/* ============ Google Fonts ============ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

/* ============ Design tokens ============ */
:root {
  --ink-900: #0F1115;
  --ink-700: #2A2F39;
  --ink-500: #5B6472;
  --ink-400: #858D9A;
  --ink-300: #B5BAC2;
  --ink-200: #E2E4E8;
  --ink-100: #EEF0F3;
  --paper:   #F7F6F2;
  --card:    #FFFFFF;

  --navy-950: #0B1220;
  --navy-900: #111827;
  --navy-800: #1B2434;
  --navy-700: #2A3547;
  --navy-500: #64748B;

  --accent:     #1E40AF;
  --accent-600: #1D4ED8;
  --accent-50:  #EEF2FF;

  --ok:    #117A4F;
  --ok-50: #E6F4EC;
  --warn:    #B45309;
  --warn-50: #FDF3E2;
  --bad:    #B42318;
  --bad-50: #FDECEA;

  --grade-zone-bad: rgba(222, 124, 116, .78);
  --grade-zone-mid: rgba(224, 159, 72, .78);
  --grade-zone-good: rgba(226, 193, 71, .78);
  --grade-zone-excellent: rgba(91, 184, 132, .78);
  --grade-zone-over-solid: rgba(131, 153, 178, .68);
  --grade-zone-over: repeating-linear-gradient(135deg, rgba(131,153,178,.68) 0 2px, rgba(210,220,230,.74) 2px 4px);

  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sans: 'Inter', 'Noto Sans SC', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* ============ Reset ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  overflow-y: scroll; /* always show scrollbar — prevents width jump on toggle */
  overflow-anchor: none; /* disable scroll anchoring globally — prevents viewport jump on collapse */
}

body {
  font-family: var(--sans);
  font-size: 14px;
  background: var(--paper);
  color: var(--ink-900);
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ============ SIDEBAR ============ */
#sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--navy-900);
  color: #E7EAF0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
  border-right: 1px solid #000;
  overflow-y: auto;
}

#sidebar-header {
  padding: 18px 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
#sidebar-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #F3F5F9;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
  white-space: nowrap;
}
.sidebar-brand-mark {
  display: block;
  width: 30px;
  height: 32px;
  flex-shrink: 0;
  object-fit: contain;
}

#btn-new-client {
  width: 100%;
  padding: 9px 14px;
  background: linear-gradient(180deg, #2563EB, #1E40AF);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  font-family: var(--sans);
  box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset, 0 1px 2px rgba(0,0,0,0.3);
  transition: filter 0.15s;
}
#btn-new-client:hover { filter: brightness(1.08); }

#client-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 20px;
}
#client-list::-webkit-scrollbar { width: 5px; }
#client-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

/* ---- Client row ---- */
.client-item {
  padding: 9px 16px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.12s;
  position: relative;
}
.client-item:hover { background: rgba(255,255,255,0.03); }
.client-item.active {
  background: rgba(59,130,246,0.08);
  border-left-color: #3B82F6;
}
.client-item .client-name {
  font-size: 13px;
  font-weight: 500;
  color: #F3F5F9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 156px;
}
.client-item .client-meta {
  font-size: 10px;
  color: #64748B;
  margin-top: 2px;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.client-delete {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #475569;
  cursor: pointer;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.12s;
  padding: 2px 4px;
}
.client-item:hover .client-delete { opacity: 1; }
.client-delete:hover { color: #ef4444; }

/* ---- Session sub-list ---- */
.session-sub-list {
  padding: 4px 0 8px 14px;
  border-left: 1px solid rgba(255,255,255,0.06);
  margin-left: 16px;
}
.session-sub-item {
  padding: 4px 10px;
  font-size: 11px;
  color: #94A3B8;
  font-family: var(--mono);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 4px;
  margin: 1px 8px 1px 0;
  cursor: pointer;
  white-space: nowrap;
  gap: 6px;
  border-left: 2px solid transparent;
}
.session-sub-item:hover { background: rgba(255,255,255,0.04); color: #CBD5E1; }
.session-sub-item.active { background: rgba(59,130,246,0.14); color: #BFDBFE; border-left-color: #60A5FA; }
.session-sub-date { font-size: 11px; }
.session-sub-delete {
  background: none;
  border: none;
  color: #475569;
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  padding: 1px 4px;
  transition: opacity 0.12s;
  line-height: 1;
}
.session-sub-item:hover .session-sub-delete { opacity: 1; }
.session-sub-delete:hover { color: #ef4444; }

/* ============ MAIN AREA ============ */
#main {
  flex: 1;
  display: block;
  min-height: 0;
  background: var(--paper);
  min-width: 0;
}

/* ---- Topbar ---- */
#topbar {
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--ink-200);
  padding: 0 24px;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  gap: 0;
}
#topbar::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 0 18px;
  height: 52px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--ink-500);
  font-weight: 500;
  font-family: var(--sans);
  transition: color 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--ink-700); }
.tab-btn.active { color: var(--ink-900); border-bottom-color: var(--ink-900); font-weight: 600; }

#topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#client-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  padding: 4px 10px;
  border: 1px solid var(--ink-200);
  border-radius: 5px;
  background: white;
}
#btn-new-session {
  padding: 6px 14px;
  background: var(--ok);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  font-family: var(--sans);
  display: none;
  transition: filter 0.12s;
}
#btn-new-session:hover { filter: brightness(1.08); }

#save-msg {
  font-size: 12px;
  color: var(--ok);
  font-weight: 500;
  font-family: var(--mono);
  opacity: 0;
  transition: opacity 0.4s;
  white-space: nowrap;
}
#save-msg.saving { color: var(--ink-500); opacity: 1; }

/* ---- Session selector bar ---- */
#session-selector-bar {
  position: sticky;
  top: 52px;
  z-index: 99;
  background: var(--card);
  border-bottom: 1px solid var(--ink-200);
  padding: 7px 24px;
  display: none;
  align-items: center;
  gap: 10px;
}
#session-selector-bar label {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--ink-400);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}
#session-select {
  padding: 5px 24px 5px 10px;
  border: 1px solid var(--ink-200);
  border-radius: 5px;
  font-size: 12px;
  font-family: var(--mono);
  background: white;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%235B6472' stroke-width='1.2' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

/* ---- Tab content ---- */
#tab-content {
  display: block;
  min-height: 0;
}
#tab-content::-webkit-scrollbar { width: 6px; }
#tab-content::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: 3px; }
#tab-content::-webkit-scrollbar-track { background: transparent; }

.tab-panel { display: none; }
.tab-panel.active {
  display: block;
  width: 100%;
  max-width: 1100px;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 16px 24px 80px;
}

#no-client-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  flex-direction: column;
  gap: 10px;
  color: var(--ink-400);
}
#no-client-msg p {
  font-size: 14px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

/* ============ SECTION CARDS ============ */
.section-card {
  width: 100%;
  box-sizing: border-box;
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
}
.section-title {
  width: 100%;
  box-sizing: border-box;
  background: #1a1a1a;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 6px 6px 0 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.section-body {
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  border: 1px solid #E8E8E8;
  border-top: none;
  border-radius: 0 0 6px 6px;
  padding: 16px 20px;
  overflow: hidden;
  max-height: 5000px;
}
.section-body.collapsed {
  max-height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  border-width: 0 !important;
}
.sub-title {
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #F0F0F0;
}

/* ============ FORM PRIMITIVES ============ */
.form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  align-items: flex-start;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 120px;
}
.form-group.wide { min-width: 220px; flex: 1; }
.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-500);
  letter-spacing: 0.04em;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group textarea {
  padding: 7px 10px;
  border: 1px solid var(--ink-200);
  border-radius: 5px;
  font-size: 13px;
  color: var(--ink-900);
  background: white;
  transition: border-color 0.12s, box-shadow 0.12s;
  outline: none;
  font-family: var(--sans);
}
.form-group input[type="number"] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--ink-700);
  box-shadow: 0 0 0 2px rgba(15,17,21,0.06);
}
.form-group textarea { resize: vertical; min-height: 60px; }

/* ---- ISA specific ---- */
.isa-interp {
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 5px;
  margin-top: 4px;
  font-weight: 500;
  border-left: 3px solid;
  line-height: 1.6;
}
.isa-interp.narrow   { background: var(--accent-50); color: #1d4ed8; border-color: var(--accent); }
.isa-interp.wide     { background: var(--warn-50); color: var(--warn); border-color: var(--warn); }
.isa-interp.neutral  { background: var(--ok-50); color: var(--ok); border-color: var(--ok); }
.isa-interp.good     { background: var(--ok-50); color: var(--ok); border-color: var(--ok); }
.isa-interp.restricted { background: var(--warn-50); color: var(--warn); border-color: var(--warn); }
.isa-interp.rigid    { background: var(--bad-50); color: var(--bad); border-color: var(--bad); }
.isa-input-row { display: flex; gap: 24px; align-items: flex-start; }
.isa-input-col { flex: 1 1 0; min-width: 0; }
.isa-input-col label { font-size: 11px; color: var(--ink-500); display: block; margin-bottom: 3px; font-weight: 600; white-space: nowrap; }
@media (max-width: 768px) { .isa-input-row { flex-direction: column; gap: 12px; } .isa-input-col { flex: none; width: 100%; } }

/* ---- Bounded angle / numeric input ---- */
.bounded-input { min-width: 210px; width: 100%; }
.bounded-controls { display: flex; align-items: center; gap: 7px; }
.bounded-track { position: relative; flex: 1; min-width: 96px; height: 22px; display: flex; align-items: center; }
.bounded-reference-zone {
  position: absolute; z-index: 0; height: 6px; border-radius: 4px;
  background: rgba(5, 150, 105, 0.24); pointer-events: none;
}
.bounded-range {
  position: relative; z-index: 1; width: 100%; margin: 0; padding: 0;
  background: transparent; accent-color: var(--ink-900); cursor: pointer;
}
.bounded-number { width: 58px !important; min-width: 58px; box-sizing: border-box; padding: 6px 5px !important; text-align: center; }
.bounded-clear {
  padding: 4px 5px; border: 0; background: transparent; color: var(--ink-400);
  font: 11px var(--sans); cursor: pointer; white-space: nowrap;
}
.bounded-clear:hover:not(:disabled) { color: var(--bad); text-decoration: underline; }
.bounded-clear:disabled { opacity: 0.35; cursor: default; }
.bounded-measure {
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--ink-200);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-700);
  font: 600 11px var(--sans);
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}
.bounded-measure:hover { border-color: var(--ink-400); background: var(--ink-50); }
.bounded-measure:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bounded-scale {
  position: absolute;
  z-index: 4;
  top: 2px;
  left: 0;
  width: 100%;
  height: 12px;
  margin: 0;
  color: var(--ink-400);
  font-size: 9px;
  line-height: 1;
  pointer-events: none;
}
.bounded-mark { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.bounded-mark-min { transform: none; }
.bounded-mark-max { transform: translateX(-100%); }
.bounded-input.is-unmeasured .bounded-range { opacity: 0.28; filter: grayscale(1); }
.bounded-input.is-unmeasured .bounded-range::-webkit-slider-thumb { opacity: 0; }
.bounded-input.is-unmeasured .bounded-range::-moz-range-thumb { opacity: 0; }
.bounded-input.is-unmeasured .bounded-reference-zone { opacity: 0.45; }
.rom-table td:has(.bounded-input) { min-width: 230px; }
.supine-shoulder-row td:has(.bounded-input) { min-width: 205px; }
.supine-shoulder-row .bounded-scale { font-size: 10px; }

/* ---- Centered bilateral rotation input ---- */
.centered-list { border-top: 1px solid var(--ink-100); }
.centered-bilateral {
  display: grid;
  grid-template-columns: minmax(135px, 1fr) minmax(300px, 2.8fr) 88px 88px minmax(78px, .8fr) 64px;
  gap: 12px;
  align-items: center;
  padding: 11px 10px;
  border-bottom: 1px solid var(--ink-100);
  font-size: 13px;
}
.centered-title { font-weight: 500; color: var(--ink-700); }
.centered-axis-wrap { min-width: 0; }
.centered-axis-labels {
  display: grid;
  grid-template-columns: 1fr auto auto auto 1fr;
  align-items: center;
  gap: 8px;
  color: var(--ink-400);
  font-size: 9px;
  margin-bottom: 1px;
}
.centered-axis-labels span:last-child { text-align: right; }
.centered-axis-labels strong { color: var(--ink-700); font-weight: 600; }
.centered-axis { position: relative; height: 24px; }
.centered-axis::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 11px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink-200);
}
.centered-zero {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 5px;
  width: 2px;
  height: 14px;
  background: var(--ink-700);
  transform: translateX(-50%);
  pointer-events: none;
}
.centered-half { position: absolute; top: 0; width: 50%; height: 24px; }
.centered-half-left { left: 0; }
.centered-half-right { right: 0; }
.centered-reference-zone {
  position: absolute;
  z-index: 0;
  top: 9px;
  height: 6px;
  border-radius: 4px;
  background: rgba(5, 150, 105, 0.24);
  pointer-events: none;
}
.centered-range {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 24px;
  margin: 0;
  padding: 0;
  background: transparent;
  accent-color: var(--ink-900);
  cursor: pointer;
}
.centered-half-left .centered-range { direction: rtl; }
.centered-half-left::after,
.centered-half-right::after {
  position: absolute;
  top: 3px;
  color: var(--ink-300);
  font-size: 10px;
  pointer-events: none;
}
.centered-half-left::after { content: '←'; left: 0; }
.centered-half-right::after { content: '→'; right: 0; }
.centered-half.is-unmeasured .centered-range { opacity: .28; filter: grayscale(1); }
.centered-half.is-unmeasured .centered-range::-webkit-slider-thumb { opacity: 0; }
.centered-half.is-unmeasured .centered-range::-moz-range-thumb { opacity: 0; }
.centered-side { min-width: 0; }
.centered-side-label { display: none; font-size: 11px; color: var(--ink-500); }
.centered-side-input { display: flex; align-items: center; gap: 3px; }
.centered-side .bounded-number { width: 52px !important; min-width: 52px; }
.centered-side .bounded-clear { padding-inline: 2px; }
.centered-reference-label { color: var(--ink-400); font-size: 11px; }
.centered-delta { min-height: 16px; }

.rotation-protocol-host { margin-top: 8px; }
.rotation-protocol-panel {
  border: 1px solid var(--ink-100);
  border-radius: 8px;
  background: var(--ink-100);
}
.rotation-protocol-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 0 12px;
  color: var(--ink-600);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.rotation-protocol-panel > summary::-webkit-details-marker { display: none; }
.rotation-protocol-panel > summary span:last-child { color: var(--accent); }
.rotation-protocol-body { padding: 0 12px 12px; color: var(--ink-600); font-size: 12px; line-height: 1.55; }
.rotation-protocol-body > p { margin: 0 0 7px; font-weight: 600; }
.rotation-protocol-body > ul { margin: 0; padding-left: 18px; }
.rotation-protocol-pain { margin-top: 10px; border-top: 1px solid var(--ink-100); padding-top: 8px; }
.rotation-protocol-pain > summary { color: var(--ink-700); font-weight: 600; cursor: pointer; }
.rotation-protocol-pain > p { margin: 7px 0; color: var(--ink-500); }
.rotation-protocol-pain-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(120px, .7fr) minmax(160px, .9fr);
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--ink-100);
}
.rotation-protocol-pain-row label { display: grid; gap: 2px; color: var(--ink-500); font-size: 10px; }
.rotation-protocol-pain-row select { min-height: 32px; }

@media (max-width: 768px) {
  .rom-table { display: block; overflow-x: auto; }
  .bounded-input { min-width: 190px; }
  .bounded-scale { margin: 0; }
  .centered-bilateral {
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    padding: 12px 0;
  }
  .centered-title { grid-column: 1; grid-row: 1; }
  .centered-reference-label { grid-column: 2; grid-row: 1; text-align: right; }
  .centered-axis-wrap { grid-column: 1 / -1; grid-row: 2; }
  .centered-side-left { grid-column: 1; grid-row: 3; }
  .centered-side-right { grid-column: 2; grid-row: 3; }
  .centered-side-label { display: block; margin-bottom: 3px; }
  .centered-side-input { display: grid; grid-template-columns: 52px minmax(44px, 1fr) auto; justify-content: stretch; }
  .centered-side-input .bounded-measure { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding-inline: 6px; }
  .centered-delta { grid-column: 1 / -1; grid-row: 4; text-align: center; }
  .rotation-protocol-panel > summary { min-height: 44px; }
  .rotation-protocol-pain-row { grid-template-columns: 1fr; gap: 5px; }
}

/* Higher-specificity inclinometer overrides for the generic modal component. */
.modal-footer.inclinometer-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 768px) {
  .modal-overlay.inclinometer-overlay { align-items: flex-end; }
}

/* ---- Button groups (option pills) ---- */
.btn-group { display: flex; flex-wrap: wrap; gap: 5px; }
.btn-option {
  padding: 5px 13px;
  border: 1px solid var(--ink-200);
  border-radius: 100px;
  background: white;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-500);
  font-family: var(--sans);
  font-weight: 500;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.btn-option:hover { border-color: var(--ink-300); color: var(--ink-700); }
.btn-option.selected { background: var(--ink-900); border-color: var(--ink-900); color: white; }
.btn-option.selected-green { background: var(--ok); border-color: var(--ok); color: white; }

/* ---- ROM table ---- */
.rom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rom-table th {
  text-align: left;
  padding: 8px 10px;
  background: #FAFAF8;
  color: var(--ink-400);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--ink-200);
}
.rom-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--ink-100);
  vertical-align: middle;
}
.rom-table tr:last-child td { border-bottom: none; }
.rom-table td:first-child { font-weight: 500; color: var(--ink-700); }
.assessment-interpretation { display: none !important; }
.rom-test-variant[hidden],
.rom-group-expander-row[hidden] { display: none !important; }
.rom-group-heading td {
  padding-top: 12px;
  padding-bottom: 5px;
  border-bottom: 0;
  color: var(--ink-400) !important;
  font-size: 10px;
  font-weight: 700 !important;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.rom-test-group + .rom-test-group .rom-group-heading td { border-top: 1px solid var(--ink-200); }
.rom-group-expander-row td { padding: 0 10px 8px; border-bottom: 0; }
.rom-group-expander {
  min-height: 32px;
  padding: 5px 8px;
  border: 0;
  color: var(--ink-500);
  background: transparent;
  font: 11px var(--sans);
  cursor: pointer;
}
.rom-group-expander::before { content: '▸'; margin-right: 5px; }
.rom-group-expander[aria-expanded="true"]::before { content: '▾'; }
.rom-group-expander:hover { color: var(--ink-800); }
.rom-num-input {
  width: 70px;
  padding: 5px 8px;
  border: 1px solid var(--ink-200);
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  outline: none;
  background: white;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.rom-num-input:focus { border-color: var(--ink-700); box-shadow: 0 0 0 2px rgba(15,17,21,0.06); }
.rom-num-input.flag-red { border-color: var(--bad); background: var(--bad-50); color: var(--bad); }
.rom-ref { color: var(--ink-400); font-size: 11px; font-family: var(--mono); }
.rom-delta {
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 600;
  margin-left: 4px;
}
.rom-delta.big { color: var(--bad); }
.rom-delta.med { color: var(--warn); }
.rom-delta.ok  { color: var(--ok); }

/* ---- Foot bilateral groups ---- */
.bilateral-group { margin-bottom: 12px; }
.bilateral-group .bilateral-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 7px;
}
.bilateral-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.bilateral-side { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.bilateral-side-label {
  font-size: 11px;
  color: var(--ink-400);
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.06em;
}

/* ---- Gait checkbox ---- */
.check-group { display: flex; gap: 8px; flex-wrap: wrap; }
.check-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  cursor: pointer;
  padding: 5px 11px;
  border: 1px solid var(--ink-200);
  border-radius: 5px;
  background: white;
  transition: border-color 0.12s;
  font-family: var(--sans);
}
.check-label:hover { border-color: var(--ink-300); }
.check-label input[type="checkbox"] { accent-color: var(--ink-900); }
.check-label.checked { border-color: var(--ink-700); background: var(--ink-100); }

/* ============ TAB 1: FUNCTIONAL ============ */
.quadrant-banner {
  padding: 11px 16px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid;
}
.quadrant-banner.q-pending { background: var(--ink-100); color: var(--ink-500); border-color: var(--ink-200); }
.quadrant-banner.q-result  { background: var(--accent-50); color: var(--accent); border-color: #BFDBFE; }

.functional-card {
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
}
.func-tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 100px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--mono);
}
.func-tag.central { background: #E0E7FF; color: #4338CA; }
.func-tag.upper   { background: #FCE7F3; color: #9D174D; }
.func-tag.lower   { background: var(--ok-50); color: var(--ok); }
.func-tag.isa     { background: var(--warn-50); color: var(--warn); }

.pmp-signal {
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 5px;
  margin-top: 6px;
  border-left: 3px solid;
  line-height: 1.6;
}
.pmp-signal.warn { background: var(--warn-50); color: var(--warn); border-color: var(--warn); }
.pmp-signal.info { background: var(--accent-50); color: var(--accent); border-color: var(--accent); }

.thor-comparison {
  margin-top: 8px;
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  background: #fafafa;
}
.thor-comparison summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 11px;
  color: var(--ink-700);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.thor-comp-summary { color: var(--ink-500); font-size: 11px; }
#thor-comp-panel { padding: 3px 11px 8px; border-top: 1px solid var(--ink-200); }

/* ============ TAB 2: REPORT ============ */
.rl-item { display: flex; align-items: flex-start; gap: 6px; margin-top: 4px; }
.rl-item-text { flex: 1; color: var(--bad); font-size: 14px; font-weight: 600; white-space: pre-wrap; }
.rl-reason-btn {
  flex-shrink: 0; width: 18px; height: 18px;
  background: var(--bad-50); border: 1px solid #FCA5A5; border-radius: 50%;
  color: #991B1B; font-size: 10px; font-weight: 700; cursor: default;
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 2px; line-height: 1;
}
.rl-reason-btn:hover { background: #FECACA; }

#reason-tooltip {
  display: none; position: fixed; z-index: 9999;
  background: var(--ink-900); color: #F9FAFB; font-size: 12px;
  padding: 10px 14px; border-radius: 8px; max-width: 300px;
  white-space: pre-wrap; line-height: 1.6; box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  pointer-events: none; font-family: var(--sans);
}

.exec-block {
  border-radius: 8px; padding: 15px 18px; margin-bottom: 12px;
  border: 1px solid var(--ink-200); background: var(--card);
}
.exec-block h3 {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ink-400); margin-bottom: 10px;
  font-family: var(--mono);
}

.exec-notice {
  font-size: 12px; color: var(--ink-400); margin-bottom: 14px;
  padding: 7px 12px; background: var(--ink-100); border-radius: 5px;
  border: 1px solid var(--ink-200);
}

.report-placeholder { text-align: center; padding: 16px 20px; color: var(--ink-400); font-size: 14px; }

.report-card {
  border-radius: 8px; padding: 15px 18px; margin-bottom: 12px;
  border: 1px solid var(--ink-200); background: var(--card);
}
.report-card.conflict { border-color: var(--bad); border-left: 3px solid var(--bad); }
.report-card.warning  { border-color: var(--warn); border-left: 3px solid var(--warn); }
.report-card.caution  { border-color: #EAB308; border-left: 3px solid #EAB308; }
.report-card.ok       { border-color: var(--ok); border-left: 3px solid var(--ok); }
.report-card.info     { border-color: var(--accent); border-left: 3px solid var(--accent); }
.report-card h3 {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-400); margin-bottom: 8px; font-family: var(--mono);
}
.report-card .report-main { font-size: 14px; font-weight: 600; color: var(--ink-900); }
.report-card .report-sub  { font-size: 13px; color: var(--ink-700); margin-top: 5px; line-height: 1.5; }

.confidence-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 100px; margin-left: 8px;
  text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--mono);
}
.confidence-badge.high   { background: var(--ok-50); color: var(--ok); }
.confidence-badge.medium { background: var(--warn-50); color: var(--warn); }
.confidence-badge.low    { background: var(--bad-50); color: var(--bad); }

.risk-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 5px;
}
.risk-badge.high-risk   { background: var(--bad-50); color: var(--bad); }
.risk-badge.normal-risk { background: var(--ok-50); color: var(--ok); }

/* ============ TAB 3: TREND ============ */
canvas { display: block; max-width: 100%; }
.trend-placeholder { text-align: center; padding: 16px 20px; color: var(--ink-400); font-size: 14px; }

.trend-tab-bar { display: flex; gap: 5px; margin-bottom: 14px; flex-wrap: wrap; }
.trend-tab-btn {
  padding: 5px 14px; border: 1px solid var(--ink-200); border-radius: 100px;
  background: white; font-size: 12px; font-weight: 600; cursor: pointer;
  color: var(--ink-500); font-family: var(--sans); transition: all 0.12s;
}
.trend-tab-btn:hover { border-color: var(--ink-300); color: var(--ink-700); }
.trend-tab-btn.active { background: var(--ink-900); border-color: var(--ink-900); color: white; }

.sm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.sm-card { background: var(--card); border-radius: 8px; border: 1px solid var(--ink-200); overflow: hidden; }
.sm-card.sm-wide { grid-column: 1 / -1; }
.sm-card-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 8px; }
.sm-card-title { font-size: 13px; font-weight: 600; color: var(--ink-900); }
.sm-card-ref   { font-size: 11px; color: var(--ink-400); font-family: var(--mono); }
.sm-canvas { display: block; }
.sm-data-bar { padding: 8px 14px 10px; border-top: 1px solid var(--ink-100); display: flex; flex-direction: column; gap: 5px; }
.sm-data-row { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.sm-side-lbl { color: var(--ink-400); font-weight: 600; font-size: 11px; width: 14px; font-family: var(--mono); }
.sm-val      { font-weight: 700; font-size: 13px; min-width: 44px; font-family: var(--mono); }
.sm-delta    { font-size: 11px; font-weight: 600; color: var(--ink-400); font-family: var(--mono); }

.sm-toggle {
  width: 100%; background: var(--ink-100); border: 1px solid var(--ink-200);
  border-radius: 8px; padding: 10px 14px; text-align: left; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink-700); font-family: var(--sans);
  display: flex; align-items: center; justify-content: space-between; transition: background 0.12s;
}
.sm-toggle:hover { background: var(--ink-200); }
.sm-toggle .sm-arrow { font-size: 11px; color: var(--ink-400); transition: transform 0.2s; }
.sm-toggle.open .sm-arrow { transform: rotate(180deg); }
.sm-summary {
  display: none; background: var(--card); border: 1px solid var(--ink-200);
  border-top: none; border-radius: 0 0 8px 8px; overflow-x: auto; margin-bottom: 14px;
}
.sm-summary.open { display: block; }
.sm-tbl { border-collapse: collapse; font-size: 12px; min-width: 100%; }
.sm-tbl th {
  text-align: center; padding: 7px 10px; background: #FAFAF8;
  color: var(--ink-400); font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  border-bottom: 1px solid var(--ink-200); white-space: nowrap; text-transform: uppercase;
}
.sm-tbl th:first-child, .sm-tbl th:nth-child(2) { text-align: left; }
.sm-tbl td { padding: 5px 10px; border-bottom: 1px solid var(--ink-100); text-align: center; white-space: nowrap; color: var(--ink-700); }
.sm-tbl td:first-child { font-weight: 600; color: var(--ink-900); }
.sm-tbl td:nth-child(2) { text-align: left; }
.sm-tbl tr:last-child td { border-bottom: none; }
.sm-tbl .sm-vbelow { color: var(--bad); font-weight: 700; }
.sm-tbl .sm-vabove { color: var(--warn); font-weight: 700; }
.sm-tbl .sm-vok    { color: var(--ok); font-weight: 700; }
.sm-tbl .sm-vref   { color: var(--ink-400); font-size: 11px; font-family: var(--mono); }

/* ============ UTILITIES ============ */
.text-red    { color: var(--bad); }
.text-orange { color: var(--warn); }
.text-green  { color: var(--ok); }
.mt-8 { margin-top: 8px; }
.gap-indicator { display: inline-block; margin-left: 4px; font-size: 11px; color: var(--bad); font-weight: 600; }
.suspect-value { text-decoration: line-through; color: var(--ink-400); font-style: italic; }
.suspect-tag {
  display: inline-block; font-size: 11px; padding: 1px 6px;
  background: var(--warn-50); color: var(--warn); border-radius: 3px;
  margin-left: 4px; font-weight: 600;
}

/* ============ COLLAPSIBLE ============ */
.collapsible-header {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none; padding: 8px 0;
}
.collapsible-header:hover { opacity: 0.75; }
.collapsible-arrow { font-size: 10px; color: var(--ink-400); }
.collapsible-hint  { font-size: 12px; color: var(--ink-300); }
.collapsible-body  { width: 100%; box-sizing: border-box; overflow: hidden; max-height: 2000px; padding: 8px 0 4px 16px; }
.collapsible-body.collapsed { max-height: 0 !important; overflow: hidden !important; padding: 0 !important; }

/* ============ SPORTS BUTTONS ============ */
.sports-group { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.sport-btn {
  padding: 4px 12px; border-radius: 100px;
  border: 1px solid var(--ink-200); background: white;
  color: var(--ink-500); font-size: 12px; cursor: pointer;
  font-family: var(--sans); font-weight: 500; transition: all 0.12s;
}
.sport-btn:hover { border-color: var(--ink-300); color: var(--ink-700); }
.sport-btn.selected { background: var(--accent-50); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.movement-btn {
  padding: 3px 10px; border-radius: 100px;
  border: 1px solid var(--ink-200); background: white;
  color: var(--ink-500); font-size: 12px; cursor: pointer;
  font-family: var(--sans); font-weight: 500; transition: all 0.12s;
}
.movement-btn:hover { border-color: var(--ink-300); color: var(--ink-700); }
.movement-btn.selected { background: var(--accent-50); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ============ TENNIS MODULE ============ */
.tennis-module { width: 100%; box-sizing: border-box; border: 1px solid #BFDBFE; border-radius: 8px; padding: 16px; margin-bottom: 16px; background: var(--accent-50); }
.tennis-title    { font-size: 15px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.tennis-subtitle { font-size: 12px; color: var(--ink-500); margin-bottom: 12px; }
.tennis-aic-tag  { font-size: 12px; background: #FEF9C3; border: 1px solid #FDE047; border-radius: 5px; padding: 6px 10px; margin-bottom: 10px; color: #713F12; }
.aic-signals { display: block; margin-top: 2px; color: #92400E; }
.tennis-section { margin-bottom: 12px; }
.tennis-section-title { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 6px; }
.tennis-risk { padding: 8px 10px; border-radius: 5px; margin-bottom: 6px; }
.tennis-risk.red    { background: var(--bad-50); border-left: 3px solid var(--bad); }
.tennis-risk.orange { background: var(--warn-50); border-left: 3px solid var(--warn); }
.risk-label  { font-size: 13px; font-weight: 600; display: block; margin-bottom: 2px; }
.risk-desc   { font-size: 12px; color: var(--ink-500); }
.tennis-foot-finding { padding: 8px 10px; border-radius: 5px; background: var(--ok-50); border-left: 3px solid var(--ok); margin-bottom: 8px; }
.foot-pattern  { font-size: 13px; font-weight: 600; color: var(--ok); }
.foot-desc     { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.foot-strategy { font-size: 12px; color: var(--ok); margin-top: 4px; }
.tennis-collapsible { width: 100%; box-sizing: border-box; margin-bottom: 8px; }
.tennis-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; background: #DBEAFE; border-radius: 5px;
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); user-select: none;
}
.tennis-col-header:hover { opacity: 0.85; }
.strength-col-header {
  width: 100%; box-sizing: border-box;
  padding: 8px 10px; background: #DBEAFE; border-radius: 5px;
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); user-select: none;
}
.strength-col-header:hover { opacity: 0.85; }
.finding-count { font-size: 11px; font-weight: 400; color: var(--ink-500); }
.tennis-col-body { padding: 8px 0 2px; }
.tennis-finding { padding: 8px 10px; border-radius: 5px; margin-bottom: 6px; }
.tennis-finding.red    { background: var(--bad-50); border-left: 3px solid var(--bad); }
.tennis-finding.orange { background: var(--warn-50); border-left: 3px solid var(--warn); }
.finding-rule { font-size: 13px; font-weight: 600; color: var(--ink-900); margin-bottom: 2px; }
.finding-desc { font-size: 12px; color: var(--ink-500); }
.tennis-adductor { padding: 8px 10px; background: #F5F3FF; border-left: 3px solid #7C3AED; border-radius: 5px; margin-bottom: 10px; }
.adductor-title { font-size: 13px; font-weight: 600; color: #6D28D9; margin-bottom: 4px; }
.adductor-item  { font-size: 12px; color: var(--ink-500); margin-bottom: 2px; }
.adductor-note  { font-size: 11px; color: var(--ink-400); margin-top: 4px; }
.tennis-strategy { padding: 8px 10px; background: var(--ok-50); border-left: 3px solid var(--ok); border-radius: 5px; margin-bottom: 6px; }
.strategy-label { font-size: 13px; font-weight: 600; color: var(--ok); margin-bottom: 2px; }
.strategy-desc  { font-size: 12px; color: var(--ink-500); }

/* ============ INJURY CHECKBOXES ============ */
.injury-site-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; cursor: pointer; padding: 3px 8px;
  border: 1px solid var(--ink-200); border-radius: 100px;
  background: white; user-select: none; transition: border-color 0.12s;
}
.injury-site-label:hover { border-color: var(--ink-300); }
.injury-site-label input[type=checkbox] { cursor: pointer; accent-color: var(--ink-900); }

/* ============ PDF EXPORT ============ */
#btn-export-pdf {
  padding: 5px 12px; border-radius: 5px;
  border: 1px solid var(--ink-200); background: white;
  color: var(--ink-700); font-size: 12px; cursor: pointer; font-weight: 500;
  font-family: var(--sans); transition: background 0.12s;
}
#btn-export-pdf:hover { background: var(--ink-100); }

#pdf-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
}
#pdf-panel {
  background: white; border-radius: 10px; padding: 24px;
  min-width: 340px; max-width: 420px; width: 90%;
  max-height: min(88vh, 760px); overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.pdf-panel-title { font-size: 16px; font-weight: 700; color: var(--ink-900); margin-bottom: 12px; }
.pdf-client-info {
  font-size: 12px; color: var(--ink-500); margin-bottom: 16px;
  padding: 8px 10px; background: var(--ink-100); border-radius: 5px;
  font-family: var(--mono);
}
.pdf-checks { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.pdf-check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.pdf-check-row input[type=checkbox] { cursor: pointer; width: 15px; height: 15px; accent-color: var(--ink-900); }
.pdf-test-selection { padding: 10px 0 8px; border-top: 1px solid var(--ink-100); border-bottom: 1px solid var(--ink-100); }
.pdf-test-selection-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pdf-test-actions { display: flex; gap: 5px; }
.pdf-test-actions button { padding: 4px 7px; border: 1px solid var(--ink-200); border-radius: 5px; background: white; color: var(--ink-500); font: 11px var(--sans); cursor: pointer; }
.pdf-test-actions button:hover { background: var(--ink-100); color: var(--ink-900); }
.pdf-test-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; padding: 10px 0 0 23px; }
.pdf-test-row { min-width: 0; color: var(--ink-700); font-size: 12px; }
.pdf-test-empty { grid-column: 1 / -1; margin: 0; color: var(--ink-400); font-size: 12px; }
.pdf-preview { margin: 0 0 16px; padding: 14px; max-height: 300px; overflow: auto; border: 1px solid var(--ink-200); border-radius: 7px; background: #fafafa; }
.pdf-preview-section + .pdf-preview-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--ink-200); }
.pdf-preview-section h3, .pdf-preview .pdf-section-title { margin: 0 0 10px; color: var(--ink-900); font-size: 14px; }
.pdf-preview-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pdf-preview-meta p, .pdf-preview-test p { margin: 0; color: var(--ink-800); font-size: 11px; }
.pdf-preview-meta span, .pdf-preview-test p span { display: block; color: var(--ink-400); font-size: 9px; }
.pdf-preview-test { margin-top: 9px; padding: 10px; border: 1px solid var(--ink-200); border-radius: 6px; background: white; }
.pdf-preview-test h4 { margin: 0 0 7px; font-size: 12px; }
.pdf-preview-table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 10px; }
.pdf-preview-table th, .pdf-preview-table td { padding: 5px 6px; border-bottom: 1px solid var(--ink-200); text-align: left; }
.pdf-preview-table th { color: var(--ink-500); background: var(--ink-100); }
.pdf-ready { margin-bottom: 16px; padding: 14px; border: 1px solid #A7F3D0; border-radius: 7px; background: #ECFDF5; }
.pdf-ready strong { display: block; margin-bottom: 9px; color: #065F46; }
.pdf-ready-link { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 0 16px; border-radius: 6px; color: white; background: var(--accent); font-size: 13px; font-weight: 600; text-decoration: none; }
.pdf-ready p { margin: 9px 0 0; color: #475569; font-size: 12px; line-height: 1.55; white-space: pre-line; }
.pdf-error { margin-bottom: 14px; padding: 9px 10px; border-radius: 6px; color: var(--bad); background: var(--bad-50); font-size: 12px; }
.pdf-panel-btns { display: flex; gap: 10px; justify-content: flex-end; }
.pdf-btn-cancel {
  padding: 8px 16px; border-radius: 6px; border: 1px solid var(--ink-200);
  background: white; color: var(--ink-700); font-size: 13px; cursor: pointer; font-family: var(--sans);
}
.pdf-btn-cancel:hover { background: var(--ink-100); }
.pdf-btn-confirm {
  padding: 8px 20px; border-radius: 6px; border: none;
  background: var(--accent); color: white; font-size: 13px;
  font-weight: 600; cursor: pointer; font-family: var(--sans);
}
.pdf-btn-confirm:hover { background: var(--accent-600); }
.pdf-btn-confirm:disabled { opacity: .55; cursor: wait; }

/* ============ DATA QUALITY ============ */
.dq-tension-badge {
  display: inline-block; font-size: 11px; color: var(--warn);
  background: var(--warn-50); border: 1px solid #FDBA74;
  border-radius: 3px; padding: 0 5px; margin-left: 6px;
  vertical-align: middle; font-weight: 600;
}
.dq-struct-note {
  display: inline-block; font-size: 11px; color: var(--ink-500);
  background: var(--ink-100); border: 1px solid var(--ink-200);
  border-radius: 3px; padding: 0 5px; margin-left: 6px; vertical-align: middle;
}
.dq-stale-badge {
  display: inline-block; font-size: 11px; color: var(--accent);
  background: var(--accent-50); border: 1px solid #BFDBFE;
  border-radius: 3px; padding: 0 5px; margin-left: 6px; vertical-align: middle;
}

.dq-completeness {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  background: var(--ink-100); border: 1px solid var(--ink-200); border-radius: 6px;
  margin-bottom: 12px; cursor: pointer; user-select: none;
}
.dq-completeness:hover { background: var(--ink-200); }
.dq-comp-label { font-size: 11px; color: var(--ink-500); font-weight: 600; white-space: nowrap; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }
.dq-comp-bar { flex: 1; height: 5px; background: var(--ink-200); border-radius: 3px; overflow: hidden; min-width: 60px; }
.dq-comp-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.dq-comp-fill.green  { background: var(--ok); }
.dq-comp-fill.yellow { background: #D97706; }
.dq-comp-fill.orange { background: var(--warn); }
.dq-comp-fill.red    { background: var(--bad); }
.dq-comp-pct { font-size: 12px; font-weight: 700; white-space: nowrap; font-family: var(--mono); }
.dq-comp-pct.green  { color: var(--ok); }
.dq-comp-pct.yellow { color: #D97706; }
.dq-comp-pct.orange { color: var(--warn); }
.dq-comp-pct.red    { color: var(--bad); }
.dq-comp-text { font-size: 12px; color: var(--ink-500); }

.dq-comp-popup { display: none; background: var(--card); border: 1px solid var(--ink-200); border-radius: 6px; padding: 12px 14px; margin-bottom: 12px; font-size: 12px; }
.dq-comp-popup.open { display: block; }
.dq-comp-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.dq-comp-row .dq-field-name    { flex: 1; color: var(--ink-700); }
.dq-comp-row .dq-field-filled  { color: var(--ok); font-weight: 700; }
.dq-comp-row .dq-field-empty   { color: var(--ink-400); }
.dq-comp-row .dq-field-partial { color: var(--warn); font-weight: 600; }

.dq-interrupt { background: var(--bad-50); border: 1px solid #FCA5A5; border-radius: 6px; padding: 12px 14px; margin-bottom: 12px; }
.dq-interrupt-title { font-size: 14px; font-weight: 700; color: var(--bad); margin-bottom: 6px; }
.dq-interrupt-row { font-size: 13px; color: #7F1D1D; line-height: 1.6; margin-top: 2px; }
.dq-interrupt-row strong { color: var(--bad); }

.dq-pending { margin-top: 6px; }
.dq-pending-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--warn); background: var(--warn-50);
  border: 1px solid #FDE68A; border-radius: 4px; padding: 3px 9px;
  cursor: pointer; font-weight: 600;
}
.dq-pending-toggle:hover { background: #FEF3C7; }
.dq-pending-body { display: none; background: var(--warn-50); border: 1px solid #FDE68A; border-top: none; border-radius: 0 0 4px 4px; padding: 8px 10px; font-size: 12px; color: #78350F; line-height: 1.6; }
.dq-pending-body.open { display: block; }

.dq-contradiction-notice { background: var(--bad-50); border: 1px solid #FCA5A5; border-radius: 5px; padding: 8px 12px; margin-bottom: 10px; font-size: 12.5px; color: #991B1B; font-weight: 600; }

.report-data-quality {
  margin-bottom: 12px;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  background: var(--card);
}
.report-data-quality.has-issues { border-color: #f59e0b; }
.report-data-quality summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 14px;
  color: var(--ink-700);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.report-data-quality.is-normal summary { color: var(--ok); }
.report-data-quality.has-issues summary { color: #92400e; }
.report-data-quality-status { color: var(--warn); font-size: 12px; font-weight: 600; }
.report-data-quality-body { padding: 0 12px 2px; }
.report-data-quality-body > :last-child { margin-bottom: 10px; }

.dq-suggestions-block { background: #F0F9FF; border: 1px solid #BAE6FD; border-radius: 6px; padding: 12px 14px; margin-top: 12px; }
.dq-suggestions-block h4 { font-size: 13px; font-weight: 700; color: #0369A1; margin: 0 0 8px 0; }
.dq-suggestion-row { font-size: 12px; color: var(--ink-700); padding: 3px 0; display: flex; gap: 6px; }
.dq-suggestion-row .dq-sug-field { color: #0369A1; font-weight: 600; min-width: 120px; }
.dq-suggestion-row .dq-sug-desc  { color: var(--ink-500); }

/* ============ REASONING LOG ============ */
.reasoning-toggle {
  width: 100%; background: var(--ink-100); border: 1px solid var(--ink-200);
  border-radius: 8px; padding: 11px 14px; margin-top: 14px; text-align: left;
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-700);
  font-family: var(--sans); display: flex; align-items: center; justify-content: space-between;
  transition: background 0.12s;
}
.reasoning-toggle:hover { background: var(--ink-200); }
.reasoning-toggle .toggle-arrow { font-size: 11px; color: var(--ink-400); transition: transform 0.2s; }
.reasoning-toggle.open .toggle-arrow { transform: rotate(180deg); }
.reasoning-log { display: none; background: var(--card); border: 1px solid var(--ink-200); border-top: none; border-radius: 0 0 8px 8px; padding: 14px 16px; font-size: 12.5px; line-height: 1.8; }
.reasoning-log.open { display: block; }
.log-ok   { color: var(--ok); }
.log-warn { color: var(--bad); font-weight: 600; }
.log-skip { color: var(--ink-400); }

/* ============ EXEC PLAN COLLAPSIBLE ============ */
.report-section-body { width: 100%; box-sizing: border-box; overflow: hidden; max-height: 5000px; overflow-anchor: none; }
.report-section-body.collapsed { max-height: 0 !important; overflow: hidden !important; padding: 0 !important; }
.report-collapsible-section { width: 100%; box-sizing: border-box; overflow-anchor: none; }
.specialty-subsection { width: 100%; box-sizing: border-box; }
#exec-container { width: 100%; box-sizing: border-box; overflow-anchor: none; }

/* ============ FEEDBACK FLAG BUTTONS ============ */
.feedback-flag-btn {
  opacity: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  line-height: 1;
  transition: opacity 0.15s;
  color: #ccc;
}
.feedback-flag-btn.has-note { opacity: 1 !important; color: orange; }
.report-section-header:hover .feedback-flag-btn:not(.has-note),
.strength-col-header:hover .feedback-flag-btn:not(.has-note) { opacity: 0.4; }

/* ===== 移动端侧栏折叠按钮 ===== */
#sidebarToggle { display: none; }

@media (max-width: 768px) {
  #sidebarToggle {
    display: block;
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 1000;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 0 6px 6px 0;
    padding: 12px 6px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 1px 1px 4px rgba(0,0,0,0.15);
  }
  #sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden !important;
  }
  #sidebar.collapsed > * { display: none !important; }
}

/* ── 初始筛查 section heading ───────────────────────── */
.screening-section { margin: 12px 0 24px 0; }
.screening-title-bar { border-bottom: 2px solid #2563eb; padding: 4px 0 10px 0; margin-bottom: 18px; }
.screening-title { font-size: 18px; font-weight: 700; color: #1a1a1a; margin: 0; }
.screening-subtitle { font-size: 13px; color: #6b7280; margin: 4px 0 0 0; font-weight: 400; }

/* ── 足部结论 3-tier hierarchy + warning severity ───── */
.foot-conclusion { padding: 12px 0; }
.foot-side-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.foot-card { padding: 12px 16px; border-radius: 8px; border-left: 4px solid; background: #fff; }
.foot-card.severity-high   { border-left-color: #E85454; background: #FEF2F2; }
.foot-card.severity-medium { border-left-color: #F5A623; background: #FFF8EC; }
.foot-card.severity-low    { border-left-color: #5CB85C; background: #F0FAF1; }
.foot-label { font-size: 11px; color: #888; letter-spacing: 0.06em; text-transform: uppercase; }
.foot-verdict { font-size: 16px; font-weight: 700; color: #1a1a1a; margin: 4px 0 0 0; line-height: 1.4; }
.foot-comparison { display: flex; gap: 12px; align-items: baseline; padding: 10px 14px; background: #f3f4f6; border-radius: 6px; margin-bottom: 14px; }
.foot-comparison .label { font-size: 13px; color: #6b7280; }
.foot-comparison .value { font-weight: 600; color: #1a1a1a; }
.foot-warnings { display: flex; flex-direction: column; gap: 8px; }
.foot-warning { display: flex; gap: 10px; padding: 10px 14px; border-radius: 6px; border-left: 4px solid; font-size: 14px; line-height: 1.55; }
.foot-warning.sev-high   { border-left-color: #E85454; background: #FEF2F2; color: #991B1B; font-weight: 500; }
.foot-warning.sev-medium { border-left-color: #F5A623; background: #FFF8EC; color: #92400E; }
.foot-warning.sev-info   { border-left-color: #4A90D9; background: #EFF6FF; color: #1E40AF; }
.foot-warning .icon { flex-shrink: 0; }

/* ============ Priority tag system ============ */
.priority-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 8px;
  letter-spacing: 0.03em;
  vertical-align: middle;
  line-height: 1.4;
}
.priority-tag.t1 { background: #01847F; color: #fff; }
.priority-tag.t2 { background: #3B6CB7; color: #fff; }
.priority-tag.t3 { background: #E5E7EB; color: #374151; }

.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #F3F4F6;
  color: #6B7280;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  cursor: help;
  vertical-align: middle;
  user-select: none;
  border: none;
  transition: background 0.15s;
}
.info-tip:hover { background: #E5E7EB; color: #374151; }
.info-tip:active { background: #D1D5DB; }

.global-tooltip {
  position: fixed;
  background: #1F2937;
  color: #F9FAFB;
  font-size: 12px;
  font-weight: 400;
  padding: 8px 12px;
  border-radius: 6px;
  max-width: 280px;
  line-height: 1.5;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  z-index: 9999;
  pointer-events: none;
  white-space: normal;
}

/* ============ Unified test heading ============ */
.test-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 16px 0 12px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.test-title .title-en {
  font-size: 12px;
  font-weight: 400;
  color: #9CA3AF;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* ============ Collapsible compensation blocks ============ */
.compensation-block { margin-top: 12px; }
.compensation-header {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: #374151;
  padding: 8px 0;
  list-style: none;
}
.compensation-header::-webkit-details-marker { display: none; }
.compensation-header::before {
  content: '▶';
  display: inline-block;
  margin-right: 6px;
  font-size: 10px;
  transition: transform 0.2s;
}
details[open] .compensation-header::before { transform: rotate(90deg); }
.compensation-header .hint {
  font-weight: 400;
  font-size: 12px;
  color: #9CA3AF;
  margin-left: 6px;
}
.compensation-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding-left: 16px;
}

.tier-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 0 8px 0;
  margin-top: 24px;
  border-bottom: 1px solid #E5E7EB;
  margin-bottom: 16px;
}
.tier-header:first-child { margin-top: 0; }
.tier-label {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.tier-1 .tier-label { background: #01847F; color: #fff; }
.tier-2 .tier-label { background: #3B6CB7; color: #fff; }
.tier-3 .tier-label { background: #E5E7EB; color: #374151; }
.tier-name { font-size: 15px; font-weight: 700; color: #1a1a1a; }
.tier-hint { font-size: 12px; color: #6B7280; font-weight: 400; }

/* ============ Unified engine warnings ============ */
.engine-warning {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 6px;
  border-left: 4px solid;
  font-size: 14px;
  line-height: 1.55;
  margin: 8px 0;
}
.engine-warning .icon { flex-shrink: 0; font-size: 14px; }
.engine-warning .body { flex: 1; }
.engine-warning .body b { font-weight: 600; }
.engine-warning.sev-high   { border-left-color: #E85454; background: #FEF2F2; color: #991B1B; font-weight: 500; }
.engine-warning.sev-medium { border-left-color: #F5A623; background: #FFF8EC; color: #92400E; }
.engine-warning.sev-info   { border-left-color: #4A90D9; background: #EFF6FF; color: #1E40AF; }
.engine-warning.sev-good   { border-left-color: #5CB85C; background: #F0FAF1; color: #166534; }

/* ============ Unified module headers ============ */
.module-header {
  background: #1a1a1a;
  color: #fff;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  min-height: 44px;
}
.module-header .module-title-cn { font-size: 16px; font-weight: 600; color: #fff; }
.module-header .module-title-en { font-size: 12px; font-weight: 400; color: rgba(255,255,255,0.6); letter-spacing: 0.02em; }
.module-header .info-tip { background: rgba(255,255,255,0.15); color: #fff; }
.module-header .info-tip:hover { background: rgba(255,255,255,0.25); }
.module-header .module-tag { font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 3px; letter-spacing: 0.03em; margin-left: auto; }
.module-header .module-tag.central { background: #8B5CF6; color: #fff; }
.module-header .module-tag.lower-limb { background: #D1FAE5; color: #065F46; }
.module-header .module-tag.upper-limb { background: #DBEAFE; color: #1E40AF; }

/* ===== Client list groups ===== */
.group { margin-bottom: 4px; }
.group-header {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; cursor: pointer; user-select: none;
  border-radius: 4px; font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.7);
}
.group-header:hover { background: rgba(255,255,255,0.05); }
.group-toggle {
  font-size: 10px; color: rgba(255,255,255,0.5);
  transition: transform 0.15s; cursor: pointer; padding: 2px;
}
.group.collapsed .group-toggle { transform: rotate(-90deg); }
.group.collapsed .group-clients { display: none; }
.group-color-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; cursor: pointer;
}
.group-name { flex: 1; outline: none; }
.group-name[contenteditable="true"] {
  background: rgba(255,255,255,0.08);
  border-radius: 3px; padding: 0 4px;
}
.group-count { font-size: 11px; color: rgba(255,255,255,0.4); }
.group-menu {
  opacity: 0; font-size: 14px; padding: 0 4px;
  cursor: pointer; transition: opacity 0.1s;
}
.group-header:hover .group-menu { opacity: 0.6; }
.group-menu:hover { opacity: 1 !important; }
.group-clients { padding-left: 8px; min-height: 28px; }
.group-clients.drag-over { background: rgba(59,130,246,0.08); border-radius: 4px; }

.client-item.dragging { opacity: 0.4; }
.client-item.drag-over-top { border-top: 2px solid #3B82F6; }
.client-item.drag-over-bottom { border-bottom: 2px solid #3B82F6; }

.btn-add-group {
  width: calc(100% - 16px); margin: 8px; padding: 8px;
  background: transparent; border: 1px dashed rgba(255,255,255,0.2);
  border-radius: 4px; color: rgba(255,255,255,0.5);
  cursor: pointer; font-size: 12px;
}
.btn-add-group:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.4);
}

.color-picker, .group-context-menu {
  position: absolute; background: #1f2937;
  border-radius: 6px; padding: 4px; z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.color-picker { display: flex; gap: 4px; padding: 8px; }
.color-picker .color-option {
  width: 20px; height: 20px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
}
.color-picker .color-option:hover { border-color: rgba(255,255,255,0.5); }
.group-context-menu { min-width: 120px; }
.group-context-menu button {
  display: block; width: 100%; padding: 6px 12px;
  background: transparent; border: none; color: #fff;
  font-size: 13px; text-align: left; cursor: pointer;
  border-radius: 3px;
}
.group-context-menu button:hover { background: rgba(255,255,255,0.08); }
.group-context-menu button.danger { color: #f87171; }
.group-context-menu button:disabled {
  color: rgba(255,255,255,0.3); cursor: not-allowed;
}

/* Group drag-and-drop */
.group.group-dragging { opacity: 0.4; }
.group-header.group-drag-over-top { border-top: 2px solid #3B82F6; }
.group-header.group-drag-over-bottom { border-bottom: 2px solid #3B82F6; }

/* ===== Mobile responsive: list/detail switch ===== */
.btn-back-to-list {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border: none;
  padding: 12px 16px;
  font-size: 14px;
  color: #3B82F6;
  cursor: pointer;
  border-bottom: 1px solid #e5e7eb;
  width: 100%;
  text-align: left;
}

@media (max-width: 768px) {
  .btn-back-to-list { display: block; }

  body { display: block; }

  #sidebar, #main {
    position: fixed;
    top: 0; left: 0;
    width: 100% !important;
    height: 100vh;
    transition: transform 0.25s ease;
  }
  #sidebar { z-index: 30; max-width: 100%; min-width: 0; }
  #main { z-index: 20; overflow-y: auto; }

  body.mobile-view-list #sidebar { transform: translateX(0); }
  body.mobile-view-list #main { transform: translateX(100%); }

  body.mobile-view-detail #sidebar { transform: translateX(-100%); }
  body.mobile-view-detail #main { transform: translateX(0); }

  #sidebarToggle { display: none; }
}

/* ===== Mobile action sheet ===== */
.client-action-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-radius: 12px 12px 0 0;
  padding: 8px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
  z-index: 100;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.client-action-sheet.open { transform: translateY(0); }
.client-action-sheet .cas-title {
  padding: 10px 14px 8px;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
}
.client-action-sheet button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: transparent;
  border: none;
  font-size: 16px;
  color: #1a1a1a;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.client-action-sheet button.danger { color: #ef4444; }
.client-action-sheet button.cancel {
  margin-top: 8px;
  font-weight: 600;
  border-bottom: none;
}
.client-action-sheet .cas-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.client-action-sheet-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.client-action-sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* ===== User menu (top-right) ===== */
.user-menu { position: relative; display: inline-block; margin-left: 8px; }
.user-menu-trigger {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: rgba(0,0,0,0.04);
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.user-menu-trigger:hover { background: rgba(0,0,0,0.08); }
.user-menu-arrow { font-size: 10px; opacity: 0.6; transition: transform 0.15s; }
.user-menu.open .user-menu-arrow { transform: rotate(180deg); }
.user-menu-dropdown {
  position: fixed;
  min-width: 200px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 8px;
  display: none;
  z-index: 9999;
}
.user-menu-dropdown.open { display: block; }
.user-menu-info { padding: 8px 12px; }
.user-menu-display-name { font-size: 14px; font-weight: 600; color: #1f2937; }
.user-menu-username { font-size: 12px; color: #6b7280; margin-top: 2px; font-family: var(--mono); }
.user-menu-divider { height: 1px; background: #e5e7eb; margin: 8px 0; }
.user-menu-item {
  display: block; width: 100%;
  padding: 8px 12px;
  background: transparent; border: none;
  color: #1f2937;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
}
.user-menu-item:hover { background: #f3f4f6; }
.user-menu-item-danger { color: #ef4444; }
.user-menu-item-danger:hover { background: #fef2f2; }
@media (max-width: 768px) {
  .user-menu-dropdown { min-width: 220px; }
}

/* ===== Modal (generic) ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}
.modal-card {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}
.modal-header h3 { margin: 0; font-size: 16px; font-weight: 600; color: #1f2937; }
.modal-close {
  background: transparent; border: none;
  font-size: 18px; color: #6b7280;
  cursor: pointer; padding: 4px 8px;
}
.modal-close:hover { color: #1f2937; }
.modal-body { padding: 20px; }
.modal-body .form-group { margin-bottom: 16px; }
.modal-body .form-group label {
  display: block; font-size: 13px; font-weight: 500;
  color: #374151; margin-bottom: 6px;
}
.modal-body .form-group input {
  width: 100%; padding: 8px 12px;
  border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 14px; box-sizing: border-box;
  font-family: inherit;
}

/* ===== Mobile inclinometer ===== */
.inclinometer-overlay[hidden] { display: none !important; }
body.inclinometer-open { overflow: hidden; }
.inclinometer-card { max-width: 390px; }
.inclinometer-header { align-items: flex-start; }
.inclinometer-kicker {
  margin-bottom: 3px;
  color: var(--ink-400);
  font: 600 10px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.inclinometer-body { padding-top: 24px; padding-bottom: 24px; text-align: center; }
.inclinometer-form-value {
  margin-bottom: 4px;
  color: var(--ink-400);
  font-size: 11px;
}
.inclinometer-reading {
  display: flex;
  min-height: 104px;
  align-items: baseline;
  justify-content: center;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.inclinometer-value { font-size: clamp(68px, 22vw, 92px); font-weight: 650; letter-spacing: -.05em; }
.inclinometer-degree { margin-left: 6px; color: var(--ink-400); font-size: 34px; font-weight: 500; }
.inclinometer-status {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--ink-50);
  color: var(--ink-500);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  white-space: pre-line;
}
.inclinometer-status[data-state="stable"] { background: var(--ok-50); color: var(--ok); }
.inclinometer-status[data-state="measuring"] { background: var(--accent-50); color: #1d4ed8; }
.inclinometer-status[data-state="error"] {
  max-width: 100%;
  border-radius: 8px;
  background: var(--warn-50);
  color: var(--warn);
}
.inclinometer-help {
  max-width: 290px;
  margin: 14px auto 0;
  color: var(--ink-400);
  font-size: 11px;
  line-height: 1.55;
}
.inclinometer-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.inclinometer-footer .inclinometer-zero { grid-column: 1 / -1; }
.inclinometer-footer button { min-height: 46px; margin: 0; }

/* ===== Inclinometer calibration · ?debug=1 only ===== */
.inclinometer-calibration-toggle {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 1450;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #c4b5fd;
  border-radius: 999px;
  background: #faf5ff;
  color: #6d28d9;
  box-shadow: 0 4px 16px rgba(76, 29, 149, .16);
  font: 600 11px var(--sans);
  cursor: pointer;
}
.inclinometer-calibration-overlay[hidden] { display: none !important; }
.inclinometer-calibration-card {
  width: min(94vw, 920px);
  max-width: 920px;
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}
.inclinometer-calibration-body {
  max-height: calc(100dvh - 98px);
  padding: 16px 20px 24px;
  overflow-y: auto;
}
.calibration-toolbar,
.calibration-record-controls,
.calibration-export-row {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px;
}
.calibration-toolbar { align-items: center; margin-bottom: 14px; }
.calibration-toolbar button,
.calibration-record-controls button,
.calibration-export-row button { min-height: 40px; }
.calibration-live-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.calibration-live-grid > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--ink-100);
  border-radius: 7px;
  background: #fafafa;
}
.calibration-live-grid small { display: block; color: var(--ink-400); font-size: 9px; line-height: 1.3; }
.calibration-live-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink-800);
  font: 600 14px var(--mono);
  overflow-wrap: anywhere;
}
.calibration-record-controls {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  background: #faf5ff;
}
.calibration-record-controls label { display: grid; gap: 4px; color: var(--ink-500); font-size: 10px; font-weight: 600; }
.calibration-record-controls input,
.calibration-record-controls select {
  min-width: 130px;
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-800);
  font: 13px var(--sans);
}
.inclinometer-calibration-body h4 { margin: 16px 0 7px; color: var(--ink-700); font-size: 12px; }
.calibration-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--ink-100); border-radius: 7px; }
.calibration-table-wrap table { width: 100%; border-collapse: collapse; font-size: 11px; }
.calibration-table-wrap th,
.calibration-table-wrap td { padding: 7px 8px; border-bottom: 1px solid var(--ink-100); text-align: left; white-space: nowrap; }
.calibration-table-wrap th { background: #f9fafb; color: var(--ink-500); font-size: 9px; text-transform: uppercase; }
.calibration-overall { margin: 9px 0 14px; color: var(--ink-600); font: 11px/1.5 var(--mono); }
.calibration-copy-status { color: var(--ink-500); font-size: 11px; }
.calibration-export {
  width: 100%;
  min-height: 100px;
  margin-top: 8px;
  padding: 9px;
  box-sizing: border-box;
  border: 1px solid var(--ink-200);
  border-radius: 7px;
  color: var(--ink-600);
  font: 10px/1.45 var(--mono);
  resize: vertical;
}

@media (max-width: 768px) {
  .bounded-controls:has(.bounded-measure) {
    grid-template-rows: 44px 32px 44px;
  }
  .bounded-controls:has(.bounded-measure) .bounded-track { grid-row: 2; }
  .bounded-controls:has(.bounded-measure) .bounded-measure {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
    min-height: 44px;
    font-size: 12px;
  }
  .inclinometer-overlay {
    align-items: flex-end;
    padding-right: 8px;
    padding-left: 8px;
  }
  .inclinometer-card {
    width: 100%;
    max-width: 430px;
    border-radius: 16px 16px 12px 12px;
  }
  .inclinometer-body { padding-top: 20px; padding-bottom: 20px; }
  .inclinometer-footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .inclinometer-calibration-toggle { right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); min-height: 44px; }
  .inclinometer-calibration-overlay { align-items: flex-start; padding: calc(8px + env(safe-area-inset-top)) 6px calc(8px + env(safe-area-inset-bottom)); }
  .inclinometer-calibration-card { width: 100%; max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .inclinometer-calibration-body { max-height: calc(100dvh - 88px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding: 12px; }
  .calibration-toolbar button { min-height: 44px; }
  .calibration-live-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calibration-record-controls { display: grid; grid-template-columns: 1fr 1fr; align-items: end; }
  .calibration-record-controls label:last-of-type,
  .calibration-record-controls .calibration-record { grid-column: 1 / -1; }
  .calibration-record-controls input,
  .calibration-record-controls select,
  .calibration-record-controls button { width: 100%; min-width: 0; min-height: 44px; }
}
.modal-body .form-group input:focus {
  outline: none; border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-hint { font-size: 12px; color: #6b7280; margin-top: 4px; }
.form-error {
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #dc2626;
  font-size: 13px;
  margin-top: 8px;
}
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}
.btn-secondary, .btn-primary {
  padding: 8px 16px; border-radius: 6px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
}
.btn-secondary { background: #fff; border-color: #d1d5db; color: #374151; }
.btn-secondary:hover { background: #f3f4f6; }
.btn-primary { background: #3B82F6; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #2563EB; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 20px;
  border-radius: 6px;
  background: #1f2937;
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 3000;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast-success { background: #10B981; }
.toast-error { background: #EF4444; }

/* ============ R-43 Mobile / WeChat H5 shell ============ */
#mobile-header,
#mobile-actionbar,
#mobile-drawer-backdrop,
#mobile-drawer-close,
#mobile-quick-nav-toggle,
#mobile-back-to-top,
#mobile-quick-nav-layer {
  display: none;
}

.sidebar-title-row h2 { margin-bottom: 12px; }

@media (max-width: 768px) {
  :root {
    --mobile-header-height: 56px;
    --mobile-tabs-height: 48px;
  }

  html {
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-text-size-adjust: 100%;
  }

  body {
    display: block;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
  }

body.mobile-drawer-open { overflow: hidden; }

  #loginOverlay {
    height: 100vh !important;
    height: 100dvh !important;
    padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  }

  #loginOverlay > div {
    max-width: 360px !important;
    padding: 28px 22px !important;
  }

  #loginOverlay input {
    min-height: 44px;
    font-size: 16px !important;
  }

  #mobile-header {
    position: sticky;
    z-index: 115;
    top: 0;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 58px;
    align-items: center;
    gap: 10px;
    min-height: calc(var(--mobile-header-height) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    color: #f8fafc;
    background: var(--navy-900);
    border-bottom: 1px solid rgba(255,255,255,.08);
  }

  .mobile-brand {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    color: #fff;
    background: transparent;
    white-space: nowrap;
  }

  .mobile-context { min-width: 0; }
  .mobile-context strong,
  .mobile-context span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-context strong { font-size: 14px; font-weight: 600; }
  .mobile-context span { margin-top: 2px; color: #94a3b8; font: 10px var(--mono); }

  #mobile-client-button,
  #mobile-drawer-close {
    min-width: 44px;
    min-height: 44px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 6px;
    color: #f8fafc;
    background: rgba(255,255,255,.06);
    font: 500 13px var(--sans);
    touch-action: manipulation;
  }

  #mobile-drawer-backdrop {
    position: fixed;
    z-index: 1190;
    inset: 0;
    display: block;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    border: 0;
    background: rgba(3, 7, 18, .52);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }

  body.mobile-drawer-open #mobile-drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  #sidebar,
  #sidebar.collapsed {
    position: fixed;
    z-index: 1200;
    inset: 0 auto 0 0;
    display: flex;
    width: min(88vw, 360px) !important;
    min-width: 0 !important;
    height: 100vh;
    height: 100dvh;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) !important;
    overflow: hidden;
    border-right: 1px solid #000 !important;
    transform: translate3d(-102%, 0, 0);
    transition: transform .22s ease;
    will-change: transform;
  }

  #sidebar.collapsed > * { display: block !important; }
  #sidebar.collapsed #client-list { display: block !important; flex: 1; }
  body.mobile-drawer-open #sidebar { transform: translate3d(0, 0, 0); }
  #sidebar-header { flex: 0 0 auto; }
  #client-list { min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .sidebar-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .sidebar-title-row h2 { margin: 0; }
  #mobile-drawer-close { display: block; font-size: 24px; line-height: 1; }

  .client-item,
  .session-sub-item,
  .group-header,
  #btn-new-client,
  .btn-add-group { min-height: 44px; }
  .client-delete,
  .session-sub-delete { min-width: 44px; min-height: 44px; opacity: 1; }
  .client-item .client-name { max-width: calc(100% - 50px); }

  #sidebarToggle,
  .btn-back-to-list { display: none !important; }

  #main {
    position: static;
    z-index: auto;
    width: 100%;
    min-height: 0;
    overflow: visible;
    transform: none !important;
  }

  #topbar {
    top: calc(var(--mobile-header-height) + env(safe-area-inset-top));
    z-index: 110;
    height: var(--mobile-tabs-height);
    padding: 0 8px;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .tab-btn {
    min-width: 49px;
    height: var(--mobile-tabs-height);
    min-height: 44px;
    padding: 0 7px;
    font-size: 0;
    scroll-snap-align: center;
    touch-action: manipulation;
  }
  .tab-btn::after { content: attr(data-mobile-label); font-size: 13px; }
  #topbar-right { display: none; }

  #mobile-actionbar {
    position: relative;
    z-index: 105;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 52px;
    padding: 6px 10px;
    background: var(--paper);
    border-bottom: 1px solid var(--ink-200);
  }

  #mobile-new-session,
  #mobile-more-button,
  #mobile-more-menu button {
    min-height: 44px;
    border-radius: 6px;
    font: 500 14px var(--sans);
    touch-action: manipulation;
  }
  #mobile-new-session {
    flex: 1;
    max-width: 240px;
    border: 0;
    color: #fff;
    background: var(--ok);
  }
  #mobile-new-session:disabled { opacity: .42; }
  #mobile-more-button {
    min-width: 64px;
    padding: 0 13px;
    color: var(--ink-700);
    background: #fff;
    border: 1px solid var(--ink-200);
  }
  .mobile-more-wrap { position: relative; }
  #mobile-more-menu {
    position: absolute;
    z-index: 1300;
    top: calc(100% + 6px);
    right: 0;
    display: none;
    width: 180px;
    padding: 6px;
    border: 1px solid var(--ink-200);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .16);
  }
  body.mobile-more-open #mobile-more-menu { display: grid; }
  #mobile-more-menu button { padding: 0 12px; border: 0; text-align: left; color: var(--ink-700); background: transparent; }
  #mobile-more-menu button.danger { color: var(--bad); }

  #session-selector-bar {
    top: calc(var(--mobile-header-height) + var(--mobile-tabs-height) + env(safe-area-inset-top));
    z-index: 108;
    min-height: 48px;
    padding: 5px 10px;
  }
  #session-select { min-width: 0; min-height: 38px; flex: 1; font-size: 14px; }

  .tab-panel.active {
    max-width: 100%;
    padding: 12px 10px calc(72px + env(safe-area-inset-bottom));
  }
  .section-card { margin-bottom: 12px; min-width: 0; }
  .section-title,
  .module-header { padding-right: 12px; padding-left: 12px; }
  .section-body { min-width: 0; padding: 13px 12px; overflow-x: auto; }

  .form-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .form-group,
  .form-group.wide { width: 100%; min-width: 0; }
  .form-group input[type="text"],
  .form-group input[type="number"],
  .form-group input[type="date"],
  .form-group textarea,
  .modal-body input,
  .modal-body select,
  .modal-body textarea {
    min-height: 44px;
    font-size: 16px;
  }
  .form-group textarea { min-height: 88px; }
  .btn-option,
  .check-label { min-height: 44px; display: inline-flex; align-items: center; }
  .bilateral-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }

  .rom-table {
    display: block;
    width: 100%;
    overflow: visible;
  }
  .rom-table thead { display: none; }
  .rom-table tbody { display: block; }
  .rom-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--ink-100);
  }
  .rom-table td,
  .rom-table td:has(.bounded-input),
  .supine-shoulder-row td:has(.bounded-input) {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
  }
  .rom-table td:first-child { grid-column: 1 / -1; font-size: 14px; }
  .rom-table td:nth-child(2)::before,
  .rom-table td:nth-child(3)::before,
  .rom-table td:nth-child(4)::before,
  .rom-table td:nth-child(5)::before {
    display: block;
    margin-bottom: 5px;
    color: var(--ink-400);
    font: 600 10px var(--mono);
  }
  .rom-table td:nth-child(2)::before { content: '左'; }
  .rom-table td:nth-child(3)::before { content: '右'; }
  .rom-table td:nth-child(4)::before { content: '参考'; }
  .rom-table td:nth-child(5)::before { content: '左右差'; }
  .rom-table td:nth-child(4) { align-self: end; }
  .rom-table td:nth-child(5) { align-self: end; text-align: right; }
  #hipflex-boundary-hint[style*="table-row"] { display: grid !important; grid-template-columns: 1fr; }
  #hipflex-boundary-hint td { grid-column: 1 / -1; }
  #hipflex-boundary-hint td::before { display: none; }

  .bounded-input { width: 100%; min-width: 0; }
  .bounded-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 5px 8px;
    width: 100%;
  }
  .bounded-track {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    height: 34px;
  }
  .bounded-number {
    grid-column: 1;
    width: 78px !important;
    min-width: 78px;
    min-height: 44px;
    padding: 8px 6px !important;
    font-size: 16px;
  }
  .bounded-clear {
    grid-column: 2;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    font-size: 12px;
    touch-action: manipulation;
  }
  .bounded-scale { margin: 0; height: 17px; font-size: 10px; }

  .bounded-range,
  .centered-range {
    height: 32px;
    touch-action: pan-y;
  }
  .bounded-range::-webkit-slider-thumb,
  .centered-range::-webkit-slider-thumb { min-width: 24px; min-height: 24px; }
  .bounded-range::-moz-range-thumb,
  .centered-range::-moz-range-thumb { width: 24px; height: 24px; }

  .isa-input-row { gap: 16px; }
  .isa-input-col { width: 100%; }

  .centered-bilateral {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 9px 12px;
    padding: 14px 0;
  }
  .centered-axis { height: 36px; }
  .centered-axis::before { top: 17px; }
  .centered-zero { top: 9px; height: 18px; }
  .centered-half { height: 36px; }
  .centered-side-input { justify-content: flex-start; gap: 6px; }
  .centered-side .bounded-number {
    width: 76px !important;
    min-width: 0;
    min-height: 44px;
    font-size: 16px;
  }
  .centered-side .bounded-clear { min-width: 44px; min-height: 44px; padding: 0; }
  .centered-delta { text-align: left; }

  #pdf-overlay { padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); }
  #pdf-panel { width: min(100%, 420px); max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; }
  .pdf-check-row,
  .pdf-panel-btns button { min-height: 44px; }

  .modal-overlay {
    align-items: flex-start;
    padding: calc(12px + env(safe-area-inset-top)) 10px calc(12px + env(safe-area-inset-bottom));
    overflow-y: auto;
  }
  .modal-card { width: 100%; max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; }
  .modal-close,
  .btn-secondary,
  .btn-primary { min-height: 44px; }
  .modal-body,
  .modal-footer { padding-right: 14px; padding-left: 14px; }

  .client-action-sheet { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100vw - 24px); text-align: center; }
}

/* ============ R-43A Mobile assessment density refinement ============ */
@media (max-width: 768px) {
  :root { --mobile-header-height: 50px; }

  html,
  body { overflow-x: clip; }
  body { overflow-y: visible; }

  #mobile-header {
    grid-template-columns: 34px minmax(0, 1fr) 58px;
    gap: 8px;
    padding-right: 10px;
    padding-left: 10px;
  }
  .mobile-brand { min-width: 0; }
  .mobile-context strong { font-size: 13.5px; }
  .mobile-context span { margin-top: 1px; font-size: 9px; }

  .tab-panel.active { padding-top: 9px; }
  .section-card { margin-bottom: 10px; }
  .section-body { padding-top: 10px; padding-bottom: 10px; }
  .module-header {
    min-height: 40px;
    gap: 6px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .module-header .module-title-cn { font-size: 15px; }
  .module-header .module-title-en { font-size: 10px; color: rgba(255,255,255,.48); }
  .module-header .module-tag { padding: 2px 7px; font-size: 10px; }

  .tier-header {
    gap: 7px;
    margin-top: 18px;
    margin-bottom: 10px;
    padding: 10px 0 6px;
  }
  .tier-label { padding: 2px 6px; font-size: 10px; }
  .tier-name { font-size: 14px; }
  .tier-hint { font-size: 11px; color: var(--ink-400); }
  .test-title {
    gap: 4px;
    margin: 12px 0 8px;
    font-size: 14px;
  }
  .test-title .title-en { font-size: 10px; color: var(--ink-400); }
  .priority-tag {
    margin-left: 4px;
    padding: 1px 4px;
    font-size: 8px;
    opacity: .72;
  }
  .info-tip {
    width: 16px;
    height: 16px;
    margin-left: 4px;
    font-size: 9px;
    opacity: .62;
  }

  .rom-table tr {
    position: relative;
    gap: 6px 10px;
    padding: 10px 0;
  }
  .rom-table td:first-child {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 20px;
    padding-right: 94px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
  }
  .rom-table td:first-child > span[style*="font-size:11px"] {
    font-size: 9.5px !important;
    color: var(--ink-400) !important;
    font-weight: 400;
  }
  .rom-table td:nth-child(2) { grid-column: 1; grid-row: 2; }
  .rom-table td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .rom-table td:nth-child(4) {
    position: absolute;
    top: 11px;
    right: 0;
    max-width: 92px;
    color: var(--ink-400);
    font-size: 10px;
    line-height: 1.3;
    text-align: right;
    white-space: nowrap;
  }
  .rom-table td:nth-child(5) {
    grid-column: 1 / -1;
    grid-row: 3;
    min-height: 14px;
    color: var(--ink-400);
    font-size: 10px;
    line-height: 1.3;
    text-align: right;
  }
  .rom-table td:nth-child(2)::before,
  .rom-table td:nth-child(3)::before {
    margin-bottom: 2px;
    font-size: 10px;
  }
  .rom-table td:nth-child(4)::before,
  .rom-table td:nth-child(5)::before {
    display: inline;
    margin: 0;
    font-size: inherit;
    font-weight: 500;
  }
  .rom-table td:nth-child(4)::before { content: '参考 '; }
  .rom-table td:nth-child(5)::before { content: '左右差 '; }
  .rom-table td:nth-child(5):has(.rom-delta:empty)::after { content: '—'; }
  #hipflex-boundary-hint td:first-child { min-height: 0; padding-right: 0; }

  .bounded-controls {
    grid-template-columns: 72px minmax(44px, 1fr);
    grid-template-rows: 44px 32px;
    gap: 2px 6px;
  }
  .bounded-number {
    grid-column: 1;
    grid-row: 1;
    width: 72px !important;
    min-width: 72px;
    font-weight: 600;
  }
  .bounded-clear {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: auto;
    min-width: 44px;
    color: var(--ink-400);
    font-size: 10px;
    opacity: .62;
  }
  .bounded-clear:disabled { visibility: hidden; }
  .bounded-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .bounded-scale {
    height: 13px;
    margin: 0;
    font-size: 9px;
  }
  .bounded-mark:not(.bounded-mark-min):not(.bounded-mark-max) { display: none; }

  .isa-input-row { gap: 10px; }
  .isa-input-col label { margin-bottom: 2px; color: var(--ink-500); }

  .centered-bilateral {
    gap: 6px 10px;
    padding: 10px 0;
  }
  .centered-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
  }
  .centered-reference-label { color: var(--ink-400); font-size: 10px; }
  .centered-axis-labels {
    grid-template-columns: 1fr auto 1fr;
    gap: 4px;
    margin-bottom: -2px;
    font-size: 8px;
  }
  .centered-axis-labels span:nth-child(2),
  .centered-axis-labels span:nth-child(4) { display: none; }
  .centered-axis-labels strong { color: var(--ink-400); font-weight: 500; }
  .centered-axis { height: 32px; }
  .centered-axis::before { top: 15px; }
  .centered-zero { top: 9px; height: 14px; background: var(--ink-400); }
  .centered-half { height: 32px; }
  .centered-side-label { margin-bottom: 2px; font-size: 10px; }
  .centered-side-input { gap: 4px; }
  .centered-side .bounded-number {
    width: 68px !important;
    min-width: 68px;
    font-weight: 600;
  }
  .centered-side .bounded-clear {
    width: auto;
    min-width: 44px;
    color: var(--ink-400);
    font-size: 10px;
    opacity: .62;
  }
  .centered-delta {
    min-height: 14px;
    color: var(--ink-400);
    font-size: 10px;
    line-height: 1.3;
    text-align: right;
  }
  .centered-delta::before { content: '左右差 '; font-weight: 500; }
  .centered-delta:has(.rom-delta:empty)::after { content: '—'; }
}

/* ============ R-43A-2 Mobile ROM states and quick navigation ============ */
@media (max-width: 768px) {
  #main { height: auto; }

  .bounded-scale > .bounded-mark:not(.bounded-mark-min):not(.bounded-mark-max) {
    display: none !important;
    visibility: hidden !important;
  }

  .bounded-track::before,
  .bounded-track::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    height: 2px;
    border-radius: 2px;
    transform: translateY(-50%);
    pointer-events: none;
  }
  .bounded-track::before {
    z-index: 0;
    width: 100%;
    background: var(--ink-200);
  }
  .bounded-track::after {
    z-index: 2;
    width: var(--bounded-progress, 0%);
    background: var(--ink-700);
  }
  .bounded-input.is-unmeasured .bounded-track::after { opacity: 0; }
  .bounded-track .bounded-reference-zone {
    top: 50%;
    z-index: 1;
    transform: translateY(-50%);
  }

  .bounded-range,
  .centered-range {
    z-index: 3;
    -webkit-appearance: none;
    appearance: none;
    outline-offset: 2px;
  }
  .bounded-range::-webkit-slider-runnable-track,
  .centered-range::-webkit-slider-runnable-track {
    height: 2px;
    border: 0;
    background: transparent;
  }
  .bounded-range::-moz-range-track,
  .centered-range::-moz-range-track,
  .bounded-range::-moz-range-progress,
  .centered-range::-moz-range-progress {
    height: 2px;
    border: 0;
    background: transparent;
  }
  .bounded-range::-webkit-slider-thumb,
  .centered-range::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    margin-top: -11px;
    border: 1px solid rgba(148,163,184,.52);
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, rgba(71,85,105,.78) 0 1.4px, transparent 1.7px), linear-gradient(145deg, rgba(255,255,255,.72), rgba(255,255,255,.34) 48%, rgba(226,232,240,.22));
    box-shadow: inset 1px 1px 1px rgba(255,255,255,.86), inset -1px -1px 2px rgba(100,116,139,.1), 0 1px 4px rgba(15,23,42,.16);
    -webkit-appearance: none;
    appearance: none;
  }
  .bounded-range::-moz-range-thumb,
  .centered-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border: 1px solid rgba(148,163,184,.52);
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, rgba(71,85,105,.78) 0 1.4px, transparent 1.7px), linear-gradient(145deg, rgba(255,255,255,.72), rgba(255,255,255,.34) 48%, rgba(226,232,240,.22));
    box-shadow: inset 1px 1px 1px rgba(255,255,255,.86), inset -1px -1px 2px rgba(100,116,139,.1), 0 1px 4px rgba(15,23,42,.16);
  }
  .bounded-input.is-unmeasured .bounded-range,
  .centered-half.is-unmeasured .centered-range {
    opacity: 1;
    filter: none;
  }
  .bounded-input.is-unmeasured .bounded-range::-webkit-slider-thumb,
  .centered-half.is-unmeasured .centered-range::-webkit-slider-thumb {
    opacity: 0 !important;
  }
  .bounded-input.is-unmeasured .bounded-range::-moz-range-thumb,
  .centered-half.is-unmeasured .centered-range::-moz-range-thumb {
    opacity: 0 !important;
  }

  .centered-half::before {
    content: '';
    position: absolute;
    z-index: 2;
    top: 15px;
    width: var(--centered-progress, 0%);
    height: 2px;
    border-radius: 2px;
    background: var(--ink-700);
    pointer-events: none;
  }
  .centered-half-left::before { right: 0; }
  .centered-half-right::before { left: 0; }
  .centered-half.is-unmeasured::before { opacity: 0; }
  .centered-half .centered-reference-zone { top: 13px; z-index: 1; }

  [data-mobile-nav-label] {
    scroll-margin-top: calc(var(--mobile-header-height) + var(--mobile-tabs-height) + 60px + env(safe-area-inset-top));
  }
  .mobile-nav-anchor {
    display: block;
    width: 0;
    height: 0;
    overflow: hidden;
  }

  #mobile-quick-nav-toggle,
  #mobile-back-to-top {
    position: fixed;
    z-index: 1040;
    right: 12px;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.18);
    color: #fff;
    background: rgba(15, 23, 42, .9);
    box-shadow: 0 3px 12px rgba(15, 23, 42, .2);
    touch-action: manipulation;
  }
  #mobile-quick-nav-toggle {
    top: calc(6px + env(safe-area-inset-top));
    right: 70px;
    bottom: auto;
    z-index: 1220;
    border-radius: 8px;
    font-size: 22px;
    line-height: 1;
  }
  #mobile-quick-nav-toggle.has-items { display: grid; }
  body.mobile-quick-nav-open #mobile-quick-nav-toggle { opacity: 0; pointer-events: none; }
  #mobile-back-to-top {
    top: calc(6px + env(safe-area-inset-top));
    right: auto;
    left: 8px;
    bottom: auto;
    z-index: 1220;
    border-radius: 50%;
    font-size: 20px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity .15s ease, transform .15s ease;
  }
  #mobile-back-to-top.is-visible { display: grid; opacity: 1; pointer-events: auto; transform: none; }
  body.mobile-quick-nav-open #mobile-back-to-top { opacity: 0; pointer-events: none; }

  #mobile-quick-nav-layer {
    position: fixed;
    z-index: 1030;
    inset: 0;
    display: block;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    contain: strict;
    pointer-events: none;
  }
  body.mobile-quick-nav-open #mobile-quick-nav-layer {
    pointer-events: auto;
  }
  #mobile-quick-nav-backdrop {
    position: absolute;
    z-index: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(0, 0, 0, .2);
    opacity: 0;
    pointer-events: none;
    touch-action: none;
    transition: opacity .18s ease;
  }
  #mobile-quick-nav-panel {
    position: absolute;
    z-index: 1;
    top: calc(var(--mobile-header-height) + var(--mobile-tabs-height) + 10px + env(safe-area-inset-top));
    right: 8px;
    display: flex;
    flex-direction: column;
    width: min(78vw, 300px);
    max-height: min(70vh, calc(100vh - 190px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
    max-height: min(70dvh, calc(100dvh - 190px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    color: #f8fafc;
    background: var(--navy-900);
    box-shadow: 0 12px 28px rgba(3, 7, 18, .28);
    opacity: 0;
    pointer-events: none;
    transform: translate3d(calc(100% + 16px), 0, 0);
    transition: opacity .18s ease, transform .18s ease;
  }
  body.mobile-quick-nav-open #mobile-quick-nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  body.mobile-quick-nav-open #mobile-quick-nav-panel {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }
  .mobile-quick-nav-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 0 8px 0 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    font-size: 15px;
    font-weight: 600;
  }
  #mobile-quick-nav-close {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    color: #cbd5e1;
    background: transparent;
    font-size: 22px;
  }
  #mobile-quick-nav-list {
    min-height: 0;
    padding: 10px 10px 14px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-quick-nav-group {
    display: block;
    width: 100%;
  }
  .mobile-quick-nav-group + .mobile-quick-nav-group { margin-top: 14px; }
  .mobile-quick-nav-group-title {
    display: block;
    padding: 5px 8px 7px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
  }
  .mobile-quick-nav-item {
    display: flex;
    float: none;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 9px 8px;
    border: 0;
    border-radius: 5px;
    color: #f8fafc;
    background: transparent;
    font: 15px/1.3 var(--sans);
    text-align: left;
    white-space: normal;
  }
  .mobile-quick-nav-item:active,
  .mobile-quick-nav-item:focus-visible { color: #bfdbfe; background: rgba(59, 130, 246, .18); }
}

@media (max-width: 430px) {
  .tab-panel.active { padding-right: 8px; padding-left: 8px; }
  .section-body { padding-right: 10px; padding-left: 10px; }
  .rom-table tr { gap: 8px; }
  .centered-reference-label { font-size: 10px; }
}

/* ============ R-45A Assessment workspace simplification ============ */

/* ============ EB-109A exception-only protocol UX ============ */
.protocol-ux-host { margin-top: 8px; }
.protocol-workspace {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
  color: #334155;
}
.protocol-workspace.is-supplemental { border-style: dashed; background: #fafafa; }
.protocol-trial-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.protocol-pain-row,
.protocol-trial {
  min-width: 0;
}
.protocol-trial { border: 1px solid #d7dee8; border-radius: 7px; background: #fff; }
.protocol-trial[data-status="invalid"] { border-color: #dfbd7c; background: #fffdfa; }
.protocol-condition-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.protocol-condition-title { min-width: 0; font-size: 12px; font-weight: 700; color: #334155; }
.protocol-group-pain-toggle,
.protocol-trial-menu-toggle,
.protocol-add-trial {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #475569;
  background: #fff;
  font: 600 11px/1.2 var(--sans);
  cursor: pointer;
}
.protocol-group-pain-bar { display: flex; justify-content: flex-end; }
.protocol-group-pain-toggle { flex: 0 0 auto; border-color: transparent; color: #7c3f63; background: transparent; }
.protocol-group-pain-toggle.has-pain { background: #fbf4f8; }
.protocol-trial-menu-toggle { min-width: 38px; padding: 4px 8px; font-size: 16px; letter-spacing: 2px; }
.protocol-group-pain-toggle:hover,
.protocol-trial-menu-toggle:hover,
.protocol-add-trial:hover { border-color: #94a3b8; background: #f8fafc; }
.protocol-group-pain-toggle[aria-expanded="true"],
.protocol-trial-menu-toggle[aria-expanded="true"] { border-color: #b7bec9; background: #f1f3f6; }
.protocol-group-pain-panel,
.protocol-trial-exception {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}
.protocol-group-pain-panel[hidden],
.protocol-trial-exception[hidden],
.protocol-pain-detail[hidden] { display: none; }
.protocol-group-pain-panel {
  grid-template-columns: minmax(0, 1fr);
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #fff;
}
.protocol-group-pain-heading { font-size: 11px; font-weight: 700; color: #64748b; }
.protocol-pain-row {
  display: grid;
  grid-template-columns: minmax(170px, .8fr) minmax(260px, 1.6fr);
  align-items: start;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #edf0f3;
}
.protocol-pain-row .protocol-condition-title { padding-top: 8px; }
.protocol-pain-fields {
  display: grid;
  grid-template-columns: minmax(130px, .8fr) minmax(220px, 1.2fr);
  gap: 7px;
}
.protocol-pain-row label,
.protocol-trial label { display: grid; gap: 3px; min-width: 0; font-size: 11px; color: #64748b; }
.protocol-pain-row select,
.protocol-pain-row input,
.protocol-trial select,
.protocol-trial input {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 5px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  color: #334155;
  font-size: 12px;
}
.protocol-pain-row input[type="checkbox"],
.protocol-trial input[type="checkbox"] { width: 16px; min-height: 16px; padding: 0; }
.protocol-pain-detail:not([hidden]) { display: grid; gap: 7px; }
.protocol-state-note { min-height: 0; margin-top: 4px; font-size: 11px; line-height: 1.4; color: #64748b; }
.protocol-state-note:empty { display: none; }
.protocol-state-note.pain { color: #7c3f63; }
.protocol-ux-panel > summary {
  min-height: 34px;
  padding: 7px 9px;
  cursor: pointer;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}
.protocol-ux-panel { border-top: 1px solid #e2e8f0; color: #475569; }
.protocol-summary { padding: 0 9px 5px; font-size: 11px; font-weight: 600; }
.protocol-requirements { margin: 0 9px 5px; padding-left: 18px; font-size: 11px; line-height: 1.55; color: #64748b; }
.protocol-isa-trials { display: grid; gap: 8px; }
.protocol-trial-measurements {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto auto;
  align-items: end;
  gap: 7px;
}
.protocol-trial-excursion { align-self: center; min-width: 64px; color: #64748b; font: 11px var(--mono); }
.protocol-trial-invalid { display: flex !important; align-items: center; gap: 7px !important; min-height: 34px; }
.protocol-familiarization {
  display: flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  margin: 0;
  color: #64748b;
  font-size: 11px;
}
.protocol-familiarization input { width: 16px; height: 16px; }
.protocol-familiarization span { color: #94a3b8; }
.protocol-isa-result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  color: #475569;
  background: #eef1f5;
  font-size: 12px;
}
.protocol-isa-result strong { color: #475569; font-size: 18px; }
.protocol-isa-result strong[data-ready="true"] { color: #326d5c; }
.protocol-add-trial { justify-self: start; min-height: 36px; }
.protocol-add-trial[hidden] { display: none; }
.protocol-trial-hint { font-size: 11px; line-height: 1.45; color: #64748b; }

@media (max-width: 768px) {
  .protocol-trial-grid { grid-template-columns: minmax(0, 1fr); }
  .protocol-group-pain-panel,
  .protocol-trial-exception { grid-template-columns: minmax(0, 1fr); }
  .protocol-group-pain-toggle,
  .protocol-trial-menu-toggle,
  .protocol-add-trial { min-height: 44px; }
  .protocol-pain-row,
  .protocol-pain-fields { grid-template-columns: minmax(0, 1fr); }
  .protocol-pain-row .protocol-condition-title { padding-top: 0; }
  .protocol-trial-measurements { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .protocol-trial-excursion { align-self: center; }
  .protocol-trial-menu-toggle { justify-self: end; min-width: 44px; }
  .protocol-ux-panel > summary { min-height: 44px; }
  .rom-group-heading,
  .rom-group-expander-row {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
    border-bottom: 0 !important;
  }
  .rom-group-heading { padding: 12px 0 2px !important; }
  .rom-group-heading td:first-child,
  .rom-group-expander-row td:first-child {
    grid-column: 1 / -1;
    min-height: 0;
    padding-right: 0;
  }
  .rom-group-expander-row { padding: 0 0 6px !important; }
  .rom-group-expander {
    width: 100%;
    min-height: 44px;
    padding: 8px 0;
    text-align: left;
    touch-action: manipulation;
  }
  .thor-comparison summary,
  .report-data-quality summary { min-height: 44px; }
  .report-data-quality summary { gap: 12px; padding-right: 12px; padding-left: 12px; }
  .report-data-quality-status { text-align: right; }
}

/* ============ EB-108C Application shell / navigation ============ */
@media (min-width: 769px) {
  #sidebar {
    width: 264px;
    min-width: 264px;
    overflow-x: hidden;
    transition: width .2s ease, min-width .2s ease;
  }
  #sidebar.collapsed {
    width: 84px;
    min-width: 84px;
    padding: 0;
    border-right: 1px solid #000;
    overflow: hidden;
  }
  #sidebar-header { padding: 16px 14px 14px; }
  .sidebar-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .sidebar-title-row h2 { min-width: 0; margin: 0; }
  #sidebarToggle {
    display: inline-grid;
    place-items: center;
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    color: #cbd5e1;
    background: rgba(255,255,255,.05);
    font: 600 12px var(--sans);
    cursor: pointer;
  }
  #sidebarToggle:hover { color: #fff; background: rgba(255,255,255,.1); }
  #sidebar.collapsed #sidebar-header { padding-inline: 12px; }
  #sidebar.collapsed .sidebar-title-row { flex-direction: column; }
  #sidebar.collapsed .sidebar-brand-label { display: none; }
  #sidebar.collapsed .sidebar-brand-mark { width: 32px; height: 34px; }
  #sidebar.collapsed #btn-new-client {
    display: grid;
    place-items: center;
    width: 48px;
    height: 44px;
    margin: 12px auto 0;
    padding: 0;
    font-size: 0;
  }
  #sidebar.collapsed #btn-new-client::before { content: '+'; font-size: 24px; line-height: 1; }
  #sidebar.collapsed #client-list { display: none; }
  #sidebar.collapsed #sidebar-current-context {
    width: calc(100% - 16px);
    margin: 12px 8px;
    padding: 10px 5px;
    text-align: center;
  }
  #sidebar.collapsed .sidebar-current-kicker { font-size: 8px; letter-spacing: .03em; }
  #sidebar.collapsed #sidebar-current-name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.3;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  #sidebar.collapsed #sidebar-current-session { display: none; }
}

#sidebar-current-context {
  width: calc(100% - 24px);
  margin: 12px 12px 4px;
  padding: 10px 12px;
  border: 1px solid rgba(96,165,250,.32);
  border-radius: 8px;
  color: #f8fafc;
  background: rgba(30,64,175,.18);
  text-align: left;
  font-family: var(--sans);
  cursor: pointer;
}
#sidebar-current-context[hidden] { display: none; }
.sidebar-current-kicker,
#sidebar-current-name,
#sidebar-current-session { display: block; }
.sidebar-current-kicker {
  margin-bottom: 5px;
  color: #93c5fd;
  font: 700 9px var(--mono);
  letter-spacing: .09em;
}
#sidebar-current-name {
  overflow: hidden;
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#sidebar-current-session {
  overflow: hidden;
  margin-top: 3px;
  color: #94a3b8;
  font: 10px var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.client-item .client-name { max-width: 196px; font-size: 14px; font-weight: 600; }
.client-item .client-meta { color: #64748b; opacity: .78; }

.tab-panel.active { max-width: 1180px; padding-top: 18px; }
.tab-btn { color: var(--ink-400); }
.tab-btn.active { color: var(--ink-900); background: #fafafa; border-bottom-color: var(--accent); }
#topbar { padding-inline: 18px; }
#topbar-right { gap: 8px; }
#top-context {
  display: grid;
  grid-template-columns: auto auto;
  align-content: center;
  column-gap: 8px;
  min-width: 184px;
  max-width: 244px;
  height: 42px;
  padding: 5px 10px;
  border-left: 1px solid var(--ink-200);
}
#top-context[hidden] { display: none; }
.top-context-kicker {
  grid-column: 1 / -1;
  color: var(--ink-400);
  font: 700 8px var(--mono);
  letter-spacing: .08em;
}
.top-context-main {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-500);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#client-title { padding: 0; border: 0; color: var(--ink-900); background: transparent; font-size: 12px; }
.top-context-separator { padding-inline: 4px; color: var(--ink-300); }
#client-session-date { font-family: var(--mono); }
#assessment-state {
  align-self: center;
  padding: 2px 6px;
  border-radius: 999px;
  color: #326d5c;
  background: #e4f2ed;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}
#session-selector-bar {
  position: relative;
  top: auto;
  z-index: auto;
  min-height: 42px;
  padding-block: 5px;
  background: #fafafa;
}

#assessment-section-nav {
  position: sticky;
  z-index: 92;
  top: 60px;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 42px;
  margin: -4px 0 12px;
  padding: 5px 7px;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 4px 12px rgba(15,23,42,.05);
  backdrop-filter: blur(8px);
}
.assessment-section-nav-label {
  padding: 0 8px;
  color: var(--ink-400);
  font: 700 9px var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
#assessment-section-nav button {
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: 5px;
  color: var(--ink-500);
  background: transparent;
  font: 600 11px var(--sans);
  cursor: pointer;
}
#assessment-section-nav button:hover { color: var(--ink-900); background: var(--ink-100); }
#assessment-section-nav button.active { color: #1e40af; background: #eef2ff; }
#assessment-core-tests,
#assessment-supporting-tests,
#assessment-integrated-validation,
#assessment-further-validation { scroll-margin-top: 112px; }

[data-legacy-structure-presentation] { display: none !important; }
#panel-1 .priority-tag,
#panel-1 .assessment-scope-tag,
#panel-1 .module-tag { display: none !important; }
#assessment-clinical-workflow { display: grid; gap: 28px; }
.structure-workflow-group { min-width: 0; }
.structure-workflow-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 12px;
  padding: 0 2px 9px;
  border-bottom: 1px solid var(--ink-200);
}
.structure-workflow-heading h2 { color: var(--ink-900); font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.structure-workflow-heading p { color: var(--ink-400); font-size: 11px; }
.structure-workflow-core > .structure-workflow-heading { border-bottom-color: #cfd7e5; }
.structure-workflow-supporting > .structure-workflow-heading,
.structure-workflow-integrated > .structure-workflow-heading { margin-bottom: 10px; }
.structure-workflow-supporting > .structure-workflow-heading h2,
.structure-workflow-integrated > .structure-workflow-heading h2 { font-size: 16px; }
.structure-workflow-group-body { display: grid; min-width: 0; gap: 12px; }
.structure-workflow-item { min-width: 0; margin-bottom: 0; }
#assessment-core-thorax > .section-body,
#assessment-core-lower-rom > .section-body,
#assessment-core-upper-rom > .section-body {
  border-top: 1px solid #dfe3e8;
  border-radius: 8px;
}
.structure-workflow-supporting > .structure-workflow-group-body {
  padding: 12px;
  border: 1px solid #e4e1d9;
  border-radius: 10px;
  background: rgba(250, 249, 246, .84);
}
.structure-workflow-supporting #assessment-apley,
.structure-workflow-supporting #assessment-squat {
  margin: 0 !important;
  padding: 14px;
  border: 1px solid var(--ink-100) !important;
  border-radius: 8px;
  background: #fff;
}
.structure-workflow-supporting .module-header,
.structure-workflow-integrated .module-header { background: #f0f2f4; }
.structure-workflow-integrated > .structure-workflow-group-body { gap: 10px; }

#panel-1 .module-header {
  border: 1px solid #dfe3e8;
  border-bottom: 0;
  color: var(--ink-900);
  background: #eef0f3;
}
#panel-1 .module-header .module-title-cn { color: var(--ink-900); font-size: 15px; }
#panel-1 .module-header .module-title-en { color: var(--ink-500); }
#panel-1 .module-header .info-tip { color: var(--ink-500); background: #fff; }
#panel-1 .section-title {
  border: 1px solid #dfe3e8;
  color: var(--ink-700);
  background: #f0f2f4;
}
#panel-1 .section-title .collapsible-arrow { color: var(--ink-500) !important; }
#panel-1 .section-body { border-color: #dfe3e8; }
.assessment-scope-tag {
  padding: 2px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #475569;
  background: #fff;
  font-size: 9px;
  font-weight: 700;
}
.assessment-group-label {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 0 0 8px;
  padding: 5px 0 7px;
  border-bottom: 1px solid var(--ink-100);
}
.assessment-group-label span { color: var(--ink-700); font: 700 10px var(--mono); letter-spacing: .05em; text-transform: uppercase; }
.assessment-group-label small { color: var(--ink-400); font-size: 10px; }
.assessment-group-label.additional { margin-top: 18px; border-bottom-color: #eadfca; }
.assessment-group-label.additional span { color: #8a5b12; }

.supplemental-intro {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 3px 10px;
  margin-bottom: 4px;
  padding: 14px 16px;
  border: 1px solid #eadfca;
  border-radius: 8px;
  background: #fffdfa;
}
.supplemental-intro-kicker { grid-column: 1 / -1; color: #a16207; font: 700 9px var(--mono); letter-spacing: .08em; }
.supplemental-intro strong { color: var(--ink-900); font-size: 15px; }
.supplemental-intro p { color: var(--ink-500); font-size: 12px; line-height: 1.5; }
#panel-supp .section-title { border: 1px solid #e1e4e8; color: var(--ink-700); background: #f1f3f5; }
#panel-supp .section-title .collapsible-arrow { color: var(--ink-500) !important; }
.structure-workflow-further { padding-top: 4px; }
.structure-workflow-further:not([data-structure-mounted]) { display: none; }
.further-validation-disclosure {
  overflow: hidden;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  background: #fff;
}
.further-validation-disclosure > summary {
  display: flex;
  min-height: 64px;
  padding: 12px 16px;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-700);
  background: #f7f8fa;
  cursor: pointer;
  list-style: none;
}
.further-validation-disclosure > summary::-webkit-details-marker { display: none; }
.further-validation-disclosure > summary > span:first-child { display: grid; gap: 3px; }
.further-validation-disclosure > summary strong { color: var(--ink-900); font-size: 16px; }
.further-validation-disclosure > summary small { color: var(--ink-400); font-size: 11px; font-weight: 500; }
.further-validation-disclosure > summary > span:last-child { color: var(--ink-400); font-size: 22px; transition: transform .2s ease; }
.further-validation-disclosure[open] > summary > span:last-child { transform: rotate(90deg); }
.further-validation-body { display: grid; gap: 10px; padding: 12px; border-top: 1px solid var(--ink-200); }

@media (min-width: 769px) and (max-width: 1360px) {
  .tab-btn { padding-inline: 12px; font-size: 13px; }
  #top-context { min-width: 164px; max-width: 204px; }
  .user-name { display: none; }
}

@media (max-width: 768px) {
  #sidebarToggle { display: none !important; }
  body.mobile-drawer-open #mobile-quick-nav-toggle,
  body.mobile-drawer-open #mobile-back-to-top {
    opacity: 0;
    pointer-events: none;
  }
  #sidebar-current-context { min-height: 66px; }
  #session-selector-bar { position: relative; top: auto; z-index: auto; }
  #assessment-section-nav {
    position: relative;
    top: auto;
    z-index: auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    min-height: 0;
    margin: 0 0 8px;
    padding: 5px;
    box-shadow: none;
    backdrop-filter: none;
  }
  .assessment-section-nav-label { display: none; }
  #assessment-section-nav .desktop-only-section-link { display: none; }
  #assessment-section-nav button { min-width: 0; min-height: 40px; padding: 5px 3px; font-size: 10px; }
  #assessment-core-tests,
  #assessment-supporting-tests,
  #assessment-integrated-validation,
  #assessment-further-validation { scroll-margin-top: calc(var(--mobile-header-height) + var(--mobile-tabs-height) + 12px + env(safe-area-inset-top)); }
  #assessment-clinical-workflow { gap: 22px; }
  .structure-workflow-heading { display: block; padding-inline: 1px; }
  .structure-workflow-heading h2 { font-size: 17px; }
  .structure-workflow-heading p { margin-top: 3px; line-height: 1.45; }
  .structure-workflow-supporting > .structure-workflow-group-body { padding: 8px; }
  .assessment-group-label { align-items: flex-start; flex-direction: column; gap: 2px; }
  .supplemental-intro { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  #panel-1 .module-header .module-title-en { color: var(--ink-400); }
}

/* ============ EB-108D Result / report information architecture ============ */
#report-container {
  min-width: 0;
  overflow: hidden;
}
.report-summary,
.report-key-findings,
.report-limitations,
.report-next-step,
.report-working-model-summary,
.report-evidence-details,
.report-technical-details {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-bottom: 14px;
  border: 1px solid #dfe3e8;
  border-radius: 10px;
  background: #fff;
}
.report-summary { padding: 22px; border-top: 3px solid var(--ink-900); }
.report-section-kicker {
  margin-bottom: 6px;
  color: var(--ink-400);
  font: 700 9px var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.report-summary-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.report-summary h1,
.report-key-findings h2,
.report-limitations h2,
.report-next-step h2,
.report-working-model-summary h2 {
  margin: 0;
  color: var(--ink-900);
  line-height: 1.25;
}
.report-summary h1 { font-size: 24px; }
.report-summary-heading p,
.report-next-step p { margin: 6px 0 0; color: var(--ink-500); font-size: 13px; line-height: 1.55; }
.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  background: var(--ink-200);
}
.report-summary-grid > div { min-width: 0; padding: 11px 12px; background: #fafafa; }
.report-summary-grid span,
.report-working-model-grid span { display: block; margin-bottom: 5px; color: var(--ink-400); font-size: 10px; }
.report-summary-grid strong,
.report-working-model-grid strong { display: block; overflow-wrap: anywhere; color: var(--ink-800); font-size: 12px; line-height: 1.45; }
.report-status-strip { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.report-status-strip span { padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 650; }
.report-status-strip .is-good { color: #166534; background: #ecfdf5; }
.report-status-strip .is-caution { color: #92400e; background: #fffbeb; }

.report-key-findings,
.report-limitations,
.report-working-model-summary { padding: 18px 20px; }
.report-key-findings h2,
.report-limitations h2,
.report-next-step h2,
.report-working-model-summary h2 { font-size: 17px; }
.report-finding { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 10px; margin-top: 12px; padding: 12px 14px; border-radius: 7px; }
.report-finding > span { align-self: start; color: var(--ink-500); font: 700 10px var(--mono); }
.report-finding.primary { border-left: 3px solid var(--accent); background: #f5f8ff; }
.report-finding.secondary { background: #fafafa; color: var(--ink-700); font-size: 13px; }
.report-finding strong { color: var(--ink-900); font-size: 14px; }
.report-finding p { margin: 4px 0 0; color: var(--ink-600); font-size: 12px; line-height: 1.55; }

.report-evidence-details > summary,
.report-technical-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 64px;
  padding: 0 18px;
  cursor: pointer;
  list-style: none;
}
.report-evidence-details > summary::-webkit-details-marker,
.report-technical-details > summary::-webkit-details-marker { display: none; }
.report-evidence-details summary strong,
.report-technical-details summary strong { display: block; color: var(--ink-900); font-size: 14px; }
.report-evidence-details summary small,
.report-technical-details summary small { display: block; margin-top: 3px; color: var(--ink-400); font-size: 11px; font-weight: 400; }
.report-details-state { flex: 0 0 auto; color: var(--accent); font-size: 11px; font-weight: 700; }
.report-evidence-details[open] > summary .report-details-state::before,
.report-technical-details[open] > summary .report-details-state::before { content: '收起'; }
.report-evidence-details:not([open]) > summary .report-details-state::before,
.report-technical-details:not([open]) > summary .report-details-state::before { content: '展开'; }
.report-details-state { font-size: 0; }
.report-details-state::before { font-size: 11px; }
.report-evidence-body,
.report-technical-body { padding: 14px; border-top: 1px solid var(--ink-200); background: #fbfbfb; }
.report-evidence-body > :last-child { margin-bottom: 0 !important; }
.report-evidence-body div,
.report-evidence-body p,
.report-evidence-body span,
.report-technical-body div,
.report-technical-body span { overflow-wrap: anywhere; word-break: break-word; }

.report-limitations-summary { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; color: var(--ink-600); font-size: 12px; }
.report-limitations > ul,
.report-limitations > p { margin: 10px 0 0; color: var(--ink-600); font-size: 12px; line-height: 1.6; }
.report-limitations .report-data-quality { margin-top: 12px; margin-bottom: 0; }
.report-next-step { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; background: #f8fafc; }
.report-plan-cta { flex: 0 0 auto; min-height: 42px; padding: 0 16px; border: 1px solid var(--ink-900); border-radius: 7px; color: #fff; background: var(--ink-900); font: 650 13px var(--sans); cursor: pointer; }
.report-plan-cta:hover { background: var(--accent); border-color: var(--accent); }

.report-working-model-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.report-working-model-grid > div { min-width: 0; padding: 10px 12px; border: 1px solid var(--ink-200); border-radius: 7px; background: #fafafa; }
.report-working-model-details,
.report-conflict-details { margin-bottom: 10px; border: 1px solid var(--ink-200); border-radius: 7px; background: #fff; }
.report-working-model-details > summary,
.report-conflict-details > summary { min-height: 44px; padding: 0 12px; cursor: pointer; color: var(--ink-700); font-size: 12px; font-weight: 700; }
.report-technical-list,
.report-conflict-details > div { padding: 0 12px 12px; }
.report-technical-list > div { display: grid; gap: 3px; padding: 8px 0; border-top: 1px solid var(--ink-100); font-size: 11px; }
.report-technical-list span { color: var(--ink-500); overflow-wrap: anywhere; }
.report-empty-state .report-placeholder { padding: 32px 20px; border: 1px solid var(--ink-200); border-radius: 8px; background: #fff; }
.report-empty-state .report-placeholder strong { color: var(--ink-700); }
.report-empty-state .report-placeholder span { display: inline-block; margin-top: 5px; }
#pmp-debug-panel { max-width: 100%; overflow: hidden; }
#pmp-debug-panel pre { max-width: 100%; overflow-x: auto; }

@media (max-width: 980px) {
  .report-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-summary-grid > div:last-child { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  #report-container,
  #report-container * { min-width: 0; }
  .report-summary { padding: 17px 14px; }
  .report-summary-heading { display: block; }
  .report-summary-heading > .confidence-badge { margin: 10px 0 0; }
  .report-summary h1 { font-size: 20px; }
  .report-summary-grid { grid-template-columns: minmax(0, 1fr); }
  .report-summary-grid > div:last-child { grid-column: auto; }
  .report-key-findings,
  .report-limitations,
  .report-working-model-summary { padding: 16px 14px; }
  .report-finding { grid-template-columns: 42px minmax(0, 1fr); padding: 11px; }
  .report-next-step { align-items: stretch; flex-direction: column; padding: 16px 14px; }
  .report-plan-cta { width: 100%; }
  .report-working-model-grid { grid-template-columns: minmax(0, 1fr); }
  .report-evidence-details > summary,
  .report-technical-details > summary { min-height: 60px; padding: 0 13px; }
  .report-evidence-body,
  .report-technical-body { padding: 10px; }
  .report-evidence-body svg,
  .report-evidence-body img { max-width: 100%; height: auto; }
  .report-evidence-body pre { max-width: 100%; overflow-x: auto; }
}

/* ============ EB-108E Evidence / technical detail decomposition ============ */
.report-evidence-architecture { min-width: 0; }
.report-evidence-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  background: var(--ink-200);
}
.report-evidence-summary > div { min-width: 0; padding: 10px 12px; background: #fff; }
.report-evidence-summary strong { display: block; color: var(--ink-900); font-size: 17px; }
.report-evidence-summary span { display: block; margin-top: 2px; color: var(--ink-400); font-size: 10px; }
.report-evidence-group {
  min-width: 0;
  padding: 18px 2px;
  border-top: 1px solid var(--ink-200);
}
.report-evidence-group-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}
.report-evidence-group-heading span { color: var(--ink-400); font: 700 9px var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.report-evidence-group-heading h3 { margin: 3px 0 0; color: var(--ink-900); font-size: 15px; }
.report-evidence-group-heading p { max-width: 430px; margin: 0; color: var(--ink-400); font-size: 11px; line-height: 1.45; text-align: right; }
.report-evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.report-evidence-card {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #e3e6ea;
  border-radius: 8px;
  background: #fff;
}
.report-evidence-card.supplemental { background: #f8fafc; }
.report-evidence-card-title { margin-bottom: 9px; color: var(--ink-700); font-size: 12px; font-weight: 700; }
.report-evidence-pair,
.report-evidence-triplet { display: grid; gap: 1px; overflow: hidden; border: 1px solid var(--ink-200); border-radius: 6px; background: var(--ink-200); }
.report-evidence-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.report-evidence-triplet { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.report-evidence-pair > div,
.report-evidence-triplet > div { min-width: 0; padding: 7px 9px; background: #fafafa; }
.report-evidence-pair span,
.report-evidence-triplet span { display: block; color: var(--ink-400); font-size: 9px; }
.report-evidence-pair strong,
.report-evidence-triplet strong { display: block; margin-top: 2px; color: var(--ink-900); font-size: 15px; line-height: 1.25; }
.report-evidence-single-result { padding: 8px 9px; border-radius: 6px; color: var(--ink-800); background: #f3f4f6; font-size: 13px; }
.report-evidence-related { display: grid; gap: 3px; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--ink-100); }
.report-evidence-related span { color: var(--ink-400); font-size: 9px; }
.report-evidence-related strong { color: var(--ink-700); font-size: 11px; line-height: 1.45; }
.report-evidence-provenance,
.report-evidence-local-note { margin-top: 7px; color: var(--ink-400); font-size: 10px; line-height: 1.45; }
.report-evidence-local-note { color: #8a5b12; }
.report-evidence-validation-rows { display: grid; gap: 8px; }
.report-evidence-validation-rows > div > span { display: block; margin-bottom: 4px; color: var(--ink-500); font-size: 10px; }
.report-evidence-inline-list { display: flex; flex-wrap: wrap; gap: 5px; }
.report-evidence-inline-list span { padding: 3px 7px; border-radius: 4px; color: var(--ink-600); background: var(--ink-100); font-size: 10px; }
.report-evidence-empty { padding: 14px; border-radius: 7px; color: var(--ink-400); background: #f8fafc; font-size: 11px; }

.report-finding-list { display: grid; gap: 6px; }
.report-finding-detail { border-bottom: 1px solid var(--ink-200); background: #fff; }
.report-finding-detail > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  padding: 9px 10px;
  cursor: pointer;
  list-style: none;
}
.report-finding-detail > summary::-webkit-details-marker { display: none; }
.report-finding-detail summary > span:first-child { min-width: 0; }
.report-finding-detail small { display: block; color: var(--ink-400); font-size: 9px; }
.report-finding-detail strong { display: block; margin-top: 3px; color: var(--ink-800); font-size: 12px; line-height: 1.4; }
.report-finding-detail summary p {
  display: -webkit-box;
  overflow: hidden;
  margin: 4px 0 0;
  color: var(--ink-500);
  font-size: 10px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.report-finding-action { flex: 0 0 auto; color: var(--accent); font-size: 10px; font-weight: 700; }
.report-finding-detail[open] .report-finding-action { font-size: 0; }
.report-finding-detail[open] .report-finding-action::after { content: '收起'; font-size: 10px; }
.report-finding-detail > div { padding: 11px 10px 13px; border-top: 1px solid var(--ink-100); color: var(--ink-600); font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.report-finding-detail.static { display: grid; gap: 3px; padding: 11px 10px; }

.report-legacy-narrative { margin-top: 12px; border: 1px solid var(--ink-200); border-radius: 8px; background: #fff; }
.report-legacy-narrative > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 0 14px;
  cursor: pointer;
  list-style: none;
}
.report-legacy-narrative > summary::-webkit-details-marker { display: none; }
.report-legacy-narrative summary strong { display: block; color: var(--ink-800); font-size: 13px; }
.report-legacy-narrative summary small { display: block; margin-top: 3px; color: var(--ink-400); font-size: 10px; font-weight: 400; }
.report-legacy-narrative[open] > summary .report-details-state::before { content: '收起'; }
.report-legacy-narrative:not([open]) > summary .report-details-state::before { content: '展开'; }
.report-legacy-narrative-body { min-width: 0; padding: 12px; border-top: 1px solid var(--ink-200); background: #fbfbfb; }

.report-data-quality-trace-details,
.report-evidence-trace-details { margin-bottom: 10px; border: 1px solid var(--ink-200); border-radius: 7px; background: #fff; }
.report-data-quality-trace-details > summary,
.report-evidence-trace-details > summary { min-height: 44px; padding: 0 12px; cursor: pointer; color: var(--ink-700); font-size: 12px; font-weight: 700; }
.report-data-quality-trace-details > div,
.report-evidence-trace-details > div { padding: 0 12px 12px; }
.report-technical-trace { font-size: 11px; line-height: 1.65; }
.report-technical-list code { display: block; color: var(--ink-500); font: 10px/1.5 var(--mono); overflow-wrap: anywhere; white-space: normal; }

@media (max-width: 768px) {
  .report-evidence-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-evidence-summary > div { padding: 8px; }
  .report-evidence-group { padding: 15px 0; }
  .report-evidence-group-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .report-evidence-group-heading p { max-width: none; text-align: left; }
  .report-evidence-grid { grid-template-columns: minmax(0, 1fr); }
  .report-evidence-card { padding: 12px; }
  .report-evidence-pair,
  .report-evidence-triplet { width: 100%; }
  .report-evidence-pair strong,
  .report-evidence-triplet strong { font-size: 14px; }
  .report-finding-detail > summary { min-height: 48px; padding: 9px 7px; }
  .report-finding-action { min-width: 54px; text-align: right; }
  .report-legacy-narrative > summary { min-height: 52px; padding: 0 10px; }
  .report-legacy-narrative-body { padding: 8px; }
  .report-legacy-narrative-body,
  .report-legacy-narrative-body * { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .report-technical-list code { overflow-x: auto; }
}

/* ============ EB-108E Global shell, reference display and compact ISA ============ */
.sidebar-tools {
  flex: 0 0 auto;
  display: grid;
  gap: 7px;
  padding: 10px 12px 0;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-tools button,
.sidebar-admin-tools button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  color: #e2e8f0;
  background: rgba(255,255,255,.05);
  font: 500 11px var(--sans);
  text-align: left;
  cursor: pointer;
}
.sidebar-tools button:first-child { justify-content: center; color: #fff; background: #1d4ed8; }
.sidebar-tools button:disabled { opacity: .38; cursor: default; }
.sidebar-admin-tools {
  flex: 0 0 auto;
  display: grid;
  gap: 7px;
  padding: 10px 12px 0;
  color: #e2e8f0;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-admin-tools[hidden] { display: none !important; }
.sidebar-admin-tools h3 { margin: 0; font-size: 12px; }
.sidebar-admin-tools button > span:first-child {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 5px;
  color: #bfdbfe;
  background: rgba(37,99,235,.25);
  font-size: 10px;
  font-weight: 800;
}
.user-menu-version { padding: 8px 10px 2px; color: #94a3b8; font: 9px var(--mono); }
#sidebar.collapsed .sidebar-tools { display: none; }
#sidebar.collapsed .sidebar-admin-tools { padding: 10px 14px; }
#sidebar.collapsed .sidebar-admin-tools h3,
#sidebar.collapsed .sidebar-admin-tools button > span:last-child { display: none; }
#sidebar.collapsed .sidebar-admin-tools button { min-height: 44px; padding: 0; justify-content: center; }

.global-more-wrap { position: relative; }
#global-more-button {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  color: var(--ink-700);
  background: #fff;
  font: 600 11px var(--sans);
  cursor: pointer;
}
#global-more-menu {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 6px);
  right: 0;
  display: none;
  width: 176px;
  padding: 6px;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15,23,42,.16);
}
body.global-more-open #global-more-menu { display: block; }
#global-more-menu button { width: 100%; min-height: 36px; padding: 7px 9px; border: 0; border-radius: 5px; color: var(--ink-700); background: transparent; font: 500 12px var(--sans); text-align: left; cursor: pointer; }
#global-more-menu button:hover { background: var(--ink-100); }

.report-page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  background: #fff;
}
.report-page-toolbar div { display: grid; gap: 2px; }
.report-page-toolbar strong { color: var(--ink-900); font-size: 13px; }
.report-page-toolbar span { color: var(--ink-400); font-size: 10px; }
.report-page-toolbar button { min-height: 36px; padding: 0 12px; border: 1px solid var(--ink-900); border-radius: 6px; color: #fff; background: var(--ink-900); font: 600 11px var(--sans); cursor: pointer; }

.case-library-shell { border: 1px solid var(--ink-200); background: #fff; }
.case-library-shell > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 10px 14px;
  list-style: none;
  cursor: pointer;
}
.case-library-shell > summary::-webkit-details-marker { display: none; }
.case-library-shell > summary span:first-child { display: grid; gap: 3px; }
.case-library-shell > summary strong { color: var(--ink-900); font-size: 13px; }
.case-library-shell > summary small { color: var(--ink-400); font-size: 10px; font-weight: 400; }
.case-library-action { flex: 0 0 auto; color: var(--accent); font-size: 11px; font-weight: 700; }
.case-library-shell[open] > summary { border-bottom: 1px solid var(--ink-200); }
.case-library-shell[open] .case-library-action { font-size: 0; }
.case-library-shell[open] .case-library-action::after { content: '收起案例库'; font-size: 11px; }

.rom-group-heading-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-controls { display: inline-flex; align-items: center; gap: 4px; }

.mobile-basic-actions { display: none; }
#structure-page-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 10px;
  padding: 7px 9px;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  background: #f8fafc;
}
#structure-page-toolbar .structure-toolbar-label { margin-right: auto; color: var(--ink-500); font: 700 10px var(--sans); letter-spacing: .04em; }
#structure-page-toolbar .structure-toolbar-group { display: inline-flex; align-items: center; gap: 4px; }
#structure-page-toolbar .structure-tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: auto;
  min-width: 0;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  color: var(--ink-700);
  background: rgba(255,255,255,.92);
  box-shadow: 0 1px 1px rgba(15,23,42,.03);
  font: 600 10px var(--sans);
  cursor: pointer;
}
#structure-page-toolbar .history-controls .structure-tool-button > span[aria-hidden] { font-size: 15px; line-height: 1; }
#structure-page-toolbar .structure-tool-button:hover:not(:disabled) { border-color: var(--ink-400); background: #fff; }
#structure-page-toolbar .structure-tool-button:focus-visible { outline: 2px solid rgba(71,85,105,.28); outline-offset: 2px; }
#structure-page-toolbar .structure-tool-button:disabled { color: var(--ink-300); background: rgba(248,250,252,.76); box-shadow: none; cursor: default; opacity: .62; }

.isa-compact-card {
  display: block;
  width: 100%;
  margin: 0 0 14px;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  background: #fff;
  overflow: visible;
}
.isa-measurement-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 16px;
  min-height: 50px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--ink-100);
}
.isa-summary-title { flex: 0 0 auto; color: var(--ink-900); font-size: 13px; font-weight: 700; }
.isa-summary-values { min-width: 0; overflow: hidden; color: var(--ink-500); font: 10px var(--mono); text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.isa-measurement-header > .info-tip { justify-self: end; }
.isa-compact-card > .isa-input-row { padding: 12px 12px 4px; }
.isa-compact-card > #isa-range-error,
.isa-compact-card > #isa-interp { margin-right: 12px; margin-left: 12px; }
.isa-protocol-disclosure { margin: 10px 12px 12px; border: 1px solid var(--ink-200); border-radius: 7px; background: #fafafa; overflow: hidden; }
.isa-protocol-disclosure > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; min-height: 46px; padding: 8px 10px; list-style: none; cursor: pointer; }
.isa-protocol-disclosure > summary::-webkit-details-marker { display: none; }
.isa-protocol-disclosure > summary::after { content: '›'; grid-column: 2; grid-row: 1 / span 2; color: var(--ink-400); font-size: 18px; transition: transform .15s ease; }
.isa-protocol-disclosure[open] > summary::after { transform: rotate(90deg); }
.isa-protocol-disclosure > summary span { color: var(--ink-800); font-size: 12px; font-weight: 700; }
.isa-protocol-disclosure > summary small { min-width: 0; overflow: hidden; color: var(--ink-400); font: 9px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.isa-protocol-disclosure[open] > summary { border-bottom: 1px solid var(--ink-200); background: #fff; }
.isa-protocol-disclosure > .protocol-ux-host { margin: 10px; }

.protocol-trial { padding: 0; overflow: hidden; }
.protocol-trial > summary { min-height: 46px; margin: 0; padding: 8px 9px; list-style: none; cursor: pointer; }
.protocol-trial > summary::-webkit-details-marker { display: none; }
.protocol-trial-summary::before { content: '›'; flex: 0 0 auto; color: var(--ink-400); font-size: 15px; transition: transform .15s ease; }
.protocol-trial[open] > .protocol-trial-summary::before { transform: rotate(90deg); }
.protocol-trial-summary-values { min-width: 0; margin-left: auto; overflow: hidden; color: var(--ink-400); font: 9px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.protocol-trial-body { padding: 0 9px 9px; border-top: 1px solid var(--ink-100); }
.protocol-trial-body .protocol-trial-measurements { margin-top: 9px; }

.bounded-track { height: 44px; }
.bounded-track::before,
.bounded-track::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  height: 2px;
  border-radius: 999px;
  transform: translateY(-50%);
  pointer-events: none;
}
.bounded-track::before { z-index: 0; width: 100%; background: rgba(100,116,139,.28); }
.bounded-track::after { z-index: 1; width: var(--bounded-progress, 0%); background: rgba(71,85,105,.68); }
.bounded-input.is-unmeasured .bounded-track::after { opacity: 0; }
.bounded-reference-band,
.centered-reference-band { position: absolute; z-index: 2; top: 50%; height: 2px; border-radius: 0; opacity: 1; box-shadow: none; transform: translateY(-50%); pointer-events: none; }
.bounded-reference-band:first-child { border-radius: 999px 0 0 999px; }
.bounded-reference-band:nth-last-of-type(1) { border-radius: 0 999px 999px 0; }
.grade-zone-bad { background: linear-gradient(90deg, var(--grade-zone-bad) 0, var(--grade-zone-bad) calc(100% - 2px), var(--grade-zone-mid) 100%); }
.grade-zone-mid { background: linear-gradient(90deg, var(--grade-zone-mid) 0, var(--grade-zone-mid) calc(100% - 2px), var(--grade-zone-good) 100%); }
.grade-zone-good { background: linear-gradient(90deg, var(--grade-zone-good) 0, var(--grade-zone-good) calc(100% - 2px), var(--grade-zone-excellent) 100%); }
.grade-zone-excellent { background: linear-gradient(90deg, var(--grade-zone-excellent) 0, var(--grade-zone-excellent) calc(100% - 2px), var(--grade-zone-over-solid) 100%); }
.grade-zone-over { background: var(--grade-zone-over); }
.bounded-range { height: 44px; -webkit-appearance: none; appearance: none; }
.centered-range { -webkit-appearance: none; appearance: none; }
.bounded-range,
.centered-range { z-index: 3; }
.bounded-range::-webkit-slider-runnable-track,
.centered-range::-webkit-slider-runnable-track { height: 2px; border: 0; border-radius: 999px; background: transparent; }
.bounded-range::-moz-range-track,
.centered-range::-moz-range-track { height: 2px; border: 0; border-radius: 999px; background: transparent; }
.bounded-range::-webkit-slider-thumb,
.centered-range::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -10px;
  border: 1px solid rgba(148,163,184,.52);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(71,85,105,.78) 0 1.4px, transparent 1.7px), linear-gradient(145deg, rgba(255,255,255,.72), rgba(255,255,255,.34) 48%, rgba(226,232,240,.22));
  box-shadow: inset 1px 1px 1px rgba(255,255,255,.86), inset -1px -1px 2px rgba(100,116,139,.1), 0 1px 4px rgba(15,23,42,.16);
  -webkit-appearance: none;
  appearance: none;
}
.bounded-range::-moz-range-thumb,
.centered-range::-moz-range-thumb { width: 20px; height: 20px; border: 1px solid rgba(148,163,184,.52); border-radius: 50%; background: radial-gradient(circle at 50% 50%, rgba(71,85,105,.78) 0 1.4px, transparent 1.7px), linear-gradient(145deg, rgba(255,255,255,.72), rgba(255,255,255,.34) 48%, rgba(226,232,240,.22)); box-shadow: inset 1px 1px 1px rgba(255,255,255,.86), inset -1px -1px 2px rgba(100,116,139,.1), 0 1px 4px rgba(15,23,42,.16); }
.bounded-input.is-unmeasured .bounded-range::-webkit-slider-thumb { opacity: .45; }
.bounded-input.is-unmeasured .bounded-range::-moz-range-thumb { opacity: .45; }
.centered-axis::before { height: 2px; background: rgba(100,116,139,.28); }
.centered-half::before {
  content: '';
  position: absolute;
  z-index: 1;
  top: 50%;
  width: var(--centered-progress, 0%);
  height: 2px;
  border-radius: 999px;
  background: rgba(71,85,105,.68);
  transform: translateY(-50%);
  pointer-events: none;
}
.centered-half-left::before { right: 0; }
.centered-half-right::before { left: 0; }
.centered-half.is-unmeasured::before { opacity: 0; }
.bounded-reference-entry { position: relative; }
.bounded-reference-trigger { min-height: 32px; padding: 4px 7px; border: 0; border-radius: 5px; color: var(--ink-500); background: transparent; font: 600 10px var(--sans); cursor: pointer; white-space: nowrap; }
.bounded-reference-trigger:hover,
.bounded-reference-trigger[aria-expanded="true"] { color: var(--accent); background: var(--accent-50); }
.bounded-reference-popover {
  position: fixed;
  z-index: 1100;
  box-sizing: border-box;
  overflow-y: auto;
  color: var(--ink-700);
  text-align: left;
}
.bounded-reference-popover-title { display: block; margin-bottom: 8px; color: var(--ink-900); font-size: 12px; }
.bounded-reference-table { border-collapse: collapse; font-size: 10px; }
.rom-table .bounded-reference-table tr { display: table-row; padding: 0; }
.rom-table .bounded-reference-table th,
.rom-table .bounded-reference-table td { position: static; display: table-cell; min-height: 0; padding: 5px 6px; }
.rom-table .bounded-reference-table td::before,
.rom-table .bounded-reference-table td::after { content: none; display: none; }
.bounded-reference-table th,
.bounded-reference-table td { padding: 5px 6px; border-bottom: 1px solid var(--ink-100); color: var(--ink-600); font-weight: 400; text-align: left; }
.bounded-reference-table thead th { color: var(--ink-400); font-size: 9px; font-weight: 700; }
.bounded-reference-table tbody th { color: var(--ink-700); font-weight: 700; white-space: nowrap; }
.bounded-reference-table tbody th::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; vertical-align: 1px; }
.bounded-reference-table tr[data-reference-zone="bad"] th::before { background: var(--grade-zone-bad); }
.bounded-reference-table tr[data-reference-zone="mid"] th::before { background: var(--grade-zone-mid); }
.bounded-reference-table tr[data-reference-zone="good"] th::before { background: var(--grade-zone-good); }
.bounded-reference-table tr[data-reference-zone="excellent"] th::before { background: var(--grade-zone-excellent); }
.bounded-reference-table tr[data-reference-zone="over"] th::before { border: 1px solid rgba(100,116,139,.48); background: var(--grade-zone-over); }
.bounded-reference-note { margin: 8px 0 0; color: var(--ink-400); font-size: 9px; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.rotation-spatial-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding: 7px 9px;
  border: 1px solid var(--ink-100);
  border-radius: 7px;
  color: var(--ink-600);
  background: #f8fafc;
  font-size: 11px;
}
.rotation-total-values { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.rotation-total-values strong { color: var(--ink-700); }
.rotation-total-reference { position: relative; flex: 0 0 auto; }
.rotation-total-reference > summary {
  min-height: 32px;
  padding: 6px 7px;
  border-radius: 5px;
  color: var(--ink-500);
  font-size: 10px;
  font-weight: 700;
  line-height: 20px;
  list-style: none;
  cursor: pointer;
  white-space: nowrap;
}
.rotation-total-reference > summary::-webkit-details-marker { display: none; }
.rotation-total-reference > summary:hover,
.rotation-total-reference[open] > summary { color: var(--accent); background: var(--accent-50); }
.rotation-total-reference-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  width: min(290px, 86vw);
  padding: 10px;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .14);
}
.rom-group-heading td { text-transform: none; letter-spacing: .03em; }
.rom-ref { position: relative; }
.section-card:has(.rom-table),
.section-body:has(.rom-table) { overflow: visible; }

@media (min-width: 769px) {
  .bounded-measure { display: none; }
  #top-context { display: flex; align-items: center; gap: 0; min-width: 0; max-width: 230px; height: 40px; padding: 0 8px; }
  .top-context-kicker,
  #assessment-state { display: none; }
  #client-title { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .isa-compact-card > .isa-input-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .isa-input-col { min-width: 0; }
  .isa-input-col label { min-height: 17px; }
}

@media (max-width: 768px) {
  :root { --mobile-header-height: 56px; --mobile-tabs-height: 48px; }
  #mobile-header {
    grid-template-columns: 44px minmax(0, 1fr) minmax(108px, 36%);
    gap: 8px;
    min-height: calc(var(--mobile-header-height) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 8px 0;
  }
  #mobile-client-button { grid-column: 1; grid-row: 1; min-width: 44px; padding: 0; font-size: 18px; }
  .mobile-brand { grid-column: 2; display: flex; align-items: center; justify-content: flex-start; gap: 7px; width: auto; height: auto; min-width: 0; border-radius: 0; background: transparent; font-family: var(--sans); white-space: nowrap; }
  .mobile-brand-mark { display: block; width: 28px; height: 30px; flex-shrink: 0; object-fit: contain; }
  .mobile-brand strong { min-width: 0; overflow: hidden; font-size: 12px; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-context { grid-column: 3; display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; justify-items: end; gap: 2px; width: 100%; max-width: none; min-width: 0; }
  .mobile-context strong,
  .mobile-context span { display: block; width: 100%; min-width: 0; margin: 0; overflow: hidden; font-size: 9px; font-weight: 500; line-height: 1.15; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-context strong { max-width: none; color: #f8fafc; font-size: 11px; }
  .mobile-context span { color: #cbd5e1; }
  .mobile-context-separator { display: none !important; }
  #topbar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    width: 100%;
    padding: 0;
    overflow: hidden;
    scroll-snap-type: none;
  }
  .tab-btn { width: 100%; min-width: 0; padding: 0 2px; }
  #mobile-actionbar { display: none !important; }
  .sidebar-tools button,
  .sidebar-admin-tools button,
  #mobile-quick-nav-toggle { top: auto; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); width: auto; min-width: 52px; padding: 0 10px; border-radius: 999px; font-size: 10px; }
  #mobile-back-to-top { top: auto; right: 12px; bottom: calc(66px + env(safe-area-inset-bottom)); left: auto; }
  [data-mobile-nav-label] { scroll-margin-top: calc(var(--mobile-header-height) + var(--mobile-tabs-height) + 12px + env(safe-area-inset-top)); }
  .report-page-toolbar { align-items: stretch; }
  .report-page-toolbar button { min-height: 44px; }
  .case-library-shell > summary { min-height: 60px; }
  .mobile-basic-actions { position: relative; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 8px; margin: 0 0 8px; }
  .mobile-basic-actions > button,
  .mobile-basic-more > summary { display: grid; place-items: center; min-height: 44px; padding: 0 12px; border: 1px solid var(--ink-200); border-radius: 7px; color: var(--ink-700); background: #fff; font: 700 12px var(--sans); list-style: none; cursor: pointer; }
  .mobile-basic-actions > button { border-color: #1d4ed8; color: #fff; background: #1d4ed8; }
  .mobile-basic-more > summary::-webkit-details-marker { display: none; }
  .mobile-basic-more > div { position: absolute; z-index: 45; top: calc(100% + 5px); right: 0; width: min(210px, 70vw); padding: 5px; border: 1px solid var(--ink-200); border-radius: 7px; background: #fff; box-shadow: 0 10px 24px rgba(15,23,42,.14); }
  .mobile-basic-more > div button { width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 5px; color: var(--ink-700); background: transparent; font: 600 12px var(--sans); text-align: left; }
  .basic-identity-row { grid-template-columns: minmax(0, 3fr) minmax(126px, 2fr); gap: 8px; }
  .basic-identity-row .form-group,
  .basic-identity-row .form-group.wide { width: auto; min-width: 0; }
  #panel-0 .form-group textarea { min-height: 64px; }
  #structure-page-toolbar { gap: 5px; margin: 0 0 8px; padding: 5px; }
  #structure-page-toolbar .structure-toolbar-label { display: none; }
  #structure-page-toolbar .history-controls { margin-right: auto; }
  #structure-page-toolbar .structure-toolbar-group { gap: 3px; }
  #structure-page-toolbar .structure-tool-button { min-width: 44px; min-height: 44px; padding: 0 7px; font-size: 9px; }
  #structure-page-toolbar .history-controls .structure-tool-button { padding: 0; }
  #structure-page-toolbar .history-controls .structure-tool-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .isa-measurement-header { grid-template-columns: auto minmax(0, 1fr); gap: 5px 8px; min-height: 60px; }
  .isa-summary-values { grid-column: 1 / -1; grid-row: 2; width: 100%; font-size: 9px; text-align: left; }
  .isa-measurement-header > .info-tip { grid-column: 2; grid-row: 1; justify-self: end; }
  .isa-protocol-disclosure > summary { min-height: 52px; }
  .history-controls button,
  .structure-expand-all,
  .structure-collapse-all { min-width: 44px; min-height: 44px; }
  .rom-group-heading-inner { min-height: 44px; }
  .protocol-trial > summary { min-height: 58px; }
  .protocol-trial-summary { flex-wrap: wrap; }
  .protocol-trial-summary-values { order: 3; width: 100%; margin-left: 20px; }
  .bounded-controls { align-items: center; }
  .bounded-controls:has(.bounded-measure) { grid-template-rows: 44px 32px 44px; }
  .bounded-controls:has(.bounded-measure) .bounded-track { grid-row: 2; }
  .bounded-controls:has(.bounded-measure) .bounded-measure { display: inline-flex; grid-column: 1 / -1; grid-row: 3; align-items: center; justify-content: center; width: 100%; min-width: 44px; min-height: 44px; visibility: visible; overflow: visible; }
  .bounded-track { min-width: 0; height: 44px; }
  .bounded-track::before,
  .bounded-track::after { display: block; }
  .bounded-track .bounded-reference-band,
  .centered-half .centered-reference-band { top: 50%; z-index: 2; height: 2px; transform: translateY(-50%); opacity: 1; }
  .bounded-range::-webkit-slider-runnable-track,
  .centered-range::-webkit-slider-runnable-track { height: 2px; }
  .bounded-range::-moz-range-track,
  .bounded-range::-moz-range-progress,
  .centered-range::-moz-range-track,
  .centered-range::-moz-range-progress { height: 2px; }
  .bounded-range::-webkit-slider-thumb,
  .centered-range::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -11px; border-color: rgba(148,163,184,.52); background: radial-gradient(circle at 50% 50%, rgba(71,85,105,.78) 0 1.4px, transparent 1.7px), linear-gradient(145deg, rgba(255,255,255,.72), rgba(255,255,255,.34) 48%, rgba(226,232,240,.22)); }
  .bounded-range::-moz-range-thumb,
  .centered-range::-moz-range-thumb { width: 22px; height: 22px; background: radial-gradient(circle at 50% 50%, rgba(71,85,105,.78) 0 1.4px, transparent 1.7px), linear-gradient(145deg, rgba(255,255,255,.72), rgba(255,255,255,.34) 48%, rgba(226,232,240,.22)); }
  .bounded-input.is-unmeasured .bounded-range::-webkit-slider-thumb,
  .centered-half.is-unmeasured .centered-range::-webkit-slider-thumb { opacity: .42 !important; }
  .bounded-input.is-unmeasured .bounded-range::-moz-range-thumb,
  .centered-half.is-unmeasured .centered-range::-moz-range-thumb { opacity: .42 !important; }
  .bounded-reference-entry.is-external { display: flex; justify-content: flex-end; }
  .bounded-reference-trigger { min-height: 44px; }
  .bounded-reference-popover { max-width: calc(100vw - 28px); }
  .section-body:has(.rom-table) { overflow: visible; }
}

@media (max-width: 410px) {
  .mobile-brand-mark { display: block; }
  .mobile-context { max-width: none; }
  .mobile-context strong { max-width: none; }
}

/* EB-108F4: one Thumb material and one responsive toolbar contract. */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
}
input[type="range"]::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -10px;
  box-sizing: border-box;
  border: 1px solid rgba(148,163,184,.52);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(71,85,105,.78) 0 1.4px, transparent 1.7px), linear-gradient(145deg, rgba(255,255,255,.72), rgba(255,255,255,.34) 48%, rgba(226,232,240,.22));
  box-shadow: inset 1px 1px 1px rgba(255,255,255,.86), inset -1px -1px 2px rgba(100,116,139,.1), 0 1px 4px rgba(15,23,42,.16);
  -webkit-appearance: none;
  appearance: none;
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  box-sizing: border-box;
  border: 1px solid rgba(148,163,184,.52);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(71,85,105,.78) 0 1.4px, transparent 1.7px), linear-gradient(145deg, rgba(255,255,255,.72), rgba(255,255,255,.34) 48%, rgba(226,232,240,.22));
  box-shadow: inset 1px 1px 1px rgba(255,255,255,.86), inset -1px -1px 2px rgba(100,116,139,.1), 0 1px 4px rgba(15,23,42,.16);
}

@media (min-width: 769px) and (max-width: 1024px) {
  #structure-page-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 8px;
    width: 100%;
    box-sizing: border-box;
  }
  #structure-page-toolbar .structure-toolbar-label { grid-column: 1; grid-row: 1; margin-right: 0; }
  #structure-page-toolbar .history-controls { grid-column: 2; grid-row: 1; justify-self: end; }
  #structure-page-toolbar > .structure-toolbar-group:last-child { grid-column: 1 / -1; grid-row: 2; justify-self: end; }
  #structure-page-toolbar .structure-tool-button { min-height: 36px; }
}

@media (min-width: 769px) and (max-width: 900px) {
  .centered-bilateral {
    grid-template-columns: minmax(100px, 1fr) minmax(190px, 2.3fr) 64px 64px minmax(56px, .7fr) 48px;
    gap: 8px;
  }
  .rom-table { width: 100%; table-layout: fixed; }
  .rom-table th:first-child { width: 22% !important; }
  .rom-table th:nth-child(2),
  .rom-table th:nth-child(3) { width: 27% !important; }
  .rom-table th:nth-child(4) { width: 15% !important; }
  .rom-table th:nth-child(5) { width: 9% !important; }
  .rom-table td:has(.bounded-input),
  .supine-shoulder-row td:has(.bounded-input),
  .rom-table .bounded-input { min-width: 0; }
  .rom-table .bounded-controls:has(.bounded-measure) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 4px;
  }
  .rom-table .bounded-controls:has(.bounded-measure) .bounded-track { grid-column: 1 / -1; grid-row: 1; min-width: 0; }
  .rom-table .bounded-controls:has(.bounded-measure) .bounded-number { grid-column: 1; grid-row: 2; width: 52px !important; min-width: 52px; }
  .rom-table .bounded-controls:has(.bounded-measure) .bounded-measure { grid-column: 2; grid-row: 2; min-width: 44px; padding-inline: 6px; }
  .rom-table .bounded-controls:has(.bounded-measure) .bounded-clear { grid-column: 3; grid-row: 2; padding-inline: 2px; }
  .rom-table .bounded-scale { margin-right: 0; }
}

@media (max-width: 768px) {
  #structure-page-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 6px;
    width: 100%;
    box-sizing: border-box;
  }
  #structure-page-toolbar .history-controls { grid-column: 1; margin-right: 0; justify-self: start; }
  #structure-page-toolbar > .structure-toolbar-group:last-child { grid-column: 2; justify-self: end; min-width: 0; }
  #structure-page-toolbar .structure-tool-button { max-width: 100%; white-space: nowrap; }
  input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -11px; }
  input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; }
}

body.session-switching #tab-content {
  pointer-events: none;
  opacity: .68;
  transition: opacity 120ms ease;
}

/* EB-109A compact protocol row + inline ISA measurement controls. */
.protocol-ux-host { margin-top: 5px; }
.protocol-workspace,
.protocol-workspace.is-supplemental {
  gap: 7px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.protocol-ux-panel {
  border: 1px solid var(--ink-200);
  border-radius: 7px;
  background: #f8fafc;
  overflow: hidden;
}
.protocol-ux-panel > .protocol-ux-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 10px;
  list-style: none;
}
.protocol-ux-panel > .protocol-ux-summary::-webkit-details-marker { display: none; }
.protocol-ux-panel > .protocol-ux-summary::after {
  content: '›';
  color: var(--ink-400);
  font-size: 17px;
  line-height: 1;
  transition: transform .15s ease;
}
.protocol-ux-panel[open] > .protocol-ux-summary::after { transform: rotate(90deg); }
.protocol-ux-panel[open] > .protocol-ux-summary { border-bottom: 1px solid var(--ink-200); background: #fff; }
.protocol-group-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-800);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.protocol-details-label { color: var(--ink-500); font-size: 11px; font-weight: 700; white-space: nowrap; }
.protocol-detail-body { padding: 8px 9px 9px; }
.protocol-detail-body .protocol-summary { padding: 0 0 5px; }
.protocol-detail-body .protocol-requirements { margin: 0 0 5px; }
.protocol-detail-body .protocol-group-pain { margin-top: 4px; border-top: 1px solid var(--ink-100); padding-top: 4px; }

.isa-input-col .bounded-input {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 44px;
  grid-template-rows: 44px;
  gap: 0 8px;
  align-items: center;
  min-width: 0;
}
.isa-input-col .bounded-controls { display: contents !important; }
.isa-input-col .bounded-number {
  grid-column: 1;
  grid-row: 1;
  width: 72px !important;
  min-width: 72px;
  min-height: 44px;
}
.isa-input-col .bounded-track {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  min-width: 0;
}
.isa-input-col .bounded-clear {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  min-width: 44px;
  min-height: 44px;
}
.isa-input-col .bounded-scale {
  top: 2px;
  left: 0;
  width: 100%;
  height: 12px;
  margin: 0;
}

@media (max-width: 1024px) {
  .isa-compact-card > .isa-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
}

@media (max-width: 768px) {
  .protocol-ux-panel > .protocol-ux-summary { min-height: 44px; }
  .protocol-group-name { font-size: 11px; }
  .protocol-details-label { font-size: 10px; }
  .isa-compact-card > .isa-input-row { padding-top: 8px; }
  .isa-input-col label { margin-bottom: 0; }
  .rotation-spatial-summary { align-items: stretch; flex-direction: column; }
  .rotation-total-values { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .rotation-total-reference { align-self: flex-end; }
  .rotation-total-reference > summary { min-height: 44px; }
}

/* EB-109E: Structure readability and control simplification. */
#structure-page-utilities { min-width: 0; }
.structure-tools-more { display: none; position: relative; }
.structure-tools-more > summary { list-style: none; }
.structure-tools-more > summary::-webkit-details-marker { display: none; }
.structure-tools-menu {
  position: absolute;
  z-index: 95;
  top: calc(100% + 5px);
  right: 0;
  width: 136px;
  padding: 5px;
  border: 1px solid var(--ink-200);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15,23,42,.14);
}
.structure-tools-menu button {
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  color: var(--ink-700);
  background: transparent;
  font: 600 11px var(--sans);
  text-align: left;
  cursor: pointer;
}
.structure-tools-menu button:hover { background: var(--ink-100); }

#toetouch-phase-group {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
#toetouch-phase-group .btn-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding-inline: 8px;
  text-align: center;
}
.toe-reference-data { margin: 5px 0 10px; border: 1px solid var(--ink-200); border-radius: 7px; background: #fafafa; }
.toe-reference-data > summary { min-height: 36px; padding: 8px 10px; color: var(--ink-500); font-size: 11px; font-weight: 700; cursor: pointer; }
.toe-reference-data table { width: calc(100% - 20px); margin: 0 10px 7px; border-collapse: collapse; font-size: 11px; }
.toe-reference-data th,
.toe-reference-data td { padding: 5px 6px; border-top: 1px solid var(--ink-100); text-align: left; }
.toe-reference-data th { color: var(--ink-700); }
.toe-reference-data td { color: var(--ink-500); }
.toe-reference-data p { margin: 0 10px 9px; color: var(--ink-400); font-size: 10px; line-height: 1.45; }

.apley-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.apley-side { min-width: 0; padding: 10px; border: 1px solid var(--ink-100); border-radius: 7px; background: #fafafa; }
.apley-side-label { margin-bottom: 6px; color: var(--ink-500); font-size: 11px; font-weight: 700; }
.apley-side > .btn-group { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.apley-side > .btn-group .btn-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding-inline: 6px;
  text-align: center;
}

.squat-workspace {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.squat-stage-selector { min-width: 0; }
.squat-stage-selector-title { margin-bottom: 7px; color: var(--ink-700); font-size: 12px; font-weight: 700; }
.squat-stage-selector > .btn-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.squat-stage-selector .btn-option { display: grid; gap: 2px; min-height: 48px; padding: 7px 10px; text-align: left; }
.squat-stage-selector .btn-option span { font-weight: 700; }
.squat-stage-selector .btn-option small { color: var(--ink-400); font-size: 10px; }
.squat-stage-selector .btn-option.selected small { color: inherit; opacity: .78; }
.squat-stage-content { min-width: 0; min-height: 170px; }
.stage-card {
  padding: 12px 14px;
  border: 1px solid var(--ink-200);
  border-left: 3px solid #94a3b8;
  border-radius: 7px;
  background: #fafafa;
}
.squat-stage-heading { display: flex; align-items: center; gap: 6px; color: var(--ink-700); font-size: 12px; font-weight: 700; }
.squat-stage-heading > span:first-child { color: var(--ink-500); font-weight: 500; }
.squat-stage-disabled-note { margin: 6px 0; color: var(--ink-400); font-size: 11px; font-style: italic; }
.squat-observation-block { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--ink-100); }
.squat-observation-title { margin-bottom: 7px; color: var(--ink-500); font-size: 11px; font-weight: 700; }
.squat-observation-block .compensation-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }

@media (max-width: 768px) {
  #structure-page-utilities {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px;
    align-items: stretch;
    margin-bottom: 8px;
  }
  #structure-page-utilities #assessment-section-nav {
    grid-column: 1;
    min-width: 0;
    margin: 0;
    padding: 2px;
    border-radius: 7px;
  }
  #structure-page-utilities #assessment-section-nav button { min-height: 44px; padding-inline: 2px; font-size: 9px; }
  #structure-page-utilities #structure-page-toolbar {
    grid-column: 2;
    display: flex;
    gap: 2px;
    width: auto;
    margin: 0;
    padding: 2px;
    border-radius: 7px;
  }
  #structure-page-toolbar .history-controls { display: flex; gap: 2px; }
  #structure-page-toolbar .structure-expansion-controls { display: none; }
  #structure-page-toolbar .structure-tools-more { display: block; }
  #structure-page-toolbar .structure-tool-button { width: 44px; min-width: 44px; min-height: 44px; padding: 0; font-size: 15px; }
  #structure-page-toolbar .history-controls .structure-tool-button > span[aria-hidden] { font-size: 18px; }

  #toetouch-phase-group { gap: 4px; }
  #toetouch-phase-group .btn-option { min-height: 44px; padding: 5px 2px; font-size: 11px; }
  .toe-reference-data > summary { min-height: 44px; }

  .apley-sides { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .apley-side { padding: 9px; }
  .apley-side > .btn-group { gap: 4px; }
  .apley-side > .btn-group .btn-option { min-height: 44px; padding: 5px 3px; font-size: 11px; }

  .squat-workspace { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .squat-stage-selector > .btn-group { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .squat-stage-selector .btn-option { min-height: 48px; padding: 5px 4px; text-align: center; }
  .squat-stage-content { min-height: 0; }
  .stage-card { padding: 11px; border-left-width: 1px; }
  .squat-stage-heading { align-items: flex-start; flex-wrap: wrap; }
  .squat-stage-heading > span:first-child { width: 100%; }
  .squat-observation-block .compensation-body { grid-template-columns: minmax(0, 1fr); gap: 9px; }
}

/* Continuous inclinometer: local capture preference and explicit side acceptance. */
.inclinometer-sides { display:flex; gap:8px; margin-bottom:12px; }
.inclinometer-sides[hidden] { display:none; }
.inclinometer-sides button { flex:1; min-height:44px; border:1px solid #d7dee8; border-radius:8px; background:#fff; color:#243249; }
.inclinometer-sides button[aria-pressed="true"] { border-color:#3155a6; color:#3155a6; background:#eef3ff; }
.inclinometer-settings { text-align:left; margin-bottom:12px; font-size:13px; }
.inclinometer-settings summary { min-height:44px; display:flex; align-items:center; cursor:pointer; }
.inclinometer-settings label { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.inclinometer-mode { min-height:44px; max-width:100%; }
.inclinometer-footer .inclinometer-lock { grid-column:1 / -1; }
.inclinometer-footer .inclinometer-lock[hidden] { display:none; }
.inclinometer-card { max-height:calc(100dvh - 24px); overflow-y:auto; }

.inclinometer-header .inclinometer-close { min-width:44px; min-height:44px; flex-shrink:0; }
