:root {
  --ink: #102a38;
  --muted: #5a7080;
  --line: #d5e0e8;
  --paper: #eef3f6;
  --surface: #ffffff;
  --navy: #0b3b5c;
  --navy-deep: #072738;
  --teal: #0b7474;
  --teal-bright: #129090;
  --teal-soft: #e8f3f2;
  --amber: #a65f18;
  --danger: #8f2a2a;
  --shadow: 0 1px 2px rgba(15, 42, 58, 0.05), 0 12px 28px rgba(15, 42, 58, 0.08);
  --radius: 14px;
  --display: "Fraunces", Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --panel-edge: rgba(11, 59, 92, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(ellipse 60% 40% at 0% 0%, rgba(11, 116, 116, 0.1), transparent 55%),
    radial-gradient(ellipse 50% 35% at 100% 0%, rgba(11, 59, 92, 0.1), transparent 50%),
    linear-gradient(180deg, #e7eef3 0%, #edf2f5 48%, #e8efec 100%);
  background-attachment: fixed;
}
body[data-shell="interpreter"] {
  background: linear-gradient(180deg, #dbe6ee 0%, #e8eef3 36%, #e6eeeb 100%);
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.ico {
  display: inline-block;
  vertical-align: -0.125em;
  flex-shrink: 0;
}
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 1000;
  padding: 10px 14px;
  background: var(--navy);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 12px;
  outline: 3px solid #f2c94c;
  outline-offset: 2px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible {
  outline: 3px solid #149191;
  outline-offset: 2px;
}
body.a11y-high-contrast :focus-visible {
  outline-color: #f2c94c;
}
.composer-actions button {
  min-height: 44px;
}
button,
.ghost,
.secondary {
  min-height: 40px;
}
.card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 4px;
}
.card-ico {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #e9f4f3, #dce8ef);
  color: var(--teal);
  border: 1px solid rgba(18, 58, 86, 0.08);
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.card-ico .ico { width: 16px; height: 16px; }
.card-ico.teal {
  background: linear-gradient(160deg, #d7efec, #c5e4e0);
  color: #0a5555;
}
.card-title-sm {
  font-size: 0.98rem !important;
  margin: 2px 0 0 !important;
  font-weight: 650;
}
.field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

a { color: inherit; text-decoration: none; }
button, select, textarea, input { font: inherit; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--teal);
}
.soft-eyebrow { color: var(--muted); margin: 0; }
.lede, .muted, .fineprint { color: var(--muted); line-height: 1.5; }
.fineprint { font-size: 0.84rem; margin-top: 10px; }

button {
  border: 0;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 650;
}
button:hover { background: var(--navy-deep); }
button.secondary, button.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.secondary:hover, button.ghost:hover { background: var(--teal-soft); }

.field { display: grid; gap: 5px; margin-top: 10px; color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.field select, .field textarea, .field input,
select, textarea, input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  font-weight: 500;
}
.inline { display: flex; gap: 8px; align-items: center; margin-top: 10px; color: var(--muted); }

.shell { min-height: 100vh; display: grid; grid-template-rows: auto auto 1fr; }

.topnav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 0 20px;
  min-height: 58px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), transparent),
    linear-gradient(90deg, #0b3b5c, #0a4a55 55%, #0b3b5c);
  color: #e8f1f6;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; gap: 12px; align-items: center; color: #fff; }
.brand strong { display: block; font-family: var(--display); font-size: 1.05rem; }
.brand small { color: rgba(232, 241, 246, 0.72); font-size: 0.82rem; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #0c2f45;
  background: linear-gradient(145deg, #1aa6a6, #7fd3c2);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.25),
    0 0 0 1px rgba(0,0,0,0.08);
}
.topnav-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: end; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #e8f1f6;
  font-size: 0.8rem;
  font-weight: 650;
}
.pill-icon { gap: 6px; }
.pill.accent { background: rgba(127, 211, 194, 0.22); color: #d9f5ef; }
.pill.warn { background: rgba(166, 95, 24, 0.35); color: #ffe4c2; }
.nav-link {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  font-weight: 650;
  font-size: 0.84rem;
  color: #e8f1f6;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.08); }

.hero-strip {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 14px 20px;
  background:
    linear-gradient(90deg, rgba(18, 58, 86, 0.04), transparent 42%),
    rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid rgba(201, 215, 226, 0.9);
  backdrop-filter: blur(8px);
}
.hero-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(12, 107, 107, 0.1);
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(12, 107, 107, 0.18);
}
.live-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal-bright);
  box-shadow: 0 0 0 0 rgba(20, 145, 145, 0.55);
  animation: livePulse 1.8s ease-out infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(20, 145, 145, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(20, 145, 145, 0); }
  100% { box-shadow: 0 0 0 0 rgba(20, 145, 145, 0); }
}
.hero-strip h1 {
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  max-width: 42ch;
  margin-top: 4px;
  font-weight: 650;
}
.hero-strip .lede { margin-top: 4px; max-width: 58ch; font-size: 0.92rem; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(104px, 1fr));
  gap: 8px;
}
.stat-tile {
  position: relative;
  background:
    linear-gradient(180deg, #ffffff, #f5f8fa);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px 10px 38px;
  min-width: 104px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}
.stat-ico {
  position: absolute;
  left: 10px;
  top: 12px;
  width: 22px;
  height: 22px;
  color: var(--navy);
  opacity: 0.78;
}
.stat-ico .ico { width: 18px; height: 18px; }
.stat-tile span:not(.stat-ico) {
  display: block;
  font-family: var(--mono);
  font-size: 1.28rem;
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat-tile small {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}
.stat-tile[data-alert="1"] {
  border-color: rgba(143, 42, 42, 0.35);
  background: linear-gradient(180deg, #fff8f5, #fff);
}
.stat-tile[data-alert="1"] .stat-ico { color: var(--danger); }

.workspace {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr) 308px;
  gap: 12px;
  padding: 12px 16px 18px;
  min-height: 0;
}

.rail, .composer, .stage { min-height: 0; }
.rail, .composer {
  display: grid;
  gap: 10px;
  align-content: start;
}
.rail-card, .composer, .stage {
  background: #fff;
  border: 1px solid rgba(201, 215, 226, 0.98);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.rail-card, .composer { padding: 12px 13px; }
.rail-card {
  border-left: 3px solid transparent;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), #fff),
    #fff;
}
.rail-card[data-panel="patient"] { border-left-color: var(--teal-bright); }
.rail-card[data-panel="facts"] { border-left-color: var(--navy); }
.rail-card[data-panel="tools"] { border-left-color: #3d6f8c; }
.rail-card[data-panel="teach"] { border-left-color: #5b7c5b; }
.rail-card[data-panel="recent"] { border-left-color: #6a7d8d; }
.rail-card[data-panel="access"] { border-left-color: #7a6b9a; }
.rail-card[data-panel="system"] { border-left-color: #8a949c; }
.rail-card h2 { font-size: 1.05rem; margin: 4px 0 6px; font-weight: 650; }
.rail-card.system .ghost { width: 100%; margin-top: 10px; }
.status-line {
  font-weight: 700;
  margin-top: 6px;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.84rem;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.status-line[data-state="online"] .status-dot {
  background: #149191;
  box-shadow: 0 0 0 3px rgba(20, 145, 145, 0.18);
}
.status-line[data-state="degraded"] .status-dot { background: var(--amber); }
.status-line[data-state="offline"] .status-dot { background: var(--danger); }
.provider-line { font-size: 0.82rem; margin-top: 4px; }

.facts { margin: 6px 0 0; padding-left: 16px; color: var(--muted); display: grid; gap: 5px; font-size: 0.9rem; }
.facts:empty::before {
  content: "No clinical facts captured yet.";
  color: var(--muted);
  font-size: 0.86rem;
  list-style: none;
  margin-left: -16px;
}
.recent { display: grid; gap: 6px; margin-top: 6px; }
.recent:empty::before {
  content: "No recent cases yet.";
  color: var(--muted);
  font-size: 0.86rem;
}
.recent button, .recent-item {
  width: 100%;
  text-align: left;
  background: #f5f8fa;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 500;
  border-radius: 8px;
  padding: 9px 10px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.recent-ico {
  color: var(--navy);
  opacity: 0.7;
  margin-top: 2px;
}
.recent-copy { min-width: 0; }
.recent button strong, .recent-item strong { display: block; font-size: 0.88rem; }
.recent button span, .recent-item span { color: var(--muted); font-size: 0.78rem; }
.recent-copy span { display: block; }

.access-tools > summary {
  cursor: pointer;
  list-style: none;
  display: grid;
  gap: 2px;
}
.access-tools > summary::-webkit-details-marker { display: none; }
.summary-head { margin-bottom: 0; }
.access-tools > summary::after {
  content: "Show";
  justify-self: start;
  margin-top: 4px;
  margin-left: 42px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--teal, #0c6b6b);
}
.access-tools[open] > summary::after { content: "Hide"; }
.access-tools[open] > summary { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.access-tools-host { margin-top: 8px; }
.access-tools .rail-card {
  box-shadow: none;
  background: #f7fafb;
  margin: 0;
}
.access-tools .rail-card + .rail-card,
.access-tools-host + .access-tools-host .rail-card { margin-top: 8px; }

.handoff-summary-card .handoff-section { margin-top: 12px; }
.handoff-summary-card .handoff-section h5 {
  margin: 0 0 4px;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.handoff-summary-card .handoff-section ul {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 4px;
  color: var(--ink);
  font-size: 0.92rem;
}

.stage {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  min-height: 62vh;
}
.stage-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(18, 58, 86, 0.04), transparent 38%),
    linear-gradient(180deg, #f7fafb, #fff);
}
.stage-title { margin-bottom: 0; }
.stage-head h2 { font-size: 1.05rem; margin-top: 2px; }
.stage-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-actions button { padding: 8px 10px; font-size: 0.84rem; }
.timeline {
  overflow: auto;
  padding: 14px;
  display: grid;
  gap: 10px;
  align-content: start;
  background:
    linear-gradient(180deg, rgba(231, 243, 241, 0.5), transparent 72px),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 23px,
      rgba(18, 58, 86, 0.03) 24px
    ),
    #f2f6f8;
  min-height: 320px;
}
.timeline:empty::before {
  content: attr(data-empty);
  display: grid;
  place-items: center;
  min-height: 240px;
  margin: 8px;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
}

.timeline-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(15, 42, 58, 0.03);
  animation: rise 0.28s ease-out;
}
.timeline-item.patient { border-left: 3px solid var(--teal-bright); }
.timeline-item.clinician { border-left: 3px solid var(--navy); }
.timeline-item.system, .timeline-item.event { border-left: 3px solid var(--amber); }
.timeline-item.banner { border-left: 3px solid var(--danger); background: #fff8f5; }
.timeline-item.handoff-summary-card {
  border-left: 3px solid var(--navy, #0a3d62);
  background: linear-gradient(180deg, #f3f8fb, #f7fafc);
}
.timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.timeline-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: end; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(18, 58, 86, 0.08);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.chip.speaker-patient { background: rgba(20, 145, 145, 0.12); color: #0a5555; }
.chip.speaker-clinician { background: rgba(18, 58, 86, 0.12); color: var(--navy); }
.timeline-item h4 {
  font-size: 0.95rem;
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.timeline-item p { margin: 3px 0 8px; font-size: 0.94rem; }
.timeline-item pre {
  margin: 6px 0 0;
  padding: 9px;
  border-radius: 8px;
  background: #eef3f6;
  overflow: auto;
  font-size: 0.78rem;
}
.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}
.review-actions .chip { text-transform: none; letter-spacing: 0; }
.chip.review-ai_draft { background: rgba(166, 95, 24, 0.15); color: var(--amber); }
.chip.review-accepted { background: rgba(20, 145, 145, 0.12); color: #0a5555; }
.chip.review-edited { background: rgba(18, 58, 86, 0.12); color: var(--navy); }
.chip.review-rejected { background: rgba(143, 42, 42, 0.12); color: var(--danger); }
.review-edit-box { margin-top: 8px; display: grid; gap: 8px; }
.review-edit-box[hidden] { display: none !important; }
.review-actions button { min-height: 44px; padding: 8px 12px; }
.handoff-structured {
  padding: 4px 2px 12px;
  max-height: none;
  overflow: visible;
  border-bottom: 1px solid rgba(201, 215, 226, 0.8);
  margin-bottom: 12px;
}
.handoff-structured .watermark {
  color: var(--danger, #8f2a2a);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.handoff-structured h2 { font-size: 1.15rem; margin: 0 0 10px; }
.handoff-section { margin: 0 0 12px; }
.handoff-section h3 { font-size: 0.9rem; margin: 0 0 4px; }
.handoff-section ul { margin: 0; padding-left: 1.1rem; }
.handoff-section-safety { color: var(--danger, #8f2a2a); }
.msg-block {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f5f8fa;
  border: 1px solid rgba(201, 215, 226, 0.7);
}
.msg-block strong {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.composer {
  border-top: 3px solid var(--teal);
  align-self: start;
  position: sticky;
  top: 70px;
  background:
    linear-gradient(180deg, rgba(231, 243, 241, 0.55), transparent 48px),
    #fff;
}
.composer h2 { margin: 2px 0 2px; font-size: 1.15rem; }
.composer-actions { display: grid; grid-template-columns: 1fr 1.15fr; gap: 8px; margin-top: 12px; }
.composer-actions #send-button { background: var(--teal); }
.composer-actions #send-button:hover { background: #0a5555; }
.composer-actions #record-button { border-color: rgba(143, 42, 42, 0.25); }
.composer-actions #record-button .ico { color: var(--danger); }
.advanced { margin-top: 12px; color: var(--muted); }
.advanced summary { cursor: pointer; font-weight: 650; font-size: 0.88rem; }
.settings-mini { display: grid; gap: 4px; margin-top: 8px; }

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

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .hero-strip { flex-direction: column; align-items: start; }
  .stage { min-height: 480px; }
  .composer { position: static; }
}

@media (max-width: 480px) {
  .shell { grid-template-rows: auto auto 1fr auto; }
  .topnav { padding: 10px 14px; }
  .topnav-meta .nav-link { display: none; }
  .hero-strip { padding: 14px 14px 6px; }
  .hero-stats { width: 100%; }
  .workspace { padding: 10px 12px 0; gap: 10px; }
  .rail { order: 2; }
  .stage { order: 1; min-height: 52vh; }
  .composer {
    order: 3;
    position: sticky;
    bottom: 0;
    z-index: 30;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 32px rgba(16, 37, 54, 0.12);
    margin: 0 -12px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .composer.consent-blocked { opacity: 0.55; pointer-events: none; }
  #consent-gate:not([hidden]) { order: 0; border: 2px solid var(--amber); }
  .composer-actions {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .composer-actions button {
    min-height: 52px;
    font-size: 1.05rem;
  }
  .ios-mic-hint { font-size: 0.82rem; }
  .advanced { display: none; }
}

/* Display accessibility lives in the composer, not a full-width top strip */
.a11y-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--muted);
}
.a11y-toolbar button,
.a11y-toolbar .ghost {
  padding: 6px 10px;
  border-radius: 8px;
  min-height: 32px;
  font-size: 0.78rem;
  font-weight: 650;
}
.a11y-toolbar .ghost[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.a11y-hint {
  flex: 1 1 140px;
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
}
.composer-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 4px;
}
#a11y-toolbar-host { flex: 1 1 220px; }
body.a11y-high-contrast {
  --ink: #000;
  --muted: #111;
  --line: #000;
  background: #fff;
  color: #000;
}
body.a11y-high-contrast .rail-card,
body.a11y-high-contrast .stage,
body.a11y-high-contrast .composer {
  border: 2px solid #000;
}
body.a11y-large-print { font-size: 20px; }
body.a11y-large-print .composer textarea { font-size: 1.15rem; }

/* F09-F12 encounter modes */
.phrase-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.phrase-btn {
  min-height: 52px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  border: 2px solid var(--navy);
  background: #fff;
  cursor: pointer;
}
body.mode-ambulance .topnav-meta .nav-link { display: none; }
body.mode-ambulance .focus-bar { display: none; }
body.mode-ambulance .hero-strip { display: none; }
body.mode-ambulance .composer { border: 3px solid var(--danger); }
body.mode-pharmacy .stage { min-height: 360px; }
body.mode-reception #dir-steps { margin: 10px 0 0 18px; }
.bsl-player { margin: 10px 0; }
.easy-read-block { display: flex; gap: 12px; align-items: center; margin: 12px 0; }
.family-summaries { margin-top: 10px; font-size: 0.92rem; }

/* GUI wire: continuity, safety, handoff, confidence, Easy Read, teach-back */
.pill.soft { background: rgba(127, 211, 194, 0.18); color: #d9f5ef; }
.pill.warn { background: rgba(255, 196, 120, 0.22); color: #ffe0b5; }

.continuity-banner {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(90deg, rgba(18, 58, 86, 0.98), rgba(12, 107, 107, 0.96));
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.continuity-banner.is-continuity {
  background: linear-gradient(90deg, rgba(143, 42, 42, 0.96), rgba(166, 95, 24, 0.94));
}
.continuity-inner {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 20px;
  max-width: 1400px;
  margin: 0 auto;
}
.continuity-mode {
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.14);
}
.continuity-inner p { margin: 0; font-size: 0.9rem; }

.safety-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(7, 20, 32, 0.58);
  display: grid;
  place-items: center;
  padding: 24px;
  backdrop-filter: blur(6px);
}
.safety-overlay[hidden] { display: none !important; }
.safety-card {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 28px 80px rgba(7, 20, 32, 0.28);
  animation: rise 420ms ease both;
}
.eyebrow.danger { color: var(--danger); }
.safety-card h2 { margin: 8px 0 10px; font-size: 1.7rem; }
.safety-actions {
  margin: 16px 0 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 6px;
}
.safety-controls {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
  margin-top: 20px;
}
.danger-btn {
  background: var(--danger);
}
.danger-btn:hover { background: #7a1f1f; }

.handoff-drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(7, 20, 32, 0.45);
  display: grid;
  justify-items: end;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
}
.handoff-drawer[hidden] { display: none !important; }
.handoff-panel {
  width: min(520px, 100%);
  max-width: 100vw;
  height: 100%;
  max-height: 100dvh;
  min-height: 0;
  background: #fff;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: -18px 0 48px rgba(7, 20, 32, 0.18);
  animation: slideIn 380ms ease both;
  overflow: hidden;
}
.handoff-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  flex: 0 0 auto;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}
.handoff-head h2 {
  margin: 4px 0 0;
  font-size: 1.35rem;
  font-family: var(--display);
  color: var(--navy);
  letter-spacing: -0.02em;
}
.handoff-head .ghost {
  flex: 0 0 auto;
  white-space: nowrap;
}
.handoff-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 18px 18px;
  overscroll-behavior: contain;
}
.handoff-body {
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  background: #f4f8fa;
  border: 1px solid var(--line);
  overflow: visible;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink);
}
.handoff-foot {
  flex: 0 0 auto;
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: #fff;
  display: grid;
  gap: 8px;
}
.handoff-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.handoff-actions button {
  min-height: 42px;
}
@keyframes slideIn {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 720px) {
  .handoff-drawer {
    justify-items: stretch;
    align-items: end;
    padding: 0;
  }
  .handoff-panel {
    width: 100%;
    max-width: 100vw;
    height: min(94dvh, 100%);
    max-height: min(94dvh, 100%);
    border-radius: 18px 18px 0 0;
    animation: slideUpHandoff 320ms ease both;
  }
  .handoff-head {
    padding: 14px 14px 10px;
  }
  .handoff-scroll {
    padding: 12px 14px 16px;
  }
  .handoff-foot {
    padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .handoff-actions {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 420px) {
  .handoff-actions {
    grid-template-columns: 1fr;
  }
}
@keyframes slideUpHandoff {
  from { transform: translateY(28px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.welcome-line {
  margin-top: 10px;
  color: var(--teal);
  font-weight: 600;
}
.toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f5f8fa;
  font-weight: 650;
  font-size: 0.84rem;
  color: var(--navy);
}
.toggle input { width: auto; }

.timeline-meta { display: flex; gap: 8px; align-items: center; }
.confidence-chip {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.conf-high { background: rgba(12, 107, 107, 0.14); color: var(--teal); }
.conf-mid { background: rgba(184, 106, 28, 0.16); color: var(--amber); }
.conf-low { background: rgba(155, 44, 44, 0.14); color: var(--danger); }
.conf-unknown { background: rgba(10, 61, 98, 0.08); color: var(--navy); }

.msg-block { margin-bottom: 8px; }
.msg-block strong {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 2px;
}
.easy-read-block {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 12px 0 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f0faf7;
  border: 1px solid rgba(12, 107, 107, 0.18);
}
.easy-read-badge {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  padding-top: 2px;
}
.cultural-notes { margin-top: 12px; display: grid; gap: 8px; }
.cultural-chip, .cultural-inline span {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(184, 106, 28, 0.1);
  color: #7a4a12;
  font-size: 0.9rem;
  line-height: 1.4;
}
.cultural-inline { display: grid; gap: 6px; margin-top: 8px; }
.degraded-note {
  margin-top: 8px;
  font-size: 0.86rem;
  color: var(--amber);
  font-weight: 600;
}

.symbol-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.symbol-card {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid rgba(10, 61, 98, 0.12);
  background: #fff;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--navy);
}
.symbol-card:hover { border-color: var(--teal); background: #f7fcfb; }
.bsl-phrase-list { display: grid; gap: 10px; margin-top: 10px; }
.bsl-phrase-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(10, 61, 98, 0.1);
  background: #fff;
}
.bsl-phrase-card.is-playing { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(12, 107, 107, 0.12); }
.bsl-clip-frame {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background: #f0faf7;
}
.bsl-animate { animation: bslPulse 1.2s ease-in-out infinite; }
@keyframes bslPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.explain-drawer .explain-body { white-space: normal; font-family: var(--font-body); }
.explain-block { margin-top: 14px; }
.explain-why-btn { margin-left: auto; font-size: 0.82rem; }
.nav-steps { margin: 10px 0 0; padding-left: 18px; }
.nav-wheelchair { margin: 8px 0 12px; }
.multiparty-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(10, 61, 98, 0.1); }
.multiparty-turns { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.multiparty-turns .is-active { outline: 2px solid var(--teal); }
.mp-transcript { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; max-height: 160px; overflow: auto; }

@media (max-width: 480px) {
  .safety-controls, .handoff-actions { grid-template-columns: 1fr; }
  .continuity-inner { padding: 10px 14px; flex-direction: column; align-items: start; }
  .handoff-panel { width: 100%; }
}

/* Focus mode: premium clinical encounter shell */
.shell-focus {
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}
.topnav-dense {
  display: grid;
  grid-template-columns: auto minmax(180px, 1.2fr) auto auto;
  gap: 10px 14px;
  align-items: center;
  min-height: 58px;
  padding: 8px 16px;
  box-shadow: 0 10px 28px rgba(7, 39, 56, 0.18);
}
.topnav-dense .brand { gap: 10px; text-decoration: none; }
.topnav-dense .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(145deg, #1aa6a6, #7fd3c2);
}
.topnav-dense .brand strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
}
.topnav-dense .brand small {
  font-size: 0.74rem;
  color: rgba(232, 241, 246, 0.72);
}
.topnav-case {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.topnav-dense .live-badge {
  flex: 0 0 auto;
  padding: 4px 9px;
  font-size: 0.68rem;
  background: rgba(18, 180, 160, 0.18);
  color: #9fe3d6;
  border: 1px solid rgba(159, 227, 214, 0.28);
}
.topnav-dense .live-pulse {
  background: #4adeb0;
  box-shadow: 0 0 0 0 rgba(74, 222, 176, 0.55);
}
.topnav-dense .focus-copy { min-width: 0; }
.topnav-dense .focus-copy h1 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.25;
  font-family: var(--sans);
  font-weight: 700;
  color: #f4fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topnav-dense .focus-meta,
.topnav-dense .welcome-line {
  margin: 1px 0 0;
  color: rgba(232, 241, 246, 0.72);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topnav-dense .welcome-line { color: #9fe3d6; }
.topnav-clinician {
  color: rgba(232, 241, 246, 0.78);
  font-size: 0.75rem;
  font-weight: 650;
  max-width: 14ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.focus-metrics { display: inline-flex; gap: 6px; flex-wrap: nowrap; }
.metric-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(232, 241, 246, 0.78);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: lowercase;
  letter-spacing: 0.01em;
}
.metric-chip strong {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #fff;
  font-weight: 700;
}
.metric-chip[data-alert="1"] {
  background: rgba(214, 84, 84, 0.28);
  border-color: rgba(255, 170, 170, 0.42);
  color: #ffd4d4;
  box-shadow: 0 0 0 1px rgba(214, 84, 84, 0.15);
}
.metric-chip[data-alert="1"] strong { color: #fff; }
.focus-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}
.action-cluster {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.action-cluster-clinical {
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}
.topnav-dense .focus-actions .ghost,
.topnav-dense .focus-actions .secondary,
.topnav-dense .nav-link {
  padding: 6px 11px;
  min-height: 34px;
  font-size: 0.78rem;
  border-radius: 10px;
  font-weight: 650;
}
.topnav-dense .focus-actions .ghost {
  background: rgba(255, 255, 255, 0.06);
  color: #e8f1f6;
  border: 1px solid rgba(255, 255, 255, 0.16);
}
.topnav-dense .focus-actions .ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}
.topnav-dense .focus-actions .secondary {
  background: linear-gradient(180deg, rgba(26, 166, 166, 0.42), rgba(26, 166, 166, 0.28));
  color: #e8fff9;
  border: 1px solid rgba(127, 211, 194, 0.4);
}
.topnav-dense .nav-link {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e8f1f6;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.topnav-dense .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.workspace-focus {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 12px;
  padding: 12px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.workspace-focus .stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(11, 59, 92, 0.1);
  background: #fff;
  box-shadow: var(--shadow);
}
.stage-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f7fbfb, #fff);
}
.stage-kicker {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--navy);
  letter-spacing: -0.02em;
}
.stage-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 550;
}
.workspace-focus .timeline {
  height: 100%;
  max-height: 100%;
  overflow: auto;
  padding: 14px 14px 18px;
  gap: 10px;
  background:
    linear-gradient(180deg, rgba(232, 243, 242, 0.35), transparent 80px),
    #f4f7f9;
}
.workspace-focus .timeline:empty::before {
  content: attr(data-empty);
  display: grid;
  place-items: center;
  min-height: 280px;
  margin: 8px;
  padding: 36px 28px;
  border: 1px dashed rgba(11, 116, 116, 0.28);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(232, 243, 242, 0.7));
  color: var(--muted);
  text-align: center;
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.45;
  max-width: 42ch;
  justify-self: center;
  width: calc(100% - 16px);
}
.workspace-focus .composer {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  overflow: auto;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(11, 59, 92, 0.1);
  border-top: 3px solid var(--teal);
  background:
    linear-gradient(180deg, rgba(232, 243, 242, 0.65), transparent 72px),
    #fff;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  align-self: stretch;
}
.composer-kicker {
  margin: 0 0 2px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}
.composer-head-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
}
.composer-head-row h2 {
  margin: 0;
  font-size: 1.2rem;
  font-family: var(--display);
  color: var(--navy);
  letter-spacing: -0.02em;
}
.compact-toggle {
  padding: 5px 9px;
  font-size: 0.76rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
}
.composer-lang-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.composer-lang-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.composer-lang-row .field { margin-top: 0; }
.composer-lang-row .field-label,
.composer-message-field .field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.composer-lang-row select,
.composer-message-field textarea {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fbfcfd;
}
.composer-lang-row select:focus,
.composer-message-field textarea:focus {
  border-color: rgba(11, 116, 116, 0.45);
  box-shadow: 0 0 0 3px rgba(11, 116, 116, 0.12);
  outline: none;
}
.composer-message-field {
  flex: 1 1 auto;
  display: grid;
  grid-template-rows: auto minmax(140px, 1fr);
  min-height: 160px;
  margin-top: 10px;
}
.composer-message-field textarea {
  height: 100%;
  min-height: 140px;
  resize: none;
  padding: 12px 14px;
  font-size: 0.98rem;
  line-height: 1.45;
}
.composer-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
  margin-top: 12px;
}
.composer-actions #send-button {
  background: linear-gradient(180deg, #0e8585, var(--teal));
  border: 0;
  color: #fff;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(11, 116, 116, 0.22);
}
.composer-actions #send-button:hover {
  background: #0a6262;
}
.composer-actions #record-button {
  border-radius: 12px;
  border: 1px solid rgba(143, 42, 42, 0.22);
  background: #fff;
}
.composer-actions #record-button .ico { color: var(--danger); }
.composer-more {
  margin-top: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.composer-more summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 0.8rem;
}

.msg-lead {
  margin: 4px 0 0 !important;
  font-size: 0.98rem !important;
  line-height: 1.45;
  color: var(--ink);
  font-weight: 550;
}
.msg-sub {
  margin: 4px 0 0 !important;
  font-size: 0.84rem !important;
  color: var(--muted);
  line-height: 1.4;
}
.msg-details { margin-top: 6px; color: var(--muted); }
.msg-details summary {
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 650;
  color: var(--teal);
}
.msg-details .msg-block {
  margin-top: 6px;
  border-radius: 10px;
  background: #f2f6f8;
}

.workspace-focus .timeline-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(11, 59, 92, 0.08);
  background: #fff;
  box-shadow: 0 1px 0 rgba(15, 42, 58, 0.03);
  position: relative;
}
.workspace-focus .timeline-item.message.patient {
  border-left: 4px solid var(--teal-bright);
  background: linear-gradient(180deg, #f4fbfa, #fff);
}
.workspace-focus .timeline-item.message.clinician {
  border-left: 4px solid var(--navy);
  background: linear-gradient(180deg, #f3f7fb, #fff);
}
.workspace-focus .timeline-item.event {
  border-left: 4px solid var(--amber);
  background: linear-gradient(180deg, #fff9f2, #fff);
}
.workspace-focus .timeline-item.banner,
.workspace-focus .timeline-item.event.banner {
  border-left: 4px solid var(--danger);
  background: linear-gradient(180deg, #fff5f3, #fff8f6);
  box-shadow: 0 0 0 1px rgba(143, 42, 42, 0.08);
}
.workspace-focus .timeline-head { margin-bottom: 4px; align-items: center; }
.workspace-focus .timeline-item p { margin: 2px 0 4px; font-size: 0.92rem; }
.workspace-focus .chip {
  padding: 3px 8px;
  font-size: 0.68rem;
  border-radius: 999px;
}
.workspace-focus .chip.speaker-patient {
  background: rgba(11, 116, 116, 0.12);
  color: #0a5555;
}
.workspace-focus .chip.speaker-clinician {
  background: rgba(11, 59, 92, 0.12);
  color: var(--navy);
}
.workspace-focus .confidence-chip {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-weight: 650;
}
.workspace-focus .timeline-meta .muted {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}
.workspace-focus .review-actions { margin-top: 8px; gap: 6px; }
.workspace-focus .review-actions button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: 9px;
}
.workspace-focus .review-actions .linkish {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  text-decoration: underline;
  font-weight: 650;
  cursor: pointer;
}
.workspace-focus .easy-read-block {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(11, 116, 116, 0.06);
  border: 1px solid rgba(11, 116, 116, 0.12);
}
.workspace-focus .explain-why-btn {
  font-size: 0.74rem;
  padding: 3px 8px;
  min-height: 28px;
  border-radius: 8px;
}

.context-drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(440px, 100%);
}
.context-drawer[hidden] { display: none !important; }
.context-drawer-backdrop {
  border: 0;
  background: rgba(7, 39, 56, 0.48);
  cursor: pointer;
  min-height: 100%;
  backdrop-filter: blur(3px);
}
.context-drawer-panel {
  background: #f4f8fa;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 48px rgba(7, 39, 56, 0.22);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  max-height: 100dvh;
  overflow: hidden;
}
.context-drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 16px 18px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.context-drawer-head h2 {
  margin: 2px 0 0;
  font-size: 1.25rem;
  font-family: var(--display);
  color: var(--navy);
  letter-spacing: -0.02em;
}
.context-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.context-tabs .team-tab,
.context-tabs button {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 0.82rem;
  min-height: 34px;
  cursor: pointer;
}
.context-tabs .team-tab.is-active,
.context-tabs button.is-active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.context-rail {
  padding: 14px 16px 24px;
  overflow: auto;
  display: grid;
  gap: 12px;
  align-content: start;
}
.context-rail > [data-context].is-context-hidden {
  display: none !important;
}
.context-rail .rail-card {
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: none;
  background: #fff;
}

@media (max-width: 1100px) {
  .topnav-dense { grid-template-columns: 1fr; }
  .topnav-dense .focus-actions,
  .topnav-dense .focus-metrics { width: 100%; flex-wrap: wrap; }
  .action-cluster-clinical {
    border-right: 0;
    padding-right: 0;
    width: 100%;
  }
  .workspace-focus {
    grid-template-columns: 1fr;
    overflow: auto;
    height: auto;
  }
  .shell-focus {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .workspace-focus .composer {
    height: auto;
    position: static;
  }
  .composer-lang-pair { grid-template-columns: 1fr; }
  .context-drawer { grid-template-columns: minmax(0, 1fr) min(100%, 100%); }
}

@media (max-width: 700px) {
  .topnav-case { width: 100%; }
  .stage-head { flex-direction: column; gap: 2px; }
}
