@property --primary-top { syntax: "<color>"; inherits: false; initial-value: transparent; }
@property --primary-bottom { syntax: "<color>"; inherits: false; initial-value: transparent; }
/* UI revision 2. One lighting model, soft surfaces, compact reader geometry.
   Brand accent variables are configured by brand.ts before React mounts. */
:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #e9f3ff; --surface: #ffffff; --surface-2: #f2f7ff; --canvas: #dfeafa;
  --ink: #192d48; --secondary: #415973; --muted: #526987;
  --line: #cfdded; --line-strong: #788eaa;
  --accent: var(--brand-light-accent); --accent-dark: var(--brand-light-hover);
  --accent-soft: var(--brand-light-soft); --accent-contrast: var(--brand-light-contrast);
  --accent-ink: var(--brand-light-ink); --accent-sheen: var(--brand-light-sheen);
  --danger: #b83342; --danger-soft: #fff0f2; --success: #236b51; --success-soft: #eaf6f0;
  --warning: #8a570a; --warning-soft: #fff5df;
  --focus: #354ecf; --backdrop: #101d3978;
  --surface-gradient: linear-gradient(155deg, #ffffff, #f7faff);
  --control-gradient: linear-gradient(180deg, #ffffff, #f1f6fd);
  --edge-highlight: #ffffffeb;
  --shadow-control: inset 0 1px 0 var(--edge-highlight), 0 2px 3px #2546760a, 0 5px 12px #2546760b;
  --shadow-pressed: inset 0 2px 4px #24436d20;
  --shadow-tinted-control: inset 0 1px 2px #4965f908, 0 2px 3px #2546760a, 0 5px 12px #2546760b;
  --shadow-accent: inset 0 1px 0 #ffffff20, inset 0 0 0 #10264d00, 0 2px 3px #2546760a, 0 5px 12px #2546760b;
  --shadow-accent-down: inset 0 1px 0 #ffffff00, inset 0 2px 4px #10264d30, 0 1px 2px #2546760a, 0 2px 5px #25467608;
  --shadow-sm: inset 0 1px 0 var(--edge-highlight), 0 5px 12px #24436d09, 0 14px 30px #24436d0c;
  --shadow-menu: inset 0 1px 0 var(--edge-highlight), 0 8px 20px #243f6b17, 0 24px 55px #243f6b24;
  --shadow: inset 0 1px 0 var(--edge-highlight), 0 12px 30px #20365f1f, 0 36px 90px #20365f30;
  --font-ui: "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: var(--font-ui); --font-serif: var(--font-ui);
  --text-xs: 11px; --text-sm: 12px; --text-body: 13px; --text-title: 16px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px;
  --radius-xs: 8px; --radius-sm: 10px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 18px; --radius-card: 22px;
  --control-height: 36px; --control-compact: 32px; --control-touch: 40px;
  --icon-size: 18px; --icon-stroke: 1.75;
  font-family: var(--font-ui); color: var(--ink);
}
:root[data-theme="dark"], [data-theme="dark"] {
  color-scheme: dark;
  --bg: #272e41; --surface: #0c1826; --surface-2: #102238; --canvas: #272e41;
  --ink: #edf3ff; --secondary: #c7d6e9; --muted: #a6b9d2;
  --line: #29415b; --line-strong: #6683a2;
  --accent: var(--brand-dark-accent); --accent-dark: var(--brand-dark-hover);
  --accent-soft: var(--brand-dark-soft); --accent-contrast: var(--brand-dark-contrast);
  --accent-ink: var(--brand-dark-ink); --accent-sheen: var(--brand-dark-sheen);
  --danger: #ffadb5; --danger-soft: #442b38; --success: #8ad8b5; --success-soft: #223f39;
  --warning: #edc27b; --warning-soft: #43392b;
  --focus: #c5b7ff; --backdrop: #030b17b8;
  --surface-gradient: linear-gradient(155deg, #102033, #0c1826 80%);
  --control-gradient: linear-gradient(180deg, #19324d, #102238);
  --edge-highlight: #b7d2ff18;
  --shadow-control: inset 0 1px 0 var(--edge-highlight), 0 2px 3px #0003, 0 5px 12px #0002;
  --shadow-pressed: inset 0 2px 5px #0007;
  --shadow-tinted-control: inset 0 1px 2px #8466fd0a, 0 2px 3px #0003, 0 5px 12px #0002;
  --shadow-accent: inset 0 1px 0 #ffffff18, inset 0 0 0 #0000, 0 2px 3px #0003, 0 5px 12px #0002;
  --shadow-accent-down: inset 0 1px 0 #ffffff00, inset 0 2px 4px #0005, 0 1px 2px #0003, 0 2px 5px #0002;
  --shadow-sm: inset 0 1px 0 var(--edge-highlight), 0 5px 15px #0002, 0 16px 32px #0003;
  --shadow-menu: inset 0 1px 0 #b7d2ff25, 0 8px 20px #0006, 0 24px 55px #0006;
  --shadow: inset 0 1px 0 #b7d2ff25, 0 12px 30px #0007, 0 36px 90px #0008;
}
body { font-family: var(--font-ui); font-size: var(--text-body); }
/* Keep native scrolling and platform high-contrast behavior. */
:is(html.library-scroll-root,.contained-modal > .dialog-body) {
  scrollbar-color: var(--line-strong) var(--surface-2);
  scrollbar-width: auto;
}
:is(html.library-scroll-root,.contained-modal > .dialog-body)::-webkit-scrollbar { width:14px; height:14px; }
:is(html.library-scroll-root,.contained-modal > .dialog-body)::-webkit-scrollbar-track { background:var(--surface-2); }
:is(html.library-scroll-root,.contained-modal > .dialog-body)::-webkit-scrollbar-thumb { background:var(--line-strong); border:3px solid var(--surface-2); border-radius:var(--radius-sm); min-height:32px; }
:is(html.library-scroll-root,.contained-modal > .dialog-body)::-webkit-scrollbar-thumb:hover { background:var(--accent-ink); }
@media (forced-colors:active) {
  :is(html.library-scroll-root,.contained-modal > .dialog-body) { scrollbar-color:auto; }
}
h1,h2,h3,.document-title-block > input,.sidebar-heading { font-family: var(--font-heading); font-weight: 650; }
button,input,:is(select,.select-trigger),textarea { font-family: inherit; }
button svg,.lucide { stroke-width: var(--icon-stroke); }
input,textarea,:is(select,.select-trigger) { border-color: var(--line-strong); accent-color: var(--accent-ink); }
input::placeholder,textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus,textarea:focus,:is(select,.select-trigger):focus { outline: 2px solid var(--focus); outline-offset: 2px; }
button:focus-visible,a:focus-visible,[tabindex]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button:disabled,button[aria-disabled="true"] { opacity: .5; }
button[aria-disabled="true"] { cursor: not-allowed; }
.primary,.button,.text-button { font-size: var(--text-body); font-weight: 600; }
.primary,.button { min-height: var(--control-height); border-radius: var(--radius-md); padding: 8px 13px; gap: 7px; box-shadow: var(--shadow-control); transition: background-color .12s,border-color .12s,box-shadow .12s; }
.primary,[data-theme="dark"] .primary,.brand-mark,.workspace-logo {
  --primary-top: var(--accent-sheen); --primary-bottom: var(--accent);
  background: linear-gradient(180deg,var(--primary-top),var(--primary-bottom));
  color: var(--accent-contrast); border: 1px solid var(--accent);
  box-shadow: var(--shadow-accent);
  transition: --primary-top .16s ease, --primary-bottom .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.primary:hover:enabled:not([aria-disabled="true"]),.workspace-logo:hover:enabled {
  --primary-top: color-mix(in srgb,var(--accent-sheen) 65%,var(--accent-dark));
  --primary-bottom: var(--accent-dark); border-color: var(--accent-dark);
}
.primary:active:enabled:not([aria-disabled="true"]),.workspace-logo:active:enabled {
  --primary-top: var(--accent-dark); --primary-bottom: var(--accent-dark); box-shadow: var(--shadow-accent-down);
}
.button:active:not(:disabled) { box-shadow: var(--shadow-pressed); }
.button { background: var(--control-gradient); border: 1px solid var(--line-strong); color: var(--secondary); }
.button:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); border-color: var(--muted); }
.button.ghost,.text-button { box-shadow: none; background: transparent; border-color: transparent; color: var(--accent-ink); }
.button.ghost:hover:not(:disabled),.text-button:hover:not(:disabled) { background: var(--accent-soft); text-decoration: none; }
.danger,.button.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.danger:hover:not(:disabled),.danger-text:hover:not(:disabled) { background: var(--danger-soft); }
.icon-button { border-radius: var(--radius-sm); color: var(--secondary); }
.icon-button:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.icon-button[aria-pressed="true"],.icon-button.selected { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent); }
.ui-tooltip { position: fixed; z-index: 120; pointer-events: none; max-width: min(260px,calc(100vw - 16px)); padding: 7px 10px; background: var(--ink); color: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); font: 12px/1.45 var(--font-ui); }
.field > label { color: var(--secondary); font-size: var(--text-body); font-weight: 600; }
.field > label > input,.field > label > :is(select,.select-trigger),.field > label > textarea,:is(select,.select-trigger),.comment-composer > textarea,.comment-card textarea { border: 1px solid var(--line-strong); border-radius: var(--radius-md); font-size: var(--text-body); }
.field > label > input,.field > label > :is(select,.select-trigger) { min-height: 40px; }
.field > small,.small-text,.info-note,.notice { font-size: var(--text-sm); }
.field > small { color: var(--muted); }
.check-row { min-height: 30px; font-size: var(--text-sm); gap: 8px; }
.check-row input { width: 15px; height: 15px; flex-shrink: 0; }
.avatar { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--line); }
.brand-mark,.workspace-logo { border-radius: var(--radius-md); }
.brand { letter-spacing: -.3px; font-weight: 650; }
.error-note,.workspace-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); border-radius: var(--radius-md); }
.notice,.info-note,.recipient-preview,.permission-editor { border-color: var(--line); background: var(--surface-2); border-radius: var(--radius-md); }
.success-text { color: var(--success); }
.toast { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow); color: var(--ink); font-size: 13px; }
.toast > svg { color: var(--success); }
.modal-backdrop,.drawer-backdrop { background: var(--backdrop); backdrop-filter: none; }
.modal { border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 24px; background: var(--surface); box-shadow: var(--shadow); }
.modal > header { position: sticky; top: -24px; z-index: 8; background: var(--surface); border-bottom: 1px solid var(--line); padding: 16px 24px; margin: -24px -24px 20px; gap: 16px; }
.modal > header h2 { font-size: 18px; line-height: 1.35; font-weight: 650; letter-spacing: -.35px; }
.modal > header .icon-button { width: 32px; height: 32px; border: 1px solid var(--line); margin: 0; flex-shrink: 0; }
.modal h3.section-label { color: var(--secondary); font-size: 12px; font-weight: 650; text-transform: none; letter-spacing: 0; }
.modal-actions,.dialog-actions { padding-top: 16px; border-top: 1px solid var(--line); }
.dialog-actions { position: sticky; bottom: -24px; z-index: 7; margin-inline: -24px; margin-bottom: -24px; padding: 16px 24px; background: var(--surface); }
.dialog-actions .button,.dialog-actions .primary { font-size: 13px; }
/* Opt-in shell: only the body scrolls; header/footer keep their shared geometry. */
.contained-modal.modal { display:flex; flex-direction:column; overflow:hidden; max-height:calc(100dvh - 48px); }
.contained-modal.modal > header { position:relative; top:auto; flex-shrink:0; margin-bottom:0; }
.contained-modal > .dialog-body { min-height:0; overflow:auto; overflow-x:hidden; padding:var(--space-4) var(--space-1); margin-inline:calc(-1 * var(--space-1)); overscroll-behavior:contain; scrollbar-gutter:stable; }
.contained-modal > .dialog-actions { position:relative; bottom:auto; flex-shrink:0; margin-top:0; }
.contained-modal .dialog-body > :first-child { margin-top:0; }
.contained-modal .dialog-body > :last-child { margin-bottom:0; }
.share-dialog .share-recipient-help { margin:0 0 var(--space-4); }
.share-dialog .dialog-body :is(.access-details,.form-grid > *,.created-link) { min-width:0; overflow-wrap:anywhere; }
@media (max-width:760px), (max-height:500px) {
  .contained-modal.modal { max-height:calc(100dvh - max(10px, env(safe-area-inset-top)) - max(10px, env(safe-area-inset-bottom))); }
}
.dialog-tabs { gap: 8px; border-bottom-color: var(--line); margin-bottom: 20px; }
.dialog-tabs button { min-height: 40px; font-size: 13px; padding: 8px 12px; border-radius: 6px 6px 0 0; color: var(--secondary); }
.dialog-tabs button.active { color: var(--accent-ink); border-color: var(--accent-ink); background: var(--accent-soft); }
.context-menu { min-width: 228px; padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface-gradient); box-shadow: var(--shadow-menu); }
.context-menu > button { min-height: 36px; padding: 8px 10px; gap: 10px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; }
.context-menu > button:hover:not(:disabled),.context-menu > button:focus-visible { background: var(--accent-soft); color: var(--accent-ink); outline-offset: -2px; }
.context-menu svg { width: 17px; height: 17px; color: currentColor; }
.context-menu .danger-text:hover { background: var(--danger-soft); color: var(--danger); }
.menu-separator { height: 1px; background: var(--line); margin: 5px 7px; }
.menu-help { color: var(--muted); font-size: 11px; line-height: 1.5; padding: 8px 10px; margin: 0; max-width: 260px; }
.share-types > button,.export-formats > button,.add-types > button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius-lg); position: relative; padding: 14px; }
.share-types > button.selected,.export-formats > button.selected,.add-types > button.selected { border-color: var(--accent-ink); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.share-types > button > svg,.export-formats > button > svg { color: var(--secondary); }
.share-types > button.selected > svg,.export-formats > button.selected > svg { color: var(--accent-ink); }
.share-types strong,.export-formats strong,.add-types strong { font-size: 13px; }
.share-types small,.export-formats small,.add-types small { font-size: 11px; color: var(--muted); }
.choice-check { position: absolute; top: 8px; right: 8px; color: var(--accent-ink); }
.scope-options { gap: 14px; flex-wrap: wrap; }
.scope-options label,.scope-current-label { font-size: 12px; color: var(--secondary); }
.selection-tree { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg); }
.selection-tree-row { min-height: 32px; font-size: 12px; }
.selection-tree-row > small,.selection-summary { font-size: 11px; color: var(--muted); }
.selection-tree-row:hover { background: var(--surface-2); }
.access-item { border-color: var(--line); padding-block: 16px; }
.access-details p,.access-details details,.access-details > small { font-size: 12px; line-height: 1.55; }
.access-actions > .button { font-size: 11px; min-height: 32px; padding: 6px 9px; }
.export-layout { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 24px; }
.export-preview { border-color: var(--line-strong); border-radius: var(--radius-lg); background: var(--canvas); }
.export-preview-toolbar { min-height: 44px; background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--secondary); font-size: 12px; }
.preview-placeholder h3 { font-size: 18px; font-weight: 650; }
.preview-placeholder p { font-size: 13px; max-width: 260px; }
.export-snapshot,.export-actions > .quiet { font-size: 11px; }
.output-options > .check-row { font-size: 12px; }
.search-result { border-radius: var(--radius-md); font-size: 13px; }
.search-result.active { border-color: var(--accent-ink); }
.search-result > p { font-size: 13px; }
.search-result > small,.search-result > div > span,.search-result > span { font-size: 11px; }

/* Compact two-row workspace. Layout changes never affect PDF pixel geometry. */
.workspace-topbar { height: 54px; min-height: 54px; padding: 0 14px; gap: 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.workspace-logo { width: 34px; height: 34px; flex-shrink: 0; }
.workspace-logo svg { width: 21px; height: 21px; }
.document-title-block > input { font-size: 15px; line-height: 20px; font-weight: 650; padding: 0 4px; border-radius: 4px; letter-spacing: -.2px; }
.document-save { margin-top: 1px; min-height: 14px; line-height: 14px; }
.document-save > span:first-child,.save-separator { display: none; }
.save-state,.save-state.saved { color: var(--muted); font-size: 11px; }
.save-state.saved svg { color: var(--success); }
.save-state.failed,.save-state.offline { color: var(--danger); }
.review-uploads { color: var(--accent-ink); font-size: 11px; text-decoration: underline; padding: 0 4px; white-space: nowrap; }
.review-uploads:focus-visible { outline-offset: 0; }
.topbar-actions { gap: 5px; }
.topbar-actions .icon-button:has(.action-label) { width: auto; gap: 6px; padding-inline: 9px; font-size: 12px; }
.topbar-divider { height: 22px; margin: 0 6px; }
.mode-switch { margin: 0 3px; }
.mode-switch :is(select,.select-trigger) { min-height: 32px; padding-left: 28px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); font-size: 12px; background: var(--surface); font-weight: 600; }
.mode-switch > svg { top: 9px; color: var(--secondary); }
.mode-switch[data-mode="edit"] :is(select,.select-trigger) { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-ink); }
.mode-switch[data-mode="edit"] > svg { color: var(--accent-ink); }
.share-button { min-height: 32px; padding: 6px 12px; margin-left: 4px; font-size: 12px; }
.topbar-actions .avatar { margin-left: 5px; width: 30px; height: 30px; }
.workspace-statusbar { min-height: 24px; height: 24px; background: var(--surface); color: var(--muted); font-size: 11px; }
.workspace-statusbar > button { font-size: 11px; }
.public-banner { padding: 6px 16px; font-size: 12px; }
.tab-sidebar { background: var(--surface); border-right: 1px solid var(--line); }
.sidebar-heading { min-height: 50px; padding: 8px 12px 8px 16px; font-size: 13px; gap: 8px; }
.sidebar-heading > div { gap: 4px; }
.sidebar-add { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 5px 8px; background: var(--surface-2); color: var(--secondary); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; }
.sidebar-add:hover:not(:disabled) { border-color: var(--accent-ink); color: var(--accent-ink); }
.sidebar-create-actions { padding: 0 12px 8px; }
.sidebar-upload { width: 100%; justify-content: flex-start; min-height: 34px; background: var(--accent-soft); color: var(--accent-ink); border-color: var(--line); font-size: 12px; }
.sidebar-action-hint { font-size: 11px; line-height: 1.5; color: var(--muted); margin: 6px 2px 0; }
.tree-list { padding: 0 8px 6px; }
.tree-row { border: 1px solid transparent; border-radius: var(--radius-md); padding-right: 4px; }
.tree-row:hover { background: var(--surface-2); }
.tree-row.active { background: var(--accent-soft); border-color: transparent; color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.tree-label { gap: 7px; font-size: 13px; }
.tree-row.active .tree-label { font-weight: 600; }
.tree-toggle,.tree-menu-button { color: var(--muted); }
.tab-kind { width: 22px; min-width: 22px; height: 26px; border-radius: var(--radius-xs); background: transparent; color: var(--secondary); }
.tree-row.active .tab-kind { color: var(--accent-ink); }
.share-badge { color: var(--accent-ink); background: var(--accent-soft); border-radius: var(--radius-xs); }
.tree-menu-button { border-radius: var(--radius-xs); }
.tree-menu-button:hover { background: var(--surface); color: var(--ink); }
.add-tab-row { min-height: 34px; margin: 6px 0; padding: 7px 12px; font-size: 12px; border-color: var(--line); border-radius: var(--radius-md); }
.add-tab-row:hover:not(:disabled) { background: var(--surface-2); color: var(--accent-ink); border-color: var(--accent-ink); }
.outline-section { padding: 8px 12px; border-top: 1px solid var(--line); }
.outline-heading { font-size: 12px; color: var(--secondary); }
.outline-list { padding-top: 2px; }
.outline-list > button { min-height: 28px; font-size: 12px; color: var(--secondary); border-radius: 4px; }
.outline-list p { color: var(--muted); }
.sidebar-footer { padding: 6px 12px; font-size: 11px; }
.sidebar-resizer:hover,.sidebar-resizer:focus-visible { background: var(--accent); }
.content-heading { min-height: 50px; height: 50px; padding: 0 13px; }
.workspace-context { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1; }
.workspace-context .breadcrumbs { min-width: 0; flex: 1; gap: 5px; }
.breadcrumbs .breadcrumb-item { min-width: 0; }
.breadcrumbs .breadcrumb-item.current { flex: 1; color: var(--ink); }
.breadcrumbs button { min-width: 0; font-size: 12px; font-weight: 600; max-width: 180px; line-height: 18px; }
.breadcrumbs button > span { overflow: hidden; text-overflow: ellipsis; }
.content-type-badge { border-color: var(--line); color: var(--muted); border-radius: 4px; }
.content-actions { gap: 3px; flex-shrink: 0; }
.reader > .reader-toolbar { min-height: 50px; height: 50px; padding: 6px 12px; gap: 10px; flex-wrap: nowrap; justify-content: flex-start; background: var(--surface); }
.reader-toolbar > .workspace-context { flex: 1 1 190px; max-width: 330px; min-width: 115px; }
.reader-toolbar .workspace-context .breadcrumb-item:not(.current),.reader-toolbar .workspace-context .content-type-badge { display: none; }
.reader-toolbar .workspace-context .breadcrumb-item.current > svg { display: none; }
.reader-toolbar .breadcrumbs > .breadcrumb-item.current { display: inline-flex; }
.reader-toolbar .toolbar-group { flex-shrink: 0; gap: 4px; font-size: 12px; }
.reader-toolbar .icon-button { width: 30px; height: 32px; padding: 6px; flex-shrink: 0; }
.reader-toolbar .icon-button svg { width: 17px; height: 17px; }
.reader-toolbar .toolbar-divider { margin: 0 3px; height: 22px; }
.reader-toolbar .page-number { width: 36px; font-size: 12px; padding: 6px 0; border: 1px solid var(--line); border-radius: 6px; }
.reader-toolbar .zoom-input { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; }
.reader-toolbar .zoom-input input { width: 34px; font-size: 12px; padding: 6px 0; }
.reader-toolbar .layer-filter { max-width: 140px; font-size: 11px; }
.reader-toolbar .zoom-controls { border-left: 1px solid var(--line); padding-left: 8px; }
.reader-toolbar > .compact-reader-tools { flex-shrink: 0; }
.reader-toolbar .optional-toolbar { margin-left: auto; }
.page-viewport { background: var(--canvas); background-image: none; }
.page-caption { color: var(--muted); font-size: 11px; }
.drawing-toolbar { background: var(--surface-2); border-bottom: 1px solid var(--line); min-height: 42px; padding: 4px 12px; gap: 5px; }
.drawing-toolbar .icon-button { border-radius: 6px; }
.drawing-toolbar .icon-button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.selection-bar { padding: 6px 13px; gap: 12px; background: var(--accent-soft); font-size: 12px; }
.selection-bar .text-button { font-size: 12px; min-height: 28px; }
.notebook-controls { display: flex; align-items: center; gap: 10px; flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.notebook-controls > * { flex-shrink: 0; }
.notebook-controls .segmented { border-radius: 6px; }
.notebook-controls .segmented > button { border-radius: 4px; min-height: 30px; }
.category-surface { background: var(--bg); padding-top: 36px; }
.category-icon { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: none; transform: none; }
.category-title h1 { font-size: 30px; font-weight: 650; }
.category-card,.document-card,.start-options > button { border-radius: var(--radius-lg); border-color: var(--line); background: var(--surface-gradient); box-shadow: var(--shadow-sm); }
.category-card:hover,.document-card:hover,.start-options > button:hover { border-color: var(--accent-ink); background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--accent); }
.category-card > svg:first-child,.start-options > button > svg { color: var(--accent-ink); }
.document-card-preview,.document-illustration { background: var(--surface-2); color: var(--secondary); border-color: var(--line); }
.document-card-preview > svg { color: var(--accent-ink); }
.empty-icon { color: var(--accent-ink); }
.empty-state h2 { font-size: 22px; font-weight: 650; }
.empty-state p { font-size: 13px; color: var(--muted); }
.auth-page { background: var(--bg); color: var(--ink); }
.auth-navigation,.auth-card { border-color: var(--line); }
.auth-card { background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
.auth-story h1 { font-size: clamp(36px,4vw,52px); line-height: 1.1; font-weight: 700; }
.auth-story > p,.auth-features > div,.auth-card > p,.auth-disclosure,.auth-footer,.auth-separator { color: var(--muted); }
.auth-features svg { color: var(--accent-ink); }
.story-foot { color: var(--muted); font-size: 11px; }
.auth-card h2,.dashboard-heading h1 { font-weight: 650; }
.document-grid .document-card-info h3 { font-size: 15px; }
.right-panel { background: var(--surface); border-color: var(--line); }
.right-panel > header { min-height: 50px; height: 50px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.right-panel > header h2 { font-size: 14px; font-weight: 650; }
.right-panel > header svg { color: var(--secondary); }
.comment-filters { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.comment-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 12px; }
.comment-heading strong { font-size: 12px; }
.comment-heading time,.comment-audience { font-size: 11px; color: var(--muted); }
.comment-card > p { font-size: 13px; line-height: 1.6; }
.comment-anchor { background: var(--surface-2); color: var(--secondary); border-radius: 4px; }
.comment-composer { background: var(--surface-2); }
.comment-composer > textarea { min-height: 88px; }
.audience-selector { color: var(--secondary); }
.history-list { color: var(--secondary); }
.timeline-dot { background: var(--line-strong); }
/* Notebook/PDF paper remains light. Dark UI never applies an image filter. */
.notebook-page { border-radius: 2px; color: #253047; }
.notebook-page-header { color: #627087; }
.notebook-title { color: #253047 !important; }
.notebook-text { color: #35435b !important; }
.notebook-title:focus-visible,.notebook-text:focus-visible { outline-color: #354ecf !important; }
.notebook-page-footer { color: #627087; }
.notebook-error { background: var(--surface); }
.pdf-page-error { background: var(--surface); }

@media (max-width: 1280px) { .action-label { display: none; } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { transition-duration: .01ms !important; } }
@media (forced-colors: active) { .primary,.workspace-logo,.sidebar-add,.tree-row.active,.modal,.context-menu { border: 1px solid CanvasText; } .tab-kind,.share-badge { color: CanvasText; } }

/* A container breakpoint also handles a wide tab sidebar or open comments. */
.document-main { container-type: inline-size; container-name: reader; }
@container reader (max-width: 930px) {
  .reader-toolbar .optional-toolbar { display: none; }
  .reader-toolbar > .compact-reader-tools { display: inline-flex; margin-left: auto; }
  .reader-toolbar > .workspace-context { max-width: none; }
}
@container reader (max-width: 670px) {
  .reader-toolbar .zoom-controls > .desktop-reading-action { display: none; }
  .reader-toolbar { gap: 6px; padding-inline: 8px; }
  .reader-toolbar > .workspace-context { min-width: 108px; }
  .reader-toolbar .content-actions { gap: 0; }
}
/* The reader can be narrow on a wide screen when side panels are expanded. */
@container reader (max-width: 520px) {
  .reader:not(.notebook-reader) > .reader-toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto 30px; grid-template-rows: 34px 38px; height: 82px; min-height: 82px; gap: 2px 6px; padding: 4px 8px; }
  .reader-toolbar > .workspace-context { grid-column: 1 / -1; grid-row: 1; min-width: 0; max-width: none; }
  .reader:not(.notebook-reader) > .reader-toolbar > .page-controls { grid-column: 1; grid-row: 2; }
  .reader:not(.notebook-reader) > .reader-toolbar > .zoom-controls { grid-column: 2; grid-row: 2; border: 0; padding: 0; }
  .reader:not(.notebook-reader) > .reader-toolbar > .compact-reader-tools { grid-column: 3; grid-row: 2; margin: 0; }
  .reader-toolbar .toolbar-group { gap: 2px; }
  .reader-toolbar .zoom-controls > .toolbar-divider { display: none; }
}
@container reader (max-width: 390px) {
  .reader-toolbar .page-controls > button:first-child,.reader-toolbar .page-controls > .toolbar-divider { display: none; }
}
@media (max-width: 1200px) {
  .reader-toolbar .optional-toolbar { display: none; }
  .reader-toolbar > .compact-reader-tools { display: inline-flex; }
  .topbar-actions { gap: 3px; }
}
@media (max-width: 1000px) {
  .workspace-topbar .topbar-actions > .desktop-document-action { display: none; }
  .workspace-topbar .topbar-actions > .compact-actions-trigger { display: inline-flex; }
  .workspace-topbar .topbar-actions > .avatar { display: none; }
}
@media (max-width: 760px) {
  .workspace-topbar { display: flex; height: 56px; min-height: 56px; padding: 0 8px; gap: 8px; }
  .workspace-logo { width: 31px; height: 33px; }
  .workspace-topbar .document-title-block { flex: 1; width: auto; min-width: 50px; }
  .workspace-topbar .document-title-block > input { font-size: 13px; line-height: 20px; padding: 0 3px; width: 100%; }
  .document-save { min-height: 12px; line-height: 12px; }
  .save-state { font-size: 9px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .workspace-topbar .topbar-actions { width: auto; gap: 3px; }
  .workspace-topbar .topbar-actions > .icon-button { min-width: 34px; width: 34px; height: 38px; margin: 0; }
  .workspace-topbar .topbar-actions > .desktop-search-action { display: none; }
  .workspace-topbar .topbar-actions > .icon-button:first-of-type { margin-right: 0; }
  .mode-switch { margin: 0; }
  .mode-switch :is(select,.select-trigger) { min-width: 85px; width: 85px; min-height: 36px; max-width: 85px; padding: 7px 4px 7px 22px; font-size: 12px; }
  .mode-switch > svg { width: 12px; height: 12px; top: 12px; left: 6px; }
  .share-button { width: 34px; min-width: 34px; min-height: 36px; padding: 7px; margin: 0; font-size: 0; gap: 0; }
  .share-button svg { width: 16px; height: 16px; flex-shrink: 0; }
  .public-mode { font-size: 10px; gap: 4px; }
  .public-mode svg { width: 14px; }
  .sidebar-heading { min-height: 48px; padding: 6px 9px 6px 13px; }
  .sidebar-heading .icon-button { width: 36px; height: 36px; }
  .sidebar-add { min-height: 34px; padding-inline: 10px; }
  .add-tab-row { min-height: 40px; }
  .content-heading { min-height: 44px; height: 44px; padding: 0 9px; }
  .content-heading .icon-button { min-width: 34px; height: 36px; }
  .content-heading .breadcrumbs button { max-width: 160px; }
  .content-heading .breadcrumb-item:not(.current) { display: none; }
  .content-type-badge { display: none; }
  .reader:not(.notebook-reader) > .reader-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 34px;
    grid-template-rows: 38px 40px;
    height: 88px;
    min-height: 88px;
    padding: 4px 8px;
    gap: 2px 6px;
  }
  .reader-toolbar > .workspace-context { grid-column: 1 / -1; grid-row: 1; max-width: none; min-width: 0; }
  .reader-toolbar .workspace-context .breadcrumbs button { max-width: none; }
  .reader:not(.notebook-reader) > .reader-toolbar > .page-controls { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  .reader:not(.notebook-reader) > .reader-toolbar > .zoom-controls { grid-column: 2; grid-row: 2; border: 0; padding: 0; justify-content: flex-end; }
  .reader:not(.notebook-reader) > .reader-toolbar > .compact-reader-tools { grid-column: 3; grid-row: 2; margin: 0; display: inline-flex; }
  .reader:not(.notebook-reader) > .reader-toolbar > .optional-toolbar { display: none; }
  .reader .reader-toolbar > .zoom-controls > .desktop-reading-action { display: none; }
  .reader-toolbar .zoom-controls > .toolbar-divider { display: none; }
  .reader-toolbar .icon-button { width: 32px; min-width: 32px; height: 40px; }
  .reader-toolbar .toolbar-group { gap: 2px; font-size: 10px; }
  .reader-toolbar .toolbar-divider { margin: 0 2px; height: 20px; }
  .reader-toolbar .page-number { width: 31px; font-size: 11px; padding: 7px 0; }
  .reader-toolbar .zoom-input input { width: 30px; font-size: 11px; padding: 7px 0; }
  .reader-toolbar .content-actions .icon-button, .reader-toolbar .breadcrumbs > .icon-button { min-width: 36px; width: 36px; }
  .notebook-reader > .reader-toolbar { height: 80px; min-height: 80px; overflow: hidden; padding: 4px 9px; display: flex; flex-wrap: wrap; gap: 2px; }
  .notebook-reader > .reader-toolbar > .workspace-context { flex-basis: 100%; height: 34px; max-width: none; }
  .notebook-controls { flex: 1 1 100%; width: 100%; height: 36px; gap: 9px; }
  .notebook-controls .toolbar-group { font-size: 11px; }
  .drawing-toolbar { min-height: 46px; padding: 3px 8px; }
  .workspace-statusbar { min-height: calc(24px + env(safe-area-inset-bottom)); height: auto; }
  .right-panel > header { min-height: 50px; height: 50px; }
  .modal { border-radius: 17px; }
}
@media (max-width: 360px) {
  .reader-toolbar .page-controls > button:first-child,
  .reader-toolbar .page-controls > .toolbar-divider { display: none; }
}

@media (max-width:760px) { .modal { padding:18px; border-radius:12px; } .export-layout { grid-template-columns:1fr; } .sidebar-upload { min-height:40px; } .share-button { color:var(--accent-contrast); } .save-state { font-size:10px; } }
@media (max-width:760px) { .modal > header { top:-18px; margin-inline:-18px; margin-top:-18px; padding:14px 18px; } .dialog-actions { bottom:-18px; margin-inline:-18px; margin-bottom:-18px; padding:14px 18px; flex-wrap:wrap; } }

/* Static elevation: no filters or animation on scrolling PDF surfaces. */
.workspace { background: var(--bg); }
.workspace-topbar { background: var(--surface-gradient); box-shadow: inset 0 1px 0 var(--edge-highlight), 0 3px 12px #00000009; z-index: 25; }
.tab-sidebar { box-shadow: inset -1px 0 0 var(--edge-highlight), 4px 0 18px #00000006; }
.sidebar-heading, .right-panel > header { background: var(--surface-gradient); }
.primary:disabled,.button:disabled,.icon-button:disabled { box-shadow: none; opacity: .52; }
.icon-button { border: 1px solid transparent; }
.icon-button:hover:not(:disabled) { border-color: var(--line); background: var(--control-gradient); box-shadow: var(--shadow-control); }
.icon-button:active:not(:disabled),.sidebar-add:active:not(:disabled) { box-shadow: var(--shadow-pressed); }
.icon-button[aria-pressed="true"],.icon-button.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 1px 0 var(--edge-highlight), 0 2px 6px #0001; }
.sidebar-add { background: var(--control-gradient); box-shadow: var(--shadow-control); }
.tree-row.active { border-color: var(--line); box-shadow: inset 3px 0 0 var(--accent), inset 0 1px 0 var(--edge-highlight), 0 3px 9px #0000000b; }
.mode-switch :is(select,.select-trigger),.reader-toolbar .page-number,.reader-toolbar .zoom-input { background: var(--control-gradient); border-color: var(--line-strong); box-shadow: var(--shadow-control); border-radius: var(--radius-sm); }
.reader-toolbar .zoom-input input { background: transparent; }
.reader-toolbar .layer-filter { background: var(--surface-2); border-radius: var(--radius-sm); }
.modal > header { background: var(--surface-gradient); }
.context-menu > button:active:not(:disabled) { box-shadow: var(--shadow-pressed); }
.drawing-toolbar .icon-button { border-radius: var(--radius-sm); }
.drawing-toolbar .icon-button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-ink); }
.share-types > button,.export-formats > button,.add-types > button { background: var(--control-gradient); box-shadow: var(--shadow-control); }
.share-types > button.selected,.export-formats > button.selected,.add-types > button.selected { background: var(--accent-soft); }
.comment-card { background: var(--surface-gradient); box-shadow: var(--shadow-sm); }
.selection-tree { background: var(--surface-2); box-shadow: inset 0 1px 4px #0000000c; }
.category-card,.start-options > button { border-radius: var(--radius-card); }
@media (max-width:760px) { .modal { border-radius:var(--radius-xl); } }
@media (forced-colors: active) { .primary,.button,.icon-button,.tree-row.active,.context-menu,.modal { box-shadow:none; background:Canvas; color:CanvasText; } }
/* Selection popups share the same tokens as action menus, with listbox semantics. */
.select-trigger { position:relative; display:inline-grid; grid-template-columns:minmax(0,1fr) 14px; align-items:center; gap:8px; min-height:36px; max-width:100%; padding:7px 10px; background:var(--control-gradient); color:var(--ink); border:1px solid var(--line-strong); border-radius:var(--radius-sm); box-shadow:var(--shadow-control); text-align:left; font-size:12px; font-weight:500; cursor:pointer; }
.select-trigger > span:first-child { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.select-chevron { position:static; grid-column:2; display:flex; justify-self:end; pointer-events:none; color:var(--secondary); }
.select-trigger:hover:enabled { border-color:var(--muted); }
.select-trigger[data-state="open"] { border-color:var(--accent-ink); box-shadow:var(--shadow-pressed); }
.select-trigger:focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
.select-trigger:disabled { cursor:not-allowed; }
.select-popup { z-index:150; min-width:var(--radix-select-trigger-width); max-width:min(400px,calc(100vw - 20px)); max-height:min(340px,var(--radix-select-content-available-height)); overflow:hidden; border:1px solid var(--line-strong); border-radius:var(--radius-lg); background:var(--surface-gradient); color:var(--ink); box-shadow:var(--shadow-menu); font:13px/1.4 var(--font-ui); }
.select-viewport { padding:5px; }
.select-option { position:relative; display:flex; align-items:center; min-height:36px; padding:8px 12px 8px 30px; border-radius:var(--radius-sm); cursor:default; user-select:none; overflow-wrap:anywhere; }
.select-option[data-state="checked"] { color:var(--accent-ink); background:var(--accent-soft); font-weight:600; }
.select-option[data-highlighted] { color:var(--accent-ink); background:color-mix(in srgb,var(--accent-soft) 90%,var(--accent) 10%); }
.select-option:focus-visible { outline:2px solid var(--focus); outline-offset:-3px; }
.select-option[data-disabled] { color:var(--muted); background:transparent; opacity:.65; }
.select-check { position:absolute; left:9px; display:flex; }
.select-scroll { display:flex; align-items:center; justify-content:center; height:24px; background:var(--surface); color:var(--secondary); }
.field > label > .select-trigger { display:grid; width:100%; min-height:40px; }
.mode-switch .select-trigger { min-width:142px; padding-left:28px; padding-right:10px; }
.mode-switch > svg { pointer-events:none; }
/* Tinted surfaces need their own depth: the neutral white inset edge reads as
   an unfilled band. Paint one rounded surface through the border, with no rim. */
.button.sidebar-upload,.mode-switch[data-mode="edit"] .select-trigger,
.icon-button[aria-pressed="true"],.icon-button.selected {
  background:var(--accent-soft); background-clip:border-box;
  box-shadow:var(--shadow-tinted-control);
  transition:background-color .16s ease,border-color .16s ease,box-shadow .16s ease;
}
.button.sidebar-upload:hover:enabled,.mode-switch[data-mode="edit"] .select-trigger:hover:enabled,
.icon-button[aria-pressed="true"]:hover:enabled,.icon-button.selected:hover:enabled {
  background:color-mix(in srgb,var(--accent-soft) 90%,var(--accent));
  border-color:var(--accent-ink); color:var(--accent-ink);
}
.button.sidebar-upload:active:enabled,.mode-switch[data-mode="edit"] .select-trigger:active:enabled,
.icon-button[aria-pressed="true"]:active:enabled,.icon-button.selected:active:enabled {
  box-shadow:var(--shadow-pressed);
}
.library-appearance .select-trigger { width:156px; }
.library-sort .select-trigger { width:132px; }
.library-pagination .select-trigger { min-width:96px; }
.busy-button { display:inline-grid; }
.busy-button > span { grid-area:1 / 1; display:inline-flex; align-items:center; justify-content:center; gap:7px; }
.busy-button-progress { visibility:hidden; }
.busy-button[aria-busy="true"] > .busy-button-label { visibility:hidden; }
.busy-button[aria-busy="true"] > .busy-button-progress { visibility:visible; }
@media(max-width:760px) { .mode-switch .select-trigger { min-width:85px; padding-left:22px; padding-right:6px; gap:6px; } .select-option { min-height:40px; } }
@media(prefers-reduced-motion:reduce) { .primary,.button,.workspace-logo,.brand-mark,.select-trigger { transition:none; } .busy-button .spin { animation:none; } }
@media(forced-colors:active) { .primary,.workspace-logo,.brand-mark,.select-trigger,.select-popup,.select-option { background:Canvas; color:CanvasText; box-shadow:none; } .select-option[data-highlighted] { outline-color:Highlight; } .select-option[data-disabled] { color:GrayText; } }

/* Keep a real chevron column even when compact toolbars override padding. */
.drawing-toolbar .select-trigger { padding:5px 8px; gap:8px; font-size:11px; flex-shrink:0; }
.drawing-toolbar.editing-toolbar { justify-content:flex-start; flex-wrap:nowrap; gap:6px; overflow-x:auto; scrollbar-width:thin; }
.editing-toolbar > * { flex-shrink:0; }
.editing-group,.editing-secondary-direct { display:flex; align-items:center; gap:3px; }
.editing-toolbar .icon-button { width:32px; min-width:32px; height:32px; }
.editing-toolbar .select-trigger,.editing-menu-trigger { min-height:32px; height:32px; }
.editing-menu-trigger { padding:5px 8px; gap:6px; font-size:11px; white-space:nowrap; }
.editing-menu-trigger > svg { flex-shrink:0; }
.editing-toolbar .toolbar-divider { margin-inline:2px; }
.select-trigger.layer-select { grid-template-columns:14px minmax(0,1fr) 14px; column-gap:6px; width:max-content; max-width:190px; min-width:0; }
.select-trigger.layer-select > span:nth-child(2) { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.select-trigger.layer-select .select-chevron { grid-column:3; }
.select-leading-icon { display:flex; align-items:center; }
.editing-secondary-overflow { display:none; }
.editing-action-menu { min-width:220px; max-width:calc(100vw - 20px); max-height:calc(100dvh - 20px); overflow-y:auto; }
.editing-action-menu > button > span { text-align:left; }
@container reader (max-width:720px) {
  .editing-secondary-direct { display:none; }
  .editing-secondary-overflow { display:flex; }
  .editing-toolbar .icon-button { min-width:38px; height:40px; }
  .editing-toolbar .select-trigger,.editing-menu-trigger { min-height:36px; height:36px; }
}
.shortcut-guide section + section { margin-top:18px; }
.shortcut-guide h3 { margin:0 0 7px; font-size:13px; color:var(--secondary); }
.shortcut-guide dl { margin:0; }
.shortcut-guide-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:14px; padding:9px 0; border-top:1px solid var(--line); }
.shortcut-guide-row dt { display:grid; gap:3px; }
.shortcut-guide-row dt span { color:var(--secondary); font-size:12px; }
.shortcut-guide-row dd { margin:0; display:flex; flex-wrap:wrap; justify-content:flex-end; align-content:start; gap:4px; max-width:170px; }
.shortcut-guide kbd,.shortcut-hint { padding:3px 6px; background:var(--control-gradient); color:var(--secondary); border:1px solid var(--line); border-radius:6px; font:11px/1.4 var(--font-ui); white-space:nowrap; }
.workspace-help { margin-top:18px; padding-top:12px; border-top:1px solid var(--line); }
.workspace-help h3 { margin:0 0 8px; font-size:13px; }
@media(max-width:480px) { .shortcut-guide-row { grid-template-columns:1fr; gap:6px; } .shortcut-guide-row dd { justify-content:flex-start; max-width:none; } }
.workspace-settings-modal { width:560px; max-width:100%; }
.workspace-settings { display:grid; gap:12px; }
.workspace-settings > section { display:grid; gap:10px; }
.workspace-settings > section + section { border-top:1px solid var(--line); padding-top:12px; }
.workspace-settings h3 { margin:0; font-size:13px; color:var(--ink); }
.workspace-settings .field { margin:0; }
.workspace-settings .field > label { font-size:12px; }
.workspace-settings .reading-preferences .field { margin-bottom:12px; }
.workspace-settings .reader-metadata-options { margin-bottom:0; }
.workspace-settings .reader-metadata-options { display:grid; grid-template-columns:1fr 1fr; gap:8px 12px; }
.workspace-settings .reader-metadata-options p { grid-column:1 / -1; }
.workspace-settings .settings-copy { margin:0; font-size:12px; line-height:1.5; color:var(--secondary); }
.workspace-settings .settings-action { justify-self:start; min-height:36px; gap:8px; }
.settings-account { display:flex; gap:10px; align-items:center; border-top:1px solid var(--line); padding-block:12px 16px; }
.settings-account .avatar { width:32px; height:32px; flex-shrink:0; }
.settings-account > div { min-width:0; display:grid; gap:2px; font-size:12px; }
.settings-account span,.settings-account small { color:var(--secondary); overflow-wrap:anywhere; }
@media(max-width:480px) { .workspace-settings .reader-metadata-options { grid-template-columns:1fr; } }
/* Numeric values use one measured group, not asymmetric input/unit padding.
   Native steppers are removed visually; arrow-key editing remains native. */
.reader-toolbar .page-number.numeric-control { width:42px; height:32px; min-height:32px; padding:0 4px; font:500 12px/20px var(--font-ui); font-variant-numeric:tabular-nums; text-align:center; }
.reader-toolbar .zoom-input.numeric-control { display:grid; place-items:center; width:76px; height:32px; min-height:32px; padding:0 6px; font:500 12px/20px var(--font-ui); font-variant-numeric:tabular-nums; }
.numeric-value-group { display:inline-flex; align-items:center; justify-content:center; max-width:100%; }
.numeric-value { position:relative; display:block; min-width:1ch; }
.numeric-measure { display:block; visibility:hidden; min-width:1ch; white-space:pre; }
:is(.reader-toolbar,.inline-text-tools) .numeric-value-group input { position:absolute; inset:0; width:100%; min-width:0; height:20px; padding:0; margin:0; border:0; outline:none; box-shadow:none; border-radius:0; font:inherit; font-variant-numeric:inherit; line-height:20px; text-align:center; color:inherit; background:transparent; }
.numeric-unit { line-height:20px; }
.numeric-control::-webkit-inner-spin-button,.numeric-control::-webkit-outer-spin-button,
.numeric-value-group input::-webkit-inner-spin-button,.numeric-value-group input::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
.numeric-control,.numeric-value-group input { -moz-appearance:textfield; appearance:textfield; }
.zoom-input.numeric-control:focus-within { outline:2px solid var(--focus); outline-offset:2px; }
.inline-text-tools { position:fixed; z-index:45; display:flex; align-items:center; gap:var(--space-1); width:max-content; max-width:calc(100vw - 16px); box-sizing:border-box; padding:var(--space-1); border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-gradient); box-shadow:var(--shadow-menu); color:var(--ink); font:500 12px/20px var(--font-ui); }
.inline-text-tools .icon-button { width:var(--control-compact); min-width:var(--control-compact); height:var(--control-compact); padding:6px; border-radius:var(--radius-xs); }
.inline-text-tools .icon-button svg { width:18px; height:18px; stroke-width:var(--icon-stroke); }
.inline-font-size.numeric-control { display:grid; place-items:center; width:68px; height:var(--control-compact); border:1px solid var(--line); border-radius:var(--radius-xs); background:var(--control-gradient); box-shadow:var(--shadow-control); padding:0 8px; font-variant-numeric:tabular-nums; }
.inline-font-size .numeric-value-group { gap:4px; }
.inline-font-size.numeric-control:focus-within { outline:2px solid var(--focus); outline-offset:2px; }
.inline-text-color { width:var(--control-compact); min-width:var(--control-compact); min-height:var(--control-compact); height:var(--control-compact); padding:5px; border:1px solid var(--line); border-radius:var(--radius-xs); background:var(--control-gradient); box-shadow:var(--shadow-control); cursor:pointer; }
.inline-text-color::-webkit-color-swatch-wrapper { padding:0; }
.inline-text-color::-webkit-color-swatch { border:0; border-radius:4px; }
.inline-text-color::-moz-color-swatch { border:0; border-radius:4px; }
@media(max-width:480px) { .inline-text-tools .icon-button,.inline-text-color { width:36px; min-width:36px; height:36px; } .inline-font-size.numeric-control { height:36px; } }
.select-trigger.numeric-select { grid-template-columns:14px minmax(0,1fr) 14px; column-gap:4px; text-align:center; font-variant-numeric:tabular-nums; }
.select-trigger.numeric-select > span:first-child { grid-column:2; justify-self:center; line-height:20px; }
.select-trigger.numeric-select .select-chevron { grid-column:3; }
.drawing-toolbar .stroke-width-select.numeric-select { width:80px; min-width:80px; padding-inline:6px; column-gap:3px; }

/* Coordinated workspace toolbar geometry. Shared tokens control every row;
   page coordinates, theme palettes and numeric value/unit centering are unchanged. */
:root { --toolbar-control:36px; --toolbar-icon:18px; --toolbar-inset:12px; --toolbar-gap:4px; --toolbar-group-gap:16px; --toolbar-separator:20px; --toolbar-row:50px; }
.workspace-topbar { gap:var(--space-3); }
.workspace-topbar .topbar-actions { gap:var(--toolbar-gap); }
.workspace-topbar .topbar-actions > .icon-button,
.workspace-topbar .mode-switch .select-trigger,
.workspace-topbar .share-button { height:var(--toolbar-control); min-height:var(--toolbar-control); }
.workspace-topbar .topbar-actions > .icon-button { width:var(--toolbar-control); min-width:var(--toolbar-control); padding:8px; }
.workspace-topbar .topbar-actions .icon-button:has(.action-label) { width:auto; }
.workspace-topbar .topbar-actions svg { width:var(--toolbar-icon); height:var(--toolbar-icon); stroke-width:var(--icon-stroke); }
.workspace-topbar .select-chevron svg { width:14px; height:14px; }
.workspace-topbar .mode-switch { margin:0; }
.workspace-topbar .mode-switch > svg { top:50%; transform:translateY(-50%); }
.workspace-topbar .mode-switch .select-trigger { padding-left:32px; border-color:var(--line); }
.workspace-topbar .topbar-divider { height:var(--toolbar-separator); margin-inline:var(--space-2); }
.workspace-topbar .share-button { margin-left:var(--space-2); }
.workspace-topbar .topbar-actions > .avatar { width:var(--toolbar-control); height:var(--toolbar-control); margin-left:var(--space-2); }
.reader > .reader-toolbar,
.reader > .drawing-toolbar.editing-toolbar { box-sizing:border-box; min-height:var(--toolbar-row); height:var(--toolbar-row); padding:6px var(--toolbar-inset); align-items:center; background:var(--surface-gradient); }
.reader > .reader-toolbar { gap:var(--toolbar-group-gap); border-bottom:1px solid var(--line); }
.reader > .drawing-toolbar.editing-toolbar { gap:0; box-shadow:inset 0 1px 0 var(--edge-highlight); border-bottom:1px solid var(--line); }
.reader-toolbar > .workspace-context { flex:1 1 200px; min-width:120px; max-width:240px; gap:var(--space-2); }
.reader-toolbar .breadcrumbs button { display:inline-flex; align-items:center; height:var(--toolbar-control); max-width:100%; padding:0; }
.reader-toolbar .content-actions,
.reader-toolbar .toolbar-group,
.editing-toolbar .editing-group,
.editing-toolbar .editing-secondary-direct { gap:var(--toolbar-gap); }
.reader-toolbar .icon-button,
.reader .editing-toolbar .icon-button { width:var(--toolbar-control); min-width:var(--toolbar-control); height:var(--toolbar-control); padding:8px; border-radius:var(--radius-xs); }
.reader-toolbar .icon-button svg,
.reader .editing-toolbar .icon-button svg,
.notebook-controls .segmented svg { width:var(--toolbar-icon); height:var(--toolbar-icon); stroke-width:var(--icon-stroke); }
.reader-toolbar .select-trigger,
.reader .editing-toolbar .select-trigger,
.reader-toolbar .page-number.numeric-control,
.reader-toolbar .zoom-input.numeric-control,
.notebook-reader .reader-toolbar .notebook-add-page { height:var(--toolbar-control); min-height:var(--toolbar-control); border-color:var(--line); }
.reader-toolbar .toolbar-divider,
.editing-toolbar .toolbar-divider { height:var(--toolbar-separator); margin-inline:var(--space-2); flex:0 0 1px; }
.reader-toolbar .zoom-controls { border-left:0; padding-left:0; }
.reader-toolbar > .optional-toolbar { margin-left:auto; }
.reader-toolbar > .compact-reader-tools { margin-left:0; }
.reader .editing-toolbar .layer-select { margin-left:var(--space-2); }
.editing-toolbar > .toolbar-divider:last-of-type { margin-left:auto; }
.reader .editing-toolbar .color-picker { display:grid; place-items:center; width:var(--toolbar-control); height:var(--toolbar-control); margin:0; border:0; border-radius:var(--radius-xs); box-shadow:none; overflow:visible; }
.reader .editing-toolbar .color-picker input { width:28px; height:28px; margin:0; padding:3px; border:1px solid var(--line); border-radius:50%; background:var(--control-gradient); }
.reader .editing-toolbar .color-picker input::-webkit-color-swatch-wrapper { padding:0; }
.reader .editing-toolbar .color-picker input::-webkit-color-swatch { border:0; border-radius:50%; }
.reader .editing-toolbar .color-picker input::-moz-color-swatch { border:0; border-radius:50%; }
.reader .editing-toolbar .color-picker:focus-within { outline:2px solid var(--focus); outline-offset:2px; }
.notebook-controls { gap:var(--toolbar-group-gap); height:calc(var(--toolbar-control) + 6px); padding-block:3px; overflow-y:hidden; }
.notebook-controls .segmented { padding:0; height:var(--toolbar-control); }
.notebook-controls .segmented > button { display:inline-flex; align-items:center; justify-content:center; gap:var(--space-2); height:var(--toolbar-control); min-height:var(--toolbar-control); padding:0 10px; }
.notebook-controls :is(button,input):focus-visible,
.notebook-controls .zoom-input.numeric-control:focus-within { outline-offset:-3px; }
.notebook-reader .reader-toolbar .notebook-add-page { gap:var(--space-2); padding-inline:10px; }
.notebook-reader .reader-toolbar .notebook-add-page svg { width:var(--toolbar-icon); height:var(--toolbar-icon); }
@container reader (max-width:1180px) {
  .reader-toolbar .optional-toolbar { display:none; }
  .reader-toolbar > .compact-reader-tools { margin-left:auto; }
  .notebook-controls .zoom-controls > .desktop-reading-action,
  .notebook-controls .zoom-controls > .toolbar-divider { display:none; }
}
@container reader (max-width:900px) {
  .reader-toolbar .zoom-controls > .desktop-reading-action,
  .reader-toolbar .zoom-controls > .toolbar-divider { display:none; }
  .reader-toolbar > .workspace-context { min-width:100px; }
  .reader > .reader-toolbar { gap:var(--space-2); }
  .notebook-reader > .reader-toolbar { display:flex; flex-wrap:wrap; height:94px; min-height:94px; gap:2px; padding-block:5px; overflow:hidden; }
  .notebook-reader > .reader-toolbar > .workspace-context { flex:1 1 100%; height:40px; max-width:none; min-width:0; }
  .notebook-controls { flex:1 1 100%; width:100%; }
  .notebook-controls .segmented svg { display:none; }
  .reader > .drawing-toolbar.editing-toolbar { display:grid; grid-template-columns:auto minmax(0,1fr) auto; grid-template-rows:auto auto; height:auto; gap:4px 12px; overflow:visible; }
  .editing-toolbar > .toolbar-divider { display:none; }
  .editing-toolbar .editing-history { grid-column:1; grid-row:1; }
  .editing-toolbar .editing-tool-choices { grid-column:2 / -1; grid-row:1; min-width:0; overflow-x:auto; scrollbar-width:thin; padding-block:3px; }
  .editing-tool-choices > .icon-button { flex:0 0 var(--toolbar-control); }
  .editing-tool-choices > .icon-button:focus-visible { outline-offset:-3px; }
  .editing-toolbar .editing-appearance { grid-column:1; grid-row:2; }
  .reader .editing-toolbar .layer-select { grid-column:2; grid-row:2; margin:0; max-width:100%; }
  .editing-toolbar .editing-actions { grid-column:3; grid-row:2; justify-self:end; }
  .editing-toolbar[aria-label="Notebook text tools"] { grid-template-rows:auto; }
  .editing-toolbar[aria-label="Notebook text tools"] .editing-tool-choices { grid-column:2; }
  .editing-toolbar[aria-label="Notebook text tools"] .editing-actions { grid-row:1; }
}
@container reader (max-width:720px) {
  .reader { --toolbar-control:40px; --toolbar-group-gap:12px; }
  .reader:not(.notebook-reader) > .reader-toolbar { display:grid; grid-template-columns:minmax(0,1fr) auto var(--toolbar-control); grid-template-rows:40px 40px; height:92px; min-height:92px; padding-block:5px; gap:2px var(--space-1); }
  .reader-toolbar > .workspace-context { grid-column:1 / -1; grid-row:1; max-width:none; min-width:0; }
  .reader:not(.notebook-reader) > .reader-toolbar > .page-controls { grid-column:1; grid-row:2; }
  .reader:not(.notebook-reader) > .reader-toolbar > .zoom-controls { grid-column:2; grid-row:2; }
  .reader:not(.notebook-reader) > .reader-toolbar > .compact-reader-tools { grid-column:3; grid-row:2; margin:0; }
  .reader-toolbar .page-controls > button:first-child,
  .reader-toolbar .page-controls > .toolbar-divider { display:none; }
  .notebook-reader > .reader-toolbar { height:98px; min-height:98px; }
  .notebook-controls { height:46px; }
}
@container reader (max-width:560px) {
  .notebook-reader > .reader-toolbar { height:144px; min-height:144px; }
  .notebook-controls { display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-rows:40px 40px; height:90px; gap:4px var(--space-2); overflow:visible; }
  .notebook-controls .notebook-page-controls { grid-column:1 / -1; grid-row:1; }
  .notebook-controls .notebook-page-settings { grid-column:1; grid-row:2; }
  .notebook-controls .segmented { grid-column:2; grid-row:2; }
}
@media(max-width:760px) {
  :root { --toolbar-inset:8px; }
  .workspace-topbar .mode-switch .select-trigger { padding-left:26px; }
  .workspace-topbar .mode-switch > svg { width:14px; height:14px; }
  .workspace-topbar .topbar-actions > .icon-button { width:34px; min-width:34px; }
  .workspace-topbar .share-button { margin-left:0; }
}

/* Account controls keep the same geometry and lighting as the existing header. */
.profile-trigger.button { min-width:0; padding:var(--space-1) var(--space-2); gap:var(--space-2); color:var(--secondary); }
.profile-trigger .avatar,.workspace-topbar .profile-trigger .avatar {
  display:grid; width:30px; height:30px; margin:0; flex-shrink:0; font-size:var(--text-sm);
}
.profile-trigger-name { max-width:180px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.profile-trigger-chevron { flex-shrink:0; }
.profile-trigger[aria-expanded="true"] { background:var(--accent-soft); color:var(--accent-ink); }
.workspace-topbar .profile-trigger-compact { width:var(--toolbar-control); height:var(--toolbar-control); min-height:var(--toolbar-control); padding:2px; }
.profile-trigger-compact .profile-trigger-name,.profile-trigger-compact .profile-trigger-chevron { display:none; }
.profile-panel.modal { width:420px; max-width:calc(100vw - 32px); }
.profile-panel-body { display:grid; gap:var(--space-3); padding:var(--space-4) 0; }
.profile-panel-body .field { margin:0; }
.profile-email { margin:0; overflow-wrap:anywhere; }
.profile-feedback { min-height:20px; }
.profile-feedback p { margin:0; }
.profile-success { display:flex; align-items:center; gap:var(--space-2); color:var(--success); }
.profile-password { justify-self:start; }
.avatar { overflow:hidden; }
.avatar img { display:block; width:100%; height:100%; object-fit:cover; border-radius:inherit; }
.profile-panel.modal { display:flex; flex-direction:column; overflow:hidden; max-height:calc(100dvh - 32px); }
.profile-panel > header { flex-shrink:0; }
.profile-panel > form { display:flex; flex-direction:column; min-height:0; }
.profile-panel .profile-panel-body { display:flex; flex-direction:column; gap:var(--space-3); min-height:0; overflow-y:auto; overflow-x:hidden; padding:0 var(--space-1) var(--space-3); margin-inline:calc(-1 * var(--space-1)); overscroll-behavior:contain; }
.profile-panel .field, .profile-panel .field > label { gap:var(--space-1); }
/* The body's bottom padding is the sole gap before the fixed footer. */
.profile-panel .dialog-actions { flex-shrink:0; margin-top:0; }
.profile-picture-row { display:flex; align-items:center; gap:var(--space-3); }
.profile-picture-row > div { min-width:0; }
.profile-picture.avatar { display:grid; flex-shrink:0; width:64px; height:64px; border-radius:50%; font-size:22px; margin:0; }
.profile-field-title { display:block; font-size:var(--text-sm); font-weight:600; margin-bottom:4px; }
.profile-picture-actions { display:flex; flex-wrap:wrap; gap:2px; margin-left:-8px; }
.profile-picture-actions .button { padding:4px 8px; min-height:32px; font-size:13px; }
.profile-picture-actions + p { margin:4px 0 0; font-size:11px; }
.profile-email-row { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.profile-email-row > div { min-width:0; }
.profile-email-row > svg { flex-shrink:0; }
.profile-email-row .profile-field-title { font-weight:500; }
.profile-name-status { display:flex; align-items:flex-start; gap:6px; margin:7px 0 0; color:var(--secondary); line-height:1.5; }
.profile-name-status svg { flex-shrink:0; margin-top:3px; }
.profile-name-status.rejected { color:var(--danger); }
.profile-panel .profile-password { align-self:flex-start; margin-left:-8px; padding:4px 8px; }
.profile-panel .profile-feedback:empty { display:none; }
.profile-zone-trigger { width:100%; min-width:0; justify-content:space-between; }
.profile-zone-trigger > span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.profile-zone-trigger > svg { flex-shrink:0; }
.profile-zone-dialog { width:460px; max-width:calc(100vw - 32px); }
.profile-zone-options { max-height:min(320px,45dvh); overflow:auto; border:1px solid var(--line); border-radius:var(--radius-md); padding:4px; margin-top:12px; }
.profile-zone-option { display:flex; width:100%; gap:8px; text-align:left; border:0; border-radius:var(--radius-xs); background:transparent; box-shadow:none; min-height:40px; font-weight:400; padding:8px; }
.profile-zone-option:hover,.profile-zone-option[aria-selected="true"] { background:var(--accent-soft); color:var(--accent-ink); }
.profile-zone-option:focus-visible { outline:2px solid var(--focus); outline-offset:-2px; }
.profile-zone-check { display:inline-flex; flex-shrink:0; width:16px; }
@media(max-width:420px) {
  .profile-picture-row { gap:12px; }
  .profile-picture.avatar { width:54px; height:54px; font-size:18px; }
  .profile-picture-actions .button { min-height:40px; }
}
.settings-account { flex-wrap:wrap; }
.settings-account .profile-trigger { max-width:100%; }

/* Secondary auth actions previously inherited padding:0 and no corner radius. */
.auth-page .text-button {
  min-height:var(--control-compact); padding:var(--space-1) var(--space-2);
  border:1px solid transparent; border-radius:var(--radius-xs); line-height:1.45;
  vertical-align:middle; justify-content:center;
  transition:background-color .12s ease,color .12s ease,box-shadow .12s ease;
}
.auth-page .text-button:hover:enabled { background:var(--accent-soft); text-decoration:none; }
.auth-page .text-button:active:enabled { background:var(--accent-soft); box-shadow:inset 0 0 0 1px var(--line-strong); }
.auth-page .text-button:focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
@media(max-width:600px) {
  .profile-trigger-name,.profile-trigger-chevron { display:none; }
  .library-page .dashboard-nav-right .profile-trigger .avatar { display:grid; }
  .profile-trigger.button { padding:var(--space-1); min-width:var(--control-touch); min-height:var(--control-touch); }
  .auth-page .text-button { min-height:var(--control-touch); }
}
@media(prefers-reduced-motion:reduce) {
  .auth-page .text-button,.profile-trigger { transition:none; }
}
@media(max-width:360px) {
  .library-page .dashboard-nav .library-appearance .select-trigger { width:108px; max-width:108px; }
}
