:root {
  --bg: #eef1f5; --panel: #ffffff; --ink: #15202b; --muted: #5b6b7c; --line: #d5dbe3; --hover: #f4f7fa;
  --accent: #0b6e99; --accent-ink: #ffffff; --ok: #1a936f; --warn: #c98200; --bad: #c8352b; --idle: #8a97a6;
  --strip-empty: #e3e8ee; --band: rgba(11, 110, 153, .22);
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171d26; --panel: #1f2732; --ink: #e6ebf1; --muted: #93a1b2; --line: #313c4a; --hover: #26303d;
    --accent: #4fb3d9; --accent-ink: #0d1820; --ok: #3cc49a; --warn: #f0b13c; --bad: #f0645a; --idle: #6d7b8c;
    --strip-empty: #2a3441; --band: rgba(79, 179, 217, .24);
  }
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.45;
  font-variant-numeric: tabular-nums; }
h1 { font-size: 1.55rem; font-weight: 650; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 1.05rem; font-weight: 650; margin: 0 0 .7rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.boot { padding: 3rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* top bar: the trace line under it is the one decorative element */
.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1320px; margin: 0 auto; padding: 0 1.2rem; display: flex; align-items: center; gap: 1.6rem; height: 3.3rem; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); display: flex; align-items: center; gap: .5rem; }
.brand svg { width: 1.5rem; height: 1.5rem; }
.nav { display: flex; gap: .2rem; flex: 1; }
.nav a { color: var(--muted); padding: .95rem .8rem; border-bottom: 2px solid transparent; font-weight: 550; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.on { color: var(--ink); border-bottom-color: var(--accent); }
.badge { background: var(--bad); color: #fff; border-radius: 1rem; font-size: .75rem; padding: .05rem .45rem; margin-left: .3rem; }
main { max-width: 1320px; margin: 0 auto; padding: 1.4rem 1.2rem 4rem; }
.head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.head .grow { flex: 1; min-width: 12rem; }
.tally { display: flex; gap: 1.4rem; flex-wrap: wrap; color: var(--muted); }
.tally b { color: var(--ink); font-weight: 650; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1.1rem; margin-bottom: 1.1rem; }
.panel.flush { padding: 0; overflow-x: auto; }
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.1rem; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .85rem; padding: .55rem .7rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .5rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th.right, td.right { text-align: right; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover { background: var(--hover); }
tr.group td { background: var(--bg); font-weight: 650; font-size: .85rem; color: var(--muted); padding: .35rem .7rem; }
td.strip { width: 38%; min-width: 240px; padding-top: .35rem; padding-bottom: .35rem; }
td.strip canvas { width: 100%; height: 26px; display: block; border-radius: 3px; }
.tname { font-weight: 600; }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; background: var(--idle); margin-right: .55rem; vertical-align: baseline; }
.s-up .dot, .dot.s-up { background: var(--ok); }
.s-degraded .dot, .dot.s-degraded, .s-alert .dot, .dot.s-alert { background: var(--warn); }
.s-down .dot, .dot.s-down { background: var(--bad); }
.bad { color: var(--bad); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }
.ok { color: var(--ok); }
.sev { font-size: .8rem; font-weight: 650; padding: .08rem .45rem; border-radius: 3px; border: 1px solid currentColor; }
.sev.critical { color: var(--bad); } .sev.warning { color: var(--warn); } .sev.info { color: var(--muted); }

button, .btn { font: inherit; font-weight: 550; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: .42rem .85rem; border-radius: 5px; cursor: pointer; display: inline-block; }
button:hover, .btn:hover { background: var(--hover); text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.08); background: var(--accent); }
button.danger { color: var(--bad); }
button.plain { border-color: transparent; background: none; color: var(--accent); padding: .2rem .4rem; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; border-right: 1px solid var(--line); padding: .35rem .7rem; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

label { display: block; font-weight: 600; font-size: .87rem; margin-bottom: .25rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; font-size: 1rem; margin: 0; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=datetime-local], select, textarea {
  font: inherit; font-weight: 400; width: 100%; padding: .42rem .55rem; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); color: var(--ink); }
textarea { min-height: 5.5rem; resize: vertical; }
.field { margin-bottom: .85rem; }
.hint { color: var(--muted); font-size: .83rem; margin-top: .2rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 1rem; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.error { color: var(--bad); font-weight: 550; margin: .4rem 0; min-height: 1.3rem; }
.notice { color: var(--ok); font-weight: 550; }
.scope-list { max-height: 9rem; overflow: auto; border: 1px solid var(--line); border-radius: 5px; padding: .4rem .6rem; }

dialog { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); padding: 1.3rem 1.4rem;
  width: min(40rem, 94vw); max-height: 92vh; overflow: auto; }
dialog::backdrop { background: rgba(10, 16, 24, .55); }
dialog h2 { font-size: 1.2rem; margin-bottom: 1rem; }
.actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }

.login { max-width: 23rem; margin: 12vh auto 0; }
.login h1 { margin-bottom: 1.2rem; display: flex; gap: .6rem; align-items: center; }
.login svg { width: 2rem; height: 2rem; }

.chart-wrap { position: relative; }
.chart-wrap canvas { width: 100%; height: 340px; display: block; cursor: crosshair; touch-action: none; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: .35rem .55rem; border-radius: 4px;
  font-size: .82rem; white-space: pre; z-index: 3; transform: translate(-50%, -115%); }
.stats { display: flex; gap: 2rem; flex-wrap: wrap; margin-top: .8rem; }
.stats div span { display: block; color: var(--muted); font-size: .83rem; }
.stats div b { font-size: 1.2rem; font-weight: 650; }
.legend { display: flex; gap: 1.1rem; color: var(--muted); font-size: .83rem; margin-top: .5rem; flex-wrap: wrap; }
.legend i { display: inline-block; width: .9rem; height: .55rem; margin-right: .35rem; border-radius: 2px; }
.hopbar { height: .5rem; background: var(--accent); border-radius: 2px; min-width: 2px; opacity: .75; }
.sections { margin-bottom: 1rem; overflow-x: auto; }
@media (prefers-reduced-motion: no-preference) { dialog[open] { animation: pop .12s ease-out; } }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }
.hopcell { width: 30%; }
