:root {
  --bg: #0b0d10;
  --card: #12151a;
  --line: #1f242c;
  --text: #e5e7eb;
  --muted: #8b94a3;
  --accent: #f59e0b;
  --a: #38bdf8;
  --b: #f472b6;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f5f7;
    --card: #ffffff;
    --line: #e3e6eb;
    --text: #111827;
    --muted: #5b6472;
    --accent: #d97706;
    --a: #0284c7;
    --b: #db2777;
    --ok: #059669;
    --warn: #b45309;
    --bad: #dc2626;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.dot.off { background: var(--bad); }
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); padding: 8px 14px; background: var(--accent); color: #111; font-weight: 600; }
button.ghost { background: transparent; color: var(--text); font-weight: 500; }
button:disabled { opacity: .6; cursor: default; }

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px; max-width: 1280px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.span2 { grid-column: span 2; }
.span4 { grid-column: span 4; }
@media (max-width: 960px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span4 { grid-column: span 2; } }
@media (max-width: 600px) { .grid { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; } .span2, .span4 { grid-column: auto; } }

.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
h1, h2 { margin: 0; }
h2 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
canvas { width: 100%; display: block; }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 99px; transition: width .4s, background .4s; }
.bar i.warn { background: var(--warn); }
.bar i.bad { background: var(--bad); }
.card p { margin: 8px 0 0; }
.legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.k { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.k1 { background: var(--a); }
.k2 { background: var(--b); margin-left: 8px; }

.cores { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin-top: 10px; }
.core { font-size: 12px; color: var(--muted); }
.core .bar { height: 6px; margin-top: 3px; }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 340px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 26px 22px; text-align: center; }
.login-card .logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin: 0 auto 10px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.login-card h1 { font-size: 20px; }
.login-card form { margin-top: 16px; display: grid; gap: 10px; }
input { font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); width: 100%; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.err { color: var(--bad); margin: 0; font-size: 13px; }
