/* ============================================================================
   awesome_solver — shared design system  ·  "Modern dark console"
   Linear/Vercel × Grafana  ·  near-black + cyan accent
   Fira Sans (UI) + Fira Code (data/mono)
   Used by every page in templates/ via <link rel="stylesheet" href="/static/app.css">
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Fira+Sans:wght@300;400;500;600;700&display=swap');

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
  /* surfaces */
  --bg:          #0a0b0f;
  --bg-2:        #0d0f14;
  --surface:     #111318;
  --surface-2:   #15181f;
  --surface-3:   #1b1f28;
  --elevated:    #1e2330;

  /* lines */
  --line:        rgba(255, 255, 255, 0.07);
  --line-2:      rgba(255, 255, 255, 0.12);
  --line-3:      rgba(255, 255, 255, 0.18);

  /* text */
  --text:        #e6eaf2;
  --text-dim:    #c2c9d6;
  --muted:       #8a93a6;
  --faint:       #5c6478;

  /* brand / accent */
  --accent:      #22d3ee;   /* cyan */
  --accent-2:    #38bdf8;   /* sky  */
  --accent-soft: rgba(34, 211, 238, 0.12);
  --accent-line: rgba(34, 211, 238, 0.40);
  --indigo:      #6366f1;
  --violet:      #a78bfa;

  /* semantic */
  --success:     #34d399;
  --success-soft:rgba(52, 211, 153, 0.13);
  --warn:        #fbbf24;
  --warn-soft:   rgba(251, 191, 36, 0.13);
  --danger:      #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.13);
  --danger-line: rgba(251, 113, 133, 0.40);

  /* radii */
  --r-xs: 6px;
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* shadow / glow */
  --shadow:      0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg:   0 18px 50px rgba(0, 0, 0, 0.55);
  --glow-accent: 0 0 0 1px var(--accent-line), 0 0 22px rgba(34, 211, 238, 0.16);

  /* type */
  --font-ui:   'Fira Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Fira Code', ui-monospace, 'SFMono-Regular', 'Cascadia Code', Menlo, monospace;

  /* layout */
  --maxw: 1500px;
  --gap:  14px;

  /* z-index scale */
  --z-sticky: 20;
  --z-toast:  1000;
}

/* ── Reset / base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[x-cloak] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 88% -10%, rgba(34, 211, 238, 0.10), transparent 60%),
    radial-gradient(1000px 500px at -10% 110%, rgba(99, 102, 241, 0.08), transparent 55%),
    linear-gradient(180deg, var(--bg), #07080b);
  background-attachment: fixed;
  padding: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--line-3); background-clip: padding-box; }

/* selection */
::selection { background: rgba(34, 211, 238, 0.28); color: #fff; }

/* focus visibility (a11y) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  gap: var(--gap);
}
.wrap.narrow { max-width: 1100px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
.grid { display: grid; gap: var(--gap); }

/* ── Icons (SVG sprite injected by app.js) ───────────────────────────────── */
.icon {
  width: 16px; height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.18em;
}
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 26px; height: 26px; }

/* ── Panels ──────────────────────────────────────────────────────────────── */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)) ,
    var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.72rem;
  font-weight: 700;
}
.panel-head .icon { color: var(--accent); }
.panel-head .spacer ~ * { text-transform: none; letter-spacing: normal; }
.panel-body { padding: 16px; }
.panel-body.tight { padding: 12px; }

/* ── App bar / header ────────────────────────────────────────────────────── */
.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
    var(--surface);
  box-shadow: var(--shadow);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: var(--text);
}
.brand .logo {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  box-shadow: var(--glow-accent);
}
.brand .brand-name { color: var(--text); }
.brand .brand-name b { color: var(--accent); font-weight: 700; }
.brand .brand-sub {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.appbar-actions { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; }

/* nav cluster */
.nav { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }

/* ── Connection / live status ────────────────────────────────────────────── */
.status {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.2);
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.dot.live { background: var(--success); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); animation: pulse 1.3s infinite; }
.dot.reconnecting { background: var(--warn); box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.16); }
.dot.offline { background: var(--danger); box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.16); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  padding: 8px 12px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn .icon { color: var(--muted); transition: color 0.15s; }
.btn:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.btn:hover .icon { color: var(--accent); }
.btn:active { transform: translateY(0.5px); }
.btn[disabled], .btn:disabled { opacity: 0.42; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.btn-primary .icon { color: var(--accent); }
.btn-primary:hover { background: rgba(34, 211, 238, 0.2); box-shadow: var(--glow-accent); color: #aef4ff; }

.btn-danger { border-color: var(--danger-line); color: var(--danger); }
.btn-danger .icon { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: var(--danger-soft); color: #ffb4c1; }
.btn-danger:hover .icon { color: var(--danger); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { border-color: var(--line-2); background: rgba(255, 255, 255, 0.03); color: var(--text); }

.btn-sm { padding: 6px 9px; font-size: 0.75rem; }
.btn-icon { padding: 8px; }
.btn-block { width: 100%; justify-content: center; }

/* compact inline action (tables) */
.act {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--muted);
  padding: 5px 8px;
  font-size: 0.72rem;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: 0.14s;
}
.act .icon { width: 13px; height: 13px; }
.act:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.act.del:hover { border-color: var(--danger-line); color: var(--danger); background: var(--danger-soft); }

/* ── Metric / stat cards ─────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.stat-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.018);
  padding: 12px 14px;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.stat-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), transparent);
  opacity: 0.55;
}
.stat-card:hover { border-color: var(--line-2); background: rgba(255, 255, 255, 0.03); }
.stat-card .lbl {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.stat-card .lbl .icon { width: 13px; height: 13px; color: var(--faint); }
.stat-card .val {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: #f3f7ff;
  letter-spacing: -0.01em;
}

/* ── Detail metric grid (proxy / latency / runtime) ──────────────────────── */
/* auto-fit, not a hardcoded column count: removing one card used to leave a
   dead column and stretch the survivors into a ragged row. */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  align-items: stretch;
}
.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.18);
  padding: 12px;
  display: flex;
  flex-direction: column;
}
/* Detail rows sit at the bottom, so cards with a different number of rows still
   line up along the card edge instead of floating at different heights. */
.metric-card__rows { margin-top: auto; }

/* ── Metric hero: the one number that answers the card's question ─────────── */
.metric-hero {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.metric-hero__value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.01em;
}
.metric-hero__unit { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.metric-hero__value--ok   { color: var(--success); }
.metric-hero__value--warn { color: var(--warn); }
.metric-hero__value--bad  { color: var(--danger); }
.metric-hero__caption {
  font-size: 0.68rem;
  color: var(--faint);
  margin-bottom: 10px;
  line-height: 1.3;
}

/* ── Ratio bar ───────────────────────────────────────────────────────────── */
.metric-bar {
  display: flex;
  height: 6px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 10px;
}
.metric-bar__seg { height: 100%; transition: width 0.35s ease-out; min-width: 0; }
.metric-bar__seg--ok       { background: var(--success); }
.metric-bar__seg--bad      { background: var(--danger); }
.metric-bar__seg--accent   { background: var(--accent); }
.metric-bar__seg--warn     { background: var(--warn); }
.metric-bar__seg--muted    { background: var(--line-3); }
@media (prefers-reduced-motion: reduce) {
  .metric-bar__seg { transition: none; }
}

/* Legend under a bar — the bar never carries meaning by colour alone. */
.metric-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 10px;
  font-size: 0.68rem;
  color: var(--muted);
}
.metric-legend__item { display: inline-flex; align-items: center; gap: 5px; }
.metric-legend__dot {
  width: 7px; height: 7px; border-radius: 2px; flex: none;
}
.metric-legend__num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.metric-card .metric-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
}
.metric-card .metric-title .icon { width: 14px; height: 14px; color: var(--accent); }
.metric-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 6px 8px;
  border-radius: var(--r-xs);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: border-color 0.18s, background 0.18s;
}
.metric-row + .metric-row { margin-top: 6px; }
.metric-row:hover { border-color: var(--line-2); background: rgba(0, 0, 0, 0.3); }
.metric-row__ico { display: grid; place-items: center; color: var(--faint); }
.metric-row__ico .icon { width: 15px; height: 15px; }
.metric-row__text { min-width: 0; }
.metric-row__title {
  font-size: 0.69rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted); line-height: 1.2;
}
.metric-row__hint {
  font-size: 0.68rem; color: var(--faint); margin-top: 2px; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.metric-row__value {
  font-family: var(--font-mono); font-size: 0.92rem; font-weight: 600;
  /* tabular figures: without them a changing counter reflows its own column */
  font-variant-numeric: tabular-nums;
  text-align: right; white-space: nowrap; color: var(--text);
}
.metric-row__value--ok   { color: var(--success); }
.metric-row__value--warn { color: var(--warn); }
.metric-row__value--bad  { color: var(--danger); }

/* generic icon tints */
.t-ok   { color: var(--success); }
.t-warn { color: var(--warn); }
.t-bad  { color: var(--danger); }
.t-accent { color: var(--accent); }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: auto;
  background: rgba(0, 0, 0, 0.15);
}
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 9px 11px;
  font-size: 0.78rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: middle;
  text-align: left;
}
th {
  position: sticky; top: 0; z-index: var(--z-sticky);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.68rem;
}
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
tbody tr.selected { background: var(--accent-soft); }
tbody tr.expandable { cursor: pointer; }
tbody tr.expanded { background: rgba(34, 211, 238, 0.07); }
td.num, th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.empty-cell { text-align: center; color: var(--muted); padding: 22px; }

input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* chevron for expandable rows */
.chevron {
  display: inline-flex;
  color: var(--faint);
  transition: transform 0.16s, color 0.16s;
  vertical-align: -0.15em;
}
.chevron.open { transform: rotate(90deg); color: var(--accent); }

/* ── Badges / status ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  padding: 3px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  white-space: nowrap;
}
.st-queued     { color: #ffe2a3; border-color: var(--warn-soft); background: var(--warn-soft); }
.st-solving    { color: #aef0ff; border-color: var(--accent-line); background: var(--accent-soft); animation: pulse 1.4s infinite; }
.st-solved     { color: #b9ffdd; border-color: var(--success-soft); background: var(--success-soft); }
.st-not_solved { color: #ffb4c1; border-color: var(--danger-soft); background: var(--danger-soft); }
.st-expired    { color: var(--muted); border-color: var(--line-2); background: rgba(255, 255, 255, 0.05); }

/* generic semantic badge variants */
.badge-ok   { color: #b9ffdd; border-color: var(--success-soft); background: var(--success-soft); }
.badge-warn { color: #ffe2a3; border-color: var(--warn-soft); background: var(--warn-soft); }
.badge-bad  { color: #ffb4c1; border-color: var(--danger-soft); background: var(--danger-soft); }
.badge-info { color: #aef0ff; border-color: var(--accent-line); background: var(--accent-soft); }
.badge-muted{ color: var(--muted); border-color: var(--line-2); background: rgba(255, 255, 255, 0.04); }

/* pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.72rem;
  padding: 3px 9px;
}
.pill.mono { font-family: var(--font-mono); }

/* flag squares */
.flags { display: inline-flex; gap: 4px; }
.flag {
  width: 21px; height: 21px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.66rem; font-weight: 700;
  color: var(--faint);
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--font-mono);
}
.flag.on { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

/* ── Chips (filters) ─────────────────────────────────────────────────────── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  cursor: pointer;
  padding: 6px 12px;
  font-size: 0.76rem;
  user-select: none;
  transition: 0.14s;
}
.chip:hover { border-color: var(--line-2); color: var(--text-dim); }
.chip.active { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.chip b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }
.chip.active b { color: var(--accent); }

/* ── Toolbar / inputs ────────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.input, .select, textarea.input {
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  padding: 8px 11px;
  min-width: 130px;
  font-size: 0.8rem;
  font-family: var(--font-ui);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input.mono { font-family: var(--font-mono); }
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus, textarea.input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}
textarea.input { resize: vertical; line-height: 1.5; }

.field { display: grid; gap: 7px; }
.field > label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  font-weight: 700;
}

/* search input with leading icon */
.search {
  position: relative; display: inline-flex; align-items: center;
}
.search .icon { position: absolute; left: 10px; color: var(--faint); pointer-events: none; }
.search .input { padding-left: 32px; }

/* live auto-refresh badge */
.auto-badge {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--success-soft);
  border-radius: var(--r-pill);
  background: var(--success-soft);
  color: var(--success);
  padding: 5px 11px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
}
.auto-badge.paused { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }

/* ── Legend ──────────────────────────────────────────────────────────────── */
.legend {
  margin-top: 12px; display: flex; gap: 18px; flex-wrap: wrap;
  font-size: 0.78rem; color: var(--muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-line { width: 16px; height: 3px; border-radius: 99px; display: inline-block; }

/* ── JSON viewer ─────────────────────────────────────────────────────────── */
.json-box {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.015);
}
.json-head {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  padding: 7px 11px;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.json {
  margin: 0; padding: 11px;
  max-height: 300px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.json.empty { color: var(--muted); font-style: italic; }
.j-key { color: var(--violet); }
.j-str { color: var(--success); }
.j-num { color: #ffb787; }
.j-bool { color: var(--accent); }
.j-null { color: var(--muted); }

/* copyable inline value */
.copyable { cursor: pointer; border-bottom: 1px dashed transparent; transition: 0.12s; }
.copyable:hover { color: var(--accent); border-bottom-color: var(--accent-line); }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
  display: flex; gap: 5px; align-items: center; justify-content: center;
  padding: 14px 0 2px; flex-wrap: wrap;
}
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; padding: 6px 10px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 0.8rem; cursor: pointer; transition: 0.14s;
}
.page-btn .icon { width: 14px; height: 14px; }
.page-btn:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.page-btn.active { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.page-btn[disabled] { opacity: 0.3; cursor: not-allowed; pointer-events: none; }
.page-info { color: var(--muted); font-size: 0.78rem; margin-left: 4px; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: var(--z-toast);
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  background: var(--elevated);
  color: var(--text);
  font-size: 0.8rem;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast .icon { color: var(--accent); }

/* ── Empty / loading states ──────────────────────────────────────────────── */
.empty-state {
  display: grid; place-items: center; gap: 10px;
  padding: 40px 20px; text-align: center; color: var(--muted);
}
.empty-state .icon { width: 30px; height: 30px; color: var(--faint); }
.loading { color: var(--muted); font-family: var(--font-mono); font-size: 0.8rem; }

/* ── Auth / login card ───────────────────────────────────────────────────── */
.auth-shell { min-height: 100dvh; display: grid; place-items: center; }
.auth-card {
  width: min(400px, 92vw);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
    var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 30px 26px 24px;
}

/* ── Chart tooltip (uPlot) ───────────────────────────────────────────────── */
.chart-host { position: relative; height: 240px; }
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 20;
  min-width: 210px; max-width: 270px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: rgba(10, 11, 15, 0.97);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  padding: 10px 11px;
  font-size: 0.74rem; line-height: 1.4;
  opacity: 0; transform: translate(10px, 10px);
  transition: opacity 0.1s ease;
}
.chart-tooltip.show { opacity: 1; }
.chart-tooltip .tt-title { color: var(--text); font-weight: 700; margin-bottom: 7px; }
.chart-tooltip .tt-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.chart-tooltip .tt-row + .tt-row { margin-top: 3px; }
.chart-tooltip .tt-row b { color: var(--text); font-family: var(--font-mono); }
.chart-tooltip .tt-divider { height: 1px; background: var(--line); margin: 7px 0; }

/* hide uPlot's own legend (we use custom tooltip) */
.u-legend { display: none; }

/* ── Reduced motion ──────────────────────────────────────────────────────── */
/* Honor reduced-motion for decorative *transitions* only. Functional keyframe
   animations (loading spinners, the "live" / "solving" pulse) convey state and
   must keep running — many Windows/RDP setups report reduced-motion by default,
   which would otherwise freeze every spinner into a static circle. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  body { padding: 10px; }
  .metric-grid { grid-template-columns: 1fr; }
  .appbar { padding: 12px; }
  .brand { font-size: 0.98rem; }
  .toolbar .spacer { display: none; }
}
