/* styles.css — Identidade visual GPR (Gestão Para Resultado) + responsivo. */
:root {
  --primary: #1D4ED8; --primary-d: #1E40AF;
  --navy: #0F172A;
  --green: #16A34A; --green-d: #166534;
  --red: #EF4444; --red-d: #991B1B;
  --purple: #7C3AED; --orange: #F97316; --amber: #F59E0B; --teal: #0891B2;
  --bg: #F8FAFC; --surface: #FFFFFF; --surface-2: #F1F5F9;
  --line: #E2E8F0; --text: #0F172A; --muted: #64748B; --muted-2: #94A3B8;
  --side-text: #CBD5E1;
  --blue-bg: #DBEAFE; --green-bg: #DCFCE7; --red-bg: #FEE2E2; --amber-bg: #FEF3C7; --purple-bg: #EDE9FE; --orange-bg: #FFEDD5;
  --grad-primary: linear-gradient(135deg, #1D4ED8 0%, #16A34A 100%);
  --grad-dark: linear-gradient(160deg, #020617 0%, #0F172A 55%, #111827 100%);
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 20px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 2px 8px rgba(15,23,42,.06);
  --shadow-lg: 0 10px 30px rgba(15,23,42,.12);
  --glow: 0 0 0 3px rgba(29,78,216,.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); background: var(--bg); font-size: 14px; -webkit-font-smoothing: antialiased;
}
#layout { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
#sidebar {
  width: 256px; flex: 0 0 256px; background: var(--grad-dark); color: var(--side-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 18px 18px 12px; }
.brand-logo { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; background: var(--grad-primary); display: grid; place-items: center; box-shadow: 0 6px 16px rgba(29,78,216,.35); }
.brand-logo svg { width: 22px; height: 22px; }
.brand-title { font-weight: 800; color: #fff; font-size: 18px; line-height: 1; letter-spacing: .02em; }
.brand-sub { color: #94a3b8; font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; margin-top: 3px; }
#nav { flex: 1; overflow-y: auto; padding: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; margin: 2px 0; border-radius: 10px;
  color: var(--side-text); cursor: pointer; font-size: 13.5px; text-decoration: none; white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 6px 16px rgba(29,78,216,.4); }
.nav-ico { width: 18px; height: 18px; display: inline-flex; align-items: center; opacity: .9; }
.nav-item.active .nav-ico { opacity: 1; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 8px; }

/* ---- Topbar / main ---- */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar {
  min-height: 60px; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 8px 20px; position: sticky; top: 0; z-index: 30; flex-wrap: wrap;
}
#empresa-nome { font-weight: 700; font-size: 16px; }
#topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
#topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#content { padding: 22px 24px 72px; }
#nav-toggle { display: none; }
#sidebar-overlay { display: none; }

/* ---- Botões / inputs ---- */
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 13px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600; transition: .12s; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-ghost { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: var(--side-text); }
.btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn-ghost.danger:hover { background: #7f1d1d; border-color: #7f1d1d; color: #fff; }
.btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 8px; }
.btn-icon { padding: 4px 8px; line-height: 1; }
select, input[type="text"], input[type="number"], input[type="date"], input.money {
  font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; color: var(--text); max-width: 100%;
}
@media (min-width: 769px) { select, input[type="text"], input[type="number"], input[type="date"], input.money { font-size: 14px; } }
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: var(--glow); }
/* Campos de data: clicar em qualquer parte abre o calendário (via showPicker no app.js); sem o ícone nativo do lado. */
input[type="date"] { cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator { display: none; -webkit-appearance: none; appearance: none; }
input[type="date"]::-webkit-inner-spin-button { display: none; }
.inp-flush { border: 1px solid transparent; background: transparent; width: 100%; padding: 7px 8px; border-radius: 7px; font-size: 14px; }
.inp-flush:hover { border-color: var(--line); }
.inp-flush:focus { background: #fff; }
input.money { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Cabeçalhos / utilitários ---- */
.page-head { margin-bottom: 18px; }
.page-title { font-size: 24px; font-weight: 800; margin: 0; letter-spacing: -.01em; }
.page-sub { color: var(--muted); margin: 5px 0 0; font-size: 13.5px; }
.section-title { font-size: 15px; font-weight: 700; margin: 26px 0 12px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.spacer { flex: 1; } .hint { color: var(--muted); font-size: 12.5px; }
.flex { display: flex; gap: 8px; align-items: center; } .nowrap { white-space: nowrap; } .text-right { text-align: right; }
.muted { color: var(--muted); } .neg { color: var(--red); } .pos { color: var(--green); }
.derived { color: var(--muted-2); font-variant-numeric: tabular-nums; }

/* ---- Cards / KPIs ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi { padding: 15px 16px; border-radius: var(--r-lg); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); opacity: .85; }
.kpi.k-green::before { background: var(--green); } .kpi.k-red::before { background: var(--red); }
.kpi.k-purple::before { background: var(--purple); } .kpi.k-orange::before { background: var(--orange); }
.kpi.k-blue::before { background: var(--primary); }
/* Fundo tonalizado sutil por variante (tom da cor → surface). */
.kpi.k-green  { background: linear-gradient(150deg, var(--green-bg)  0%, var(--surface) 72%); }
.kpi.k-red    { background: linear-gradient(150deg, var(--red-bg)    0%, var(--surface) 72%); }
.kpi.k-blue   { background: linear-gradient(150deg, var(--blue-bg)   0%, var(--surface) 72%); }
.kpi.k-purple { background: linear-gradient(150deg, var(--purple-bg) 0%, var(--surface) 72%); }
.kpi.k-orange { background: linear-gradient(150deg, var(--orange-bg) 0%, var(--surface) 72%); }
.kpi-link { cursor: pointer; transition: .12s; } .kpi-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-label { color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 22px; font-weight: 800; margin-top: 6px; letter-spacing: -.01em; }
.kpi-value.green { color: var(--green); } .kpi-value.red { color: var(--red); } .kpi-value.blue { color: var(--primary); }
.kpi-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.kpi-2 { display: flex; justify-content: space-between; font-size: 13px; margin-top: 6px; }
.kpi-2 span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Charts ---- */
.charts-grid { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.chart-box { padding: 16px; }
.chart-box h3 { margin: 0 0 12px; font-size: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ch-title { font-weight: 700; }
.ch-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chart-eye { font: 600 11px Inter, system-ui, sans-serif; background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 3px 9px; cursor: pointer; white-space: nowrap; }
.chart-eye:hover { background: var(--surface-2); }
.chart-eye.off { opacity: .5; text-decoration: line-through; }
.chart-canvas-wrap { position: relative; height: 300px; }
.total-anual { font-size: 11.5px; color: var(--muted); text-align: right; font-weight: 600; }
.total-anual b { display: block; color: var(--text); font-size: 13px; }
.chart-summary { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.chart-summary b { color: var(--text); font-variant-numeric: tabular-nums; margin-right: 5px; font-weight: 700; }
.chart-summary b.pos { color: var(--green); } .chart-summary b.neg { color: var(--red); }
.chips [data-mes] { user-select: none; }

/* ---- Segmented control (Tabela/Pizza/Barras) ---- */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px; gap: 2px; }
.seg button { border: none; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

/* ---- Tabelas ---- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; }
/* Barra de rolagem horizontal fixa no rodapé da janela — scrollbar CUSTOMIZADO (trilho + polegar reais),
   sempre visível (o overlay nativo do macOS some quando parado). Controlado por wireStickyHScroll. */
.hbar { position: sticky; bottom: 0; z-index: 22; height: 15px; margin-top: -1px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 0 0 var(--r-lg) var(--r-lg); overflow: hidden; touch-action: none; cursor: pointer; }
.hthumb { position: absolute; top: 2px; left: 0; height: 9px; min-width: 40px; background: var(--muted-2); border-radius: 5px; cursor: grab; will-change: transform; }
.hthumb:hover { background: var(--muted); }
.hthumb:active { cursor: grabbing; background: var(--muted); }
@media print { .hbar { display: none !important; } }
/* Tabelas largas: 1ª coluna redimensionável (alça no canto da célula de cabeçalho). */
.tbl-wide thead th:first-child { resize: horizontal; overflow: auto; min-width: 150px; max-width: 680px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; } th.sortable:hover { color: var(--primary); }
tbody tr:hover { background: #f9fafb; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-total td, tr.total td { font-weight: 700; background: var(--surface-2); }
.grp-row td { font-weight: 700; background: #eef2f7; }
/* Entradas (DRE/DFC): destaque verde */
.row-entrada td { font-weight: 800; background: var(--green-bg); color: var(--green-d); }
.row-entrada td:first-child { box-shadow: inset 3px 0 0 var(--green); }
[data-theme="dark"] .row-entrada td { background: #14361f; color: #6ee7b7; }
/* Linha de RESULTADO final (Lucro Líquido no DRE/DFC, TOTAIS no Meta×Real) — destaque forte */
.row-resultado td { font-size: 14.5px; font-weight: 800; background: var(--surface-2); border-top: 2px solid var(--primary); border-bottom: 2px solid var(--primary); }
.row-resultado td:first-child { box-shadow: inset 4px 0 0 var(--primary); }
[data-theme="dark"] .row-resultado td { background: #18233b; }

/* Grupos recolhíveis no DRE/DFC (começam expandidos) */
.grp-row[data-grp] { cursor: pointer; user-select: none; }
.grp-caret { display: inline-block; font-size: 10px; transition: transform .15s; margin-right: 2px; }
.grp-row.collapsed .grp-caret { transform: rotate(-90deg); }
.cat-row td:first-child { padding-left: 20px; color: var(--muted); }
.row-click { cursor: pointer; }

/* Linha colorida por status (Vendas/Despesas) */
tr.st-bad > td { background: #fee2e2; }
tr.st-warn > td { background: #fef3c7; }
tr.st-info > td { background: #f4f8ff; }
tr.st-ok > td { background: #f4fbf6; }

/* Cabeçalho fixo (congela ao rolar a tabela longa) */
.tbl-frozen { max-height: calc(100vh - 240px); overflow: auto; }
.tbl-frozen thead th { position: sticky; top: 0; z-index: 2; }
/* Esconde a barra horizontal NATIVA do box (usamos a .hbar custom fixa no rodapé da janela); mantém a vertical estilizada. */
.tbl-frozen::-webkit-scrollbar { height: 0; width: 10px; }
.tbl-frozen::-webkit-scrollbar-thumb { background: var(--muted-2); border-radius: 5px; }
.tbl-frozen::-webkit-scrollbar-track { background: transparent; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--green-bg); color: var(--green-d); } .badge.warn { background: var(--amber-bg); color: #92400e; }
.badge.bad { background: var(--red-bg); color: var(--red-d); } .badge.info { background: var(--blue-bg); color: var(--primary-d); }
.badge.none { background: var(--surface-2); color: var(--muted); }

/* ---- Gauge (Controle de Metas) ---- */
.gauge { --pct: 0; --c: var(--primary); width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto;
  background: conic-gradient(var(--c) calc(var(--pct) * 1%), var(--line) 0); position: relative; }
.gauge::before { content: ""; position: absolute; inset: 12px; background: var(--surface); border-radius: 50%; }
.gauge-val { position: relative; font-size: 24px; font-weight: 800; color: var(--text); }
.gauge-cap { text-align: center; margin-top: 10px; font-weight: 700; }
.gauge-sub { text-align: center; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---- Seleção múltipla + arrastar (cadastro) ---- */
.chk { width: 16px; height: 16px; accent-color: var(--primary); }
.bulkbar { display: flex; align-items: center; gap: 10px; }
.drag-handle { cursor: grab; color: var(--muted); user-select: none; padding: 0 4px; font-size: 15px; display: inline-block; }
.drag-handle:active { cursor: grabbing; }
tr.dragging { opacity: .4; }
tr.drop-before td { box-shadow: inset 0 2px 0 0 var(--primary); }
tr.drop-after td { box-shadow: inset 0 -2px 0 0 var(--primary); }
@keyframes gpr-rowflash { from { background: var(--blue-bg); } to { background: transparent; } }
tr.row-nova > td { animation: gpr-rowflash 1.6s ease; }

/* ---- Início (guia) ---- */
.hero { background: var(--grad-dark); color: #fff; border-radius: var(--r-xl); padding: 26px 26px; margin-bottom: 20px; }
.hero h1 { margin: 0; font-size: 26px; font-weight: 800; } .hero p { margin: 8px 0 0; color: #cbd5e1; max-width: 640px; }
.guide-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.guide-card { padding: 18px; cursor: pointer; transition: .1s; text-decoration: none; color: inherit; display: block; }
.guide-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow-lg); }
.guide-ico { width: 40px; height: 40px; border-radius: 11px; background: var(--blue-bg); color: var(--primary); display: grid; place-items: center; }
.guide-ico svg { width: 22px; height: 22px; }
.guide-name { font-weight: 700; margin-top: 12px; } .guide-desc { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.callout { background: var(--blue-bg); border: 1px solid #bfdbfe; color: var(--primary-d); padding: 13px 15px; border-radius: var(--r); font-size: 13px; }
.callout.warn { background: var(--amber-bg); border-color: #fde68a; color: #92400e; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.empty { text-align: center; color: var(--muted); padding: 36px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: 13px; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip .x { cursor: pointer; color: var(--muted-2); } .chip.active .x { color: #dbeafe; }

/* ============ RESPONSIVO ============ */
@media (max-width: 1024px) { .charts-grid { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  #sidebar { position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  #sidebar.open { transform: translateX(0); }
  #sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(2,6,23,.5); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .2s; }
  #sidebar-overlay.show { opacity: 1; pointer-events: auto; }
  #nav-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
  #nav-toggle svg { width: 22px; height: 22px; stroke: var(--text); }
  #content { padding: 16px 14px 80px; }
  #topbar { padding: 8px 12px; }
  #empresa-nome { font-size: 14px; }
  /* Mobile: mostra a logo (gradiente) ao lado do hambúrguer; tira ⚙ e tema do topo (tema vira item do menu).
     Seletores com id p/ vencer as regras-base (que vêm depois no arquivo). */
  #empresa-picker .logo-home { display: inline-grid; }
  #empresa-cfg, #theme-toggle { display: none; }
  #btn-tema { display: block; text-align: center; }
  #emp-dd .emp-trigger { max-width: 52vw; }
  .page-title { font-size: 20px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-value { font-size: 18px; }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-canvas-wrap { height: 260px; }
  /* 1ª coluna fixa na rolagem horizontal */
  .table-wrap table th:first-child, .table-wrap table td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
  .table-wrap thead th:first-child { z-index: 3; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .hero { padding: 20px; } .hero h1 { font-size: 22px; }
}

/* ============ FASE 7 ============ */
/* Mini-legenda de cores de status (Lançamento de Vendas/Despesas) */
.status-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 12px; }
.status-pill { font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.status-pill.st-ok   { background: var(--green-bg);  color: #166534; border-color: #bbf7d0; }
.status-pill.st-bad  { background: var(--red-bg);    color: #991b1b; border-color: #fecaca; }
.status-pill.st-warn { background: var(--amber-bg);  color: #92400e; border-color: #fde68a; }
.status-pill.st-info { background: var(--blue-bg);   color: #1e40af; border-color: #bfdbfe; }

/* Toolbar sticky (Dashboard — fica logo abaixo do #topbar) */
#content .toolbar.sticky-tools { position: sticky; top: 60px; z-index: 25; background: var(--bg); padding: 10px 24px; margin: 0 -24px 14px; border-bottom: 1px solid var(--line); }
@media (max-width: 768px) { #content .toolbar.sticky-tools { padding: 10px 16px; margin: 0 -16px 14px; } }

/* Bloco "Total do Ano" do Dashboard (KPIs grandes, sempre visível) */
.kpis-year { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.kpis-year .kpi { background: linear-gradient(150deg, var(--surface) 0%, var(--surface-2) 100%); }
.kpis-year .kpi-value { font-size: 26px; }

/* Linha extra "TOTAL DO ANO" abaixo do resumo dos gráficos */
.chart-summary-year { background: var(--surface-2); border-radius: 10px; padding: 9px 12px; margin-top: 8px; border-top: none !important; font-weight: 700; }
.chart-summary-year span { font-size: 12px; }

/* Marcador 🔁 ao lado da data quando o lançamento é recorrente */
.rec-mark { display: inline-block; margin-left: 5px; font-size: 12px; cursor: help; }

/* Célula com input + botão "+" embutido (cliente nas Vendas / recebedor nas Despesas) */
.cell-with-add { display: flex; align-items: center; gap: 4px; }
.cell-with-add .inp-flush { flex: 1; }

/* Diálogo de Lançamento Recorrente (<dialog>) */
.dlg { border: none; border-radius: 16px; padding: 0; box-shadow: 0 25px 50px rgba(15,23,42,.25); max-width: 560px; width: 90%; }
.dlg::backdrop { background: rgba(15,23,42,.45); }
.dlg form { padding: 22px; }
.dlg h3 { margin: 0 0 14px; font-size: 17px; }
.dlg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.dlg-grid input, .dlg-grid select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; color: var(--text); background: #fff; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dlg-actions button { padding: 8px 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; font-weight: 600; cursor: pointer; }
.dlg-actions button.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
@media (max-width: 520px) { .dlg-grid { grid-template-columns: 1fr; } }

/* ===== Refresh do Fluxo de Caixa ===== */
.fluxo-hero { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 16px; padding: 22px; border-radius: 22px; background: var(--grad-primary); color: #fff; box-shadow: var(--shadow-lg); margin-bottom: 16px; }
.fluxo-hero-main { display: flex; flex-direction: column; justify-content: center; }
.fluxo-hero-label { font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; opacity: .85; }
.fluxo-hero-value { font-size: 36px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.fluxo-hero-meta { margin-top: 8px; display: flex; align-items: center; gap: 8px; opacity: .92; }
.fluxo-hero-meta .hint { color: rgba(255,255,255,.78); }
.fluxo-hero-sparks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fluxo-hero-spark { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); border-radius: 14px; padding: 12px; backdrop-filter: blur(4px); }
.fluxo-hero-spark-label { font-size: 11.5px; font-weight: 700; letter-spacing: .03em; opacity: .92; }
.fluxo-hero-spark-wrap { position: relative; height: 64px; margin-top: 6px; }
.fluxo-hero-spark-wrap-tall { height: 150px; }
.spark-legend { display: flex; gap: 16px; margin: 4px 0 2px; font-size: 11.5px; font-weight: 600; opacity: .95; }
.spark-legend .sl-item { display: inline-flex; align-items: center; gap: 6px; }
.spark-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
@media (max-width: 880px) { .fluxo-hero { grid-template-columns: 1fr; } .fluxo-hero-value { font-size: 30px; } .fluxo-hero-sparks { grid-template-columns: 1fr; } }

/* Setas de tendência (delta) — usadas no hero do Fluxo */
.kpi-delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 12.5px; padding: 3px 8px; border-radius: 999px; }
.kpi-delta.up   { background: rgba(34,197,94,.18);  color: #f0fdf4; }
.kpi-delta.down { background: rgba(239,68,68,.22);  color: #fef2f2; }
.kpi-delta.flat { background: rgba(255,255,255,.18); color: #fff; }

/* ============ FASE 8 — cabeçalho global, componentes e premium ============ */
/* Topbar: seletor de empresa grande + ícones */
.empresa-select { font-size: 16px; font-weight: 700; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 34px 8px 12px; max-width: 320px; cursor: pointer; }
.empresa-select:hover { border-color: var(--primary); }
#empresa-picker { display: flex; align-items: center; gap: 8px; min-width: 0; }
.icon-btn { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); border-radius: 11px; cursor: pointer; font-size: 17px; display: grid; place-items: center; transition: .15s; }
.icon-btn:hover { background: var(--surface-2); transform: translateY(-1px); }
/* Logo no topo: oculta no desktop (a marca já está na sidebar); visível só no mobile (gradiente). */
.logo-home { display: none; border: 0; background: transparent; padding: 0; width: 40px; height: 40px; cursor: pointer; flex: 0 0 auto; place-items: center; }
.logo-home svg { width: 36px; height: 36px; border-radius: 9px; display: block; }

/* Dropdown próprio de empresa */
.emp-dd { position: relative; min-width: 0; }
.emp-trigger { display: flex; align-items: center; gap: 9px; max-width: 320px; min-width: 0; font: inherit; font-size: 15px; font-weight: 700; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; cursor: pointer; transition: .15s; }
.emp-trigger:hover { border-color: var(--primary); }
.emp-trigger .emp-ico { width: 20px; height: 20px; color: var(--primary); flex: 0 0 auto; display: grid; place-items: center; }
.emp-trigger .emp-ico svg { width: 18px; height: 18px; }
.emp-nome { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-caret { margin-left: auto; color: var(--muted); font-size: 12px; transition: transform .15s; }
.emp-dd.open .emp-caret { transform: rotate(180deg); }
.emp-panel { position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px; max-width: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 7px; z-index: 50; animation: gpr-fade .14s ease both; }
.emp-panel-head { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 8px 8px; }
.emp-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.emp-item { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; font: inherit; font-size: 14px; font-weight: 600; color: var(--text); background: transparent; border: 0; border-radius: 9px; padding: 9px 10px; cursor: pointer; }
.emp-item:hover { background: var(--surface-2); }
.emp-item.active { background: var(--blue-bg); color: var(--primary-d); }
.emp-item .emp-ico { width: 18px; height: 18px; flex: 0 0 auto; display: grid; place-items: center; }
.emp-item .emp-ico svg { width: 17px; height: 17px; }
.emp-item-nome { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.emp-check { color: var(--primary); font-weight: 800; }
.emp-add { display: flex; align-items: center; gap: 6px; width: 100%; font: inherit; font-size: 13.5px; font-weight: 700; color: var(--primary); background: transparent; border: 0; border-top: 1px solid var(--line); margin-top: 6px; padding: 11px 10px 6px; cursor: pointer; }
.emp-add:hover { color: var(--primary-d); }
[data-theme="dark"] .emp-item.active { background: var(--surface-2); color: #6ea8ff; }

/* ===== Combo multi-empresa (consolidação) + cor por empresa ===== */
.emp-item { gap: 6px; padding: 5px 7px; }
.emp-pick { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--text); background: transparent; border: 0; border-radius: 8px; padding: 5px 4px; cursor: pointer; text-align: left; }
.emp-pick:hover { color: var(--primary-d); }
.emp-item.primary { background: var(--blue-bg); }
[data-theme="dark"] .emp-item.primary { background: var(--surface-2); }
.emp-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; display: inline-block; vertical-align: middle; box-shadow: 0 0 0 2px var(--surface); }
.emp-cell { white-space: nowrap; font-weight: 600; }
.emp-cell .emp-dot { margin-right: 6px; }
.emp-color-list { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 7px; }
.emp-color-list li { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.emp-tag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); background: var(--blue-bg); border-radius: 6px; padding: 1px 6px; margin-left: 6px; flex: 0 0 auto; }
.emp-chk { width: 24px; height: 24px; flex: 0 0 auto; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--primary); background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; transition: .12s; }
.emp-chk.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.emp-chk:hover { border-color: var(--primary); }
.emp-panel-hint { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--muted); }
.emp-trigger .emp-dot { width: 12px; height: 12px; }
.emp-trigger.agg { border-color: var(--primary); }

/* Banner do modo consolidado (só-leitura) */
.agg-banner { display: flex; align-items: center; gap: 8px; background: var(--blue-bg); color: var(--primary-d); border: 1px solid var(--primary); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; }
.agg-banner.ro-banner { background: var(--amber-bg); color: #92400e; border-color: var(--amber); }
[data-theme="dark"] .agg-banner.ro-banner { background: var(--surface-2); color: #fcd34d; }
[data-theme="dark"] .agg-banner { background: var(--surface-2); color: #cfe0ff; }
.sidebar-tema { display: none; }

/* ---- Cadastro (redesign) ---- */
.cad-section { margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head .ch-h { font-size: 15px; font-weight: 800; }
.card-head .hint { margin-top: 2px; }
.card-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.table-flat { box-shadow: none; }
.col-icon { width: 84px; }
.col-mini { width: 30px; }
.badge-ano { background: var(--primary); color: #fff; border-radius: 6px; padding: 2px 9px; font-size: 12px; font-weight: 700; }
.cat-grupo { margin-top: 14px; }
.cat-grupo:first-child { margin-top: 0; }
.cat-grupo-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--line); }
.cat-grupo:first-child .cat-grupo-head { border-top: 0; }
.cat-grupo-head strong { font-size: 13.5px; }
.btn-icon[disabled] { opacity: .3; cursor: default; pointer-events: none; }
.cad-import summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.cad-import[open] summary { margin-bottom: 10px; }

/* Cabeçalho de período (anos + meses), sticky com leve glassmorphism */
#period-bar { position: sticky; top: 60px; z-index: 25; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(160%) blur(8px); border-bottom: 1px solid var(--line); padding: 9px 24px; }
.period-inner { display: flex; flex-direction: column; gap: 7px; }
.period-inner .chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); width: 44px; flex: 0 0 44px; }
#period-bar .chip { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-weight: 600; font-size: 12.5px; cursor: pointer; transition: .12s; user-select: none; }
#period-bar .chip:hover { border-color: var(--primary); color: var(--primary); }
#period-bar .chip.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px rgba(29,78,216,.3); }
.chips-anos .chip { font-weight: 800; }
@media (max-width: 768px) { #period-bar { padding: 8px 14px; } #content { padding: 16px 14px 72px; } }

/* Busca que cresce + legenda-filtro de status */
.search-grow { flex: 1 1 240px; min-width: 180px; }
.status-pill { cursor: default; }
button.status-pill { cursor: pointer; transition: .12s; }
button.status-pill:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
button.status-pill.dim { opacity: .42; }
button.status-pill.sel { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Flag de recorrência inline (ao lado da categoria) */
.cat-cell { white-space: nowrap; }
.rec-flag { border: none; background: transparent; cursor: pointer; font-size: 14px; opacity: .35; filter: grayscale(1); margin-left: 4px; vertical-align: middle; transition: .12s; }
.rec-flag:hover { opacity: .9; transform: scale(1.15); }
.rec-flag.on { opacity: 1; filter: none; }

/* Autocomplete custom (cliente / recebedor) */
.ac-pop { position: absolute; z-index: 200; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; max-width: 280px; max-height: 240px; overflow: auto; }
.ac-item { display: block; width: 100%; text-align: left; border: none; background: transparent; padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-item:hover { background: var(--surface-2); }
.ac-new { color: var(--primary); font-weight: 700; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }
.ac-empty { padding: 8px 10px; color: var(--muted); font-size: 12.5px; }

/* Popover de recorrência */
.rec-pop { position: absolute; z-index: 210; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 14px; width: 250px; }
.rec-pop-title { font-weight: 800; font-size: 13.5px; margin-bottom: 10px; }
.rec-pop-f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 9px; }
.rec-pop-f select, .rec-pop-f input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13px; color: var(--text); background: var(--surface); }
.rec-pop-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.rec-pop-actions button { padding: 7px 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; font-weight: 600; cursor: pointer; }
.rec-pop-actions .btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
/* Destaque da LINHA e da CÉLULA em edição (lançamentos) — segue o foco ao dar TAB */
.tbl-frozen tbody tr:focus-within > td { background: rgba(29, 78, 216, .10); }
.tbl-frozen tbody tr:focus-within > td:first-child { box-shadow: inset 4px 0 0 var(--primary); }
.tbl-frozen td:focus-within { box-shadow: inset 0 0 0 2px var(--primary); border-radius: 6px; }
[data-theme="dark"] .tbl-frozen tbody tr:focus-within > td { background: rgba(96, 165, 250, .16); }

/* Coluna de seleção + popover de escolha (remover só esta / esta e as próximas) */
.col-chk { width: 34px; text-align: center; }
.col-chk input { cursor: pointer; }
/* Coluna de Ações fixada no início (ao lado da caixa de seleção), grudada na esquerda ao rolar */
.col-acoes { white-space: nowrap; width: 78px; }
.tbl-frozen th.col-chk, .tbl-frozen td.col-chk { position: sticky; left: 0; z-index: 2; background: var(--surface); }
.tbl-frozen th.col-acoes, .tbl-frozen td.col-acoes { position: sticky; left: 34px; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.tbl-frozen thead th.col-chk, .tbl-frozen thead th.col-acoes { z-index: 3; background: var(--surface-2); }
/* mantém a cor do status nas colunas fixas */
.tbl-frozen tr.st-ok td.col-chk, .tbl-frozen tr.st-ok td.col-acoes { background: #f4fbf6; }
.tbl-frozen tr.st-bad td.col-chk, .tbl-frozen tr.st-bad td.col-acoes { background: #fee2e2; }
.tbl-frozen tr.st-warn td.col-chk, .tbl-frozen tr.st-warn td.col-acoes { background: #fef3c7; }
.tbl-frozen tr.st-info td.col-chk, .tbl-frozen tr.st-info td.col-acoes { background: #f4f8ff; }
.tbl-frozen tr:focus-within td.col-chk, .tbl-frozen tr:focus-within td.col-acoes { background: #e8efff; }
[data-theme="dark"] .tbl-frozen th.col-chk, [data-theme="dark"] .tbl-frozen td.col-chk,
[data-theme="dark"] .tbl-frozen th.col-acoes, [data-theme="dark"] .tbl-frozen td.col-acoes { background: var(--surface); }
[data-theme="dark"] .tbl-frozen thead th.col-chk, [data-theme="dark"] .tbl-frozen thead th.col-acoes { background: var(--surface-2); }
[data-theme="dark"] .tbl-frozen tr.st-ok td.col-chk, [data-theme="dark"] .tbl-frozen tr.st-ok td.col-acoes { background: #142a1d; }
[data-theme="dark"] .tbl-frozen tr.st-bad td.col-chk, [data-theme="dark"] .tbl-frozen tr.st-bad td.col-acoes { background: #371d22; }
[data-theme="dark"] .tbl-frozen tr.st-warn td.col-chk, [data-theme="dark"] .tbl-frozen tr.st-warn td.col-acoes { background: #382f10; }
[data-theme="dark"] .tbl-frozen tr.st-info td.col-chk, [data-theme="dark"] .tbl-frozen tr.st-info td.col-acoes { background: #14233f; }
.choice-list { display: flex; flex-direction: column; gap: 6px; }
.choice-btn { text-align: left; padding: 9px 11px; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; }
.choice-btn:hover { background: var(--surface-2); }
.choice-btn.danger { color: var(--red); border-color: #fecaca; }

/* Gráficos: 1 por linha (faturamento por canal / despesas por categoria) */
.charts-grid-1 { grid-template-columns: 1fr !important; }

/* Linha inteira destacada quando o total é negativo */
tr.row-neg > td { background: var(--red-bg); }
tr.row-neg > td:first-child { box-shadow: inset 3px 0 0 var(--red); }

/* Microinterações / animações de entrada */
@keyframes gpr-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#content > div > .card, #content > div > .grid > .card, #content > div > .kpis > .kpi { animation: gpr-fade .26s ease both; }
.card { transition: box-shadow .16s, transform .16s; }
.chart-box:hover, .kpi.kpi-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn { transition: background .12s, transform .1s, box-shadow .12s; }
.btn:active { transform: translateY(1px); }

/* Início executivo */
.card-head { font-weight: 800; font-size: 14px; margin-bottom: 10px; }
.acao-list { display: flex; flex-direction: column; gap: 7px; }
.acao-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 11px; background: var(--surface-2); text-decoration: none; color: var(--text); border: 1px solid transparent; transition: .12s; }
.acao-item:hover { border-color: var(--primary); transform: translateX(2px); }
.acao-item.bad { background: var(--red-bg); }
.acao-item.warn { background: var(--amber-bg); }
.acao-item.ok { opacity: .6; }
.acao-ic { font-size: 15px; }
.acao-txt { flex: 1; font-size: 13.5px; }
.acao-val { font-weight: 800; font-variant-numeric: tabular-nums; }
.prev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.prev-lbl { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.prev-val { font-size: 19px; font-weight: 800; margin-top: 3px; }
.prev-val.green { color: var(--green); } .prev-val.red { color: var(--red); }
.ini-gauge { display: grid; place-items: center; padding-top: 4px; }
.ini-atalhos { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.ini-atalhos .btn { text-decoration: none; }
.alerta-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; margin-bottom: 6px; font-size: 13px; }
.alerta-item.st-bad { background: var(--red-bg); } .alerta-item.st-warn { background: var(--amber-bg); } .alerta-item.st-ok { background: var(--green-bg); }
.num.green { color: var(--green); } .num.red { color: var(--red); }

/* ============ TEMA ESCURO ============ */
[data-theme="dark"] {
  --bg: #0B1120; --surface: #111A2E; --surface-2: #1B2740;
  --line: #243149; --text: #E6EDF7; --muted: #93A4BF; --muted-2: #64748B;
  --blue-bg: #15315A; --green-bg: #143626; --red-bg: #3B1E22; --amber-bg: #3A300F; --purple-bg: #2A2456; --orange-bg: #3A2613;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.45);
  --shadow-lg: 0 16px 44px rgba(0,0,0,.6);
}
[data-theme="dark"] body { background: var(--bg); }
[data-theme="dark"] tr.st-bad > td { background: #371d22; }
[data-theme="dark"] tr.st-warn > td { background: #382f10; }
[data-theme="dark"] tr.st-ok > td { background: #142a1d; }
[data-theme="dark"] tr.st-info > td { background: #14233f; }
[data-theme="dark"] .status-pill { color: var(--text); }
[data-theme="dark"] .grp-row td { background: #18233b; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] .money, [data-theme="dark"] .inp-flush { background: var(--surface-2); color: var(--text); border-color: var(--line); }
[data-theme="dark"] .badge.ok { background: #143626; color: #6ee7b7; }
/* Texto de callout legível no escuro (frase de meta no Início/Metas). */
[data-theme="dark"] .callout { color: var(--text); border-color: var(--line); }
[data-theme="dark"] .callout.warn { color: #fbbf24; border-color: #5a4a18; }
/* Botões de ícone (⚙, tema, logo) mais claros/visíveis no escuro. */
[data-theme="dark"] .icon-btn { background: var(--surface-2); border-color: #3a4a66; color: var(--text); }
[data-theme="dark"] .icon-btn:hover { background: #28354f; border-color: var(--primary); }
[data-theme="dark"] .icon-btn .ico-glyph { filter: brightness(0) invert(.82); }
[data-theme="dark"] .logo-home { color: #6ea8ff; }

/* ============ IMPRESSÃO ============ */
@media print {
  #sidebar, #sidebar-overlay, #topbar, #period-bar, .toolbar, .no-print, .seg, [data-action], [data-export], .chips, .status-legend, .dlg, .ac-pop, .rec-pop, .fluxo-hero-sparks { display: none !important; }
  #layout, #main { display: block; }
  #content { padding: 0 !important; }
  .table-wrap, .tbl-frozen { max-height: none !important; overflow: visible !important; box-shadow: none !important; border: 1px solid #ccc; }
  .card { box-shadow: none !important; break-inside: avoid; }
  body { background: #fff; }
  th { position: static !important; }
  .fluxo-hero { background: #f1f5f9 !important; color: var(--text) !important; box-shadow: none !important; }
  .fluxo-hero-meta .hint, .kpi-delta { color: var(--text) !important; }
}

/* ===== Tela de login / reset / nova senha / termos (auth — identidade GPR) ===== */
#auth-gate { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; overflow: auto;
  background:
    radial-gradient(1100px 560px at 50% -12%, rgba(29,78,216,.12), transparent 60%),
    radial-gradient(820px 460px at 108% 116%, rgba(22,163,74,.12), transparent 60%),
    var(--bg); }
.auth-shell { width: 100%; max-width: 404px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 32px 30px; animation: gpr-fade .2s ease both; }
.auth-shell.auth-wide { max-width: 560px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-logo, .auth-logo svg { width: 40px; height: 40px; display: block; flex: 0 0 auto; }
.auth-brand-txt { line-height: 1.15; }
.auth-brand-txt strong { display: block; font-size: 19px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.auth-brand-txt span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.auth-title { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.auth-subtitle { margin: 6px 0 16px; font-size: 13.5px; color: var(--muted); }
.auth-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin: 14px 0 6px; }
.auth-input { width: 100%; font: inherit; font-size: 14.5px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 13px; transition: .14s; }
.auth-input::placeholder { color: var(--muted-2); }
.auth-input:focus { outline: none; border-color: var(--primary); box-shadow: var(--glow); }
.auth-btn { width: 100%; margin-top: 20px; font: inherit; font-size: 15px; font-weight: 700; color: #fff; background: var(--grad-primary); border: 0; border-radius: var(--r); padding: 12px; cursor: pointer; transition: .15s; box-shadow: 0 6px 16px rgba(29,78,216,.25); }
.auth-btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 10px 22px rgba(29,78,216,.3); }
.auth-btn:disabled { opacity: .6; cursor: default; transform: none; box-shadow: none; }
.auth-links { margin-top: 18px; text-align: center; font-size: 13px; }
.auth-links a { color: var(--primary); cursor: pointer; text-decoration: none; font-weight: 600; }
.auth-links a:hover { text-decoration: underline; }
.auth-dot { color: var(--muted-2); margin: 0 8px; }
.auth-err { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 16px; text-align: center; }
.auth-msg.ok { background: var(--green-bg); color: var(--green-d); border-radius: var(--r-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 4px; text-align: center; }
.auth-terms { max-height: 42vh; overflow: auto; white-space: pre-wrap; font-size: 13px; line-height: 1.55; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin: 14px 0; }
.auth-check { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--text); margin-top: 4px; }
.auth-check input { margin-top: 2px; }
[data-theme="dark"] #auth-gate { background: radial-gradient(1100px 560px at 50% -12%, rgba(29,78,216,.2), transparent 60%), var(--bg); }

/* Banner não-bloqueante (oferta de importar dados deste navegador) */
.legado-banner { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 1100; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); border-radius: 12px; padding: 11px 16px; display: flex; align-items: center; gap: 10px; font-size: 13.5px; max-width: 92vw; animation: gpr-fade .2s ease both; }

/* GPR Core (admin) */
.cfg-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text); }
.ig-sub { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 4px 0 2px; }
.cfg-field select, .cfg-field input { font: inherit; }
.nav-admin { margin-top: 4px; }
