:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #14171c; --muted: #5f6873; --line: #e3e6ea;
  --accent: #3b5bdb; --ok: #2f9e44; --warn: #e08a00; --bad: #d6336c; --off: #9aa3ad;
  --shadow: 0 1px 2px rgba(0,0,0,.06);
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116; --panel: #161b22; --ink: #e6e9ee; --muted: #8b949e; --line: #262d36;
    --accent: #7c95ff; --ok: #51cf66; --warn: #fcc419; --bad: #ff6b9a; --off: #5c6670; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1116; --panel: #161b22; --ink: #e6e9ee; --muted: #8b949e; --line: #262d36;
  --accent: #7c95ff; --ok: #51cf66; --warn: #fcc419; --bad: #ff6b9a; --off: #5c6670; --shadow: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 Inter, system-ui, -apple-system, sans-serif; }
a { color: var(--accent); text-decoration: none; }
header { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
header h1 { font-size: 15px; margin: 0; letter-spacing: .02em; }
header h1 span { color: var(--muted); font-weight: 400; }
nav { display: flex; gap: 4px; }
nav button { background: none; border: 0; color: var(--muted); padding: 6px 12px; border-radius: 6px; cursor: pointer; font: inherit; }
nav button.on { background: var(--bg); color: var(--ink); font-weight: 600; }
.spacer { flex: 1; }
.small { font-size: 12px; color: var(--muted); }
main { padding: 20px; max-width: 1400px; margin: 0 auto; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.big { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; }
.row2 { display: grid; gap: 14px; grid-template-columns: 1.3fr 1fr; margin-top: 14px; }
@media (max-width: 900px) { .row2 { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
tr.click { cursor: pointer; } tr.click:hover { background: var(--bg); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--off); vertical-align: 1px; }
.dot.ok { background: var(--ok); } .dot.degraded, .dot.warning { background: var(--warn); } .dot.down, .dot.error { background: var(--bad); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.ev { display: grid; grid-template-columns: 112px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ev time { font-family: var(--mono); font-size: 12px; color: var(--muted); }
#graphWrap { display: grid; grid-template-columns: 1fr 360px; gap: 14px; height: calc(100vh - 120px); }
@media (max-width: 900px) { #graphWrap { grid-template-columns: 1fr; height: auto; } #cy { height: 60vh; } }
#cy { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-height: 400px; }
#side { overflow: auto; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
select, input[type=search] { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; }
.legend span { margin-right: 12px; }
.muted { color: var(--muted); }
.bars div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.bars i { display: block; height: 6px; background: var(--accent); border-radius: 3px; margin-top: 2px; opacity: .7; }
.hidden { display: none !important; }
@media (max-width: 640px) {
  header { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  header h1 { width: 100%; }
  header h1 span { display: inline; }
  nav { order: 3; width: 100%; }
  .spacer { display: none; }
  main { padding: 16px; }
  .big { font-size: 24px; }
  .ev { grid-template-columns: 84px 1fr; }
}
