/* Radiology demo — D1 mockup styles.
   Every color, radius and voice comes from tokens.css (ANND Design · Medical, copied verbatim).
   Motion values mirror src/lib/annd/motion.ts. */

@font-face {
  font-family: "Inter Variable";
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations"),
       url("fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* THE MACHINE: IBM Plex Mono, self-hosted like Inter (OFL 1.1, @fontsource/ibm-plex-mono 5.3.0) */
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --dur-fast: 120ms;
  --dur-base: 180ms;
  --dur-slow: 240ms;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --press: .985;
  --focus: color-mix(in srgb, var(--accent) 70%, transparent);
  --focus-v: color-mix(in srgb, var(--viewer-accent) 85%, transparent);
  --fill-opacity: .45;
  /* the viewer has no critical token; this is dark-theme --critical, which reads on --viewer in both themes */
  --viewer-critical: #EF7F74;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  font-family: var(--app);
  font-size: 15px;
  line-height: 1.5;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
::selection { background: color-mix(in srgb, var(--accent) 18%, transparent); }

:focus { outline: none; }
:focus-visible { outline: 1.5px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-control); }
.viewer :focus-visible { outline-color: var(--focus-v); }

.machine { font-family: var(--machine); font-feature-settings: "tnum"; }
.kicker { font-family: var(--machine); font-size: 11px; font-weight: 400; letter-spacing: .2em; text-transform: uppercase; color: var(--faint); }
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ic { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.3; flex: none; }
.unit { color: var(--muted); }

.skip { position: absolute; left: 12px; top: -80px; z-index: 50; background: var(--surface); color: var(--ink); padding: 8px 12px; border-radius: var(--radius-control); border: 1px solid var(--rule-strong); }
.skip:focus { top: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-control);
  border: 1px solid var(--rule-strong); background: var(--paper); color: var(--ink);
  font-size: 13.5px; font-weight: 500; white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--field-2); }
.btn:active { transform: scale(var(--press)); }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--on-accent); box-shadow: var(--lift-accent); }
.btn-primary:hover { background: var(--accent-deep); }
.btn-block { width: 100%; height: 40px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn-sm .ic { width: 15px; height: 15px; }
.btn[aria-busy="true"] { pointer-events: none; }
.btn-vsecondary { background: var(--viewer-2); border-color: var(--viewer-rule); color: var(--viewer-ink); cursor: pointer; }
.btn-vsecondary:hover { background: color-mix(in srgb, var(--viewer-2) 90%, var(--viewer-ink)); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--field-2); color: var(--ink); }

/* ---------- tags (mono status tags; color is never the only signal) ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: var(--radius-tag); font-family: var(--machine); font-size: 10px;
  letter-spacing: .05em; text-transform: uppercase; white-space: nowrap;
  background: var(--paper); color: var(--muted); border: 1px solid var(--rule);
}
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-critical { background: var(--critical-tint); color: var(--critical); border-color: transparent; }
.tag-warning { background: var(--warning-tint); color: var(--warning); border-color: transparent; }
.tag-normal { background: var(--normal-tint); color: var(--normal); border-color: transparent; }
.tag-info { background: var(--info-tint); color: var(--info); border-color: transparent; }

/* finding swatch: on light chrome it needs a rule-strong ring plus its label (DECISIONS M12) */
.sw-f { width: 10px; height: 10px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1px var(--rule-strong); }
.sub-chip { display: inline-flex; align-items: center; gap: 5px; font-family: var(--machine); font-size: 10.5px; color: var(--muted); letter-spacing: .03em; }

/* spinner: calm, CSS-only, reduced-motion aware */
.spin { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--rule-strong); border-top-color: var(--ink); animation: spin .9s linear infinite; flex: none; }
.spin-v { border-color: var(--viewer-rule); border-top-color: var(--viewer-ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================== LOGIN ============================== */
.login { min-height: 100%; display: grid; place-items: center; padding: 48px 16px; }
.login-col { width: 100%; max-width: 372px; }
.brand { display: flex; align-items: center; gap: 10px; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.brand-sub { font-family: var(--machine); font-size: 11px; color: var(--faint); letter-spacing: .04em; margin-left: 6px; padding-left: 12px; border-left: 1px solid var(--rule); }
.brand-lg .wordmark { font-size: 26px; }
.login-title { font-family: var(--display); font-weight: 500; font-size: 31px; letter-spacing: -.012em; margin-top: 40px; }
.login-sub { color: var(--muted); margin-top: 4px; }
.login-form { margin-top: 28px; display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--ink); }
.input {
  height: 42px; padding: 0 14px; border-radius: var(--radius-control); border: 1px solid var(--rule-strong);
  background: var(--surface); color: var(--ink); transition: border-color var(--dur-fast) var(--ease);
}
.input:hover { border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.input:focus-visible { outline-offset: 0; border-color: var(--accent); }
.input[readonly] { color: var(--muted); }
.login.is-leaving { opacity: 0; transition: opacity var(--dur-base) var(--ease); }

/* ============================ WORKSPACE ============================ */
.workspace { height: 100%; display: grid; grid-template-rows: 56px minmax(0, 1fr); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 20px; border-bottom: 1px solid var(--rule); background: var(--surface);
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.health {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px;
  border-radius: var(--radius-pill); border: 1px solid var(--rule); background: var(--paper);
  font-size: 12.5px; color: var(--muted);
}
.health:hover { background: var(--field-2); }
.health .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--normal); }
.health[data-state="offline"] { color: var(--critical); border-color: transparent; background: var(--critical-tint); }
.health[data-state="offline"] .dot { background: var(--critical); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent);
  font-weight: 600; font-size: 13px; box-shadow: var(--lift-accent);
}

.pop-wrap { position: relative; }
.popover {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 240px;
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--radius-card);
  box-shadow: var(--lift-2); padding: 14px;
}
.popover-menu { padding: 6px; min-width: 220px; }
.popover-dark { background: var(--viewer-2); border-color: var(--viewer-rule); color: var(--viewer-ink); box-shadow: 0 12px 30px -12px rgba(0,0,0,.6); min-width: 300px; }
.menu-head { display: grid; padding: 8px 10px 10px; border-bottom: 1px solid var(--rule); margin-bottom: 4px; }
.menu-name { font-weight: 500; font-size: 13.5px; }
.menu-mail { font-size: 11.5px; color: var(--faint); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: var(--radius-nav); font-size: 13.5px; text-align: left; }
.menu-item:hover { background: var(--field-2); }
.pop-list { display: grid; gap: 8px; margin-top: 10px; font-size: 12.5px; }
.pop-row { display: flex; justify-content: space-between; gap: 16px; }
.pop-row dt { color: var(--muted); }
.pop-row dd { font-family: var(--machine); text-align: right; }

.layout { display: grid; grid-template-columns: 288px minmax(0, 1fr) 392px; min-height: 0; }

/* ---------- tray (filled chrome, like the sidebar) ---------- */
.tray { background: var(--surface); border-right: 1px solid var(--rule); overflow-y: auto; padding: 18px 12px 24px; display: flex; flex-direction: column; gap: 6px; }
.tray-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 8px; }
.faint-sm { font-size: 11px; color: var(--faint); }
.tray-hint { font-size: 12.5px; color: var(--muted); padding: 0 8px 6px; }
.tray-list { display: grid; gap: 2px; }
.case {
  width: 100%; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 8px; border: 1px solid transparent; border-radius: var(--radius-card); background: transparent; text-align: left;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), opacity var(--dur-base) var(--ease);
}
.case[draggable="true"] { cursor: grab; }
.case:hover { background: var(--field); }
.case:active { cursor: grabbing; }
.case.is-dragging { opacity: .45; }
.case[aria-current="true"] { background: var(--accent-tint); }
/* faint falls under 4.5:1 on the accent wash; muted clears it in both themes */
.case[aria-current="true"] .case-sub, .case[aria-current="true"] .case-live { color: var(--muted); }
.case[aria-disabled="true"] { cursor: default; }
.case[aria-disabled="true"] .case-thumb { opacity: .55; }
.case-thumb { width: 56px; height: 56px; border-radius: 10px; background: var(--viewer); object-fit: cover; display: block; }
.case-body { display: grid; gap: 3px; min-width: 0; }
.case-title { font-size: 13.5px; font-weight: 500; line-height: 1.3; }
.case-sub { font-family: var(--machine); font-size: 10.5px; color: var(--faint); letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-tags { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 2px; }
.case-live { font-family: var(--machine); font-size: 10px; color: var(--faint); letter-spacing: .04em; }

.session { padding-bottom: 14px; margin-bottom: 8px; border-bottom: 1px solid var(--rule); display: grid; gap: 6px; }
.session .kicker { padding: 0 8px; }
.session-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.srow {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 8px; border: 0; background: none;
  border-radius: var(--radius-nav); font-size: 13px; text-align: left;
}
.srow:hover { background: var(--field); }
.srow[aria-current="true"] { background: var(--accent-tint); font-weight: 500; }
.srow-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow-time { font-family: var(--machine); font-size: 11px; color: var(--faint); }
.sdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.sdot-critical { background: var(--critical); }
.sdot-normal { background: var(--normal); }
.sdot-run { background: var(--faint); }
.sdot-error { background: var(--warning); }

/* ---------- stage + viewer (near-black in both themes) ---------- */
.stage { min-width: 0; min-height: 0; padding: 12px; display: flex; }
.viewer {
  flex: 1; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--viewer); color: var(--viewer-ink); border-radius: var(--radius-card); overflow: hidden;
}
.vbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 10px 8px 16px; background: var(--viewer-2); border-bottom: 1px solid var(--viewer-rule);
}
.vbar-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.v-title { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-sub { font-size: 11px; color: var(--viewer-muted); white-space: nowrap; }
.vbar-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vbar-controls[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.v-wl { font-size: 11px; color: var(--viewer-muted); min-width: 76px; }
.vsep { width: 1px; height: 20px; background: var(--viewer-rule); }

/* segmented control — the one place the bottom-line active motif lives (ANND #16) */
.seg { position: relative; display: inline-flex; gap: 2px; }
.seg button {
  position: relative; height: 30px; padding: 0 10px; border: 0; background: none; border-radius: var(--radius-control);
  font-size: 12.5px; color: var(--viewer-muted); transition: color var(--dur-fast) var(--ease);
}
.seg button:hover { color: var(--viewer-ink); }
.seg button[aria-checked="true"] { color: var(--viewer-ink); font-weight: 500; }
.seg-ind { position: absolute; bottom: 2px; left: 0; height: 1.5px; width: 0; background: var(--viewer-accent); border-radius: 2px; transition: transform var(--dur-slow) var(--ease), width var(--dur-slow) var(--ease); }
.seg-light button { color: var(--muted); }
.seg-light button:hover, .seg-light button[aria-checked="true"] { color: var(--ink); }
.seg-light .seg-ind { background: var(--accent); }

.vswitch, .lswitch {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border: 0; background: none;
  border-radius: var(--radius-control); font-size: 12.5px; color: var(--viewer-muted);
}
.vswitch:hover { color: var(--viewer-ink); }
.vswitch[aria-checked="true"] { color: var(--viewer-ink); }
.vswitch[aria-disabled="true"] { opacity: .4; cursor: default; }
.opacity:has(input:disabled) { opacity: .4; }
.sw { position: relative; width: 26px; height: 16px; border-radius: 999px; background: rgba(226,229,232,.18); transition: background-color var(--dur-fast) var(--ease); flex: none; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--viewer-ink); transition: transform var(--dur-base) var(--ease); }
[aria-checked="true"] > .sw { background: var(--viewer-accent); }
[aria-checked="true"] > .sw::after { transform: translateX(10px); background: var(--viewer); }
.lswitch { color: var(--ink); padding: 0; }
.lswitch .sw { background: var(--field-2); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.lswitch .sw::after { background: var(--surface); box-shadow: 0 0 0 1px var(--rule-strong); }
.lswitch[aria-checked="true"] .sw { background: var(--accent); box-shadow: none; }
.lswitch[aria-checked="true"] .sw::after { background: var(--on-accent); box-shadow: none; }

.opacity { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: var(--viewer-muted); }
.opacity input { width: 84px; accent-color: var(--viewer-accent); }
.opacity .machine { min-width: 30px; }
.vicon { width: 30px; height: 30px; display: inline-grid; place-items: center; border: 0; background: none; color: var(--viewer-muted); border-radius: var(--radius-control); }
.vicon:hover { color: var(--viewer-ink); background: rgba(226,229,232,.06); }
.vicon-light { color: var(--muted); }
.vicon-light:hover { color: var(--ink); background: var(--field-2); }

.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 12.5px; align-items: center; }
.keys dt { white-space: nowrap; color: var(--viewer-muted); font-size: 11.5px; }
.keys dd { color: var(--viewer-ink); }
kbd { font-family: var(--machine); font-size: 11px; display: inline-block; min-width: 20px; padding: 1px 5px; margin-right: 3px; text-align: center; border: 1px solid var(--viewer-rule); border-radius: 5px; color: var(--viewer-ink); }

.vbody { position: relative; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.v-canvas { position: relative; min-height: 0; display: grid; place-items: center; padding: 16px; overflow: hidden; container-type: size; }
.v-canvas:focus-visible { outline-offset: -4px; border-radius: var(--radius-card); }

.drop {
  position: absolute; inset: 20px; display: grid; place-items: center; text-align: center;
  border: 1.5px dashed rgba(226,229,232,.22); border-radius: var(--radius-card);
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.drop-inner { max-width: 380px; display: grid; justify-items: center; gap: 8px; padding: 24px; }
.drop-ic { width: 30px; height: 30px; fill: none; stroke: var(--viewer-muted); stroke-width: 1.1; margin-bottom: 6px; transition: transform var(--dur-base) var(--ease), stroke var(--dur-fast) var(--ease); }
.drop-title { font-family: var(--display); font-size: 18px; font-weight: 500; letter-spacing: -.012em; color: var(--viewer-ink); }
.drop-sub { font-size: 13.5px; color: var(--viewer-muted); }
.drop-actions { margin-top: 12px; display: flex; gap: 8px; }
.drop.is-over { border-color: var(--viewer-accent); border-style: solid; background: rgba(128,183,235,.06); }
.drop.is-over .drop-ic { stroke: var(--viewer-accent); transform: translateY(-3px); }
.drop.is-rejected { border-color: color-mix(in srgb, var(--viewer-critical) 60%, transparent); border-style: solid; }
.drop.is-rejected .drop-ic { stroke: var(--viewer-critical); }
.drop.is-offline .drop-ic { stroke: var(--viewer-muted); }
.drop-err { color: var(--viewer-critical); }
.drop.is-busy { border-color: var(--viewer-rule); border-style: solid; }
.drop.is-overlay { background: rgba(10,12,15,.78); z-index: 5; }

/* The square fits the smaller canvas side, so a tall canvas never pushes patient-left under the rail. */
.stack { position: relative; width: min(100cqw, 100cqh); aspect-ratio: 1 / 1; }
.stack img, .ov img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.ct-thumb { filter: blur(6px); transform: scale(1.01); }
.ct { opacity: 0; transition: opacity var(--dur-slow) var(--ease); }
.ct.is-on { opacity: 1; }
.ov { position: absolute; inset: 0; opacity: 0; transition: opacity var(--dur-slow) var(--ease); }
.ov.is-on { opacity: 1; }
.ov .fill { opacity: var(--fill-opacity); transition: opacity var(--dur-base) var(--ease); }
.ov .line { transition: opacity var(--dur-base) var(--ease); }
.ov.has-sel .fill:not(.is-sel) { opacity: calc(var(--fill-opacity) * .3); }
.ov.has-sel .line:not(.is-sel) { opacity: .4; }
.gt { pointer-events: none; }
.orient { position: absolute; top: 50%; transform: translateY(-50%); font-family: var(--machine); font-size: 11px; color: var(--viewer-muted); }
.orient-r { left: -2px; }
.orient-l { right: -2px; }

.v-status {
  position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 10px; border-radius: var(--radius-pill); background: rgba(22,26,30,.86);
  border: 1px solid var(--viewer-rule); font-size: 12px; color: var(--viewer-ink);
}
.legend {
  position: absolute; left: 10px; bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 4px; border-radius: 12px; background: rgba(22,26,30,.9); border: 1px solid var(--viewer-rule); max-width: calc(100% - 20px);
}
.lg-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border: 0; background: none;
  border-radius: 8px; font-family: var(--machine); font-size: 11px; color: var(--viewer-ink); letter-spacing: .03em;
}
.lg-chip:hover { background: rgba(226,229,232,.07); }
.lg-chip[aria-pressed="false"] { color: var(--viewer-muted); }
.lg-chip[aria-pressed="false"] .lg-sw { background: transparent !important; }
.lg-sw { width: 10px; height: 10px; border-radius: 3px; border: 1.5px solid; flex: none; }
.lg-key { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 11px; color: var(--viewer-muted); }
.lg-line { width: 16px; height: 0; border-top: 1.5px solid var(--viewer-ink); }
.lg-dash { width: 16px; height: 0; border-top: 1.5px dashed var(--viewer-ink); }
.lg-none { padding: 0 8px; font-size: 12px; color: var(--viewer-muted); }

.v-rail { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; justify-items: center; gap: 6px; padding: 16px 14px 16px 4px; }
.rail-end { font-size: 10px; color: var(--viewer-muted); }
.rail-track { position: relative; min-height: 0; height: 100%; width: 28px; display: grid; justify-items: center; }
.slice { writing-mode: vertical-lr; direction: rtl; height: 100%; width: 22px; margin: 0; accent-color: var(--viewer-accent); cursor: ns-resize; }
.rail-marks { position: absolute; inset: 0 0 0 auto; width: 6px; pointer-events: none; }
.rail-mark { position: absolute; right: -2px; width: 6px; height: 3px; border-radius: 2px; transform: translateY(50%); }

.vfoot { display: flex; justify-content: space-between; gap: 12px; padding: 8px 16px; border-top: 1px solid var(--viewer-rule); font-size: 12px; color: var(--viewer-muted); min-height: 36px; align-items: center; }
.v-readout { font-size: 11.5px; color: var(--viewer-ink); }
.v-readout .u { color: var(--viewer-muted); }

/* ---------- results panel ---------- */
.panel { overflow-y: auto; border-left: 1px solid var(--rule); background: var(--field); }
.panel-body { padding: 22px 22px 40px; display: grid; gap: 22px; }
.p-head { display: grid; gap: 6px; }
.p-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.p-title { font-family: var(--display); font-weight: 500; font-size: 20px; letter-spacing: -.012em; line-height: 1.25; }
.p-sub { font-family: var(--machine); font-size: 11px; color: var(--faint); letter-spacing: .02em; }
.p-section { display: grid; gap: 10px; }
.p-section + .p-section { padding-top: 20px; border-top: 1px solid var(--rule); }
.p-lead { color: var(--muted); font-size: 14px; }

.idle-list { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.idle-list li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--rule); font-size: 13.5px; }
.idle-list .machine { font-size: 11.5px; color: var(--faint); }

/* processing timeline */
.clock { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.clock-t { font-family: var(--machine); font-size: 22px; font-feature-settings: "tnum"; }
.clock-est { font-size: 12.5px; color: var(--faint); }
.bar { height: 3px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform var(--dur-slow) var(--ease); }
.timeline { display: grid; }
.tl {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 2px 10px; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--rule);
}
.tl:last-child { border-bottom: 0; }
.tl-ic { width: 20px; height: 20px; display: grid; place-items: center; }
.tl-ic .pend { width: 7px; height: 7px; border-radius: 50%; border: 1.3px solid var(--rule-strong); }
.tl-ic .ic { width: 16px; height: 16px; }
.tl-name { font-size: 13.5px; color: var(--faint); transition: color var(--dur-base) var(--ease); }
.tl-t { font-family: var(--machine); font-size: 11.5px; color: var(--faint); }
.tl-detail { grid-column: 2 / 4; font-size: 12px; color: var(--muted); }
.tl[data-s="run"] .tl-name, .tl[data-s="done"] .tl-name { color: var(--ink); }
.tl[data-s="run"] .tl-name { font-weight: 500; }
.tl[data-s="done"] .tl-ic { color: var(--normal); }
.tl[data-s="error"] .tl-ic, .tl[data-s="error"] .tl-name { color: var(--critical); }
.tl[data-s="error"] .tl-detail { color: var(--critical); }
.tl[data-s="run"] .tl-t { color: var(--ink); }

.summary-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: none; padding: 0; font-size: 12.5px; color: var(--muted); gap: 10px; text-align: left; }
.summary-btn:hover { color: var(--ink); }
.summary-btn .ic { width: 15px; height: 15px; transition: transform var(--dur-base) var(--ease); }
.summary-btn[aria-expanded="true"] .ic { transform: rotate(180deg); }
.summary-btn .machine { color: var(--ink); }

/* agreement with the expert read */
.agree-src { font-size: 12.5px; color: var(--muted); }
.agree { width: 100%; border-collapse: collapse; font-size: 13px; }
.agree thead th { font-weight: 400; font-size: 11.5px; color: var(--faint); text-align: left; padding: 0 8px 6px 0; white-space: nowrap; }
.agree td { white-space: nowrap; }
.agree-vol { margin-top: 6px; }
.agree td, .agree tbody th { padding: 9px 8px 9px 0; border-top: 1px solid var(--rule); vertical-align: middle; font-weight: 400; text-align: left; }
.agree td:last-child, .agree th:last-child { padding-right: 0; text-align: right; }
.agree .a-name { display: inline-flex; align-items: center; gap: 8px; }
.agree .machine { font-size: 12px; }
.agree .muted { color: var(--muted); }
.dice-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--muted); }
.dice-row .machine { color: var(--ink); }
.tag-neutral { background: var(--paper); color: var(--muted); }

/* findings */
.findings { display: grid; gap: 8px; }
.finding {
  width: 100%; display: grid; gap: 10px; padding: 12px 12px 12px 14px; text-align: left;
  border: 1px solid var(--rule); border-radius: var(--radius-card); background: transparent;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.finding:hover { border-color: var(--rule-strong); }
.finding:active { transform: scale(var(--press)); }
.finding[aria-pressed="true"] { background: var(--accent-tint); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.f-top { display: flex; align-items: center; gap: 10px; }
.f-sw { width: 14px; height: 14px; border-radius: 4px; box-shadow: 0 0 0 1px var(--rule-strong); flex: none; }
.f-abbr { font-family: var(--machine); font-size: 12px; font-weight: 500; letter-spacing: .04em; }
.f-name { font-size: 14px; font-weight: 500; flex: 1; min-width: 0; }
.f-p { font-family: var(--machine); font-size: 12px; color: var(--muted); white-space: nowrap; }
.f-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.f-k { font-size: 11.5px; color: var(--faint); }
.f-v { font-family: var(--machine); font-size: 15px; font-feature-settings: "tnum"; }
.f-v.na { font-family: var(--app); font-size: 12.5px; color: var(--faint); padding-top: 2px; }
.f-metric { display: grid; gap: 1px; }
.f-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); }
.f-jump { display: inline-flex; align-items: center; gap: 6px; font-family: var(--machine); font-size: 11px; color: var(--accent); white-space: nowrap; }
.f-jump .ic { width: 14px; height: 14px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: baseline; }
.kv dt { font-size: 13px; color: var(--muted); }
.kv dd { font-size: 14px; text-align: right; }
.kv .machine { font-size: 13px; }
.mls-val { display: inline-flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.note { font-size: 12px; color: var(--faint); }

.normal-hero { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; }
.normal-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--normal-tint); color: var(--normal); }
.normal-ic .ic { width: 20px; height: 20px; stroke-width: 1.5; }
.normal-title { font-family: var(--display); font-weight: 500; font-size: 20px; letter-spacing: -.012em; line-height: 1.25; }
.checks { display: grid; border-top: 1px solid var(--rule); }
.checks li { display: grid; grid-template-columns: 14px 44px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }
.checks .machine { font-size: 11.5px; }
.checks .nd { font-size: 12px; color: var(--normal); display: inline-flex; gap: 4px; align-items: center; }
.checks .nd .ic { width: 14px; height: 14px; }

.report-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.report {
  font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; padding: 14px; border-radius: var(--radius-card);
  border: 1px solid var(--rule); background: var(--surface);
}
.report .m { font-family: var(--machine); font-size: 12.5px; }
.prov { display: grid; gap: 4px; font-size: 11.5px; color: var(--faint); }
.prov .machine { font-size: 11px; }

.err-box { display: grid; gap: 10px; padding: 14px; border-radius: var(--radius-card); background: var(--critical-tint); color: var(--critical); }
.err-box p { color: var(--ink); font-size: 13.5px; }
.err-title { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.err-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.skel { height: 12px; border-radius: 6px; background: var(--field-2); }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-control);
  background: var(--ink); color: var(--field); font-size: 13.5px; box-shadow: var(--lift-2);
}
.toast .ic { width: 16px; height: 16px; }

/* ======================= MOCKUP CHROME ======================= */
.states-btn {
  position: fixed; right: 16px; bottom: 16px; z-index: 40; display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px; border-radius: var(--radius-pill); border: 1px dashed var(--rule-strong);
  background: var(--surface); color: var(--muted); font-family: var(--machine); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; box-shadow: var(--lift-1);
}
.states-btn:hover { color: var(--ink); }
.states-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warning); }
.states {
  position: fixed; top: 12px; right: 12px; bottom: 60px; width: 320px; z-index: 45; overflow-y: auto;
  background: var(--surface); border: 1px dashed var(--rule-strong); border-radius: var(--radius-card); box-shadow: var(--lift-2);
  padding: 16px; display: grid; gap: 12px; align-content: start;
}
.states-head { display: flex; justify-content: space-between; align-items: center; }
.states-title { font-family: var(--display); font-size: 16px; font-weight: 600; }
.states-note { font-size: 12px; color: var(--faint); }
.states-list { display: grid; gap: 12px; }
.states-group { display: grid; gap: 2px; }
.states-group .kicker { margin-bottom: 4px; }
.state-link { display: block; padding: 6px 8px; border-radius: var(--radius-nav); font-size: 13px; color: var(--ink); text-decoration: none; }
.state-link:hover { background: var(--field); }
.state-link[aria-current="true"] { background: var(--accent-tint); font-weight: 500; }
.states-settings { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--rule); }
.states-settings .kicker { margin-top: 6px; }
.contract-check { font-size: 11.5px; }
.contract-check.ok { color: var(--normal); }
.contract-check.bad { color: var(--critical); white-space: pre-wrap; }

/* ---------- responsive: demo target is a 1280+ laptop or projector ---------- */
@media (max-width: 1240px) {
  .layout { grid-template-columns: 248px minmax(0, 1fr) 352px; }
  .opacity input { width: 64px; }
}
@media (max-width: 1020px) {
  .workspace { height: auto; min-height: 100%; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .tray { border-right: 0; border-bottom: 1px solid var(--rule); max-height: none; }
  .tray-list { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .stage { padding: 12px 16px; }
  .viewer { min-height: 70vh; }
  .panel { border-left: 0; border-top: 1px solid var(--rule); }
  .brand-sub { display: none; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 16px; }
  .topbar .tag { display: none; }
  .panel-body { padding: 20px 16px 40px; }
  .vbar-controls { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
  .spin { animation: none; }
}
html.rm *, html.rm *::before, html.rm *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
html.rm .spin { animation: none; }
@media (forced-colors: active) {
  .ov img, .gt { forced-color-adjust: none; }
  .sw, .f-sw, .sw-f, .lg-sw { forced-color-adjust: none; }
}

/* stream dropped / reconnecting (Revision 2) */
.conn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-control); background: var(--info-tint); color: var(--info); font-size: 13.5px; }
.conn .spin { border-color: color-mix(in srgb, var(--info) 30%, transparent); border-top-color: var(--info); }
.err-box-warn { background: var(--warning-tint); color: var(--warning); }

/* 1280-class laptops: keep the viewer toolbar on one row of controls */
@media (max-width: 1400px) {
  .v-wl, .vsep, .lbl-long { display: none; }
  .opacity input { width: 60px; }
  .vbar-controls { gap: 6px; }
}
