:root {
  --bg: #0D1117; --bar: #10151C; --panel: #151A21; --panel2: #1B2129; --line: #2A313C; --line2: #222831;
  --text: #E8EAED; --text2: #C3CAD4; --muted: #A0A9B6; --faint: #8A94A3;
  --accent: #E5484D; --link: #8CC4FF;
  --ok: #3DD68C; --warn: #F5B041; --crit: #FF6B6B;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 'IBM Plex Sans', system-ui, sans-serif; }
a { color: var(--link); text-decoration: none; } a:hover { color: #B8DBFF; text-decoration: underline; }
.num { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
h1, h2 { margin: 0; letter-spacing: -0.01em; }

.bar { border-bottom: 1px solid var(--line); background: var(--bar); position: sticky; top: 0; z-index: 20; }
html { scroll-behavior: smooth; }
main [id] { scroll-margin-top: 96px; }
@media (max-width: 760px) {
  /* keep the pinned header one line high on phones: menu scrolls sideways */
  .bar-in { padding: 10px 16px; gap: 10px 16px; }
  .nav { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; order: 3; }
  .nav a { white-space: nowrap; }
  main [id] { scroll-margin-top: 130px; }
}
.bar-in { max-width: 1360px; margin: 0 auto; padding: 14px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.brand span { color: var(--muted); font-weight: 500; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 520px; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--text2); }
.nav a.on { background: #1F2630; color: var(--text); font-weight: 500; }
.nav a.off { color: var(--faint); cursor: default; } .nav a.off:hover { text-decoration: none; }
.tools { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.btn { height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; cursor: pointer; }
.btn:hover { border-color: #3A4452; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

main { max-width: 1360px; margin: 0 auto; padding: 28px 24px 64px; display: flex; flex-direction: column; gap: 28px; }
.state { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.state > div:first-child { flex: 1 1 420px; }
.state h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.state p { margin: 6px 0 0; color: var(--muted); }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.pill i { width: 8px; height: 8px; border-radius: 50%; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.crit { background: #3A1D20; color: #FFB4B4; } .crit i { background: var(--crit); }
.warn { background: #3A2E14; color: #FFD58A; } .warn i { background: var(--warn); }
.ok { background: #17302A; color: #9BE7C4; } .ok i { background: var(--ok); }
.info { background: #172A40; color: #A9D1FF; }
.mute { background: #222831; color: var(--text2); }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 12px; }
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.attn { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.attn .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.attn .t { font-weight: 600; font-size: 16px; }
.attn .x { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.kpi { padding: 16px 18px; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi .v { font-size: 30px; font-weight: 500; margin-top: 6px; letter-spacing: -0.02em; }
.kpi .s { font-size: 13px; color: var(--muted); margin-top: 4px; }
.allgood { padding: 18px 20px; color: #9BE7C4; }

.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.row > .card { min-width: 0; }
.wide { flex: 999 1 640px; } .narrow { flex: 1 1 420px; }
.head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; padding: 18px 20px 6px; }
.head h2 { font-size: 18px; font-weight: 600; }
.head span { font-size: 13px; color: var(--muted); }
.scroll { overflow-x: auto; padding: 0 8px 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td .sub { font-size: 12px; color: var(--muted); }
.r { text-align: right; }
.balances { display: flex; flex-wrap: wrap; gap: 12px; padding: 4px 20px 18px; }
.bal { flex: 1 1 240px; background: var(--panel2); border-radius: 10px; padding: 12px 14px; display: flex; justify-content: space-between; gap: 8px; }
.bal .l { font-size: 13px; color: var(--muted); } .bal .v { font-size: 20px; margin-top: 2px; }
.bad { color: #FFB4B4; }
.events { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.ev { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line2); align-items: baseline; }
.ev .tm { font-size: 13px; color: var(--muted); flex: 0 0 92px; }
.note { margin: 0; font-size: 12px; color: var(--faint); }

.pl { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.pl h2 { font-size: 18px; font-weight: 600; }
.lines { display: flex; flex-direction: column; gap: 10px; }
.lines > div { display: flex; justify-content: space-between; gap: 12px; }
.lines .sep { height: 1px; background: var(--line); }
.lines .total { font-weight: 600; font-size: 17px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 110px; padding-top: 6px; }
.bars .b { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bars .f { width: 100%; border-radius: 3px 3px 0 0; background: #3A4452; }
.bars .f.cur { background: var(--accent); }
.bars span { font-size: 10px; color: var(--faint); }
.svc { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.svc > div { display: flex; align-items: center; gap: 8px; background: var(--panel2); border-radius: 8px; padding: 9px 10px; min-width: 0; }
.svc .n { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc .st { font-size: 12px; color: var(--muted); }
.dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.crit { background: var(--crit); }
.ratio { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: #4A5463; }
.ratio div { background: var(--ok); }
.pairs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; font-size: 14px; }
.pairs > div { display: flex; justify-content: space-between; gap: 8px; }

.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.meter { display: flex; align-items: center; gap: 8px; }
.meter .track { width: 64px; height: 6px; border-radius: 3px; background: var(--line); }
.meter .fill { height: 6px; border-radius: 3px; }
.fill.ok { background: var(--ok); } .fill.warn { background: var(--warn); } .fill.crit { background: var(--crit); }
.spark polyline { fill: none; stroke: #6CB6FF; stroke-width: 1.5; stroke-linejoin: round; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login label { font-size: 13px; color: var(--muted); }
.login input { height: 44px; border-radius: 8px; border: 1px solid var(--line); background: #0F141A; color: var(--text); padding: 0 12px; font: inherit; }
.login .btn { height: 44px; }
.err { color: #FFB4B4; font-size: 14px; }
