/* Shared visual layer: local assets only, no changes to content or clinical state. */
:root {
 --ink:#253b43; --muted:#62767e; --accent:#2a6566; --line:#e2e9eb;
 --surface:#fff; --canvas:#f4f7f8; --tint:#e8f2f0; --radius:7px;
 --shadow:0 2px 10px #203d4810;
 font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
body {background:var(--canvas);-webkit-font-smoothing:antialiased;}
h1 {font-size:27px;letter-spacing:-.7px;font-weight:650;}
h3 {font-size:16px;letter-spacing:-.2px;}
button,.button {min-height:34px;font-size:13px;border-radius:6px;transition:background-color .12s,border-color .12s;}
button:hover,.button:hover {filter:none;box-shadow:0 1px 3px #163d471a;}
button:disabled {cursor:not-allowed;box-shadow:none;}
input,select,textarea {border-color:#d8e2e5;border-radius:6px;font-size:13px;min-height:34px;}
input[type=checkbox],input[type=radio] {min-height:0;accent-color:var(--accent);}
input:focus-visible,select:focus-visible,textarea:focus-visible,a:focus-visible,button:focus-visible {outline:2px solid #377b82;outline-offset:3px;}
label {font-size:12px;font-weight:550;color:#4e646e;}
small {font-size:12px;}
.sidebar {width:192px;background:#f9fcfc;border-right-color:#e5edef;padding:27px 14px 18px;}
.wordmark {margin:2px 15px 33px;}
.wordmark img {width:113px;opacity:.9;}
.sidebar a:not(.wordmark) {padding:11px 13px;color:#4f666e;font-size:13px;border-radius:7px;}
.sidebar a[aria-current=page] {background:#e4f0ed;color:#275d5c;}
.sidebar nav {gap:5px;}
.sidebar-bottom {gap:4px;}
.sidebar-bottom a,.sidebar-bottom button {font-weight:450;}
.workspace {margin-left:192px;}
main {max-width:1720px;padding:25px 30px 40px;}
.page-heading {min-height:46px;margin-bottom:23px;gap:16px;}
.heading-identity {display:flex;align-items:center;gap:15px;min-width:0;}
.heading-icon {font-size:29px;color:#437b79;}
.page-heading h1 {font-size:27px;}
.page-heading p {font-size:12px;margin:5px 0 0;}
.client-finder {width:240px;justify-content:flex-start;background:#ffffffbf;color:#526b75;font-weight:400;border-color:#dfe7ea;}
.client-finder kbd {margin-left:auto;border:1px solid #e2e8ea;background:#f8fafb;padding:0 4px;font:11px system-ui;border-radius:3px;color:#7b8c93;}
.client-finder .mdi {font-size:18px;}
.client-header {min-height:84px;padding:19px 30px 13px;background:#fbfdfd;border-bottom:0;}
.client-header h1 {font-size:24px;margin:0 0 5px;}
.client-header p {font-size:12px;color:#677d85;}
.client-tabs {background:#fbfdfd;padding:0 30px;gap:26px;top:84px;}
.client-tabs a {font-size:13px;padding:11px 0 12px;}
.panel {border-color:#e7edef;border-radius:9px;box-shadow:var(--shadow);padding:20px;margin-bottom:20px;}
.panel-heading {min-height:30px;margin-bottom:15px;}
.panel-heading h3 {display:flex;align-items:center;gap:8px;}
.panel-heading>a {display:inline-flex;align-items:center;gap:5px;text-decoration:none;font-size:12px;}
.panel-heading>a:hover {text-decoration:underline;}
.panel-heading>a .mdi {font-size:16px;}
.count {display:inline-flex;align-items:center;justify-content:center;min-width:23px;padding:2px 6px;background:#f0f4f5;color:#556b75;border-radius:4px;font-size:11px;font-weight:550;letter-spacing:0;}
.columns {gap:22px;}
.today-grid {grid-template-columns:minmax(0,1fr) minmax(0,1.08fr);align-items:start;}
.filter-bar {display:flex;align-items:center;flex-wrap:wrap;gap:5px;margin:0 0 15px;}
.filter-button {min-height:27px;padding:3px 8px;border:1px solid transparent;border-radius:5px;font-size:11px;font-weight:500;color:#536a73;background:#f2f5f6;gap:5px;}
.filter-button span {font-size:10px;font-variant-numeric:tabular-nums;opacity:.8;}
.filter-button[aria-pressed=true] {background:#2b6365!important;color:white!important;border-color:#2b6365;}
.compact {min-height:29px;padding:4px 8px;font-size:12px;}
/* State definitions are shared across the calendar, Today and work filters. */
.workflow-processing {--state:#c39926;--state-ink:#78601e;--state-bg:#fffaf0;background:var(--state-bg)!important;color:var(--ink)!important;}
.workflow-review {--state:#6aaf80;--state-ink:#396847;--state-bg:#f0f8f3;background:var(--state-bg)!important;color:var(--ink)!important;}
.workflow-billing {--state:#6d9ad0;--state-ink:#3b6087;--state-bg:#f0f5fc;background:var(--state-bg)!important;color:var(--ink)!important;}
.workflow-complete {--state:#a0abb3;--state-ink:#62717b;--state-bg:#f1f3f5;background:var(--state-bg)!important;color:#596a73!important;}
.workflow-error {--state:#c96c77;--state-ink:#8f3b48;--state-bg:#fff1f2;background:var(--state-bg)!important;color:var(--ink)!important;}
.workflow-neutral {--state:#c0ccd0;--state-ink:#63767e;--state-bg:#f8fafb;background:var(--state-bg);}
.appointment-row,.work-row {position:relative;display:flex;align-items:center;gap:12px;min-width:0;text-decoration:none;border:1px solid #e8edef;border-left:4px solid var(--state,#c0ccd0);border-radius:6px;margin:0 0 8px;padding:13px 12px;color:var(--ink);}
.appointment-row:hover,.work-row:hover {border-right-color:#c4d4d9;box-shadow:0 2px 5px #223e4912;}
.appointment-row time {width:77px;flex-shrink:0;font-weight:650;font-size:13px;font-variant-numeric:tabular-nums;white-space:nowrap;border-right:1px solid #dfe8e9;padding-right:11px;}
.row-body {display:grid;gap:3px;min-width:0;flex:1;font-size:12px;}
.row-body strong {font-size:12px;font-weight:600;display:flex;align-items:center;gap:7px;}
.row-body small {font-size:11px;line-height:1.45;color:#60747d;}
.state-dot {width:8px;height:8px;border-radius:50%;background:var(--state,#bac8ce);flex-shrink:0;}
.appointment-row>.mdi,.work-row>.mdi {font-size:17px;color:#8a9ca3;}
.work-row {padding:11px 10px;gap:10px;}
.work-icon {display:grid;place-items:center;width:31px;height:34px;flex-shrink:0;background:#ffffffa3;border-radius:6px;color:var(--state-ink,#527078);}
.work-icon .mdi {font-size:20px;}
.row-category {align-self:flex-start;background:#ffffffa6;color:var(--state-ink,#536970);font-size:10px;padding:2px 5px;border-radius:3px;}
.show-more {width:100%;justify-content:center;font-size:12px;min-height:28px;margin-top:6px;}
.workflow-legend {padding:10px 14px 5px;margin:0;font-size:10px;gap:7px;}
.workflow-legend span {border-left:3px solid var(--state);border-radius:3px;padding:2px 7px;}
.section-tools {background:#ffffffa6;border:1px solid #e4ebed;border-radius:8px;padding:10px 12px;margin-bottom:18px;gap:8px;}
.section-tools>input[type=search],.search {max-width:360px;min-width:190px;}
.section-tools>button:first-of-type:not(.secondary) {margin-left:auto;}
.section-tools .search+button {margin-left:auto;}
.calendar-panel {padding:0;}
.calendar-week {min-width:805px;}
.calendar-day {padding:10px 9px;border-right-color:#e8eef0;min-height:460px;}
.calendar-day h3 {font-size:12px;padding:3px 3px 12px;margin-bottom:12px;border-bottom-color:#e4ebed;}
.calendar-day.is-today h3 {color:#28686a;border-bottom:2px solid #649d98;}
.calendar-event {padding:10px 8px;border-radius:5px;border:1px solid #e5ecee;border-left:3px solid var(--state,#81aaa8);margin:7px 0;font-size:12px;line-height:1.55;}
.calendar-event strong {font-variant-numeric:tabular-nums;}
.calendar-event .workflow-label {font-size:11px;}
.calendar-event .workflow-steps {display:none;}
.calendar-slot {border-color:#c6d7db!important;padding:9px 8px;font-size:12px;border-radius:5px;color:#658087!important;}
.calendar-slot small {font-size:10px;}
.calendar-slot:hover {background:#f4f9f9!important;border-color:#78a8a8!important;}
table {font-size:13px;}
.billing-metrics {display:grid;grid-template-columns:1.3fr 1fr 1fr;gap:0;margin-bottom:20px;background:white;border:1px solid #e5ecef;border-radius:8px;}
.billing-metrics>div {display:flex;align-items:center;gap:12px;padding:14px 18px;border-right:1px solid #e5ecef;}
.billing-metrics>div:last-child {border-right:0;}
.billing-metrics>div>.mdi {color:#679590;font-size:23px;}
.billing-metrics>div>span:not(.count):not(.mdi) {display:grid;gap:3px;flex:1;}
.billing-metrics strong {font-size:21px;font-weight:600;letter-spacing:-.4px;font-variant-numeric:tabular-nums;}
.billing-metrics small {font-size:11px;}
th {background:#f7fafb;color:#617984;text-transform:none;letter-spacing:0;font-size:12px;font-weight:550;}
th,td {padding:13px 16px;border-color:#e8eef0;}
tbody tr:hover {background:#f8fbfb;}
td a {font-weight:600;}
td small {font-size:11px;margin-top:3px;}
.status {font-size:11px;line-height:1.5;border-radius:4px;padding:2px 6px;}
.split {grid-template-columns:254px minmax(0,1fr);gap:20px;}
.record-list {background:#ffffffa8;border:1px solid #e4ecef;border-radius:8px;padding:10px;}
.record-list>.toolbar {margin-bottom:9px;gap:6px;}
.record-list>label {padding:0 3px 8px;margin:0;}
.record-list .check {font-size:11px;font-weight:400;}
.record-list input[type=checkbox] {width:auto;flex:none;}
.record-item {border:1px solid transparent;border-bottom-color:#e7edef;border-radius:5px;margin:3px 0;padding:11px 10px;font-size:12px;line-height:1.55;}
.record-item:hover {background:#f0f6f6;box-shadow:none;}
.record-item[aria-current=true] {background:#eaf3f2;box-shadow:inset 3px 0 #639792;}
.record-item small {font-size:11px;line-height:1.45;}
.record-item.is-notification {padding:4px 9px;border-radius:4px;background:#f6f8f9;}
.record-item.is-notification>span {font-size:11px;}
.record-item.is-notification small {font-size:10px;}
.record-item.is-stopped {background:#fff0f1;border-left-color:#c46b75;}
.record-item.is-processing {background:#fff9e9;border-left-color:#d3b654;}
.editor-panel {padding:0;border-radius:9px;overflow:hidden;}
.editor-meta {padding:15px 18px;gap:10px 15px;background:#fdfefe;}
.editor-meta input,.editor-meta select {min-height:32px;font-size:12px;}
.editor-meta .wide {grid-column:1/-1;}
.editor-meta .toolbar {margin-top:0;}
.editor-toolbar {padding:7px 11px;background:#f6f9fa;border-color:#e3ebed;gap:3px;}
.editor-toolbar button {min-height:27px;padding:3px 5px;border-radius:4px;}
.editor-toolbar button:hover {background:#e3eeee;box-shadow:none;}
.editor-toolbar select {min-height:27px;max-width:109px;font-size:11px;}
.save-status {color:#658078;}
.writing-area,.writing-preview {font:14px/1.65 Arial,sans-serif;min-height:285px;height:clamp(285px,calc(100vh - 520px),570px);padding:24px 28px;background:#fff;}
.writing-area[contenteditable=false] {cursor:default;}
.editor-footer {padding:11px 14px;background:#fcfefe;}
.drafting-controls {border-top:1px solid var(--line);padding:10px 17px;background:#f9fcfc;}
.draft-command {display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
.draft-command button {min-height:29px;font-size:12px;}
.draft-command>small {font-size:11px;}
.draft-state {margin-left:auto;}
.drafting-controls details {border:0;padding:9px 0 0;}
.drafting-controls summary {font-size:11px;font-weight:450;}
.drafting-controls summary small {font-size:10px;}
.drafting-controls textarea {margin-top:5px;font-size:12px;}
.drafting-controls textarea[name=instruction] {min-height:104px;resize:vertical;}
.draft-command [data-trash-draft] {margin-left:auto;}
body[data-section=correspondence] .writing-area,body[data-section=correspondence] .writing-preview {height:clamp(220px,calc(100vh - 640px),480px);min-height:220px;}
.editor-footer .toolbar {gap:6px;}
.editor-footer button,.editor-footer .button {font-size:11px;min-height:30px;padding:4px 8px;}
details {padding:12px 18px;border-color:#e7edef;}
summary {font-size:12px;color:#405d67;}
details[open]>summary {margin-bottom:9px;}
.callout,#notice {border-radius:5px;border-left-width:3px;font-size:12px;line-height:1.55;}
.callout p {margin:5px 0;}
.callout.error,#notice.error {background:#fff1f2;border-color:#c5757b;color:#713c46;}
[data-editor-extra]>.callout {margin:12px 16px;}
.document-workspace {grid-template-columns:155px minmax(210px,.85fr) minmax(285px,1.3fr);gap:16px;}
.folder-tree {background:#ffffff80;padding:7px;border:1px solid #e5ecee;border-radius:7px;}
.folder {border-radius:5px;padding:9px 7px;gap:7px;}
.folder[aria-current=true] {background:#e4f1ed;color:#2a615d;}
.folder:hover {background:#edf4f4;box-shadow:none;}
.document-list {padding:6px;border-radius:8px;}
.document-list .record-item {padding:11px 9px;}
.document-list .is-document {background:#fff;border:1px solid #d6e2e5;padding:14px 11px;margin:6px 0;color:#253e48;min-height:70px;}
.document-list .is-document .document-title {font-size:13px;font-weight:650;line-height:1.4;}
.document-list .is-correspondence {border-left:3px solid #518780;background:#eef6f4;}
.document-list .is-correspondence .document-title {font-size:14px;}
.document-list .is-document>.mdi {font-size:22px;color:#315f65;}
.document-list .is-notification {padding:5px 10px;min-height:36px;background:#f2f4f5;border:0;border-left:2px solid #cad2d5;color:#56656b;}
.document-list .is-notification>.mdi {font-size:15px;color:#65777d;}
.document-list .document-label {min-width:0;flex:1;}
.document-list .document-title {display:block;overflow-wrap:anywhere;}
.document-list .is-notification .document-title {font-size:11px;font-weight:400;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.document-list .is-notification small {font-size:10px;color:#5f6c72;}
.document-list .record-item[aria-current=true] {background:#dbece8;border-color:#6d9a94;box-shadow:inset 3px 0 #315f65;}
.document-preview {padding:17px;min-height:470px;}
.preview-sheet {background:#f2f5f7;border-color:#e0e8ec;border-radius:5px;padding:16px;min-height:360px;}
.preview-sheet img {box-shadow:0 3px 12px #33495318;}
.preview-sheet:has(>.empty) {display:grid;place-items:center;}
.settings-layout {grid-template-columns:188px minmax(0,1fr);gap:22px;}
.settings-nav {background:#ffffffa1;border:1px solid #e5edef;border-radius:8px;padding:8px;gap:3px;height:fit-content;}
.settings-nav button,.settings-nav a {font-size:12px;border-radius:5px;padding:9px 10px;white-space:normal;text-align:left;}
.settings-nav [aria-current=true] {background:var(--tint);color:var(--accent);}
.settings-layout>section>h3:not(:first-child) {margin-top:24px;}
.settings-layout>.panel {padding:20px;}
.settings-layout textarea {line-height:1.65;}
.form-grid {gap:12px 16px;}
.form-actions {flex-wrap:wrap;gap:8px;}
dialog {box-shadow:0 18px 65px #1c384533;border:1px solid #dae5e8;border-radius:12px;padding:27px;}
dialog::backdrop {background:#213c4957;backdrop-filter:blur(3px);}
dialog h2 {font-size:21px;}
.finder-search {margin:0 0 13px;}
.finder-search input {padding:10px 12px;font-size:14px;}
.finder-results {max-height:52vh;overflow:auto;margin-bottom:12px;}
.finder-result {display:flex;width:100%;gap:12px;text-align:left;justify-content:start;background:white;border:0;border-bottom:1px solid var(--line);color:var(--ink);padding:12px 8px;}
.finder-result>span:not(.mdi) {display:grid;gap:3px;flex:1;}
.finder-result strong {font-size:13px;font-weight:550;}
.finder-result small {font-size:11px;}
.finder-result:hover {background:var(--tint);box-shadow:none;}
.pending-appointments {margin-bottom:22px;}
.pending-appointments .panel-heading small {font-size:11px;color:var(--muted);}
.pending-appointment-row {display:flex;align-items:center;gap:15px;padding:12px 0;border-top:1px solid var(--line);}
.pending-appointment-row .row-body {flex:1;}
.pending-appointment-row time {font-size:12px;color:var(--muted);}
.pending-appointment-row .toolbar {margin:0;flex-shrink:0;}
.compact-empty {padding:8px 0;text-align:left;}
@media(max-width:720px){.pending-appointment-row {flex-wrap:wrap;gap:8px;}.pending-appointment-row .row-body {flex-basis:100%;}.pending-appointments .panel-heading {flex-wrap:wrap;}}
.empty {font-size:12px;padding:36px 20px;line-height:1.6;}
@media(min-width:1450px){main {padding-inline:36px;}.today-grid {gap:25px;}.appointment-row {padding-block:15px;}}
@media(max-width:1150px){.today-grid {grid-template-columns:1fr 1fr;gap:16px;}.row-category {display:none;}.appointment-row time {width:65px;font-size:12px;}.appointment-row,.work-row {gap:8px;padding-inline:8px;}.split {grid-template-columns:220px minmax(0,1fr);}.document-workspace {grid-template-columns:135px 1fr;}.document-preview {grid-column:1/-1;}}
@media(max-width:1000px){.sidebar {width:160px;padding-inline:10px;}.workspace {margin-left:160px;}main {padding:22px;}.client-header,.client-tabs {padding-inline:22px;}.client-finder {width:190px;}.page-heading {align-items:flex-start;}.page-heading #page-actions {justify-content:flex-end;}.today-grid {grid-template-columns:1fr;}.document-preview {min-height:360px;}}
@media(max-width:720px){
 .sidebar {position:relative;display:grid;width:100%;padding:13px 15px;gap:13px;height:auto;}
 .wordmark {margin:0;}.wordmark img {width:84px;}.sidebar nav {gap:4px;}.sidebar a:not(.wordmark) {padding:7px 8px;font-size:12px;}
 .sidebar-bottom {gap:2px;}.sidebar-bottom a,.sidebar-bottom button {padding:6px;}.workspace {margin:0;}
 main {padding:18px 15px 30px;}.page-heading {gap:12px;flex-wrap:wrap;margin-bottom:18px;}.page-heading h1 {font-size:24px;}
 .heading-identity {gap:10px;}.heading-icon {font-size:25px;}.page-heading #page-actions {justify-content:start;flex:1;}
 .client-finder {width:auto;min-width:145px;}.client-finder kbd {display:none;}.client-header .client-finder {min-width:0;width:35px;padding:7px;}.client-header .client-finder>span:not(.mdi) {display:none;}
 .client-header {height:78px;min-height:78px;padding:16px 15px;gap:12px;}.client-header h1 {font-size:21px;}.client-tabs {top:78px;gap:22px;padding-inline:15px;}
 .panel {padding:15px;}.panel-heading {gap:8px;}.panel-heading h3 {font-size:15px;}.panel-heading>a {font-size:11px;}.columns {gap:0;}
 .section-tools {padding:9px;gap:7px;}.section-tools>input[type=search] {width:100%;max-width:none;}.section-tools>button:first-of-type:not(.secondary) {margin-left:0;}
 .split {grid-template-columns:1fr;gap:14px;}.record-list {max-height:235px;}.editor-panel,.calendar-panel {padding:0;}.editor-meta {padding:13px;gap:10px;}
 .editor-footer {padding:9px;}.editor-footer .toolbar {gap:5px;}.writing-area,.writing-preview {padding:20px;min-height:300px;}
 .document-workspace {grid-template-columns:1fr;gap:12px;}.folder-tree {display:flex;overflow:auto;gap:5px;}.folder {white-space:nowrap;min-height:32px;flex-shrink:0;}.document-list {max-height:260px;padding:5px;}.document-preview {grid-column:auto;}
 .settings-layout {grid-template-columns:1fr;gap:14px;}.settings-nav {display:flex;overflow:auto;gap:4px;}.settings-nav button,.settings-nav a {white-space:nowrap;flex-shrink:0;}
 .settings-layout>.panel {padding:15px;}.panel>table {min-width:500px;}.settings-layout>.panel>table {min-width:0;}
 .form-grid {grid-template-columns:1fr;}.editor-meta {grid-template-columns:1fr 1fr;}.row-category {display:none;}.work-icon {width:26px;}.row-body small {font-size:11px;}
 .billing-metrics {gap:0;grid-template-columns:1fr 1fr;}.billing-metrics>div {padding:12px;}.billing-metrics>div:first-child {grid-column:1/-1;border-right:0;border-bottom:1px solid var(--line);}.billing-metrics strong {font-size:19px;}.activity-row {flex-wrap:wrap;}
 .calendar-week {grid-template-columns:repeat(7,minmax(160px,1fr));min-width:1120px;}th,td {padding:11px 12px;}dialog {padding:23px 17px;}
}
@media(prefers-reduced-motion:reduce){button,.button {transition:none;}}

/* Client workspace: the viewport owns height, each pane owns its scrolling. */
.birthday-note {display:inline-flex;align-items:center;gap:5px;margin-left:9px;color:#806139;}
.birthday-note .mdi {font-size:15px;}
.overview-grid {display:grid;grid-template-columns:minmax(0,1.6fr) minmax(280px,1fr);gap:20px;align-items:start;}
.overview-sidebar {min-width:0;}
.summary-status {color:var(--muted);font-size:11px;line-height:1.6;padding:0 0 14px;border-bottom:1px solid var(--line);}
.summary-status.error {color:#8f3b48;}
.summary-sections {display:grid;grid-template-columns:1fr 1fr;gap:0 22px;}
.summary-section {padding:17px 0 8px;border-bottom:1px solid var(--line);min-width:0;}
.summary-section:first-child {grid-column:1/-1;}
.summary-section h4 {font-size:12px;font-weight:650;color:#356568;margin:0 0 9px;}
.summary-section p {font-size:13px;line-height:1.65;margin:0 0 9px;white-space:pre-wrap;overflow-wrap:anywhere;}
.source-reference {font-size:10px;font-weight:600;white-space:nowrap;}
.summary-sources {border:0;padding:16px 0 0;}
.source-row {display:grid;gap:3px;padding:8px 0;border-bottom:1px solid var(--line);font-size:12px;}
.source-row small {font-size:10px;color:var(--muted);}
.overview-row {display:flex;align-items:center;gap:10px;text-decoration:none;padding:10px 0;border-bottom:1px solid var(--line);min-width:0;}
.overview-row:last-child {border:0;}
.overview-row>.mdi {color:#71948f;}
.overview-row>span {display:grid;gap:4px;min-width:0;}
.overview-row strong {font-size:12px;font-weight:550;overflow-wrap:anywhere;}
.overview-row small {font-size:11px;color:var(--muted);}
.editor-dock {flex:none;background:var(--surface);z-index:2;box-shadow:0 -2px 8px #203d4809;}
.editor-dock .editor-toolbar {position:static;}
.editor-scroll>.editor-toolbar {position:sticky;top:0;z-index:3;flex-shrink:0;}
.editor-dock .editor-footer {border-top:1px solid var(--line);}
.editor-footer [data-trash-draft] {margin-left:auto;}
.summary-section ul,.summary-section ol {padding-left:19px;margin:0 0 9px;}
.summary-section li {font-size:13px;line-height:1.65;margin:0 0 6px;overflow-wrap:anywhere;}
.summary-section h5 {font-size:12px;margin:10px 0 7px;}
.overview-row.is-notification {padding:5px 0;color:var(--muted);}
.overview-row.is-notification strong {font-size:11px;font-weight:400;}
.overview-row.is-notification small {font-size:10px;}
@media(min-width:761px){
 /* Templates share the bounded list/editor layout; note structures remain a normal page. */
 body[data-section=templates]:has(.split) {height:100dvh;overflow:hidden;}
 body[data-section=templates]:has(.split) .workspace {height:100dvh;min-height:0;display:flex;flex-direction:column;}
 body[data-section=templates]:has(.split) main {flex:1;min-height:0;width:100%;max-width:none;display:flex;flex-direction:column;overflow:hidden;padding:16px 22px;}
 body[data-section=templates] .page-heading,body[data-section=templates] #notice {flex-shrink:0;}
 body[data-section=templates] #notice {max-height:100px;overflow:auto;}
 body[data-section=templates] .split {flex:1;min-height:0;align-items:stretch;}
 body[data-section=templates] .record-list {display:flex;flex-direction:column;min-height:0;max-height:none;overflow:hidden;}
 body[data-section=templates] .record-list>[data-record-list] {scrollbar-gutter:stable;}
 body[data-section=templates] .editor-panel {min-height:0;margin:0;display:flex;flex-direction:column;}
 body[data-section=templates] [data-editor]:not([hidden]) {display:flex;flex-direction:column;flex:1;min-height:0;}
 body[data-section=templates] .writing-area,body[data-section=templates] .writing-preview {height:auto;min-height:220px;flex:1 0 auto;overflow:visible;}
 body[data-client-id]:not([data-client-id=""]) {height:100dvh;overflow:hidden;}
 body[data-client-id]:not([data-client-id=""]) .workspace {height:100dvh;display:flex;flex-direction:column;min-height:0;}
 body[data-client-id]:not([data-client-id=""]) .client-header,
 body[data-client-id]:not([data-client-id=""]) .client-tabs {position:static;flex-shrink:0;}
 body[data-client-id]:not([data-client-id=""]) main {flex:1;min-height:0;overflow:auto;max-width:none;width:100%;padding:16px 22px;}
 body:is([data-section=notes],[data-section=correspondence],[data-section=documents]) main {display:flex;flex-direction:column;overflow:hidden!important;}
 body:is([data-section=notes],[data-section=correspondence],[data-section=documents]) #notice {flex-shrink:0;max-height:100px;overflow:auto;}
 body:is([data-section=notes],[data-section=correspondence]) .split {flex:1;min-height:0;align-items:stretch;gap:16px;}
 body:is([data-section=notes],[data-section=correspondence]) .record-list {display:flex;flex-direction:column;min-height:0;max-height:none;overflow:hidden;}
 .record-list>[data-record-list] {overflow:auto;min-height:0;flex:1;overscroll-behavior:contain;}
 .record-list>.toolbar,.record-list>label {flex-shrink:0;}
 body:is([data-section=notes],[data-section=correspondence]) .editor-panel {min-height:0;margin:0;display:flex;flex-direction:column;}
 body:is([data-section=notes],[data-section=correspondence]) [data-editor]:not([hidden]) {display:flex;flex-direction:column;flex:1;min-height:0;}
 .editor-scroll {flex:1;min-height:0;overflow:auto;display:flex;flex-direction:column;overscroll-behavior:contain;}
 .editor-scroll>.editor-meta,.editor-scroll>[data-editor-extra] {flex-shrink:0;}
 body:is([data-section=notes],[data-section=correspondence]) .writing-area,
 body:is([data-section=notes],[data-section=correspondence]) .writing-preview {height:auto;min-height:220px;flex:1 0 auto;overflow:visible;padding:20px 24px;}
 .writing-preview .writing-area {min-height:0!important;padding:0!important;}
 body[data-section=documents] .section-tools {flex-shrink:0;margin-bottom:12px;}
 body[data-section=documents] .document-workspace {flex:1;min-height:0;align-items:stretch;grid-template-columns:145px minmax(190px,.8fr) minmax(260px,1.3fr);}
 body[data-section=documents] .folder-tree {overflow:auto;display:flex;flex-direction:column;}
 body[data-section=documents] .document-list {max-height:none;overflow:auto;min-height:0;margin:0;}
 body[data-section=documents] .document-preview {grid-column:auto;min-height:0;margin:0;display:flex;flex-direction:column;overflow:auto;}
 body[data-section=documents] .preview-sheet {min-height:0;flex:1;overflow:auto;}
 body[data-section=documents] .document-preview>.panel-heading,
 body[data-section=documents] .preview-pages {flex-shrink:0;}
}
@media(min-width:761px) and (max-width:1100px){
 .overview-grid {grid-template-columns:minmax(0,1fr) 270px;gap:14px;}
 .summary-sections {grid-template-columns:1fr;}
 body[data-section=documents] .document-workspace {grid-template-columns:180px minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);}
 body[data-section=documents] .folder-tree {grid-column:1/-1;flex-direction:row;overflow:auto;}
 body[data-section=documents] .folder {flex-shrink:0;}
}
@media(max-width:760px){
 body[data-section=templates] .record-list {display:flex;flex-direction:column;height:235px;max-height:38dvh;overflow:hidden;}
 body[data-section=templates] .record-list>.toolbar,body[data-section=templates] .record-list>label {flex-shrink:0;}
 body[data-section=templates] .record-list>[data-record-list] {flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;}
 .overview-grid,.summary-sections {grid-template-columns:1fr;}
 .editor-dock {position:sticky;bottom:0;}
 .editor-panel {overflow:visible;}
 .writing-area,.writing-preview {height:auto!important;min-height:280px!important;}
 .editor-scroll {overflow:visible;}
}
.message-routing-grid{display:grid;grid-template-columns:minmax(130px,1fr) minmax(150px,1fr) minmax(150px,1fr);gap:10px;align-items:center}
.message-routing-grid label{margin:0;min-width:0}.message-routing-grid select{width:100%;min-width:0}
@media(max-width:600px){.message-routing-grid{grid-template-columns:1fr}.message-routing-grid>strong{display:none}.message-routing-grid>span{margin-top:12px;font-weight:600}}
