:root {
  color-scheme: light;
  --paper: #f3f1eb;
  --paper-warm: #ebe8df;
  --surface: #fbfaf6;
  --surface-raised: #ffffff;
  --ink: #172027;
  --ink-soft: #46535b;
  --ink-muted: #748087;
  --line: #c9c9c2;
  --line-dark: #9da3a3;
  --line-faint: #deded8;
  --blue: #1f4f67;
  --blue-dark: #173b4c;
  --blue-pale: #dbe7eb;
  --copper: #ad5e34;
  --copper-pale: #f0dfd3;
  --green: #39715b;
  --green-pale: #dce9e2;
  --amber: #a66e19;
  --amber-pale: #f2e7cc;
  --red: #a23d34;
  --red-dark: #812f29;
  --red-pale: #f0dcda;
  --mono: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --topbar-h: 68px;
  --footer-h: 27px;
  --left-rail: 264px;
  --right-rail: 324px;
  --telemetry-h: 286px;
  --focus: #2b6f92;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

html {
  background: var(--paper);
}

body {
  min-width: 320px;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
select,
input[type="range"],
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
}

button {
  border: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

::selection {
  color: #fff;
  background: var(--blue);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 9px 13px;
  color: #fff;
  background: var(--blue-dark);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--footer-h);
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: var(--paper);
}

/* Top application bar */
.topbar {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: max-content minmax(210px, 1fr) max-content max-content;
  align-items: stretch;
  min-width: 0;
  border-bottom: 1px solid var(--line-dark);
  background: var(--surface);
  box-shadow: 0 1px 0 rgb(255 255 255 / 80%);
}

.brand-lockup {
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-right: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}

.brand-wordmark {
  display: block;
  width: auto;
  height: 16px;
  object-fit: contain;
}

.prototype-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0 20px;
  border-right: 1px solid var(--line);
}

.eyebrow,
.section-kicker {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.prototype-name {
  margin: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.prototype-subtitle {
  overflow: hidden;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.revision-tag,
.route-code,
.drawing-number,
.channel-count {
  padding: 2px 5px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.primary-nav {
  display: flex;
  align-items: stretch;
  height: 100%;
  border-left: 1px solid var(--line);
}

.primary-nav a {
  display: grid;
  place-items: center;
  min-width: 70px;
  padding: 0 14px;
  color: var(--ink-soft);
  text-decoration: none;
  border-right: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
}

.primary-nav a:hover {
  color: var(--ink);
  background: var(--paper-warm);
}

.topbar-actions {
  display: flex;
  align-items: stretch;
}

.status-button,
.disclosure-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-left: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.status-button:hover,
.disclosure-button:hover {
  background: var(--paper-warm);
}

.status-button__copy {
  display: grid;
  line-height: 1.15;
}

.status-button__copy span {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-button__copy strong {
  font-size: 11px;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border: 1px solid var(--blue);
  border-radius: 50%;
  background: var(--blue-pale);
  box-shadow: inset 0 0 0 2px var(--surface);
}

.status-dot--simulated {
  background: var(--blue);
}

.disclosure-button > span:first-child {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--copper);
  color: var(--copper);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
}

.disclosure-button > span:last-child {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Main workbench grid */
.workspace {
  position: relative;
  display: grid;
  grid-template-columns: var(--left-rail) minmax(360px, 1fr) var(--right-rail);
  grid-template-rows: minmax(260px, 1fr) var(--telemetry-h);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.process-rail,
.control-rail,
.telemetry-drawer {
  position: relative;
  z-index: 10;
  background: var(--surface);
}

.process-rail {
  grid-column: 1;
  grid-row: 1;
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--line-dark);
}

.control-rail {
  grid-column: 3;
  grid-row: 1;
  min-height: 0;
  overflow: auto;
  border-left: 1px solid var(--line-dark);
  scrollbar-width: thin;
  scrollbar-color: var(--line-dark) transparent;
}

.rail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 16px 13px;
  border-bottom: 1px solid var(--line);
}

.rail-heading h1,
.panel-title-row h2 {
  margin: 3px 0 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.batch-ticket {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  margin: 12px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.batch-ticket > span:first-child {
  color: var(--ink-muted);
}

.batch-ticket > strong {
  font-size: 10px;
}

.batch-ticket__mass {
  grid-column: 1 / -1;
  margin-top: 4px;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}

.process-steps {
  position: relative;
  display: grid;
  padding: 3px 0 8px;
}

.process-steps::before {
  position: absolute;
  z-index: 0;
  top: 24px;
  bottom: 28px;
  left: 32px;
  width: 1px;
  content: "";
  background: var(--line-dark);
}

.process-step {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 39px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 57px;
  padding: 7px 12px;
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
  background: transparent;
  text-align: left;
}

.process-step:hover {
  background: var(--paper);
}

.process-step.is-active {
  border-color: var(--line);
  background: var(--paper);
}

.process-step.is-active::after {
  position: absolute;
  top: -1px;
  right: 0;
  bottom: -1px;
  width: 3px;
  content: "";
  background: var(--copper);
}

.process-step__index {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  color: var(--ink-soft);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
}

.process-step.is-active .process-step__index {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.process-step--branch .process-step__index {
  border-style: dashed;
  color: var(--copper);
}

.process-step__copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.process-step__copy strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.process-step__copy small {
  overflow: hidden;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 8px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.process-step__state {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.process-step__state[data-step-state="ready"] {
  color: var(--green);
}

.route-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 13px;
  margin: 8px 13px 15px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.route-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.stream-line {
  display: block;
  width: 15px;
  border-top: 2px solid var(--ink-soft);
}

.stream-line--liquid {
  border-top-style: dashed;
  border-top-color: var(--blue);
}

/* Three.js viewer */
.viewer-workspace {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #e7e7e1;
}

.viewer {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 260px;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(rgb(255 255 255 / 45%), rgb(255 255 255 / 8%)),
    #e3e4df;
}

#twin-canvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.station-label-layer {
  position: absolute;
  z-index: 6;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.model-station-label {
  position: absolute;
  display: flex;
  align-items: center;
  min-width: max-content;
  overflow: hidden;
  border: 1px solid rgb(54 67 72 / 45%);
  border-radius: 2px;
  background: rgb(250 250 247 / 94%);
  box-shadow: 0 2px 8px rgb(28 39 43 / 12%);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.model-station-label[hidden] {
  display: none;
}

.model-station-label span {
  padding: 5px 6px;
  background: var(--ink);
  color: #fff;
}

.model-station-label strong {
  padding: 5px 7px;
  font-size: inherit;
  font-weight: 700;
}

.model-station-label.is-active {
  border-color: var(--copper);
  box-shadow: 0 0 0 1px rgb(176 96 50 / 14%), 0 3px 12px rgb(28 39 43 / 15%);
}

.model-station-label.is-active span {
  background: var(--copper);
}

.viewer-grid {
  position: absolute;
  z-index: 0;
  inset: 0;
  opacity: 0.42;
  background-image:
    linear-gradient(rgb(73 87 93 / 9%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(73 87 93 / 9%) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, transparent 0, #000 36%, #000 100%);
  pointer-events: none;
}

.viewer-grid::after {
  position: absolute;
  right: 0;
  bottom: 24%;
  left: 0;
  height: 1px;
  content: "";
  background: rgb(54 67 72 / 24%);
}

.viewer-empty-state {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.viewer-empty-state[hidden] {
  display: none;
}

.viewer-empty-state small {
  color: var(--ink-muted);
  font-size: 8px;
}

.technical-spinner {
  position: relative;
  width: 42px;
  height: 42px;
  margin-bottom: 5px;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
}

.technical-spinner::before,
.technical-spinner::after {
  position: absolute;
  content: "";
}

.technical-spinner::before {
  inset: 6px;
  border: 2px solid transparent;
  border-top-color: var(--copper);
  border-right-color: var(--copper);
  border-radius: 50%;
  animation: technical-spin 1.2s linear infinite;
}

.technical-spinner::after {
  top: 50%;
  left: -4px;
  width: 48px;
  height: 1px;
  background: var(--line-dark);
}

@keyframes technical-spin {
  to { transform: rotate(360deg); }
}

.viewer-toolbar,
.view-presets,
.scale-reference,
.viewer-help,
.viewer-orientation {
  position: absolute;
  z-index: 4;
}

.viewer-toolbar {
  top: 12px;
  left: 12px;
  display: flex;
  border: 1px solid var(--line-dark);
  background: rgb(251 250 246 / 92%);
  box-shadow: 0 1px 4px rgb(23 32 39 / 8%);
}

.viewer-toolbar button {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 9px;
  border-right: 1px solid var(--line);
  color: var(--ink-soft);
  background: transparent;
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
}

.viewer-toolbar button:last-child {
  border-right: 0;
}

.viewer-toolbar button:hover,
.viewer-toolbar button.is-pressed {
  color: var(--blue-dark);
  background: var(--blue-pale);
}

.viewer-toolbar svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view-presets {
  top: 12px;
  right: 12px;
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line-dark);
  background: rgb(251 250 246 / 92%);
}

.control-label {
  display: grid;
  place-items: center;
  padding: 0 8px;
  border-right: 1px solid var(--line);
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.view-presets button {
  padding: 7px 8px;
  border-right: 1px solid var(--line);
  background: transparent;
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.view-presets button:last-child {
  border-right: 0;
}

.view-presets button:hover,
.view-presets button.is-active {
  color: #fff;
  background: var(--blue);
}

.hover-tooltip {
  position: absolute;
  z-index: 20;
  display: grid;
  min-width: 185px;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid var(--ink);
  background: rgb(251 250 246 / 97%);
  box-shadow: 4px 4px 0 rgb(23 32 39 / 10%);
  pointer-events: none;
}

.hover-tooltip[hidden] {
  display: none;
}

.hover-tooltip__id {
  color: var(--copper);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
}

.hover-tooltip strong {
  font-size: 11px;
}

.hover-tooltip > span:last-child {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 8px;
}

.viewer-orientation {
  right: 17px;
  bottom: 40px;
  width: 49px;
  height: 49px;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  background: rgb(251 250 246 / 80%);
}

.viewer-orientation::before,
.viewer-orientation::after {
  position: absolute;
  bottom: 23px;
  left: 23px;
  content: "";
  transform-origin: 0 50%;
}

.viewer-orientation::before {
  width: 17px;
  height: 1px;
  background: var(--red);
}

.viewer-orientation::after {
  width: 14px;
  height: 1px;
  background: var(--blue);
  transform: rotate(-120deg);
}

.axis {
  position: absolute;
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 600;
}

.axis--x { top: 20px; right: 5px; color: var(--red); }
.axis--y { top: 4px; left: 21px; color: var(--green); }
.axis--z { bottom: 4px; left: 6px; color: var(--blue); }

.scale-reference {
  right: 78px;
  bottom: 44px;
  width: 72px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 7px;
  text-align: center;
}

.scale-reference span {
  display: block;
  height: 6px;
  border: solid var(--ink-soft);
  border-width: 0 1px 1px;
}

.viewer-help {
  right: 12px;
  bottom: 11px;
  margin: 0;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Right control rail */
.mode-switcher {
  position: sticky;
  z-index: 8;
  top: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line-dark);
  background: var(--surface);
}

.mode-switcher button {
  min-height: 39px;
  border-right: 1px solid var(--line);
  color: var(--ink-muted);
  background: transparent;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mode-switcher button:last-child {
  border-right: 0;
}

.mode-switcher button:hover {
  color: var(--ink);
  background: var(--paper);
}

.mode-switcher button.is-active {
  color: #fff;
  background: var(--blue);
}

.control-panel {
  padding: 14px;
  border-bottom: 1px solid var(--line-dark);
}

.control-panel[hidden] {
  display: none;
}

.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}

.interlock-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
}

.interlock-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.range-control {
  margin: 13px 0 16px;
}

.range-control__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.range-control__heading label {
  font-size: 11px;
  font-weight: 600;
}

.range-control output {
  min-width: 42px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  color: var(--blue-dark);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 10px;
  text-align: right;
}

input[type="range"] {
  width: 100%;
  height: 18px;
  margin: 0;
  appearance: none;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border: 1px solid var(--line-dark);
  background: var(--paper-warm);
}

input[type="range"]::-webkit-slider-thumb {
  width: 13px;
  height: 17px;
  margin-top: -8px;
  appearance: none;
  border: 1px solid var(--blue-dark);
  border-radius: 0;
  background: var(--surface);
  box-shadow: inset 0 -4px 0 var(--blue);
}

input[type="range"]::-moz-range-track {
  height: 3px;
  border: 1px solid var(--line-dark);
  background: var(--paper-warm);
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 17px;
  border: 1px solid var(--blue-dark);
  border-radius: 0;
  background: var(--surface);
  box-shadow: inset 0 -4px 0 var(--blue);
}

.range-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 7px;
}

.button-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.button {
  min-height: 33px;
  padding: 0 11px;
  border: 1px solid var(--line-dark);
  font-size: 10px;
  font-weight: 600;
}

.button--primary {
  border-color: var(--blue-dark);
  color: #fff;
  background: var(--blue);
}

.button--primary:hover {
  background: var(--blue-dark);
}

.button--secondary {
  background: var(--surface);
}

.button--secondary:hover {
  background: var(--paper-warm);
}

.button--command {
  width: 100%;
  border-color: var(--copper);
  color: var(--copper);
  background: var(--surface);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.button--command:hover {
  color: #fff;
  background: var(--copper);
}

.geometry-readout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 13px 0 0;
  border: 1px solid var(--line);
}

.geometry-readout > div {
  padding: 7px;
  border-right: 1px solid var(--line);
}

.geometry-readout > div:last-child {
  border-right: 0;
}

.geometry-readout dt {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
}

.geometry-readout dd {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
}

.build-sequence {
  margin: 14px 0;
  padding: 9px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.sequence-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.sequence-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line-dark);
}

.sequence-controls button {
  height: 30px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--mono);
}

.sequence-controls button:last-child {
  border-right: 0;
}

.sequence-controls button:hover {
  color: #fff;
  background: var(--blue);
}

.visibility-controls {
  display: grid;
  gap: 0;
  padding: 0;
  border: 1px solid var(--line);
}

.visibility-controls legend {
  margin-left: 7px;
  padding: 0 4px;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.visibility-controls label,
.channel-list label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line-faint);
  font-size: 10px;
}

.visibility-controls label:last-child,
.channel-list label:last-child {
  border-bottom: 0;
}

input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0;
  border-radius: 0;
  accent-color: var(--blue);
}

.channel-list {
  border: 1px solid var(--line);
}

.channel-list label > span {
  display: flex;
  flex: 1;
  gap: 6px;
}

.channel-list b {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 8px;
}

.channel-list i {
  font-family: var(--mono);
  font-size: 7px;
  font-style: normal;
  text-transform: uppercase;
}

.quality-good { color: var(--green); }
.quality-sim { color: var(--blue); }

.utility-panel,
.ai-panel,
.validation-panel {
  background: var(--surface);
}

.connection-state,
.review-badge,
.validation-state {
  padding: 3px 5px;
  border: 1px solid currentColor;
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.connection-state--simulated {
  color: var(--blue);
  background: var(--blue-pale);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 10px;
  border: 1px solid var(--line-dark);
}

.segmented-control label {
  border-right: 1px solid var(--line);
}

.segmented-control label:last-child {
  border-right: 0;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: grid;
  min-height: 34px;
  padding: 3px;
  place-items: center;
  color: var(--ink-muted);
  font-size: 8px;
  text-align: center;
}

.segmented-control input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.segmented-control input:checked + span {
  color: #fff;
  background: var(--blue);
}

.link-activity {
  display: grid;
  grid-template-columns: 1fr 1fr 1.35fr;
  border: 1px solid var(--line);
}

.link-activity > div {
  display: grid;
  gap: 3px;
  padding: 7px;
  border-right: 1px solid var(--line);
}

.link-activity > div:last-child {
  border-right: 0;
}

.link-activity span {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
}

.link-activity strong {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
}

.activity-led {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

.activity-led--idle {
  background: var(--line-dark);
}

.source-notice {
  display: grid;
  gap: 2px;
  margin: 9px 0;
  padding: 8px 9px;
  border-left: 3px solid;
}

.source-notice strong {
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.source-notice span {
  font-size: 9px;
}

.source-notice--simulation {
  border-color: var(--blue);
  background: var(--blue-pale);
}

.setpoint-form {
  display: grid;
  gap: 7px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.setpoint-form > label,
.setpoint-entry > label,
.ai-prompt-form > label {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

select,
input[type="number"],
input[type="text"] {
  min-height: 31px;
  border: 1px solid var(--line-dark);
  border-radius: 0;
  color: var(--ink);
  background: var(--surface-raised);
}

select {
  padding: 0 28px 0 8px;
}

.setpoint-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 7px;
}

.setpoint-entry > div {
  display: flex;
  align-items: stretch;
}

.setpoint-entry input {
  width: 80px;
  padding: 0 7px;
  font-family: var(--mono);
}

.setpoint-entry div span {
  display: grid;
  min-width: 34px;
  place-items: center;
  border: solid var(--line-dark);
  border-width: 1px 1px 1px 0;
  color: var(--ink-muted);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 9px;
}

.review-badge {
  color: var(--copper);
  background: var(--copper-pale);
}

.ai-status-summary {
  display: grid;
  grid-template-columns: 29px 1fr;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.analysis-mark {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid var(--copper);
  color: var(--copper);
  font-family: var(--mono);
  font-weight: 600;
}

.ai-status-summary p {
  display: grid;
  gap: 2px;
  margin: 0;
}

.ai-status-summary strong {
  font-size: 9px;
}

.ai-status-summary p span {
  color: var(--ink-soft);
  font-size: 9px;
}

.anomaly-list {
  margin: 8px 0;
}

.anomaly-empty {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-muted);
  font-size: 9px;
}

.anomaly-empty span {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--green);
  font-family: var(--mono);
}

.ai-prompt-form {
  display: grid;
  gap: 5px;
}

.ai-quick-prompts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin: 8px 0;
}

.ai-quick-prompts button {
  min-height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line-dark);
  color: var(--ink-soft);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ai-quick-prompts button:hover {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue-dark);
}

.ai-prompt-form > div {
  display: grid;
  grid-template-columns: 1fr auto;
}

.ai-prompt-form input {
  min-width: 0;
  padding: 0 8px;
  border-right: 0;
  font-size: 10px;
}

.ai-prompt-form button {
  min-width: 64px;
  padding: 0 10px;
  border: 1px solid var(--blue-dark);
  color: #fff;
  background: var(--blue);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
}

.ai-disclosure-inline {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 8px;
  line-height: 1.45;
}

.validation-state--pending {
  color: var(--amber);
  background: var(--amber-pale);
}

.table-wrap {
  overflow-x: auto;
}

.validation-note {
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1.45;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8px;
}

th,
td {
  padding: 6px;
  border: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  color: var(--ink-muted);
  background: var(--paper);
  font-family: var(--mono);
  font-weight: 500;
  text-transform: uppercase;
}

tbody th {
  color: var(--ink-soft);
  background: var(--surface);
  font-family: var(--sans);
  text-align: left;
  text-transform: none;
}

.text-button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 8px;
  padding: 6px 0;
  color: var(--blue);
  background: transparent;
  font-size: 9px;
  font-weight: 600;
  text-align: left;
}

/* Bottom telemetry workbench */
.telemetry-drawer {
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  border-top: 1px solid var(--line-dark);
  box-shadow: 0 -3px 10px rgb(23 32 39 / 6%);
}

.telemetry-command-strip {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(150px, 1fr);
  align-items: stretch;
  height: 46px;
  border-bottom: 1px solid var(--line-dark);
  background: var(--paper);
}

.scenario-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border-right: 1px solid var(--line);
}

.scenario-control label {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.scenario-control select {
  width: min(210px, 70%);
  height: 29px;
  min-height: 29px;
  font-size: 10px;
}

.scenario-classification {
  padding: 2px 4px;
  border: 1px solid var(--line);
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
}

.run-controls {
  display: flex;
  border-right: 1px solid var(--line);
}

.speed-control {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 5px;
  min-width: 91px;
  padding: 0 8px;
  border-right: 1px solid var(--line);
  color: var(--ink-muted);
  background: var(--paper-warm);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
}

.speed-control select {
  width: 42px;
  height: 27px;
  min-height: 27px;
  padding: 0 4px;
  border-color: var(--line);
  font-size: 9px;
  font-weight: 600;
}

.run-button,
.estop-button {
  min-width: 70px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
}

.run-button:hover {
  background: var(--paper-warm);
}

.run-button--start {
  color: #fff;
  background: var(--green);
}

.run-button--start:hover {
  background: #2c5e49;
}

.estop-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 82px;
  border-right: 0;
  color: var(--red-dark);
  background: var(--red-pale);
}

.estop-button span {
  width: 10px;
  height: 10px;
  border: 2px solid var(--red);
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--surface);
}

.estop-button:hover {
  color: #fff;
  background: var(--red);
}

.run-state {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 14px;
}

.run-state span {
  color: var(--green);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.run-state strong {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}

.telemetry-body {
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) minmax(440px, 2fr) minmax(260px, 1.3fr) minmax(260px, 1.25fr);
  grid-template-rows: 58px 1fr;
  height: calc(100% - 46px);
  min-width: 0;
}

.progress-module {
  grid-column: 1 / 3;
  grid-row: 1;
  padding: 8px 13px 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.progress-heading > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.progress-heading span {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
}

.progress-heading strong {
  font-family: var(--mono);
  font-size: 11px;
}

.progress-track {
  position: relative;
  height: 7px;
  border: 1px solid var(--line-dark);
  background: var(--paper-warm);
}

.progress-track > span {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: -1px;
  border: 1px solid var(--blue-dark);
  background: var(--blue);
}

.progress-track i {
  position: absolute;
  z-index: 2;
  top: -3px;
  width: 1px;
  height: 11px;
  background: var(--line-dark);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 6px;
  text-transform: uppercase;
}

.metric-rack {
  grid-column: 1 / 3;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(86px, 1fr));
  min-width: 0;
  border-right: 1px solid var(--line);
}

.metric {
  position: relative;
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric__tag {
  position: absolute;
  top: 6px;
  right: 7px;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 6px;
}

.metric__label {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric > strong {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 3px 0;
  font-family: var(--mono);
  font-size: clamp(16px, 1.55vw, 24px);
  font-weight: 500;
  line-height: 1;
}

.metric > strong small {
  color: var(--ink-muted);
  font-size: 8px;
  font-weight: 400;
}

.metric__range {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 7px;
}

.chart-rack {
  grid-column: 3;
  grid-row: 1 / 3;
  display: grid;
  grid-template-rows: 1fr 1fr;
  min-width: 0;
  border-right: 1px solid var(--line);
}

.mini-chart {
  display: grid;
  grid-template-rows: 27px minmax(0, 1fr);
  min-height: 0;
  border-bottom: 1px solid var(--line);
}

.mini-chart:last-child {
  border-bottom: 0;
}

.mini-chart header,
.event-log header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 9px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
}

.mini-chart header span:last-child {
  color: var(--ink-muted);
}

.chart-placeholder {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  background-image:
    linear-gradient(rgb(73 87 93 / 7%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(73 87 93 / 7%) 1px, transparent 1px);
  background-size: 24px 20px;
}

.chart-placeholder canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-placeholder p {
  z-index: 1;
  margin: 0;
  padding: 2px 4px;
  color: var(--ink-muted);
  background: rgb(251 250 246 / 82%);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
}

.chart-zero-line {
  position: absolute;
  right: 0;
  bottom: 17%;
  left: 0;
  border-top: 1px dashed var(--line-dark);
}

.event-log {
  grid-column: 4;
  grid-row: 1 / 3;
  display: grid;
  grid-template-rows: 27px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.event-log header button {
  padding: 3px;
  color: var(--ink-muted);
  background: transparent;
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
}

.event-log ol {
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.event-log li {
  display: grid;
  grid-template-columns: 41px 37px 1fr;
  gap: 5px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line-faint);
  font-family: var(--mono);
  font-size: 7px;
}

.event-log time {
  color: var(--ink-muted);
}

.event-log p {
  margin: 0;
  color: var(--ink-soft);
}

.log-severity {
  font-weight: 600;
}

.log-severity--info { color: var(--blue); }
.log-severity--check { color: var(--amber); }
.log-severity--success { color: var(--green); }
.log-severity--warning { color: var(--amber); }
.log-severity--danger { color: var(--red); }

.drawer-handle {
  position: absolute;
  top: -11px;
  left: 50%;
  display: grid;
  width: 48px;
  height: 11px;
  place-items: center;
  border: solid var(--line-dark);
  border-width: 1px 1px 0;
  background: var(--surface);
  transform: translateX(-50%);
}

.drawer-handle > span:first-child {
  width: 15px;
  border-top: 1px solid var(--ink-muted);
}

/* Footer */
.system-footer {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  border-top: 1px solid var(--line-dark);
  color: var(--ink-muted);
  background: var(--ink);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.system-footer > span {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 100%;
  padding: 0 12px;
  border-right: 1px solid #3b4449;
}

.system-footer b {
  color: #e9eceb;
  font-weight: 500;
}

.footer-state {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.footer-state--ready {
  background: #79b99a;
}

.footer-disclaimer {
  margin-left: auto;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Dialogs */
.detail-dialog {
  width: min(540px, calc(100vw - 28px));
  max-height: min(680px, calc(100dvh - 28px));
  padding: 0;
  overflow: auto;
  border: 1px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 8px 8px 0 rgb(23 32 39 / 18%);
}

.detail-dialog::backdrop {
  background: rgb(23 32 39 / 42%);
  backdrop-filter: blur(1px);
}

.detail-dialog form > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line-dark);
}

.detail-dialog h2 {
  margin: 3px 0 0;
  font-size: 17px;
}

.dialog-close {
  width: 30px;
  height: 30px;
  color: var(--ink-soft);
  background: var(--paper);
  font-size: 20px;
}

.dialog-body {
  padding: 17px;
}

.dialog-body p {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.dialog-body p strong {
  color: var(--ink);
}

.dialog-readout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 15px 0;
  border: 1px solid var(--line);
}

.dialog-readout > div {
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.dialog-readout > div:nth-child(2n) {
  border-right: 0;
}

.dialog-readout > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.dialog-readout dt {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.dialog-readout dd {
  margin: 3px 0 0;
  font-size: 11px;
  font-weight: 600;
}

.detail-dialog form > footer {
  display: flex;
  justify-content: flex-end;
  padding: 11px 17px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.disclosure-list {
  margin: 16px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  list-style: none;
}

.disclosure-list li {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 9px;
  padding: 9px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 10px;
}

.disclosure-list li:last-child {
  border-bottom: 0;
}

.disclosure-list span {
  color: var(--copper);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
}

/* First-run guided tour */
.first-run-tour {
  position: fixed;
  z-index: 1600;
  inset: 0;
  pointer-events: auto;
}

.first-run-tour[hidden] {
  display: none;
}

.tour-scrim {
  position: absolute;
  inset: 0;
  background: rgb(23 32 39 / 32%);
  backdrop-filter: blur(1px);
}

.tour-card {
  position: absolute;
  right: 22px;
  bottom: 22px;
  width: min(430px, calc(100vw - 32px));
  max-height: calc(100dvh - 44px);
  overflow: auto;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: var(--surface);
  box-shadow: 9px 9px 0 rgb(23 32 39 / 20%);
  pointer-events: auto;
}

.tour-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line-dark);
}

.tour-card__header > div {
  display: flex;
  gap: 14px;
  align-items: center;
}

.tour-progress {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tour-close {
  width: 30px;
  height: 30px;
  color: var(--ink-soft);
  background: var(--paper);
  font-size: 20px;
}

.tour-card__body {
  padding: 20px 18px 18px;
}

.tour-step-label {
  color: var(--copper);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tour-card h2 {
  margin: 8px 0 10px;
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.tour-card__body > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.58;
}

.tour-callout {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 12px;
  margin-top: 18px;
  padding: 12px;
  border-left: 3px solid var(--blue);
  background: var(--blue-pale);
  font-size: 10px;
  line-height: 1.45;
}

.tour-callout strong {
  color: var(--blue-dark);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.tour-callout span {
  color: var(--ink-soft);
}

.tour-card__footer {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.tour-preference {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--ink-muted);
  font-size: 9px;
  line-height: 1.25;
}

.tour-actions {
  display: flex;
  gap: 7px;
}

.tour-actions .button {
  min-width: 74px;
}

.tour-dots {
  display: flex;
  gap: 5px;
  padding: 0 16px 14px;
  background: var(--paper);
}

.tour-dot {
  width: 22px;
  height: 3px;
  border: 0;
  background: var(--line-dark);
  opacity: 0.45;
}

.tour-dot.is-active {
  background: var(--copper);
  opacity: 1;
}

.tour-focus {
  position: relative;
  z-index: 1500 !important;
  outline: 3px solid var(--copper) !important;
  outline-offset: 4px;
  box-shadow: 0 0 0 7px rgb(255 255 255 / 74%) !important;
}

/* Intermediate widths */
@media (max-width: 1260px) {
  :root {
    --left-rail: 232px;
    --right-rail: 300px;
  }

  .brand-lockup {
    padding-inline: 12px;
  }

  .prototype-subtitle,
  .disclosure-button > span:last-child {
    display: none;
  }

  .prototype-identity {
    padding-inline: 13px;
  }

  .primary-nav a {
    min-width: 58px;
    padding-inline: 9px;
  }

  .telemetry-body {
    grid-template-columns: minmax(230px, 1fr) minmax(380px, 1.8fr) minmax(225px, 1fr) minmax(225px, 1fr);
  }
}

@media (max-width: 1050px) {
  :root {
    --left-rail: 212px;
    --right-rail: 278px;
  }

  .prototype-name {
    font-size: 14px;
  }

  .status-button__copy span {
    display: none;
  }

  .telemetry-body {
    overflow-x: auto;
  }
}

/* Tablet / mobile workbench becomes a vertical review surface. */
@media (max-width: 860px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .topbar {
    position: sticky;
    top: 0;
    grid-template-columns: max-content 1fr max-content;
    height: auto;
    min-height: 58px;
  }

  .brand-lockup {
    padding: 0 10px;
  }

  .brand-wordmark {
    height: 14px;
  }

  .prototype-identity {
    padding: 0 9px;
  }

  .revision-tag,
  .topbar-actions .status-button {
    display: none;
  }

  .primary-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 34px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .primary-nav a {
    flex: 1;
    min-width: 0;
  }

  .topbar-actions {
    grid-column: 3;
    grid-row: 1;
  }

  .disclosure-button {
    padding: 0 10px;
  }

  .workspace {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 54vh auto auto;
    overflow: visible;
  }

  .process-rail {
    grid-column: 1;
    grid-row: 1;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line-dark);
  }

  .rail-heading,
  .batch-ticket,
  .route-legend {
    display: none;
  }

  .process-steps {
    display: flex;
    overflow-x: auto;
    padding: 0;
    scrollbar-width: thin;
  }

  .process-steps::before {
    display: none;
  }

  .process-step {
    grid-template-columns: 30px minmax(90px, 1fr);
    flex: 0 0 150px;
    min-height: 62px;
    border-right: 1px solid var(--line);
  }

  .process-step__state {
    display: none;
  }

  .process-step.is-active::after {
    top: auto;
    left: -1px;
    width: auto;
    height: 3px;
  }

  .viewer-workspace {
    grid-column: 1;
    grid-row: 2;
  }

  .control-rail {
    grid-column: 1;
    grid-row: 3;
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: visible;
    border-left: 0;
    border-top: 1px solid var(--line-dark);
  }

  .mode-switcher {
    grid-column: 1 / -1;
  }

  .mode-panel {
    grid-column: 1 / -1;
  }

  .utility-panel,
  .ai-panel {
    border-right: 1px solid var(--line-dark);
  }

  .telemetry-drawer {
    grid-column: 1;
    grid-row: 4;
    min-height: 390px;
  }

  .telemetry-command-strip {
    grid-template-columns: 1fr;
    height: auto;
  }

  .scenario-control {
    min-height: 44px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .run-controls {
    min-height: 45px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .run-controls > button {
    flex: 1;
  }

  .run-state {
    min-height: 36px;
    justify-content: space-between;
  }

  .telemetry-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 210px 190px;
    height: auto;
    overflow: visible;
  }

  .progress-module,
  .metric-rack,
  .chart-rack,
  .event-log {
    grid-column: 1;
    grid-row: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-dark);
  }

  .progress-module {
    min-height: 62px;
  }

  .metric-rack {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    overflow-x: auto;
  }

  .metric {
    min-height: 100px;
  }

  .chart-rack {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
  }

  .mini-chart {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .system-footer {
    min-height: var(--footer-h);
  }

  .footer-disclaimer {
    display: none !important;
  }
}

@media (max-width: 580px) {
  .tour-card {
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 64dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    box-shadow: 0 -8px 24px rgb(23 32 39 / 18%);
  }

  .tour-card__body {
    padding: 17px 16px 15px;
  }

  .tour-card h2 {
    font-size: 21px;
  }

  .tour-callout {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .tour-card__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .tour-actions {
    width: 100%;
  }

  .tour-actions .button {
    flex: 1;
  }

  .viewer {
    min-height: 420px;
  }

  .model-station-label:not(.is-active) {
    display: none;
  }

  .model-station-label {
    font-size: 6px;
  }

  .view-presets {
    top: 50px;
    right: 10px;
    left: 10px;
  }

  .view-presets button {
    flex: 1;
  }

  .viewer-toolbar {
    top: 10px;
    left: 10px;
  }

  .viewer-help,
  .scale-reference {
    display: none;
  }

  .control-rail {
    grid-template-columns: 1fr;
  }

  .utility-panel,
  .ai-panel {
    border-right: 0;
  }

  .button-pair {
    grid-template-columns: 1fr;
  }

  .run-controls {
    overflow-x: auto;
  }

  .run-button,
  .estop-button {
    flex: 0 0 25%;
    min-width: 75px;
  }

  .chart-rack {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    height: 300px;
  }

  .mini-chart {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .system-footer > span:nth-child(3) {
    display: none;
  }
}

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

/* Presentation display mode */
#display-mode-button {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 9px;
  border-right: 1px solid var(--line);
  color: var(--ink-soft);
  background: transparent;
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
}

#display-mode-button:last-child {
  border-right: 0;
}

#display-mode-button:hover,
#display-mode-button.is-pressed,
#display-mode-button[aria-pressed="true"] {
  color: var(--blue-dark);
  background: var(--blue-pale);
}

#display-mode-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#display-mode-overlay {
  position: absolute;
  z-index: 5;
  left: 12px;
  bottom: 14px;
  display: grid;
  gap: 8px;
  min-width: 196px;
  max-width: min(248px, calc(100% - 24px));
  padding: 9px 11px;
  border: 1px solid var(--ink);
  background: rgb(251 250 246 / 97%);
  box-shadow: 4px 4px 0 rgb(23 32 39 / 10%);
  color: var(--ink);
  pointer-events: auto;
}

.display-mode-overlay__copy {
  display: grid;
  gap: 2px;
}

.display-mode-overlay__copy span {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.4;
}

.display-mode-overlay__controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

#display-mode-exit {
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#display-mode-overlay[hidden] {
  display: none;
}

#display-mode-overlay .eyebrow,
#display-mode-overlay .section-kicker {
  color: var(--copper);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
}

#display-mode-overlay strong {
  font-size: 11px;
  font-weight: 600;
}

#display-mode-overlay p,
#display-mode-overlay > span {
  margin: 0;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.4;
}

body.display-mode-active .process-rail,
body.display-mode-active .control-rail,
body.display-mode-active .telemetry-drawer {
  opacity: 0.55;
}

body.display-mode-active .viewer-help,
body.display-mode-active .view-presets {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  #display-mode-overlay,
  #display-mode-overlay * {
    animation: none !important;
  }
}
