/* ==========================================================================
   Tiroides 360° — Fusión #2 (Dark Radiology Workbench) + #3 (Pocket Wizard)
   + Tratado Escrito Vivo (5 Capítulos Simulados)
   ========================================================================== */

:root {
  --bg: #090C10;
  --panel: #11161E;
  --panel-2: #161C26;
  --panel-3: #0D1218;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #F1F5F9;
  --text-body: #CBD5E1;
  --muted: #8B9BB0;

  --cyan: #22D3EE;
  --teal: #2DD4BF;
  --amber: #F59E0B;
  --orange: #FB923C;
  --crimson: #EF4444;
  --emerald: #10B981;
  --brass: #E2C48D;

  --serif: "Newsreader", Georgia, serif;
  --display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: var(--mono);
  background: rgba(255, 255, 255, 0.08);
  padding: 0.08rem 0.35rem;
  border-radius: 5px;
  font-size: 0.86em;
  color: var(--cyan);
}

/* App Shell */
.app-shell {
  display: grid;
  grid-template-columns: 68px 1fr;
  min-height: 100vh;
}

/* Left Slim Rail */
.left-rail {
  background: #06080B;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}

.rail-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.25);
  display: grid;
  place-items: center;
}

.rail-nav, .rail-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  align-items: center;
}

.rail-btn {
  width: 54px;
  padding: 8px 4px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: var(--sans);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.rail-btn:hover {
  background: var(--panel-2);
  color: var(--text);
}

.rail-btn.active {
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.35);
  color: var(--cyan);
}

.rail-ico { font-family: var(--mono); font-size: 0.82rem; font-weight: 700; }
.rail-lbl { font-size: 0.64rem; font-weight: 600; }

/* Workspace & Topbar */
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  min-height: 52px;
  background: rgba(17, 22, 30, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 8px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 25;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.brand-lockup { display: flex; flex-direction: column; }
.brand-name { font-family: var(--mono); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; color: var(--text); }
.brand-sub { font-size: 0.74rem; color: var(--muted); }

.topbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-body);
  cursor: pointer;
  white-space: nowrap;
}

.chip-offline { color: var(--teal); border-color: rgba(45, 212, 191, 0.28); cursor: default; }
.chip-access { color: var(--cyan); border-color: rgba(34, 211, 238, 0.35); }
.chip-cmd:hover, .chip-access:hover, .chip-ghost:hover { border-color: var(--border-strong); color: #FFFFFF; }
.dot-sm { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }

/* Views */
.view-panel { display: none; flex: 1; }
.view-panel.active { display: block; animation: fadeUp 0.18s ease-out; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* View 1: Split Workbench */
.split-workbench {
  display: grid;
  grid-template-columns: 1.04fr 0.96fr;
  gap: 1px;
  background: var(--border);
  min-height: calc(100vh - 52px);
}

.pane {
  background: var(--bg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px;
}

.box-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cyan);
}

.mono-white { color: var(--text); text-transform: none; font-size: 0.78rem; }
.mono-cyan { color: var(--cyan); font-family: var(--mono); font-size: 0.74rem; }

.mode-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.cine-mode-btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 7px;
  padding: 4px 9px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}
.cine-mode-btn.active { background: rgba(34, 211, 238, 0.16); color: var(--cyan); border-color: var(--cyan); }

.viewer-wrap { position: relative; border-radius: 10px; overflow: hidden; }
.plate-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.plate-switch {
  display: inline-flex;
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
}
.plate-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.plate-tab.active {
  background: rgba(34, 211, 238, 0.16);
  color: var(--cyan);
}
.plate-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.plate-stage {
  background: #03060A;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.plate-img,
.plate-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #03060A;
}
.plate-img[hidden],
.plate-video[hidden] { display: none; }
.plate-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  background: rgba(9, 12, 16, 0.84);
  border: 1px solid rgba(34, 211, 238, 0.45);
  padding: 4px 9px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  pointer-events: none;
}
.plate-attr {
  margin: 7px 0 0;
  font-family: var(--mono);
  font-size: 0.67rem;
  color: var(--muted);
}
.dx-annotation-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.dx-annotation-layer[hidden] { display: none; }
.dx-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dx-pin-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--cyan);
  border: 2px solid #06090D;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.25);
  flex-shrink: 0;
}
.dx-pin-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  color: #F8FAFC;
  background: rgba(9, 12, 16, 0.88);
  border: 1px solid rgba(34, 211, 238, 0.5);
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
}
.plate-treatise-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.shutter-flash {
  position: absolute;
  inset: 0;
  background: rgba(34, 211, 238, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 5;
}
.shutter-flash.active { opacity: 1; }
canvas { width: 100%; height: auto; display: block; background: #03060A; border-radius: 10px; }

.viewer-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.cine-caption { margin: 0; font-size: 0.77rem; color: var(--muted); flex: 1; }
.link-cyan {
  background: none;
  border: none;
  padding: 0;
  color: var(--cyan);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Clickable Thyroid SVG */
.anatomy-grid {
  display: grid;
  grid-template-columns: 165px 1fr;
  gap: 14px;
  align-items: center;
}
.thyroid-svg { width: 100%; max-width: 160px; cursor: pointer; }
.lobe-shape {
  fill: rgba(34, 211, 238, 0.1);
  stroke: rgba(34, 211, 238, 0.5);
  stroke-width: 2;
  transition: fill 0.15s, stroke 0.15s;
}
.lobe-shape:hover { fill: rgba(34, 211, 238, 0.24); }
.lobe-shape.selected { fill: rgba(34, 211, 238, 0.36); stroke: var(--cyan); stroke-width: 2.5; }
.anatomy-meta p { margin: 0 0 8px; font-size: 0.82rem; color: var(--muted); }
.telemetry-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--teal);
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}

/* Right Pane: Concept #3 Guided 3-Step Visual Wizard inside Dark OLED Shell */
.wizard-shell {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wiz-head-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.kicker-cyan {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cyan);
}
.wiz-head h2 {
  font-family: var(--display);
  font-size: 1.25rem;
  margin: 2px 0 0;
}
.step-chip {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(34, 211, 238, 0.14);
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.3);
  padding: 4px 10px;
  border-radius: 999px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.step-bar {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 10px;
  padding: 7px 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.step-bar.done {
  border-color: rgba(45, 212, 191, 0.45);
  background: rgba(45, 212, 191, 0.12);
  color: var(--teal);
}

.step-view { display: none; }
.step-view.active { display: block; animation: fadeUp 0.18s ease-out; }
.step-sub { margin: 0 0 12px; font-size: 0.85rem; color: var(--muted); }

/* Illustrated SVG Sign Cards */
.visual-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.sign-card {
  background: var(--panel-2);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.sign-card:active { transform: scale(0.98); }
.sign-card.selected {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
}
.sign-card svg { width: 100%; height: 48px; border-radius: 9px; display: block; }
.sign-card-wide {
  grid-column: span 2;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.sign-card-wide svg { width: 145px; flex-shrink: 0; }
.sign-name { font-size: 0.84rem; font-weight: 700; display: block; }
.sign-pt { font-family: var(--mono); font-size: 0.7rem; color: var(--teal); font-weight: 600; }

/* Tactile Ruler Slider */
.ruler-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
}
.mm-display {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.mm-big { font-family: var(--display); font-size: 2.3rem; font-weight: 800; line-height: 1; }
.mm-unit { font-size: 1rem; color: var(--muted); font-weight: 600; }
.cm-sub { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); margin-left: 6px; }
.detent-pill {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--muted);
  border: 1px solid var(--border);
}
.detent-pill.active {
  background: rgba(34, 211, 238, 0.16);
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.4);
}
input[type="range"] { width: 100%; accent-color: var(--cyan); height: 8px; cursor: pointer; }
.ruler-marks {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 6px;
}
.mark-threshold { color: var(--cyan); font-weight: 700; }

.field-lbl { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.lobe-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.lobe-pill {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-body);
  border-radius: 12px;
  padding: 9px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.lobe-pill.active {
  background: rgba(34, 211, 238, 0.15);
  border-color: var(--cyan);
  color: var(--cyan);
}

/* Apple-Wallet Stacked Verdict Card */
.wallet-stack { position: relative; padding-top: 12px; margin-bottom: 14px; }
.wallet-back {
  position: absolute;
  top: 2px;
  left: 14px;
  right: 14px;
  height: 28px;
  background: #1E293B;
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
}
.wallet-front {
  position: relative;
  background: linear-gradient(160deg, #131B26 0%, #0C1219 100%);
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.45);
}
.wallet-front.risk-low, .wallet-front.risk-mild { border-color: rgba(245, 158, 11, 0.5); }
.wallet-front.risk-high {
  background: linear-gradient(160deg, #2B1014 0%, #14090C 100%);
  border-color: rgba(239, 68, 68, 0.55);
}
.wallet-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.wallet-score-row { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 0 12px; }
.score-big { font-family: var(--display); font-size: 2.65rem; font-weight: 800; line-height: 1; }
.score-max { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }
.risk-badge {
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.16);
  color: var(--teal);
}
.risk-low .risk-badge, .risk-mild .risk-badge { background: rgba(245, 158, 11, 0.18); color: var(--amber); }
.risk-high .risk-badge { background: rgba(239, 68, 68, 0.2); color: #FCA5A5; }
.risk-prob { font-family: var(--mono); font-size: 0.8rem; color: var(--text-body); white-space: nowrap; }

.risk-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.meter-seg {
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.meter-seg::before {
  content: "";
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}
.meter-seg.active { color: #FFFFFF; font-weight: 700; }
#gauge-benign.active::before { background: var(--teal); }
#gauge-low.active::before { background: var(--amber); }
#gauge-mild.active::before { background: var(--orange); }
#gauge-high.active::before { background: var(--crimson); }

.risk-rec { margin: 0 0 10px; font-size: 0.88rem; font-weight: 600; color: var(--text); }
.tirads-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.76rem;
  background: rgba(0, 0, 0, 0.28);
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text-body);
}

.ris-panel {
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.ris-textarea {
  width: 100%;
  background: #05070A;
  color: #CBD5E1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.48;
  resize: vertical;
}
.ris-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.copy-feedback { font-size: 0.78rem; color: var(--emerald); font-weight: 600; }
.disclaimer { font-size: 0.72rem; color: var(--muted); margin: 10px 0 0; }

/* Buttons & Inputs */
.btn-cyan-lg {
  width: 100%;
  margin-top: 14px;
  border: none;
  border-radius: 14px;
  background: var(--cyan);
  color: #06131C;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 12px 16px;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.btn-cyan-lg:hover { filter: brightness(1.08); }
.btn-cyan-lg:active { transform: scale(0.988); }

.btn-copy-sm {
  border: none;
  border-radius: 7px;
  background: var(--cyan);
  color: #06131C;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 10px;
  cursor: pointer;
}
.btn-copy-sm.is-copied { background: var(--emerald); color: #FFFFFF; }

.btn-outline-dark {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: 10px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-outline-dark:hover { color: var(--text); border-color: var(--border-strong); }

.dark-input, .dark-select {
  width: 100%;
  background: #06090D;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
  font: inherit;
  font-size: 0.88rem;
}
.dark-input:focus, .dark-select:focus { outline: none; border-color: var(--cyan); }

/* View 2: Tratado Escrito Vivo (Dual-Pane Reader) */
.treatise-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: calc(100vh - 52px);
}
.toc-pane {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.toc-head h3 { font-family: var(--serif); margin: 4px 0 10px; font-size: 1.2rem; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.filter-pill {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}
.filter-pill.active { background: rgba(34, 211, 238, 0.16); color: var(--cyan); border-color: var(--cyan); }

.toc-list { display: flex; flex-direction: column; gap: 6px; }
.toc-btn {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--panel-3);
  color: var(--text-body);
  border-radius: 10px;
  padding: 11px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.toc-btn:hover { border-color: var(--border-strong); }
.toc-btn.active { border-color: var(--cyan); background: rgba(34, 211, 238, 0.08); }
.toc-num { font-family: var(--mono); font-size: 0.68rem; color: var(--cyan); display: block; margin-bottom: 2px; }
.toc-title { font-weight: 600; font-size: 0.85rem; display: block; color: var(--text); }
.toc-meta { font-size: 0.72rem; color: var(--muted); margin-top: 4px; display: block; }

.reading-pane {
  padding: 32px clamp(20px, 5vw, 60px) 64px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}
.sim-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--brass);
  background: rgba(226, 196, 141, 0.1);
  border: 1px solid rgba(226, 196, 141, 0.3);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.reading-pane h1 {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  line-height: 1.15;
  margin: 0 0 12px;
}
.reading-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.prose h3 {
  font-family: var(--serif);
  font-size: 1.32rem;
  color: var(--text);
  margin: 24px 0 8px;
}
.prose p { color: var(--text-body); font-size: 0.98rem; line-height: 1.72; margin: 0 0 14px; }
.pearl-box {
  background: rgba(45, 212, 191, 0.08);
  border-left: 3px solid var(--teal);
  border-radius: 8px;
  padding: 13px 16px;
  margin: 18px 0;
  font-size: 0.9rem;
  color: var(--text);
}
.prose-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.84rem;
}
.prose-table th, .prose-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
.prose-table th { background: var(--panel-2); color: var(--cyan); font-family: var(--mono); font-size: 0.74rem; }

.inline-cine-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin: 20px 0;
}
.inline-details {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  margin: 16px 0;
  font-size: 0.86rem;
}
.inline-details summary { font-weight: 700; color: var(--cyan); cursor: pointer; }
.signal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 22px;
}
.signal-row { display: flex; gap: 8px; margin-top: 10px; }
.signal-item {
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 0.8rem;
  margin-top: 8px;
}

/* View 3: Cases */
.cases-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  min-height: calc(100vh - 52px);
}
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 0.8rem; font-weight: 600; color: var(--text-body); }
.checks-box {
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.check-line { display: flex; gap: 8px; align-items: flex-start; font-size: 0.79rem; color: var(--text-body); cursor: pointer; }
.check-line input { margin-top: 3px; accent-color: var(--cyan); }
.cases-list { display: flex; flex-direction: column; gap: 10px; }
.case-item {
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.case-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 6px; }
.badge-pub { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(16, 185, 129, 0.16); color: var(--emerald); }
.badge-pending { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(245, 158, 11, 0.16); color: var(--amber); }

.cert-card {
  background: linear-gradient(155deg, #121923 0%, #090D12 100%);
  border: 1px solid rgba(226, 196, 141, 0.45);
  border-radius: 14px;
  padding: 10px;
}
.cert-inner {
  border: 1px dashed rgba(226, 196, 141, 0.45);
  border-radius: 10px;
  padding: 16px;
}
.cert-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  font-size: 0.82rem;
}

/* Modals & Bottom Sheets */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
}
.overlay[hidden] { display: none; }
.glass-modal {
  width: 100%;
  max-width: 520px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}
.access-modal { padding: 18px; max-height: 90vh; overflow-y: auto; }
.grab-handle { display: none; width: 42px; height: 5px; border-radius: 999px; background: rgba(255,255,255,0.22); margin: 0 auto 12px; }

.cmd-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  padding: 14px 16px;
  font: inherit;
  font-size: 0.94rem;
  outline: none;
}
.cmd-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-body);
  padding: 10px 16px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.cmd-item:hover { background: rgba(34, 211, 238, 0.12); color: var(--cyan); }
.cmd-tag { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }

.access-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.access-tab {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 9px;
  padding: 8px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.access-tab.active { background: rgba(34, 211, 238, 0.15); border-color: var(--cyan); color: var(--cyan); }
.retrofit-row, .quick-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.retrofit-row input { flex: 1; }
.hint-line { font-size: 0.74rem; color: var(--muted); display: block; margin-top: 4px; }
.hint-line.ok { color: var(--emerald); }
.hint-line.err { color: var(--crimson); }
.form-msg { padding: 9px 11px; border-radius: 8px; font-size: 0.82rem; font-weight: 600; }
.form-msg.success { background: rgba(16, 185, 129, 0.15); color: var(--emerald); }
.form-msg.error { background: rgba(239, 68, 68, 0.15); color: #FCA5A5; }
.muted { color: var(--muted); font-size: 0.84rem; margin: 0; }

/* Mobile Nav & Toast */
.mobile-nav { display: none; }
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 95;
  background: var(--panel-2);
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.4);
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}

@media (max-width: 980px) {
  .split-workbench, .treatise-layout, .cases-layout { grid-template-columns: 1fr; }
  .anatomy-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; padding-bottom: 66px; }
  .left-rail { display: none; }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(11, 15, 21, 0.96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 6px 4px 10px;
    z-index: 50;
  }
  .bnav-btn {
    border: none;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
  }
  .bnav-btn.active { color: var(--cyan); }
  .overlay-sheet { align-items: end; padding: 0; }
  .access-modal { border-radius: 22px 22px 0 0; max-width: none; }
  .grab-handle { display: block; }
  .field-2, .signal-row { grid-template-columns: 1fr; flex-direction: column; }
  .toast { bottom: 76px; left: 16px; right: 16px; text-align: center; }
}
