/* ============================================================
   SpineOS  |  Clinician Workspace
   Consumes shared tokens from packages/design/tokens.css.
   Local overrides are kept minimal.
   ============================================================ */

/* ---- Local overrides ---- */
:root:not([data-theme="dark"]) {
  --bg: #eef1f5;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, var(--accent-soft), transparent 24%),
    radial-gradient(circle at 80% 0%, rgba(15, 23, 42, 0.04), transparent 30%),
    linear-gradient(180deg, var(--surface-muted) 0%, var(--bg) 100%);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---- Dark mode theme toggle button ---- */
.theme-toggle {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--muted);
  transition: background var(--ease), color var(--ease);
}
.theme-toggle:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

button, input, select { font: inherit; }

/* ---- Demo banner (app-level, gated by DEMO_FALLBACK_ENABLED) ---- */
.demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-toast);
  padding: 6px 16px;
  background: linear-gradient(90deg, #f59e0b, #d97706);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-align: center;
  letter-spacing: 0.3px;
}
.demo-banner ~ * { margin-top: 32px; }

/* ============================================================
   LOGIN
   ============================================================ */

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--gap-xl);
}

.login-card {
  width: min(560px, 100%);
  padding: var(--gap-xl);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.login-badge, .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-xs);
  color: var(--accent-ink);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---- Severity Badges ---- */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.status-pill.danger   { color: var(--danger);  background: var(--danger-soft);  border-color: rgba(185,77,72,0.32); }
.status-pill.warning  { color: var(--warning); background: var(--warning-soft); border-color: rgba(192,106,27,0.32); }
.status-pill.success  { color: var(--success); background: var(--success-soft); border-color: rgba(47,125,86,0.32); }

/* ---- Clinical Alert Badges ---- */
.mini-grid .alert-badge,
.alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(185, 77, 72, 0.15);
}
.alert-badge::before {
  content: "⚠";
  font-size: 0.8em;
}

.login-card h1,
.workspace-header h2,
.brand-block h1,
.control-head h3,
.viewer-head h3,
.inspector-card h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

.login-card h1 {
  margin-top: 14px;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 0.95;
}

.login-form,
.top-controls,
.field-grid,
.mini-grid,
.metrics-grid,
.chip-grid,
.episode-list,
.measurement-history {
  display: grid;
  gap: var(--gap-md);
}

.login-form { margin-top: var(--gap); }

label {
  display: grid;
  gap: var(--gap-xs);
}

label span {
  font-size: 0.9rem;
  color: var(--muted);
}

input, select {
  width: 100%;
  padding: var(--input-padding);
  border-radius: var(--input-radius);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--ink);
  font-size: var(--input-font-size);
}

input:focus, select:focus {
  outline-width: 2px;
  outline-style: solid;
  outline-color: var(--accent);
  outline-offset: -2px;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.login-actions, .row-actions, .header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.header-actions {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* ---- Shared button tokens ---- */

.primary-button,
.secondary-button,
.chip,
.segment,
.episode-button {
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: var(--ease);
}

.primary-button, .secondary-button {
  padding: var(--btn-padding);
  justify-content: center;
  align-items: center;
  display: inline-flex;
  min-height: var(--btn-min-height);
  font-size: var(--btn-font-size);
  border-radius: var(--btn-radius);
}

.primary-button {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-ink) 100%);
  border-color: rgba(15, 118, 110, 0.4);
  color: white;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.18);
}

.primary-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-button:hover,
.chip:hover,
.segment:hover,
.episode-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.secondary-button.accent,
.segment.active,
.chip.active,
.chip.placed {
  background: var(--accent-soft);
  border-color: rgba(15, 118, 110, 0.24);
  color: var(--accent-ink);
}

.chip.placed:not(.active) {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(47, 125, 86, 0.18);
}

/* ============================================================
   PLANNER SHELL — main two-column layout
   ============================================================ */

.planner-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.episode-rail {
  padding: var(--gap-lg) var(--gap);
  border-right: 1px solid var(--line);
  background: var(--surface-muted);
  backdrop-filter: blur(20px);
  overflow-y: auto;
  max-height: 100vh;
  position: sticky;
  top: 0;
}

.brand-block { margin-bottom: var(--gap); }

.brand-block h1 {
  font-size: 2rem;
}

.brand-block p,
.workspace-header p,
.episode-meta,
.muted,
.control-copy,
.viewer-head p,
.inspector-card p {
  color: var(--muted);
  line-height: 1.55;
}

.rail-card, .surface {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-sm);
}

.rail-card {
  padding: var(--gap-md);
  margin-bottom: var(--gap-sm);
}

.episode-button {
  display: grid;
  gap: 4px;
  padding: var(--gap-sm);
  border-radius: var(--radius-md);
  text-align: left;
}

.episode-button.active {
  background: linear-gradient(180deg, var(--accent-soft), rgba(15, 118, 110, 0.06));
  border-color: rgba(15, 118, 110, 0.22);
}

.episode-route {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--accent-ink);
}

/* ============================================================
   WORKSPACE MAIN AREA
   ============================================================ */

.workspace-main {
  padding: var(--gap-lg);
  min-width: 0;
}

.workspace-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--gap);
  align-items: flex-start;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: var(--gap-sm) 0 var(--gap);
  margin-bottom: var(--gap-lg);
  background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface-muted) 82%, transparent 100%);
  backdrop-filter: blur(10px);
}

.workspace-header > div:first-child {
  min-width: 0;
  flex: 1 1 300px;
}

.workspace-header h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.quiet-link {
  display: inline-flex;
  align-items: center;
  padding: 12px 16px;
  color: var(--muted);
  text-decoration: none;
}

/* ---- Two-column planner grid ---- */

.planner-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 340px);
  gap: var(--gap);
}

.stage-column, .inspector-column {
  display: grid;
  gap: var(--gap);
  min-width: 0;
}

.viewer-surface, .inspector-card {
  padding: var(--gap-lg);
}

/* ---- Top controls / mode controls ---- */

.top-controls {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
}

.control-card {
  margin-top: var(--gap-md);
  padding-top: var(--gap-md);
  border-top: 1px solid var(--line);
}

.control-head, .viewer-head {
  display: flex;
  justify-content: space-between;
  gap: var(--gap-md);
  align-items: flex-start;
}

.control-head h3, .viewer-head h3, .inspector-card h3 {
  font-size: 1.3rem;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.82rem;
  font-weight: 600;
}

/* ---- Landmark workflow chips ---- */

.landmark-group + .landmark-group { margin-top: var(--gap-sm); }

.workflow-focus {
  margin-top: var(--gap-md);
  padding: var(--gap-md) var(--gap);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-strong), var(--surface-muted));
}

.workflow-focus strong {
  display: block;
  margin-top: 4px;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.workflow-focus p {
  margin: var(--gap-xs) 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.workflow-steps {
  display: grid;
  gap: 10px;
  margin-top: var(--gap-md);
}

/* ---- Wizard card ---- */

.wizard-card {
  display: grid;
  gap: var(--gap-sm);
  margin-top: var(--gap-md);
}

.wizard-progress {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.wizard-progress strong {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

.wizard-progress-bar {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.wizard-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #36b5a0);
}

.wizard-current, .wizard-upcoming {
  padding: var(--gap-md) var(--gap);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.wizard-current strong, .wizard-step strong {
  display: block;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.wizard-current p, .wizard-step span {
  margin: var(--gap-xs) 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.wizard-upcoming {
  display: grid;
  gap: 10px;
}

.wizard-step {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: var(--gap-sm) 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: var(--ease);
}

.wizard-step:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

/* ---- Workflow step items ---- */

.workflow-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--gap-sm);
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  transition: var(--ease);
  text-align: left;
}

.workflow-step:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.workflow-step.active {
  border-color: rgba(15, 118, 110, 0.24);
  background: var(--accent-soft);
}

.workflow-step.placed:not(.active) {
  border-color: rgba(47, 125, 86, 0.18);
  background: var(--success-soft);
}

.workflow-step.candidate:not(.placed) {
  border-color: rgba(192, 106, 27, 0.2);
  background: var(--warning-soft);
}

.workflow-step-index {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.06);
  font-size: 0.74rem;
  font-weight: 700;
}

.workflow-step-copy {
  display: grid;
  gap: 4px;
}

.workflow-step-copy strong { font-size: 0.95rem; }

.workflow-step-copy span, .workflow-step-state {
  font-size: 0.8rem;
  color: var(--muted);
}

.workflow-step-state { white-space: nowrap; }

.group-title {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.chip {
  padding: 10px 14px;
  text-align: left;
  border-radius: var(--radius-sm);
}

.segment-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-xs);
}

.segment { padding: 10px 14px; }

.field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ============================================================
   VIEWER
   ============================================================ */

.viewer-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-sm);
}

.viewer-stats div {
  min-width: 120px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--line);
}

.viewer-stats span,
.metric-card .metric-label,
.mini-grid span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
}

/* secondary actions row */
.viewer-toolbar-actions {
  display: flex;
  gap: var(--gap-xs);
  margin-top: var(--gap-sm);
}

.upload-control, .viewer-slider {
  display: grid;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.upload-control {
  position: relative;
  min-height: 58px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(15, 118, 110, 0.16);
  background: linear-gradient(180deg, var(--accent-soft), rgba(15, 118, 110, 0.03));
  cursor: pointer;
}

.upload-control:hover { border-color: rgba(15, 118, 110, 0.28); }

.upload-control.compact {
  min-height: auto;
  padding: 8px 12px;
}

.upload-control input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-label {
  font-size: 0.82rem;
  color: var(--accent-ink);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-control strong {
  display: block;
  font-size: 0.92rem;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-slider {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.viewer-slider.compact {
  padding: 6px 10px;
}

.viewer-slider.compact span {
  font-size: 0.78rem;
}

.viewer-slider input[type="range"] {
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

/* ---- Crop controls ---- */

.crop-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}

.crop-controls.compact {
  padding: 0;
}

.crop-btn {
  font-size: 0.78rem;
  padding: 4px 10px;
}

.crop-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.viewer-stage.crop-mode {
  cursor: crosshair;
}

.crop-selection {
  position: absolute;
  border: 2px dashed rgba(255, 255, 255, 0.9);
  background: rgba(15, 118, 110, 0.15);
  pointer-events: none;
  z-index: 15;
  border-radius: 2px;
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.35);
}

/* ---- Dual-viewer strip ---- */

.dual-viewer-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-sm);
  margin-top: var(--gap-sm);
}

.viewer-panel {
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  padding: var(--gap-sm);
  background: var(--surface-muted);
  transition: border-color var(--ease);
  min-width: 0;
}

.viewer-panel.active {
  border-color: rgba(15, 118, 110, 0.4);
  background: var(--surface);
}

.viewer-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--gap-xs);
  margin-bottom: var(--gap-xs);
}

.viewer-panel-head strong {
  display: block;
  font-size: 0.88rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-pill.small {
  padding: 4px 8px;
  font-size: 0.72rem;
}

.viewer-panel-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: var(--gap-xs);
}

/* Camera control: hidden on desktop, shown on touch */
.camera-control {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .camera-control {
    display: grid;
  }
}

/* ---- Paste hint ---- */

.paste-hint {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  border: 1px solid var(--line);
}

.viewer-head-hint {
  display: flex;
  align-items: center;
}

/* ---- Empty stage (compact for panels) ---- */

.empty-stage.compact {
  min-height: 200px;
  padding: var(--gap);
}

.empty-stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-xs);
  margin-top: var(--gap-sm);
  justify-content: center;
}

/* ---- Cross-view summary ---- */

.view-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap-xs);
  flex-wrap: wrap;
}

.cross-view-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface-muted);
  font-size: 0.76rem;
  color: var(--muted);
}

/* ---- Stage ---- */

.viewer-stage-scroll {
  overflow: auto;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  padding: var(--gap-sm);
  min-width: 0;
}

.viewer-stage {
  position: relative;
  min-width: 100%;
  cursor: crosshair;
  margin: 0 auto; /* center when smaller than container */
}

.viewer-stage img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

/* ---- Overlay ---- */

.overlay-layer {
  position: absolute;
  inset: 0;
}

.overlay-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.overlay-line {
  stroke-width: 0.4;
  vector-effect: non-scaling-stroke;
}

.overlay-line.landmark      { stroke: rgba(15, 118, 110, 0.95); }
.overlay-line.landmark.subtle { stroke: rgba(15, 118, 110, 0.55); }
.overlay-line.measurement   { stroke: rgba(255, 255, 255, 0.92); }
.overlay-line.calibration   { stroke: rgba(192, 106, 27, 0.95); }
.overlay-line.guide         { stroke: rgba(255, 255, 255, 0.4); stroke-dasharray: 1 1; }
.overlay-line.soft          { opacity: 0.65; }

.overlay-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  padding: 0;
  transform: translate(-50%, -50%);
  border: none;
  background: transparent;
  color: white;
  cursor: grab;
  overflow: visible;
}

.overlay-handle:active { cursor: grabbing; }

.overlay-handle.measurement, .overlay-handle.calibration {
  width: 10px;
  height: 10px;
}

.overlay-handle .handle-dot {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  border: 1.2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-ink) 100%);
}

.overlay-handle.measurement .handle-dot {
  background: linear-gradient(180deg, #111827 0%, #1f2937 100%);
}

.overlay-handle.calibration .handle-dot {
  background: linear-gradient(180deg, var(--warning) 0%, #a85a15 100%);
}

.overlay-handle.context .handle-dot { opacity: 0.55; }

.overlay-handle.assisted .handle-dot {
  background: linear-gradient(180deg, var(--warning) 0%, #a85a15 100%);
}

.overlay-handle.assist-candidate {
  width: 14px;
  height: 14px;
  z-index: 3;
}

.overlay-handle.assist-candidate .handle-dot {
  background: linear-gradient(180deg, var(--warning) 0%, #a85a15 100%);
  border-width: 1.4px;
  box-shadow: 0 0 0 5px rgba(192, 106, 27, 0.2), 0 8px 18px rgba(0, 0, 0, 0.24);
}

.overlay-handle.active .handle-dot {
  box-shadow: 0 0 0 4px var(--accent-soft), 0 6px 16px rgba(0, 0, 0, 0.22);
}

.handle-label {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.58rem;
  font-weight: 700;
  color: #fff;
  background: rgba(15, 118, 110, 0.82);
  border-radius: 3px;
  padding: 0 3px;
  white-space: nowrap;
  pointer-events: none;
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.overlay-handle.context .handle-label { opacity: 0.55; }
.overlay-handle.assisted .handle-label {
  background: rgba(192, 106, 27, 0.82);
}

/* ---- Floating measurement tooltip ---- */

.floating-result {
  position: absolute;
  z-index: 10;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  pointer-events: none;
  backdrop-filter: blur(10px);
  white-space: nowrap;
  transform: translate(-50%, -120%);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.floating-result::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(15, 23, 42, 0.88);
}

/* ---- Empty state ---- */

.empty-stage {
  min-height: 400px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface-muted), var(--surface));
  border: 1px dashed var(--line-strong);
  display: grid;
  place-items: center;
  text-align: center;
  padding: var(--gap-xl);
}

.empty-stage strong {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.empty-stage p {
  margin: var(--gap-xs) 0 0;
  color: var(--muted);
  max-width: 36ch;
  line-height: 1.55;
}

/* ============================================================
   INSPECTOR COLUMN
   ============================================================ */

.inspector-column {
  min-width: 0;
  overflow: hidden;
}

.mini-grid, .metrics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: var(--gap-md);
}

.mini-grid article, .metric-card {
  padding: var(--gap-sm);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  min-width: 0;
  overflow: hidden;
}

.metric-card strong, .mini-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.metric-card.missing strong { color: var(--muted); }

.measurement-result-panel {
  display: grid;
  gap: var(--gap-sm);
}

.chip--green {
  background: var(--success-soft);
  border-color: rgba(47, 125, 86, 0.22);
  color: var(--success);
}

.chip--orange {
  background: var(--warning-soft);
  border-color: rgba(192, 106, 27, 0.22);
  color: var(--warning);
}

.chip--red {
  background: var(--danger-soft);
  border-color: rgba(185, 77, 72, 0.22);
  color: var(--danger);
}

.note-panel {
  display: grid;
  gap: var(--gap-sm);
}

.note-panel-head {
  display: flex;
  justify-content: space-between;
  gap: var(--gap-sm);
  align-items: flex-start;
}

.note-panel-head p {
  margin-top: 6px;
}

.note-packet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-sm);
}

.note-packet-grid article {
  padding: var(--gap-sm);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.note-packet-grid span {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
}

.note-packet-grid strong {
  display: block;
  margin-top: 6px;
  letter-spacing: -0.02em;
}

.medical-necessity-panel {
  display: grid;
  gap: 10px;
  padding: var(--gap-sm);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.medical-necessity-head {
  display: flex;
  justify-content: space-between;
  gap: var(--gap-sm);
  align-items: flex-start;
}

.medical-necessity-head__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.medical-necessity-head__actions .secondary-button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.78rem;
}

.medical-necessity-head h4 {
  margin-top: 4px;
  letter-spacing: -0.01em;
}

.medical-necessity-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.medical-necessity-counts span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
}

.medical-necessity-rows {
  display: grid;
  gap: 8px;
}

.medical-necessity-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
}

.medical-necessity-row > div {
  min-width: 0;
}

.medical-necessity-row span,
.medical-necessity-row small {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.medical-necessity-row strong {
  display: block;
  margin-top: 3px;
  line-height: 1.28;
}

.medical-necessity-row ul {
  margin: 8px 0 0 18px;
  padding: 0;
  color: var(--text);
  font-size: 0.78rem;
}

.medical-necessity-row li + li {
  margin-top: 4px;
}

.medical-necessity-gap {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(185, 77, 72, 0.22);
  background: var(--danger-soft);
}

.medical-necessity-gap p {
  margin-top: 4px;
  color: var(--danger);
}

.handoff-panel {
  display: grid;
  gap: 10px;
  padding: var(--gap-sm);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-muted), var(--surface));
}

.handoff-panel-head {
  display: flex;
  justify-content: space-between;
  gap: var(--gap-sm);
  align-items: flex-start;
}

.handoff-panel-head h4 {
  margin-top: 4px;
  letter-spacing: -0.02em;
}

.handoff-checklist {
  display: grid;
  gap: 8px;
}

.handoff-check-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
}

.handoff-check-row span {
  color: var(--muted);
}

.handoff-task-list {
  display: grid;
  gap: 8px;
}

.handoff-task-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
}

.handoff-task-row > div {
  display: grid;
  gap: 2px;
}

.handoff-task-row small {
  color: var(--muted);
}

.handoff-escalation {
  display: grid;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.handoff-escalation-head {
  display: grid;
  gap: 2px;
}

.handoff-escalation-head small {
  color: var(--muted);
}

.handoff-escalation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.packet-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.packet-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid rgba(15, 118, 110, 0.18);
  font-size: 0.78rem;
}

.note-support-list {
  display: grid;
  gap: 8px;
}

.note-support-row,
.note-history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap-sm);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.note-support-row span,
.note-history-row small {
  color: var(--muted);
}

.note-history {
  display: grid;
  gap: 8px;
}

.note-history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.note-history-row > div {
  display: grid;
  gap: 2px;
}

.note-field {
  display: grid;
  gap: 6px;
}

.note-field.compact textarea {
  min-height: 72px;
}

.note-field textarea {
  width: 100%;
  padding: var(--input-padding);
  border-radius: var(--input-radius);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--ink);
  font-size: var(--input-font-size);
  line-height: 1.5;
  resize: vertical;
  min-height: 96px;
}

.note-field textarea:focus {
  outline-width: 2px;
  outline-style: solid;
  outline-color: var(--accent);
  outline-offset: -2px;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

@media (max-width: 720px) {
  .handoff-escalation-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Comparison benchmarks (structured, not JSON) ---- */

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-sm);
  margin-top: var(--gap-md);
}

.comparison-item {
  padding: var(--gap-sm);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 2px;
}

.comparison-item .comp-label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  padding-right: 80px; /* room for risk badge */
}

.comparison-item .comp-value {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* ---- Risk-Level Comparison Items ---- */
.comparison-item.risk-high    { border-color: rgba(185,77,72,0.20); background: var(--danger-soft); }
.comparison-item.risk-optimal { border-color: rgba(47,125,86,0.18); background: var(--success-soft); }
.comparison-item.risk-moderate { border-color: rgba(192,106,27,0.18); background: var(--warning-soft); }

.comp-header {
  display: contents;
}
.comp-risk-label {
  position: absolute;
  top: var(--gap-sm);
  right: var(--gap-sm);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.comp-risk-label.risk-high     { color: var(--danger);  background: rgba(185,77,72,0.12); }
.comp-risk-label.risk-optimal  { color: var(--success); background: rgba(47,125,86,0.12); }
.comp-risk-label.risk-moderate { color: var(--warning); background: rgba(192,106,27,0.12); }

.comp-bar-track {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--line);
  margin-top: auto;
  padding-top: 4px;
  overflow: hidden;
}
.comp-bar-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.4s ease;
}
.comp-bar-fill.risk-high     { background: var(--danger); }
.comp-bar-fill.risk-optimal  { background: var(--success); }
.comp-bar-fill.risk-moderate { background: var(--warning); }

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.84rem;
  line-height: 1.55;
  font-family: var(--font-mono);
  min-width: 0;
  overflow: hidden;
}

.notice {
  margin-top: var(--gap-md);
  padding: var(--gap-sm) var(--gap-md);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
}

.notice.success {
  background: var(--success-soft);
  border: 1px solid rgba(47, 125, 86, 0.18);
  color: var(--success);
}

.notice.error {
  background: var(--danger-soft);
  border: 1px solid rgba(185, 77, 72, 0.18);
  color: var(--danger);
}

/* ---- Viewer side panel (within stage area) ---- */
.viewer-layout {
  display: grid;
  gap: var(--gap-md);
  min-width: 0;
}

.viewer-sidepanel {
  display: grid;
  gap: var(--gap-sm);
  align-content: start;
}

.sidecard {
  padding: var(--gap-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-strong), var(--surface-muted));
}

.sidecard.compact { padding: var(--gap-sm); }

.sidecard h4 {
  margin: 4px 0 0;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}

.sidecard p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.sidecard-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--gap-sm);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.04);
  font-size: 0.76rem;
  color: var(--muted);
}

.status-badge.manual {
  color: var(--accent-ink);
  border-color: rgba(15, 118, 110, 0.18);
  background: var(--accent-soft);
}

.status-badge.assisted {
  color: var(--warning);
  border-color: rgba(192, 106, 27, 0.18);
  background: var(--warning-soft);
}

/* ---- Rail Action Button ---- */
.rail-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-xs);
  width: 100%;
  margin-top: var(--gap-sm);
  padding: 10px var(--gap);
  border: none;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent), #36b5a0);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--ease), transform var(--ease);
}
.rail-action-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ============================================================
   Redesign v2 — Workspace header (Phase 1a)
   Decluttered 3-region grid: patient · mode · utility icons + menu
   ============================================================ */

.ws-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--gap);
  padding: var(--gap-sm) var(--gap-sm);
  margin-bottom: var(--gap-lg);
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface-muted) 82%, transparent 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.ws-header__left {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
}

.ws-brand-mark {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-ink));
  color: #fff;
  display: grid; place-items: center;
  font-weight: var(--w-semibold);
  font-size: var(--t-caption);
  flex-shrink: 0;
}

.ws-patient {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: var(--leading-tight);
}
.ws-patient__name {
  font-size: var(--t-emph);
  font-weight: var(--w-semibold);
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-patient__meta {
  font-size: var(--t-caption);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-header__center {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  justify-self: center;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-muted);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}
.segmented__item {
  padding: 6px 14px;
  min-height: 32px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-size: var(--t-caption);
  font-weight: var(--w-semibold);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), box-shadow var(--ease);
}
.segmented__item:hover:not([aria-selected="true"]) { color: var(--ink); }
.segmented__item[aria-selected="true"] {
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.ws-compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  min-height: 34px;
  background: var(--surface-muted);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--t-caption);
  font-weight: var(--w-semibold);
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.ws-compare-toggle:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.ws-compare-toggle.is-active {
  background: var(--accent-wash);
  color: var(--accent-ink);
  border-color: transparent;
}

.ws-header__right {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  justify-self: end;
}

.ws-iconbtn {
  position: relative;
  width: 36px; height: 36px;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--muted);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.ws-iconbtn:hover { background: var(--surface-muted); color: var(--ink); }
.ws-iconbtn.is-active { background: var(--accent-wash); color: var(--accent-ink); }

.ws-iconbtn__badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  border: 2px solid var(--surface-muted);
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: var(--w-semibold);
  line-height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ws-header__divider {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 4px;
}

.ws-menu-wrap { position: relative; }

.ws-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 6px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ws-menu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 8px 12px;
  min-height: 36px;
  width: 100%;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: var(--t-caption);
  font-weight: var(--w-semibold);
  letter-spacing: -0.005em;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.ws-menu__item:hover,
.ws-menu__item:focus-visible { background: var(--surface-muted); }
.ws-menu__item.is-active { background: var(--accent-wash); color: var(--accent-ink); }
.ws-menu__item--danger { color: var(--danger); }
.ws-menu__item--danger:hover { background: var(--danger-soft); }
.ws-menu__hint {
  color: var(--muted);
  font-weight: var(--w-normal);
  font-family: var(--font-mono);
  font-size: 11px;
}
.ws-menu__sep {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}

/* ============================================================
   Redesign v2 — Inspector column (Phase 1c)
   Persistent episode context + 4 tabs (Metrics/Notes/PROM/Care)
   ============================================================ */

.inspector-context {
  padding: var(--gap-sm) var(--gap);
  margin-bottom: var(--gap-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.inspector-context__summary h3 {
  font-size: var(--t-emph);
  font-weight: var(--w-semibold);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.inspector-context__summary p {
  font-size: var(--t-caption);
  color: var(--muted);
  margin: 0;
  line-height: var(--leading-normal);
}
.inspector-context__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--gap-sm);
}
.inspector-context__chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: var(--t-caption);
  font-weight: var(--w-semibold);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
}
.inspector-context__chips .chip--neutral { border-color: transparent; background: var(--surface-muted); }
.inspector-context__chips .chip--danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

.inspector-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  padding: 0 4px;
  margin-bottom: var(--gap-sm);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: calc(60px + var(--gap-lg));
  background: var(--surface-muted);
  z-index: 10;
}
.inspector-tab {
  padding: 10px 0;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
  font-size: var(--t-body);
  font-weight: var(--w-semibold);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease);
}
.inspector-tab:hover { color: var(--ink); }
.inspector-tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.inspector-panel {
  display: grid;
  gap: var(--gap);
}

/* Care tab — prose lists for orders + surgeon instructions */
.ws-care-orders {
  margin: 0;
  padding: 0 0 0 18px;
  font-size: var(--t-body);
  color: var(--ink);
  line-height: var(--leading-normal);
}
.ws-care-orders li { margin-bottom: 4px; }

.ws-care-alerts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ws-care-instructions {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap-sm);
}
.ws-care-instructions dt {
  font-size: var(--t-caption);
  color: var(--muted);
  font-weight: var(--w-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ws-care-instructions dd {
  margin: 2px 0 0;
  font-size: var(--t-body);
  color: var(--ink);
  line-height: var(--leading-normal);
}

/* Radiology tab */
.radiology-card {
  display: grid;
  gap: var(--gap);
}
.radiology-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--gap);
}
.radiology-card__header p {
  margin: 4px 0 0;
  font-size: var(--t-caption);
  color: var(--muted);
}
.radiology-card__header-actions {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.radiology-candidate-loader .link-button {
  background: none;
  border: none;
  color: var(--accent-ink, #1f5fa4);
  padding: 0;
  margin-top: 4px;
  text-align: left;
  cursor: pointer;
  font-size: var(--t-caption);
  text-decoration: underline;
}
.radiology-candidate-loader .link-button:hover {
  opacity: 0.85;
}
.radiology-status {
  flex: none;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-size: var(--t-caption);
  font-weight: var(--w-semibold);
}
.radiology-level-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.radiology-level-row {
  display: grid;
  grid-template-columns: minmax(64px, 0.32fr) minmax(0, 1fr);
  gap: var(--gap);
  padding: 10px;
  border-top: 1px solid var(--line);
  align-items: start;
}
.radiology-level-row:first-child { border-top: 0; }
.radiology-level-row--head {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: var(--t-caption);
  font-weight: var(--w-semibold);
  text-transform: uppercase;
}
.radiology-finding-list {
  display: grid;
  gap: 8px;
}
.radiology-finding,
.radiology-hu-card {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
}
.radiology-finding__edit {
  justify-self: start;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: var(--t-caption);
  font-weight: var(--w-semibold);
  cursor: pointer;
}
.radiology-finding__title,
.radiology-hu-card strong {
  font-size: var(--t-body);
  font-weight: var(--w-semibold);
  color: var(--ink);
}
.radiology-finding__meta,
.radiology-finding small,
.radiology-hu-card small,
.radiology-hu-card span,
.radiology-hu-card p {
  margin: 0;
  font-size: var(--t-caption);
  color: var(--muted);
  line-height: var(--leading-normal);
}
.radiology-finding.severity-severe,
.radiology-finding.severity-very_low,
.radiology-hu-card.severity-very_low {
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(254, 242, 242, 0.8);
}
.radiology-finding.severity-moderate,
.radiology-hu-card.severity-low,
.radiology-hu-card.severity-borderline {
  border-color: rgba(217, 119, 6, 0.28);
  background: rgba(255, 251, 235, 0.82);
}
/* CT HU construct-risk color tiers — see huConstructRiskTier() in radiology.js
 * for the literature-backed cutoffs. Tier styles override severity styles so
 * "Bone quality: low" always reads as red/yellow/green per the numeric HU value
 * rather than the categorical grade name. */
.radiology-hu-card--red {
  border-color: rgba(220, 38, 38, 0.45);
  background: rgba(254, 226, 226, 0.85);
  box-shadow: inset 4px 0 0 rgba(220, 38, 38, 0.65);
}
.radiology-hu-card--yellow {
  border-color: rgba(202, 138, 4, 0.5);
  background: rgba(254, 243, 199, 0.85);
  box-shadow: inset 4px 0 0 rgba(202, 138, 4, 0.65);
}
.radiology-hu-card--green {
  border-color: rgba(22, 163, 74, 0.45);
  background: rgba(220, 252, 231, 0.85);
  box-shadow: inset 4px 0 0 rgba(22, 163, 74, 0.6);
}
.radiology-hu-card__badge {
  margin-top: 4px !important;
  font-size: var(--t-caption);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.radiology-hu-card--red .radiology-hu-card__badge { color: rgb(153, 27, 27); }
.radiology-hu-card--yellow .radiology-hu-card__badge { color: rgb(146, 64, 14); }
.radiology-hu-card--green .radiology-hu-card__badge { color: rgb(22, 101, 52); }
.radiology-hu-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0 4px;
}
.radiology-hu-legend__chip {
  font-size: var(--t-caption);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
}
.radiology-hu-legend__chip--red {
  background: rgba(254, 226, 226, 0.9);
  border-color: rgba(220, 38, 38, 0.5);
  color: rgb(153, 27, 27);
}
.radiology-hu-legend__chip--yellow {
  background: rgba(254, 243, 199, 0.9);
  border-color: rgba(202, 138, 4, 0.55);
  color: rgb(146, 64, 14);
}
.radiology-hu-legend__chip--green {
  background: rgba(220, 252, 231, 0.9);
  border-color: rgba(22, 163, 74, 0.5);
  color: rgb(22, 101, 52);
}
.radiology-hu-legend__note {
  display: block;
  flex-basis: 100%;
  color: var(--muted);
  font-size: var(--t-caption);
}
/* Candidate review row: confidence weight + decision tinting + focus ring */
.radiology-candidate-row {
  outline: none;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}
.radiology-candidate-row:focus-visible,
.radiology-candidate-row:focus {
  box-shadow: 0 0 0 2px var(--accent, #1f5fa4);
  border-radius: var(--r-sm);
}
.radiology-candidate-row--confidence-low {
  border-left: 4px solid rgba(220, 38, 38, 0.6);
  padding-left: 8px;
}
.radiology-candidate-row--confidence-medium {
  border-left: 4px solid rgba(202, 138, 4, 0.55);
  padding-left: 8px;
}
.radiology-candidate-row--confidence-high {
  border-left: 4px solid rgba(22, 163, 74, 0.55);
  padding-left: 8px;
}
.radiology-candidate-row--decision-accepted { background: rgba(220, 252, 231, 0.35); }
.radiology-candidate-row--decision-rejected { background: rgba(254, 226, 226, 0.35); }
.radiology-candidate-row--decision-edited { background: rgba(219, 234, 254, 0.4); }
.radiology-candidate-confidence {
  font-weight: 600;
}
.radiology-candidate-confidence--low { color: rgb(153, 27, 27); }
.radiology-candidate-confidence--medium { color: rgb(146, 64, 14); }
.radiology-candidate-confidence--high { color: rgb(22, 101, 52); }
.radiology-candidate-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  margin: 8px 0;
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-muted, rgba(0,0,0,0.02));
}
.radiology-candidate-keyboard-hint {
  font-size: var(--t-caption);
  flex-basis: 100%;
}
.radiology-candidate-keyboard-hint kbd {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface, white);
  font-size: 0.85em;
}
.radiology-candidate-save-summary {
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(22, 163, 74, 0.35);
  border-radius: var(--r-sm);
  background: rgba(220, 252, 231, 0.45);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.radiology-candidate-save-summary small {
  color: var(--muted);
}

/* Lane-colored left border on candidate rows so the row and its overlay share
 * a tint. --radiology-candidate-lane-color is set inline per row in JS. */
.radiology-candidate-row {
  border-left: 4px solid var(--radiology-candidate-lane-color, transparent);
  padding-left: 8px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.radiology-candidate-row--linked {
  background: rgba(var(--accent-rgb, 31, 95, 164), 0.06);
  box-shadow: inset 0 0 0 1px var(--radiology-candidate-lane-color, var(--accent, #1f5fa4));
}

/* Imaging overlay panel — schematic sagittal MRI with candidate boxes drawn
 * at normalized coordinates from each candidate's viewerOverlay. */
.radiology-overlay-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface, #fff);
  margin: 12px 0;
}
.radiology-overlay-panel__header {
  display: grid;
  gap: 4px;
}
.radiology-overlay-panel__stage {
  position: relative;
  max-width: 320px;
  margin: 0 auto;
  aspect-ratio: 600 / 800;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: #0f1418;
}
.radiology-overlay-panel__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  pointer-events: none;
}
.radiology-overlay-panel__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.radiology-overlay-box {
  cursor: pointer;
  outline: none;
  transition: transform 0.12s ease;
}
.radiology-overlay-box rect:first-child {
  transition: fill-opacity 0.15s ease, stroke-width 0.15s ease;
}
.radiology-overlay-box:hover rect:first-child,
.radiology-overlay-box:focus rect:first-child,
.radiology-overlay-box.radiology-overlay-box--active rect:first-child {
  fill-opacity: 0.4;
  stroke-width: 3;
}
.radiology-overlay-panel__note {
  margin: 0;
}
.radiology-hu-grid,
.radiology-target-groups {
  display: grid;
  gap: var(--gap-sm);
}
.radiology-target-group {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-muted);
}
.radiology-target-group > span {
  font-size: var(--t-caption);
  color: var(--muted);
  font-weight: var(--w-semibold);
  text-transform: uppercase;
}
.radiology-target-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}
.radiology-target-group li {
  display: grid;
  gap: 2px;
}
.radiology-target-group small,
.radiology-warning {
  margin: 0;
  font-size: var(--t-caption);
  color: var(--muted);
}
.radiology-review-card {
  border-style: dashed;
}
.radiology-candidate-card {
  border-style: dashed;
}
.radiology-candidate-loader,
.radiology-candidate-list {
  display: grid;
  gap: var(--gap-sm);
}
.radiology-candidate-loader label,
.radiology-candidate-row label {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: var(--t-caption);
  color: var(--muted);
  font-weight: var(--w-semibold);
}
.radiology-candidate-loader textarea,
.radiology-candidate-row select,
.radiology-candidate-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: var(--w-regular);
  padding: 9px 10px;
}
.radiology-candidate-loader textarea {
  resize: vertical;
  line-height: var(--leading-normal);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}
.radiology-candidate-actions,
.radiology-candidate-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-sm);
  flex-wrap: wrap;
}
.radiology-candidate-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(130px, 0.45fr) minmax(160px, 1fr);
  gap: var(--gap-sm);
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-muted);
}
.radiology-candidate-row strong,
.radiology-candidate-row small {
  display: block;
}
.radiology-candidate-row strong {
  color: var(--ink);
  font-size: var(--t-body);
}
.radiology-candidate-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--t-caption);
}
.radiology-route-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.radiology-route-summary span {
  padding: 4px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: var(--t-caption);
  font-weight: var(--w-semibold);
}
.radiology-twin-summary {
  display: grid;
  gap: var(--gap-sm);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.radiology-twin-summary__stats,
.radiology-twin-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.radiology-twin-summary__stats span,
.radiology-twin-chip {
  padding: 4px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: var(--t-caption);
  font-weight: var(--w-semibold);
}
.radiology-twin-levels {
  display: grid;
  gap: 6px;
}
.radiology-twin-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.45fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--gap-sm);
  min-width: 0;
}
.radiology-twin-row strong,
.radiology-twin-row small {
  display: block;
}
.radiology-twin-row strong {
  color: var(--ink);
}
.radiology-twin-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--t-caption);
}
.radiology-review-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-sm);
}
.radiology-review-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: var(--t-caption);
  color: var(--muted);
  font-weight: var(--w-semibold);
}
.radiology-review-form select,
.radiology-review-form input,
.radiology-review-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: var(--w-regular);
  padding: 9px 10px;
}
.radiology-review-form textarea {
  resize: vertical;
  line-height: var(--leading-normal);
}
.radiology-review-form__notes,
.radiology-review-form__footer {
  grid-column: 1 / -1;
}
.radiology-review-form__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-sm);
}
.radiology-review-form__footer p {
  margin: 0;
}
@media (max-width: 720px) {
  .radiology-candidate-row {
    grid-template-columns: 1fr;
  }
  .radiology-candidate-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .radiology-twin-row {
    grid-template-columns: 1fr;
  }
  .radiology-review-form {
    grid-template-columns: 1fr;
  }
  .radiology-review-form__footer {
    align-items: stretch;
    flex-direction: column;
  }
}

/* ============================================================
   Personal note templates (v0.2 plan #2 — clinician half)
   Lives inside the settings panel. Matches the admin tenant-
   modal baseline-templates section in rhythm so a surgeon who
   manages both ends sees a consistent shape.
   ============================================================ */

.my-templates-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px dashed var(--border-subtle, #e2e8f0);
  display: grid;
  gap: 10px;
}

.my-templates-head h3 {
  margin: 2px 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.my-templates-error {
  padding: 8px 10px;
  border: 1px solid rgba(220, 38, 38, 0.24);
  border-radius: 8px;
  background: rgba(220, 38, 38, 0.06);
  color: #b91c1c;
  font-size: 13px;
}

.my-template-groups {
  display: grid;
  gap: 12px;
  margin: 6px 0 4px;
}

.my-template-group {
  display: grid;
  gap: 4px;
}

.my-template-group__label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
  font-weight: 600;
}

.my-template-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.my-template-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 8px;
  background: var(--surface, #fff);
  font-size: 13px;
}

.my-template-row__body {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.my-template-row__body strong {
  color: var(--ink, #0f172a);
  font-weight: 600;
  word-break: break-word;
}

.my-template-row__meta {
  font-size: 11px;
  color: var(--muted, #64748b);
  background: var(--surface-muted, #f3f4f6);
  padding: 2px 8px;
  border-radius: 999px;
}

.my-template-add {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 2fr minmax(140px, 1fr) auto;
  gap: 8px;
  margin-top: 8px;
  align-items: stretch;
}

.my-template-add select,
.my-template-add input {
  padding: 6px 10px;
  border: 1px solid var(--border, #d8dce5);
  border-radius: 8px;
  background: var(--surface, #fff);
  font-size: 13px;
  color: var(--ink, #0f172a);
}

.my-template-add__label { grid-column: span 1; }

@media (max-width: 640px) {
  .my-template-add {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Template picker drawer (composer inline)
   Opens below the "Use template" button and lists baselines +
   personal matches for the current note_type.
   ============================================================ */

.note-field--with-action .note-field__row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.note-field--with-action .note-field__row select {
  flex: 1;
}

.template-picker {
  margin: 10px 0 4px;
  padding: 12px;
  border: 1px solid var(--border, #d8dce5);
  border-radius: 10px;
  background: var(--surface, #fff);
  display: grid;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.template-picker__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  justify-content: space-between;
}

.template-picker__head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}

.template-picker__error {
  padding: 6px 10px;
  border: 1px solid rgba(220, 38, 38, 0.24);
  border-radius: 8px;
  background: rgba(220, 38, 38, 0.06);
  color: #b91c1c;
  font-size: 13px;
}

.template-picker__group {
  display: grid;
  gap: 4px;
}

.template-picker__group-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
  font-weight: 600;
}

.template-picker__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 8px;
  background: var(--surface-muted, #f9fafb);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink, #0f172a);
  transition: border-color 0.12s, background 0.12s;
}

.template-picker__item:hover {
  border-color: var(--border-strong, #cbd5e1);
  background: var(--surface, #fff);
}

.template-picker__hint {
  font-size: 12px;
  margin-top: 4px;
}

/* ============================================================
   Task queue (v0.2 plan #3) — full-page coordinator view
   Mirrors the alert-inbox / dashboard pattern (panel-v2) with
   its own filters, SLA-colored rail, and per-row transitions.
   ============================================================ */

.task-queue-view {
  display: grid;
  gap: 14px;
}

.ws-queue-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  padding: 10px 0 2px;
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
}

.ws-queue-filter-group {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

.ws-queue-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border, #d8dce5);
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--ink, #0f172a);
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.ws-queue-chip:hover {
  background: var(--surface-muted, #f3f4f6);
}

.ws-queue-chip--active {
  background: var(--ink, #0f172a);
  border-color: var(--ink, #0f172a);
  color: #fff;
}

.ws-queue-chip__count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-muted, #f3f4f6);
  color: var(--muted, #64748b);
}

.ws-queue-chip--active .ws-queue-chip__count {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.9);
}

.ws-queue-search {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 6px 10px;
  border: 1px solid var(--border, #d8dce5);
  border-radius: 8px;
  background: var(--surface, #fff);
  font-size: 13px;
  color: var(--ink, #0f172a);
}

.ws-queue-clear {
  margin-left: auto;
}

.ws-queue-error {
  padding: 10px 12px;
  border: 1px solid rgba(220, 38, 38, 0.24);
  border-radius: 8px;
  background: rgba(220, 38, 38, 0.06);
  color: #b91c1c;
  font-size: 13px;
}

.ws-queue-empty {
  padding: 24px 4px;
  text-align: left;
}

.ws-queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.ws-queue-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 10px;
  background: var(--surface, #fff);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.ws-queue-row:hover {
  border-color: var(--border-strong, #cbd5e1);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ws-queue-row--overdue {
  border-left: 4px solid #dc2626;
}

.ws-queue-row__open {
  flex: 1;
  display: flex;
  gap: 10px;
  padding: 2px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.ws-queue-row__sla {
  flex: none;
  width: 6px;
  border-radius: 3px;
  margin: 2px 0;
}

.ws-queue-row__body {
  flex: 1;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.ws-queue-row__hdr {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.ws-queue-row__hdr strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink, #0f172a);
}

.ws-queue-row__patient {
  font-size: 12px;
  color: var(--muted, #64748b);
}

.ws-queue-row__summary {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft, #334155);
  line-height: 1.4;
}

.ws-queue-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted, #64748b);
}

.ws-queue-row__due,
.ws-queue-row__age,
.ws-queue-row__assignee {
  font-size: 11px;
  letter-spacing: 0.02em;
}

.ws-queue-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  align-self: center;
  flex: none;
}

@media (max-width: 640px) {
  .ws-queue-row {
    flex-direction: column;
  }
  .ws-queue-row__actions {
    justify-content: flex-start;
  }
}

/* ============================================================
   Timeline tab (v0.2 plan #4) — merged event stream
   Every timestamped artifact in one chronological column.
   Event-type colors are inline on the dot (from JS) so adding a
   new type doesn't require a CSS change.
   ============================================================ */
.ws-timeline-card {
  display: grid;
  gap: var(--gap-sm);
}

.ws-timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ws-timeline-header__count {
  font-size: var(--t-caption);
  color: var(--muted);
}

.ws-timeline-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 4px;
}

.ws-timeline-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border, #d8dce5);
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--ink, #0f172a);
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.ws-timeline-chip:hover {
  background: var(--surface-muted, #f3f4f6);
}

.ws-timeline-chip--active {
  background: var(--ink, #0f172a);
  border-color: var(--ink, #0f172a);
  color: #fff;
}

.ws-timeline-chip__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.ws-timeline-chip__count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-muted, #f3f4f6);
  color: var(--muted, #64748b);
}

.ws-timeline-chip--active .ws-timeline-chip__count {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.9);
}

.ws-timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--border-subtle, #e2e8f0);
  display: grid;
  gap: 10px;
}

.ws-timeline-item {
  position: relative;
  padding: 8px 4px 8px 16px;
}

.ws-timeline-item__dot {
  position: absolute;
  left: -6px;
  top: 13px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--surface, #fff);
  box-shadow: 0 0 0 1px var(--border-subtle, #e2e8f0);
}

.ws-timeline-item__body {
  display: grid;
  gap: 3px;
}

.ws-timeline-item__hdr {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ws-timeline-item__title {
  font-size: var(--t-body, 14px);
  font-weight: var(--w-semibold, 600);
  color: var(--ink, #0f172a);
}

.ws-timeline-item__at {
  font-size: 11px;
  color: var(--muted, #64748b);
  white-space: nowrap;
}

.ws-timeline-item__detail {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft, #334155);
  line-height: 1.4;
}

.ws-timeline-item__type {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
  font-weight: var(--w-semibold, 600);
}

.ws-timeline-loadmore {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

.ws-timeline-empty {
  padding: 12px 2px;
  display: grid;
  gap: 10px;
}

/* ============================================================
   Redesign v2 — Viewer compact toolbar (Phase 1b)
   Replaces the 6-row panel-toolbar with a single pill-style bar.
   ============================================================ */

.viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  margin: 0 0 var(--gap-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
  overflow: visible;
  flex-wrap: wrap;
}

.viewer-tb__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  min-height: 32px;
  background: transparent;
  border: 0;
  border-radius: var(--r-pill);
  color: var(--muted);
  font: inherit;
  font-size: var(--t-caption);
  font-weight: var(--w-semibold);
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.viewer-tb__btn:hover:not(.is-active) { background: var(--surface-muted); color: var(--ink); }
.viewer-tb__btn.is-active { background: var(--accent); color: #fff; }
.viewer-tb__btn.has-adjust:not(.is-active) { color: var(--accent-ink); }
.viewer-tb__btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.viewer-tb__sep {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 4px;
  flex-shrink: 0;
}

.viewer-tb__zoom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  min-height: 32px;
  color: var(--muted);
  flex: 1 1 160px;
  min-width: 140px;
}
.viewer-tb__zoom input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--line-strong);
  border-radius: var(--r-pill);
  cursor: pointer;
}
.viewer-tb__zoom input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
  cursor: grab;
}
.viewer-tb__zoom input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
  cursor: grab;
}
.viewer-tb__zoom-value {
  font-size: var(--t-caption);
  font-weight: var(--w-semibold);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: right;
}

.viewer-tb__btn-label--hide-mobile { display: inline; }
@media (max-width: 640px) {
  .viewer-tb__btn-label--hide-mobile { display: none; }
}

/* Reuse ws-menu styles; adjust menu extras */
.viewer-adjust-wrap { position: relative; display: inline-flex; }
.viewer-adjust-menu {
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  min-width: 260px;
}
.viewer-adjust-menu__slider {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 12px;
}
.viewer-adjust-menu__label {
  font-size: var(--t-caption);
  font-weight: var(--w-semibold);
  color: var(--ink);
}
.viewer-adjust-menu__value {
  font-size: var(--t-caption);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.viewer-adjust-menu__slider input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--line-strong);
  border-radius: var(--r-pill);
}
.viewer-adjust-menu__slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface-strong);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   Redesign v2 — Overlay handle touch targets
   Invisible 44px ring around each visible handle — mouse UX stays
   the same, but taps don't need sub-10px precision.
   ============================================================ */

.overlay-handle::before {
  content: "";
  position: absolute;
  inset: -18px;
  border-radius: 50%;
  /* Keeps hit area, invisible */
}
/* Slightly smaller ring for measurement/calibration handles which are 10px */
.overlay-handle.measurement::before,
.overlay-handle.calibration::before {
  inset: -17px;
}

/* ============================================================
   Redesign v2 — Clinical note composer CTAs (Phase 1d)
   ============================================================ */

.note-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-sm);
  margin: var(--gap) 0 var(--gap-sm);
  flex-wrap: wrap;
}
.note-actions__secondary {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.note-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: var(--t-caption);
  font-weight: var(--w-semibold);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}
.note-btn:hover { background: var(--surface-muted); }
.note-btn:active { transform: scale(0.97); }
.note-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.note-btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
  padding: 8px 20px;
  min-height: 44px;
  font-size: var(--t-body);
}
.note-btn--primary:hover { background: var(--accent-ink); }

.note-btn--icon {
  width: 40px;
  padding: 0;
}

.note-menu-wrap { position: relative; display: inline-flex; }
.note-menu {
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  min-width: 240px;
}

/* Collapse the new header layout below tablet width */
@media (max-width: 900px) {
  .ws-header {
    grid-template-columns: 1fr;
    gap: var(--gap-sm);
    padding: var(--gap-sm);
  }
  .ws-header__center,
  .ws-header__right {
    justify-self: start;
  }
  .ws-header__center {
    flex-wrap: wrap;
  }
}

/* ============================================================
   RESPONSIVE BREAKPOINTS — unified collapse
   ============================================================ */

/* Inspector column stacks below stage */
@media (max-width: 1080px) {
  .planner-grid {
    grid-template-columns: 1fr;
  }
}

/* Episode rail + planner collapse together (no dead zone) */
@media (max-width: 1120px) {
  .planner-shell {
    grid-template-columns: 1fr;
  }

  .episode-rail {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: var(--gap) var(--gap);
  }

  .episode-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-sm);
  }

  .episode-button {
    flex: 0 1 auto;
  }
}

/* Tablet — intermediate layout adjustments */
@media (max-width: 900px) {
  .dual-viewer-strip {
    grid-template-columns: 1fr;
  }

  .viewer-panel-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .comparison-grid {
    grid-template-columns: 1fr;
  }

  .header-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .header-actions .secondary-button,
  .header-actions .segment {
    font-size: 0.78rem;
    padding: 6px 10px;
  }
}

/* Phone — everything stacks */
@media (max-width: 760px) {
  .workspace-main,
  .episode-rail,
  .login-shell {
    padding: var(--gap-md);
  }

  .workspace-header h2 {
    font-size: 1.8rem;
  }

  .dual-viewer-strip {
    grid-template-columns: 1fr;
  }

  .viewer-panel-toolbar {
    grid-template-columns: 1fr;
  }

  .top-controls,
  .field-grid,
  .mini-grid,
  .metrics-grid,
  .chip-grid,
  .comparison-grid,
  .note-packet-grid,
  .medical-necessity-row,
  .pathway-template-grid {
    grid-template-columns: 1fr;
  }

  .workspace-header {
    flex-direction: column;
  }

  .toolbar-surface, .viewer-surface, .inspector-card {
    padding: var(--gap);
  }
}

/* ============================================================
   Smart Detect — Compact toolbar + Wizard drawer + Overlays
   ============================================================ */

.compact-toolbar {
  padding: 0 0 var(--gap-sm);
  margin-bottom: var(--gap-sm);
  border-bottom: 1px solid var(--line);
}

.compact-toolbar-row {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  flex-wrap: wrap;
}

.compact-segments {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.compact-step-indicator {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  flex: 1;
  min-width: 0;
}

.compact-step-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.compact-step-count {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.compact-progress-bar {
  width: 100%;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.06);
  overflow: hidden;
  margin: var(--gap-xs) 0;
}

.compact-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #36b5a0);
}

.compact-progress-row {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  width: 100%;
}
.compact-progress-row .compact-progress-bar { flex: 1; }
.compact-progress-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.compact-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.icon-btn {
  min-width: 28px;
  padding: 4px 6px;
}

.compact-divider {
  width: 1px;
  height: 16px;
  background: var(--line);
}

/* ---- Measurement compact toolbar ---- */

.measure-tool-strip {
  display: flex;
  gap: 2px;
}

.measure-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}

.measure-tool-btn:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.measure-tool-btn.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: rgba(15, 118, 110, 0.24);
  font-weight: 600;
}

.measure-tool-btn.secondary {
  border-style: dashed;
}

.measure-calibration-row {
  margin-top: var(--gap-xs);
  padding-top: var(--gap-xs);
  border-top: 1px solid var(--line);
}

.measure-calibration-field {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-sm);
  font-size: 0.78rem;
  color: var(--muted);
}

.measure-calibration-field input {
  width: 72px;
  padding: 4px 8px;
  font-size: 0.78rem;
}

.measure-hint {
  margin: var(--gap-xs) 0 0;
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.4;
}

.floating-result-tool {
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.7;
  margin-right: 4px;
  flex-shrink: 0;
  margin: 0 2px;
}

/* ---- Wizard drawer ---- */

.wizard-drawer {
  margin-top: var(--gap-sm);
  padding-top: var(--gap-sm);
  border-top: 1px solid var(--line);
  max-height: 50vh;
  overflow-y: auto;
  display: grid;
  gap: var(--gap-sm);
}

.wizard-drawer-progress {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.wizard-drawer-progress strong {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.wizard-drawer-current {
  padding: var(--gap-sm) var(--gap-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-soft);
  background: var(--surface-strong);
}

.wizard-drawer-current strong {
  font-size: 0.92rem;
}

.wizard-drawer-current p {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Plan v2.1 §1.7: model-version badge sits below the Smart Detect actions
   so the clinician always sees which model is producing the assist. */
.model-version-badge {
  margin-top: var(--gap-xs);
  font-size: 0.72rem;
  letter-spacing: 0.01em;
}

.model-version-badge a,
.model-version-badge a:visited {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.model-version-badge a:hover,
.model-version-badge a:focus-visible {
  text-decoration: none;
  border-bottom-style: solid;
}

/* Plan v2.1 §1.7: per-vertebra confidence pill in the editing drawer.
   Three tiers map to green / amber / red so clinicians can spot
   low-confidence detections without parsing decimals. */
.confidence-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: var(--radius-pill, 999px);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.confidence-badge--high {
  background: rgba(78, 209, 177, 0.15);
  color: var(--accent, #4ed1b1);
}

.confidence-badge--medium {
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
}

.confidence-badge--low {
  background: rgba(239, 68, 68, 0.20);
  color: #ef4444;
}

/* Cohort-level confidence summary above the vertebra list. */
.cohort-confidence {
  margin: 6px 0 8px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

.cohort-confidence--high { color: var(--accent, #4ed1b1); }
.cohort-confidence--medium { color: #f59e0b; }
.cohort-confidence--low { color: #ef4444; }
.cohort-confidence .muted { color: var(--muted); font-weight: 400; }

/* Plan v2.1 §1.5: inline stratum picker in the Smart Detect confirmed
   phase. Surfaces the canonical eval-case strata so the clinician
   picks before downloading rather than hand-editing JSON later. */
.stratum-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: var(--gap-xs) 0 var(--gap-sm);
  font-size: 0.82rem;
}
.stratum-picker__label {
  color: var(--muted);
  white-space: nowrap;
}
.stratum-picker__select {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface, #fff);
  font-size: 0.82rem;
  color: var(--ink);
}

/* Paired-view linkage: collapsed by default, expands when a labeller
   is working a flexion/extension case. */
.stratum-picker-group {
  display: grid;
  gap: 4px;
}
.stratum-picker__pair {
  font-size: 0.78rem;
  margin: 0 0 var(--gap-sm);
}
.stratum-picker__pair-summary {
  cursor: pointer;
  color: var(--muted);
  padding: 2px 0;
}
.stratum-picker__pair-fields {
  display: grid;
  gap: 6px;
  padding: 8px 0 0 4px;
  border-left: 2px solid var(--line, #e5e7eb);
  padding-left: 8px;
  margin-top: 4px;
}
.stratum-picker__pair-field {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 6px;
  align-items: center;
}
.stratum-picker__pair-field span {
  color: var(--muted);
  font-size: 0.76rem;
}
.stratum-picker__pair-role,
.stratum-picker__pair-id {
  padding: 3px 6px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface, #fff);
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
}
.stratum-picker__pair-hint {
  margin: 4px 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
}

/* Plan v2.1 §1: spondylolisthesis findings derived from confirmed
   vertebrae. "Geometric findings (derived from corners — clinician
   review required)" framing — never auto-enters the chart. */
.listhesis-findings {
  margin: var(--gap-xs) 0 var(--gap-sm);
  padding: var(--gap-xs) 8px;
  border-left: 2px solid #f59e0b;
  background: rgba(245, 158, 11, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.listhesis-findings__title {
  margin: 0 0 4px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f59e0b;
}

.listhesis-findings__caveat {
  font-weight: 400;
  color: var(--muted);
}

.listhesis-findings__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.listhesis-finding {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  padding: 2px 0;
}

.listhesis-finding__level {
  font-weight: 600;
  color: var(--text);
  min-width: 56px;
}

.listhesis-finding__label {
  color: var(--text);
}

.listhesis-finding__grade,
.listhesis-finding__pct {
  color: var(--muted);
  font-size: 0.7rem;
}

.wizard-drawer-steps {
  display: grid;
  gap: 4px;
}

.wizard-drawer-actions {
  padding-top: var(--gap-xs);
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ---- Smart Detect: Anchor handles ---- */

.anchor-handle {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
}

.anchor-handle .handle-diamond {
  display: block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(13, 148, 136, 0.5);
}

.anchor-badge {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-pill);
  background: rgba(13, 148, 136, 0.5);
  color: #fff;
  font-size: 0.52rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 0 3px;
  white-space: nowrap;
  backdrop-filter: blur(2px);
  line-height: 1;
  letter-spacing: 0.02em;
}

/* Pulse animation on newly placed point */
@keyframes anchor-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.8); opacity: 0.4; }
}
.anchor-handle.just-placed {
  animation: anchor-pulse 0.6s ease-out;
}

/* Crosshair cursor during placement mode */
.viewer-stage.placing-mode {
  cursor: crosshair;
}

/* Ribbon mode — cell cursor hints "draw a line" */
.viewer-stage.ribbon-mode {
  cursor: cell;
}

.ribbon-line {
  pointer-events: none;
  stroke: var(--accent, #42b983);
  stroke-width: 0.6;
  stroke-dasharray: 1.2 0.6;
  fill: none;
  opacity: 0.9;
  filter: drop-shadow(0 0 0.3px rgba(0, 0, 0, 0.4));
}

.ribbon-seed-preview {
  pointer-events: none;
  opacity: 0.95;
}

/* Fit mode — crosshair cursor for per-corner placement */
.viewer-stage.fit-mode {
  cursor: crosshair;
}

/* Vertebral body bounding quadrilateral (Surgimap-style box) */
.vertebra-quad {
  fill: rgba(66, 185, 131, 0.1);
  stroke: rgba(66, 185, 131, 0.55);
  stroke-width: 0.2;
  stroke-linejoin: round;
  pointer-events: none;
}

/* Source badge (auto-detect vs estimated) in the editing anchor list */
.anchor-source-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(66, 185, 131, 0.2);
  color: var(--accent, #42b983);
}

.anchor-source-badge.muted {
  background: rgba(148, 163, 184, 0.2);
  color: var(--muted, #94a3b8);
}

.fit-target-upcoming,
.fit-target-current,
.fit-partial {
  pointer-events: none;
}

.fit-target-current {
  animation: fit-pulse 1.4s ease-in-out infinite;
}

@keyframes fit-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.fit-level-label {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

.fit-level-label.current {
  background: var(--accent, #42b983);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(66, 185, 131, 0.25);
}

.fit-placed-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--accent, #42b983);
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.fit-step-prompt {
  margin: 6px 0 8px 0;
  font-size: 0.95em;
}

.fit-step-track {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.fit-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line, #d0d0d0);
  border: 1.5px solid transparent;
  transition: background 120ms, border-color 120ms, transform 120ms;
}

.fit-step-dot.done {
  background: var(--accent, #42b983);
}

.fit-step-dot.active {
  background: transparent;
  border-color: var(--accent, #42b983);
  transform: scale(1.25);
}

.fit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 0.88em;
  color: var(--muted, #6b7280);
  user-select: none;
}

.fit-toggle input {
  margin: 0;
}

/* ---- Smart Detect: Single-tap labeling ---- */

.anchor-handle.labeling {
  cursor: pointer;
}

.anchor-handle.labeling:hover .handle-diamond,
.anchor-handle.selected .handle-diamond {
  background: var(--teal);
  transform: scale(1.3);
}

.anchor-handle.selected .anchor-badge {
  background: var(--teal);
  color: white;
}

.anchor-label-picker {
  margin-top: var(--gap-sm);
  padding: var(--gap-sm);
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.anchor-label-picker strong {
  display: block;
  font-size: 0.78rem;
  margin-bottom: var(--gap-xs, 4px);
}

.anchor-level-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: var(--gap-xs, 4px);
}

.anchor-level-btn {
  font-size: 0.72rem;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
}

.anchor-level-btn:hover {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}

.labeling-point-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: var(--gap-sm) 0;
}

.labeling-point-btn {
  font-size: 0.75rem;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.labeling-point-btn:hover {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}

/* ---- Smart Detect: Region assigner (replaces level picker) ---- */

.region-assigner {
  position: absolute;
  z-index: 20;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  padding: var(--gap-md);
  min-width: 220px;
  max-width: 280px;
}

.region-assigner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-sm);
}

.region-assigner-header strong {
  font-size: 0.82rem;
}

.region-assigner-header .muted {
  font-size: 0.68rem;
}

.region-assigner-row {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  margin-bottom: var(--gap-sm);
}

.region-assigner-row label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.region-assigner-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.region-assigner-arrow {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 12px;
}

.region-assigner select {
  padding: 4px 6px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
}

/* ---- Smart Detect: Spine curve overlay ---- */

.spine-curve-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 0.25;
  stroke-dasharray: 0.8 0.5;
  opacity: 0.6;
  vector-effect: non-scaling-stroke;
}

/* ---- Smart Detect: Detection overlay lines ---- */

.overlay-line.detection {
  stroke: rgba(59, 130, 246, 0.55);
  stroke-width: 0.2;
  stroke-dasharray: 0.6 0.4;
  vector-effect: non-scaling-stroke;
}

/* ---- Smart Detect: Anchor list in drawer ---- */

.anchor-list-item {
  display: flex;
  align-items: center;
  gap: var(--gap-xs);
  padding: 3px var(--gap-xs);
  border-radius: 3px;
  font-size: 0.78rem;
}

.anchor-list-item:hover {
  background: var(--accent-soft);
}

.anchor-list-level {
  font-weight: 700;
  color: var(--accent-ink);
  min-width: 28px;
}

.anchor-list-pos {
  color: var(--muted);
  font-size: 0.72rem;
  flex: 1;
}

.anchor-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  color: var(--muted);
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1;
}

.anchor-remove-btn:hover {
  background: rgba(220, 38, 38, 0.12);
  color: var(--error);
}

.seed-handle {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.seed-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.92);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
}

.seed-handle.selected .seed-badge,
.seed-handle.labeled .seed-badge {
  background: rgba(13, 148, 136, 0.98);
}

.seed-remove-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

.seed-handle:hover .seed-remove-btn,
.seed-handle.selected .seed-remove-btn {
  display: inline-flex;
}

.seed-level-group {
  display: grid;
  gap: 4px;
  margin-bottom: var(--gap-xs);
}

.seed-level-group:last-of-type {
  margin-bottom: 0;
}

.seed-level-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.seed-level-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seed-level-btn {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.seed-level-btn.active,
.seed-level-btn:hover {
  background: var(--accent-soft);
  border-color: rgba(15, 118, 110, 0.3);
  color: var(--accent-ink);
}

/* ---- Toast Notifications ---- */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  max-width: 380px;
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-error   { background: #dc2626; }
.toast-success { background: #059669; }
.toast-info    { background: #1e40af; }

/* ============================================================
   KEYBOARD SHORTCUTS OVERLAY
   ============================================================ */

.shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: var(--gap);
  background: rgba(15, 23, 42, 0.42);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  animation: shortcutsFadeIn 160ms var(--ease-default, cubic-bezier(0.4, 0, 0.2, 1));
}
@keyframes shortcutsFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes shortcutsCardRise {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}

.shortcuts-card {
  position: relative;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.28), 0 6px 20px rgba(15, 23, 42, 0.12);
  padding: var(--gap-lg) var(--gap-lg) var(--gap);
  max-width: 560px;
  width: 100%;
  max-height: 84vh;
  overflow-y: auto;
  animation: shortcutsCardRise 200ms var(--ease-default, cubic-bezier(0.4, 0, 0.2, 1));
}

.shortcuts-card__hdr {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.shortcuts-card h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
}
.shortcuts-card__sub {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.shortcuts-card .shortcuts-close {
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--surface-muted);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
  transition: background var(--ease), color var(--ease);
}
.shortcuts-card .shortcuts-close:hover {
  background: var(--line);
  color: var(--ink);
}
.shortcuts-card .shortcuts-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.shortcuts-section + .shortcuts-section { margin-top: var(--gap); }

.shortcuts-section h3 {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 6px;
  font-weight: var(--weight-semibold);
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  color: var(--ink);
}
.shortcut-row:last-child { border-bottom: 0; }

.shortcut-keys {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  flex-shrink: 0;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: var(--weight-semibold);
  color: var(--ink);
  background: var(--surface-muted);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: inset 0 -1px 0 var(--line-strong);
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  .shortcuts-overlay,
  .shortcuts-card {
    animation: none;
  }
}

/* ============================================================
   IMAGE COMPARISON SLIDER
   ============================================================ */

.comparison-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #0f172a;
  user-select: none;
  touch-action: none;
}

.comparison-container img {
  display: block;
  width: 100%;
  height: auto;
}

.comparison-before,
.comparison-after {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.comparison-before {
  z-index: 2;
  overflow: hidden;
}

.comparison-before img,
.comparison-after img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.comparison-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #fff;
  z-index: 3;
  cursor: ew-resize;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

.comparison-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.comparison-divider::before {
  content: "\2194";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  font-size: 1rem;
  color: var(--ink);
  font-weight: 700;
}

.comparison-label {
  position: absolute;
  top: 8px;
  padding: 3px 10px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: var(--radius-pill);
  z-index: 4;
  pointer-events: none;
}

.comparison-label.pre-op { left: 8px; }
.comparison-label.post-op { right: 8px; }

.comparison-panel {
  margin-top: var(--gap);
  padding: var(--gap);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
}

.comparison-panel h3 {
  margin: 0 0 var(--gap-sm);
  font-size: 1rem;
}

.comparison-controls {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  margin-bottom: var(--gap-sm);
  flex-wrap: wrap;
}

.comparison-empty {
  padding: var(--gap-xl);
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ============================================================
   PROM ASSIGNMENT PANEL
   ============================================================ */

.prom-assignment-panel {
  display: grid;
  gap: var(--gap-sm);
}

.prom-region-selector {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-xs);
}

.prom-region-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 120ms ease, background 120ms ease;
}

.prom-region-toggle:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.prom-region-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
}

.prom-instrument-list {
  display: grid;
  gap: var(--gap-xs);
  max-height: 220px;
  overflow-y: auto;
}

.prom-category-group {
  display: grid;
  gap: 4px;
}

.prom-category-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-top: var(--gap-xs);
}

.prom-instrument-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.84rem;
  cursor: pointer;
  transition: background 100ms ease;
}

.prom-instrument-toggle:hover {
  background: rgba(0, 0, 0, 0.03);
}

.prom-instrument-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
}

.prom-instrument-toggle.recommended span:first-of-type {
  font-weight: 600;
}

.prom-rec-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}

/* ── Settings Panel ─────────────────────────────────────────── */

.settings-panel {
  margin: 0 16px 16px;
  padding: 20px 24px;
  border-radius: var(--radius-card, 12px);
  border: 1px solid var(--border, #e2e8f0);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.settings-header h3 {
  margin: 2px 0 0;
  font-size: 1.1rem;
}

.settings-header p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--text-secondary, #64748b);
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pathway-builder {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border, #e2e8f0);
  display: grid;
  gap: 12px;
}

.pathway-builder-head h3 {
  margin: 4px 0 0;
}

.pathway-builder-head p {
  margin: 6px 0 0;
  color: var(--text-secondary, #64748b);
  font-size: 0.84rem;
}

.pathway-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pathway-template-card {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  display: grid;
  gap: 10px;
}

.pathway-template-card textarea {
  width: 100%;
  padding: var(--input-padding);
  border-radius: var(--input-radius);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--ink);
  font-size: var(--input-font-size);
  line-height: 1.45;
  resize: vertical;
}

.pathway-template-card textarea:focus {
  outline-width: 2px;
  outline-style: solid;
  outline-color: var(--accent);
  outline-offset: -2px;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-card, 8px);
  background: var(--surface-muted);
  cursor: pointer;
  transition: background 0.15s;
}

.settings-toggle:hover {
  background: var(--accent-soft, #e0f2fe);
}

.settings-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-toggle-info strong {
  font-size: 0.9rem;
}

.settings-toggle-info small {
  font-size: 0.78rem;
  color: var(--text-secondary, #64748b);
}

.settings-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-ink, teal);
  flex-shrink: 0;
}

.settings-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border, #e2e8f0);
  display: flex;
  justify-content: flex-end;
}

/* ── Wound Photo Review ─────────────────────────────────────── */

.wound-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #dc2626;
  background: #fef2f2;
  padding: 2px 6px;
  border-radius: var(--radius-pill, 100px);
  margin-left: 6px;
}

.wound-photo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.wound-photo-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  background: var(--surface-muted);
}

.wound-photo-row.unreviewed {
  border-left: 3px solid #f59e0b;
}

.wound-photo-row.reviewed {
  border-left: 3px solid #22c55e;
}

.wound-photo-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.wound-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--accent-soft, #e0f2fe);
  color: var(--accent-ink, teal);
}

.wound-photo-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.82rem;
}

.wound-photo-info small {
  color: var(--text-secondary, #64748b);
  font-size: 0.75rem;
}

/* ── Outcome Dashboard ──────────────────────────────────────── */

.dashboard-view {
  margin: 0 16px 16px;
  padding: 20px 24px;
  border-radius: var(--radius-card, 12px);
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.dashboard-header h2 {
  margin: 2px 0 0;
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.dash-card {
  padding: 16px;
  border-radius: 10px;
  background: var(--surface-muted);
  border: 1px solid var(--border, #e2e8f0);
  display: grid;
  gap: 4px;
}

.dash-card--urgent {
  border-color: #ef4444;
  background: #fef2f2;
}

.dash-card--warning {
  border-color: #f59e0b;
  background: #fffbeb;
}

.dash-card-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, #64748b);
  margin-bottom: 4px;
}

.dash-card-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary, #0f172a);
}

.dash-card--urgent .dash-card-value { color: #dc2626; }
.dash-card--warning .dash-card-value { color: #d97706; }

.dash-card small {
  color: var(--muted);
  font-size: 0.78rem;
}

.dashboard-sections {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dash-section h3 {
  font-size: 1rem;
  margin-bottom: 10px;
}

.dash-stage-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-stage-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-stage-row--meta {
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
}

.dash-stage-label {
  width: 140px;
  font-size: 0.85rem;
  flex-shrink: 0;
  text-transform: capitalize;
}

.dash-stage-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--accent-ink, teal);
  min-width: 4px;
  transition: width 0.3s;
}

.dash-stage-count {
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 20px;
}

.dash-behind-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-behind-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: #fffbeb;
  border-radius: 8px;
  font-size: 0.88rem;
}

.dash-behind-row > div {
  display: grid;
  gap: 2px;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.dash-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, #64748b);
  padding: 6px 10px;
  border-bottom: 2px solid var(--border, #e2e8f0);
}

.dash-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.dash-table tr:hover td {
  background: var(--accent-soft, #e0f2fe);
}

/* ── Alert Inbox ────────────────────────────────────────────── */

.alert-inbox-view {
  margin: 0 16px 16px;
  padding: 20px 24px;
  border-radius: var(--radius-card, 12px);
}

.alert-count-badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  background: #dc2626;
  border-radius: 100px;
  margin-left: 4px;
}

.alert-empty {
  text-align: center;
  color: var(--text-secondary, #64748b);
  padding: 32px 0;
  font-size: 1rem;
}

.alert-groups {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.alert-group-label {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  border-left: 4px solid;
}

.alert-row-main {
  flex: 1;
}

.alert-category {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, #64748b);
  margin-bottom: 2px;
}

.alert-row-main strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.alert-row-main p {
  font-size: 0.85rem;
  margin: 0 0 2px;
}

.alert-row-main small {
  color: var(--text-secondary, #64748b);
  font-size: 0.75rem;
}

.alert-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.alert-actions .secondary-button {
  font-size: 0.78rem;
  padding: 4px 10px;
}

/* ================================================================
   Vertebra Overlay (Phase 5)
   ================================================================ */

/* Endplate lines — green, Surgimap-style */
.endplate-line {
  stroke: rgba(46, 204, 113, 0.9);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

/* Corner dots — small draggable handles at endplate endpoints */
.corner-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(46, 204, 113, 0.95);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  cursor: grab;
  z-index: 6;
  padding: 0;
  outline: none;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s ease;
  touch-action: none;  /* prevent scroll/zoom while dragging */
}

.corner-dot:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.corner-dot:hover {
  transform: translate(-50%, -50%) scale(1.5);
  background: rgba(46, 204, 113, 1);
}

.corner-dot:active {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.3);
}

/* Vertebra level label — centered at centroid, dynamically sized */
.vertebra-label {
  position: absolute;
  transform: translate(-50%, -50%);
  color: rgba(46, 204, 113, 0.95);
  font-family: var(--font-mono, "Geist Mono", monospace);
  font-weight: 600;
  font-size: 0.85em;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 0.8),
    0 0 6px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  cursor: pointer;
  z-index: 5;
  user-select: none;
  white-space: nowrap;
}

.vertebra-label:hover {
  color: rgba(46, 204, 113, 1);
  text-shadow:
    0 0 4px rgba(0, 0, 0, 0.9),
    0 0 8px rgba(46, 204, 113, 0.3);
}

/* Seed level picker popup — positioned near the seed point */
.seed-level-picker {
  position: absolute;
  transform: translate(15px, -50%);
  z-index: 20;
  background: var(--bg-surface, #1a1a2e);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius, 6px);
  padding: var(--gap-sm, 8px);
  min-width: 200px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ============================================================
   Conference Demo Mode
   ============================================================ */

.conference-demo-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  color: #fff;
  padding: 10px 20px;
  text-align: center;
  border-bottom: 3px solid #38bdf8;
  position: relative;
  z-index: 100;
}

.demo-banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.demo-banner-badge {
  background: #38bdf8;
  color: #0f172a;
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
}

.demo-banner-title {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.demo-banner-subtitle {
  font-size: 0.78rem;
  opacity: 0.7;
}

/* ---- iPad viewport optimizations (scoped to conference demo mode) ---- */
@media (min-width: 768px) and (max-width: 1400px) {
  .conference-demo-banner {
    padding: 8px 16px;
  }
  .demo-banner-title { font-size: 0.88rem; }
  .demo-banner-subtitle { font-size: 0.72rem; }

  .workspace-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-actions {
    flex-wrap: wrap;
    gap: 4px;
  }

  .header-actions .secondary-button,
  .header-actions .segment {
    font-size: 0.72rem;
    padding: 4px 8px;
  }

  .episode-rail {
    max-height: calc(100vh - 120px);
  }

  .inspector-column .surface {
    padding: 10px;
  }

  .viewer-surface {
    min-height: 400px;
  }
}

/* iPad Pro landscape (1366x1024) — only in conference demo mode */
@media (min-width: 1200px) and (max-width: 1400px) and (max-height: 1100px) {
  .conference-demo .planner-grid {
    grid-template-columns: 220px 1fr 300px;
  }
}

/* iPad standard (1024x768) — only in conference demo mode */
@media (min-width: 768px) and (max-width: 1199px) and (max-height: 900px) {
  .conference-demo .planner-grid {
    grid-template-columns: 180px 1fr 260px;
  }

  .episode-card { padding: 8px; }
  .episode-card h3 { font-size: 0.82rem; }
}

/* ============================================================
   Phase 4 polish — focus rings + reduced-motion + empty state
   ============================================================ */

/* ---- 1. :focus-visible rings on Phase 1/2 clinician primitives ---- */
.ws-iconbtn:focus-visible,
.ws-compare-toggle:focus-visible,
.segmented__item:focus-visible,
.ws-menu__item:focus-visible,
.inspector-tab:focus-visible,
.viewer-tb__btn:focus-visible,
.note-btn:focus-visible,
.ws-menu-wrap button:focus-visible,
.viewer-adjust-menu__slider input[type="range"]:focus-visible,
.viewer-tb__zoom input[type="range"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm, 10px);
}
/* Menu items sit inside a popover with its own padding; tighten offset */
.ws-menu__item:focus-visible,
.viewer-adjust-menu .ws-menu__item:focus-visible {
  outline-offset: 1px;
}
/* Range thumbs: rings around the track feel odd. Ring the thumb instead
   via a focused-on-thumb style where supported. */
.viewer-tb__zoom input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--accent-soft, rgba(15, 118, 110, 0.28));
}

/* ---- 2. Reduced-motion guards for new Phase 1/2 transitions ---- */
@media (prefers-reduced-motion: reduce) {
  .ws-iconbtn,
  .ws-compare-toggle,
  .segmented__item,
  .ws-menu__item,
  .inspector-tab,
  .viewer-tb__btn,
  .note-btn,
  .taper__fill {
    transition: none;
  }
  .note-btn:active,
  .viewer-tb__btn:active {
    transform: none;
  }
}

/* ---- 3. Viewer empty-state polish ---- */
.empty-stage.compact > div {
  display: grid;
  gap: var(--gap-xs);
  place-items: center;
}
.empty-stage.compact > div::before {
  content: "";
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  margin-bottom: var(--gap-xs);
  /* SF-symbol-ish imaging glyph in an inline SVG background */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b5f5f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='5' width='18' height='14' rx='2'/><circle cx='9' cy='11' r='1.6'/><path d='M3 17l5-5 4 4 3-3 6 6'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 28px;
}
.empty-stage.compact strong {
  font-size: 1.1rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}
.empty-stage.compact p {
  max-width: 32ch;
  font-size: 0.9rem;
  line-height: 1.55;
}


/* ============================================================
   Auth v2 — Apple-style single-column sign-in
   Shared shape across patient portal and clinician planner.
   ============================================================ */

.auth-v2 {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--gap-lg, 28px);
  padding: var(--gap-lg, 28px) var(--gap, 20px);
  background:
    radial-gradient(circle at 10% -10%, var(--accent-soft, rgba(15, 118, 110, 0.12)), transparent 45%),
    radial-gradient(circle at 110% 110%, var(--accent-soft, rgba(15, 118, 110, 0.10)), transparent 50%),
    var(--bg);
  box-sizing: border-box;
}

.auth-v2__brand {
  display: flex;
  justify-content: center;
}
.auth-v2__logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: var(--weight-semibold, 600);
  letter-spacing: -0.01em;
}
.auth-v2__logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-ink) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: var(--weight-semibold, 600);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.auth-v2__logo-text {
  font-size: 1.1rem;
}

.auth-v2__card {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 44px);
  background: var(--surface-strong, var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 20px);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.12), 0 6px 16px rgba(15, 23, 42, 0.06);
  align-self: center;
}

.auth-v2__title {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: var(--weight-semibold, 600);
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--ink);
}
.auth-v2__sub {
  margin: 10px 0 28px;
  font-size: var(--text-base, 15px);
  line-height: 1.5;
  color: var(--muted);
}

.auth-v2__form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-v2__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-v2__field span {
  font-size: var(--text-sm, 13px);
  font-weight: var(--weight-semibold, 600);
  color: var(--muted);
  letter-spacing: 0.01em;
}
.auth-v2__field input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font: inherit;
  font-size: var(--text-md, 16px);
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm, 12px);
  transition: border-color 160ms var(--ease-default, ease), box-shadow 160ms var(--ease-default, ease);
  box-sizing: border-box;
}
.auth-v2__field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft, rgba(15, 118, 110, 0.18));
}
.auth-v2__field input::placeholder { color: var(--subtle, #86868b); }

.auth-v2__msg {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm, 12px);
  font-size: var(--text-sm, 13px);
  font-weight: var(--weight-semibold, 600);
}
.auth-v2__msg--error {
  background: var(--danger-soft, rgba(185, 77, 72, 0.10));
  color: var(--danger, #b94d48);
}

.auth-v2__submit {
  width: 100%;
  min-height: 52px;
  margin-top: 6px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-sm, 12px);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: var(--text-md, 16px);
  font-weight: var(--weight-semibold, 600);
  letter-spacing: -0.005em;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.18);
  transition: background 160ms var(--ease-default, ease), transform 100ms var(--ease-default, ease);
}
.auth-v2__submit:hover:not([disabled]) { background: var(--accent-ink); }
.auth-v2__submit:active:not([disabled]) { transform: scale(0.98); }
.auth-v2__submit[disabled] { opacity: 0.55; cursor: not-allowed; }

.auth-v2__hint {
  margin: 4px 0 0;
  font-size: var(--text-sm, 13px);
  color: var(--muted);
  text-align: center;
}

.auth-v2__divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--gap-sm, 12px);
  align-items: center;
  margin: 24px 0 16px;
  color: var(--subtle, #86868b);
  font-size: var(--text-sm, 13px);
}
.auth-v2__divider::before,
.auth-v2__divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.auth-v2__demo {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auth-v2__demo-btn {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  min-height: 60px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 12px);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms var(--ease-default, ease), background 160ms var(--ease-default, ease), transform 100ms var(--ease-default, ease);
}
.auth-v2__demo-btn:hover { border-color: var(--line-strong); background: var(--surface-muted); }
.auth-v2__demo-btn:active { transform: scale(0.99); }
.auth-v2__demo-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.auth-v2__demo-btn--single { margin-top: 4px; }

.auth-v2__demo-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-soft, rgba(15, 118, 110, 0.12));
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: var(--text-sm, 13px);
  font-weight: var(--weight-semibold, 600);
  flex-shrink: 0;
}
.auth-v2__demo-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.auth-v2__demo-label strong {
  font-size: var(--text-base, 15px);
  font-weight: var(--weight-semibold, 600);
  color: var(--ink);
  letter-spacing: -0.005em;
}
.auth-v2__demo-label small {
  font-size: var(--text-sm, 13px);
  color: var(--muted);
}
.auth-v2__demo-arrow {
  color: var(--subtle, #86868b);
  font-size: 1.2rem;
  line-height: 1;
}

.auth-v2__footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: center;
  font-size: var(--text-sm, 13px);
  color: var(--muted);
}
.auth-v2__footer a {
  color: var(--muted);
  transition: color 160ms var(--ease-default, ease);
}
.auth-v2__footer a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 480px) {
  .auth-v2 { padding: var(--gap, 20px) var(--gap-sm, 12px); }
  .auth-v2__card { padding: 24px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-v2__submit,
  .auth-v2__demo-btn,
  .auth-v2__field input { transition: none; }
  .auth-v2__submit:active,
  .auth-v2__demo-btn:active { transform: none; }
}


/* ============================================================
   Phase 5 polish — Clinician sidebar rail
   Tightens the always-visible left rail. Lighter section chrome,
   iOS-style list rows, calmer brand block.
   ============================================================ */

.episode-rail {
  padding: var(--gap) var(--gap-sm);
  gap: 0;
}

/* Calm the brand block — "Planner" doesn't need to dominate */
.brand-block {
  margin: 0 var(--gap-xs) var(--gap);
}
.brand-block .eyebrow {
  padding: 0;
  background: transparent;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}
.brand-block h1 {
  font-size: 1.5rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
  margin-top: 2px;
}
.brand-block p {
  font-size: 0.82rem;
  margin-top: 2px;
}

/* Transform rail-cards into quiet sections: no border, lighter eyebrow,
   generous hairline dividers between sections. */
.episode-rail .rail-card {
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  padding: var(--gap-sm) var(--gap-xs);
  margin: 0;
}
.episode-rail .rail-card + .rail-card {
  border-top: 1px solid var(--line);
  margin-top: var(--gap-sm);
  padding-top: var(--gap);
}
.episode-rail .rail-card > .eyebrow {
  padding: 0;
  background: transparent;
  margin-bottom: var(--gap-sm);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* Episode buttons become list rows */
.episode-rail .episode-button {
  padding: 10px 12px;
  border-radius: var(--radius-sm, 12px);
  border: 1px solid transparent;
  background: transparent;
  transition: background 160ms var(--ease-default, ease),
              border-color 160ms var(--ease-default, ease),
              transform 100ms var(--ease-default, ease);
}
.episode-rail .episode-button:hover {
  background: var(--surface);
  border-color: var(--line);
  transform: none;
}
.episode-rail .episode-button.active {
  background: var(--accent-soft);
  border-color: transparent;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.22);
}
.episode-rail .episode-button .episode-route {
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.episode-rail .episode-button strong {
  font-size: 0.95rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.005em;
  color: var(--ink);
}
.episode-rail .episode-button .episode-meta {
  font-size: 0.78rem;
  line-height: 1.4;
}

/* Saved Sets rows: similar row treatment, tighter */
.episode-rail .measurement-history .history-row {
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-sm, 12px);
  background: transparent;
  transition: background 160ms var(--ease-default, ease);
}
.episode-rail .measurement-history .history-row:hover {
  background: var(--surface);
}
.episode-rail .measurement-history .history-row strong {
  font-size: 0.9rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.005em;
}
.episode-rail .measurement-history .history-row span {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.4;
}
/* Clickable variant — admin gets the per-row audit drill-down. */
.episode-rail .measurement-history .history-row--clickable {
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
}
.episode-rail .measurement-history .history-row--clickable:hover {
  background: var(--surface);
  outline: 1px solid var(--line, #e5e7eb);
}
.episode-rail .measurement-history .history-row--clickable:focus-visible {
  outline: 2px solid var(--accent, #0a2540);
  outline-offset: 1px;
}

/* "+ New Case" becomes a ghost secondary button, not a gradient pill */
.episode-rail .rail-action-btn {
  width: 100%;
  margin-top: var(--gap-sm);
  padding: 8px 12px;
  min-height: 36px;
  background: transparent;
  color: var(--accent-ink);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm, 12px);
  font-size: 0.85rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.005em;
  box-shadow: none;
  transition: background 160ms var(--ease-default, ease),
              border-color 160ms var(--ease-default, ease),
              transform 100ms var(--ease-default, ease);
}
.episode-rail .rail-action-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: none;
  opacity: 1;
}
.episode-rail .rail-action-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Empty state hint in Saved Sets */
.episode-rail .measurement-history > .episode-meta {
  display: block;
  padding: 10px 12px;
  font-size: 0.82rem;
  color: var(--muted);
  font-style: normal;
}

@media (prefers-reduced-motion: reduce) {
  .episode-rail .episode-button,
  .episode-rail .measurement-history .history-row,
  .episode-rail .rail-action-btn {
    transition: none;
  }
}


/* ============================================================
   Phase 5 polish — Clinical note composer textareas
   Auto-grow via JS, better typography, quieter placeholder.
   ============================================================ */

.note-field--auto {
  gap: 6px;
}
.note-field--auto > span {
  font-size: 0.74rem;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}
.note-field--auto textarea {
  min-height: 84px;
  padding: 12px 14px;
  font-size: 0.95rem;
  line-height: 1.55;
  resize: none;              /* auto-grow JS manages height */
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm, 12px);
  transition: border-color 160ms var(--ease-default, ease),
              box-shadow 160ms var(--ease-default, ease);
}
.note-field--auto textarea::placeholder {
  color: var(--subtle, #86868b);
  opacity: 0.8;
  font-style: normal;
}
.note-field--auto textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .note-field--auto textarea { transition: none; }
}


/* ============================================================
   Phase 5 polish — Toast notifications
   Swap hardcoded hex colors for dark-mode-aware tokens, tighten
   radius + shadow to match Phase 2 primitives, respect
   prefers-reduced-motion, add a subtle backdrop saturation.
   ============================================================ */

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm, 12px);
  font-size: 0.9rem;
  line-height: 1.5;
  font-weight: var(--weight-semibold, 600);
  letter-spacing: -0.005em;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22),
              0 3px 10px rgba(15, 23, 42, 0.10);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
}

/* Token-driven color variants — inherit dark-mode values */
.toast-error   { background: var(--danger, #dc2626); color: #fff; }
.toast-success { background: var(--success, #059669); color: #fff; }
.toast-info    { background: var(--accent-ink, #0b5f5f); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; transform: none; }
}


/* ============================================================
   Phase 5 polish — Panel v2 (Dashboard / Alert Inbox / Settings)
   Shared header + close + empty-state pattern so all three
   full-screen modals match each other and the Phase 2 aesthetic.
   ============================================================ */

.panel-v2 {
  /* Tighter outer chrome — these panels already live inside
     the workspace-main grid; keep inner padding consistent
     with .progress-section for visual continuity. */
  padding: var(--gap-lg);
}

.panel-v2__hdr {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--gap);
  align-items: flex-start;
  margin-bottom: var(--gap-lg);
  padding-bottom: var(--gap);
  border-bottom: 1px solid var(--line);
}
.panel-v2__title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.panel-v2__eyebrow {
  font-size: 0.7rem;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: transparent;
  padding: 0;
}
.panel-v2__hdr h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}
.panel-v2__sub {
  margin: 2px 0 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 52ch;
}

.panel-v2__close {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--surface-muted);
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  transition: background 160ms var(--ease-default, ease),
              color 160ms var(--ease-default, ease);
  flex-shrink: 0;
}
.panel-v2__close:hover {
  background: var(--line);
  color: var(--ink);
}
.panel-v2__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Empty state shared — used by Alert Inbox when clear */
.panel-v2__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: var(--gap-xl) var(--gap);
}
.panel-v2__empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  display: grid;
  place-items: center;
  margin-bottom: 6px;
}
.panel-v2__empty strong {
  font-size: 1.15rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  color: var(--ink);
}
.panel-v2__empty p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---- Dashboard cards: tighter chrome, tabular numbers ---- */
.panel-v2 .dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--gap-sm);
  margin-bottom: var(--gap-lg);
}
.panel-v2 .dash-card {
  padding: var(--gap);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 16px);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 100px;
}
.panel-v2 .dash-card-label {
  font-size: 0.72rem;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.panel-v2 .dash-card-value {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.panel-v2 .dash-card small {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}
.panel-v2 .dash-card--urgent .dash-card-value  { color: var(--danger); }
.panel-v2 .dash-card--warning .dash-card-value { color: var(--warning); }

/* ---- Dashboard section lists: bar rows as clean hairlines ---- */
.panel-v2 .dashboard-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}
.panel-v2 .dash-section {
  padding: var(--gap);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 16px);
}
.panel-v2 .dash-section h3 {
  margin: 0 0 var(--gap-sm);
  font-size: 0.72rem;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel-v2 .dash-stage-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--gap-sm);
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.panel-v2 .dash-stage-row:last-child { border-bottom: 0; }
.panel-v2 .dash-stage-label { color: var(--ink); font-weight: 500; }
.panel-v2 .dash-stage-bar {
  grid-column: 1 / -1;
  height: 4px;
  background: var(--accent-soft);
  border-radius: 2px;
  order: 3;
  margin-top: 6px;
}
.panel-v2 .dash-stage-count {
  font-weight: var(--weight-semibold);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---- Alert Inbox groups + rows ---- */
.panel-v2 .alert-groups {
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
}
.panel-v2 .alert-group-label {
  font-size: 0.72rem !important;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 var(--gap-sm);
}
.panel-v2 .alert-list { display: flex; flex-direction: column; gap: 8px; }
.panel-v2 .alert-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--gap);
  padding: var(--gap);
  background: var(--surface) !important;
  border-left-width: 3px !important;
  border-radius: var(--radius-md, 16px);
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.panel-v2 .alert-row-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.panel-v2 .alert-row-main strong {
  font-size: 0.95rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.005em;
}
.panel-v2 .alert-row-main p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.5;
}
.panel-v2 .alert-row-main small {
  font-size: 0.78rem;
  color: var(--muted);
}
.panel-v2 .alert-row-main .alert-category {
  font-size: 0.7rem;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel-v2 .alert-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.panel-v2 .alert-actions .secondary-button {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: 999px;
}

/* ---- Settings toggles → iOS-style switch rows ---- */
.panel-v2 .settings-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 16px);
  overflow: hidden;
  padding: 0;
}
.panel-v2 .settings-toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--gap);
  padding: 14px var(--gap);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  background: transparent;
  transition: background 160ms var(--ease-default, ease);
}
.panel-v2 .settings-toggle:last-of-type { border-bottom: 0; }
.panel-v2 .settings-toggle:hover { background: var(--surface-muted); }
.panel-v2 .settings-toggle-info strong {
  font-size: 0.95rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.005em;
  color: var(--ink);
  display: block;
}
.panel-v2 .settings-toggle-info small {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}
/* iOS-style toggle switch via styled checkbox */
.panel-v2 .settings-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--line-strong);
  position: relative;
  cursor: pointer;
  transition: background 180ms var(--ease-default, ease);
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}
.panel-v2 .settings-toggle input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.16);
  transition: transform 180ms var(--ease-default, ease);
}
.panel-v2 .settings-toggle input[type="checkbox"]:checked {
  background: var(--accent);
}
.panel-v2 .settings-toggle input[type="checkbox"]:checked::before {
  transform: translateX(18px);
}
.panel-v2 .settings-toggle input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Pathway builder keeps its internals but gets cleaner chrome */
.panel-v2 .pathway-builder {
  margin-top: var(--gap-lg);
  padding: 0;
  background: transparent;
  border: 0;
}
.panel-v2 .pathway-builder-head h3 {
  font-size: 1.1rem;
  margin: 4px 0 6px;
  letter-spacing: -0.01em;
}
.panel-v2 .pathway-builder-head p {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 var(--gap);
  line-height: 1.5;
}
.panel-v2 .pathway-template-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 16px);
  padding: var(--gap);
}

.panel-v2 .settings-footer {
  margin-top: var(--gap);
  display: flex;
  justify-content: flex-end;
}

@media (prefers-reduced-motion: reduce) {
  .panel-v2 .settings-toggle input[type="checkbox"],
  .panel-v2 .settings-toggle input[type="checkbox"]::before,
  .panel-v2 .panel-v2__close,
  .panel-v2 .settings-toggle { transition: none; }
}

/* ─── MFA / TOTP enrollment panel ─────────────────────────────── */

.clinician-mfa-panel {
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  background: var(--surface, #fff);
  border-left-width: 4px;
}

.clinician-mfa-panel--not-enrolled {
  border-left-color: #d97706;
  background: linear-gradient(to right, rgba(217, 119, 6, 0.07), transparent 30%);
}

.clinician-mfa-panel--enrolled {
  border-left-color: #16a34a;
  background: linear-gradient(to right, rgba(22, 163, 74, 0.07), transparent 30%);
}

.clinician-mfa-panel__hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.clinician-mfa-panel__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink, #0f172a);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.clinician-mfa-panel__body {
  margin: 0;
  font-size: 13px;
  color: var(--muted, #6b7280);
  line-height: 1.5;
}

.clinician-mfa-panel__factors {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.clinician-mfa-panel__factor {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface-muted, #f9fafb);
  border: 1px solid var(--line, #e5e7eb);
  font-size: 13px;
}

.clinician-mfa-panel__factor strong {
  color: var(--ink, #0f172a);
  font-weight: 600;
}

.clinician-mfa-panel__factor small {
  color: var(--muted, #6b7280);
  font-size: 12px;
}

/* ─── Audit-trail history modal (plan v2.1 §1.7) ────────────── */

.audit-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 1000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.audit-modal {
  background: var(--surface, #fff);
  border-radius: 14px;
  width: min(820px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.25);
}

.audit-modal__hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}

.audit-modal__eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink, var(--accent, #0a2540));
  margin-bottom: 4px;
}

.audit-modal__hdr h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink, #0f172a);
}

.audit-modal__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line, #e5e7eb);
  background: var(--surface-muted, #f3f4f6);
  color: var(--muted, #6b7280);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.audit-modal__close:hover {
  background: var(--line, #e5e7eb);
  color: var(--ink, #0f172a);
}

.audit-modal__body {
  padding: 18px 22px;
  overflow-y: auto;
  display: grid;
  gap: 14px;
}

.audit-modal__hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted, #6b7280);
  line-height: 1.5;
}

.audit-modal__hint--error {
  color: #b91c1c;
}

.audit-modal__discrepancy {
  color: #b91c1c;
  font-weight: 600;
}

.audit-modal__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.audit-modal__table th,
.audit-modal__table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line, #e5e7eb);
  vertical-align: top;
}

.audit-modal__table th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #6b7280);
  background: var(--surface-muted, #f9fafb);
}

.audit-modal__table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--ink, #0f172a);
}

.audit-modal__row--mismatch td {
  background: rgba(239, 68, 68, 0.08);
}

.audit-modal__flag {
  margin-left: 4px;
  color: #b91c1c;
  font-weight: 600;
  cursor: help;
}

.audit-modal__ftr {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 22px;
  border-top: 1px solid var(--line, #e5e7eb);
  background: var(--surface-muted, #f9fafb);
}

.audit-modal__ftr [data-action="toggle-audit-discrepancies"] {
  margin-right: auto;
}

.audit-modal__ftr [data-action="toggle-audit-discrepancies"].is-active {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.45);
  color: #b91c1c;
}

.audit-action-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.audit-action-chip {
  padding: 4px 10px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius-pill, 16px);
  background: var(--surface-muted, #f9fafb);
  color: var(--muted, #6b7280);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.audit-action-chip:hover:not([disabled]) {
  background: var(--line, #e5e7eb);
  color: var(--ink, #0f172a);
}

.audit-action-chip.is-active {
  background: var(--accent-soft, rgba(15, 118, 110, 0.12));
  border-color: rgba(15, 118, 110, 0.4);
  color: var(--accent-ink, #0a2540);
}

.audit-action-chip[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ─── MFA enrollment modal ────────────────────────────────────── */

.clinician-mfa-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 1000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: clinician-mfa-fade 0.15s ease-out;
}

@keyframes clinician-mfa-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.clinician-mfa-modal {
  background: var(--surface, #fff);
  border-radius: 14px;
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.25);
  animation: clinician-mfa-rise 0.18s ease-out;
}

@keyframes clinician-mfa-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.clinician-mfa-modal__hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}

.clinician-mfa-modal__eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink, var(--accent, #0a2540));
  margin-bottom: 4px;
}

.clinician-mfa-modal__hdr h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink, #0f172a);
}

.clinician-mfa-modal__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line, #e5e7eb);
  background: var(--surface-muted, #f3f4f6);
  color: var(--muted, #6b7280);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.clinician-mfa-modal__close:hover:not([disabled]) {
  background: var(--line, #e5e7eb);
  color: var(--ink, #0f172a);
}

.clinician-mfa-modal__close[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.clinician-mfa-modal__body {
  padding: 18px 22px;
  overflow-y: auto;
  display: grid;
  gap: 16px;
}

.clinician-mfa-modal__hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted, #6b7280);
  line-height: 1.5;
}

.clinician-mfa-modal__ftr {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 22px;
  border-top: 1px solid var(--line, #e5e7eb);
  background: var(--surface-muted, #f9fafb);
}

.clinician-mfa-field {
  display: grid;
  gap: 6px;
}

.clinician-mfa-field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink, #0f172a);
  letter-spacing: 0.01em;
}

.clinician-mfa-qr-wrap {
  display: grid;
  place-items: center;
  padding: 10px;
}

.clinician-mfa-qr-wrap--empty {
  gap: 8px;
  min-height: 200px;
  color: var(--muted, #6b7280);
  font-size: 13px;
}

.clinician-mfa-qr-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line, #e5e7eb);
  border-top-color: var(--accent, #0a2540);
  border-radius: 50%;
  animation: clinician-mfa-spin 0.9s linear infinite;
}

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

.clinician-mfa-qr {
  display: block;
  max-width: 200px;
  width: 100%;
  height: auto;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  padding: 6px;
  background: #fff;
}

.clinician-mfa-secret {
  display: block;
  font-family: var(--font-mono, 'SF Mono', 'Menlo', monospace);
  font-size: 14px;
  letter-spacing: 0.12em;
  background: var(--surface-muted, #f3f4f6);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink, #0f172a);
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
  cursor: text;
}

.clinician-mfa-code-input {
  font: inherit;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.35em;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line, #d1d5db);
  background: var(--surface, #fff);
  color: var(--ink, #0f172a);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.clinician-mfa-code-input:focus-visible {
  outline: none;
  border-color: var(--accent, #0a2540);
  box-shadow: 0 0 0 3px var(--accent-soft, rgba(10, 37, 64, 0.12));
}

.clinician-mfa-error {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(220, 38, 38, 0.08);
  color: #991b1b;
  font-size: 13px;
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.clinician-mfa-done {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 8px;
  padding: 20px 0;
}

.clinician-mfa-done__icon {
  font-size: 36px;
  line-height: 1;
}

.clinician-mfa-done h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink, #0f172a);
}

.clinician-mfa-done p {
  margin: 0;
  font-size: 13px;
  color: var(--muted, #6b7280);
  max-width: 340px;
  line-height: 1.5;
}

/* ─── Sign-in 2FA challenge (reuses .auth-v2 shell) ──────────── */

.clinician-mfa-challenge-hint {
  margin: -4px 0 0;
  font-size: 12px;
  color: var(--muted, #6b7280);
  text-align: center;
}

.clinician-mfa-challenge-cancel {
  appearance: none;
  background: none;
  border: none;
  padding: 4px;
  margin-top: 2px;
  font: inherit;
  font-size: 13px;
  color: var(--muted, #6b7280);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  align-self: center;
}

.clinician-mfa-challenge-cancel:hover:not([disabled]) {
  color: var(--ink, #0f172a);
}

.clinician-mfa-challenge-cancel:focus-visible {
  outline: 2px solid var(--accent, #0a2540);
  outline-offset: 2px;
  border-radius: 2px;
}

.clinician-mfa-challenge-cancel[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  .clinician-mfa-modal-backdrop,
  .clinician-mfa-modal,
  .clinician-mfa-qr-spinner { animation: none; }
}
