@font-face {
  font-family: "Bootstrap Icons";
  src: url("/_content/CopelandSyst.BootstrapComponents/lib/Bootstrap/dist/css/fonts/bootstrap-icons.woff2") format("woff2"), url("/_content/CopelandSyst.BootstrapComponents/lib/Bootstrap/dist/css/fonts/bootstrap-icons.woff") format("woff");
  font-display: block;
}

/* Selection is a semantic component boundary, independent of focus/AT roles. */
:where(button, label, legend, [role="button"], [role="tab"],
  [role="toolbar"], [role="menubar"], [role="menu"],
  .dialog-heading, .pane-heading, .eyebrow, [data-ui-chrome]) {
  -webkit-user-select: none;
  user-select: none;
}
:where(input, textarea, [contenteditable], .editor-paper, .scrivening-content,
  [data-selectable]) {
  -webkit-user-select: text;
  user-select: text;
}
.bi::before{font-family:"Bootstrap Icons";font-style:normal;font-weight:normal;line-height:1}.bi-arrow-left::before{content:"\f12f"}.bi-arrow-right::before{content:"\f138"}.bi-file-text::before{content:"\f3b9"}.bi-file-earmark::before{content:"\f392"}.bi-grid::before{content:"\f3fc"}.bi-list::before{content:"\f479"}.bi-people::before{content:"\f4d0"}.bi-search::before{content:"\f52a"}.bi-layout-sidebar-inset-reverse::before{content:"\f45b"}.bi-journals::before{content:"\f446"}.bi-plus-lg::before{content:"\f64d"}.bi-folder2::before{content:"\f3d9"}.bi-trash::before{content:"\f5de"}.bi-archive::before{content:"\f10d"}.bi-type-bold::before{content:"\f5f0"}.bi-type-italic::before{content:"\f5f4"}.bi-type-underline::before{content:"\f5f8"}.bi-list-ul::before{content:"\f478"}.bi-quote::before{content:"\f50b"}.bi-file-earmark-richtext::before{content:"\f36c"}
:root{--ink:#e8e4dc;--muted:#9b968d;--panel:#17191c;--paper:#f7f2e8;--paper-ink:#25221e;--accent:#d08a4a;--line:rgba(255,255,255,.09)}*{box-sizing:border-box}body{margin:0;background:#111316;color:var(--ink);font-family:Inter,system-ui,sans-serif;overflow:hidden}.skip-link{position:fixed;z-index:2000;left:1rem;top:0;transform:translateY(-150%);padding:.65rem 1rem;background:#fff;color:#111;border-radius:0 0 .35rem .35rem}.skip-link:focus{transform:translateY(0)}.app-shell{height:100vh;display:grid;grid-template:56px 1fr/60px minmax(220px,280px) minmax(420px,1fr) minmax(250px,310px);grid-template-areas:"top top top top" "rail navigation main inspector"}.app-shell.navigation-hidden{grid-template-columns:60px 0 minmax(420px,1fr) minmax(250px,310px)}.topbar{grid-area:top;background:#15171a;display:flex;gap:.85rem}.navbar-brand{color:var(--ink);font-weight:700}.brand-mark{width:28px;height:28px;display:grid;place-items:center;border:1px solid var(--accent);color:var(--accent);font-family:Georgia,serif}.btn-quiet{color:var(--muted);border:0}.btn-quiet:hover,.btn-quiet.active{color:var(--ink);background:#292d31}.navigation-toggle{display:flex;align-items:center;gap:.4rem}.navigation-toggle [data-navigation-toggle-label]{font-size:.78rem}.search-box{position:relative;max-width:300px;flex:1}.search-box .bi{position:absolute;left:.7rem;top:.43rem;color:var(--muted)}.search-box input{padding-left:2rem;background:#202328;border-color:#30343a;color:var(--ink)}.save-state{font-size:.75rem;color:var(--muted)}.project-rail{grid-area:rail;background:#121417;padding:.7rem .5rem;display:flex;align-items:center;flex-direction:column;gap:.6rem}.project-chip,.rail-action{border:0;text-decoration:none;width:40px;height:40px;border-radius:10px;display:grid;place-items:center;background:#25282d;color:var(--muted);font-weight:700}.project-chip.active{background:var(--accent);color:#17120d}.navigation-pane{grid-area:navigation;background:var(--panel);overflow:auto}.pane-heading{height:52px;padding:0 1rem;display:flex;align-items:center;justify-content:space-between;font-size:.8rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em}.navigation-tree{padding:.3rem .45rem}.navigation-node{width:100%;border:0;background:transparent;color:#bcb8b0;display:flex;gap:.5rem;align-items:center;padding:.38rem .5rem .38rem calc(.5rem + var(--depth)*1rem);border-radius:5px;text-align:left;font-size:.84rem}.navigation-node:hover,.navigation-node.active{background:#2a2d31;color:#fff}.navigation-node .bi{color:#817c73}.writing-surface{grid-area:main;overflow:auto;background:#202327}.editor-view,.planning-view{min-height:100%;padding:2.3rem clamp(1.5rem,5vw,5rem)}.document-header{max-width:780px;margin:0 auto 1.2rem;display:flex;justify-content:space-between;align-items:end}.document-header h1{font-family:Georgia,serif;font-size:1.55rem;margin:.2rem 0}.eyebrow{font-size:.65rem;letter-spacing:.15em;color:var(--accent);font-weight:800}.document-stat{color:var(--muted);font-size:.75rem}.formatbar{max-width:780px;margin:0 auto;background:#17191c;border:1px solid var(--line);padding:.35rem;display:flex;gap:.15rem;flex-wrap:wrap}.formatbar button{border:0;background:transparent;color:#aaa;padding:.35rem .55rem;min-height:36px}.formatbar button:disabled{opacity:.45}.toolbar-divider{width:1px;background:var(--line);margin:.2rem}.editor-paper{max-width:780px;min-height:calc(100vh - 220px);margin:0 auto;padding:4rem clamp(2rem,8vw,6rem);background:var(--paper);color:var(--paper-ink);box-shadow:0 20px 60px #0006;outline:none;font-family:Georgia,serif;font-size:1.08rem;line-height:1.78}.editor-paper[contenteditable="false"]{cursor:default}.placeholder-copy{color:#8b8377}.inspector-pane{grid-area:inspector;background:var(--panel);overflow:auto}.offcanvas-body{padding:1rem}.synopsis{background:#202328;border-color:#34383e;color:var(--ink);font-family:Georgia,serif}.inspector-tabs{display:flex;gap:.5rem}.inspector-tabs button{background:transparent;border:0;border-bottom:2px solid transparent;color:var(--muted);padding:.45rem .2rem;font-size:.75rem}.inspector-tabs button.active{color:var(--ink);border-color:var(--accent)}.metadata-list{display:grid;grid-template-columns:1fr 1fr;gap:.8rem;margin-top:1.2rem;font-size:.78rem}.metadata-list dt{color:var(--muted);font-weight:400}.metadata-list dd{text-align:right}.corkboard{max-width:1000px;margin:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:1rem}.index-card{background:#f2e9d8;color:#27231e;padding:1rem;min-height:160px;box-shadow:0 6px 18px #0004}.index-card h2{font:700 1rem Georgia,serif}.planning-view .table{--bs-table-bg:#1c1f23;--bs-table-color:#d7d3cb;max-width:1000px;margin:auto}.welcome-panel{max-width:720px;margin:20vh auto;padding:3rem}.welcome-panel h1{font:3.5rem/1.05 Georgia,serif}.welcome-panel p{color:var(--muted);font-size:1.1rem}.empty-small{padding:2rem 1rem;color:var(--muted);font-size:.85rem}:focus-visible{outline:3px solid #ffd29f!important;outline-offset:2px}.writing-surface:focus{outline:none}@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@media(max-width:1100px){.app-shell{grid-template-columns:60px 230px 1fr;grid-template-areas:"top top top" "rail navigation main"}.app-shell.navigation-hidden{grid-template-columns:60px 0 1fr}.inspector-pane{position:fixed}.view-switcher{display:none}}@media(max-width:720px){.app-shell,.app-shell.navigation-hidden{grid-template-columns:50px 1fr;grid-template-areas:"top top" "rail main"}.navigation-pane{position:fixed;z-index:1100;top:56px;bottom:0;left:50px;width:min(82vw,320px);box-shadow:12px 0 30px #0008}.app-shell.navigation-hidden .navigation-pane{display:none}.editor-view,.planning-view{padding:1rem}.editor-paper{padding:2rem 1.4rem}.search-box{display:none}.navigation-toggle [data-navigation-toggle-label]{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}.welcome-panel h1{font-size:2.4rem}}
.btn-accent{background:var(--accent);border-color:var(--accent);color:#17120d;font-weight:700}.btn-accent:hover{background:#e09a58;border-color:#e09a58;color:#111}.navigation-actions{display:flex;gap:.15rem}.role-review{grid-area:main;position:sticky;top:0;z-index:5;background:#5a351b;color:#fff;padding:.65rem 1rem;display:flex;align-items:center;justify-content:space-between;gap:1rem}.af-dialog{width:min(560px,calc(100vw - 2rem));max-height:calc(100vh - 2rem);overflow:auto;border:1px solid #454a50;border-radius:12px;padding:1.25rem;background:#1b1e22;color:var(--ink);box-shadow:0 30px 90px #000b}.af-dialog::backdrop{background:#08090bc7;backdrop-filter:blur(3px)}.dialog-heading,.section-heading{display:flex;align-items:center;justify-content:space-between;gap:1rem}.dialog-heading h2,.section-heading h3{font-family:Georgia,serif;margin:0}.dialog-actions{display:flex;justify-content:flex-end;gap:.5rem;margin-top:1.25rem}.dialog-error{min-height:1.5em;color:#ffb4ab;margin:.5rem 0 0}.library-dialog{width:min(940px,calc(100vw - 2rem))}.library-summary{display:flex;flex-wrap:wrap;gap:1.5rem;color:var(--muted);padding:1rem 0;border-bottom:1px solid var(--line)}.library-grid{display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;margin-top:1.25rem}.library-list{list-style:none;padding:0;margin:.75rem 0;max-height:50vh;overflow:auto}.library-list li{border-bottom:1px solid var(--line)}.library-list a,.library-list li>div{display:flex;justify-content:space-between;gap:1rem;padding:.65rem .25rem;color:var(--ink);text-decoration:none}.library-list span{color:var(--muted);font-size:.8rem}.navigation-menu{position:fixed;z-index:2200;min-width:170px;padding:.35rem;background:#25292e;border:1px solid #43484f;border-radius:7px;box-shadow:0 12px 30px #0008}.navigation-menu button{display:block;width:100%;border:0;background:transparent;color:var(--ink);text-align:left;padding:.5rem .7rem;border-radius:4px}.navigation-menu button:hover,.navigation-menu button:focus{background:#373c43}@media(max-width:720px){.library-grid{grid-template-columns:1fr}.role-review{font-size:.8rem;align-items:flex-start;flex-direction:column}}
.inspector-tabs{overflow-x:auto;margin-bottom:1rem}.inspector-note-editor{min-height:260px;max-height:55vh;overflow:auto;padding:.8rem;background:#f7f2e8;color:#25221e;border:1px solid #3b4046;border-radius:6px;font-family:Georgia,serif;line-height:1.6}.inspector-note-editor[contenteditable="false"]{opacity:.8}.snapshot-list,.comment-list{list-style:none;padding:0;margin:0}.snapshot-list li,.comment-list li{padding:.65rem 0;border-bottom:1px solid var(--line);font-size:.8rem}.snapshot-list li>div:first-child{display:flex;flex-direction:column}.snapshot-list span,.comment-list span{display:block;color:var(--muted);font-size:.7rem}.snapshot-actions{display:flex;gap:.35rem;margin-top:.4rem}.snapshot-actions button,.comment-list button{border:0;border-radius:4px;padding:.25rem .45rem;background:#30343a;color:var(--ink)}.comment-list li.resolved{opacity:.65}.revision-diff{margin-top:1rem;padding:.75rem;background:#111316;border-radius:6px;max-height:280px;overflow:auto}.revision-diff h3{font-size:.9rem}.diff-added{background:#174b2c;text-decoration:none}.diff-deleted{background:#642627;text-decoration:line-through}.diff-equal{color:var(--muted)}.keyword-list{display:flex;gap:.35rem;flex-wrap:wrap}.keyword-list .eyebrow{flex-basis:100%}.keyword-chip{padding:.2rem .45rem;border:1px solid #4a4f56;border-radius:999px;font-size:.72rem}
.collections-strip{border-bottom:1px solid var(--line);padding:.35rem .55rem}.collections-heading,.collection-row{display:flex;align-items:center;justify-content:space-between;gap:.3rem;font-size:.72rem;color:var(--muted)}.collections-heading button,.collection-row button{border:0;background:transparent;color:inherit}.collection-row>button:first-child{flex:1;text-align:left;padding:.25rem}.collection-row span{opacity:.7}.navigation-node[hidden]{display:none}.scrivenings{max-width:820px;margin:auto}.scrivening-document{background:var(--paper);color:var(--paper-ink);margin-bottom:1rem;padding:2.25rem 3rem;box-shadow:0 10px 35px #0004}.scrivening-document header{display:flex;justify-content:space-between;gap:1rem;border-bottom:1px solid #d4cabb;margin-bottom:1.5rem}.scrivening-document h2{font:1.15rem Georgia,serif}.scrivening-document header button,.index-card footer button{border:0;background:transparent;color:#704521;font-weight:700}.scrivening-content{font:1rem/1.7 Georgia,serif}.index-card textarea{width:100%;border:0;background:#fff8e9;color:#27231e;resize:vertical;padding:.4rem;font:inherit}.index-card footer{display:flex;justify-content:space-between;align-items:center;font-size:.72rem;margin-top:.5rem}.outliner-title{border:0;background:transparent;color:inherit;text-align:left}.search-results-panel{position:absolute;z-index:20;inset:56px 310px 0 340px;background:#181b1f;padding:1.25rem;overflow:auto;box-shadow:0 20px 50px #0009}.search-results-heading{display:flex;justify-content:space-between}.search-results-panel ol{list-style:none;padding:0;max-width:850px}.search-results-panel li{border-bottom:1px solid var(--line)}.search-results-panel li>button{display:block;width:100%;text-align:left;border:0;background:transparent;color:var(--ink);padding:.75rem}.search-results-panel li span{display:block;color:var(--accent);font-size:.72rem}.search-results-panel li p{color:var(--muted);margin:.3rem 0}.replace-tools{margin:.5rem 0}@media(max-width:1100px){.search-results-panel{right:0}}@media(max-width:720px){.search-results-panel{inset:56px 0 0 50px}.scrivening-document{padding:1.25rem}}
.app-shell.focus-mode{grid-template-columns:0 0 minmax(420px,1fr) 0}.focus-mode .project-rail,.focus-mode .navigation-pane,.focus-mode .inspector-pane{visibility:hidden}.focus-mode .topbar>*:not(.navbar-brand):not([data-save-state]):not([data-focus-mode]){display:none}.typewriter-mode .editor-paper{padding-bottom:45vh}.statistics-grid{display:grid;grid-template-columns:1fr 1fr;gap:.75rem}.statistics-grid>div{padding:1rem;background:#25292e;border-radius:7px;display:flex;flex-direction:column}.statistics-grid strong{font:1.7rem Georgia,serif}.statistics-grid span,.goal-list span{color:var(--muted);font-size:.75rem}.goal-list{list-style:none;padding:0}.goal-list li{display:flex;flex-direction:column;gap:.3rem;padding:.65rem 0;border-bottom:1px solid var(--line)}.goal-list progress{width:100%;accent-color:var(--accent)}
.story-bible{max-width:1300px;margin:auto}.knowledge-tabs{max-width:1100px;margin:0 auto 1rem;display:flex;gap:.35rem;border-bottom:1px solid var(--line)}.knowledge-tabs button{border:0;border-bottom:2px solid transparent;background:transparent;color:var(--muted);padding:.65rem .8rem}.knowledge-tabs button[aria-selected="true"]{color:var(--ink);border-color:var(--accent)}.knowledge-layout{max-width:1100px;margin:auto;display:grid;grid-template-columns:minmax(230px,320px) minmax(360px,1fr);gap:1.25rem}.knowledge-index,.knowledge-form,.knowledge-detail,.timeline-list,.asset-library-list,.continuity-list{background:#191c20;border:1px solid var(--line);border-radius:8px;padding:1rem}.knowledge-index ol,.timeline-list,.asset-library-list,.continuity-list{list-style:none;margin:.75rem 0 0;padding:0}.knowledge-index li,.timeline-list li,.asset-library-list li,.continuity-list li{border-bottom:1px solid var(--line);padding:.65rem 0}.knowledge-index li>button{width:100%;border:0;background:transparent;color:var(--ink);display:flex;align-items:start;justify-content:space-between;text-align:left;padding:.35rem}.knowledge-index li>button[aria-current="true"]{background:#31353b;border-radius:5px}.knowledge-index span,.timeline-list span,.asset-library-list span,.knowledge-detail span{display:block;color:var(--muted);font-size:.75rem}.knowledge-detail h2,.knowledge-form h2{font-family:Georgia,serif}.knowledge-subform{margin-top:1.25rem;padding-top:1.25rem;border-top:1px solid var(--line)}.knowledge-subform h3{font:1.05rem Georgia,serif}.knowledge-subform ul{padding-left:1.2rem}.asset-library-list li{display:flex;gap:1rem}.asset-library-list img{width:120px;height:90px;object-fit:cover;border-radius:5px}.asset-library-list a{color:#f0b47e}.timeline-list p,.asset-library-list p{color:var(--muted);margin:.35rem 0}.story-bible .form-control,.story-bible .form-select{background:#22262b;border-color:#3a3f46;color:var(--ink)}@media(max-width:850px){.knowledge-layout{grid-template-columns:1fr}.knowledge-tabs{overflow-x:auto}.story-bible{padding:1rem}}

/* 2026 desktop synthesis: hierarchy and palette are derived from Playwright evidence. */
:root {
  --ink: #26231f;
  --muted: #625e57;
  --panel: #f3eee5;
  --paper: #faf6ed;
  --paper-ink: #26231f;
  --accent: #365f73;
  --accent-strong: #254c60;
  --warning: #a96019;
  --line: #d4ccc0;
  --chrome: #e9e3d9;
  --focus: #086fb8;
  --deep-ink: #1e2428;
}

body { min-height:100dvh; overflow:auto; background: var(--chrome); color: var(--ink); font-family: "Segoe UI", system-ui, sans-serif; }
.workspace-body { height:100dvh; min-height:0; overflow:hidden; display:flex; flex-direction:column; }
.plan-capacity-notice { position:fixed; inset:auto 0 0; z-index:1030; display:flex; align-items:center; justify-content:space-between; gap:.5rem 1rem; flex-wrap:wrap; padding:.65rem 1rem; background:var(--bs-body-bg,#fff); color:var(--bs-body-color,#212529); border-top:2px solid var(--bs-warning,#ffc107); font-size:.875rem; }
.plan-capacity-notice[hidden] { display:none; }
.plan-capacity-notice a { flex-shrink:0; font-weight:600; }
body:not(.workspace-body):has([data-plan-capacity-notice]:not([hidden])) { padding-bottom:var(--plan-notice-height,0px); }
/* The server emits this row before the large workspace body, so its real,
   wrapping height is known at the first editor paint. No guessed pixel reserve. */
.workspace-body > .plan-capacity-notice { position:static; order:2; flex:0 0 auto; }
.workspace-body > [data-private-beta-banner] { flex:0 0 auto; }
.workspace-body > .app-shell { order:1; flex:1 1 0; height:auto; min-height:0; }
@media print { .plan-capacity-notice { display:none; } }
.marketing-body { min-height:100dvh; overflow:auto; }
:focus-visible { outline: 2px solid var(--focus) !important; outline-offset: 2px; }
.skip-link { background: #fff; color: #171512; border: 2px solid var(--focus); }
.skip-link-navigation { left: 12rem; }
.skip-link-inspector { left: 20rem; }
@media (max-width: 720px) {
  .skip-link, .skip-link-navigation, .skip-link-inspector {
    left: 1rem;
    max-width: calc(100vw - 2rem);
  }
}

.app-shell {
  --navigation-width: 296px;
  --inspector-width: 336px;
  grid-template: 52px 34px minmax(0, 1fr) / 56px var(--navigation-width) minmax(520px, 1fr) var(--inspector-width);
  grid-template-areas: "top top top top" "menu menu menu menu" "rail navigation main inspector";
  background: var(--chrome);
}
.app-shell.navigation-hidden { grid-template-columns: 56px 0 minmax(520px, 1fr) var(--inspector-width); }
.app-shell.inspector-hidden { grid-template-columns: 56px var(--navigation-width) minmax(520px, 1fr) 0; }
.app-shell.navigation-hidden.inspector-hidden { grid-template-columns: 56px 0 minmax(520px, 1fr) 0; }
.app-shell.inspector-hidden .inspector-pane { visibility: hidden; }
/* Server-known normal layout also works when scripting is unavailable. The
   early bootstrap replaces this class using the current window's Focus mode. */
@media (min-width: 1441px) {
  .app-shell.initial-inspector-hidden { grid-template-columns:56px var(--navigation-width) minmax(520px,1fr) 0; }
  .app-shell.navigation-hidden.initial-inspector-hidden { grid-template-columns:56px 0 minmax(520px,1fr) 0; }
  .app-shell.initial-inspector-hidden .inspector-pane { visibility:hidden; }
}
.topbar { min-height: 52px; padding-block: 0 !important; gap: .65rem; flex-wrap: nowrap; overflow: hidden; background: var(--deep-ink); color: #f7f3eb; border-color: #384047 !important; }
.navbar-brand { display: block; flex: 0 0 161.2px; width: 161.2px; min-width: 161.2px; height: 40px; margin: 0; padding: 0; }
.brand-logo { display: block; width: 161.2px; height: 40px; }
.topbar .btn-quiet { min-height: 40px; color: #e4e0d8; border-radius: 6px; }
.topbar .btn-quiet:hover,.topbar .btn-quiet.active { color: #fff; background: #343c42; }
.navigation-toggle [data-navigation-toggle-label] { font-size: .82rem; }
.project-identity { min-width: 170px; max-width: 330px; height: 40px; padding: 0 .75rem; display: flex; align-items: center; gap: .3rem; overflow: hidden; border: 0; border-left: 1px solid #3c444a; background: transparent; color: #fff; text-align: left; }
.project-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-identity span { flex: none; color: #beb9b0; font-size: .78rem; }
.search-box { max-width: 340px; min-width: 180px; }
.search-box .bi { top: .58rem; }
.search-box input { min-height: 38px; background: #2a3035; border-color: #4a535a; color: #fff; }
.search-box input::placeholder { color: #cbc5bc; }
.save-state { min-width: 64px; color: #ece8e0; font-size: .8rem; text-align: right; }
.command-palette-button { display: flex; align-items: center; gap: .55rem; border: 1px solid #4a535a !important; }
.command-palette-button kbd { padding: .1rem .3rem; border: 1px solid #6b747a; background: transparent; color: #e8e4dc; font-size: .65rem; }
.inspector-toggle { display: flex; align-items: center; gap: .4rem; }
.topbar [data-open-goal-dialog],
.topbar [data-open-layout-dialog],
.topbar .browser-fullscreen,
.outline-navigation [data-open-quick-reference] { display: inline-flex; align-items: center; gap: .4rem; }
.topbar > :not(.search-box):not(.project-identity) { flex: 0 0 auto; }
.application-menu-bar { grid-area: menu; position: relative; z-index: 30; min-width: 0; min-height: 34px; padding-inline: .45rem; display: flex; align-items: stretch; gap: .05rem; border-bottom: 1px solid #c8c0b5; background: #f8f4ec; }
.application-menu-bar .bs-top-level-menu { display: flex; align-items: stretch; }
.application-menu-bar .bs-top-level-menu > .btn { min-height: 32px; padding: .2rem .65rem; border: 0; border-radius: 0; background: transparent; color: #38342f; font-size: .82rem; box-shadow: none; }
.application-menu-bar .bs-top-level-menu > .btn:hover,
.application-menu-bar .bs-top-level-menu > .btn:focus,
.application-menu-bar .bs-top-level-menu > .btn.show { background: #e2dbd0; color: #171512; }
.application-menu-bar .dropdown-menu { min-width: 250px; padding: .35rem; border-color: #aaa095; background: #fffdf8; box-shadow: 0 12px 30px #443a2f45; }
.application-menu-bar .dropdown-item { position:relative; min-height:38px; padding-block:.48rem; padding-inline:.65rem; padding-inline-start:2.55rem; display:flex; align-items:center; justify-content:space-between; gap:1.5rem; border-radius:4px; color:#292621; }
.application-menu-bar .bs-top-level-menu > .dropdown-menu { top:100%; inset-inline-start:0; inset-inline-end:auto; margin-top:0; transform:none!important; }
.application-menu-bar .bs-top-level-menu > .dropdown-menu.dropdown-menu-end { inset-inline-start:auto; inset-inline-end:0; }
.application-menu-bar .menu-glyph,
.application-menu-bar .dropdown-item[aria-checked="true"]:not(:has(.menu-glyph))::before { position:absolute; inset-inline-start:.42rem; width:1.55rem; height:1.55rem; display:grid; place-items:center; border:1px solid transparent; border-radius:4px; color:currentColor; content:"\2713"; }
.application-menu-bar .dropdown-item[aria-checked="true"] .menu-glyph { border-color:var(--accent); background:var(--selected,#dfeaf0); color:var(--accent-strong); }
.application-menu-bar .dropdown-item[aria-checked="false"] .menu-glyph { background:transparent; }
.application-menu-bar .dropdown-item:hover,
.application-menu-bar .dropdown-item:focus { background: #dfeaf0; color: #183848; }
.application-menu-bar .shortcut-key { margin-left: auto; color: #625d55; font-size: .72rem; white-space: nowrap; }
.application-menu-bar .application-document-title { min-width:0; flex:1 1 10rem; margin:0 .65rem; padding-left:.75rem; border-left:1px solid var(--line); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font:500 .88rem/1.5 "Segoe UI",system-ui,sans-serif; }
.application-account-identity { padding:.5rem .65rem; overflow-wrap:anywhere; }
.application-account-identity span,.application-account-identity strong { display:block; }
.application-account-identity span { color:var(--muted); font-size:.75rem; }
.application-document-actions { position:relative; flex:none; margin-left:auto; }
.application-document-actions .outline-navigation { display:flex; gap:.2rem; }
.document-actions-toggle,.workspace-view-select { display:none; }
.formatting-toggle { margin-left:auto; white-space:nowrap; }
.contextual-notes { display:grid; gap:.7rem; min-width:0; }
.contextual-notes h2 { margin:0; font-size:1rem; }
.contextual-note-purpose { margin:0; padding:.6rem .7rem; border-left:2px solid var(--accent); background:color-mix(in srgb,var(--panel) 80%,var(--accent) 12%); font-size:.85rem; line-height:1.55; }
.contextual-note-actions { display:flex; flex-wrap:wrap; gap:.4rem; margin-block:.7rem; }
[data-source-note-summary] { padding-left:1.2rem; font-size:.85rem; overflow-wrap:anywhere; }
.app-shell :focus-visible { outline:3px dotted var(--accent)!important; outline-offset:3px; }
.shortcut-sequence-feedback { position: fixed; z-index: 2600; left: 50%; bottom: 2.25rem; max-width: min(42rem,calc(100vw - 2rem)); padding: .55rem .8rem; transform: translateX(-50%); border: 1px solid #756b5f; border-radius: 6px; background: #24282c; color: #fff; box-shadow: 0 8px 28px #0007; font-size: .8rem; }
.shortcut-prefix { display:block; margin-bottom:.4rem; font-weight:700; }
.shortcut-next-keys { display:grid; gap:.3rem; }
.shortcut-key-group { display:flex; align-items:center; gap:.2rem; }
.shortcut-modifiers { margin-inline-end:.05rem; font-weight:700; }
.shortcut-next-keys kbd { min-width:2rem; padding:.2rem .42rem; text-align:center; }

.project-rail { padding: .6rem .45rem; gap: .55rem; overflow: auto; background: var(--deep-ink); }
.project-chip,.rail-action { flex: 0 0 40px; width: 40px; height: 40px; border: 1px solid #414950; border-radius: 8px; background: #30373c; color: #f5f1e9; font-size: .72rem; letter-spacing: .04em; }
.project-chip:hover,.rail-action:hover { background: #424b51; color: #fff; }
.project-chip.active { border-color: #80aabe; box-shadow: inset 3px 0 #d6edf7; background: var(--accent); color: #fff; }

.navigation-pane,.inspector-pane { background: var(--panel); color: var(--ink); border-color: var(--line) !important; }
.navigation-project-heading { min-height: 66px; padding: .7rem .8rem; display: flex; align-items: center; justify-content: space-between; gap: .6rem; border-bottom: 1px solid var(--line); }
.navigation-project-heading div { min-width: 0; display: flex; flex-direction: column; }
.navigation-project-heading .navigation-project-actions { flex: 0 0 auto; flex-direction: row; align-items: center; gap: .25rem; }
.navigation-project-heading strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 .9rem Georgia, serif; }
.navigation-project-heading span { color: var(--muted); font-size: .72rem; }
.role-review-button { flex: none; min-height: 34px; padding: .3rem .55rem; border: 1px solid #b9742b; border-radius: 5px; background: #fff0dc; color: #6e3704; font-weight: 650; font-size: .72rem; }
.pane-heading { height: 48px; border-bottom: 1px solid var(--line); color: var(--ink); }
.navigation-actions .btn-quiet { min-width: 36px; min-height: 36px; color: var(--muted); }
.navigation-actions .btn-quiet:hover { background: #e2dbd0; color: var(--ink); }
.collections-strip { border-color: var(--line); }
.collections-heading,.collection-row { color: var(--muted); }
.navigation-tree { padding: .35rem .4rem; }
.navigation-node { min-height: 40px; padding-block: .45rem; color: #49453f; border-radius: 5px; }
.navigation-node:hover { background: #e5ded3; color: var(--ink); }
.navigation-node.active { background: #d9e7ee; color: #183848; box-shadow: inset 3px 0 var(--accent); font-weight: 650; }
.navigation-node .bi { color: #6b665e; }
.navigation-node.navigation-visual-separator { color: #625c53; font-size: .73rem; font-weight: 750; letter-spacing: .035em; }
.navigation-node.navigation-visual-separator .bi { display: none; }
.navigation-node.navigation-visual-separator::before,.navigation-node.navigation-visual-separator::after { min-width: .75rem; height: 1px; flex: 1 1 auto; background: currentColor; opacity: .55; content: ""; }
.navigation-node.navigation-visual-separator span { flex: 0 1 auto; max-width: 72%; }
.navigation-node.navigation-compile-context::after { margin-left: auto; padding: .08rem .3rem; border: 1px solid #9b958c; border-radius: 999px; color: #625e57; font-size: .58rem; font-weight: 600; content: "Context"; }
.navigation-tree.treeview { --bs-treeview-toggle-size: 1.75rem; }
.navigation-tree.treeview .navigation-node { padding: .35rem .5rem; padding-inline-start: calc(.5rem + var(--bs-treeview-indent) * (var(--bs-treeview-level, 1) - 1)); }
.navigation-tree.treeview .navigation-node .treeview-toggle { flex: 0 0 auto; }
.navigation-tree.treeview .navigation-node .treeview-label-wrap { max-width: none; }
.navigation-tree.treeview .navigation-node.navigation-visual-separator::before { content: none; }
.navigation-tree.treeview .navigation-node.navigation-visual-separator span { max-width: none; }
.navigation-tree.treeview .navigation-node.navigation-visual-separator .treeview-toggle .bi { display: inline-block; }
.navigation-tree.treeview .navigation-node:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.navigation-tree.treeview .treeview-search { background: inherit; }
/* The native tree is the navigation scroll owner; its search remains at its top. */
.navigation-pane { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.navigation-pane[hidden] { display: none; }
.navigation-pane > :not(.navigation-tree) { flex: 0 0 auto; }
.navigation-pane > .navigation-tree.treeview {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  background: var(--panel);
  scroll-padding-block-start: 3.25rem;
  overscroll-behavior: contain;
}
.navigation-pane > [data-navigation-tooltips] { min-height: 0; }
.navigation-icon-dialog { width: min(38rem,calc(100vw - 2rem)); }
.navigation-icon-choices { display: grid; grid-template-columns: repeat(auto-fit,minmax(7rem,1fr)); gap: .5rem; max-height: min(55dvh,30rem); padding: .2rem; overflow: auto; border: 0; }
.navigation-icon-choices label { min-height: 5rem; padding: .65rem .4rem; display: grid; place-items: center; align-content: center; gap: .25rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); cursor: pointer; text-align: center; }
.navigation-icon-choices label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); background: color-mix(in srgb,var(--accent) 12%,var(--paper)); }
.navigation-icon-choices input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.navigation-icon-choices label:has(input:focus-visible) { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.navigation-icon-choices .bi { font-size: 1.35rem; }
.navigation-icon-choices span { font-size: .76rem; }

.writing-surface { position: relative; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--chrome); }
.workspace-view-well { position:relative; z-index:12; flex:0 0 44px; min-width:0; height:44px; display:flex; align-items:stretch; overflow:hidden; border-bottom:1px solid var(--line); background:#f8f4ec; }
.workspace-view-tabs { position: relative; z-index: 12; flex: 1 1 auto; min-width:0; height: 44px; padding: 0 0 0 clamp(1rem, 4vw, 4rem); display: flex; align-items: stretch; gap: .15rem; overflow-x: auto; border:0; background: transparent; }
.workspace-view-tabs button { min-width: 40px; padding: 0 .8rem; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); white-space: nowrap; }
.workspace-view-tabs button:hover { background: #e9e2d7; color: var(--ink); }
.workspace-view-tabs button[aria-selected="true"] { border-color: var(--accent); background: #e7eef1; color: #193b4c; font-weight: 700; }
.workspace-compile-filter { position: relative; z-index: 13; flex:0 0 auto; min-height: 44px; padding: 0 .65rem; display: flex; align-items: center; gap: .45rem; border-left: 1px solid var(--line); background: #f8f4ec; color: #49453f; font-size: .78rem; white-space: nowrap; }
.workspace-compile-filter input { width: 1rem; height: 1rem; accent-color: var(--accent); }
.editor-view,.planning-view { flex: 1 1 auto; height: auto; min-height: 0; padding: 1.2rem clamp(1rem, 4vw, 4rem) 2.5rem; overflow: auto; }
.document-header { max-width: 840px; min-height: 52px; margin-bottom: .65rem; align-items: center; }
.document-header h1 { color: var(--ink); font-size: 1.55rem; }
.document-stat { color: var(--muted); font-size: .82rem; }
.eyebrow { color: var(--accent-strong); }
.formatbar { max-width: 840px; min-height: 44px; margin: 0 auto; padding: 2px; align-items: center; flex-wrap: nowrap; overflow: visible; border: 1px solid var(--line); border-radius: 6px 6px 0 0; background: #fdfaf4; }
.formatbar > button,.formatbar > select,.formatbar > .dropdown > button { min-height: 40px; padding: .4rem .6rem; border: 0; background: transparent; color: var(--ink); }
.formatbar > button:hover,.formatbar > .dropdown > button:hover { background: #e7e0d6; }
.formatbar .dropdown { flex: none; }
.formatbar .dropdown-menu { min-width: 210px; padding: .35rem; border-color: #bfb6a9; background: #fffdf8; box-shadow: 0 12px 30px #554b3b2b; }
.formatbar [data-editor-more-menu] > .dropdown-menu { max-height:var(--editor-more-menu-height,calc(100dvh - 1rem)); overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
.formatbar .dropdown-item { min-height: 38px; border-radius: 4px; color: var(--ink); }
.formatbar .dropdown-item:hover,.formatbar .dropdown-item:focus { background: #dfeaf0; color: #183848; }
.table-context-tools { max-width: 840px; min-height: 40px; margin: 0 auto; padding: .2rem .5rem; display: flex; align-items: center; gap: .35rem; border: 1px solid var(--line); border-top: 0; background: #e7eef1; color: #183848; }
.table-context-tools[hidden] { display: none; }
.table-context-tools span { margin-right: .35rem; font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.table-context-tools button { min-height: 34px; border: 0; border-radius: 4px; background: #fff; color: inherit; }
.editor-paper { max-width: 840px; min-height: calc(100vh - 255px); padding: 4rem clamp(3rem, 6vw, 4rem); border: 1px solid #d7cec0; border-top: 0; background: var(--paper); color: var(--paper-ink); box-shadow: 0 10px 34px #5d514126; font-family: Georgia, "Times New Roman", serif; font-size: 1.125rem; line-height: 1.72; caret-color: #173e52; }
.placeholder-copy { color: #776f64; }

.inspector-pane { box-shadow: -1px 0 var(--line); }
.offcanvas-header.pane-heading { height: 52px; }
.offcanvas-body { padding: .9rem 1rem; }
.inspector-pane [data-inspector-panel] { margin-inline: .9rem; padding-bottom: 1rem; }
.inspector-tabs { min-height: 42px; gap: .15rem; margin: 0 0 1rem; border-bottom: 1px solid var(--line); }
.inspector-tabs button { min-height: 40px; padding: .45rem .5rem; color: var(--muted); }
.inspector-tabs button.active { border-color: var(--accent); color: #193b4c; font-weight: 700; }
.synopsis,.story-bible .form-control,.story-bible .form-select,.inspector-pane .form-control,.inspector-pane .form-select { background: #fffdf8; border-color: #c8c0b4; color: var(--ink); }
.inspector-autosave { min-height: 32px; padding: .35rem 0; color: var(--muted); font-size: .72rem; }
.metadata-list { color: var(--ink); }
.metadata-list dt { color: var(--muted); }
.inspector-note-editor { background: var(--paper); color: var(--ink); border-color: var(--line); }

.planning-view .table { --bs-table-bg: #fffdf8; --bs-table-color: var(--ink); --bs-table-border-color: var(--line); }
.index-card { border: 1px solid #d0c6b8; background: #fff8e9; box-shadow: 0 6px 18px #554b3b20; }
.scrivening-document { border: 1px solid #d0c6b8; box-shadow: 0 6px 18px #554b3b20; }
.story-bible { max-width: 1300px; }
.knowledge-tabs { border-color: var(--line); }
.knowledge-tabs button { color: var(--muted); }
.knowledge-tabs button[aria-selected="true"] { color: #193b4c; border-color: var(--accent); }
.knowledge-index,.knowledge-form,.knowledge-detail,.timeline-list,.asset-library-list,.continuity-list { border-color: var(--line); background: #f9f5ee; }
.knowledge-index li,.timeline-list li,.asset-library-list li,.continuity-list li,.knowledge-subform { border-color: var(--line); }
.knowledge-index li > button { color: var(--ink); }
.knowledge-index li > button[aria-current="true"] { background: #dce9ef; }
.knowledge-index span,.timeline-list span,.asset-library-list span,.knowledge-detail span { color: var(--muted); }
.asset-library-list a { color: #24546b; }
.knowledge-detail > header,.timeline-list li > div:first-child { display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
.story-bible .timeline-list { min-width: 0; padding: .25rem 1rem; }
.story-bible .timeline-list li { white-space: normal; overflow-wrap: anywhere; }
.story-bible .timeline-list li > div:first-child { flex-wrap: wrap; }
.story-bible .timeline-list p { white-space: normal; }
.knowledge-record-actions { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; flex-wrap: wrap; }
.knowledge-subform li { display: flex; align-items: start; justify-content: space-between; gap: .75rem; margin-bottom: .35rem; }
.asset-library-list li > div { min-width: 0; flex: 1; }
.asset-library-list details { margin-top: .65rem; border-top: 1px solid var(--line); padding-top: .5rem; }
.asset-library-list summary { cursor: pointer; font-weight: 700; }
.asset-library-list [data-asset-link-form] { display: grid; grid-template-columns: repeat(2,minmax(170px,1fr)); gap: .6rem; margin-top: .65rem; }
.asset-library-list [data-asset-link-form] label { color: var(--muted); font-size: .75rem; }
.asset-library-list [data-asset-link-form] .dialog-actions,.asset-library-list [data-asset-link-form] output { grid-column: 1/-1; }
@media(max-width:700px){.asset-library-list [data-asset-link-form]{grid-template-columns:1fr}}

.af-dialog { border-color: #ada396; background: #fffdf8; color: var(--ink); box-shadow: 0 30px 90px #28201866; }
.af-dialog::backdrop { background: #1b1d1db8; backdrop-filter: blur(2px); }
.shell-task-dialog { width:min(960px,calc(100vw - 2rem)); max-width:calc(100vw - 2rem); max-height:calc(100dvh - 2rem); padding:0; }
.shell-task-dialog[open] { display:flex; flex-direction:column; }
.shell-task-dialog>.dialog-heading { flex:0 0 auto; margin:0; padding:1rem; border-bottom:1px solid var(--line); }
.shell-task-dialog>.dialog-heading h2 { margin:0; font-size:1.2rem; }
.shell-task-dialog .btn-close { flex:0 0 44px; width:44px; height:44px; padding:.75rem; }
.shell-task-status { flex:0 0 auto; margin:0; padding:.6rem 1rem; overflow-wrap:anywhere; }
.shell-task-status:empty { padding:0; }
.shell-task-content { min-height:0; overflow:auto; overscroll-behavior:contain; padding:1rem; }
.shell-task-content>[data-shell-task] { min-width:0; overflow-wrap:anywhere; }
.shell-task-content .container { max-width:100%; padding-inline:0; }
.shell-task-content .shell-task-readable { max-width:52rem; }
.shell-task-content .shell-task-pre-wrap { white-space:pre-wrap; }
.shell-task-footer { flex:0 0 auto; display:flex; flex-wrap:wrap; gap:.5rem; padding:.75rem 1rem; border-top:1px solid var(--line); }
.shell-task-dialog button,.shell-task-dialog input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),.shell-task-dialog select { min-height:44px; }
@media(max-width:600px) { .shell-task-dialog { width:calc(100vw - 1rem); max-width:calc(100vw - 1rem); max-height:calc(100dvh - 1rem); } .shell-task-content { padding:.75rem; } }
.publication-dialog{width:min(1080px,calc(100vw - 3rem))}.publication-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(340px,.8fr);gap:1.5rem;margin-top:1rem}.publication-layout>form+form{border-left:1px solid var(--line);padding-left:1.5rem}.publication-layout h3{font-family:Georgia,serif;font-size:1.2rem}.compile-rules{border:0;padding:0;margin:1rem 0}.compile-rules legend{font-weight:700;font-size:.9rem;border-bottom:1px solid var(--line);padding-bottom:.35rem;margin-bottom:.7rem}.publication-actions{flex-wrap:wrap}.publication-actions [data-open-archive-restore]{margin-right:auto}.compile-preview{margin-top:1rem;max-height:19rem;overflow:auto;border-top:1px solid var(--line);padding-top:.75rem}.compile-preview ol{list-style:none;padding:0;margin:0}.compile-preview li{display:flex;justify-content:space-between;gap:1rem;padding:.45rem .25rem;border-bottom:1px solid var(--line)}.compile-preview li span{color:var(--muted);text-align:right}.compile-preview li.excluded strong{text-decoration:line-through;color:var(--muted)}.archive-validation{margin-top:1rem;padding:.8rem;border:1px solid var(--line);border-radius:.4rem;background:var(--panel-soft,#f5f1e8);overflow-wrap:anywhere}.archive-validation dl{display:grid;grid-template-columns:max-content 1fr;gap:.2rem .8rem;margin:0}.archive-validation dt{font-weight:700}.archive-validation dd{margin:0}.archive-validation code{font-size:.72rem}@media(max-width:850px){.publication-layout{grid-template-columns:1fr}.publication-layout>form+form{border-left:0;border-top:1px solid var(--line);padding-left:0;padding-top:1rem}}
.compile-designer[open]{width:min(96rem,calc(100vw - 2rem));height:calc(100dvh - 2rem);max-width:none;max-height:none;padding:0;display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;overflow:hidden}.compile-designer>.dialog-heading{padding:1rem 1.25rem .45rem;margin:0}.compile-designer-header{padding:.65rem 1.25rem;display:grid;grid-template-columns:auto minmax(16rem,1fr) auto auto auto minmax(12rem,16rem);gap:.5rem;align-items:center;border-block:1px solid var(--line);background:var(--paper)}.compile-designer-header .form-label{margin:0}.compile-designer-body{min-height:0;display:grid;grid-template-columns:minmax(10rem,13rem) minmax(30rem,1fr) minmax(19rem,25rem);overflow:hidden}.compile-designer-tabs{min-width:0;padding:.75rem;display:flex;flex-direction:column;gap:.25rem;border-right:1px solid var(--line);background:var(--paper)}.compile-designer-tabs button{min-height:44px;padding:.55rem .7rem;border:0;border-left:4px solid transparent;background:transparent;color:var(--ink);text-align:left}.compile-designer-tabs button[aria-selected="true"]{border-left-color:var(--accent);background:var(--selected);font-weight:700}.compile-designer-panel{min-width:0;min-height:0;padding:1rem 1.2rem;overflow:auto}.compile-designer-panel h3{font-family:Georgia,serif}.compile-designer-panel>section[hidden]{display:none}.compile-field-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.75rem;margin-block:.7rem}.compile-field-grid>label{display:grid;gap:.25rem;font-weight:600}.compile-check-grid{display:flex;flex-wrap:wrap;gap:.7rem 1.5rem;margin-block:.7rem}.compile-master-detail{display:grid;grid-template-columns:minmax(13rem,30%) minmax(0,1fr);gap:.8rem;margin-top:1rem}.compile-master-detail>div,.compile-master-detail>fieldset{min-width:0;padding:.7rem;border:1px solid var(--line);border-radius:6px}.compile-master-detail [role="option"]{width:100%;min-height:52px;margin-bottom:.35rem;padding:.5rem;display:flex;justify-content:space-between;gap:.4rem;border:1px solid var(--line);border-radius:4px;background:transparent;color:var(--ink);text-align:left}.compile-master-detail [role="option"][aria-selected="true"]{border-color:var(--accent);border-left-width:4px;background:var(--selected)}[data-compile-transforms-panel] .compile-master-detail>div>.section-heading{align-items:stretch;flex-direction:column}[data-compile-transforms-panel] .compile-master-detail>div>.section-heading .btn{width:100%}.compile-list-actions{display:flex;flex-wrap:wrap;gap:.3rem;margin-top:.5rem}.compile-list-actions .btn{min-height:44px}.compile-preview{min-width:0;min-height:0;max-height:none;margin:0;padding:1rem;border-top:0;border-left:1px solid var(--line);overflow:auto;background:var(--paper)}.compile-preview li{display:grid;gap:.15rem}.compile-preview li span{text-align:left}.compile-designer-footer{min-height:70px;padding:.65rem 1.25rem;display:flex;align-items:center;justify-content:space-between;gap:1rem;border-top:1px solid var(--line);background:var(--paper)}.compile-designer-footer>p{margin:0}.compile-designer-footer>div{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.5rem}.compile-designer .btn,.compile-designer input,.compile-designer select,.compile-designer textarea{min-height:44px}
.compile-designer>.dialog-heading .btn-close{width:44px;height:44px;min-width:44px;padding:.75rem;flex:0 0 44px;border-radius:6px}
.compile-css-editor{min-height:10rem;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;resize:vertical}.compile-web-group{margin-top:1rem;padding:.8rem;border:1px solid var(--line);border-radius:6px}.compile-web-group>legend{float:none;width:auto;margin:0;padding-inline:.25rem;font-size:1rem;font-weight:700}
@media(max-width:960px){.compile-designer[open]{overflow-y:auto}.compile-designer>[class],.compile-designer>form,.compile-designer>aside{min-width:0;width:100%;max-width:100%}.compile-designer-header{grid-template-columns:1fr}.compile-designer-body{display:block;overflow:visible}.compile-designer-tabs{position:sticky;top:0;z-index:2;display:flex;flex-direction:row;overflow-x:auto;border-right:0;border-bottom:1px solid var(--line)}.compile-designer-tabs button{min-width:max-content;border-left:0;border-bottom:4px solid transparent}.compile-designer-tabs button[aria-selected="true"]{border-bottom-color:var(--accent)}.compile-designer-panel,.compile-preview{overflow:visible;border-left:0}.compile-preview{border-top:1px solid var(--line)}.compile-field-grid,.compile-master-detail{grid-template-columns:1fr}.compile-designer-footer{position:static;align-items:flex-start;flex-direction:column}}
.search-box{display:flex;max-width:470px}.search-box .bi{z-index:1}.search-box input{border-radius:.375rem 0 0 .375rem}.search-box [data-search-scope]{max-width:120px;border:1px solid #4a535a;border-left:0;border-radius:0 .375rem .375rem 0;background:#252a2f;color:#fff;font-size:.75rem;padding:.2rem .45rem}.search-results-heading [data-search-project]{display:block;color:var(--accent);font-size:.75rem}.search-facets{max-width:980px;border-block:1px solid var(--line);padding:.6rem 0;margin:.6rem 0}.search-facets summary{cursor:pointer;font-weight:700}.search-facet-grid{display:grid;grid-template-columns:repeat(4,minmax(130px,1fr));gap:.65rem;margin-top:.75rem;align-items:end}.search-facet-grid label{font-size:.72rem;color:var(--muted)}.search-facet-grid input,.search-facet-grid select{margin-top:.25rem}@media(max-width:1100px){.search-facet-grid{grid-template-columns:repeat(2,minmax(130px,1fr))}}
.statistics-dialog{width:min(780px,calc(100vw - 2rem))}.text-analysis{border-block:1px solid var(--line);padding:1rem 0;margin:1rem 0}.text-analysis .section-heading{align-items:flex-start}.text-analysis h3{font-size:1.15rem}.analysis-scope{font-weight:700;margin-bottom:.5rem}.analysis-grid{grid-template-columns:repeat(4,1fr)}.frequency-list{columns:2;list-style:none;padding:0;margin:.5rem 0}.frequency-list li{display:flex;justify-content:space-between;gap:1rem;border-bottom:1px solid var(--line);padding:.25rem .5rem;break-inside:avoid}.frequency-list li span{overflow:hidden;text-overflow:ellipsis}@media(max-width:700px){.analysis-grid{grid-template-columns:repeat(2,1fr)}.frequency-list{columns:1}}
.recovery-button{display:flex;align-items:center;gap:.35rem}.recovery-count{min-width:1.35rem;padding:.08rem .35rem;border-radius:999px;background:#9d3e32;color:#fff;font-size:.7rem;font-weight:800;text-align:center}.draft-recovery-dialog{width:min(780px,calc(100vw - 2rem))}.draft-recovery-list{max-height:56vh;overflow:auto;border-block:1px solid var(--line)}.draft-recovery-item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:1rem;align-items:center;padding:1rem .2rem;border-bottom:1px solid var(--line)}.draft-recovery-item:last-child{border-bottom:0}.draft-recovery-item h3{margin:0;font:1.05rem Georgia,serif}.draft-recovery-item p{margin:.25rem 0 0;color:var(--muted);font-size:.78rem}.draft-recovery-actions{display:flex;gap:.35rem;flex-wrap:wrap;justify-content:end}.recovery-warning{padding:.75rem;border-left:4px solid #b85837;background:#fff2df;color:#572819}@media(max-width:700px){.draft-recovery-item{grid-template-columns:1fr}.draft-recovery-actions{justify-content:start}.recovery-button>span:not(.recovery-count){position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}}
.draft-recovery-dialog[open]{width:min(1000px,calc(100vw - 2rem));max-height:calc(100dvh - 2rem);overflow:auto}
.recovery-tabs{position:sticky;top:-1rem;z-index:2;margin:.35rem 0 1rem;display:flex;gap:.15rem;border-bottom:1px solid var(--line);background:var(--surface,#fffdf8)}
.recovery-tabs button{min-height:44px;padding:.55rem .8rem;border:0;border-bottom:3px solid transparent;background:transparent;color:var(--muted)}
.recovery-tabs button[aria-selected="true"]{border-bottom-color:var(--accent);color:var(--ink);font-weight:700}
[data-recovery-panel]{min-height:24rem}
.recovery-filter{display:grid;grid-template-columns:auto minmax(12rem,1fr) auto minmax(9rem,.45fr) auto minmax(9rem,.45fr);gap:.45rem;align-items:center;margin-bottom:.75rem}
.recovery-filter label{margin:0;color:var(--muted);font-size:.75rem}
.project-activity-list,.backup-history{max-height:25rem;margin:0;padding:0;overflow:auto;border-block:1px solid var(--line);list-style:none}
.project-activity-list li,.backup-history li{min-height:66px;padding:.65rem .25rem;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.25rem .75rem;align-items:center;border-bottom:1px solid var(--line)}
.project-activity-heading{display:flex;align-items:center;gap:.6rem}.project-activity-heading time,.project-activity-list p,.backup-history span{color:var(--muted);font-size:.72rem}.project-activity-heading time{margin-left:auto}.project-activity-list p{grid-column:1;margin:0}.project-activity-list button{grid-column:2;grid-row:1 / span 2}.project-activity-detail{overflow-wrap:anywhere}
.backup-policy-layout{display:grid;grid-template-columns:minmax(14rem,.65fr) minmax(20rem,1.35fr);gap:1.25rem}.backup-policy-layout>form{padding-right:1.25rem;border-right:1px solid var(--line)}.backup-policy-layout h3{font:1.05rem Georgia,serif}.backup-history li>div{display:grid}.backup-history code{font-size:.7rem}.backup-history a{grid-row:1 / span 2;grid-column:3}
html[data-color-theme="dark"] .recovery-tabs{background:#202428}
@media(max-width:760px){.recovery-tabs{overflow-x:auto}.recovery-tabs button{min-width:max-content}.recovery-filter,.backup-policy-layout{grid-template-columns:1fr}.recovery-filter label{margin-top:.35rem}.backup-policy-layout>form{padding:0 0 1rem;border-right:0;border-bottom:1px solid var(--line)}}
.connectivity-banner{position:fixed;z-index:2400;top:86px;left:50%;width:max-content;max-width:calc(100vw - 2rem);padding:.55rem 1rem;transform:translateX(-50%);border:1px solid #d79b59;border-top:0;border-radius:0 0 .45rem .45rem;background:#fff0d6;color:#4f2b09;box-shadow:0 8px 24px #24180d3d;font-size:.82rem;font-weight:700;text-align:center}
.document-lock-notice{max-width:var(--editor-document-measure,840px);margin:0 auto 1rem;padding:.7rem .85rem;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.7rem;border:1px solid #c88b45;border-radius:.45rem;background:#fff0d6;color:#4f2b09;box-shadow:0 4px 14px #0002}.document-lock-notice[hidden]{display:none}.document-lock-notice p{margin:0}.document-lock-notice .btn{border-color:#71502a;color:#3e2a12}.document-lock-notice .btn:hover,.document-lock-notice .btn:focus-visible{background:#4f3518;color:#fff}.document-lock-notice.document-lock-error{border-color:#b84b51;background:#ffe8e8;color:#651c22}.document-lock-notice.document-lock-error .btn{border-color:#7e2b31;color:#651c22}.document-lock-notice.document-lock-error .btn:hover,.document-lock-notice.document-lock-error .btn:focus-visible{background:#651c22;color:#fff}.app-shell[data-color-theme="dark"] .document-lock-notice{border-color:#d7a25e;background:#332719;color:#fff0d7}.app-shell[data-color-theme="dark"] .document-lock-notice .btn{border-color:#e0b77e;color:#fff0d7}.app-shell[data-color-theme="dark"] .document-lock-notice .btn:hover,.app-shell[data-color-theme="dark"] .document-lock-notice .btn:focus-visible{background:#fff0d7;color:#2f2112}.app-shell[data-color-theme="dark"] .document-lock-notice.document-lock-error{border-color:#e98087;background:#3b1e21;color:#ffe9ea}.app-shell[data-color-theme="dark"] .document-lock-notice.document-lock-error .btn{border-color:#f0a2a8;color:#ffe9ea}.app-shell[data-color-theme="dark"] .document-lock-notice.document-lock-error .btn:hover,.app-shell[data-color-theme="dark"] .document-lock-notice.document-lock-error .btn:focus-visible{background:#ffe9ea;color:#3b1e21}
input[type="checkbox"],input[type="radio"]{min-width:24px;min-height:24px}.form-check{min-height:28px}.form-check-label{padding-top:.15rem}input[type="range"]{min-height:24px}.collections-heading button{min-width:28px;min-height:28px}
.dialog-error { color: #a3231b; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.library-summary,.library-list li { border-color: var(--line); }
.library-list a,.library-list li > div { color: var(--ink); }
.library-list span { color: var(--muted); }
.role-options { display: flex; gap: .65rem; margin-top: 1rem; }
.command-palette { width: min(680px, calc(100vw - 2rem)); padding: 1rem; }
.command-filter { min-height: 46px; margin: 1rem 0 .65rem; }
.command-results { max-height: min(60vh, 520px); overflow: auto; }
.command-results button { width: 100%; min-height: 44px; padding: .55rem .7rem; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 5px; background: transparent; color: var(--ink); text-align: left; }
.command-results button:hover,.command-results button:focus { background: #dfeaf0; }
.command-results kbd { border: 1px solid #81786e; background: #e7e0d6; color: #3e3933; }
.command-empty { padding: 1rem; color: var(--muted); }
.collaborators-dialog { width: min(760px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; }
.collaborator-invitation-form { display: grid; grid-template-columns: minmax(220px, 1fr) 150px 150px auto; gap: .75rem; align-items: end; }
.collaborator-invitation-form[hidden] { display:none; }
.collaborator-invitation-form label { display: grid; gap: .35rem; }
.invitation-token-panel { margin-block: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 6px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.collaborator-list-heading,.collaborator-invitation-row,.collaborator-invitation-row>div { display: flex; align-items: center; gap: .65rem; }
.collaborator-list-heading,.collaborator-invitation-row { justify-content: space-between; }
.collaborator-invitation-list { display: grid; gap: .5rem; }
.collaborator-invitation-row { min-height: 54px; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 6px; }
.collaborator-invitation-row>div:first-child { min-width: 0; flex-direction: column; align-items: flex-start; gap: .1rem; }
.collaborator-invitation-row strong,.collaborator-invitation-row span { overflow-wrap: anywhere; }
.collaborator-invitation-row>div:first-child span,.collaborator-status { color: var(--muted); font-size: .78rem; }
.operations-case-list { display: grid; gap: 1rem; }
.operations-case { padding: 1rem; border: 1px solid var(--bs-border-color); border-radius: .5rem; }
.operations-case header,.operations-case header>div { display: flex; align-items: center; gap: .65rem; }
.operations-case header { justify-content: space-between; }
.operations-case header>div { min-width: 0; flex-direction: column; align-items: flex-start; gap: .1rem; }
.operations-case dl { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: .35rem 1rem; margin-block: 1rem; }
.operations-case dd { margin: 0; overflow-wrap: anywhere; }
.operations-case-form { display: grid; grid-template-columns: minmax(220px,1fr) auto; gap: .75rem; align-items: end; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--bs-border-color); }
.operations-case-form label { display: grid; gap: .35rem; }
.operations-nav-link { border: 1px solid #625e57; background: #fffdf8; color: #34312d; }
.operations-nav-link:hover,.operations-nav-link:focus-visible { border-color: #34312d; background: #e2dbd0; color: #171512; }
html[data-color-theme="dark"] .operations-nav-link { border-color: #7a848b; background: #202428; color: #f1ede5; }
html[data-color-theme="dark"] .operations-nav-link:hover,
html[data-color-theme="dark"] .operations-nav-link:focus-visible { border-color: #aeb8bf; background: #343a3f; color: #fff; }
html[data-color-theme="dark"] .knowledge-tabs button[aria-selected="true"] { border-color: #9bc9dc; color: #b9def0; }
.shortcut-dialog { width: min(660px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; overflow: hidden; }
.shortcut-dialog > form { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); min-height: 0; }
.shortcut-dialog .dialog-heading { flex: 0 0 auto; margin: 0; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.shortcut-dialog .dialog-heading h2 { margin: 0; }
.shortcut-dialog-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 1rem 1.25rem; }
.shortcut-dialog-footer { flex: 0 0 auto; padding: .75rem 1.25rem; border-top: 1px solid var(--line); }
.shortcut-dialog-footer .dialog-actions { margin: 0; flex-wrap: wrap; }
.shortcut-dialog-footer .dialog-error:empty { display: none; }
.shortcut-grid { margin-top: 1rem; display: grid; grid-template-columns: minmax(160px, .8fr) minmax(220px, 1fr); align-items: center; gap: .65rem 1rem; }
.shortcut-grid label { margin: 0; font-weight: 600; }
@media (max-width: 520px) {
  .shortcut-dialog .shortcut-grid { grid-template-columns: minmax(0, 1fr); gap: .35rem; }
  .shortcut-dialog .shortcut-grid input { margin-bottom: .65rem; min-width: 0; }
  .shortcut-dialog .dialog-heading,.shortcut-dialog-body,.shortcut-dialog-footer { padding-inline: .85rem; }
}

.navigation-menu,.context-menu { position: fixed; z-index: 2200; min-width: 210px; max-width: 310px; padding: .35rem; border: 1px solid #aaa095; border-radius: 7px; background: #fffdf8; box-shadow: 0 12px 30px #443a2f45; }
.af-scroll-menu { max-height: min(calc(100dvh - 16px), var(--af-menu-available-height, 100dvh)); overflow: hidden; }
.af-scroll-menu:not(.dropdown-menu):not([hidden]),.af-scroll-menu.dropdown-menu.show { display: flex; flex-direction: column; }
.af-menu-scroll-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.af-menu-scroll-content::-webkit-scrollbar { display: none; }
.af-scroll-menu .af-menu-scroll-control { display: block; flex: 0 0 auto; width: 100%; min-height: 28px; padding: .15rem; border: 0; text-align: center; font-size: .75rem; color: #31566a; background: #eaf1f4; }
.af-scroll-menu .af-menu-scroll-control:hover:not(:disabled),.af-scroll-menu .af-menu-scroll-control:focus-visible { background: #d6e7ee; color: #183848; }
.af-scroll-menu .af-menu-scroll-control:disabled { opacity: .45; cursor: default; }
.af-scroll-menu .af-menu-scroll-control[hidden] { display: none; }
html[data-color-theme="dark"] .af-scroll-menu .af-menu-scroll-control { color: #ece8e0; background: #2b353c; }
html[data-color-theme="dark"] .af-scroll-menu .af-menu-scroll-control:hover:not(:disabled),
html[data-color-theme="dark"] .af-scroll-menu .af-menu-scroll-control:focus-visible { background: #355365; color: #fff; }
@media (any-pointer: coarse) {
  .af-menu-scroll-content { touch-action: pan-y; }
  .af-menu-scroll-content > [role="menuitem"],.af-menu-scroll-content > .dropdown-item { box-sizing: border-box; height: 40px; min-height: 40px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; scroll-snap-align: start; scroll-snap-stop: always; }
  .af-menu-scroll-content > .af-menu-action-row { box-sizing: border-box; height: 40px; min-height: 40px; scroll-snap-align: start; scroll-snap-stop: always; }
  .af-menu-scroll-content > .af-menu-action-row > .dropdown-item { height: 40px; min-height: 40px; }
}
@media (hover: none) and (pointer: coarse) {
  .af-menu-scroll-content { scroll-snap-type: y mandatory; }
  .af-scroll-menu .af-menu-scroll-control { display: none; }
}
.context-menu { max-height:min(36rem,calc(100dvh - 16px)); }
.context-menu-positioning { visibility: hidden; }
.context-menu-section-heading { padding: .45rem .7rem; font-size: .75rem; font-weight: 700; color: #645f58; }
@media (any-pointer: coarse) {
  .af-menu-scroll-content > .context-menu-section-heading { box-sizing: border-box; height: 40px; scroll-snap-align: start; }
}
.navigation-menu button,.context-menu button { display: block; width: 100%; min-height: 40px; padding: .48rem .7rem; border: 0; border-radius: 4px; background: transparent; color: var(--ink); text-align: left; }
.navigation-menu button:hover,.navigation-menu button:focus,.context-menu button:hover,.context-menu button:focus { background: #dfeaf0; color: #183848; }
.context-menu button[aria-disabled="true"] { color: #6d665d; background: transparent; }
.context-menu-separator { height: 1px; margin: .3rem .35rem; background: var(--line); }
.revision-diff { background: #f0ebe2; }
.revision-comparison { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .35rem .5rem; align-items: center; margin-bottom: .75rem; padding: .65rem; border: 1px solid var(--line); border-radius: 6px; }
.revision-comparison legend { float: none; width: auto; margin: 0 0 .25rem; font-size: .75rem; font-weight: 700; }
.revision-comparison label { margin: 0; color: var(--muted); font-size: .7rem; }
.revision-comparison button { grid-column: 2; justify-self: start; }
.search-collection-picker { margin: .75rem 0; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 6px; }
.search-collection-picker legend { float: none; width: auto; margin: 0; color: var(--muted); font-size: .75rem; font-weight: 700; }
.search-collection-picker > div { display: flex; flex-wrap: wrap; gap: .35rem .9rem; }
.search-collection-picker label { display: inline-flex; align-items: center; gap: .35rem; min-height: 32px; }
.search-collection-picker label span { color: var(--muted); font-size: .7rem; }
.writing-session-history { margin: 1rem 0; padding-block: .75rem; border-block: 1px solid var(--line); }
.writing-session-history ol { max-height: 13rem; margin: .5rem 0 0; padding: 0; overflow: auto; list-style: none; }
.writing-session-history li { display: flex; justify-content: space-between; gap: .75rem; padding: .5rem .15rem; border-bottom: 1px solid var(--line); font-size: .75rem; }
.writing-session-history li > div { min-width: 8rem; }
.writing-session-history li span { color: var(--muted); }
.daily-writing-history { margin: 1rem 0; padding-block: .75rem; border-block: 1px solid var(--line); }
.daily-writing-history table { width: 100%; margin-top: .5rem; border-collapse: collapse; font-size: .78rem; }
.daily-writing-history caption { color: var(--muted); text-align: left; }
.daily-writing-history th,.daily-writing-history td { padding: .4rem .25rem; border-bottom: 1px solid var(--line); }
.daily-writing-history td { text-align: right; font-variant-numeric: tabular-nums; }
.daily-writing-history td.positive { color: #276442; }
.daily-writing-history td.negative { color: #9b3434; }
.writing-correction { margin-top: .65rem; }
.writing-correction summary { min-height: 36px; cursor: pointer; font-weight: 700; }
.document-switcher { width: min(620px, calc(100vw - 2rem)); }
.document-switcher-results { max-height: min(60vh, 520px); margin-top: .75rem; overflow: auto; }
.document-switcher-results button { width: 100%; min-height: 48px; display: flex; flex-direction: column; padding: .55rem .7rem; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.document-switcher-results button:hover,.document-switcher-results button:focus { background: color-mix(in srgb, var(--accent) 13%, transparent); }
.document-switcher-results span { overflow: hidden; color: var(--muted); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.pane-resizer { position: fixed; z-index: 24; top: 86px; bottom: 0; width: 9px; padding: 0; border: 0; background: transparent; cursor: col-resize; touch-action: none; }
.pane-resizer::after { content: ""; position: absolute; inset: 0 2px; background: transparent; }
.pane-resizer:hover::after,.pane-resizer:focus-visible::after { background: var(--focus); }
.navigation-pane-resizer { left: calc(56px + var(--navigation-width) - 4px); }
.inspector-pane-resizer { right: calc(var(--inspector-width) - 4px); }
.app-shell.navigation-hidden .navigation-pane-resizer,.app-shell.inspector-hidden .inspector-pane-resizer,.app-shell.focus-mode .pane-resizer { display: none; }
.search-results-panel { left: calc(56px + var(--navigation-width)); right: var(--inspector-width); }
.app-shell.navigation-hidden .search-results-panel { left: 56px; }
.app-shell.inspector-hidden .search-results-panel { right: 0; }

.app-shell.focus-mode { grid-template-columns: 0 var(--navigation-width) minmax(520px, 1fr) var(--inspector-width); }
.app-shell.focus-mode.focus-navigation-hidden { grid-template-columns: 0 0 minmax(520px, 1fr) var(--inspector-width); }
.app-shell.focus-mode.inspector-hidden { grid-template-columns: 0 var(--navigation-width) minmax(520px, 1fr) 0; }
.app-shell.focus-mode.focus-navigation-hidden.inspector-hidden { grid-template-columns: 0 0 minmax(520px, 1fr) 0; }
.app-shell.focus-mode:not(.focus-navigation-hidden) .navigation-pane { visibility: visible; }
.app-shell.focus-mode:not(.inspector-hidden) .inspector-pane { visibility: visible; }
.focus-mode .topbar > *:not(.navbar-brand):not([data-save-state]) { display: none; }

@media (max-width: 1440px) {
  .app-shell { grid-template-columns: 56px minmax(230px, 280px) minmax(0, 1fr); grid-template-areas: "top top top" "menu menu menu" "rail navigation main"; }
  .app-shell.navigation-hidden { grid-template-columns: 56px 0 minmax(0, 1fr); }
  .inspector-pane { position: fixed; }
  .project-identity { max-width: 230px; }
  .command-palette-button kbd { display: none; }
  .pane-resizer { display: none; }
  .search-results-panel { left: 336px; right: 0; }
  .app-shell { --editor-responsive-measure:calc(100vw - 500px); }
}

/* Match the workspace's pane breakpoint rather than Bootstrap lg (992px). */
@media (min-width: 992px) and (max-width: 1440px) {
  .app-shell .inspector-pane.offcanvas-lg {
    position:fixed; top:0; bottom:0; left:auto; right:0; z-index:1045;
    display:flex; flex-direction:column; width:var(--inspector-width); max-width:100vw;
    transform:translateX(100%); visibility:hidden;
  }
  .app-shell .inspector-pane.offcanvas-lg:is(.show,.showing) { transform:none; visibility:visible; }
  .app-shell .inspector-pane.offcanvas-lg:not(.show):not(.showing):not(.hiding) { visibility:hidden; }
  .app-shell .inspector-pane.offcanvas-lg .offcanvas-header { display:flex; }
}

@media (max-width: 1850px) {
  .topbar { gap: .38rem; }
  .project-identity { min-width: 120px; max-width: 230px; }
  .workspace-identity { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .search-box { min-width: 130px; }
  .topbar [data-open-goal-dialog] > span,
  .topbar .recovery-button > span:not(.recovery-count),
  .topbar [data-open-layout-dialog] > span,
  .topbar .browser-fullscreen > span,
  .topbar .inspector-toggle > span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

@media (max-width: 720px) {
  .app-shell,.app-shell.navigation-hidden,.app-shell.inspector-hidden,.app-shell.navigation-hidden.inspector-hidden {
    --editor-responsive-measure:100%;
    grid-template-columns: 50px minmax(0,1fr);
    grid-template-areas: "top top" "menu menu" "rail main";
  }
  .topbar { min-width:0;overflow-x:auto;overflow-y:hidden; }
  .topbar>* { flex:0 0 auto; }
  .application-menu-bar { overflow-x:auto;overflow-y:visible; }
  /* Anchor compact menus to the full bar so edge triggers cannot place their
     actions outside the viewport. Keep Navigation below this existing layer. */
  .application-menu-bar .bs-top-level-menu { position:static; }
  .application-menu-bar .bs-top-level-menu > .dropdown-menu,
  .application-menu-bar .bs-top-level-menu > .dropdown-menu.dropdown-menu-end {
    inset-inline:.5rem; width:auto; min-width:0; max-width:calc(100vw - 1rem);
  }
  .workspace-view-tabs>button { flex:0 0 auto; }
  .navigation-pane { position:fixed;z-index:25;top:86px;bottom:0;left:50px;width:min(82vw,320px);box-shadow:12px 0 30px #0008; }
  .app-shell.navigation-hidden .navigation-pane { display:none; }
  .app-shell.focus-mode:not(.focus-navigation-hidden) { grid-template-columns: 0 minmax(0,1fr); grid-template-areas: "top top" "menu menu" "navigation main"; }
  .app-shell.focus-mode.focus-navigation-hidden { grid-template-columns: 0 minmax(0,1fr); grid-template-areas: "top top" "menu menu" "rail main"; }
  .editor-controls-dock { overflow-x:auto;overflow-y:hidden; }
  .editor-controls-dock .formatbar { width:max-content;min-width:100%;flex-wrap:nowrap; }
  .editor-paper { width:100%;min-width:0;max-width:100%; }
  .editor-statusbar { justify-content:flex-start;overflow-x:auto;overflow-y:hidden; }
  .editor-statusbar>* { flex:0 0 auto; }
  .collaborator-invitation-form { grid-template-columns: 1fr; }
  .collaborator-invitation-row { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 900px), (min-resolution: 2dppx) and (max-width: 1250px) {
  .project-identity span,.inspector-toggle span { display: none; }
  .search-box { min-width: 150px; }
  .editor-paper { padding-inline: 2.5rem; }
}

.editor-view {
  --editor-gutter: clamp(1rem, 4vw, 4rem);
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 0 var(--editor-gutter);
  display: grid;
  grid-template-columns: minmax(0,1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  align-content: stretch;
  overflow: clip;
  min-width: 0;
}
.writing-surface,.planning-view { min-width:0; }
.editor-view > .editor-controls-dock { grid-row: 1; }
.editor-view > .document-header { grid-row: 2; }
.editor-view > .document-findbar { grid-row: 3; }
.editor-view > .editor-page-scroll { grid-row: 4; }
.editor-view > .editor-statusbar { grid-row: 5; }
.editor-view { grid-template-rows:auto auto minmax(0,1fr) auto; }
.editor-view > .document-findbar { grid-row:2; }
.editor-view > .editor-page-scroll { grid-row:3; }
.editor-view > .editor-statusbar { grid-row:4; }
.editor-controls-dock {
  position: relative;
  z-index: 11;
  width: calc(100% + (var(--editor-gutter) * 2));
  margin: 0 calc(var(--editor-gutter) * -1) .65rem;
  padding: .5rem var(--editor-gutter);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--chrome) 96%, transparent);
  box-shadow: 0 5px 12px #4b403319;
}
.editor-controls-dock .formatbar,.editor-controls-dock .table-context-tools { width: 100%; max-width: none; }
.editor-controls-dock .formatbar { border-radius: 6px; }
.editor-controls-dock .table-context-tools { border-top: 0; }
.af-editor-toolbar {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  align-items:start;
  gap:2px;
}
.editor-toolbar-band {
  min-width:0;
  width:100%;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:2px;
}
.editor-toolbar-contextual {
  padding-top:2px;
  border-top:1px solid var(--line);
}
.editor-toolbar-group {
  flex:0 0 auto;
  min-width:max-content;
  min-height:40px;
  display:inline-flex;
  flex-wrap:nowrap;
  align-items:center;
  gap:2px;
  padding-inline:2px;
  border-inline-end:1px solid var(--line);
}
.editor-toolbar-band > .editor-toolbar-group:last-child { border-inline-end:0; }
.formatbar .editor-toolbar-group > button,
.formatbar .editor-toolbar-group > .dropdown > button {
  min-height:40px;
  padding:.4rem .55rem;
  border:0;
  background:transparent;
  color:var(--ink);
}
.formatbar .editor-toolbar-group > select { min-height:40px; }
.formatbar .editor-toolbar-group > button:hover,
.formatbar .editor-toolbar-group > .dropdown > button:hover { background:#e7e0d6; }
.toolbar-emphasis-group {
  min-height:40px;
  display:inline-flex;
  align-items:stretch;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:5px;
}
.formatbar .toolbar-emphasis-group > button {
  min-width:40px;
  min-height:38px;
  padding:.35rem .45rem;
  border:0;
  border-inline-end:1px solid var(--line);
  background:transparent;
  color:var(--ink);
}
.formatbar .toolbar-emphasis-group > button:last-child { border-inline-end:0; }
.formatbar .toolbar-emphasis-group > button:hover { background:#e7e0d6; }
.toolbar-styles-group .author-style-picker { width:clamp(9rem,14vw,11rem); flex-basis:11rem; }
.editor-toolbar-contextual .script-format-picker,
.editor-toolbar-contextual .script-element-picker { width:7.75rem; }
.editor-toolbar-contextual .revision-level-picker { width:8.5rem; }
.paragraph-ruler {
  --ruler-left-position: 0%;
  --ruler-first-position: 0%;
  --ruler-right-position: 100%;
  width: 100%;
  max-width: var(--editor-measure, 840px);
  margin: .4rem auto 0;
  padding: .35rem .45rem .3rem;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink);
  scrollbar-gutter: stable;
}
.paragraph-ruler[hidden] { display: none; }
.paragraph-ruler-scale {
  position: relative;
  width: max(100%, 760px);
  height: 18px;
  margin-bottom: .3rem;
  border: 1px solid color-mix(in srgb, var(--muted) 65%, transparent);
  border-radius: 3px;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(8.333% - 1px), color-mix(in srgb, var(--muted) 45%, transparent) calc(8.333% - 1px) 8.333%),
    color-mix(in srgb, var(--chrome) 86%, var(--paper));
}
.paragraph-ruler-scale span { position: absolute; z-index: 1; width: 0; height: 0; transform: translateX(-50%); }
.paragraph-ruler-scale [data-ruler-left-marker] { left: var(--ruler-left-position); top: -1px; border: 6px solid transparent; border-top-color: var(--accent); }
.paragraph-ruler-scale [data-ruler-first-marker] { left: var(--ruler-first-position); bottom: -1px; border: 6px solid transparent; border-bottom-color: #28799c; }
.paragraph-ruler-scale [data-ruler-right-marker] { left: var(--ruler-right-position); top: -1px; border: 6px solid transparent; border-top-color: #8a4b75; }
.paragraph-ruler-controls { width: max(100%, 760px); display: flex; align-items: end; gap: .35rem; }
.paragraph-ruler-controls > label:not(.paragraph-ruler-check) { display: grid; gap: .15rem; min-width: 82px; color: var(--muted); font-size: .65rem; white-space: nowrap; }
.paragraph-ruler-controls input[type="number"] { width: 82px; min-height: 30px; }
.paragraph-ruler-controls [data-ruler-tab-stops] { width: 166px; min-height: 30px; }
.paragraph-ruler-tabs { min-width: 166px !important; }
.paragraph-ruler-tabs small { max-width: 166px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: .62rem; }
.paragraph-ruler-controls select { width: 94px; min-height: 30px; }
.paragraph-ruler-check { display: flex; align-items: center; gap: .3rem; min-height: 30px; white-space: nowrap; font-size: .75rem; }
.paragraph-ruler-controls .btn { min-height: 30px; white-space: nowrap; }
.paragraph-ruler output { display: block; min-height: 1rem; margin-top: .2rem; color: var(--muted); font-size: .65rem; }
.editor-page-scroll { width:100%; min-width:0; min-height:0; display:grid; justify-items:center; overflow:hidden; }
.editor-paper { box-sizing: border-box; width: min(var(--editor-measure, 840px), var(--editor-responsive-measure, calc(100vw - 816px))); min-width: min(var(--editor-measure, 840px), var(--editor-responsive-measure, calc(100vw - 816px))); height: 100%; max-width: min(var(--editor-measure, 840px), var(--editor-responsive-measure, calc(100vw - 816px))); min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; font-family: var(--editor-font-family, Georgia, "Times New Roman", serif); font-size: calc(var(--editor-base-size, 18px) * var(--editor-zoom, 1)); line-height: var(--editor-line-height, 1.7); }
.app-shell:not(.page-view-enabled) .editor-page-scroll { overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
.app-shell:not(.page-view-enabled) .editor-paper { overscroll-behavior-y:auto; }
.page-view-enabled .editor-page-scroll { position:relative; align-items:start; overflow:auto; overscroll-behavior:contain; scrollbar-gutter:stable; isolation:isolate; }
.editor-page-sheets[hidden] { display:none; }
.editor-page-sheets { position:absolute; inset-block-start:0; inset-inline-start:var(--page-sheet-offset, 0px); display:flex; gap:var(--page-visual-gap, 34px); pointer-events:none; z-index:-1; }
.editor-page-sheet { box-sizing:border-box; flex:none; width:var(--page-view-width, 816px); height:var(--page-view-height, 1056px); background:var(--paper); border:1px solid var(--line); }
.app-shell.high-paper-contrast .editor-page-sheet { background:#fff; border-color:#5b554c; }
.app-shell[data-color-theme="dark"].high-paper-contrast .editor-page-sheet { background:#111518; border-color:#d9e1e5; }
.page-view-enabled .editor-page-scroll > .editor-paper {
  box-sizing: border-box;
  width: var(--page-view-width, 816px);
  min-width: var(--page-view-width, 816px);
  max-width: none;
  height: var(--page-view-height, 1056px);
  min-height: var(--page-view-height, 1056px);
  padding: var(--page-margin-top, 96px) var(--page-margin-right, 96px) var(--page-margin-bottom, 96px) var(--page-margin-left, 96px);
  column-width: var(--page-content-width, 624px);
  column-gap: var(--page-column-gap, 216px);
  column-fill: auto;
  overflow: visible;
  scrollbar-gutter: auto;
  overscroll-behavior-inline: contain;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0 var(--page-view-width, 816px),
    var(--chrome) var(--page-view-width, 816px) calc(var(--page-view-width, 816px) + var(--page-visual-gap, 34px))
  );
  background-attachment: local;
}
.app-shell.page-view-enabled .editor-page-scroll > .editor-paper { background:transparent; border-color:transparent; box-shadow:none; }
.page-view-enabled .editor-page-scroll > .editor-paper > :first-child { break-before: avoid; }
.page-view-enabled .editor-page-scroll > .editor-paper [data-af-keep-with-next="true"] { break-after: avoid-column; }
.page-view-enabled .editor-page-scroll > .editor-paper img,
.page-view-enabled .editor-page-scroll > .editor-paper figure,
.page-view-enabled .editor-page-scroll > .editor-paper table { max-width: 100%; break-inside: avoid; }
.page-view-enabled .editor-view > .document-header,
.page-view-enabled .editor-view > .editor-controls-dock,
.page-view-enabled .editor-view > .editor-statusbar { justify-self: stretch; }
.document-header { max-width: var(--editor-measure, 840px); }
.editor-view > .document-header { width: 100%; margin-bottom: .65rem; }
.document-findbar { width: min(1180px, 100%); margin: 0 auto .65rem; padding: .45rem .55rem; display: grid; grid-template-columns: auto minmax(150px, 1.2fr) auto auto auto minmax(130px, .8fr) auto auto auto; align-items: center; gap: .4rem; border: 1px solid var(--line); border-radius: 6px; background: #f8f4ec; color: var(--ink); box-shadow: 0 4px 12px #4b403319; }
.document-findbar[hidden] { display: none; }
.document-findbar > label,.document-find-options,.document-findbar output { color: var(--muted); font-size: .75rem; white-space: nowrap; }
.document-find-options { display: flex; align-items: center; gap: .45rem; }
.document-find-options label { display: flex; align-items: center; gap: .2rem; }
.document-find-navigation { display: flex; gap: .15rem; }
.document-findbar button { min-width: 36px; min-height: 36px; padding: .25rem .5rem; border: 1px solid #bdb4a8; border-radius: 4px; background: #fffdf8; color: var(--ink); }
.document-findbar input { min-height: 36px; }
.app-shell[data-paper-theme="sepia"] .editor-paper { border-color: #c7b99f; background: #f2e3c5; color: #30291f; }
.app-shell[data-paper-theme="white"] .editor-paper { border-color: #c9c9c9; background: #fff; color: #1e1e1e; }
.app-shell[data-paper-theme="dark"] .editor-paper { border-color: #50565b; background: #22272b; color: #edf0f2; caret-color: #fff; }
.app-shell[data-paper-theme="dark"] .editor-paper a { color: #8dd3f5; }
.editor-statusbar {
  position: relative;
  z-index: 10;
  width: calc(100% + (var(--editor-gutter) * 2));
  min-height: 42px;
  margin: .65rem calc(var(--editor-gutter) * -1) 0;
  padding: .25rem var(--editor-gutter);
  display: flex;
  align-items: center;
  gap: .65rem;
  justify-content: flex-end;
  overflow-x: auto;
  overflow-y: hidden;
  border-top: 1px solid var(--line);
  background: #f8f4ecf2;
  box-shadow: 0 -4px 12px #4b403319;
}

.editor-paper figure.af-asset-reference {
  margin: 1.5rem auto;
  max-width: 100%;
  padding: .6rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: color-mix(in srgb, var(--paper) 92%, var(--surface));
  text-align: center;
}

.editor-paper figure.af-asset-reference img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.editor-paper figure.af-asset-reference figcaption {
  margin-top: .45rem;
  color: var(--muted);
  font-size: .82em;
}
.editor-paper figure.af-asset-reference[data-af-display-width="25"] { width: 25%; }
.editor-paper figure.af-asset-reference[data-af-display-width="50"] { width: 50%; }
.editor-paper figure.af-asset-reference[data-af-display-width="75"] { width: 75%; }
.editor-paper figure.af-asset-reference[data-af-display-width="100"] { width: 100%; }
.editor-paper figure.af-asset-reference[data-af-alignment="left"] { margin-left: 0; margin-right: auto; }
.editor-paper figure.af-asset-reference[data-af-alignment="center"] { margin-left: auto; margin-right: auto; }
.editor-paper figure.af-asset-reference[data-af-alignment="right"] { margin-left: auto; margin-right: 0; }
.editor-paper figure.af-asset-reference[data-af-display-width] img { width: 100%; }
.editor-paper figure.af-asset-reference:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.zoom-controls { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .75rem; }
.zoom-controls,.appearance-button,.composition-settings,.drafting-view-aids { flex:0 0 auto; }
.zoom-controls button { width: 34px; height: 34px; border: 1px solid #bdb4a8; border-radius: 5px; background: #fffdf8; color: var(--ink); font-size: 1.1rem; }
.zoom-controls input { width: 130px; accent-color: var(--accent); }
.zoom-controls output { min-width: 3.25rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.appearance-button { min-height: 34px; padding: .25rem .55rem; border: 1px solid #bdb4a8; border-radius: 5px; background: #fffdf8; color: var(--ink); }
.editor-appearance-dialog { width: min(680px, calc(100vw - 2rem)); }
.appearance-tabs { display:flex; gap:.2rem; margin-top:.8rem; border-bottom:1px solid var(--line); }
.appearance-tabs [role="tab"] { min-height:42px; padding:.55rem .9rem; border:0; border-bottom:3px solid transparent; background:transparent; color:var(--muted); font-weight:700; }
.appearance-tabs [role="tab"][aria-selected="true"] { border-bottom-color:var(--accent); color:var(--ink); }
.appearance-tabs [role="tab"]:focus-visible { outline:3px solid color-mix(in srgb,var(--accent) 42%,transparent); outline-offset:-3px; }
.appearance-tab-panels { box-sizing:border-box; height:min(34rem, calc(100vh - 15rem)); min-height:min(34rem, calc(100vh - 15rem)); overflow:auto; padding:.25rem .2rem .5rem; scrollbar-gutter:stable; }
.appearance-tab-panels [role="tabpanel"][hidden] { display:none; }
.appearance-tab-panels > [role="tabpanel"] { width:100%; min-width:0; }
.appearance-grid { display: grid; grid-template-columns: minmax(120px, .55fr) minmax(260px, 1fr); align-items: center; gap: .8rem 1rem; margin-top: 1rem; }
.appearance-grid > label { font-weight: 650; }
.appearance-presets { margin:.35rem 0 1rem; padding:.8rem; border:1px solid var(--line); border-radius:6px; }
.appearance-presets legend { float:none; width:auto; padding:0 .25rem; color:var(--muted); font-size:.78rem; font-weight:700; }
.appearance-preset-grid { display:grid; grid-template-columns:minmax(8rem,.7fr) minmax(12rem,1.3fr) auto auto; gap:.45rem; align-items:center; }
.appearance-preset-grid label { font-size:.75rem; font-weight:650; }
.appearance-preset-grid [data-appearance-preset-name] { grid-column:2; }
.appearance-preset-grid [data-save-appearance-preset] { grid-column:3 / span 2; }
.appearance-presets output { display:block; min-height:1.1rem; margin-top:.35rem; color:var(--muted); font-size:.75rem; }
.appearance-range { min-height: 40px; display: grid; grid-template-columns: 1fr 4.25rem; align-items: center; gap: .75rem; }
.appearance-range input { width: 100%; accent-color: var(--accent); }
.appearance-range output { text-align: right; font-variant-numeric: tabular-nums; }
.dialogue-appearance-group { margin:1rem 0 0; padding:.85rem; border:1px solid var(--line); border-radius:6px; }
.dialogue-appearance-group legend { float:none; width:auto; margin:0; padding:0 .3rem; font-size:.82rem; font-weight:750; }
.dialogue-format-options,.dialogue-target-options,.dialogue-behavior-options { display:grid; gap:.65rem; }
.dialogue-format-options { grid-template-columns:repeat(2,minmax(0,1fr)); }
.dialogue-target-options { grid-template-columns:repeat(2,minmax(0,1fr)); }
.dialogue-format-options small { display:block; color:var(--muted); font-size:.7rem; }
.dialogue-appearance-grid { display:grid; grid-template-columns:minmax(9rem,.55fr) minmax(15rem,1fr); align-items:center; gap:1rem; margin:1rem .85rem; }
.dialogue-appearance-grid > label { font-weight:650; }
.dialogue-behavior-options { margin:.85rem; }
.dialogue-behavior-options small { display:block; color:var(--muted); font-size:.7rem; }
.dialogue-focus-preview { margin:1rem .85rem 0; padding:.8rem 1rem; border:1px solid var(--line); border-radius:6px; background:var(--paper); color:var(--paper-ink); }
.dialogue-focus-preview figcaption { margin-bottom:.35rem; color:color-mix(in srgb,var(--paper-ink) 72%,var(--paper)); font-size:.7rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.dialogue-focus-preview p { margin:0; font-family:var(--editor-font-family,Georgia,"Times New Roman",serif); font-size:calc(var(--editor-base-size,18px) * .88); line-height:var(--editor-line-height,1.7); }
.dialogue-focus-preview .dialogue-preview-narrative { color:var(--dialogue-receded-color); }
.dialogue-focus-preview :is(.dialogue-preview-quote,.dialogue-preview-tag) { color:var(--paper-ink); }
.app-shell[data-dialogue-focus-target="narrative"] .dialogue-focus-preview .dialogue-preview-narrative { color:var(--paper-ink); }
.app-shell[data-dialogue-focus-target="narrative"] .dialogue-focus-preview :is(.dialogue-preview-quote,.dialogue-preview-tag) { color:var(--dialogue-receded-color); }
.app-shell[data-dialogue-focus-include-tags="false"] .dialogue-preview-tag { display:none; }
.app-shell[data-dialogue-focus-underline="true"] .dialogue-focus-preview :is(.dialogue-preview-quote,.dialogue-preview-tag) { text-decoration:underline solid currentColor .08em; text-underline-offset:.16em; }
.app-shell[data-dialogue-focus-bold="true"] .dialogue-focus-preview :is(.dialogue-preview-quote,.dialogue-preview-tag) { font-weight:700; }
@media(max-width:600px){.appearance-tab-panels{height:calc(100vh - 14rem);min-height:18rem}.appearance-grid,.dialogue-appearance-grid{grid-template-columns:1fr}.dialogue-format-options,.dialogue-target-options{grid-template-columns:1fr}.appearance-preset-grid{grid-template-columns:1fr}.appearance-preset-grid [data-appearance-preset-name],.appearance-preset-grid [data-save-appearance-preset]{grid-column:auto}}
.document-template-manager,.document-template-default-dialog,.project-template-manager { width: min(760px, calc(100vw - 2rem)); }
.image-library-dialog { width: min(880px, calc(100vw - 2rem)); }
.table-of-contents-dialog { width: min(760px, calc(100vw - 2rem)); }
.navigation-export-dialog { width: min(620px, calc(100vw - 2rem)); }
.navigation-export-result { min-height: 2.5rem; margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--line); }
.navigation-export-result p { margin: 0 0 .65rem; overflow-wrap: anywhere; }
.toc-options { display: grid; grid-template-columns: minmax(0, 1fr) minmax(10rem, .35fr); gap: .75rem; }
.toc-options label { margin: 0; }
.toc-options label > input,.toc-options label > select { margin-top: .3rem; }
.toc-node-picker { margin: 1rem 0 0; padding: .75rem; border: 1px solid var(--line); border-radius: .4rem; }
.toc-node-picker legend { float: none; width: auto; margin: 0; padding: 0 .3rem; font-size: .85rem; font-weight: 700; }
.toc-node-list { max-height: min(44vh, 28rem); overflow: auto; display: grid; gap: .15rem; padding: .15rem; }
.toc-node-choice { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .55rem; align-items: start; min-height: 40px; margin: 0; padding: .45rem .55rem; border-radius: .3rem; }
.toc-node-choice:hover,.toc-node-choice:focus-within { background: var(--selected); }
.toc-node-choice input { margin-top: .22rem; }
.toc-node-choice span { padding-inline-start: calc(var(--toc-depth, 0) * .8rem); overflow-wrap: anywhere; }
.toc-node-choice small { display: block; color: var(--muted); }
@media (max-width: 540px) { .toc-options { grid-template-columns: 1fr; } .toc-node-list { max-height: 42vh; } }
.image-library-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(210px,1fr)); gap: .75rem; max-height: min(60vh,620px); overflow: auto; }
.image-library-card { min-width: 0; padding: .65rem; display: grid; grid-template-rows: 150px auto auto; gap: .45rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--surface); color: var(--ink); }
.image-library-card img { width: 100%; height: 150px; object-fit: contain; background: color-mix(in srgb,var(--surface) 80%,#000); }
.image-library-card strong,.image-library-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-library-card span { color: var(--muted); font-size: .78rem; }
.image-library-card button { min-height: 40px; }
.image-properties-dialog { width: min(760px,calc(100vw - 2rem)); }
.image-properties-layout { display: grid; grid-template-columns: minmax(180px,.7fr) minmax(280px,1fr); gap: 1rem; align-items: start; }
.image-properties-layout > img { width: 100%; max-height: 360px; object-fit: contain; border: 1px solid var(--line); border-radius: .35rem; background: color-mix(in srgb,var(--surface) 80%,#000); }
.image-properties-options { margin-top: .75rem; display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.image-properties-options label { font-weight: 650; }
.image-properties-options select { margin-top: .25rem; font-weight: 400; }
@media(max-width:700px){.image-properties-layout,.image-properties-options{grid-template-columns:1fr}}
.document-template-list { max-height: 250px; margin: .5rem 0 0; padding: 0; overflow: auto; list-style: none; }
.document-template-list li { min-height: 48px; padding: .55rem .15rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; border-bottom: 1px solid var(--line); }
.document-template-list li > div { min-width: 0; display: flex; flex-direction: column; }
.document-template-list li span { color: var(--muted); font-size: .78rem; }
.document-template-list button { min-height: 34px; padding: .25rem .55rem; border: 0; border-radius: 4px; background: #f1e8dc; color: #852c26; }
.document-template-list .template-origin { flex: none; }
.project-template-placeholders { margin-top:.75rem; padding:.75rem; border:1px solid var(--line); border-radius:6px; background:var(--chrome); }
.project-template-placeholders p { margin:0 0 .55rem; }
.project-template-placeholders p:last-child { margin-bottom:0; }
.project-template-placeholders fieldset { display:grid; grid-template-columns:repeat(auto-fit,minmax(12rem,1fr)); gap:.55rem; }
.project-template-placeholders legend { float:none; width:auto; margin:0; font-size:.8rem; font-weight:700; }
.project-template-placeholders label { display:grid; gap:.2rem; font-size:.78rem; font-weight:600; }
.project-template-list { max-height:18rem; margin:.5rem 0 0; padding:0; overflow:auto; list-style:none; }
.project-template-list>li { min-height:58px; padding:.65rem .15rem; display:flex; align-items:center; justify-content:space-between; gap:.75rem; border-bottom:1px solid var(--line); }
.project-template-list>li>div:first-child { min-width:0; display:flex; flex-direction:column; gap:.1rem; }
.project-template-list span { color:var(--muted); font-size:.78rem; }
.project-template-actions { flex:none; display:flex; flex-wrap:wrap; justify-content:flex-end; gap:.35rem; }
@media(max-width:650px){.project-template-list>li{align-items:stretch;flex-direction:column}.project-template-actions{justify-content:flex-start}}
.navigation-node span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navigation-node .navigation-generated-preview { color: #777167; font-weight: 400; font-style: normal; }
.navigation-node.active .navigation-generated-preview { color: #355565; }
.navigation-preview-tooltip { --navigation-tooltip-surface:#fffdf8; position: fixed; z-index: 2300; width: min(390px, calc(100vw - 20px)); padding: .75rem .85rem; border: 1px solid #a99f92; border-radius: 7px; background: var(--navigation-tooltip-surface); color: var(--ink); box-shadow: 0 14px 36px #31291f4d; pointer-events: auto; }
.navigation-preview-tooltip-label { margin-bottom: .35rem; color: var(--muted); font: 700 .68rem/1.2 "Segoe UI", system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.navigation-preview-tooltip-content { position: relative; max-height: 8.4rem; overflow: hidden; font: 1rem/1.55 Georgia, serif; }
.navigation-preview-tooltip-content > :first-child { margin-top: 0; }
.navigation-preview-tooltip-content > :last-child { margin-bottom: 0; }
.navigation-preview-tooltip-content.truncated::after { position: absolute; right: 0; bottom: 0; min-width: 2.4rem; padding-left:1.1rem; content: "…"; background:linear-gradient(to right,transparent 0,var(--navigation-tooltip-surface) 48%); color:inherit; text-align:right; }

.navigation-history-controls { display: flex; gap: .1rem; }
.navigation-history-controls .btn { width: 36px; padding-inline: 0; }
.navigation-history-controls .btn:disabled { opacity: .38; }
.library-dialog { width: min(1180px, calc(100vw - 2rem)); }
.library-grid[data-library-admin] { grid-template-columns: repeat(3, minmax(240px, 1fr)); align-items: start; }
.library-admin-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; align-items: center; }
.library-item-main { width: 100%; padding: .25rem 0; display: flex; flex-direction: column; border: 0; background: transparent; color: inherit; text-align: left; }
.library-item-actions,.metadata-item-actions,.bookmark-actions { display: flex; align-items: center; gap: .15rem; }
.library-item-actions button,.metadata-item-actions button,.bookmark-actions button,[data-close-series-members] { min-width: 32px; min-height: 32px; padding: .2rem .35rem; border: 0; border-radius: 4px; background: transparent; color: var(--muted); }
.library-item-actions button:hover,.metadata-item-actions button:hover,.bookmark-actions button:hover { background: #e6ded2; color: var(--ink); }
.danger-link { color: #8e2d26 !important; }
.series-members-panel { grid-column: 1 / -1; padding: 1rem; border: 1px solid var(--line); border-radius: 7px; background: #f7f1e8; }
.series-members-panel form { max-width: 560px; }
.metadata-manager { width: min(1100px, calc(100vw - 2rem)); }
.metadata-manager-grid { display: grid; grid-template-columns: repeat(2, minmax(280px, 1fr)); gap: 1rem; max-height: 68vh; overflow: auto; }
.metadata-manager-grid > section { padding: 1rem; border: 1px solid var(--line); border-radius: 7px; background: #f8f3ea; }
.metadata-manager-grid h3 { font: 1.15rem Georgia, serif; }
.metadata-manager-grid ol,.bookmark-list { padding: 0; list-style: none; }
.metadata-manager-grid li,.bookmark-list li { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: .5rem; border-bottom: 1px solid var(--line); }
.metadata-manager-grid li > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.metadata-manager-grid li i { display: inline-block; width: .75rem; height: .75rem; margin-right: .4rem; border-radius: 50%; background: var(--metadata-color); }
.section-type-dialog[open] { width: min(45rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
.section-type-dialog-header { padding: 1.25rem 1.35rem .75rem; }
.section-type-close { width: 44px; height: 44px; padding: .75rem; flex: 0 0 44px; border-radius: 6px; }
.section-type-dialog-body { min-height: 0; padding: 0 1.35rem 1.25rem; overflow-y: auto; overscroll-behavior: contain; }
.section-type-dialog-body > p { margin: 0 0 1rem; }
.section-type-dialog-body > section { padding: 1rem; border: 1px solid var(--line); border-radius: 7px; background: #f8f3ea; }
.section-type-dialog-body > section + section { margin-top: 1rem; }
.section-type-dialog-body h3 { margin: 0 0 .65rem; font: 1.15rem Georgia, serif; }
.section-type-help { margin: -.25rem 0 .75rem; color: var(--muted); font-size: .82rem; }
.section-type-add-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; align-items: end; }
.section-rule-fields { display: grid; grid-template-columns: minmax(8rem, 1.05fr) minmax(7rem, .85fr) minmax(8rem, 1.05fr) auto; gap: .65rem; align-items: end; }
.section-type-dialog fieldset { min-width: 0; padding: 0; border: 0; }
.section-type-dialog legend { margin: 0 0 .35rem; font: 1rem Georgia, serif; }
.section-type-dialog .form-label { margin-bottom: .25rem; font-size: .78rem; font-weight: 650; }
.section-type-dialog .form-control,.section-type-dialog .form-select,.section-type-dialog form .btn { min-height: 44px; }
.section-type-table { margin: .75rem 0 0; border: 1px solid var(--line); --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-border-color: var(--line); }
.section-type-table th { color: var(--muted); font-size: .75rem; }
.section-type-table th:last-child,.section-type-table td:last-child { width: 1%; text-align: right; white-space: nowrap; }
.section-type-table td { vertical-align: middle; }
.section-type-delete { min-width: 96px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; color: #8e2d26; }
.section-type-dialog-footer { min-height: 68px; padding: .7rem 1.35rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); background: #fffdf8; }
.section-type-dialog-footer p { min-height: 1.25rem; margin: 0; color: var(--muted); font-size: .8rem; }
.section-type-dialog-footer .btn { min-width: 88px; min-height: 44px; }
.author-style-picker { width: clamp(9rem, 16vw, 13rem); min-height: 40px; flex: 0 1 13rem; }
.author-style-dialog[open] { width: min(96rem, calc(100vw - 2rem)); height: calc(100dvh - 2rem); max-height: calc(100dvh - 2rem); padding: 1.25rem 0 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; overflow: hidden; }
.author-style-dialog > .dialog-heading,.author-style-dialog > p { margin-inline: 1.35rem; }
.author-style-dialog .dialog-heading .btn-close { box-sizing: border-box; width: 44px; height: 44px; padding: .75rem; flex: 0 0 44px; border-radius: 6px; }
.author-style-dialog-body { min-height: 0; padding: .25rem 1.35rem 1.25rem; display: grid; grid-template-columns: minmax(22rem, 32%) minmax(0, 1fr); gap: 1rem; overflow: hidden; overscroll-behavior: contain; }
.author-style-master,.author-style-editor { min-width: 0; min-height: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 7px; background: #f8f3ea; }
.author-style-dialog-body h3 { margin: 0; font: 1.15rem Georgia, serif; }
.author-style-master { display: grid; grid-template-rows: auto auto minmax(7rem, 1fr) auto; gap: .75rem; }
.author-style-master-heading { min-width: 0; display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
.author-style-master-heading p,.author-style-editor-heading p { margin: .2rem 0 0; color: var(--muted); font-size: .78rem; }
.author-style-master-heading .btn { flex: 0 0 auto; }
.author-style-list { min-height: 0; margin: 0; padding: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); list-style: none; }
.author-style-list li + li { border-top: 1px solid var(--line); }
.author-style-option { width: 100%; min-height: 60px; padding: .6rem .75rem; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .75rem; border: 0; border-left: 4px solid transparent; background: transparent; color: var(--ink); text-align: left; }
.author-style-option strong,.author-style-option small { display: block; }
.author-style-option small { margin-top: .1rem; color: var(--muted); }
.author-style-option[aria-selected="true"] { border-left-color: var(--accent); background: #e4f0f6; }
.author-style-option[aria-selected="true"] strong::before { margin-right: .4rem; color: var(--accent); font-family: bootstrap-icons; content: "\f26e"; }
.author-style-editor { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: .75rem; }
.author-style-editor > form { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.author-style-form-scroll { min-height: 0; padding-right: .25rem; overflow-y: auto; }
.author-style-dialog fieldset { min-width: 0; margin: 0; padding: .7rem; border: 1px solid var(--line); border-radius: 6px; }
.author-style-dialog legend { width: auto; margin: 0; padding: 0 .25rem; float: none; font: 1rem Georgia, serif; }
.author-style-identity { display: grid; grid-template-columns: minmax(14rem, 1fr) minmax(10rem, .45fr); gap: .75rem; }
.author-style-fields { display: grid; grid-template-columns: repeat(2, minmax(10rem, 1fr)); gap: .65rem .75rem; align-items: end; }
.author-style-colour-fields { display: grid; grid-template-columns: repeat(2, minmax(15rem, 1fr)); gap: .9rem; }
.author-style-fields .author-style-check { align-self: center; }
.author-style-check { min-height: 44px; display: flex; align-items: center; gap: .5rem; }
.author-style-check .form-check-input { width: 1.2rem; height: 1.2rem; margin: 0; }
.author-style-disclosure { margin-top: .75rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.author-style-disclosure > summary { min-height: 48px; padding: .65rem .8rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; font: 1rem Georgia, serif; }
.author-style-disclosure > summary small { color: var(--muted); font: .75rem system-ui, sans-serif; text-align: right; }
.author-style-disclosure > fieldset { margin: 0 .7rem .7rem; }
.author-style-disclosure[disabled] { display: none; }
.author-style-form-actions { margin-top: .75rem; padding-top: .75rem; display: grid; grid-template-columns: auto 1fr auto auto; gap: .75rem; border-top: 1px solid var(--line); }
.author-style-dialog .form-control,.author-style-dialog .form-select,.author-style-dialog .btn,.direct-format-dialog .form-control,.direct-format-dialog .form-select,.direct-format-dialog .btn { min-height: 44px; }
.author-style-copy { min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.author-style-copy > summary { min-height: 44px; padding: .55rem .7rem; display: flex; align-items: center; font: 1rem Georgia, serif; cursor: pointer; }
.author-style-copy form { display: grid; gap: .65rem; }
.author-style-copy[open] form { max-height: min(40dvh, 24rem); padding: 0 .7rem .7rem; overflow-y: auto; }
.author-style-copy fieldset { padding: .6rem; }
.copy-author-style-options { max-height: 12rem; display: grid; grid-template-columns: repeat(2, minmax(10rem, 1fr)); gap: .25rem .75rem; overflow-y: auto; }
.copy-author-style-options label { min-height: 40px; display: flex; align-items: center; gap: .45rem; }
.author-style-dialog-footer { min-height: 68px; padding: .7rem 1.35rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); background: #fffdf8; }
.author-style-dialog-footer p { min-height: 1.25rem; margin: 0; color: var(--muted); }
.direct-format-dialog { width: min(44rem, calc(100vw - 2rem)); }
.direct-format-grid { display: grid; grid-template-columns: repeat(2, minmax(12rem, 1fr)); gap: .75rem; }
.af-colour-palette { margin-top: .4rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.af-colour-palette label { position: relative; width: 44px; height: 44px; margin: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); cursor: pointer; }
.af-colour-palette input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.af-colour-palette label > span { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid #777; border-radius: 50%; background: var(--af-swatch, transparent); color: var(--ink); font-weight: 700; }
.af-colour-palette label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.af-colour-palette label:has(input:checked)::after { position: absolute; right: 1px; bottom: 0; color: var(--accent); font-family: bootstrap-icons; font-size: .75rem; content: "\f26e"; }
.af-colour-palette label:has(input:focus-visible) { outline: 3px solid #176b9c; outline-offset: 2px; }
.keyword-assignment { display: block; padding: .2rem 0; }
.keyword-assignment::before { display: inline-block; width: .45rem; height: .45rem; margin-right: .2rem; border-radius: 50%; background: var(--keyword-color); content: ""; }
.metadata-empty { color: var(--muted); font-size: .78rem; }
.custom-field-control { display: flex; flex-direction: column; gap: .25rem; margin-top: .65rem; }
.custom-field-control > span,.custom-field-control > legend { color: var(--muted); font-size: .75rem; font-weight: 600; }
.custom-field-control > label { display: block; font-size: .8rem; }
.bookmark-list li > button { min-width: 0; flex: 1; padding: .45rem 0; display: flex; flex-direction: column; border: 0; background: transparent; color: var(--ink); text-align: left; }
.bookmark-list li > button span { max-width: 100%; overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.quick-reference { width: min(900px, calc(100vw - 2rem)); }
.quick-reference-content { min-height: 300px; max-height: 72vh; overflow: auto; padding: 2.5rem clamp(1.25rem, 6vw, 5rem); border: 1px solid var(--line); background: var(--paper); color: var(--paper-ink); font: 1.05rem/1.7 Georgia, serif; }
.editor-statusbar { gap: 1rem; justify-content: space-between; }
.editor-statusbar [data-selection-count] { min-width: 150px; color: var(--muted); font-size: .75rem; }
.drafting-view-aids { display: flex; align-items: center; gap: .75rem; margin-left: auto; color: var(--muted); font-size: .75rem; }
.drafting-view-aids label { display: flex; align-items: center; gap: .25rem; white-space: nowrap; }
.show-invisibles .editor-paper p:not(:empty)::after,.show-invisibles .editor-paper li:not(:empty)::after { margin-left: .18em; color: #7c8e9780; content: "¶"; font-family: system-ui, sans-serif; font-size: .72em; }
.show-invisibles .editor-paper br::after { color: #7c8e9780; content: "↵"; }
.highlight-current-line .editor-paper [data-af-current-block="true"] { position: relative; border-radius: 3px; background: color-mix(in srgb, #8bc5df 18%, transparent); }
.highlight-current-line .editor-paper [data-af-current-block="true"]::before { position: absolute; inset-block: .12em; inset-inline-start: -.7rem; width: 4px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 58%, transparent); content: ""; pointer-events: none; }
@media (forced-colors: active) { .highlight-current-line .editor-paper [data-af-current-block="true"]::before { background: Highlight; } }
.comment-list ol { margin: .55rem 0 0 .65rem; padding-left: .8rem; border-left: 2px solid var(--line); list-style: none; }
.comment-actions,.semantic-note-actions { display: flex; gap: .35rem; margin-top: .35rem; }
.comment-actions button,.semantic-note-actions button { min-height: 30px; padding: .28rem .55rem; border: 1px solid var(--line); border-radius: 4px; background: var(--chrome); color: var(--ink); font-size: .72rem; }

/* One human discussion surface moves between Inspector and manuscript margin. */
@media (min-width:1441px) {
  .app-shell.human-discussion-open { grid-template-columns:56px var(--navigation-width) minmax(0,1fr) 0; }
  .app-shell.human-discussion-open.navigation-hidden { grid-template-columns:56px 0 minmax(0,1fr) 0; }
  .app-shell.human-discussion-open.focus-mode { grid-template-columns:0 var(--navigation-width) minmax(0,1fr) 0; }
  .app-shell.human-discussion-open.focus-mode.focus-navigation-hidden { grid-template-columns:0 0 minmax(0,1fr) 0; }
  .app-shell.human-discussion-open .inspector-pane,
  .app-shell.human-discussion-open.focus-mode .inspector-pane,
  .app-shell.human-discussion-open .inspector-pane-resizer { visibility:hidden; }
}
.human-discussion-margin[hidden], .human-discussion [hidden] { display:none !important; }
.human-discussion-open .editor-page-scroll { grid-template-columns:minmax(0,840px) minmax(260px,310px); gap:1rem; justify-content:center; justify-items:stretch; align-items:start; overflow:auto; }
.human-discussion-open .editor-page-scroll > .editor-paper { grid-column:1; grid-row:1; width:100%; min-width:0; max-width:none; margin:0; }
.human-discussion-margin { grid-column:2; grid-row:1; min-width:0; width:100%; position:relative; z-index:1; padding-bottom:1rem; }
.human-discussion { min-width:0; padding:.85rem; border:1px solid var(--line); border-radius:.4rem; background:var(--panel); color:var(--ink); font: .84rem/1.5 system-ui,sans-serif; overflow-wrap:anywhere; }
.human-discussion-heading, .human-discussion-controls, .human-thread-heading, .human-thread-actions, .human-comment-compose-actions, .human-comment-anchor-actions { display:flex; align-items:center; flex-wrap:wrap; gap:.45rem; }
.human-discussion-heading { justify-content:space-between; }
.human-discussion-heading h2 { margin:0; font-size:1rem; font-weight:650; }
.human-discussion-purpose, .human-discussion-permission, .human-comment-context, .human-comment-draft-hint { margin:.55rem 0; font-size:.78rem; }
.human-discussion-controls label { display:flex; align-items:center; gap:.3rem; }
.human-discussion-controls select { max-width:100%; min-height:32px; padding:.25rem; border:1px solid var(--line); border-radius:.25rem; background:var(--chrome); color:var(--ink); }
.human-discussion [data-comment-form] { margin:.75rem 0; padding:.7rem 0; border-block:1px solid var(--line); }
.human-discussion textarea { width:100%; max-width:100%; min-height:90px; margin:.5rem 0; font:inherit; background:var(--paper); color:var(--paper-ink); }
.human-discussion-state { display:block; margin:.5rem 0; white-space:pre-wrap; }
.human-thread-list > .human-thread { padding:.8rem; margin-top:.75rem; border:1px solid var(--line); border-left:3px solid var(--accent); border-radius:.35rem; font-size:.84rem; }
.human-thread-heading { justify-content:space-between; margin-bottom:.45rem; }
.human-thread-list .human-thread-state { display:inline; padding:.1rem .4rem; border:1px solid var(--line); border-radius:.3rem; color:var(--ink); font-size:.75rem; }
.human-thread-resolved { border-left-style:dotted !important; }
.human-thread-message { padding:.6rem 0; border-top:1px solid var(--line); }
.human-thread-message .review-actor { display:flex; flex-wrap:wrap; justify-content:space-between; gap:.25rem .5rem; }
.human-thread-message .review-time { font-size:.73rem; color:var(--muted); }
.human-comment-body { margin:.4rem 0; white-space:pre-wrap; }
.human-comment-quote, .human-original-context blockquote { margin:.5rem 0; padding:.5rem .65rem; border-left:2px solid var(--accent); background:var(--paper); color:var(--paper-ink); font: .9rem/1.55 Georgia,serif; white-space:pre-wrap; }
.human-anchor-state, .human-reply-context { margin:.4rem 0; font-size:.75rem; }
.human-original-context summary { cursor:pointer; font-weight:600; }
.human-original-context p { margin:.5rem 0; font-size:.78rem; }
.human-discussion :is(button,select,textarea,summary):focus-visible { outline:3px dotted var(--accent) !important; outline-offset:3px; }
.human-thread-list button:disabled { opacity:.55; cursor:default; }
.human-thread-list button { background:var(--chrome); color:var(--ink); border:1px solid var(--line); min-height:32px; }
@media (max-width:1100px) {
  .human-discussion-open .editor-page-scroll { grid-template-columns:minmax(0,1fr); }
  .human-discussion-open .editor-page-scroll > .editor-paper { grid-column:1; grid-row:1; }
  .human-discussion-margin { grid-column:1; grid-row:2; }
}
.semantic-note-list { padding: 0; list-style: none; }
.semantic-note-list li { padding: .65rem 0; border-bottom: 1px solid var(--line); }
.semantic-note-list li > button { width: 100%; display: flex; flex-direction: column; border: 0; background: transparent; color: var(--ink); text-align: left; }
.semantic-note-list span,.semantic-note-list p { color: var(--muted); font-size: .75rem; }
.semantic-note-list p { margin: .35rem 0; white-space: pre-wrap; }

.planning-toolbar { position: sticky; top: 44px; z-index: 9; width: min(1180px, 100%); margin: 0 auto 1rem; padding: .55rem .7rem; display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 7px; background: #f8f4ecf2; box-shadow: 0 5px 12px #4b403319; }
.planning-toolbar button { min-height: 34px; border: 1px solid #bdb4a8; border-radius: 4px; background: #fffdf8; color: var(--ink); }
.planning-toolbar > output:first-of-type { margin-left: auto; }
.planning-toolbar output { color: var(--muted); font-size: .75rem; }
.planning-toolbar details { position: relative; }
.planning-toolbar summary { cursor: pointer; color: var(--ink); font-size: .82rem; font-weight: 600; }
.planning-toolbar details fieldset { position: absolute; z-index: 12; top: calc(100% + .4rem); left: 0; min-width: 190px; padding: .65rem; display: grid; gap: .35rem; border: 1px solid #bdb4a8; border-radius: 6px; background: #fffdf8; box-shadow: 0 10px 28px #4b40332b; }
.planning-toolbar details label { white-space: nowrap; font-size: .78rem; }
.planning-toolbar .outliner-presets > div { position: absolute; z-index: 12; top: calc(100% + .4rem); left: 0; width: 260px; padding: .65rem; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: .45rem; border: 1px solid #bdb4a8; border-radius: 6px; background: #fffdf8; box-shadow: 0 10px 28px #4b40332b; }
.planning-toolbar .outliner-presets label { grid-column: 1 / -1; margin: 0; }
.planning-toolbar .outliner-presets [data-outliner-preset-name] { grid-column: 1 / -1; }
.planning-toolbar .outliner-presets [data-save-outliner-preset] { grid-column: 1 / -1; }
.planning-toolbar [data-outliner-custom-columns] { display: grid; gap: .35rem; }
[data-scrivenings-block] { width: 145px; }
.scrivening-document { padding: 0; overflow: clip; }
.scrivening-document > header { margin: 0; padding: .75rem 1rem; align-items: center; background: #eee6d9; }
.scrivening-document > header > div:last-child { display: flex; gap: .35rem; }
.scrivening-document > header button { min-height: 36px; padding: .3rem .55rem; border: 1px solid #a99378; border-radius: 4px; background: #f7efe3; color: #603719; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: .18em; }
.scrivening-document > header button:hover,
.scrivening-document > header button:focus-visible { background: #ddd1c0; color: #4e2b0d; text-decoration-color: currentColor; }
.scrivening-document > footer { min-height: 32px; padding: .35rem 1rem; border-top: 1px solid #d4cabb; color: #746c60; font-size: .72rem; text-align: right; }
.scrivening-content { min-height: 150px; padding: 2.5rem 3rem; outline: none; }
.scrivening-content[contenteditable="false"] { cursor: default; }
.scrivening-document.active { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent),0 8px 26px #554b3b26; }
.scrivening-document.active > header { background: #f5e8d7; }
.scrivening-document[aria-current="true"] { border-color: var(--accent); scroll-margin-top: .75rem; }
.scrivenings { width:100%;max-width:var(--continuous-measure,820px); }
.scrivenings[data-continuous-separator="divider"] .scrivening-document { margin:0;border-width:0 0 2px;border-radius:0;box-shadow:none; }
.scrivenings[data-continuous-separator="seamless"] .scrivening-document { margin:0;border:0;border-radius:0;box-shadow:none; }
.scrivenings[data-continuous-separator="seamless"] .scrivening-document > footer { border-top:0; }
.scrivenings[data-continuous-show-titles="false"] .scrivening-document > header > div:first-child { position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap; }
.continuous-navigation { display:flex;gap:.25rem; }
[data-panel="corkboard"] > .document-header,
[data-panel="outliner"] > .document-header { width:min(1180px,100%); max-width:1180px; }
[data-panel="outliner"] > .table-responsive { width:min(1180px,100%); margin-inline:auto; }
[data-panel="story-bible"] > .document-header { width:min(1100px,100%); max-width:1100px; }
.planning-header-actions { display:flex; align-items:center; gap:.65rem; color:var(--muted); font-size:.8rem; }
.planning-options-button { flex:0 0 40px; width:40px; height:40px; display:grid; place-items:center; border:1px solid var(--line); }
.corkboard-searchbar { width:min(1180px,100%); margin:0 auto .55rem; display:flex; align-items:center; gap:.6rem; }
.corkboard-searchbar label { flex:0 0 auto; font-size:.78rem; font-weight:650; }
.corkboard-searchbar input { width:clamp(14rem,30vw,28rem); }
.corkboard-guidance { width:min(1180px,100%); margin:0 auto 1rem; display:grid; gap:.6rem; color:var(--muted); }
.corkboard-guidance-copy { display:flex; align-items:baseline; gap:.35rem; flex-wrap:wrap; }
.corkboard-guidance h2 { margin:0; color:var(--ink); font:700 .85rem Georgia,serif; }
.corkboard-guidance .form-text { margin:0; color:var(--muted); }
.corkboard-spatial-actions { display:flex; align-items:center; gap:.4rem; flex-wrap:wrap; }
.corkboard { width: min(1180px,100%); max-width: none; grid-template-columns: repeat(auto-fill,minmax(min(100%,var(--corkboard-card-width,280px)),var(--corkboard-card-width,280px))); justify-content:start; align-items: start; }
.corkboard-controls > label { font-size: .75rem; font-weight: 600; }
.corkboard-controls [data-corkboard-layout-mode] { width:12rem; max-width:100%; }
.corkboard-snap-controls { display:flex; align-items:center; gap:.4rem; padding:.2rem .4rem; border-left:1px solid var(--line); }
.corkboard-snap-controls[hidden] { display:none; }
.corkboard-snap-controls label { display:flex; align-items:center; gap:.3rem; margin:0; font-size:.75rem; font-weight:600; }
.corkboard-snap-controls [data-corkboard-grid-size] { width:82px; }
.corkboard-selection-tools { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.corkboard-selection-tools output { min-width: 105px; }
.corkboard.freeform { position: relative; display: block; width: 100%; max-width: none; border: 1px solid #6e5a4138; border-radius: 8px; background-color: #b99b7030; background-image: radial-gradient(#71583f47 1px,transparent 1px); background-size: var(--corkboard-grid-size,24px) var(--corkboard-grid-size,24px); box-shadow: inset 0 2px 14px #46351e1c; }
.corkboard.freeform .index-card { position: absolute; width: var(--corkboard-card-width,280px); margin: 0; touch-action: none; }
.corkboard.freeform .index-card-heading { cursor: move; }
.corkboard.freeform .index-card.selected { outline: 3px solid var(--accent); outline-offset: 3px; box-shadow: 0 10px 32px #2c6c8847; }
.corkboard.freeform .index-card:focus-visible { outline: 3px solid #145e79; outline-offset: 4px; }
.card-selector { display: flex; align-items: center; gap: .4rem; cursor: pointer; }
.card-selector input { width: 24px; height: 24px; }
.index-card { min-height: 240px; border-radius: 3px; cursor: grab; }
.index-card:active { cursor: grabbing; }
.index-card [data-card-field="synopsis"] { display:block; width:100%; }
.index-card-heading,.card-order-actions { display: flex; align-items: center; justify-content: space-between; gap: .25rem; }
.card-order-actions button { width: 30px; height: 30px; border: 0; border-radius: 4px; background: #e8decd; color: #5c4b3a; }
.index-card-image-shell { position: relative; width: calc(100% + 2rem); margin: -.2rem -1rem .75rem; }
.index-card-image-frame { width: 100%; height: 165px; overflow: hidden; background: color-mix(in srgb,var(--surface) 82%,#000); }
.index-card-image { display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--synopsis-crop-x,50%) var(--synopsis-crop-y,50%); transform: scale(var(--synopsis-crop-zoom,1)); transform-origin: var(--synopsis-crop-x,50%) var(--synopsis-crop-y,50%); }
.adjust-synopsis-image { position: absolute; right: .45rem; bottom: .45rem; min-height: 34px; box-shadow: 0 2px 8px #0007; }
.synopsis-image-dialog { width: min(680px,calc(100vw - 2rem)); }
.synopsis-image-preview { width: 100%; height: min(360px,42vh); overflow: hidden; margin: .75rem 0 1rem; border: 1px solid var(--line); border-radius: .4rem; background: color-mix(in srgb,var(--surface) 80%,#000); }
.synopsis-image-preview img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--synopsis-crop-x,50%) var(--synopsis-crop-y,50%); transform: scale(var(--synopsis-crop-zoom,1)); transform-origin: var(--synopsis-crop-x,50%) var(--synopsis-crop-y,50%); }
.synopsis-crop-controls { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1rem; }
.synopsis-crop-controls label { display: grid; gap: .35rem; color: var(--ink); font-size: .8rem; font-weight: 650; }
.synopsis-crop-controls input { width: 100%; accent-color: var(--accent); }
.synopsis-crop-output { display: block; min-height: 1.5rem; margin-top: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
html[data-color-theme="light"] .synopsis-image-dialog .btn-outline-secondary { border-color: #766e64; background: #fffdf8; color: #34312d; }
html[data-color-theme="light"] .synopsis-image-dialog .btn-outline-secondary:hover,
html[data-color-theme="light"] .synopsis-image-dialog .btn-outline-secondary:focus-visible { border-color: #514b44; background: #e8e1d6; color: #171512; }
.index-card-metadata { display: grid; gap: .35rem; margin: .65rem 0; font-size: .74rem; }
.index-card-metadata > div { display: grid; grid-template-columns: 64px minmax(0,1fr); gap: .35rem; }
.index-card-metadata dt { color: #746c60; font-weight: 500; }
.index-card-metadata dd { margin: 0; overflow-wrap: anywhere; }
.index-card-metadata progress { width: 70px; height: .55rem; }
.metadata-color { display: inline-block; width: .65rem; height: .65rem; margin-right: .3rem; border-radius: 50%; background: var(--metadata-color); }
.index-card footer button { min-height:32px; padding:.25rem .45rem; border:1px solid #b7a894; border-radius:4px; background:#fff8e9; color:#563315; text-decoration:none; }
.index-card footer button:hover,.index-card footer button:focus-visible { border-color:#8b7358; background:#e7d9c5; color:#3c210b; }
.corkboard.corkboard-threads { display:flex; align-items:flex-start; gap:1rem; overflow-x:auto; padding:.15rem .15rem .8rem; scroll-snap-type:x proximity; }
.corkboard-thread { flex:0 0 var(--corkboard-card-width,280px); min-width:min(var(--corkboard-card-width,280px),85vw); padding:.55rem; border:1px solid #c7bbaa; border-top:5px solid var(--thread-color); border-radius:7px; background:#ece3d5; scroll-snap-align:start; }
.corkboard-thread>header { min-height:42px; display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:.45rem; padding:.1rem .25rem .55rem; color:#3d362e; }
.corkboard-thread>header h2 { margin:0; font:700 1rem Georgia,serif; }
.corkboard-thread>header>span:last-child { color:#6f665c; font-size:.72rem; }
.thread-color { width:.8rem; height:.8rem; border:2px solid #fff; border-radius:50%; background:var(--thread-color); box-shadow:0 0 0 1px #756c61; }
.corkboard-thread-cards { display:grid; gap:.75rem; }
.corkboard-thread .index-card { min-height:220px; cursor:default; }
.corkboard-thread .index-card h3 { margin:.5rem 0; font:700 1rem Georgia,serif; }
.thread-label-control { display:grid; gap:.25rem; margin-top:.55rem; color:#655d53; font-size:.72rem; font-weight:600; }
.outliner-progress { min-width:130px; display:grid; gap:.2rem; color:var(--muted); font-size:.72rem; }
.outliner-progress progress { width:120px; height:.65rem; accent-color:var(--accent); }
.outliner-controls { align-items: end; }
.outliner-controls > label { font-size: .75rem; font-weight: 600; }
.outliner-controls [data-outliner-filter] { width: min(250px,30vw); }
.outliner-bulk { display: flex; align-items: end; gap: .35rem; flex-wrap: wrap; }
.outliner-bulk label { color: var(--muted); font-size: .7rem; }
.outliner-bulk select { width: 135px; }
.outliner-options-dialog,.corkboard-options-dialog { width:min(780px,calc(100vw - 2rem)); }
.outliner-options-body,.corkboard-options-body { display:grid; gap:1rem; margin-top:1rem; }
.planning-options-section,.outliner-options-section { margin:0; padding:1rem; border:1px solid var(--line); border-radius:7px; }
.planning-options-section > legend,.outliner-options-section > legend,.outliner-options-section > h3 { width:auto; margin:0 0 .75rem; padding:0 .2rem; color:var(--ink); font:700 1rem Georgia,serif; }
.outliner-columns-grid,.corkboard-field-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:.55rem 1rem; }
.outliner-columns-grid label,.corkboard-field-grid label { display:flex; align-items:center; gap:.4rem; }
.outliner-columns-grid [data-outliner-custom-columns] { display:contents; }
.outliner-layout-grid { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:.55rem; }
.outliner-layout-grid label { grid-column:1 / -1; }
.outliner-layout-grid [data-outliner-preset-name] { grid-column:1 / -1; }
.outliner-layout-grid [data-save-outliner-preset] { grid-column:1 / -1; }
.corkboard-options-body .planning-options-section:first-child { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); align-items:center; gap:.6rem 1rem; }
.corkboard-options-body .planning-options-section:first-child legend { grid-column:1 / -1; }
.corkboard-options-body .corkboard-snap-controls { grid-column:1 / -1; border-left:0; padding:.5rem 0 0; }
.outliner-table { width: max-content; min-width: 100%; max-width: none !important; table-layout: fixed; }
.outliner-table th { position: static; width: 112px; min-width: 112px; max-width: 112px; overflow: hidden; white-space: nowrap; }
.outliner-table th > button { padding: .15rem .3rem; border: 0; background: transparent; color: inherit; font-weight: 700; }
.outliner-table th[aria-sort="ascending"] > button::after { content: " ↑"; }
.outliner-table th[aria-sort="descending"] > button::after { content: " ↓"; }
.outliner-table td { width: 112px; min-width: 112px; max-width: 112px; overflow: hidden; vertical-align: middle; }
.outliner-table :is(th,td)[data-column="select"] { width: 48px; min-width: 48px; max-width: 48px; }
.outliner-table :is(th,td)[data-column="title"] { width: 220px; min-width: 220px; max-width: 220px; }
.outliner-table :is(th,td)[data-column="synopsis"] { width: 280px; min-width: 280px; max-width: 280px; }
.outliner-table :is(th,td)[data-column="sectionType"] { width: 210px; min-width: 210px; max-width: 210px; }
.outliner-table :is(th,td)[data-column="label"],.outliner-table :is(th,td)[data-column="status"] { width: 150px; min-width: 150px; max-width: 150px; }
.outliner-table :is(th,td)[data-column="keywords"] { width: 180px; min-width: 180px; max-width: 180px; }
.outliner-table :is(th,td)[data-column="created"],.outliner-table :is(th,td)[data-column="modified"] { width: 130px; min-width: 130px; max-width: 130px; }
.outliner-table :is(th,td)[data-column="progress"],.outliner-table :is(th,td)[data-column="totalProgress"] { width: 160px; min-width: 160px; max-width: 160px; }
.outliner-table :is(th,td)[data-column="compile"] { width: 90px; min-width: 90px; max-width: 90px; }
.outliner-table :is(th,td)[data-column="actions"] { width: 90px; min-width: 90px; max-width: 90px; }
.outliner-table :is(th,td)[data-column^="custom:"] { width: 180px; min-width: 180px; max-width: 180px; }
.outliner-table td > :is(input,select,button) { max-width: 100%; }
.outliner-table .outliner-title { width: 100%; overflow-wrap: anywhere; }
.outliner-table[data-bands] { display:block; width:100%; min-width:0; }
.outliner-table[data-bands] :is(thead,tbody) { display:block; }
.outliner-table[data-bands] tr { display:grid; grid-template-columns:var(--outliner-tracks); border-bottom:1px solid var(--line); }
.outliner-table[data-bands] :is(th,td)[data-column] {
  width:auto; min-width:0; max-width:none; white-space:normal;
  padding:.55rem; overflow-wrap:anywhere; overflow:visible; border-bottom:0;
}
.outliner-table[data-bands] [data-column][hidden] { display:none; }
.outliner-table[data-bands] td { user-select:text; -webkit-user-select:text; }
.outliner-table[data-bands] :is(input:not([type="checkbox"]),select) { width:100%; min-width:0; }
.outliner-table[data-bands] .outliner-progress { min-width:0; }
.outliner-table[data-bands] progress { max-width:100%; }
[data-outliner-cell-label] { display:block; font-size:.72rem; color:var(--muted); margin-bottom:.25rem; user-select:none; -webkit-user-select:none; }
[data-outliner-cell-label]::before { content:attr(data-label); }
.outliner-table[data-bands="1"] [data-outliner-cell-label] { display:none; }
.outliner-table[data-bands] [data-primary="true"] [data-outliner-cell-label] { display:none; }
.outliner-table[data-bands] [data-column="select"] { border-inline-end:1px solid var(--line); }
.outliner-table[data-bands] tbody [data-column="actions"] { align-content:start; }
.outliner-table[data-bands] tbody tr[data-selected="true"] > td { background:var(--selection-bg, #e6f0f4); }
.app-shell[data-color-theme="dark"] .outliner-table[data-bands] tbody tr[data-selected="true"] > td { background:#294957; }
.outliner-table[data-bands] tbody tr[data-selected="true"] [data-outliner-cell-label] { color:inherit; }
.outliner-table[data-bands] tbody tr[data-selected="true"] > td[data-column="select"] { box-shadow:inset 3px 0 var(--accent); }
.outliner-selection-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:1rem; padding:.65rem .55rem; border:1px solid var(--line); background:var(--panel); }
.outliner-selection-toolbar label { display:flex; align-items:center; gap:.5rem; margin:0; }
.outliner-selection-toolbar output { color:var(--muted); font-size:.85rem; }
.outliner-selection-toolbar [data-open-outliner-bulk] { margin-inline-start:auto; }
.outliner-table[data-bands] thead { position:relative; }
.outliner-table[data-bands] thead [data-secondary-heading="true"] {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip-path:inset(50%); white-space:nowrap;
}
.outliner-table[data-bands] tbody [data-column="title"] { font-weight:600; }
.outliner-table[data-bands] thead :is([data-column="title"],[data-column="words"],[data-column="actions"]) { text-align:left; white-space:nowrap; }
.outliner-table[data-bands] [data-column="actions"] button { white-space:nowrap; }
.outliner-table[data-bands] tbody [data-column="synopsis"] { padding-top:0; }
.outliner-table[data-bands] [data-outline-synopsis] { box-sizing:border-box; width:100%; min-height:4rem; resize:vertical; line-height:1.45; }
.planning-save-state { display:block; flex-basis:100%; margin-top:.35rem; color:var(--muted); font-size:.75rem; font-weight:400; overflow-wrap:anywhere; }
.index-card footer { flex-wrap:wrap; }
.index-card .planning-save-state { color:inherit; }
.corkboard-position-state { display:flex; align-items:center; gap:.75rem; padding:.5rem 0; }
.corkboard-position-state[hidden] { display:none; }
[data-outliner-bulk-targets] { max-height:12rem; overflow:auto; }
[data-outliner-bulk-state],[data-outliner-preset-state] { display:block; }
@media (forced-colors:active) {
  .outliner-table[data-bands] tbody tr[data-selected="true"] > td { outline:1px solid Highlight; outline-offset:-1px; }
}
.planning-pagination { width: min(1180px,100%); margin: .75rem auto 0; display: flex; align-items: center; justify-content: center; gap: 1rem; }
.planning-pagination output { min-width: 13rem; color: var(--muted); font-size: .78rem; text-align: center; }

@media (max-width: 900px) {
  .library-grid[data-library-admin],.metadata-manager-grid { grid-template-columns: 1fr; }
  .series-members-panel { grid-column: auto; }
}

@media (max-width: 520px) {
  .synopsis-crop-controls { grid-template-columns: 1fr; gap: .65rem; }
  .synopsis-image-preview { height: 260px; }
  .corkboard-options-body .planning-options-section:first-child { grid-template-columns:1fr; }
}

@media (forced-colors: active) {
  .form-check-input:checked { forced-color-adjust:none; border-color:Highlight !important; background-color:Highlight !important; }
  .index-card-image-frame,.synopsis-image-preview { border: 1px solid CanvasText; background: Canvas; }
  .adjust-synopsis-image { box-shadow: none; }
  .navigation-node.navigation-visual-separator::before,.navigation-node.navigation-visual-separator::after { background: CanvasText; opacity: 1; }
}

@media (max-width: 960px) {
  .author-style-dialog-body { display: block; overflow-y: auto; }
  .author-style-master { grid-template-rows: auto auto minmax(6rem, 14rem) auto; }
  .author-style-editor { margin-top: 1rem; display: block; }
  .author-style-editor-heading { margin-bottom: .75rem; }
  .author-style-editor > form { display: block; }
  .author-style-form-scroll { overflow: visible; }
  .author-style-form-actions { position: static; }
  .author-style-disclosure > summary { flex-wrap: wrap; }
}

@media (max-width: 700px) {
  .section-type-add-form,.section-rule-fields { grid-template-columns: 1fr; }
  .section-type-dialog form .btn { width: 100%; }
  .section-type-dialog-body { padding-inline: .8rem; }
  .section-type-dialog-header,.section-type-dialog-footer { padding-inline: .8rem; }
  .author-style-identity,.author-style-fields,.author-style-colour-fields,.direct-format-grid,.copy-author-style-options { grid-template-columns: 1fr; }
  .author-style-form-actions { grid-template-columns: 1fr; }
  .author-style-form-actions > span { display: none; }
  .author-style-dialog-body { padding-inline: .8rem; }
  .author-style-dialog > .dialog-heading,.author-style-dialog > p { margin-inline: .8rem; }
  .author-style-dialog-footer { padding-inline: .8rem; }
}

/* Whole-application color modes. Editor paper appearance remains an independent author preference. */
.bi-moon-stars::before { content: "\f497"; }
.bi-sun::before { content: "\f5a2"; }
.color-theme-toggle { flex: 0 0 40px; width: 40px; height: 40px; padding: 0; font-size: 1.05rem; }

.app-shell[data-color-theme="light"] {
  --ink: #26231f;
  --muted: #625e57;
  --panel: #f3eee5;
  --paper: #faf6ed;
  --paper-ink: #26231f;
  --accent: #365f73;
  --accent-strong: #254c60;
  --line: #d4ccc0;
  --chrome: #e9e3d9;
  --deep-ink: #f8f4ec;
  --focus: #086fb8;
  --selected: #dfeaf0;
}
html[data-color-theme="light"] body { background: #e9e3d9; color: #26231f; }
html[data-color-theme="light"] main a:not(.btn) { color: #24546b; }
html[data-color-theme="light"] main .card-header { background: #f4f1eb; }
html[data-color-theme="light"] main .text-secondary,
html[data-color-theme="light"] main .form-text { color: #5f5a53 !important; }
html[data-color-theme="light"] .statistics-grid > div { border: 1px solid #d4ccc0; background: #eee7dc; color: #26231f; }
html[data-color-theme="light"] .statistics-grid span,
html[data-color-theme="light"] .goal-list span { color: #625e57; }
.app-shell[data-color-theme="light"] .topbar { border-color: #c8c0b5 !important; background: #f8f4ec; color: #26231f; }
.app-shell[data-color-theme="light"] .project-identity { color: #26231f; }
.app-shell[data-color-theme="light"] .topbar .btn-quiet { color: #48443e; }
.app-shell[data-color-theme="light"] .topbar .btn-quiet:hover,
.app-shell[data-color-theme="light"] .topbar .btn-quiet.active { background: #e4ddd2; color: #171512; }
.app-shell[data-color-theme="light"] .project-identity { border-color: #d0c8bc; }
.app-shell[data-color-theme="light"] .project-identity span { color: #6d675f; }
.app-shell[data-color-theme="light"] .search-box input,
.app-shell[data-color-theme="light"] .search-box [data-search-scope] { border-color: #bdb4a8; background: #fffdf8; color: #26231f; }
.app-shell[data-color-theme="light"] .search-box input::placeholder { color: #6b655d; }
.app-shell[data-color-theme="light"] .save-state { color: #4f4a43; }
.app-shell[data-color-theme="light"] .command-palette-button { border-color: #aaa095 !important; }
.app-shell[data-color-theme="light"] .command-palette-button kbd { border-color: #aaa095; color: #4f4a43; }
.app-shell[data-color-theme="light"] .project-rail { background: #e1dacf; }
.app-shell[data-color-theme="light"] .project-chip,
.app-shell[data-color-theme="light"] .rail-action { border-color: #aaa095; background: #f8f4ec; color: #3e3a35; }
.app-shell[data-color-theme="light"] .project-chip:hover,
.app-shell[data-color-theme="light"] .rail-action:hover { background: #fffdf8; color: #171512; }
.app-shell[data-color-theme="light"] .project-chip.active { border-color: #365f73; background: #365f73; color: #fff; }

.app-shell[data-color-theme="dark"],
html[data-color-theme="dark"] {
  --ink: #ece8e0;
  --muted: #aaa49a;
  --panel: #202428;
  --paper: #282d31;
  --paper-ink: #f1eee8;
  --accent: #72abc3;
  --accent-strong: #9bc9dc;
  --warning: #e5a45d;
  --line: #454b50;
  --chrome: #171a1d;
  --deep-ink: #111315;
  --focus: #69bcea;
  --selected: #314a58;
}
html[data-color-theme="dark"] body { background: #171a1d; color: #ece8e0; }
html[data-color-theme="dark"] .af-dialog { border-color: #5b6369; background: #202428; color: #ece8e0; box-shadow: 0 30px 90px #000c; }
html[data-color-theme="dark"] .af-dialog::backdrop { background: #060708d4; }
html[data-color-theme="dark"] .af-dialog .btn-close { filter: invert(1) grayscale(1); }
html[data-color-theme="dark"] .af-dialog .form-control,
html[data-color-theme="dark"] .af-dialog .form-select { border-color: #6f7a82; background-color: #2b3035; color: #f3efe8; }
html[data-color-theme="dark"] .af-dialog .form-control::placeholder { color: #aaa49a; }
html[data-color-theme="dark"] .af-dialog .form-text,
html[data-color-theme="dark"] .af-dialog .text-secondary,
html[data-color-theme="dark"] .af-dialog .small { color: #bbb5ac !important; }
html[data-color-theme="dark"] .af-dialog .btn-outline-secondary { border-color: #7a848b; color: #e8e4dc; }
html[data-color-theme="dark"] .af-dialog .btn-quiet { color: #d6d1c8; }
html[data-color-theme="dark"] .statistics-grid > div { border: 1px solid #4e575e; background: #2d3439; color: #f2eee7; }
html[data-color-theme="dark"] .statistics-grid span,
html[data-color-theme="dark"] .goal-list span { color: #b9b3aa; }
.app-shell[data-color-theme="dark"] { background: #171a1d; color: var(--ink); }
.app-shell[data-color-theme="dark"] .topbar { border-color: #42484e !important; background: #111315; color: #f7f3eb; }
.app-shell[data-color-theme="dark"] .application-menu-bar { border-color: #42484e; background: #1b1f22; }
.app-shell[data-color-theme="dark"] .application-menu-bar .bs-top-level-menu > .btn { color: #e5e1da; }
.app-shell[data-color-theme="dark"] .application-menu-bar .bs-top-level-menu > .btn:hover,
.app-shell[data-color-theme="dark"] .application-menu-bar .bs-top-level-menu > .btn:focus,
.app-shell[data-color-theme="dark"] .application-menu-bar .bs-top-level-menu > .btn.show { background: #343a3f; color: #fff; }
.app-shell[data-color-theme="dark"] .application-menu-bar .dropdown-menu { border-color: #596168; background: #262b2f; }
.app-shell[data-color-theme="dark"] .application-menu-bar .dropdown-item { color: #ece8e0; }
.app-shell[data-color-theme="dark"] .application-menu-bar .dropdown-item:hover,
.app-shell[data-color-theme="dark"] .application-menu-bar .dropdown-item:focus { background: #355365; color: #fff; }
.app-shell[data-color-theme="dark"] .application-menu-bar .dropdown-item[aria-checked="true"] .menu-glyph { border-color:#8fc5db; background:#355365; color:#fff; }
.about-dialog { width:min(780px,calc(100vw - 2rem)); }
.about-dialog .dialog-heading { display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; }
.about-version { padding:.25rem .55rem; border:1px solid var(--line); border-radius:999px; color:var(--muted); font-size:.72rem; white-space:nowrap; }
.about-lead { margin:1rem 0; font:1.08rem/1.55 Georgia,serif; }
.about-ownership,.about-licenses { padding:1rem; border:1px solid var(--line); border-radius:7px; background:var(--paper); }
.about-ownership h3,.about-licenses h3 { margin:.15rem 0 .5rem; font:1.15rem Georgia,serif; }
.about-copyright { margin-bottom:0; font-weight:650; }
.about-licenses { margin-top:1rem; }
.about-licenses details { margin-top:.55rem; border-top:1px solid var(--line); padding-top:.55rem; }
.about-licenses summary { min-height:36px; cursor:pointer; font-weight:700; }
.about-licenses ul { margin:.5rem 0; }
.about-licenses a { color:var(--accent-strong); }
html[data-color-theme="dark"] .about-licenses a { color:#a9d9ed; }
@media(max-width:560px){.about-dialog .dialog-heading{grid-template-columns:minmax(0,1fr) auto}.about-version{grid-column:1/-1;justify-self:start}.about-dialog{padding:1rem}}
.app-shell[data-color-theme="dark"] .application-menu-bar .shortcut-key { color: #c5beb4; }
.app-shell[data-color-theme="dark"] .project-identity { color: #fff; }
.app-shell[data-color-theme="dark"] .topbar .btn-quiet { color: #e4e0d8; }
.app-shell[data-color-theme="dark"] .topbar .btn-quiet:hover,
.app-shell[data-color-theme="dark"] .topbar .btn-quiet.active { background: #343a3f; color: #fff; }
.app-shell[data-color-theme="dark"] .project-identity { border-color: #42484e; }
.app-shell[data-color-theme="dark"] .project-identity span { color: #bdb7ad; }
.app-shell[data-color-theme="dark"] .search-box input,
.app-shell[data-color-theme="dark"] .search-box [data-search-scope] { border-color: #555e64; background: #262b2f; color: #fff; }
.app-shell[data-color-theme="dark"] .search-box input::placeholder { color: #bdb7ae; }
.app-shell[data-color-theme="dark"] .save-state { color: #e6e1d8; }
.app-shell[data-color-theme="dark"] .command-palette-button { border-color: #555e64 !important; }
.app-shell[data-color-theme="dark"] .command-palette-button kbd { border-color: #687278; color: #ebe7df; }
.app-shell[data-color-theme="dark"] .project-rail { background: #15181b; }
.app-shell[data-color-theme="dark"] .project-chip,
.app-shell[data-color-theme="dark"] .rail-action { border-color: #485057; background: #292f33; color: #f5f1e9; }
.app-shell[data-color-theme="dark"] .project-chip:hover,
.app-shell[data-color-theme="dark"] .rail-action:hover { background: #3a4248; color: #fff; }
.app-shell[data-color-theme="dark"] .navigation-pane,
.app-shell[data-color-theme="dark"] .inspector-pane { border-color: var(--line) !important; background: var(--panel); color: var(--ink); }
.app-shell[data-color-theme="dark"] .navigation-node { color: #d2cdc5; }
.app-shell[data-color-theme="dark"] .navigation-node:hover { background: #30363b; color: #fff; }
.app-shell[data-color-theme="dark"] .navigation-node.active { background: #294858; color: #fff; box-shadow: inset 3px 0 #90c6dd; }
.app-shell[data-color-theme="dark"] .navigation-node .bi { color: #aaa49a; }
.app-shell[data-color-theme="dark"] .navigation-node .navigation-generated-preview,
.app-shell[data-color-theme="dark"] .navigation-node.active .navigation-generated-preview { color: #b7b0a6; }
.app-shell[data-color-theme="dark"] .writing-surface { background: var(--chrome); }
.app-shell[data-color-theme="dark"] .workspace-view-tabs,
.app-shell[data-color-theme="dark"] .editor-controls-dock,
.app-shell[data-color-theme="dark"] .editor-statusbar { border-color: var(--line); background: #202428f2; }
.app-shell[data-color-theme="dark"] .workspace-view-tabs button { color: #b8b2aa; }
.app-shell[data-color-theme="dark"] .workspace-view-tabs button:hover { background: #30363b; color: #fff; }
.app-shell[data-color-theme="dark"] .workspace-view-tabs button[aria-selected="true"] { border-color: #83bad0; background: #294858; color: #fff; }
.app-shell[data-color-theme="dark"] .inspector-tabs button.active,
.app-shell[data-color-theme="dark"] .inspector-tabs button[aria-selected="true"] { border-color: #83bad0; background: #294858; color: #fff; }
.app-shell[data-color-theme="dark"] .document-header h1 { color: var(--ink); }
.app-shell[data-color-theme="dark"] .formatbar,
.app-shell[data-color-theme="dark"] .planning-toolbar,
.app-shell[data-color-theme="dark"] .table-context-tools,
.app-shell[data-color-theme="dark"] .document-findbar,
.app-shell[data-color-theme="dark"] .paragraph-ruler { border-color: var(--line); background: #24292d; color: var(--ink); }
.app-shell[data-color-theme="dark"] .formatbar > button,
.app-shell[data-color-theme="dark"] .formatbar > select,
.app-shell[data-color-theme="dark"] .formatbar > .dropdown > button { color: var(--ink); }
.app-shell[data-color-theme="dark"] .formatbar > button:hover,
.app-shell[data-color-theme="dark"] .formatbar > .dropdown > button:hover { background: #373e43; }
.app-shell[data-color-theme="dark"] .formatbar .editor-toolbar-group > button:hover,
.app-shell[data-color-theme="dark"] .formatbar .editor-toolbar-group > .dropdown > button:hover,
.app-shell[data-color-theme="dark"] .formatbar .toolbar-emphasis-group > button:hover { background:#373e43; }
.app-shell[data-color-theme="dark"] .af-editor-toolbar button[aria-pressed="true"],
.app-shell[data-color-theme="dark"] .planning-toolbar button[aria-pressed="true"] { background: #355365; color: #fff; box-shadow: inset 0 -3px #9bc9dc; }
.app-shell[data-color-theme="dark"] .dropdown-menu,
.app-shell[data-color-theme="dark"] .planning-toolbar details fieldset,
.app-shell[data-color-theme="dark"] .planning-toolbar .outliner-presets > div { border-color: #596168; background: #262b2f; color: var(--ink); }
.app-shell[data-color-theme="dark"] .dropdown-item { color: var(--ink); }
.app-shell[data-color-theme="dark"] .dropdown-item:hover,
.app-shell[data-color-theme="dark"] .dropdown-item:focus { background: #355365; color: #fff; }
.app-shell[data-color-theme="dark"] .editor-paper { border-color: #50575d; background: var(--paper); color: var(--paper-ink); caret-color: #fff; }
.app-shell[data-color-theme="dark"] .editor-statusbar button,
.app-shell[data-color-theme="dark"] .planning-toolbar button,
.app-shell[data-color-theme="dark"] .document-findbar button,
.app-shell[data-color-theme="dark"] .card-order-actions button { border-color: #626a70; background: #30363b; color: var(--ink); }
.app-shell[data-color-theme="dark"] .synopsis,
.app-shell[data-color-theme="dark"] .form-control,
.app-shell[data-color-theme="dark"] .form-select,
.app-shell[data-color-theme="dark"] .inspector-note-editor { border-color: #545c62; background-color: #282d31; color: var(--ink); }
.app-shell[data-color-theme="dark"] .form-control::placeholder { color: #aaa49a; }
.app-shell[data-color-theme="dark"] .inspector-pane .form-check-input:not(:checked) { border-color: #8c989f; background-color: #171a1d; }
.app-shell[data-color-theme="dark"] .af-dialog,
.app-shell[data-color-theme="dark"] .navigation-menu,
.app-shell[data-color-theme="dark"] .context-menu,
.app-shell[data-color-theme="dark"] .navigation-preview-tooltip { --navigation-tooltip-surface:#202428; border-color: #5b6369; color: var(--ink); }
.app-shell[data-color-theme="dark"] .command-results button,
.app-shell[data-color-theme="dark"] .navigation-menu button,
.app-shell[data-color-theme="dark"] .context-menu button { color: var(--ink); }
.app-shell[data-color-theme="dark"] .command-results kbd { border-color: #6f7a82; background: #343f46; color: #fff; }
.app-shell[data-color-theme="dark"] .command-results button:hover,
.app-shell[data-color-theme="dark"] .command-results button:focus,
.app-shell[data-color-theme="dark"] .navigation-menu button:hover,
.app-shell[data-color-theme="dark"] .navigation-menu button:focus,
.app-shell[data-color-theme="dark"] .context-menu button:hover,
.app-shell[data-color-theme="dark"] .context-menu button:focus { background: #355365; color: #fff; }
.app-shell[data-color-theme="dark"] .library-list a,
.app-shell[data-color-theme="dark"] .library-list li > div,
.app-shell[data-color-theme="dark"] .knowledge-index li > button { color: var(--ink); }
.app-shell[data-color-theme="dark"] .knowledge-index li > button[aria-current="true"] { background: #263842; box-shadow: inset 3px 0 var(--accent); }
.app-shell[data-color-theme="dark"] .knowledge-index,
.app-shell[data-color-theme="dark"] .knowledge-form,
.app-shell[data-color-theme="dark"] .knowledge-detail,
.app-shell[data-color-theme="dark"] .timeline-list,
.app-shell[data-color-theme="dark"] .asset-library-list,
.app-shell[data-color-theme="dark"] .continuity-list,
.app-shell[data-color-theme="dark"] .metadata-manager-grid > section,
.app-shell[data-color-theme="dark"] .section-type-dialog-body > section,
.app-shell[data-color-theme="dark"] .author-style-master,
.app-shell[data-color-theme="dark"] .author-style-editor,
.app-shell[data-color-theme="dark"] .author-style-copy,
.app-shell[data-color-theme="dark"] .series-members-panel { border-color: var(--line); background: #24292d; }
.app-shell[data-color-theme="dark"] .section-type-dialog-footer { border-color: var(--line); background: #202428; }
.app-shell[data-color-theme="dark"] .author-style-dialog-footer { border-color: var(--line); background: #202428; }

/* Live revision marking remains visible and keyboard reachable without taking
   the author away from the pinned editing controls. */
.revision-toolbar-group { display: inline-flex; align-items: center; gap: 2px; min-width: 0; padding-inline: 2px; border-inline: 1px solid var(--line); }
.formatbar .revision-toolbar-group > button { min-height: 40px; padding: .4rem .5rem; border: 0; background: transparent; color: var(--ink); }
.formatbar .revision-toolbar-group > button:hover { background: #e7e0d6; }
.revision-level-picker { width: 9.5rem; min-height: 40px; border: 0; background-color: transparent; }
.revision-mode-state { flex: 1 1 9rem; min-width: 7rem; padding-inline: .45rem; color: var(--muted); font-size: .72rem; line-height: 1.2; }
.revision-level-dialog[open] { width: min(58rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 1.25rem 0 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; overflow: hidden; }
.revision-level-dialog > .dialog-heading,.revision-level-dialog > p { margin-inline: 1.35rem; }
.revision-level-list { min-height: 0; padding: .5rem 1.35rem 1.35rem; display: grid; align-content: start; gap: .6rem; overflow: auto; overscroll-behavior: contain; }
.revision-level-row { min-width: 0; padding: .75rem; display: grid; grid-template-columns: 2.5rem minmax(14rem, 1fr) minmax(9rem, 12rem) auto; gap: .75rem; align-items: end; border: 1px solid var(--line); border-radius: 7px; background: #fffdf8; }
.revision-level-number { width: 2.25rem; height: 2.25rem; align-self: center; display: grid; place-items: center; border-radius: 50%; background: #e7e0d6; color: var(--ink); font-weight: 800; }
.revision-level-row label { margin-bottom: .2rem; }
.revision-level-row output { display: inline-block; margin-inline-start: .4rem; color: var(--muted); font: .75rem ui-monospace,monospace; }
.revision-level-row .form-control,.revision-level-row .btn { min-height: 44px; }
.revision-level-row .form-control-color { display: inline-block; width: 4rem; vertical-align: middle; }
.revision-level-dialog-footer { min-height: 68px; padding: .7rem 1.35rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); background: #fffdf8; }
.revision-level-dialog-footer p { min-height: 1.25rem; margin: 0; color: var(--muted); }
.app-shell[data-color-theme="dark"] .formatbar .revision-toolbar-group > button:hover { background: #373e43; }
[data-bs-theme="dark"] .revision-level-row,
[data-bs-theme="dark"] .revision-level-dialog-footer { border-color: #495057; background: #202428; color: #f1eee7; }
[data-bs-theme="dark"] .revision-level-row .form-label { color: #f1eee7; }
[data-bs-theme="dark"] .revision-level-row output,
[data-bs-theme="dark"] .revision-level-dialog-footer p { color: #c7c2b9; }
[data-bs-theme="dark"] .revision-level-number { background: #343a40; color: #f1eee7; }
@media(max-width:900px){.revision-level-row{grid-template-columns:2.5rem minmax(12rem,1fr) minmax(8rem,10rem)}.revision-level-row>.btn{grid-column:2/-1}.revision-mode-state{display:none}}

/* SQL-backed semantic scriptwriting. Geometry is supplied by a validated
   project format; these rules handle the controls and accessible affordances. */
.script-toolbar-group { display:inline-flex; align-items:center; gap:2px; min-width:0; padding-inline:2px; border-inline:1px solid var(--line); }
.script-format-picker { width:9.25rem; min-height:40px; border:0; background-color:transparent; }
.script-element-picker { width:8.75rem; min-height:40px; border:0; background-color:transparent; }
.formatbar .script-toolbar-group > button { min-height:40px; padding:.4rem .55rem; border:0; background:transparent; color:var(--ink); }
.script-mode-state { flex:0 1 7rem; min-width:5.5rem; padding-inline:.4rem; color:var(--muted); font-size:.72rem; line-height:1.2; }
.script-autocomplete { position:fixed; z-index:1080; width:min(24rem,calc(100vw - 2rem)); max-height:18rem; overflow:auto; padding:.25rem; border:1px solid var(--line); border-radius:7px; background:#fffdf8; box-shadow:0 12px 30px #201a142b; }
.script-autocomplete[hidden] { display:none; }
.script-autocomplete [role="option"] { width:100%; min-height:44px; padding:.55rem .7rem; border:0; border-radius:4px; background:transparent; color:var(--ink); text-align:left; }
.script-autocomplete [role="option"]:hover,.script-autocomplete [role="option"][aria-selected="true"] { background:#dce9ef; color:#193b4c; }
.prose-autocomplete [role="option"] { display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.prose-autocomplete [role="option"] small { color:var(--muted); font-size:.75rem; }
.prose-autocomplete [role="option"][aria-selected="true"] small { color:inherit; }
.language-tools-dialog { width:min(70rem,calc(100vw - 2rem)); max-height:min(54rem,calc(100vh - 2rem)); overflow:auto; }
.language-tool-switches { display:flex; flex-wrap:wrap; gap:.75rem 2rem; margin:.75rem 0 1rem; padding:.8rem 1rem; border:1px solid var(--line); border-radius:7px; }
.language-tools-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:1rem; }
.language-tools-grid>section { min-width:0; padding:1rem; border:1px solid var(--line); border-radius:7px; background:var(--panel-soft); }
.language-tools-grid h3 { margin:0; font-size:1.05rem; }
.language-tools-grid form { display:grid; grid-template-columns:minmax(0,1fr) minmax(9rem,.38fr); gap:.65rem; align-items:end; padding:.75rem 0; border-bottom:1px solid var(--line); }
.language-tools-grid form>.form-check,.language-tools-grid form>.language-tool-options,.language-tools-grid form>.dialog-actions,.language-tools-grid form>[role="status"] { grid-column:1/-1; }
.language-tool-options { display:flex; flex-wrap:wrap; gap:1rem; }
.language-tool-list { display:grid; gap:.4rem; max-height:18rem; margin:.75rem 0 0; padding:0; overflow:auto; list-style:none; }
.language-tool-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:.4rem .75rem; align-items:center; min-height:44px; padding:.5rem .6rem; border:1px solid var(--line); border-radius:6px; background:var(--panel); }
.language-tool-row>span { min-width:0; overflow-wrap:anywhere; }
.language-tool-row small { display:block; color:var(--muted); }
.language-tool-row-actions { display:flex; flex-wrap:wrap; gap:.25rem; }
.language-tools-footer { position:sticky; bottom:-1px; margin:1rem -1.25rem -1.25rem; padding:.75rem 1.25rem; border-top:1px solid var(--line); background:var(--panel); }
.project-spelling-dialog { width:min(66rem,calc(100vw - 2rem)); max-height:calc(100dvh - 2rem); overflow:auto; }
.spelling-check-controls { display:grid; grid-template-columns:minmax(14rem,1fr) auto; gap:.75rem; align-items:end; margin:.8rem 0; padding:.8rem; border:1px solid var(--line); border-radius:7px; background:var(--panel-soft); }
.spelling-check-controls label { display:grid; gap:.3rem; min-width:0; }
.spelling-check-controls .btn { min-height:40px; }
.spelling-status { display:block; min-height:1.5rem; color:var(--muted); }
.spelling-summary { margin:.55rem 0; padding:.65rem .75rem; border-left:4px solid var(--accent); background:var(--panel-soft); }
.spelling-results>ol { display:grid; gap:.65rem; max-height:min(42dvh,28rem); margin:0; padding:.15rem; overflow:auto; list-style:none; }
.spelling-issue { display:grid; grid-template-columns:minmax(0,1fr) minmax(12rem,.55fr); gap:.45rem .9rem; padding:.75rem; border:1px solid var(--line); border-radius:7px; background:var(--paper); }
.spelling-issue header { display:flex; flex-wrap:wrap; align-items:baseline; gap:.4rem .8rem; min-width:0; }
.spelling-issue header strong { color:var(--danger-ink,#8b2925); font-size:1.04rem; }
.spelling-issue header span { color:var(--muted); font-size:.78rem; overflow-wrap:anywhere; }
.spelling-issue>p { grid-column:1; margin:0; overflow-wrap:anywhere; }
.spelling-replacement { grid-column:2; grid-row:1 / span 2; }
.spelling-replacement label { display:grid; gap:.25rem; color:var(--muted); font-size:.75rem; }
.spelling-issue-actions { grid-column:1/-1; display:flex; flex-wrap:wrap; gap:.35rem; }
.spelling-issue-actions .btn { min-height:38px; }
.spelling-empty { padding:1rem; border:1px dashed var(--line); border-radius:7px; color:var(--muted); }
.spelling-replace-confirmation { margin:.8rem 0; padding:.8rem; border:2px solid var(--accent); border-radius:7px; background:var(--panel-soft); }
.spelling-replace-confirmation p { margin:.35rem 0 0; }
.spelling-learned { margin-top:.9rem; padding:.65rem .75rem; border:1px solid var(--line); border-radius:7px; }
.spelling-learned>ol { display:grid; gap:.35rem; max-height:10rem; margin:.55rem 0 0; padding:0; overflow:auto; list-style:none; }
.spelling-learned li { display:flex; justify-content:space-between; align-items:center; gap:.75rem; min-height:40px; padding:.35rem .45rem; border-bottom:1px solid var(--line); }
.spelling-footer { position:sticky; bottom:-1px; justify-content:space-between; margin:1rem -1.25rem -1.25rem; padding:.75rem 1.25rem; border-top:1px solid var(--line); background:var(--panel); }
.spelling-footer>span { color:var(--muted); font-size:.75rem; }
.script-format-dialog[open] { width:min(76rem,calc(100vw - 2rem)); height:min(54rem,calc(100dvh - 2rem)); max-width:none; max-height:none; padding:1.25rem 0 0; display:grid; grid-template-rows:auto auto minmax(0,1fr) auto; overflow:hidden; }
.script-format-dialog>.dialog-heading,.script-format-dialog>p { margin-inline:1.35rem; }
.script-format-layout { min-height:0; display:grid; grid-template-columns:minmax(14rem,23%) minmax(17rem,27%) minmax(26rem,1fr); gap:.75rem; padding:.5rem 1.35rem 1rem; overflow:hidden; }
.script-format-layout>section,.script-format-layout>form { min-width:0; min-height:0; padding:.85rem; border:1px solid var(--line); border-radius:7px; background:#fffdf8; }
.script-formats-pane,.script-elements-pane { display:grid; grid-template-rows:auto auto minmax(0,1fr) auto; gap:.55rem; overflow:hidden; }
.script-formats-pane { grid-template-rows:auto minmax(0,1fr) auto; }
.script-format-list-scroll,.script-element-list-scroll,.script-element-editor-scroll { min-height:0; overflow-y:auto; overflow-x:hidden; }
.script-format-list { display:grid; gap:.35rem; }
.script-format-option { width:100%; min-height:56px; padding:.55rem .65rem; border:1px solid var(--line); border-radius:5px; background:transparent; color:var(--ink); text-align:left; display:flex; align-items:center; justify-content:space-between; gap:.5rem; }
.script-format-option small,.script-element-option small { color:var(--muted); }
.script-format-option[aria-selected="true"] { border-color:var(--accent); background:#dce9ef; color:#193b4c; }
.script-format-archive-controls { border:1px solid var(--line); border-radius:6px; }
.script-format-archive-controls[hidden] { display:none; }
.script-format-archive-controls summary,.script-element-remove-region summary { min-height:44px; padding:.65rem; cursor:pointer; font-weight:600; }
.script-format-archive-body,.script-element-remove-body { padding:.2rem .7rem .7rem; }
.script-format-archive-body .form-text,.script-element-remove-body .form-text { margin-block:.35rem .65rem; }
.script-format-archive-body button,.script-element-remove-body button { width:100%; min-height:44px; }
.script-format-archive-guard[hidden] { display:none; }
.script-element-list { display:grid; gap:.35rem; }
.script-element-option { width:100%; min-height:66px; padding:.55rem .65rem; display:flex; align-items:center; justify-content:space-between; gap:.5rem; border:1px solid var(--line); border-radius:5px; background:transparent; color:var(--ink); text-align:left; }
.script-element-option span { min-width:0; display:grid; }
.script-element-option code { color:var(--muted); font-size:.75rem; }
.script-element-option small { margin-top:.15rem; white-space:normal; overflow-wrap:anywhere; }
.script-element-option[aria-selected="true"] { border-color:var(--accent); border-left-width:4px; background:#dce9ef; color:#193b4c; }
.script-element-editor { padding:0!important; display:grid; grid-template-rows:minmax(0,1fr) auto; overflow:hidden; }
.script-element-editor-scroll { padding:.85rem; }
.script-element-editor fieldset { margin:0 0 .85rem; padding:.75rem; border:1px solid var(--line); border-radius:6px; }
.script-element-editor legend { width:auto; margin:0; padding-inline:.3rem; font-size:.8rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; }
.script-element-identity-grid,.script-element-transition-grid,.script-element-behavior-grid,.script-element-geometry { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.35rem .75rem; align-items:end; }
.script-element-identity-grid { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
.script-element-identity-grid label,.script-element-transition-grid label,.script-element-behavior-grid label,.script-element-geometry label { margin:0; display:grid; gap:.25rem; }
.script-element-behavior-grid .form-check { align-self:center; min-height:44px; display:flex; align-items:center; }
.script-element-editor-actions { min-height:64px; padding:.65rem .85rem; display:flex; justify-content:flex-end; gap:.55rem; border-top:1px solid var(--line); background:var(--paper); }
.script-element-editor-actions .btn,.script-format-dialog .section-heading .btn,.script-format-dialog input,.script-format-dialog select,.script-format-dialog button { min-height:44px; }
.script-format-dialog-footer { min-height:68px; padding:.7rem 1.35rem; display:flex; align-items:center; justify-content:space-between; gap:1rem; border-top:1px solid var(--line); background:#fffdf8; }
.script-format-dialog-footer p { min-height:1.25rem; margin:0; color:var(--muted); }
.app-shell[data-color-theme="dark"] .formatbar .script-toolbar-group>button:hover { background:#373e43; }
.app-shell[data-color-theme="dark"] .script-autocomplete,.app-shell[data-color-theme="dark"] .script-format-layout>section,.app-shell[data-color-theme="dark"] .script-format-layout>form,.app-shell[data-color-theme="dark"] .script-format-dialog-footer { border-color:var(--line); background:#202428; color:var(--ink); }
.app-shell[data-color-theme="dark"] .script-autocomplete [role="option"] { color:var(--ink); }
.app-shell[data-color-theme="dark"] .script-autocomplete [role="option"]:hover,.app-shell[data-color-theme="dark"] .script-autocomplete [role="option"][aria-selected="true"],.app-shell[data-color-theme="dark"] .script-format-option[aria-selected="true"] { background:#314a58; color:#fff; }
.app-shell[data-color-theme="dark"] .language-tools-grid>section,.app-shell[data-color-theme="dark"] .language-tool-row,.app-shell[data-color-theme="dark"] .language-tools-footer { background:var(--panel); }
.app-shell[data-color-theme="dark"] .spelling-check-controls,.app-shell[data-color-theme="dark"] .spelling-summary,.app-shell[data-color-theme="dark"] .spelling-replace-confirmation,.app-shell[data-color-theme="dark"] .spelling-footer { background:var(--panel); }
.app-shell[data-color-theme="dark"] .spelling-issue { background:#202428; }
.app-shell[data-color-theme="dark"] .spelling-issue header strong { color:#ffbbb5; }

@media (max-width:700px) {
  .language-tools-dialog { width:calc(100vw - 1rem); max-width:none; max-height:calc(100vh - 1rem); padding:.85rem; }
  .language-tools-grid { grid-template-columns:minmax(0,1fr); }
  .language-tools-grid form { grid-template-columns:minmax(0,1fr); }
  .language-tools-grid form>* { grid-column:1; }
  .language-tools-footer { margin:1rem -.85rem -.85rem; padding:.7rem .85rem; }
  .project-spelling-dialog { width:calc(100vw - 1rem); max-width:none; max-height:calc(100dvh - 1rem); padding:.85rem; }
  .spelling-check-controls,.spelling-issue { grid-template-columns:minmax(0,1fr); }
  .spelling-replacement { grid-column:1; grid-row:auto; }
  .spelling-footer { margin:1rem -.85rem -.85rem; padding:.7rem .85rem; }
}
@media(max-width:1000px){.script-mode-state{display:none}.script-format-dialog[open]{overflow-y:auto}.script-format-layout{display:block;overflow:visible}.script-format-layout>section,.script-format-layout>form{margin-bottom:.75rem;overflow:visible}.script-format-list-scroll,.script-element-list-scroll{max-height:14rem;overflow:auto}.script-element-editor-scroll{overflow:visible}.script-element-transition-grid,.script-element-behavior-grid,.script-element-geometry,.script-element-identity-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,12rem),1fr))}.script-element-editor-actions{position:static;flex-wrap:wrap}}
.app-shell[data-color-theme="dark"] .section-type-table { --bs-table-bg: transparent; --bs-table-color: #ece8e0; --bs-table-border-color: #454b50; }
.app-shell[data-color-theme="dark"] .author-style-list,
.app-shell[data-color-theme="dark"] .author-style-disclosure,
.app-shell[data-color-theme="dark"] .author-style-copy { background: #202428; }
.app-shell[data-color-theme="dark"] .author-style-option[aria-selected="true"] { background: #314a58; }
.app-shell[data-color-theme="dark"] .index-card { border-color: #5b554c; background: #353129; color: #f2ede4; }
.app-shell[data-color-theme="dark"] .index-card textarea { background: #292720; color: #f2ede4; }
.app-shell[data-color-theme="dark"] .index-card-metadata dt { color: #bbb3a8; }
.app-shell[data-color-theme="dark"] .index-card footer button { border-color:#60717b; background:#293a44; color:#bde8fa; }
.app-shell[data-color-theme="dark"] .index-card footer button:hover,.app-shell[data-color-theme="dark"] .index-card footer button:focus-visible { border-color:#86bdd3; background:#3a5260; color:#fff; }
.app-shell[data-color-theme="dark"] .corkboard-thread { border-color:#555d63; background:#252a2e; }
.app-shell[data-color-theme="dark"] .corkboard-thread>header { color:#f1eee8; }
.app-shell[data-color-theme="dark"] .corkboard-thread>header>span:last-child,.app-shell[data-color-theme="dark"] .thread-label-control { color:#c2bbb1; }
.app-shell[data-color-theme="dark"] .thread-color { border-color:#252a2e; box-shadow:0 0 0 1px #a9a197; }
.app-shell[data-color-theme="dark"] .scrivening-document { border-color: #50575d; background: #282d31; color: #f1eee8; }
.app-shell[data-color-theme="dark"] .scrivening-document > header { border-color: #50575d; background: #30363b; }
.app-shell[data-color-theme="dark"] .scrivening-document.active > header { background: #355365; }
.app-shell[data-color-theme="dark"] .scrivening-document > header button { border-color: #607985; background: #293a44; color: #bde8fa; }
.app-shell[data-color-theme="dark"] .scrivening-document > header button:hover,
.app-shell[data-color-theme="dark"] .scrivening-document > header button:focus-visible { border-color: #9bd5ee; background: #445c69; color: #fff; }
.app-shell[data-color-theme="dark"] .planning-view .table { --bs-table-bg: #24292d; --bs-table-color: #ece8e0; --bs-table-border-color: #454b50; }
.app-shell[data-color-theme="dark"] .outliner-title,
.app-shell[data-color-theme="dark"] .outliner-table th > button { color: #ece8e0; }
.app-shell[data-color-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(180%); }

@media (max-width: 900px) {
  .document-findbar { grid-template-columns: auto minmax(140px,1fr) auto auto; overflow-y: auto; }
  .document-findbar > * { min-width: 0; }
}

/* Quiet actions retain a visible affordance without competing with primary actions. */
html[data-color-theme="light"] .app-shell .btn.btn-quiet,
html[data-color-theme="light"] .af-dialog .btn.btn-quiet {
  border: 1px solid #81786e;
  background: #f5f0e7;
  color: #4b4640;
  box-shadow: 0 1px 0 rgb(33 27 20 / 8%);
}
html[data-color-theme="light"] .app-shell .btn.btn-quiet:hover,
html[data-color-theme="light"] .app-shell .btn.btn-quiet.active,
html[data-color-theme="light"] .af-dialog .btn.btn-quiet:hover,
html[data-color-theme="light"] .af-dialog .btn.btn-quiet.active {
  border-color: #6d8794;
  background: #e7e0d6;
  color: #26231f;
}
html[data-color-theme="dark"] .app-shell .btn.btn-quiet,
html[data-color-theme="dark"] .af-dialog .btn.btn-quiet {
  border: 1px solid #6f7a82;
  background: #292f33;
  color: #e4e0d8;
  box-shadow: 0 1px 0 rgb(255 255 255 / 4%);
}
html[data-color-theme="dark"] .app-shell .btn.btn-quiet:hover,
html[data-color-theme="dark"] .app-shell .btn.btn-quiet.active,
html[data-color-theme="dark"] .af-dialog .btn.btn-quiet:hover,
html[data-color-theme="dark"] .af-dialog .btn.btn-quiet.active {
  border-color: #83bad0;
  background: #343f46;
  color: #fff;
}
html[data-color-theme] .btn.btn-quiet:active {
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 45%);
}

.editor-view.asset-view-mode .editor-controls-dock,
.editor-view.asset-view-mode .document-findbar,
.editor-view.asset-view-mode .editor-statusbar,
.editor-view.asset-view-mode .script-autocomplete,
.editor-view.asset-view-mode .editor-page-scroll { display: none; }
.editor-view > .asset-viewer { grid-row:4; height:100%; min-height:0; }
.asset-viewer { width:min(100%,86rem); min-height:calc(100dvh - 11rem); margin:0 auto; display:grid; grid-template-columns:minmax(0,1fr) minmax(18rem,23rem); grid-template-rows:minmax(0,1fr) auto; overflow:hidden; border:1px solid var(--line); border-radius:7px; background:#d9d4cc; box-shadow:0 14px 42px rgb(46 38 28 / 20%); }
.asset-viewer[hidden] { display:none; }
.asset-viewer-stage { min-width:0; min-height:0; padding:1.25rem; display:grid; place-items:center; overflow:auto; outline-offset:-4px; }
.asset-viewer-stage img { display:block; max-width:100%; height:auto; background:#fff; box-shadow:0 5px 22px rgb(0 0 0 / 24%); }
.asset-viewer-stage iframe { width:100%; height:100%; min-height:36rem; border:0; background:#fff; }
.asset-viewer-stage video { max-width:100%; max-height:100%; background:#000; }
.asset-viewer-stage audio { width:min(40rem,100%); }
.asset-viewer-unavailable { max-width:38rem; margin:auto; color:var(--muted); text-align:center; }
.asset-viewer-toolbar { grid-column:1 / -1; min-height:58px; padding:.55rem .75rem; display:flex; align-items:center; justify-content:space-between; gap:.75rem; border-top:1px solid var(--line); background:#f8f4ec; color:#3e3a35; }
.asset-viewer-toolbar>div { display:flex; flex-wrap:wrap; gap:.45rem; }
.asset-viewer-toolbar output { font-size:.78rem; }
.asset-viewer-toolbar .asset-zoom-controls[hidden] { display:none; }
.asset-zoom-controls { align-items:center; }
.asset-zoom-controls [data-asset-zoom-output] { min-width:3.25rem; text-align:center; }
.app-shell[data-color-theme="dark"] .asset-viewer { background:#121518; }
.app-shell[data-color-theme="dark"] .asset-viewer-toolbar { background:#24292d; color:#ece8e0; }
.app-shell[data-color-theme="dark"] .asset-viewer-toolbar .btn { border-color:#7a848b; color:#ece8e0; }
.app-shell[data-color-theme="dark"] .asset-viewer-toolbar .btn:hover { border-color:#9bc9dc; background:#355365; color:#fff; }
.pdf-annotation-panel { min-width:0; min-height:0; padding:.85rem; display:flex; flex-direction:column; gap:.75rem; overflow:auto; border-left:1px solid var(--line); background:var(--panel); color:var(--ink); }
.pdf-annotation-panel[hidden] { display:none; }
.asset-viewer:has(.pdf-annotation-panel[hidden]) { grid-template-columns:minmax(0,1fr); }
.pdf-annotation-panel>header { display:flex; align-items:center; justify-content:space-between; gap:.65rem; }
.pdf-annotation-panel h2 { margin:0; font-size:1rem; }
.pdf-annotation-form { padding:.75rem; display:grid; gap:.65rem; border:1px solid var(--line); border-radius:5px; background:var(--chrome); }
.pdf-annotation-form[hidden] { display:none; }
.pdf-annotation-form label { display:grid; gap:.25rem; font-size:.78rem; font-weight:700; }
.pdf-annotation-form>div { display:flex; flex-wrap:wrap; gap:.4rem; }
.pdf-annotation-form output:empty { display:none; }
.pdf-annotation-form output { color:var(--danger); font-size:.76rem; }
.pdf-annotation-empty { margin:.25rem 0; color:var(--muted); font-size:.82rem; }
.pdf-annotation-list { margin:0; padding:0; display:grid; gap:.7rem; list-style:none; }
.pdf-annotation-list li { padding:.75rem; display:grid; gap:.4rem; border:1px solid var(--line); border-radius:5px; background:var(--chrome); }
.pdf-annotation-list header { display:flex; align-items:center; justify-content:space-between; gap:.5rem; }
.pdf-annotation-list blockquote { margin:0; padding:.45rem .6rem; border-inline-start:3px solid var(--accent); background:color-mix(in srgb,var(--accent) 8%,transparent); font-size:.82rem; }
.pdf-annotation-list p { margin:0; white-space:pre-wrap; }
.pdf-annotation-list small { color:var(--muted); }
.pdf-annotation-actions { display:flex; flex-wrap:wrap; gap:.35rem; }
@media (max-width:800px) {
  .asset-viewer { grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(24rem,1fr) minmax(12rem,40dvh) auto; }
  .pdf-annotation-panel { border-top:1px solid var(--line); border-left:0; }
}
@media (forced-colors:active) {
  .pdf-annotation-list blockquote { border-color:Highlight; }
}

.editor-footer-state { min-width:0; flex:1 1 0; display:flex; align-items:center; gap:.55rem; overflow:hidden; color:var(--muted); font-size:.72rem; white-space:nowrap; }
.editor-footer-state output { min-width:0; overflow:hidden; text-overflow:ellipsis; }
.page-view-enabled [data-selection-count] { display:none; }
.page-view-enabled .editor-footer-state { min-width:170px; flex-basis:170px; }
.page-view-enabled .zoom-controls input { width:90px; }
.editor-footer-state output+output { padding-left:.55rem; border-left:1px solid var(--line); }
.composition-settings { position:relative; }
.editor-statusbar:has(.composition-settings[open]) { z-index:80; }
.composition-settings>summary { min-height:34px; padding:.3rem .55rem; border:1px solid #bdb4a8; border-radius:4px; background:#fffdf8; color:var(--ink); cursor:pointer; font-size:.76rem; list-style:none; }
.composition-settings>summary::-webkit-details-marker { display:none; }
.composition-settings>summary::after { margin-left:.35rem; content:"▴"; }
.composition-settings:not([open])>summary::after { content:"▾"; }
.composition-settings fieldset { position:absolute; z-index:35; right:0; bottom:calc(100% + .45rem); width:15.5rem; padding:.75rem; display:grid; gap:.5rem; border:1px solid #bdb4a8; border-radius:6px; background:#fffdf8; color:var(--ink); box-shadow:0 12px 32px rgb(45 38 29 / 24%); }
.composition-settings[open] fieldset { position:fixed; z-index:200; right:1rem; bottom:3.5rem; width:min(15.5rem,calc(100vw - 2rem)); }
.composition-settings legend { float:none; width:auto; margin:0 0 .2rem; font-size:.78rem; font-weight:700; }
.composition-settings label { display:flex; align-items:center; gap:.4rem; font-size:.76rem; white-space:nowrap; }
.composition-settings label[for="composition-measure"] { display:block; margin-top:.2rem; font-weight:600; }
.composition-settings label[for="composition-background"],.composition-settings label[for="composition-background-fade"] { display:block; margin-top:.2rem; font-weight:600; }
.composition-settings [data-composition-background-output] { color:var(--muted); font-size:.7rem; }
.focus-mode.has-composition-background .editor-page-scroll { position:relative; isolation:isolate; padding:.75rem; background-image:var(--composition-background-image); background-position:center; background-size:cover; background-repeat:no-repeat; }
.focus-mode.has-composition-background .editor-page-scroll::before { content:""; position:absolute; z-index:0; inset:0; background:var(--chrome); opacity:var(--composition-background-fade,.55); pointer-events:none; }
.focus-mode.has-composition-background .editor-page-scroll>.editor-paper { position:relative; z-index:1; }
.app-shell.high-paper-contrast .editor-paper { border-color:#5b554c; background:#fff; color:#111; box-shadow:0 0 0 1px #5b554c,0 18px 48px rgb(0 0 0 / 26%); }
.app-shell[data-color-theme="dark"] .composition-settings>summary,.app-shell[data-color-theme="dark"] .composition-settings fieldset { border-color:#667078; background:#282d31; color:#f3efe8; }
.app-shell[data-color-theme="dark"].high-paper-contrast .editor-paper { border-color:#d9e1e5; background:#111518; color:#fff; }
@media (forced-colors: active) {
  .focus-mode.has-composition-background .editor-page-scroll { background-image:none !important; }
  .focus-mode.has-composition-background .editor-page-scroll::before { display:none; }
}
@media (max-width: 560px) {
  .appearance-preset-grid { grid-template-columns:1fr 1fr; }
  .appearance-preset-grid label,.appearance-preset-grid select,.appearance-preset-grid [data-appearance-preset-name] { grid-column:1 / -1; }
  .appearance-preset-grid [data-save-appearance-preset] { grid-column:1 / -1; }
}
.corkboard-controls [data-corkboard-filter] { width:clamp(11rem,18vw,17rem); }
.corkboard-controls [data-corkboard-filter-state] { min-width:5rem; color:var(--muted); font-size:.72rem; }
.inspector-autosave { gap:.5rem; flex-wrap:wrap; }
.inspector-autosave [data-metadata-state]::before { content:"Item metadata · "; }
.inspector-autosave [data-autofill-synopsis] { margin-left:auto; }

html[data-color-theme="dark"] .navigation-menu,
html[data-color-theme="dark"] .context-menu { border-color:#5b6369; background:#202428; color:#ece8e0; box-shadow:0 12px 30px #000a; }
html[data-color-theme="dark"] .navigation-menu button,
html[data-color-theme="dark"] .context-menu button { color:#ece8e0; }
html[data-color-theme="dark"] .navigation-menu button:hover,
html[data-color-theme="dark"] .navigation-menu button:focus,
html[data-color-theme="dark"] .context-menu button:hover,
html[data-color-theme="dark"] .context-menu button:focus { background:#355365; color:#fff; }
html[data-color-theme="dark"] .metadata-manager-grid > section,
html[data-color-theme="dark"] .section-type-dialog-body > section,
html[data-color-theme="dark"] .author-style-master,
html[data-color-theme="dark"] .author-style-editor,
html[data-color-theme="dark"] .author-style-copy,
html[data-color-theme="dark"] .series-members-panel { border-color:#454b50; background:#24292d; color:#ece8e0; }
html[data-color-theme="dark"] .section-type-dialog-footer,
html[data-color-theme="dark"] .author-style-dialog-footer { border-color:#454b50; background:#202428; color:#ece8e0; }
html[data-color-theme="dark"] .btn-accent { border-color:#72abc3; background:#72abc3; color:#10212a; }
html[data-color-theme="dark"] .btn-accent:hover,
html[data-color-theme="dark"] .btn-accent:focus { border-color:#9bc9dc; background:#9bc9dc; color:#10212a; }
html[data-color-theme="light"] .btn-accent:focus-visible { border-color:#254c60; background:#254c60; color:#fff; }
html[data-color-theme="dark"] .danger-link { color:#ffaaa3 !important; }
html[data-color-theme="dark"] .library-item-actions button:hover,
html[data-color-theme="dark"] .library-item-actions button:focus-visible,
html[data-color-theme="dark"] .metadata-item-actions button:hover,
html[data-color-theme="dark"] .metadata-item-actions button:focus-visible,
html[data-color-theme="dark"] .bookmark-actions button:hover,
html[data-color-theme="dark"] .bookmark-actions button:focus-visible { background:#343f46; color:#fff; }
html[data-color-theme="light"] .btn-outline-secondary { border-color:#667783; color:#3f505b; }
html[data-color-theme="light"] .btn-outline-secondary:hover,
html[data-color-theme="light"] .btn-outline-secondary:focus-visible { border-color:#3f505b; background:#3f505b; color:#fff; }
html[data-color-theme="dark"] .app-shell .btn-outline-secondary,
html[data-color-theme="dark"] .af-dialog .btn-outline-secondary { border-color:#7a848b; color:#e8e4dc; }
html[data-color-theme="dark"] .app-shell .btn-outline-secondary:hover,
html[data-color-theme="dark"] .app-shell .btn-outline-secondary:focus-visible,
html[data-color-theme="dark"] .af-dialog .btn-outline-secondary:hover,
html[data-color-theme="dark"] .af-dialog .btn-outline-secondary:focus-visible { border-color:#607984; background:#607984; color:#fff; }
html[data-color-theme="light"] .app-shell .btn-outline-danger,
html[data-color-theme="light"] .af-dialog .btn-outline-danger { border-color:#b42331; color:#a51f2d; }
html[data-color-theme="light"] .app-shell .btn-outline-danger:hover,
html[data-color-theme="light"] .app-shell .btn-outline-danger:focus-visible,
html[data-color-theme="light"] .af-dialog .btn-outline-danger:hover,
html[data-color-theme="light"] .af-dialog .btn-outline-danger:focus-visible { border-color:#a51f2d; background:#a51f2d; color:#fff; }
html[data-color-theme="light"] .app-shell .text-secondary,
html[data-color-theme="light"] .app-shell .form-text,
html[data-color-theme="light"] .af-dialog .text-secondary,
html[data-color-theme="light"] .af-dialog .form-text { color:#5f5a53 !important; }
html[data-color-theme="dark"] .app-shell .text-secondary,
html[data-color-theme="dark"] .app-shell .form-text,
html[data-color-theme="dark"] .af-dialog .text-secondary,
html[data-color-theme="dark"] .af-dialog .form-text { color:#bbb5ac !important; }
html[data-color-theme="dark"] .btn-outline-danger { border-color:#d8756f; color:#ffaaa3; }
html[data-color-theme="dark"] .app-shell .btn-outline-danger:hover,
html[data-color-theme="dark"] .app-shell .btn-outline-danger:focus-visible,
html[data-color-theme="dark"] .af-dialog .btn-outline-danger:hover,
html[data-color-theme="dark"] .af-dialog .btn-outline-danger:focus-visible { border-color:#bd5550; background:#bd5550; color:#fff; }
html[data-color-theme="dark"] .app-shell .btn-primary:hover,
html[data-color-theme="dark"] .app-shell .btn-primary:focus-visible,
html[data-color-theme="dark"] .af-dialog .btn-primary:hover,
html[data-color-theme="dark"] .af-dialog .btn-primary:focus-visible { border-color:#176fd0; background:#176fd0; color:#fff; }
html[data-color-theme="dark"] .app-shell .btn-secondary:hover,
html[data-color-theme="dark"] .app-shell .btn-secondary:focus-visible,
html[data-color-theme="dark"] .af-dialog .btn-secondary:hover,
html[data-color-theme="dark"] .af-dialog .btn-secondary:focus-visible { border-color:#6c757d; background:#6c757d; color:#fff; }
html[data-color-theme="light"] .app-shell .form-control,
html[data-color-theme="light"] .app-shell .form-select,
html[data-color-theme="light"] .af-dialog .form-control,
html[data-color-theme="light"] .af-dialog .form-select { border-color:#81786e; }
html[data-color-theme="dark"] .app-shell .form-control,
html[data-color-theme="dark"] .app-shell .form-select,
html[data-color-theme="dark"] .af-dialog .form-control,
html[data-color-theme="dark"] .af-dialog .form-select { border-color:#6f7a82; }
html[data-color-theme="light"] .app-shell .form-control:focus,
html[data-color-theme="light"] .app-shell .form-select:focus,
html[data-color-theme="light"] .af-dialog .form-control:focus,
html[data-color-theme="light"] .af-dialog .form-select:focus { border-color:#365f73; }
html[data-color-theme="dark"] .app-shell .form-control:focus,
html[data-color-theme="dark"] .app-shell .form-select:focus,
html[data-color-theme="dark"] .af-dialog .form-control:focus,
html[data-color-theme="dark"] .af-dialog .form-select:focus { border-color:#83bad0; }
html[data-color-theme="light"] .app-shell .btn-primary:disabled,
html[data-color-theme="light"] .af-dialog .btn-primary:disabled,
html[data-color-theme="dark"] .app-shell .btn-primary:disabled,
html[data-color-theme="dark"] .af-dialog .btn-primary:disabled { border-color:#65747d; background:#65747d; color:#fff; opacity:1; }
.workspace-identity {
  display: grid;
  min-width: 9rem;
  max-width: 13rem;
  min-height: 44px;
  padding: .3rem .65rem;
  border: 1px solid var(--af-border, #c8c0b5);
  border-radius: .4rem;
  color: var(--af-text);
  text-decoration: none;
  line-height: 1.15;
}
.workspace-identity:hover,.workspace-identity:focus-visible { background: var(--af-hover);color:var(--af-text); }
.workspace-identity span { overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.workspace-identity [data-current-user] { color:var(--af-muted);font-size:.72rem; }

.session-chooser { height:100dvh;min-height:0;overflow-y:auto;display:grid;justify-items:center;align-items:safe center;padding:clamp(.75rem,4vw,2rem);background:var(--af-bg,#f2eee6);color:var(--af-text,#27231f); }
.session-chooser-card { width:min(46rem,100%);padding:clamp(1.25rem,4vw,2.5rem);border:1px solid var(--af-border,#c8c0b5);border-radius:.75rem;background:var(--af-panel,#fffdf8);box-shadow:0 1rem 3rem rgb(0 0 0 / .12); }
.session-choice-list { display:grid;gap:.75rem;margin:1.5rem 0;padding:0;border:0;list-style:none; }
.session-choice-list li,.session-choice { display:flex;align-items:center;justify-content:space-between;gap:1rem;min-height:64px;padding:.75rem;border:1px solid var(--af-border,#c8c0b5);border-radius:.5rem;background:var(--af-surface,#fff); }
.session-choice { cursor:pointer;justify-content:flex-start; }
.session-choice:has(input:checked) { border-color:var(--af-accent,#167195);box-shadow:0 0 0 2px color-mix(in srgb,var(--af-accent,#167195) 25%,transparent); }
.session-choice input { inline-size:1.25rem;block-size:1.25rem;flex:0 0 auto; }
.session-choice-list strong,.session-choice-list span { display:block; }
.session-choice-list strong+span { margin-top:.2rem;color:var(--af-muted,#68615a);font-size:.85rem; }
.workspace-members-panel { padding:1rem;border:1px solid var(--af-border,#c8c0b5);border-radius:.5rem;background:var(--af-surface,#fff); }
.workspace-member-list { display:grid;gap:.6rem;margin:1rem 0;padding:0;list-style:none; }
.workspace-member-list>li { display:flex;align-items:center;gap:.6rem;min-height:58px;padding:.65rem;border-bottom:1px solid var(--af-border,#c8c0b5); }
.workspace-member-list>li>div:first-child { min-width:10rem;margin-right:auto; }
.workspace-member-list>li>div:first-child span { display:block;color:var(--af-muted,#68615a);font-size:.8rem; }
.workspace-member-actions { display:flex;align-items:center;gap:.4rem; }
.workspace-member-actions .form-select { min-width:8.5rem; }
.workspace-member-add { padding-top:.5rem; }
html[data-color-theme="dark"] .session-chooser { --af-bg:#171a1d;--af-panel:#202428;--af-surface:#282d31;--af-text:#ece8e0;--af-muted:#bcb5aa;--af-border:#50575d;--af-accent:#83c4df; }
html[data-color-theme="dark"] .session-chooser-card,
html[data-color-theme="dark"] .workspace-members-panel,
html[data-color-theme="dark"] .session-choice { color:var(--af-text); }
html[data-color-theme="dark"] .workspace-members-panel .form-select,
html[data-color-theme="dark"] .workspace-member-add .form-select { border-color:#667078;background-color:#24292d;color:#ece8e0; }

.scratchpad-dialog[open] { width:min(72rem,calc(100vw - 2rem)); height:min(56rem,calc(100dvh - 2rem)); max-height:calc(100dvh - 2rem); display:grid; grid-template-rows:auto auto minmax(0,1fr); overflow:hidden; }
.scratchpad-introduction { margin:.3rem 0 .9rem; color:var(--muted); }
.scratchpad-layout { min-width:0; min-height:0; display:grid; grid-template-columns:minmax(15rem,18rem) minmax(0,1fr); gap:1rem; overflow:hidden; }
.scratchpad-master,.scratchpad-detail { min-width:0; min-height:0; padding:.9rem; border:1px solid var(--line); border-radius:7px; background:var(--paper); }
.scratchpad-master { display:grid; grid-template-rows:auto minmax(0,1fr); gap:.65rem; }
.scratchpad-master h3 { margin:0; font:1.12rem Georgia,serif; }
.scratchpad-list { min-height:0; overflow:auto; border:1px solid var(--line); border-radius:6px; background:#fff; }
.scratchpad-list>button { width:100%; min-height:62px; padding:.65rem .75rem; display:block; border:0; border-left:4px solid transparent; border-bottom:1px solid var(--line); background:transparent; color:var(--ink); text-align:left; }
.scratchpad-list>button strong,.scratchpad-list>button span { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.scratchpad-list>button span { margin-top:.15rem; color:var(--muted); font-size:.75rem; }
.scratchpad-list>button:hover,.scratchpad-list>button:focus-visible { background:#eef4f6; }
.scratchpad-list>button[aria-selected="true"] { border-left-color:var(--accent); background:#dcebf2; }
.scratchpad-empty { margin:0; padding:1rem; color:var(--muted); }
.scratchpad-detail { display:grid; grid-template-rows:auto auto auto minmax(10rem,1fr) auto auto auto; align-content:start; overflow-y:auto; }
.scratchpad-editor { min-width:0; min-height:10rem; margin:0; padding:1rem; overflow:auto; border:1px solid #ada396; border-radius:6px; background:#fffdf8; color:#27231f; font:1rem/1.55 Georgia,serif; outline-offset:2px; }
.scratchpad-note-actions,.scratchpad-send-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:.5rem; margin-top:.65rem; }
.scratchpad-send-panel { min-width:0; margin-top:.85rem; padding:.7rem; border:1px solid var(--line); border-radius:6px; }
.scratchpad-send-panel legend { width:auto; margin:0; padding:0 .25rem; float:none; font:1rem Georgia,serif; }
.scratchpad-destination-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.65rem; }
.scratchpad-destination-grid label { min-width:0; color:var(--muted); font-size:.8rem; }
.scratchpad-destination-grid .form-select { margin-top:.25rem; }
.scratchpad-detail>[data-scratchpad-state] { min-height:1.5rem; margin:.6rem 0 0; color:var(--muted); }
.scratchpad-detail>[data-scratchpad-state] a { font-weight:700; }
html[data-color-theme="light"] .scratchpad-detail>[data-scratchpad-state] a { color:#24546b; }
html[data-color-theme="dark"] .scratchpad-master,
html[data-color-theme="dark"] .scratchpad-detail { border-color:#50585e; background:#24292d; }
html[data-color-theme="dark"] .scratchpad-list { border-color:#50585e; background:#1b1f22; }
html[data-color-theme="dark"] .scratchpad-list>button { border-bottom-color:#454c51; color:#ece8e0; }
html[data-color-theme="dark"] .scratchpad-list>button:hover,
html[data-color-theme="dark"] .scratchpad-list>button:focus-visible { background:#2c3941; }
html[data-color-theme="dark"] .scratchpad-list>button[aria-selected="true"] { border-left-color:#9bd5ee; background:#314a58; }
html[data-color-theme="dark"] .scratchpad-editor { border-color:#646d73; background:#f8f4ec; color:#27231f; }
html[data-color-theme="dark"] .scratchpad-detail>[data-scratchpad-state] a { color:#9bd5ee; }

.navigation-hoist-state { margin:0 .55rem .35rem; padding:.45rem .55rem; display:flex; align-items:center; justify-content:space-between; gap:.5rem; border:1px solid var(--line); border-radius:6px; background:#e6eef2; color:#274656; font-size:.75rem; }
.navigation-hoist-state[hidden] { display:none; }
.navigation-hoist-state span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.navigation-hoist-state .btn { flex:0 0 auto; }
.document-header-actions { display:flex; align-items:flex-end; gap:1rem; }
.outline-navigation { display:flex; align-items:center; gap:.25rem; }
.outline-navigation .btn { min-height:38px; border:1px solid var(--line); }
.outline-navigation [data-outline-parent] { min-width:0; max-width:16rem; display:flex; align-items:center; flex-wrap:nowrap; gap:.25rem; overflow:hidden; }
.outline-navigation [data-outline-parent] i { flex:0 0 auto; }
.outline-navigation [data-outline-parent] span { min-width:0; display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.workspace-layout-dialog { width:min(44rem,calc(100vw - 2rem)); }
.workspace-layout-list { max-height:48dvh; margin:1rem 0; overflow:auto; border:1px solid var(--line); border-radius:7px; }
.workspace-layout-list>p { margin:0; padding:1rem; color:var(--muted); }
.workspace-layout-list>article { min-height:68px; padding:.7rem; display:flex; align-items:center; justify-content:space-between; gap:1rem; border-bottom:1px solid var(--line); }
.workspace-layout-list>article:last-child { border-bottom:0; }
.workspace-layout-list>article strong,.workspace-layout-list>article span { display:block; }
.workspace-layout-list>article span { margin-top:.15rem; color:var(--muted); font-size:.78rem; }
.workspace-layout-list>article>div:last-child { display:flex; gap:.4rem; }
.workspace-layout-save { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:.6rem; }
.workspace-layout-dialog [data-workspace-layout-state] { min-height:1.5rem; margin:.5rem 0 0; color:var(--muted); }
html[data-color-theme="dark"] .navigation-hoist-state { border-color:#52616a; background:#263842; color:#d9eef6; }
html[data-color-theme="dark"] .workspace-layout-list { border-color:#50585e; background:#1b1f22; }
html[data-color-theme="dark"] .workspace-layout-list>article { border-bottom-color:#454c51; }

.reference-window { height:100dvh; padding:clamp(1rem,4vw,2.5rem); overflow:auto; background:#eee8de; color:#27231f; }
.reference-window-header { max-width:52rem; margin:0 auto; display:flex; align-items:flex-end; justify-content:space-between; gap:1rem; }
.reference-window-header p { margin:.2rem 0 0; color:#6c655c; }
.reference-window-header h1 { margin:.1rem 0 0; font:clamp(1.6rem,4vw,2.35rem)/1.1 Georgia,serif; }
.reference-window-header nav { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:.5rem; }
.reference-window-meta { max-width:52rem; margin:.9rem auto; padding:.55rem .75rem; display:flex; flex-wrap:wrap; gap:.5rem 1.25rem; border-block:1px solid #c5bbae; color:#6c655c; font-size:.78rem; }
.reference-document { max-width:52rem; min-height:calc(100dvh - 14rem); margin:0 auto; padding:clamp(2rem,7vw,5rem); border:1px solid #cec4b7; background:#fffdf8; color:#27231f; box-shadow:0 16px 45px rgb(58 48 36 / 16%); font:1.08rem/1.75 Georgia,serif; }
.reference-unavailable { display:grid; place-items:center; color:#6c655c; }
html[data-color-theme="dark"] .reference-window { background:#171a1d; color:#ece8e0; }
html[data-color-theme="dark"] .reference-window-header p,
html[data-color-theme="dark"] .reference-window-meta { color:#bcb5aa; }
html[data-color-theme="dark"] .reference-window-meta { border-color:#50575d; }
html[data-color-theme="dark"] .reference-window .btn-outline-secondary { border-color:#7a848b; color:#ece8e0; }

@media (max-width:950px) {
  .document-header { align-items:flex-start; }
  .document-header-actions { align-items:flex-end; flex-direction:column-reverse; gap:.4rem; }
  .outline-navigation [data-outline-parent] span { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
  .reference-window-header { align-items:flex-start; flex-direction:column; }
  .reference-window-header nav { justify-content:flex-start; }
}

@media (max-width:850px) {
  .scratchpad-dialog[open] { height:calc(100dvh - 1rem); width:calc(100vw - 1rem); }
  .scratchpad-layout { display:block; overflow-y:auto; }
  .scratchpad-master { min-height:15rem; max-height:18rem; }
  .scratchpad-detail { margin-top:1rem; }
  .scratchpad-destination-grid { grid-template-columns:1fr; }
  .workspace-layout-list>article { align-items:flex-start; flex-direction:column; }
  .workspace-layout-save { grid-template-columns:1fr; }
}

/* High-zoom compact mode: preserve one-dimensional scrolling inside dense
   authoring controls instead of allowing intrinsic toolbar widths to widen the
   page or push controls outside the viewport. Kept at the end intentionally so
   component definitions cannot override the reflow contract. */
@media (max-width:720px) {
  .workspace-view-tabs>button { flex:0 0 auto; }
  .editor-controls-dock { overflow-x:auto;overflow-y:hidden; }
  body:has(dialog[open]) .editor-controls-dock,
  body:has(dialog[open]) .editor-statusbar { content-visibility:hidden;overflow-x:hidden; }
  body:has(dialog[open]) > .tooltip { display:none!important; }
  .editor-controls-dock .formatbar { width:max-content;min-width:100%;flex-wrap:nowrap; }
  .editor-statusbar { justify-content:flex-start;overflow-x:auto;overflow-y:hidden; }
  .editor-statusbar>* { flex:0 0 auto; }
}

/* Focus Mode reuses the existing menus and view/filter well in the otherwise
   empty identity bar. At narrower widths the connected view/filter well returns
   to the writing surface before any of its controls are allowed to detach. */
.app-shell.focus-mode { grid-template-rows:52px 0 minmax(0,1fr); }
.focus-mode .topbar { position:relative; z-index:34; }
.focus-mode .application-menu-bar { position:fixed; z-index:36; top:18px; left:var(--focus-menu-left,162px); width:max-content; height:34px; min-height:34px; padding:0; align-items:stretch; overflow:visible; border:0; background:transparent; }
.focus-mode .application-menu-bar .bs-top-level-menu>.btn { min-height:34px; }

@media (min-width:1600px) {
  .focus-mode .workspace-view-well { position:fixed; z-index:35; top:8px; left:var(--focus-views-left,535px); right:var(--focus-views-right,82px); height:44px; border:0; background:transparent; }
  .focus-mode .workspace-view-tabs { height:44px; padding-left:0; overflow:hidden; }
  .focus-mode .workspace-compile-filter { min-height:44px; }
}

@media (max-width:720px) {
  .app-shell.focus-mode { grid-template-rows:52px 34px minmax(0,1fr); }
  .focus-mode .application-menu-bar { position:relative; top:auto; left:auto; width:auto; height:34px; padding-inline:.45rem; overflow-x:auto; overflow-y:visible; border-bottom:1px solid var(--line); background:#f8f4ec; }
  .app-shell[data-color-theme="dark"].focus-mode .application-menu-bar { background:#1b1f22; }
}
.transfer-subtree-dialog { width: min(42rem, calc(100vw - 2rem)); }
/* The same menu/title/action row remains coherent in Focus mode. */
.app-shell.focus-mode { grid-template-rows:52px auto minmax(0,1fr); }
.focus-mode .application-menu-bar { position:relative; top:auto; left:auto; width:auto; height:auto; min-height:38px; padding-inline:.5rem; border-bottom:1px solid var(--line); background:var(--chrome); }
.focus-mode .workspace-view-well { position:relative; top:auto; left:auto; right:auto; width:auto; height:auto; background:var(--chrome); }
@media(max-width:1100px) {
  .application-menu-bar { flex-wrap:wrap; overflow:visible; }
  .application-menu-bar .application-document-title { flex:1 1 9rem; }
  .document-actions-toggle { display:block; }
  .application-document-actions .outline-navigation { display:none; position:absolute; z-index:2400; top:100%; right:0; min-width:12rem; padding:.35rem; border:1px solid var(--line); border-radius:5px; background:var(--panel); box-shadow:0 8px 24px #0003; }
  .application-document-actions.actions-open .outline-navigation { display:flex; flex-direction:column; align-items:stretch; }
  .application-document-actions .outline-navigation button { justify-content:flex-start; }
}
@media(max-width:560px) {
  .app-shell { grid-template-rows:auto auto minmax(0,1fr); }
  .workspace-view-tabs { display:none; }
  .workspace-view-select { display:flex; align-items:center; gap:.4rem; flex:1 1 9rem; min-width:0; font-size:.85rem; }
  .workspace-view-select select { min-width:0; width:100%; min-height:36px; border:1px solid var(--line); border-radius:4px; padding:.35rem; color:var(--ink); background:var(--panel); }
  .workspace-view-well { flex-wrap:wrap; }
  .app-shell[data-color-theme="dark"] .workspace-view-well { background:var(--panel); color:var(--ink); }
  .application-menu-bar .application-document-title { order:1; margin-block:.25rem; }
  .application-document-actions { order:2; }
}
.transfer-source-summary { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .35rem .85rem; padding: .75rem; border: 1px solid var(--af-border); border-radius: .35rem; background: var(--af-panel-muted); }
.transfer-source-summary dt { color: var(--af-text-muted); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.transfer-source-summary dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.transfer-new-project-options { margin-top: .75rem; padding: .8rem; border: 1px solid var(--af-border); border-radius: .35rem; background: var(--af-panel-muted); }
.import-split-options { margin-top: .75rem; padding-left: .85rem; border-left: 3px solid var(--af-accent); }

.snapshot-filters { margin-block: .8rem; padding: .7rem; display: grid; grid-template-columns: minmax(0,1fr) minmax(7rem,.6fr); gap: .55rem; border: 1px solid var(--line); border-radius: 6px; background: color-mix(in srgb,var(--panel) 82%,var(--chrome)); }
.snapshot-filters label { display: grid; gap: .25rem; color: var(--muted); font-size: .72rem; }
.snapshot-filters output { grid-column: 1/-1; min-height: 1.2em; color: var(--muted); font-size: .72rem; }
.snapshot-actions { flex-wrap: wrap; }
.snapshot-actions button { min-height: 32px; border: 1px solid color-mix(in srgb,var(--line) 75%,transparent); background: var(--panel); color: var(--ink); }
.snapshot-actions button:hover { background: color-mix(in srgb,var(--panel) 85%,var(--ink)); }
.snapshot-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-semantic-tools { margin-top: .8rem; padding-top: .8rem; display: grid; grid-template-columns: minmax(13rem,1fr) auto; gap: .55rem; align-items: end; border-top: 1px solid var(--line); }
.search-semantic-tools label { color: var(--muted); font-size: .72rem; }
.search-semantic-tools select { margin-top: .25rem; }
.search-semantic-tools p { grid-column: 1/-1; margin: 0; color: var(--muted); font-size: .72rem; }
.search-semantic-tools code { color: inherit; }
.writing-surface > .search-results-panel { inset: 44px 0 0; min-width: min(34rem,100%); }
.app-shell[data-color-theme="dark"] .workspace-compile-filter { border-color: #454b50; background: #1b1f22; color: #e5e1da; }
.app-shell[data-color-theme="dark"] .navigation-node.navigation-compile-context::after { border-color: #6f7c84; color: #c1ccd2; }

.publication-readiness-dialog { width:min(62rem,calc(100vw - 2rem)); max-height:calc(100dvh - 2rem); }
.publication-readiness-result { max-height:min(64dvh,48rem); padding:.2rem; overflow:auto; }
.publication-readiness-summary { margin:.7rem 0 1rem; padding:1rem; border:1px solid var(--line); border-left:5px solid #2f778f; border-radius:7px; background:var(--paper); }
.publication-readiness-summary.has-errors { border-left-color:#a53832; }
.publication-readiness-summary.has-warnings { border-left-color:#9a671b; }
.publication-readiness-summary.is-ready { border-left-color:#287549; }
.publication-readiness-summary>p { margin:0 0 .7rem; font:1.15rem Georgia,serif; }
.publication-readiness-summary dl { margin:0; display:grid; grid-template-columns:repeat(auto-fit,minmax(8rem,1fr)); gap:.65rem; }
.publication-readiness-summary dl>div { min-width:0; }
.publication-readiness-summary dt { color:var(--muted); font-size:.7rem; font-weight:700; letter-spacing:.08em; text-transform:uppercase; }
.publication-readiness-summary dd { margin:.15rem 0 0; overflow-wrap:anywhere; }
.publication-issue-group { margin:1rem 0; }
.publication-issue-group h3 { font:1.08rem Georgia,serif; }
.publication-issue-group ol { margin:0; padding:0; display:grid; gap:.55rem; list-style:none; }
.publication-issue-group li { min-height:56px; padding:.65rem; display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:.7rem; border:1px solid var(--line); border-radius:6px; background:var(--paper); }
.publication-issue-group li>i { color:#a53832; font-size:1.15rem; }
.publication-issue-group li>span { display:grid; gap:.12rem; }
.publication-issue-group li>span>strong { font-size:.82rem; }
.publication-issue-group .btn { min-height:38px; }
.publication-ready-message { padding:1rem; border:1px solid #4f8f68; border-radius:6px; color:#245f3d; }
.publication-ready-message i { margin-right:.35rem; }
.app-shell[data-color-theme="dark"] .publication-readiness-summary,
.app-shell[data-color-theme="dark"] .publication-issue-group li { border-color:#505b62; background:#1d2226; }
.app-shell[data-color-theme="dark"] .publication-ready-message { border-color:#69a982; color:#a9e2bd; }
.compile-designer .btn-outline-secondary { border-color:#667783;color:#4b5b66; }
.compile-designer .btn-outline-danger { border-color:#b42331;color:#a51f2d; }
.compile-outputs-dialog{width:min(780px,calc(100vw - 2rem))}.compile-outputs-list{list-style:none;padding:0;margin:.75rem 0;max-height:55vh;overflow:auto}.compile-outputs-list li{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.8rem .25rem;border-bottom:1px solid var(--line)}.compile-outputs-list li>div{display:grid;gap:.2rem;min-width:0;overflow-wrap:anywhere}.compile-outputs-list span{color:var(--muted);font-size:.9rem}
.compile-outputs-actions{display:flex!important;flex-direction:row;gap:.4rem;flex-wrap:wrap}@media(max-width:560px){.compile-outputs-list li{align-items:flex-start;flex-direction:column}}
.compile-output-toast{position:fixed;right:1.2rem;bottom:1.2rem;z-index:3000;width:min(360px,calc(100vw - 2.4rem));padding:1rem;border:1px solid var(--line);border-radius:10px;background:var(--paper);color:var(--ink);box-shadow:0 12px 36px #0006}.compile-output-toast[hidden]{display:none}.compile-output-toast-heading,.compile-output-toast-actions{display:flex;align-items:center;justify-content:space-between;gap:.5rem}.compile-output-toast-heading button{border:0;background:transparent;color:inherit;font-size:1.5rem;line-height:1;min-width:44px;min-height:44px}.compile-output-toast p{margin:.5rem 0}.compile-output-toast-actions{justify-content:flex-start;flex-wrap:wrap}.compile-output-activity{height:4px;overflow:hidden;border-radius:4px;background:var(--line);margin:.6rem 0}.compile-output-activity span{display:block;width:35%;height:100%;background:var(--accent);animation:compile-output-activity 1.5s ease-in-out infinite alternate}@keyframes compile-output-activity{from{transform:translateX(0)}to{transform:translateX(185%)}}@media(prefers-reduced-motion:reduce){.compile-output-activity span{animation:none;width:100%}}
.app-shell[data-color-theme="dark"] .publication-issue-group .btn-outline-secondary { border-color:#78909b; color:#e8f4f8; }
html[data-color-theme="dark"] .compile-designer .btn-outline-secondary { border-color:#91a6b0;color:#e8f4f8; }
html[data-color-theme="dark"] .compile-designer .btn-outline-danger { border-color:#d98982;color:#ffc4be; }
@media(max-width:720px){.publication-issue-group li{grid-template-columns:auto minmax(0,1fr)}.publication-issue-group li>.btn{grid-column:2;justify-self:start}}

/* Dialogue Focus is a transient CSS Highlight layer. It never adds manuscript
   markup, and the receded state deliberately retains readable contrast. */
.dialogue-focus-mode .editor-paper :is(p,h1,h2,h3,h4,h5,h6,blockquote,li,pre,address),
.dialogue-focus-mode .editor-paper :is(p,h1,h2,h3,h4,h5,h6,blockquote,li,pre,address) * {
  color: var(--dialogue-receded-color, color-mix(in srgb,var(--paper-ink) 68%,var(--paper))) !important;
  transition: color 120ms ease-out;
}
.dialogue-focus-mode[data-dialogue-focus-target="narrative"] .editor-paper :is(p,h1,h2,h3,h4,h5,h6,blockquote,li,pre,address),
.dialogue-focus-mode[data-dialogue-focus-target="narrative"] .editor-paper :is(p,h1,h2,h3,h4,h5,h6,blockquote,li,pre,address) * { color:var(--paper-ink) !important; }
.dialogue-focus-mode .editor-paper ::highlight(af-dialogue-focus),
.dialogue-focus-mode .editor-paper ::highlight(af-dialogue-tags) {
  color: var(--paper-ink) !important;
  text-decoration: none;
}
.dialogue-focus-mode[data-dialogue-focus-target="narrative"] .editor-paper ::highlight(af-dialogue-focus),
.dialogue-focus-mode[data-dialogue-focus-target="narrative"] .editor-paper ::highlight(af-dialogue-tags) { color:var(--dialogue-receded-color) !important; }
.dialogue-focus-mode[data-dialogue-focus-underline="true"] .editor-paper ::highlight(af-dialogue-focus),
.dialogue-focus-mode[data-dialogue-focus-underline="true"] .editor-paper ::highlight(af-dialogue-tags) {
  text-decoration: underline solid currentColor .08em;
  text-underline-offset: .16em;
}
.dialogue-focus-mode[data-dialogue-focus-underline="true"] .editor-paper ::highlight(af-dialogue-underlined) { text-decoration:underline double currentColor .08em; text-underline-offset:.16em; }
.dialogue-focus-mode[data-dialogue-focus-bold="true"] .editor-paper ::highlight(af-dialogue-focus),
.dialogue-focus-mode[data-dialogue-focus-bold="true"] .editor-paper ::highlight(af-dialogue-tags) { text-shadow:.018em 0 currentColor,-.018em 0 currentColor; }
.dialogue-focus-mode[data-dialogue-focus-bold="true"] .editor-paper ::highlight(af-dialogue-bold) { text-shadow:.035em 0 currentColor,-.035em 0 currentColor; }
.dialogue-focus-mode[data-dialogue-focus-keep-current="true"] .editor-paper [data-af-current-block="true"],
.dialogue-focus-mode[data-dialogue-focus-keep-current="true"] .editor-paper [data-af-current-block="true"] * { color:var(--paper-ink) !important; }
@media (prefers-reduced-motion: reduce) {
  .dialogue-focus-mode .editor-paper * { transition: none !important; }
}
@media (forced-colors: active) {
  .dialogue-focus-mode .editor-paper :is(p,h1,h2,h3,h4,h5,h6,blockquote,li,pre,address),
  .dialogue-focus-mode .editor-paper :is(p,h1,h2,h3,h4,h5,h6,blockquote,li,pre,address) * { color: GrayText !important; }
  .dialogue-focus-mode .editor-paper ::highlight(af-dialogue-focus),
  .dialogue-focus-mode .editor-paper ::highlight(af-dialogue-tags) {
    color: CanvasText !important;
    text-decoration: underline solid Highlight 2px;
    text-underline-offset: .18em;
  }
}
.name-generator-dialog {
  width: min(760px, calc(100vw - 2rem));
}

.name-generator-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
  margin-block: 1rem;
}

.name-generator-options label {
  display: grid;
  gap: .35rem;
}

.generated-name-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem .8rem;
  max-height: 18rem;
  overflow: auto;
  padding: .25rem;
  margin-block: 1rem;
}

.generated-name-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .45rem .55rem;
  border: 1px solid var(--af-border);
  border-radius: .35rem;
  background: var(--af-panel-muted, var(--af-surface, #fff));
}

@media (max-width: 600px) {
  .name-generator-options,
  .generated-name-list { grid-template-columns: 1fr; }
}
.legal-policy-body { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Public product surface and resumable first-run setup. */
.marketing-nav,.marketing-footer{display:flex;align-items:center;justify-content:space-between;gap:1.25rem;max-width:1240px;margin:auto;padding:1rem 1.5rem}.marketing-brand{display:flex;align-items:center;gap:.6rem;color:var(--ink,#202326);font:700 1.15rem Georgia,serif;text-decoration:none}.marketing-nav nav,.marketing-footer nav{display:flex;flex-wrap:wrap;gap:1rem}.marketing-nav nav a,.marketing-footer a{color:inherit;text-underline-offset:.2em}.marketing-actions{display:flex;gap:.5rem}.marketing-main{overflow:hidden}.marketing-hero,.marketing-section,.marketing-cta{max-width:1240px;margin:auto;padding:clamp(3rem,7vw,7rem) 1.5rem}.marketing-hero{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(18rem,.75fr);gap:clamp(2rem,6vw,6rem);align-items:center}.marketing-hero h1{max-width:17ch;font:clamp(2.7rem,6vw,5.7rem)/.98 Georgia,serif;letter-spacing:-.035em}.marketing-hero .lead{max-width:55ch;margin:1.5rem 0;font-size:clamp(1.05rem,2vw,1.35rem)}.marketing-fineprint{max-width:70ch;margin-top:1rem;color:var(--muted,#5d6266);font-size:.9rem}.journey-list{display:grid;gap:.7rem;margin:0;padding:1rem;list-style:none;border:1px solid var(--line,#d9d4ca);border-radius:1rem;background:var(--paper,#fff)}.journey-list li{display:grid;grid-template-columns:2.7rem 1fr;gap:.7rem;align-items:center;padding:.8rem;border-bottom:1px solid var(--line,#d9d4ca)}.journey-list li:last-child{border:0}.journey-list span{font:700 1.1rem Georgia,serif;color:#2f778f}.marketing-section>h2,.marketing-cta h2{max-width:25ch;font:clamp(2rem,4vw,3.6rem)/1.05 Georgia,serif}.marketing-grid,.pricing-truth{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1rem;margin-top:2rem}.marketing-grid article,.pricing-truth>div{padding:1.3rem;border:1px solid var(--line,#d9d4ca);border-radius:.75rem;background:var(--paper,#fff)}.marketing-grid h3,.pricing-truth h3{font:1.3rem Georgia,serif}.marketing-contrast{max-width:none;padding-inline:max(1.5rem,calc((100vw - 1192px)/2));background:#172f38;color:#f7f3eb}.marketing-contrast a{color:#9bd7e8}.pricing-truth{grid-template-columns:repeat(2,minmax(0,1fr))}.marketing-cta{max-width:none;padding-inline:max(1.5rem,calc((100vw - 1192px)/2));background:#9a4e32;color:#fff}.marketing-footer{border-top:1px solid var(--line,#d9d4ca)}
.onboarding-shell{max-width:960px}.onboarding-progress{display:grid;grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));gap:.6rem;padding:0;list-style:none}.onboarding-progress li{display:grid;gap:.15rem;padding:.8rem;border:1px solid var(--line,#d9d4ca);border-radius:.5rem}.onboarding-progress li.is-done{border-color:#287549;background:color-mix(in srgb,#287549 10%,transparent)}.onboarding-progress span{color:var(--muted,#5d6266);font-size:.8rem}.onboarding-card{margin-top:1.5rem;padding:clamp(1rem,4vw,2.5rem);border:1px solid var(--line,#d9d4ca);border-radius:.8rem;background:var(--paper,#fff)}.choice-card{display:inline-flex;align-items:center;gap:.45rem;margin:.25rem;padding:.65rem .8rem;border:1px solid var(--line,#d9d4ca);border-radius:.45rem}.choice-card:focus-within{outline:3px solid color-mix(in srgb,#2f778f 55%,transparent);outline-offset:2px}.onboarding-escape{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:1rem;margin-top:1.5rem}.onboarding-escape nav{display:flex;flex-wrap:wrap;gap:1rem}
.marketing-contrast .marketing-grid article{border-color:#66818b;background:#203d47;color:#fff}.marketing-contrast .eyebrow,body.marketing-body .marketing-main .marketing-contrast a{color:#bfe9f5}.marketing-main .btn-outline-primary{border-color:#254c60;color:#254c60}.marketing-main .btn-outline-primary:hover,.marketing-main .btn-outline-primary:focus-visible{background:#254c60;color:#fff}
@media(max-width:800px){.marketing-nav{align-items:flex-start;flex-wrap:wrap}.marketing-nav nav{order:3;width:100%;overflow-x:auto}.marketing-hero{grid-template-columns:1fr}.marketing-grid,.pricing-truth{grid-template-columns:1fr}.marketing-actions{margin-left:auto}}@media(prefers-reduced-motion:reduce){.marketing-main *{scroll-behavior:auto!important;animation:none!important;transition:none!important}}@media(forced-colors:active){.marketing-contrast,.marketing-cta{background:Canvas;color:CanvasText}.marketing-grid article,.pricing-truth>div,.journey-list,.onboarding-card{border:1px solid CanvasText}}
.app-shell[data-project=""] [data-project-surface] { display: none !important; }
[data-project-surface][hidden] { display: none !important; }

/* Saved-version comparison is separate from the editable manuscript. */
.revision-comparison-dialog { width:min(1120px,calc(100vw - 2rem)); max-width:calc(100vw - 2rem); max-height:92vh; max-height:92dvh; padding:1rem; overflow:auto; border:1px solid var(--line,#c9c1b5); border-radius:.5rem; background:var(--panel,#f8f4eb); color:var(--ink,#292a26); }
.revision-comparison-dialog::backdrop { background:#172a3590; }
.revision-comparison-dialog > header { display:flex; align-items:start; justify-content:space-between; flex-wrap:wrap; gap:.75rem; }
.revision-comparison-dialog h2 { margin:0; font:650 1.3rem/1.35 system-ui,sans-serif; }
.revision-comparison-dialog button { min-height:36px; padding:.4rem .7rem; border:1px solid var(--line,#c9c1b5); border-radius:.3rem; background:var(--chrome,#f8f4eb); color:inherit; }
.revision-comparison-metadata { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.7rem; margin:1rem 0 .7rem; }
.revision-comparison-metadata section { min-width:0; padding:.7rem; border:1px solid var(--line,#c9c1b5); border-radius:.3rem; overflow-wrap:anywhere; }
.revision-comparison-metadata h3 { margin:0 0 .4rem; font:650 .9rem/1.4 system-ui,sans-serif; }
.revision-comparison-metadata p,.revision-comparison-dialog > p { margin:.4rem 0; font:.82rem/1.55 system-ui,sans-serif; }
.revision-comparison-scroll { max-height:55vh; max-height:55dvh; overflow:auto; overscroll-behavior:contain; scrollbar-gutter:stable; margin-top:.9rem; }
.revision-comparison-paper { min-height:12rem; padding:clamp(1rem,3vw,2.5rem); background:var(--paper,#faf7ef); color:var(--paper-ink,#292a26); font:1.1rem/1.9 Georgia,serif; overflow-wrap:anywhere; }
.revision-comparison-paper ins,.diff-added { text-decoration:underline; text-underline-offset:.15em; }
.revision-comparison-paper del { text-decoration:line-through; }
.revision-comparison-paper ins { background:#deeee3; color:#285847; }
.revision-comparison-paper del { background:#f4dddd; color:#7d2f36; }
.revision-comparison-dialog :focus-visible { outline:3px dotted var(--accent,#21566a)!important; outline-offset:3px; }
.revision-comparison-sr { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
.snapshot-actions { flex-wrap:wrap; }
@media(max-width:600px) { .revision-comparison-dialog { width:calc(100vw - 1rem); max-width:calc(100vw - 1rem); padding:.75rem; } .revision-comparison-metadata { grid-template-columns:minmax(0,1fr); } .revision-comparison-scroll { max-height:45dvh; } }
@media(forced-colors:active) { .revision-comparison-paper ins,.revision-comparison-paper del { background:Canvas; color:CanvasText; } }
@media print { .revision-comparison-dialog { max-height:none; overflow:visible; } .revision-comparison-scroll { max-height:none; overflow:visible; } }
.human-suggestion-dialog { width:min(58rem,calc(100vw - 2rem)); max-height:calc(100dvh - 2rem); overflow:auto; }
.human-suggestion-dialog header,.human-suggestion-toolbar,.human-suggestion-actions { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.65rem; }
.human-suggestion-dialog header h2 { margin:0; }
.human-suggestion-dialog label { display:block; margin:.8rem 0 .35rem; }
.human-suggestion-dialog [data-human-suggestion-state] { display:block; margin-block:.65rem; font-weight:600; }
.human-suggestion-dialog form,.human-suggestion-list > li { border:1px solid var(--line); border-radius:.4rem; padding:1rem; margin-block:1rem; background:var(--panel); color:var(--ink); }
.human-suggestion-list { list-style:none; margin:0; padding:0; }
.human-suggestion-preview { margin-block:.8rem; padding:.8rem; border-inline-start:3px solid var(--accent); background:var(--paper); color:var(--paper-ink); font:1rem/1.6 Georgia,serif; overflow-wrap:anywhere; white-space:pre-wrap; }
.human-suggestion-dialog textarea { background:var(--paper); color:var(--paper-ink); }
.human-suggestion-preview del { text-decoration:line-through; text-decoration-thickness:2px; }
.human-suggestion-preview ins { text-decoration:underline; text-decoration-thickness:2px; text-underline-offset:.18em; }
.human-suggestion-list blockquote { white-space:pre-wrap; overflow-wrap:anywhere; }
.human-suggestion-list details { margin-block:.8rem; }
.human-suggestion-dialog :focus-visible { outline:3px dotted currentColor; outline-offset:4px; }
@media(max-width:600px) { .human-suggestion-dialog { width:calc(100vw - 1rem); padding:.8rem; } .human-suggestion-actions { justify-content:flex-start; } }

/* Library collections share a bounded native dialog; only its body scrolls. */
.library-dialog { width:min(72rem,calc(100vw - 2rem)); height:min(48rem,calc(100dvh - 2rem)); max-height:calc(100dvh - 2rem); padding:0; overflow:hidden; }
.library-dialog[open] { display:flex; flex-direction:column; }
.library-dialog [hidden] { display:none !important; }
.library-dialog .library-heading { flex:none; padding:1rem 1.25rem .8rem; }
.library-dialog .library-heading h2 { font:1.7rem Georgia,serif; }
.library-context { margin:.2rem 0 0; color:var(--muted); font-size:.85rem; overflow-wrap:anywhere; }
.library-tabs { display:flex; flex:none; gap:.25rem; padding:0 1.25rem; border-bottom:1px solid var(--line); }
.library-tabs > button { display:flex; align-items:center; justify-content:center; gap:.5rem; min-height:44px; padding:.6rem .9rem; border:0; border-bottom:3px solid transparent; background:transparent; color:var(--muted); }
.library-tabs > button[aria-selected="true"] { border-bottom-color:var(--accent); color:var(--ink); font-weight:700; }
.library-tabs > button > span { border:1px solid var(--line); border-radius:1rem; padding:.05rem .4rem; font-size:.75rem; font-variant-numeric:tabular-nums; }
.library-body { flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; padding:1rem 1.25rem; }
.library-body > section { min-width:0; }
.library-panel-tools,.library-primary-actions { display:flex; align-items:center; justify-content:space-between; gap:.6rem; flex-wrap:wrap; }
.library-primary-actions { justify-content:flex-end; }
.library-find { flex:1; min-width:min(14rem,100%); max-width:27rem; }
.library-filters { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:.7rem; margin:.8rem 0; }
.library-filters > label { display:flex; align-items:center; gap:.5rem; margin:0; }
.library-filters > div { display:flex; align-items:center; gap:.5rem; }
.library-filters .form-select { width:auto; }
.library-dialog .library-list { max-height:none; overflow:visible; margin:.75rem 0; }
.library-dialog .library-list > li { display:flex; align-items:center; flex-wrap:wrap; gap:.8rem; padding:.8rem 0; border-bottom:1px solid var(--line); }
.library-dialog .library-list > li[hidden] { display:none; }
.library-dialog .library-list > li > .library-row-main { display:flex; flex:1; min-width:0; align-items:flex-start; flex-direction:column; gap:.2rem; padding:0; }
.library-dialog .library-list .library-title-link { display:inline; padding:.1rem 0; border:0; border-radius:0; background:transparent; color:var(--ink); text-align:left; text-decoration:none; font-weight:650; line-height:1.45; overflow-wrap:anywhere; }
.library-dialog .library-title-link:hover { text-decoration:underline; text-underline-offset:.2rem; }
.library-row-meta { display:flex; flex-wrap:wrap; align-items:center; gap:.25rem .75rem; color:var(--muted); }
.library-dialog .library-row-meta span { font-size:.8rem; }
.library-dialog .library-badge { border:1px solid var(--line); border-radius:.25rem; padding:.05rem .35rem; }
.library-dialog .library-list > li > .library-item-actions { display:flex; flex:none; padding:0; gap:.4rem; }
.library-dialog .library-item-actions button,.library-dialog .library-item-actions a,.library-dialog .library-primary-actions button,.library-dialog .library-panel-tools > button,.library-dialog .btn-close,.library-dialog .library-back { min-height:44px; }
.library-dialog .library-item-actions a { align-items:center; justify-content:center; padding:.5rem .7rem; font-size:.9rem; }
.library-dialog .library-item-actions .btn { padding:.5rem .7rem; font-size:.9rem; }
.library-dialog .library-more { padding:0; }
.library-dialog .dropdown-menu { max-width:min(23rem,calc(100vw - 2rem)); max-height:calc(100dvh - 3rem); overflow:auto; }
.library-dialog .dropdown-menu > li { padding:0; border:0; }
.library-dialog .dropdown-menu .dropdown-item { min-height:44px; padding:.55rem .85rem; white-space:normal; }
.library-description { margin:.2rem 0 0; color:var(--muted); font-size:.85rem; overflow-wrap:anywhere; }
.library-note,.library-empty { color:var(--muted); font-size:.85rem; margin:.6rem 0; }
.library-dialog .series-members-panel { padding:0; border:0; background:transparent; }
.library-dialog .series-members-panel .section-heading { margin-top:.65rem; align-items:flex-start; flex-wrap:wrap; }
.library-dialog .series-members-panel h3 { font:1.4rem Georgia,serif; overflow-wrap:anywhere; }
.library-dialog .series-members-panel form { max-width:none; }
.library-member-form { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:.8rem; padding:1rem; margin:.8rem 0; border:1px solid var(--line); border-radius:.4rem; }
.library-member-primary,.library-member-form > .library-primary-actions,.library-member-form > p { grid-column:1/-1; }
.library-member-primary { display:flex; gap:.5rem; align-items:center; }
.library-position-form { flex-basis:100%; display:flex; flex-wrap:wrap; align-items:flex-end; gap:.6rem; padding:.8rem; border:1px solid var(--line); border-radius:.4rem; }
.library-position-form > label { flex:1; min-width:10rem; }
.library-position-form > p { flex-basis:100%; margin:0; }
.library-footer { flex:none; display:flex; align-items:center; justify-content:space-between; gap:.75rem; border-top:1px solid var(--line); padding:.6rem 1.25rem; }
.library-footer p { margin:0; min-width:0; color:var(--muted); font-size:.85rem; }
.library-footer .btn { min-height:44px; }
.library-dialog button { min-height:44px; }
.library-dialog :focus-visible { outline:3px dotted currentColor !important; outline-offset:3px; }
.universe-share-list { max-height:35dvh; overflow:auto; list-style:none; margin:.8rem 0; padding:0; }
.universe-share-list > li { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.65rem; padding:.7rem 0; border-bottom:1px solid var(--line); }
.universe-share-list > li > div { min-width:0; overflow-wrap:anywhere; }
.universe-share-list span { display:block; font-size:.85rem; color:var(--muted); }
.universe-sharing-dialog button { min-height:44px; }
.universe-sharing-dialog :focus-visible { outline:3px dotted currentColor !important; outline-offset:3px; }
.universe-media-dialog { width:min(42rem,calc(100vw - 2rem)); }
.universe-media-dialog .dialog-heading h2 { min-width:0; overflow-wrap:anywhere; }
.universe-media-list { max-height:35dvh; overflow:auto; overscroll-behavior:contain; list-style:none; margin:.8rem 0; padding:0; }
.universe-media-list > li { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.65rem; padding:.7rem 0; border-bottom:1px solid var(--line); }
.universe-media-list > li > div { min-width:0; overflow-wrap:anywhere; }
.universe-media-list span { display:block; font-size:.85rem; color:var(--muted); }
.universe-media-dialog button { min-height:44px; }
.universe-media-dialog :focus-visible { outline:3px dotted currentColor !important; outline-offset:3px; }
@media(max-width:600px) {
  .library-dialog { width:calc(100vw - 1rem); height:calc(100dvh - 1rem); max-height:calc(100dvh - 1rem); }
  .library-dialog .library-heading,.library-body { padding:.8rem; }
  .library-tabs { padding:0 .6rem; gap:0; }
  .library-tabs > button { flex:1; min-width:0; gap:.3rem; padding:.6rem .25rem; font-size:.9rem; }
  .library-panel-tools { align-items:stretch; }
  .library-find { flex-basis:100%; max-width:none; }
  .library-panel-tools > .library-primary-actions { justify-content:flex-start; }
  .library-filters { align-items:flex-start; }
  .library-filters > div { flex-wrap:wrap; }
  .library-dialog .library-list > li > .library-row-main { flex-basis:100%; }
  .library-dialog .library-list > li > .library-item-actions { flex-wrap:wrap; }
  .library-member-form { grid-template-columns:minmax(0,1fr); padding:.8rem; }
  .library-footer { padding:.6rem .8rem; }
}
/* Fixed progress presentation does not resize the accepted workspace. */
.af-document-transition-status {
  position: fixed;
  inset-block-start: .75rem;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  z-index: 1090;
  display: flex;
  align-items: center;
  gap: .65rem;
  inline-size: min(32rem, calc(100vw - 2rem));
  block-size: 3rem;
  padding-inline: 1rem;
  border: 1px solid var(--bs-border-color, #64748b);
  border-radius: .5rem;
  background: var(--bs-body-bg, #101820);
  color: var(--bs-body-color, #f4f7fa);
  box-shadow: 0 .2rem 1rem #0003;
  pointer-events: none;
}
.af-document-transition-status > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-document-transition-spinner {
  flex: none;
  inline-size: 1.1rem;
  block-size: 1.1rem;
  border: .15rem solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
  animation: af-document-transition-spin .9s linear infinite;
}
.af-document-transition-dialog {
  inline-size: min(30rem, calc(100vw - 2rem));
  max-block-size: calc(100dvh - 2rem);
  overflow: auto;
  padding: 1.5rem;
  border: 1px solid var(--bs-border-color, #64748b);
  border-radius: .75rem;
  background: var(--bs-body-bg, #101820);
  color: var(--bs-body-color, #f4f7fa);
}
.af-document-transition-dialog::backdrop { background: #0007; }
.af-document-transition-dialog h2 { font-size: 1.25rem; margin-block: 0 1rem; }
.af-document-transition-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
@keyframes af-document-transition-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .af-document-transition-spinner { animation: none; } }
