/* MediCare+ (chef, MIT): .design/medicare/DESIGN.md. Primary adapted to SoneHealth. */
@font-face { font-family: 'Figtree'; src: url('../fonts/medicare/figtree-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('../fonts/medicare/figtree-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Open Sans'; src: url('../fonts/medicare/open-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Open Sans'; src: url('../fonts/medicare/open-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Open Sans'; src: url('../fonts/medicare/open-sans-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('../fonts/medicare/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('../fonts/medicare/ibm-plex-mono-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
    color-scheme: light;
    --ink: #0f172a;
    --muted: #475569;
    --accent: #662046;
    --accent-hover: #551b3a;
    --accent-active: #461630;
    --line: #e2e8f0;
    --paper: #fafcff;
    --surface: #fff;
    --soft: #f8f0f5;
    --soft-active: #f0e1e9;
    --focus: #662046;
    --secondary: #48cae4;
    --tertiary: #90e0ef;
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    --font-body: 'Open Sans', 'Segoe UI', sans-serif;
    --font-heading: 'Figtree', 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', Consolas, monospace;
    --shadow-subtle: 0 1px 3px #0000000f, 0 1px 2px #0000000a;
    --shadow-medium: 0 4px 12px #00000012, 0 1px 3px #0000000a;
    --shadow-large: 0 12px 32px #00000014, 0 4px 8px #0000000a;
    --bs-primary: #662046;
    --bs-link-color: #662046;
    --bs-primary-rgb: 102, 32, 70;
    --bs-link-hover-color: #551b3a;
    --bs-body-color: #0f172a;
    --bs-body-bg: #fafcff;
    --bs-border-color: #e2e8f0;
    --bs-body-font-family: var(--font-body);
    --bs-font-monospace: var(--font-mono);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--font-body); }
.shell { width: min(100%, 1220px); margin-inline: auto; padding: 24px clamp(18px, 3vw, 44px); }
.top { display: flex; width: 100%; max-width: none; padding-inline: max(18px, calc((100vw - 1220px) / 2 + 44px)); justify-content: space-between; align-items: center; gap: 24px; border-bottom: 1px solid #ffffff33; background: var(--accent); color: #fff; }
.top nav { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.top nav a, .top nav a:hover, .top .brand, .top .brand:hover, .top .brand small { color: #fff; }
.top .brand-pulse { color: #f6dce9; }
.top .quiet { color: #fff; border-color: #ffffff70; background: transparent; }
.top .quiet:hover { color: #fff; background: #ffffff24; border-color: #fff; }
.top :where(a, button):focus-visible { outline-color: #fff; }
.top nav form { margin: 0; }
.account-top { gap: 20px; flex-wrap: wrap; padding-right: 24px; }
.account-top > nav { flex: 1; justify-content: center; gap: 12px 20px; }
.header-account-tools { display: flex; align-items: center; gap: 20px; margin-left: auto; padding-left: 20px; border-left: 1px solid #ffffff40; min-width: 0; }
.header-account-tools .language-switcher { padding-right: 18px; border-right: 1px solid #ffffff40; }
.header-account-identity { display: grid; gap: 3px; min-width: 0; max-width: 150px; line-height: 1.4; }
.header-account-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: #f6dce9; }
.header-account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.header-account-tools form { margin: 0; flex-shrink: 0; }
.header-account-tools button { min-height: 40px; padding: 8px 12px; font-size: .8rem; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand-pulse { width: 30px; height: 24px; flex: none; color: var(--accent); }
.brand small { color: var(--accent); font-size: .78em; }
main.shell { flex: 1; min-height: 0; padding-block: 40px 80px; }
footer.shell { margin-top: auto; border-top: 1px solid var(--line); font-size: .85rem; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--font-heading); }
h1 { font-size: 26px; font-weight: 700; line-height: 1.3; letter-spacing: .01em; margin-bottom: 8px; }
h2 { font-size: 20px; font-weight: 600; line-height: 1.4; }
h3 { font-size: 18px; font-weight: 600; line-height: 1.4; }
p { max-width: 72ch; }
.muted, .lede { color: var(--muted); }
.lede { margin: 0; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--accent); font-size: 11px; line-height: 1.4; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.page-heading, .patient-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 0 0 30px; }
.page-heading, .patient-heading { padding: 24px 0; background: transparent; border: 0; border-bottom: 1px solid var(--line); }
.count-label { color: var(--muted); font-weight: 600; white-space: nowrap; padding-bottom: 4px; }
.patient-heading { margin-top: 26px; margin-bottom: 22px; }
.patient-stats { color: var(--muted); white-space: nowrap; margin: 0 0 4px; }
.patient-stats strong { color: var(--ink); font-size: 1.15rem; }

a { color: var(--accent); text-underline-offset: 4px; }
a:hover { color: var(--accent-hover); }
button, .button { min-height: 44px; border: 1.5px solid transparent; border-radius: 8px; padding: 10px 24px; background: var(--accent); color: #fff; cursor: pointer; font: 600 15px/1.4 var(--font-body); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button:hover, .button:hover { background: var(--accent-hover); color: #fff; }
button:active, .button:active { background: var(--accent-active); }
button:disabled { color: #94a3b8; background: #e2e8f0; cursor: not-allowed; }
.quiet { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.quiet:hover { color: var(--accent-hover); background: var(--soft); }
:where(a, button, input, select, textarea, summary, audio):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 2px var(--paper); }
input, select, textarea { width: 100%; max-width: 100%; min-height: 44px; border: 1.5px solid #cbd5e1; border-radius: 8px; padding: 10px 14px; color: var(--ink); background: var(--surface); font: inherit; }
input::placeholder, textarea::placeholder { color: #64748b; opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { display: block; margin: 16px 0 6px; font-size: 14px; font-weight: 600; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 24px 0; }
legend { font-weight: 650; padding-inline: 4px; }
fieldset label { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 400; margin: 8px 16px 8px 0; }
input:is([type="checkbox"], [type="radio"]) { width: 20px; height: 20px; min-height: 20px; padding: 0; accent-color: var(--accent); }
textarea { min-height: 100px; }
.form-grid, .split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.inline { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.inline label { flex: 1; min-width: 200px; }
.inline form { display: inline; }
.search-bar { max-width: 620px; margin: 0 0 34px; }
.search-bar label { margin-top: 0; }
.search-controls { display: flex; gap: 10px; align-items: center; }
.search-controls input { flex: 1; }
.search-controls a { white-space: nowrap; }
.notice { background: #ecfdf5; color: #065f46; padding: 16px; border: 1px solid #a7f3d0; border-left: 4px solid var(--success); border-radius: 8px; }
.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; border-left: 4px solid var(--error); border-radius: 8px; padding: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 24px; margin: 24px 0; box-shadow: var(--shadow-subtle); }
.compact { max-width: 480px; margin: 48px auto; }

.workspace-intro { max-width: 760px; padding-block: 24px 64px; }
.workspace-intro h1 { font-size: 34px; line-height: 1.2; letter-spacing: .02em; margin-block: 16px 24px; }
.workspace-intro .lede { font-size: 18px; }
.workspace-intro .button { margin-top: 32px; }
.workspace-tools { margin-bottom: 40px; }
.workspace-tools > h2 { margin-bottom: 24px; }
.workspace-tools .clinical-summary { margin-bottom: 0; display: flex; flex-direction: column; }
.workspace-links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: auto; }
.workspace-links a { display: inline-flex; align-items: center; min-height: 44px; }
.workspace-roadmap { padding: 0; margin: 24px 0; list-style: none; }
.workspace-roadmap li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.workspace-status { color: #065f46; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 4px; padding: 4px 12px; font-size: 12px; font-weight: 700; }
.workspace-roadmap :is(.workspace-status, .pending) { flex: none; }
@media (max-width: 620px) {
    .workspace-intro { padding-block: 16px 40px; }
    .workspace-roadmap li { align-items: flex-start; flex-direction: column; gap: 8px; }
}

/* The sign-in surface is independent of the clinical workspace. */
.auth-login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--accent); }
.auth-login .top { width: 100%; max-width: none; border: 0; border-bottom: 1px solid #ffffff33; background: transparent; }
.auth-login .brand, .auth-login .brand:hover, .auth-login .brand small, .auth-login .top nav a { color: #fff; }
.auth-login .brand-pulse { color: #f6dce9; }
.auth-login .top nav a:hover { color: #f6dce9; }
.auth-login .top :where(a, button):focus-visible { outline-color: #fff; }
.auth-login main.shell { flex: 1; width: 100%; max-width: none; min-height: 0; display: grid; place-items: center; padding: clamp(32px, 6vh, 72px) 20px; background: transparent; }
.auth-login footer.shell { width: 100%; max-width: none; margin-top: auto; padding: 18px clamp(18px, 4vw, 44px); border-color: #ffffff33; background: transparent; color: #fff; }
.auth-login footer.shell a { color: #fff; text-decoration: none; }
.auth-login footer.shell a:hover, .auth-login footer.shell a:focus-visible { color: #fff; text-decoration: underline; }
.auth-login footer.shell a:focus-visible { outline-color: #fff; }
.login-card { width: min(100%, 480px); padding: clamp(24px, 4vw, 40px); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-large); }
.login-intro { margin-bottom: 32px; }
.login-intro .eyebrow { margin-bottom: 16px; }
.login-intro h1 { margin-bottom: 8px; font-size: 34px; line-height: 1.2; letter-spacing: .02em; }
.login-intro p { color: var(--muted); margin: 0; }
.login-form { display: grid; gap: 20px; }
.login-field { display: grid; gap: 8px; }
.login-field label { margin: 0; font-size: .91rem; }
.login-field input { min-height: 52px; background: #fff; }
.login-form button { width: 100%; min-height: 52px; margin-top: 8px; }
.login-recovery { display: block; width: fit-content; margin: 18px 0 0 auto; font-size: .9rem; font-weight: 600; }
.login-footnote { margin: 34px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .83rem; line-height: 1.55; }

.breadcrumb { color: var(--muted); font-size: .88rem; line-height: 1.8; }
.breadcrumb a { color: var(--muted); }
.breadcrumb span { margin-inline: 4px; }
.profile-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin: 0 0 32px; }
.profile-tabs a { display: block; padding: 14px 18px; border-bottom: 3px solid transparent; color: var(--muted); text-decoration: none; font-weight: 650; text-align: center; }
.profile-tabs a:hover { background: var(--soft); color: var(--ink); }
.profile-tabs a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--ink); background: var(--surface); }
.profile-section { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-subtle); }
.section-heading-row { display: flex; justify-content: space-between; align-items: start; gap: 18px; margin: 0 0 17px; }
.section-heading-row h2, .section-heading-row h3 { margin-bottom: 4px; }
.section-heading-row p { margin: 0; }
.text-action { white-space: nowrap; font-weight: 650; }
.section-heading { margin-bottom: 14px; }
.data-section { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-subtle); }
.table-wrap { max-width: 100%; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 14px; line-height: 1.55; }
th, td { padding: 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { color: var(--muted); font-size: .82rem; font-weight: 700; white-space: nowrap; }
tbody th { font-weight: 650; }
tbody tr:hover { background: var(--soft); }
.row-action { text-align: right; white-space: nowrap; }
.row-action a { font-weight: 650; text-decoration-thickness: 1px; }
.empty-row { color: var(--muted); padding: 34px 14px; }
.empty-state { color: var(--muted); padding: 24px; border: 1px dashed var(--line); }
.recording-group { margin: 0 0 28px; }
.recording-group-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-block: 10px; border-bottom: 1px solid var(--line); }
.recording-group-heading h3 { margin: 0; }
.recording-group-heading span { color: var(--muted); font-size: .9rem; }
.clinical-summary { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 24px; margin: 0 0 24px; box-shadow: var(--shadow-subtle); }
.clinical-summary > :last-child { margin-bottom: 0; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; margin: 0; }
.facts div { border-top: 1px solid var(--line); padding: 11px 0; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; font-weight: 650; }
.share-row { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.share-row span:last-child { color: var(--muted); }
.action-drawer { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin: 24px 0; padding: 0 24px; }
.action-drawer > summary { cursor: pointer; font-weight: 680; padding: 16px 2px; color: var(--accent); }
.action-drawer[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.action-drawer form { padding-bottom: 20px; max-width: 780px; }
.action-drawer form p { margin-bottom: 0; }

.audio-workspace { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 24px; margin: 0 0 24px; box-shadow: var(--shadow-subtle); }
.audio-workspace .section-heading-row { margin-bottom: 8px; }
.playback-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
audio { flex: 1; min-width: min(100%, 250px); }
.wave-container { margin-top: 18px; }
canvas { display: block; width: 100%; height: 200px; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; touch-action: none; }
#patient-waveform { touch-action: pan-y; }
.timeline { display: flex; justify-content: space-between; font: 14px/1.6 var(--font-mono); color: var(--muted); margin: 8px 0 16px; }
.wave-legend { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 16px 0; font-size: 13px; }
.wave-legend > span { display: inline-flex; align-items: center; gap: 8px; }
.wave-key { display: inline-block; width: 20px; height: 16px; border-radius: 2px; }
.wave-key-selection { background: #ffe600; border: 2px solid #c00070; }
.wave-key-inspiration { background: #00cfff; border: 1px solid #007aab; }
.wave-key-expiration { background: #ff8a00; border: 1px solid #a74400; }
.workspace-columns { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 26px; align-items: start; }
.diary-section, .annotation-section { min-width: 0; }
.access-report, .assignment-report { min-width: 0; overflow-wrap: anywhere; }
.patient-email-field { max-width: 560px; margin: 24px 0; }
.patient-email-field input[readonly] { background: var(--paper); color: var(--muted); }
.patient-email-field .muted, .access-report > .muted { font-size: 13px; margin-top: 8px; }
.access-history-entry, .assignment-report { padding: 20px 0; border-top: 1px solid var(--line); }
.assignment-report h3 { font-size: 17px; }
.assignment-report .section-heading-row { flex-wrap: wrap; gap: 12px; }
.assignment-report p { margin-bottom: 8px; }
.assignment-choices { margin: 0; padding: 0; }
.assignment-search { margin-bottom: 24px; }
.assignment-search-form { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.assignment-search-form > div { flex: 1 1 260px; max-width: 520px; min-width: 0; }
.assignment-search-form label { display: block; margin-bottom: 6px; font-weight: 600; }
.assignment-search-form input { width: 100%; }
.assignment-patient-list { display: grid; gap: 24px; }
.assignment-patient-card { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.assignment-patient-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.assignment-patient-header > div { min-width: 0; }
.assignment-patient-header h2 { margin: 4px 0 8px; font-size: 1.5rem; }
.assignment-patient-header p { margin: 0; }
.assignment-patient-header > .button { flex: none; }
.assignment-scope-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 24px; margin-top: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.assignment-scope-line > span { color: var(--muted); font-size: .875rem; }
.assignment-visit-list { list-style: none; padding: 0; margin: 0; }
.assignment-visit-list > li { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.assignment-visit-list > li:last-child { border-bottom: 0; }
.assignment-visit-list > li > div { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.assignment-visit-list time { color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.assignment-visit-list a { flex: none; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; }
.assignment-visit-list h3 { font-size: 1.125rem; margin: 0; }
.assignment-context-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.assignment-context-links a { min-height: 44px; display: inline-flex; align-items: center; }
.assignment-context-links > span { margin-left: auto; font-size: .875rem; }
.assignment-locked-tab { display: block; padding: 14px 18px; color: var(--muted); font-size: .875rem; }
.assignment-reading-note { margin: 0 0 24px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); }
.assignment-scope-description { margin: 16px 0; padding: 16px; background: var(--soft); border: 1px solid var(--line); border-radius: 6px; }
.assignment-consent-notice p { margin: 8px 0 0; }
@media (max-width: 620px) {
    .assignment-patient-header { flex-direction: column; align-items: stretch; gap: 16px; }
    .assignment-patient-header h2 { font-size: 1.25rem; }
    .assignment-patient-card { padding: 20px 16px; }
    .assignment-visit-list > li { align-items: start; flex-direction: column; gap: 8px; }
    .assignment-visit-list-detailed .button { width: 100%; }
    .assignment-context-links { gap: 4px 16px; }
    .assignment-context-links > span { margin-left: 0; width: 100%; }
    .assignment-locked-tab { padding-inline: 12px; }
    .assignment-search-form > div { flex-basis: 100%; }
}
.assignment-form .form-section-body { grid-template-columns: minmax(0, 1fr); }
.access-history { padding-inline: 24px; }
.medical-form .section-fields .assignment-choice { display: flex; align-items: flex-start; gap: 12px; margin: 0; min-height: 48px; padding: 12px 0; border-top: 1px solid var(--line); }
.assignment-choice input { flex: none; width: 20px; height: 20px; margin-top: 2px; }
.assignment-choice span { min-width: 0; overflow-wrap: anywhere; }
.assignment-choice small { display: block; color: var(--muted); font-weight: 400; }
.diary-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.diary-actions button { font-size: 13px; padding: 8px 16px; }
.danger, .danger:hover { background: var(--error); color: #fff; }
.danger:hover { background: #b91c1c; }
.danger-outline { color: var(--error); border-color: var(--error); background: transparent; }
.danger-outline:hover { color: #b91c1c; background: #fef2f2; }
button[hidden] { display: none; }
.diary-section #diary { list-style: none; padding: 0; margin: 0; }
#diary li { border-top: 1px solid var(--line); padding: 16px 0; }
#diary li p { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.region-button { background: var(--soft); color: var(--ink); border-color: var(--line); font: 14px/1.6 var(--font-mono); }
.region-button:hover { background: var(--soft-active); color: var(--ink); }
.annotation-section > p { color: var(--muted); }
.annotation-section .action-drawer { margin-top: 18px; }
.pending { color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 4px; padding: 4px 12px; font-size: 12px; font-weight: 700; }
dialog { max-width: min(480px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 12px; padding: 24px; color: var(--ink); box-shadow: var(--shadow-large); }
dialog::backdrop { background: #0f172a80; }
.recording-diary { margin-block: 32px; }
.recording-diary .section-heading-row { align-items: flex-start; flex-wrap: wrap; gap: 20px; }
.recording-diary .section-heading-row p { margin: 8px 0 0; font-size: 14px; }
.diary-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
#diary .diary-entry { padding: 0; border: 0; margin-top: 12px; }
.diary-disclosure { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.diary-entry-heading { display: grid; grid-template-columns: 32px minmax(110px, 1fr) auto minmax(120px, 1.2fr) auto; align-items: center; gap: 16px; padding: 18px 20px; }
.diary-disclosure > summary { cursor: pointer; min-height: 76px; list-style: none; border-radius: 8px; }
.diary-disclosure > summary:hover { background: var(--soft); }
.diary-disclosure > summary::-webkit-details-marker { display: none; }
.diary-disclosure > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.diary-icon { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.diary-toggle { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; color: var(--accent); background: var(--surface); }
.diary-toggle .diary-icon { transition: transform 150ms ease-out; }
.diary-disclosure[open] .diary-toggle .diary-icon { transform: rotate(90deg); }
.diary-summary-interval, .diary-author { display: grid; gap: 4px; min-width: 0; }
.diary-label { display: flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 500; color: var(--muted); }
.diary-label .diary-icon { width: 14px; height: 14px; }
.diary-interval { color: var(--ink); font: 600 14px/1.5 var(--font-mono); overflow-wrap: anywhere; }
.diary-phase { display: inline-flex; align-items: center; gap: 6px; justify-self: start; border: 1px solid var(--line); border-radius: 5px; padding: 5px 8px; background: var(--soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.diary-phase[data-phase="expiration"] > .diary-icon { transform: rotate(180deg); }
#diary .diary-author { margin: 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.diary-disclosure-hint { font-size: 12px; color: var(--accent); font-weight: 600; }
.diary-when-open, .diary-disclosure[open] .diary-when-closed { display: none; }
.diary-disclosure[open] .diary-when-open { display: inline; }
.diary-entry-content { border-top: 1px solid var(--line); background: var(--paper); border-radius: 0 0 8px 8px; }
.diary-entry-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 32px; padding: 24px; }
.diary-observations h3, .diary-note h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; color: var(--ink); font-size: 14px; font-weight: 650; }
.diary-note h3 .diary-icon { color: var(--accent); }
.diary-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; margin: 0; }
.diary-facts > div:last-child { grid-column: 1 / -1; }
.diary-facts dt { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 500; }
.diary-facts dt .diary-icon { width: 15px; height: 15px; }
.diary-facts dd { margin: 6px 0 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.diary-anomalies-value { display: flex; flex-wrap: wrap; gap: 6px; }
.diary-anomaly { display: inline-block; padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); font-size: 12px; font-weight: 500; }
.diary-note { min-width: 0; padding-left: 24px; border-left: 1px solid var(--line); }
#diary .diary-note p { margin: 0; font-size: 15px; line-height: 1.8; max-width: 70ch; }
.diary-entry-footer { border-top: 1px solid var(--line); padding: 16px 24px; }
.diary-entry-footer .diary-actions { margin: 0; gap: 8px; }
.diary-entry-footer .diary-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; font: 500 13px/1.5 var(--font-body); padding: 8px 12px; text-align: left; }
.diary-entry-footer button[hidden] { display: none; }
.diary-entry-footer .diary-delete { margin-left: auto; }
.diary-audit { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; color: var(--muted); }
.diary-audit > .diary-icon { width: 14px; height: 14px; margin-top: 3px; }
#diary .diary-timestamps { margin: 0; font-size: 12px; line-height: 1.6; color: var(--muted); white-space: normal; }
@media (max-width: 1000px) {
    .diary-entry-heading { grid-template-columns: 32px minmax(100px, 1fr) auto; gap: 12px; }
    .diary-toggle { grid-column: 1; grid-row: 1; }
    .diary-summary-interval { grid-column: 2; grid-row: 1; }
    .diary-disclosure-hint { grid-column: 3; grid-row: 1; text-align: right; }
    .diary-phase { grid-column: 2 / -1; grid-row: 2; }
    .diary-author { grid-column: 2 / -1; grid-row: 3; }
}
@media (max-width: 620px) {
    .access-history { padding-inline: 16px; }
    .diary-entry-heading { grid-template-columns: 28px minmax(0, 1fr); padding: 16px 12px; gap: 12px; }
    .diary-toggle { width: 28px; height: 28px; }
    .diary-summary-interval { grid-column: 2; }
    .diary-disclosure-hint { grid-column: 2; grid-row: 4; text-align: left; }
    .diary-entry-body { padding: 20px 16px; }
    .diary-note { padding: 20px 0 0; border-left: 0; border-top: 1px solid var(--line); }
    .diary-entry-footer { padding: 16px; }
    .diary-entry-footer .diary-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .diary-entry-footer .region-button { grid-column: 1 / -1; }
    .diary-entry-footer .diary-delete { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .diary-toggle .diary-icon { transition: none; }
}
@media (max-width: 480px) {
    .diary-facts { grid-template-columns: 1fr; }
}
.annotation-modal { width: 820px; max-width: calc(100% - 32px); max-height: calc(100dvh - 32px); padding: 0; background: var(--surface); overflow-y: auto; overscroll-behavior: contain; }
.annotation-modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px; border-bottom: 1px solid var(--line); }
.annotation-modal-heading h2 { margin: 0 0 8px; font-size: 24px; }
.annotation-modal-heading p { margin: 0; font-size: 14px; color: var(--muted); }
.annotation-modal .medical-form-actions { position: sticky; bottom: 0; z-index: 1; }
#annotation-status:not(:empty) { margin: 16px 24px; }
.annotation-modal-open { overflow: hidden; }
#annotation-picker-list { display: grid; gap: 12px; margin: 20px 0; }
#annotation-picker-list button { justify-content: flex-start; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 620px) {
    .diary-entry-body { grid-template-columns: 1fr; gap: 24px; }
    .diary-toolbar { width: 100%; }
    .diary-toolbar #add-annotation { flex: 1; }
    .annotation-modal { max-width: calc(100% - 16px); max-height: calc(100dvh - 16px); border-radius: 8px; }
    .annotation-modal-heading { padding: 16px; gap: 12px; }
    .annotation-modal-heading h2 { font-size: 20px; }
    .annotation-modal-heading .quiet { padding: 8px 12px; }
    .annotation-modal .medical-form-actions { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
}

.pagination { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 22px; }
.pagination .page-link { display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; border-radius: 8px; color: var(--accent); background: var(--surface); border: 1px solid var(--line); }
.pagination .page-link:hover { background: var(--soft); border-color: var(--accent); }
.pagination .active .page-link { color: #fff; background: var(--accent); border-color: var(--accent); }
.pagination .disabled .page-link { color: var(--muted); background: var(--paper); }
.pagination svg { width: 18px; height: 18px; }

@media (max-width: 760px) {
    .account-top > nav { flex: none; justify-content: flex-start; }
    .header-account-tools { width: 100%; justify-content: space-between; margin-left: 0; padding: 14px 0 0; border-left: 0; border-top: 1px solid #ffffff40; }
    .header-account-tools .language-switcher { padding-right: 12px; }
    main.shell { padding-block: 32px 56px; }
    .top, .page-heading, .patient-heading { align-items: start; flex-direction: column; }
    .top nav { gap: 12px 20px; }
    .patient-stats { white-space: normal; }
    .workspace-columns { grid-template-columns: 1fr; }
    .annotation-section { grid-row: 1; }
}

@media (max-width: 620px) {
    main.shell { padding-block: 24px 40px; }
    .page-heading, .patient-heading, .profile-section, .data-section { padding: 16px; }
    .action-drawer { padding-inline: 16px; }
    .audio-workspace { padding: 16px; }
    .profile-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
    .profile-tabs a { padding: 12px 7px; }
    .search-controls { flex-wrap: wrap; }
    .search-controls input { flex-basis: 100%; }
    .form-grid, .split, .facts { grid-template-columns: 1fr; }
    .clinical-summary { padding: 16px; }
    .share-row { flex-direction: column; gap: 3px; }
    .table-wrap { overflow-x: visible; }
    .patient-table, .visit-table, .recording-table,
    .patient-table tbody, .visit-table tbody, .recording-table tbody,
    .patient-table tr, .visit-table tr, .recording-table tr,
    .patient-table th, .visit-table th, .recording-table th,
    .patient-table td, .visit-table td, .recording-table td { display: block; width: 100%; }
    .patient-table thead, .visit-table thead, .recording-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
    .patient-table tr, .visit-table tr, .recording-table tr { border-top: 1px solid var(--line); padding: 14px 0; }
    .patient-table th, .visit-table th, .recording-table th,
    .patient-table td, .visit-table td, .recording-table td { padding: 5px 0; border: 0; text-align: left; white-space: normal; }
    .patient-table th, .visit-table th, .recording-table th { font-size: 1.02rem; }
    :is(.patient-table,.visit-table,.recording-table) td[data-label]::before { content: attr(data-label) ': '; color: var(--muted); font-size: .85rem; font-weight: 500; }
    :is(.patient-table,.visit-table,.recording-table) .row-action { padding-top: 12px; }
    :is(.patient-table,.visit-table,.recording-table) .empty-row { padding: 18px 0; }
    .audio-workspace .section-heading-row { flex-wrap: wrap; }
    canvas { height: 160px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* Shared form rhythm: inputs and actions occupy separate rows. */
.table-order { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 16px; }
.table-order > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.table-order label { margin: 0; color: var(--muted); font-size: .8rem; font-weight: 500; }
.table-order select { width: auto; max-width: 100%; min-height: 44px; padding: 6px 8px; border-color: transparent; background: transparent; font-size: .85rem; }
.table-order select:hover { border-color: var(--line); }
main form.table-order > button { margin: 0; padding: 6px 10px; border-color: transparent; font-size: .85rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 620px) {
    .table-order { justify-content: flex-start; gap: 2px 8px; }
    .table-order > div:first-child { flex-basis: 100%; }
}
:is(.patient-table,.visit-table,.recording-table) thead { background: #f8fafc; }
:is(.patient-table,.visit-table,.recording-table) thead a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; text-decoration: none; }
:is(.patient-table,.visit-table,.recording-table) tbody tr:nth-child(even) { background: var(--paper); }
:is(.patient-table,.visit-table,.recording-table) tbody tr:hover { background: var(--soft); }
.data-section + .clinical-summary { margin-top: 24px; }
main form:not(.search-bar):not(.inline) { min-width: 0; }
main form > :is(input:not([type="hidden"]), select, textarea) { display: block; }
main form > :is(input:not([type="hidden"]), select, textarea, .form-grid, fieldset) + :is(p, button, .button) { margin-top: 24px; }
main form > p:has(button) { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 8px; }
main form > button { margin-top: 20px; }
.login-form > button { margin-top: 8px; }
.form-grid { column-gap: 24px; row-gap: 0; }
.form-grid > div { min-width: 0; }
fieldset legend { float: none; width: auto; font-size: 1rem; }
fieldset label { min-height: 44px; }
input[type="checkbox"] { flex: none; }
textarea { resize: vertical; }
[aria-invalid="true"] { border: 2px solid var(--error); }
[aria-invalid="true"]:focus-visible { outline-color: var(--error); }
.field-error { color: var(--error); font-size: 13px; margin: 6px 0 16px; }
.required-mark { color: var(--error); font-weight: 700; }
label .required-mark::after { content: ' *'; }
.required-legend { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.medical-form > .required-legend { padding: 16px 24px 0; margin-bottom: 0; }
.inline > .required-legend { flex-basis: 100%; }
.login-form > .required-legend { margin-bottom: 0; }
code, kbd, samp, input[type="number"], td[data-label="Data"], td[data-label="Durata"] { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.top nav a, .login-recovery { display: inline-flex; align-items: center; min-height: 44px; }
.skip-link { position: fixed; top: 8px; left: 12px; transform: translateY(-160%); z-index: 100; padding: 12px 18px; background: var(--surface); color: var(--accent); border-radius: 6px; }
.skip-link:focus { transform: translateY(0); }
.section-heading-row { flex-wrap: wrap; }
.row-action { white-space: normal; }
.row-action a, .text-action { display: inline-flex; align-items: center; min-height: 44px; }
.breadcrumb { overflow-wrap: anywhere; }
.action-drawer summary { min-height: 52px; }
.action-drawer form { padding-top: 4px; }
.profile-tabs a { min-height: 48px; }
.clinical-summary .action-drawer { background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding-inline: 0; }
.workspace-columns { margin-top: 32px; }
@media (max-width: 760px) {
    .annotation-section { grid-row: auto; }
    .section-heading-row { gap: 12px; }
    .text-action { white-space: normal; }
}
@media (max-width: 620px) {
    .profile-tabs { grid-template-columns: 1fr; }
    .profile-tabs a { text-align: left; }
    main form > p:has(button) { flex-direction: column; align-items: stretch; }
}

/* MediCare+ workspace composition and reusable clinical form components. */
.page-heading { padding: 0 0 24px; margin-bottom: 32px; }
.patient-heading { padding: 24px; margin: 24px 0 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-subtle); }
.patient-stats { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-radius: 8px; background: var(--paper); font-size: 14px; }
.patient-workspace { display: grid; grid-template-columns: 192px minmax(0, 1fr); gap: 32px; align-items: start; }
.patient-content { min-width: 0; }
.patient-workspace .profile-tabs { display: flex; flex-direction: column; gap: 8px; border: 0; margin: 0; }
.patient-workspace .profile-tabs a { display: flex; align-items: center; text-align: left; min-height: 48px; padding: 12px 16px; border: 1px solid transparent; border-radius: 8px; font-size: 14px; font-weight: 600; }
.patient-workspace .profile-tabs a[aria-current="page"] { color: var(--accent); background: var(--soft); border-color: #e4cbd9; box-shadow: inset 3px 0 var(--accent); }
.patient-content > .action-drawer:first-child { margin-top: 0; }
.patient-content > .profile-section { padding: 24px; }
.profile-section > .clinical-summary { padding: 0; border: 0; box-shadow: none; margin-top: 24px; }
.facts { gap: 0; margin-block: 24px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--paper); }
.facts div { padding: 16px; border-top: 0; border-bottom: 1px solid var(--line); }
.facts dt { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.facts dd { font-size: 16px; font-weight: 400; overflow-wrap: anywhere; }
.list-toolbar { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 16px 32px; padding: 16px 0 24px; }
.list-toolbar .search-bar { flex: 1 1 280px; max-width: 440px; margin: 0; }
.list-toolbar .table-order { flex: 1 1 300px; margin: 0; gap: 4px 8px; }
.list-toolbar .table-order label { font-size: 12px; }
.table-wrap { border: 1px solid var(--line); border-radius: 8px; }
thead th { font-size: 12px; letter-spacing: .01em; }
tbody tr:last-child :is(th, td) { border-bottom: 0; }
tbody th { font-weight: 600; }
.row-action a { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-size: 13px; font-weight: 600; }
.row-action a:hover { background: var(--soft); border-color: var(--accent); }
.recording-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.recording-row-actions a { flex: none; white-space: nowrap; gap: 6px; }
@media (max-width: 620px) {
    .recording-row-actions { justify-content: flex-start; }
    .row-action .recording-row-actions a { width: auto; padding-inline: 8px; font-size: 12px; }
}
.action-drawer { padding: 0; overflow: clip; }
.action-drawer > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; min-height: 56px; list-style: none; font-size: 15px; font-weight: 600; }
.action-drawer > summary::-webkit-details-marker { display: none; }
.action-drawer > summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); flex: none; margin-right: 4px; }
.action-drawer[open] > summary::after { transform: rotate(225deg); }
.action-drawer > summary:hover { background: var(--soft); }
.action-drawer[open] > summary { background: var(--soft); margin-bottom: 0; }
.action-drawer > :is(p, form:not(.medical-form)) { margin-inline: 24px; }
.action-drawer > p { margin-top: 24px; }
.action-drawer form.medical-form { max-width: none; width: 100%; padding: 0; margin: 0; }
.medical-form .medical-form-section { min-width: 0; margin: 0; padding: 24px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.medical-form-section > legend { float: left; width: 100%; margin: 0 0 8px; padding: 0; color: var(--ink); font: 600 20px/1.4 var(--font-heading); }
.form-section-body { clear: both; display: grid; grid-template-columns: minmax(120px, .65fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.section-help { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0; padding-top: 8px; }
.section-fields { min-width: 0; }
.section-fields > :first-child { margin-top: 0; }
.medical-form .section-fields label { display: block; min-height: 0; margin: 16px 0 6px; font-size: 14px; font-weight: 600; }
.medical-form .section-fields > label:first-child, .medical-form .form-grid:first-child > div > label:first-child { margin-top: 0; }
.medical-form .form-grid { gap: 16px 24px; }
.medical-form .form-grid + .form-grid { margin-top: 16px; }
.medical-form .form-grid > div > label { margin-top: 0; }
.medical-form input:not([type="checkbox"]):not([type="radio"]), .medical-form select { min-height: 48px; }
.medical-form textarea { min-height: 120px; }
.medical-form .choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.medical-form .section-fields .choice-card { display: flex; align-items: center; gap: 10px; min-height: 48px; margin: 0; padding: 12px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; font-size: 14px; font-weight: 400; cursor: pointer; }
.choice-card span { overflow-wrap: anywhere; }
.medical-form .choice-card:hover { border-color: var(--accent); background: var(--soft); }
.medical-form .choice-card:has(input:checked) { border-color: var(--accent); background: var(--soft); color: var(--accent); font-weight: 600; }
.choice-card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.medical-form .choice-fieldset { margin: 0 0 16px; border: 0; padding: 0; }
.choice-fieldset > legend { font-size: 14px; margin-bottom: 12px; }
.medical-form-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 24px; background: #f8fafc; border-top: 1px solid var(--line); }
.medical-form-actions > p { color: var(--muted); font-size: 13px; margin: 0; max-width: 52ch; }
.medical-form-buttons { display: flex; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.medical-form-actions button { margin: 0; }
#form-status:not(:empty) { margin: 16px 24px; }
.visit-note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.sheet-reading > h3 { margin: 32px 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 20px; }
.sheet-reading > p { line-height: 1.8; }
.sheet-reading .facts { margin-block: 16px 24px; background: var(--surface); }
.sheet-reading .facts dt { font-size: 14px; font-weight: 500; }
.sheet-reading .facts dd { font-size: 17px; line-height: 1.7; font-weight: 600; }
.sheet-reading .sheet-note { grid-column: 1 / -1; }
.sheet-reading .sheet-note dd { white-space: pre-wrap; font-weight: 400; }
.sheet-pathologies { margin: 0 0 20px; padding-left: 24px; font-size: 17px; line-height: 1.8; }
.sheet-pathologies li { padding: 4px 0 4px 4px; }
.sheet-pathologies li::marker { color: var(--accent); }
input[name="smoking_years"]:disabled { background: var(--paper); color: var(--muted); cursor: not-allowed; }
.registration-card { max-width: 640px; }
.language-switcher { margin: 0; flex: none; }
.language-switcher > div { display: inline-flex; gap: 2px; border: 1px solid currentColor; border-radius: 6px; padding: 2px; }
.language-switcher button { min-width: 40px; min-height: 38px; padding: 6px 8px; border: 0; border-radius: 4px; background: transparent; color: inherit; font-size: 12px; }
.language-switcher button[aria-pressed="true"] { background: var(--surface); color: var(--accent); }
.header-account-tools .language-switcher button { min-width: 30px; min-height: 30px; padding: 4px 6px; font-size: 11px; }
.workspace-top .language-switcher { color: var(--accent); }
.workspace-top .language-switcher button[aria-pressed="true"] { background: var(--accent); color: var(--surface); }
@media (max-width: 620px) {
    .doctor-workspace .workspace-top { flex-wrap: wrap; }
}
.registration-links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 24px; }
.registration-links a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }
.registration-card .login-field .muted { font-size: 13px; margin: 8px 0 0; }
.registration-steps { padding-left: 20px; margin-block: 24px; }
.registration-steps li { margin-bottom: 12px; font-size: 14px; }
.visit-date { display: inline-flex; flex-direction: column; gap: 8px; padding: 16px 20px; margin-bottom: 20px; border: 1px solid var(--accent); border-radius: 8px; background: var(--soft); }
.visit-date-label { color: var(--ink); font-size: 13px; font-weight: 600; }
.visit-date time { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px; }
.visit-date time strong { color: var(--accent); font-size: 24px; font-weight: 700; line-height: 1.3; }
.visit-date time > span { color: var(--ink); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.note-content { overflow-wrap: anywhere; margin: 20px 0; }
.note-content p { margin-bottom: 1em; }
.note-content :is(ul, ol) { padding-left: 24px; }
#visit-note-editor { margin-top: 20px; }
#visit-note-editor .tox-tinymce { max-width: 100%; border-color: var(--line); }
#visit-editor-status:not(:empty) { margin-top: 16px; }
.audio-file-field { background: var(--paper); border: 1px dashed #94a3b8; border-radius: 8px; padding: 16px; margin-top: 24px; }
.medical-form .audio-file-field label { margin-top: 0; }
.audio-file-field input[type="file"] { padding: 0; border: 0; background: transparent; font-size: 14px; }
input[type="file"]::file-selector-button { padding: 10px 16px; min-height: 44px; border: 1px solid var(--accent); border-radius: 8px; background: var(--surface); color: var(--accent); font: 600 14px var(--font-body); margin-right: 12px; cursor: pointer; }
.diary-section { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 24px; box-shadow: var(--shadow-subtle); }
.medical-form-compact .form-section-body { grid-template-columns: 1fr; gap: 16px; }
.medical-form-compact .medical-form-section { padding: 24px 16px; }
.medical-form-compact .medical-form-actions { padding: 16px; }
.clinical-summary .action-drawer { border: 1px solid var(--line); border-radius: 8px; }
.top nav a { text-decoration: none; border-radius: 8px; padding: 8px 12px; }
.top nav a:hover { background: #ffffff1a; }
@media (max-width: 1000px) {
    .patient-workspace { grid-template-columns: 1fr; gap: 24px; }
    .patient-workspace .profile-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .form-section-body { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 620px) {
    .patient-workspace .profile-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .patient-workspace .profile-tabs a { padding: 12px; }
    .patient-heading, .patient-content > .profile-section { padding: 16px; }
    .patient-stats { padding: 8px; white-space: normal; }
    .medical-form .medical-form-section, .medical-form-actions { padding: 24px 16px; }
    .assignment-form > .required-legend { padding-inline: 16px; }
    .medical-form-actions { flex-direction: column; align-items: stretch; }
    .medical-form-buttons { margin: 0; flex-direction: column; }
    .medical-form .choice-grid { grid-template-columns: 1fr; }
    .action-drawer > summary { padding-inline: 16px; }
    .action-drawer > :is(p, form:not(.medical-form)) { margin-inline: 16px; }
    .list-toolbar { gap: 24px; }
    .list-toolbar .table-order { flex-basis: 100%; }
    .table-wrap { border: 0; border-radius: 0; }
    .row-action a { width: 100%; justify-content: center; }
    .diary-section { padding: 16px; }
}
