/* Shared application UI. Document/PDF typography remains in its own renderer. */
:root { --ui-focus: #86507b; --ui-border: #e4dce3; --ui-muted: #746a73; }
.app-page #app { font-size: 14px; line-height: 1.5; }
.app-page [hidden], .modal [hidden], .client-shell [hidden] { display: none !important; }
.app-page :is(button,a,input,select,textarea):focus-visible,
.modal :is(button,a,input,select,textarea):focus-visible {
  outline: 3px solid #86507b; outline-offset: 3px;
}
.main-shell { scrollbar-gutter: stable; }
.main-shell > .view { padding: 28px 32px 56px; }
.app-page .topbar { height: auto; min-height: 96px; padding: 20px 32px; gap: 12px; }
.app-page .topbar > div:not(.workspace-header-tools) { min-width: 0; flex: 1 1 auto; margin-right: 0; }
.app-page .topbar h1 { margin: 4px 0 0; font-size: 28px; line-height: 1.2; }
.app-page .topbar .eyebrow { line-height: 1.4; }
.app-page .topbar .btn { flex-shrink: 0; }
.topbar-search { min-width: 0; width: auto; height: 42px; padding: 0 12px; display: inline-flex; gap: 10px; font-size: 12px; }
.topbar-search kbd { font-family: inherit; font-size: 10px; font-weight: 600; line-height: 1.4; }
.notification-button { flex: 0 0 42px; }
.notification-button b[hidden] { display: none !important; }
.app-page .topbar > .workspace-header-tools{display:flex!important;align-items:center;justify-content:flex-end;gap:10px;margin:0 0 0 auto;flex:0 0 auto!important;min-width:0}
.workspace-header-tools .notification-button{width:42px;height:42px;display:grid;place-items:center;padding:10px;border:1px solid var(--ui-border);border-radius:10px;background:#fff;color:#6e3b66;box-shadow:none}
.workspace-header-tools .notification-button svg{width:20px;height:20px;display:block}
.workspace-attention-link{display:grid;gap:6px;padding:15px 16px;margin:0 0 10px;border:1px solid var(--ui-border);border-radius:10px;text-decoration:none;color:#312633;background:#fff}
.workspace-attention-link:hover{background:#faf6fa;border-color:#b994b2}
.workspace-attention-link strong{font-size:14px;line-height:1.45}.workspace-attention-link span{font-size:12px;color:#6e3b66}.workspace-attention-link small{font-size:11px;color:#786c78}
@media(max-width:780px){.app-page .topbar > .workspace-header-tools{gap:8px}.workspace-header-tools .notification-button{width:36px;height:36px;flex-basis:36px;padding:8px}.app-page .topbar>div:not(.workspace-header-tools){flex:1;min-width:0}.workspace-header-tools .topbar-search{width:36px;height:36px;min-width:36px;padding:8px!important}.workspace-header-tools .topbar-search span,.workspace-header-tools .topbar-search kbd{display:none}}
.sidebar { overflow-y: auto; overscroll-behavior: contain; }
.sidebar nav { gap: 12px; }
.sidebar .nav-item, .reports-portal .sidebar .nav-item.nav-link { min-height: 42px; font-size: 12px; line-height: 1.4; gap: 10px; }
.app-page .btn { min-height: 42px; font-size: 13px; line-height: 1.35; padding: 10px 16px; }
.app-page :is(.row-actions,.doc-actions,.small-actions,.workflow-actions,.toolbar-actions,.portal-actions) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.app-page :is(.row-actions,.doc-actions) :is(button,a), .app-page .mini-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 7px 10px; border-radius: 7px;
  font-size: 11px; font-weight: 650; line-height: 1.35; text-decoration: none;
}
.app-page button:disabled { opacity: .5; cursor: not-allowed; }
.app-page :is(.section-head,.library-heading,.registry-tools,.library-tools) { gap: 16px; flex-wrap: wrap; }
.app-page .section-head { align-items: flex-start; margin-bottom: 20px; }
.app-page .section-head h2 { margin: 0 0 7px; font-size: 22px; line-height: 1.25; }
.app-page .section-head p { font-size: 13px; line-height: 1.55; }
.library-tools { align-items: flex-end; }
.app-page .list-control { display: grid; gap: 6px; min-width: 130px; }
.app-page .list-control > span { font-size: 10px; line-height: 1.4; }
.app-page .list-control select { min-height: 42px; max-width: 100%; padding: 9px 32px 9px 12px; font-size: 12px; }
.app-page .search { min-height: 42px; height: auto; gap: 8px; }
.app-page .search input { width: 100%; min-width: 0; padding: 10px 0; font-size: 12px; }
.library-tools .search, .registry-tools .search { flex: 1 1 200px; }
.stats-row, .registry-stats { gap: 16px; margin-bottom: 24px; }
.stat { padding: 20px; gap: 16px; }
.stat span { font-size: 12px; line-height: 1.45; }
.stat strong { font-size: 30px; line-height: 1.15; }
.cockpit-hero { margin-bottom: 24px; }
.cockpit-guide-details { margin-bottom: 24px; border: 1px solid var(--ui-border); border-radius: 12px; background: #fff; }
.cockpit-guide-details > summary { padding: 14px 18px; color: #6e3b66; font-size: 12px; font-weight: 750; cursor: pointer; }
.cockpit-guide-details .cockpit-guide { margin: 0; padding: 0 16px 16px; }
.cockpit-guide-details > summary:focus-visible { outline: 3px solid #86507b; outline-offset: 3px; }
.ux-dashboard-grid { display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 16px; margin: 0 0 32px; align-items: stretch; }
.ux-dashboard-card { min-width: 0; min-height: 0; padding: 22px; background: #fff; border: 1px solid var(--ui-border); border-radius: 16px; }
.ux-dashboard-card > div:first-child { display: grid; gap: 8px; margin: 0 0 20px; }
.ux-dashboard-card .eyebrow { margin: 0; font-size: 10px; line-height: 1.4; }
.ux-dashboard-card h3 { margin: 0; font-size: 17px; line-height: 1.35; }
.dashboard-empty { margin: 0; padding: 14px; background: #faf7f9; border-radius: 10px; font-size: 12px; line-height: 1.6; color: var(--ui-muted); }
#attentionList, #notificationsList, #recentActivity { display: grid; gap: 10px; }
:is(#attentionList,#notificationsList,#globalSearchResults) button,
.recent-activity-item { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 12px; align-items: start; width: 100%; padding: 12px; border: 1px solid #eee6ed; border-radius: 10px; background: #faf7f9; text-align: left; }
:is(#attentionList,#notificationsList,#globalSearchResults) button:hover { background: #f0e5ed; border-color: #cbb2c5; }
:is(#attentionList,#notificationsList,#globalSearchResults) button > b,
.activity-symbol { display: grid; place-items: center; width: 36px; height: 36px; margin: 0; border: 1px solid #ddcad7; border-radius: 9px; background: #f0e5ed; color: #6e3b66; font-size: 10px; font-weight: 850; }
:is(#attentionList,#notificationsList,#globalSearchResults) button > span,
.activity-copy { display: grid; min-width: 0; gap: 6px; }
:is(#attentionList,#notificationsList,#globalSearchResults) strong,
.activity-copy strong { font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
:is(#attentionList,#notificationsList,#globalSearchResults) small,
.activity-copy time { display: block; margin: 0; color: var(--ui-muted); font-size: 11px; font-weight: 500; line-height: 1.45; }
.pipeline { display: grid; gap: 18px; }
.pipeline > div { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.pipeline span { font-size: 12px; line-height: 1.4; }
.pipeline b { font-size: 12px; line-height: 1.4; }
.pipeline i { grid-column: 1/-1; display: block; height: 6px; border-radius: 9px; }
.doc-row { grid-template-columns: 44px minmax(0,1fr) auto; gap: 16px; padding: 18px; align-items: start; }
.doc-row .doc-icon { grid-row: 1/3; }
.doc-meta { min-width: 0; }
.doc-meta > strong { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.doc-details { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; }
.doc-details > span { display: inline-flex; flex-wrap: wrap; gap: 5px; font-size: 11px; line-height: 1.45; color: var(--ui-muted); }
.doc-details b { color: #60535d; font-weight: 750; }
.doc-row .doc-badges { grid-column: 3; grid-row: 1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 250px; }
.doc-row .doc-actions { grid-column: 2/4; justify-content: flex-end; }
.app-page :is(.status-pill,.type-pill,.client-visibility-pill) { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 5px 9px; font-size: 10px; line-height: 1.4; white-space: normal; }
.documents-list,.registry-list { gap: 12px; }
.registry-row { grid-template-columns: 24px minmax(120px,.8fr) minmax(170px,1.3fr) minmax(120px,.8fr) minmax(115px,.7fr) auto; gap: 14px; padding: 18px; align-items: start; }
.registry-row > div { min-width: 0; }
.registry-row > div > span { display: block; margin-bottom: 5px; font-size: 10px; line-height: 1.45; color: var(--ui-muted); }
.registry-row > div > strong { display: block; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.registry-row > div > small { display: block; margin-top: 6px; font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.registry-row .row-actions { grid-column: 2/-1; grid-row: auto; justify-content: flex-end; }
.registry-row .registry-select { min-height: 24px; grid-row: 1/3; }
.registry-bulkbar { flex-wrap: wrap; gap: 12px; padding: 12px 14px; margin-bottom: 12px; }
.registry-bulkbar label { font-size: 12px; line-height: 1.4; }
.registry-bulkbar > span { font-size: 11px; }
.registry-hero { padding: 28px; gap: 24px; align-items: center; }
.registry-hero h2 { margin: 7px 0 10px; font-size: 26px; line-height: 1.25; }
.registry-hero p { line-height: 1.6; }
.management-layout,.users-layout { grid-template-columns: minmax(0,1fr) minmax(300px,360px); gap: 24px; }
.management-row { grid-template-columns: 42px minmax(0,1fr) auto; padding: 18px; gap: 14px; }
.management-row > div { min-width: 0; }
.management-row strong { font-size: 13px; line-height: 1.5; }
.management-row small,.management-row em { display: block; margin-top: 6px; font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.management-row .row-actions { flex-wrap: wrap; }
.stack-form { gap: 16px; }
.stack-form label,.field-group label { line-height: 1.45; gap: 8px; }
.field-note,.stack-form small,.portal-form label small { font-size: 11px; line-height: 1.55; }
.stack-form :is(input,select,textarea),.field-group :is(input,select,textarea) { width: 100%; min-width: 0; max-width: 100%; font-size: 13px; line-height: 1.5; }
.stack-form :is(input,select),.field-group :is(input,select) { min-height: 42px; }
.stack-form input[type=checkbox],.field-group input[type=checkbox] { width: 16px; min-height: 16px; height: 16px; flex: 0 0 16px; }
.check-field { display: flex !important; align-items: flex-start; gap: 10px !important; }
.check-field input { margin-top: 3px; }
.check-field span { font-size: 12px; line-height: 1.55; }
.user-row { gap: 14px; }
.user-row strong,.user-row small { display: block; line-height: 1.5; }
.user-row small { margin-top: 5px; overflow-wrap: anywhere; }
.user-row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.editor-view { height: calc(100dvh - var(--workspace-topbar-height,96px)); }
.editor-toolbar { height: auto; min-height: 76px; padding: 12px 20px; gap: 14px; flex-wrap: wrap; }
.doc-title-wrap { flex: 1 1 250px; min-width: 0; }
.doc-title-wrap input { width: 100%; min-width: 0; font-size: 14px; line-height: 1.5; }
.doc-title-wrap span { font-size: 11px; line-height: 1.45; }
.editor-document-kind { display:block; margin-bottom:4px; color:#7a5172; font-size:10px; line-height:1.5; letter-spacing:.04em; font-weight:750; text-transform:uppercase; }
.editor-toolbar #backBtn { width:auto; min-width:0; padding:9px 12px; font-size:11px; line-height:1.5; white-space:nowrap; border:1px solid #e4d8e1; border-radius:8px; background:#fff; }
#saveState { display:inline-flex; align-items:center; gap:6px; margin-top:4px; }
#saveState::before { content:''; width:6px; height:6px; flex:0 0 6px; border-radius:50%; background:#a58c44; }
#saveState[data-state=saved] { color:#347348; }#saveState[data-state=saved]::before { background:#347348; }
#saveState[data-state=saving] { color:#7d3f70; }#saveState[data-state=saving]::before { background:#7d3f70; }
#saveState[data-state=error] { color:#a13b47; }#saveState[data-state=error]::before { background:#a13b47; }
.toolbar-actions { gap:8px; }.editor-toolbar #saveBtn { border-color:#bca1b5; background:#f7eff5; color:#613957; font-weight:750; }
.editor-toolbar .btn { min-height: 38px; font-size: 11px; padding: 8px 12px; }
.editor-stepper { height: auto; min-height: 56px; padding: 10px 20px; gap: 10px; justify-content: flex-start; flex-wrap: wrap; }
.editor-stepper button { display: inline-flex; align-items: center; gap: 9px; height: auto; min-height: 36px; padding: 7px 12px; font-size: 11px; line-height: 1.4; border-radius: 8px; }
.editor-stepper button > b { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #e4d5df; color: #6e3b66; font-size: 10px; }
.editor-stepper button.active > b { background: #d6ff3f; color: #3e2b38; }
.editor-layout { height: calc(100% - var(--editor-controls-height,132px)); grid-template-columns: 190px minmax(320px,380px) minmax(0,1fr); }
.editor-layout > * { min-width: 0; }
.form-panel { padding: 22px; }
.section-navigator { padding: 18px 12px; }
.section-nav-head { display: grid; gap: 10px; margin: 0 0 14px; }
.section-nav-head span { font-size: 11px; line-height: 1.4; }
.section-nav-head button { min-height: 32px; font-size: 11px; }
#sectionNavigator { display: grid; gap: 10px; }
.section-nav-item { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 6px; }
.section-nav-item > button { display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 9px; padding: 6px; }
.section-nav-item > button > b { width: 24px; height: 24px; font-size: 10px; }
.section-nav-item span { display: block; white-space: normal; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.section-nav-item small { margin-top: 4px; font-size: 10px; line-height: 1.4; }
.section-nav-item > div { justify-content: flex-end; gap: 5px; padding: 0; }
.section-nav-item > div button { width: 30px; height: 30px; font-size: 14px; border-radius: 6px; }
.section-nav-item > div button:hover { background: #f1e6ee; }
.section-nav-item.is-selected { border-color: #9d7094; box-shadow: 0 0 0 1px #b792ae; }
.section-nav-item.is-hidden { opacity: .65; background: #f2eff1; }
.field-group { margin-bottom: 20px; padding-bottom: 22px; }
.offer-slide-editor { margin: 0 0 20px; padding: 18px; }
.field-head { align-items: flex-start; gap: 10px; }
.field-head h3 { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.field-head button { min-width: 30px; min-height: 30px; }
.workflow-rail { gap: 6px; margin: 0 0 18px; }
.workflow-rail span { display: grid; justify-items: center; gap: 7px; padding: 10px 4px; font-size: 10px; line-height: 1.4; }
.workflow-rail span b { margin: 0; }
.workflow-rail small { padding-top: 6px; font-size: 11px; line-height: 1.5; }
.preview-stage { padding: 22px 24px 60px; background: #ede7ec; }
.preview-label { display: flex; flex-wrap: wrap; gap: 10px; max-width: 100%; margin: 0 auto 14px; font-size: 11px; line-height: 1.4; }
#previewCompleteness { padding: 5px 9px; border-radius: 99px; }
#previewRoot { max-width: none; transform: none; transform-origin: top left; }
#previewRoot .contract-document { width: 794px; }
#previewRoot .contract-document .pdf-page { width: 794px; min-height: 1123px; padding: 74px 68px 64px; }
#previewRoot .contract-document .contract-content { padding-top: 55px; }
.editor-view[data-step=preview] .preview-stage { padding: 24px 40px 60px; }
.editor-view[data-step=preview] .editor-layout { grid-template-columns: 1fr; }
.editor-view[data-step=preview] :is(.section-navigator,.form-panel) { display: none; }
.editor-view[data-step=team] .section-navigator,.editor-view[data-step=setup] .section-navigator { opacity: .8; }
.modal { padding: 28px; max-height: calc(100dvh - 40px); overflow: auto; overscroll-behavior: contain; }
.modal h2 { margin: 7px 38px 22px 0; font-size: 24px; line-height: 1.25; }
.modal .eyebrow { padding-right: 38px; font-size: 10px; line-height: 1.4; }
.modal-close { display: grid; place-items: center; width: 36px; height: 36px; right: 16px; top: 16px; padding: 0; border-radius: 8px; line-height: 1; }
.modal-close:hover { background: #f1e7ee; }
.modal .search,.command-search { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0 12px; border: 1px solid #dfd2dc; border-radius: 10px; min-height: 46px; background: #fff; }
.modal .search input,.command-search input { min-width: 0; width: 100%; border: 0; background: transparent; padding: 12px 0; font-size: 13px; outline: 0; }
.command-search:focus-within { box-shadow: 0 0 0 2px #b58aac; }
#globalSearchResults,#snippetList,#historyList,#notificationsList,#completenessResults { margin-top: 18px; }
.snippet-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-height: none; overflow: visible; }
.snippet-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 16px; align-items: start; }
.snippet-row > div { display: grid; gap: 7px; min-width: 0; }
.snippet-row span { font-size: 10px; line-height: 1.4; }
.snippet-row strong { font-size: 13px; line-height: 1.45; }
.snippet-row small { font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.snippet-row button { min-height: 34px; padding: 7px 10px; font-size: 11px; }
.snippet-row button[data-snippet-delete] { grid-column: 2; }
.completeness-item { margin-bottom: 10px; padding: 14px; font-size: 13px; line-height: 1.55; }
.modal :is(.template-preview) { margin-bottom: 20px; height: 88px; }
.template-preview span { top: 12px; left: 16px; line-height: 1.4; }
.template-preview::after { bottom: 12px; height: 6px; box-shadow: 0 -13px 0 #d7b8d1; }
.template-card { padding: 22px; }
.template-card h3 { font-size: 16px; line-height: 1.35; margin-bottom: 10px; }
.template-card p { font-size: 12px; line-height: 1.65; }
.client-registry-row { grid-template-columns: 48px minmax(150px,1.3fr) minmax(115px,.8fr) minmax(140px,1fr) auto !important; }
.client-registry-row > div > strong { font-size: 13px; }
.client-registry-row .row-actions { grid-column: auto; }
.profit-stats { gap: 16px; }
.profit-row { grid-template-columns: minmax(170px,1.25fr) repeat(3,minmax(110px,.8fr)) minmax(100px,.6fr); gap: 16px; }
.profit-row .row-actions { grid-column: 1/-1; justify-content: flex-end; }
.profit-row :is(strong,small) { display: block; line-height: 1.5; }
.profit-row strong { font-size: 12px; margin-top: 6px; }
.profit-row small { font-size: 10px; margin-top: 6px; color: var(--ui-muted); }
.report-step { padding: 26px; gap: 20px; }
.step-heading h3 { margin: 6px 0 9px; font-size: 20px; line-height: 1.35; }
.step-heading p { font-size: 13px; line-height: 1.6; }
.portal-form label { min-width: 0; gap: 8px; font-size: 12px; line-height: 1.45; }
.portal-form :is(input,select,textarea) { min-width: 0; max-width: 100%; font-size: 13px; line-height: 1.5; }
.source-row { grid-template-columns: minmax(170px,1.2fr) repeat(4,minmax(100px,1fr)) 32px; gap: 12px; }
.source-row label,.action-row label,.wide-field { min-width: 0; gap: 8px; font-size: 11px; line-height: 1.45; }
.source-row :is(input,select),.action-row :is(input,select,textarea),.wide-field textarea { min-width: 0; max-width: 100%; font-size: 12px; line-height: 1.5; }
.source-row :is(input,select),.action-row :is(input,select),.portal-form :is(input,select),.profit-form-grid :is(input,select) { min-height: 42px; }
.app-page :is(.stack-form,.field-group,.portal-form,.source-row,.action-row,.profit-form-grid) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select) { height: 44px; min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
.app-page :is(.stack-form,.field-group,.portal-form,.source-row,.action-row,.profit-form-grid) label { font-size: 12px; line-height: 1.5; }
.source-row label,.action-row label,.wide-field { font-size: 12px; }
.row-remove { width: 32px; height: 36px; }
.source-row input[type=file] { width: 100%; overflow: hidden; }
.source-row input::file-selector-button { max-width: 100%; margin-right: 6px; }
.report-submit-bar,.form-actions { align-items: center; flex-wrap: wrap; gap: 12px; }
.report-submit-bar .autosave-status,.form-actions .autosave-status { flex: 1 1 200px; line-height: 1.45; }
.channel-edit { display: grid; gap: 18px; }
.client-shell :is(.client-document,.client-document-toolbar,.client-section-head) { gap: 16px; }
.client-document > div { min-width: 0; }
.client-document h3 { line-height: 1.45; overflow-wrap: anywhere; }
.client-document p { margin-top: 6px; line-height: 1.5; }
.client-section-head { flex-wrap: wrap; }
.sidebar-scrim { display: none; }
@media (max-width: 1440px) {
  .ux-dashboard-grid { grid-template-columns: 1fr 1fr; }
  .ux-dashboard-card:last-child { grid-column: 1/-1; }
  #recentActivity { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .registry-row { grid-template-columns: 24px minmax(140px,.7fr) minmax(180px,1fr) auto; }
  .registry-row > div:nth-child(4),.registry-row > div:nth-child(5) { grid-row: auto; }
  .registry-row > div:nth-child(4) { grid-column: 2; }
  .registry-row > div:nth-child(5) { grid-column: 3; }
  .registry-row .status-pill { grid-column: 4; grid-row: 1; }
  .registry-row .row-actions { grid-column: 2/-1; }
  .source-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 32px; }
  .source-row .row-remove { grid-column: 3; grid-row: 1; }
  .client-registry-row { grid-template-columns: 48px minmax(0,1fr) auto !important; }
  .client-registry-row > div:nth-of-type(n+2) { grid-column: 2; }
  .client-registry-row .row-actions { grid-column: 3; grid-row: 1/4; }
}
@media (max-width: 1150px) {
  .main-shell > .view { padding: 24px; }
  .app-page .topbar { padding: 18px 24px; }
  .topbar-search span,.topbar-search kbd { display: none; }
  .topbar-search { width: 42px; padding: 0; justify-content: center; }
  .management-layout,.users-layout { grid-template-columns: 1fr; }
  .management-form,.user-form-card { max-width: none; }
  .editor-view { height: auto; min-height: calc(100dvh - 96px); }
  .editor-layout { grid-template-columns: 180px minmax(0,1fr); height: auto; }
  .section-navigator,.form-panel { max-height: 62dvh; }
  .preview-stage { grid-column: 1/-1; min-height: 480px; }
  .editor-view[data-step=preview] .preview-stage { grid-column: 1; }
  .profit-row { grid-template-columns: repeat(3,minmax(0,1fr)) !important; }
  .profit-row .profit-main { grid-column: 1/-1; }
  .profit-row > div:nth-of-type(n+2) { grid-column: auto; }
  .profit-row .row-actions { grid-column: 1/-1; grid-row: auto; }
}
@media (max-width: 780px) {
  .app-page .topbar { min-height: 80px; padding: 14px 16px; gap: 8px; }
  .app-page .topbar h1 { font-size: 22px; }
  .app-page .topbar .eyebrow { font-size: 9px; }
  .app-page .topbar .btn { width: 40px; min-height: 40px; padding: 0; }
  .notification-button,.topbar-search { flex: 0 0 36px; width: 36px; height: 36px; }
  .menu-btn { flex: 0 0 36px; width: 36px; height: 36px; }
  .sidebar { width: min(280px,calc(100vw - 52px)); height: 100dvh; z-index: 60; padding-top: 22px; }
  .sidebar.open { box-shadow: 16px 0 48px #21121d55; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 59; border: 0; background: #24142380; }
  .sidebar-scrim:not([hidden]) { display: block; }
  .sidebar .nav-item { min-height: 44px; }
  .sidebar-close { display: grid; place-items: center; position: absolute; right: 12px; top: 14px; width: 32px; height: 32px; border: 1px solid #ffffff38; border-radius: 8px; background: #ffffff12; color: #fff; font-size: 21px; }
  .main-shell > .view { padding: 20px 16px 36px; }
  .ux-dashboard-grid { grid-template-columns: 1fr; }
  .ux-dashboard-card:last-child { grid-column: auto; }
  #recentActivity { grid-template-columns: 1fr; }
  .ux-dashboard-card { padding: 18px; }
  .stats-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stat { padding: 16px; gap: 8px; }
  .stat strong { font-size: 25px; }
  .library-tools,.registry-tools { display: flex; width: 100%; gap: 12px; }
  .library-tools .list-control,.registry-tools .list-control { flex: 1 1 130px; min-width: 0; }
  .library-tools .search,.registry-tools .search { flex-basis: 100%; }
  .doc-row { grid-template-columns: 38px minmax(0,1fr); padding: 16px; gap: 10px 12px; }
  .doc-row .doc-icon { width: 38px; height: 44px; grid-row: 1/3; }
  .doc-row .doc-badges { grid-column: 2; grid-row: auto; max-width: none; justify-content: flex-start; }
  .doc-row .doc-actions { grid-column: 2; justify-content: flex-start; }
  .doc-actions button:nth-child(2) { display: inline-flex; }
  .app-page :is(.row-actions,.doc-actions) :is(button,a),.app-page .mini-btn { min-height: 38px; }
  .registry-row { grid-template-columns: 24px minmax(0,1fr); gap: 12px; padding: 16px; }
  .registry-row > * { grid-row: auto !important; }
  .registry-row > div:nth-child(n),.registry-row .row-actions,.registry-row .status-pill { grid-column: 2; }
  .registry-row .registry-select { grid-column: 1; grid-row: 1/4 !important; }
  .registry-row .row-actions { justify-content: flex-start; }
  .registry-bulkbar > span { margin: 0; }
  .registry-hero { flex-wrap: wrap; padding: 22px; }
  .registry-hero h2 { font-size: 23px; }
  .management-row { grid-template-columns: 36px minmax(0,1fr); }
  .management-row .row-actions { grid-column: 2; }
  .editor-toolbar { position: static; padding: 12px; gap: 10px; }
  .doc-title-wrap { order: 0; flex: 1 1 200px; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .btn { flex: 1 1 130px; padding: 9px 8px; }
  .editor-stepper { position: sticky; top: var(--workspace-topbar-height,80px); z-index: 9; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding: 10px 12px; gap: 8px; }
  .editor-stepper button { flex: 0 0 auto; }
  .editor-layout { display: block; }
  .section-navigator { max-height: 260px; padding: 16px; }
  #sectionNavigator { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .form-panel { max-height: none; padding: 18px 16px; }
  .preview-stage,.editor-view[data-step=preview] .preview-stage { min-height: 0; padding: 20px 12px 40px; }
  .modal { width: calc(100% - 24px); max-height: calc(100dvh - 24px); padding: 22px 18px; border-radius: 16px; }
  .modal h2 { font-size: 22px; }
  .snippet-list { grid-template-columns: 1fr; }
  .template-grid { gap: 14px; }
  .client-registry-row { grid-template-columns: 42px minmax(0,1fr) !important; }
  .client-registry-row .row-actions { grid-column: 2; grid-row: auto; justify-content: flex-start; }
  .profit-row { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
  .profit-row .row-actions { grid-column: 1/-1; }
  .report-step { padding: 20px 16px; grid-template-columns: 1fr; }
  .step-heading { flex-wrap: wrap; gap: 12px; }
  .source-row,.action-row,.report-period,.portal-form { grid-template-columns: 1fr; }
  .source-row .row-remove { grid-column: 1; grid-row: auto; }
  .portal-form .full { grid-column: 1; }
  .report-submit-bar { position: static; flex-direction: column; align-items: stretch; }
  .report-submit-bar .autosave-status { flex: 0 0 auto; }
  .client-document-toolbar { flex-wrap: wrap; }
  .app-page :is(.stack-form,.field-group,.portal-form,.source-row,.action-row,.profit-form-grid,.wide-field,.command-search,.search,.modal) :is(input:not([type=checkbox]):not([type=radio]),select,textarea),
  .login-form-panel :is(input[type=email],input[type=password]),.client-shell :is(input:not([type=checkbox]),select,textarea) { font-size: 16px; line-height: 1.5; }
  .app-page :is(.stack-form,.field-group,.portal-form,.source-row,.action-row,.profit-form-grid) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select) { height: 48px; min-height: 48px; }
}
/* Form controls share one desktop scale, independent of the report/page wrapper. */
@media (min-width: 781px) {
  .app-page :is(.stack-form,.field-group,.portal-form,.source-row,.action-row,.profit-form-grid,.wide-field,.modal) :is(input:not([type=checkbox]):not([type=radio]),select,textarea) { font-size: 13px; line-height: 1.5; }
}
.login-form-panel label { font-size: 12px; line-height: 1.5; }
.login-form-panel input { font-size: 14px; line-height: 1.5; }
.modal :is(#tablePaste,#sheetSelect),.clause-editor textarea { font-size: 13px; line-height: 1.6; }
.modal .template-category { margin: 24px 0 0; }
.modal .template-category-head { padding-bottom: 12px; margin-bottom: 14px; gap: 12px; }
.toast { max-width: min(420px,calc(100vw - 32px)); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.report-builder .portal-btn,.report-submit-bar .portal-btn { min-height: 42px; font-size: 13px; line-height: 1.4; }
.profit-form-grid label,.modal .stack-form label { font-size: 12px; line-height: 1.5; }
@media(max-width:780px) { .row-remove { width: 40px; height: 40px; }.modal :is(#tablePaste,#sheetSelect),.clause-editor textarea { font-size: 16px; } }
@media (min-width: 781px) { .sidebar-close { display: none; } }
@media (prefers-reduced-motion: reduce) { .app-page *, .modal * { scroll-behavior: auto !important; transition: none !important; } }
@media print { .sidebar-scrim,.sidebar-close { display: none !important; } }
/* Service prices always state the basis of the rate. */
#serviceForm #serviceUnitHint{display:block;margin-top:7px;font-size:12px;line-height:1.6;font-weight:400}
#servicePicker .picker-row>b{display:flex;flex-direction:column;gap:4px;text-align:right}
#servicePicker .picker-row>b>small{font-size:11px;font-weight:500;color:#81747e}
