:root {
  --bg: #141210;
  --bg-raised: #1c1917;
  --bg-card: #1a1714;
  --border: #2d2925;
  --border-bright: #484038;
  --orange: #f97316;
  --orange-dim: #7c3910;
  --orange-glow: rgba(249, 115, 22, .14);
  --green: #4ade80;
  --yellow: #fbbf24;
  --red: #f87171;
  --blue: #60a5fa;
  --text: #e7e0d5;
  --text-muted: #9b8f83;
  --text-dim: #625b54;
  --mono: "IBM Plex Mono", monospace;
  --sans: "IBM Plex Sans", sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--sans); }
button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
.grid-noise { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .42; background-image: linear-gradient(rgba(255,255,255,.025) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.025) 1px,transparent 1px); background-size: 28px 28px; }
.skip-link { position: fixed; left: 12px; top: -80px; z-index: 1000; padding: 12px 16px; color: var(--bg); background: var(--orange); font-weight: 700; }
.skip-link:focus { top: 12px; }
.kicker { display: block; color: var(--orange); font: 700 10px/1.3 var(--mono); letter-spacing: .16em; text-transform: uppercase; }

.topbar { position: sticky; top: 0; z-index: 80; min-height: 72px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; padding: 12px 24px; border-bottom: 1px solid var(--border-bright); background: rgba(20,18,16,.94); backdrop-filter: blur(18px); }
.back-link { display: inline-flex; align-items: center; gap: 8px; width: max-content; color: var(--text-muted); text-decoration: none; font: 600 12px var(--mono); }
.back-link:hover { color: var(--orange); }
.brand-lockup { text-align: center; }
.brand-lockup strong { display: block; margin-top: 3px; font-size: 14px; }
.brand-id { color: var(--orange); font: 700 9px var(--mono); letter-spacing: .14em; }
.session-status { justify-self: end; display: flex; align-items: center; gap: 8px; color: var(--text-muted); font: 600 10px var(--mono); text-transform: uppercase; }
.status-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 6px rgba(74,222,128,.1); animation: pulse 2.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 11px rgba(74,222,128,0); } }

.command-shell { min-height: calc(100dvh - 72px); display: grid; grid-template-columns: 238px minmax(480px, 1fr) 330px; }
.site-rail, .decision-desk { background: rgba(26,23,20,.92); }
.site-rail { border-right: 1px solid var(--border-bright); padding: 24px 18px; }
.rail-heading h1 { margin: 7px 0 5px; font: 600 18px/1.15 var(--mono); }
.rail-heading p, .rail-note p { margin: 0; color: var(--text-muted); font-size: 12px; }
.building-map { position: relative; height: 230px; margin: 22px 0 16px; overflow: hidden; border: 1px solid var(--border-bright); background: #efe9dd; }
.building-map img { width: 100%; height: 100%; object-fit: contain; filter: sepia(.12) contrast(.94); }
.floor-marker { position: absolute; right: 10px; min-width: 34px; padding: 4px 6px; border: 1px solid #163e63; color: #163e63; background: rgba(255,255,255,.82); font: 700 9px var(--mono); text-align: center; }
.floor-marker-8 { top: 13%; } .floor-marker-6 { top: 35%; } .floor-marker-1 { bottom: 9%; }
.floor-marker.active { color: #fff; border-color: var(--orange); background: var(--orange); box-shadow: 0 0 0 5px rgba(249,115,22,.18); }
.layer-list { border-top: 1px solid var(--border); }
.layer-row { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; min-height: 45px; border-bottom: 1px solid var(--border); font: 600 11px var(--mono); }
.layer-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); }
.layer-row[data-tone="clear"] .layer-dot { background: var(--green); }
.layer-row[data-tone="watch"] .layer-dot { background: var(--yellow); }
.layer-row[data-tone="constrained"] .layer-dot { background: var(--orange); }
.layer-row[data-tone="blocked"] .layer-dot { background: var(--red); }
.layer-value { color: var(--text-muted); font-size: 10px; text-align: right; }
.rail-note { margin-top: 22px; padding: 13px; border-left: 2px solid var(--orange); background: var(--orange-glow); }

.scenario-stage { min-width: 0; padding: 28px clamp(20px,3vw,44px) 42px; }
.stage-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.stage-heading h2 { margin: 7px 0 0; font: 600 clamp(26px,3vw,42px)/1 var(--sans); letter-spacing: -.04em; }
.text-button { border: 0; border-bottom: 1px solid var(--text-dim); padding: 4px 0; color: var(--text-muted); background: transparent; cursor: pointer; font: 600 10px var(--mono); text-transform: uppercase; }
.text-button:hover { color: var(--orange); border-color: var(--orange); }
.timeline { display: grid; grid-template-columns: repeat(5,1fr); gap: 4px; margin: 27px 0 20px; padding: 0; list-style: none; }
.timeline li { position: relative; min-width: 0; padding: 0 5px 13px; border-bottom: 2px solid var(--border-bright); color: var(--text-dim); text-align: center; font: 700 9px/1.35 var(--mono); text-transform: uppercase; }
.timeline li::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--border-bright); transform: translateX(-50%); }
.timeline li.active { color: var(--orange); border-color: var(--orange); }
.timeline li.active::after { background: var(--orange); box-shadow: 0 0 0 4px rgba(249,115,22,.16); }
.timeline li.complete { color: var(--text-muted); border-color: var(--green); }
.timeline li.complete::after { background: var(--green); }
.timeline time { display: block; margin-bottom: 2px; color: inherit; font-size: 12px; }

.signal-card { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; min-height: 108px; padding: 16px 18px; border: 1px solid var(--border-bright); border-left: 4px solid var(--blue); background: var(--bg-card); }
.signal-card[data-tone="watch"] { border-left-color: var(--yellow); }
.signal-card[data-tone="constrained"] { border-left-color: var(--orange); background: linear-gradient(90deg,rgba(249,115,22,.1),transparent 45%),var(--bg-card); }
.signal-card[data-tone="clear"] { border-left-color: var(--green); }
.signal-icon { font-size: 30px; color: var(--orange); }
.signal-card h3 { margin: 4px 0 3px; font-size: 16px; line-height: 1.25; }
.signal-card p { margin: 0; color: var(--text-muted); font-size: 13px; }
.signal-badge { padding: 6px 8px; border: 1px solid var(--border-bright); color: var(--text-muted); font: 700 9px var(--mono); text-transform: uppercase; }

.site-canvas { position: relative; height: clamp(270px,34vw,440px); margin-top: 14px; overflow: hidden; border: 1px solid var(--border-bright); background: #b9b3a9; }
.site-canvas > img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.7) contrast(1.05) brightness(.76); }
.canvas-wash { position: absolute; inset: 0; background: linear-gradient(180deg,rgba(8,16,22,.08),rgba(8,16,22,.42)); pointer-events: none; }
.work-zone { position: absolute; padding: 8px 10px; border: 1px solid currentColor; background: rgba(20,18,16,.83); box-shadow: 0 8px 24px rgba(0,0,0,.24); color: var(--text); font: 600 9px/1.3 var(--mono); text-transform: uppercase; }
.work-zone::before { content: ""; position: absolute; inset: -8px; border: 1px dashed currentColor; opacity: .45; }
.work-zone span, .work-zone strong { display: block; }
.work-zone strong { margin-top: 2px; color: var(--orange); font-size: 11px; }
.work-zone-exterior { left: 29%; top: 33%; color: var(--orange); }
.work-zone-cooling { left: 9%; bottom: 14%; color: var(--green); }
.work-zone-delivery { right: 8%; bottom: 18%; color: var(--blue); }
.canvas-alert { position: absolute; top: 14px; right: 14px; display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; align-items: center; min-width: 190px; padding: 10px 12px; border: 1px solid var(--border-bright); background: rgba(20,18,16,.92); font: 600 10px var(--mono); }
.canvas-alert > span:last-child { grid-column: 2; color: var(--text-muted); font-size: 9px; }
.alert-ring { grid-row: 1/3; width: 13px; height: 13px; border: 3px solid var(--yellow); border-radius: 50%; box-shadow: 0 0 0 5px rgba(251,191,36,.12); }

.planner-output { display: grid; grid-template-columns: 1.1fr 2fr auto; align-items: center; gap: 18px; margin-top: 14px; padding: 16px; border: 1px solid var(--border-bright); background: var(--bg-card); }
.planner-output h3 { margin: 4px 0 0; font-size: 14px; line-height: 1.3; }
.planner-metrics { display: grid; grid-template-columns: repeat(4,1fr); border-left: 1px solid var(--border); }
.planner-metrics div { padding: 4px 12px; border-right: 1px solid var(--border); }
.planner-metrics span, .planner-metrics strong, .planner-metrics small { display: block; }
.planner-metrics span, .planner-metrics small { color: var(--text-muted); font: 600 8px var(--mono); text-transform: uppercase; }
.planner-metrics strong { margin: 3px 0; font: 700 17px var(--mono); }
.secondary-button, .primary-button { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; border: 1px solid var(--orange); padding: 11px 15px; cursor: pointer; text-decoration: none; font: 700 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.secondary-button { color: var(--orange); background: transparent; }
.secondary-button:hover { color: var(--bg); background: var(--orange); }
.primary-button { color: #160c04; background: var(--orange); }
.primary-button:hover { background: #fb923c; }
.phase-action { display: flex; justify-content: flex-end; margin-top: 14px; }

.decision-desk { border-left: 1px solid var(--border-bright); padding: 26px 20px; }
.desk-heading h2 { margin: 7px 0 6px; font-size: 22px; }
.desk-heading p { margin: 0; color: var(--text-muted); font-size: 12px; }
.condition-strip { display: flex; justify-content: space-between; margin: 20px 0 14px; padding: 9px 11px; border: 1px solid var(--border); color: var(--text-muted); font: 600 10px var(--mono); text-transform: uppercase; }
.condition-strip strong { color: var(--yellow); }
.decision-panel { display: grid; gap: 9px; }
.desk-note { margin: 0; padding: 15px; border: 1px solid var(--border); color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.choice-card { display: grid; grid-template-columns: 24px 1fr; gap: 9px; width: 100%; min-height: 78px; padding: 12px; border: 1px solid var(--border-bright); color: var(--text); background: #211e1b; text-align: left; cursor: pointer; }
.choice-card:hover { border-color: var(--orange); background: var(--orange-glow); }
.choice-card.selected { border-color: var(--orange); box-shadow: inset 3px 0 var(--orange); background: var(--orange-glow); }
.choice-index { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--border-bright); color: var(--text-muted); font: 700 10px var(--mono); }
.choice-card.selected .choice-index { color: var(--bg); border-color: var(--orange); background: var(--orange); }
.choice-card strong, .choice-card small { display: block; }
.choice-card strong { font-size: 13px; }
.choice-card small { margin-top: 4px; color: var(--text-muted); font-size: 11px; line-height: 1.35; }
.confirm-plan { width: 100%; margin-top: 2px; }
.confirm-plan:disabled { cursor: not-allowed; opacity: .38; }
.impact-panel { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 15px; }
.panel-title-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.panel-title-row h3 { margin: 0; font: 700 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.panel-title-row span { color: var(--text-dim); font: 600 8px var(--mono); text-transform: uppercase; }
.impact-list { margin-top: 9px; }
.impact-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 11px; }
.impact-row span { color: var(--text-muted); }
.impact-row strong[data-tone="clear"] { color: var(--green); }
.impact-row strong[data-tone="watch"] { color: var(--yellow); }
.impact-row strong[data-tone="constrained"] { color: var(--orange); }
.impact-row strong[data-tone="blocked"] { color: var(--red); }
.coordination-list { display: grid; gap: 9px; }
.coordination-check { display: grid; grid-template-columns: 20px 1fr; gap: 9px; width: 100%; min-height: 56px; align-items: center; padding: 10px; border: 1px solid var(--border-bright); background: #211e1b; text-align: left; cursor: pointer; }
.coordination-check[aria-pressed="true"] { border-color: var(--green); background: rgba(74,222,128,.08); }
.check-box { display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid var(--text-dim); font: 700 11px var(--mono); }
.coordination-check[aria-pressed="true"] .check-box { color: var(--bg); border-color: var(--green); background: var(--green); }
.debrief { padding: 15px; border: 1px solid var(--green); background: rgba(74,222,128,.07); }
.debrief h3 { margin: 4px 0 7px; font-size: 16px; }
.debrief p { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.5; }

.evidence-dock { display: grid; grid-template-columns: minmax(220px,.8fr) 2fr; gap: 30px; padding: 28px clamp(20px,4vw,60px); border-top: 1px solid var(--border-bright); border-bottom: 1px solid var(--border); background: #efe9dd; color: #14283b; }
.evidence-dock h2 { margin: 6px 0 0; font-size: 20px; }
.evidence-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.evidence-card { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; min-height: 76px; padding: 12px; border: 1px solid #a5afb2; color: #14283b; background: #f9f6ef; text-decoration: none; transition: transform .2s,border-color .2s; }
.evidence-card:hover { transform: translateY(-3px); border-color: var(--orange); }
.evidence-card strong, .evidence-card small { display: block; }
.evidence-card strong { font-size: 13px; }
.evidence-card small { margin-top: 3px; color: #64727b; font-size: 10px; }
.evidence-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; background: var(--orange); }
.disclaimer { padding: 16px clamp(20px,4vw,60px) 26px; color: var(--text-muted); background: var(--bg); font-size: 11px; }
.disclaimer p { max-width: 980px; margin: 0; }

dialog { color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.82); backdrop-filter: blur(6px); }
.scenario-dialog { width: min(920px,calc(100vw - 32px)); padding: 0; border: 1px solid var(--border-bright); background: var(--bg-raised); box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.dialog-grid { display: grid; grid-template-columns: 1fr 1fr; }
.dialog-map { position: relative; min-height: 430px; background: #090807; overflow: hidden; }
.dialog-map img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.62) saturate(.75); }
.dialog-map::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 80px rgba(0,0,0,.6); }
.dialog-map-label { position: absolute; left: 20px; bottom: 20px; z-index: 2; padding: 8px 10px; border: 1px solid var(--orange); color: var(--orange); background: rgba(20,18,16,.88); font: 700 9px var(--mono); letter-spacing: .12em; }
.dialog-copy { display: flex; flex-direction: column; justify-content: center; padding: clamp(28px,5vw,54px); }
.dialog-copy h2 { margin: 9px 0 14px; font-size: clamp(32px,5vw,52px); line-height: .98; letter-spacing: -.05em; }
.dialog-copy p, .dialog-copy li { color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.dialog-copy ul { margin: 12px 0 24px; padding-left: 18px; }
.planner-dialog { width: min(760px,calc(100vw - 32px)); padding: clamp(24px,4vw,42px); border: 1px solid var(--border-bright); background: var(--bg-raised); }
.dialog-close { position: absolute; right: 14px; top: 14px; width: 38px; height: 38px; border: 1px solid var(--border-bright); color: var(--text-muted); background: transparent; cursor: pointer; font-size: 23px; }
.planner-dialog h2 { margin: 8px 0; font-size: 30px; }
.planner-lede { max-width: 650px; color: var(--text-muted); }
.brief-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 16px; margin: 22px 0; }
.brief-grid section { padding: 16px; border: 1px solid var(--border); background: var(--bg-card); }
.brief-grid h3 { margin: 0 0 12px; font: 700 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.brief-grid dl { margin: 0; }
.brief-grid dl div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.brief-grid dt { color: var(--text-muted); }
.brief-grid dd { margin: 0; text-align: right; }
.brief-grid ul { margin: 0; padding-left: 18px; color: var(--text-muted); }
.brief-grid li { margin: 0 0 8px; }

@media (max-width: 1180px) {
  .command-shell { grid-template-columns: 190px minmax(420px,1fr) 290px; }
  .planner-output { grid-template-columns: 1fr; }
  .planner-metrics { border-left: 0; }
}

@media (max-width: 920px) {
  .topbar { grid-template-columns: 1fr auto; }
  .brand-lockup { display: none; }
  .command-shell { display: block; }
  .site-rail { border-right: 0; border-bottom: 1px solid var(--border-bright); padding: 16px; }
  .rail-heading, .building-map, .rail-note { display: none; }
  .layer-list { display: grid; grid-template-columns: repeat(5,minmax(120px,1fr)); gap: 8px; overflow-x: auto; border: 0; padding-bottom: 4px; }
  .layer-row { min-height: 48px; padding: 0 9px; border: 1px solid var(--border); }
  .scenario-stage { padding-top: 22px; }
  .decision-desk { border-top: 1px solid var(--border-bright); border-left: 0; }
  .evidence-dock { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .topbar { min-height: 60px; padding: 10px 14px; }
  .session-status span:last-child { display: none; }
  .command-shell { min-height: calc(100dvh - 60px); }
  .stage-heading { align-items: start; }
  .stage-heading h2 { font-size: 29px; }
  .text-button { font-size: 8px; }
  .timeline { margin-top: 22px; overflow-x: auto; grid-template-columns: repeat(5,92px); }
  .signal-card { grid-template-columns: 34px 1fr; padding: 14px; }
  .signal-icon { font-size: 25px; }
  .signal-badge { grid-column: 2; width: max-content; }
  .site-canvas { height: 300px; }
  .work-zone { padding: 7px; }
  .work-zone-exterior { left: 18%; top: 35%; }
  .work-zone-delivery { right: 4%; }
  .canvas-alert { top: 8px; right: 8px; min-width: 165px; }
  .planner-metrics { grid-template-columns: 1fr 1fr; }
  .planner-metrics div { border-bottom: 1px solid var(--border); }
  .evidence-cards { grid-template-columns: 1fr; }
  .dialog-grid, .brief-grid { grid-template-columns: 1fr; }
  .dialog-map { min-height: 170px; }
  .dialog-copy { padding: 26px 22px; }
  .dialog-copy h2 { font-size: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
