@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("/static/figtree.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #0a1310;
  --panel: #101c18;
  --panel-2: #13201b;
  --sunk: #0d1814;
  --rule: #20332b;
  --rule-soft: #182822;
  --ink: #e9efe9;
  --ink-2: #c3cfc8;
  --muted: #8fa198;
  --accent: #f2c14e;
  --accent-ink: #13261f;
  --mint: #a8d5c2;
  --spruce: #2a6150;
  /* Status: reserved, always shown with a shape and a word. */
  --good: #2fb344;
  --warn: #fab219;
  --serious: #ec835a;
  --crit: #e5534b;
  --info: #6aa9d8;
  /* Series: fixed order, validated on this surface. */
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s5: #d55181;
  --s6: #9085e9;
  --radius: 10px;
  --side: 232px;
  --font: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--font);
  font-variant-numeric: tabular-nums;
}
a { color: var(--mint); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.shell.collapsed { --side: 60px; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--rule); z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px; min-height: 60px; }
.brand img { width: 30px; height: 30px; border-radius: 7px; flex: none; }
.brand-name { font-weight: 700; font-size: 14px; line-height: 1.15; white-space: nowrap; }
.brand-sub { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
  color: var(--ink-2); font-weight: 500; white-space: nowrap; position: relative;
}
.nav a:hover { background: var(--panel-2); text-decoration: none; color: var(--ink); }
.nav a[aria-current="page"] { background: #1a2d25; color: #fff; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav .badge { margin-left: auto; }
.side-foot { border-top: 1px solid var(--rule); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.side-foot .who { color: var(--muted); font-size: 12px; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collapsed .brand-text, .collapsed .nav span.t, .collapsed .side-foot .who, .collapsed .side-foot .t, .collapsed .nav .badge { display: none; }
.collapsed .nav a { justify-content: center; padding: 9px 0; }
.collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px; min-height: 60px; background: rgba(10, 19, 16, 0.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.top h1 { font-size: 18px; }
.top .host { color: var(--muted); font-size: 12.5px; }
.top .spacer { flex: 1; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px;
  background: transparent; border: 1px solid transparent; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--rule); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
.content { padding: 18px 20px 48px; display: flex; flex-direction: column; gap: 16px; max-width: 1640px; width: 100%; }

.live { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.live.stale i { background: var(--warn); }
.live.off i { background: var(--crit); }

/* ---------- pieces ---------- */
.card { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); min-width: 0; }
.card > header { display: flex; align-items: baseline; gap: 10px; padding: 12px 14px 0; flex-wrap: wrap; }
.card > header h2 { font-size: 13.5px; font-weight: 650; }
.card > header .sub { color: var(--muted); font-size: 12px; }
.card > header .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card > .body { padding: 12px 14px 14px; }
.card > .body.flush { padding: 8px 0 4px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-tiles { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.g-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.tile { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.tile .k { color: var(--muted); font-size: 12px; font-weight: 550; display: flex; justify-content: space-between; gap: 6px; }
.tile .v { font-size: 25px; font-weight: 680; letter-spacing: -0.02em; margin-top: 2px; line-height: 1.15; white-space: nowrap; }
.tile .v small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
.tile .s { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { height: 5px; border-radius: 3px; background: var(--rule); margin-top: 9px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--s1); width: 0; transition: width 0.4s; }
.meter.warn i { background: var(--warn); }
.meter.crit i { background: var(--crit); }
.meter.thin { height: 4px; margin-top: 4px; min-width: 60px; }

.banner {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 18px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--rule); border-left: 4px solid var(--good);
}
.banner.warning { border-left-color: var(--warn); }
.banner.critical { border-left-color: var(--crit); }
.banner.unknown { border-left-color: var(--muted); }
.banner .glyph { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; font-weight: 700; background: rgba(47, 179, 68, 0.14); color: var(--good); flex: none; }
.banner.warning .glyph { background: rgba(250, 178, 25, 0.14); color: var(--warn); }
.banner.critical .glyph { background: rgba(229, 83, 75, 0.16); color: var(--crit); }
.banner.unknown .glyph { background: rgba(143, 161, 152, 0.16); color: var(--muted); }
.banner .h { font-size: 19px; font-weight: 680; letter-spacing: -0.01em; }
.banner .d { color: var(--muted); font-size: 13px; }
.banner .facts { margin-left: auto; display: flex; gap: 22px; flex-wrap: wrap; }
.fact .k { color: var(--muted); font-size: 11.5px; }
.fact .v { font-weight: 600; font-size: 13.5px; }

.st { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.st::before { content: "●"; font-size: 10px; }
.st.healthy, .st.ok { color: var(--good); }
.st.degraded, .st.warning { color: var(--warn); }
.st.degraded::before, .st.warning::before { content: "▲"; font-size: 9px; }
.st.down, .st.critical { color: var(--crit); }
.st.down::before, .st.critical::before { content: "■"; font-size: 9px; }
.st.unknown, .st.info { color: var(--muted); }
.st.unknown::before { content: "?"; font-size: 11px; font-weight: 800; }
.st.info::before { content: "i"; font-size: 11px; font-weight: 800; font-style: italic; }
.badge { display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 10px; background: var(--rule); color: var(--ink-2); font-size: 11.5px; font-weight: 650; text-align: center; }
.badge.critical { background: var(--crit); color: #fff; }
.badge.warning { background: var(--warn); color: #1c1400; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; border: 1px solid var(--rule); color: var(--muted); font-size: 11.5px; white-space: nowrap; }

.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 550; font-size: 11.5px; padding: 7px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
td { padding: 8px 14px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; white-space: nowrap; }
td.nw { white-space: nowrap; }
td .sub, .sub { color: var(--muted); font-size: 12px; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.018); }
.empty { color: var(--muted); padding: 18px 14px; font-size: 13px; }
.note { color: var(--muted); font-size: 12.5px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--rule); background: var(--panel-2); cursor: pointer; font-weight: 550; font-size: 13px; white-space: nowrap; }
.btn:hover { border-color: #33503f; background: #182a22; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #f7d47f; }
.btn.small { padding: 3px 9px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: transparent; padding: 5px 11px; cursor: pointer; color: var(--muted); font-weight: 550; font-size: 12.5px; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button[aria-pressed="true"] { background: #1a2d25; color: #fff; }
input[type="text"], input[type="search"], input[type="password"], input[type="number"], input[type="datetime-local"], select {
  background: var(--sunk); border: 1px solid var(--rule); border-radius: 8px; padding: 6px 9px; min-width: 0; max-width: 100%;
}
input[type="number"] { width: 92px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart .plot { height: 210px; }
.chart.short .plot { height: 150px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 2px 14px 10px; font-size: 12px; color: var(--ink-2); }
.legend .it { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.legend .m { color: var(--muted); }
.tip {
  position: absolute; z-index: 5; pointer-events: none; background: #0b1512; border: 1px solid #2c4539; border-radius: 8px;
  padding: 7px 9px; font-size: 12px; box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45); white-space: nowrap; display: none;
}
.tip .t { color: var(--muted); margin-bottom: 3px; }
.tip .r { display: flex; align-items: center; gap: 7px; }
.tip .r b { margin-left: auto; padding-left: 14px; font-weight: 650; }
.tip .sw { width: 10px; height: 3px; border-radius: 2px; }
.chart .msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12.5px; pointer-events: none; text-align: center; padding: 0 20px; }
.u-legend { display: none; }
.cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px 14px; }
.cores .c { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr max-content; gap: 10px; align-items: center; font-size: 12.5px; padding: 4px 0; }
.bar-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .meter { margin: 0; }
.bar-row .val { color: var(--ink-2); text-align: right; min-width: 64px; }

/* ---------- lists ---------- */
.attn { display: flex; flex-direction: column; }
.attn .row { display: flex; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--rule-soft); align-items: flex-start; }
.attn .row:last-child { border-bottom: 0; }
.attn .row .t { font-weight: 600; }
.attn .row .d { color: var(--muted); font-size: 12.5px; }
.attn .row .act { margin-left: auto; flex: none; display: flex; gap: 6px; align-items: center; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.app { border: 1px solid var(--rule); border-radius: 9px; padding: 10px 12px; background: var(--panel-2); min-width: 0; }
.app .nm { font-weight: 650; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.app .nm span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app .ds { color: var(--muted); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.counts { display: flex; gap: 10px; flex-wrap: wrap; }
.count { flex: 1; min-width: 120px; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; }
.count .v { font-size: 26px; font-weight: 680; line-height: 1.1; }
.logs { font-family: var(--mono); font-size: 12px; line-height: 1.5; }
.logs .ln { display: grid; grid-template-columns: 132px 150px minmax(0, 1fr); gap: 10px; padding: 3px 14px; border-bottom: 1px solid var(--rule-soft); }
.logs .ln:hover { background: rgba(255, 255, 255, 0.02); }
.logs .ts { color: var(--muted); white-space: nowrap; }
.logs .un { color: var(--mint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logs .ms { white-space: pre-wrap; overflow-wrap: anywhere; }
.logs .p3 .ms, .logs .p2 .ms, .logs .p1 .ms, .logs .p0 .ms { color: #ff9c95; }
.logs .p4 .ms { color: #ffd479; }
.logs .lv { font-weight: 700; margin-right: 6px; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 60; background: #0b1512; border: 1px solid #2c4539; border-radius: 9px; padding: 10px 14px; max-width: 360px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); }
.toast.err { border-color: var(--crit); }
.scrim { display: none; }
.only-mobile { display: none; }

@media (max-width: 1100px) {
  .g2, .g3, .g-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); --side: 248px; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: var(--side); transform: translateX(-102%); transition: transform 0.18s; }
  .shell.open .side { transform: none; }
  .shell.open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 25; }
  .collapsed .brand-text, .collapsed .nav span.t, .collapsed .side-foot .who, .collapsed .side-foot .t, .collapsed .nav .badge { display: initial; }
  .collapsed .nav a { justify-content: flex-start; padding: 8px 10px; }
  .only-mobile { display: inline-flex; }
  .only-desktop { display: none; }
  .top { padding: 8px 12px; }
  .content { padding: 12px 12px 40px; gap: 12px; }
  .banner .facts { margin-left: 0; gap: 16px; }
  .tile .v { font-size: 21px; }
  .g-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .logs .ln { grid-template-columns: 1fr; gap: 0; padding: 6px 12px; }
  .chart .plot { height: 180px; }
  td, th { padding-left: 10px; padding-right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- sign-in pages ---------- */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 50% -10%, #173026 0%, var(--bg) 60%); }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: 26px 26px 22px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand img { border-radius: 9px; }
.auth-name { font-weight: 700; font-size: 15px; }
.auth-sub { color: var(--muted); font-size: 12.5px; }
.auth-card h1 { font-size: 20px; margin-bottom: 14px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card label { display: flex; flex-direction: column; gap: 5px; color: var(--ink-2); font-size: 13px; font-weight: 550; }
.auth-card input { background: var(--sunk); border: 1px solid var(--rule); border-radius: 8px; padding: 10px 11px; font-size: 15px; }
.auth-card button[type="submit"] { margin-top: 4px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 10px; font-weight: 680; font-size: 14.5px; cursor: pointer; }
.auth-card button.link { background: none !important; color: var(--muted) !important; font-weight: 500 !important; font-size: 13px !important; padding: 4px !important; }
.auth-note { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }
.auth-error { background: rgba(229, 83, 75, 0.12); border: 1px solid rgba(229, 83, 75, 0.5); color: #ffb3ad; border-radius: 8px; padding: 9px 11px; margin: 0 0 12px; font-size: 13px; }
.qr { background: #fff; border-radius: 10px; padding: 12px; width: 204px; margin: 14px auto 4px; }
.qr svg, .qr img { display: block; width: 180px; height: 180px; }
.secret { display: inline-block; margin-top: 5px; color: var(--ink); letter-spacing: 0.04em; user-select: all; overflow-wrap: anywhere; }
.auth-step { margin: 16px 0 8px; font-size: 13.5px; }
.auth-open { display: block; text-align: center; background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: 11px; font-weight: 680; font-size: 14.5px; }
.auth-open:hover { text-decoration: none; background: #f7d47f; }
.auth-copy { margin-top: 8px; background: var(--panel-2); border: 1px solid var(--rule); border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 600; }
.auth-card form { margin-top: 16px; }
