@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600;700;800&family=Manrope:wght@400;500;600;700;800&display=swap');

/* =============================================================================
   Tokens
   - Marca Nodum (ink/jade) na moldura: sidebar, login, botões principais.
   - Cores de DADO (azul=receita, verde=lucro, laranja=custo, vermelho=negativo)
     são as mesmas nos dois temas; só superfícies e textos mudam.
   ============================================================================= */
:root {
  --nodum-ink-900: #1c1b1a;
  --nodum-ink-800: #2c2c2a;
  --nodum-jade-500: #1d9e75;
  --nodum-jade-400: #27b487;
  --nodum-jade-300: #9fe1cb;
  --nodum-forest-500: #146b52;
  --font-display: 'Poppins', system-ui, sans-serif;
  --font-body: 'Manrope', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body-brand: var(--font-body);

  /* Moldura (sidebar + fundo atrás da folha) — escura nos dois temas. */
  --frame: #15171b;
  --frame-2: #1d2026;
  --frame-ink: #e9ebef;
  --frame-ink-soft: #9399a6;
  --frame-line: rgba(255, 255, 255, 0.07);

  --navy-900: #16233f;
  --blue: #3b6ff5;
  --blue-light: #eaf0ff;
  --orange: #f2a33a;
  --orange-light: #fff3e2;
  --green: #16a874;
  --green-light: #e5f7ef;
  --red: #e5484d;
  --red-light: #fdeceb;
  --navy: #16233f;
  --navy-light: #eef1f6;
  --purple: #8b5cf6;
  --purple-light: #f1ebff;

  --ink: #1b2233;
  --ink-soft: #566078;
  --ink-faint: #8a93a6;
  --bg: #eef1f6;          /* fundo da "folha" de conteúdo */
  --card: #ffffff;
  --card-2: #f6f8fb;      /* superfícies internas (hover, linhas de total) */
  --border: #e3e7ef;
  --text-strong: #121826;
  --accent: var(--nodum-jade-500);
  --accent-soft: rgba(29, 158, 117, 0.12);

  --radius: 20px;
  --radius-sm: 12px;
  --notch: 18px;          /* raio das bordas invertidas */
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 12px 32px -18px rgba(17, 24, 39, 0.18);
  --sidebar-w: 256px;
}

:root[data-theme="dark"] {
  --frame: #090a0c;
  --frame-2: #15171c;
  --frame-line: rgba(255, 255, 255, 0.06);

  --ink: #e6e9ef;
  --ink-soft: #a9b0bf;
  --ink-faint: #737b8c;
  --bg: #14171d;
  --card: #1c2028;
  --card-2: #20242d;
  --border: #2a2f3a;
  --text-strong: #f5f7fa;
  --accent-soft: rgba(39, 180, 135, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 16px 36px -20px rgba(0, 0, 0, 0.7);

  --blue-light: rgba(59, 111, 245, 0.16);
  --orange-light: rgba(242, 163, 58, 0.15);
  --green-light: rgba(22, 168, 116, 0.16);
  --red-light: rgba(229, 72, 77, 0.17);
  --purple-light: rgba(139, 92, 246, 0.18);
  --navy-light: rgba(255, 255, 255, 0.07);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body { background: var(--bg); }
body.app-body { background: var(--frame); }

button { font-family: inherit; }
.icon { display: block; flex: none; }
[hidden] { display: none !important; }

/* =============================================================================
   Sidebar
   ============================================================================= */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--frame);
  color: var(--frame-ink);
  display: flex;
  flex-direction: column;
  padding: 26px 16px 18px;
  z-index: 60;
  transition: transform 0.25s ease;
}

.sidebar-brand { padding: 0 10px 26px; }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-tag {
  display: block;
  margin-top: 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--nodum-jade-300);
  opacity: 0.85;
}

/* Sem overflow aqui: a aba ativa precisa "vazar" até a folha de conteúdo. */
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
@media (max-height: 640px) { .sidebar { overflow-y: auto; } }
.nav-section {
  margin: 18px 12px 8px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--frame-ink-soft);
  opacity: 0.7;
}
.nav-section:first-child { margin-top: 0; }

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 12px;
  background: none;
  color: var(--frame-ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: var(--frame-line); color: var(--frame-ink); }
.nav-ico { display: inline-flex; width: 18px; justify-content: center; }

/* Item ativo: "aba" que se funde com a folha de conteúdo à direita, com
   bordas invertidas em cima e embaixo (recorte côncavo). */
.nav-link.active {
  background: var(--bg);
  color: var(--text-strong);
  border-radius: 14px 0 0 14px;
  margin-right: -16px;
  width: calc(100% + 16px);
}
.nav-link.active::before,
.nav-link.active::after {
  content: '';
  position: absolute;
  right: 0;
  width: var(--notch);
  height: var(--notch);
  pointer-events: none;
}
.nav-link.active::before {
  top: calc(-1 * var(--notch));
  background: radial-gradient(circle at 0 0, transparent calc(var(--notch) - 0.5px), var(--bg) var(--notch));
}
.nav-link.active::after {
  bottom: calc(-1 * var(--notch));
  background: radial-gradient(circle at 0 100%, transparent calc(var(--notch) - 0.5px), var(--bg) var(--notch));
}
.nav-link.active .nav-ico { color: var(--accent); }

.nav-cta {
  margin-bottom: 4px;
  background: var(--nodum-jade-500);
  color: #fff;
}
.nav-cta:hover { background: var(--nodum-jade-400); color: #fff; }

.sidebar-footer {
  border-top: 1px solid var(--frame-line);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.user-card { display: flex; align-items: center; gap: 10px; padding: 0 6px; min-width: 0; }
.user-avatar {
  width: 36px; height: 36px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--nodum-jade-500), var(--nodum-forest-500));
  color: #fff; font-weight: 800; font-size: 13px;
}
.user-meta { min-width: 0; display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 700; color: var(--frame-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-tag {
  display: inline-block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nodum-jade-300);
}
.sidebar-footer-actions { display: flex; gap: 8px; }
.side-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; min-width: 38px; padding: 0 12px;
  border-radius: 11px;
  border: 1px solid var(--frame-line);
  background: var(--frame-2);
  color: var(--frame-ink-soft);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.side-btn:hover { color: var(--frame-ink); border-color: rgba(255,255,255,0.14); }
.side-btn-text { flex: 1; }

.sidebar-backdrop { display: none; }

/* =============================================================================
   Folha de conteúdo (sheet) — cartão grande arredondado sobre a moldura
   ============================================================================= */
.shell { margin-left: var(--sidebar-w); padding: 12px 12px 12px 0; min-height: 100vh; }
.sheet {
  background: var(--bg);
  border-radius: 28px;
  min-height: calc(100vh - 24px);
  overflow: clip;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 30px 34px 6px;
}
.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.page-header h1 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-strong);
}
.subtitle { margin: 0; color: var(--ink-soft); font-size: 13.5px; }
.page-title { min-width: 0; }

.mobile-menu-toggle {
  display: none;
  width: 42px; height: 42px; flex: none;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  align-items: center; justify-content: center;
}

/* ---------- Botões ---------- */
.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, opacity 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--nodum-jade-500); color: #fff; }
.btn-primary:hover { background: var(--nodum-forest-500); }
.btn-ghost { background: var(--card-2); color: var(--ink); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--ink-faint); }

/* =============================================================================
   Filtros
   ============================================================================= */
.filterbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 18px 34px 0;
  padding: 14px 18px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: flex-end;
  box-shadow: var(--shadow);
}
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.select, .multiselect-toggle {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 8px 12px;
  height: 38px;
  background: var(--card-2);
  color: var(--ink);
}
.select:focus, .multiselect-toggle:focus, .field input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.range-inputs { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 13px; }

.pill-group {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  padding: 3px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.pill {
  border: none;
  background: none;
  color: var(--ink-soft);
  border-radius: 9px;
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.pill:hover { color: var(--text-strong); }
.pill.active { background: var(--card); color: var(--text-strong); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
:root[data-theme="dark"] .pill.active { background: var(--nodum-jade-500); color: #fff; }

.multiselect { position: relative; max-width: 100%; }
.multiselect-toggle {
  cursor: pointer;
  width: min(220px, calc(100vw - 64px));
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-faint) 50%), linear-gradient(135deg, var(--ink-faint) 50%, transparent 50%);
  background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.multiselect-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  width: min(270px, calc(100vw - 48px));
  max-height: 300px;
  overflow-y: auto;
  z-index: 30;
}
.ms-option { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 9px; font-size: 13px; cursor: pointer; }
.ms-option:hover { background: var(--card-2); }
.ms-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* =============================================================================
   Layout do painel
   ============================================================================= */
main#app { padding: 22px 34px 48px; }
#dashboard > * { scroll-margin-top: 110px; }

.empty-state { text-align: center; color: var(--ink-faint); padding: 90px 20px; font-size: 14px; }
.empty-ico { display: inline-flex; padding: 16px; border-radius: 18px; background: var(--card); color: var(--ink-faint); margin-bottom: 10px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- KPI cards com borda invertida ----------
   O canto superior direito de cada card é "recortado" e abriga o ícone:
   .kpi-notch tem a cor do fundo da folha e os pseudo-elementos desenham as
   duas curvas côncavas que fazem a transição suave com o card. */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
@media (max-width: 1280px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  min-width: 0;
}
.kpi-notch {
  position: absolute;
  top: 0; right: 0;
  width: 58px; height: 58px;
  background: var(--bg);
  border-bottom-left-radius: var(--notch);
}
.kpi-notch::before,
.kpi-notch::after {
  content: '';
  position: absolute;
  width: var(--notch);
  height: var(--notch);
  background: radial-gradient(circle at 0 100%, transparent calc(var(--notch) - 0.5px), var(--bg) var(--notch));
}
.kpi-notch::before { top: 0; left: calc(-1 * var(--notch)); }
.kpi-notch::after { bottom: calc(-1 * var(--notch)); right: 0; }
.kpi-icon {
  position: absolute;
  top: 6px; right: 6px;
  width: 46px; height: 46px;
  border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
}

.kpi-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 2px 52px 10px 0;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 10px;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.arrow-icon { display: inline-block; vertical-align: -1px; margin-right: 1px; }
.kpi-delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 800;
  border-radius: 8px;
  padding: 3px 8px;
  margin-bottom: 6px;
}
.kpi-delta.up { background: var(--green-light); color: var(--green); }
.kpi-delta.down { background: var(--red-light); color: var(--red); }
.kpi-delta.flat { background: var(--card-2); color: var(--ink-faint); }
.kpi-compare { font-size: 11.5px; color: var(--ink-faint); }

/* ---------- Painéis ---------- */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-top: 18px;
  min-width: 0;
}
.grid-2 > .panel { margin-top: 0; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.panel h2 { font-size: 15.5px; font-weight: 800; margin: 0 0 4px; color: var(--text-strong); letter-spacing: -0.005em; }
.panel-sub { font-size: 12.5px; color: var(--ink-faint); margin: 0; }

.chart-wrap { position: relative; height: 300px; }
.chart-tall { height: 340px; }
.chart-donut { height: 240px; }

.donut-panel { container-type: inline-size; }
.donut-layout { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: center; gap: 16px; }
/* Painel estreito: donut em cima, legenda embaixo (senão as colunas cortam). */
@container (max-width: 560px) {
  .donut-layout { grid-template-columns: 1fr; }
}
.legend-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.legend-list li { display: flex; align-items: center; justify-content: space-between; font-size: 13px; gap: 12px; }
.legend-list .lg-left { display: flex; align-items: center; gap: 9px; color: var(--ink-soft); min-width: 0; }
.legend-list .lg-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-list .lg-value { font-weight: 800; color: var(--text-strong); }
.legend-list .lg-value-pair { display: flex; gap: 14px; flex: none; }
.legend-list .lg-value-pair > span { width: 56px; text-align: right; }
.legend-list .lg-value-muted { color: var(--ink-faint); font-weight: 600; }
.legend-list .legend-head { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.legend-list .legend-head .lg-value-pair > span { font-weight: 800; }

/* ---------- Gauges ---------- */
.gauge-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .gauge-row { grid-template-columns: 1fr; } }
.gauge-card { text-align: center; background: var(--card-2); border-radius: var(--radius-sm); padding: 14px 10px 16px; }
.gauge-value { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--text-strong); margin-top: -36px; }
.gauge-title { font-size: 12px; font-weight: 600; color: var(--ink-faint); margin-top: 2px; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 11px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
  font-weight: 800;
  border-bottom-width: 1px;
}
.data-table tbody tr:hover { background: var(--card-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td.positive { color: var(--green); font-weight: 800; }
.data-table td.negative { color: var(--red); font-weight: 800; }
.data-table td.company-swatch-cell { display: flex; align-items: center; gap: 8px; }
.data-table .rbt-col { color: var(--ink-faint); font-size: 12px; font-weight: 600; }
.data-table .total-row td { font-weight: 800; color: var(--text-strong); background: var(--card-2); }

/* DRE: linhas de resultado (subtotais) em destaque; sub-grupos recuados. */
.dre-table td:first-child { font-weight: 600; color: var(--ink); }
.dre-table tr.dre-subtotal td { background: var(--card-2); color: var(--text-strong); font-weight: 800; }
.dre-table tr.dre-subtotal td:first-child { border-radius: 10px 0 0 10px; }
.dre-table tr.dre-subtotal td:last-child { border-radius: 0 10px 10px 0; }
.dre-table tr.dre-child td:first-child { padding-left: 30px; font-weight: 500; color: var(--ink-soft); }
.dre-table tr.dre-final td { background: var(--accent-soft); }
.dre-table tr.dre-metric td { color: var(--ink-soft); font-style: italic; }
.dre-table .val-neg { color: var(--ink-soft); }

/* =============================================================================
   Modais
   ============================================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, 0.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--card);
  border-radius: 22px;
  width: 100%;
  max-width: 480px;
  padding: 24px 26px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.5);
  max-height: 88vh;
  overflow-y: auto;
}
.modal.modal-wide { max-width: 680px; }
.modal-divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.modal-subheading { font-size: 13.5px; color: var(--text-strong); margin: 0 0 12px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-header h3 { margin: 0; font-size: 17px; font-family: var(--font-display); font-weight: 700; color: var(--text-strong); }
.modal-close {
  background: var(--card-2); border: none; cursor: pointer; color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
}
.modal-close:hover { color: var(--ink); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.modal-hint { font-size: 11.5px; color: var(--ink-faint); margin: 14px 0 0; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.field-hint { font-style: normal; font-weight: 500; color: var(--ink-faint); }
.field input, .field .select {
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 12px;
  background: var(--card-2);
  color: var(--ink);
  height: auto;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.checkbox-list {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 8px 10px;
  max-height: 160px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.checkbox-list label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink); }

.role-pill { display: inline-block; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 9px; border-radius: 999px; }
.role-pill.admin { background: var(--blue-light); color: var(--blue); }
.role-pill.client { background: var(--green-light); color: var(--green); }
.btn-icon-danger { background: none; border: none; color: var(--red); cursor: pointer; font-size: 12.5px; font-weight: 800; }

/* ---------- Upload: dropzone + lista de arquivos ---------- */
.dropzone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 26px 16px;
  margin-bottom: 12px;
  border: 1.5px dashed var(--border);
  border-radius: 16px;
  background: var(--card-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-ico { color: var(--accent); }
.dropzone strong { font-size: 14px; color: var(--text-strong); }
.dz-hint { font-size: 12px; color: var(--ink-faint); }

.file-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-list li, .upload-line {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 12px;
  border-radius: 11px;
  background: var(--card-2);
  font-size: 12.5px;
}
.file-list .f-name, .upload-line .f-name { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--ink); font-weight: 600; }
.file-list .f-size { color: var(--ink-faint); flex: none; }

#uploadResult { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.upload-line .f-status { flex: none; max-width: 60%; text-align: right; font-weight: 700; }
.upload-line.ok .f-status, .upload-line.ok .u-ico { color: var(--green); }
.upload-line.fail .f-status, .upload-line.fail .u-ico { color: var(--red); }
.upload-line.fail { background: var(--red-light); }
.upload-progress { font-size: 13px; color: var(--ink-soft); }

/* =============================================================================
   Responsivo
   ============================================================================= */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: 20px 0 60px rgba(0,0,0,0.35); }
  .sidebar.open { transform: none; }
  .nav-link.active { margin-right: 0; width: 100%; border-radius: 12px; }
  .nav-link.active::before, .nav-link.active::after { display: none; }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(0,0,0,0.45);
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  }
  .sidebar.open + .sidebar-backdrop { opacity: 1; pointer-events: auto; }

  .shell { margin-left: 0; padding: 0; }
  body.app-body { background: var(--bg); }
  .sheet { border-radius: 0; min-height: 100vh; }
  .mobile-menu-toggle { display: inline-flex; }
}

@media (max-width: 768px) {
  .page-header { padding: 18px 16px 4px; align-items: flex-start; }
  .page-header h1 { font-size: 19px; }
  .eyebrow { font-size: 10px; }
  .subtitle { font-size: 12.5px; }

  .filterbar { position: static; margin: 14px 16px 0; padding: 14px; gap: 12px; }
  .filter-group { width: 100%; }
  .multiselect-toggle, .select { width: 100%; }
  .pill-group { width: 100%; }
  .pill { flex: 1 1 auto; }

  main#app { padding: 16px 16px 40px; }
  .kpi-grid { gap: 12px; }
  .kpi-card { padding: 16px 14px 14px; }
  .kpi-value { font-size: 18px; }

  .panel { padding: 16px; }
  .panel-header { flex-direction: column; gap: 8px; }
  .chart-tall { height: 260px; }
  .chart-wrap { height: 250px; }
  .chart-donut { height: 200px; }
  .donut-layout { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .modal { padding: 18px 16px; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 9px 10px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .gauge-value { font-size: 20px; }
}

/* =============================================================================
   Modais de administração, confirmação e avisos
   ============================================================================= */
.modal-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-faint); }
.modal-overlay.modal-top { z-index: 120; }
.modal.modal-sm { max-width: 400px; text-align: center; }
.modal-header .header-back { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: none; cursor: pointer;
  background: var(--card-2); color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.icon-btn:hover { color: var(--text-strong); }
.icon-btn.danger:hover { color: var(--red); background: var(--red-light); }
.link-btn { background: none; border: none; padding: 0; margin-left: 8px; color: var(--accent); font-weight: 700; font-size: 12px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.search-box {
  flex: 1; min-width: 0; position: relative; display: flex; align-items: center;
}
.search-box > span { position: absolute; left: 12px; color: var(--ink-faint); display: inline-flex; pointer-events: none; }
.search-box input {
  width: 100%; height: 40px; padding: 0 12px 0 38px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--card-2); color: var(--ink); font: inherit; font-size: 13.5px;
}
.search-box input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.entity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.entity-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--card-2);
  border: 1px solid transparent;
  border-radius: 16px;
}
.entity-row:hover { border-color: var(--border); }
.entity-avatar {
  width: 40px; height: 40px; flex: none; border-radius: 13px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--nodum-jade-500), var(--nodum-forest-500));
}
.entity-avatar.sw { font-size: 0; }
.entity-main { flex: 1; min-width: 0; }
.entity-title { font-size: 14px; font-weight: 700; color: var(--text-strong); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.entity-meta { margin-top: 3px; font-size: 12px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-actions { display: flex; gap: 6px; flex: none; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
}
.chip.warn { background: var(--orange-light); color: var(--orange); }
.chip.you { background: var(--card); color: var(--ink-soft); border: 1px solid var(--border); }
.list-empty { text-align: center; color: var(--ink-faint); padding: 28px 10px; font-size: 13.5px; }

.notice { display: flex; gap: 10px; align-items: flex-start; border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.45; margin-bottom: 12px; }
.notice-warn { background: var(--orange-light); color: var(--text-strong); }
.notice-warn .icon { color: var(--orange); flex: none; margin-top: 1px; }

.reset-box { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.reset-box strong { display: block; font-size: 13.5px; color: var(--text-strong); margin-bottom: 4px; }
.reset-box p { margin: 0 0 10px; font-size: 12.5px; color: var(--ink-soft); }
.reset-box .pw-row input { font-size: 12px; }

.pw-row { display: flex; gap: 8px; }
.pw-row input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg {
  text-align: left; cursor: pointer; font: inherit;
  padding: 11px 13px; border-radius: 14px;
  border: 1.5px solid var(--border); background: var(--card-2); color: var(--ink);
  display: flex; flex-direction: column; gap: 3px;
}
.seg strong { font-size: 13.5px; }
.seg small { font-size: 11.5px; color: var(--ink-faint); font-weight: 500; }
.seg.active { border-color: var(--accent); background: var(--accent-soft); }

.form-error { background: var(--red-light); color: var(--red); border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }

.confirm-ico { width: 52px; height: 52px; border-radius: 18px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--orange-light); color: var(--orange); }
.confirm-ico.danger { background: var(--red-light); color: var(--red); }
.modal.modal-sm h3 { margin: 0 0 8px; font-family: var(--font-display); font-size: 17px; color: var(--text-strong); }
.confirm-msg { margin: 0 0 16px; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); }
.modal.modal-sm .field { text-align: left; }
.modal.modal-sm .modal-actions { justify-content: center; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); }

.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--orange); color: #1c1b1a; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }
button.user-card { background: none; border: none; width: 100%; text-align: left; cursor: pointer; border-radius: 12px; padding: 6px; font: inherit; color: inherit; }
button.user-card:hover { background: var(--frame-line); }

.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 340px;
  padding: 12px 14px; border-radius: 14px; font-size: 13px; font-weight: 600;
  background: var(--text-strong); color: var(--bg);
  box-shadow: 0 14px 40px -12px rgba(0,0,0,0.5);
  animation: toast-in 0.2s ease;
}
.toast.ok .icon { color: var(--nodum-jade-400); }
.toast.err .icon { color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 768px) {
  .toolbar { flex-direction: column; }
  .entity-row { flex-wrap: wrap; }
  .entity-actions { width: 100%; justify-content: flex-end; }
  .segmented { grid-template-columns: 1fr; }
  .toast-stack { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; }
}

/* Importações */
.bulkbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; margin-bottom: 10px; border-radius: 14px; background: var(--red-light); font-size: 13px; font-weight: 700; color: var(--text-strong); }
.bulkbar .btn { padding: 7px 12px; font-size: 12.5px; }
.import-group { list-style: none; margin: 14px 2px 6px; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.import-group label { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; cursor: pointer; }
.pick { width: 17px; height: 17px; flex: none; accent-color: #1d9e75; cursor: pointer; }
.chip.new { background: var(--green-light); color: var(--green); }
.chip.repl { background: var(--blue-light); color: var(--blue); }
