/* ═══════════════════════════════════════════════════════════════════════
   CONCEITO — Gestão Tributária IBS/CBS · Design System
   Paleta derivada do logo: navy #0D2B55 · aço #8A94A6 · dourado #F4B942
   Temas light/dark via tokens semânticos em [data-theme]
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  /* marca */
  --brand-navy: #0D2B55;
  --brand-navy-2: #1F497D;
  --brand-blue: #2E75B6;
  --brand-gold: #F4B942;
  --brand-gold-soft: #f8d585;

  /* tokens semânticos — LIGHT */
  --bg: #F2F5F9;
  --bg-gradient: radial-gradient(1200px 600px at 85% -10%, #dbe7f5 0%, transparent 60%), #F2F5F9;
  --surface: #FFFFFF;
  --surface-2: #F7FAFD;
  --surface-3: #EDF2F8;
  --border: #DCE4EE;
  --border-strong: #C3D0E0;
  --text: #16202B;
  --text-2: #4A5A6E;
  --text-3: #7B8A9D;
  --heading: #0D2B55;
  --accent: #0D2B55;
  --accent-contrast: #F4B942;
  --link: #1F5FA8;
  --ok: #157A3C;
  --err: #B3261E;
  --warn-bg: #FFF7E0;
  --warn-border: #F4B942;
  --warn-text: #6B4E00;
  --input-bg: #FFFFFF;
  --input-border: #C3D0E0;
  --table-head: #0D2B55;
  --table-head-text: #FFFFFF;
  --row-hover: #F0F5FB;
  --shadow-card: 0 1px 2px rgba(13, 43, 85, .06), 0 4px 16px rgba(13, 43, 85, .07);
  --shadow-card-hover: 0 2px 4px rgba(13, 43, 85, .08), 0 10px 28px rgba(13, 43, 85, .12);
  --glow-gold: none;
  --glow-blue: none;
  --glow-text-gold: none;
  --glow-text-blue: none;
  --sidebar-bg: #0D2B55;
  --sidebar-bg-2: #0A2244;
  --sidebar-text: #B9C9DF;
  --sidebar-active: rgba(244, 185, 66, .14);
  --sidebar-active-text: #F4B942;
  --logo-chip-bg: #FFFFFF;
  --chart-grid: rgba(13, 43, 85, .08);
  --chart-ticks: #4A5A6E;
}

[data-theme="dark"] {
  --bg: #080F1D;
  --bg-gradient: radial-gradient(1100px 560px at 80% -12%, rgba(46, 117, 182, .16) 0%, transparent 60%),
                 radial-gradient(900px 500px at -10% 110%, rgba(244, 185, 66, .07) 0%, transparent 55%),
                 #080F1D;
  --surface: #0E1930;
  --surface-2: #12203B;
  --surface-3: #16264472;
  --border: #1E3050;
  --border-strong: #2A4066;
  --text: #E4ECF7;
  --text-2: #9FB2CC;
  --text-3: #6E82A0;
  --heading: #EAF1FA;
  --accent: #F4B942;
  --accent-contrast: #0D2B55;
  --link: #6FB3F0;
  --ok: #4ADE80;
  --err: #FF7B72;
  --warn-bg: rgba(244, 185, 66, .09);
  --warn-border: rgba(244, 185, 66, .45);
  --warn-text: #F4CE7E;
  --input-bg: #0B1526;
  --input-border: #27395C;
  --table-head: #10203C;
  --table-head-text: #CFE0F5;
  --row-hover: #14243F;
  --shadow-card: 0 0 0 1px rgba(63, 131, 211, .13), 0 8px 28px rgba(0, 0, 0, .45);
  --shadow-card-hover: 0 0 0 1px rgba(94, 160, 231, .3), 0 0 26px rgba(46, 117, 182, .22), 0 10px 34px rgba(0, 0, 0, .5);
  --glow-gold: 0 0 0 1px rgba(244, 185, 66, .28), 0 0 26px rgba(244, 185, 66, .13);
  --glow-blue: 0 0 0 1px rgba(94, 160, 231, .3), 0 0 26px rgba(46, 117, 182, .18);
  --glow-text-gold: 0 0 16px rgba(244, 185, 66, .55);
  --glow-text-blue: 0 0 16px rgba(111, 179, 240, .55);
  --sidebar-bg: #0A1426;
  --sidebar-bg-2: #081020;
  --sidebar-text: #93A7C4;
  --sidebar-active: rgba(244, 185, 66, .12);
  --sidebar-active-text: #F4B942;
  --logo-chip-bg: #E9EEF6;
  --chart-grid: rgba(159, 178, 204, .12);
  --chart-ticks: #9FB2CC;
}

/* ── base ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  transition: background-color .3s ease, color .3s ease;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ── shell / sidebar ──────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100dvh; }

.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 40;
  border-right: 1px solid rgba(255, 255, 255, .06);
  transition: width .26s cubic-bezier(.4, 0, .2, 1);
}

/* ── Sidebar rail / mini (modo compacto — só ícones) ──────────────────────
   Só no desktop; no mobile a sidebar já é off-canvas (média 860px abaixo). */
.rail-ico { transition: transform .26s ease; }
@media (min-width: 861px) {
  .sidebar.rail { width: 74px !important; min-width: 74px !important; flex: 0 0 74px !important; }
  .sidebar.rail .sidebar__logo { padding: 16px 8px 14px; }
  .sidebar.rail .sidebar__logo img { max-width: 42px; height: 36px; object-fit: cover; object-position: left center; }
  .sidebar.rail .sidebar__logo::before { width: 58px; height: 58px; }
  .sidebar.rail .nav-section { font-size: 0; padding: 14px 0 4px; text-align: center; }
  .sidebar.rail .nav-section::before { margin: 0 auto; }
  .sidebar.rail .nav-section__ctx { display: none; }
  .sidebar.rail .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
  .sidebar.rail .nav-item > span:not(.nav-badge) { display: none; }
  .sidebar.rail .nav-item:not(.active):hover { transform: none; }
  .sidebar.rail .nav-badge { position: absolute; top: 7px; right: 15px; min-width: 8px; width: 8px; height: 8px; padding: 0; font-size: 0; border-radius: 50%; }
  .sidebar.rail .sidebar__lawref { display: none; }
  .sidebar.rail .theme-toggle__label { display: none; }
  .sidebar.rail .theme-toggle { justify-content: center; }
  .sidebar.rail .rail-ico { transform: rotate(180deg); }
}
@media (max-width: 860px) { .rail-toggle { display: none; } }

.sidebar__logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  position: relative;
}
/* Neon backlight: claridade radial atrás do logo — substitui o antigo chip
   branco. Dá profundidade e "acende" o fundo do logo na sidebar escura. */
.sidebar__logo::before {
  content: "";
  position: absolute;
  left: 50%; top: 47%;
  transform: translate(-50%, -50%);
  width: 210px; height: 92px;
  background: radial-gradient(ellipse at center,
    rgba(244, 185, 66, .28), rgba(94, 160, 231, .16) 46%, transparent 72%);
  filter: blur(7px);
  pointer-events: none;
  z-index: 0;
}
.sidebar__logo img {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 196px;
  display: block;
  margin: 0 auto;
  /* O logo é navy — invisível na sidebar navy. Vira silhueta clara + glow neon
     (dourado/azul da marca) que o destaca sem nenhum polígono branco atrás. */
  filter: brightness(0) invert(1)
    drop-shadow(0 0 5px rgba(244, 185, 66, .55))
    drop-shadow(0 0 13px rgba(94, 160, 231, .38));
  transition: filter .3s ease;
}
.sidebar__logo:hover img {
  filter: brightness(0) invert(1)
    drop-shadow(0 0 7px rgba(244, 185, 66, .8))
    drop-shadow(0 0 18px rgba(94, 160, 231, .5));
}

.sidebar__nav { flex: 1; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 9px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .01em;
  transition: background .18s ease, color .18s ease;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand-gold);
}
.nav-badge {
  margin-left: auto;
  background: var(--brand-gold);
  color: #0D2B55;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 8px;
}

.sidebar__footer { padding: 14px 16px 18px; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 12px; }
.sidebar__lawref { display: grid; font-size: 11px; line-height: 1.45; }
.sidebar__lawref strong { color: var(--brand-gold); font-size: 12.5px; letter-spacing: .04em; }

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 9px;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s ease;
}
.theme-toggle:hover { background: rgba(255, 255, 255, .13); }
.theme-toggle svg { width: 17px; height: 17px; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }

/* ── topbar ───────────────────────────────────────────────────────────── */
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 30px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar__titles h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--heading);
}
.topbar__titles .accent { color: var(--brand-gold); }
[data-theme="dark"] .topbar__titles .accent { text-shadow: var(--glow-text-gold); }
.topbar__titles p { margin: 2px 0 0; font-size: 12px; color: var(--text-3); }
.topbar__meta { margin-left: auto; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  background: var(--surface-2);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }

.hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px;
  color: var(--text-2);
  cursor: pointer;
}
.hamburger svg { width: 20px; height: 20px; display: block; }

/* ── banner legal ─────────────────────────────────────────────────────── */
.legal-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--warn-bg);
  color: var(--warn-text);
  border-bottom: 1px solid var(--warn-border);
  padding: 11px 30px;
  font-size: 12.5px;
  line-height: 1.55;
}
.legal-banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; color: var(--warn-border); }

/* ── container / cards ────────────────────────────────────────────────── */
/* Largura expansiva: o corpo ocupa ~95% da área disponível (antes travado em
   1240px), acompanhando a sidebar retrátil. Cards, grids, gráficos e planilhas
   herdam por serem 100% do container. */
.container { max-width: 95%; width: 100%; margin: 0 auto; padding: 26px clamp(20px, 2.5vw, 40px) 70px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 26px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-card);
  transition: box-shadow .25s ease, border-color .25s ease;
}
.card:hover { box-shadow: var(--shadow-card-hover); }

.card__head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.card__head h2 { margin: 0; font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; color: var(--heading); }
.card__desc { margin: 3px 0 0; font-size: 12.5px; color: var(--text-3); }

.step-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--brand-navy);
  color: var(--brand-gold);
  font-weight: 800;
  font-size: 14px;
}
[data-theme="dark"] .step-num { background: var(--brand-gold); color: #0D2B55; box-shadow: var(--glow-gold); }
.step-num.warn { background: var(--warn-border); color: #4a3800; }
.step-num.ok { background: var(--ok); color: #fff; }

.hint { color: var(--text-3); font-weight: 400; font-size: 11.5px; }

/* ── KPI strip ────────────────────────────────────────────────────────── */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  display: grid;
  gap: 3px;
  box-shadow: var(--shadow-card);
  transition: transform .2s ease, box-shadow .25s ease;
}
.kpi-card:hover { transform: translateY(-2px); }
.kpi-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.kpi-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}
.kpi-sub { font-size: 11px; color: var(--text-3); }
[data-theme="dark"] .kpi-glow-gold { box-shadow: var(--glow-gold); border-color: rgba(244,185,66,.35); }
[data-theme="dark"] .kpi-glow-gold .kpi-value { color: var(--brand-gold); text-shadow: var(--glow-text-gold); }
[data-theme="dark"] .kpi-glow-blue { box-shadow: var(--glow-blue); border-color: rgba(94,160,231,.4); }
[data-theme="dark"] .kpi-glow-blue .kpi-value { color: #6FB3F0; text-shadow: var(--glow-text-blue); }

/* ── forms ────────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 22px; margin-bottom: 18px; }
.grid-span-2 { grid-column: 1 / span 2; }

.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  min-height: 42px;
  border: 1px solid var(--input-border);
  border-radius: 9px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-blue) 22%, transparent);
}

.actions-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ── buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: none;
  border-radius: 9px;
  padding: 11px 22px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .18s ease, transform .12s ease, box-shadow .2s ease;
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--brand-navy); color: var(--brand-gold); }
.btn-primary:hover { background: var(--brand-navy-2); box-shadow: 0 4px 16px rgba(13,43,85,.3); }
[data-theme="dark"] .btn-primary {
  background: var(--brand-gold);
  color: #0D2B55;
  box-shadow: 0 0 20px rgba(244,185,66,.18);
}
[data-theme="dark"] .btn-primary:hover { background: var(--brand-gold-soft); box-shadow: 0 0 28px rgba(244,185,66,.32); }

.btn-secondary { background: var(--surface-3); color: var(--heading); border: 1px solid var(--border-strong); margin-top: 10px; }
.btn-secondary:hover { background: var(--row-hover); }

.btn-danger { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); font-size: 12px; padding: 5px 12px; min-height: 30px; }
.btn-danger:hover { background: color-mix(in srgb, var(--err) 24%, transparent); }

/* ── status ───────────────────────────────────────────────────────────── */
.status { font-size: 13px; font-weight: 600; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.status.warn { color: var(--warn-text); }
.status.busy { color: var(--link); }
.status.busy::before {
  content: "";
  display: inline-block;
  width: 12px; height: 12px;
  margin-right: 7px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── avisos ───────────────────────────────────────────────────────────── */
.card-warn { border-color: var(--warn-border); }
.avisos-list { margin: 0; padding-left: 20px; font-size: 13px; color: var(--warn-text); }
.avisos-list li { margin-bottom: 5px; }

/* ── nota-card ────────────────────────────────────────────────────────── */
.nota-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 18px;
  overflow: hidden;
  background: var(--surface);
  transition: box-shadow .25s ease, border-color .25s ease;
}
[data-theme="dark"] .nota-card:hover { border-color: var(--border-strong); box-shadow: var(--glow-blue); }

.nota-card__header {
  background: var(--table-head);
  color: var(--table-head-text);
  padding: 10px 16px;
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.nota-card__header .arquivo { font-weight: 600; word-break: break-all; }
.confianca-baixa, .confianca-alta {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  margin-left: 8px;
  white-space: nowrap;
}
.confianca-baixa { background: rgba(244,185,66,.22); color: #ffd98a; }
.confianca-alta { background: rgba(74,222,128,.16); color: #7CE38B; }

.nota-card__body { padding: 15px 16px; background: var(--surface-2); }

.mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 14px; margin-bottom: 12px; }
.mini-field label { display: block; font-size: 11px; font-weight: 600; color: var(--text-2); margin-bottom: 3px; }
.mini-field input, .mini-field select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--input-border);
  border-radius: 7px;
  font-size: 12.5px;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
}
.mini-field input:focus, .mini-field select:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-blue) 22%, transparent);
}

/* ── tabela de itens ──────────────────────────────────────────────────── */
.itens-scroll { overflow-x: auto; border-radius: 9px; border: 1px solid var(--border); }
table.itens-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: var(--surface);
  min-width: 900px;
}
table.itens-table th {
  background: var(--table-head);
  color: var(--table-head-text);
  padding: 9px 7px;
  text-align: center;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
table.itens-table td { border-bottom: 1px solid var(--border); padding: 4px 5px; }
table.itens-table tbody tr { transition: background .12s ease; }
table.itens-table tbody tr:hover { background: var(--row-hover); }
[data-theme="dark"] table.itens-table tbody tr:hover { box-shadow: inset 3px 0 0 var(--brand-gold); }
table.itens-table td input {
  width: 100%;
  border: none;
  padding: 5px 4px;
  font-size: 12.5px;
  font-family: inherit;
  background: transparent;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
table.itens-table td input:focus { outline: 2px solid var(--brand-blue); outline-offset: -2px; border-radius: 4px; background: var(--surface-2); }
tr.revisar { background: color-mix(in srgb, var(--brand-gold) 12%, transparent); }
[data-theme="dark"] tr.revisar { box-shadow: inset 3px 0 0 var(--brand-gold); }

.avisos-nota { font-size: 11.5px; color: var(--warn-text); margin: 8px 0 0; padding-left: 16px; }

/* ── HERO: impacto da reforma (diferencial do sistema) ──────────────────── */
.reforma-hero {
  border: 1px solid color-mix(in srgb, var(--brand-gold) 45%, var(--border));
  border-radius: 16px;
  padding: 20px 22px 22px;
  margin-bottom: 22px;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--brand-gold) 12%, transparent) 0%, transparent 55%),
    var(--surface-2);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand-gold) 18%, transparent), var(--shadow-card);
}
[data-theme="dark"] .reforma-hero { background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--brand-gold) 16%, transparent) 0%, transparent 55%),
    var(--surface-3);
  box-shadow: 0 0 26px color-mix(in srgb, var(--brand-gold) 14%, transparent), var(--shadow-card); }
.reforma-hero__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.reforma-hero__eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--brand-gold); }
.reforma-hero__title { margin: 4px 0 4px; font-size: 20px; font-weight: 800; letter-spacing: -.01em; color: var(--heading); }
.reforma-hero__sub { margin: 0; font-size: 13px; color: var(--text-2); max-width: 720px; line-height: 1.5; }
.reforma-hero__cta { margin-top: 2px; white-space: nowrap; text-decoration: none; }
.reforma-hero .kpi-strip-4 { margin-bottom: 18px; }
.reforma-hero__grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: stretch; }
@media (max-width: 900px) { .reforma-hero__grid { grid-template-columns: 1fr; } .reforma-hero__head { flex-direction: column; } }
.reforma-hero__note {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
  font-size: 13px; color: var(--text-2); line-height: 1.55;
}
.reforma-hero__note h4 { margin: 0 0 10px; font-size: 13.5px; font-weight: 700; color: var(--heading); }
.reforma-hero__note ul { margin: 0; padding-left: 18px; display: grid; gap: 9px; }
.reforma-hero__note a { color: var(--brand-blue); font-weight: 600; text-decoration: none; border-bottom: 1px dashed color-mix(in srgb, var(--brand-blue) 50%, transparent); }
.reforma-hero__note a:hover { border-bottom-style: solid; }

/* ── charts ───────────────────────────────────────────────────────────── */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chart-card--wide { grid-column: 1 / -1; }
.chart-card {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  transition: box-shadow .28s ease, border-color .28s ease, transform .28s ease;
  min-width: 0; /* permite o card encolher no grid (senão o canvas força overflow) */
}
.chart-box canvas { max-width: 100%; }
/* Fio de luz no topo do card, revelado no hover (neon sutil da marca). */
.chart-card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 2px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(90deg, transparent, var(--brand-gold), var(--brand-blue), transparent);
  opacity: 0; transition: opacity .28s ease;
  pointer-events: none;
}
.chart-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-3px);
}
.chart-card:hover::before { opacity: .85; }
[data-theme="dark"] .chart-card { background: var(--surface-3); }
[data-theme="dark"] .chart-card:hover::before { opacity: 1; }

/* Split de regime de caixa sob os donuts (Recebido/A receber, Pago/A pagar) */
.caixa-split { display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; padding: 10px 2px 2px; border-top: 1px dashed var(--border); margin-top: 8px; }
.caixa-split:empty { display: none; }
.caixa-split__real { font-size: 14px; }
.caixa-split__real strong { font-size: 15px; }
.caixa-split__aberto { font-size: 12px; color: var(--text-3); }
[data-theme="dark"] .chart-card:hover {
  border-color: rgba(94,160,231,.55);
  box-shadow: 0 0 0 1px rgba(94,160,231,.35), 0 0 30px rgba(46,117,182,.28), 0 10px 34px rgba(0,0,0,.5);
}
.chart-card h3 { margin: 0 0 12px; font-size: 13.5px; font-weight: 700; color: var(--heading); }
.chart-box { position: relative; height: 280px; }
.chart-card--wide .chart-box { height: 320px; }

/* ── resultado ────────────────────────────────────────────────────────── */
.resultado-box {
  background: linear-gradient(135deg, var(--brand-navy) 0%, #163a6b 100%);
  color: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
}
[data-theme="dark"] .resultado-box {
  background: linear-gradient(135deg, #10203C 0%, #0C1730 100%);
  border: 1px solid rgba(244,185,66,.3);
  box-shadow: var(--glow-gold);
}
.resultado-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.resultado-grid > div > div:first-child { font-size: 12.5px; color: #B9C9DF; font-weight: 600; }
.resultado-box .saldo {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--brand-gold);
  font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .resultado-box .saldo { text-shadow: var(--glow-text-gold); }
.resultado-meta { font-size: 12px; margin-top: 12px; color: #B9C9DF; }
.resultado-note { font-size: 11px; color: #8FA5C4; }

.validacao-ok { color: var(--ok); font-weight: 700; }
.validacao-err { color: var(--err); font-weight: 700; }
.caminho-arquivo {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 9px 13px;
  border-radius: 8px;
  word-break: break-all;
}

/* ── footer ───────────────────────────────────────────────────────────── */
.footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 30px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
  background: var(--surface);
}
.footer img { height: 24px; opacity: .9; }

/* ── responsivo ───────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .mini-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 8px 0 40px rgba(0,0,0,.35);
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: block; }
  .container { padding: 18px 16px 60px; }
  .topbar { padding: 12px 16px; }
  .legal-banner { padding: 10px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-span-2 { grid-column: auto; }
  .kpi-strip { grid-template-columns: 1fr; }
  .resultado-grid { grid-template-columns: 1fr; }
}

/* ═══ SPA multi-abas (Dashboard · Carteira · Importações · Revisão ·
       Apurações · Extratos · SEFAZ · Configurações) ═══ */

.view { display: none; animation: fadeview .18s ease; }
.view.active { display: block; }
@keyframes fadeview { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* barra de filtros do dashboard */
.filter-bar { padding: 18px 22px; }
.filter-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr;
  gap: 12px 14px;
  margin-bottom: 14px;
}
@media (max-width: 1080px) { .filter-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .filter-grid { grid-template-columns: 1fr; } }

.kpi-strip-8 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1080px) { .kpi-strip-8 { grid-template-columns: repeat(2, 1fr); } }

/* badges de status e contribuinte */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-ok     { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge-err    { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }
.badge-warn   { background: color-mix(in srgb, var(--brand-gold) 22%, transparent); color: var(--warn-text); }
.badge-info   { background: color-mix(in srgb, var(--brand-blue) 16%, transparent); color: var(--link); }
.badge-neutro { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }

.saldo-credor  { color: var(--ok); font-weight: 800; font-variant-numeric: tabular-nums; }
.saldo-devedor { color: var(--err); font-weight: 800; font-variant-numeric: tabular-nums; }

/* botões compactos em tabelas */
.btn-mini { padding: 4px 12px; min-height: 28px; font-size: 11.5px; border-radius: 7px; margin-top: 0; }

/* slider de cenário */
input[type="range"] {
  width: 100%;
  accent-color: var(--brand-gold);
  height: 34px;
}

/* selects e inputs dentro de tabelas */
table.itens-table td select {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
}
table.itens-table td a { color: var(--link); font-weight: 700; text-decoration: none; }
table.itens-table td a:hover { text-decoration: underline; }

/* pill do cliente selecionado */
#pillCliente { border-color: var(--brand-gold); color: var(--warn-text); background: var(--warn-bg); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══ Glow (brilho) — destaque dos indicadores ═══ */
.chart-glow-gold { border-color: color-mix(in srgb, var(--brand-gold) 45%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand-gold) 25%, transparent), 0 0 22px color-mix(in srgb, var(--brand-gold) 18%, transparent); }
.chart-glow-blue { border-color: color-mix(in srgb, var(--brand-blue) 45%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand-blue) 25%, transparent), 0 0 22px color-mix(in srgb, var(--brand-blue) 16%, transparent); }
[data-theme="dark"] .chart-glow-gold { box-shadow: var(--glow-gold); }
[data-theme="dark"] .chart-glow-blue { box-shadow: var(--glow-blue); }
[data-theme="dark"] .chart-glow-gold h3, [data-theme="dark"] .chart-glow-gold .hint { text-shadow: 0 0 12px rgba(244,185,66,.35); }

/* brilho nos valores de saldo e KPIs (tema claro ganha versão suave) */
.kpi-glow-gold { border-color: color-mix(in srgb, var(--brand-gold) 40%, transparent); box-shadow: 0 0 18px color-mix(in srgb, var(--brand-gold) 20%, transparent), var(--shadow-card); }
.kpi-glow-blue { border-color: color-mix(in srgb, var(--brand-blue) 40%, transparent); box-shadow: 0 0 18px color-mix(in srgb, var(--brand-blue) 18%, transparent), var(--shadow-card); }
.kpi-glow-gold .kpi-value { color: color-mix(in srgb, var(--brand-gold) 70%, var(--heading)); text-shadow: 0 0 14px color-mix(in srgb, var(--brand-gold) 40%, transparent); }
.kpi-glow-blue .kpi-value { color: color-mix(in srgb, var(--brand-blue) 75%, var(--heading)); text-shadow: 0 0 14px color-mix(in srgb, var(--brand-blue) 35%, transparent); }
[data-theme="dark"] .saldo-credor { text-shadow: 0 0 12px color-mix(in srgb, var(--ok) 55%, transparent); }
[data-theme="dark"] .saldo-devedor { text-shadow: 0 0 12px color-mix(in srgb, var(--err) 55%, transparent); }
[data-theme="dark"] .nav-badge { box-shadow: 0 0 14px rgba(244,185,66,.5); }

/* ── Comparativo Reforma × Hoje (Fase 3) ─────────────────────────────────── */
.comp-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; margin-top: 4px; }
.comp-col h3 { margin: 0 0 8px; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.comp-total { font-size: 30px; font-weight: 700; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.comp-linhas { list-style: none; margin: 12px 0 6px; padding: 0; }
.comp-linhas li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed rgba(128,128,128,.25); font-size: 13px; }
.comp-linhas li span { font-variant-numeric: tabular-nums; }
.comp-delta { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; min-width: 200px; }
.comp-delta p { margin: 0 0 8px; font-size: 13px; }
.comp-delta-num { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.comp-delta-pct { font-size: 16px; font-weight: 600; opacity: .85; }
.comp-delta--ok { border: 2px solid #2e9e5b; } .comp-delta--ok .comp-delta-num, .comp-delta--ok .comp-delta-pct { color: #2e9e5b; }
.comp-delta--err { border: 2px solid #d64550; } .comp-delta--err .comp-delta-num, .comp-delta--err .comp-delta-pct { color: #d64550; }
.comp-delta--neutro { border: 2px solid #8a8f98; } .comp-delta--neutro .comp-delta-num { color: #8a8f98; }
@media (max-width: 860px) { .comp-grid { grid-template-columns: 1fr; } }

/* alinhamento numérico em tabelas (Fase 3) */
.itens-table td.num, .itens-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Assistente de IA — ícone inteligente colapsável (Fase 4) ─────────────── */
.assist { position: fixed; right: 24px; bottom: 24px; z-index: 1000; font-size: 14px; }

/* Ícone inteligente (estado COLAPSADO padrão): círculo compacto que expande o
   rótulo só no hover — footprint mínimo, sem ocupar a janela. */
.assist__fab {
  display: inline-flex; align-items: center; gap: 10px; position: relative; cursor: pointer;
  height: 58px; padding: 0; width: 58px; max-width: 58px; overflow: hidden;
  border: none; border-radius: 32px; color: var(--brand-gold);
  background: radial-gradient(120% 120% at 30% 20%, #234a86 0%, var(--brand-navy) 55%, #0c2144 100%);
  transition: max-width .32s cubic-bezier(.22,1,.36,1), transform .18s ease;
  animation: assistGlow 2.8s ease-in-out infinite;
}
/* Brilho PULSANTE (respiração da aura dourada em volta do ícone). */
@keyframes assistGlow {
  0%, 100% { box-shadow: 0 12px 30px rgba(13,43,85,.42), 0 0 0 1px color-mix(in srgb, var(--brand-gold) 35%, transparent), 0 0 9px color-mix(in srgb, var(--brand-gold) 22%, transparent), inset 0 0 16px color-mix(in srgb, var(--brand-gold) 10%, transparent); }
  50% { box-shadow: 0 14px 34px rgba(13,43,85,.48), 0 0 0 1px color-mix(in srgb, var(--brand-gold) 60%, transparent), 0 0 28px color-mix(in srgb, var(--brand-gold) 55%, transparent), inset 0 0 18px color-mix(in srgb, var(--brand-gold) 16%, transparent); }
}
.assist__fab:hover { max-width: 220px; transform: translateY(-2px); animation: none; box-shadow: 0 16px 38px rgba(13,43,85,.5), 0 0 30px color-mix(in srgb, var(--brand-gold) 45%, transparent); }
.assist__fab-orb {
  flex: 0 0 58px; width: 58px; height: 58px; display: grid; place-items: center; position: relative;
}
.assist__fab-chat { width: 24px; height: 24px; }
.assist__fab-spark {
  position: absolute; top: 13px; right: 13px; width: 11px; height: 11px; color: var(--brand-gold-soft);
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--brand-gold) 70%, transparent));
  animation: assistSpark 2.6s ease-in-out infinite;
}
@keyframes assistSpark { 0%,100% { opacity: .55; transform: scale(.85) rotate(0deg); } 50% { opacity: 1; transform: scale(1.15) rotate(20deg); } }
.assist__fab-label { white-space: nowrap; font-weight: 700; letter-spacing: .01em; padding-right: 20px; opacity: 0; transition: opacity .2s ease .06s; }
.assist__fab:hover .assist__fab-label { opacity: 1; }
.assist--open .assist__fab { display: none; }

/* Badge de marcas (Gemini + Claude) sobre o canto do ícone — sinaliza os
   recursos de IA disponíveis. pointer-events:none: o clique passa para o FAB. */
.assist__badge {
  position: absolute; right: -3px; bottom: -3px; z-index: 2; pointer-events: none;
  display: inline-flex; align-items: center; padding: 2px; border-radius: 20px;
  background: #fff; box-shadow: 0 3px 10px rgba(13,43,85,.35), 0 0 0 1.5px color-mix(in srgb, var(--brand-gold) 55%, transparent);
}
.assist__brand { width: 15px; height: 15px; display: block; border-radius: 50%; background: #fff; }
.assist__badge .assist__brand + .assist__brand { margin-left: -5px; box-shadow: -1px 0 0 #fff; }
.assist--open .assist__badge { display: none; }
.assist__pulse {
  position: absolute; top: -3px; right: -3px; z-index: 2; width: 14px; height: 14px; border-radius: 50%;
  background: var(--brand-gold); border: 2px solid var(--surface); pointer-events: none;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-gold) 70%, transparent);
  animation: assistPulse 1.8s infinite;
}
.assist--open .assist__pulse { display: none; }
@keyframes assistPulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-gold) 65%, transparent); }
  70% { box-shadow: 0 0 0 13px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.assist__panel[hidden] { display: none; }
.assist__panel {
  width: min(400px, calc(100vw - 32px)); height: min(580px, calc(100vh - 96px));
  display: flex; flex-direction: column; border-radius: 18px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: 0 28px 70px rgba(13,43,85,.4);
  transform-origin: bottom right; animation: assistOpen .26s cubic-bezier(.22,1,.36,1);
}
@keyframes assistOpen { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
.assist__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px;
  background: radial-gradient(120% 140% at 0% 0%, #234a86 0%, var(--brand-navy) 60%, #0c2144 100%); color: #fff;
}
.assist__head-id { display: flex; align-items: center; gap: 11px; }
.assist__head-orb { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: grid; place-items: center; color: var(--brand-gold); background: color-mix(in srgb, var(--brand-gold) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-gold) 40%, transparent); }
.assist__head-orb svg { width: 18px; height: 18px; }
.assist__head strong { font-size: 14.5px; display: block; line-height: 1.2; }
.assist__head-brands { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; }
.assist__head-brands img { width: 15px; height: 15px; display: block; border-radius: 50%; background: #fff; padding: 1px; }
.assist__head-brands img + img { margin-left: -8px; }
.assist__mode {
  display: inline-block; margin-left: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; padding: 2px 8px; border-radius: 20px; background: rgba(255,255,255,.16); color: #fff;
}
.assist__mode--ia { background: var(--brand-gold); color: var(--brand-navy); }
.assist__close { background: rgba(255,255,255,.12); border: none; color: #fff; cursor: pointer; opacity: .85; width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; transition: background .2s ease; }
.assist__close svg { width: 16px; height: 16px; }
.assist__close:hover { opacity: 1; background: rgba(255,255,255,.22); }
.assist__body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.assist__msg { max-width: 90%; padding: 10px 13px; border-radius: 13px; line-height: 1.5; }
.assist__msg p { margin: 0 0 8px; } .assist__msg p:last-child { margin-bottom: 0; }
.assist__msg ul { margin: 6px 0; padding-left: 18px; } .assist__msg li { margin-bottom: 6px; }
.assist__msg h4 { margin: 4px 0 6px; font-size: 13.5px; color: var(--heading); }
.assist__msg--bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 4px; }
.assist__msg--user { align-self: flex-end; background: var(--brand-navy); color: #fff; border-bottom-right-radius: 4px; }
[data-theme="dark"] .assist__msg--bot { background: var(--surface-3); }
.assist__msg a { color: var(--brand-blue); font-weight: 600; text-decoration: none; border-bottom: 1px dashed color-mix(in srgb, var(--brand-blue) 50%, transparent); }
.assist-nota { font-size: 11.5px; color: var(--text-2); }
.assist-pensando { color: var(--text-2); font-style: italic; }
.assist-erro { color: #d64550; }
.assist-fonte { font-size: 11px; color: var(--text-2); }
.assist-fontes { margin-top: 10px; font-size: 11px; color: var(--text-2); border-top: 1px dashed var(--border); padding-top: 7px; }
.assist-fontes span { white-space: nowrap; }
.assist-cit {
  display: inline-block; min-width: 15px; text-align: center; margin: 0 1px; padding: 0 4px;
  border-radius: 8px; font-size: 10px; font-weight: 800; line-height: 15px; vertical-align: super;
  background: color-mix(in srgb, var(--brand-gold) 22%, transparent); color: var(--heading);
  border: 1px solid color-mix(in srgb, var(--brand-gold) 45%, transparent);
}
.assist-fontes--num summary { cursor: pointer; font-weight: 700; color: var(--heading); }
.assist-fontes--num ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.assist-fontes--num .assist-fonte { word-break: break-all; }
.assist-acao {
  display: inline-block; margin-top: 10px; padding: 7px 13px; border-radius: 20px; cursor: pointer;
  background: color-mix(in srgb, var(--brand-gold) 18%, transparent); color: var(--heading);
  border: 1px solid color-mix(in srgb, var(--brand-gold) 45%, transparent); font-weight: 600; font-size: 13px;
}
.assist-acao:hover { background: color-mix(in srgb, var(--brand-gold) 28%, transparent); }
.assist__chips { display: flex; gap: 6px; padding: 8px 10px 0; flex-wrap: wrap; background: var(--surface-2); }
.assist__chip {
  padding: 6px 11px; border-radius: 18px; cursor: pointer; font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
}
.assist__chip:hover { border-color: var(--brand-gold); color: var(--heading); }
.assist__form { display: flex; gap: 8px; padding: 10px; background: var(--surface-2); border-top: 1px solid var(--border); }
.assist__form input {
  flex: 1; padding: 10px 13px; border-radius: 22px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 13.5px; outline: none;
}
.assist__form input:focus { border-color: var(--brand-gold); }
.assist__send {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--brand-navy); color: var(--brand-gold); display: inline-flex; align-items: center; justify-content: center;
}
.assist__send svg { width: 18px; height: 18px; }
.assist__send:hover { background: #17325c; }
@media (max-width: 520px) { .assist { right: 12px; bottom: 12px; } .assist__fab-label { display: none; } }

/* ── Central de Relatórios ─────────────────────────────────────────────── */
.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.rel-card { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease; }
.rel-card:hover { border-color: var(--brand-gold); box-shadow: 0 2px 10px rgba(0,0,0,.08); transform: translateY(-1px); }
.rel-card__nome { font-weight: 600; color: var(--text); }
.rel-card__desc { font-size: 12px; color: var(--text-muted); line-height: 1.35; }
table.itens-table tfoot tr.rel-total td { border-top: 2px solid var(--border); padding-top: 7px; background: var(--surface-2); }

/* ── Sidebar: seções Painel do Contador / Produtor ─────────────────────── */
.nav-section { padding: 16px 16px 5px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em; color: rgba(255,255,255,.42);
  display: flex; align-items: center; gap: 6px; }
.nav-section--produtor { color: var(--brand-gold, #F4B942); }
.nav-section--produtor::before { content: ""; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--brand-gold, #F4B942); box-shadow: 0 0 6px rgba(244,185,66,.7); }
.nav-section__ctx { font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 10px;
  color: rgba(255,255,255,.6); margin-left: auto; max-width: 120px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════════════════
   Design System v2 — motion, profundidade e header rico (23/07/2026)
   Lente Emil (restrição/propósito) + Jakub (polimento). Motion só com função:
   feedback, orientação, continuidade. Tudo respeita prefers-reduced-motion.
   ═══════════════════════════════════════════════════════════════════════ */
:root {
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.28, .64, 1);
  --dur-fast: 150ms;
  --dur: 220ms;
}

/* Nav — indicador ativo dourado que "cresce" (orientação) + hover sutil */
.nav-item { position: relative; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.nav-item::before {
  content: ""; position: absolute; left: 3px; top: 50%; width: 3px; height: 0;
  background: var(--brand-gold); border-radius: 3px; transform: translateY(-50%);
  transition: height var(--dur) var(--ease-spring); }
.nav-item.active { box-shadow: none; }
.nav-item.active::before { height: 20px; }
.nav-item:not(.active):hover { transform: translateX(2px); }

/* Cards — profundidade ao focar (afordância). KPI sobe com mola sutil. */
.card { transition: box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out); }
.kpi-card { transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur) var(--ease-out); }
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }

/* View — entrada com leve subida (continuidade), easing forte no lugar de fadeview */
@keyframes viewRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.view.active { animation: viewRise var(--dur) var(--ease-out); }

/* Botões — feedback de pressão */
.btn { transition: background var(--dur-fast) var(--ease-out), transform 90ms var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.btn:active { transform: translateY(1px) scale(.99); }

/* ── Header rico ──────────────────────────────────────────────────────── */
.topbar { gap: 16px; align-items: center; }
.topbar__titles { min-width: 0; }
.hdr-crumb { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 600;
  letter-spacing: .02em; color: var(--text-3); text-transform: uppercase; margin-bottom: 2px; }
.hdr-crumb__sep { opacity: .5; }
.hdr-crumb__prod { color: var(--brand-gold); text-transform: none; letter-spacing: 0;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.hdr-producer { display: flex; align-items: center; gap: 9px; padding: 5px 6px 5px 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.hdr-producer:hover { border-color: var(--brand-gold); box-shadow: 0 2px 10px rgba(13,43,85,.10); }
.hdr-producer__avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-navy-2), var(--brand-blue)); color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.hdr-producer__name { font-size: 13px; font-weight: 600; color: var(--text); max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-producer__switch { border: none; background: var(--surface-3); color: var(--text-2); cursor: pointer;
  font: inherit; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.hdr-producer__switch:hover { background: var(--brand-navy); color: #fff; }

.hdr-icon { position: relative; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; color: var(--text-2);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-spring); }
.hdr-icon svg { width: 18px; height: 18px; }
.hdr-icon:hover { background: var(--brand-navy); color: #fff; border-color: var(--brand-navy); transform: translateY(-1px); }
.hdr-icon__badge { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--err); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px;
  display: grid; place-items: center; border: 2px solid var(--surface); }

/* ── Cockpit do Contador (carteira rica) ───────────────────────────────── */
.cockpit-table td { vertical-align: middle; padding: 9px 8px; }
.cp-nome { display: flex; align-items: center; gap: 10px; }
.cp-avatar { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-navy-2), var(--brand-blue)); color: #fff; font-size: 11.5px; font-weight: 700; }
.cp-nome small { display: block; color: var(--text-3); font-size: 11px; margin-top: 1px; }
.autobar { position: relative; height: 18px; min-width: 92px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.autobar__fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 999px;
  transition: width var(--dur) var(--ease-out); }
.autobar__txt { position: relative; z-index: 1; font-size: 10.5px; font-weight: 700; color: var(--text);
  line-height: 18px; padding-left: 9px; mix-blend-mode: normal; }
.btn-acessar { background: var(--brand-navy); color: #fff; border: none; font-weight: 600; white-space: nowrap; }
.btn-acessar:hover { background: var(--brand-blue); transform: translateX(2px); }
.cockpit-table tbody tr:hover { background: var(--row-hover); }

/* Correção: classe com display sobrepõe o atributo [hidden] — restaura ocultação. */
.hdr-producer[hidden] { display: none; }

/* ── Profundidade 3D com propósito (KPIs) — só quando há movimento permitido ─ */
@media (prefers-reduced-motion: no-preference) {
  .kpi-card { position: relative; transform-style: preserve-3d; will-change: transform; }
  .kpi-card.tilt-on {
    transform: perspective(760px) translateY(-3px) rotateX(var(--ry, 0deg)) rotateY(var(--rx, 0deg));
    box-shadow: var(--shadow-card-hover);
  }
  /* brilho que segue o cursor — reforça a leitura de superfície/relevo */
  .kpi-card::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    opacity: 0; transition: opacity var(--dur) var(--ease-out);
    background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 0%), rgba(255,255,255,.22), transparent 62%); }
  [data-theme="dark"] .kpi-card::after { background: radial-gradient(220px circle at var(--mx,50%) var(--my,0%), rgba(120,170,255,.14), transparent 62%); }
  .kpi-card.tilt-on::after { opacity: 1; }
  .kpi-card .kpi-value, .kpi-card .kpi-label { transform: translateZ(18px); }
}

/* ── Header context-aware: Importar, Novidades, Ajuda, dropdown de usuário ── */
.hdr-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
  background: var(--brand-navy); color: #fff; border: none; border-radius: 10px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast) var(--ease-out); }
.hdr-btn svg { width: 16px; height: 16px; }
.hdr-btn--import:hover { background: var(--brand-blue); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(13,43,85,.22); }
.hdr-btn[hidden] { display: none; }

.hdr-user { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 3px 8px 3px 4px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font: inherit;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.hdr-user:hover { border-color: var(--brand-gold); box-shadow: 0 2px 10px rgba(13,43,85,.10); }
.hdr-user__avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-navy-2), var(--brand-blue)); color: #fff; font-size: 12px; font-weight: 700; }
.hdr-user__name { font-size: 13px; font-weight: 600; color: var(--text); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-user__caret { width: 15px; height: 15px; color: var(--text-3); transition: transform var(--dur-fast) var(--ease-out); }
.hdr-user[aria-expanded="true"] .hdr-user__caret { transform: rotate(180deg); }

/* Card flutuante (dropdown do usuário) */
.hdr-menu { position: absolute; top: 62px; right: 22px; width: 288px; max-height: 78vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; z-index: 60;
  box-shadow: 0 8px 16px rgba(13,43,85,.10), 0 24px 60px rgba(13,43,85,.20); padding: 8px; }
@media (prefers-reduced-motion: no-preference) {
  .hdr-menu { animation: menuPop var(--dur) var(--ease-out); transform-origin: top right; }
  @keyframes menuPop { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
}
.hdr-menu[hidden] { display: none; }
.hdr-menu__head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.hdr-menu__head .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-navy-2), var(--brand-blue)); color: #fff; font-size: 13px; font-weight: 700; }
.hdr-menu__head strong { font-size: 13.5px; color: var(--text); line-height: 1.25; }
.hdr-menu__head small { display: block; color: var(--text-3); font-size: 11px; margin-top: 1px; }
.hdr-menu__sec { padding: 10px 12px 3px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.hdr-menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: none; background: none;
  border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; color: var(--text-2); text-align: left;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.hdr-menu__item:hover { background: var(--surface-3); color: var(--text); }
.hdr-menu__item svg { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; }
.hdr-menu__item--soon { color: var(--text-3); cursor: default; }
.hdr-menu__item--soon:hover { background: none; color: var(--text-3); }
.hdr-menu__item--soon::after { content: "em breve"; margin-left: auto; font-size: 9.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-3); background: var(--surface-3); padding: 1px 7px; border-radius: 999px; }
.hdr-menu__item--danger { color: var(--err); }
.hdr-menu__item--danger:hover { background: rgba(179,38,30,.08); color: var(--err); }
.hdr-menu__sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ── Toast (feedback não-bloqueante) ───────────────────────────────────── */
#toastHost { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--brand-navy); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 28px rgba(13,43,85,.28); max-width: 90vw; }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toastIn var(--dur) var(--ease-out); }
  @keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  .toast--out { animation: toastOut var(--dur) var(--ease-out) forwards; }
  @keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
}

/* pillCliente virou redundante (contexto agora no breadcrumb + botão de usuário). */
#pillCliente { display: none !important; }

/* ── Grupos de produtores (cockpit) ────────────────────────────────────── */
.cp-grupo-head { cursor: pointer; background: var(--surface-2); user-select: none; }
.cp-grupo-head:hover { background: var(--surface-3); }
.cp-grupo-head td { padding: 9px 8px; border-top: 1px solid var(--border); }
.cp-grupo-head strong { color: var(--heading); font-size: 13px; }
.cp-grupo-caret { display: inline-block; color: var(--text-3); transition: transform var(--dur-fast) var(--ease-out); }
.cp-grupo-head.collapsed .cp-grupo-caret { transform: rotate(-90deg); }
.cp-grupo-n { color: var(--text-3); font-size: 11.5px; margin-left: 6px; }
.cp-grupo-rec { color: var(--text-2); font-weight: 600; font-size: 12.5px; }
.cp-grupo { color: var(--link); text-decoration: none; font-size: 11px; }
.cp-grupo:hover { text-decoration: underline; }
.cp-grupo-input { font: inherit; font-size: 11px; padding: 1px 6px; border: 1px solid var(--brand-gold); border-radius: 6px;
  background: var(--input-bg); color: var(--text); width: 150px; }

/* ── Onda 6: popovers Novidades/Ajuda ──────────────────────────────────── */
.hdr-pop { position: absolute; top: 62px; right: 22px; width: 320px; max-height: 76vh; overflow-y: auto; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 6px;
  box-shadow: 0 8px 16px rgba(13,43,85,.10), 0 24px 60px rgba(13,43,85,.20); }
.hdr-pop[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .hdr-pop { animation: menuPop var(--dur) var(--ease-out); transform-origin: top right; }
}
.hdr-pop__head { padding: 10px 12px 8px; font-size: 13.5px; font-weight: 700; color: var(--heading); }
.hdr-pop__nov { display: flex; gap: 10px; padding: 9px 12px; border-radius: 9px; }
.hdr-pop__nov:hover { background: var(--surface-2); }
.hdr-pop__data { flex-shrink: 0; font-size: 10.5px; font-weight: 700; color: var(--brand-navy); background: var(--surface-3);
  border-radius: 999px; padding: 2px 8px; height: fit-content; }
.hdr-pop__nov strong { display: block; font-size: 12.5px; color: var(--text); }
.hdr-pop__nov p { margin: 2px 0 0; font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.hdr-pop__link { display: block; width: 100%; text-align: left; border: none; background: none; cursor: pointer;
  padding: 9px 12px; border-radius: 9px; transition: background var(--dur-fast) var(--ease-out); }
.hdr-pop__link:hover { background: var(--surface-2); }
.hdr-pop__link strong { display: block; font-size: 12.5px; color: var(--text); font-weight: 600; }
.hdr-pop__link small { color: var(--text-3); font-size: 11px; }
.hdr-pop__foot { padding: 10px 12px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 10.5px; color: var(--text-3); line-height: 1.45; }

/* Transição ao entrar no produtor (View Transitions API) */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: vtOut 180ms var(--ease-out) both; }
  ::view-transition-new(root) { animation: vtIn 260ms var(--ease-out) both; }
  @keyframes vtOut { to { opacity: 0; transform: scale(.99); } }
  @keyframes vtIn { from { opacity: 0; transform: translateY(12px) scale(.995); } to { opacity: 1; transform: none; } }
}

/* Grupo de botões de export do relatório */
.rel-export { display: inline-flex; gap: 6px; }

/* ═══════════════════════════════════════════════════════════════════════
   Polimento — Acessibilidade (AA) e responsividade mobile (24/07/2026)
   ═══════════════════════════════════════════════════════════════════════ */

/* Foco visível de TECLADO (não aparece no clique de mouse) — WCAG 2.4.7 */
:focus-visible { outline: 3px solid var(--brand-gold); outline-offset: 2px; border-radius: 6px; }
.nav-item:focus-visible { outline-offset: -3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
.rel-card:focus-visible, .hdr-menu__item:focus-visible, .hdr-pop__link:focus-visible,
[tabindex]:focus-visible { outline: 3px solid var(--brand-gold); outline-offset: 2px; }
#conteudo:focus-visible { outline: none; }

/* Skip link — WCAG 2.4.1 (pular navegação) */
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 300; background: var(--brand-navy); color: #fff;
  padding: 10px 16px; border-radius: 0 0 10px 10px; font-weight: 600; font-size: 13px; text-decoration: none;
  transition: top .18s var(--ease-out); }
.skip-link:focus { top: 0; }

/* Backdrop da sidebar no mobile */
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(8,15,29,.5); z-index: 40; }
.sidebar-backdrop[hidden] { display: none; }

@media (max-width: 860px) {
  .sidebar { z-index: 50; }
  /* Header: prioriza o essencial, some o secundário para caber */
  .topbar { gap: 8px; flex-wrap: nowrap; }
  .topbar__actions { gap: 6px; }
  #serverStatus { display: none; }
  .hdr-btn--import span { display: none; }        /* Importar vira só ícone */
  .hdr-btn--import { padding: 0 10px; }
  .hdr-user__name { display: none; }              /* usuário vira só avatar */
  .hdr-user { padding: 3px; }
  .hdr-user__caret { display: none; }
  .topbar__titles h1 { font-size: 17px; }
  /* Menus/popovers ocupam a largura disponível sem vazar */
  .hdr-menu, .hdr-pop { right: 10px; left: 10px; width: auto; max-width: calc(100vw - 20px); top: 58px; }
  .cockpit-table { min-width: 720px; }            /* rola dentro do .itens-scroll */
  .rel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .hdr-crumb { display: none; }                   /* breadcrumb some em telas muito estreitas */
  .kpi-value { font-size: 22px; }
}

/* Numeração das notas — chips de lacuna */
.num-gap { display: inline-block; background: rgba(179,38,30,.10); color: var(--err); border: 1px solid rgba(179,38,30,.3);
  border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 600; margin: 2px 0; }

/* ── Central de Relatórios — cards profissionais com acento por grupo ───── */
/* Ao gerar um relatório, a página desliza até aqui — reserva o topbar fixo e
   garante espaço p/ trazer relatórios curtos para perto do topo. */
#relSaida { scroll-margin-top: 88px; }
#relSaida:not(:empty) { min-height: 64vh; }

/* ── DRE hierárquica (padrão Agronota) ────────────────────────────────── */
.dre-resumo {
  display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: baseline;
  padding: 12px 16px; margin-bottom: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  font-size: 13px; color: var(--text-2);
}
.dre-resumo strong { color: var(--heading); font-variant-numeric: tabular-nums; font-size: 14px; }
.dre-resumo__saldo { margin-left: auto; }
.dre-resumo__saldo strong { color: var(--ok); }
[data-theme="dark"] .dre-resumo__saldo strong { text-shadow: 0 0 13px color-mix(in srgb, var(--ok) 50%, transparent); }
.dre-table td { font-variant-numeric: tabular-nums; }
.dre-table th, .dre-table td { white-space: nowrap; } /* R$ não quebra; anual rola na horizontal */
.dre-table tbody tr.dre-secao > td {
  background: var(--surface-3); font-weight: 700; color: var(--heading);
  border-top: 1px solid var(--border-strong);
}
.dre-table tbody tr.dre-grupo > td { font-weight: 600; color: var(--heading); }
.dre-table tbody tr.dre-resultado > td {
  background: color-mix(in srgb, var(--brand-gold) 13%, transparent);
  font-weight: 800; color: var(--heading); border-top: 2px solid var(--brand-gold);
}
[data-theme="dark"] .dre-table tbody tr.dre-resultado > td { box-shadow: inset 0 0 24px rgba(244, 185, 66, .1); }
.rel-card { flex-direction: row; align-items: flex-start; gap: 13px; padding: 15px 16px; position: relative; overflow: hidden;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out); }
.rel-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--rc, var(--brand-blue));
  opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); }
.rel-card__icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: 11px; display: grid; place-items: center;
  color: var(--rc, var(--brand-blue)); background: color-mix(in srgb, var(--rc, #2E75B6) 13%, transparent);
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring); }
.rel-card__icon svg { width: 20px; height: 20px; }
.rel-card__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rel-card__go { margin-left: auto; align-self: center; color: var(--rc, var(--brand-blue)); flex-shrink: 0;
  opacity: 0; transform: translateX(-7px); transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring); }
.rel-card__go svg { width: 18px; height: 18px; display: block; }
.rel-card:hover { border-color: var(--rc, var(--brand-blue)); transform: translateY(-3px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--rc, #2E75B6) 24%, transparent); }
.rel-card:hover::before { opacity: 1; }
.rel-card:hover .rel-card__icon { background: var(--rc, var(--brand-blue)); color: #fff; transform: scale(1.06) rotate(-3deg); }
.rel-card:hover .rel-card__go { opacity: 1; transform: none; }
.rel-card:hover .rel-card__nome { color: var(--rc, var(--brand-navy)); }
/* Destaque: grupo Reforma (o diferencial do produto) */
.rel-card--featured { background: linear-gradient(135deg, rgba(244,185,66,.12), var(--surface) 70%); border-color: rgba(244,185,66,.45); }
.rel-card--featured .rel-card__icon { background: var(--rc); color: #0D2B55; }
.rel-card--featured:hover .rel-card__icon { color: #0D2B55; transform: scale(1.06) rotate(-3deg); }
[data-theme="dark"] .rel-card--featured { background: linear-gradient(135deg, rgba(244,185,66,.10), var(--surface) 70%); }

/* ── Integrações — hub de conectores ───────────────────────────────────── */
.integ-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.integ-card { display: flex; flex-direction: column; gap: 6px; padding: 15px 16px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.integ-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); border-color: var(--border-strong); }
.integ-card--em-breve { opacity: .72; }
.integ-card--ativa { border-left: 3px solid var(--ok); }
.integ-card__top { display: flex; align-items: center; gap: 8px; }
.integ-card__info { margin-left: auto; font-size: 11px; color: var(--text-3); }
.integ-card strong { font-size: 13.5px; color: var(--text); }
.integ-card p { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.4; flex: 1; }
.integ-card__acao { margin-top: 6px; }
.integ-badge { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 9px; border-radius: 999px; }
.integ-badge--ok { background: rgba(21,122,60,.12); color: var(--ok); }
.integ-badge--av { background: rgba(46,117,182,.12); color: var(--brand-blue); }
.integ-badge--soon { background: var(--surface-3); color: var(--text-3); }

/* ── Login (Fase 2) ────────────────────────────────────────────────────── */
.login-overlay { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 24px;
  background: var(--bg-gradient); }
.login-overlay[hidden] { display: none; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px 30px; box-shadow: 0 12px 24px rgba(13,43,85,.12), 0 40px 80px rgba(13,43,85,.18);
  text-align: center; }
@media (prefers-reduced-motion: no-preference) { .login-card { animation: viewRise var(--dur) var(--ease-out); } }
.login-logo { width: 230px; max-width: 80%; height: auto; margin: 0 auto 18px; display: block; }
.login-card h1 { font-size: 20px; color: var(--heading); margin: 0 0 2px; }
.login-sub { font-size: 12px; color: var(--text-3); margin: 0 0 22px; }
.login-card form { display: grid; gap: 6px; text-align: left; }
.login-card label { font-size: 12px; font-weight: 600; color: var(--text-2); margin-top: 8px; }
.login-card input { padding: 11px 13px; border: 1px solid var(--input-border); border-radius: 10px; background: var(--input-bg);
  color: var(--text); font: inherit; font-size: 14px; }
.login-card input:focus { outline: 2px solid var(--brand-blue); outline-offset: -1px; }
.login-card .btn-primary { margin-top: 18px; width: 100%; justify-content: center; padding: 12px; font-size: 14px; }
.login-erro { margin-top: 12px; font-size: 13px; color: var(--err); font-weight: 600; }
.login-erro[hidden] { display: none; }

/* ── Tela de login "fase" (split-screen premium, Fase E) ─────────────────────
   Painel-marca (navy sempre escuro, arte SVG própria) + painel-form (herda o
   tema). Acento por portal: dourado = Contador, azul = Cliente. */
.login-fase { display: flex; padding: 0; align-items: stretch; place-items: stretch; }
.login-fase.portal-contador { --lf-accent: #F4B942; }
.login-fase.portal-cliente  { --lf-accent: #5EA0E7; }

.login-fase__brand {
  position: relative; flex: 1 1 55%; overflow: hidden; display: flex; align-items: center;
  color: #EAF1FA;
  background: radial-gradient(1000px 720px at 82% -12%, rgba(46,117,182,.22), transparent 60%),
              linear-gradient(158deg, #0D2B55 0%, #0A1E3E 55%, #06132698 100%), #07152B;
  border-right: 1px solid rgba(255,255,255,.06);
}
.login-fase__art { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--lf-accent); opacity: .92; pointer-events: none; }
.login-fase__brandinner { position: relative; z-index: 1; padding: clamp(32px, 5vw, 72px); max-width: 560px; }
.login-fase__logo { width: 262px; max-width: 72%; height: auto; display: block; margin-bottom: 34px;
  filter: brightness(0) invert(1) drop-shadow(0 0 7px color-mix(in srgb, var(--lf-accent) 60%, transparent)) drop-shadow(0 0 16px rgba(94,160,231,.3)); }
.login-fase__tagline { font-size: clamp(26px, 3.1vw, 40px); line-height: 1.12; font-weight: 800; margin: 0 0 14px; color: #fff; letter-spacing: -.01em; }
.login-fase__lead { font-size: 15px; line-height: 1.6; color: #B9C9DF; margin: 0 0 26px; max-width: 46ch; }
.login-fase__feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 13px; }
.login-fase__feats li { position: relative; padding-left: 30px; font-size: 14px; color: #CFE0F5; }
.login-fase__feats li::before { content: ""; position: absolute; left: 0; top: 3px; width: 17px; height: 17px; border-radius: 50%;
  background: color-mix(in srgb, var(--lf-accent) 20%, transparent); box-shadow: inset 0 0 0 1.5px var(--lf-accent); }
.login-fase__feats li::after { content: ""; position: absolute; left: 5.5px; top: 6px; width: 5px; height: 9px;
  border: solid var(--lf-accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }

.login-fase__form { flex: 1 1 45%; display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--bg); }
.login-fase .login-card { width: 100%; max-width: 400px; background: transparent; border: none; box-shadow: none;
  padding: 0; text-align: left; animation: none; }
.login-fase .login-card h1 { font-size: 26px; margin-bottom: 4px; }
.login-fase .login-card .btn-primary { background: linear-gradient(135deg, var(--brand-navy), var(--brand-navy-2)); }
.login-fase.portal-cliente .login-card input:focus { outline-color: var(--lf-accent); }
.login-fase__seguro { display: inline-flex; align-items: center; gap: 7px; margin-top: 22px; font-size: 12px; color: var(--text-3); }
.login-fase__seguro svg { color: var(--ok); flex-shrink: 0; }

@media (max-width: 860px) {
  .login-fase { flex-direction: column; }
  .login-fase__brand { flex: 0 0 auto; min-height: 30vh; border-right: none; border-bottom: 1px solid rgba(255,255,255,.06); }
  .login-fase__feats { display: none; }
  .login-fase__logo { margin-bottom: 16px; width: 200px; }
  .login-fase__lead { margin-bottom: 0; }
}

/* Classe com display sobrepõe o atributo [hidden] — restaura ocultação. */
.btn[hidden] { display: none !important; }

/* Modo produtor: esconde os itens do Painel do Contador na sidebar. */
.nav-oculto { display: none !important; }

/* Motor de entitlements: recurso/módulo não liberado ao escritório fica oculto. */
.feature-off { display: none !important; }
/* RBAC na UI: ação sem permissão (capability) do usuário fica oculta. */
.cap-off { display: none !important; }

/* ── Estado vazio ilustrado (Onda 6) ─────────────────────────────
   Honestidade do dado é design: cada tela sem registros mostra ícone,
   título e orientação — nunca uma linha crua. Herda tokens do tema. */
.estado-vazio {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px; padding: 46px 24px; max-width: 460px; margin: 0 auto;
}
.estado-vazio__icone {
  width: 66px; height: 66px; display: grid; place-items: center; border-radius: 50%;
  color: var(--brand-blue);
  background: color-mix(in srgb, var(--brand-blue) 12%, transparent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand-blue) 6%, transparent);
  margin-bottom: 4px;
}
[data-theme="dark"] .estado-vazio__icone {
  color: #6FB3F0;
  background: color-mix(in srgb, var(--brand-blue) 20%, transparent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand-blue) 9%, transparent), var(--glow-blue);
}
.estado-vazio__icone svg { width: 30px; height: 30px; stroke: currentColor; fill: none; }
.estado-vazio__titulo { margin: 0; font-size: 15px; font-weight: 700; color: var(--heading); }
.estado-vazio__texto { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.estado-vazio__acao { margin-top: 8px; }
/* Variante para dentro de uma célula de tabela (colspan) */
td > .estado-vazio { padding: 30px 16px; }
@media (max-width: 520px) {
  .estado-vazio { padding: 34px 16px; }
  .estado-vazio__icone { width: 56px; height: 56px; }
}
