/* Primary review stays together; additional statistics are opened on demand. */
.app{height:calc(100dvh - 56px);min-height:0;display:flex;flex-direction:column;padding:10px;gap:8px}
.workspace{height:auto;flex:1;min-height:0;grid-template-rows:minmax(0,1fr)}
.viewer{display:flex;flex-direction:column;padding:10px;gap:6px;min-height:0;overflow:hidden}
.viewer-head{min-height:28px;flex:none;padding-right:27px;align-items:center}.viewer-head .section-title{font-size:13px}.context-time{line-height:1.35}
.viewer>.overview{order:0;flex:none;height:82px;padding:0;margin:0;border:1px solid var(--line);border-radius:6px;overflow:hidden}
.overview-head{height:23px;padding:0 8px;margin:0;flex-wrap:nowrap}.overview-head h3{font-size:10px}.overview-head .legend{font-size:8px;gap:8px}.timeline-wrap{height:57px;border:0;border-top:1px solid var(--line);border-radius:0}.timeline-help{display:none}
.toolbar{flex:none;min-height:36px;height:auto;margin:0;padding:4px 0 6px;gap:4px}.toolbar .tool{height:27px;font-size:9px;padding:0 6px}.toolbar .tool.icon{font-size:15px;width:27px}.toolbar .tool-label{font-size:8px}.toolbar .divider{height:19px;margin:0 2px}.toolbar .time-zoom{font-size:18px;width:27px}.toolbar #back10,.toolbar #forward10{min-width:56px}.toolbar .select-tool{height:27px;min-width:55px}
.signal-shell{flex:1;min-height:120px;margin:0}.signal-shell svg{height:100%}.signal-foot{display:none!important}
.segment-tachogram{flex:none;height:clamp(100px,14vh,130px);min-height:92px;max-height:160px;margin:0;resize:vertical}.tachogram-head{height:23px}.segment-tachogram svg{height:calc(100% - 23px)}
#morphologyPanel{flex:none;position:relative;height:clamp(150px,20vh,210px);min-height:0;padding:7px 9px;display:flex;flex-direction:column;gap:4px;border-radius:6px;box-shadow:none;overflow:hidden}
#morphologyPanel .morph-header{flex:none;min-height:24px;padding-right:24px;align-items:center;gap:5px;flex-wrap:nowrap}
#morphologyPanel .morph-header h3{font-size:11px;white-space:nowrap;flex-shrink:0}
#morphologyPanel .morph-actions{gap:4px;justify-content:flex-end;flex-wrap:wrap}
#morphologyPanel .morph-actions .tool{font-size:9px;height:24px;padding:0 7px}#morphologyPanel .compare{font-size:8px;max-width:180px}
#morphologyPanel .morph-chart{flex:1;min-height:0;height:auto;width:100%;margin:0;resize:none}
#morphologyPanel .morph-measures{flex:none;gap:6px;font-size:9px;padding-top:3px;line-height:1.2}
#morphologyPanel .morph-native-status{flex:none;font-size:9px;line-height:1.3;margin:0}
#morphologyPanel .panel-fold{right:5px;top:5px;height:21px;width:21px}
#morphologyPanel.is-collapsed{height:32px;min-height:32px;padding:9px}#morphologyPanel.is-collapsed>.fold-title{writing-mode:horizontal-tb;padding:0;margin:0;font-size:11px}
.supplementary{flex:none;min-width:0;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--muted)}
.supplementary>summary{padding:8px 11px;font-size:11px;font-weight:650;cursor:pointer;line-height:14px;min-height:30px}
.supplementary>.bottom{display:grid;grid-template-columns:minmax(240px,1fr) minmax(240px,1fr);grid-template-rows:auto;gap:10px;padding:0 10px 10px}
.supplementary>.bottom>.panel{grid-area:auto;min-height:0;height:auto;padding:12px}.supplementary .panel.is-collapsed{height:42px;min-height:42px}.supplementary .panel.is-collapsed>.fold-title{writing-mode:horizontal-tb;padding:0;margin:0}
.app:has(>.supplementary[open]){height:auto;min-height:calc(100dvh - 56px)}.app:has(>.supplementary[open])>.workspace{flex:none;height:calc(100dvh - 106px)}
.timeline-wrap [data-timeline-handle]{cursor:ew-resize}.timeline-wrap [data-timeline-move]{cursor:grab}.timeline-wrap.selecting-range{cursor:crosshair}.timeline-wrap.dragging-selection{cursor:grabbing}
@media(min-width:1201px){.workspace:has(.viewer.is-collapsed){grid-template-rows:minmax(0,1fr)}}
@media(max-width:1400px) and (min-width:1201px){:root{--events-width:190px;--detail-width:230px;--library-width:184px}.viewer{padding:8px;gap:5px}#morphologyPanel .morph-header{flex-wrap:wrap}#morphologyPanel{height:154px}.overview-head .legend{gap:5px;font-size:7px}.section-heading span{font-size:9px}}
@media(max-height:800px) and (min-width:1201px){.app{padding:8px;gap:6px}.viewer{padding:8px;gap:5px}.viewer-head{min-height:26px}.viewer>.overview{height:76px}.overview-head{height:21px}.timeline-wrap{height:53px}.segment-tachogram{height:102px}#morphologyPanel{height:148px;padding:5px 7px}.toolbar{padding:3px 0}.toolbar .tool{height:25px}.toolbar .select-tool{height:25px}}
@media(max-width:1200px){.app{height:auto;min-height:calc(100dvh - 56px)}.workspace{flex:none;height:auto;grid-template-rows:minmax(600px,calc(100dvh - 108px)) 430px}.app:has(>.supplementary[open])>.workspace{height:auto}.workspace:has(.viewer.is-collapsed){grid-template-rows:42px 430px}.viewer>.overview{height:82px}.timeline-wrap{height:57px}#morphologyPanel{height:170px}.signal-shell{min-height:160px}}
@media(max-width:700px){.workspace{grid-template-rows:minmax(650px,calc(100dvh - 100px)) 380px 430px}.workspace:has(.viewer.is-collapsed){grid-template-rows:42px 380px 430px}.viewer-head{align-items:flex-start}.toolbar{gap:3px}.time-zoom-group{max-width:100%}.toolbar .tool-label{display:none}#morphologyPanel{height:180px}#morphologyPanel .morph-header{flex-wrap:wrap}#morphologyPanel .morph-actions{justify-content:flex-start}.supplementary>.bottom{grid-template-columns:1fr}.overview-head .legend{display:flex;gap:5px;font-size:7px}}
.viewer-head>div:first-child{flex:1;min-width:0}.viewer-actions{display:flex;gap:4px;flex:none}.viewer-actions .tool.icon{height:23px;width:24px;padding:0;font-size:15px}.toolbar .tool{padding-left:5px;padding-right:5px}
#morphologyPanel:has(.caliper-toggle.active:not([hidden])){height:clamp(180px,25vh,230px)}.viewer:has(.caliper-toggle.active:not([hidden])) .signal-shell{min-height:90px}
.morph-options-dialog{width:min(360px,calc(100vw - 32px));padding:20px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);box-shadow:0 14px 50px #142e5033}.morph-options-dialog::backdrop{background:#10264270}.morph-options-dialog form{display:flex;flex-direction:column;gap:16px}.morph-options-dialog h3{font-size:14px;margin:0}.morph-options-dialog select{width:100%;height:32px;font-size:12px;border:1px solid var(--line);border-radius:5px;background:var(--surface-soft);color:var(--ink)}.morph-options-dialog .compare{font-size:12px;line-height:1.5}.morph-options-dialog .tool{align-self:flex-end}

/* ECG and RR share the same horizontal geometry and one visible time axis. */
.signal-stack{display:flex;flex-direction:column;flex:1;min-height:190px;border:1px solid var(--line);border-radius:6px;overflow:hidden}
.signal-stack .signal-shell{flex:1;min-height:90px;border:0;border-radius:0;padding:0;overflow:hidden}
.signal-time-axis{display:none}
.signal-stack .segment-tachogram{height:92px;min-height:92px;max-height:130px;border:0;border-top:1px solid var(--line);border-radius:0;margin:0;padding:0}
.signal-stack .tachogram-head{height:21px}.signal-stack .segment-tachogram svg{height:calc(100% - 21px);width:100%}
.viewer>.overview{height:62px}.overview-head{height:21px}.timeline-wrap{height:39px}
#morphologyPanel{height:clamp(190px,26vh,270px)}
#morphologyPanel:has(.caliper-toggle.active:not([hidden])){height:clamp(200px,28vh,290px)}
.toolbar #prevEvent,.toolbar #nextEvent,.toolbar #prevBeat,.toolbar #nextBeat,.toolbar #back10,.toolbar #forward10{width:25px;min-width:25px;padding:0;font-size:18px;line-height:1}
@media(max-width:1200px){.signal-stack{min-height:230px}}

.morph-mode-split{display:inline-flex;gap:0;border:1px solid var(--line);border-radius:5px;overflow:hidden;flex:none}.morph-mode-split .tool{border:0;border-radius:0!important}.morph-mode-split .tool+.tool{border-left:1px solid var(--line)}.morph-mode-split .tool.active{color:#fff;background:var(--accent,#1764b5)}
#morphologyPanel .morph-header h3{font-size:10px}#morphologyPanel .morph-actions{flex-wrap:nowrap}.native-event-zoom .tool{min-width:22px!important}#morphologyPanel .native-event-zoom [data-event-reset]{display:none}
/* Review controls and patient context. */
:root{--heart-rate-line:#2877ba;--tach-average:#83aa96;--ecg-line:#ce4453}[data-theme="dark"]{--heart-rate-line:#69a7e5;--tach-average:#689780;--ecg-line:#ef7884}
.topbar{display:grid;grid-template-columns:minmax(0,1fr) minmax(190px,auto) minmax(0,1fr);gap:14px}.topbar-start,.topbar-end{display:flex;align-items:center;gap:9px;min-width:0}.topbar-end{justify-content:flex-end}.record-context{min-width:0;max-width:380px;text-align:center;line-height:1.4}.record-context>strong{display:block;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#f0f6ff}.record-context .record-chip{display:block;max-width:none;padding:0;border:0;background:none;font-size:11px;line-height:18px;white-space:nowrap}.record-menu{position:relative;flex:none}.record-menu>summary{list-style:none;cursor:pointer;background:#21446f;border:1px solid #44638b;border-radius:6px;color:#edf5ff;font-size:11px;font-weight:650;padding:8px 11px;white-space:nowrap}.record-menu>summary::-webkit-details-marker{display:none}.record-menu>summary span{padding-left:10px}.record-menu-items{position:absolute;top:calc(100% + 7px);left:0;min-width:180px;border:1px solid var(--line);border-radius:8px;padding:5px;background:var(--surface);box-shadow:0 7px 25px #10264230;z-index:50;display:flex;flex-direction:column;gap:2px}.record-menu-items button,.record-menu-items a{display:flex;align-items:center;justify-content:flex-start;box-sizing:border-box;min-height:35px;padding:8px 10px;border:0;border-radius:4px;background:transparent;color:var(--ink);font-size:12px;font-weight:550;text-decoration:none;white-space:nowrap;width:100%;text-align:left;cursor:pointer}.record-menu-items button:hover,.record-menu-items a:hover{background:var(--surface-soft)}.record-menu-items button[hidden]{display:none}.record-menu-items button:before,.record-menu-items a:before{content:none}
.toolbar{justify-content:space-between;flex-wrap:wrap;gap:5px}.beat-navigation,.view-controls{display:flex;align-items:center;gap:4px}.view-controls{margin-left:auto}.toolbar>.divider{display:none}.view-controls .tool-label{margin-left:3px}.viewer>.overview{height:93px}.timeline-wrap{height:70px}.overview .legend i.trend{background:var(--heart-rate-line)}
.signal-stack{flex:0 1 auto;height:calc(clamp(112px,20.6vh,180px) + 92px);max-height:none;min-height:204px}
#morphologyPanel:not(.is-collapsed){flex:1;min-height:190px;height:auto}#morphologyPanel:has(.caliper-toggle.active:not([hidden])){height:auto}
@media(max-width:1200px){.signal-stack{min-height:172px}.record-context .record-chip{display:block}.record-context{max-width:290px}.topbar{gap:8px}.topbar .brand{font-size:14px}.topbar .brand img{width:27px;height:27px}.topbar-start{gap:5px}.record-menu>summary{padding:7px}}
@media(max-width:700px){.topbar{grid-template-columns:auto minmax(0,1fr) auto;gap:5px}.topbar .brand{font-size:0;gap:0}.topbar .brand span{display:none}.topbar .brand img{width:25px;height:25px}.topbar-start,.topbar-end{gap:3px}.topbar .analysis-chip{min-width:25px;padding:0 3px}.topbar #analysisStatus{display:none}.record-menu>summary{font-size:10px;padding:6px}.record-menu>summary span{padding-left:3px}.record-context>strong{font-size:11px}.record-context .record-chip{font-size:9px}.record-menu-items button,.record-menu-items a{font-size:12px}.toolbar .view-controls{flex-wrap:wrap;justify-content:flex-end}.viewer>.overview{height:93px}}

.recording-picker{position:relative}.picker-close{position:absolute;right:6px;top:5px;width:23px;height:23px;line-height:19px;border:1px solid var(--line);border-radius:4px;background:var(--surface);color:var(--muted);font-size:19px;cursor:pointer}

@media(max-height:760px) and (min-width:1201px){#morphologyPanel:not(.is-collapsed){min-height:170px}}

.topbar{align-items:center}.topbar-start,.topbar-end{align-self:center;height:34px;align-items:center}.record-context{display:flex;flex-direction:column;justify-content:center;align-self:center;gap:1px}.record-context>strong{line-height:17px}.record-context .record-chip{height:auto;min-height:0;line-height:17px;flex:none}.record-menu{align-self:center}.record-menu>summary{box-sizing:border-box;display:flex;align-items:center;justify-content:center;height:32px;padding:0 10px;line-height:1}.record-menu-items{align-items:stretch}.record-menu-items>button,.record-menu-items>a{height:36px;line-height:18px;align-items:center}.topbar-end .viewer-actions{gap:4px;align-items:center}.topbar-end .viewer-actions .tool.icon{display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;margin:0;padding:0;font-size:17px;line-height:1}.record-context>strong:empty{display:none}
@media(max-width:700px){.topbar-end .viewer-actions{gap:2px}.topbar-end .viewer-actions .tool.icon{width:25px;height:28px;font-size:16px}.record-menu>summary{height:28px;padding:0 6px}.record-context>strong,.record-context .record-chip{line-height:15px}}
