:root { color-scheme: dark; --panel:#17232d; --muted:#91a5b4; --edge:#344550; --accent:#72dfcf; }
* { box-sizing:border-box; }
body { margin:0; background:#0d161e !important; color:#e9f0f4 !important; font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif; font-size:14px; }
#main { width:min(1400px,100%) !important; margin:auto; padding:24px 32px 18px; }
button, select, input { font:inherit; }
button, a, select, [role=button] { -webkit-tap-highlight-color:transparent; }
button, [role=button] { cursor:pointer; }
button { border:1px solid var(--edge); background:#22333f; color:#edf5f8; border-radius:8px; padding:10px 15px; font-weight:600; }
button:hover, [role=button]:hover { background:#304652; border-color:#6b8a9a; }
button:disabled { opacity:.4; cursor:not-allowed; }
:focus-visible { outline:3px solid var(--accent) !important; outline-offset:3px; }
a { color:var(--accent); text-underline-offset:3px; }
.app-header { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:22px; }
h1 { margin:5px 0 0; font-size:28px; letter-spacing:-1px; font-weight:750; }
h1 span { font-weight:400; color:#c0ced7; }
.eyebrow { font-size:10px; font-weight:700; letter-spacing:1.6px; color:var(--muted); }
nav { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
nav button { background:transparent; font-size:12px; padding:10px 12px; }
nav a { padding:10px; font-size:12px; text-decoration:none; }
kbd { font-family:inherit; font-size:10px; border:1px solid #5a6b76; border-radius:4px; padding:2px 5px; opacity:.85; white-space:nowrap; }
.instrument { border:1px solid #3a4b56; border-radius:16px; background:var(--panel); overflow:clip; box-shadow:0 20px 55px #0004; }
.screen-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:13px 24px; border-bottom:1px solid var(--edge); font-size:11px; letter-spacing:.8px; }
.screen-header>div { font-weight:700; }
.status-dot { display:inline-block; width:7px; height:7px; border-radius:100%; background:var(--accent); margin-right:8px; }
#cursor-readout { color:#bdced9; font-variant-numeric:tabular-nums; }
#export-plot { padding:6px 10px; font-size:11px; background:transparent; }
.ear-headings { background:#fff; display:grid; grid-template-columns:1fr 1fr; text-align:center; padding:15px 0 0; font-size:12px; font-weight:750; letter-spacing:2px; }
.ear-headings small { margin-left:9px; font-size:15px; }
.right-ear { color:#c72a43; } .left-ear { color:#2563eb; }
#plot-screen { position:sticky; top:0; z-index:1; background:white; padding:0 18px; }
#plot-wrap { position:relative; width:100%; max-width:940px; margin:auto; }
#canimg { display:block; width:100%; height:auto; }
#crosshair { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; overflow:visible; }
#crosshair line { stroke:currentColor; stroke-width:1.2px; stroke-dasharray:5 4; vector-effect:non-scaling-stroke; opacity:.65; }
#crosshair #cursor-centre-h, #crosshair #cursor-centre-v { stroke:#263445; stroke-width:2px; stroke-dasharray:none; opacity:1; }
.screen-footer { display:flex; gap:15px; justify-content:space-between; padding:10px 24px; font-size:11px; color:var(--muted); border-bottom:1px solid var(--edge); }
#store-status { color:#c3d8df; }
#controls { display:grid; grid-template-columns:1fr 1fr 1fr; width:100% !important; border:0 !important; outline:none; }
.channel { padding:22px 24px; min-width:0; }
.channel + .channel { border-left:1px solid var(--edge); }
.channel>label { display:block; margin:12px 0 0; color:#c3d2dc; font-size:12px; }
.channel>label>span { float:right; color:var(--muted); }
.dial-row { display:grid; grid-template-columns:42px minmax(0,1fr) 42px; align-items:center; gap:8px; margin:8px 0 17px; }
.dial-row>button { height:42px; padding:0; font-size:25px; font-weight:400; border-radius:50%; }
.dial-row select { width:100%; appearance:none; background:#101b24; border:1px solid #3b515e; border-radius:8px; color:#f1f8fc; padding:8px 4px; text-align:center; font-size:36px; font-weight:550; font-variant-numeric:tabular-nums; cursor:pointer; }
.dial-row select option { font-size:18px; }
[data-ear=right] .tone select { color:#ff8e9e; }
[data-ear=left] .tone select { color:#90bbff; }
.masker .dial-row select { color:#a5c1d3; }
.routing { display:flex; gap:14px; }
.routing label { color:var(--muted); font-size:10px; flex:1; }
.routing span { display:block; margin-top:5px; }
.routing select { width:100%; border:1px solid var(--edge); border-radius:6px; padding:7px; background:#22333f; color:white; }
.present { width:100%; padding:14px; background:#72dfcf; border-color:#72dfcf; color:#102c2c; display:flex; align-items:center; justify-content:space-between; touch-action:none; }
.present:hover { background:#a3f1e5; }
.present.presenting { background:#fff0a6; border-color:#fff0a6; box-shadow:0 0 24px #fff0a633; }
.toggle { display:flex !important; align-items:center; gap:10px; cursor:pointer; font-size:12px; color:#c0d0dc; }
.toggle input { appearance:auto; width:19px; height:19px; accent-color:#72dfcf; cursor:pointer; }
#masker-side { font-size:10px; float:none; margin-left:auto; }
.action-bar { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 24px; border-top:1px solid var(--edge); background:#14202a; }
.response-indicator { display:flex; align-items:center; gap:10px; font-size:12px; color:var(--muted); }
#response-image { display:flex; background:#e7eeec; padding:7px 12px; border-radius:20px; }
#main_response { width:65px; height:auto; }
.store-actions { display:flex; flex-wrap:wrap; gap:8px; }
.store-actions button { font-size:12px; min-width:120px; }
.store-actions kbd { margin-left:14px; }
.app-footer { display:flex; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-top:17px; color:var(--muted); font-size:11px; }
.modal-open { overflow:hidden; }
dialog { color-scheme:light; width:min(1080px,calc(100% - 32px)); max-height:85dvh; padding:0; border:1px solid #566d7c; border-radius:14px; background:#f5f8fa; color:#1b303d; box-shadow:0 30px 100px #0007; }
dialog::backdrop { background:#061019b8; backdrop-filter:blur(5px); }
.dialog-header { position:sticky; top:0; z-index:2; display:flex; justify-content:space-between; align-items:center; padding:20px 24px; background:#17232d; color:white; }
.dialog-header h2 { font-size:21px; margin:5px 0 0; }
.close-dialog { font-size:26px; padding:0; width:40px; height:40px; }
.dialog-body { padding:24px; overflow:auto; }
.dialog-body table { border-collapse:collapse; font-size:12px; width:100%; margin:16px 0; }
.dialog-body td { padding:8px 5px; border:1px solid #d2dde4; }
.dialog-body tr:first-child { background:#e2ebf0; font-weight:650; }
.dialog-body input, .dialog-body select { max-width:100%; border:1px solid #9db1bf; border-radius:4px; background:white; color:#193443; padding:6px; }
.dialog-body input[size="3"] { width:58px; }
.dialog-body a { color:#176678; }
.dialog-body .boxy { display:inline-block; width:auto; padding:10px 14px; margin:8px 5px 8px 0; border:1px solid #bacbd4; background:#e8f0f4; border-radius:6px; font-size:12px; }
.dialog-body label { margin:0; }
#hidey { display:none; }
#shortcuts-dialog { max-width:640px; }
.shortcut-list { display:grid; grid-template-columns:140px 1fr; gap:14px; margin:0; }
.shortcut-list dt { font-weight:700; }
.shortcut-list dd { margin:0; }
#shortcuts p { font-size:12px; line-height:1.6; margin-top:24px; color:#506876; }
@media (min-width:1100px) and (max-height:900px) { #main { padding-top:14px; } .app-header { margin-bottom:12px; } .channel { padding:15px 24px; } .ear-headings { padding-top:8px; } .dial-row { margin-bottom:10px; } }
@media (max-width:850px) { #main { padding:16px; } .app-header { align-items:flex-start; flex-direction:column; gap:14px; } .channel { padding:16px 12px; } .dial-row { grid-template-columns:32px minmax(0,1fr) 32px; gap:4px; } .dial-row>button { height:32px; } .dial-row select { font-size:26px; } .screen-header { padding:12px; letter-spacing:0; } .action-bar { padding:14px; flex-wrap:wrap; } .channel .eyebrow { letter-spacing:.5px; font-size:9px; } }
@media (max-width:580px) { #main { padding:12px 8px; } h1 { font-size:24px; } nav { gap:5px; } nav button { font-size:11px; padding:9px; } #controls { grid-template-columns:1fr 1fr; } .frequency { grid-column:1 / -1; display:grid; grid-template-columns:1fr 1fr; gap:0 15px; } .frequency .eyebrow { grid-column:1 / -1; } .frequency>label { grid-column:1; } .frequency .dial-row { grid-column:1; margin-bottom:0; } .frequency .routing { grid-column:2; grid-row:2 / 4; align-items:center; } .channel + .channel { border-top:1px solid var(--edge); } .tone { border-left:0 !important; } .screen-header { flex-wrap:wrap; } #cursor-readout { order:3; width:100%; } #plot-screen { padding:0 2px; } .screen-footer { padding:10px; flex-wrap:wrap; } .response-indicator { font-size:11px; } .store-actions { order:3; width:100%; } .store-actions button { flex:1; } .present { font-size:11px; padding:12px 8px; } .present kbd { font-size:8px; } #masker-side { display:none; } .dialog-body { padding:14px; } .shortcut-list { grid-template-columns:100px 1fr; font-size:12px; } }
/* Neutralise legacy label margins and table text inheritance. */
.routing label, .action-bar label { margin:0; }
.dialog-body, .dialog-body table, .dialog-body td { color:#1b303d; }
.ear-headings { max-width:940px; margin:auto; }
@media (min-width:1100px) { #plot-wrap, .ear-headings { max-width:clamp(440px,calc((100dvh - 530px) * 1.8333),900px); } }
@media (max-width:580px) { .channel .eyebrow { min-height:24px; display:block; } .frequency .eyebrow { min-height:auto; } }
/* A side control deck gives both ear plots useful space on desktop screens. */
@media (min-width:1100px) {
  .instrument { display:grid; grid-template-columns:minmax(0,1fr) 320px; }
  .screen-header { grid-column:1 / -1; }
  #plot-screen { grid-column:1; grid-row:2; align-self:stretch; position:relative; display:flex; flex-direction:column; justify-content:center; padding:0 12px; }
  #plot-wrap, .ear-headings { width:100%; max-width:860px; }
  .ear-headings { padding-top:10px; }
  .screen-footer { grid-column:1; grid-row:3; align-self:end; }
  #controls { grid-column:2; grid-row:2 / 4; grid-template-columns:1fr; border-left:1px solid var(--edge) !important; }
  .channel { padding:12px 18px; }
  .channel + .channel { border-left:0; border-top:1px solid var(--edge); }
  .channel>label { margin-top:7px; }
  .dial-row { margin:6px 0 10px; }
  .dial-row select { font-size:30px; padding:5px 4px; }
  .present { padding:11px; }
  .action-bar { grid-column:1 / -1; }
}

/* Optional, non-modal teaching dock. The original live field IDs stay intact. */
.helper-dock { color:#dce8ef; background:#14222c; border-top:1px solid var(--edge); margin:0 -18px; padding:10px 18px 12px; }
.helper-dock[hidden] { display:none; }
.helper-ascending { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:16px; border-top:1px solid var(--edge); margin-top:10px; padding-top:8px; }
.helper-ascending h3 { font-size:12px; margin:0 0 4px; }
#ascending-trials .ascending-criterion-met { color:#166534; font-weight:700; }
#ascending-trials, #helper-start-level { font-size:12px; line-height:1.5; font-variant-numeric:tabular-nums; }
.helper-header { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:9px; }
.helper-header>div { display:flex; align-items:baseline; flex-wrap:wrap; gap:10px; }
.helper-header h2 { font-size:12px; margin:0; }
.helper-header span { color:var(--muted); font-size:10px; }
.helper-header button { font-size:11px; padding:5px 9px; }
nav button[aria-expanded=true] { border-color:var(--accent); color:var(--accent); background:#173832; }
.helper-ears { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.helper-ear { min-width:0; }
.helper-ear h3 { font-size:11px; margin:0 0 8px; display:flex; align-items:center; justify-content:space-between; gap:5px; }
.helper-ear .right-ear { color:#ff8e9e; }
.helper-ear .left-ear { color:#90bbff; }
.helper-response { display:flex; align-items:center; gap:6px; }
.helper-response>span { color:var(--muted); font-size:9px; font-weight:400; }
.helper-response img { width:42px; height:auto; padding:3px; border-radius:4px; background:#e7eeec; }
.helper-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.helper-metrics label { display:block; margin:0 0 4px; font-size:10px; color:var(--muted); }
.helper-metrics input { width:100%; min-width:0; padding:0; border:0; background:transparent; color:#edf5f8; font-size:18px; font-variant-numeric:tabular-nums; cursor:default; }
.helper-metrics input::placeholder { color:var(--muted); opacity:1; }
@media (min-width:1100px) {
  .helper-dock { margin:0 -12px; padding:10px 16px 12px; }
  .helper-visible #plot-wrap, .helper-visible .ear-headings { max-width:clamp(520px,calc((100dvh - 400px) * 1.8333),860px); }
}
@media (max-width:580px) {
  .helper-dock { margin:0 -2px; padding:8px 10px 10px; }
  .helper-ears { gap:14px; }
  .helper-metrics { grid-template-columns:1fr 1fr; gap:6px; }
  .helper-response>span { display:none; }
  .helper-header>div { gap:4px; }
  .helper-metrics label { font-size:9px; }
  .helper-metrics input { font-size:16px; }
}

.assessment-settings { text-align:left; }
.assessment-option { display:flex; align-items:center; gap:10px; font-weight:650; }
.assessment-option input { width:18px; height:18px; accent-color:#176678; }
#assessment-help { max-width:640px; color:#506876; line-height:1.5; margin:8px 0 12px; }

#testoutput { display:grid; gap:10px; }
.patient-link { display:flex; flex-direction:column; align-items:flex-start; gap:4px; padding:10px 12px; background:#e8f0f4; border:1px solid #bacbd4; border-radius:6px; }
.patient-link a { font-weight:650; }
.patient-link span { font-size:12px; color:#506876; }

.log-badge { display:inline-block; min-width:18px; margin-left:4px; padding:1px 5px; border-radius:8px; background:#304652; color:#c7f4eb; font-variant-numeric:tabular-nums; }
#presentation-log-dialog { width:min(1280px,calc(100% - 32px)); }
.log-intro { margin:0 0 16px; line-height:1.5; }
.log-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 16px; border:1px solid #cad9e1; border-radius:8px; background:#e8f0f4; }
.log-summary { display:flex; flex-direction:column; gap:4px; }
.log-summary strong { font-size:18px; }
.log-summary span, .log-note { color:#506876; font-size:12px; }
.log-note { line-height:1.6; margin:12px 0; }
.log-empty { padding:36px 20px; text-align:center; border:1px dashed #b4c7d1; border-radius:8px; color:#506876; }
.log-table-wrap { max-height:48dvh; overflow:auto; border:1px solid #c8d6df; border-radius:6px; }
#log-table { margin:0; min-width:1050px; font-variant-numeric:tabular-nums; }
#log-table caption { text-align:left; padding:10px 12px; color:#506876; font-size:11px; }
#log-table th { text-align:left; padding:10px 8px; background:#e2ebf0; color:#193443; position:sticky; top:0; z-index:1; border-bottom:1px solid #b4c7d1; white-space:nowrap; }
#log-table td { padding:10px 8px; border:0; border-bottom:1px solid #d7e2e8; white-space:nowrap; }
#log-table tbody tr { background:white; font-weight:400; }
#log-table tbody tr:nth-child(even) { background:#f0f5f8; }
#log-table .log-right-ear { color:#b91c3c; font-weight:650; }
#log-table .log-left-ear { color:#1d4ed8; font-weight:650; }
#log-table abbr { text-underline-offset:3px; }
@media (max-width:580px) { .log-toolbar { align-items:flex-start; flex-direction:column; } .log-table-wrap { max-height:42dvh; } }

@media (max-width:580px) {
  .store-actions button { min-width:0; padding:10px 6px; font-size:11px; }
  .store-actions kbd { margin-left:4px; }
}

.masking-dock { grid-column:1 / -1; padding:14px 18px; color:#dce8ef; background:#14222c; border-top:1px solid var(--edge); min-width:0; }
.masking-dock[hidden] { display:none; }
.masking-dock p { font-size:12px; line-height:1.5; }
.masking-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:12px 0; }
.masking-actions .masking-rule-control { display:inline-flex; align-items:center; gap:6px; margin:0; white-space:nowrap; }
.masking-dock button, .masking-dock select { min-height:36px; font-size:12px; }
.masking-dock select { color:#edf5f8; background:#22333f; border:1px solid #6b8a9a; border-radius:5px; padding:6px; }
.masking-scroll { overflow:auto; max-height:340px; }
#masking-table { border-collapse:collapse; width:100%; font-size:12px; }
#masking-table caption { text-align:left; padding:8px 0; }
#masking-table th, #masking-table td { border:1px solid var(--edge); padding:7px; text-align:center; }
#masking-table th { background:#22333f; }
#masking-table select { width:100%; min-width:62px; }
#masking-table input { width:20px; height:20px; }
.masking-feedback { display:block; min-width:100px; max-width:240px; margin-bottom:5px; }
@media (max-width:600px) { .masking-dock { padding:10px; } .masking-actions button { min-height:44px; } }

/* Let the worksheet and both docks scroll together without covering its fields. */
.masking-visible #plot-screen { position:static; }

/* Masking curves remain independent of helper visibility and point storage. */
#store-masking-point { font-size:11px; padding:5px 8px; min-height:28px; margin-top:7px; }
.masking-chart-visible #plot-screen { position:static; }
#masking-canvas { display:block; width:100%; max-width:780px; height:auto; background:white; border-radius:6px; }
.masking-chart .masking-actions label { display:flex; align-items:center; flex-wrap:wrap; gap:6px; margin:0; font-size:12px; }
.masking-chart input[type="text"] { min-width:0; width:180px; max-width:100%; padding:8px; }
.masking-chart input[type="color"] { width:38px; height:32px; padding:2px; }

#pta-annotation-canvas { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
#pta-annotation-panel { margin-bottom:10px; }
#pta-annotation-panel select { background:#22333f; color:#edf5f8; border:1px solid #6b8a9a; border-radius:5px; padding:6px; max-width:100%; }
#pta-annotation-panel .masking-actions { gap:6px; }
#pta-annotation-panel button { font-size:11px; padding:7px 9px; }
#pta-annotation-panel p { font-size:12px; line-height:1.5; }
.pta-annotation-visible #plot-screen { position:static; }

/* Tutorial case builder shares the settings dialog shell. */
#tutorial { max-width: 760px; }
.tutorial-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
#tutorial label { display: flex; flex-direction: column; justify-content:space-between; gap: 6px; min-width:0; }
.tutorial-group { grid-column:1 / -1; display:grid; gap:16px; min-width:0; margin:0; padding:16px; border:1px solid #c3d1da; border-radius:8px; }
.tutorial-group legend { padding:0 6px; font-weight:600; }
.tutorial-loss { grid-template-columns:repeat(3, minmax(0, 1fr)); }
.tutorial-conductive { grid-template-columns:repeat(2, minmax(0, 1fr)); }
#tutorial > .tutorial-grid > label[for="tutorial-age-position"],
#tutorial > .tutorial-grid > label[for="tutorial-ia"],
#tutorial > .tutorial-grid > label[for="tutorial-occlusion"] { grid-column:1 / -1; }
#tutorial select, #tutorial input { box-sizing:border-box; width: 100%; min-width: 0; padding: 8px; }
#tutorial p { line-height: 1.5; }
#tutorial-status { min-height: 1.5em; }
@media (max-width: 600px) { .tutorial-grid, .tutorial-loss { grid-template-columns: 1fr; } .tutorial-group { padding:12px; gap:12px; } }

#tutorial-ia-ranges { width:min(520px,calc(100% - 32px)); }
#tutorial-ia-ranges th { padding:8px; text-align:left; }

#tutorial-check-results { width:min(850px,calc(100% - 24px)); }
#tutorial-check-results th { padding:8px 5px; text-align:left; }
#tutorial-check-results tbody tr { background:white; font-weight:400; }
#tutorial-check-results [data-result="correct"] td:last-child { color:#176235; font-weight:700; }
#tutorial-check-results [data-result="incorrect"] td:last-child { color:#a02525; font-weight:700; }
#tutorial-check-results [data-result="missing"] td:last-child { color:#805000; font-weight:700; }
@media (max-width:600px) { .tutorial-conductive { grid-template-columns:1fr; } }

.tutorial-shape-note { grid-column:1 / -1; margin:0; }

.tutorial-conductive-ear { display:grid; gap:16px; min-width:0; }

/* Method review keeps feedback readable on narrow screens. */
#tutorial-method-results { width:min(900px,calc(100% - 24px)); }
#tutorial-check-method { margin-left:6px; }
#tutorial-method-findings h3 { margin-top:24px; }
#tutorial-method-findings ul { padding-left:22px; }
#tutorial-method-findings li { margin:8px 0; overflow-wrap:anywhere; }
#tutorial-method-findings [data-result="review"] strong { color:#a02525; }
#tutorial-method-findings [data-result="incomplete"] strong { color:#805000; }
#tutorial-method-findings [data-result="pass"] strong { color:#176235; }

/* Patient anatomy popup. Canvas dimensions also define PNG export resolution. */
.patient-image-controls { display:flex; flex-wrap:wrap; align-items:center; gap:16px; }
.patient-image-controls label { display:flex; align-items:center; gap:8px; }
#patient-image-canvas { display:block; width:100%; height:auto; background:white; }
#patient-image-status { font-size:14px; line-height:1.5; overflow-wrap:anywhere; }

/* Patient fitting: separate from instrument routing and plot exports. */
.patient-setup { grid-column:1 / -1; min-width:0; border-top:1px solid var(--edge); background:#14212b; }
.patient-setup summary { padding:14px 24px; cursor:pointer; font-weight:700; }
.patient-setup summary span { margin-left:12px; color:var(--muted); font-weight:400; font-size:12px; }
.setup-body { display:grid; grid-template-columns:minmax(0,1fr) minmax(280px,1fr); gap:24px; padding:0 24px 20px; align-items:center; }
.setup-figure { margin:0; min-width:0; }
.setup-figure svg { display:block; width:100%; max-height:390px; }
.setup-figure svg text { fill:#e9f0f4; font:14px ui-sans-serif,system-ui,sans-serif; }
.setup-figure svg .setup-view-label { fill:#91a5b4; font-size:11px; letter-spacing:2px; }
.setup-figure svg .setup-location { fill:#b9cbd6; font-size:12px; }
.setup-figure svg .setup-device-text { font-size:11px; font-weight:700; }
.setup-leader { fill:none; stroke:#708794; stroke-width:1.5; }
.setup-figure figcaption, .setup-note { color:#b9cbd6; font-size:12px; line-height:1.6; }
.setup-figure figcaption { text-align:center; }
.setup-note { margin:0 0 16px; }
.setup-selectors { display:grid; gap:12px; }
.setup-device-label { display:grid; grid-template-columns:minmax(0,1fr) minmax(130px,160px); gap:12px; align-items:center; }
.setup-device-label span { display:flex; gap:9px; align-items:center; }
.setup-device-label i { width:10px; height:10px; border-radius:50%; flex:none; }
.setup-device-label select { width:100%; min-height:44px; border:1px solid #536b7a; border-radius:8px; background:#22333f; color:#edf5f8; padding:8px; }
.setup-actions { display:grid; gap:8px; margin-top:16px; }
.setup-action-row { display:flex; flex-wrap:wrap; gap:8px; }
#setup-status { color:var(--muted); font-size:12px; line-height:1.6; min-height:38px; margin-bottom:0; }
@media(max-width:700px) {
  .setup-body { grid-template-columns:1fr; gap:16px; padding:0 14px 16px; }
  .patient-setup summary { padding:14px; }
  .setup-device-label { font-size:12px; grid-template-columns:minmax(0,1fr) 140px; }
}

/* Optional per-ear metadata, kept separate from the frequency grid. */
.patient-metadata { white-space: normal; }
.metadata-ears { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.metadata-ears fieldset { min-width: 0; padding: 1rem; border: 1px solid #8096a6; border-radius: .5rem; }
.metadata-ears legend { font-weight: bold; }
.patient-metadata label { display: flex; flex-direction: column; gap: .3rem; margin: .6rem 0; }
.patient-metadata input, .patient-metadata select { width: 100%; min-width: 0; box-sizing: border-box; }
.metadata-measure, .metadata-reflex { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.metadata-reflex strong { grid-column: 1 / -1; }
.patient-metadata :disabled { opacity: .5; background: #dce1e5; cursor: not-allowed; }
@media (max-width: 640px) { .metadata-ears { grid-template-columns: 1fr; } }

.patient-link-actions { display:flex; align-items:center; flex-wrap:wrap; gap:12px; }
.patient-link-actions button { padding:6px 10px; font-size:12px; }
#PTAtestoutput[hidden] { display:none !important; }
