:root {
  --bg: #f4f6f9; --panel: #fff; --text: #1a2230; --muted: #667085; --line: #e3e7ee; --grid: #eef1f5;
  --accent: #0b6bcb; --ok: #1a8f4c; --warn: #b97400; --bad: #c62828; --unknown: #8792a2;
  --c1: #0b6bcb; --c2: #e07b00; --c3: #c62828; --c4: #1a8f4c; --c5: #7b3fc4; --c6: #00838f; --c7: #ad1457; --c8: #5d6b7a; --c9: #9e9d24; --c10: #6d4c41;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b; --panel: #171e28; --text: #e6eaf0; --muted: #97a3b4; --line: #263140; --grid: #1f2937;
    --accent: #5aa9f5; --ok: #4cc27e; --warn: #f0b040; --bad: #f2777a; --unknown: #7c8798;
    --c1: #5aa9f5; --c2: #f5a742; --c3: #f2777a; --c4: #4cc27e; --c5: #b48cf2; --c6: #4dd0e1; --c7: #f06292; --c8: #9aa7b8; --c9: #d4d35a; --c10: #bc9a8a;
  }
}
* { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
button { font: inherit; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 6px; padding: 6px 12px; }
input, select { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; max-width: 100%; }
small, .dim { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.nowrap { white-space: nowrap; }
.r { text-align: right; font-variant-numeric: tabular-nums; }
.bad { color: var(--bad); }

.bar { display: flex; align-items: center; gap: 20px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand span { color: var(--accent); }
.bar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.bar nav a { padding: 6px 10px; border-radius: 6px; color: var(--text); }
.bar nav a.on { background: var(--accent); color: #fff; }
.bar nav a:hover { text-decoration: none; background: var(--grid); }
.bar nav a.on:hover { background: var(--accent); }
.who { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--muted); }
.who button { background: transparent; color: var(--text); border-color: var(--line); }

.period { display: flex; align-items: center; gap: 16px; padding: 10px 20px; flex-wrap: wrap; border-bottom: 1px solid var(--line); background: var(--panel); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip, .sort a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); font-size: 13px; }
.chip.on, .sort a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip:hover, .sort a:hover { text-decoration: none; border-color: var(--accent); }
.range { display: flex; align-items: center; gap: 8px; margin: 0; flex-wrap: wrap; color: var(--muted); }
.range.two { margin: 12px 0 4px; }
.period .label { margin-left: auto; color: var(--muted); font-size: 13px; }
.live { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; white-space: nowrap; }
.live i { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2s infinite; }
.live b { color: var(--ok); font-weight: 600; }
.live.busy i { background: var(--accent); }
.live.stale i, .live.off i { background: var(--bad); animation: none; }
.live.stale b { color: var(--bad); }
.live.off i { background: var(--unknown); }
.live.off b { color: var(--muted); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .live i { animation: none; } }
.verdict { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 14px; border-radius: 10px; color: #fff; background: var(--unknown); }
.verdict b { font-size: 20px; }
.verdict span { opacity: .9; }
.verdict.ok { background: var(--ok); } .verdict.warn { background: var(--warn); } .verdict.bad { background: var(--bad); }
@media (prefers-color-scheme: dark) { .verdict { color: #10151c; } }

main { padding: 16px 20px 40px; max-width: 1500px; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 0 0 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 16px; }
.grid2 > .card { margin: 0; min-width: 0; }
.grid2 { margin-bottom: 16px; }
figure figcaption { font-weight: 600; margin-bottom: 8px; }
.chart { min-height: 250px; position: relative; }
.chart .msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 20px; pointer-events: none; }
.u-legend { font-size: 12px; text-align: left; }
.u-legend th { font-weight: 400; }
.u-select { background: color-mix(in srgb, var(--accent) 18%, transparent); }

.areas { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 14px; }
.area { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--unknown); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.area b::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: var(--unknown); }
.area span { color: var(--muted); font-size: 12.5px; }
.area.ok { border-left-color: var(--ok); } .area.ok b::before { background: var(--ok); }
.area.warn { border-left-color: var(--warn); } .area.warn b::before { background: var(--warn); }
.area.bad { border-left-color: var(--bad); } .area.bad b::before { background: var(--bad); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpis > div { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; }
.kpis b { font-size: 21px; font-variant-numeric: tabular-nums; }
.kpis i { font-style: normal; color: var(--muted); font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
th.r, td.r { text-align: right; }
td small { display: block; margin-top: 2px; word-break: break-word; }
tr.stale { opacity: .5; }
.scroll { overflow-x: auto; }
progress { display: block; width: 110px; height: 5px; margin-top: 4px; accent-color: var(--accent); }
.lvl { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--grid); }
.lvl.ERROR { color: var(--bad); } .lvl.WARN { color: var(--warn); }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.head h3 { margin: 0; }
.sort { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.head .sort { margin: 0 0 0 auto; }
.filters { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 12.5px; }
.filters select { max-width: 520px; }
.notice { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 9px 12px; margin: 0 0 16px; color: var(--muted); }
.notice.bad { border-left-color: var(--bad); color: var(--bad); }
.empty { color: var(--muted); margin: 6px 0; }
.foot { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
table.cmp td:first-child { width: 34%; }

.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; max-width: none; }
.auth .card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; padding: 26px; margin: 0; }
.auth .brand { font-size: 20px; }
.auth .sub { margin: -8px 0 4px; color: var(--muted); }
.auth label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.auth input { padding: 9px 10px; font-size: 15px; color: var(--text); }
.auth button { padding: 10px; font-weight: 600; }
.auth .notice { margin: 0; }

@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  .period .label { margin-left: 0; }
  main { padding: 12px; }
}
