/* ==========================================================================
   Pré-vendas Analytics — design system
   Cores com significado fixo: investido (índigo) · adjudicado (verde) · perdido (vermelho) · em curso (âmbar)
   ========================================================================== */
:root {
  --bg: #f5f6fb; --surface: #ffffff; --surface-2: #f0f2f8; --surface-3: #e8ebf4;
  --border: #e3e6ef; --border-strong: #cfd4e2;
  --text: #0f172a; --text-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --brand: #4f46e5; --brand-2: #6366f1; --brand-soft: #eef2ff; --on-brand: #ffffff;
  --inv: #6366f1; --adj: #10b981; --lost: #f43f5e; --open: #f59e0b;
  --visita: #0ea5e9; --prevenda: #8b5cf6; --apres: #ec4899; --outro: #94a3b8;
  --good: #047857; --bad: #be123c; --good-soft: #d1fae5; --bad-soft: #ffe4e6; --warn-soft: #fef3c7; --warn: #92400e;
  --shadow: 0 1px 2px rgb(15 23 42 / .05), 0 6px 20px rgb(15 23 42 / .05);
  --shadow-lg: 0 10px 40px rgb(15 23 42 / .18);
  --radius: 14px; --radius-sm: 9px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar: 240px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1f; --surface: #121a31; --surface-2: #19223f; --surface-3: #212c50;
    --border: #243055; --border-strong: #33427a;
    --text: #e8ecf8; --text-2: #c3cbe3; --muted: #93a0c4; --faint: #64739c;
    --brand: #818cf8; --brand-2: #818cf8; --brand-soft: #1e2750; --on-brand: #0a0f1f;
    --inv: #818cf8; --adj: #34d399; --lost: #fb7185; --open: #fbbf24;
    --visita: #38bdf8; --prevenda: #a78bfa; --apres: #f472b6; --outro: #7c8bb0;
    --good: #6ee7b7; --bad: #fda4af; --good-soft: #0b3b30; --bad-soft: #4a1626; --warn-soft: #43320a; --warn: #fcd34d;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 6px 20px rgb(0 0 0 / .3);
    --shadow-lg: 0 10px 40px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f1f; --surface: #121a31; --surface-2: #19223f; --surface-3: #212c50;
  --border: #243055; --border-strong: #33427a;
  --text: #e8ecf8; --text-2: #c3cbe3; --muted: #93a0c4; --faint: #64739c;
  --brand: #818cf8; --brand-2: #818cf8; --brand-soft: #1e2750; --on-brand: #0a0f1f;
  --inv: #818cf8; --adj: #34d399; --lost: #fb7185; --open: #fbbf24;
  --visita: #38bdf8; --prevenda: #a78bfa; --apres: #f472b6; --outro: #7c8bb0;
  --good: #6ee7b7; --bad: #fda4af; --good-soft: #0b3b30; --bad-soft: #4a1626; --warn-soft: #43320a; --warn: #fcd34d;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 6px 20px rgb(0 0 0 / .3);
  --shadow-lg: 0 10px 40px rgb(0 0 0 / .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.sp { height: 14px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; color: var(--on-brand); flex: none; }
.brand b { display: block; font-size: 15px; line-height: 1.1; }
.brand span { font-size: 11.5px; color: var(--muted); }
.nav-group { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--text-2); font-weight: 500; }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.nav svg { width: 18px; height: 18px; flex: none; }
.side-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; flex: none; }
.me small { display: block; color: var(--muted); font-size: 11.5px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 16px 28px 6px; }
.topbar h1 { font-size: 22px; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.burger { display: none; }
.content { padding: 8px 28px 48px; max-width: 1560px; width: 100%; container-type: inline-size; }

/* ---------- filter bar ---------- */
.filters { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); padding: 10px 28px; border-bottom: 1px solid transparent; }
.filters.stuck { border-bottom-color: var(--border); }
.fbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fpanel { margin-top: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 14px; }
.fpanel .field > label { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.fpanel .wide { grid-column: 1 / -1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 13px; color: var(--text-2); user-select: none; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 2px 6px 2px 10px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.tag button { all: unset; cursor: pointer; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; }
.tag button:hover { background: color-mix(in srgb, var(--brand) 20%, transparent); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 550; color: var(--text); white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { filter: brightness(1.08); background: var(--brand); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.input, .select, textarea.input { width: 100%; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); outline: none; }
.input:focus, .select:focus, textarea.input:focus, .btn:focus-visible, .chip:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.select.inline, .input.inline { width: auto; }
textarea.input { resize: vertical; min-height: 70px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; border: 1px solid var(--border); flex-wrap: wrap; }
.seg button { all: unset; cursor: pointer; padding: 5px 12px; border-radius: 8px; font-weight: 550; color: var(--muted); font-size: 13px; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgb(0 0 0 / .12); font-weight: 650; }
.seg button:focus-visible { outline: 2px solid var(--brand); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

/* multi-select */
.ms { position: relative; }
.ms-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; text-align: left; }
.ms-btn .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-btn.has { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.ms-pop { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; min-width: 100%; width: 270px; max-width: 86vw; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px; }
.ms-list { max-height: 260px; overflow: auto; margin-top: 6px; }
.ms-item { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.ms-item:hover { background: var(--surface-2); }
.ms-item input { accent-color: var(--brand); width: 15px; height: 15px; }
.ms-item small { color: var(--muted); margin-left: auto; }
.ms-foot { display: flex; justify-content: space-between; padding-top: 6px; border-top: 1px solid var(--border); margin-top: 6px; }

/* ---------- cards & layout ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-main-r { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card > header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card > header h3 { font-size: 15px; }
.card > header p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card > header .grow { min-width: 160px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > header { padding: 16px 18px 0; margin-bottom: 12px; }
.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 380px; }
.chart-box.short { height: 220px; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@container (min-width: 620px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (min-width: 1060px) { .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent, var(--brand)); }
.kpi .lbl { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 2px; line-height: 1.15; }
.kpi .val small { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi .sub { color: var(--muted); font-size: 12.5px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); margin-left: 6px; vertical-align: middle; }
.delta.up { background: var(--good-soft); color: var(--good); }
.delta.down { background: var(--bad-soft); color: var(--bad); }
.help { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--surface-3); color: var(--muted); font-size: 10px; font-weight: 700; cursor: help; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; }
.pill.ganho { background: var(--good-soft); color: var(--good); }
.pill.perdido { background: var(--bad-soft); color: var(--bad); }
.pill.em_curso { background: var(--warn-soft); color: var(--warn); }
.pill.neutral { background: var(--surface-3); color: var(--text-2); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ---------- tables ---------- */
.tbl-wrap { overflow: auto; max-width: 100%; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; z-index: 1; }
.tbl th.num { text-align: right; }
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th .arr { opacity: .35; margin-left: 4px; font-size: 10px; }
.tbl th.sorted .arr { opacity: 1; color: var(--brand); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); position: sticky; bottom: 0; }
.tbl .sub { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.tbl .name { font-weight: 600; }
.bar-cell { position: relative; min-width: 110px; }
.bar-cell .bar { position: absolute; left: 12px; top: 50%; height: 22px; transform: translateY(-50%); border-radius: 5px; opacity: .22; background: var(--c, var(--inv)); }
.bar-cell span { position: relative; display: block; text-align: right; }
.ret { font-weight: 700; }
.ret.hi { color: var(--good); }
.ret.lo { color: var(--bad); }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); }
.stack { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-3); min-width: 90px; }
.stack i { display: block; height: 100%; }

/* ---------- heatmap ---------- */
.heat { border-collapse: separate; border-spacing: 3px; font-size: 12.5px; }
.heat th { font-weight: 600; color: var(--text-2); padding: 6px 8px; text-align: center; white-space: nowrap; font-size: 12px; }
.heat th.rowh { text-align: right; position: sticky; left: 0; background: var(--surface); }
.heat td { min-width: 62px; height: 40px; text-align: center; border-radius: 7px; background: color-mix(in srgb, var(--hc, var(--brand)) calc(var(--p, 0) * 85%), var(--surface-2)); color: var(--text); font-weight: 600; cursor: default; }
.heat td.zero { background: var(--surface-2); color: var(--faint); font-weight: 400; }
.heat td.strong { color: #fff; }
.heat td.tot, .heat th.tot { background: transparent; border-left: 2px solid var(--border); font-weight: 700; }
.legend { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.legend .ramp { width: 120px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--hc, var(--brand))); }

/* ---------- ranking ---------- */
.rank { display: flex; flex-direction: column; gap: 10px; }
.rk { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.rk .pos { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-3); color: var(--text-2); }
.rk:nth-child(1) .pos { background: #fde68a; color: #78350f; }
.rk:nth-child(2) .pos { background: #e2e8f0; color: #334155; }
.rk:nth-child(3) .pos { background: #fed7aa; color: #7c2d12; }
.rk .nm { font-weight: 650; }
.rk .track { height: 7px; border-radius: 4px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.rk .track i { display: block; height: 100%; border-radius: 4px; background: var(--adj); }
.rk .v { text-align: right; font-weight: 750; font-size: 17px; }
.rk .v small { display: block; font-weight: 450; font-size: 12px; color: var(--muted); }

/* funnel */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.fn { display: grid; grid-template-columns: 120px 1fr 72px; gap: 10px; align-items: center; }
.fn .t { font-size: 13px; color: var(--text-2); }
.fn .b { height: 26px; background: var(--surface-2); border-radius: 7px; overflow: hidden; }
.fn .b i { display: block; height: 100%; background: var(--brand-2); border-radius: 7px; min-width: 3px; }
.fn .n { text-align: right; font-weight: 700; }
.fn .n small { display: block; font-weight: 450; color: var(--muted); font-size: 11.5px; }
.legend-list { display: flex; flex-direction: column; gap: 8px; }
.legend-list .li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; font-size: 13px; }

/* ---------- modal / drawer / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgb(8 12 28 / .55); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .14s ease-out; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: 92vh; display: flex; flex-direction: column; }
.modal.wide { width: min(780px, 100%); }
.modal > header { padding: 18px 22px 8px; display: flex; align-items: center; gap: 10px; }
.modal > header h3 { font-size: 17px; flex: 1; }
.modal .body { padding: 8px 22px 16px; overflow: auto; }
.modal > footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.drawer-ov { place-items: stretch end; padding: 0; }
.drawer { background: var(--surface); width: min(640px, 100%); height: 100%; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .18s ease-out; border-left: 1px solid var(--border); }
.drawer > header { padding: 18px 22px 12px; display: flex; align-items: flex-start; gap: 10px; border-bottom: 1px solid var(--border); }
.drawer .body { padding: 18px 22px 28px; overflow: auto; flex: 1; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.f { display: flex; flex-direction: column; gap: 4px; }
.form .f.full { grid-column: 1 / -1; }
label.l { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.form .hint { font-size: 12px; color: var(--muted); }
.err { color: var(--bad); background: var(--bad-soft); padding: 8px 12px; border-radius: 9px; font-size: 13px; margin-top: 10px; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 11px; box-shadow: var(--shadow-lg); font-weight: 550; max-width: 380px; animation: slide-up .18s ease-out; }
.toast.err { background: var(--bad); color: #fff; }
.toast.ok { background: #047857; color: #fff; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@keyframes slide-up { from { transform: translateY(10px); opacity: 0; } }

/* timeline */
.tl { display: flex; flex-direction: column; }
.tl .it { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); align-items: start; }
.tl .it:last-child { border-bottom: 0; }
.tl .it .dot { margin-top: 5px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(900px 500px at 15% 0%, color-mix(in srgb, var(--brand) 20%, transparent), transparent 60%),
  radial-gradient(700px 400px at 100% 100%, color-mix(in srgb, var(--adj) 16%, transparent), transparent 60%), var(--bg); }
.auth .card { width: min(400px, 100%); padding: 30px; }
.auth h1 { font-size: 22px; margin: 14px 0 4px; }

.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 12px; min-height: 90px; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.note { background: var(--brand-soft); color: var(--text-2); border-radius: 12px; padding: 12px 14px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.note svg { width: 18px; height: 18px; flex: none; color: var(--brand); margin-top: 1px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow: auto; }
.tabs button { all: unset; cursor: pointer; padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .g-main, .g-main-r, .g3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .burger { display: inline-flex; }
  .topbar, .filters, .content { padding-left: 16px; padding-right: 16px; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .form { grid-template-columns: minmax(0, 1fr); }
  .fn { grid-template-columns: 90px 1fr 64px; }
}
@media print {
  .sidebar, .filters, .burger, .btn, .toasts { display: none !important; }
  .shell { display: block; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
}

/* realce de linha/coluna escolhida nos mapas de calor */
.heat td.hl { box-shadow: inset 0 0 0 2px var(--brand); }
.heat th.hl { color: var(--brand); }
.heat th.rowh.hl { color: var(--brand); }
.heat tfoot td.tot, .heat tfoot th { border-top: 2px solid var(--border); }

/* painel de filtros aberto: deixa de ser fixo (senao tapa o conteudo ao fazer scroll) */
.filters.open { position: static; }
