:root {
  color-scheme: dark;
  --ink: #090a0a;
  --panel: #111312;
  --panel-2: #171a18;
  --line: #2a2e2b;
  --muted: #90978f;
  --paper: #f2f0e9;
  --blue: #07bef8;
  --green: #69d48f;
  --red: #ff6868;
  --amber: #f6b94c;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 85% 5%, rgba(7, 190, 248, .09), transparent 25rem),
    var(--ink);
  color: var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-width: 320px;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.shell { max-width: 1480px; margin: 0 auto; min-height: 100vh; border-inline: 1px solid #181a19; }
.topbar { height: 84px; display: flex; align-items: center; justify-content: space-between; padding: 0 42px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 13px; color: var(--paper); text-decoration: none; letter-spacing: .05em; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; background: var(--blue); color: #080808; font-weight: 950; letter-spacing: -.08em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .85rem; }
.brand small { color: var(--muted); margin-top: 3px; font-size: .58rem; letter-spacing: .15em; }
.runtime-state { display: flex; gap: 9px; align-items: center; font-size: .68rem; letter-spacing: .12em; color: var(--muted); }
.pulse { width: 7px; height: 7px; background: var(--amber); border-radius: 50%; box-shadow: 0 0 0 4px rgba(246,185,76,.12); }
.runtime-state.ready .pulse { background: var(--green); box-shadow: 0 0 0 4px rgba(105,212,143,.12); }
.runtime-state.error .pulse { background: var(--red); }

main { padding: 0 42px 64px; }
.hero { min-height: 310px; display: flex; align-items: flex-end; justify-content: space-between; padding: 62px 0 48px; border-bottom: 1px solid var(--line); gap: 32px; }
.eyebrow { color: var(--blue); font-size: .66rem; font-weight: 800; letter-spacing: .18em; margin: 0 0 16px; }
h1 { margin: 0; font-size: clamp(3.1rem, 6vw, 6rem); line-height: .9; letter-spacing: -.075em; max-width: 850px; }
h1 em { color: var(--blue); font-style: normal; }
.hero-note { max-width: 330px; color: #b6bbb5; line-height: 1.6; font-size: .84rem; padding-bottom: 5px; }
.scope-pill { display: inline-block; border: 1px solid var(--blue); color: var(--blue); padding: 7px 10px; font-size: .68rem; font-weight: 800; letter-spacing: .14em; }

.workspace { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.control-panel { padding: 38px 34px 42px 0; border-right: 1px solid var(--line); }
.results-panel { padding: 38px 0 42px 38px; min-width: 0; }
.section-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.section-heading > span:first-child { color: var(--blue); font: 800 .65rem/1 ui-monospace, monospace; border: 1px solid rgba(7,190,248,.35); padding: 7px; }
.section-heading p { margin: 0 0 4px; color: var(--muted); font-size: .58rem; letter-spacing: .16em; }
.section-heading h2 { margin: 0; font-size: 1.05rem; letter-spacing: -.025em; }
.run-id { margin-left: auto; color: var(--muted); font: .62rem/1.3 ui-monospace, monospace; max-width: 220px; text-align: right; }

.field { display: block; border: 0; padding: 0; margin: 0 0 22px; }
.field > span, .field legend { display: block; margin-bottom: 9px; color: #b8bdb7; font-size: .67rem; font-weight: 700; letter-spacing: .08em; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 0; background: var(--panel); color: var(--paper); outline: none; }
input, select { height: 46px; padding: 0 13px; }
textarea { min-height: 94px; padding: 12px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(7,190,248,.14); }
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { height: 44px; display: grid; place-items: center; background: var(--panel); color: var(--muted); font-weight: 850; font-size: .8rem; cursor: pointer; }
.segmented input:checked + span { background: var(--blue); color: #080808; }
.route-lock { display: grid; gap: 8px; margin: 27px 0; padding: 16px; background: #0d0f0e; border: 1px solid var(--line); }
.route-lock span { color: var(--muted); font-size: .58rem; letter-spacing: .16em; }
.route-lock strong { font-size: .76rem; letter-spacing: .08em; }
.route-lock b { color: var(--blue); margin: 0 4px; }
.primary-action { width: 100%; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border: 0; background: var(--blue); color: #090909; font-size: .72rem; font-weight: 900; letter-spacing: .1em; }
.primary-action[href] { box-sizing: border-box; margin-top: 12px; text-decoration: none; }
.primary-action:hover { background: #38cbfa; }
.primary-action:disabled { cursor: wait; opacity: .55; }
.primary-action b { font-size: 1.2rem; }
.matrix-launch { margin-top: 14px; padding: 16px; border: 1px solid #31483a; background: rgba(105,212,143,.04); }
.matrix-launch p { margin: 0 0 12px; color: var(--muted); font-size: .67rem; line-height: 1.45; }
.matrix-launch p strong { display: block; color: var(--green); font-size: .58rem; letter-spacing: .14em; }
.matrix-action { width: 100%; height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border: 1px solid var(--green); background: transparent; color: var(--green); font-size: .68rem; font-weight: 900; letter-spacing: .08em; }
.matrix-action:hover { background: rgba(105,212,143,.1); }
.matrix-action:disabled { cursor: wait; opacity: .55; }
.matrix-action b { display: grid; place-items: center; width: 27px; height: 27px; background: var(--green); color: #07150c; font-size: .65rem; }

.outcome { min-height: 88px; display: grid; grid-template-columns: 100px 1fr; align-items: center; border: 1px solid var(--line); background: var(--panel); margin-bottom: 28px; }
.outcome-code { align-self: stretch; display: grid; place-items: center; background: #1f2220; font: 800 .72rem/1 ui-monospace, monospace; color: var(--muted); }
.outcome > div { padding: 16px 20px; }
.outcome strong { display: block; margin-bottom: 5px; }
.outcome p { margin: 0; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.outcome.pass .outcome-code { color: #06150b; background: var(--green); }
.outcome.no_go .outcome-code, .outcome.fail .outcome-code { color: #210707; background: var(--red); }
.outcome.hold .outcome-code, .outcome.escalation .outcome-code { color: #1d1200; background: var(--amber); }
.outcome.ready .outcome-code { color: #071024; background: var(--blue); }

.matrix-result { margin: 0 0 28px; padding: 22px; border: 1px solid #344b3d; background: rgba(28,46,35,.28); }
.matrix-result-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.matrix-result-head h3 { margin: 0; }
.matrix-result-head strong { color: #aeb7ad; font: .65rem/1.4 ui-monospace, monospace; text-align: right; }
.matrix-digest { margin: 12px 0 18px; color: #6f7d72; font: .58rem/1.4 ui-monospace, monospace; overflow-wrap: anywhere; }
.matrix-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.matrix-case { min-width: 0; min-height: 82px; padding: 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #0d0f0e; }
.matrix-case span, .matrix-case strong, .matrix-case small { display: block; }
.matrix-case span { color: #aeb4ae; font-size: .62rem; }
.matrix-case strong { margin: 8px 0 5px; font: 800 .58rem/1 ui-monospace, monospace; }
.matrix-case small { color: #59615b; font: .52rem/1.35 ui-monospace, monospace; overflow-wrap: anywhere; }
.matrix-case.pass { box-shadow: inset 0 2px var(--green); }
.matrix-case.pass strong { color: var(--green); }
.matrix-case.fail { box-shadow: inset 0 2px var(--red); }
.matrix-case.fail strong { color: var(--red); }

.week-track { display: grid; grid-template-columns: 1fr 48px 1fr 48px 1fr; align-items: center; margin: 10px 0 28px; }
.week-node { display: flex; align-items: center; gap: 9px; color: #666d67; }
.week-node span { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #393d3a; font: 700 .58rem/1 ui-monospace, monospace; }
.week-node b { font-size: .67rem; letter-spacing: .08em; }
.week-node.active, .week-node.pass { color: var(--paper); }
.week-node.active span { border-color: var(--blue); color: var(--blue); }
.week-node.pass span { background: var(--green); border-color: var(--green); color: #07150c; }
.week-track i { height: 1px; background: var(--line); }
.week-track i.pass { background: var(--green); }

.pipeline-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); }
.stage-card { min-height: 142px; padding: 16px; background: #0e100f; position: relative; }
.stage-card + .stage-card { border-left: 1px solid var(--line); }
.stage-card small { color: #515752; font: .6rem/1 ui-monospace, monospace; }
.stage-card h3 { margin: 23px 0 8px; font-size: .85rem; }
.stage-card .status { display: inline-block; color: var(--muted); font: 750 .58rem/1 ui-monospace, monospace; letter-spacing: .06em; }
.stage-card p { margin: 11px 0 0; color: #686e69; font-size: .64rem; line-height: 1.35; }
.stage-card.pass { box-shadow: inset 0 3px var(--green); }
.stage-card.pass .status { color: var(--green); }
.stage-card.no_go, .stage-card.fail { box-shadow: inset 0 3px var(--red); }
.stage-card.no_go .status, .stage-card.fail .status { color: var(--red); }
.stage-card.hold, .stage-card.escalation { box-shadow: inset 0 3px var(--amber); }
.stage-card.hold .status, .stage-card.escalation .status { color: var(--amber); }
.stage-card.locked { opacity: .7; }

.founder-programme { margin-top: 28px; padding: 24px; border: 1px solid #344b3d; background: rgba(28, 46, 35, .35); }
.founder-programme h3 { margin: 0 0 6px; }
.founder-authority { margin: 0 0 18px; color: #8d9890; font: .65rem/1.5 monospace; overflow-wrap: anywhere; }
/* One column: two half-width columns left every digest wrapping onto itself,
   which is what made the governed detail unreadable rather than merely dense. */
.founder-sessions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.founder-sessions article { border: 1px solid var(--line); padding: 14px; background: rgba(0, 0, 0, .18); }
.founder-sessions h4 { margin: 0 0 10px; font-size: .75rem; }
.founder-sessions ol { margin: 0; padding-left: 20px; }
.founder-sessions li { margin: 0 0 9px; color: #b9beba; font-size: .7rem; }
.founder-sessions li span, .founder-sessions li strong, .founder-sessions li small { display: block; }
.founder-sessions li strong { margin-top: 3px; color: #f0f2ef; }
.founder-sessions li small { margin-top: 3px; color: #89aa94; line-height: 1.35; }
.founder-sessions li.exercise { margin: 0 0 16px; padding-bottom: 14px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.founder-sessions li.exercise:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.exercise-name { margin: 0 0 8px; color: #f0f2ef; font-size: .84rem; line-height: 1.3; }
.exercise-essentials, .evidence-fields { display: grid; grid-template-columns: minmax(9.5rem, max-content) minmax(0, 1fr); gap: 4px 14px; margin: 0; }
.exercise-essentials dt, .evidence-fields dt { color: #8d9890; font-size: .66rem; letter-spacing: .04em; text-transform: uppercase; }
.exercise-essentials dd, .evidence-fields dd { margin: 0; color: #dfe3df; font-size: .72rem; line-height: 1.45; overflow-wrap: anywhere; }
.technical-evidence { margin-top: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .22); }
.technical-evidence > summary { padding: 7px 10px; color: #89aa94; font-size: .66rem; letter-spacing: .05em; text-transform: uppercase; cursor: pointer; list-style: none; }
.technical-evidence > summary::-webkit-details-marker { display: none; }
.technical-evidence > summary::before { content: "▸ "; }
.technical-evidence[open] > summary::before { content: "▾ "; }
.technical-evidence > summary:hover { color: #b9d6c3; }
.technical-evidence .evidence-fields { padding: 4px 10px 11px; }
.technical-evidence .evidence-fields dd { color: #9fb6a6; font-family: monospace; font-size: .66rem; }
.founder-gate { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px 28px; margin-top: 28px; padding: 24px; border: 1px solid rgba(7,190,248,.35); background: linear-gradient(135deg, rgba(7,190,248,.1), rgba(7,190,248,.02)); }
.founder-gate h3 { margin: 0 0 9px; }
.founder-gate p:not(.eyebrow) { color: #a7aca7; line-height: 1.5; font-size: .72rem; margin: 0; }
.feedback { margin: 0; }
.check-row { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: 10px; color: #b5bab4; font-size: .72rem; line-height: 1.4; }
.check-row input { width: 17px; height: 17px; flex: 0 0 auto; accent-color: var(--blue); }
.client-workspace { border-top: 1px solid var(--line); }
.client-panel form { display: grid; gap: 14px; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.check-grid label { display: grid; grid-template-columns: 17px minmax(0, 1fr); align-items: center; gap: 9px; color: #aeb4ae; font-size: .67rem; line-height: 1.35; cursor: pointer; }
.check-grid input { width: 17px; height: 17px; margin: 0; padding: 0; accent-color: var(--blue); }
.full-gym-action { width: 100%; margin: 8px 0 10px; padding: 12px 14px; border: 1px solid var(--blue); background: rgba(7,190,248,.10); color: var(--blue); font-size: .68rem; font-weight: 900; letter-spacing: .08em; cursor: pointer; }
.full-gym-action:hover { background: rgba(7,190,248,.18); }
.equipment-note { margin: 0 0 12px; color: #8e9894; font-size: .64rem; line-height: 1.5; }
.equipment-grid { max-height: 310px; overflow-y: auto; padding-right: 6px; }
.evidence-grid { max-height: 270px; overflow: auto; padding-right: 8px; }
.privacy-note { margin: 0 0 16px; padding: 12px; border-left: 2px solid var(--amber); color: #a8aaa7; font-size: .68rem; line-height: 1.5; }
.verdict-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.verdict-actions button { height: 44px; background: transparent; font-size: .68rem; font-weight: 850; letter-spacing: .1em; }
.verdict-actions .fail { color: var(--red); border: 1px solid #653434; }
.verdict-actions .pass { color: #0b160e; border: 1px solid var(--green); background: var(--green); }
.field-hint { margin: -14px 0 20px; color: #9aa09a; font-size: .74rem; line-height: 1.5; }
.field-hint code { color: var(--paper); font-size: .72rem; }
.hidden { display: none !important; }

.trace-detail { margin-top: 22px; border-top: 1px solid var(--line); }
.trace-detail summary { list-style: none; padding: 18px 0; display: flex; justify-content: space-between; cursor: pointer; color: #a4aaa4; font-size: .7rem; }
.trace-detail summary::-webkit-details-marker { display: none; }
.trace-detail pre { margin: 0; padding: 18px; max-height: 440px; overflow: auto; background: #070808; border: 1px solid var(--line); color: #aeb7ad; font: .65rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

.history-section { padding: 42px 0 20px; }
.storage-path { margin-left: auto; max-width: 48%; color: #6e756f; font: .58rem/1.4 ui-monospace, monospace; text-align: right; overflow-wrap: anywhere; }
.history-list { border-top: 1px solid var(--line); }
.history-subheading { display: flex; justify-content: space-between; gap: 20px; margin-top: 34px; padding: 0 10px 12px; color: #707771; font-size: .58rem; letter-spacing: .12em; }
.history-subheading p { margin: 0; color: var(--green); }
.matrix-history-row { grid-template-columns: 1.15fr .45fr .65fr .65fr .85fr; }
.history-row { width: 100%; display: grid; grid-template-columns: 1.15fr .75fr .65fr .65fr .85fr; align-items: center; gap: 16px; padding: 16px 10px; color: var(--paper); border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.history-row:hover { background: var(--panel); }
.history-row code { color: #aeb4ae; font-size: .66rem; }
.history-row span { color: var(--muted); font-size: .7rem; }
.history-row strong { justify-self: end; font: 800 .62rem/1 ui-monospace, monospace; color: var(--amber); }
.history-row strong.pass { color: var(--green); }
.history-row strong.no_go, .history-row strong.fail { color: var(--red); }
.empty { color: #686e69; padding: 24px 10px; font-size: .75rem; }
footer { display: flex; justify-content: space-between; padding: 24px 42px; border-top: 1px solid var(--line); color: #5f665f; font-size: .55rem; letter-spacing: .12em; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .control-panel { border-right: 0; border-bottom: 1px solid var(--line); padding-right: 0; }
  .results-panel { padding-left: 0; }
  .pipeline-grid { grid-template-columns: repeat(2, 1fr); }
  .matrix-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-card:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .stage-card:nth-child(4) { border-top: 1px solid var(--line); }
}

@media (max-width: 680px) {
  .topbar, main, footer { padding-inline: 20px; }
  .hero { min-height: 260px; align-items: flex-start; flex-direction: column; padding-block: 42px; }
  h1 { font-size: 3.5rem; }
  .runtime-state { max-width: 115px; text-align: right; }
  .week-track { grid-template-columns: 1fr 18px 1fr 18px 1fr; }
  .week-node { flex-direction: column; align-items: flex-start; }
  .pipeline-grid, .founder-sessions { grid-template-columns: 1fr; }
  .matrix-grid { grid-template-columns: 1fr; }
  .stage-card + .stage-card { border-left: 0; border-top: 1px solid var(--line); }
  .founder-gate { grid-template-columns: 1fr; }
  .check-row, .verdict-actions { grid-column: 1; }
  .history-row { grid-template-columns: 1fr auto; }
  .history-row span:nth-of-type(n+2) { display: none; }
  .storage-path { display: none; }
  footer { flex-direction: column; gap: 10px; }
}
 #hosted-login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ink); color: var(--paper); }
#hosted-login.hidden { display: none; }
#hosted-login form { width: min(440px, 100%); padding: 32px; border: 1px solid var(--line); background: var(--panel); }
#hosted-login h1 { font-size: 2.2rem; }
#hosted-login-error { color: var(--red); min-height: 1.3em; }
