:root {
  --bg: #f6f7f9; --card: #fff; --text: #17191c; --muted: #6b7280; --line: #e5e7eb;
  --accent: #4f46e5; --c1: #4f46e5; --c2: #10b98166; --bar: #4f46e514; --up: #059669; --down: #dc2626;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --card: #171a21; --text: #e6e8eb; --muted: #9aa1ab; --line: #262b35;
          --accent: #818cf8; --c1: #818cf8; --c2: #34d39955; --bar: #818cf81f; --up: #34d399; --down: #f87171; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
header { display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
.sites { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.sites a, .range a { padding: 6px 10px; border-radius: 8px; color: var(--muted); white-space: nowrap; }
.sites a.on, .range a.on { background: var(--bar); color: var(--accent); font-weight: 600; }
.logout { color: var(--muted); font-size: 13px; }
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
.range { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 16px; color: var(--muted); }
.range input, .range button, .login input, .login button { font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); }
.range button, .login button { background: var(--accent); color: #fff; border: 0; cursor: pointer; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kpis div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpis small { display: block; color: var(--muted); font-size: 12px; }
.kpis b { font-size: clamp(17px, 2vw, 22px); font-variant-numeric: tabular-nums; }
.kpis b { display: block; white-space: nowrap; }
.delta { font-size: 12px; } .delta.up { color: var(--up); } .delta.down { color: var(--down); }
.note { color: var(--muted); font-size: 12px; margin: 6px 2px 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; overflow-x: auto; }
h2 { font-size: 14px; margin: 0 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.grid .card { margin: 0; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: right; font-weight: 500; color: var(--muted); font-size: 12px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
td { text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
td.lbl { position: relative; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
td.lbl span { position: relative; }
.bar { position: absolute; left: 0; top: 2px; bottom: 2px; background: var(--bar); border-radius: 4px; }
.empty { text-align: center; color: var(--muted); }
body.login { display: grid; place-items: center; min-height: 100vh; }
.login .card { display: grid; gap: 10px; width: min(320px, 90vw); }
.login h1 { margin: 0 0 6px; font-size: 20px; }
.err { color: var(--down); margin: 0; }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } header { gap: 8px; padding: 10px 12px; } }
.chart { position: relative; height: 300px; } @media (max-width: 600px) { .chart { height: 220px; } }
