:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --heat: 42, 120, 214;
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --critical: #d03b3b;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 8px 24px rgba(11, 11, 11, 0.05);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #9a988f;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --heat: 57, 135, 229;
    --good-text: #0ca30c;
    --accent: #3987e5;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #9a988f;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --heat: 57, 135, 229;
  --good-text: #0ca30c;
  --accent: #3987e5;
  --shadow: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(30px, 5vw, 48px); font-weight: 700; max-width: 18em; }
h2 { font-size: clamp(24px, 3.2vw, 32px); font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
code { font: 0.9em ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top-row { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--s1); color: #fff; display: grid; place-items: center; font-weight: 800; }
nav { margin-left: auto; display: flex; gap: 4px; overflow-x: auto; }
nav a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
nav a:hover { background: var(--surface-2); color: var(--ink); }
nav .nav-cta { color: var(--accent); font-weight: 600; }
.theme { border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; flex: none; }
@media (max-width: 640px) { nav a:not(.nav-cta) { display: none; } }

/* sections */
section { padding: 72px 0; }
.band { background: var(--surface); border-block: 1px solid var(--border); }
.hero { padding: 80px 16px 64px; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 14px; }
.lede { font-size: 18px; color: var(--ink-2); max-width: 44em; margin-top: 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.section-head { max-width: 50em; margin-bottom: 28px; }
.section-head .sub { color: var(--ink-2); margin-top: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; font-size: 14px; padding: 0 12px; }
.btn:disabled { opacity: 0.5; cursor: progress; }

/* cards & tiles */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 0; box-shadow: var(--shadow); min-width: 0; }
.band .card { background: var(--page); box-shadow: none; }
figcaption { margin-bottom: 14px; }
figcaption p { font-size: 14px; margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--page); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.tile .label { font-size: 13px; color: var(--ink-2); }
.tile .value { font-size: 28px; font-weight: 650; margin-top: 2px; }
.tile .note { font-size: 12px; color: var(--muted); }

/* pipeline */
.pipeline { display: grid; grid-template-columns: 1fr 2.2fr 1fr; gap: 14px; align-items: stretch; }
@media (max-width: 880px) { .pipeline { grid-template-columns: 1fr; } }
.stage { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: relative; box-shadow: var(--shadow); }
.stage p { font-size: 14px; color: var(--ink-2); margin-top: 8px; }
.stage-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.agent-groups { display: grid; gap: 12px; margin: 12px 0 14px; }
.agent-group h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
.agent-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.agent { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; background: var(--page); transition: border-color .25s, background .25s, transform .25s; }
.agent .name { font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.agent .job { font-size: 12.5px; color: var(--muted); }
.agent .count { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }
.agent.running { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--page)); transform: translateY(-1px); }
.agent.done .count::before { content: "✓ "; color: var(--good-text); }

/* score */
.score { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; margin-bottom: 24px; }
@media (max-width: 720px) { .score { grid-template-columns: 1fr; } }
.hero-fig { font-size: 64px; font-weight: 700; line-height: 1; }
.hero-fig small { font-size: 22px; color: var(--muted); font-weight: 600; }
.score-label { color: var(--ink-2); margin-top: 6px; }
.planted { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 6px 18px; font-size: 14px; }
.planted li { display: grid; grid-template-columns: 20px 1fr; gap: 6px; align-items: start; }
.mark-ok { color: var(--good-text); font-weight: 700; }
.mark-miss { color: var(--critical); font-weight: 700; }

/* lanes */
.lanes { margin-top: 16px; }
.lane .lane-total { font-size: 32px; font-weight: 700; margin: 6px 0 2px; }
.lane .lane-sub { font-size: 13px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.items { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--grid); }
.items li { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.items .amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.items .meta { font-size: 12px; color: var(--muted); }
.more { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* heatmap */
.heat-wrap { overflow-x: auto; }
.heat { border-collapse: separate; border-spacing: 2px; font-size: 12px; }
.heat th { font-weight: 500; color: var(--muted); padding: 0 4px; white-space: nowrap; }
.heat th.acct { text-align: left; color: var(--ink-2); padding-right: 10px; font-size: 13px; }
.heat td { width: 38px; min-width: 30px; height: 30px; border-radius: 5px; text-align: center; color: var(--ink); font-variant-numeric: tabular-nums; cursor: default; position: relative; }
.heat td.empty { background: var(--surface-2); color: var(--muted); }
.heat td.gap { background: var(--surface) !important; outline: 2px solid var(--critical); outline-offset: -2px; color: var(--critical); font-weight: 700; }
.heat td:hover, .heat td:focus { outline: 2px solid var(--ink); outline-offset: -2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); margin-top: 12px; align-items: center; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend .sw.gapkey { background: var(--surface); outline: 2px solid var(--critical); outline-offset: -2px; }
.legend .ramp { width: 80px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, rgba(var(--heat), .12), rgba(var(--heat), 1)); }

/* charts */
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 12px; }
.chart .lbl { fill: var(--ink-2); font-size: 12.5px; }
.chart .val { fill: var(--ink); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar:hover { filter: brightness(1.12); }
details.table { margin-top: 12px; font-size: 13px; }
details.table summary { cursor: pointer; color: var(--ink-2); }
details.table table { border-collapse: collapse; margin-top: 8px; width: 100%; }
details.table th, details.table td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--grid); }
details.table td.n { text-align: right; font-variant-numeric: tabular-nums; }

.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 10px; padding: 8px 11px; font-size: 13px; box-shadow: 0 6px 24px rgba(0,0,0,.14); max-width: 280px; }
.tooltip strong { display: block; font-size: 15px; }
.tooltip .tk { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-right: 6px; }

/* try */
.try-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: stretch; }
@media (max-width: 720px) { .try-row { grid-template-columns: 1fr; } }
.drop { display: flex; flex-direction: column; gap: 6px; justify-content: center; border: 2px dashed var(--axis); border-radius: 12px; padding: 22px; cursor: pointer; font-size: 14px; min-height: 140px; }
.drop.over, .drop:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop-title { font-weight: 600; font-size: 16px; }
.try-side { display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.status { margin-top: 14px; font-size: 14px; color: var(--ink-2); min-height: 1.5em; }
.status.err { color: var(--critical); }
#try-report { margin-top: 24px; }
.report-block { margin-top: 16px; }

.foot { padding: 36px 16px 56px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
