/* Conduit AI Lab. Built by Albert Abrantes. */

:root {
  color-scheme: light;
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --surface-3: #e8e7e0;
  --ink: #15171b;
  --ink-2: #4b4f58;
  --muted: #5f646e;
  --line: #e2e0d8;
  --line-strong: #c9c7be;
  --accent: #2a78d6;
  --accent-soft: rgba(42, 120, 214, 0.12);
  --accent-ink: #1c5cab;
  --good: #0ca30c;
  --good-text: #006300;
  --good-soft: rgba(12, 163, 12, 0.14);
  --bad: #d03b3b;
  --bad-text: #a32626;
  --bad-soft: rgba(208, 59, 59, 0.14);
  --warn: #e3a008;
  --warn-text: #7a5300;
  --warn-soft: rgba(227, 160, 8, 0.18);
  --aurora-1: rgba(42, 120, 214, 0.22);
  --aurora-2: rgba(27, 175, 122, 0.16);
  --aurora-3: rgba(98, 80, 214, 0.16);
  --shadow: 0 1px 2px rgba(21, 23, 27, 0.04), 0 8px 24px -12px rgba(21, 23, 27, 0.12);
  --focus: 0 0 0 3px rgba(42, 120, 214, 0.45);
  --pipe-fill: #1c5cab;
  --pipe-text: #ffffff;
  --radius: 14px;
  --radius-sm: 8px;
  --sidebar-w: 264px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1013;
    --surface: #161920;
    --surface-2: #1c2029;
    --surface-3: #242935;
    --ink: #eceae4;
    --ink-2: #b9bdc5;
    --muted: #878c96;
    --line: #272c36;
    --line-strong: #38404d;
    --accent: #3987e5;
    --accent-soft: rgba(57, 135, 229, 0.18);
    --accent-ink: #86b6ef;
    --good: #0ca30c;
    --good-text: #4ad04a;
    --good-soft: rgba(12, 163, 12, 0.18);
    --bad: #d03b3b;
    --bad-text: #f07a7a;
    --bad-soft: rgba(208, 59, 59, 0.2);
    --warn: #fab219;
    --warn-text: #fac65a;
    --warn-soft: rgba(250, 178, 25, 0.16);
    --aurora-1: rgba(57, 135, 229, 0.28);
    --aurora-2: rgba(25, 158, 112, 0.2);
    --aurora-3: rgba(144, 133, 233, 0.2);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -14px rgba(0, 0, 0, 0.6);
    --focus: 0 0 0 3px rgba(134, 182, 239, 0.5);
    --pipe-fill: #3987e5;
    --pipe-text: #0e1013;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1013;
  --surface: #161920;
  --surface-2: #1c2029;
  --surface-3: #242935;
  --ink: #eceae4;
  --ink-2: #b9bdc5;
  --muted: #878c96;
  --line: #272c36;
  --line-strong: #38404d;
  --accent: #3987e5;
  --accent-soft: rgba(57, 135, 229, 0.18);
  --accent-ink: #86b6ef;
  --good: #0ca30c;
  --good-text: #4ad04a;
  --good-soft: rgba(12, 163, 12, 0.18);
  --bad: #d03b3b;
  --bad-text: #f07a7a;
  --bad-soft: rgba(208, 59, 59, 0.2);
  --warn: #fab219;
  --warn-text: #fac65a;
  --warn-soft: rgba(250, 178, 25, 0.16);
  --aurora-1: rgba(57, 135, 229, 0.28);
  --aurora-2: rgba(25, 158, 112, 0.2);
  --aurora-3: rgba(144, 133, 233, 0.2);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -14px rgba(0, 0, 0, 0.6);
  --focus: 0 0 0 3px rgba(134, 182, 239, 0.5);
  --pipe-fill: #3987e5;
  --pipe-text: #0e1013;
}

@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
  overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.015em; font-weight: 600; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); letter-spacing: -0.03em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
p { margin: 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { margin: 0; padding-left: 1.2em; }
li + li { margin-top: 0.35em; }
strong { font-weight: 600; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -48px; background: var(--surface); color: var(--ink); padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; }

/* Layout */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.main { min-width: 0; padding: 28px 40px 48px; max-width: 1180px; width: 100%; }
.content { display: grid; gap: 22px; }
.content > *, .grid-2 > *, .grid-3 > *, .grid-4 > *, .round-panel > *, .hero > * { min-width: 0; }
.table-wrap { max-width: 100%; }

/* Sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 22px 18px 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 0; }
.brand__mark {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  background: conic-gradient(from 210deg, #2a78d6, #1baf7a, #6250d6, #2a78d6);
  position: relative; overflow: hidden;
}
.brand__mark::after { content: ""; position: absolute; inset: 7px; background: var(--surface); border-radius: 3px; }
.brand__word { font-weight: 600; letter-spacing: -0.035em; font-size: 1.02rem; color: var(--ink); line-height: 1; }
.brand__for { display: block; font-size: 0.72rem; color: var(--muted); letter-spacing: 0.01em; margin-top: 4px; font-weight: 500; }
.site-title { margin: 22px 6px 0; }
.site-title .site-name { font-size: 1.35rem; letter-spacing: -0.03em; font-weight: 600; line-height: 1.2; color: var(--ink); margin: 0; }
.site-title p { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

.chip-live {
  display: inline-flex; align-items: center; gap: 8px; margin: 14px 6px 0;
  padding: 6px 10px 6px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 0.8rem; font-weight: 500; color: var(--ink-2); max-width: 100%;
}
.chip-live__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; position: relative; }
.chip-live[data-state="running"] .chip-live__dot { background: var(--accent); }
.chip-live[data-state="running"] .chip-live__dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0;
  animation: pulse 2s ease-out infinite;
}
.chip-live[data-state="waiting"] .chip-live__dot { background: var(--warn); }
.chip-live[data-state="stalled"] .chip-live__dot { background: var(--bad); }
.chip-live[data-state="done"] .chip-live__dot { background: var(--good); }
@keyframes pulse { 0% { transform: scale(0.6); opacity: 0.9; } 100% { transform: scale(1.6); opacity: 0; } }

.freshness { margin: 10px 6px 0; font-size: 0.78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.badge-stale {
  display: none; font-size: 0.72rem; padding: 2px 8px; border-radius: 999px;
  background: var(--warn-soft); color: var(--warn-text); border: 1px solid transparent; font-weight: 500;
}
.is-stale .badge-stale { display: inline-block; }
.badge-error { display: none; font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; background: var(--bad-soft); color: var(--bad-text); font-weight: 500; }
.is-fetch-error .badge-error { display: inline-block; }

.nav { margin-top: 22px; display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  color: var(--ink-2); font-weight: 500; font-size: 0.92rem; position: relative;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -2px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav__n { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); width: 1.4em; }
.nav a[aria-current="page"] .nav__n { color: var(--accent-ink); }
.sidebar__foot { margin-top: auto; padding: 16px 6px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.75rem; color: var(--muted); }
.theme-btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
  border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 0.75rem; cursor: pointer;
}
.theme-btn:hover { color: var(--ink); }

/* Mobile top bar and drawer */
.topbar { display: none; }
.scrim { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .main { padding: 16px 16px 40px; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 14px;
  }
  .topbar .brand__word { font-size: 0.95rem; }
  .menu-btn {
    appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 10px;
    padding: 7px 10px; font: inherit; font-size: 0.85rem; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  }
  .menu-btn svg { width: 16px; height: 16px; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(84vw, 320px); z-index: 50; height: 100dvh;
    transform: translateX(-104%); visibility: hidden; transition: transform 0.28s cubic-bezier(.2,.7,.2,1), visibility 0s linear 0.28s; box-shadow: var(--shadow);
  }
  .drawer-open .sidebar { transform: none; visibility: visible; transition: transform 0.28s cubic-bezier(.2,.7,.2,1), visibility 0s; }
  .scrim { position: fixed; inset: 0; background: rgba(10, 12, 16, 0.45); z-index: 40; }
  .drawer-open .scrim { display: block; }
  .drawer-open .close-btn { display: inline-flex; }
  .drawer-open, html:has(body.drawer-open) { overflow: hidden; }
}
.close-btn { display: none; appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.8rem; cursor: pointer; margin-left: auto; padding: 4px 6px; }

/* Page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .kicker { font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.page-head .updated { font-size: 0.8rem; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stale-note { display: none; font-size: 0.8rem; color: var(--warn-text); background: var(--warn-soft); padding: 8px 12px; border-radius: 10px; }
.is-stale .stale-note { display: block; }
.no-data .updated, .no-data .hero .next, .no-data .hero__side, .no-data [data-overall-eta], .no-data [data-refreshed], .no-data .freshness [data-updated-rel] { display: none; }
.fetch-note { display: none; font-size: 0.8rem; color: var(--bad-text); background: var(--bad-soft); padding: 8px 12px; border-radius: 10px; }
.is-fetch-error .fetch-note { display: block; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow); position: relative;
}
.card--quiet { box-shadow: none; background: var(--surface-2); }
.card--muted { background: transparent; border-style: dashed; box-shadow: none; }
.card > h2, .card > h3 { margin-bottom: 10px; }
.card .lead { color: var(--ink-2); max-width: 70ch; }
.card .cap, .cap { font-size: 0.82rem; color: var(--muted); margin-top: 10px; max-width: 70ch; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .card { padding: 18px 16px; } }
.prose { max-width: 72ch; color: var(--ink-2); }
.prose p + p, .prose p + ul, .prose p + ol, .prose ul + p, .prose ol + p { margin-top: 10px; }
.prose li { color: var(--ink-2); }
.prose strong { color: var(--ink); }
.section-note { font-size: 0.85rem; color: var(--muted); }

/* Aurora surface */
.aurora { overflow: hidden; isolation: isolate; }
.aurora::before {
  content: ""; position: absolute; inset: -40% -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42% 60% at 20% 30%, var(--aurora-1), transparent 70%),
    radial-gradient(36% 50% at 75% 25%, var(--aurora-3), transparent 70%),
    radial-gradient(40% 55% at 60% 85%, var(--aurora-2), transparent 70%);
  filter: blur(22px);
  animation: aurora 26s ease-in-out infinite alternate;
}
@keyframes aurora {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  50% { transform: translate3d(3%, -4%, 0) rotate(4deg) scale(1.06); }
  100% { transform: translate3d(-3%, 3%, 0) rotate(-3deg) scale(1.02); }
}

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 28px; align-items: start; padding: 28px 30px; }
.hero .tagline-lead { font-size: 1rem; color: var(--accent-ink); font-weight: 600; margin-bottom: 12px; max-width: 56ch; line-height: 1.45; }
.hero .hero__headline { max-width: 20ch; font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); letter-spacing: -0.03em; }
.hero .subhead { margin-top: 14px; color: var(--ink-2); max-width: 60ch; font-size: 1.02rem; }
.hero .next { margin-top: 18px; display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; font-size: 0.92rem; color: var(--ink-2); max-width: 64ch; }
.hero .next .lbl { font-weight: 600; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; font-size: 0.8rem; line-height: 1.7; margin-top: 2px; }
.hero__side { display: grid; gap: 14px; }
.hero .byline { margin-top: 20px; font-size: 0.8rem; color: var(--muted); max-width: 60ch; border-top: 1px solid var(--line); padding-top: 12px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; padding: 22px 18px; } }

.mini-stat { background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; backdrop-filter: blur(6px); }
.mini-stat .lbl { font-size: 0.78rem; color: var(--muted); font-weight: 500; }
.mini-stat .val { font-size: 1.7rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; margin-top: 2px; }
.mini-stat .val small { font-size: 0.95rem; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.mini-stat .sub { font-size: 0.8rem; color: var(--ink-2); margin-top: 4px; }

/* Compact phase strip */
.phase-strip { display: grid; gap: 8px; }
.phase-strip__dots { display: flex; gap: 4px; align-items: center; }
.phase-strip__dots span { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); position: relative; }
.phase-strip__dots span[data-s="done"] { background: var(--accent); }
.phase-strip__dots span[data-s="running"] { background: var(--accent); opacity: 0.55; animation: breathe 1.8s ease-in-out infinite; }
.phase-strip__dots span[data-s="conditional"] { background: repeating-linear-gradient(135deg, var(--line-strong) 0 3px, transparent 3px 6px); }
.phase-strip__lbl { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); gap: 10px; }
@keyframes breathe { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

/* Progress bars */
.bar { height: 10px; background: var(--surface-3); border-radius: 5px; overflow: hidden; position: relative; }
.bar__fill { height: 100%; width: 0; background: var(--accent); border-radius: 0 4px 4px 0; transition: width 0.9s cubic-bezier(.2,.7,.2,1); position: relative; }
.bar--running .bar__fill::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  background-size: 200% 100%; animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.bar--thin { height: 6px; }
.bar__row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 0.88rem; margin-bottom: 6px; }
.bar__row .val { font-variant-numeric: tabular-nums; font-weight: 600; }
.bar__row .lbl { color: var(--ink-2); }

/* Live run card */
.run-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.76rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill--running { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.pill--running::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: breathe 1.6s ease-in-out infinite; }
.pill--good { background: var(--good-soft); color: var(--good-text); border-color: transparent; }
.pill--bad { background: var(--bad-soft); color: var(--bad-text); border-color: transparent; }
.pill--warn { background: var(--warn-soft); color: var(--warn-text); border-color: transparent; }
.pill--outline { background: transparent; }
.pill--mono { font-family: var(--mono); font-weight: 500; letter-spacing: 0; }
.pill code { font-family: var(--mono); font-weight: 500; font-size: 0.95em; }
.counter { font-size: 2.6rem; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.counter small { font-size: 1.1rem; color: var(--muted); font-weight: 500; letter-spacing: -0.01em; }
.counts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.counts span { font-size: 0.82rem; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 4px 10px; }
.counts b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.kv { display: grid; gap: 10px; margin-top: 16px; font-size: 0.9rem; }
.kv > div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; }
.kv .k { color: var(--muted); font-size: 0.82rem; font-weight: 500; padding-top: 2px; }
.kv .v { color: var(--ink-2); }
.kv .v b { color: var(--ink); font-weight: 600; }
.kv .v .cap { margin-top: 3px; display: block; }
.xfade { transition: opacity 0.4s ease; }
.xfade.is-out { opacity: 0; }
@media (max-width: 560px) { .kv > div { grid-template-columns: 1fr; gap: 2px; } }

/* Threshold gauges (bullet bars) */
.gauges { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1180px) { .gauges { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .gauges { grid-template-columns: 1fr; } }
.gauge { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px 12px; display: grid; gap: 8px; align-content: start; }
.gauge__label { font-size: 0.82rem; color: var(--ink-2); font-weight: 500; min-height: 2.6em; }
.gauge--count .gauge__value { margin-bottom: 14px; }
.gauge__value { font-size: 1.9rem; font-weight: 600; letter-spacing: -0.035em; line-height: 1; }
.gauge__track { position: relative; height: 10px; border-radius: 5px; background: var(--surface-3); overflow: visible; margin-top: 4px; }
.gauge__fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 0 4px 4px 0; transition: width 1.1s cubic-bezier(.2,.7,.2,1); }
.gauge--pass .gauge__fill { background: var(--good); }
.gauge--fail .gauge__fill { background: var(--bad); }
.gauge--pass .gauge__track { background: var(--good-soft); }
.gauge--fail .gauge__track { background: var(--bad-soft); }
.gauge__mark { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); border-radius: 1px; transform: translateX(-1px); }
.gauge__mark::after { content: ""; position: absolute; left: -3px; top: -4px; border: 4px solid transparent; border-top-color: var(--ink); }
.gauge__foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.76rem; color: var(--muted); flex-wrap: wrap; }
.gauge__status { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.gauge--pass .gauge__status { color: var(--good-text); }
.gauge--fail .gauge__status { color: var(--bad-text); }
.gauge__status svg { width: 13px; height: 13px; }
.gauge__why { font-size: 0.78rem; color: var(--muted); line-height: 1.45; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.score-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; font-size: 0.92rem; }
.score-summary .big { font-weight: 600; }
.score-summary .big b { font-size: 1.15em; }

/* Stat tiles */
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.tile .lbl { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.tile .val { font-size: 2.3rem; font-weight: 600; letter-spacing: -0.04em; line-height: 1.05; margin-top: 4px; }
.tile .sub { font-size: 0.8rem; color: var(--ink-2); margin-top: 4px; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.74rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
td b { font-weight: 600; }
.table--roles td:first-child { font-weight: 600; white-space: nowrap; }
.table--roles td:nth-child(2) { color: var(--ink-2); min-width: 160px; }
.table--roles td:nth-child(3) { color: var(--ink-2); }
.foot-note { font-size: 0.8rem; color: var(--muted); margin-top: 12px; }

/* Bar charts (HTML) */
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 180px) 1fr auto; gap: 10px; align-items: center; font-size: 0.86rem; }
.hbar .lbl { color: var(--ink-2); }
.hbar .val { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 3.4em; text-align: right; }
.hbar .track { display: block; height: 10px; background: var(--surface-3); border-radius: 5px; position: relative; overflow: visible; }
.hbar .fill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 0 4px 4px 0; transition: width 1s cubic-bezier(.2,.7,.2,1); }
.hbar .thr { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 1px; }
.hbar--pass .fill { background: var(--good); } .hbar--fail .fill { background: var(--bad); }
.hbar--pass .track { background: var(--good-soft); } .hbar--fail .track { background: var(--bad-soft); }
.hbar--muted .fill { background: var(--muted); }
@media (max-width: 560px) { .hbar { grid-template-columns: 1fr auto; } .hbar .track { grid-column: 1 / -1; order: 3; } }

/* Stacked category bars */
.stack { display: grid; gap: 8px; }
.stack__row { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: center; font-size: 0.86rem; }
.stack__bar { display: flex; gap: 2px; height: 14px; }
.stack__seg { height: 100%; border-radius: 3px; min-width: 2px; transition: flex-basis 1s ease; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.8rem; color: var(--ink-2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.hatch { background: repeating-linear-gradient(135deg, var(--accent) 0 2px, transparent 2px 5px); border: 1px solid var(--accent); }
.legend i.dashed { border: 1.5px dashed var(--warn); background: var(--warn-soft); }

/* Histogram */
.hist { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: end; height: 170px; padding-top: 10px; }
.hist__col { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 6px; text-align: center; }
.hist__bar-wrap { display: flex; align-items: flex-end; justify-content: center; }
.hist__bar { width: 100%; max-width: 72px; background: var(--accent); border-radius: 4px 4px 0 0; height: 0; transition: height 1s cubic-bezier(.2,.7,.2,1); position: relative; }
.hist__bar span { position: absolute; top: -22px; left: 0; right: 0; font-size: 0.84rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.hist__lbl { font-size: 0.78rem; color: var(--muted); }

/* Tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.tab { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 0.9rem; font-weight: 500; display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tab[aria-selected="true"] .pill { background: rgba(255,255,255,0.14); color: inherit; border-color: transparent; }
:root[data-theme="dark"] .tab[aria-selected="true"] .pill { background: rgba(0,0,0,0.18); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab[aria-selected="true"] .pill { background: rgba(0,0,0,0.18); } }
.round-panel { display: grid; gap: 22px; }
.round-panel[hidden] { display: none; }
.round-head { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.facts { font-size: 0.9rem; color: var(--ink-2); margin-top: 10px; }
.facts b { color: var(--ink); }
.subtle-banner { font-size: 0.84rem; color: var(--warn-text); background: var(--warn-soft); border-radius: 10px; padding: 8px 12px; margin-bottom: 14px; }
.dev-row { display: grid; grid-template-columns: minmax(180px, 1.3fr) repeat(6, minmax(0, 1fr)); gap: 8px; align-items: start; font-size: 0.82rem; padding: 10px 0; border-top: 1px dashed var(--line); }
.dev-row:first-of-type { border-top: 0; }
.dev-row .lbl { font-weight: 600; color: var(--ink-2); }
.dev-row .note { display: block; color: var(--muted); font-size: 0.76rem; margin-top: 3px; font-weight: 400; }
.dev-row .m { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.dev-row .m .k { font-size: 0.7rem; color: var(--muted); }
@media (min-width: 901px) { .dev-row .m .k { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; } }
.dev-row .m .pm { font-size: 0.72rem; margin-left: 4px; }
.dev-row .m.pass .pm { color: var(--good-text); } .dev-row .m.fail .pm { color: var(--bad-text); }
.dev-head { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
@media (max-width: 900px) { .dev-row { grid-template-columns: 1fr 1fr 1fr; } .dev-row .lbl { grid-column: 1 / -1; } .dev-head { display: none; } .dev-row .m .k { display: block; } }
.pm svg { width: 11px; height: 11px; vertical-align: -1px; }

/* Bucket list */
.buckets { display: grid; gap: 14px; }
.bucket { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.bucket:first-child { border-top: 0; padding-top: 0; }
.bucket h2 { font-size: 0.98rem; }
.bucket .meta { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bucket .track { grid-column: 1 / -1; height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bucket .fill { height: 100%; width: 0; background: var(--accent); border-radius: 0 4px 4px 0; transition: width 0.9s cubic-bezier(.2,.7,.2,1); }
.bucket p { grid-column: 1 / -1; color: var(--ink-2); font-size: 0.9rem; max-width: 76ch; }
.bucket .tag { align-self: start; }

/* Vertical timeline */
.tl { display: grid; gap: 0; position: relative; }
.tl__item { display: grid; grid-template-columns: 26px 1fr; gap: 14px; position: relative; padding-bottom: 22px; }
.tl__item:last-child { padding-bottom: 0; }
.tl__node { width: 26px; display: flex; justify-content: center; position: relative; }
.tl__dot { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--line-strong); margin-top: 4px; position: relative; z-index: 1; flex: none; }
.tl__item[data-s="done"] .tl__dot { background: var(--accent); border-color: var(--accent); }
.tl__item[data-s="running"] .tl__dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl__item[data-s="running"] .tl__dot::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--accent); animation: pulse 2s ease-out infinite; }
.tl__item[data-s="next"] .tl__dot { border-color: var(--accent); background: var(--surface); }
.tl__item[data-s="conditional"] .tl__dot { border-style: dashed; border-color: var(--warn); background: var(--surface); }
.tl__item[data-s="skipped"] .tl__dot { border-color: var(--line-strong); background: var(--surface); opacity: 0.6; }
.tl__item[data-s="blocked"] .tl__dot { background: var(--bad); border-color: var(--bad); }
.tl__line { position: absolute; left: 12px; top: 22px; bottom: -4px; width: 2px; background: var(--line); }
.tl__item[data-s="done"] .tl__line { background: var(--accent); }
.tl__item[data-s="running"] .tl__line, .tl__item[data-ahead="1"] .tl__line { background: repeating-linear-gradient(to bottom, var(--line-strong) 0 4px, transparent 4px 8px); }
.tl__item:last-child .tl__line { display: none; }
.tl__body { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 6px; }
.tl__item[data-s="running"] .tl__body { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tl__item[data-s="conditional"] .tl__body { border-style: dashed; }
.tl__item[data-s="upcoming"] .tl__body, .tl__item[data-s="skipped"] .tl__body { background: transparent; }
.tl__top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.tl__top h2 { font-size: 1rem; }
.tl__time { font-size: 0.84rem; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tl__note { font-size: 0.84rem; color: var(--muted); max-width: 72ch; }
.tl__cond { font-size: 0.82rem; color: var(--warn-text); }
.basis { font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; padding: 1px 7px; border-radius: 5px; }
.basis--measured { background: var(--ink); color: var(--surface); }
.basis--estimate { border: 1px solid var(--line-strong); color: var(--ink-2); }

/* Range chart (Gantt) */
.range { display: grid; gap: 6px; position: relative; }
.range__row { display: grid; grid-template-columns: 250px 1fr; gap: 12px; align-items: center; font-size: 0.8rem; min-height: 26px; }
.range__row .lbl { color: var(--ink-2); line-height: 1.2; }
.range__track { position: relative; height: 18px; }
.range__track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.range__bar { position: absolute; top: 3px; height: 12px; border-radius: 4px; min-width: 3px; }
.range__bar--done { background: var(--accent); }
.range__bar--elapsed { background: var(--accent); }
.range__bar--measured { background: var(--accent); opacity: 0.45; }
.range__bar--estimate { background: repeating-linear-gradient(135deg, var(--accent) 0 2px, transparent 2px 6px); border: 1px solid var(--accent); opacity: 0.8; }
.range__bar--conditional { background: repeating-linear-gradient(135deg, var(--warn) 0 2px, transparent 2px 6px); border: 1.5px dashed var(--warn); opacity: 0.9; }
.range__axis { grid-template-columns: 250px 1fr; display: grid; gap: 12px; font-size: 0.72rem; color: var(--muted); }
.range__ticks { position: relative; height: 26px; }
.range__ticks span { position: absolute; top: 4px; transform: translateX(-50%); white-space: nowrap; }
.range__ticks span.is-first { transform: none; }
.range__ticks span.is-first::before { left: 0; }
.range__ticks span.is-last { transform: translateX(-100%); }
.range__ticks span.is-last::before { left: auto; right: 0; }
.range__ticks span::before { content: ""; position: absolute; left: 50%; top: -6px; width: 1px; height: 5px; background: var(--line-strong); }
.range__now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); z-index: 2; pointer-events: none; }
.range__now::after { content: "Now"; position: absolute; top: -18px; left: -14px; font-size: 0.68rem; font-weight: 700; color: var(--bad-text); letter-spacing: 0.04em; }
.range__plot { position: relative; padding-top: 18px; }
.range__row:not(:first-child) .range__now::after { display: none; }
@media (max-width: 720px) {
  .range__row, .range__axis { grid-template-columns: 1fr; gap: 2px; }
  .range__row .lbl { white-space: normal; }
  .range__row { min-height: 0; margin-top: 14px; }
  .range__row .lbl { font-size: 0.8rem; color: var(--ink); }
  .range__track { height: 24px; }
  .range__bar { top: 5px; height: 14px; }
  .range__now::after { display: none; }
}
/* Stacked tables on small screens: each row becomes a labelled card */
@media (max-width: 560px) {
  table.rows-sm thead { display: none; }
  table.rows-sm, table.rows-sm tbody, table.rows-sm tr, table.rows-sm td { display: block; width: 100%; }
  table.rows-sm tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; margin-bottom: 10px; background: var(--surface); }
  table.rows-sm tbody tr:last-child { margin-bottom: 0; }
  table.rows-sm td { display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 10px; border: 0; padding: 5px 0; text-align: left; font-variant-numeric: tabular-nums; }
  table.rows-sm td::before { content: attr(data-label); font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding-top: 3px; }
  table.rows-sm td:first-child { grid-template-columns: 1fr; font-weight: 600; border-bottom: 1px solid var(--line); padding-bottom: 7px; margin-bottom: 4px; }
  table.rows-sm td:first-child::before { display: none; }
  table.rows-sm td[colspan] { grid-template-columns: 1fr; }
  table.rows-sm td[colspan]::before { display: none; }
  table.cov td.hl { background: transparent; box-shadow: inset 3px 0 0 var(--accent); padding-left: 8px; }
}

/* Activity */
.day { display: grid; gap: 10px; }
.day h2 { font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; padding-top: 6px; }
.entry { display: grid; grid-template-columns: 88px 1fr; gap: 14px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.entry.is-new { animation: flash 2.4s ease-out; }
@keyframes flash { 0% { background: var(--accent-soft); } 100% { background: var(--surface); } }
.entry time { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.entry h3 { font-size: 0.95rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.entry p { font-size: 0.88rem; color: var(--ink-2); margin-top: 3px; }
.tag { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 1px 7px; border-radius: 5px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.tag--accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
@media (max-width: 560px) { .entry { grid-template-columns: 1fr; gap: 4px; } }

/* Pipeline */
.pipeline { width: 100%; height: auto; display: block; overflow: visible; }
.pipeline text { font-family: var(--font); fill: var(--ink-2); }
.pipeline .node rect { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1; }
.pipeline .node text.name { fill: var(--ink); font-weight: 600; }
.pipeline .node text.n { fill: var(--muted); font-family: var(--mono); }
.pipeline .node.is-active rect { fill: var(--pipe-fill); stroke: var(--pipe-fill); }
.pipeline .node.is-active text { fill: var(--pipe-text); }
.pipeline .node.is-active .glow { animation: glow 2.2s ease-in-out infinite; }
@keyframes glow { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.6; } }
.pipeline .edge { stroke: var(--line-strong); stroke-width: 1.5; fill: none; }
.pipeline .edge--loop { stroke: var(--accent); stroke-dasharray: 4 4; }
.pipeline .token { fill: var(--accent); }
.pipeline .token-ring { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0.5; }
.pipeline .loop-label { fill: var(--accent-ink); font-weight: 600; }
.stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; margin-top: 18px; counter-reset: stage; padding: 0; list-style: none; }
.stages li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; font-size: 0.86rem; color: var(--ink-2); padding: 8px 10px; border-radius: 8px; border: 1px solid transparent; }
.stages li::before { counter-increment: stage; content: counter(stage); font-family: var(--mono); font-size: 0.74rem; color: var(--muted); padding-top: 3px; }
.stages li.is-active { background: var(--accent-soft); border-color: transparent; }
.stages li.is-active::before { color: var(--accent-ink); font-weight: 600; }
.stages b { color: var(--ink); display: block; }
.stages--after li::before { content: ""; counter-increment: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); margin-top: 7px; margin-left: 6px; }
.stages--after { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .stages { grid-template-columns: 1fr; } }

/* Coverage pending */
.pending { text-align: center; padding: 34px 20px; display: grid; gap: 10px; justify-items: center; }
.pending__orb { width: 56px; height: 56px; border-radius: 50%; background: conic-gradient(from 0deg, var(--accent), var(--aurora-2), var(--aurora-3), var(--accent)); opacity: 0.8; position: relative; animation: spin 14s linear infinite; }
.pending__orb::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface-2); }
@keyframes spin { to { transform: rotate(360deg); } }
.pending h2 { font-size: 1.05rem; }
.pending p { color: var(--ink-2); max-width: 52ch; font-size: 0.92rem; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips span { font-size: 0.8rem; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.chips b { color: var(--ink); }
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-row button { appearance: none; font: inherit; font-size: 0.8rem; font-weight: 600; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.filter-row button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
table.cov td.hl, table.cov th.hl { background: var(--accent-soft); }
table.cov td.dim, table.cov th.dim { opacity: 0.85; }
table.cov td.dim .placeholder { color: var(--ink-2); }
@media (prefers-reduced-motion: no-preference) { .reveal tbody tr { opacity: 0; transform: translateY(4px); animation: rowin 0.5s ease forwards; } }
@keyframes rowin { to { opacity: 1; transform: none; } }

/* Footer */
.footer { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); display: grid; gap: 4px; }

/* Placeholder text */
.placeholder { color: var(--muted); font-style: normal; }
.empty { padding: 18px; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--muted); font-size: 0.9rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .aurora::before { animation: none !important; }
}
@media print { .sidebar, .topbar { display: none; } .shell { grid-template-columns: 1fr; } }
