:root {
  --bg: #f6f6f6;
  --surface: #ffffff;
  --surface-2: #f1f1f1;
  --line: #e4e4e4;
  --text: #0a0a0a;
  --muted: #6b6b6b;
  --brand: #0a0a0a;
  --brand-2: #000000;
  --brand-soft: #ececec;
  --ok: #0f8a4f;   --ok-soft: #e3f6ec;
  --warn: #b26a00; --warn-soft: #fff3dc;
  --bad: #c62828;  --bad-soft: #fdeaea;
  --info: #2b5fd9; --info-soft: #e7efff;
  --gray-soft: #eef1f5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: #0a0a0a; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero h1 { font-size: 40px; line-height: 1.1; margin: 0 0 16px; letter-spacing: -.02em; }
.auth-hero p { color: rgba(255,255,255,.82); max-width: 440px; font-size: 16px; }
.auth-hero ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-hero li { display: flex; gap: 10px; align-items: flex-start; color: rgba(255,255,255,.9); }
.auth-hero li::before { content: ""; flex: 0 0 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: #ffffff; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.logo-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.auth-hero .logo-mark { background: #fff; color: #0a0a0a; }
.auth-panel { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.01em; }
.auth-card .sub { color: var(--muted); margin: 0 0 24px; }
.small { font-size: 12px; color: var(--muted); }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.side nav { display: grid; gap: 2px; }
.side nav button { text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 500; display: flex; align-items: center; justify-content: space-between; }
.side nav button:hover { background: var(--surface-2); color: var(--text); }
.side nav button.on { background: #0a0a0a; color: #ffffff; font-weight: 600; }
.op-sel { padding: 0 4px; }
.b-op { background: #ffffff; color: #0a0a0a; border: 1px solid #0a0a0a; }
.side .nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 12px 4px; }
.side .who { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 6px; }
.side .who strong { font-size: 13px; }
.main { padding: 28px 32px 48px; min-width: 0; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.top h1 { margin: 0; font-size: 24px; letter-spacing: -.015em; }
.top p { margin: 4px 0 0; color: var(--muted); }
.mobile-bar { display: none; }

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid > .card { margin-top: 0 !important; }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.kpi { padding: 16px 18px; }
.kpi .lbl { color: var(--muted); font-size: 12px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kpi .val { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 9px; }
.dot.ok { background: var(--ok); } .dot.warn { background: #e09a00; } .dot.bad { background: var(--bad); } .dot.na { background: #c3cad6; }

.btn { border: 1px solid transparent; background: var(--brand); color: #fff; padding: 9px 16px; border-radius: 9px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.btn:hover { background: var(--brand-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: #f1c5c5; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font-weight: 500; }

label.f { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
label.f span.req::after { content: " *"; color: var(--bad); }
.in, select.in, textarea.in { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 9px 11px; outline: none; }
.in:focus { border-color: #0a0a0a; box-shadow: 0 0 0 3px rgba(0,0,0,.08); }
textarea.in { min-height: 84px; resize: vertical; }
.form { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .in { width: auto; min-width: 140px; }
.filters .grow { flex: 1 1 220px; }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; background: var(--surface-2); padding: 9px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #fafafa; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .nowrap { white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-bruta { background: var(--gray-soft); color: #44516a; }
.b-legalizada { background: var(--info-soft); color: var(--info); }
.b-agendada { background: #efe8ff; color: #6a3fd1; }
.b-suspendida { background: var(--warn-soft); color: var(--warn); }
.b-instalada { background: var(--ok-soft); color: var(--ok); }
.b-caida { background: var(--bad-soft); color: var(--bad); }
.b-retracto { background: #fde9f3; color: #b0296d; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-gray { background: var(--gray-soft); color: #44516a; }
.flag { color: var(--warn); font-size: 12px; font-weight: 600; }

.funnel { display: grid; gap: 8px; }
.funnel-row { display: grid; grid-template-columns: 120px 1fr 64px; gap: 10px; align-items: center; font-size: 13px; }
.bar { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; }

.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: var(--muted); font-size: 13px; }
.note.warn { background: var(--warn-soft); border-color: #f3dca8; color: #6b4a00; }
.note.bad { background: var(--bad-soft); border-color: #f1c5c5; color: #7a1d1d; }
.note.ok { background: var(--ok-soft); border-color: #bfe6d0; color: #0b5b35; }

.news { display: grid; gap: 12px; }
.news .card h3 { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.news .meta { color: var(--muted); font-size: 12px; font-weight: 400; white-space: nowrap; }
.news .body { white-space: pre-wrap; color: #2b3852; }

/* Drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(15,27,51,.35); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { width: min(560px, 100%); height: 100%; background: var(--surface); overflow-y: auto; padding: 22px 24px; box-shadow: -8px 0 32px rgba(15,27,51,.18); }
.drawer h2 { margin: 0; font-size: 20px; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; margin: 16px 0; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; }
.timeline li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); margin-top: 5px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: #0f1b33; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--bad); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: #0a0a0a; border-color: #0a0a0a; font-weight: 600; }

.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 28px; text-align: center; color: var(--muted); cursor: pointer; background: var(--surface); }
.drop:hover, .drop.over { border-color: #0a0a0a; background: #f4f4f4; color: #0a0a0a; }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 20px; }
  .auth-hero h1 { font-size: 30px; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 8px 0 32px rgba(15,27,51,.2); }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .main { padding: 18px 16px 40px; }
  .g3, .g2, .form-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
}
@media (max-width: 480px) { .g4 { grid-template-columns: 1fr 1fr; } .kpi .val { font-size: 22px; } }
