/* ═══════════════════════════════════════════════════════════════════
   LastPing — "signal room" design system
   Dark-only. Plain CSS. System fonts. No dependencies.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* ── New surface tokens ─────────────────────────────────── */
  --bg0: #0b0e13;
  --bg1: #11151c;
  --bg2: #161c25;
  --bg3: #1d2430;
  --line: #222a36;
  --line-2: #303a49;
  /* ── Ink ─────────────────────────────────────────────────── */
  --ink: #e7edf4;
  --ink-2: #9aa6b5;
  --ink-3: #626e7c;
  /* ── Brand ───────────────────────────────────────────────── */
  --accent: #2dd4bf;
  --accent-hi: #5eead4;
  --accent-ink: #03221f;
  /* ── Status ──────────────────────────────────────────────── */
  --up: #34d399;
  --late: #f2b544;
  --down: #f26d78;
  --paused: #626e7c;
  --info: #4ea3ff;
  /* ── Type ────────────────────────────────────────────────── */
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  /* ── Type scale ──────────────────────────────────────────── */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-lg: 14px;
  --fs-xl: 16px;
  --fs-2xl: 18px;
  /* ── Radii ───────────────────────────────────────────────── */
  --r-1: 4px; --r-2: 6px; --r-3: 8px; --r-4: 999px;
  /* ── Elevation ───────────────────────────────────────────── */
  --shadow-1: 0 1px 2px rgba(0,0,0,.5);
  --shadow-2: 0 8px 28px rgba(0,0,0,.45);
  --shadow-3: 0 24px 64px rgba(0,0,0,.6), 0 0 0 1px var(--line);
  /* ── Motion ──────────────────────────────────────────────── */
  --t-fast: 120ms ease;
  --t-med: 180ms ease;

  /* ── Legacy aliases (backward compat for un-migrated templates) ── */
  --bg: #0b0e13;
  --paper: #0b0e13;
  --panel: #11151c;
  --panel2: #161c25;
  --muted: #9aa6b5;
  --dim: #626e7c;
  --acc: #2dd4bf;
  --acc-ink: #03221f;
  --ok: #34d399;
  --warn: #f2b544;
  --danger: #f26d78;
  --blue: #4ea3ff;
  --amber: #2dd4bf;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ── Reset + Base ──────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg0);
  color: var(--ink);
  font: 400 13px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); }
code, kbd, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

/* ── Shell ──────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.side {
  position: relative; /* anchors the absolutely-positioned .side-collapse toggle */
  width: 220px; flex: 0 0 220px;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 0 0 12px;
}
.side-brand {
  display: flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
.side nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; }
.nav-grp {
  padding: 14px 10px 5px;
  font: 500 10.5px var(--font-mono);
  text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-3);
}
.nav-grp:first-child { padding-top: 6px; }
.side nav a {
  display: flex; align-items: center; gap: 10px;
  height: 30px; padding: 0 10px; margin: 1px 0;
  border-radius: var(--r-2);
  color: var(--ink-2); font-size: 13px;
  transition: background var(--t-fast), color var(--t-fast);
}
.side nav a:hover { background: var(--bg2); color: var(--ink); }
.side nav a.on {
  background: var(--bg3); color: var(--ink);
  box-shadow: inset 2px 0 0 var(--accent);
}
.side nav a svg { width: 16px; height: 16px; flex: 0 0 16px; opacity: .85; }
.nav-count {
  margin-left: auto;
  font: 500 11px var(--font-mono);
  color: var(--down);
  background: color-mix(in srgb, var(--down) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--down) 28%, transparent);
  border-radius: var(--r-4); padding: 0 6px; line-height: 15px;
}
.side-foot {
  padding: 10px 16px 0; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  color: var(--ink-3); font: 400 11.5px var(--font-mono);
}

/* ── Legacy sidebar classes (template backward compat) ──────── */
.side-nav-group {
  display: flex; flex-direction: column; gap: 2px;
  padding-bottom: 10px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.side-nav-group:last-child { border-bottom: none; }
.side .grp {
  display: block; padding: 4px 12px 2px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--dim); font-family: var(--mono);
}
.side nav a .lbl { transition: opacity var(--t-fast); }
.side-collapse {
  position: absolute; bottom: 14px; right: 10px;
  background: none; border: 1px solid var(--line); border-radius: 6px;
  color: var(--dim); cursor: pointer; padding: 5px;
  display: flex; align-items: center;
  transition: transform var(--t-med), color var(--t-fast);
}
.side-collapse:hover { color: var(--ink); border-color: var(--muted); }
.side.collapsed { width: 56px; flex: 0 0 56px; }
.side.collapsed .lbl { display: none; }
.side.collapsed .grp { display: none; }
.side.collapsed .side-collapse { transform: rotate(180deg); }
.side.collapsed nav a { justify-content: center; padding: 9px; }

/* ── Logo ───────────────────────────────────────────────────── */
.lp-logo { display: inline-flex; align-items: center; gap: 8px; }
.lp-ecg .trace { stroke: var(--line-2); }
.lp-ecg .beat { stroke: var(--accent); stroke-dasharray: 40 8; animation: lp-ecg 2.4s linear infinite; }
@keyframes lp-ecg { from { stroke-dashoffset: 48; } to { stroke-dashoffset: 0; } }
.lp-word { font: 700 13.5px var(--font-mono); letter-spacing: -.01em; color: var(--ink); }

.app-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 14px;
  height: 48px; padding: 0 20px;
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.brand { display: flex; align-items: center; }
.topbar-center { flex: 1; display: flex; justify-content: center; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 13px; min-width: 0; }
.crumbs a { color: var(--ink-2); }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--ink-3); user-select: none; }
.crumbs .cur { color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cmdk {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
  height: 28px; min-width: 210px; padding: 0 10px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-2);
  color: var(--ink-3); font: 400 12.5px var(--font-ui); cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
}
.cmdk:hover { border-color: var(--line-2); color: var(--ink-2); }
.cmdk kbd {
  margin-left: auto; font-size: 10.5px; color: var(--ink-3);
  background: var(--bg3); border: 1px solid var(--line); border-radius: var(--r-1);
  padding: 1px 5px;
}

/* Account row (legacy topbar classes) */
.acct { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.acct form { margin: 0; }
.acct-login { color: var(--muted); }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
.linkbtn:hover { color: var(--ink); }

/* Fleet pulse chip */
.fleet {
  display: flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: var(--r-4);
  font: 500 11.5px var(--font-mono); color: var(--ink-2);
  white-space: nowrap;
}
.fleet .n-up { color: var(--up); } .fleet .n-late { color: var(--late); } .fleet .n-down { color: var(--down); }
.fleet-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); position: relative; flex: 0 0 7px; color: var(--up); }
.fleet-dot.hot { background: var(--down); color: var(--down); }
.fleet-dot::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid currentColor; opacity: 0;
  animation: fleet-pulse 2.4s ease-out infinite;
}
.fleet-dot.hot::after { animation: none; opacity: 0; }
@keyframes fleet-pulse { 0% { transform: scale(.5); opacity: .8; } 70% { transform: scale(1.4); opacity: 0; } 100% { opacity: 0; } }

.ava {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--line-2);
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 11px var(--font-ui); color: var(--ink-2); text-transform: uppercase; cursor: pointer;
}
.ava:hover { color: var(--ink); border-color: var(--ink-3); }

.drawer-toggle { display: none; }

/* ── Main area ──────────────────────────────────────────────── */
.main { flex: 1; overflow: auto; padding: 20px 24px 48px; }
.main-inner { max-width: 1200px; margin: 0 auto; }

/* ── Page header ────────────────────────────────────────────── */
.page-head { display: flex; align-items: center; gap: 12px; margin: 2px 0 16px; min-height: 34px; }
.page-head h1 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.page-head .meta { color: var(--ink-3); font: 400 11.5px var(--font-mono); margin-top: 3px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; padding: 0 12px;
  background: var(--bg2); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-2);
  font: 500 12.5px var(--font-ui); cursor: pointer; text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.btn:hover { background: var(--bg3); border-color: var(--line-2); color: var(--ink); }
.btn.active { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: var(--accent-ink); }
.btn-danger { color: var(--down); }
.btn-danger:hover { border-color: color-mix(in srgb, var(--down) 45%, transparent); background: color-mix(in srgb, var(--down) 8%, transparent); color: var(--down); }
.btn-danger-solid { background: var(--down); border-color: var(--down); color: #1c0507; font-weight: 600; }
.btn-quiet { background: none; border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--bg3); border-color: transparent; color: var(--ink); }
.btn-sm { height: 24px; padding: 0 9px; font-size: 12px; }
.btn-lg { height: 34px; padding: 0 16px; font-size: 13.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ── Segmented control ──────────────────────────────────────── */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-2); overflow: hidden; background: var(--bg1); }
.seg > * {
  appearance: none; background: none; border: 0; margin: 0; cursor: pointer;
  height: 26px; padding: 0 11px;
  border-right: 1px solid var(--line);
  color: var(--ink-2); font: 500 12px var(--font-ui);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background var(--t-fast), color var(--t-fast);
  text-decoration: none;
}
.seg > *:last-child { border-right: 0; }
.seg > *:hover { color: var(--ink); background: var(--bg2); }
.seg > .on { background: var(--bg3); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.seg .cnt { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }
.seg > .on .cnt { color: var(--ink-2); }

/* ── Fields ─────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field > label, .microlabel {
  display: block; margin-bottom: 5px;
  font: 500 10.5px var(--font-mono);
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3);
}
.input, .select, textarea.input {
  width: 100%; height: 28px; padding: 0 9px;
  background: var(--bg2); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-2);
  font: 400 12.5px var(--font-ui);
  transition: border-color var(--t-fast);
}
textarea.input { height: auto; padding: 7px 9px; resize: vertical; line-height: 1.5; }
.input.mono { font-family: var(--font-mono); }
.input::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--accent); }
.select {
  appearance: none; padding-right: 24px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 13px) 12px, calc(100% - 9px) 12px;
  background-size: 4px 4px; background-repeat: no-repeat; cursor: pointer;
}
.hint { margin: 5px 0 0; font-size: 11.5px; color: var(--ink-2); }
.search { position: relative; }
.search .input { padding-left: 27px; }
.search svg { position: absolute; left: 8px; top: 6px; width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }

/* Legacy field classes (templates use field-input / field-label / field-select) */
.field-label {
  display: block; margin-bottom: 5px;
  font: 500 10.5px var(--font-mono);
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3);
}
.field-input {
  width: 100%; height: 28px; padding: 0 9px;
  background: var(--bg2); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-2);
  font: 400 12.5px var(--font-ui);
  transition: border-color var(--t-fast);
}
.field-input:focus { outline: none; border-color: var(--accent); }
.field-input::placeholder { color: var(--ink-3); }
.field-select {
  width: 100%; height: 28px; padding: 0 24px 0 9px;
  background: var(--bg2); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-2);
  font: 400 12.5px var(--font-ui); appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 13px) 12px, calc(100% - 9px) 12px;
  background-size: 4px 4px; background-repeat: no-repeat;
  transition: border-color var(--t-fast);
}
.field-select:focus { outline: none; border-color: var(--accent); }
.field-hint { margin: 5px 0 0; font-size: 11.5px; color: var(--ink-2); }
.field-row { display: flex; gap: 12px; align-items: flex-end; }
.num-unit { display: flex; align-items: center; gap: 6px; }
/* Compact number input inside a .num-unit row (prevents width:100% overflow) */
.num-unit .num-unit-n { width: 72px; min-width: 0; flex: 0 0 72px; }

/* Toggle */
.toggle { position: relative; display: inline-block; width: 32px; height: 18px; flex: 0 0 32px; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle i {
  position: absolute; inset: 0; border-radius: var(--r-4);
  background: var(--bg3); border: 1px solid var(--line-2);
  transition: background var(--t-fast), border-color var(--t-fast); pointer-events: none;
}
.toggle i::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--ink-2); transition: transform var(--t-fast), background var(--t-fast);
}
.toggle input:checked + i { background: color-mix(in srgb, var(--accent) 25%, var(--bg3)); border-color: var(--accent); }
.toggle input:checked + i::after { transform: translateX(14px); background: var(--accent); }
.toggle input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Checkbox */
input[type=checkbox].cb { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

/* ── Panels / cards ──────────────────────────────────────────── */
.panel { background: var(--bg1); border: 1px solid var(--line); border-radius: var(--r-3); }
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
}
.panel-title { font-size: 13.5px; font-weight: 600; }
.panel-head .meta { color: var(--ink-3); font: 400 11px var(--font-mono); }
.panel-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel-body { padding: 14px; }

/* Legacy detail-panel-head (check_detail) */
.detail-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.detail-panel-title { font-size: 14.5px; font-weight: 600; color: var(--ink); }

/* Stat strip */
.stat-strip { display: flex; background: var(--bg1); border: 1px solid var(--line); border-radius: var(--r-3); overflow-x: auto; }
.stat {
  flex: 1; min-width: 96px; padding: 12px 16px 11px;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: 0; }
.stat .microlabel { margin-bottom: 3px; }
.stat b { display: block; font: 600 20px/1.2 var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .sub { font: 400 11px var(--font-mono); color: var(--ink-3); margin-top: 1px; }
.stat b a { color: inherit; }
/* Admin stat grid (admin_overview uses .stat .n/.l pattern) */
.stat .n { font: 600 20px/1.2 var(--font-mono); font-variant-numeric: tabular-nums; }
.stat .l { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* ── Color utils ────────────────────────────────────────────── */
.c-up { color: var(--up); } .c-late { color: var(--late); } .c-down { color: var(--down); }
.c-muted { color: var(--ink-3); } .c-ink2 { color: var(--ink-2); } .c-accent { color: var(--accent); }
.form-inline { margin: 0; }

/* ── Pills & badges ──────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 20px; padding: 0 9px 0 7px;
  border-radius: var(--r-4);
  font: 500 11.5px var(--font-mono); letter-spacing: .01em;
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.up     { color: var(--up);   background: color-mix(in srgb, var(--up) 11%, transparent);   border: 1px solid color-mix(in srgb, var(--up) 26%, transparent); }
.pill.late   { color: var(--late); background: color-mix(in srgb, var(--late) 11%, transparent); border: 1px solid color-mix(in srgb, var(--late) 26%, transparent); }
.pill.down   { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); border: 1px solid color-mix(in srgb, var(--down) 28%, transparent); }
.pill.paused { color: var(--ink-3); background: transparent; border: 1px solid var(--line-2); }
.pill.paused::before { background: transparent; border: 1px solid currentColor; width: 5px; height: 5px; }
.pill.open     { color: var(--late); background: color-mix(in srgb, var(--late) 11%, transparent); border: 1px solid color-mix(in srgb, var(--late) 26%, transparent); }
.pill.resolved { color: var(--ink-2); background: var(--bg2); border: 1px solid var(--line); }
.pill.resolved::before { background: var(--up); }
/* Legacy pill variants used in templates */
.pill.ok { color: var(--up); background: color-mix(in srgb, var(--up) 11%, transparent); border: 1px solid color-mix(in srgb, var(--up) 26%, transparent); }
.pill.warn { color: var(--late); background: color-mix(in srgb, var(--late) 11%, transparent); border: 1px solid color-mix(in srgb, var(--late) 26%, transparent); }
/* pill-ok / pill-warn standalone (settings.html.tmpl) */
.pill-ok { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--r-4); font: 500 11.5px var(--font-mono); color: var(--up); background: color-mix(in srgb, var(--up) 11%, transparent); border: 1px solid color-mix(in srgb, var(--up) 26%, transparent); }
.pill-warn { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--r-4); font: 500 11.5px var(--font-mono); color: var(--late); background: color-mix(in srgb, var(--late) 11%, transparent); border: 1px solid color-mix(in srgb, var(--late) 26%, transparent); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 17px; padding: 0 6px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-1);
  font: 500 10px var(--font-mono); text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-2); white-space: nowrap;
}
.badge.warn { color: var(--late); border-color: color-mix(in srgb, var(--late) 30%, transparent); background: color-mix(in srgb, var(--late) 8%, transparent); }
.badge.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
/* b-down badge variant (templates use class="badge b-down") */
.badge.b-down { color: var(--down); border-color: color-mix(in srgb, var(--down) 30%, transparent); background: color-mix(in srgb, var(--down) 8%, transparent); }

/* ── Signal strip (90-day trace) ─────────────────────────────── */
.strip-wrap { display: flex; align-items: center; gap: 9px; }
.strip {
  position: relative; width: 148px; height: 15px; flex: 0 0 148px;
  background: repeating-linear-gradient(90deg,
    color-mix(in srgb, var(--up) 52%, var(--bg2)) 0 2px,
    transparent 2px 4px);
  border-radius: 2px;
}
.strip i { position: absolute; top: 0; bottom: 0; width: 2px; border-radius: 1px; }
.strip i.late { background: var(--late); }
.strip i.down { background: var(--down); }
.strip i.nodata { background: var(--ink-3); opacity: .4; }
.strip.dim { opacity: .35; }
.strip-pct { font: 500 12px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ── Tables ──────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 8px 12px;
  font: 500 10.5px var(--font-mono); text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); border-bottom: 1px solid var(--line);
  white-space: nowrap; user-select: none;
}
.table th.num, .table td.num { text-align: right; }
.th-sort { cursor: pointer; }
.th-sort:hover { color: var(--ink-2); }
.th-sort.on { color: var(--ink-2); }
.th-sort.on::after { content: " ↓"; color: var(--accent); }
.table td {
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  font-size: 13px; vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: color-mix(in srgb, var(--bg3) 55%, transparent); }
.table .mono, .table td.data { font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.table td.dim { color: var(--ink-2); }
.table a.rowlink { color: var(--ink); font-weight: 500; }
.table a.rowlink:hover { color: var(--accent); }
tr.row-down  { background: color-mix(in srgb, var(--down) 4%, transparent); }
tr.row-late  { background: color-mix(in srgb, var(--late) 4%, transparent); }
tr.row-down td:first-child { box-shadow: inset 2px 0 0 var(--down); }
tr.row-late td:first-child { box-shadow: inset 2px 0 0 var(--late); }
tr.row-paused td { opacity: .55; }
tr.row-paused td:last-child { opacity: 1; }
.table-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; color: var(--ink-3); font: 400 11.5px var(--font-mono);
}
.table-foot .right { margin-left: auto; display: flex; gap: 4px; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 200px; max-width: 340px; }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a {
  padding: 8px 12px 9px; margin-bottom: -1px;
  color: var(--ink-2); font: 500 13px var(--font-ui);
  border-bottom: 2px solid transparent;
  transition: color var(--t-fast);
}
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .cnt { font: 400 11px var(--font-mono); color: var(--ink-3); margin-left: 5px; }

/* ── Dropdown menu ───────────────────────────────────────────── */
.menu {
  min-width: 168px; padding: 5px;
  background: var(--bg1); border: 1px solid var(--line); border-radius: var(--r-3);
  box-shadow: var(--shadow-2);
}
.menu a, .menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 6px 9px; border: 0; background: none; text-align: left;
  color: var(--ink); font: 400 12.5px var(--font-ui); border-radius: var(--r-1); cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--bg3); color: var(--ink); }
.menu .danger { color: var(--down); }
.menu .danger:hover { background: color-mix(in srgb, var(--down) 10%, transparent); color: var(--down); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.menu kbd { margin-left: auto; font-size: 10px; color: var(--ink-3); }

/* ── Attention rows ──────────────────────────────────────────── */
.attn { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.attn:last-child { border-bottom: 0; }
.attn .cause { color: var(--ink-2); font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn .act { margin-left: auto; flex: 0 0 auto; }
.attn .name { font-weight: 500; color: var(--ink); font-family: var(--font-mono); font-size: 12.5px; }
.attn .name:hover { color: var(--accent); }

/* ── Feed rows ───────────────────────────────────────────────── */
.feed { display: flex; flex-direction: column; }
.feed-row { display: flex; align-items: baseline; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.feed-row:last-child { border-bottom: 0; }
.feed-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; align-self: center; }
.feed-row .when { margin-left: auto; color: var(--ink-3); font: 400 11.5px var(--font-mono); white-space: nowrap; }
.feed-row .who { font-family: var(--font-mono); color: var(--ink); }
.feed-row .what { color: var(--ink-2); }

/* ── Incident card + evidence well ──────────────────────────── */
.incident { border: 1px solid color-mix(in srgb, var(--down) 28%, var(--line)); box-shadow: inset 2px 0 0 var(--down); }
.well {
  background: var(--bg0); border: 1px solid var(--line); border-radius: var(--r-2);
  padding: 11px 13px; font: 400 12px/1.65 var(--font-mono);
  color: var(--ink-2); overflow-x: hidden; overflow-y: auto; max-height: 240px;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  max-width: 100%; tab-size: 4;
}
.well .hl { color: var(--down); }
.well .ok-l { color: var(--up); }
/* Failure detail log — bounded excerpt, never widens the page */
.detail-log { min-width: 0; }
.detail-log:focus { outline: 1px solid var(--line); outline-offset: 2px; }
/* Capped scroll region for long incident / event lists */
.list-scroll { max-height: 32rem; overflow-y: auto; min-width: 0; }
.list-scroll:focus { outline: 1px solid var(--line); outline-offset: 2px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-2);
  font: 400 11.5px var(--font-mono); color: var(--ink-2);
}
.chip b { color: var(--ink); font-weight: 500; }

/* ── Event timeline ──────────────────────────────────────────── */
.timeline { list-style: none; margin: 0; padding: 2px 0 0; }
.timeline li { position: relative; padding: 0 0 16px 24px; }
.timeline li::before {
  content: ""; position: absolute; left: 4px; top: 14px; bottom: -2px;
  width: 1px; background: var(--line);
}
.timeline li:last-child::before { display: none; }
.timeline .tl-dot {
  position: absolute; left: 0; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--bg3); border: 1.5px solid var(--ink-3);
}
.timeline .tl-dot.down { background: var(--down); border-color: var(--down); }
.timeline .tl-dot.up { background: var(--up); border-color: var(--up); }
.timeline .tl-dot.late { background: var(--late); border-color: var(--late); }
.timeline .tl-dot.send { background: var(--bg1); border-color: var(--accent); }
.tl-head { display: flex; align-items: baseline; gap: 8px; }
.tl-title { font-size: 12.5px; font-weight: 500; }
.tl-when { margin-left: auto; color: var(--ink-3); font: 400 11px var(--font-mono); white-space: nowrap; }
.tl-sub { color: var(--ink-2); font-size: 12px; margin-top: 1px; }
.tl-sub .mono { font-size: 11.5px; }

/* ── Bars (run/probe history) ────────────────────────────────── */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 56px; padding-top: 4px; }
.bars i { flex: 1; max-width: 10px; min-height: 4px; border-radius: 2px 2px 0 0; background: color-mix(in srgb, var(--up) 55%, var(--bg3)); transition: background var(--t-fast); }
.bars i:hover { background: var(--up); }
.bars i.fail { background: var(--down); }
.bars-axis { display: flex; justify-content: space-between; color: var(--ink-3); font: 400 10.5px var(--font-mono); border-top: 1px solid var(--line); padding-top: 5px; margin-top: 2px; }

/* ── KV config list ──────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 12.5px; }
.kv dt { color: var(--ink-3); font: 500 10.5px var(--font-mono); text-transform: uppercase; letter-spacing: .07em; padding-top: 2px; }
.kv dd { margin: 0; color: var(--ink); font-family: var(--font-mono); font-size: 12px; overflow-wrap: break-word; min-width: 0; }
.kv dd .dim { color: var(--ink-2); }

/* Copyable code line */
.copyline {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg0); border: 1px solid var(--line); border-radius: var(--r-2);
  padding: 6px 6px 6px 10px;
}
.copyline code { flex: 1; font-size: 11.5px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Callout ─────────────────────────────────────────────────── */
.callout {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--r-2);
  background: var(--bg2); font-size: 12.5px; color: var(--ink-2);
}
.callout.warn { border-color: color-mix(in srgb, var(--late) 30%, var(--line)); background: color-mix(in srgb, var(--late) 6%, var(--bg2)); }
.callout.warn .ic { color: var(--late); }
.callout.down { border-left: 3px solid var(--down); }
.callout b { color: var(--ink); font-weight: 500; }
/* Legacy callout sub-elements (home.html.tmpl) */
.callout-icon { font-size: 18px; flex: 0 0 auto; }
.callout.warn .callout-icon { color: var(--late); }
.callout-body { flex: 1; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.callout-strong { color: var(--ink); font-weight: 600; }
.callout-muted { color: var(--muted); }

/* ── Callout banner (banner-warn) ────────────────────────────── */
.banner-warn {
  background: color-mix(in srgb, var(--warn) 8%, var(--bg1));
  border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line));
  border-radius: var(--r-3); padding: 13px 15px; margin-bottom: 18px;
  display: flex; align-items: center; gap: 12px;
}

/* ── Flash messages ──────────────────────────────────────────── */
.flash {
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  background: var(--bg1); border-radius: var(--r-2);
  padding: 11px 14px; margin: 0 0 20px; font-size: 13px;
}
.flash.err { border-left-color: var(--down); }

/* ── Toast notifications ─────────────────────────────────────── */
.toasts {
  position: fixed; top: 18px; right: 18px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 60; max-width: 380px; pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  width: 340px; padding: 11px 12px;
  background: var(--bg1); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--r-3); box-shadow: var(--shadow-2); font-size: 12.5px;
  pointer-events: auto; animation: toast-in .22s ease-out both;
}
.toast.success { border-left-color: var(--up); }
.toast.info { border-left-color: var(--info); }
.toast.warn { border-left-color: var(--late); }
.toast.error { border-left-color: var(--down); }
.toast-msg { flex: 1; font-size: 13px; color: var(--ink); line-height: 1.5; }
.toast-close, .toast .x {
  background: none; border: 0; color: var(--ink-3); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0 2px;
  flex: 0 0 auto; margin-top: -1px; margin-left: auto;
}
.toast-close:hover, .toast .x:hover { color: var(--ink); }
.toast-out { animation: toast-out .3s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(24px); } }

/* ── Confirm modal ───────────────────────────────────────────── */
.confirm-modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; }
.confirm-modal[hidden] { display: none; }
.confirm-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.confirm-box {
  position: relative; background: var(--bg1);
  border: 1px solid var(--line); border-radius: var(--r-3);
  box-shadow: var(--shadow-3); padding: 28px 28px 22px;
  max-width: 420px; width: calc(100% - 32px);
}
.confirm-msg { color: var(--ink); font-size: 14px; line-height: 1.55; margin: 0 0 22px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Command palette ─────────────────────────────────────────── */
.palette {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 80px;
}
.palette[hidden] { display: none; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.palette-box {
  position: relative; width: 560px; max-width: 100%;
  background: var(--bg1); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-3); overflow: hidden;
}
.palette-search {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.palette-search svg { color: var(--ink-3); }
.palette-search input {
  flex: 1; background: none; border: 0; color: var(--ink);
  font: 400 13.5px var(--font-ui); outline: none;
}
.palette-search input::placeholder { color: var(--ink-3); }
.palette-close { background: none; border: 0; color: var(--ink-2); cursor: pointer; padding: 4px; display: flex; }
.palette-close:hover { color: var(--ink); }
.palette-list {
  list-style: none; margin: 0; padding: 8px;
  max-height: 360px; overflow-y: auto;
}
.palette-list a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-2);
  color: var(--ink-2); font-size: 13px; text-decoration: none;
}
.palette-list a:hover { background: var(--bg3); color: var(--ink); }
.palette-group {
  padding: .25rem 1rem; font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); border-top: 1px solid var(--line);
}
.palette-group:first-child { border-top: none; }
.palette-grp { padding: 8px 14px 3px; font: 500 10px var(--font-mono); text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 7px 14px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.palette-item .badge { margin-left: auto; }
.palette-item:hover, .palette-item.sel { background: var(--bg3); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
.palette-foot {
  display: flex; gap: 14px; padding: 8px 14px;
  border-top: 1px solid var(--line); color: var(--ink-3); font: 400 10.5px var(--font-mono);
}
.palette-foot kbd {
  background: var(--bg3); border: 1px solid var(--line);
  border-radius: 3px; padding: 0 4px; margin-right: 4px;
}

/* ── Tooltip (CSS-only) ──────────────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--line-2); border-radius: var(--r-1);
  box-shadow: var(--shadow-1);
  padding: 4px 8px; font: 400 11px var(--font-ui); color: var(--ink);
  white-space: nowrap; z-index: 30; pointer-events: none;
}

/* ── States ──────────────────────────────────────────────────── */
.empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; padding: 44px 20px;
  text-align: center; color: var(--ink-2);
}
.empty svg { color: var(--ink-3); opacity: .7; }
.empty p, .empty-msg { margin: 0; color: var(--ink-2); font-size: 13px; }
.empty .btn { margin-top: 4px; }
.skeleton { position: relative; overflow: hidden; background: var(--bg2); border-radius: var(--r-2); }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ink) 5%, transparent), transparent);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.state-error {
  border: 1px solid color-mix(in srgb, var(--down) 28%, var(--line));
  border-left: 3px solid var(--down);
  background: color-mix(in srgb, var(--down) 7%, var(--bg1));
  border-radius: var(--r-2); padding: 11px 13px; font-size: 12.5px;
}

/* ── Tiles (home.html.tmpl) ──────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--bg1); border: 1px solid var(--line); border-radius: var(--r-3); padding: 14px 16px; }
.tile b { font-family: var(--font-mono); font-size: 28px; display: block; margin-top: 4px; }
.tile-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }

/* ── Color aliases (detail + analytics pages) ────────────────── */
.color-ok { color: var(--up); }
.color-warn { color: var(--late); }
.color-down { color: var(--down); }

/* ── Auth pages ──────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg0); padding: 24px; }
.auth-box { width: 100%; max-width: 420px; background: var(--bg1); border: 1px solid var(--line); border-radius: var(--r-3); padding: 32px; }
.auth-box .brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-mono); font-weight: 700; font-size: 16px; margin-bottom: 24px; color: var(--ink); }
.auth-title { margin: 0 0 20px; font-size: 22px; font-weight: 700; color: var(--ink); }
.auth-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; margin-top: 14px; }
.auth-form input[type="email"], .auth-form input[type="password"] {
  width: 100%; background: var(--bg0); border: 1px solid var(--line); border-radius: var(--r-2);
  padding: 9px 12px; color: var(--ink); font: inherit; outline: none;
}
.auth-form input[type="email"]:focus-visible, .auth-form input[type="password"]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.auth-form .btn-primary { width: 100%; margin-top: 18px; }
.btn-github {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; background: var(--bg1); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-2);
  padding: 10px 14px; font: inherit; font-size: 14px;
  cursor: pointer; text-decoration: none; margin-bottom: 16px;
}
.btn-github:hover { background: var(--bg2); }
.auth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0; color: var(--muted); font-size: 13px;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-footer { font-size: 13px; color: var(--muted); margin: 14px 0 0; text-align: center; }
.auth-error { color: var(--down); font-size: 13px; margin: 0 0 14px; }
.auth-sub { text-align: center; color: var(--ink-2); font-size: 13px; margin: 0 0 20px; }
.auth-footer-quiet { text-align: center; color: var(--ink-3); font-size: 12px; margin: 20px 0 0; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
details.adv > summary { font-size: 13px; color: var(--ink-2); cursor: pointer; list-style: none; padding: 2px 0; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::before { content: "▸ "; }
details.adv[open] > summary::before { content: "▾ "; }

/* ── Monitor detail ──────────────────────────────────────────── */
.detail-back { color: var(--muted); font-size: 13px; font-family: var(--mono); display: inline-block; margin-bottom: 12px; }
.detail-back:hover { color: var(--ink); }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 18px; }
.detail-head-left { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; }
.detail-head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.detail-name { font-size: 22px; font-weight: 600; font-family: var(--mono); color: var(--ink); }
.detail-paused-label { font-size: 12px; color: var(--muted); font-family: var(--mono); }

/* Copy field */
.copy-field { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 14px; }
.copy-field-url {
  flex: 1; font-family: var(--mono); font-size: 13px; color: var(--ink);
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-2);
  padding: 8px 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.copy-field-btn { flex-shrink: 0; font-size: 13px; padding: 8px 12px; }

/* KV panel */
.kv-panel {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  margin-bottom: 14px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); flex-wrap: wrap;
}
.kv-panel-badge { color: var(--accent); text-transform: uppercase; letter-spacing: .05em; font-size: 11px; font-weight: 600; }
.kv-panel-value { color: var(--ink); }
.kv-panel-muted { color: var(--muted); }
.kv-panel-code { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-1); padding: 3px 7px; font-size: 12px; color: var(--ink); }

/* Destination chips */
.dest-chips { display: flex; gap: 8px; flex-wrap: wrap; font-family: var(--mono); font-size: 12.5px; }
.dest-chip { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-2); padding: 7px 11px; color: var(--ink); }
.dest-chip-events { color: var(--muted); }
.chip-events { font-size: 10.5px; color: var(--ink-3); margin-left: 4px; }

/* Alerts grid */
.alerts-grid-header {
  display: grid; grid-template-columns: .9fr 1.3fr 2fr 1fr; gap: 8px;
  padding: 0 4px 8px; color: var(--muted); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--line);
}
.alerts-grid-row {
  display: grid; grid-template-columns: .9fr 1.3fr 2fr 1fr; gap: 8px;
  padding: 10px 4px; border-bottom: 1px solid var(--line); align-items: center;
}

/* ── Routing matrix ───────────────────────────────────────────── */
.route-matrix-panel {}
.route-matrix-scroll { overflow-x: auto; }
.route-matrix-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12.8px; }
.route-matrix-table th {
  padding: 7px 10px; text-align: center; font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.route-matrix-dest-col { text-align: left !important; min-width: 180px; }
.route-matrix-event-col { width: 80px; }
.route-matrix-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.route-matrix-cb-cell { text-align: center; }
.route-matrix-cb-cell input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.route-matrix-cb-cell input[type=checkbox]:disabled { opacity: .35; cursor: not-allowed; }
.route-matrix-row:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.route-matrix-row-disabled .route-matrix-name { color: var(--muted); }
.route-matrix-dest-cell { text-align: left; }
.route-matrix-name { color: var(--ink); }
.route-matrix-kind { margin-left: 8px; color: var(--muted); font-size: 11.5px; }
.route-matrix-hint {
  display: block; font-size: 10.5px; color: var(--muted);
  font-family: var(--sans); font-weight: 400; text-transform: none;
  letter-spacing: 0; margin-top: 2px; white-space: nowrap;
}
.route-matrix-badge { font-size: 10px; padding: 2px 5px; margin-left: 8px; vertical-align: middle; }
.route-matrix-badge-unverified { background: rgba(242,181,68,.12); color: var(--warn); border: 1px solid var(--warn); }

/* ── Alert-message template editor ───────────────────────────── */
.tmpl-palette { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.tmpl-chip {
  background: var(--bg2); color: var(--muted);
  border: 1px solid var(--line); border-radius: var(--r-1);
  padding: 3px 7px; font-family: var(--mono); font-size: 11.5px; cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
}
.tmpl-chip:hover { border-color: var(--accent); color: var(--accent); }
.tmpl-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tmpl-editor { margin-bottom: 16px; }
.tmpl-editor-hd { margin-bottom: 5px; }
.tmpl-editor-label { font-size: 12.5px; min-width: 80px; }
.tmpl-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
.tmpl-preview { min-height: 36px; white-space: pre-wrap; word-break: break-all; }
.tmpl-reset-btn { font-size: 11.5px; padding: 3px 8px; }

/* ── ECG logo (kept for backward compat) ─────────────────────── */
/* .lp-logo/.lp-ecg/.lp-word already defined above */

/* ── HTTP monitor UI ─────────────────────────────────────────── */
.monitor-type-http { font-size: 11px; color: var(--accent); margin-right: 4px; vertical-align: middle; opacity: .8; }
.latency-ms { color: var(--ink); font-family: var(--mono); }
.rt-chart { display: flex; align-items: flex-end; gap: 3px; height: 68px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.rt-bar { width: 6px; min-height: 4px; border-radius: 2px 2px 0 0; transition: opacity var(--t-fast); }
.rt-bar-up { background: var(--up); }
.rt-bar-down { background: var(--down); }
.rt-bar:hover { opacity: .7; }

/* ── Error page ──────────────────────────────────────────────── */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg0); padding: 24px; }
.error-card { text-align: center; max-width: 400px; }
.error-logo { margin-bottom: 28px; display: flex; justify-content: center; }
.error-code { font-family: var(--mono); font-size: 80px; font-weight: 700; color: var(--down); line-height: 1; margin-bottom: 12px; }
.error-title { font-size: 22px; font-weight: 700; color: var(--ink); margin: 0 0 10px; }
.error-msg { color: var(--muted); font-size: 15px; margin: 0 0 28px; }
.error-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── Layout helpers ──────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-main-rail { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 12px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.mt-5 { margin-top: 5px; } .mt-14 { margin-top: 14px; }
.mb-14 { margin-bottom: 14px; } .mb-18 { margin-bottom: 18px; }
.rail { display: flex; flex-direction: column; gap: 14px; }

/* Settings / status-page layout classes */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.panel.full { grid-column: 1 / -1; }
.profile-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 0; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; }
.stat-grid .stat { background: var(--bg1); }
/* Status page builder grid */
.sp-grid { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.sp-vis-row { display: flex; gap: 8px; margin-bottom: 14px; }
.sp-vis-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-2); font: 500 12.5px var(--font-ui); cursor: pointer; color: var(--ink-2); background: var(--bg2); }
.sp-vis-btn.active { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg2)); }
.sp-field { margin-bottom: 12px; }
.sp-field-label { display: block; margin-bottom: 4px; font: 500 10.5px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.sp-input { width: 100%; height: 28px; padding: 0 9px; background: var(--bg2); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-2); font: 400 12.5px var(--font-ui); }
.sp-input-mono { font-family: var(--font-mono); }
.sp-input:focus { outline: none; border-color: var(--accent); }
.sp-check-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.sp-checks { display: flex; flex-direction: column; }
/* Type-picker: segmented-control style (check_new / check_edit) */
.type-picker {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  overflow: hidden;
  background: var(--bg1);
  gap: 0;
}
.type-picker input[type=radio] {
  /* Visually hidden but accessible — keeps keyboard and screen-reader behaviour */
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
  overflow: hidden;
  outline: none;
}
.type-picker label {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-right: 1px solid var(--line);
  color: var(--ink-2);
  font: 500 12.5px var(--font-ui);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.type-picker label:last-of-type { border-right: 0; }
.type-picker input[type=radio]:checked + label {
  background: var(--bg3);
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.type-picker input[type=radio]:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.new-check-grid { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 14px; }
.adv { margin-top: 14px; }
.adv-sep { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink-2); font-size: 12.5px; margin-bottom: 8px; }
/* sec-label (admin views) */
.sec-label { font: 600 11px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 16px 0 6px; }
.sec-label .sub { font-weight: 400; color: var(--dim); }
/* pings-incidents grid */
.pings-incidents-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
/* Admin panels */
.admin-badge { display: inline-flex; align-items: center; height: 16px; padding: 0 6px; background: color-mix(in srgb, var(--info) 12%, transparent); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); border-radius: var(--r-4); font: 600 9.5px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--info); }
/* lp-flash-data (JS flash data attribute host) */
.lp-flash-data { display: none; }
/* dot used in admin feeds */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
/* actions — generic flex row for action buttons (channels.html.tmpl) */
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
/* audit — panel modifier used in admin_overview panels */
.panel.audit { padding: 14px 16px; }
/* out — admin nav exit link */
.out { font-size: 12.5px; color: var(--ink-2); }
.out a { color: var(--ink-2); }
.out a:hover { color: var(--ink); }
/* rail-card — sidebar helper cards in check_new / check_edit / status_pages */
.rail-card { background: var(--bg1); border: 1px solid var(--line); border-radius: var(--r-3); padding: 12px 14px; margin-bottom: 10px; font-size: 12.5px; color: var(--ink-2); }
.rail-card-label { font: 600 10.5px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 6px; }
/* ── Schedule preview widget (check_new / check_edit rail) ──────── */
.sched-preview { background: var(--bg1); border: 1px solid var(--line); border-radius: var(--r-3); padding: 12px 14px; margin-bottom: 10px; font-size: 12.5px; color: var(--ink-2); min-height: 48px; }
.sched-preview-summary { font: 600 11px var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--amber); margin-bottom: 6px; }
.sched-preview-times { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.sched-preview-times li { font: 400 11.5px var(--font-mono); color: var(--ink); }
.sched-preview-times li:first-child { color: var(--up); }
.sched-preview-error { font-size: 11.5px; color: var(--ink-3); font-style: italic; }
@media (prefers-reduced-motion: reduce) { .sched-preview { transition: none; } }
/* wrap — admin layout main content wrapper */
.wrap { flex: 1; padding: 20px 24px; max-width: 1100px; margin: 0 auto; }

/* ── First run: listening for the first heartbeat (signature) ──── */
.firstrun {
  display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center;
  padding: 22px 24px; margin-bottom: 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--panel)) 0%, var(--panel) 62%);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--r-3);
}
.firstrun-ecg { width: 128px; height: 60px; flex: 0 0 auto; }
.firstrun-ecg svg { width: 100%; height: 100%; display: block; }
.firstrun-ecg .trace { stroke: var(--line-2); stroke-width: 2; fill: none; }
.firstrun-ecg .scan  { stroke: var(--accent); stroke-width: 2; fill: none; stroke-linecap: round; stroke-dasharray: 10 210; animation: firstrun-scan 1.8s linear infinite; }
@keyframes firstrun-scan { from { stroke-dashoffset: 220; } to { stroke-dashoffset: 0; } }
.firstrun-body { min-width: 0; }
.firstrun-eyebrow {
  font: 600 10.5px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); display: inline-flex; align-items: center; gap: 8px;
}
.firstrun-eyebrow::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
  animation: firstrun-blip 1.8s ease-out infinite;
}
@keyframes firstrun-blip {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.firstrun-title { font: 650 17px/1.25 var(--font-ui); margin: 9px 0 5px; color: var(--ink); }
.firstrun-sub { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin: 0 0 13px; max-width: 62ch; }
.firstrun-copy { max-width: 540px; }
.firstrun-hint { color: var(--dim); font-size: 12px; margin: 11px 0 0; }
/* received — the first heartbeat lands */
.firstrun-live {
  border-left-color: var(--up);
  background: linear-gradient(180deg, color-mix(in srgb, var(--up) 9%, var(--panel)) 0%, var(--panel) 62%);
}
.firstrun-live .firstrun-eyebrow { color: var(--up); }
.firstrun-live .firstrun-eyebrow::before { background: var(--up); animation: none; box-shadow: none; }
.firstrun-ecg-live .beat { stroke: var(--up); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 70 320; animation: firstrun-spike 1s cubic-bezier(.2,.8,.2,1) both; }
@keyframes firstrun-spike { from { stroke-dashoffset: 390; } to { stroke-dashoffset: 0; } }
@media (max-width: 720px) { .firstrun { grid-template-columns: 1fr; gap: 14px; } .firstrun-ecg { width: 108px; } }

/* ── Onboarding hero (zero monitors, first-time state) ─────────── */
.ob-hero {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, var(--panel)) 0%, var(--panel) 70%);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--r-3); padding: 22px 24px;
}
.ob-hero-head {
  display: flex; align-items: flex-start; gap: 20px; margin-bottom: 20px;
}
.ob-ecg { width: 120px; height: 56px; flex: 0 0 120px; }
.ob-ecg svg { width: 100%; height: 100%; display: block; }
.ob-ecg .trace { stroke: var(--line-2); stroke-width: 2; fill: none; }
.ob-ecg .scan  { stroke: var(--accent); stroke-width: 2; fill: none; stroke-linecap: round; stroke-dasharray: 10 210; animation: firstrun-scan 1.8s linear infinite; }
.ob-hero-body { flex: 1; min-width: 0; }
.ob-headline { font: 650 18px/1.3 var(--font-ui); margin: 9px 0 6px; color: var(--ink); }
.ob-lede { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin: 0; max-width: 68ch; }
.ob-dismiss { flex: 0 0 auto; align-self: flex-start; }
.ob-paths { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ob-path-lede { color: var(--ink-2); font-size: 13px; line-height: 1.6; margin: 0 0 2px; }
.ob-path-hint { font-size: 11.5px; color: var(--dim); margin: 8px 0 0; }
.ob-path-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ob-ol { margin: 0; padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 9px; }
.ob-ol li { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.ob-ol li b { color: var(--ink); }
@media (max-width: 900px) {
  .ob-hero-head { flex-wrap: wrap; }
  .ob-ecg { display: none; }
  .ob-paths { grid-template-columns: 1fr; }
}

/* ── Motion discipline ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .lp-ecg .beat { stroke-dashoffset: 0; }
  .skeleton::after { background: color-mix(in srgb, var(--ink) 4%, transparent); }
  /* keep the first-run graphics legible without motion */
  .firstrun-ecg .scan { stroke-dasharray: none; }
  .firstrun-ecg-live .beat { stroke-dasharray: none; stroke-dashoffset: 0; }
  .ob-ecg .scan { stroke-dasharray: none; }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-2, .grid-main-rail { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .sp-grid { grid-template-columns: 1fr; }
  .new-check-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .side {
    position: fixed; left: -260px; top: 0; bottom: 0;
    transition: left var(--t-med); z-index: 20;
    width: 214px !important; flex: 0 0 214px !important;
  }
  .side.open { left: 0; }
  .side.open .lbl { display: inline !important; }
  .side.open .grp { display: block !important; }
  .side-collapse { display: none; }
  .drawer-toggle { display: inline-flex; }
  .cmdk { min-width: 0; }
  .main { padding: 14px; }
  .stat-strip { flex-wrap: wrap; }
  .stat { min-width: 33%; border-bottom: 1px solid var(--line); }
  .tiles { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 8px 14px; }
  .topbar-center { display: none; }
  .table thead { display: none; }
  .table tr { display: block; border: 1px solid var(--line); border-radius: var(--r-2); margin-bottom: 9px; padding: 6px 4px; }
  .table td { display: flex; justify-content: space-between; border: 0; padding: 6px 12px; }
  .pings-incidents-grid { grid-template-columns: 1fr !important; }
  .alerts-grid-header { display: none !important; }
  .alerts-grid-row { grid-template-columns: 1fr 1fr !important; }
}
