@font-face {
  font-family: Evolventa;
  src: url('/fonts/Evolventa-Regular.woff2') format('woff2');
  font-weight: 100 549;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Evolventa;
  src: url('/fonts/Evolventa-Bold.woff2') format('woff2');
  font-weight: 550 900;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: dark;
  font-family: Evolventa, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-synthesis: none;
  --bg: #141617;
  --paper: #1d2022;
  --raised: #262a2d;
  --fill: #24282b;
  --ink: #f2f4f5;
  --secondary: #c1c7cc;
  --muted: #9da7ae;
  --line: #343a3f;
  --line-soft: #2a3034;
  --field: #191c1e;
  --field-border: #414a51;
  --accent: #0e7496;
  --accent-hover: #006181;
  --accent-ink: #c4d0d7;
  --accent-soft: #153b48;
  --focus: #81cce2;
  --warning: #e2bc7f;
  --warning-soft: #352d22;
  --success: #9bcaad;
  --success-soft: #23382b;
  --sidebar: #101213;
  --sidebar-text: #f2f4f5;
  --sidebar-muted: #a2aab0;
  --sidebar-line: #2a2f33;
  --sidebar-hover: #202529;
  --sidebar-selected: #183d4a;
  --backdrop: rgb(0 0 0 / 50%);
  --ease: cubic-bezier(.22,1,.36,1);
  --radius-control: 10px;
  --radius-panel: 20px;
}
:root[data-theme=light] {
  color-scheme: light;
  --bg: #f5f7fa;
  --paper: #fff;
  --raised: #fff;
  --fill: #f0f3f5;
  --ink: #20272b;
  --secondary: #4f5b63;
  --muted: #64727c;
  --line: #dce2e6;
  --line-soft: #e9edef;
  --field: #fff;
  --field-border: #bcc8d0;
  --accent-ink: #0e7496;
  --accent-soft: #e6f1f5;
  --focus: #0e7496;
  --warning: #805610;
  --warning-soft: #faf1de;
  --success: #2b6049;
  --success-soft: #e8f3ec;
  --backdrop: rgb(0 0 0 / 28%);
}
* { box-sizing: border-box; }
html { min-width:320px; background:var(--bg); -webkit-text-size-adjust:100%; }
body { margin:0; color:var(--ink); background:var(--bg); font-size:15px; line-height:1.6; -webkit-font-smoothing:antialiased; }
button, input, textarea, select { font:inherit; letter-spacing:0; }
button { color:inherit; cursor:pointer; -webkit-tap-highlight-color:transparent; }
button:disabled { cursor:not-allowed; opacity:.5; }
button, input, textarea, select, [tabindex] { outline-offset:4px; }
:focus-visible { outline:2px solid var(--focus); }
input, textarea { caret-color:var(--accent-ink); }
svg { width:18px; height:18px; flex-shrink:0; }
h1, h2, h3, p { margin:0; }
h1 { font-size:34px; font-weight:550; line-height:1.25; letter-spacing:-.025em; overflow-wrap:anywhere; }
h2 { font-size:20px; font-weight:400; line-height:1.4; letter-spacing:-.015em; }
h3 { font-size:16px; font-weight:550; line-height:1.5; }
p { overflow-wrap:anywhere; }
textarea { resize:vertical; min-height:96px; }
::selection { background:var(--accent-soft); color:var(--ink); }
::-webkit-scrollbar { width:5px; height:5px; }
::-webkit-scrollbar-thumb { border-radius:4px; background:var(--field-border); }
::-webkit-scrollbar-track { background:transparent; }
.skip { position:absolute; top:-80px; left:24px; z-index:90; padding:12px; background:var(--paper); color:var(--ink); }
.skip:focus { top:12px; }

/* KEYN Ops proportions: a continuous sidebar and one working canvas. */
.app-frame { display:grid; grid-template-columns:272px minmax(0,1fr); min-height:100dvh; }
.app-body { min-width:0; height:100dvh; }
.queue { position:sticky; top:0; display:flex; flex-direction:column; height:100dvh; min-width:0; padding:0 16px 24px; color:var(--sidebar-text); background:var(--sidebar); border-right:1px solid var(--sidebar-line); overflow:auto; scrollbar-color:var(--sidebar-line) transparent; }
.brand { min-height:104px; display:flex; align-items:center; justify-content:space-between; padding:0 12px; }
.brand img { display:block; width:134px; height:40px; filter:brightness(0) invert(1); opacity:.94; }
.queue-top { display:flex; align-items:center; justify-content:space-between; padding:12px 8px; }
.queue-top h2 { font-size:17px; }
.queue .icon-button { color:var(--sidebar-muted); }
.queue .icon-button:hover { background:var(--sidebar-hover); color:var(--sidebar-text); }
.date-control { display:flex; align-items:center; gap:12px; margin:0 8px 24px; padding:10px 12px; min-height:44px; border:1px solid var(--sidebar-line); border-radius:10px; background:var(--sidebar-hover); color:var(--sidebar-muted); color-scheme:dark; }
.date-control input { width:100%; min-width:0; border:0; outline-offset:0; background:transparent; color:var(--sidebar-text); font-size:13px; }
.queue-caption { display:flex; justify-content:space-between; padding:0 12px 12px; color:var(--sidebar-muted); font-size:12px; }
.patient-list { position:relative; isolation:isolate; display:flex; flex-direction:column; gap:4px; }
.queue-selection { position:absolute; left:0; top:0; z-index:0; width:100%; background:var(--sidebar-selected); border-radius:10px; pointer-events:none; transform-origin:left top; }
.patient-item { position:relative; display:flex; align-items:flex-start; gap:12px; width:100%; padding:16px 12px; border:0; border-radius:10px; background:transparent; text-align:left; }
.patient-item:hover { background:var(--sidebar-hover); }
.patient-item { z-index:1; }
.patient-item.selected { background:transparent; }
.patient-item.selected .appointment-time { color:var(--sidebar-text); }
.appointment-time { padding-top:2px; color:var(--sidebar-muted); font-size:12px; font-variant-numeric:tabular-nums; }
.appointment-body { display:flex; flex-direction:column; gap:6px; min-width:0; flex:1; }
.appointment-body strong { font-size:14px; line-height:1.5; font-weight:400; }
.appointment-kind { font-size:12px; color:var(--sidebar-muted); }
.appointment-reason { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; font-size:12px; line-height:1.5; color:var(--sidebar-muted); }
.patient-item.selected .appointment-kind, .patient-item.selected .appointment-reason { color:#bad0d9; }
.patient-item>svg { display:none; }
.queue .field.compact { margin:0 8px 24px; }
.queue .field.compact select { color:var(--sidebar-text); background:var(--sidebar-hover); border-color:var(--sidebar-line); color-scheme:dark; font-size:13px; }
.queue .empty { color:var(--sidebar-muted); }
.topbar { display:flex; align-items:center; justify-content:space-between; gap:24px; min-height:104px; padding:20px 32px; }
.page-heading { min-width:0; }
.topbar-brand { display:none; }
.data-source-name { display:block; margin-bottom:4px; font-size:12px; color:var(--muted); }
.app-title { font-size:20px; line-height:1.4; letter-spacing:-.015em; }
.topbar-actions { display:flex; align-items:center; gap:8px; }
.icon-button { display:inline-flex; align-items:center; justify-content:center; width:36px; height:36px; flex-shrink:0; padding:0; border:0; border-radius:10px; background:transparent; color:var(--muted); }
.icon-button:hover { background:var(--fill); color:var(--ink); }
.button { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:10px 16px; border:1px solid transparent; border-radius:10px; background:var(--accent); color:#fff; font-size:14px; line-height:1.5; font-weight:400; text-decoration:none; }
.button:hover:not(:disabled) { background:var(--accent-hover); }
.button.secondary { background:var(--fill); color:var(--ink); border-color:var(--line); }
.button.secondary:hover:not(:disabled) { background:var(--raised); border-color:var(--field-border); }
.button.small, .connect-button { min-height:36px; padding:8px 12px; font-size:12px; }
.text-button { display:inline-flex; align-items:center; gap:8px; border:0; padding:4px 0; background:transparent; color:var(--accent-ink); text-align:left; font-size:13px; line-height:1.6; }
.text-button:hover { text-decoration:underline; text-underline-offset:4px; }
.text-button svg { width:16px; height:16px; }
.button, .icon-button, .text-button, .patient-item, .tabs button, .segmented button {
  transition:transform 160ms var(--ease), background-color 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease);
}
.button:active:not(:disabled), .icon-button:active:not(:disabled) { transform:scale(.97); }
.text-button:active:not(:disabled) { transform:translateY(1px); }
.layout { display:grid; grid-template-columns:minmax(0,1fr) 300px; align-items:stretch; grid-template-rows:minmax(0,1fr); height:calc(100dvh - 104px); gap:24px; max-width:1640px; padding:0 32px 32px; margin:0 auto; }
main { min-width:0; height:100%; min-height:0; border:1px solid var(--line); border-radius:20px; background:var(--paper); overflow:auto; }
.patient-header { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:20px 16px; padding:32px 32px 28px; }
.patient-heading { display:flex; align-items:flex-start; grid-column:1/-1; gap:12px; min-width:0; }
.patient-meta { display:flex; align-items:center; flex-wrap:wrap; gap:8px 16px; margin-top:12px; color:var(--muted); font-size:13px; }
.header-actions { grid-row:2; grid-column:2; }
.patient-context { display:flex; align-items:center; flex-wrap:wrap; gap:8px 12px; grid-row:2; grid-column:1; align-self:center; font-size:12px; color:var(--muted); }
.patient-context>span { display:flex; align-items:center; gap:6px; }
.patient-context svg { width:14px; height:14px; }
.patient-context .text-button { font-size:12px; }
.tabs { position:relative; isolation:isolate; display:flex; gap:4px; padding:4px; margin:0 32px; border-radius:12px; background:var(--field); }
.tabs button { position:relative; z-index:1; display:flex; align-items:center; justify-content:center; gap:6px; flex:1 1 auto; min-width:0; padding:10px 8px; border:0; border-radius:9px; background:transparent; color:var(--muted); font-size:13px; white-space:nowrap; }
:root[data-theme=light] .tabs { background:var(--fill); }
.tabs button:hover { color:var(--ink); }
.tabs button.active { color:var(--ink); }
.tabs button span { color:var(--muted); font-size:11px; }
.tab-indicator { position:absolute; z-index:0; left:0; top:4px; bottom:4px; width:1px; border:1px solid var(--line); border-radius:9px; background:var(--raised); pointer-events:none; transform-origin:left center; box-shadow:0 1px 3px rgb(0 0 0 / 8%); }
.workspace-content { padding:0 32px 32px; }
.visit-purpose { padding:28px 0; border-bottom:1px solid var(--line-soft); }
.visit-purpose h2 { max-width:54ch; color:var(--secondary); font-size:18px; line-height:1.65; letter-spacing:0; }
.content-section { padding:28px 0; border-bottom:1px solid var(--line-soft); }
.section-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:24px; }
.section-heading>.muted { font-size:12px; text-align:right; }
.muted { color:var(--muted); font-size:14px; line-height:1.7; }
.facts { display:flex; flex-direction:column; gap:24px; }
.fact p, .changes p { font-size:16px; line-height:1.75; color:var(--ink); }
.source-link { display:flex; align-items:center; gap:6px; padding:0; margin-top:8px; border:0; background:transparent; color:var(--muted); font-size:12px; line-height:1.6; text-align:left; transition:color 160ms var(--ease); }
.source-link svg { width:13px; height:13px; }
.source-link:hover { color:var(--accent-ink); }
.summarize-button { margin:-8px 0 24px; }
.changes { display:flex; flex-direction:column; gap:24px; }
.label { display:inline-flex; padding:4px 8px; border-radius:6px; color:var(--secondary); background:var(--fill); font-size:11px; line-height:1.5; white-space:nowrap; }
.label.warning { color:var(--warning); background:var(--warning-soft); }
.label.success { color:var(--success); background:var(--success-soft); }

/* Current input and historical evidence use different surfaces. */
.instructions { padding:24px 0; margin:0; border-bottom:1px solid var(--line-soft); }
.instructions h2 { font-size:20px; }
.instructions .section-heading { margin-bottom:16px; }
.instructions textarea, .field input, .field textarea, .field select { width:100%; padding:12px 16px; border:1px solid var(--field-border); border-radius:10px; background:var(--field); color:var(--ink); font-size:16px; line-height:1.7; transition:border-color 180ms var(--ease), background-color 180ms var(--ease); }
.instructions textarea:hover, .field input:hover, .field textarea:hover, .field select:hover { border-color:var(--muted); }
.instructions textarea:focus, .field input:focus, .field textarea:focus, .field select:focus { border-color:var(--accent-ink); }
.editor-toolbar { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-top:12px; color:var(--muted); font-size:11px; }
.editor-toolbar>div { display:flex; align-items:center; gap:16px; }
#save-status { display:flex; align-items:center; gap:6px; }
#save-status[data-status=saved]::before { content:''; width:5px; height:5px; border-radius:50%; background:var(--success); }
.field { display:flex; flex-direction:column; gap:8px; margin-bottom:24px; }
.field>span { font-size:13px; color:var(--secondary); }
.field.compact>span { font-size:12px; }
.source-panel { position:relative; display:flex; flex-direction:column; min-width:0; max-height:100%; align-self:start; overflow:auto; background:transparent; }
.source-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 4px 24px; }
.source-heading h2 { color:var(--muted); font-size:14px; letter-spacing:0; }
.source-paper { padding:24px 20px; border:1px solid var(--line); border-radius:16px; background:var(--paper); }
.source-meta { margin-bottom:20px; }
.source-meta .label { padding:0; background:transparent; color:var(--muted); }
.source-meta h3 { margin:12px 0; font-size:22px; font-weight:400; line-height:1.5; letter-spacing:-.02em; }
.source-meta p { color:var(--muted); font-size:12px; line-height:1.8; }
.source-body { font-size:15px; line-height:1.85; overflow-wrap:anywhere; }
.source-placeholder { margin:auto 0; padding:64px 24px; color:var(--muted); text-align:center; }
.source-placeholder>svg { width:32px; height:32px; margin-bottom:16px; }
.source-placeholder h3 { font-size:16px; font-weight:400; }
.source-placeholder .button { margin-top:20px; }
.close-source, .mobile-only { display:none; }
.empty { max-width:600px; padding:96px 32px; margin:auto; text-align:center; color:var(--muted); }
.empty h2 { margin:16px 0 24px; color:var(--ink); }
.empty p { margin-bottom:24px; font-size:14px; }
.empty.small { padding:24px 12px; text-align:left; font-size:13px; }
.empty-icon svg { width:32px; height:32px; }
.empty-inline { padding:24px; border-radius:10px; background:var(--fill); }
.empty-inline h3 { font-size:14px; font-weight:400; }
.empty-inline p { margin-top:8px; font-size:14px; color:var(--muted); }
.loading-bar { position:relative; overflow:hidden; width:96px; height:2px; margin:auto; background:var(--line); }
.loading-bar:after { content:''; position:absolute; inset:0; background:var(--accent-ink); animation:loading 1.2s var(--ease) infinite; transform-origin:left; }
@keyframes loading { from { transform:scaleX(.15); } to { transform:scaleX(1); } }
.search-field { display:flex; align-items:center; gap:12px; padding:12px 16px; margin-bottom:24px; border:1px solid var(--field-border); border-radius:10px; background:var(--field); color:var(--muted); }
.search-field input { width:100%; border:0; outline:none; background:transparent; color:var(--ink); font-size:15px; }
.search-field:focus-within { outline:2px solid var(--focus); outline-offset:4px; }
.history-source-actions { display:flex; align-items:center; flex-wrap:wrap; gap:16px; margin-bottom:24px; }
.timeline-item { display:grid; grid-template-columns:100px minmax(0,1fr); gap:16px; padding:24px 0; border-bottom:1px solid var(--line-soft); }
.timeline-date { color:var(--muted); font-size:12px; line-height:1.8; }
.timeline-item h3 { margin-bottom:8px; font-size:18px; font-weight:400; }
.timeline-item p:not(.muted) { margin:16px 0; white-space:pre-line; font-size:16px; line-height:1.75; }
.table-scroll { overflow:auto; margin-top:24px; }
table { border-collapse:collapse; width:100%; font-size:14px; text-align:left; }
th { padding:12px; background:var(--fill); color:var(--muted); font-size:12px; font-weight:400; vertical-align:bottom; }
td { padding:20px 12px; border-bottom:1px solid var(--line-soft); vertical-align:top; font-variant-numeric:tabular-nums; }
th:not(:first-child), td:not(:first-child) { text-align:right; }
td strong { font-size:14px; font-weight:400; }
.cell-detail { display:block; margin-top:8px; color:var(--muted); font-size:12px; }
.notice { margin-top:24px; padding:16px; border:1px solid var(--line); border-radius:10px; background:var(--warning-soft); color:var(--warning); font-size:13px; line-height:1.7; }
.spaced { margin-top:32px; }
.document-intro { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding-top:28px; }
.document-intro h2 { font-size:20px; }
.document-form { padding-top:24px; }
.medication { min-width:0; margin:24px 0; padding:20px; border:1px solid var(--line); border-radius:14px; }
.medication legend { padding:0 8px; color:var(--muted); font-size:13px; }
.med-top { display:flex; align-items:flex-start; gap:12px; }
.med-top .field { flex:1; min-width:0; }
.med-top>.icon-button { margin-top:28px; }
.med-grid { display:grid; grid-template-columns:1fr 1fr; gap:0 16px; }
.empty-med { padding:16px 0; color:var(--muted); font-size:13px; }
.document-check { padding-top:24px; margin-top:24px; border-top:1px solid var(--line-soft); }
.check-label { display:flex; align-items:flex-start; gap:12px; font-size:13px; line-height:1.7; }
.check-label input { flex-shrink:0; width:16px; height:16px; margin:4px 0 0; accent-color:var(--accent); }
.document-actions { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin-top:24px; }
.preview-controls { padding:0 0 20px; }
.segmented { display:flex; padding:4px; border-radius:10px; background:var(--field); border:1px solid var(--line); }
.segmented button { flex:1; padding:8px; border:0; border-radius:7px; background:transparent; color:var(--muted); font-size:12px; }
.segmented button.active { background:var(--raised); color:var(--ink); box-shadow:0 1px 3px rgb(0 0 0 / 8%); }
.preview-controls>.text-button { margin-top:12px; font-size:12px; }
.preview-status { padding:12px 16px; border:1px solid var(--line); border-bottom:0; border-radius:14px 14px 0 0; color:var(--muted); background:var(--paper); font-size:11px; }
.document-preview { padding:20px 16px; margin:0; border:1px solid var(--line); border-top:0; border-radius:0 0 14px 14px; background:var(--paper); font:15px/1.8 Evolventa,sans-serif; white-space:pre-wrap; overflow-wrap:anywhere; }
.anonymous-check { padding:20px 0; color:var(--muted); font-size:12px; }
.anonymous-check .check-label { margin-top:12px; color:var(--ink); }
.export-actions { display:flex; flex-wrap:wrap; gap:12px; padding:20px 0; border-top:1px solid var(--line); }
.export-actions .button { min-height:40px; padding:8px 12px; font-size:12px; }
.revision-list { padding-top:24px; margin-top:24px; border-top:1px solid var(--line-soft); }
.revision-list>div { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:16px 0; border-bottom:1px solid var(--line-soft); font-size:12px; }
.overlay { position:fixed; inset:0; z-index:60; display:flex; align-items:center; justify-content:center; padding:24px; background:var(--backdrop); }
.dialog { width:min(620px,100%); max-height:90dvh; overflow:auto; padding:32px; border:1px solid var(--line); border-radius:24px; background:var(--paper); box-shadow:0 24px 64px rgb(0 0 0 / 24%); transform-origin:center; }
.dialog>.section-heading { margin-bottom:24px; }
.dialog h2 { font-size:24px; }
.dialog>p { margin-bottom:24px; color:var(--muted); font-size:13px; }
.correction-dialog { width:min(1000px,100%); }
.correction-grid { display:grid; grid-template-columns:1fr 1fr; gap:24px; }
.correction-grid section { min-width:0; }
.correction-grid h3 { margin-bottom:12px; font-size:14px; }
.correction-grid pre { padding:20px; border-radius:10px; background:var(--field); font:15px/1.8 Evolventa,sans-serif; white-space:pre-wrap; overflow-wrap:anywhere; }
.warning-text { color:var(--warning); }
#toast { position:fixed; left:50%; bottom:24px; z-index:80; padding:16px 24px; max-width:min(680px,calc(100vw - 40px)); border:1px solid var(--line); border-radius:12px; background:var(--raised); color:var(--ink); font-size:13px; line-height:1.7; box-shadow:0 8px 24px rgb(0 0 0 / 12%); opacity:0; transform:translate(-50%,12px); pointer-events:none; white-space:pre-line; transition:opacity 240ms var(--ease),transform 320ms var(--ease); }
#toast.visible { opacity:1; transform:translate(-50%,0); }
.initial-loading { padding:80px; text-align:center; color:var(--muted); }
.drawer-backdrop, .queue-backdrop { display:none; }
@media(min-width:1600px) {
  .app-frame { grid-template-columns:288px minmax(0,1fr); }
  .layout { grid-template-columns:minmax(0,1fr) 340px; gap:32px; }
  .patient-header { padding:40px 40px 32px; }
  .workspace-content { padding:0 40px 40px; }
  .tabs { margin:0 40px; }
  h1 { font-size:38px; }
}
@media(max-width:1199px) {
  .app-frame { grid-template-columns:256px minmax(0,1fr); }
  .layout { grid-template-columns:minmax(0,1fr); padding:0 24px 24px; }
  .topbar { padding-left:24px; padding-right:24px; }
  .source-panel { display:none; }
  .source-open>.source-panel { display:flex; position:fixed; inset:12px 12px 12px auto; z-index:40; width:min(440px,85vw); max-height:none; height:calc(100dvh - 24px); padding:20px; border:1px solid var(--line); border-radius:20px; background:var(--bg); box-shadow:0 16px 48px rgb(0 0 0 / 20%); }
  .source-heading { padding:0 0 20px; }
  .source-open>.drawer-backdrop { display:block; position:fixed; inset:0; z-index:39; padding:0; border:0; background:var(--backdrop); cursor:default; }
  .close-source { display:inline-flex; }
}
@media(max-width:759px) {
  .app-frame { display:block; }
  .app-body { height:auto; }
  .topbar { min-height:88px; gap:12px; padding:16px; }
  .app-title { font-size:15px; max-width:140px; }
  .topbar .app-title { display:none; }
  .topbar-brand { display:block; margin-bottom:8px; }
  :root[data-theme=dark] .topbar-brand { filter:brightness(0) invert(1); }
  .data-source-name { font-size:11px; }
  .topbar-actions { gap:2px; }
  .connect-button { padding:8px; min-height:36px; font-size:11px; }
  .topbar-actions .icon-button { width:32px; height:36px; }
  .layout { display:block; height:auto; padding:0 12px 16px; }
  main { height:auto; min-height:calc(100dvh - 104px); border-radius:16px; }
  .queue { display:none; }
  .queue-open>.queue { display:flex; position:fixed; inset:8px auto 8px 8px; z-index:50; width:min(304px,90vw); height:auto; border:1px solid var(--sidebar-line); border-radius:20px; box-shadow:0 16px 48px rgb(0 0 0 / 24%); }
  .queue-open>.queue-backdrop { display:block; position:fixed; inset:0; z-index:49; border:0; padding:0; background:var(--backdrop); }
  .brand { min-height:88px; }
  .mobile-only { display:inline-flex; }
  .patient-header { display:flex; flex-direction:column; gap:20px; padding:24px 20px; }
  .patient-heading { gap:8px; }
  .patient-heading .mobile-only { width:24px; height:28px; margin-left:-4px; margin-top:2px; color:var(--accent-ink); }
  h1 { font-size:27px; line-height:1.3; }
  .patient-meta { font-size:12px; gap:6px; margin-top:12px; }
  .patient-meta span { width:100%; }
  .header-actions>.button { width:100%; }
  .header-actions { width:100%; }
  .patient-context { align-self:flex-start; gap:8px; font-size:11px; }
  .tabs { margin:0 16px; gap:2px; }
  .tabs button { padding:10px 6px; font-size:12px; }
  .tabs button span { font-size:10px; }
  .workspace-content { padding:0 20px 24px; }
  .visit-purpose { padding:24px 0; }
  .visit-purpose h2 { font-size:17px; }
  .content-section { padding:24px 0; }
  h2, .instructions h2 { font-size:19px; }
  .section-heading { gap:12px; align-items:flex-start; }
  .section-heading>.button { font-size:11px; padding:8px; }
  .facts { gap:24px; }
  .fact p, .changes p { font-size:16px; }
  .editor-toolbar { align-items:flex-start; flex-direction:column; }
  .editor-toolbar .text-button { font-size:12px; }
  .timeline-item { display:block; }
  .timeline-date { margin-bottom:12px; }
  .med-grid, .correction-grid { grid-template-columns:1fr; }
  .medication { padding:16px; }
  .document-intro { flex-direction:column; padding-top:24px; }
  .document-intro h2 { font-size:19px; }
  .document-actions>.button { width:100%; }
  .source-open>.source-panel { inset:8px; width:auto; height:calc(100dvh - 16px); padding:20px; }
  .overlay { padding:12px; }
  .dialog { padding:24px 20px; border-radius:20px; }
  .dialog h2 { font-size:22px; }
  .revision-list>div { flex-direction:column; align-items:flex-start; }
  #toast { width:calc(100vw - 32px); bottom:16px; padding:16px; }
}
html[data-input=keyboard] button { transition:none; }
html[data-input=keyboard] button:active { transform:none; }
@media(prefers-reduced-motion:reduce) {
  *, *:before, *:after { animation:none!important; transition:none!important; scroll-behavior:auto!important; }
  button:active { transform:none!important; }
}
@media(prefers-contrast:more) { :root { --muted:var(--secondary); --line:var(--field-border); } }
@media print {
  :root { color-scheme:light; --ink:#20272b; --secondary:#4f5b63; --muted:#64727c; --paper:#fff; --field:#fff; --bg:#fff; --line:#dce2e6; --line-soft:#e9edef; --accent-ink:#0e7496; }
  .queue, .topbar, .tabs, .source-panel, .header-actions, button { display:none!important; }
  .app-frame, .layout { display:block; height:auto; padding:0; }
  .app-body { height:auto; }
  main { height:auto; min-height:0; overflow:visible; border:0; border-radius:0; }
  .patient-header, .workspace-content { padding:0 0 20px; }
  body, main, .instructions, .field textarea { color:#000; background:#fff; }
  .field textarea { border:0; padding:0; }
}
.login-page { display:flex; min-height:100dvh; height:auto; align-items:center; justify-content:center; flex-direction:column; gap:32px; margin:0; padding:32px; border:0; border-radius:0; text-align:center; }
.login-page img { filter:brightness(0) invert(1); }
.signed-user { max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:12px; }
@media(max-width:759px) { .signed-user { display:none; } }
