/* Goupipe — Painel do dono. Tokens, tema escuro (padrão) e claro, componentes. */
:root {
  --violet: #7c3aed; --violet-2: #9d5cf5; --violet-3: #5b21b6;
  --bg: #0b0b12; --bg-2: #111119; --surface: #17171f; --surface-2: #1f1f2a; --surface-3: #272734;
  --border: #272734; --border-2: #363646;
  --text: #eeedf6; --muted: #a3a2b5; --faint: #8a89a0;
  --green: #22c55e; --amber: #f59e0b; --red: #ef4444; --blue: #3b82f6;
  --ok-fg: #86efac; --ok-bg: rgba(34,197,94,.13); --ok-bd: rgba(34,197,94,.35);
  --warn-fg: #fcd34d; --warn-bg: rgba(245,158,11,.13); --warn-bd: rgba(245,158,11,.35);
  --bad-fg: #fca5a5; --bad-bg: rgba(239,68,68,.13); --bad-bd: rgba(239,68,68,.35);
  --info-fg: #93c5fd; --info-bg: rgba(59,130,246,.13); --info-bd: rgba(59,130,246,.35);
  --brand-fg: #d8b4fe; --brand-bg: rgba(124,58,237,.18); --brand-bd: rgba(124,58,237,.45);
  --gray-fg: #b4b3c4; --gray-bg: rgba(163,162,181,.12); --gray-bd: var(--border-2);
  --nav-on: linear-gradient(90deg, rgba(124,58,237,.26), rgba(124,58,237,.06));
  --shadow: 0 24px 60px rgba(0,0,0,.55); --shadow-sm: 0 8px 24px rgba(0,0,0,.35);
  --ring: 0 0 0 3px rgba(124,58,237,.28);
  --skel-a: #1f1f2a; --skel-b: #2a2a38;
  --radius: 12px; --radius-lg: 16px;
  --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f3fa; --bg-2: #ffffff; --surface: #ffffff; --surface-2: #f3f1fb; --surface-3: #e9e6f6;
  --border: #e3e1ee; --border-2: #cfccdf;
  --text: #17162a; --muted: #595871; --faint: #6e6d82;
  --green: #16a34a; --amber: #d97706; --red: #dc2626; --blue: #2563eb;
  --ok-fg: #166534; --ok-bg: rgba(22,163,74,.11); --ok-bd: rgba(22,163,74,.3);
  --warn-fg: #92400e; --warn-bg: rgba(217,119,6,.12); --warn-bd: rgba(217,119,6,.32);
  --bad-fg: #b91c1c; --bad-bg: rgba(220,38,38,.1); --bad-bd: rgba(220,38,38,.3);
  --info-fg: #1d4ed8; --info-bg: rgba(37,99,235,.1); --info-bd: rgba(37,99,235,.3);
  --brand-fg: #5b21b6; --brand-bg: rgba(124,58,237,.1); --brand-bd: rgba(124,58,237,.35);
  --gray-fg: #4b4a5e; --gray-bg: rgba(75,74,94,.09); --gray-bd: var(--border-2);
  --nav-on: linear-gradient(90deg, rgba(124,58,237,.14), rgba(124,58,237,.03));
  --shadow: 0 24px 60px rgba(40,30,90,.18); --shadow-sm: 0 8px 24px rgba(40,30,90,.1);
  --ring: 0 0 0 3px rgba(124,58,237,.22);
  --skel-a: #ecebf4; --skel-b: #f6f5fb;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 13.5px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--violet-2); }
:root[data-theme="light"] a { color: #6d28d9; }
[hidden] { display: none !important; }
b, strong { font-weight: 600; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.2px; }
:focus-visible { outline: 2px solid var(--violet-2); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.logo { width: 36px; height: 36px; border-radius: 10px; object-fit: contain; display: block; }

/* ── Tela de entrada ─────────────────────────────────────────────── */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(900px 500px at 50% -10%, rgba(124,58,237,.2), transparent 60%), var(--bg); }
.gate .box { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px 30px; box-shadow: var(--shadow); }
.gate .logo { margin: 0 auto 16px; width: 44px; height: 44px; }
.gate h1 { font-size: 20px; margin: 0 0 4px; text-align: center; }
.gate .lead { color: var(--muted); font-size: 12.5px; text-align: center; margin: 0 0 22px; }
.gate .err { color: var(--bad-fg); font-size: 12.5px; margin-top: 10px; text-align: center; min-height: 18px; }
.gate .links { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; font-size: 12px; flex-wrap: wrap; }
.gate .links button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.gate .links button:hover { color: var(--text); }
.gate .panel { display: none; } .gate .panel.on { display: block; }
.gate .theme-corner { position: fixed; top: 16px; right: 16px; }

/* ── Layout ───────────────────────────────────────────────────────── */
.app { display: none; min-height: 100vh; }
.app.on { display: flex; }
.side { width: 240px; flex-shrink: 0; background: var(--bg-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 12px; }
.brand b { font-size: 16px; display: block; line-height: 1.15; }
.brand small { display: block; color: var(--faint); font-size: 10.5px; letter-spacing: .6px; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; }
.nav .group { color: var(--faint); font-size: 10.5px; letter-spacing: .8px; text-transform: uppercase; font-weight: 600; padding: 12px 10px 4px; }
.nav button { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; color: var(--muted); text-align: left; padding: 9px 10px; border-radius: 9px; cursor: pointer; transition: background .12s, color .12s; font-weight: 500; }
.nav button:hover { background: var(--surface-2); color: var(--text); }
.nav button.active { background: var(--nav-on); color: var(--text); box-shadow: inset 2px 0 0 var(--violet-2); }
.nav button svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav button .cnt { margin-left: auto; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.who { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.who .av { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(140deg, var(--violet-2), var(--violet-3)); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 12px; flex-shrink: 0; }
.who b { display: block; font-size: 12.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--faint); font-size: 11px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .txt { min-width: 0; }
.side-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 29; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 26px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 17px; margin: 0; white-space: nowrap; }
.topbar .sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .ttl { min-width: 0; }
.topbar .spacer { flex: 1; }
.burger { display: none; }
.content { padding: 20px 26px 48px; }
section.view { display: none; animation: fade .18s ease; }
section.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Busca global */
.search { position: relative; width: 320px; max-width: 40vw; }
.search .input { padding-left: 34px; padding-right: 44px; height: 38px; }
.search svg.ic { position: absolute; left: 11px; top: 11px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search kbd { position: absolute; right: 10px; top: 9px; font: 600 10.5px var(--font); color: var(--faint); border: 1px solid var(--border-2); border-radius: 6px; padding: 1px 6px; background: var(--surface); }
.search .res { display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 40; max-height: 360px; overflow: auto; padding: 6px; }
.search.open .res { display: block; }
.search .res button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.search .res button:hover, .search .res button.sel { background: var(--surface-2); }
.search .res .t { min-width: 0; flex: 1; }
.search .res b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search .res small { color: var(--faint); font-size: 11.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search .res .none { padding: 12px; color: var(--faint); text-align: center; font-size: 12.5px; }

/* ── Botões / inputs ──────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text); padding: 8px 13px; border-radius: 9px; cursor: pointer; transition: .12s; font-size: 13px; font-weight: 500; white-space: nowrap; line-height: 1.3; }
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: var(--violet-2); background: var(--surface-3); }
.btn.primary { background: var(--violet); border-color: var(--violet); color: #fff; }
.btn.primary:hover { background: var(--violet-2); border-color: var(--violet-2); }
.btn.danger { border-color: var(--bad-bd); color: var(--bad-fg); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.btn.xs { padding: 3px 7px; font-size: 11.5px; border-radius: 6px; }
.btn.w { width: 100%; }
.btn.ghost { background: none; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn.icon { padding: 7px; width: 36px; height: 36px; }
.btn.icon svg { width: 17px; height: 17px; }
.btn:disabled { opacity: .5; cursor: default; pointer-events: none; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 3px; flex-wrap: wrap; }
.seg button { background: none; border: 0; color: var(--muted); padding: 5px 11px; border-radius: 7px; cursor: pointer; font-size: 12.5px; font-weight: 500; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--violet); color: #fff; }
.input, select.input, textarea.input { width: 100%; background: var(--bg-2); border: 1px solid var(--border-2); color: var(--text); padding: 9px 12px; border-radius: 9px; outline: none; transition: .12s; min-height: 38px; }
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--violet-2); box-shadow: var(--ring); }
select.input { appearance: none; 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='%238a89a0' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
label.f { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.field { margin-bottom: 12px; }
.field .hint { color: var(--faint); font-size: 11.5px; margin-top: 4px; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--violet); }
.money { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 9px; padding: 0 12px; }
.money span { color: var(--faint); font-weight: 600; font-size: 13px; }
.money input { flex: 1; background: none; border: 0; font-size: 18px; font-weight: 600; padding: 9px 0; width: 100%; outline: none; font-variant-numeric: tabular-nums; min-width: 0; }
.money:focus-within { border-color: var(--violet-2); box-shadow: var(--ring); }

/* ── Cards / KPIs ─────────────────────────────────────────────────── */
.grid { display: grid; gap: 14px; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
.card h3 { margin: 0 0 12px; font-size: 13.5px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card h3 .faint { font-weight: 500; font-size: 12px; }
.tile .lbl { color: var(--muted); font-size: 12px; font-weight: 500; }
.tile .val { font-size: 26px; font-weight: 600; letter-spacing: -.8px; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile .val.small { font-size: 21px; }
.tile .delta { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.tile.accent { border-color: var(--brand-bd); background: linear-gradient(160deg, var(--brand-bg), var(--surface) 65%); }
.two { grid-template-columns: 2fr 1fr; }
.three { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid > * { min-width: 0; }
@media (max-width: 1000px) { .two, .three { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ── Tabelas ──────────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .input { width: auto; min-width: 200px; }
.toolbar .grow { flex: 1; }
.toolbar .count { color: var(--faint); font-size: 12px; white-space: nowrap; }
.tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; letter-spacing: .4px; text-transform: uppercase; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--bg-2); position: sticky; top: 0; z-index: 1; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable::after { content: ""; display: inline-block; width: 0; height: 0; margin-left: 6px; border: 4px solid transparent; border-top-color: var(--border-2); vertical-align: -3px; }
th.sorted.asc::after { border-top-color: transparent; border-bottom-color: var(--violet-2); vertical-align: 2px; }
th.sorted.desc::after { border-top-color: var(--violet-2); }
td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr:hover td { background: var(--brand-bg); }
:root[data-theme="light"] tbody tr:hover td { background: rgba(124,58,237,.05); }
.sub { display: block; color: var(--faint); font-size: 11.5px; font-weight: 400; text-transform: none; letter-spacing: 0; line-height: 1.4; }
td.num, th.num { text-align: right; }
td.act-cell { text-align: right; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); margin-bottom: 4px; font-size: 14px; }
.empty p { margin: 0; font-size: 12.5px; max-width: 420px; margin-inline: auto; }
.state-err { padding: 28px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--bad-bd); border-radius: var(--radius-lg); background: var(--bad-bg); }
.state-err b { display: block; color: var(--bad-fg); margin-bottom: 4px; }
.state-err p { margin: 0 0 12px; font-size: 12.5px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.pager .pg { display: flex; gap: 4px; align-items: center; }
.pager select.input { width: auto; min-height: 30px; padding: 4px 26px 4px 8px; font-size: 12px; }
.dot-on { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.2); margin-right: 6px; vertical-align: middle; }
.dot-off { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border-2); margin-right: 6px; vertical-align: middle; }
.bar { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; width: 70px; display: inline-block; vertical-align: middle; margin-right: 6px; }
.bar i { display: block; height: 100%; background: var(--violet-2); border-radius: 999px; }
.bar.full i { background: var(--amber); }

/* Chips */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; line-height: 1.5; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.green { color: var(--ok-fg); background: var(--ok-bg); border-color: var(--ok-bd); }
.pill.amber { color: var(--warn-fg); background: var(--warn-bg); border-color: var(--warn-bd); }
.pill.red { color: var(--bad-fg); background: var(--bad-bg); border-color: var(--bad-bd); }
.pill.violet { color: var(--brand-fg); background: var(--brand-bg); border-color: var(--brand-bd); }
.pill.blue { color: var(--info-fg); background: var(--info-bg); border-color: var(--info-bd); }
.pill.gray { color: var(--gray-fg); background: var(--gray-bg); border-color: var(--gray-bd); }
.pill.nodot::before { display: none; }
.due-red { color: var(--bad-fg); font-weight: 600; } .due-amber { color: var(--warn-fg); font-weight: 600; }

/* Skeleton */
.skel { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--skel-a) 25%, var(--skel-b) 50%, var(--skel-a) 75%); background-size: 400% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.tile .skel { height: 28px; width: 60%; margin-top: 8px; }

/* Menus */
.menu { position: relative; display: inline-block; }
.menu .dd { display: none; position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 5px; min-width: 200px; z-index: 25; box-shadow: var(--shadow); }
.menu.open .dd { display: block; }
.menu .dd button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 12.5px; }
.menu .dd button:hover { background: var(--brand-bg); }
.menu .dd button.danger { color: var(--bad-fg); }
.menu .dd hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* Gráfico SVG */
.chart { width: 100%; height: 230px; display: block; }
.chart .bar-r { fill: url(#gbar); transition: opacity .12s; }
.chart .bar-r:hover { opacity: .8; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid { stroke: var(--border); stroke-dasharray: 3 3; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Listas simples */
.list { display: flex; flex-direction: column; }
.list .it { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.list .it:last-child { border-bottom: 0; }
.list .it .t { flex: 1; min-width: 0; }
.list .it b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .it small { color: var(--faint); font-size: 11.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .it.click { cursor: pointer; border-radius: 8px; margin: 0 -8px; padding-inline: 8px; }
.list .it.click:hover { background: var(--surface-2); }
.kv { display: grid; grid-template-columns: minmax(84px, 130px) 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); margin: 0; } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.copy { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 8px; padding: 6px 8px 6px 10px; font-family: var(--mono); font-size: 12px; max-width: 100%; }
.copy code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.secret { font-family: var(--mono); font-size: 16px; letter-spacing: .5px; background: var(--bg-2); border: 1px dashed var(--brand-bd); border-radius: 10px; padding: 12px 14px; text-align: center; overflow-wrap: anywhere; user-select: all; }

/* ── Drawer ───────────────────────────────────────────────────────── */
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 45; display: none; }
.drawer-bg.on { display: block; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 100vw; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow); z-index: 46; transform: translateX(100%); transition: transform .2s ease; display: flex; flex-direction: column; }
.drawer.on { transform: none; }
.drawer .dh { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.drawer .dh h2 { margin: 0; font-size: 17px; }
.drawer .dh .sub { color: var(--faint); font-size: 12px; margin-top: 2px; }
.drawer .dh .x { margin-left: auto; }
.drawer .db { flex: 1; overflow: auto; padding: 16px 20px 24px; }
.drawer .df { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-wrap: wrap; }
.drawer h4 { margin: 18px 0 8px; font-size: 11px; color: var(--faint); letter-spacing: .6px; text-transform: uppercase; }
.drawer h4:first-child { margin-top: 0; }
.mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.mini .m { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.mini .m .lbl { color: var(--faint); font-size: 11px; }
.mini .m .v { font-weight: 600; font-size: 14px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* ── Modal ────────────────────────────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); display: none; place-items: center; z-index: 50; padding: 20px; }
.modal-bg.on { display: grid; }
.modal { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); animation: fade .15s ease; max-height: 92vh; overflow: auto; }
.modal.wide { max-width: 620px; }
.modal h2 { margin: 0 0 4px; font-size: 16px; }
.modal p.d { margin: 0 0 16px; color: var(--muted); font-size: 12.5px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ── Toasts ───────────────────────────────────────────────────────── */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--surface-2); border: 1px solid var(--border-2); border-left: 3px solid var(--border-2); color: var(--text); padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow-sm); animation: fade .15s ease; display: flex; gap: 10px; align-items: flex-start; }
.toast.ok { border-left-color: var(--green); } .toast.err { border-left-color: var(--red); } .toast.info { border-left-color: var(--blue); }
.toast button { background: none; border: 0; color: var(--faint); cursor: pointer; padding: 0; margin-left: auto; font-size: 16px; line-height: 1; }

/* Preços — prévia dos cards como no cadastro */
.plans-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.plans-preview .pl { border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); position: relative; }
.plans-preview .pl.on { border-color: var(--violet); }
.plans-preview .tag { position: absolute; top: -9px; left: 12px; background: var(--violet); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.plans-preview b { display: block; font-size: 13.5px; }
.plans-preview .pr { font-size: 20px; font-weight: 600; margin: 4px 0 0; letter-spacing: -.5px; }
.plans-preview .pr small { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.plans-preview p { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; }
@media (max-width: 760px) { .plans-preview { grid-template-columns: 1fr; } }

/* Configurações */
.status-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; flex-wrap: wrap; }
.status-line:last-child { border-bottom: 0; }
.status-line .k { color: var(--muted); min-width: 170px; }
.status-line .v { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Acessibilidade: viewer não vê ações */
body[data-role="viewer"] .act { display: none !important; }

/* ── Responsivo ───────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .side-bg.on { display: block; }
  .burger { display: inline-flex; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .topbar .sub { display: none; }
  .search { width: auto; max-width: none; flex: 1; }
  .search kbd { display: none; }
  .content { padding: 14px 14px 40px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dt { margin-top: 8px; font-size: 11.5px; }
  .toolbar .input { min-width: 0; flex: 1; }
  .drawer { width: 100vw; }
  .modal { padding: 18px; }
}
@media (max-width: 520px) { .tiles { grid-template-columns: 1fr 1fr; } .tile .val { font-size: 21px; } .hide-sm { display: none; } }
@media print { .side, .topbar, .drawer-bg, .modal-bg, .toasts { display: none !important; } .content { padding: 0; } }

/* ── Notificações (sininho) ───────────────────────────────────────── */
.notif { position: relative; }
.notif .badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); line-height: 1; }
.notif .nres { display: none; position: absolute; top: calc(100% + 6px); right: 0; width: 380px; max-width: calc(100vw - 28px); background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 40; max-height: 70vh; overflow: auto; }
.notif.open .nres { display: block; }
.notif .nh { padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.notif .ni { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: flex-start; }
.notif .ni:last-child { border-bottom: 0; }
.notif .ni:hover { background: var(--surface-2); }
.notif .ni .ic { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; }
.notif .ni .t { flex: 1; min-width: 0; }
.notif .ni b { display: block; font-size: 12.5px; }
.notif .ni small { color: var(--muted); font-size: 11.5px; display: block; }
.notif .ni .when { color: var(--faint); font-size: 11px; white-space: nowrap; }

/* ── Programas ────────────────────────────────────────────────────── */
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pcard { cursor: pointer; transition: border-color .12s; display: flex; flex-direction: column; gap: 10px; }
.pcard:hover { border-color: var(--violet-2); }
.pcard .ph { display: flex; align-items: flex-start; gap: 10px; }
.pcard .ph b { font-size: 14px; display: block; }
.pcard .ph small { color: var(--faint); font-size: 11.5px; display: block; }
.pcard .ph .pill { margin-left: auto; }
.pcard .desc { color: var(--muted); font-size: 12.5px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--faint); font-size: 11.5px; }
.funnel { display: flex; flex-direction: column; gap: 5px; }
.funnel .fr { display: grid; grid-template-columns: 78px 1fr 44px; gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); }
.funnel .fr .fb { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.funnel .fr .fb i { display: block; height: 100%; border-radius: 999px; background: var(--violet-2); }
.funnel .fr .fb i.ok { background: var(--green); } .funnel .fr .fb i.warn { background: var(--amber); } .funnel .fr .fb i.gray { background: var(--border-2); }
.funnel .fr .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.pdet .back { margin-bottom: 12px; }
.pdet .phead { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.pdet .phead h2 { margin: 0; font-size: 18px; }
.pdet .phead .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; max-width: 640px; }
.pdet .phead .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.strike { text-decoration: line-through; color: var(--faint); font-weight: 400; margin-right: 6px; }
