:root { color: #1b2a3d; background: #e7edf4; font-family: Inter, "Segoe UI", system-ui, sans-serif; font-synthesis: none; }
.draft-view-page { margin-bottom: 2rem; }
.draft-view-page p, .draft-view-page td { white-space: pre-wrap; tab-size: 4; }
.draft-view-page figure { margin: 1rem 0; }
.draft-view-page img { max-width: 100%; height: auto; }
.draft-object-preview { display: block; max-width: 100%; height: auto; }
.draft-view-page td { overflow-wrap: anywhere; }
.draft-page-label { text-align: center; }
.draft-page-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .35rem; }
.draft-page-actions { display: flex; gap: .3rem; }
.draft-add-page { text-align: center; margin: 1.5rem 0; }
.draft-formula-source { white-space: pre-wrap; overflow-wrap: anywhere; margin: 1rem 0; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; overflow-x: hidden; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.color-tool { display: inline-flex; min-width: 2.2rem; height: 2rem; align-items: center; justify-content: center; gap: .15rem; border: 1px solid #b8cad8; border-radius: .3rem; background: #fff; color: #1c2f3e; font-weight: 700; cursor: pointer; }
.color-tool input { width: .8rem; height: 1.4rem; padding: 0; border: 0; background: transparent; cursor: pointer; }
.tool-button.is-active { background: #d9edf7; border-color: #4f8fac; }
.document-statistics { margin: .35rem 0 0; color: #496173; font-size: .82rem; text-align: right; }
.zoom-bar { display: flex; align-items: center; gap: .3rem; margin-top: .35rem; justify-content: center; }
.zoom-display { min-width: 3rem; text-align: center; color: #496173; font-size: .82rem; font-weight: 700; }
.toc-list { display: grid; gap: .35rem; max-height: 45vh; overflow-y: auto; }
.toc-entry { border: 0; border-radius: .35rem; padding: .45rem .6rem; background: #f1f7fb; color: #174d70; text-align: left; }
.shell { min-height: 100vh; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 5vw; color: #f7fbff; background: #123760; border-bottom: 4px solid #4f97b9; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: inherit; font-size: 1.25rem; font-weight: 760; letter-spacing: -.02em; text-decoration: none; }
.brand-mark { display: grid; width: 2rem; height: 2rem; place-items: center; border: 1px solid #b9d9eb; border-radius: .45rem; font-family: Georgia, serif; font-size: 1.55rem; font-style: italic; color: #d7f0ff; }
.mode-label, .eyebrow, .revision-label { margin: 0; font-size: .78rem; font-weight: 720; letter-spacing: .08em; text-transform: uppercase; }
.topbar-link { border: 0; background: transparent; color: #b9d9eb; font-size: .85rem; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }.topbar-link:hover { color: #fff; }
.help-dialog { width: min(96vw, 940px); height: min(92vh, 700px); max-width: none; max-height: none; padding: 0; overflow: hidden; border: 1px solid #aeb2b6; border-radius: .45rem; background: #f3f3f3; box-shadow: 0 1.5rem 5rem rgb(16 44 66 / 28%); }.help-dialog::backdrop { background: rgb(10 31 48 / 48%); }.help-header { padding: 1rem 1rem .55rem; }.help-header h2 { margin: 0; color: #111; font-family: "Segoe UI", system-ui, sans-serif; font-size: 1.7rem; }.help-header p { margin: .45rem 0 0; color: #43586c; }.help-layout { display: grid; grid-template-columns: 255px minmax(0, 1fr); height: calc(100% - 128px); margin: 0 1rem; border: 1px solid #aeb2b6; background: #fff; }.help-nav { display: flex; flex-direction: column; overflow-y: auto; border-right: 1px solid #aeb2b6; background: #fff; }.help-nav-item { border: 0; border-radius: 0; padding: .34rem .45rem; background: transparent; color: #111; font-size: .95rem; text-align: left; cursor: pointer; }.help-nav-item:hover { background: #e5f1fa; }.help-nav-item.is-active { background: #1786d0; color: #fff; font-weight: 400; }.help-content { padding: 1rem; overflow-y: auto; background: #fff; }.help-section h3 { margin: 0 0 1.5rem; color: #204f7d; font-family: "Segoe UI", system-ui, sans-serif; font-size: 1.65rem; }.help-section h4 { margin: 0 0 .25rem; color: #111; font-size: 1rem; }.help-section p { margin: 0 0 1.15rem; color: #111; line-height: 1.45; font-size: .96rem; white-space: pre-line; }.help-loading { color: #43586c; }.help-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 1rem; }.help-template-actions { display: flex; flex-wrap: wrap; gap: .45rem; }.help-template-button { display: inline-flex; align-items: center; color: #111; text-decoration: none; }
.mode-label { color: #b9d9eb; }.eyebrow, .revision-label { color: #3f718c; }
.auth-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: clamp(2rem, 7vw, 8rem); align-items: center; max-width: 1160px; min-height: calc(100vh - 72px); margin: auto; padding: clamp(2rem, 7vw, 6rem) 5vw; }
.auth-intro { max-width: 39rem; }.auth-intro h1 { margin: .5rem 0 1.1rem; color: #17314b; font-family: Georgia, serif; font-size: clamp(2.3rem, 5vw, 4.6rem); line-height: 1.06; letter-spacing: -.055em; }.auth-intro p:not(.eyebrow) { margin: 0; color: #43586c; font-size: 1.08rem; line-height: 1.65; }
.auth-card, .document-sidebar, .editor-panel { background: #fbfdff; border: 1px solid #ccd9e5; box-shadow: 0 1rem 3rem rgb(26 57 83 / 12%); }.auth-card { padding: 1.5rem; border-radius: .85rem; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; margin-bottom: 1.5rem; padding-bottom: .75rem; border-bottom: 1px solid #d8e2eb; }.tab-button { border: 0; border-radius: .4rem; padding: .7rem; background: transparent; color: #587184; font-weight: 700; }.tab-button.is-active { color: #123760; background: #e3f1f8; }
.field { display: grid; gap: .45rem; margin-bottom: 1rem; }label { color: #30495e; font-size: .92rem; font-weight: 700; }input, textarea { width: 100%; padding: .78rem .85rem; color: #162c3e; border: 1px solid #b8cad8; border-radius: .4rem; background: #fff; outline: none; }textarea { min-height: 23rem; resize: vertical; line-height: 1.55; }input:focus, textarea:focus { border-color: #2779a5; box-shadow: 0 0 0 3px rgb(39 121 165 / 15%); }
.primary-button, .new-document-button { border: 0; border-radius: .4rem; padding: .78rem 1rem; background: #12628c; color: white; font-weight: 760; }.primary-button:hover, .new-document-button:hover { background: #0d5174; }.primary-button:disabled { cursor: not-allowed; background: #90a8b8; }.form-message, .quiet-message { min-height: 1.4rem; margin: .85rem 0 0; color: #496173; font-size: .9rem; line-height: 1.4; }.form-message.is-error { color: #aa2c30; }
.danger-button { color: #aa2c30; }.danger-button:hover { color: #7a1e20; }.is-hidden { display: none !important; }
.workspace { display: grid; grid-template-columns: 1fr; min-height: calc(100vh - 44px); background: #d7d9dc; }.document-sidebar { position: fixed; z-index: 80; inset: 44px auto 0 0; width: min(340px, 92vw); padding: 1.4rem; overflow-y: auto; border-width: 0 1px 0 0; background: #f8fafc; box-shadow: .6rem 0 2rem rgb(0 0 0 / 20%); transform: translateX(-105%); transition: transform .16s ease; }.document-sidebar.is-open { transform: translateX(0); }.document-drawer-close { width: 100%; margin-top: .7rem; }.sidebar-heading, .editor-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }.account-name { margin: .35rem 0 0; color: #18334d; font-weight: 720; }.text-button { padding: .35rem; border: 0; background: transparent; color: #336782; font-weight: 700; }.new-document-button { width: 100%; margin: 1rem 0; text-align: left; }.document-list { display: grid; gap: .45rem; }.document-item { display: grid; gap: .25rem; width: 100%; padding: .75rem; border: 1px solid transparent; border-radius: .4rem; background: transparent; color: #1b354b; text-align: left; }.document-item:hover, .document-item.is-selected { border-color: #9cc8dd; background: #e7f4fa; }.document-item-title { overflow: hidden; font-weight: 720; text-overflow: ellipsis; white-space: nowrap; }.document-item-date { color: #617789; font-size: .78rem; }
.editor-panel { margin: 0; border: 0; border-radius: 0; padding: 0; box-shadow: none; }.empty-state { max-width: 31rem; margin: 15vh auto; text-align: center; }.empty-state h2 { margin: .45rem 0 .75rem; color: #18334d; font-family: Georgia, serif; font-size: 2rem; }.empty-state p:not(.eyebrow) { margin-bottom: 1.4rem; color: #596f80; line-height: 1.55; }.editor-toolbar { margin-bottom: 1.5rem; }.editor-field { margin-bottom: 0; }
@media (max-width: 760px) { .topbar { min-height: 62px; padding: 0 1rem; }.mode-label { display: none; }.auth-layout, .workspace { display: block; }.auth-layout { min-height: auto; padding: 2.5rem 1rem; }.auth-intro { margin-bottom: 2.25rem; }.auth-intro h1 { font-size: 2.65rem; }.document-sidebar { border-width: 0 0 1px; }.document-list { max-height: 15rem; overflow: auto; }.editor-panel { margin: 1rem; } }

/* The browser editor is deliberately isolated from the Desktop stylesheet. */
.desktop-editor-page { min-height: calc(100vh - 44px); background: #d7d9dc; }
.desktop-native-toolbar { display: flex; min-height: 42px; align-items: center; gap: 2px; padding: 4px 7px; overflow-x: auto; border-bottom: 1px solid #aeb2b6; background: #f2f2f2; white-space: nowrap; }
.desktop-object-toolbar { border-top: 1px solid #fafafa; }
.desktop-toolbar-button, .desktop-file-menu > summary { min-height: 32px; padding: 5px 9px; border: 1px solid transparent; border-radius: 2px; color: #111; background: transparent; font: inherit; cursor: default; }
.desktop-toolbar-button:hover, .desktop-file-menu > summary:hover { border-color: #9bb9d0; background: #e5f1fa; }
.desktop-toolbar-separator { flex: 0 0 1px; align-self: stretch; margin: 3px 5px; background: #b9bdc0; }
.desktop-toolbar-check { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; color: #222; font-size: .88rem; }
.desktop-file-menu { position: relative; }.desktop-file-menu > summary { display: flex; align-items: center; list-style: none; }.desktop-file-menu > summary::-webkit-details-marker { display: none; }
.desktop-file-menu-items { position: absolute; z-index: 30; top: calc(100% + 2px); left: 0; display: grid; min-width: 220px; padding: 4px; border: 1px solid #999; background: #fff; box-shadow: 0 7px 20px rgb(0 0 0 / 22%); }
.desktop-file-menu-items button { padding: 8px 12px; border: 0; color: #111; background: transparent; text-align: left; }.desktop-file-menu-items button:hover { background: #dcecf7; }
.editor-form > .document-header, .editor-form > .editor-toolbar, .editor-form > .table-toolbar, .editor-form > .editor-scroll, .editor-form > .document-statistics, .editor-form > .zoom-bar, .editor-form > .form-message { margin-right: clamp(.75rem, 2vw, 2rem); margin-left: clamp(.75rem, 2vw, 2rem); }
.editor-form > .document-header { margin-top: 1rem; }
.editor-form > .document-header .document-actions button { display: none; }
.draft-desktop-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 86px); }
.draft-page-list { padding: 8px 0; overflow-y: auto; border-right: 1px solid #adb1b5; background: #f2f3f5; }
.draft-page-list-button { display: block; width: 100%; padding: 11px 13px; border: 0; color: #202020; background: transparent; text-align: left; }.draft-page-list-button:hover, .draft-page-list-button.is-active { background: #dcecf7; }
.draft-page-workspace { min-width: 0; padding: 0 1rem 1rem; overflow: auto; background: #d7d9dc; }.desktop-window-title { margin: .7rem 0 .2rem; color: #333; font-size: 1rem; font-weight: 500; }
.draft-page-header .draft-page-actions, .draft-add-page { display: none; }
.document-header, .document-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.document-header { align-items: flex-end; margin-bottom: 1rem; }.title-field { flex: 1; max-width: 46rem; margin-bottom: 0; }.document-actions { padding-bottom: .1rem; }
.editor-toolbar { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: .55rem; margin-bottom: 0; padding: .55rem; border: 1px solid #c4d3de; border-radius: .55rem; background: #f1f7fb; }
.toolbar-group { display: inline-flex; align-items: center; gap: .15rem; padding-right: .55rem; border-right: 1px solid #cedbe5; }.toolbar-group:last-child { padding-right: 0; border-right: 0; }
.tool-button { min-width: 2.25rem; min-height: 2.25rem; padding: .38rem .5rem; border: 1px solid transparent; border-radius: .35rem; color: #284c63; background: transparent; font-size: .92rem; font-weight: 720; }.tool-button:hover, .tool-button:focus-visible { border-color: #9cc8dd; outline: 0; background: white; }.tool-button-italic { font-family: Georgia, serif; font-size: 1.05rem; font-style: italic; }.tool-button-wide { min-width: auto; font-size: .82rem; }
.toolbar-select { min-height: 2.25rem; padding: .25rem .35rem; border: 1px solid #c4d3de; border-radius: .35rem; color: #284c63; background: white; font-size: .85rem; cursor: pointer; }.toolbar-select:focus { border-color: #2779a5; outline: 0; box-shadow: 0 0 0 2px rgb(39 121 165 / 15%); }.toolbar-select-narrow { min-width: 3.5rem; }
.table-toolbar { margin-top: .45rem; background: #e7f1f7; }.toolbar-info { margin-left: auto; font-size: .82rem; color: #496173; }
.document-page td.cell-selected { background: #c8e2f0; outline: 2px solid #2779a5; outline-offset: -2px; }
.editor-scroll { overflow: auto; min-height: 66vh; margin-top: 1rem; padding: clamp(.5rem, 2vw, 2rem) clamp(.5rem, 2vw, 3rem); border-radius: .5rem; background: #c8d4de; display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
.document-page { box-sizing: border-box; width: 794px; min-height: 1123px; margin: 0 auto; padding: 38px 38px 57px; overflow-wrap: break-word; color: #1c2f3e; background: white; box-shadow: 0 .5rem 2rem rgb(32 58 76 / 18%), 0 0 0 1px rgb(32 58 76 / 6%); font-family: Georgia, "Times New Roman", serif; font-size: 14pt; line-height: 1.5; outline: none; position: relative; }
.document-page figure { max-width: 100%; margin: 1rem 0; }
.document-page img { display: block; max-width: 100%; height: auto; object-fit: contain; }
.document-page:empty::before { content: attr(data-placeholder); color: #8a9aa6; pointer-events: none; }
.document-page h2 { margin: 1.4rem 0 .55rem; color: #133b5b; font-size: 18pt; line-height: 1.2; }
.document-page h3 { margin: 1.2rem 0 .45rem; color: #133b5b; font-size: 15pt; line-height: 1.25; }
.document-page p { min-height: 1.5em; margin: 0 0 .6rem; }
.document-page ul, .document-page ol { margin: 0 0 .8rem; padding-left: 1.8rem; }
.document-page li { margin: 0 0 .2rem; }
.document-page table { width: 100%; margin: 1rem 0; border-collapse: collapse; table-layout: fixed; }
.document-page td, .document-page th { min-width: 3rem; padding: .4rem .5rem; border: 1px solid #50718a; vertical-align: top; font-size: 12pt; }
.document-page th { background: #e7f1f7; }
.page-break { height: 0; margin: 0; padding: 0; border: 0; border-top: 2px dashed #85aabd; break-after: page; page-break-after: always; position: relative; }
.page-break::after { display: block; width: max-content; padding: 0 .5rem; transform: translateY(-.75rem); color: #557083; background: white; font-family: Inter, "Segoe UI", system-ui, sans-serif; font-size: .72rem; }
.page-break[data-page-label]::after { content: attr(data-page-label); }
.formula-chip { display: inline-block; max-width: 100%; margin: .05rem .12rem; padding: .12rem .42rem; overflow-wrap: anywhere; border: 1px solid #8ab5cc; border-radius: .32rem; color: #123f61; background: #edf7fc; font-family: "Cambria Math", "Times New Roman", serif; font-size: .96em; white-space: normal; vertical-align: middle; }
.formula-chip.is-rendered { padding: 2px 4px; border-color: transparent; background: transparent; }
.formula-chip .f-row { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0; line-height: 1; }
.formula-chip .f-text { white-space: nowrap; }
.formula-chip .f-bold { font-weight: 700; }
.formula-chip .f-frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 .15em; }
.formula-chip .f-num, .formula-chip .f-den { display: block; text-align: center; line-height: 1.2; }
.formula-chip .f-num { border-bottom: 1px solid currentColor; padding: 0 .2em .05em; }
.formula-chip .f-den { padding: .05em .2em 0; }
.formula-chip .f-sqrt { display: inline-flex; align-items: stretch; vertical-align: middle; }
.formula-chip .f-sqrt-sign { font-size: 1.1em; line-height: 1; padding-right: .08em; }
.formula-chip .f-sqrt-content { border-top: 1px solid currentColor; padding: .05em .15em 0; }
.formula-chip .f-sqrt-idx { font-size: .6em; vertical-align: super; margin-right: -.3em; }
.formula-chip .f-scripts { display: inline-flex; align-items: baseline; position: relative; }
.formula-chip .f-sub { font-size: .7em; vertical-align: sub; margin-left: .05em; }
.formula-chip .f-sup { font-size: .7em; vertical-align: super; margin-left: .05em; }
.formula-chip .f-limits { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 .1em; }
.formula-chip .f-lim-sup { font-size: .65em; line-height: 1.1; }
.formula-chip .f-lim-sub { font-size: .65em; line-height: 1.1; }
.formula-chip .f-vector { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; }
.formula-chip .f-vec-arrow { font-size: .7em; line-height: .8; }
.formula-chip .f-delim { display: inline-flex; align-items: center; vertical-align: middle; }
.formula-chip .f-delim-open, .formula-chip .f-delim-close { font-size: 1.15em; }
.formula-chip .f-grid { display: inline-flex; align-items: center; vertical-align: middle; }
.formula-chip .f-grid-body { display: inline-flex; flex-direction: column; }
.formula-chip .f-grid-row { display: inline-flex; gap: .3em; }
.formula-chip .f-grid-cell { display: inline-block; text-align: center; min-width: 1em; }.formula-preview { display: block; max-width: 100%; height: auto; vertical-align: middle; }
.insert-dialog { width: min(31rem, calc(100vw - 2rem)); padding: 0; border: 0; border-radius: .75rem; box-shadow: 0 1.5rem 5rem rgb(16 44 66 / 28%); }.insert-dialog::backdrop { background: rgb(10 31 48 / 48%); }.insert-dialog form { display: grid; gap: .8rem; padding: 1.35rem; }.insert-dialog h2 { margin: 0; color: #17314b; font-family: Georgia, serif; font-size: 1.6rem; }.insert-dialog p { margin: 0; color: #516978; line-height: 1.5; }.insert-dialog code { color: #174d70; }.dialog-actions { display: flex; justify-content: flex-end; gap: .65rem; margin-top: .25rem; }.secondary-button { border: 1px solid #a9bdcb; border-radius: .45rem; padding: .72rem .95rem; color: #2f4f63; background: white; font-weight: 700; }.table-size-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }.table-size-fields .field { margin: 0; }
@page { size: A4 portrait; margin: 0; }
@media print { .topbar, .document-sidebar, .document-header, .editor-toolbar, .form-message, .zoom-bar, .document-statistics { display: none !important; }.workspace, .editor-panel, .editor-scroll { display: block; min-height: 0; margin: 0; padding: 0; overflow: visible; background: white; border: 0; box-shadow: none; }.text-editor-pages { display: block !important; width: 210mm !important; min-width: 210mm !important; gap: 0 !important; }.document-page, #editor-form .document-page { box-sizing: border-box; width: 210mm !important; height: 297mm !important; min-height: 297mm !important; margin: 0 !important; padding: 10mm 10mm 15mm !important; overflow: hidden; box-shadow: none; break-after: page; page-break-after: always; }.text-editor-sheet:last-child { break-after: auto; page-break-after: auto; } }
.diagram-dialog { width: min(95vw, 1100px); max-height: 90vh; padding: 0; border: 0; border-radius: .75rem; box-shadow: 0 1.5rem 5rem rgb(16 44 66 / 28%); }.diagram-dialog::backdrop { background: rgb(10 31 48 / 48%); }.diagram-layout { display: grid; grid-template-columns: 200px 1fr; min-height: 500px; }.diagram-sidebar { padding: 1.2rem; border-right: 1px solid #ccd9e5; display: flex; flex-direction: column; gap: .8rem; }.diagram-sidebar h2 { margin: 0; color: #17314b; font-family: Georgia, serif; font-size: 1.2rem; }.diagram-tools { display: flex; flex-wrap: wrap; gap: .3rem; }.diagram-tools .tool-button.is-active { background: #12628c; color: white; border-color: #12628c; }.diagram-actions { display: flex; flex-direction: column; gap: .4rem; margin-top: auto; }.diagram-canvas { width: 100%; background: #f8fafb; cursor: crosshair; border-radius: 0 0 .75rem 0; touch-action: none; }
.diagram-editor-chip, .graph-editor-chip { display: inline-block; max-width: 100%; margin: .3rem 0; border: 1px solid #ccd9e5; border-radius: .35rem; overflow: hidden; cursor: pointer; }.diagram-editor-chip canvas, .graph-editor-chip canvas { display: block; width: 100%; height: auto; }
.graph-dialog { width: min(95vw, 1100px); max-height: 90vh; padding: 0; border: 0; border-radius: .75rem; box-shadow: 0 1.5rem 5rem rgb(16 44 66 / 28%); }.graph-dialog::backdrop { background: rgb(10 31 48 / 48%); }.graph-layout { display: grid; grid-template-columns: 260px 1fr; min-height: 480px; }.graph-sidebar { padding: 1.2rem; border-right: 1px solid #ccd9e5; display: flex; flex-direction: column; gap: .65rem; overflow-y: auto; }.graph-sidebar h2 { margin: 0; color: #17314b; font-family: Georgia, serif; font-size: 1.2rem; }.graph-range-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }.graph-range-fields .field { margin: 0; }.graph-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; }.graph-canvas { width: 100%; background: white; border-radius: 0 0 .75rem 0; }
.glyph-studio-dialog { width: min(96vw, 980px); height: min(94vh, 680px); max-width: none; max-height: none; padding: 0; overflow: hidden; border: 1px solid #8e8e8e; border-radius: .35rem; background: #f3f3f3; box-shadow: 0 1.5rem 5rem rgb(16 44 66 / 28%); }.glyph-studio-dialog::backdrop { background: rgb(10 31 48 / 48%); }.gs-titlebar { display: flex; height: 34px; align-items: center; justify-content: space-between; padding-left: .75rem; border-bottom: 1px solid #c8c8c8; background: #fff; }.gs-titlebar h2 { margin: 0; color: #111; font-size: .92rem; font-weight: 400; }.gs-titlebar button { align-self: stretch; width: 46px; border: 0; background: transparent; color: #222; font-size: 1.35rem; }.gs-titlebar button:hover { color: #fff; background: #c42b1c; }.gs-layout { display: grid; grid-template-columns: 255px minmax(0, 1fr); gap: 12px; height: calc(100% - 34px); padding: 12px; }.gs-sidebar { display: flex; min-width: 0; flex-direction: column; gap: 7px; overflow-y: auto; }.gs-sidebar label { color: #111; font-size: .9rem; font-weight: 400; }.gs-sidebar select { width: 100%; min-height: 31px; }.gs-sidebar .secondary-button { width: 100%; padding: .43rem .65rem; border-color: #adadad; border-radius: 2px; color: #111; font-weight: 400; }.gs-symbol-row, .gs-brush-row { display: flex; align-items: center; gap: 6px; }.gs-symbol-row select, .gs-brush-row input { flex: 1; min-width: 0; }.gs-symbol-row #gs-new-symbol-btn { flex: 0 0 36px; width: 36px; }.gs-brush-row span { flex: 0 0 28px; text-align: right; }.gs-sidebar hr { width: 100%; margin: 0; border: 0; border-top: 1px solid #b8b8b8; }.gs-button-spacer { height: 7px; }.gs-sidebar #gs-draw-hint { margin: 7px 0 0; color: #555; font-size: .84rem; line-height: 1.35; }.gs-sidebar #gs-profiles-btn { margin-top: auto; }.gs-main { display: flex; min-width: 0; flex-direction: column; gap: 8px; }.gs-slots-group { min-width: 0; margin: 0; padding: 7px; border: 1px solid #b8b8b8; }.gs-slots-group legend { padding: 0 .35rem; color: #111; font-size: .88rem; }.gs-slots { display: flex; gap: 3px; overflow-x: auto; }.gs-slot { display: flex; flex: 0 0 61px; flex-direction: column; align-items: center; gap: 2px; min-width: 61px; padding: 3px; border: none; border-radius: 2px; background: #f5f5f5; cursor: pointer; outline: 1px solid #d0d0d0; outline-offset: -1px; }.gs-slot:hover { background: #e5f1fa; }.gs-slot-selected { outline: 2px solid #0078d4; outline-offset: -2px; }.gs-slot-good { outline-color: #2e8b57; }.gs-slot-bad { outline-color: #cc3333; }.gs-slot-empty { outline-color: #d0d0d0; }.gs-slot-num { color: #333; font-size: .69rem; }.gs-slot-thumb { border: 0; background: #fff; }.gs-slot-label { font-size: .64rem; }.gs-label-good { color: #2e8b57; }.gs-label-bad { color: #cc3333; }.gs-label-empty { color: #999; }.gs-canvas-row { display: flex; flex: 1; align-items: center; justify-content: center; overflow: auto; }.gs-canvas { width: 420px; height: 420px; max-width: 100%; border: 1px solid #9c9c9c; background: #fff; cursor: crosshair; touch-action: none; }.gs-status { min-height: 22px; margin: 0; color: #222; font-size: .84rem; }.gs-profiles-dialog { width: min(94vw, 500px); height: min(88vh, 400px); padding: 12px; border: 1px solid #8e8e8e; border-radius: .35rem; background: #f3f3f3; }.gs-profiles-dialog h2 { margin: 0 0 .75rem; color: #111; font-size: 1rem; font-weight: 400; }.gs-profile-list { height: calc(100% - 103px); overflow-y: auto; border: 1px solid #8e8e8e; background: #fff; }.gs-profile-item { display: block; width: 100%; padding: .42rem .55rem; border: 0; background: #fff; color: #111; text-align: left; }.gs-profile-item:hover { background: #e5f1fa; }.gs-profile-item.is-selected { color: #fff; background: #1786d0; }.gs-profile-status { min-height: 28px; max-height: 58px; margin: 5px 0 0; overflow-y: auto; color: #444; font-size: .76rem; white-space: pre-line; }.gs-profile-actions { display: flex; align-items: center; gap: 5px; padding-top: 5px; }.gs-profile-actions .secondary-button, .gs-profile-actions .danger-button { padding: .42rem .65rem; border-radius: 2px; font-weight: 400; }.gs-profile-actions-spacer { flex: 1; }

/* Match the desktop Glyph Studio map inside the available browser viewport. */
.glyph-studio-dialog {
  height: calc(100dvh - 12px);
  max-height: calc(100dvh - 12px);
}
.gs-layout,
.gs-main,
.gs-canvas-row {
  min-height: 0;
}
.gs-sidebar select {
  min-height: 26px;
}
.gs-sidebar .secondary-button {
  min-height: 26px;
  padding: 3px 8px;
  font-size: .9rem;
  line-height: 18px;
}
.gs-sidebar #gs-profiles-btn {
  margin-top: 0;
}
.gs-profiles-dialog {
  display: none;
  width: min(94vw, 570px);
  height: min(88vh, 430px);
  padding: 0;
  overflow: hidden;
}
.gs-profiles-dialog[open] {
  display: flex;
  flex-direction: column;
}
.gs-profile-titlebar {
  display: flex;
  flex: 0 0 34px;
  align-items: center;
  justify-content: space-between;
  padding-left: 12px;
  border-bottom: 1px solid #c8c8c8;
  background: #fff;
}
.gs-profiles-dialog .gs-profile-titlebar h2 {
  margin: 0;
  font-size: .92rem;
}
.gs-profile-titlebar button {
  align-self: stretch;
  width: 46px;
  border: 0;
  background: transparent;
  color: #222;
  font-size: 1.35rem;
}
.gs-profile-titlebar button:hover {
  color: #fff;
  background: #c42b1c;
}
.gs-profile-list {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  margin: 12px 12px 0;
}
.gs-profile-status {
  flex: 0 0 auto;
  min-height: 18px;
  max-height: 38px;
  margin: 4px 12px 0;
}
.gs-profile-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 5px;
  padding: 5px 12px 12px;
  overflow: visible;
}
.gs-profile-actions .secondary-button,
.gs-profile-actions .danger-button {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 3px 8px;
  font-size: .88rem;
  line-height: 18px;
  white-space: nowrap;
}

/* Desktop text-editor map. The document data still comes from New/Open/Draft. */
.desktop-window-caption {
  display: none;
  min-width: 0;
  overflow: hidden;
  color: #111;
  font-size: .84rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.web-window-titlebar {
  display: flex;
  flex: 0 0 29px;
  min-height: 29px;
  align-items: center;
  padding-left: 8px;
  border-bottom: 1px solid #b8b8b8;
  color: #111;
  background: #f4f4f4;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: .88rem;
  font-weight: 400;
}
.web-window-titlebar > span:first-child {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}
.web-window-titlebar > span:first-child::before {
  content: "";
  flex: 0 0 16px;
  width: 16px;
  height: 13px;
  border: 1px solid #8096a5;
  background: linear-gradient(90deg, #d8eef4 0 35%, #fff 35% 100%);
  box-shadow: inset 3px 0 #7db394;
}
.web-window-controls {
  display: flex;
  align-self: stretch;
  margin-left: auto;
}
.web-window-control {
  position: relative;
  display: block;
  align-self: stretch;
  width: 46px;
  min-width: 46px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #111;
  background: transparent;
}
.web-window-control:hover,
.web-window-control:focus-visible {
  outline: 0;
  background: #e2e2e2;
}
.web-window-close:hover,
.web-window-close:focus-visible {
  color: #fff;
  outline: 0;
  background: #c42b1c;
}
.web-window-minimize::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 18px;
  width: 10px;
  border-top: 1px solid currentColor;
}
.web-window-maximize::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 18px;
  width: 10px;
  height: 9px;
  border: 1px solid currentColor;
}
.web-window-maximize.is-restore-icon::before {
  top: 11px;
  left: 16px;
  box-shadow: 3px -3px 0 -1px #f4f4f4, 3px -3px 0 0 currentColor;
}
.web-window-close::before,
.web-window-close::after {
  content: "";
  position: absolute;
  top: 14px;
  left: 17px;
  width: 12px;
  border-top: 1px solid currentColor;
  transform: rotate(45deg);
}
.web-window-close::after {
  transform: rotate(-45deg);
}
body[data-workspace-mode] .topbar {
  height: 24px;
  min-height: 24px;
  justify-content: flex-start;
  padding: 0 8px;
}
body[data-workspace-mode] .topbar .brand,
body[data-workspace-mode] .topbar .topbar-meta {
  display: none;
}
body[data-workspace-mode] .desktop-window-caption {
  display: block;
}
body[data-workspace-mode="editor"] .workspace,
body[data-workspace-mode="editor"] .editor-panel {
  min-height: calc(100dvh - 24px);
}
body[data-workspace-mode="editor"] #editor-form {
  display: flex;
  position: fixed;
  z-index: 40;
  inset: 0;
  height: 100dvh;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}
body[data-workspace-mode="draft"] #editor-form {
  display: flex;
  position: fixed;
  z-index: 40;
  inset: 0;
  height: 100dvh;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}
body[data-workspace-mode="draft"] #draft-view-panel {
  display: flex;
  position: fixed;
  z-index: 50;
  inset: 0;
  height: 100dvh;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}
body[data-workspace-mode="draft"] #draft-view-panel > .desktop-native-toolbar {
  flex: 0 0 auto;
}
body[data-workspace-mode="draft"] .draft-desktop-layout {
  flex: 1 1 auto;
  min-height: 0;
}
body[data-workspace-mode="editor"] #editor-form.is-windowed,
body[data-workspace-mode="draft"] #editor-form.is-windowed,
body[data-workspace-mode="draft"] #draft-view-panel.is-windowed {
  inset: clamp(20px, 5vh, 56px) clamp(20px, 5vw, 96px);
  width: auto;
  height: auto;
  border: 1px solid #777;
  box-shadow: 0 18px 55px rgb(0 0 0 / 34%);
}
body[data-workspace-mode="editor"] #editor-form.is-minimized,
body[data-workspace-mode="draft"] #editor-form.is-minimized,
body[data-workspace-mode="draft"] #draft-view-panel.is-minimized {
  inset: auto auto 3px 7px;
  width: 147px;
  height: 27px;
  min-height: 27px;
  border: 1px solid #929292;
  border-radius: 7px;
  background: #f4f4f4;
  box-shadow: 0 2px 7px rgb(0 0 0 / 24%);
}
body:has(#editor-form.is-minimized) #draft-view-panel.is-minimized {
  left: 161px;
}
.desktop-editor-page.is-minimized > :not(.web-window-titlebar) {
  display: none !important;
}
.desktop-editor-page.is-minimized .web-window-titlebar {
  flex-basis: 25px;
  min-height: 25px;
  padding-left: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
}
.desktop-editor-page.is-minimized .web-window-titlebar > span:first-child {
  width: 47px;
  flex: 0 0 47px;
  gap: 0;
  overflow: hidden;
  color: transparent;
  font-size: 0;
}
.desktop-editor-page.is-minimized .web-window-minimize {
  display: none;
}
.desktop-editor-page.is-minimized .web-window-controls {
  margin-left: 0;
}
.desktop-editor-page.is-minimized .web-window-control {
  width: 46px;
  min-width: 46px;
}
.desktop-editor-page.is-minimized .web-window-maximize::before {
  top: 8px;
  left: 18px;
}
.desktop-editor-page.is-minimized .web-window-close::before,
.desktop-editor-page.is-minimized .web-window-close::after {
  top: 12px;
  left: 17px;
}
#editor-form > .desktop-native-toolbar {
  flex: 0 0 34px;
  min-height: 34px;
  gap: 1px;
  padding: 2px 7px;
  overflow-x: auto;
}
body[data-workspace-mode="editor"] .desktop-toolbar-button {
  min-height: 28px;
  padding: 3px 6px;
  font-size: .88rem;
}
.desktop-toolbar-button:disabled {
  color: #8a8a8a;
}
.desktop-toolbar-field {
  flex: 0 0 auto;
  color: #111;
  font-size: .88rem;
  font-weight: 400;
}
.desktop-toolbar-select {
  flex: 0 0 auto;
  height: 27px;
  min-width: 68px;
  padding: 1px 24px 1px 7px;
  border: 1px solid #9da5ab;
  border-radius: 2px;
  color: #111;
  background: #fff;
  font-size: .88rem;
}
.desktop-alignment-select {
  width: 132px;
}
.desktop-numbering-toolbar {
  position: relative;
  z-index: 110;
  overflow: visible !important;
  border-top: 1px solid #fafafa;
}
.desktop-numbering-select {
  width: 510px;
}
.desktop-numbering-menu {
  position: relative;
  flex: 0 0 auto;
}
.desktop-numbering-menu > summary {
  display: flex;
  align-items: center;
  width: 510px;
  cursor: default;
  list-style: none;
}
.desktop-numbering-menu > summary::-webkit-details-marker {
  display: none;
}
.desktop-numbering-menu > summary::after {
  content: "▾";
  margin-left: auto;
  color: #333;
}
.desktop-numbering-popup {
  position: absolute;
  z-index: 120;
  top: calc(100% + 1px);
  left: 0;
  width: 510px;
  padding: 2px 0;
  border: 1px solid #888;
  background: #f7f7f7;
  box-shadow: 2px 3px 7px rgb(0 0 0 / 18%);
}
.desktop-numbering-popup button,
.desktop-numbering-popup label {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 27px;
  margin: 0;
  padding: 3px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111;
  font: inherit;
  font-size: .88rem;
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
}
.desktop-numbering-popup button:hover,
.desktop-numbering-popup label:hover {
  background: #e3e3e3;
}
.desktop-numbering-popup input {
  width: 18px;
  height: 18px;
  margin: 0 8px 0 0;
  padding: 0;
}
.desktop-numbering-separator {
  height: 1px;
  margin: 3px 0;
  background: #aaa;
}
body[data-workspace-mode="editor"] #empty-document-state,
body[data-workspace-mode="editor"] #editor-form > .document-header,
body[data-workspace-mode="editor"] #editor-form > #editor-toolbar,
body[data-workspace-mode="editor"] #editor-form > #table-toolbar,
body[data-workspace-mode="editor"] #editor-form > .document-statistics,
body[data-workspace-mode="editor"] #editor-form > .zoom-bar,
body[data-workspace-mode="editor"] #editor-form > .form-message {
  display: none !important;
}
body[data-workspace-mode="editor"] #editor-form > .editor-scroll {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 22px 20px;
  border-radius: 0;
  background: #d7d9dc;
}
#editor-form .text-editor-pages {
  display: flex;
  flex: 0 0 auto;
  width: 794px;
  min-width: 794px;
  flex-direction: column;
  gap: 22px;
  margin: 0 auto;
  color: #111;
  font-family: Arial, "Segoe UI", sans-serif;
  font-size: 16pt;
  line-height: 1.5;
  outline: none;
}
#editor-form .document-page {
  width: 794px;
  height: 1123px;
  min-height: 1123px;
  padding: 38px 38px 57px;
  overflow: hidden;
  color: #111;
  box-shadow: 6px 5px 0 rgb(0 0 0 / 12%), 0 0 0 1px #aeb2b6;
  font-family: Arial, "Segoe UI", sans-serif;
  font-size: inherit;
  line-height: 1.5;
}
#editor-form .text-editor-sheet > hr.page-break { display: none; }
#editor-form .text-editor-sheet::after {
  position: absolute;
  right: 38px;
  bottom: 18px;
  left: 38px;
  content: attr(data-page-number);
  color: #111;
  font-size: 12pt;
  text-align: var(--page-number-align, center);
}
#editor-form .document-page:empty::before {
  content: "";
}
@media (max-width: 760px) { .editor-panel { margin: .75rem; padding: .75rem; }.document-header { align-items: stretch; flex-direction: column; }.document-actions { justify-content: space-between; }.editor-toolbar { gap: .3rem; }.toolbar-group { gap: 0; padding-right: .25rem; }.tool-button { min-width: 2.1rem; min-height: 2.1rem; }.tool-button-wide { padding: .34rem .42rem; font-size: .74rem; }.editor-scroll { min-height: 65vh; margin-top: .75rem; padding: .35rem; }.document-page { width: 100%; min-height: auto; padding: 15mm 10mm; font-size: 12pt; }.document-page table { font-size: .9em; }.page-break { margin: 0; }.diagram-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }.diagram-canvas { max-height: 60vh; } }

/* Handwriting editor */
body[data-workspace-mode] .topbar { min-height: 44px; padding: 0 1rem; color: #111; background: #f2f2f2; border-bottom: 1px solid #a6a6a6; }
body[data-workspace-mode] .brand-mark { width: 1.75rem; height: 1.75rem; color: #244d78; border-color: #607d99; }
body[data-workspace-mode] .brand { color: #111; font-size: 1rem; }
body[data-workspace-mode] .mode-label { color: #333; }
body[data-workspace-mode] .topbar-link { display: none; }
.workspace-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1rem; padding-bottom: .8rem; border-bottom: 1px solid #d3e0e8; }
.workspace-heading h2 { margin: .2rem 0 0; color: #18334d; font-family: Georgia, serif; }.workspace-heading > p { max-width: 38rem; margin: 0; color: #596f80; line-height: 1.45; }
.handwriting-desktop-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); min-height: calc(100vh - 12rem); margin: 0 calc(-1 * clamp(1.25rem, 3vw, 2.6rem)) calc(-1 * clamp(1.25rem, 3vw, 2.6rem)); border-top: 1px solid #b7c3cc; }
.workspace.handwriting-mode { grid-template-columns: 1fr; }.workspace.handwriting-mode > .editor-panel { margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; }.workspace.handwriting-mode .handwriting-desktop-layout { min-height: calc(100vh - 44px); margin: 0; border-top: 0; }
.handwriting-control-panel { display: flex; flex-direction: column; gap: .45rem; max-height: calc(100vh - 10rem); padding: .8rem; overflow-y: auto; border-right: 1px solid #aeb9c1; background: #f5f5f5; }
.desktop-control-button { min-height: 2.45rem; padding: .45rem .65rem; border: 1px solid #aeb3b8; border-radius: .18rem; color: #111; background: linear-gradient(#fff, #f1f1f1); font-size: .92rem; text-align: center; }
.desktop-control-button:hover:not(:disabled) { border-color: #6f9fc4; background: #edf6fc; }.desktop-control-button:active:not(:disabled) { background: #dcecf7; }.desktop-control-button:disabled { color: #8a8a8a; cursor: default; }
.desktop-primary-button { font-weight: 700; }
.desktop-control-row { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.desktop-control-group { display: grid; gap: .45rem; margin: .15rem 0; padding: .65rem .5rem .5rem; border: 1px solid #c5c9cc; }.desktop-control-group legend { padding: 0 .35rem; color: #222; font-size: .88rem; }
.desktop-control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }.desktop-preview-row { display: grid; grid-template-columns: 1.4fr .75fr .75fr; gap: .4rem; }
.desktop-slider-label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .5rem; }.desktop-slider-label input { min-width: 0; padding: 0; border: 0; box-shadow: none; }
.handwriting-settings-illustration { display: grid; min-height: 10rem; place-items: center; padding: 1rem; overflow: hidden; color: #e7f0f7; background: radial-gradient(circle at 58% 30%, #bd6f2e, #41291d 48%, #14191d 80%); text-align: center; }.handwriting-settings-illustration span { font-family: Georgia, serif; font-size: 4.5rem; font-style: italic; text-shadow: 0 0 20px #ffc978; }.handwriting-settings-illustration small { align-self: end; color: #fff1d5; }
.handwriting-page-area { min-width: 0; min-height: 42rem; padding: 1rem; overflow: auto; background: #d7d7d7; }
.handwriting-page-toolbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: center; gap: .45rem; max-width: 42rem; margin: 0 auto .75rem; padding: .45rem; border: 1px solid #afb9c0; border-radius: .35rem; background: rgb(245 245 245 / 94%); }
.handwriting-settings-popover { position: fixed; z-index: 60; top: 6rem; left: min(350px, 25vw); display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: .6rem; width: min(42rem, calc(100vw - 2rem)); max-height: calc(100vh - 8rem); padding: 1rem; overflow-y: auto; border: 1px solid #8c9aa4; border-radius: .4rem; background: #f5f5f5; box-shadow: 0 1rem 3rem rgb(0 0 0 / 25%); }
.desktop-status { min-height: 1.3rem; margin: .2rem 0 0; color: #43586c; font-size: .78rem; line-height: 1.35; }
.handwriting-empty-hint { margin-top: 28vh; color: #737373; text-align: center; }
.hw-editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .5rem; border: 1px solid #c4d3de; border-radius: .55rem; background: #f1f7fb; margin-bottom: .75rem; }
.toolbar-sep { color: #c4d3de; margin: 0 .15rem; }
.hw-editor-container { min-height: 100%; padding: 0; background: transparent; text-align: center; }
.hw-page-wrapper { box-shadow: 0 .5rem 2rem rgb(32 58 76 / 18%); margin: 0 auto; }
.hw-correction-canvas { pointer-events: auto; }
@media (max-width: 900px) { .workspace-heading { align-items: flex-start; flex-direction: column; gap: .45rem; } }
@media (max-width: 800px) { .handwriting-desktop-layout { grid-template-columns: 1fr; }.handwriting-control-panel { max-height: none; border-right: 0; border-bottom: 1px solid #aeb9c1; }.handwriting-page-area { min-height: 34rem; }.handwriting-settings-popover { left: 1rem; grid-template-columns: 1fr; } }
@media (max-width: 800px) { .draft-desktop-layout { grid-template-columns: 1fr; }.draft-page-list { display: flex; max-width: 100vw; overflow-x: auto; border-right: 0; border-bottom: 1px solid #adb1b5; }.draft-page-list-button { width: auto; min-width: 9rem; }.desktop-native-toolbar { align-items: stretch; }.desktop-toolbar-check { min-width: max-content; } }

/* The handwriting viewport shares the text editor's 794 x 1123 A4 scale. */
body[data-workspace-mode="handwriting"] { overflow: hidden; }
body[data-workspace-mode="handwriting"] .handwriting-desktop-layout {
  grid-template-columns: 330px minmax(0, 1fr); height: calc(100dvh - 44px); min-height: 0;
}
body[data-workspace-mode="handwriting"] .handwriting-control-panel {
  min-height: 0; max-height: none; padding: 14px; gap: 7px;
}
body[data-workspace-mode="handwriting"] .desktop-control-button {
  min-height: 30px; padding: 4px 8px; font: 14px "Segoe UI", Arial, sans-serif; white-space: nowrap;
}
body[data-workspace-mode="handwriting"] .desktop-preview-row { grid-template-columns: minmax(0, 1.6fr) 1fr 1fr; }
body[data-workspace-mode="handwriting"] .handwriting-page-area {
  min-height: 0; height: 100%; padding: 12px 16px; overflow: auto; background: #d7d7d7;
}
body[data-workspace-mode="handwriting"] .handwriting-page-toolbar { display: none; }
body[data-workspace-mode="handwriting"] .hw-editor-container {
  display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 100%; width: max-content; min-width: 100%;
}
body[data-workspace-mode="handwriting"] .hw-page-wrapper {
  flex: none; margin: 0; background: white; box-shadow: 1px 2px 0 #aaa; overflow: hidden;
}
body[data-workspace-mode="handwriting"] img.handwriting-settings-illustration {
  display: block; width: 100%; height: auto; min-height: 0; padding: 0;
}

body[data-workspace-mode="handwriting"] .mode-label { display: none; }
#handwriting-status:empty { display: none; }
body[data-workspace-mode="handwriting"] img.handwriting-settings-illustration {
  flex: 0 0 auto; object-fit: contain;
}

/* A minimized text window exposes the handwriting viewport, not a long body. */
#hw-editor-panel { display: none !important; }
body[data-workspace-mode="handwriting"] { height: 100dvh; margin: 0; overflow: hidden; }
body[data-workspace-mode="handwriting"] .topbar { display: none; }
body[data-workspace-mode="handwriting"] .shell,
body[data-workspace-mode="handwriting"] #workspace,
body[data-workspace-mode="handwriting"] #editor-panel,
body[data-workspace-mode="handwriting"] #handwriting-workspace {
 height: 100%; min-height: 0; margin: 0; padding: 0; overflow: hidden;
}
body[data-workspace-mode="handwriting"] .handwriting-desktop-layout { height: 100%; min-height: 0; }
body[data-workspace-mode="handwriting"] .handwriting-page-area { overscroll-behavior: contain; }
body[data-workspace-mode="handwriting"] .hw-editor-container { gap: 22px; background: #d7d7d7; }
body[data-workspace-mode="handwriting"] .hw-page-wrapper { outline: 1px solid #b0b0b0; }

/* Scroll the whole sidebar content when its controls exceed the panel width. */
body[data-workspace-mode="handwriting"] .handwriting-control-panel {
  display: block; min-width: 0; overflow: auto; overscroll-behavior: contain;
}
.handwriting-control-content {
  display: flex; flex-direction: column; gap: 7px;
  width: max-content; min-width: 100%;
}
.handwriting-control-content > * { flex-shrink: 0; }
body[data-workspace-mode="handwriting"] .handwriting-control-content .desktop-preview-row {
  grid-template-columns: max-content minmax(64px, 1fr) minmax(64px, 1fr);
}
.handwriting-control-content img.handwriting-settings-illustration {
  align-self: stretch; width: 0; min-width: 100%;
}

/* qt_editor.py: splitter 325, panel margins 14/14/14/16, spacing 7, Segoe UI 10pt. */
body[data-workspace-mode="handwriting"] .handwriting-desktop-layout {
  grid-template-columns: 325px minmax(0, 1fr);
}
body[data-workspace-mode="handwriting"] .handwriting-control-panel {
  padding: 14px 14px 16px; font: 10pt "Segoe UI", sans-serif;
}
body[data-workspace-mode="handwriting"] .handwriting-control-content {
  width: 310px; min-width: 100%; gap: 7px;
}
body[data-workspace-mode="handwriting"] .handwriting-control-content .desktop-control-button {
  height: 26px; min-height: 26px; padding: 2px 7px;
  font: 10pt "Segoe UI", sans-serif; line-height: normal; border-radius: 2px;
}
body[data-workspace-mode="handwriting"] .handwriting-control-content .desktop-control-group {
  margin: 0; padding: 8px 10px 10px; gap: 7px;
}
body[data-workspace-mode="handwriting"] .handwriting-control-content legend {
  font: 10pt "Segoe UI", sans-serif; padding: 0 3px;
}
body[data-workspace-mode="handwriting"] .handwriting-control-content .desktop-control-grid,
body[data-workspace-mode="handwriting"] .handwriting-control-content .desktop-control-row { gap: 7px; }
body[data-workspace-mode="handwriting"] .handwriting-control-content .desktop-preview-row {
  grid-template-columns: minmax(max-content, 1.6fr) minmax(64px, 1fr) minmax(64px, 1fr); gap: 7px;
}
body[data-workspace-mode="handwriting"] .handwriting-control-content img.handwriting-settings-illustration {
  width: 100%; min-width: 0; max-width: 100%; height: auto; object-fit: contain;
}
body[data-workspace-mode="handwriting"] .handwriting-control-content .desktop-slider-label { font: 10pt "Segoe UI", sans-serif; }

/* Qt Glyph Studio: logical pixel dimensions from qt_glyph_studio.py. */
.glyph-studio-dialog { width: min(980px, calc(100vw - 12px)); height: min(710px, calc(100dvh - 12px)); max-height: calc(100dvh - 12px); background: #f0f0f0; font: 13.3333px "Segoe UI", sans-serif; color: #000; }
.gs-titlebar { height: 30px; padding-left: 12px; border-bottom: 0; background: #f5f4f2; }
.gs-titlebar h2 { font: inherit; }
.gs-window-controls { display: flex; height: 30px; }
.gs-titlebar .gs-window-controls button { display: grid; place-items: center; width: 46px; height: 30px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; }
.gs-titlebar button:hover { color: #000; background: #e3e3e3; }
.gs-titlebar #gs-close-btn:hover { color: white; background: #c42b1c; }
.gs-icon-minimize { width: 10px; height: 1px; background: currentColor; }
.gs-icon-maximize { width: 10px; height: 10px; border: 1px solid currentColor; border-radius: 1px; }
.gs-icon-close { position: relative; width: 14px; height: 14px; }
.gs-icon-close::before,.gs-icon-close::after { content: ""; position: absolute; left: 6px; top: 0; height: 14px; width: 1px; background: currentColor; transform: rotate(45deg); }
.gs-icon-close::after { transform: rotate(-45deg); }
.gs-layout { height: calc(100% - 30px); grid-template-columns: 255px minmax(0,1fr); padding: 12px; gap: 12px; overflow: auto; }
.gs-sidebar { gap: 7px; }
.gs-sidebar label,.gs-sidebar select,.gs-sidebar .secondary-button,.gs-slots-group legend,.gs-slot-num,.gs-slot-label,.gs-status,.gs-sidebar #gs-draw-hint { font: inherit; color: inherit; }
.gs-sidebar label { line-height: 20px; }
.gs-sidebar select,.gs-sidebar .secondary-button { box-sizing: border-box; height: 26px; min-height: 26px; padding: 2px 5px; line-height: 20px; }
.gs-sidebar select { background: linear-gradient(#fff,#ececec); }
.gs-sidebar .secondary-button { background: linear-gradient(#fff,#ececec); }
.gs-sidebar hr { height: 2px; margin: 0; }
.gs-brush-row { height: 28px; flex-shrink: 0; }
.gs-brush-row input { padding: 0; margin: 0; height: 20px; min-height: 0; }
.gs-sidebar #gs-draw-hint { margin: 7px 0 0; line-height: 18px; color: #555; }
.gs-sidebar #gs-profiles-btn { margin-top: 10px; }
.gs-slots-group { height: 136px; flex-shrink: 0; padding: 7px; border-color: #d5d5d5; }
.gs-slots-group legend { padding: 0; line-height: 20px; }
.gs-slots { gap: 3px; }
.gs-slot { flex: 0 0 62px; min-width: 62px; padding: 2px; gap: 2px; outline: none; border: 0; background: transparent; border-radius: 0; }
.gs-slot-num,.gs-slot-label { line-height: 20px; }
.gs-slot-label { width: 58px; text-align: center; }
.gs-slot-thumb { width: 54px; height: 54px; box-sizing: border-box; border: 2px solid #ccc; }
.gs-slot-good .gs-slot-thumb { border-color: #2e8b57; }
.gs-slot-bad .gs-slot-thumb { border-color: #c33; }
.gs-slot-selected .gs-slot-thumb { border-color: #0078d4; }
.gs-canvas-row { align-items: flex-start; }
.gs-canvas { flex: 0 0 420px; width: 420px; height: 420px; max-width: none; }
.gs-status { min-height: 22px; }
.glyph-studio-dialog.gs-maximized { width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
.glyph-studio-dialog.gs-minimized { position: fixed; inset: auto auto 0 12px; margin: 0; width: 330px; height: 32px; z-index: 100; }
.gs-minimized .gs-layout { display: none; }
.gs-minimized .gs-titlebar h2 { cursor: pointer; }

/* Same compact minimized frame as the Desktop text and draft windows. */
.glyph-studio-dialog.gs-minimized { inset: auto auto 3px 7px; width: 147px; height: 27px; min-height: 27px; padding: 0; border: 1px solid #929292; border-radius: 7px; background: #f4f4f4; box-shadow: 0 2px 7px rgb(0 0 0 / 24%); }
.gs-minimized .gs-titlebar { height: 25px; min-height: 25px; padding-left: 7px; border: 0; border-radius: 6px; overflow: hidden; }
.gs-minimized .gs-titlebar h2 { position: relative; flex: 0 0 47px; width: 47px; height: 25px; margin: 0; overflow: hidden; font-size: 0; }
.gs-minimized .gs-titlebar h2::before { content: ""; position: absolute; top: 6px; left: 0; width: 14px; height: 12px; border: 1px solid #929292; background: linear-gradient(90deg,#9fc8b2 0 30%,#f8f8f8 30%); box-shadow: inset 0 2px white; }
.gs-minimized #gs-minimize-btn { display: none; }
.gs-minimized .gs-window-controls { height: 25px; margin-left: 0; }
.gs-minimized .gs-window-controls button { width: 46px; min-width: 46px; height: 25px; }
body:has(#editor-form.is-minimized) .glyph-studio-dialog.gs-minimized,
body:has(#draft-view-panel.is-minimized) .glyph-studio-dialog.gs-minimized { left: 161px; }
body:has(#editor-form.is-minimized):has(#draft-view-panel.is-minimized) .glyph-studio-dialog.gs-minimized { left: 315px; }

.desktop-system-menu { position: fixed; inset: auto; z-index: 10000; width: 190px; margin: 0; padding: 3px 0; border: 1px solid #ccc; border-radius: 4px; background: #f8f8f8; color: #111; box-shadow: 2px 3px 6px #0003; font: 12px "Segoe UI",sans-serif; }
.desktop-system-menu[hidden] { display: none !important; }
.desktop-system-menu button { display: block; width: 100%; height: 24px; padding: 2px 12px 2px 36px; border: 0; border-radius: 0; background: transparent; color: inherit; text-align: left; font: inherit; }
.desktop-system-menu button:disabled { color: #aaa; }
.desktop-system-menu button:not(:disabled):hover,.desktop-system-menu button:focus-visible { background: #dceafa; outline: 0; }
.desktop-system-menu .system-menu-close { border-top: 1px solid #ddd; margin-top: 3px; }
.desktop-editor-page.is-minimized > .desktop-system-menu:not([hidden]) { display: block !important; }

/* Desktop minimized window icon: application tile with overlapping windows. */
.desktop-editor-page.is-minimized .web-window-titlebar > span:first-child,
.gs-minimized .gs-titlebar h2 { position: relative; }
.desktop-editor-page.is-minimized .web-window-titlebar > span:first-child::before,
.gs-minimized .gs-titlebar h2::before { position: relative; top: auto; left: auto; z-index: 1; display: block; width: 14px; height: 12px; flex: 0 0 14px; border: 1px solid #929292; background: linear-gradient(90deg,#9fc8b2 0 30%,#f8f8f8 30%); box-shadow: inset 0 2px white; }
.gs-minimized .gs-titlebar h2::before { position: absolute; top: 6px; left: 0; }
.desktop-editor-page.is-minimized .web-window-titlebar > span:first-child::after,
.gs-minimized .gs-titlebar h2::after { content: ""; position: absolute; left: 16px; top: calc(50% - 4px); width: 7px; height: 6px; border: 1px solid #929292; border-radius: 1px; background: #f4f4f4; box-shadow: -2px 2px 0 #f4f4f4, -3px 3px 0 #929292; }

/* Separate native-style actions: app menu and restore are independent buttons. */
.minimized-icon-actions { display: none; }
.gs-minimized .gs-titlebar,.desktop-editor-page.is-minimized .web-window-titlebar { position: relative; }
.gs-minimized .minimized-icon-actions,.desktop-editor-page.is-minimized .minimized-icon-actions { position: absolute; left: 7px; top: 0; height: 25px; display: flex; align-items: center; gap: 0; }
.gs-minimized .gs-titlebar h2::before,.gs-minimized .gs-titlebar h2::after,
.desktop-editor-page.is-minimized .web-window-titlebar > span:first-child::before,
.desktop-editor-page.is-minimized .web-window-titlebar > span:first-child::after { visibility: hidden; }
.minimized-icon-actions button { position: relative; display: block; align-self: center; width: 16px; height: 20px; min-width: 0; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; color: #111; }
.minimized-icon-actions .minimized-restore-icon { width: 12px; }
.minimized-icon-actions button:focus-visible { outline: 1px solid #0078d4; }
.minimized-system-icon::before { content: ""; position: absolute; left: 0; top: 3px; width: 14px; height: 12px; border: 1px solid #929292; background: linear-gradient(90deg,#9fc8b2 0 30%,#f8f8f8 30%); box-shadow: inset 0 2px white; }
.minimized-restore-icon::before { content: ""; position: absolute; left: 2px; top: 5px; width: 7px; height: 6px; border: 1px solid #555; border-radius: 1px; background: #f4f4f4; box-shadow: -2px 2px 0 #f4f4f4,-3px 3px 0 #555; }

/* QtUserGuideWindow: 940x700 client area, Segoe UI 18pt heading / 11pt body. */
.help-dialog { width: min(940px,calc(100vw - 12px)); height: min(730px,calc(100dvh - 12px)); max-height: calc(100dvh - 12px); font: 13.3333px "Segoe UI",sans-serif; color: #000; background: #f0f0f0; }
.help-dialog[open] { display: flex; flex-direction: column; }
.help-titlebar { flex: 0 0 30px; }
.help-titlebar h2 { font: 13.3333px "Segoe UI",sans-serif; }
.help-header { padding: 10px 9px 6px; }
.help-header h2 { font: bold 24px "Segoe UI",sans-serif; line-height: 32px; }
.help-header p { margin: 7px 0 0; font: 13.3333px "Segoe UI",sans-serif; line-height: 18px; color: #4a5568; }
.help-layout { flex: 1; min-height: 0; height: auto; grid-template-columns: 255px minmax(0,1fr); gap: 4px; margin: 0 9px; border: 0; background: transparent; }
.help-nav { border: 1px solid #b5b5b5; }
.help-nav-item { flex-shrink: 0; min-height: 18px; height: 18px; padding: 0 3px; font: 13.3333px/18px "Segoe UI",sans-serif; }
.help-content { padding: 4px; border: 1px solid #b5b5b5; }
.help-section h3 { margin: 0 0 32px; color: #1f4f82; font: bold 24px/32px "Segoe UI",sans-serif; }
.help-section h4 { margin: 0; font: bold 14.6667px/20px "Segoe UI",sans-serif; }
.help-section p { margin: 0 0 20px; font: 14.6667px/20px "Segoe UI",sans-serif; }
.help-footer { padding: 7px 9px 8px; gap: 7px; }
.help-template-actions { gap: 7px; }
.help-footer .secondary-button { height: 26px; min-height: 26px; padding: 2px 6px; border: 1px solid #aaa; border-radius: 2px; background: linear-gradient(white,#ececec); color: #000; font: 13.3333px/20px "Segoe UI",sans-serif; }
.help-footer #close-help { min-width: 80px; }
.help-dialog.gs-maximized { width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
.help-dialog.gs-minimized { position: fixed; inset: auto auto 3px 7px; width: 147px; height: 27px; min-height: 27px; margin: 0; border-radius: 7px; z-index: 101; }
.help-dialog.gs-minimized > :not(.help-titlebar):not(.desktop-system-menu) { display: none; }
.help-dialog.gs-minimized .help-titlebar { flex: 0 0 25px; }
.help-titlebar #help-close-btn:hover { background: #c42b1c; color: white; }
.help-dialog.gs-minimized #help-minimize-btn { display: none; }
body:has(.gs-minimized:not(#help-dialog),.is-minimized) .help-dialog.gs-minimized { left: auto; right: 7px; }

/* Qt text editor: 1100x760 client area; native 10pt Segoe UI controls. */
body[data-workspace-mode="editor"] { height: 100dvh; overflow: hidden; }
body[data-workspace-mode="editor"] #editor-form.is-windowed:not(.is-minimized) { inset: 0 auto auto 7px; width: min(1100px,calc(100vw - 14px)); height: min(790px,100dvh); border: 1px solid #aaa; border-radius: 7px; }
#editor-form .web-window-titlebar { flex: 0 0 30px; height: 30px; min-height: 30px; font: 13.3333px "Segoe UI",sans-serif; }
#editor-form .web-window-control { width: 46px; min-width: 46px; }
#editor-form .web-window-minimize::before { top: 15px; }
#editor-form .web-window-maximize::before { top: 10px; }
#editor-form .web-window-close::before,#editor-form .web-window-close::after { top: 15px; }
#editor-form > .desktop-native-toolbar { height: 34px; min-height: 34px; flex: 0 0 34px; padding: 2px 7px; gap: 1px; background: linear-gradient(#fafafa,#efefef); }
#editor-form .desktop-toolbar-button { font: 13.3333px/20px "Segoe UI",sans-serif; min-height: 28px; padding: 3px 6px; }
#editor-form .desktop-toolbar-field { font: 13.3333px/20px "Segoe UI",sans-serif; }
#editor-form .desktop-toolbar-select { font: 13.3333px/20px "Segoe UI",sans-serif; height: 26px; padding: 2px 5px; background: linear-gradient(white,#ececec); }
#editor-form .desktop-numbering-select,#editor-form .desktop-numbering-menu > summary,#editor-form .desktop-numbering-popup { width: 340px; max-width: calc(100vw - 100px); }
#editor-form.is-minimized .web-window-titlebar { height: 25px; min-height: 25px; flex-basis: 25px; }
#editor-form.is-minimized .web-window-maximize::before { top: 8px; }
#editor-form.is-minimized .web-window-close::before,#editor-form.is-minimized .web-window-close::after { top: 12px; }

#editor-form .desktop-numbering-popup label { min-width: 0; overflow: hidden; }
#editor-form .desktop-numbering-popup label span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#editor-form .desktop-numbering-popup input { flex: 0 0 18px; }
#editor-form > .desktop-object-toolbar { position: relative; overflow: hidden; }
.desktop-toolbar-more { position: absolute; right: 0; top: 0; bottom: 0; width: 20px; padding: 0; border: 0; background: #f0f0f0; color: #444; font: 18px "Segoe UI",sans-serif; }
.desktop-toolbar-more[hidden],.desktop-toolbar-overflow[hidden] { display: none; }
.desktop-toolbar-overflow { position: fixed; inset: auto; margin: 0; padding: 6px; max-width: calc(100vw - 10px); max-height: calc(100dvh - 50px); overflow: auto; border: 1px solid #999; background: #f0f0f0; box-shadow: 2px 3px 6px #0003; z-index: 200; }
.desktop-toolbar-overflow > * { display: block; margin: 3px 0; }
.desktop-toolbar-overflow .desktop-toolbar-separator { height: 1px; width: 100%; }

/* Text editor caption uses the same 46x30 controls as Glyph Studio and Guide. */
#editor-form .web-window-controls { height: 30px; }
#editor-form .web-window-controls .web-window-control { box-sizing: border-box; flex: 0 0 46px; width: 46px; height: 30px; min-height: 0; margin: 0; padding: 0; border: 0; }
#editor-form .web-window-minimize::before { top: 15px; left: 18px; width: 10px; }
#editor-form .web-window-maximize::before { box-sizing: border-box; top: 10px; left: 18px; width: 10px; height: 10px; border-radius: 1px; }
#editor-form .web-window-maximize.is-restore-icon::before { top: 11px; left: 17px; width: 8px; height: 8px; box-shadow: 2px -2px 0 -1px #f4f4f4,2px -2px 0 0 currentColor; }
#editor-form .web-window-close::before,#editor-form .web-window-close::after { top: 8px; left: 22px; width: 1px; height: 14px; border: 0; background: currentColor; }
#editor-form.is-minimized .web-window-controls,#editor-form.is-minimized .web-window-controls .web-window-control { height: 25px; }
#editor-form.is-minimized .web-window-maximize::before { top: 8px; }
#editor-form.is-minimized .web-window-close::before,#editor-form.is-minimized .web-window-close::after { top: 5px; }

/* The Desktop editor has one toolbar set, independent of the parent workspace. */
#editor-form > .document-header,
#editor-form > #editor-toolbar,
#editor-form > #table-toolbar,
#editor-form > .document-statistics,
#editor-form > .zoom-bar { display: none !important; }
#editor-form > .editor-scroll { flex: 1 1 auto; min-height: 0; margin: 0; padding: 22px 20px; border-radius: 0; background: #d7d9dc; }

/* Qt SettingControl: label, expanding slider, 72px spinbox; 7px spacing. */
#handwriting-settings { display: flex; flex-direction: column; gap: 6px; width: min(460px,calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 8px; overflow-x: hidden; overflow-y: auto; border: 1px solid #999; border-radius: 0; background: #f0f0f0; color: #000; font: 13.3333px "Segoe UI",sans-serif; }
#handwriting-settings.is-hidden { display: none; }
#handwriting-settings .field { display: grid; grid-template-columns: minmax(110px,155px) minmax(0,1fr) 72px; align-items: center; gap: 7px; min-height: 26px; margin: 0; flex: 0 0 auto; }
#handwriting-settings label { font: inherit; color: inherit; margin: 0; }
#handwriting-settings .field > label { grid-column: 1; grid-row: 1; }
#handwriting-settings input[type="number"] { grid-column: 3; grid-row: 1; width: 72px; min-width: 0; height: 26px; min-height: 0; padding: 2px 4px; border: 1px solid #aaa; border-radius: 2px; font: inherit; color: #000; }
#handwriting-settings input[type="range"] { grid-column: 2; grid-row: 1; width: 100%; min-width: 0; height: 20px; min-height: 0; margin: 0; padding: 0; border: 0; background: transparent; }
#handwriting-settings select,#handwriting-settings input[type="color"] { grid-column: 2 / 4; grid-row: 1; width: 100%; height: 26px; min-height: 0; padding: 2px 4px; border: 1px solid #aaa; border-radius: 2px; font: inherit; }
#handwriting-settings > label { justify-content: flex-start; min-height: 26px; flex: 0 0 auto; }
#handwriting-settings input[type="checkbox"] { flex: 0 0 14px; width: 14px; height: 14px; margin: 0 7px 0 0; }

#handwriting-settings > .hw-auxiliary-setting { display: none !important; }
#handwriting-settings { gap: 6px; }
#handwriting-settings .field { grid-template-columns: 116px minmax(0,1fr) 72px; min-height: 26px; }
#handwriting-settings .hw-settings-heading { font: inherit; border-bottom: 1px solid #aaa; padding: 2px 0 4px; margin-bottom: 6px; }

.desktop-formula-dialog { width: min(900px,calc(100vw - 24px)); height: min(650px,calc(100dvh - 24px)); max-width: none; max-height: none; padding: 0; border: 1px solid #999; border-radius: 7px; background: #f0f0f0; color: #000; font: 13.3333px "Segoe UI",sans-serif; }
.desktop-formula-dialog::backdrop { background: transparent; }
.desktop-formula-dialog .gs-titlebar h2 { font: inherit; }
#formula-form { display: flex; flex-direction: column; gap: 7px; padding: 12px; height: calc(100% - 30px); min-height: 0; }
.formula-entry-row { display: flex; gap: 7px; flex: 0 0 26px; }
#formula-source { flex: 1; min-width: 0; height: 26px; min-height: 0; margin: 0; padding: 2px 4px; border: 1px solid #aaa; border-radius: 2px; font: 16px Consolas,monospace; }
#formula-form button { min-height: 26px; padding: 2px 7px; border: 1px solid #aaa; border-radius: 2px; background: linear-gradient(white,#ececec); font: 13.3333px "Segoe UI",sans-serif; color: #000; white-space: nowrap; }
#formula-insert { min-width: 80px; }
#formula-tabs { display: flex; overflow-x: auto; flex-shrink: 0; gap: 0; margin-bottom: -7px; }
#formula-tabs button { border-radius: 3px 3px 0 0; padding: 5px 11px; }
#formula-tabs [aria-selected="true"] { background: white; border-bottom-color: white; }
#formula-panels { flex: 1; min-height: 0; overflow: auto; border: 1px solid #aaa; background: #fcfcfc; }
.formula-symbol-page { height: 100%; min-height: 170px; padding: 10px; display: grid; grid-template-columns: repeat(10,minmax(0,1fr)); gap: 7px; align-items: center; }
.formula-symbol-page[hidden],.formula-function-page[hidden] { display: none; }
.formula-function-page { padding: 8px; }
.formula-function-page fieldset { margin: 0 0 7px; padding: 7px; border: 1px solid #aaa; }
.formula-function-grid { display: grid; grid-template-columns: repeat(8,minmax(0,1fr)); gap: 7px; }
#formula-message { margin: 0; font: inherit; color: #a02020; }

.desktop-table-dialog { width: 253px; max-width: calc(100vw - 16px); padding: 0; border: 1px solid #aaa; border-radius: 7px; background: #f0f0f0; color: #000; font: 13.3333px "Segoe UI",sans-serif; box-shadow: 0 16px 32px #0004; }
.desktop-table-dialog::backdrop { background: transparent; }
.desktop-table-dialog .gs-titlebar { height: 30px; padding-left: 10px; }
.desktop-table-dialog .gs-titlebar h2 { font: inherit; }
#table-form { padding: 12px 11px 11px; }
#table-form .table-size-fields { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 7px; align-items: center; }
#table-form label { margin: 0; color: #000; font: inherit; }
#table-form input { width: 100%; height: 24px; min-height: 0; padding: 2px 4px; border: 1px solid #aaa; border-radius: 2px; color: #000; background: #fff; font: inherit; }
#table-hint { margin: 8px 0 7px; color: #000; font: inherit; line-height: 18px; }
#table-form .dialog-actions { margin: 0; display: flex; justify-content: flex-end; gap: 7px; }
#table-form button { min-width: 80px; height: 26px; padding: 2px 6px; border: 1px solid #aaa; border-radius: 2px; background: linear-gradient(white,#ececec); color: #000; font: inherit; }
#table-form button:focus-visible { outline: 1px solid #0078d4; outline-offset: 0; }

#rich-editor p[data-horizontal-rule="true"] { font-size: 0; line-height: 0; height: 1px; border-bottom: 1px solid currentColor; margin: 12px 0; padding: 0; }

/* New glyph: compact Desktop prompt, with the same titlebar controls. */
.desktop-symbol-dialog { width: 240px; max-width: calc(100vw - 16px); padding: 0; border: 1px solid #aaa; border-radius: 7px; background: #f0f0f0; color: #000; font: 13.3333px "Segoe UI",sans-serif; box-shadow: 0 16px 32px #0004; }
.desktop-symbol-dialog::backdrop { background: transparent; }
.desktop-symbol-dialog .gs-titlebar { height: 30px; padding-left: 8px; }
.desktop-symbol-dialog .gs-titlebar h2 { font: inherit; }
#gs-new-symbol-form { padding: 12px 11px 11px; }
#gs-new-symbol-form label { display: block; margin: 0 0 6px; color: #000; font: inherit; white-space: nowrap; }
#gs-new-symbol-input { box-sizing: border-box; width: 100%; height: 24px; min-height: 0; padding: 2px 4px; border: 1px solid #aaa; border-radius: 2px; background: white; color: black; font: inherit; }
#gs-new-symbol-status:empty { display: none; }
#gs-new-symbol-status { margin: 6px 0; font: inherit; }
#gs-new-symbol-form .dialog-actions { margin: 7px 0 0; display: flex; justify-content: flex-end; gap: 7px; }
#gs-new-symbol-form button { min-width: 80px; height: 26px; padding: 2px 6px; border: 1px solid #aaa; border-radius: 2px; background: linear-gradient(white,#ececec); color: #000; font: inherit; }
#gs-new-symbol-form button:focus-visible { outline: 1px solid #0078d4; outline-offset: 0; }

#te-ink-scope { width: 145px; flex: 0 0 145px; }
#te-ink-color { width: 145px; flex: 0 0 145px; }
#rich-editor { --document-ink: #123773; color: var(--document-ink); }
#rich-editor .text-editor-sheet { color: var(--document-ink); }
#handwriting-settings #hw-ink-color { grid-column: 2 / 4; width: 100%; height: 24px; padding: 0 4px; font: inherit; }
/* GraphDialog dimensions use the same logical pixels as the Qt desktop. */
.desktop-graph-dialog { width:min(980px,calc(100vw - 32px)); height:min(760px,calc(100dvh - 24px)); max-width:none; max-height:none; padding:0; border:1px solid #aaa; border-radius:7px; background:#f0f0f0; color:#000; font:13.3333px "Segoe UI",sans-serif; overflow:hidden; }
.desktop-graph-dialog[open] { display:flex; flex-direction:column; }
.desktop-graph-dialog::backdrop { background:transparent; }
.desktop-graph-dialog .gs-titlebar { flex:0 0 30px; height:30px; padding-left:8px; gap:7px; }
.desktop-graph-dialog .gs-titlebar h2 { font:inherit; }
.desktop-graph-dialog .graph-layout { display:grid; grid-template-columns: minmax(360px, 56%) minmax(0,1fr); gap:14px; padding:10px 10px 0; min-height:0; flex:1; }
.desktop-graph-dialog .graph-sidebar { display:grid; grid-template-columns:max-content minmax(0,1fr); grid-template-rows:26px 26px minmax(72px,1fr) 26px 26px 26px minmax(125px,1fr) 26px 26px 26px 26px 22px; align-items:center; gap:6px 7px; min-width:0; padding:8px; border:0; overflow:auto; }
.desktop-graph-dialog label { font:inherit; color:inherit; margin:0; font-weight:400; white-space:nowrap; }
.desktop-graph-dialog .graph-field { display:flex; align-items:center; gap:6px; min-width:0; height:100%; }
.desktop-graph-dialog input:not([type=checkbox]):not([type=range]),.desktop-graph-dialog select,.desktop-graph-dialog textarea { min-width:0; width:100%; padding:2px 4px; margin:0; border:1px solid #aaa; border-radius:2px; font:inherit; color:#000; background:white; box-shadow:none; }
.desktop-graph-dialog input:not([type=checkbox]):not([type=range]),.desktop-graph-dialog select { height:26px; }
.desktop-graph-dialog textarea { height:100%; resize:none; }
.desktop-graph-dialog input:disabled,.desktop-graph-dialog textarea:disabled { background:#efefef!important; color:#888!important; }
.desktop-graph-dialog label:has(input:disabled) { color:#888; }
.desktop-graph-dialog input[type=checkbox] { appearance:auto; width:14px; height:14px; margin:0 4px 0 0; }
.desktop-graph-dialog .graph-check { display:flex; align-items:center; }
.desktop-graph-dialog .graph-wide { grid-column:1/-1; display:flex; gap:6px; align-items:center; }
.desktop-graph-dialog .graph-checks label { display:flex; align-items:center; }
.desktop-graph-dialog .graph-preview { min-width:0; min-height:0; background:white; border:1px solid #b8b8b8; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.desktop-graph-dialog .graph-preview img { flex:none; max-width:100%; height:auto; }
.desktop-graph-dialog button { font:inherit; font-weight:400; color:#000; background:linear-gradient(white,#ededed); border:1px solid #aaa; border-radius:2px; padding:2px 7px; min-height:26px; white-space:nowrap; box-shadow:none; }
.desktop-graph-dialog .gs-window-controls button { border:0; background:transparent; padding:0; }
.desktop-graph-dialog #graph-accept-button { border-color:#008dff; }
.desktop-graph-dialog .graph-footer { display:flex; align-items:center; gap:7px; padding:7px 10px 10px; flex:none; }
.desktop-graph-dialog .graph-size { display:flex; align-items:center; justify-content:center; gap:7px; flex:1; }
.desktop-graph-dialog #graph-scale { width:130px; padding:0; height:20px; }
.desktop-graph-dialog #graph-scale-value { min-width:38px; }
.desktop-graph-dialog #graph-error { margin:0 18px; color:#b00020; font:inherit; }
.desktop-graph-dialog #graph-error:empty { display:none; }
.desktop-graph-dialog [hidden] { display:none!important; }
@media(max-width:650px) { .desktop-graph-dialog .graph-layout { grid-template-columns:minmax(0,1fr); overflow:auto; } .desktop-graph-dialog .graph-preview { min-height:180px; } .desktop-graph-dialog .graph-sidebar { min-height:570px; } .desktop-graph-dialog .graph-footer { flex-wrap:wrap; } }
.desktop-graph-dialog textarea { min-height:0; }
.desktop-graph-dialog .gs-titlebar { display:flex; align-items:center; }
.desktop-graph-dialog .gs-titlebar h2 { flex:1; text-align:left; margin:0; }
.desktop-graph-dialog .gs-titlebar .te-window-icon { width:14px; height:12px; border:1px solid #8a9da5; background:linear-gradient(90deg,#83b4a2 25%,white 25%); }
.desktop-graph-dialog .graph-field-label { align-self:start; padding-top:5px; }
.desktop-graph-dialog { resize:both; min-width:min(760px,calc(100vw - 32px)); min-height:min(540px,calc(100dvh - 24px)); }

/* Match Qt native raster zoom; gestures belong to the page viewport only. */
body[data-workspace-mode="handwriting"] .handwriting-page-area {
  padding: 0; touch-action: none;
}
body[data-workspace-mode="handwriting"] .hw-editor-container {
  box-sizing: border-box;
}

/* Desktop render title stays above both the sidebar and page viewport. */
body[data-workspace-mode="handwriting"] #handwriting-workspace {
  display: flex; flex-direction: column;
}
#handwriting-render-title {
  flex: 0 0 30px; height: 30px; padding: 5px 14px;
  font: 13px "Segoe UI", Arial, sans-serif; color: #111;
  background: #f3f3f3; border-bottom: 1px solid #b8b8b8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body[data-workspace-mode="handwriting"] .handwriting-desktop-layout {
  flex: 1; height: 0; min-height: 0;
}

/* Draft uses the Desktop A4 geometry and one scrollable page canvas. */
body[data-workspace-mode="draft"] #draft-view-panel.is-windowed:not(.is-minimized) {
  inset: 0 auto auto 6px; width: min(1250px, calc(100vw - 12px)); height: min(850px, 100dvh);
}
#draft-view-panel .draft-native-toolbar { flex: 0 0 auto; min-height: 36px; padding: 4px 10px; gap: 4px; font: 13.333px "Segoe UI", sans-serif; overflow-x: auto; }
#draft-view-panel .draft-native-toolbar button, #draft-view-panel .draft-native-toolbar summary, #draft-view-panel .desktop-toolbar-check { font: inherit; font-weight: 400; padding: 4px 8px; min-height: 26px; white-space: nowrap; }
#draft-view-panel .desktop-toolbar-check { display: inline-flex; align-items: center; gap: 5px; }
#draft-view-panel .desktop-toolbar-check input { width: 14px; height: 14px; margin: 0; }
#draft-view-panel .draft-desktop-layout { grid-template-columns: 256px minmax(0, 1fr); flex: 1; min-height: 0; overflow: hidden; }
#draft-page-list { min-height: 0; padding: 0; overflow: auto; background: #f2f3f5; }
#draft-page-list button { width: 100%; min-height: 40px; padding: 10px 12px; font: 14px "Segoe UI", sans-serif; border-radius: 0; }
#draft-view-panel .draft-page-workspace { display: flex; min-height: 0; padding: 0; overflow: hidden; background: #d7d9dc; }
#draft-view-title, #draft-view-panel .draft-page-header { display: none; }
#draft-message:empty { display: none; }
#draft-view-pages.editor-scroll { display: block; flex: 1; min-width: 0; min-height: 0; overflow: auto; margin: 0; padding: 0 16px 22px; border: 0; border-radius: 0; background: #d7d9dc; scroll-behavior: auto; }
#draft-view-pages > section { width: 794px; margin: 0 auto 22px; }
#draft-view-pages .draft-view-page { box-sizing: border-box; width: 794px; height: 1123px; min-height: 1123px; margin: 0; padding: 38px 38px 57px; overflow: hidden; background: white; color: #111; font: 16pt/1.5 Arial, "Segoe UI", sans-serif; border-radius: 0; box-shadow: 5px 5px 0 #b4b7ba, 0 0 0 1px #aeb2b6; outline: none; }
#draft-view-pages .draft-view-page > hr.page-break { display: none; }
#draft-view-pages .draft-view-page p { margin: 0 0 .6rem; }
#draft-view-pages .draft-view-page table { max-width: 100%; }
#draft-view-pages .graph-editor-chip, #draft-view-pages .diagram-editor-chip { display: block; max-width: 100%; }
#draft-view-pages canvas { max-width: 100%; }

body[data-workspace-mode="draft"] { height: 100dvh; overflow: hidden; }
#draft-view-panel .draft-native-toolbar .is-hidden { display: none !important; }
#draft-view-pages .draft-view-page { overflow-wrap: anywhere; }

/* Draft uses the same caption controls as the text editor. */
#draft-view-panel .web-window-controls { height: 30px; }
#draft-view-panel .web-window-controls .web-window-control { box-sizing: border-box; flex: 0 0 46px; width: 46px; height: 30px; min-height: 0; margin: 0; padding: 0; border: 0; }
#draft-view-panel .web-window-minimize::before { top: 15px; left: 18px; width: 10px; }
#draft-view-panel .web-window-maximize::before { box-sizing: border-box; top: 10px; left: 18px; width: 10px; height: 10px; border-radius: 1px; }
#draft-view-panel .web-window-maximize.is-restore-icon::before { top: 11px; left: 17px; width: 8px; height: 8px; box-shadow: 2px -2px 0 -1px #f4f4f4,2px -2px 0 0 currentColor; }
#draft-view-panel .web-window-close::before,#draft-view-panel .web-window-close::after { top: 8px; left: 22px; width: 1px; height: 14px; border: 0; background: currentColor; }
#draft-view-panel.is-minimized .web-window-controls,#draft-view-panel.is-minimized .web-window-controls .web-window-control { height: 25px; }
#draft-view-panel.is-minimized .web-window-maximize::before { top: 8px; }
#draft-view-panel.is-minimized .web-window-close::before,#draft-view-panel.is-minimized .web-window-close::after { top: 5px; }


#draft-view-pages .draft-formula-code { display: inline; padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; white-space: pre-wrap; cursor: text; }

/* Desktop draft is plain source, with literal spaces and tab-separated tables. */
#draft-view-pages .draft-view-page p { margin: 0; white-space: pre-wrap; tab-size: 8; }

#draft-view-panel .draft-desktop-layout.has-review { grid-template-columns:256px minmax(0,1fr) 280px; }
#draft-review-panel { min-width:280px; min-height:0; overflow:hidden; display:flex; flex-direction:column; background:#f2f3f5; border-left:6px solid #d7d9dc; font:14px "Segoe UI",sans-serif; color:#111; }
#draft-review-panel.is-hidden { display:none; }
#draft-review-panel header { display:flex; align-items:center; justify-content:space-between; background:#d7d9dc; padding:2px 5px; }
#draft-review-close { padding:0; min-height:18px; width:18px; border:0; background:transparent; color:#555; }
#draft-review-list { flex:1; min-height:0; overflow:auto; }
#draft-review-list button { display:block; width:100%; padding:10px 12px; margin:0; border:0; border-radius:0; background:transparent; color:#111; text-align:left; white-space:normal; font:14px/1.35 "Segoe UI",sans-serif; font-weight:400; }
#draft-review-list button:hover,#draft-review-list button:focus { background:#dceef8; }
