/* Toolholder live presentation — white theme with grey tones.
   t_1b6a3178: compact operator dashboard at normal browser 100 %. The page has its natural height and scrolls
   vertically when the window is short; nothing is squeezed into one screen any more (the old html/body
   overflow:hidden + flex-filled hero with min-height:0 let the hero's content paint through the PLC cards). */
:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-2: #eceef1;
  --line: #d3d8de;
  --line-strong: #9aa3ad;
  --text: #1b2129;
  --muted: #5d6874;
  --white: #ffffff;
  --green: #1fae5a;
  --green-glow: rgba(31,174,90,.45);
  --red: #e01f1f;
  --red-glow: rgba(224,31,31,.45);
  --blue: #2b7fe0;
  --amber: #d99a06;
  --graphite: #2a3340;
  --graphite-glow: rgba(42,51,64,.35);
  --focus: #2b7fe0;
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
* { box-sizing: border-box; }
/* natural document height; vertical scrolling whenever the content is taller than the window */
html, body { height: auto; overflow-x: hidden; overflow-y: auto; }
body { margin: 0; min-height: 100vh; padding: clamp(10px, 1.4vw, 24px); background: var(--bg); }
#live { display: flex; flex-direction: column; min-width: 0; }
#live > * { flex: none; min-width: 0; }
h1, h2, h3, p { margin: 0; }
kbd {
  font: 600 .7em/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 3px 7px; border: 1px solid var(--line-strong); border-bottom-width: 3px; border-radius: 6px;
  background: #fff; color: var(--text); vertical-align: middle; margin-left: 8px;
}
.eyebrow { font-size: .8rem; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.muted { color: var(--muted); font-size: .85rem; }

/* header */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.top h1 { font-size: clamp(22px, 2vw, 32px); font-weight: 700; }
.top-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px; border-radius: 999px;
  font-weight: 600; font-size: .95rem; border: 1px solid var(--line); background: var(--panel);
}
.pill::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--line-strong); }
.pill.online::before { background: var(--green); box-shadow: 0 0 12px var(--green-glow); }
.pill.offline { color: #a51616; border-color: #e9a3a3; }
.pill.offline::before { background: var(--red); box-shadow: 0 0 12px var(--red-glow); }

/* buttons */
button {
  font: inherit; font-size: 1.1rem; font-weight: 700; min-height: 52px; padding: 10px 24px;
  border: 2px solid var(--line-strong); border-radius: 12px; background: #e9ecf0; color: var(--text); cursor: pointer;
}
button:hover:not(:disabled) { background: #dde2e8; }
button:disabled { opacity: .4; cursor: not-allowed; }
button:focus-visible { outline: 4px solid var(--focus); outline-offset: 4px; }
button.ghost { background: transparent; min-height: 44px; font-size: .95rem; font-weight: 600; padding: 8px 18px; }
button.primary { background: var(--green); border-color: #157a3e; color: #fff; }
button.primary:hover:not(:disabled) { background: #1a9a4f; }
button.danger { background: var(--red); border-color: #a51616; color: #fff; }
button.danger:hover:not(:disabled) { background: #c41b1b; }

/* hero: natural height, three columns that may shrink but never overflow */
.hero {
  margin: 12px 0 10px; display: grid; grid-template-columns: minmax(130px, 190px) minmax(0, 1fr) minmax(170px, 240px);
  align-items: center; gap: 16px 24px; padding: 14px 24px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 2px 12px rgba(27,33,41,.06);
}
.hero > * { min-width: 0; }
.led-area { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.led-area strong { font-size: 1.1rem; }
.led {
  width: 120px; height: 120px; flex: none; border-radius: 50%; border: 8px solid #e6e9ed;
  background: #b3bac3; box-shadow: 0 0 0 2px var(--line), 0 6px 22px rgba(27,33,41,.15);
  transition: background-color .15s, box-shadow .15s, border-color .15s;
}
.led.white { background: var(--white); border-color: #f4f5f7; box-shadow: 0 0 0 2px var(--line-strong), 0 0 40px rgba(27,33,41,.24); }
.led.green { background: var(--green); border-color: #cdeedb; box-shadow: 0 0 0 2px #8fd6ac, 0 0 44px var(--green-glow); }
.led.red { background: var(--red); border-color: #f6cfcf; box-shadow: 0 0 0 2px #f08b8b, 0 0 44px var(--red-glow); }
.led.blue { background: var(--blue); border-color: #d2e3f8; box-shadow: 0 0 0 2px #8db9ee, 0 0 44px rgba(43,127,224,.45); }
.led.unknown { background: #b3bac3; }
.led.flashing, .swatch.flashing { animation: flash 1s steps(1, end) infinite; }
@keyframes flash { 50% { opacity: .25; } }

.hero-copy { overflow-wrap: anywhere; }
.hero-copy h2 { font-size: clamp(28px, 3.2vw, 52px); line-height: 1.08; font-weight: 800; letter-spacing: -.01em; }
.hero-copy .eyebrow { font-size: .9rem; margin-bottom: 4px; }
.instruction { font-size: clamp(17px, 1.4vw, 22px); margin-top: 8px; color: #2d3640; }
.next-hint { margin-top: 6px; color: var(--muted); font-size: .95rem; min-height: 1.4em; }

.timer { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 10px; border-radius: 14px; }
.timer strong { font-size: clamp(36px, 3.4vw, 60px); line-height: 1; font-variant-numeric: tabular-nums; font-weight: 800; }
.timer .bar { width: 100%; height: 10px; border-radius: 6px; background: var(--panel-2); overflow: hidden; border: 1px solid var(--line); }
.timer .bar div { height: 100%; width: 0; background: var(--green); }
.timer.idle strong { color: var(--line-strong); }
.timer.warning { background: #fff3d1; }
.timer.warning strong { color: #b07d00; animation: flash 1s steps(1, end) infinite; }
.timer.warning .bar div { background: var(--amber); }

/* readouts */
.readouts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.readout {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 18px; min-width: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 16px; align-items: center;
}
.readout .label { font-size: 1rem; font-weight: 700; letter-spacing: .08em; }
.readout .bit {
  grid-row: 1 / span 2; grid-column: 2; justify-self: end; font-size: clamp(36px, 3.4vw, 56px); line-height: 1;
  font-weight: 800; font-variant-numeric: tabular-nums; color: #8f99a4;
}
.readout.high .bit { color: var(--graphite); }
.readout.high { border: 3px solid var(--graphite); box-shadow: 0 0 0 4px var(--graphite-glow); }
.readout small { color: var(--muted); font-size: .8rem; grid-column: 1; overflow-wrap: anywhere; }

/* strain graph — same PA3 feed as /firmware, read-only */
.strain {
  margin-top: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px 6px;
}
.strain-head { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; }
.strain-head .label { font-size: 1rem; font-weight: 700; letter-spacing: .08em; }
.strain-counts { font-size: clamp(26px, 2.4vw, 38px); line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.strain-counts.stale { color: var(--line-strong); }
.strain-window { margin-left: auto; display: flex; gap: 8px; }
button.small { min-height: 34px; padding: 4px 12px; font-size: .85rem; font-weight: 700; }
button.small[aria-pressed="true"] { background: var(--graphite); border-color: var(--graphite); color: #fff; }
#strain-chart { display: block; width: 100%; height: 150px; margin-top: 4px; background: #fbfcfd; border: 1px solid var(--line); border-radius: 10px; }
#strain-note { min-height: 1.2em; margin-top: 2px; overflow-wrap: anywhere; }
#strain-note.feed-delayed { color: #7a5a00; font-weight: 600; }

/* stepper — the border of the current step lights up in the step's LED colour (flashing for C/E);
   without a strain feed B and C light together (.group) while a pick is authorized */
.stepper { list-style: none; margin: 14px 0 12px; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.stepper li {
  position: relative; min-width: 0; padding: 10px 10px 10px 62px; background: var(--panel); border: 4px solid var(--line); border-radius: 14px;
  opacity: .7; --accent: var(--graphite); --accent-glow: var(--graphite-glow); overflow-wrap: anywhere;
  transition: opacity .15s, border-color .15s, background-color .15s, box-shadow .15s, transform .15s;
}
.stepper li[data-step="B"], .stepper li[data-step="C"], .stepper li[data-step="E"] { --accent: var(--green); --accent-glow: var(--green-glow); }
.stepper li[data-step="F"] { --accent: var(--red); --accent-glow: var(--red-glow); }
.stepper li b {
  position: absolute; left: 10px; top: 8px; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  font-size: 1.25rem; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
}
.stepper li h3 { font-size: .98rem; font-weight: 700; margin: 0 0 2px; }
.stepper li p { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stepper li code { font-size: .8rem; color: #3b4652; }
.stepper li .swatch { position: absolute; left: 17px; top: 54px; width: 24px; height: 24px; }
.stepper li[aria-current="step"] {
  opacity: 1; border-color: var(--accent); background: var(--panel);
  box-shadow: 0 0 0 5px var(--accent-glow), 0 0 26px var(--accent-glow); z-index: 1;
}
.stepper li[aria-current="step"] b { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper li[data-step="A"][aria-current="step"] b, .stepper li[data-step="D"][aria-current="step"] b { color: #fff; }
.stepper li[aria-current="step"] .swatch.flashing { animation: none; opacity: 1; }
.stepper li[aria-current="step"][data-step="C"], .stepper li[aria-current="step"][data-step="E"] {
  animation: border-flash 1s steps(1, end) infinite;
}
@keyframes border-flash {
  50% { border-color: var(--line); box-shadow: 0 0 0 5px transparent, 0 0 0 transparent; }
}
.stepper li.candidate { opacity: .9; border-style: dashed; border-color: var(--line-strong); }
.stepper li.group { opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-glow), 0 0 24px var(--accent-glow); }
.stepper li.group b { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper li.group .swatch.flashing { animation: none; opacity: 1; }
.swatch { display: inline-block; width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(27,33,41,.2); }
.swatch.white { background: var(--white); }
.swatch.green { background: var(--green); }
.swatch.red { background: var(--red); }
.swatch.blue { background: var(--blue); }
.swatch.inline { width: 16px; height: 16px; vertical-align: -3px; }

/* controls + messages */
.controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.controls p { margin-left: auto; text-align: right; }
.progress { margin-top: 6px; font-size: 1rem; min-height: 1.4em; color: #2d3640; overflow-wrap: anywhere; }
.error { margin-top: 2px; font-size: .95rem; min-height: 1.3em; color: #b11a1a; overflow-wrap: anywhere; }
footer { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between; color: var(--muted); font-size: .8rem; }

/* six absolute settings (t_f28eb6ab): a compact group in the controls row + one note line (wraps, never cut off) */
.tolerance { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding-left: 14px; border-left: 2px solid var(--line); }
.tol-label { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
button.tol { min-height: 0; padding: 4px 10px; display: inline-flex; flex-direction: column; align-items: flex-start;
  gap: 0; line-height: 1.15; border-left-width: 6px; border-radius: 10px; }
button.tol b { font-size: .95rem; }
button.tol span { color: var(--muted); font-size: .7rem; font-weight: 500; white-space: nowrap; }
button.tol.yellow { border-left-color: #e8c20a; }
button.tol.blue { border-left-color: var(--blue); }
button.tol.purple { border-left-color: #8a3fd1; }
button.tol.echo { border-left-color: var(--line-strong); border-left-style: dashed; }
button.tol.active-value { box-shadow: inset 0 0 0 2px #157a3e; }
button.tol.sending { animation: pulse 1s ease-in-out infinite; }
.tolerance-note { margin-top: 4px; font-size: .78rem; line-height: 1.3; overflow-wrap: anywhere; }
.error:empty { min-height: 0; margin-top: 0; }
.tolerance-ready { color: #157a3e; font-weight: 600; }
.setting-bad { color: #b11a1a; font-weight: 600; }

/* Context-only recovery for an already-active maintenance reservation. */
.maintenance-recovery { margin: 8px 0; padding: 14px 18px; background: #fff8e9; border: 1px solid #d7b86b; border-radius: 12px; }
.maintenance-recovery[hidden] { display: none; }
.maintenance-recovery h2 { font-size: 1.1rem; }
.maintenance-recovery p { margin: 6px 0; }
.maintenance-recovery label { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0; }
.maintenance-recovery button { min-height: 40px; font-size: .9rem; padding: 6px 14px; }
body.offline .hero { border-color: #e9a3a3; }
body.offline .led { filter: grayscale(.6) brightness(.95); }
body.offline .readout .bit { color: var(--line-strong); }

/* alarm takeover: the whole viewport turns red, one action (fixed: covers the window also when scrolled) */
.alarm {
  position: fixed; inset: 0; z-index: 10; background: #c11212; color: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 4vh 6vw; gap: 2.2vh; overflow-y: auto;
  animation: alarm-in .25s ease-out;
}
@keyframes alarm-in { from { opacity: 0; } to { opacity: 1; } }
.alarm[hidden] { display: none; }
.alarm .eyebrow { color: #ffd5d5; font-size: 1.05rem; }
.alarm h2 { font-size: clamp(36px, 6.5vw, 112px); font-weight: 900; line-height: 1; letter-spacing: -.01em; text-shadow: 0 6px 24px rgba(0,0,0,.35); overflow-wrap: anywhere; }
.alarm-instruction { font-size: clamp(20px, 2.6vw, 42px); font-weight: 600; }
button.reset {
  min-height: 12vh; min-width: min(60vw, 720px); font-size: clamp(36px, 5vw, 84px); font-weight: 900; letter-spacing: .04em;
  background: #fff; color: #b40f0f; border: 6px solid #ffd0d0; border-radius: 24px; box-shadow: 0 12px 40px rgba(0,0,0,.35);
  text-transform: uppercase;
}
button.reset:hover:not(:disabled) { background: #ffe9e9; }
button.reset:disabled { opacity: .55; }
.alarm-progress { font-size: clamp(18px, 2vw, 30px); min-height: 1.4em; font-weight: 600; }
.alarm-note { color: #ffd5d5; font-size: 1rem; max-width: 70ch; }
.alarm.busy button.reset { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.985); } }
/* 2026-11-03: overlay retired — keep the graph visible; alarm = all of Step A–F red + inline Reset */
.alarm { display: none !important; }
body.alarm-active .stepper li, body.alarm-active .stepper li[aria-current="step"] {
  --accent: var(--red); --accent-glow: var(--red-glow);
  opacity: 1; border-color: var(--red); border-style: solid; animation: none;
  background: color-mix(in srgb, var(--red) 14%, var(--panel));
  box-shadow: 0 0 0 4px var(--red-glow), 0 0 22px var(--red-glow);
}
body.alarm-active .stepper li b { background: var(--red); border-color: var(--red); color: #fff; }
body.alarm-active .stepper li h3 { color: #a51616; }
body.alarm-active #reset-inline:not(:disabled) { box-shadow: 0 0 0 4px var(--red-glow); animation: pulse 1s ease-in-out infinite; }

/* medium widths: stepper in two rows */
@media (max-width: 1200px) {
  .stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* narrow: hero stacks, controls wrap */
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); text-align: center; justify-items: center; padding: 12px 16px; }
  .led { width: 96px; height: 96px; }
  .timer { width: min(100%, 320px); }
}
@media (max-width: 700px) {
  .tolerance { padding-left: 0; border-left: 0; width: 100%; }
  .stepper { grid-template-columns: minmax(0, 1fr); }
  .readout { padding: 8px 12px; column-gap: 10px; }
  .controls button:not(.tol) { flex: 1 1 auto; }
  .strain-window { margin-left: 0; }
}

/* t_edbc07c5: A–F observer provenance. The stepper tells WHERE the lit step comes from. */
.observer { margin: 6px 0 0; font-size: .82rem; color: var(--muted); overflow-wrap: anywhere; }
.observer[data-kind="device"] { color: #17633a; }
.observer[data-kind="device-disputed"], .observer[data-kind="uncertain"] { color: #8a5b0d; font-weight: 600; }
.observer[data-kind="controller"] { color: #3b4652; }
.stepper[data-source="uncertain"] li, .stepper[data-source="offline"] li { opacity: .55; }
.stepper[data-source="controller"] li[aria-current="step"] { border-style: dashed; }
.stepper[data-source="device"] li[aria-current="step"] { border-style: solid; }
.stepper li.controller-only { border-style: dotted; border-color: var(--line-strong); }
.stepper li.controller-only::after { content: 'controller'; position: absolute; right: 8px; top: 6px; font-size: .68rem; color: #8a5b0d; }
.device-echo { display: block; font-size: .74rem; color: #17633a; }
.device-echo.stale { color: var(--muted); }
.device-echo.disagree { color: #b3261e; font-weight: 700; }
/* Unmistakable current step: tinted fill, thick accent border, NOW tag; others recede. */
.stepper-caption { margin: 14px 0 -4px; font-weight: 700; font-size: 1rem; color: #17633a; overflow-wrap: anywhere; }
.stepper-caption[data-kind="controller"] { color: #3b4652; }
.stepper-caption[data-kind="uncertain"], .stepper-caption[data-kind="device-disputed"] { color: #8a5b0d; }
.stepper-caption[data-kind="offline"] { color: var(--muted); }
.stepper li:not([aria-current]) { opacity: .5; }
.stepper li[aria-current="step"] { opacity: 1; background: color-mix(in srgb, var(--accent) 16%, var(--panel)); transform: translateY(-3px); }
.stepper li[aria-current="step"]::before { content: 'NOW'; position: absolute; right: 10px; top: -12px; padding: 1px 7px; border-radius: 6px; font-size: .7rem; font-weight: 800; letter-spacing: .08em; background: var(--accent); color: #fff; }
.stepper[data-source="controller"] li[aria-current="step"]::before { content: 'NOW · controller'; }
.stepper[data-source="device-disputed"] li[aria-current="step"]::before { content: 'NOW · holder'; }
.stepper li[aria-current="step"][data-step="A"], .stepper li[aria-current="step"][data-step="D"] { --accent: #4a5866; }
