:root {
  --bg: #121a23; --panel: #18222d; --line: #263443; --ink: #dbe3ec; --mute: #8a99aa;
  --ok: #43b59b; --warn: #d9a441; --bad: #e0605a; --idle: #3a4a5b; --accent: #8fb3ff;
  --r: 6px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef2f6; --panel: #fff; --line: #d3dbe4; --ink: #17212c; --mute: #5b6b7c;
    --ok: #1f8a6f; --warn: #a86f00; --bad: #c23b33; --idle: #c3cdd8; --accent: #3157c9;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
main { max-width: 1240px; margin: 0 auto; padding: 0 16px 48px; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 15px; margin: 28px 0 10px; }
h3 { font-size: 13px; margin: 0 0 8px; color: var(--mute); font-weight: 500; }
a { color: var(--accent); }
button {
  font: inherit; color: var(--ink); background: transparent; border: 1px solid var(--line);
  border-radius: var(--r); padding: 5px 12px; cursor: pointer;
}
button:hover { border-color: var(--mute); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mute { color: var(--mute); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }

/* header */
.top {
  display: flex; align-items: center; gap: 16px; max-width: 1240px; margin: 0 auto;
  padding: 14px 16px; flex-wrap: wrap;
}
.brand { font-size: 17px; display: flex; align-items: center; gap: 8px; letter-spacing: .01em; }
.mark { width: 14px; height: 14px; border-radius: 3px; background: linear-gradient(90deg, var(--ok) 0 30%, transparent 30% 35%, var(--ok) 35% 65%, transparent 65% 70%, var(--idle) 70%); }
.live { margin: 0; color: var(--mute); display: flex; align-items: center; gap: 7px; flex: 1; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }
.dot.on { background: var(--ok); }
.dot.poll { background: var(--warn); }
.dot.off { background: var(--bad); }
.logout { margin: 0; }

/* summary */
.summary { display: flex; flex-wrap: wrap; gap: 8px 32px; padding: 6px 0 14px; border-bottom: 1px solid var(--line); }
.stat { display: flex; flex-direction: column; min-width: 92px; }
.stat b { font-size: 26px; font-weight: 600; line-height: 1.15; }
.stat span { color: var(--mute); font-size: 12px; }
.stat.alerting b { color: var(--bad); }

/* the slot band: one cell per slot, grouped by node */
.band { display: flex; flex-wrap: wrap; gap: 14px 22px; padding: 16px 0 4px; }
.band-node { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.band-node .who { font-size: 12px; color: var(--mute); }
.band-node.stale .who { color: var(--warn); }
.band-node.down .who { color: var(--bad); }
.cells { display: flex; flex-wrap: wrap; gap: 3px; }
.cell { width: 14px; height: 26px; border-radius: 2px; background: var(--idle); }
.cell.lane, .cell.job { background: var(--ok); }
.cell.job { background: var(--accent); }
.cell.dead { background: var(--bad); }
.cell.other { background: var(--warn); }
.band-node.down .cell, .band-node.stale .cell { opacity: .35; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--mute); padding-top: 6px; width: 100%; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; background: var(--idle); }
.legend i.lane { background: var(--ok); } .legend i.job { background: var(--accent); }
.legend i.dead { background: var(--bad); } .legend i.other { background: var(--warn); }

/* node cards */
.nodes { display: flex; flex-direction: column; gap: 8px; }
details.node { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); border-left-width: 3px; }
details.node.down { border-left-color: var(--bad); }
details.node.stale { border-left-color: var(--warn); }
details.node.problem { border-left-color: var(--warn); }
details.node > summary {
  list-style: none; cursor: pointer; padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
}
details.node > summary::-webkit-details-marker { display: none; }
details.node > summary::before { content: "\25B8"; color: var(--mute); width: 10px; }
details.node[open] > summary::before { content: "\25BE"; }
.node .name { font-weight: 600; font-size: 15px; }
.pill { font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid currentColor; }
.problems { color: var(--warn); font-size: 13px; }
.node .meta { color: var(--mute); font-size: 12px; margin-left: auto; }
.node-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 14px; }
.kv { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; }
.kv span { color: var(--mute); }
.kv b { font-weight: 500; }

/* tables */
.scroll { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--mute); padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 5px 10px 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td.task { max-width: 340px; overflow-wrap: anywhere; }
td.nowrap { white-space: nowrap; }
.state { display: inline-flex; align-items: center; gap: 6px; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--idle); }
.state.lane::before { background: var(--ok); } .state.job::before { background: var(--accent); }
.state.dead::before { background: var(--bad); } .state.other::before { background: var(--warn); }

/* panels */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.cols.three { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; min-width: 0; }
.empty { color: var(--mute); margin: 0; font-size: 13px; }
ul.list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
ul.list li { padding: 5px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; }
ul.list li:last-child { border-bottom: 0; }
ul.list .when { color: var(--mute); white-space: nowrap; }
ul.list .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.alert-row .txt { color: var(--bad); }
.need-row .txt { color: var(--warn); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 3px; }
.bar > div { height: 100%; background: var(--ok); width: 0; }
.bar.warn > div { background: var(--warn); } .bar.bad > div { background: var(--bad); }

/* charts */
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .lbl { fill: var(--mute); font-size: 10px; }
.chart .bar-m { fill: var(--ok); }
.chart .bar-w { fill: var(--warn); }
.chart .line-a { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.chart .line-b { fill: none; stroke: var(--warn); stroke-width: 2; }
.chart .dot-b { fill: var(--warn); }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--mute); margin-top: 4px; }
.chart-legend i { display: inline-block; width: 12px; height: 3px; margin-right: 5px; vertical-align: middle; background: var(--accent); }
.chart-legend i.b { background: var(--warn); }

/* login */
body.login { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-box { width: 100%; max-width: 340px; padding: 24px 16px; }
.login-box .brand { margin-bottom: 22px; }
.login-form { display: flex; flex-direction: column; gap: 6px; }
.login-form label { color: var(--mute); font-size: 13px; margin-top: 8px; }
.login-form input {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 9px 10px;
}
.login-form input:focus { border-color: var(--accent); }
.login-form button { margin-top: 14px; padding: 9px; background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }
.msg { min-height: 1.4em; margin: 6px 0 0; color: var(--bad); font-size: 13px; }

@media (max-width: 600px) {
  .stat b { font-size: 22px; }
  .node .meta { margin-left: 0; width: 100%; }
  .cols, .cols.three { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
