/* ==========================================================================
   Pyjan race control
   A timing-wall design system: condensed display type, monospaced data,
   signal colours borrowed from the flags, elevation by lightness rather
   than by hairline borders. Light and dark from the same tokens.
   ========================================================================== */

@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap;
  src: url("fonts/barlow-400.81419bf5abb5.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap;
  src: url("fonts/barlow-500.8e986e86d57e.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap;
  src: url("fonts/barlow-600.a1e2a2d7d4c0.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap;
  src: url("fonts/barlow-700.15481e4eab6d.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap;
  src: url("fonts/barlow-condensed-500.24f826a7cf9c.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap;
  src: url("fonts/barlow-condensed-600.ba4513495282.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap;
  src: url("fonts/barlow-condensed-700.e1180918b873.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap;
  src: url("fonts/jetbrains-mono-400.caf0dfde4e44.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap;
  src: url("fonts/jetbrains-mono-500.a21e038a03f7.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-display: swap;
  src: url("fonts/jetbrains-mono-700.69002db50656.woff2") format("woff2"); }

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light dark;
  --font-ui: "Barlow", "Segoe UI", system-ui, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "Barlow", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --r: 4px;
  --r-lg: 8px;
  --rail-w: 228px;
  --rail-c: 64px;
  --top-h: 52px;
  --gap: 16px;

  /* light: warm paper */
  --bg: oklch(95.5% 0.008 85);
  --bg-2: oklch(93% 0.01 85);
  --surface: oklch(99.2% 0.003 85);
  --surface-2: oklch(97% 0.006 85);
  --inset: oklch(94.5% 0.008 85);
  --line: oklch(87% 0.012 80);
  --line-2: oklch(79% 0.014 80);
  --text: oklch(21% 0.012 70);
  --text-2: oklch(36% 0.014 70);
  --muted: oklch(50% 0.016 70);
  --faint: oklch(66% 0.014 75);

  --accent: oklch(83% 0.175 88);
  --accent-hover: oklch(79% 0.18 86);
  --accent-ink: oklch(19% 0.03 80);

  --green: oklch(58% 0.17 150);
  --green-bg: oklch(93% 0.06 150);
  --yellow: oklch(70% 0.16 85);
  --yellow-bg: oklch(95% 0.08 90);
  --red: oklch(55% 0.2 25);
  --red-bg: oklch(94% 0.05 25);
  --purple: oklch(55% 0.2 305);
  --purple-bg: oklch(94% 0.05 305);
  --blue: oklch(56% 0.15 245);
  --blue-bg: oklch(94% 0.04 245);

  --shadow: 0 1px 2px oklch(0% 0 0 / .05), 0 6px 20px oklch(0% 0 0 / .05);
  --shadow-pop: 0 10px 30px oklch(0% 0 0 / .18);
  --rail-bg: oklch(19% 0.01 70);
  --rail-text: oklch(84% 0.012 80);
  --rail-muted: oklch(60% 0.014 75);
  --rail-line: oklch(26% 0.01 70);
}

[data-theme="dark"] {
  --bg: oklch(16.5% 0.006 70);
  --bg-2: oklch(14.5% 0.006 70);
  --surface: oklch(21% 0.007 70);
  --surface-2: oklch(24.5% 0.008 70);
  --inset: oklch(13.5% 0.006 70);
  --line: oklch(28% 0.008 70);
  --line-2: oklch(35% 0.01 70);
  --text: oklch(92% 0.012 85);
  --text-2: oklch(80% 0.014 80);
  --muted: oklch(66% 0.016 78);
  --faint: oklch(49% 0.014 75);
  --accent: oklch(85% 0.17 92);
  --accent-hover: oklch(89% 0.16 94);
  --accent-ink: oklch(16% 0.03 85);
  --green: oklch(76% 0.17 152);  --green-bg: oklch(30% 0.06 152);
  --yellow: oklch(84% 0.16 90);  --yellow-bg: oklch(32% 0.07 90);
  --red: oklch(70% 0.19 27);     --red-bg: oklch(31% 0.08 27);
  --purple: oklch(76% 0.17 305); --purple-bg: oklch(33% 0.08 305);
  --blue: oklch(75% 0.13 245);   --blue-bg: oklch(31% 0.06 245);
  --shadow: inset 0 1px 0 oklch(100% 0 0 / .035), 0 6px 20px oklch(0% 0 0 / .35);
  --shadow-pop: 0 14px 40px oklch(0% 0 0 / .6);
  --rail-bg: oklch(12.5% 0.006 70);
  --rail-text: oklch(86% 0.012 80);
  --rail-muted: oklch(58% 0.014 75);
  --rail-line: oklch(20% 0.008 70);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: oklch(16.5% 0.006 70);
    --bg-2: oklch(14.5% 0.006 70);
    --surface: oklch(21% 0.007 70);
    --surface-2: oklch(24.5% 0.008 70);
    --inset: oklch(13.5% 0.006 70);
    --line: oklch(28% 0.008 70);
    --line-2: oklch(35% 0.01 70);
    --text: oklch(92% 0.012 85);
    --text-2: oklch(80% 0.014 80);
    --muted: oklch(66% 0.016 78);
    --faint: oklch(49% 0.014 75);
    --accent: oklch(85% 0.17 92);
    --accent-hover: oklch(89% 0.16 94);
    --accent-ink: oklch(16% 0.03 85);
    --green: oklch(76% 0.17 152);  --green-bg: oklch(30% 0.06 152);
    --yellow: oklch(84% 0.16 90);  --yellow-bg: oklch(32% 0.07 90);
    --red: oklch(70% 0.19 27);     --red-bg: oklch(31% 0.08 27);
    --purple: oklch(76% 0.17 305); --purple-bg: oklch(33% 0.08 305);
    --blue: oklch(75% 0.13 245);   --blue-bg: oklch(31% 0.06 245);
    --shadow: inset 0 1px 0 oklch(100% 0 0 / .035), 0 6px 20px oklch(0% 0 0 / .35);
    --shadow-pop: 0 14px 40px oklch(0% 0 0 / .6);
    --rail-bg: oklch(12.5% 0.006 70);
    --rail-text: oklch(86% 0.012 80);
    --rail-muted: oklch(58% 0.014 75);
    --rail-line: oklch(20% 0.008 70);
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.45 var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--text); }
p { margin: 0 0 10px; }
code, kbd, .mono, .t { font-family: var(--font-mono); font-size: 0.92em; }
code { background: var(--inset); padding: 1px 5px; border-radius: 3px; }
strong, b { font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-family: var(--font-display); font-weight: 600; letter-spacing: 0.01em; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); }
h4 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.i { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2;
     stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.18em; flex: none; }
.i.lg { width: 1.4em; height: 1.4em; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.ok { color: var(--green); }
.warn { color: var(--red); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.t { font-variant-numeric: tabular-nums; }
.up { text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--font-display); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.hide { display: none !important; }
[x-cloak] { display: none !important; }

/* --------------------------------------------------------------------------
   Shell: rail + frame
   -------------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.app.rail-collapsed { grid-template-columns: var(--rail-c) minmax(0, 1fr); }

.rail {
  background: var(--rail-bg);
  color: var(--rail-text);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--rail-line);
  overflow: hidden;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: var(--top-h);
  border-bottom: 1px solid var(--rail-line);
  color: var(--rail-text);
}
.brand-mark {
  width: 28px; height: 28px; flex: none; border-radius: 6px;
  background: var(--accent); color: var(--accent-ink);
  font: 700 17px/28px var(--font-display); text-align: center; letter-spacing: 0;
}
.brand-name { font: 700 19px var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; }
.brand-sub { display: block; font: 500 10px var(--font-display); letter-spacing: 0.18em; text-transform: uppercase; color: var(--rail-muted); margin-top: -3px; }

.rail nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-g { margin: 6px 0 12px; }
.nav-gt { font: 600 10.5px var(--font-display); letter-spacing: 0.2em; text-transform: uppercase; color: var(--rail-muted); padding: 6px 10px 4px; }
.nav-a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r);
  color: var(--rail-text); font-weight: 500; font-size: 14.5px;
  position: relative; white-space: nowrap;
}
.nav-a .i { width: 18px; height: 18px; stroke-width: 1.9; color: var(--rail-muted); }
.rail a:hover, .brand:hover { color: #fff; }
.nav-a:hover { background: oklch(100% 0 0 / .06); color: #fff; }
.nav-a:hover .i { color: inherit; }
.nav-a.on { background: oklch(100% 0 0 / .08); color: #fff; }
.nav-a.on .i { color: var(--accent); }
.nav-a.on::before { content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 3px; background: var(--accent); border-radius: 0 2px 2px 0; }
.nav-a .badge { margin-left: auto; }

.rail-foot { border-top: 1px solid var(--rail-line); padding: 10px 8px; display: grid; gap: 4px; }
.rail-user { display: flex; align-items: center; gap: 10px; padding: 6px 10px; color: var(--rail-text); font-size: 13.5px; }
.rail-user .i { color: var(--rail-muted); }
.rail-user .role { color: var(--rail-muted); font-size: 12px; display: block; }
.rail-btn { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r); background: none; border: 0; color: var(--rail-text); font: inherit; font-size: 13.5px; cursor: pointer; width: 100%; text-align: left; }
.rail-btn:hover { background: oklch(100% 0 0 / .06); }
.rail-btn .i { color: var(--rail-muted); }

.app.rail-collapsed .brand-name, .app.rail-collapsed .brand-sub,
.app.rail-collapsed .nav-gt, .app.rail-collapsed .nav-a span,
.app.rail-collapsed .rail-user span, .app.rail-collapsed .rail-btn span { display: none; }
.app.rail-collapsed .nav-a, .app.rail-collapsed .rail-btn, .app.rail-collapsed .rail-user { justify-content: center; padding-left: 0; padding-right: 0; }
.app.rail-collapsed .brand { justify-content: center; padding: 0; }
.app.rail-collapsed .nav-g { margin-top: 0; }

.frame { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--top-h); position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px; padding: 0 22px;
  background: color-mix(in oklch, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); min-width: 0; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--faint); }
.crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-status { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.tb-stat { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tb-stat b { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text); }
.tb-clock { font-family: var(--font-mono); font-size: 12.5px; }
.tb-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: var(--r); display: inline-flex; }
.tb-btn:hover { background: var(--inset); color: var(--text); }

.page { padding: 22px 24px 60px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page.narrow { max-width: 1120px; }
.page.wide { max-width: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.eyebrow { font: 600 11.5px var(--font-display); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.lede { color: var(--muted); margin: 6px 0 0; max-width: 72ch; font-size: 14.5px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-actions form { margin: 0; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: 600 14px/1 var(--font-ui);
  padding: 9px 14px; border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; transform: none; }
.btn .i { width: 16px; height: 16px; }

.btn.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  font-family: var(--font-display); font-size: 15.5px; letter-spacing: 0.06em; text-transform: uppercase; padding: 9px 16px; }
.btn.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.btn-ghost:hover { background: var(--inset); border-color: transparent; }
.btn.btn-ok { color: var(--green); border-color: color-mix(in oklch, var(--green) 45%, transparent); background: var(--green-bg); }
.btn.btn-ok:hover { border-color: var(--green); background: var(--green-bg); }
.btn.btn-danger { color: var(--red); border-color: color-mix(in oklch, var(--red) 45%, transparent); background: var(--red-bg); }
.btn.btn-danger:hover { border-color: var(--red); background: var(--red-bg); }
.btn.btn-sm { padding: 5px 9px; font-size: 13px; }
.btn.btn-sm.btn-primary { font-size: 13.5px; padding: 5px 10px; }
.btn.btn-xs { padding: 3px 7px; font-size: 12px; }
.btn.btn-icon { padding: 7px; }
.btn.btn-icon.btn-sm { padding: 4px; }
.btn-icon .i { width: 16px; height: 16px; }

button:not([class]) { font: 600 14px/1 var(--font-ui); padding: 9px 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); color: var(--text); cursor: pointer; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar form { margin: 0; display: contents; }
.toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.btn-group .btn.on { background: var(--inset); color: var(--text); border-color: var(--line-2); box-shadow: inset 0 -2px 0 var(--accent); }

/* --------------------------------------------------------------------------
   Lamps, tags, badges
   -------------------------------------------------------------------------- */
.lamp { display: inline-flex; align-items: center; gap: 7px; font: 600 12.5px var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.lamp i { width: 9px; height: 9px; border-radius: 2px; background: var(--faint); box-shadow: 0 0 0 2px color-mix(in oklch, var(--faint) 25%, transparent); }
.lamp.on { color: var(--green); } .lamp.on i { background: var(--green); box-shadow: 0 0 0 2px color-mix(in oklch, var(--green) 30%, transparent), 0 0 8px var(--green); }
.lamp.err { color: var(--red); } .lamp.err i { background: var(--red); box-shadow: 0 0 0 2px color-mix(in oklch, var(--red) 30%, transparent); }
.lamp.warn { color: var(--yellow); } .lamp.warn i { background: var(--yellow); box-shadow: 0 0 0 2px color-mix(in oklch, var(--yellow) 30%, transparent); }
.lamp.busy { color: var(--yellow); } .lamp.busy i { background: var(--yellow); animation: blink 1s steps(2) infinite; }
.lamp.lg { font-size: 15px; } .lamp.lg i { width: 11px; height: 11px; }
@keyframes blink { 50% { opacity: .25; } }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 3px; font: 600 11.5px var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; background: var(--inset); color: var(--text-2); white-space: nowrap; vertical-align: middle; }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.yellow { background: var(--yellow-bg); color: var(--yellow); }
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.purple { background: var(--purple-bg); color: var(--purple); }
.tag.blue { background: var(--blue-bg); color: var(--blue); }
.tag.accent { background: var(--accent); color: var(--accent-ink); }
.tag.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.badge { min-width: 18px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--inset); color: var(--text-2); font: 600 11px/18px var(--font-mono); text-align: center; }
.badge.accent { background: var(--accent); color: var(--accent-ink); }

/* pill: old name, kept for JS that flips it live */
.pill { display: inline-flex; align-items: center; gap: 7px; font: 600 12.5px var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.pill::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--faint); }
.pill.up { color: var(--green); } .pill.up::before { background: var(--green); box-shadow: 0 0 8px var(--green); }
.pill.down { color: var(--muted); }
.pill.warn { color: var(--yellow); } .pill.warn::before { background: var(--yellow); }
.pill.err { color: var(--red); } .pill.err::before { background: var(--red); }

.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: -1px; }

/* --------------------------------------------------------------------------
   Panels, stats, notices, empty states
   -------------------------------------------------------------------------- */
.panel { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); margin-bottom: var(--gap); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h3, .panel-head h2 { margin: 0; }
.panel-head .sub { color: var(--muted); font-size: 13px; }
.panel-head .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-body { padding: 16px 18px; }
.panel-body.tight { padding: 0; }
.panel-foot { padding: 10px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.panel.flag { border-left: 4px solid var(--line-2); }
.panel.flag-green { border-left-color: var(--green); }
.panel.flag-yellow { border-left-color: var(--yellow); }
.panel.flag-red { border-left-color: var(--red); }
.panel.flag-accent { border-left-color: var(--accent); }
.panel.hero { background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: var(--gap); }
.stat { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 12px 16px 10px; min-width: 0; }
.stat-l { font: 600 11px var(--font-display); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.stat-v { font: 600 30px/1.05 var(--font-display); margin-top: 4px; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-v small { font-size: 16px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.stat-s { color: var(--muted); font-size: 12.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.accent { background: var(--accent); color: var(--accent-ink); }
.stat.accent .stat-l, .stat.accent .stat-s, .stat.accent .stat-v, .stat.accent .stat-v small { color: inherit; }
.stat.inline { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; }
.stat.inline .stat-v { font-size: 22px; margin: 0; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 14px; font-size: 14px; }
.notice .i { flex: none; margin-top: 2px; }
.notice.success, .msg.success { background: var(--green-bg); border-color: color-mix(in oklch, var(--green) 40%, transparent); color: var(--green); }
.notice.error, .msg.error, .notice.danger { background: var(--red-bg); border-color: color-mix(in oklch, var(--red) 40%, transparent); color: var(--red); }
.notice.warning, .msg.warning { background: var(--yellow-bg); border-color: color-mix(in oklch, var(--yellow) 45%, transparent); color: var(--text); }
.notice.info { background: var(--blue-bg); border-color: color-mix(in oklch, var(--blue) 40%, transparent); color: var(--text); }
.msg { padding: 11px 14px; border-radius: var(--r); margin-bottom: 14px; border: 1px solid transparent; font-size: 14px; }
.msg.info { background: var(--blue-bg); }

.empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.empty .i { width: 30px; height: 30px; stroke-width: 1.4; color: var(--faint); margin-bottom: 8px; }
.empty p { margin: 0 0 12px; }

/* --------------------------------------------------------------------------
   Data tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data, table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { font: 600 11.5px var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid var(--line-2); padding-top: 10px; padding-bottom: 8px; white-space: nowrap; position: sticky; top: 0; background: var(--surface); z-index: 1; }
tbody tr:hover > td { background: color-mix(in oklch, var(--inset) 60%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.t, .time, td.time { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
td.pos { font: 600 15px var(--font-display); text-align: right; width: 3rem; color: var(--text-2); }
td .sub, .sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
tr.dim td { color: var(--muted); }
td.best, .best { color: var(--purple); font-weight: 600; }
td.pb, .pb { color: var(--green); }
td.actions { text-align: right; white-space: nowrap; }
td.actions .toolbar { justify-content: flex-end; }
table.kv th { font: 500 13px var(--font-ui); color: var(--muted); text-transform: none; letter-spacing: 0; width: 42%; border-bottom: 1px solid var(--line); background: none; position: static; padding: 6px 10px 6px 0; }
table.kv td { padding: 6px 0; }
table.compact th, table.compact td { padding: 5px 9px; font-size: 13px; }

.bar { height: 6px; background: var(--inset); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .5s; }
.bar.green > i { background: var(--green); }
.progress-cells { display: flex; gap: 3px; }
.progress-cells i { flex: 1; height: 8px; border-radius: 2px; background: var(--inset); }
.progress-cells i.done { background: var(--green); }
.progress-cells i.live { background: var(--yellow); animation: blink 1.2s steps(2) infinite; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
label, .lbl { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 0 0 5px; }
.lbl .unit, label .unit { font-weight: 500; color: var(--muted); }
.field { margin-bottom: 14px; min-width: 0; }
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 18px; }
.form-grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.form-grid.four { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 18px; }

input, select, textarea {
  font: inherit; width: 100%; color: var(--text);
  padding: 8px 10px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--inset);
  transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 35%, transparent); }
input[readonly] { color: var(--muted); }
input::placeholder { color: var(--faint); }
input[type="number"] { font-family: var(--font-mono); font-size: 13.5px; }
input[type="checkbox"], input[type="radio"] { width: auto; }
input[type="file"] { padding: 7px; }
textarea { min-height: 80px; resize: vertical; }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
select[multiple] { background-image: none; }
input.sm, select.sm { padding: 5px 8px; font-size: 13px; }
input.w-auto, select.w-auto { width: auto; }

.help { display: inline-flex; align-items: center; border: 0; background: none; color: var(--faint); padding: 0; cursor: help; line-height: 1; }
.help .i { width: 15px; height: 15px; stroke-width: 2; }
.help:hover { color: var(--accent); }

/* stepper: number + unit + nudge buttons */
.stepper { display: inline-flex; align-items: stretch; width: 100%; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--inset); overflow: hidden; }
.stepper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 35%, transparent); }
.stepper input { border: 0; background: none; box-shadow: none !important; padding: 7px 10px; min-width: 0; flex: 1; text-align: right; }
.stepper input:focus { outline: none; }
.stepper .unit { display: flex; align-items: center; padding: 0 9px 0 2px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.stepper button { border: 0; border-left: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); width: 30px; cursor: pointer; font: inherit; display: flex; align-items: center; justify-content: center; }
.stepper button:hover { background: var(--surface); color: var(--text); }
.stepper button .i { width: 14px; height: 14px; }

/* segmented control (radios) */
.seg { display: inline-flex; background: var(--inset); border: 1px solid var(--line-2); border-radius: var(--r); padding: 3px; gap: 2px; max-width: 100%; }
.seg.block { display: flex; }
.seg label { margin: 0; flex: 1; position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px; border-radius: 3px; font: 600 13px var(--font-ui); color: var(--muted); white-space: nowrap; cursor: pointer; transition: background .12s, color .12s; }
.seg span .i { width: 15px; height: 15px; }
.seg input:hover + span { color: var(--text); }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px oklch(0% 0 0 / .18); }
.seg input:checked + span .i { color: var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.seg.sm span { padding: 4px 9px; font-size: 12.5px; }
.seg.tone input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg.tone input:checked + span .i { color: inherit; }

/* toggle switch */
.switch { display: flex; align-items: flex-start; gap: 12px; padding: 9px 0; cursor: pointer; margin: 0; font-weight: 500; color: var(--text); font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .sw { flex: none; width: 36px; height: 20px; border-radius: 10px; background: var(--line-2); position: relative; transition: background .15s; margin-top: 1px; }
.switch .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px oklch(0% 0 0 / .3); transition: transform .15s; }
.switch input:checked + .sw { background: var(--accent); }
.switch input:checked + .sw::after { transform: translateX(16px); }
.switch input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch .sw-t { display: block; min-width: 0; line-height: 1.35; }
.switch .sw-t small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; margin-top: 2px; }
.switch .sw-t .help { vertical-align: -1px; margin-left: 2px; }
.switch .sw-t .lbl { margin: 0; color: var(--text); font-size: 14px; }
.switches { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 24px; }
.switches .switch { border-bottom: 1px solid var(--line); }
.switches .switch:last-child { border-bottom: 0; }

/* slider + value */
.range-row { display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem; gap: 10px; align-items: center; }
input[type="range"] { appearance: none; height: 4px; background: var(--line-2); border-radius: 2px; padding: 0; border: 0; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 1px 3px oklch(0% 0 0 / .35); cursor: pointer; }
input[type="range"]:focus { box-shadow: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 3px; font-family: var(--font-mono); }

/* choice tiles (weather etc) */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.choice { position: relative; margin: 0; }
.choice input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.choice span { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 8px; border-radius: var(--r); border: 1px solid var(--line); background: var(--inset); font-size: 12px; font-weight: 500; color: var(--muted); text-align: center; cursor: pointer; transition: border-color .12s, color .12s, background .12s; }
.choice span .i { width: 22px; height: 22px; stroke-width: 1.6; }
.choice input:hover + span { border-color: var(--muted); color: var(--text); }
.choice input:checked + span { border-color: var(--accent); background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:checked + span .i { color: var(--accent); }

.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; }
.form-actions form { margin: 0; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 200px; }

.group { padding: 4px 0 8px; }
.group + .group { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 8px; }
.group-title { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.group-title h4 { margin: 0; }
.group-title .sub { margin: 0; font-size: 13px; }

/* row editors: a header line plus one grid row per entry */
.slot-grid { display: grid; gap: 6px; align-items: center; font-size: 13px; min-width: 900px; }
.slot-grid .head { display: flex; align-items: center; gap: 4px; font: 600 11px var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 4px 0 6px; border-bottom: 2px solid var(--line-2); }
.slot-grid input, .slot-grid select { padding: 5px 8px; font-size: 13px; }
.slot-grid .stepper input { padding: 5px 8px; }
.slot-grid .stepper .unit { padding-right: 7px; font-size: 11.5px; }

/* --------------------------------------------------------------------------
   Tabs and the editor layout
   -------------------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { border: 0; background: none; font: 600 14px var(--font-ui); color: var(--muted); padding: 10px 14px; margin-bottom: -2px; border-bottom: 2px solid transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab .badge { font-size: 10.5px; }
.tab.on .badge { background: var(--accent); color: var(--accent-ink); }
.tabs.vertical { flex-direction: column; border-bottom: 0; border-right: 2px solid var(--line); margin: 0; }
.tabs.vertical .tab { margin: 0 -2px 0 0; border-bottom: 0; border-right: 2px solid transparent; justify-content: flex-start; padding: 9px 12px; }
.tabs.vertical .tab.on { border-right-color: var(--accent); }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.editor-rail { position: sticky; top: calc(var(--top-h) + 16px); }
.summary { font-size: 13.5px; }
.summary dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 12px; margin: 0; }
.summary dt { color: var(--muted); white-space: nowrap; }
.summary dd { margin: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary dd.t { font-size: 12.5px; }

/* session timeline */
.timeline { display: flex; gap: 3px; height: 26px; border-radius: var(--r); overflow: hidden; margin: 6px 0 4px; }
.timeline > div { display: flex; align-items: center; justify-content: center; font: 600 11.5px var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); min-width: 0; overflow: hidden; white-space: nowrap; padding: 0 6px; transition: flex .25s; }
.timeline .tl-p { background: var(--blue); color: #fff; }
.timeline .tl-q { background: var(--purple); color: #fff; }
.timeline .tl-r { background: var(--accent); }
.timeline .tl-r2 { background: var(--green); color: #fff; }
.timeline .tl-x { background: var(--inset); color: var(--muted); }

/* --------------------------------------------------------------------------
   Content tiles, media
   -------------------------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: var(--gap); }
.tiles.small { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; color: inherit; display: block; transition: transform .12s, box-shadow .12s; }
a.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.tile.livery { cursor: pointer; outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .12s; }
.tile.livery.on { outline-color: var(--accent); }
.tile img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--inset); }
.tile-body { padding: 10px 12px 11px; font-size: 14px; }
.tile-body strong { display: block; font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: 0.01em; }
.tile-body .sub { font-size: 12.5px; }
.tile-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
img.badge-img { width: 32px; height: 32px; object-fit: contain; }
img.preview { width: 100%; border-radius: var(--r-lg); display: block; background: var(--inset); }
.detail-split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.live-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.split-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.split-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }

/* track map */
.map-wrap { position: relative; line-height: 0; background: var(--inset); border-radius: var(--r); overflow: hidden; }
.map-wrap img { width: 100%; height: auto; display: block; }
[data-theme="dark"] .map-wrap img { filter: invert(1) hue-rotate(180deg) opacity(.85); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .map-wrap img { filter: invert(1) hue-rotate(180deg) opacity(.85); } }
#dots, #marks { position: absolute; inset: 0; }
.dot { position: absolute; width: 11px; height: 11px; border-radius: 50%; margin: -5.5px 0 0 -5.5px; border: 1.5px solid oklch(0% 0 0 / .6); box-shadow: 0 0 0 1.5px oklch(100% 0 0 / .5); }
.dot-label { position: absolute; left: 14px; top: -4px; font: 600 11px/1 var(--font-ui); white-space: nowrap; color: var(--text); text-shadow: 0 0 3px var(--bg), 0 0 3px var(--bg), 0 0 5px var(--bg); }

pre.log { background: var(--rail-bg); color: oklch(85% 0.01 80); border-radius: var(--r); padding: 12px 14px; overflow: auto; max-height: 70vh; font: 12.5px/1.5 var(--font-mono); white-space: pre-wrap; word-break: break-word; margin: 0; }

/* --------------------------------------------------------------------------
   Dialogs, tooltips, misc
   -------------------------------------------------------------------------- */
dialog.dlg, dialog.panel { border: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--text); padding: 0; width: min(680px, 92vw); max-height: 88vh; overflow: auto; box-shadow: var(--shadow-pop); }
dialog::backdrop { background: oklch(0% 0 0 / .55); backdrop-filter: blur(2px); }
dialog .panel-body { padding: 18px 20px; }

.tippy-box[data-theme~="pyjan"] { background: var(--rail-bg); color: oklch(90% 0.01 80); border-radius: var(--r); font-size: 13px; line-height: 1.4; box-shadow: var(--shadow-pop); max-width: 340px !important; }
.tippy-box[data-theme~="pyjan"] .tippy-content { padding: 9px 12px; }
.tippy-box[data-theme~="pyjan"] .tippy-arrow { color: var(--rail-bg); }
.tip-t { font: 600 14px var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); margin-bottom: 3px; }
.tip-b { color: oklch(88% 0.01 80); }
.tip-m { margin-top: 6px; padding-top: 6px; border-top: 1px solid oklch(100% 0 0 / .12); color: oklch(68% 0.012 80); font-size: 12px; }
.tip-m code { background: oklch(100% 0 0 / .1); color: oklch(90% 0.01 80); }

.kbd { font: 12px var(--font-mono); background: var(--inset); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--inset); display: inline-flex; align-items: center; justify-content: center; font: 600 12px var(--font-display); color: var(--text-2); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 20% -10%, color-mix(in oklch, var(--accent) 18%, transparent), transparent 60%), var(--bg); }
.login-card { width: min(380px, 100%); }
.login-card .brand { border: 0; padding: 0; height: auto; margin-bottom: 18px; color: var(--text); }
.login-card .brand-sub { color: var(--muted); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .editor-rail { position: static; }
  .split-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: var(--rail-c) minmax(0, 1fr); }
  .brand-name, .brand-sub, .nav-gt, .nav-a span, .rail-user span, .rail-btn span { display: none; }
  .nav-a, .rail-btn, .rail-user { justify-content: center; padding-left: 0; padding-right: 0; }
  .brand { justify-content: center; padding: 0; }
  .live-split, .detail-split, .split-2, .split-3 { grid-template-columns: 1fr; }
  .page { padding: 16px 14px 40px; }
  .topbar { padding: 0 14px; }
  .tb-clock { display: none; }
}
@media (max-width: 600px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; left: 0; top: 0; bottom: 0; width: var(--rail-c); z-index: 40; }
  .frame { padding-left: var(--rail-c); }
  .page-head { flex-direction: column; align-items: stretch; }
  .tb-status .tb-stat span { display: none; }
}
@media print {
  .rail, .topbar, .page-actions, .toolbar, .help { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .panel { box-shadow: none; border: 1px solid #ccc; }
}
