/* Shared surfaces and independent navigation. Loaded after all legacy styles. */
:root{--text-muted:#626e7e;--soft-accent:#edf4ff;--accent-line:#b6cef1}
html[data-theme=dark]{--text-muted:#b2bac7;--soft-accent:#233650;--accent-line:#496a98}
#open-manual-review{padding:12px;font-size:14px}
#sidebar .sidebar-library{gap:12px;align-items:center}#sidebar .sidebar-library svg{width:20px;height:20px;flex:none}
#library-view .library-view-head,#library-cases,#library-content,.library-upload-panel,.community-manuals,.supplement-manuals{max-width:1180px;margin-left:auto;margin-right:auto}
.manual-page{--muted:var(--text-muted);--line:#e1e5ec;--ink:var(--text-main)}
.manual-summary{flex-wrap:wrap;gap:12px}.manual-summary-main{flex:1;min-width:240px}.manual-code{min-width:0;height:auto;padding:12px;font-size:14px;overflow-wrap:anywhere;border-radius:10px}
.manual-card{box-shadow:0 2px 9px #172f4d04}.manual-card-header{padding-bottom:16px}.manual-card-header h3{font-size:19px;font-weight:650}.manual-card-header h3 span{display:inline-grid;place-items:center;width:28px;height:28px;border-radius:8px;background:var(--soft-accent);color:var(--accent)}
.manual-video-card{margin-top:24px;border:1px solid var(--accent-line);padding:24px;background:var(--surface)}
.manual-video-card .manual-card-header h3{font-size:22px}.manual-video-layout{display:flex;flex-direction:column;gap:18px;align-items:stretch}.manual-video-frame{width:100%}.manual-video-frame video{width:100%;max-height:none;aspect-ratio:16/9;object-fit:contain}
.manual-video-copy{position:relative}.manual-video-copy h4{font-size:18px;margin:4px 0 6px}.manual-video-copy p{margin:5px 0;color:var(--text-muted)}.manual-video-copy .manual-eyebrow{color:var(--accent);font-weight:600;font-size:11px;letter-spacing:.06em}.manual-video-actions{margin-top:12px}
.video-navigation{border-top:1px solid var(--line);margin-top:22px;padding-top:20px;color:var(--text-main)}.video-navigation-head{display:flex;gap:16px;align-items:baseline;justify-content:space-between;flex-wrap:wrap}.video-navigation-head h4{margin:0;font-size:17px}.video-navigation-head p{margin:0;color:var(--text-muted);font-size:12px}
.chapter-timeline{display:flex;gap:4px;margin:17px 0 12px;height:12px}.chapter-segment{position:relative;flex-basis:0;min-width:0;border:0;padding:0;background:var(--surface-hover);border-radius:3px;overflow:hidden;cursor:pointer}.chapter-segment-fill{display:block;height:100%;background:var(--accent);pointer-events:none}.chapter-segment:hover{outline:2px solid var(--accent);outline-offset:2px}.chapter-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:16px}.chapter-now{flex:1;min-width:200px;font-size:12px;color:var(--text-muted)}.chapter-toolbar button{font-size:12px;padding:7px 10px}.chapter-toolbar button[aria-pressed=true]{background:var(--soft-accent);border-color:var(--accent-line);color:var(--accent)}
.video-navigation-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);gap:20px}.chapter-list{display:flex;flex-direction:column;gap:6px}.chapter-item{display:flex;align-items:center;gap:10px;padding:12px;border:1px solid transparent;border-radius:10px;background:var(--surface-soft);color:var(--text-main);cursor:pointer;text-align:left;font:inherit;font-size:13px;line-height:1.5}.chapter-item:hover{background:var(--surface-hover)}.chapter-item[aria-current=true]{background:var(--soft-accent);border-color:var(--accent-line);color:var(--accent)}.chapter-number,.chapter-time{font-size:11px;font-variant-numeric:tabular-nums;color:var(--text-muted)}.chapter-label{flex:1}.chapter-item[aria-current=true] .chapter-number{color:var(--accent)}
.video-transcript{min-width:0;border:1px solid var(--line);border-radius:12px;padding:12px;background:var(--surface)}.transcript-search{width:100%;box-sizing:border-box;font:inherit;font-size:13px;border:1px solid var(--line);padding:10px 12px;border-radius:8px;color:var(--text-main);background:var(--surface-soft)}.transcript-status{font-size:11px;color:var(--text-muted);margin:9px 0}.transcript-cues{max-height:265px;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}.transcript-cue{display:flex;align-items:flex-start;gap:12px;text-align:left;width:100%;padding:9px;border:0;border-radius:7px;background:transparent;color:var(--text-main);font:inherit;font-size:12px;line-height:1.7;cursor:pointer}.transcript-cue time{flex:none;font-variant-numeric:tabular-nums;color:var(--text-muted)}.transcript-cue:hover{background:var(--surface-soft)}.transcript-cue.active{background:var(--soft-accent);color:var(--accent)}.chapter-marks{position:absolute;bottom:12px;left:16px;right:16px;height:5px;pointer-events:none}.chapter-marks span{position:absolute;top:0;height:5px;width:2px;background:#1119}.manual-player:fullscreen .chapter-marks{left:30px;right:30px;bottom:30px}.video-navigation :focus-visible{outline:2px solid var(--accent);outline-offset:3px}
/* Dark theme covers nested content, selections, dialogs, and diagnostic cards. */
html[data-theme=dark] .manual-page{--page-text-primary:#ececec;--page-text-secondary:#c4cbd5;--page-text-tertiary:#b2bac7;--muted:#b2bac7;--ink:#ececec;--line:#404044}
html[data-theme=dark] :is(.manual-code,.account-avatar){background:var(--soft-accent);color:var(--accent)}
html[data-theme=dark] .manual-evidence-tab[aria-pressed=true]{background:var(--soft-accent);border-color:var(--accent-line);color:var(--accent)}
html[data-theme=dark] :is(.manual-causes summary,.manual-card-header h3 span,.result-label,.restored-result-head h3,.restored-analysis-nav h3){color:var(--accent)}
html[data-theme=dark] :is(.manual-safety,.manual-selector){box-shadow:none}
html[data-theme=dark] :is(.manual-evidence-image img,.manual-dialog-scroll){background:#29292b}
html[data-theme=dark] :is(.library-view-head p,.supplement-manuals>p,.supplement-card p,.supplement-card small,.account-dialog p,.sandbox-header p,.sandbox-empty,.sandbox-file small,.sandbox-record small,.feature-cards small,#welcome>p,.detail-panel>summary small,.restored-peaks,.chart-range,.image-grid figcaption,.portal-eyebrow){color:var(--text-muted)}
html[data-theme=dark] :is(.sandbox-file,.sandbox-record,.restored-result-card,.restored-result-head,.supplement-manuals,.account-tabs,.manual-dialog-head,.history-group){border-color:var(--line)}
html[data-theme=dark] :is(.account-tabs button[aria-selected=true],.restored-switch button.active){color:var(--accent);border-color:var(--accent-line)}
html[data-theme=dark] :is(.dialog-close,.conversation-action-buttons button,.delete-account-buttons button,.message-action:hover,.message-edit-box){background:var(--surface-hover);color:var(--text-main);border-color:var(--line)}
html[data-theme=dark] :is(.plot,.image-grid img,.restored-chart-tools select,.industrial-model-mark){background:var(--surface-soft);border-color:var(--line);color:var(--text-main)}
html[data-theme=dark] :is(.industrial-model-mark strong,.industrial-artifact-title,.industrial-prompt){color:var(--text-main)}
html[data-theme=dark] .industrial-artifact-state{color:var(--text-muted)}
html[data-theme=dark] :is(.notice,.account-danger,.admin-delete-warning){background:#3b2b23;color:#f0c1a1;border-color:#72513e}
html[data-theme=dark] #drop-overlay{background:#17283eee;color:#c6ddff;border-color:#7cacfa}html[data-theme=dark] #drop-overlay span{color:#c6ddff}
html[data-theme=dark] .manual-button:hover{background:var(--surface-hover)}
html[data-theme=dark] #admin-view button.active{background:var(--soft-accent);border-color:var(--accent-line);color:var(--accent)}
html[data-theme=dark] input::placeholder,html[data-theme=dark] textarea::placeholder{color:#a1a9b6}
html[data-theme=dark] .manual-primary,html[data-theme=dark] .portal-primary{color:white}
@media(max-width:760px){.video-navigation-grid{grid-template-columns:1fr}.manual-video-card{padding:16px}.manual-video-card .manual-card-header h3{font-size:19px}.manual-video-copy h4{font-size:17px}.manual-summary-main{min-width:0}.manual-card-header>span{line-height:1.6}.chapter-now{flex-basis:100%}.manual-summary{gap:12px}.manual-code{max-width:110px;font-size:12px}.manual-video-actions .manual-button{white-space:normal}.video-navigation-head{gap:6px}.chapter-item{padding:10px}}
html[data-theme=dark] #history .history-row:is(:hover,.active,.menu-open),html[data-theme=dark] #history button:hover{background:var(--surface-hover);color:var(--text-main)}
html[data-theme=dark] #history .history-row .history-title{background:transparent;color:var(--text-main)}
html[data-theme=dark] #history .history-row :is(.history-more,.history-pin):hover{background:#454548;color:var(--text-main)}
html[data-theme=dark] :is(.summary-cell ul,.summary-cell li,.summary-cell p,.diagnosis-card .limitations){color:#c4cbd5}
html[data-theme=dark] .user-files a{background:var(--surface-hover);border-color:var(--line);color:var(--accent)}
html[data-theme=dark] :is(.conversation-action-description,.conversation-action-dialog label){color:var(--text-muted)}
html[data-theme=dark] .conversation-action-buttons .conversation-confirm{background:#286bd1;color:white}
html[data-theme=dark] .conversation-action-buttons .conversation-confirm.danger{background:#b33f48;color:white}

/* restored-plot is the SVG itself, not an SVG container. */
html[data-theme=dark] svg.restored-plot{background:#20262e}
html[data-theme=dark] svg.restored-plot polyline{stroke:#93c5fd;stroke-width:1.5}
html[data-theme=dark] svg.restored-plot line{stroke:#414b59}
html[data-theme=dark] svg.restored-plot>path{stroke:#8795a8}
html[data-theme=dark] svg.restored-plot text{fill:#c7d2e1}

/* Named chapter strip directly below the video, with time-proportional segments. */
.manual-video-layout>.chapter-timeline{display:flex;gap:0;height:auto;min-height:55px;margin:-8px 0 0;border:1px solid var(--line);border-radius:9px;overflow-x:auto;overflow-y:hidden;background:var(--surface-soft);scrollbar-width:thin}
.manual-video-layout .chapter-segment{flex-basis:0;flex-shrink:0;min-width:76px;min-height:54px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:8px 10px 10px;border:0;border-right:1px solid var(--line);border-radius:0;overflow:hidden;background:transparent;color:var(--text-main);font:inherit;cursor:pointer}
.manual-video-layout .chapter-segment:last-child{border-right:0}
.manual-video-layout .chapter-segment-fill{position:absolute;bottom:0;left:0;height:3px;background:var(--accent)}
.chapter-segment-label{position:relative;font-size:12px;font-weight:550;line-height:1.4;white-space:nowrap}
.chapter-segment-time{position:relative;font-size:10px;line-height:1.2;color:var(--text-muted);font-variant-numeric:tabular-nums}
.manual-video-layout .chapter-segment.active{background:var(--soft-accent);color:var(--accent);box-shadow:inset 0 3px var(--accent)}
.manual-video-layout .chapter-segment.active .chapter-segment-label{font-weight:700}
.manual-video-layout .chapter-segment:hover{background:var(--surface-hover);outline:none}
.manual-video-layout .chapter-segment:focus-visible{outline:2px solid var(--accent);outline-offset:-3px}
@media(max-width:760px){.manual-video-layout .chapter-segment{min-width:96px}.manual-video-layout>.chapter-timeline{margin-top:-8px}}
