/* Shared navigation adjustments also apply to the restored management pages. */
.app-shell:not(.function-sidebar-collapsed) .function-group-title,
.app-shell:not(.function-sidebar-collapsed) .function-link { position:relative; }
.app-shell:not(.function-sidebar-collapsed) .function-group-title > strong,
.app-shell:not(.function-sidebar-collapsed) .function-link > b {
  position:absolute; left:56px; right:2px; text-align:left;
}
.function-group-title strong { font-size:16px; }

/* Paper surround: color only, retaining the existing editor geometry. */
.editor-lab:not(.is-preview-mode),
.editor-lab:not(.is-preview-mode) .editor-lab-paper-viewport { background:#dfe6ef; }

/* Match the standard toolbar dropdowns in the reference. */
.editor-lab .editor-lab-toolbar select {
  appearance:auto!important; color:#344963; background:#fff;
  border:1px solid #d3deed; border-radius:7px; font-weight:400;
}
.editor-lab .editor-lab-toolbar select::picker(select) { appearance:auto!important; }

/* The account belongs to the sticky question filter toolbar. */
.app-content[data-route="s04"] .qm-toolbar { overflow:visible; }
.app-content[data-route="s04"] .qm-toolbar > .page-account {
  top:8px!important; right:18px!important;
}

.editor-lab [data-resize-container][data-node="image"] { margin:12px 0; max-width:100%; }
.editor-lab [data-resize-wrapper] { max-width:100%; }
.editor-lab [data-resize-wrapper] > img { margin:0!important; }
.editor-lab [data-resize-handle] { width:10px; height:10px; border:1.5px solid #3370ff; border-radius:2px; background:white; opacity:0; z-index:2; }
.editor-lab [data-resize-container]:hover [data-resize-handle],
.editor-lab [data-resize-container].ProseMirror-selectednode [data-resize-handle],
.editor-lab [data-resize-container][data-resizing] [data-resize-handle] { opacity:1; }
.editor-lab [data-resize-handle="top-left"],.editor-lab [data-resize-handle="bottom-right"] { cursor:nwse-resize; }
.editor-lab [data-resize-handle="top-right"],.editor-lab [data-resize-handle="bottom-left"] { cursor:nesw-resize; }
.editor-lab.is-preview-mode [data-resize-handle] { display:none; }

/* One connected editing control surface, separated by quiet horizontal rules. */
.editor-lab:not(.is-preview-mode) .editor-lab-header { margin-bottom:0!important; border-bottom:1px solid #e2e8f0!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-toolbar { margin:0!important; border-top:0!important; border-radius:0!important; min-height:118px!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-body { margin-top:0!important; }
.editor-lab:not(.is-preview-mode) .editor-version-bar { margin-top:0!important; padding-top:8px!important; padding-bottom:8px!important; background:#fff; border-top:1px solid #e2e8f0; border-radius:0!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-primary-actions { min-height:54px!important; padding-top:7px!important; padding-bottom:7px!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-primary-actions::before,
.editor-lab:not(.is-preview-mode) .editor-lab-format-label { color:#111!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-toolbar button,
.editor-lab:not(.is-preview-mode) .editor-lab-toolbar label,
.editor-lab:not(.is-preview-mode) .editor-lab-toolbar label span { font-weight:400!important; }

.lecture-sort-button { display:inline-flex; align-items:center; gap:6px; border:0; padding:0; background:transparent; color:inherit; font:inherit; cursor:pointer; }
.lecture-sort-arrows { display:inline-flex; align-items:center; }
.lecture-sort-arrows svg { display:block; }
.lecture-sort-arrows path { fill:#ccd2dc; }
.lecture-sort-arrows path.active { fill:#4388ff; }
.lecture-sort-button:focus-visible { outline:2px solid #8eaff7; outline-offset:4px; border-radius:2px; }

/* Keep content actions prominent and formatting controls visually quiet. */
.editor-lab:not(.is-preview-mode) .editor-lab-primary-actions button { font-weight:700!important; min-height:36px!important; height:36px!important; border-radius:6px!important; padding:0 16px!important; font-size:14px!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-primary-actions { padding-left:0!important; gap:8px!important; min-height:56px!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-primary-actions::before,
.editor-lab:not(.is-preview-mode) .editor-lab-format-label { width:82px!important; flex-basis:82px!important; padding-left:14px!important; font-weight:600!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-format-groups { gap:12px; }
.editor-lab:not(.is-preview-mode) .editor-lab-ribbon-group { padding-right:12px!important; border-color:#edf0f5!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-format-row { padding:10px 0!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-format-row button,
.editor-lab:not(.is-preview-mode) .editor-lab-format-row summary,
.editor-lab:not(.is-preview-mode) .editor-lab-format-row summary span,
.editor-lab:not(.is-preview-mode) .editor-lab-format-row label strong { font-weight:400!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-editor-column { border-top:0!important; }
.editor-lab:not(.is-preview-mode) .editor-version-bar { border-top:1px solid #e8edf4!important; }

/* Editing controls span the workspace edges as a single white surface. */
.editor-lab:not(.is-preview-mode) { padding-top:0!important; padding-left:0!important; padding-right:0!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-header { border:0!important; border-bottom:1px solid #edf0f4!important; border-radius:0!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-toolbar { border:0!important; padding-left:24px!important; padding-right:24px!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-primary-actions { border-bottom:1px solid #edf0f4!important; }
.editor-lab:not(.is-preview-mode) .editor-lab-editor-column { border-left:0!important; border-right:0!important; }
.editor-lab:not(.is-preview-mode) .editor-version-bar { border-top:1px solid #edf0f4!important; border-bottom:1px solid #edf0f4!important; padding-left:24px!important; padding-right:24px!important; }
.app-content:has(> .editor-lab:not(.is-preview-mode)) > .page-account { top:6px!important; }
.lecture-export-row > .lecture-home-mode { justify-self:start; align-self:center; }

.lecture-home .lecture-export-head,
.lecture-home .lecture-export-row { grid-template-columns:minmax(260px,2.5fr) minmax(100px,.8fr) minmax(130px,1fr) minmax(80px,.65fr) 80px; }
.lecture-export-owner { color:#7b8fa8; }

/* An understated illuminated edge around the connected editor controls. */
.editor-lab:not(.is-preview-mode) .editor-lab-header {
  box-shadow:inset 0 1px 0 #fff,inset 1px 0 0 #d9e4f2,inset -1px 0 0 #d9e4f2!important;
}
.editor-lab:not(.is-preview-mode) .editor-lab-toolbar {
  box-shadow:inset 1px 0 0 #d9e4f2,inset -1px 0 0 #d9e4f2!important;
}
.editor-lab:not(.is-preview-mode) .editor-version-bar {
  box-shadow:inset 1px 0 0 #d9e4f2,inset -1px 0 0 #d9e4f2,0 7px 18px rgb(49 78 120 / 10%)!important;
  border-bottom-color:#cfdded!important;
}
.editor-lab.is-preview-mode { background:#edf2f8!important; }
.editor-lab.is-preview-mode .editor-lab-paper-viewport { background:#edf2f8!important; }

/* Subtle shared navigation palette; active destinations retain blue emphasis. */
.function-sidebar { background:#f5f8fc; border-right-color:#dce5f0; }
.function-group:not(.active) { background:transparent; }
.function-group-title:not([aria-current="page"]) strong,
.function-link:not(.active) > b { color:#17191d!important; }
.function-group-title[aria-current="page"] strong,
.function-link.active > b { color:#3370ff; }

.app-content[data-route="s04"] .qm-workspace {
  background:radial-gradient(circle at 4% 0%,rgba(53,104,232,.07),transparent 30%),linear-gradient(180deg,#f9fbff 0,#f4f7fb 330px);
}
.app-shell:not(.function-sidebar-collapsed) .editor-document-status { left:208px; }
.app-shell.function-sidebar-collapsed .editor-document-status { left:76px; }
.editor-lab.is-lecture-layered .editor-document-metrics > span { display:none; }
.editor-lab .editor-document-view select,
.editor-lab .editor-document-view select::picker(select) { appearance:auto!important; }

.function-sidebar .function-group.active { background:transparent; }

/* Header-only refresh: a cool tinted surface and clear action hierarchy. */
.editor-lab:not(.is-preview-mode) .editor-lab-header {
  background:linear-gradient(110deg,#f2f6fd 0%,#edf3fb 100%)!important;
  border-bottom-color:#dce6f3!important;
}
.editor-lab:not(.is-preview-mode) .editor-lab-header .editor-document-type {
  background:#e3ebf7; border:1px solid #d6e1f0; border-radius:10px; box-shadow:inset 0 1px 2px rgb(42 65 103 / 4%);
}
.editor-lab:not(.is-preview-mode) .editor-lab-header .editor-document-type button { border-radius:7px; color:#5b6e87; }
.editor-lab:not(.is-preview-mode) .editor-lab-header .editor-document-type button[aria-pressed="true"] {
  color:#245dcc; background:#fff; box-shadow:0 2px 6px rgb(43 73 121 / 10%);
}
.editor-lab:not(.is-preview-mode) .editor-lab-header [data-preview-entry] {
  background:linear-gradient(180deg,#3975f2,#2862de)!important; border:1px solid #2f66df!important;
  border-radius:8px!important; box-shadow:0 3px 8px rgb(43 101 224 / 16%)!important;
}
.editor-lab:not(.is-preview-mode) .editor-lab-header [data-preview-entry]:hover { filter:brightness(1.05); }
.editor-lab:not(.is-preview-mode) .editor-lab-header [data-editor-more],
.editor-lab:not(.is-preview-mode) .editor-lab-header [data-editor-back] {
  background:rgb(255 255 255 / 85%)!important; color:#405775!important;
  border:1px solid #d4e0ef!important; border-radius:8px!important; box-shadow:0 1px 2px rgb(36 65 107 / 4%)!important;
}

/* Preview header matches the editor tint, with a 20% taller bar. */
.editor-lab.is-preview-mode .editor-lab-header {
  background:linear-gradient(110deg,#f2f6fd 0%,#edf3fb 100%)!important;
  border-bottom-color:#dce6f3!important;
  min-height:81.6px!important;
  padding-top:16.8px!important;
  padding-bottom:16.8px!important;
}
.app-content:has(> .editor-lab.is-preview-mode) > .page-account { top:11.8px!important; }

#editor-lab-picker .editor-picker-filters { grid-template-columns:repeat(5,minmax(0,1fr)); }
@media (max-width:760px) { #editor-lab-picker .editor-picker-filters { grid-template-columns:repeat(2,minmax(0,1fr)); } }
/* File preview window controls. */
.lecture-file-preview { width:540px; max-height:calc(100vh - 20px); }
.lecture-file-preview > header { display:grid!important; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:center; gap:12px; height:48px; padding:0 12px; background:#f4f7fc; border-bottom:1px solid #e1e8f2; }
.lecture-file-preview > header strong { font-size:14px; }
.lecture-file-preview > header .preview-edit { font-size:14px; padding:5px 14px; border-radius:5px; background:#306cf0; color:white; }
.preview-window-actions { display:flex; justify-content:flex-end; gap:7px; }
.lecture-file-preview .preview-window-actions button { width:26px; height:28px; font-size:20px; border-radius:4px; }
.lecture-file-preview .preview-window-actions button:hover { background:#e2eaf6; }
.lecture-file-preview .lecture-preview-body { height:510px; max-height:calc(100vh - 112px); }
.lecture-file-preview > footer { display:flex; align-items:center; justify-content:flex-end; gap:16px; height:40px; padding:0 16px; background:#f4f7fc; border-top:1px solid #e1e8f2; color:#576b87; }
.lecture-file-preview > footer button { border:0; background:transparent; font-size:24px; cursor:pointer; color:inherit; }
.lecture-file-preview.is-maximized { inset:10px!important; width:auto; max-width:none; height:calc(100vh - 20px); }
.lecture-file-preview.is-maximized .lecture-preview-body { height:calc(100vh - 110px); }
.lecture-file-preview.is-minimized { top:auto!important; left:auto!important; right:20px; bottom:16px; }
.lecture-file-preview.is-minimized .lecture-preview-body,.lecture-file-preview.is-minimized > footer { display:none; }
.lecture-home .lecture-file-pagination button { font-weight:700!important; }
.lecture-home .lecture-home-state.changed { background:#fff9d9!important; color:#967617!important; }
.lecture-file-preview > header { height:40px; grid-template-columns:minmax(0,1fr) auto auto; gap:22px; }
.lecture-file-preview > header .preview-edit { font-size:13px; padding:3px 13px; margin-right:14px; }
.lecture-file-preview .preview-window-actions { gap:4px; }
.lecture-file-preview .preview-window-actions button { color:#637083; font:18px Arial,sans-serif; width:28px; }
.lecture-file-preview .preview-window-actions [data-window-close]:hover { color:#fff; background:#dc5050; }
.lecture-file-preview > footer { height:34px; gap:8px; }
.lecture-file-preview > footer button { display:grid; place-items:center; width:28px; height:26px; font:20px Arial,sans-serif; border:1px solid #dce5f1; border-radius:5px; background:#fff; }
.lecture-file-preview > footer select { appearance:auto; border:1px solid #dce5f1; border-radius:5px; background:#fff; height:26px; color:#576b87; padding:0 6px; font-size:12px; }
.lecture-file-preview.is-maximized .lecture-preview-body { height:calc(100vh - 94px); }
.editor-mindmap { position:relative; box-sizing:border-box; }
.editor-mindmap.ProseMirror-selectednode { outline:2px solid #3977ef; }
.mindmap-resize-handle { position:absolute; right:0; bottom:0; width:12px; height:12px; background:#fff; border:2px solid #3977ef; cursor:nwse-resize; z-index:15; touch-action:none; opacity:0; }
.editor-mindmap:hover .mindmap-resize-handle,.editor-mindmap.ProseMirror-selectednode .mindmap-resize-handle { opacity:1; }
.editor-mindmap[style*="margin-left: auto"][style*="margin-right: 0"] .mindmap-resize-handle { left:0; right:auto; cursor:nesw-resize; }
.lecture-home .lecture-home-state.pending { background:#edf2f8!important; color:#526984!important; }
.lecture-home .lecture-home-state.changed { background:#fff5cc!important; color:#967017!important; }
.editor-lab.is-preview-mode .editor-mindmap,
.editor-lab.is-preview-mode .editor-mindmap-preview,
.editor-lab.is-preview-mode .editor-mindmap-preview .map-container { background:transparent!important; background-image:none!important; border:0!important; box-shadow:none!important; }
.lecture-file-preview > footer { display:flex!important; align-items:center!important; }
.lecture-file-preview > footer button,.lecture-file-preview > footer select { box-sizing:border-box; height:28px!important; min-height:28px!important; margin:0!important; vertical-align:middle; }
.lecture-file-preview > footer button { display:flex!important; align-items:center; justify-content:center; padding:0!important; line-height:1; }
.lecture-file-preview svg { display:block; flex-shrink:0; }
.lecture-file-preview .preview-window-actions button { display:flex; align-items:center; justify-content:center; }
.lecture-home .lecture-home-state.pending,
[data-lecture-assets-dialog] .lecture-home-state.pending { background:#ffead5!important; color:#c15b0b!important; }
[data-lecture-assets-dialog] .lecture-home-state.changed { background:#fff5cc; color:#967017; }
[data-lecture-assets-dialog] .history-file-meta { display:flex; align-items:center; gap:12px; margin-top:7px; }
[data-lecture-assets-dialog] .history-file-meta .lecture-home-state { font-size:11px; min-height:23px; }
#editor-lab-picker .reference-pick-row .reference-pick-excerpt { color:#53657d; font-size:13px; line-height:1.6; font-weight:400; }
#editor-lab-picker .reference-pick-row .reference-pick-stars { display:inline; margin-left:10px; color:#b77916; letter-spacing:1px; }
#editor-lab-picker .reference-pick-row .reference-pick-record.is-referenced { color:#186447; background:#e8f5ed; width:fit-content; padding:4px 9px; border-radius:5px; }
[data-lecture-assets-dialog] .lecture-assets-title h3 { color:#2d68e8; font-size:16px; font-weight:650; }
[data-lecture-assets-dialog] header h2 { font-size:22px; }

/* Reference preview sits above the handout picker, with My Files window styling. */
dialog.handout-reference-preview { margin:0; padding:0; color:#16304d; max-width:calc(100vw - 20px); }
dialog.handout-reference-preview::backdrop { background:rgba(25,43,66,.16); }

/* One modal layer: reference list on the left, interactive preview on the right. */
#editor-lab-handout-picker { width:min(660px,calc(100vw - 40px))!important; }
#editor-lab-handout-picker[open].has-handout-preview { display:grid; grid-template-columns:minmax(0, .95fr) minmax(0, 1.05fr); gap:16px; width:min(1420px,calc(100vw - 40px))!important; background:transparent; border:0; box-shadow:none; overflow:visible; }
#editor-lab-handout-picker > form { height:min(800px,calc(100dvh - 64px)); max-height:calc(100dvh - 64px); min-width:0; border-radius:14px; }
#editor-lab-handout-picker .handout-reference-preview { position:relative; inset:auto!important; margin:0; width:100%; max-width:none; height:min(800px,calc(100dvh - 64px)); max-height:none; display:grid; grid-template-rows:40px minmax(0,1fr) 34px; align-self:start; box-sizing:border-box; }
#editor-lab-handout-picker .handout-reference-preview > header { position:static; min-height:40px!important; height:40px; padding:0 12px!important; gap:12px; background:#f4f7fc; }
#editor-lab-handout-picker .handout-reference-preview > header .preview-edit { width:auto; height:26px; }
#editor-lab-handout-picker .handout-reference-preview .lecture-preview-body { height:100%; max-height:none; min-height:0; }
#editor-lab-handout-picker .handout-reference-preview > footer { padding:0 12px; height:34px; min-height:0; }
#editor-lab-handout-picker .handout-reference-preview.is-minimized { height:40px; grid-template-rows:40px; }
#editor-lab-handout-picker .handout-reference-preview.is-maximized { position:fixed; inset:16px!important; width:calc(100vw - 32px); height:calc(100dvh - 32px); z-index:100; }
#editor-lab-handout-picker .editor-handout-picker-item { grid-template-columns:minmax(0,1fr) auto; }
#editor-lab-handout-picker .handout-picker-filters { gap:8px; }
#editor-lab-handout-picker .handout-picker-filters button { padding:0 10px; }
#editor-lab-handout-picker .handout-reference-preview .preview-window-actions { display:flex; align-items:center; gap:4px; }
#editor-lab-handout-picker .handout-reference-preview > header button { width:28px!important; height:28px!important; padding:0; border-radius:4px!important; background:transparent!important; }
#editor-lab-handout-picker .handout-reference-preview > header .preview-edit { width:auto!important; height:26px!important; padding:3px 13px; background:#306cf0!important; color:white; margin-right:4px; }
#editor-lab-handout-picker .handout-reference-preview > footer { position:static; padding:0 12px!important; }
#editor-lab-handout-picker .handout-reference-preview > footer button { min-width:28px; width:28px!important; height:28px!important; padding:0!important; border-radius:5px!important; }
#editor-lab-handout-picker .handout-reference-preview > footer select { width:76px; min-height:28px; height:28px; padding:0 6px; border-radius:5px; font-size:12px; }
#editor-lab-handout-picker .handout-picker-filters { grid-template-columns:repeat(4,minmax(0,1fr)) auto; }
#editor-lab-handout-picker .handout-picker-filters select { padding-left:8px; padding-right:6px; font-size:12px; }
@supports (appearance:base-select) {
  #editor-lab-export-confirm select, #editor-lab-export-confirm select::picker(select),
  #editor-lab-handout-picker .handout-picker-filters select,
  #editor-lab-handout-picker .handout-picker-filters select::picker(select) { appearance:base-select!important; }
  #editor-lab-export-confirm select::picker(select),
  #editor-lab-handout-picker .handout-picker-filters select::picker(select) {
    position:fixed; inset:auto; top:anchor(bottom); left:anchor(left);
    position-area:none; position-try-fallbacks:none; margin:6px 0 0;
    min-width:anchor-size(width); max-height:220px; overflow-y:auto;
    border:1px solid #dbe3ee; border-radius:9px; padding:5px;
    background:#fff; box-shadow:0 8px 24px #24395420;
  }
}

@supports (appearance:base-select) {
#editor-lab-export-confirm [data-export-grade] { anchor-name:--export-grade; }
#editor-lab-export-confirm [data-export-grade]::picker(select) { position-anchor:--export-grade; }
#editor-lab-export-confirm [data-export-year] { anchor-name:--export-year; }
#editor-lab-export-confirm [data-export-year]::picker(select) { position-anchor:--export-year; }
#editor-lab-export-confirm [data-export-season] { anchor-name:--export-season; }
#editor-lab-export-confirm [data-export-season]::picker(select) { position-anchor:--export-season; }
#editor-lab-export-confirm [data-export-audience] { anchor-name:--export-audience; }
#editor-lab-export-confirm [data-export-audience]::picker(select) { position-anchor:--export-audience; }
#editor-lab-export-confirm [data-export-format] { anchor-name:--export-format; }
#editor-lab-export-confirm [data-export-format]::picker(select) { position-anchor:--export-format; }
#editor-lab-export-confirm [data-export-version] { anchor-name:--export-version; }
#editor-lab-export-confirm [data-export-version]::picker(select) { position-anchor:--export-version; }
#editor-lab-handout-picker [data-handout-filter="grade"] { anchor-name:--handout-grade; }
#editor-lab-handout-picker [data-handout-filter="grade"]::picker(select) { position-anchor:--handout-grade; }
#editor-lab-handout-picker [data-handout-filter="year"] { anchor-name:--handout-year; }
#editor-lab-handout-picker [data-handout-filter="year"]::picker(select) { position-anchor:--handout-year; }
#editor-lab-handout-picker [data-handout-filter="season"] { anchor-name:--handout-season; }
#editor-lab-handout-picker [data-handout-filter="season"]::picker(select) { position-anchor:--handout-season; }
#editor-lab-handout-picker [data-handout-filter="lesson"] { anchor-name:--handout-lesson; }
#editor-lab-handout-picker [data-handout-filter="lesson"]::picker(select) { position-anchor:--handout-lesson; }
}
