:root {
  color-scheme: light;
  --ink: #20252b;
  --muted: #66717c;
  --line: #dce1e5;
  --surface: #ffffff;
  --canvas: #f4f6f7;
  --primary: #0f766e;
  --primary-dark: #0a5b55;
  --danger: #b42318;
  --warning: #9a6700;
  --success: #18794e;
  --nav: #1b2329;
  --touch: 44px;
  --radius: 10px;
  --shadow: 0 10px 28px rgba(15, 23, 42, .12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--canvas);
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  padding-bottom: var(--safe-bottom);
}
body.nav-open { overflow: hidden; }
[hidden] { display: none !important; }
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 80;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}
.skip-link:focus { top: calc(var(--safe-top) + 8px); }
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav);
  color: #eef2f3;
  border-bottom: 1px solid #313b43;
  padding-top: var(--safe-top);
}
.topnav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  gap: 10px 14px;
  align-items: center;
  min-width: 0;
}
.brand {
  flex: none;
  color: #fff !important;
  font-weight: 800;
  letter-spacing: .01em;
  text-decoration: none;
  font-size: 16px;
}
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  min-width: 0;
}
.topnav a { color: #cbd3d7; text-decoration: none; font-size: 14px; }
.topnav a.active, .topnav a:hover, .topnav a:focus-visible { color: #fff; font-weight: 600; }
.topnav-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.context-chip {
  min-width: 0;
  max-width: min(360px, 42vw);
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
}
.context-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.context-chip .context-caption { color: #9fb0b8; font-size: 11px; }
.context-chip.muted { opacity: .72; }
.shell-user { display: flex; align-items: center; gap: 6px; }
.shell-user .btn-quiet, .nav-drawer .btn-quiet {
  min-height: 36px;
  background: #2a333a;
  border-color: #3a454d;
  color: #eef2f3;
}
.nav-toggle {
  display: none;
  width: var(--touch);
  height: var(--touch);
  min-height: var(--touch);
  padding: 0;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: #2a333a;
  border-color: #3a454d;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: #eef2f3;
  border-radius: 2px;
}
.mobile-step {
  display: none;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px 8px;
  color: #cbd3d7;
  font-size: 13px;
}
.mobile-step strong { color: #fff; margin-left: 8px; }
.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, .45);
}
.nav-drawer {
  position: fixed;
  z-index: 70;
  top: 0;
  left: 0;
  width: min(360px, 88vw);
  height: 100dvh;
  overflow: auto;
  padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 24px);
  background: #161c21;
  box-shadow: 16px 0 40px rgba(0,0,0,.28);
}
.nav-drawer-kicker {
  margin: 16px 0 8px;
  color: #9fb0b8;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.nav-drawer-links, .nav-drawer-steps { display: grid; gap: 6px; }
.nav-drawer a {
  display: flex;
  align-items: center;
  min-height: var(--touch);
  padding: 8px 10px;
  border-radius: 8px;
  background: #2a333a;
}
.nav-drawer a.active { background: var(--primary); color: #fff; }
.container { max-width: 1180px; margin: 20px auto 40px; padding: 0 20px; }
h1 { font-size: 24px; line-height: 1.2; margin: 0 0 8px; letter-spacing: 0; }
h2, h3 { letter-spacing: 0; }
.subnav { display: none; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tabs button { background: #e2e8f0; color: #0f172a; }
.tabs button.active { background: #2563eb; color: #fff; }
.artifact-list { font-size: 13px; }
.artifact-list a { display: block; margin: 4px 0; }
textarea.editor { width: 100%; min-height: 220px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 16px; margin-top: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #333;
  min-width: 0;
}
.form-grid .span-2 { grid-column: span 2; }
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 800px) {
  .form-grid, .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .lab-sides { grid-template-columns: 1fr !important; }
}
.lbl { display: inline-flex; align-items: center; gap: 6px; min-height: 22px; }
input, select, button, textarea {
  min-height: var(--touch);
  padding: 10px 12px;
  border: 1px solid #bfc7cd;
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
  max-width: 100%;
  appearance: none;
  -webkit-appearance: none;
}
select {
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23455' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E") no-repeat right 12px center;
  padding-right: 32px;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, .help-tip:focus-visible {
  outline: 3px solid rgba(15, 118, 110, .28);
  outline-offset: 1px;
  border-color: var(--primary);
}
input[type="checkbox"], input[type="radio"] {
  appearance: auto;
  -webkit-appearance: auto;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  background: none;
}
input[type="file"] {
  appearance: auto;
  -webkit-appearance: auto;
}
input[readonly] { background: #f3f5f5; color: #45515a; }
button { background: var(--primary); color: white; border-color: var(--primary); cursor: pointer; font-weight: 600; }
button:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }
button:disabled { background: #c7cdd1; border-color: #c7cdd1; color: #6e7880; cursor: not-allowed; }
.btn-secondary { background: #4d5a63; border-color: #4d5a63; }
.btn-quiet { background: #eef1f2; border-color: #d7dde0; color: #28343b; }
.btn-quiet:hover:not(:disabled) { background: #e2e7e9; border-color: #cdd5d9; }
.btn-stop { background: var(--danger); border-color: var(--danger); }
.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-size: 14px;
}
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #eee; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }
.live-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
@media (max-width: 900px) { .live-grid { grid-template-columns: 1fr; } }
.live-box { background: #141414; border-radius: 6px; overflow: hidden; min-height: 280px; position: relative; }
.live-box img { width: 100%; height: 360px; object-fit: contain; display: block; background: #111; }
#cam-preview:not([src]) { visibility: hidden; }
.live-label { position: absolute; left: 10px; top: 10px; background: rgba(0,0,0,.55); color: #fff; padding: 4px 8px; border-radius: 6px; font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
.stat { background: #e8f2ef; border-radius: 8px; padding: 10px; }
.stat b { display: block; font-size: 18px; color: #0d4f55; }
.stat span { font-size: 12px; color: #67717a; }
.cop-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; color: #526068; font-size: 12px; }
.cop-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cop-dot { width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #35434b; }
.cop-left { background: #00d5e8; }
.cop-right { background: #ffd600; }
.podo-tools-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 16px; margin-top: 16px; }
.instrument-panel { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fafbfb; }
.instrument-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.instrument-head h3 { margin: 0; font-size: 15px; }
.instrument-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.compact-button { flex: none; min-height: 34px; padding: 5px 10px; }
.icon-button { flex: none; width: 34px; height: 34px; min-height: 34px; padding: 0; background: #eef1f2; border-color: #d7dde0; color: #28343b; font-size: 20px; line-height: 1; }
.axis-command { display: flex; align-items: center; min-height: 48px; padding: 9px 11px; border-left: 4px solid var(--primary); background: #e8f2ef; color: #164e49; font-weight: 700; }
.axis-command.is-running { background: #fff8e6; border-left-color: #c58a00; color: #725108; }
.axis-live-values { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 10px; }
.axis-live-values div, .stabilo-stats div { min-width: 0; padding: 8px; border: 1px solid #dce3e5; border-radius: 5px; background: #fff; }
.axis-live-values span, .stabilo-stats span { display: block; color: var(--muted); font-size: 11px; }
.axis-live-values strong, .stabilo-stats strong { display: block; margin-top: 2px; color: #173f43; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.axis-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.axis-steps span { min-width: 0; padding: 5px 3px; border: 1px solid #d7dde0; border-radius: 4px; background: #fff; color: #66717a; text-align: center; font-size: 11px; }
.axis-steps span.is-active { border-color: #d6aa35; background: #fff5d9; color: #684c00; font-weight: 700; }
.axis-steps span.is-done { border-color: #a9d1c2; background: #edf8f3; color: #155d40; }
.axis-result { margin-top: 10px; padding: 9px 11px; border: 1px solid #dce1e5; border-radius: 5px; background: #fff; color: var(--muted); font-size: 12px; }
.axis-result[data-state="ok"] { border-color: #a9d1c2; background: #edf8f3; color: #155d40; }
.axis-result[data-state="warning"] { border-color: #e8c56d; background: #fff8e6; color: #765a05; }
.axis-result[data-state="bad"] { border-color: #efb5ae; background: #fff3f1; color: #8e241c; }
.live-stabilometry canvas { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; border: 1px solid #ced7da; border-radius: 5px; background: #10171b; }
.stabilo-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
.instrument-note { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.status-ok { color: #15803d; font-weight: 700; }
.status-bad { color: #b91c1c; font-weight: 700; }
.fpi-item { border: 1px solid #e2e2e2; border-radius: 8px; margin: 8px 0; padding: 12px 14px; }
.fpi-item.is-filled { border-color: #bfdbfe; background: #f8fbff; }
.fpi-item.is-missing { border-color: #fecaca; background: #fff7f7; }
.fpi-item.is-missing .fpi-title { color: #991b1b; }
.fpi-item summary { cursor: pointer; font-weight: 600; }
.fpi-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; }
.fpi-title-state { display: inline-flex; align-items: center; gap: 8px; color: #64748b; }
.fpi-item.is-missing .fpi-title-state { color: #b91c1c; }
.fpi-caret { font-size: 14px; line-height: 1; }
.fpi-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.fpi-opts label { display: flex; gap: 4px; align-items: center; font-size: 13px; }
.fpi-current {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 38px;
  margin-top: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}
.fpi-current b { color: #0f172a; font-size: 16px; text-align: center; font-variant-numeric: tabular-nums; }
.fpi-current span { color: #334155; font-size: 13px; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .46);
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  width: min(1120px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
  padding: 18px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 20px;
  line-height: 32px;
}
.fpi-modal-options { display: grid; gap: 8px; margin-top: 12px; }
.fpi-choice {
  display: grid;
  grid-template-columns: 20px 44px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
}
.fpi-choice:hover { background: #f8fbff; border-color: #bfdbfe; }
.fpi-choice b { font-variant-numeric: tabular-nums; }
.fpi-sheet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.fpi-choice.compact {
  grid-template-columns: 18px 38px minmax(0, 1fr);
  padding: 8px 10px;
  font-size: 13px;
}
.skip-row { justify-content: flex-end; }
@media (max-width: 820px) {
  .fpi-sheet { grid-template-columns: 1fr; }
}
.result { background: #e7f3ef; border: 1px solid #c4dfd6; border-radius: 5px; padding: 12px 14px; font-weight: 700; color: #155e55; }
.rec-timer { font-variant-numeric: tabular-nums; font-size: 28px; font-weight: 700; font-family: ui-monospace, Consolas, monospace; }
.rec-timer-box { background: #111; color: #f5f5f5; border-radius: 8px; padding: 8px 14px; min-width: 110px; }
.rec-timer-box.is-recording { background: #7f1d1d; }
.stepper {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px 10px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.stepper .step {
  flex: none;
  background: #2a333a;
  color: #cad2d6;
  border-radius: 999px;
  padding: 7px 12px;
  min-height: 36px;
  font-size: 13px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.stepper .step span {
  background: #3a454d;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.stepper .step.active { background: var(--primary); color: #fff; }
.stepper .step.active span { background: rgba(255,255,255,.22); }
.progress-row { display: flex; gap: 16px; margin-top: 10px; font-weight: 600; }
.protocol-box { background: #eef4ff; border-radius: 8px; padding: 12px 14px; margin: 12px 0; font-size: 14px; }
.ready-tbl { width: auto; min-width: 280px; }
.side-box { border: 1px solid #e2e2e2; border-radius: 8px; padding: 10px; margin: 8px 0; }
.exam-block { margin: 8px 0; }
.exam-block summary {
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.exam-block summary > span:first-child { flex: 1; }
.summary-caret {
  margin-left: auto;
  color: #475569;
  font-size: 14px;
  transition: transform .15s ease;
}
.exam-block[open] .summary-caret { transform: rotate(180deg); }
.help-tip, button.help-tip, .help-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #c5d0d4;
  background: #eef3f4;
  color: #1f4f55;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
}
button.help-tip:hover, .help-btn:hover, button.help-tip.is-open, .help-tip.is-open > .help-btn {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.help-popover { display: none; }
.help-popover-live {
  position: fixed;
  z-index: 90;
  padding: 10px 12px;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  max-width: min(340px, calc(100vw - 20px));
}
.fpi-title { font-weight: 600; margin-bottom: 4px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.search-wrap { position: relative; }
.search-wrap input[type="search"] { width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: 15px; }
.search-results {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
  background: #fff; border: 1px solid #d0d5dd; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08); max-height: 280px; overflow: auto;
}
.search-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; text-align: left; background: transparent; color: #111;
  border: none; border-bottom: 1px solid #f0f0f0; border-radius: 0;
  padding: 10px 12px; cursor: pointer;
}
.search-item:hover { background: #f3f6ff; }
.search-item-main { font-size: 14px; }
.search-item-meta { font-size: 12px; color: #666; }
.search-empty { padding: 12px; color: #888; font-size: 13px; }
.patient-current { margin: 14px 0 0; color: #444; }
.connected-card {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
}
.connected-card.is-on { background: #ecfdf5; border-color: #a7f3d0; }
tr.patient-selected { background: #eff6ff; }
.btn-small { background: #eef2ff; color: #1e3a8a; padding: 4px 8px; font-size: 12px; }
.archive-toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.archive-toolbar input { flex: 1; min-width: 220px; }
.archive-toolbar select { min-width: 190px; }
.similar-box {
  margin-top: 12px; padding: 10px 12px; border: 1px solid #fde68a;
  background: #fffbeb; border-radius: 8px;
}
.lab-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.side-box { margin: 0; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; background: #f8fafc; }
.side-box legend { font-weight: 700; padding: 0 6px; }
.track-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.track-pill {
  background: #edf0f1; color: #27343b; border: 1px solid #d7dde0; border-radius: 5px; padding: 8px 12px; font-size: 14px;
}
.track-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.track-steps { margin: 14px 0 0; padding-left: 18px; color: #475569; font-size: 13px; }
.track-steps li { margin: 4px 0; }
.lab-adapter { margin-top: 16px; padding-top: 12px; border-top: 1px solid #eef2f6; }
.lab-adapter h3 { margin: 0 0 10px; font-size: 14px; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.check-grid label, .ack-row, .check-inline, .form-grid label.check-inline {
  display: flex; flex-direction: row; align-items: center; gap: 8px;
  font-size: 13px; color: #333;
}
.check-inline input, .ack-row input, .check-grid input { width: auto; }
.ack-row { margin-top: 12px; }
@media (max-width: 800px) { .check-grid { grid-template-columns: 1fr; } }

.page-intro { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.current-visit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 15px;
  margin-bottom: 16px;
  background: #edf7f4;
  border: 1px solid #c6e2d9;
  border-left: 4px solid var(--primary);
  border-radius: 5px;
}
.workflow-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid #d8e2df;
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  background: #ffffff;
}
.workflow-kicker {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 2px;
}
.workflow-panel strong {
  display: block;
  font-size: 16px;
}
.workflow-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.workflow-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.workflow-chip {
  min-width: 132px;
  background: #fff8e6;
  border-color: #e8d28f;
  color: #5f4905;
}
.workflow-chip b {
  display: block;
  font-size: 12px;
}
.workflow-chip.done {
  background: #edf8f3;
  border-color: #b9dccd;
  color: #155d40;
}
.workflow-chip.current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.current-visit-main { min-width: 0; }
.current-visit-main span { display: block; color: #526068; font-size: 12px; margin-bottom: 2px; }
.current-visit-main strong { display: block; overflow-wrap: anywhere; font-size: 15px; }
.visit-switcher { margin-top: 12px; border-top: 1px solid #e3e7e9; padding-top: 10px; }
.visit-switcher > summary, .details-panel > summary, .saved-trials > summary {
  cursor: pointer;
  color: #34424a;
  font-weight: 600;
}
.visit-switcher[open] > summary, .details-panel[open] > summary { margin-bottom: 12px; }
.progress-row { display: flex; flex-wrap: wrap; gap: 8px; }
.progress-row span, .iteration-badge, .status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid #d6dde0;
  border-radius: 5px;
  background: #f5f7f7;
  color: #37444b;
  font-size: 13px;
  font-weight: 700;
}
.progress-row span.is-missing { color: var(--danger); border-color: #efb5ae; background: #fff3f1; }
.progress-row span.is-complete { color: var(--success); border-color: #b7d9ca; background: #edf8f3; }
.status-badge.ok { color: var(--success); border-color: #b7d9ca; background: #edf8f3; }
.status-badge.pending { color: var(--warning); border-color: #ead69b; background: #fff9e8; }
.modal-actions {
  position: sticky;
  bottom: -18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 16px -18px -18px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
}
.exam-block { border-bottom: 1px solid #e6eaec; padding: 2px 0; }
.exam-block:last-child { border-bottom: 0; }
.exam-block summary { min-height: 44px; padding: 8px 4px; }
.exam-block > .form-grid { padding: 6px 4px 14px; }
.exam-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  font-size: 13px;
  color: #333;
}
.exam-field-title { font-weight: 600; }
.bilateral-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.multi-choice-wrap { position: relative; min-width: 0; }
.multi-choice-side { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.exam-block .multi-choice > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #bfc7cd;
  border-radius: 5px;
  background: #fff;
  color: #28343b;
  font-weight: 400;
  list-style: none;
  cursor: pointer;
}
.exam-block .multi-choice > summary::-webkit-details-marker { display: none; }
.multi-choice > summary > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-choice-caret { flex: none; color: #475569; transition: transform .15s ease; }
.multi-choice[open] .multi-choice-caret { transform: rotate(180deg); }
.multi-choice.is-missing > summary { border-color: #e7a8a2; background: #fff7f7; color: var(--danger); }
.multi-choice.is-filled > summary { border-color: #9fcfc5; background: #f4fbf8; }
.multi-choice-menu {
  position: absolute;
  z-index: 24;
  top: calc(100% + 4px);
  left: 0;
  width: max(100%, min(430px, calc(100vw - 56px)));
  max-height: 300px;
  overflow: auto;
  padding: 6px;
  border: 1px solid #cfd7dc;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
}
.form-grid .multi-choice-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-height: 36px;
  padding: 7px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.form-grid .multi-choice-option:hover { background: #f2f7f6; }
.form-grid .multi-choice-option input { width: 18px; min-height: 18px; margin: 1px 0 0; }
@media (max-width: 800px) {
  .bilateral-choice-grid { grid-template-columns: 1fr; }
  .multi-choice-menu { width: 100%; }
}
.equipment-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 12px;
  margin: 12px 0;
  background: #f1f4f4;
  border-left: 4px solid #89969c;
  border-radius: 4px;
  font-size: 14px;
}
.equipment-summary.ok { background: #edf8f3; border-left-color: var(--success); color: #135c3d; }
.equipment-summary.bad { background: #fff3f1; border-left-color: var(--danger); color: #8e241c; }
.measurement-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.measurement-actions #rec-status { flex: 1 1 260px; }
.details-panel { margin: 10px 0 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: #fafbfb; }
.details-panel .ready-tbl { margin-top: 8px; }
.workflow-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.workflow-step { min-height: 46px; padding: 7px 8px; border: 1px solid #d9dfe2; border-radius: 4px; background: #f5f7f7; color: #66717a; font-size: 12px; }
.workflow-step b { display: block; color: #34414a; font-size: 13px; }
.workflow-step.done { background: #edf8f3; border-color: #b9dccd; color: #246548; }
.workflow-step.current { background: #fff8e6; border-color: #e8d28f; color: #765a05; }
.rx-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.rx-meta-item { padding: 10px 12px; background: #f3f5f5; border: 1px solid #dfe4e6; border-radius: 5px; }
.rx-meta-item span { display: block; color: var(--muted); font-size: 12px; }
.rx-meta-item strong { display: block; margin-top: 2px; }
.patient-evidence {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #cfe3dc;
  border-radius: 6px;
  background: #f3faf7;
}
.patient-evidence h3 {
  margin: 0 0 10px;
  font-size: 14px;
}
.clinical-alerts {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #e6c878;
  border-left: 4px solid var(--warning);
  border-radius: 6px;
  background: #fff8e6;
}
.clinical-alerts h3 { margin: 0 0 10px; font-size: 14px; color: #594405; }
.clinical-alert-list { display: grid; gap: 7px; }
.clinical-alert-item { padding: 8px 9px; border: 1px solid #ead69b; border-radius: 5px; background: #fffdf5; }
.clinical-alert-item strong { display: block; font-size: 12px; color: #594405; }
.clinical-alert-item span { display: block; margin-top: 3px; font-size: 12px; color: #4d4632; overflow-wrap: anywhere; }
.prescription-domain { margin: 14px 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.prescription-domain-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.prescription-domain-head h3 { margin: 0; font-size: 15px; }
.prescription-domain-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.prescription-domain-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.prescription-domain-grid section { min-width: 0; }
.prescription-domain-grid h4 { margin: 0 0 7px; color: #34414a; font-size: 13px; }
.domain-list { display: grid; gap: 6px; }
.domain-item, .domain-empty { min-width: 0; padding: 8px 9px; border: 1px solid #dce3e5; border-radius: 5px; background: #fff; }
.domain-item strong { display: block; overflow-wrap: anywhere; font-size: 12px; }
.domain-item span, .domain-item em { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-style: normal; overflow-wrap: anywhere; }
.domain-item em { color: #725108; }
.domain-item.is-supported { border-left: 3px solid var(--success); }
.domain-item.is-unresolved { border-left: 3px solid var(--warning); background: #fffaf0; }
.domain-empty { color: var(--muted); font-size: 12px; }
.prescription-findings-details { margin-top: 10px; }
.prescription-findings-details summary { cursor: pointer; color: #34414a; font-size: 12px; font-weight: 600; }
.prescription-findings-details[open] summary { margin-bottom: 8px; }
.domain-list.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.evidence-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.evidence-item {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #dcebe6;
  border-radius: 5px;
  background: #fff;
}
.evidence-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.evidence-item strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  font-size: 13px;
}
.source-details { margin: 12px 0; }
.source-details p { margin-bottom: 0; }
.range-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.range-field { padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: #fafbfb; }
.range-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-weight: 700; }
.range-head output { min-width: 34px; color: var(--primary); font-size: 20px; text-align: right; }
.range-field input[type="range"] { width: 100%; min-height: 32px; padding: 0; border: 0; accent-color: var(--primary); }
.range-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.check-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.check-option { display: flex; flex-direction: row !important; align-items: center; gap: 8px !important; min-height: 46px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 5px; background: #fff; cursor: pointer; }
.check-option:has(input:checked) { border-color: #e0a29b; background: #fff4f2; color: #8e241c; }
.check-option input { width: auto !important; min-height: auto; }
.conditional-field { margin-top: 10px; }
label.conditional-field { display: flex; flex-direction: column; gap: 4px; }
.lab-adapter input[readonly],
.lab-adapter select:disabled,
.lab-sides input[readonly],
.lab-sides select:disabled {
  color: var(--ink);
  opacity: 1;
  background: #f7fafc;
  border-color: #d8e2ea;
  cursor: default;
}
.decision { margin-top: 16px; }
.decision[data-state="accept"] { background: #e9f7f0; border-color: #afd7c4; color: #12623f; }
.decision[data-state="modify"], .decision[data-state="reject"] { background: #fff3f1; border-color: #efc1bb; color: #8d2119; }
.decision[data-state="indeterminate"] { background: #fff8e6; border-color: #e8d28f; color: #765a05; }
.next-action { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.table-wrap { width: 100%; overflow-x: auto; }
.technical-value { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: #54616a; }
.empty-state { padding: 22px 12px; text-align: center; color: var(--muted); }
.summary-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.summary-stat { padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.summary-stat b { display: block; font-size: 22px; color: var(--primary); }
.summary-stat span { color: var(--muted); font-size: 12px; }
.danger-zone { border-color: #efc1bb; }
.danger-zone > summary { color: var(--danger); }
.prescription-note { width: 100%; min-height: 72px; resize: vertical; }

@media (max-width: 900px) {
  .prescription-domain-grid { grid-template-columns: 1fr; }
  .podo-tools-grid { grid-template-columns: 1fr; }
  .workflow-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .check-options { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .prescription-domain-head { display: block; }
  .prescription-domain-head .status-badge { margin-top: 8px; }
  .domain-list.compact { grid-template-columns: 1fr; }
  .axis-live-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-toolbar { flex-direction: column; }
  .archive-toolbar input, .archive-toolbar select { width: 100%; min-width: 0; }
  .topnav-inner { padding: 9px 14px; }
  .context-bar { padding: 5px 14px 0; display: block; }
  .context-bar strong { display: block; width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .context-caption { margin-right: 6px; }
  .stepper { width: 100%; max-width: 100%; padding: 8px 14px 10px; }
  .container { margin-top: 16px; padding: 0 14px; }
  .card { padding: 15px; }
  .current-visit { align-items: flex-start; flex-direction: column; }
  .workflow-panel { grid-template-columns: 1fr; }
  .workflow-actions { justify-content: flex-start; }
  .workflow-chip { width: 100%; }
  .range-grid, .rx-meta, .summary-stats, .evidence-grid { grid-template-columns: 1fr; }
  .workflow-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-box img { height: 280px; }
  .modal-backdrop { padding: 8px; }
  .modal-card { max-height: calc(100vh - 16px); padding: 14px; }
  .modal-actions { bottom: -14px; margin: 14px -14px -14px; padding: 10px 14px; }
}

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 8px;
}
.page-head h1 { margin: 0; }
.sticky-actions {
  position: sticky;
  bottom: var(--safe-bottom);
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  padding: 10px 0;
  background: linear-gradient(180deg, transparent, var(--canvas) 28%);
}
.table-wrap {
  -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(to right, #fff 30%, transparent),
    linear-gradient(to right, transparent, #fff 70%) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.12), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.12), transparent) 100% 0;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}
.card, .modal-card { overflow-wrap: anywhere; }
img, canvas, video { max-width: 100%; height: auto; }
button, a, .help-tip { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

@media (max-width: 980px) {
  .nav-toggle { display: inline-flex; }
  .nav-links, .shell-user, .stepper { display: none; }
  .mobile-step { display: block; }
  .context-chip { max-width: min(220px, 48vw); }
}
@media (max-width: 700px) {
  .page-head { align-items: center; }
  h1 { font-size: 22px; }
  .sticky-actions {
    margin: 16px -14px 0;
    padding: 10px 14px calc(10px + var(--safe-bottom));
    background: rgba(244, 246, 247, .96);
    border-top: 1px solid var(--line);
  }
  .measurement-actions button, .next-action button, .next-action .btn-link {
    flex: 1 1 160px;
  }
  .live-box img { height: auto; min-height: 220px; max-height: 52vh; }
  .rec-timer { font-size: 24px; }
  .icon-button, .compact-button { width: var(--touch); min-width: var(--touch); height: var(--touch); min-height: var(--touch); }
}
@media (max-width: 480px) {
  .topnav-tools .context-caption { display: none; }
  .workflow-strip { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .axis-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (hover: none) {
  .search-item:hover, .fpi-choice:hover, .form-grid .multi-choice-option:hover { background: inherit; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (prefers-contrast: more) {
  :root { --line: #8a949a; }
  button, input, select, textarea { border-width: 2px; }
}
@media print {
  .topnav, .skip-link, .help-tip, .nav-toggle, .sticky-actions { display: none !important; }
  body { background: #fff; }
  .card { break-inside: avoid; box-shadow: none; }
}
