:root{
  --bg:#f6f7f9; --card:#ffffff; --fg:#111827; --muted:#6b7280; --line:#e5e7eb;
  --accent:#0ea5e9; --red:#ef4444; --blue:#3b82f6; --green:#10b981; --cyan:#0ea5e9;
  --head:#f3f4f6;
}
@media (prefers-color-scheme: dark){
  :root{ --bg:#0f172a; --card:#111827; --fg:#e5e7eb; --muted:#9ca3af; --line:#1f2937; --head:#1f2937; }
}
*{ box-sizing:border-box; }
body{ margin:0; background:var(--bg); color:var(--fg);
  font-family:-apple-system,Segoe UI,Roboto,Arial,sans-serif; line-height:1.45; }
.app{ max-width:900px; margin:0 auto; padding:16px 16px 48px; }
header{ display:flex; justify-content:space-between; align-items:flex-start; gap:12px; padding:8px 0 16px; }
header h1{ margin:0; font-size:22px; }
h1{ font-size:22px; } h2{ font-size:17px; margin:22px 0 8px; display:flex; align-items:center; gap:8px; }
h3{ font-size:14px; margin:16px 0 6px; color:var(--muted); }
.muted{ color:var(--muted); font-size:13px; }
.bar{ width:4px; height:18px; border-radius:2px; display:inline-block; }
.bar.red{background:var(--red)} .bar.blue{background:var(--blue)} .bar.green{background:var(--green)} .bar.cyan{background:var(--cyan)}
section{ background:var(--card); border:1px solid var(--line); border-radius:10px; padding:12px 14px; margin:12px 0; }
table.grid{ border-collapse:collapse; width:100%; font-size:14px; }
table.grid th,table.grid td{ padding:8px 10px; border-bottom:1px solid var(--line); text-align:left; }
table.grid thead th{ background:var(--head); }
table.grid .r{ text-align:right; } table.grid .c{ text-align:center; }
.chart{ width:100%; max-width:860px; border:1px solid var(--line); border-radius:8px; margin-top:10px; display:block; }
.alarms{ display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:10px; }
.alarms figure{ margin:0; border:1px solid var(--line); border-radius:8px; overflow:hidden; cursor:pointer; background:var(--head); }
.alarms img{ width:100%; display:block; aspect-ratio:4/3; object-fit:cover; }
.alarms figcaption{ padding:6px 8px; font-size:13px; }
.lightbox{ position:fixed; inset:0; background:rgba(0,0,0,.8); display:flex; align-items:center; justify-content:center; padding:20px; z-index:50; }
.lightbox img{ max-width:100%; max-height:100%; border-radius:8px; }
.alert{ padding:8px 12px; margin:6px 0; border-radius:6px; border-left:4px solid var(--muted); background:var(--head); }
.alert b{ color:inherit; }
.sev-ext{ border-left-color:#b91c1c; background:#fee2e2; color:#7f1d1d; }
.sev-sev{ border-left-color:#c2410c; background:#ffedd5; color:#7c2d12; }
.sev-mod{ border-left-color:#a16207; background:#fef9c3; color:#713f12; }
.sev-min{ border-left-color:#3f6212; background:#ecfccb; color:#365314; }
button{ background:var(--accent); color:#fff; border:0; border-radius:8px; padding:9px 14px; font-size:15px; cursor:pointer; }
button:disabled{ opacity:.6; }
.linkbtn{ background:transparent; color:var(--muted); padding:6px 8px; font-size:14px; }
footer{ margin-top:24px; padding-top:10px; border-top:1px solid var(--line); }
.loading{ min-height:60vh; display:flex; align-items:center; justify-content:center; color:var(--muted); }
/* login */
.login{ min-height:100vh; display:flex; align-items:center; justify-content:center; padding:16px; }
.login .card{ background:var(--card); border:1px solid var(--line); border-radius:14px; padding:24px; width:100%; max-width:360px; }
.login h1{ margin:0 0 16px; font-size:20px; text-align:center; }
.login form{ display:flex; flex-direction:column; gap:12px; }
.login label{ display:flex; flex-direction:column; gap:4px; font-size:13px; color:var(--muted); }
.login input{ padding:10px 12px; font-size:16px; border:1px solid var(--line); border-radius:8px; background:var(--bg); color:var(--fg); }
.err{ color:#b91c1c; font-size:14px; margin:10px 0 0; }
