:root { --bg:#0f172a; --panel:#1e293b; --line:#334155; --text:#e2e8f0; --muted:#94a3b8;
  --accent:#38bdf8; --ok:#34d399; --warn:#fbbf24; --bad:#f87171; }
* { box-sizing:border-box; margin:0; }
body { background:var(--bg); color:var(--text); font:14px/1.5 -apple-system,'Segoe UI',Roboto,sans-serif; }
.hidden { display:none !important; }
.center { display:flex; align-items:center; justify-content:center; min-height:100vh; }
.card { background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:20px; }
.login-card { width:340px; display:flex; flex-direction:column; gap:10px; }
h1 { font-size:20px; } h2 { font-size:16px; margin-bottom:10px; } h3 { font-size:14px; margin:12px 0 6px; }
.muted { color:var(--muted); font-size:12px; }
input, select { background:#0b1220; color:var(--text); border:1px solid var(--line); border-radius:6px; padding:8px 10px; font-size:14px; width:100%; }
button { background:var(--panel); color:var(--text); border:1px solid var(--line); border-radius:6px; padding:7px 12px; cursor:pointer; font-size:13px; }
button:hover { border-color:var(--accent); }
button.primary { background:var(--accent); color:#04121e; border:none; font-weight:600; }
button.ghost { background:transparent; }
button.danger { border-color:var(--bad); color:var(--bad); }
.err { color:var(--bad); font-size:13px; min-height:18px; }
header { display:flex; align-items:center; gap:14px; padding:10px 18px; border-bottom:1px solid var(--line); background:var(--panel); position:sticky; top:0; z-index:5; }
.brand { font-weight:700; color:var(--accent); }
.spacer { flex:1; }
nav#tabs button { border:none; background:transparent; color:var(--muted); padding:7px 10px; }
nav#tabs button.active { color:var(--text); border-bottom:2px solid var(--accent); border-radius:0; }
main { padding:18px; max-width:1200px; margin:0 auto; display:flex; flex-direction:column; gap:16px; }
table { width:100%; border-collapse:collapse; font-size:13px; }
th, td { text-align:left; padding:6px 8px; border-bottom:1px solid var(--line); }
th { color:var(--muted); font-weight:600; font-size:12px; }
tr:hover td { background:rgba(56,189,248,.05); }
.badge { font-size:11px; padding:2px 8px; border-radius:10px; border:1px solid var(--line); color:var(--muted); }
.badge.ok { color:var(--ok); border-color:var(--ok); }
.badge.warn { color:var(--warn); border-color:var(--warn); }
.badge.bad { color:var(--bad); border-color:var(--bad); }
.row { display:flex; gap:10px; align-items:end; flex-wrap:wrap; }
.row > div { display:flex; flex-direction:column; gap:4px; }
.row label { font-size:11px; color:var(--muted); }
.mono { font-family:ui-monospace,Menlo,monospace; font-size:12px; }
pre.report { background:#0b1220; border:1px solid var(--line); border-radius:8px; padding:12px; font-size:12px; overflow:auto; max-height:400px; }
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media (max-width:900px){ .grid2 { grid-template-columns:1fr; } }
.num { text-align:right; font-variant-numeric:tabular-nums; }

/* ── Light theme ── */
[data-theme="light"] {
  --bg:#f1f5f9; --panel:#ffffff; --line:#e2e8f0; --text:#0f172a; --muted:#64748b;
  --accent:#0284c7; --ok:#059669; --warn:#d97706; --bad:#dc2626;
}
[data-theme="light"] input, [data-theme="light"] select { background:#f8fafc; color:var(--text); }
[data-theme="light"] pre.report { background:#f8fafc; }
[data-theme="light"] tr:hover td { background:rgba(2,132,199,.06); }

/* ── KPI cards & charts ── */
.kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; }
.kpi { background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:12px 14px; }
.kpi .v { font-size:22px; font-weight:700; font-variant-numeric:tabular-nums; }
.kpi .l { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; }
.kpi.margin .v { color:var(--ok); }
.kpi.margin.neg .v { color:var(--bad); }
.chart-wrap { overflow-x:auto; }
.chart-wrap svg { display:block; }
.legend { display:flex; gap:14px; font-size:12px; color:var(--muted); margin-top:6px; }
.legend .dot { display:inline-block; width:10px; height:10px; border-radius:2px; margin-right:5px; vertical-align:-1px; }
.filters { display:flex; gap:10px; align-items:end; flex-wrap:wrap; margin-bottom:4px; }
.checklist li { list-style:none; padding:4px 0; }
.checklist .done { color:var(--ok); }
.checklist .todo { color:var(--warn); }
#theme-btn { font-size:16px; padding:5px 9px; }
