/* Cardiac Electrophysiology Workstation. Light instrument surfaces, 1px hairlines, course tokens only (styles.css :root). */
.ws-host { container-type: inline-size; container-name: ws; width: 100%; }
.ws { --ws-rail: 368px; --ws-bar: var(--topbar, 58px); display: grid; grid-template-columns: minmax(0, 1fr) var(--ws-rail); min-height: calc(100vh - var(--ws-bar)); background: var(--surface, #F8FAFC); color: var(--ink, #0F172A); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
.ws *, .ws *::before, .ws *::after { box-sizing: border-box; }
.ws-mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ws-sp { flex: 1; }
.ws-div { width: 1px; align-self: stretch; margin: 7px 4px; background: var(--line, #E2E8F0); flex: none; }

/* ---------- main column: toolbar, stage, dock ---------- */
.ws-main { display: flex; flex-direction: column; min-width: 0; position: sticky; top: var(--ws-bar); height: calc(100vh - var(--ws-bar)); min-height: 560px; background: var(--canvas, #fff); border-right: 1px solid var(--line, #E2E8F0); }
.ws-tools { display: flex; align-items: center; gap: 6px; flex: none; min-height: 46px; padding: 4px 12px; flex-wrap: wrap; row-gap: 4px; background: var(--canvas, #fff); border-bottom: 1px solid var(--line, #E2E8F0); }
.ws-tools::-webkit-scrollbar { display: none; }
.ws-grp { display: flex; gap: 2px; flex: none; }
@container ws (max-width: 1100px) { .ws-perf { display: none; } }
.ws-perf { font-size: 10.5px; color: var(--faint, #64748B); white-space: nowrap; padding-left: 10px; }
.ws-stage { position: relative; flex: 1 1 auto; min-height: 260px; overflow: hidden; background: linear-gradient(#FFFFFF, #F8FAFC); }
.ws-stage .h3d { left: 0; top: 0; width: 100%; height: 100%; }
.ws-nogl { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; text-align: center; color: var(--muted, #475569); font-size: 13px; }
.ws-nogl b { color: var(--ink); font-size: 14px; }
.ws-dock { flex: none; background: var(--canvas, #fff); border-top: 1px solid var(--line, #E2E8F0); padding: 8px 14px 10px; display: flex; flex-direction: column; gap: 6px; }
.ws-readout { display: flex; align-items: center; gap: 14px; height: 22px; font-size: 12px; white-space: nowrap; overflow: hidden; }
.ws-ro-lead { font-weight: 700; letter-spacing: 0.01em; }
.ws-ro-val { font-size: 13px; font-weight: 600; min-width: 74px; }
.ws-ro-ph { display: inline-flex; align-items: center; gap: 7px; color: var(--muted, #475569); font-weight: 600; }
.ws-ro-ph i { width: 8px; height: 8px; border-radius: 2px; background: #94A3B8; flex: none; }
.ws-ro-t { color: var(--faint, #64748B); font-size: 11px; }
.ws-strip { display: block; width: 100%; height: 124px; border: 1px solid var(--line, #E2E8F0); border-radius: 6px; background: #fff; }
.ws-tl { display: block; width: 100%; height: 36px; }
.ws-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- controls ---------- */
.ws-b { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 11px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted, #475569); font: 600 12px/1 var(--sans); cursor: pointer; white-space: nowrap; transition: background-color .16s var(--out), color .16s var(--out), border-color .16s var(--out); }
.ws-b:hover { background: var(--surface2, #F1F5F9); color: var(--ink); }
.ws-b:focus-visible { outline: 2px solid var(--blue, #1D4ED8); outline-offset: 1px; }
.ws-b.on { background: var(--ink, #0F172A); color: #fff; }
.ws-b:disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.ws-b svg { width: 12px; height: 12px; }
.ws-play { background: var(--ink, #0F172A); color: #fff; min-width: 76px; }
.ws-play:hover { background: var(--ink2, #1E293B); color: #fff; }
.ws-ctl .ws-b:not(.ws-play):not(.on) { border-color: var(--line, #E2E8F0); background: #fff; }
.ws-ctl .ws-seg .ws-b, .ws-tools .ws-b { border-color: transparent; }
.ws-ctl .ws-seg .ws-b:not(.on) { background: transparent; }
.ws-tg:not(.on) { color: var(--faint, #64748B); }
.ws-tools .ws-tg.on, .ws-ctl .ws-tg.on { background: var(--surface2, #F1F5F9); color: var(--ink); border-color: var(--line2, #CBD5E1); }
.ws-tools .ws-tg.on::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--teal, #0D9488); }
.ws-seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line, #E2E8F0); border-radius: 9px; background: var(--surface, #F8FAFC); }
.ws-seg .ws-b { height: 24px; padding: 0 9px; border-radius: 6px; font-size: 11.5px; }
.ws-tools .ws-grp[data-g=view] { gap: 2px; padding: 2px; border: 1px solid var(--line, #E2E8F0); border-radius: 9px; background: var(--surface, #F8FAFC); }
.ws-tools .ws-grp[data-g=view] .ws-b { height: 26px; border-radius: 6px; padding: 0 10px; font-size: 11.5px; }
.ws-tools .ws-grp[data-g=view] .ws-b.on { background: #fff; color: var(--ink); border-color: var(--line2, #CBD5E1); box-shadow: var(--sh-1); }
.ws-seg[role=radiogroup] .ws-b.on { background: #fff; color: var(--ink); border-color: var(--line2, #CBD5E1); box-shadow: var(--sh-1); }
.ws-mini { height: 20px; padding: 0 7px; font-size: 10.5px; border: 1px solid var(--line, #E2E8F0); background: #fff; margin-left: auto; margin-right: 8px; }

/* ---------- rail ---------- */
.ws-rail { min-width: 0; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.ws-sec { background: var(--canvas, #fff); border: 1px solid var(--line, #E2E8F0); border-radius: 12px; padding: 12px 14px 14px; min-width: 0; }
.ws-sec h3 { margin: 0 0 10px; display: flex; align-items: baseline; gap: 8px; font: 700 10.5px/1 var(--sans); letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink, #0F172A); }
.ws-sec h3 small { font: 500 10.5px/1 var(--sans); letter-spacing: 0; text-transform: none; color: var(--faint, #64748B); }
.ws-lab { font: 600 10.5px/1 var(--sans); color: var(--faint, #64748B); margin: 0 0 6px; }
.ws-leads { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.ws-lead-pill { position: absolute; left: 0; top: 0; border-radius: 8px; background: var(--ink, #0F172A); pointer-events: none; will-change: transform; }
.ws-lead { position: relative; z-index: 1; appearance: none; height: 32px; border: 1px solid var(--line, #E2E8F0); border-radius: 8px; background: transparent; color: var(--ink2, #1E293B); font: 600 12px/1 var(--mono); cursor: pointer; transition: color .15s, border-color .15s; padding: 0; }
.ws-lead:hover { border-color: var(--ink, #0F172A); }
.ws-lead:focus-visible { outline: 2px solid var(--blue, #1D4ED8); outline-offset: 1px; }
.ws-lead.on { color: #fff; border-color: transparent; }
.ws-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
.ws-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
.ws-grid3 .ws-b, .ws-grid4 .ws-b { padding: 0 4px; }
.ws-cond .ws-seg { margin-bottom: 12px; }
.ws-site { display: none; }
.ws-site.on { display: block; }
.ws-sl { display: block; margin: 0 0 12px; }
.ws-sl.off { opacity: 0.4; }
.ws-sl-h { display: flex; align-items: center; font: 600 12px/1 var(--sans); color: var(--ink2, #1E293B); margin-bottom: 8px; }
.ws-sl-h output { font-size: 12px; color: var(--ink); min-width: 52px; text-align: right; }
.ws-sl input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; margin: 0; background: transparent; cursor: pointer; --p: 50%; }
.ws-sl input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(to right, var(--ink, #0F172A) var(--p), var(--line2, #CBD5E1) var(--p)); }
.ws-sl input[type=range]::-moz-range-track { height: 3px; border-radius: 2px; background: var(--line2, #CBD5E1); }
.ws-sl input[type=range]::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--ink, #0F172A); }
.ws-sl input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6.5px; border-radius: 50%; background: #fff; border: 1.5px solid var(--ink, #0F172A); box-shadow: var(--sh-1); }
.ws-sl input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 1.5px solid var(--ink, #0F172A); }
.ws-sl input[type=range]:focus-visible { outline: 2px solid var(--blue, #1D4ED8); outline-offset: 2px; border-radius: 4px; }
.ws-note { margin: 2px 0 0; font-size: 12px; line-height: 1.5; color: var(--muted, #475569); }
.ws-loops { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ws-loops figure { margin: 0; min-width: 0; }
.ws-lp { display: block; width: 100%; aspect-ratio: 1; border: 1px solid var(--line, #E2E8F0); border-radius: 8px; background: #fff; }
.ws-loops figcaption { margin-top: 5px; font: 600 11px/1 var(--sans); color: var(--faint, #64748B); text-align: center; }
.ws-leg { display: flex; align-items: center; gap: 5px; margin-top: 9px; font: 600 11px/1 var(--sans); color: var(--muted, #475569); }
.ws-leg i { width: 8px; height: 8px; border-radius: 2px; margin-left: 6px; }
.ws-leg i:first-child { margin-left: 0; }
.ws-leg em { font-style: normal; font-weight: 500; color: var(--faint, #64748B); }
.ws-tm { display: block; width: 100%; height: 206px; border: 1px solid var(--line, #E2E8F0); border-radius: 8px; background: #fff; }
.ws-nums { margin-top: 9px; font-size: 11px; color: var(--ink2, #1E293B); white-space: pre; overflow: hidden; }
.ws-ex-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ws-ex-sw { width: 9px; height: 9px; border-radius: 2px; background: #94A3B8; flex: none; }
.ws-ex-phase { font: 700 14px/1.1 var(--sans); }
.ws-ex-cond { margin-left: auto; font: 600 11px/1 var(--sans); color: var(--muted, #475569); border: 1px solid var(--line2, #CBD5E1); border-radius: 999px; padding: 4px 9px; }
.ws-ex-body { will-change: opacity, transform; }
.ws-ex-body p { margin: 0 0 9px; font-size: 12.5px; line-height: 1.55; color: var(--ink2, #1E293B); }
.ws-ex-body p:last-child { margin-bottom: 0; }
.ws-ex-body p b { display: block; font: 700 10.5px/1 var(--sans); letter-spacing: 0.07em; text-transform: uppercase; color: var(--faint, #64748B); margin-bottom: 3px; }
.ws-ex-body p[data-k=dip] b, .ws-ex-body p[data-k=lead] b { display: inline; }
.ws-ex-body p[data-k=dip] b::after, .ws-ex-body p[data-k=lead] b::after { content: ""; }
.ws-ex-body p[data-k=dip], .ws-ex-body p[data-k=lead] { padding-top: 9px; border-top: 1px solid var(--line, #E2E8F0); }
.ws-ex-body p[data-k=dip] b, .ws-ex-body p[data-k=lead] b { text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--ink); margin: 0; }

/* ---------- 3D label chrome from Heart3D stays at the viewport edges; keep controls above it ---------- */
.ws-stage .h3d-hint { display: none; }

/* ---------- narrow: rail goes below the stage ---------- */
@container ws (max-width: 940px) {
  .ws { grid-template-columns: minmax(0, 1fr); }
  .ws-main { position: relative; top: 0; height: auto; min-height: 0; border-right: 0; border-bottom: 1px solid var(--line, #E2E8F0); }
  .ws-stage { flex: none; height: clamp(360px, 62vh, 620px); }
  .ws-rail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .ws-explain { grid-column: 1 / -1; }
}
@container ws (max-width: 640px) {
  .ws-rail { grid-template-columns: minmax(0, 1fr); }
  .ws-stage { height: clamp(320px, 58vh, 480px); }
  .ws-strip { height: 104px; }
  .ws-perf { display: none; }
}
@media (prefers-reduced-motion: reduce) { .ws-b, .ws-lead { transition: none; } }
html.focus .ws, html.focus .ws-main { --ws-bar: 0px; }
.ws-tools { gap: 4px; padding: 4px 10px; }
.ws-tools .ws-b { padding: 0 8px; font-size: 11.5px; }
.ws-tools .ws-tg.on::before { display: none; }
.ws-tools .ws-grp[data-g=view] .ws-b { padding: 0 8px; }
.ws-div { margin: 7px 2px; }
