@font-face {
  font-family: "Bounded";
  src: url("/static/fonts/bounded-variable.ttf") format("truetype");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Zen Kaku Gothic New";
  src: url("/static/fonts/zen-kaku-gothic-new-regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lato";
  src: url("/static/fonts/lato-light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lato";
  src: url("/static/fonts/lato-medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lato";
  src: url("/static/fonts/lato-semibold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lato";
  src: url("/static/fonts/lato-black.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lato";
  src: url("/static/fonts/lato-black-italic.ttf") format("truetype");
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}
:root {
  --font-text: "Zen Kaku Gothic New", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: "Bounded", var(--font-text);
  --font-record: "Lato", var(--font-text);
  font-family: var(--font-text);
  color: #25312e;
  background: #f5f7f6;
  font-synthesis: none;
  color-scheme: light;
  --muted: #66736e;
  --accent: #276857;
  --glass: rgb(255 255 255 / 96%);
  --shadow-button: inset 0 2px 1px rgb(255 255 255 / 95%), inset 0 -2px 3px rgb(40 70 57 / 14%);
  --shadow-panel: inset 1px 2px 3px rgb(36 58 47 / 12%), inset -1px -1px 1px #fff;
  --shadow-card: inset 1px 2px 4px rgb(36 58 47 / 14%), inset -1px -1px 1px #fff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: linear-gradient(120deg, rgb(230 243 237 / 28%), transparent 42%), linear-gradient(225deg, rgb(232 240 251 / 30%), transparent 50%); background-attachment: fixed; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, .brand { font-family: var(--font-heading); overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button {
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  background: rgb(242 246 244 / 80%);
  color: #303b36;
  padding: 9px 14px;
  min-height: 40px;
  box-shadow: var(--shadow-button);
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
button:hover { background: rgb(234 241 237 / 94%); box-shadow: var(--shadow-button); }
button:active:not(:disabled) { box-shadow: inset 0 2px 4px rgb(40 70 57 / 8%); }
button:disabled { opacity: .5; cursor: wait; }
:focus-visible { outline: 3px solid #79ad9b; outline-offset: 3px; }
.shell { margin: auto; padding: 32px 32px 80px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { font-size: 17px; font-weight: 700; letter-spacing: .07em; }
.brand span { font-family: var(--font-text); font-size: 10px; color: var(--muted); font-weight: 400; letter-spacing: .13em; margin-left: 14px; }
:root { --app-header-height: 64px; }
.shell > .app-header { position: sticky; top: 0; z-index: 10; min-height: var(--app-header-height); align-items: center; background: rgb(245 247 246 / 90%); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.app-header .brand { flex: 1; min-width: 0; }
.app-header .actions { flex: none; }
.eyebrow { font-size: 11px; font-weight: 650; letter-spacing: .16em; color: var(--accent); }
.workspace { --nav-width: 160px; display: grid; grid-template-columns: var(--nav-width) minmax(0,1fr); grid-template-areas: "nav toolbar" "nav content"; gap: 20px 28px; align-items: start; margin-top: 40px; }
.nav-collapsed .workspace { --nav-width: 56px; }
.workspace-content { grid-area: content; min-width: 0; }
.workspace-content > section > h2, .workspace-content .summary-controls > h2 { margin-top: 0; font-size: 24px; font-weight: 600; letter-spacing: -.03em; }
.workspace-header { grid-area: toolbar; display: grid; grid-template-columns: minmax(0,1fr) clamp(170px,17vw,240px); grid-template-areas: "heading filter"; align-items: center; gap: 16px; min-width: 0; }
#history-toolbar { display: contents; }
.history-heading { grid-area: heading; display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.history-heading h2 { margin: 0; min-width: 0; font-size: 20px; line-height: 1.3; letter-spacing: -.025em; overflow-wrap: normal; }
.history-heading > span { flex: none; color: var(--muted); font-size: 12px; white-space: nowrap; }
.workspace-header .history-filter { grid-area: filter; margin: 0; gap: 0; min-width: 0; }
.history-filter-label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.workspace-header .history-filter select { width: 100%; min-height: 44px; padding: 10px 12px; }
.workspace-header:has(#history-toolbar[hidden]) { display: none; }
.actions { display: grid; grid-template-columns: repeat(4,48px); gap: 8px; justify-self: end; position: static; margin: 0; }
.actions button { display: grid; place-items: center; width: 48px; min-height: 48px; padding: 0; background: rgb(222 239 229 / 72%); color: #285c49; border-radius: 14px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.actions svg { width: 25px; height: 25px; }
.actions button:nth-child(2) { background: rgb(227 237 251 / 72%); color: #445c78; }
.actions button:nth-child(3) { background: rgb(235 228 248 / 72%); color: #66557c; }
.actions button:nth-child(4) { background: rgb(246 236 220 / 72%); color: #766140; }
.actions button:hover { background: rgb(222 239 229 / 94%); }
.actions button:nth-child(2):hover { background: rgb(227 237 251 / 94%); }
.actions button:nth-child(3):hover { background: rgb(235 228 248 / 94%); }
.actions button:nth-child(4):hover { background: rgb(246 236 220 / 94%); }
.columns { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(230px, 1fr); gap: 32px; }
#history-panel { grid-template-columns: minmax(0,1fr); gap: 40px; }
.card { min-width: 0; padding: 0; }
.card h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.025em; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; }
.section-head span, .hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.section-head span { white-space: nowrap; }
.section-add { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.section-add .add-button-label { color: inherit; font-size: inherit; line-height: inherit; }
.section-add .add-button-icon { color: inherit; font-size: 20px; line-height: 1; }
.events { display: grid; gap: 6px; }
.event { display: flex; justify-content: space-between; gap: 16px; text-align: left; width: 100%; background: transparent; padding: 17px 14px; border-radius: 12px; }
.event, .care-card, .task-preview { box-shadow: none; }
.event b, .event strong, .care-card b, .care-card strong { font-weight: 550; }
.event:hover, .care-card:hover, .task-preview:hover { background: var(--glass); box-shadow: var(--shadow-card); }
.event[data-event-type="appointment"], .event[data-event-type="procedure"] { --event-tint: #eaf5ee; --event-hover: #deefe5; }
.event[data-event-type="lab"] { --event-tint: #eaf2fb; --event-hover: #ddebf9; }
.event[data-event-type="study"] { --event-tint: #f1ecfa; --event-hover: #e9e0f6; }
.event[data-event-type="document"] { --event-tint: #fff5dd; --event-hover: #fff0ca; }
.event[data-event-type] { background: var(--event-tint, transparent); }
.event[data-event-type]:hover, .event[data-event-type]:focus-visible { background: var(--event-hover, var(--glass)); }
.event small { display: block; color: var(--muted); margin-top: 6px; font-weight: 400; line-height: 1.5; }
.event .date { color: var(--muted); white-space: nowrap; font-size: 12px; padding-top: 2px; }
.event strong { overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: 28px 0; line-height: 1.65; max-width: 330px; font-size: 14px; }
.aside p { color: var(--muted); line-height: 1.7; font-size: 14px; margin: 16px 0 0; }
.aside hr { border: 0; margin: 34px 0; }
.stack { display: grid; gap: 4px; margin-top: 14px; }
.quiet { background: transparent; text-align: left; color: var(--muted); box-shadow: none; }
.quiet:hover { background: rgb(237 244 240 / 65%); box-shadow: none; }
.stack .quiet { padding: 11px 0; min-height: 44px; font-size: 14px; }
.stack .quiet:hover { background: transparent; color: var(--accent); }
#message { position: fixed; inset: 18px 18px auto auto; margin: 0; width: min(560px, calc(100vw - 36px)); max-height: calc(100dvh - 36px); overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr) 32px; align-items: start; gap: 12px; background: #e2f0e8; color: #23513d; border: 0; padding: 15px 14px 15px 18px; border-radius: 14px; box-shadow: 0 12px 40px #24382b24, 0 2px 8px #24382b14; z-index: 1000; font: 14px/1.5 var(--font-text); }
#message-text { overflow-wrap: anywhere; align-self: center; }
#message-close { width: 32px; height: 32px; padding: 7px; border: 0; border-radius: 8px; background: transparent; color: inherit; box-shadow: none; }
#message-close:hover { background: #ffffff70; }
#message-close:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
#message-close svg { display: block; width: 18px; height: 18px; }
#message::backdrop { background: transparent; pointer-events: none; }
#message.error { background: #f9e9e7; color: #923e37; }
dialog { border: 0; background: rgb(255 255 255 / 97%); color: #25312e; border-radius: 24px; width: min(750px, calc(100% - 32px)); max-height: 90vh; padding: 32px; overflow: auto; box-shadow: 0 24px 90px rgb(35 59 53 / 16%), inset 0 1px 0 #fff; }
dialog::backdrop { background: rgb(38 59 53 / 15%); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.modal-head h2 { font-size: 28px; font-weight: 600; letter-spacing: -.035em; margin: 0 0 26px; overflow-wrap: anywhere; }
.modal-head .eyebrow { margin: 0 0 8px; }
.modal-head:has(.modal-head-actions) > :first-child { min-width: 0; }
.modal-head-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.modal-head-actions .primary { padding: 10px 14px; font-size: 14px; }
@media(max-width:600px) {
 .modal-head:has(.modal-head-actions) { display: grid; grid-template-columns: minmax(0,1fr) 40px; gap: 10px; }
 .modal-head-actions { display: contents; }
 .modal-head-actions .primary { grid-column: 1 / -1; grid-row: 2; min-height: 44px; }
 .modal-head-actions .close { grid-column: 2; grid-row: 1; }
 #care-editor .modal-head h2 { margin-bottom: 0; }
 #care-editor .modal-head { margin-bottom: 20px; }
}
.close { background: #f1f4f2; color: #65716e; font-size: 26px; line-height: 1; padding: 0; min-height: 40px; width: 40px; flex: none; border-radius: 50%; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fields label, .preview-row label { display: grid; align-content: start; gap: 4px; color: #53615a; font-size: 12px; line-height: 1.45; }
.fields .full { grid-column: 1 / -1; }
input, select, textarea { background: rgb(237 243 239 / 72%); border: 0; color: #26342d; padding: 9px 12px; border-radius: 10px; width: 100%; min-width: 0; min-height: 40px; font-size: 14px; line-height: 1.45; box-shadow: inset 0 1px 2px rgb(40 70 57 / 2%); }
input:hover, select:hover, textarea:hover { background: rgb(232 240 235 / 86%); }
input[type=file] { padding: 10px; font-size: 13px; }
input[type=file]::file-selector-button { border: 0; padding: 10px 14px; margin-right: 12px; border-radius: 7px; background: #fff; color: #385847; cursor: pointer; }
textarea { resize: vertical; }
.fields small { color: var(--muted); font-size: 12px; font-weight: 400; }
.status { background: #edf5ef; color: #3b634b; padding: 14px; border-radius: 12px; margin-top: 20px; font-size: 14px; line-height: 1.6; }
h3 { font-size: 17px; font-weight: 600; margin: 28px 0 5px; }
footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.primary { background: var(--accent); color: #fff; font-weight: 600; box-shadow: inset 0 1px 0 rgb(255 255 255 / 20%), inset 0 -1px 2px rgb(15 47 36 / 20%); }
.primary:hover { background: #205544; box-shadow: inset 0 1px 0 rgb(255 255 255 / 25%), inset 0 -1px 2px rgb(15 47 36 / 24%); }
.result { padding: 16px 0; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.result small { color: var(--muted); display: block; margin-top: 6px; }
.result .value { font-weight: 650; }
.result > :first-child { min-width: 0; }
.result-reading { text-align: right; max-width: 220px; }
.result-reading .value { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.lab-number.normal { color: #237342; }
.lab-number.outside { color: #956500; }
.lab-number.critical, .lab-critical-label, .result .lab-critical-label { color: #b23832; }
.lab-critical-label { display: block; margin-top: 5px; font-size: 11px; line-height: 1.45; }
.result-change { font: 500 21px/1 var(--font-record); color: #426a79; }
.result-change.same { color: var(--muted); }
.result-reading .result-previous, .result-reading .result-comparison-hint { font-size: 11px; font-weight: 400; line-height: 1.45; }
@media(max-width:600px) { .result-reading { max-width: 145px; } .result-reading .result-previous { max-width: 135px; } }
.report-meta { color: var(--muted); line-height: 1.7; }
.report-meta a, .download-link { color: var(--accent); text-underline-offset: 4px; }
.document-preview, .upload-preview { display: block; max-width: 100%; max-height: 60vh; object-fit: contain; margin: 20px auto; border-radius: 8px; }
.upload-preview { max-height: 280px; }
@media (max-width: 700px) {
  .shell { padding: 24px 12px 56px; }
  header { align-items: start; gap: 16px; }
  .brand { font-size: 15px; }
  .brand span { display: block; margin: 6px 0 0; font-size: 9px; }
  .columns { grid-template-columns: 1fr; gap: 38px; }
  .card h2 { font-size: 18px; }
  .empty { padding: 12px 0; }
  dialog { width: calc(100% - 12px); max-width: calc(100% - 12px); padding: 20px 12px; border-radius: 20px; max-height: 92vh; }
  #message { inset: 8px 8px auto auto; width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .modal-head h2 { font-size: 25px; }
  .fields { grid-template-columns: 1fr; gap: 10px; }
  .fields .full { grid-column: auto; }
  footer { gap: 8px; }
  footer button { padding: 12px 14px; }
  .event { flex-wrap: wrap; gap: 8px; padding: 14px 8px; }
}
@media (prefers-reduced-motion: reduce) { button { transition: none; } }

.field-group { display: grid; align-content: start; gap: 6px; min-width: 0; }
.inline-add { background: transparent; color: var(--accent); padding: 8px 0; text-align: left; min-height: 44px; font-size: 13px; }
.inline-add:hover { background: transparent; color: #1d483c; }
.history-filter { display: grid; gap: 8px; font-size: 12px; color: var(--muted); margin: 0 0 18px; }
.event-notes { white-space: pre-wrap; line-height: 1.7; overflow-wrap: anywhere; }
#record-notes textarea { max-height: 340px; min-height: 90px; line-height: 1.6; resize: vertical; }
#recognized-notes-hint { margin: 8px 0 0; font-size: 12px; }

.dental-section { min-width: 0; margin: 8px 0 12px; }
.fields > .full { grid-column: 1 / -1; }
.dental-section h3 { margin: 0; }
.dental-section .section-head { margin: 0; }
.teeth-summary { margin: 12px 0 0; color: var(--accent); font-size: 14px; line-height: 1.6; }
@media(max-width:600px) { .dental-section .section-head { align-items: start; gap: 8px; } .dental-section h3 { font-size: 16px; } }

.mouth-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; border-radius: 22px; }
.dental-mouth { position: relative; width: 100%; max-width: 580px; min-width: 480px; aspect-ratio: 600 / 500; margin: 8px auto; }
.mouth-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; }
.mouth-gum { fill: #f4e5e2; }
.mouth-cavity { fill: #fbf7f6; }
.mouth-tongue { fill: #f1e0dd; }
.mouth-tooth { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; width: 7.5%; min-width: 40px; height: 44px; min-height: 44px; padding: 0; background: transparent; color: #596961; border-radius: 10px; font-size: 12px; font-weight: 650; }
.mouth-tooth svg { width: 42px; max-width: 100%; height: 44px; fill: #fff; stroke: #92a296; stroke-width: 1.3; stroke-linejoin: round; }
.tooth-number { position: absolute; bottom: -12px; line-height: 1; pointer-events: none; }
.lower-jaw .tooth-number { bottom: auto; top: -12px; }
.side-label .tooth-number { top: 50%; bottom: auto; transform: translateY(-50%); }
.label-left .tooth-number { right: calc(100% + 2px); }
.label-right .tooth-number { left: calc(100% + 2px); }
.mouth-tooth .tooth-groove { fill: none; stroke: #c0cac3; stroke-width: 1; }
.mouth-tooth:hover { background: #e4eee888; }
.mouth-tooth.selected { background: #daeee3; color: #205b43; box-shadow: inset 0 0 0 2px #397653; }
.mouth-tooth.selected svg { fill: #a8d3ba; stroke: #397653; }
.mouth-top-label, .mouth-bottom-label, .mouth-right-label, .mouth-left-label { position: absolute; color: #887672; font-size: 12px; text-align: center; pointer-events: none; }
.mouth-top-label { top: 27%; left: 25%; width: 50%; }
.mouth-bottom-label { top: 72%; left: 25%; width: 50%; }
.mouth-right-label { top: 47%; left: 17%; }
.mouth-left-label { top: 47%; right: 17%; }
.mouth-mobile-hint { display: none; }
@media(max-width:600px) { .mouth-mobile-hint { display: block; } .mouth-tooth { font-size: 11px; } }
.tooth-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; }
.tooth-tools button { font-size: 12px; min-height: 38px; padding: 9px 12px; }
.tooth-tools button[aria-pressed=true] { background: var(--accent); color: #fff; }
#tooth-removed[aria-pressed=true] { background: #262b29; }
.mouth-tooth.removed, .mouth-tooth.removed.selected { background: #e3e6e4; color: #202421; }
.mouth-tooth.removed svg { fill: #171c19; stroke: #171c19; }
.mouth-tooth.removed .tooth-groove { stroke: #5c665f; }
#tooth-devitalized[aria-pressed=true] { background: #b9e3f5; color: #164c6a; }
#tooth-implanted[aria-pressed=true] { background: #ddd4ef; color: #514065; }
.mouth-tooth.devitalized svg { fill: #8bd2f2; stroke: #3686ad; }
.mouth-tooth.devitalized .tooth-groove { stroke: #4c9fc4; }
.mouth-tooth.implanted svg { fill: #e5dcf2; stroke: #867198; }
.mouth-tooth.implanted .tooth-groove { stroke: #ac96bd; }
.dental-legend { display: flex; flex-wrap: wrap; gap: 7px 16px; margin: 8px 0; color: var(--muted); font-size: 12px; }
.dental-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.dental-key { width: 10px; height: 10px; border-radius: 3px; background: #a8d3ba; }
.dental-key.removed { background: #171c19; }
.dental-key.devitalized { background: #8bd2f2; }
.dental-key.implanted { background: #c2aed8; }
.dental-instructions { margin: 6px 0; font-size: 12px; }
.dental-card { margin: 18px 0; }
.dental-card .hint { margin: 8px 0; }
.dental-card .dental-mouth { max-width: 520px; }
.dental-zoom { display: none; }
#editor.dental-editor { width: min(1100px, calc(100vw - 32px)); }
.dental-editor #intake-fields > .fields { grid-template-columns: minmax(220px, .8fr) minmax(480px, 1.2fr); align-items: start; }
.dental-editor #intake-fields > .fields > :not(#teeth-wrap) { grid-column: 1; }
.dental-editor #intake-fields > .fields > #teeth-wrap { grid-column: 2; grid-row: 1 / span 8; margin-top: 0; }
.dental-editor .dental-mouth { max-width: 480px; }
.dental-editor .teeth-summary { margin-top: 6px; font-size: 12px; line-height: 1.4; }
#editor.dental-editor footer { box-shadow: 0 -1px 0 #edf1ef; }
@media(max-width:900px) {
  .dental-editor #intake-fields > .fields { grid-template-columns: 1fr; }
  .dental-editor #intake-fields > .fields > #teeth-wrap { grid-column: 1; grid-row: auto; }
}
@media(max-width:600px) {
  .dental-zoom { display: inline-flex; font-size: 12px; min-height: 36px; padding: 6px 10px; }
  .dental-card:not(.dental-zoomed) .dental-mouth { min-width: 0; }
  .dental-card:not(.dental-zoomed) .mouth-tooth { min-width: 0; min-height: 0; height: auto; aspect-ratio: 44 / 48; }
  .dental-card:not(.dental-zoomed) .mouth-tooth svg { width: 100%; height: auto; }
  .dental-card:not(.dental-zoomed) .tooth-number { font-size: 8px; bottom: -7px; }
  .dental-card:not(.dental-zoomed) .lower-jaw .tooth-number { top: -7px; bottom: auto; }
  .dental-card:not(.dental-zoomed) .side-label .tooth-number { top: 50%; bottom: auto; }
  .dental-card:not(.dental-zoomed) .mouth-top-label,
  .dental-card:not(.dental-zoomed) .mouth-bottom-label,
  .dental-card:not(.dental-zoomed) .mouth-right-label,
  .dental-card:not(.dental-zoomed) .mouth-left-label { font-size: 9px; }
  .dental-card:not(.dental-zoomed) .mouth-mobile-hint { display: none; }
}
.record-controls { display: flex; gap: 10px; margin: 12px 0 18px; }
.danger { color: #a0473e; }
#archive-wrap { margin-top: 28px; }
summary { cursor: pointer; min-height: 44px; padding: 12px 0; color: var(--muted); font-size: 14px; }
.backup-row { display: grid; gap: 4px; margin: 6px 0; min-width: 0; }
.backup-row .quiet { padding: 10px 0; font-size: 13px; }
.recovery-banner { padding: 16px 18px; margin: 28px 0 0; background: #e9eff6; color: #445c78; border-radius: 12px; font-size: 14px; }
.recovery-open { display: block; padding: 10px 0; line-height: 1.6; }
.care-nav { grid-area: nav; display: grid; grid-template-rows: auto minmax(0,1fr); gap: 4px; margin: 0; padding: 4px; position: sticky; top: calc(var(--app-header-height) + 24px); max-height: calc(100dvh - var(--app-header-height) - 48px); background: var(--glass); border-radius: 18px; box-shadow: var(--shadow-panel); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.care-nav button { display: flex; align-items: center; gap: 12px; padding: 12px 10px; background: transparent; color: var(--muted); font-size: 13px; text-align: left; min-width: 0; box-shadow: none; }
.care-nav svg { width: 20px; height: 20px; flex: none; }
.care-nav-links { display: grid; gap: 4px; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.care-nav button:focus-visible { outline-width: 2px; outline-offset: -2px; }
.care-nav .nav-toggle { min-height: 44px; color: var(--accent); margin-bottom: 8px; }
.nav-expand-arrow { display: none; }
.nav-collapsed .nav-expand-arrow { display: inline; }
.nav-collapsed .nav-collapse-arrow { display: none; }
.nav-collapsed .nav-label, .nav-collapsed .nav-toggle-label { display: none; }
.nav-collapsed .care-nav { justify-items: center; }
.nav-collapsed .care-nav button { justify-content: center; width: 44px; min-height: 44px; padding: 0; }
.care-nav button:hover { background: rgb(236 244 239 / 70%); color: #303b36; }
.care-nav button.active { background: rgb(222 239 229 / 72%); color: var(--accent); font-weight: 600; box-shadow: var(--shadow-panel); }
.care-card { display: grid; gap: 8px; width: 100%; text-align: left; background: transparent; margin: 8px 0; padding: 20px 16px; }
.care-card small { color: var(--muted); font-size: 13px; line-height: 1.6; font-weight: 400; }
.observation-filters { display: grid; grid-template-columns: minmax(0,300px) minmax(120px,145px); align-items: center; gap: 8px 12px; }
.observation-filters input { width: 100%; min-height: 40px; padding: 8px 12px; font-size: 13px; }
.observation-filters select { width: 100%; min-height: 40px; padding: 8px 12px; font-size: 13px; }
.observation-row { display: grid; grid-template-columns: 60px minmax(0,1fr) auto; gap: 12px; align-items: start; padding: 8px 0; }
.observation-date { display: grid; gap: 2px; padding-top: 1px; font: 500 16px/1.3 var(--font-record); color: var(--accent); }
.observation-date small { font: 11px var(--font-text); color: var(--muted); }
.observation-copy { min-width: 0; }
.observation-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.observation-text.expanded { display: block; }
.observation-expand { min-height: 24px; padding: 2px 0; font-size: 11px; color: var(--accent); }
.observation-actions { display: flex; gap: 2px; }
.observation-actions button { width: 32px; min-height: 32px; padding: 4px; font-size: 20px; text-align: center; }
#observation-editor { width: min(680px,calc(100% - 24px)); }
#observation-editor .fields { grid-template-columns: minmax(0,1fr); }
#observation-date { max-width: 210px; }
#observation-description { min-height: 110px; max-height: 320px; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.calendar-toolbar button { padding: 4px 10px; min-height: 32px; font-size: 12px; }
.calendar-line { display: grid; grid-template-columns: 28px minmax(0,1fr) 28px; gap: 4px; align-items: center; }
.calendar-arrow { width: 28px; min-height: 48px; padding: 4px; font-size: 25px; text-align: center; }
#calendar-days { display: flex; position: relative; overflow-x: auto; min-width: 0; scrollbar-width: none; overscroll-behavior-x: contain; scroll-snap-type: x proximity; }
#calendar-days::-webkit-scrollbar { display: none; }
.calendar-day { display: grid; justify-items: center; align-content: center; gap: 4px; flex: 0 0 max(32px,calc(100% / 15)); min-width: 0; min-height: 58px; padding: 5px 0; background: transparent; box-shadow: none; border-radius: 8px; scroll-snap-align: center; }
.calendar-day:hover { box-shadow: none; background: #f0f5f2; }
.calendar-day[aria-pressed=true] { background: #eaf3ee; }
.calendar-date-number { font: 500 12px/1.2 var(--font-record); }
.calendar-day small { font-size: 9px; line-height: 1.1; color: var(--muted); }
.calendar-dot { width: 6px; height: 6px; border-radius: 50%; background: #cdd8d1; }
.calendar-day.is-today .calendar-date-number { color: var(--accent); font-weight: 900; }
.calendar-day.is-today .calendar-dot { box-shadow: 0 0 0 2px #ffffff,0 0 0 3px #89b39e; }
.calendar-day.has-intakes .calendar-dot { background: #36885c; }
.calendar-legend { color: var(--muted); font-size: 10px; margin: 6px 32px 14px; }
.medication-day-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; }
.medication-day-heading h3 { margin: 6px 0; font-size: 15px; }
.medication-day-heading .hint { font-size: 11px; }
#medication-day-status:empty { display: none; }
.intake-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; align-items: center; padding: 10px 0; }
.intake-copy { min-width: 0; }
.intake-name { padding: 0; min-height: 28px; font: 600 16px/1.4 var(--font-record); color: #25312e; }
.intake-dose { font-size: 13px; line-height: 1.5; margin: 2px 0; overflow-wrap: anywhere; }
.intake-copy small { display: block; font-size: 11px; }
.intake-toggle { font-size: 12px; min-height: 38px; padding: 8px 12px; background: #f0f4f1; box-shadow: none; }
.intake-toggle[aria-pressed=true] { background: #e2f0e7; color: #276744; }
.calendar-mark-hint { margin: 12px 0; font-size: 11px; }
#medication-courses { margin-top: 20px; }
#medication-courses > summary { font-size: 14px; }
.medication-course-filter { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); max-width: 240px; margin: 6px 0 10px; }
.medication-course-filter select { min-height: 38px; padding: 7px 10px; font-size: 12px; }
.medication-course-row { display: grid; gap: 3px; width: 100%; padding: 10px 8px; background: transparent; box-shadow: none; text-align: left; border-radius: 10px; }
.medication-course-row:hover { background: #f1f6f3; box-shadow: none; }
.medication-course-title { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.medication-course-title strong { font: 500 16px var(--font-record); }
.medication-course-dose { font-size: 13px; flex: none; }
.medication-course-schedule { font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.medication-course-row small { font-size: 11px; color: var(--muted); }
.medication-weekdays { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 14px; }
.medication-weekdays legend { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.fields .medication-weekdays label { display: flex; gap: 5px; align-items: center; min-height: 36px; }
.medication-weekdays input[type=checkbox] { width: 17px; min-height: 17px; accent-color: var(--accent); }
@media(max-width:700px) {
 .observation-row { grid-template-columns: 46px minmax(0,1fr) auto; gap: 6px; padding: 8px 0; }
 .observation-text { font-size: 13px; }
 .observation-date { font-size: 16px; }
 .observation-filters input { width: 100%; }
 .calendar-line { grid-template-columns: 22px minmax(0,1fr) 22px; gap: 0; }
 .calendar-arrow { width: 22px; }
 .calendar-legend { margin-left: 22px; }
 .intake-row { gap: 8px; padding: 9px 0; }
 .intake-toggle { padding: 8px; font-size: 11px; }
 .intake-name { font-size: 15px; }
 .intake-dose { font-size: 12px; }
 .medication-course-title { flex-wrap: wrap; gap: 4px 12px; }
}
.task-preview { display: block; width: 100%; background: transparent; padding: 12px 0; text-align: left; font-size: 14px; line-height: 1.6; }
.task-preview.overdue { color: #a0473e; }
.record-controls { flex-wrap: wrap; }
.related-care { margin: 14px 0 22px; }
.related-care button { display: block; padding-left: 0; }
#event-dialog { width: min(920px, calc(100% - 32px)); }
#event-dialog .modal-head { gap: 16px; }
#event-dialog .event-heading { min-width: 0; flex: 1; }
#event-dialog .modal-head h2 { margin-bottom: 0; font-size: 25px; line-height: 1.25; }
.event-heading-actions { display: flex; align-items: center; gap: 10px; flex: none; }
#event-controls .record-controls { margin: 0; gap: 4px; }
#event-controls button { font-size: 13px; min-height: 40px; padding: 8px 12px; }
#event-body > .report-meta { margin: 14px 0 18px; }
.dental-card .dental-overview { display: grid; grid-template-columns: 155px minmax(0,1fr); align-items: center; gap: 24px; }
.dental-card .dental-event-key, .dental-card .dental-event-map { min-width: 0; }
.dental-card:not(.dental-zoomed) .dental-mouth { min-width: 0; }
.dental-card:not(.dental-zoomed) .mouth-tooth { min-width: 0; min-height: 0; height: auto; aspect-ratio: 44 / 48; }
.dental-card:not(.dental-zoomed) .mouth-tooth svg { width: 100%; height: auto; }
.dental-card .dental-legend { flex-direction: column; align-items: start; gap: 14px; margin: 0; font-size: 13px; line-height: 1.45; }
.dental-card .dental-legend > span { align-items: start; gap: 8px; }
.dental-card .dental-key { flex: none; margin-top: 4px; }
.dental-card .dental-event-key .hint { margin: 22px 0 0; font-size: 11px; line-height: 1.6; }
.event-detail-columns { display: grid; grid-template-columns: minmax(0,1fr); gap: 24px; margin-top: 18px; }
.event-detail-columns.has-related { grid-template-columns: minmax(0,1.5fr) minmax(230px,1fr); gap: 36px; }
.event-description, .event-related { min-width: 0; }
.event-detail-columns h3 { margin: 0 0 12px; font-size: 16px; }
.event-description .event-notes { margin: 0 0 16px; line-height: 1.65; overflow-wrap: anywhere; }
.event-description .download-link { overflow-wrap: anywhere; }
.event-tooth-actions { list-style: none; padding: 0; margin: 0 0 12px; color: var(--accent); font-size: 14px; line-height: 1.6; }
.event-tooth-actions li + li { margin-top: 4px; }
.event-related .related-care { display: grid; gap: 6px; margin: 0; }
.event-related .related-care button { width: 100%; padding: 10px 12px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.document-photo { display: block; max-width: 100%; padding: 0; margin: 14px 0; background: transparent; box-shadow: none; cursor: zoom-in; }
.document-photo:hover { background: transparent; box-shadow: none; }
.document-photo .document-preview { display: block; margin: 0; }
.document-read { margin: 4px 0 14px; }
.treatment-draft, .treatment-suggestion { background: #eef6f2; padding: 16px; border-radius: 14px; margin: 16px 0; }
.treatment-draft h3, .treatment-suggestion h3 { margin: 0 0 8px; font-size: 15px; }
.treatment-draft .hint, .treatment-suggestion .hint { margin: 0; }
.treatment-draft pre, .treatment-suggestion .event-notes { white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.6 var(--font-text); max-height: 260px; overflow: auto; }
.treatment-choice { display: flex; align-items: start; gap: 10px; font-size: 13px; line-height: 1.5; }
.treatment-choice input { width: 18px; height: 18px; min-height: 18px; flex: none; margin-top: 1px; accent-color: var(--accent); }
.treatment-add { width: 100%; font-size: 13px; color: var(--accent); background: #fff; }
.treatment-review-hint { grid-column: 1 / -1; margin: 0; }
.treatment-source { margin-bottom: -8px; }
#document-image-dialog { width: min(1200px, calc(100% - 24px)); height: min(94dvh,1100px); max-height: 94dvh; padding: 20px; overflow: hidden; }
#document-image-dialog[open] { display: grid; grid-template-rows: auto auto auto minmax(0,1fr); gap: 10px; }
#document-image-dialog .modal-head h2 { margin: 0; font: 500 19px/1.35 var(--font-record); }
.document-image-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.document-image-tools button { min-height: 40px; padding: 8px 12px; font-size: 13px; }
#document-image-scale { min-width: 42px; text-align: center; font-size: 13px; }
#document-image-dialog .download-link { font-size: 13px; margin-left: auto; }
#document-image-status { margin: 0; grid-row: 3; }
#document-image-status:empty { display: none; }
#document-image-stage { grid-row: 4; min-height: 0; overflow: auto; overscroll-behavior: contain; background: #f2f5f3; border-radius: 12px; }
#document-image { display: block; height: auto; max-width: none; margin: 0 auto; }
@media(max-width:700px) {
 #event-dialog { width: calc(100% - 12px); }
 #event-dialog .modal-head { display: grid; grid-template-columns: minmax(0,1fr) 40px; gap: 10px; }
 #event-dialog .modal-head h2 { font-size: 23px; }
 .event-heading-actions { display: contents; }
 .event-heading-actions .close { grid-column: 2; grid-row: 1; }
 #event-controls { grid-column: 1 / -1; grid-row: 2; }
 #event-controls:empty { display: none; }
 #event-controls button { min-height: 44px; padding: 8px 12px; }
 .event-detail-columns.has-related { grid-template-columns: minmax(0,1fr); gap: 24px; }
 .dental-card .dental-overview { grid-template-columns: 125px minmax(0,1fr); gap: 12px; }
 .dental-card .dental-legend { font-size: 12px; gap: 12px; }
}
@media(max-width:600px) {
 .dental-card .dental-overview { grid-template-columns: 88px minmax(0,1fr); gap: 8px; }
 .dental-card .dental-legend { font-size: 11px; gap: 10px; }
 .dental-card .dental-legend > span { gap: 6px; }
 .dental-card .dental-event-key .hint { font-size: 10px; margin-top: 14px; }
 .dental-card.dental-zoomed .dental-overview { grid-template-columns: minmax(0,1fr); }
 .dental-card.dental-zoomed .dental-event-key { display: none; }
}
.trend-grid { stroke: #e5ebe8; stroke-width: 1; }
.trend-axis { fill: #65716e; }
.trend-range { stroke: #aebbb5; stroke-width: 3; }
.trend-point { cursor: pointer; }
.trend-point:focus { outline: none; stroke: #276857; stroke-width: 2; }
.trend-legend { display: flex; flex-wrap: wrap; }
.trend-delta { line-height: 1.7; background: #e7f0eb; border-radius: 14px; }
.trend-result p { margin: 10px 0; }
.trend-results { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 40px; }
/* Search keeps its controls together and its results within reading width. */
#search-form { max-width: 860px; }
.search-toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto auto 32px; gap: 8px; align-items: center; }
.search-query { display: block; min-width: 0; margin: 0; }
.search-query-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.search-query input { width: 100%; min-height: 40px; padding: 8px 12px; font-size: 14px; }
.search-toolbar button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 12px; font-size: 13px; line-height: 1.4; white-space: nowrap; }
.search-toolbar svg { width: 18px; height: 18px; flex: none; }
#search-filter-toggle { position: relative; color: var(--accent); }
#search-filter-toggle[aria-expanded=true], #search-filter-toggle[data-filtered=true] { background: #e4efe8; }
#search-reset { width: 32px; padding: 0; color: var(--muted); }
.search-filter-count { position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: var(--accent); color: #fff; text-align: center; font: 600 10px/16px var(--font-record); }
#search-filter-box { margin: 8px 0 0; padding: 12px; background: var(--glass); border-radius: 12px; box-shadow: var(--shadow-card); }
#search-filter-box .search-filters { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px 12px; margin: 0; }
#search-filter-box > .hint { margin: 6px 0 0; font-size: 11px; line-height: 1.4; }
#search-status { margin: 8px 0 4px; font-size: 12px; line-height: 1.4; }
#search-results { max-width: 960px; }
.search-result { min-width: 0; margin: 0; padding: 0; }
.search-result + .search-result { border-top: 1px solid rgb(36 58 47 / 7%); }
.search-result-link { display: grid; gap: 2px; width: 100%; min-width: 0; min-height: 44px; padding: 8px 6px; border-radius: 8px; color: #25312e; background: transparent; text-align: left; text-decoration: none; box-shadow: none; }
.search-result-link:hover { background: #edf3f0; box-shadow: none; }
.search-result-link .search-row-title { font: 600 15px/1.35 var(--font-record); overflow-wrap: anywhere; }
.search-row-meta { color: var(--muted); font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.search-row-snippet { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; color: #596961; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
#search-pages { max-width: 960px; align-items: center; gap: 8px; margin: 8px 0; }
#search-pages:empty { display: none; }
#search-pages button { min-height: 36px; padding: 6px 10px; font-size: 12px; }
@media(max-width:700px) {
 .search-toolbar { grid-template-columns: minmax(0,1fr) 40px 40px 32px; gap: 6px; }
 .search-query input { min-height: 44px; font-size: 16px; }
 .search-toolbar button { min-height: 44px; padding: 0; }
 .search-action-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
 #search-filter-box { padding: 10px; }
 #search-filter-box .search-filters { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
 .search-result-link .search-row-title { font-size: 14px; }
}
@media(max-width:380px) { #search-filter-box .search-filters { grid-template-columns: minmax(0,1fr); } }
#photo-ocr { margin: 24px 0; }
#ocr-text-wrap { margin: 18px 0; }
#ocr-text-wrap summary { cursor: pointer; padding: 12px 0; min-height: 48px; color: var(--accent); }
#ocr-text-wrap label { display: grid; gap: 8px; }
.ocr-confirm { grid-column: 1 / -1; display: flex !important; align-items: center; gap: 12px; }
.ocr-confirm input { width: 24px; min-height: 24px; flex: none; }
.term-card { padding: 20px 0; }
.term-card h3 { margin-bottom: 8px; }
.term-aliases { color: #53615a; font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.term-card form { display: grid; gap: 8px; }
.term-card label { display: grid; gap: 8px; font-size: 13px; color: var(--muted); }
.term-card button { justify-self: start; }
.user-term { padding: 16px; margin: 12px 0; border-radius: 14px; background: #edf3ef; overflow-wrap: anywhere; }
.user-term strong, .user-term small { display: block; margin-bottom: 8px; }
.user-term summary { padding: 10px 0; cursor: pointer; }
.summary-sections { border: 0; margin: 24px 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary-sections legend { margin-bottom: 10px; font-weight: 600; }
.summary-sections label { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; }
.summary-sections input { width: 22px; min-height: 22px; margin: 0; }
#summary-preview { padding: 32px 0; }
#summary-preview h1 { font-size: 30px; }
.summary-section { margin: 38px 0; }
.summary-record { padding: 12px 0; }
.summary-record h3 { margin-bottom: 12px; font-size: 18px; line-height: 1.5; }
.summary-record p { line-height: 1.7; overflow-wrap: anywhere; }
.summary-table-wrap { overflow-x: auto; }
.summary-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 14px 0; }
.summary-table th { background: #e7f0eb; text-align: left; }
.summary-table th, .summary-table td { padding: 12px; vertical-align: top; text-align: left; line-height: 1.5; }
@media(max-width:700px) { .summary-sections { grid-template-columns: 1fr; } .summary-table { min-width: 580px; } }
@media print {
 body:has(#summary-panel:not([hidden])) { background: white; }
 body:has(#summary-panel:not([hidden])) .shell { max-width: none; padding: 0; }
 body:has(#summary-panel:not([hidden])) .workspace { display: block; margin: 0; }
 body:has(#summary-panel:not([hidden])) header,
 body:has(#summary-panel:not([hidden])) .actions, body:has(#summary-panel:not([hidden])) .care-nav,
 body:has(#summary-panel:not([hidden])) .summary-controls, body:has(#summary-panel:not([hidden])) #message,
 body:has(#summary-panel:not([hidden])) #readonly-banner { display: none !important; }
 .summary-section h2, .summary-record h3 { break-after: avoid; }
 .summary-table { min-width: 0; font-size: 10pt; }
 .summary-table-wrap { overflow: visible; }
 .summary-table thead { display: table-header-group; }
 .summary-table tr { break-inside: avoid; }
 .summary-section { margin: 20px 0; }
 #summary-preview { padding: 0; }
 @page { size: A4; margin: 16mm; }
}

.summary-directions summary { cursor: pointer; min-height: 44px; padding: 14px 16px; background: #f2f5f2; border-radius: 12px; font-weight: 600; }
.summary-directions .summary-sections { margin-top: 12px; }
#document-text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; max-height: 350px; overflow: auto; padding: 12px; background: #f2f5f2; border-radius: 12px; }
#document-text-wrap { margin: 16px 0; }
#intake-progress { color: #3b6858; }
/* Compact document review. Labels stay available to assistive technology. */
#editor.lab-editor { width: min(1160px,calc(100% - 28px)); padding: 20px 24px; max-height: 94vh; }
#editor .modal-head { position: sticky; top: -20px; z-index: 5; padding: 12px 0; background: #fff; align-items: center; }
#editor .modal-head h2 { font-size: 22px; margin: 0; }
#editor .modal-head .eyebrow { display: none; }
#editor footer { position: sticky; bottom: -20px; z-index: 5; background: #fff; padding: 14px 0; margin: 12px 0 0; box-shadow: 0 -12px 22px #ffffffed; }
#record-details, #source-details { margin: 2px 0 8px; }
#record-details > summary, #source-details > summary { font-size: 13px; padding: 8px 0; min-height: 34px; color: #466055; overflow-wrap: anywhere; }
#intake-progress { font-size: 12px; margin: 4px 0 8px; }
#intake-source { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#intake-filename { margin: 4px 0; }
#intake-replace { padding: 6px 10px; min-height: 32px; font-size: 12px; }
#editor.lab-editor .fields { grid-template-columns: minmax(150px,.9fr) minmax(220px,1.4fr) minmax(160px,1fr); gap: 10px 14px; }
#editor.lab-editor #record-type-wrap { grid-column: auto; }
#editor.lab-editor #facility-wrap { grid-column: span 2; }
#editor.lab-editor .fields label { gap: 4px; font-size: 12px; }
#editor.lab-editor input, #editor.lab-editor select { min-height: 38px; padding: 8px 10px; border-radius: 7px; font-size: 13px; }
#editor.lab-editor .inline-add { min-height: 28px; padding: 2px 0; font-size: 12px; }
#record-notes > summary { min-height: 28px; padding: 3px 0; font-size: 12px; }
#editor.lab-editor .status { background: transparent; padding: 0; margin: 8px 0; font-size: 12px; }
#editor.lab-editor #intake-meta-hint { margin: 5px 0; font-size: 12px; }
.preview-toolbar { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; margin: 16px 0 4px; }
.preview-toolbar h3 { margin: 0; font-size: 17px; }
.preview-toolbar .hint { font-size: 12px; }
.preview-instruction { margin: 4px 0 10px; font-size: 12px; }
.preview-columns, .preview-row { display: grid; grid-template-columns: 24px minmax(0,1.85fr) minmax(132px,.95fr) minmax(70px,.65fr) minmax(112px,.9fr) minmax(200px,1.7fr) 36px; gap: 8px; }
.preview-columns { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.preview-row { grid-template-areas: 'number name value unit reference match remove' '. check check check check match .' '. flag flag flag flag match .'; align-items: start; padding: 8px 4px; border-radius: 10px; min-width: 0; }
.preview-row:nth-child(even) { background: #f8faf9; }
.preview-row.unmatched { background: #fff8ea; }
.preview-row label { gap: 0; font-size: 12px; min-width: 0; }
.preview-row .field-caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.row-number { grid-area: number; color: #819088; font-size: 11px; padding-top: 12px; text-align: center; }
.row-name { grid-area: name; min-width: 0; }
.preview-row .profile-pin { display: flex; align-items: center; gap: 6px; min-height: 26px; margin-top: 2px; font-size: 11px; color: var(--muted); cursor: pointer; }
.preview-row .profile-pin input { width: 16px; height: 16px; min-height: 16px; flex: none; margin: 0; accent-color: var(--accent); }
.row-value { grid-area: value; }
.row-unit { grid-area: unit; }
.row-reference { grid-area: reference; }
.row-match { grid-area: match; min-width: 0; }
.row-match label { display: grid; }
.preview-row .remove { grid-area: remove; display: grid; place-items: center; padding: 0; min-height: 36px; width: 36px; background: transparent; color: var(--muted); border-radius: 7px; }
.preview-row .remove svg { display: block; width: 16px; height: 16px; pointer-events: none; }
.preview-row .remove:hover { color: #983f35; background: #fcece9; }
.preview-row .remove:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row-full-name summary { padding: 1px 0; min-height: 23px; font-size: 11px; color: var(--accent); }
.row-full-name p { margin: 3px 0 6px; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.remember-term { padding: 2px 0; min-height: 26px; border-radius: 0; background: transparent; color: #496e5c; text-align: left; font-size: 12px; line-height: 1.4; font-weight: 400; }
.remember-term:hover { background: transparent; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.remember-term:disabled { opacity: .6; }
.row-feedback { margin: 1px 0; font-size: 11px; color: var(--accent); line-height: 1.45; overflow-wrap: anywhere; }
.row-feedback.error { color: #983f35; }
.preview-row .ocr-confirm { grid-area: check; display: flex; align-items: center; gap: 7px; font-size: 11px; min-height: 24px; margin-top: 1px; }
.preview-row .ocr-confirm input { width: 18px; min-height: 18px; margin: 0; }
.row-flag { grid-area: flag; color: var(--muted); font-size: 11px; }
@media(max-width:960px) {
 .preview-columns { display: none; }
 .preview-row { grid-template-columns: 24px repeat(3,minmax(0,1fr)) 36px; grid-template-areas: 'number name name name remove' '. value unit reference .' '. match match match .' '. check check check .' '. flag flag flag .'; gap: 6px 8px; padding: 12px 4px; }
 .preview-row .field-caption { position: static; width: auto; height: auto; clip: auto; overflow: visible; white-space: normal; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
 .row-name .field-caption { display: none; }
 .row-match { display: block; }
 .row-match label { min-width: 0; }
 .row-match .remember-term { margin-bottom: 0; }
 .row-feedback { grid-column: 1 / -1; }
 #editor.lab-editor .fields { grid-template-columns: 1fr 1fr; }
 #editor.lab-editor #record-type-wrap { grid-column: 1 / -1; }
 #editor.lab-editor #facility-wrap { grid-column: auto; }
}
@media(max-width:700px) {
 #editor.lab-editor, #editor.dental-editor { width: calc(100% - 12px); padding: 20px 12px; }
}
@media(max-width:600px) {
 #editor, #editor.lab-editor, #editor.dental-editor { padding: 14px 12px; border-radius: 16px; }
 .preview-row .remove { width: 44px; min-height: 44px; }
 #editor.lab-editor { max-height: 95vh; }
 #editor .modal-head { top: -14px; }
 #editor footer { bottom: -14px; padding: 10px 0; }
 #editor .modal-head h2 { font-size: 20px; }
 #editor.lab-editor .fields { grid-template-columns: 1fr; }
 #editor.lab-editor #record-type-wrap { grid-column: auto; }
 .preview-row { grid-template-columns: repeat(3,minmax(0,1fr)) 44px; grid-template-areas: 'name name name remove' 'value unit reference .' 'match match match .' 'check check check .' 'flag flag flag .'; padding: 10px 6px; }
 .row-number { display: none; }
 .row-match { display: block; }
 .row-match .remember-term { max-width: none; min-height: 30px; margin-bottom: 0; }
 #editor.lab-editor .preview-row input, #editor.lab-editor .preview-row select { font-size: 16px; padding: 8px; }
 .preview-toolbar { align-items: start; }
 #intake-source { display: block; }
}

@media(min-width:961px) {
 .preview-columns { position: sticky; top: 52px; z-index: 4; background: #fff; padding: 8px 0; }
}

#editor.lab-editor .preview-row textarea { min-height: 38px; padding: 8px 10px; border-radius: 7px; font-size: 13px; line-height: 1.4; resize: none; overflow: hidden; }
@media(max-width:600px) { #editor.lab-editor .preview-row textarea { font-size: 16px; padding: 8px; } }

#unsaved-dialog { width: min(440px, calc(100% - 12px)); max-width: calc(100% - 12px); padding: 24px; }
#unsaved-dialog .modal-head { align-items: center; gap: 12px; }
#unsaved-dialog .modal-head h2 { margin: 0; font-size: 23px; }
#unsaved-dialog .hint { margin: 16px 0; }
#unsaved-dialog .unsaved-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }
#unsaved-save { grid-column: 1 / -1; }
#unsaved-dialog .unsaved-actions button { padding: 12px 10px; }
@media(max-width:700px) { #unsaved-dialog { padding: 20px 12px; } }

/* Several lab scales and medication courses share the same calendar axis. */
.trend-selection { margin-top: 24px; display: grid; gap: 18px; }
.trend-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.trend-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.trend-chip { min-height: 38px; padding: 8px 12px; background: #e5eee9; color: #285c49; font-size: 13px; text-align: left; overflow-wrap: anywhere; }
.trend-picker { max-width: 680px; }
.trend-picker summary, .trend-result-details > summary, .trend-dose-details > summary { cursor: pointer; font-size: 13px; color: #276857; padding: 10px 0; }
.trend-picker[open] { background: #f0f4f2; border-radius: 12px; padding: 0 14px 10px; }
.trend-picker input[type=search] { background: #fff; min-height: 42px; margin: 4px 0 8px; }
.trend-choices { max-height: 240px; overflow-y: auto; display: grid; gap: 2px; }
.trend-choice, .trend-toggle { display: flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; }
.trend-choice { min-height: 44px; padding: 7px 0; }
.trend-choice span { min-width: 0; overflow-wrap: anywhere; }
.trend-choice input, .trend-toggle input { width: 18px; height: 18px; min-height: 18px; margin: 0; flex: none; accent-color: var(--accent); }
.trend-toggle { min-height: 44px; }
.trend-filters { max-width: none; grid-template-columns: 1.3fr 1fr 1fr auto; gap: 12px; align-items: end; margin: 22px 0 12px; }
.trend-filters button { font-size: 13px; }
.trend-period { font-size: 13px; font-weight: 600; margin: 24px 0 12px; }
.trend-lane { padding: 6px 0 12px; min-width: 0; }
.trend-lane h3 { margin: 8px 0 4px; }
.trend-lane-meta { color: var(--muted); font-size: 12px; margin: 0; }
.trend-chart { margin: 6px 0 0; width: 100%; display: block; max-height: none; min-height: 0; }
.trend-axis { font-size: 11px; }
.trend-point-info, .trend-dose-info { font-size: 13px; line-height: 1.5; color: var(--muted); margin: 6px 0; overflow-wrap: anywhere; }
.trend-legend { font-size: 12px; gap: 4px 12px; margin: 8px 0 2px; }
.trend-comparison { margin: 12px 0 0; max-width: none; }
.trend-comparison h3 { font-size: 15px; margin: 8px 0 14px; }
.trend-delta { padding: 12px; font-size: 13px; }
.trend-result { padding: 14px 0; }
.trend-result strong { font-size: 16px; }
.trend-medications { margin: 10px 0 24px; }
.trend-medications > h3 { margin: 8px 0; }
.trend-medication-lane { padding: 12px 0; }
.trend-medication-heading { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.trend-medication-link { min-height: 36px; font-size: 15px; font-weight: 600; background: transparent; padding: 6px 0; text-align: left; overflow-wrap: anywhere; color: #276857; }
.trend-medication-lane .trend-point.selected { stroke: #276857; stroke-width: 2; }
.trend-dose-label { font-size: 12px; fill: #26342d; }
@media(max-width:700px) {
 .trend-filters { grid-template-columns: 1fr 1fr; }
 .trend-filters label:first-child { grid-column: 1 / -1; }
 .trend-filters button { grid-column: 1 / -1; justify-self: start; min-height: 36px; padding: 6px 0; }
 .trend-selection { gap: 10px; }
 .trend-lane { padding: 8px 0 14px; }
 .trend-results { grid-template-columns: 1fr; gap: 0; }
 .trend-axis { font-size: 11px; }
}

/* Patient profile: source-linked facts and current recorded courses. */
.profile-identity { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 12px; }
.profile-identity > .hint { font-size: 12px; line-height: 1.4; }
.profile-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; align-items: start; }
.profile-column { display: grid; gap: 12px; min-width: 0; }
#profile-prevention { margin-bottom: 0; }
#profile-status:empty { display: none; }
#profile-prevention h3 { margin-bottom: 8px; }
.prevention-meta { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.prevention-intro { margin: 0 0 12px; }
.prevention-list { display: grid; gap: 0 28px; }
.prevention-row { min-width: 0; border-bottom: 1px solid rgba(60,100,88,.09); }
.prevention-row > summary { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 10px 0; list-style: none; cursor: pointer; }
.prevention-row > summary::-webkit-details-marker { display: none; }
.prevention-row > summary::after { content: '⌄'; color: var(--muted); margin-left: auto; flex: 0 0 auto; }
.prevention-row[open] > summary::after { transform: rotate(180deg); }
.prevention-caption { display: grid; gap: 3px; min-width: 0; }
.prevention-caption strong { font-size: 16px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.prevention-caption .hint { font-size: 12px; }
.prevention-last { font-size: 12px; color: var(--muted); }
.prevention-last.has-record { color: var(--accent); }
.prevention-row-body .prevention-source { display: block; text-align: left; width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; color: var(--accent); }
.prevention-row-body { padding: 0 0 10px; }
.prevention-row-body p { margin: 6px 0; }
.prevention-row-body button { padding: 5px 0; min-height: 36px; font-size: 13px; }
.prevention-more, .prevention-about { margin-top: 12px; font-size: 13px; }
.prevention-more > summary, .prevention-about > summary { min-height: 36px; padding: 7px 0; font-size: 13px; }
.prevention-about { color: var(--muted); }
.prevention-about p { margin: 10px 0; }
.prevention-about a { font-size: 12px; }
.profile-section { min-width: 0; padding: 16px 18px; background: var(--glass); border-radius: 16px; box-shadow: var(--shadow-card); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.profile-section h3 { margin: 0 0 10px; font-size: 13px; line-height: 1.35; font-weight: 700; }
.profile-section h4 { margin: 0 0 6px; font-size: 12px; line-height: 1.4; color: var(--muted); font-weight: 600; }
.profile-section p { overflow-wrap: anywhere; }
.profile-section > p { margin: 6px 0; font-size: 13px; line-height: 1.45; }
.profile-analyte + .profile-analyte { margin-top: 24px; }
.profile-medication + .profile-medication { margin-top: 10px; }
.profile-result strong { display: block; font-size: 21px; font-weight: 600; overflow-wrap: anywhere; }
.profile-result .report-meta { margin: 8px 0; font-size: 12px; }
.profile-result .record-controls { gap: 8px 12px; margin-top: 8px; }
.profile-result .record-controls button { font-size: 12px; padding: 6px 0; min-height: 32px; }
.profile-result .download-link { font-size: 12px; }
.profile-unpin { margin-left: auto; }
.profile-history { margin-top: 18px; }
.profile-history summary { min-height: 36px; padding: 8px 0; color: var(--muted); cursor: pointer; font-size: 13px; }
.profile-history .profile-result { margin-top: 14px; }
.profile-difference { font-size: 12px; line-height: 1.5; color: #846131; }
.profile-medication-name { padding: 0; min-height: 32px; background: transparent; color: var(--accent); font-weight: 600; text-align: left; }
.profile-medication-name:hover { background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.profile-dose { margin: 6px 0; font-size: 15px; }
.profile-medication .event-notes { margin: 6px 0; }
.profile-medication .hint { margin: 6px 0; }
.profile-medication .profile-medication-name { display: block; min-height: 22px; padding: 0; font-size: 15px; line-height: 1.35; }
.profile-medication-dose { color: #25312e; font-weight: 500; }
.profile-medication .profile-medication-schedule { margin: 1px 0; font-size: 13px; line-height: 1.35; }
.profile-medication .hint { margin: 1px 0; font-size: 12px; line-height: 1.35; }
.profile-toggle { padding: 2px 0; min-height: 30px; border-radius: 0; background: transparent; color: var(--accent); font-size: 12px; }
.profile-toggle:hover { background: transparent; text-decoration: underline; text-underline-offset: 3px; }
#profile-editor .modal-head { align-items: center; margin-bottom: 22px; }
#profile-editor .modal-head h2 { margin: 0; font-size: 22px; }
@media(max-width:700px) {
 .profile-grid { grid-template-columns: 1fr; gap: 12px; }
 .profile-column { gap: 12px; }
 .profile-section { padding: 14px 12px; }
}

/* Keep the navigation on the left without squeezing records on small screens. */
@media(max-width:1180px) {
 .columns { grid-template-columns: 1fr; gap: 40px; }
 .profile-grid { grid-template-columns: 1fr; }
 .trend-filters { grid-template-columns: 1fr 1fr; }
 .trend-filters label:first-child { grid-column: 1 / -1; }
 .trend-filters button { grid-column: 1 / -1; justify-self: start; }
}
@media(min-width:701px) { .profile-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width:1000px) {
 .shell { padding-left: 24px; padding-right: 24px; }
 .workspace { --nav-width: 140px; grid-template-columns: var(--nav-width) minmax(0,1fr); gap: 20px; margin-top: 32px; }
 .care-nav button { gap: 10px; padding: 12px 10px; }
 .actions { grid-template-columns: repeat(4,44px); }
 .actions button { width: 44px; min-height: 44px; border-radius: 12px; }
}
@media(max-width:700px) {
 :root { --app-header-height: 56px; }
 .shell { padding: 20px 8px 48px; }
 .shell > header { padding: 0 4px; }
 .workspace { grid-template-columns: 44px minmax(0,1fr); grid-template-areas: "nav toolbar" "nav content"; gap: 16px 12px; margin-top: 24px; }
 .workspace-header { grid-template-columns: minmax(0,1fr); grid-template-areas: "heading" "filter"; gap: 10px; }
 .history-heading { align-items: center; justify-content: space-between; gap: 10px; }
 .history-heading h2 { font-size: 18px; white-space: normal; }
 .care-nav { gap: 6px; top: calc(var(--app-header-height) + 12px); max-height: calc(100dvh - var(--app-header-height) - 24px); padding: 0; background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
 .care-nav-links { gap: 6px; }
 .care-nav button { justify-content: center; width: 44px; min-height: 44px; padding: 0; border-radius: 12px; }
 .care-nav svg { width: 21px; height: 21px; }
 .nav-label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
 .nav-toggle-label { display: none; }
 .nav-expanded .care-nav { width: 168px; padding: 4px; justify-items: stretch; z-index: 7; background: rgb(255 255 255 / 94%); box-shadow: 0 12px 40px rgb(40 70 57 / 12%), inset 0 1px 0 #fff; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
 .nav-expanded .care-nav button { width: 100%; justify-content: start; padding: 10px; gap: 10px; }
 .nav-expanded .nav-label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: nowrap; }
 .nav-expanded .nav-toggle-label { display: inline; }
 .actions { grid-template-columns: repeat(4,44px); gap: 6px; justify-self: end; position: static; }
 .actions svg { width: 24px; height: 24px; }
 .workspace-content > section > h2, .workspace-content .summary-controls > h2 { font-size: 21px; }
 .workspace-content .section-head { flex-wrap: wrap; gap: 10px; }
 .workspace-content .section-head .section-add { width: 44px; height: 44px; min-height: 44px; flex: 0 0 44px; padding: 0; }
 .section-add .add-button-label { display: none; }
 .section-add .add-button-icon { font-size: 26px; font-weight: 300; }
 .profile-section { padding: 14px 12px; }
}
@media(max-width:360px) {
 :root { --app-header-height: 104px; }
 .shell > .app-header { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; padding-top: 6px; padding-bottom: 6px; }
 .app-header .brand span { display: inline; margin-left: 10px; }
}

.inline-add, .inline-add:hover, .remember-term, .remember-term:hover,
.profile-toggle, .profile-toggle:hover, .profile-medication-name, .profile-medication-name:hover,
.search-result-link, .search-result-link:hover, .preview-row .remove, .preview-row .remove:hover,
.trend-medication-link, .trend-medication-link:hover,
.mouth-tooth:not(.selected), .mouth-tooth:not(.selected):hover { box-shadow: none; }
@media print {
 body:has(#summary-panel:not([hidden])) .workspace-header { display: none; }
 body:has(#summary-panel:not([hidden])) { background: #fff; }
 .profile-section { background: #fff; box-shadow: none; backdrop-filter: none; }
}

/* Record names have a separate hierarchy from section headings and result values. */
.event b, .event strong, .care-card b, .care-card strong, .record-title,
#event-title, #report-title, #care-detail-title,
.profile-medication-name, .trend-medication-link, .profile-analyte h4,
.trend-lane > h3, .summary-record h3, #unlinked-documents .event {
 font-family: var(--font-record);
 font-weight: 500;
 line-height: 1.4;
 letter-spacing: -.01em;
 overflow-wrap: anywhere;
}
#event-title, #report-title, #care-detail-title { font-weight: 900; line-height: 1.3; }
.event > span:first-child { min-width: 0; }

.profile-operation { padding: 8px 0; }
.profile-operation + .profile-operation { margin-top: 2px; }
.profile-operation .report-meta { margin: 6px 0; font-size: 13px; }
.profile-operation .record-controls { margin: 0; gap: 12px; }
.profile-operation .record-controls button { font-size: 12px; min-height: 36px; padding: 6px 0; }
.profile-operations-editor { min-width: 0; }
.profile-operations-editor .section-head { flex-wrap: wrap; margin: 4px 0 10px; }
.profile-operations-editor h3 { margin: 0; font-size: 17px; }
.profile-operations-editor .inline-add { min-height: 36px; }
#profile-editor .modal-head { position: sticky; top: -32px; z-index: 3; padding: 12px 0; background: #fff; }
#profile-editor footer { position: sticky; bottom: -32px; z-index: 3; padding: 12px 0; background: #fff; box-shadow: 0 -10px 18px rgb(255 255 255 / 94%); }
.patient-operation-row { display: grid; grid-template-columns: minmax(0,1.4fr) 140px minmax(0,1fr) 36px; gap: 8px; align-items: end; margin: 14px 0; }
.operation-row-remove { width: 36px; min-height: 48px; padding: 0; font-size: 26px; color: var(--muted); background: transparent; box-shadow: none; }
.operation-row-remove:hover { background: #fcece9; color: #983f35; box-shadow: none; }
@media(max-width:700px) {
 #profile-editor .modal-head { top: -20px; }
 #profile-editor footer { bottom: -20px; }
}
@media(max-width:600px) {
 #profile-editor .modal-head h2 { font-size: 20px; }
 .patient-operation-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 44px; gap: 10px 8px; margin: 18px 0; }
 .patient-operation-row .operation-title { grid-column: 1 / 3; }
 .operation-row-remove { grid-row: 1; grid-column: 3; width: 44px; }
 .patient-operation-row .operation-performed_on { grid-column: 1; }
 .patient-operation-row .operation-facility { grid-column: 2 / 4; }
 .patient-operation-row input { font-size: 16px; }
}

/* Recoverable cleanup of unused uploads and backup archives. */
.unlinked-row { display: grid; grid-template-columns: minmax(0,1fr) 36px; gap: 6px; align-items: center; margin: 8px 0; }
.unlinked-row .event { margin: 0; min-width: 0; }
.file-remove { width: 36px; min-height: 36px; padding: 0; font-size: 25px; line-height: 1; background: transparent; box-shadow: none; }
.backup-file-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.backup-file-line .download-link { min-width: 0; overflow-wrap: anywhere; }
.backup-row .file-remove { padding: 0; font-size: 25px; flex: none; }
#deleted-uploads-wrap, #deleted-backups-wrap, #deleted-recovered-wrap { margin-top: 18px; }
#deleted-uploads-wrap > summary, #deleted-backups-wrap > summary, #deleted-recovered-wrap > summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 8px 0; }
.deleted-file-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 8px 0; font-size: 13px; min-width: 0; }
.deleted-file-row > a, .deleted-file-row > span { min-width: 0; overflow-wrap: anywhere; }
.deleted-file-row button { padding: 6px 0; min-height: 32px; font-size: 12px; }
@media(max-width:700px) { .file-remove, .backup-row .file-remove { width: 40px; min-height: 40px; } .unlinked-row { grid-template-columns: minmax(0,1fr) 40px; } }

/* Native camera capture remains separate from the PDF/file picker. */
#document-source-dialog { width: min(420px,calc(100% - 24px)); padding: 24px; }
#document-source-dialog .modal-head { align-items: center; gap: 12px; margin-bottom: 20px; }
#document-source-dialog .modal-head h2 { font-size: 21px; line-height: 1.3; margin: 0; }
.document-source-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.source-option { display: grid; justify-items: center; gap: 12px; min-width: 0; min-height: 104px; padding: 18px 8px; font-size: 14px; }
.source-option svg { width: 28px; height: 28px; }
.camera-hint { margin: 16px 0 0; font-size: 12px; line-height: 1.5; }
.camera-action { display: none; }
.intake-source-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; flex: none; }
@media(max-width:700px), (any-pointer:coarse) { .camera-action:not([hidden]) { display: inline-flex; align-items: center; min-height: 44px; } }
@media(max-width:700px) {
 #document-source-dialog { margin-top: auto; margin-bottom: max(8px,env(safe-area-inset-bottom)); width: calc(100% - 16px); padding: 22px 18px; border-radius: 24px; }
 #document-source-dialog .modal-head h2 { font-size: 20px; }
 .source-option { min-height: 100px; }
 .intake-source-actions { gap: 4px 12px; }
 .intake-source-actions button { padding: 8px 0; font-size: 13px; }
}

/* The compact intake calendar stays available in every section. */
.workspace { grid-template-areas: "nav calendar" "nav toolbar" "nav content"; grid-template-rows: max-content max-content minmax(0,1fr); }
.workspace:has(#history-toolbar[hidden]) { grid-template-areas: "nav calendar" "nav content"; grid-template-rows: max-content minmax(0,1fr); }
.global-calendar { grid-area: calendar; display: grid; grid-template-columns: 32px minmax(0,1fr); align-items: center; gap: 4px; min-width: 0; position: sticky; top: calc(var(--app-header-height) + 8px); z-index: 8; padding: 4px 6px; background: rgb(255 255 255 / 97%); border-radius: 13px; box-shadow: var(--shadow-panel); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.global-calendar .calendar-line { grid-template-columns: 20px minmax(0,1fr) 20px; gap: 0; }
.global-calendar .calendar-arrow { width: 20px; min-height: 34px; font-size: 21px; }
.global-calendar .calendar-day { flex-basis: max(28px,calc(100% / 15)); min-height: 36px; gap: 2px; padding: 2px 0; border-radius: 6px; }
.global-calendar .calendar-date-number { font-size: 11px; }
.global-calendar .calendar-day small { font-size: 8px; }
.global-calendar .calendar-dot { width: 4px; height: 4px; }
.calendar-home { display: grid; place-items: center; width: 32px; min-height: 34px; padding: 6px; color: var(--accent); background: transparent; box-shadow: none; }
.calendar-home svg { width: 19px; height: 19px; }
.calendar-screen-reader { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.nav-expanded .care-nav { z-index: 9; }
#medication-calendar-popup { position: fixed; inset: auto; margin: 0; width: min(440px,calc(100vw - 16px)); max-height: min(560px,calc(100dvh - 24px)); padding: 16px; overflow-y: auto; background: rgb(255 255 255 / 97%); color: #25312e; border: 0; border-radius: 18px; box-shadow: 0 12px 56px rgb(33 56 47 / 20%),inset 0 1px 0 #fff; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
#medication-calendar-popup::backdrop { background: transparent; }
.calendar-popup-head { display: flex; justify-content: space-between; gap: 8px; align-items: start; position: sticky; top: -16px; padding: 8px 0; background: rgb(255 255 255 / 97%); z-index: 1; }
.calendar-popup-head h3 { margin: 0 0 4px; font: 600 17px/1.3 var(--font-record); }
.calendar-popup-head .hint { font-size: 11px; }
.calendar-popup-head .close { width: 32px; min-height: 32px; padding: 0; flex: none; }
#medication-day-status:empty { display: none; }
#medication-calendar-popup .intake-row { padding: 8px 0; gap: 10px; }
#medication-calendar-popup .intake-name { font-size: 15px; }
#medication-calendar-popup .intake-dose { font-size: 12px; }
.intake-rule { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.calendar-popup-legend { margin: 12px 0 4px; font-size: 10px; color: var(--muted); }
#medication-calendar-popup .calendar-mark-hint { margin: 4px 0 0; font-size: 10px; }
.medication-interval-fields { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 140px minmax(0,1fr); gap: 10px 16px; }
.medication-interval-fields .hint { grid-column: 1 / -1; margin: 0; font-size: 12px; }
@media(max-width:700px) {
 .global-calendar { top: calc(var(--app-header-height) + 4px); padding: 3px 2px; grid-template-columns: 26px minmax(0,1fr); gap: 0; }
 .calendar-home { width: 26px; min-height: 40px; padding: 4px; }
 .global-calendar .calendar-day { flex-basis: max(32px,calc(100% / 15)); min-height: 40px; }
 #medication-calendar-popup { padding: 14px; }
 .calendar-popup-head { top: -14px; }
 .medication-interval-fields { grid-template-columns: 110px minmax(0,1fr); gap: 10px; }
}
@media print { .global-calendar, #medication-calendar-popup { display: none !important; } }

#medication-calendar-popup .intake-name { min-height: 24px; line-height: 1.35; }
#medication-calendar-popup .intake-dose { margin: 0; }
#medication-calendar-popup .intake-rule { margin-top: 1px; line-height: 1.3; }
#medication-calendar-popup .intake-row { padding: 6px 0; }
.calendar-day.has-period .calendar-dot,
.calendar-day.has-period.is-today .calendar-dot { box-shadow: 0 0 0 2px #fff,0 0 0 4px #e797b7; }
.calendar-period-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin: 2px 0 7px; padding: 4px 9px; border-radius: 9px; background: #fdf1f6; }
.calendar-period { display: flex; flex: 1 1 auto; flex-direction: row; align-items: center; gap: 12px; min-height: 32px; margin: 0; padding: 0; color: #71445a; font-family: Lato,sans-serif; font-size: 13px; cursor: pointer; }
.calendar-period-control { display: flex; align-items: center; gap: 7px; }
.calendar-period input { width: 17px; height: 17px; min-height: 0; margin: 0; padding: 0; accent-color: #bd5e86; box-shadow: none; }
#calendar-period-value { min-width: 23px; font-size: 12px; }
.medication-interval-fields { min-width: 0; }
.calendar-cycle-start { display: flex; flex: none; flex-direction: row; align-items: center; gap: 6px; min-height: 32px; margin: 0; color: #85526b; font-size: 11px; white-space: nowrap; cursor: pointer; }
.calendar-cycle-start input { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: #bd5e86; }
.calendar-cycle { margin: 2px 0 8px; padding: 7px 9px; background: #fcf6f9; border-radius: 9px; }
.calendar-cycle p { margin: 0; }
#calendar-cycle-forecast { font: 500 13px/1.4 var(--font-record); color: #70455c; }
#calendar-cycle-meta, #calendar-cycle-note { margin-top: 4px; font-size: 11px; line-height: 1.4; }
#calendar-cycle-meta:empty { display: none; }
#calendar-cycle-history { margin-top: 5px; color: #7d6471; font-size: 11px; }
#calendar-cycle-history summary { cursor: pointer; min-height: 30px; padding: 5px 0; font-size: 11px; }
.calendar-cycle .calendar-cycle-interval { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.calendar-cycle-hint { grid-column: 1 / -1; width: 100%; padding: 3px 8px; min-height: 23px; text-align: left; color: #85526b; background: #fcf4f8; border-radius: 7px; box-shadow: none; font: 500 11px/1.4 var(--font-record); }
.calendar-cycle-hint.is-due { background: #f9eaf2; color: #864866; }
.calendar-dot { position: relative; }
.calendar-day.is-period-expected:not(.has-period) .calendar-dot::after { content: ''; position: absolute; inset: -4px; border: 1.5px dashed #c97fa1; border-radius: 50%; }
#drug-safety { margin: 8px 0 20px; }
.drug-safety-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drug-safety-head h3 { margin: 0; font: 500 19px var(--font-record); }
.drug-safety-head label { display: flex; flex-direction: row; align-items: center; gap: 7px; margin: 0; font-size: 12px; }
.drug-safety-head input { width: 148px; min-height: 36px; padding: 6px 9px; }
.drug-safety-head { justify-content: flex-start; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 8px; }
.drug-safety-head .medication-course-filter { margin: 0; max-width: none; }
.drug-safety-head select { width: 168px; min-height: 36px; padding: 6px 9px; font-size: 12px; }
.drug-safety-limit { max-width: 900px; font-size: 12px; line-height: 1.45; }
#drug-safety summary { min-height: 34px; padding: 8px 0; font-size: 13px; }
.drug-profile-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; }
.drug-profile-row strong { display: block; font: 500 14px var(--font-record); }
.drug-profile-row small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.drug-profile-row button { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.drug-pair { margin: 10px 0; padding: 12px 14px; border-radius: 12px; background: rgb(255 255 255 / 85%); box-shadow: var(--shadow-card); }
.drug-pair h4 { margin: 0 0 7px; font: 500 15px/1.4 var(--font-record); overflow-wrap: anywhere; }
.drug-finding { padding: 7px 10px; border-radius: 9px; margin-top: 7px; background: #f4f4f3; }
.drug-finding p { margin: 5px 0; font-size: 12px; line-height: 1.5; }
.drug-level { font: 600 12px/1.4 var(--font-record); }
.drug-contraindicated { background: #fcebea; color: #8d2d29; }
.drug-avoid { background: #fff0e6; color: #87502c; }
.drug-separate { background: #fff6da; color: #705821; }
.drug-monitor { background: #edf2fa; color: #3e5879; }
.drug-reference_major { background: #fcebea; color: #8d2d29; }
.drug-reference_moderate { background: #fff6da; color: #705821; }
.drug-reference_minor, .drug-reference_unknown { background: #edf2fa; color: #3e5879; }
.drug-finding.is-provisional { outline: none; }
.drug-components { font-weight: 600; }
#drug-reference-info { margin: 4px 0 10px; }
#drug-reference-info p { font-size: 12px; margin: 6px 0; line-height: 1.5; overflow-wrap: anywhere; }
.drug-finding .drug-timing { font-weight: 600; }
.drug-sources a { color: inherit; text-decoration: underline; }
.drug-unverified p { margin: 5px 0; font-size: 12px; color: var(--muted); }
#drug-profile-dialog { width: min(650px,calc(100vw - 16px)); }
#drug-profile-dialog h2 { font: 500 20px/1.3 var(--font-record); }
#care-detail.medication-detail { width: min(640px,calc(100% - 24px)); padding: 20px 24px; }
#care-detail.medication-detail .modal-head { position: relative; display: block; padding-right: 52px; margin-bottom: 2px; }
#care-detail.medication-detail #care-detail-close { position: absolute; top: 0; right: 0; }
#care-detail.medication-detail #care-detail-title { margin: 0; font: 600 22px/1.25 var(--font-record); letter-spacing: -.02em; }
.medication-detail .medication-detail-plan { margin: 0 0 3px; padding-right: 52px; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.medication-detail .medication-detail-meta { margin: 0; font-size: 12px; line-height: 1.5; }
.medication-detail .event-notes { margin: 6px 0; font-size: 13px; line-height: 1.45; }
.medication-detail-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; margin: 3px 0 8px; }
.medication-detail-links .inline-add,.medication-detail-links .download-link { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 0; margin: 0; font-size: 13px; line-height: 1.4; background: transparent; box-shadow: none; }
.medication-dose-history h3 { margin: 0 0 5px; font: 600 14px/1.4 var(--font-record); }
.medication-dose-row { display: grid; grid-template-columns: 66px minmax(0,1fr); gap: 8px; padding: 4px 0; font-size: 13px; line-height: 1.45; }
.medication-dose-row time { color: var(--muted); }
.medication-dose-row p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.medication-detail .record-controls { flex-wrap: wrap; gap: 0 16px; margin: 8px 0 2px; }
.medication-detail .record-controls button { min-height: 36px; padding: 4px 0; font-size: 13px; line-height: 1.4; background: transparent; box-shadow: none; }
.medication-detail #care-detail-body > details { margin-top: 2px; }
.medication-detail #care-detail-body > details > summary { min-height: 36px; padding: 7px 0; font-size: 12px; }
.medication-detail #care-detail-body > details > p { margin: 5px 0; font-size: 12px; line-height: 1.45; }
@media(max-width:700px) {
 #care-detail.medication-detail { width: calc(100% - 12px); padding: 16px 14px; }
 #care-detail.medication-detail #care-detail-title { font-size: 20px; }
 .medication-detail-links { column-gap: 14px; margin-bottom: 6px; }
 .medication-detail-links .inline-add,.medication-detail-links .download-link,.medication-detail .record-controls button { min-height: 40px; }
 .medication-detail .record-controls { column-gap: 14px; }
}
.drug-profile-fields label, .drug-check-fields label { margin-top: 9px; font-size: 12px; }
.drug-profile-fields input, .drug-profile-fields select, .drug-check-fields input, .drug-check-fields select { min-height: 38px; padding: 7px 10px; font-size: 13px; }
.drug-picker-tools { display: grid; grid-template-columns: minmax(0,1fr) 38px; gap: 5px; margin-top: 5px; }
.drug-picker-tools select { min-width: 0; }
.drug-picker-tools button { min-height: 38px; padding: 5px; }
.drug-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.drug-chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 5px 1px 9px; border-radius: 7px; background: #eaf1ee; font-size: 12px; }
.drug-chip button { width: 27px; min-height: 28px; padding: 0; font-size: 18px; }
label.drug-confirm { display: flex; flex-direction: row; align-items: center; gap: 8px; line-height: 1.4; }
.drug-confirm input { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; flex: none; }
.drug-picker-hint { margin: 7px 0; font-size: 11px; }
.drug-check-fields { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; margin: 8px 0 14px; }
.drug-check-fields fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
.drug-check-fields legend { font: 500 15px var(--font-record); }
#calendar-drug-safety { margin: 5px 0; font-size: 11px; min-height: 30px; }
.drug-section-title { margin: 14px 0 7px; font: 600 14px/1.4 var(--font-record); }
.drug-alert-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.drug-alert-head h4 { margin: 0; min-width: 0; }
.drug-provisional { flex: none; font-size: 10px; font-weight: 400; opacity: .85; }
button.drug-provisional { min-height: 26px; padding: 3px 6px; }
.drug-pair > p { margin: 4px 0; font-size: 13px; line-height: 1.45; }
.drug-pair .drug-level { display: block; margin-top: 3px; font-size: 11px; }
.drug-pair .drug-timing { font-weight: 600; }
#drug-safety-status { margin: 4px 0; font-size: 12px; }
#drug-safety > .drug-safety-limit { margin: 4px 0 10px; font-size: 11px; }
.drug-lifestyle-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.drug-lifestyle-card { min-width: 0; padding: 10px 12px 4px; background: rgb(255 255 255 / 80%); border-radius: 12px; box-shadow: var(--shadow-card); }
.drug-lifestyle-card h4 { font: 500 14px/1.4 var(--font-record); overflow-wrap: anywhere; }
.drug-lifestyle-line { margin: 6px 0; padding: 5px 7px; border-radius: 7px; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.drug-lifestyle-kind { display: block; font: 600 10px/1.4 var(--font-record); margin-bottom: 1px; }
.lifestyle-avoid { color: #8d2d29; background: #fcebea; }
.lifestyle-caution { color: #705821; background: #fff6da; }
.lifestyle-timing { color: #3e5879; background: #edf2fa; }
.lifestyle-meal { color: #365b4d; background: #ecf4ef; }
.drug-detail-rule { margin: 8px 0; }
.drug-detail-rule p,.drug-lifestyle-card details p { font-size: 12px; line-height: 1.45; margin: 5px 0; }
.drug-source-line { overflow-wrap: anywhere; }
#drug-safety-about { margin-top: 18px; padding-top: 10px; border-top: 1px solid rgb(62 84 72 / 7%); }
.drug-secondary { margin: 4px 0; }
#drug-safety-about > p { font-size: 11px; line-height: 1.45; }
.drug-guide-row { min-width: 0; margin: 6px 0; border: 0; border-radius: 12px; background: var(--glass); box-shadow: var(--shadow-card); }
#drug-safety .drug-guide-row > .drug-guide-summary { display: grid; grid-template-columns: minmax(0,1fr) 14px; align-items: start; gap: 2px 10px; padding: 8px 12px; border-radius: inherit; cursor: pointer; list-style: none; }
.drug-guide-row > summary::-webkit-details-marker { display: none; }
.drug-guide-name strong { display: block; font: 600 15px/1.4 var(--font-record); overflow-wrap: anywhere; }
.profile-medication .profile-medication-name { font-weight: 600; }
.drug-guide-name { min-width: 0; }
.drug-guide-name > strong { display: inline; }
.drug-guide-name small { display: inline; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.drug-guide-plan { display: inline; margin: 0; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.drug-guide-copy { grid-column: 1; font-size: 12px; line-height: 1.4; }
.drug-guide-copy:empty { display: none; }
.drug-guide-advice { display: block; overflow-wrap: anywhere; }
.drug-guide-advice + .drug-guide-advice { margin-top: 2px; }
.guide-danger { color: #9a3830; font-weight: 600; }
.guide-caution { color: #806322; }
.drug-guide-arrow { grid-column: 2; grid-row: 1; color: var(--muted); transition: transform .15s; }
.drug-guide-row[open] .drug-guide-arrow { transform: rotate(180deg); }
.drug-guide-details { margin: 0; padding: 0 12px 8px; font-size: 12px; }
.drug-guide-details p { margin: 5px 0; line-height: 1.5; }
.drug-guide-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 14px; }
.drug-guide-tools button,.drug-guide-tools .download-link { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 0; margin: 0; font-size: 12px; line-height: 1.4; background: transparent; box-shadow: none; }
.drug-guide-details .download-link { font-size: 12px; }
@media(max-width:700px) { #drug-safety .drug-guide-row > .drug-guide-summary { gap: 2px 8px; } .drug-guide-name strong { font-size: 14px; } .drug-guide-tools { column-gap: 12px; } }
@media(max-width:700px) { .drug-lifestyle-grid { grid-template-columns: minmax(0,1fr); } .drug-alert-head { flex-wrap: wrap; gap: 3px 8px; } }
@media(max-width:700px) { .drug-safety-head { align-items: start; } .drug-safety-head h3 { font-size: 16px; } .drug-safety-head label { flex-direction: column; align-items: start; gap: 2px; } .drug-safety-head input { width: 132px; } .drug-check-fields { grid-template-columns: minmax(0,1fr); } .drug-pair { padding: 10px; } }
@media(max-width:700px) {
 .drug-safety-head { gap: 8px; flex-wrap: nowrap; }
 .drug-filter-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
 .drug-safety-head .drug-date-filter { flex: 0 0 120px; }
 .drug-safety-head .drug-date-filter input { width: 100%; font-size: 12px; }
 .drug-safety-head .medication-course-filter { flex: 1; min-width: 0; }
 .drug-safety-head select { width: 100%; }
}

#drug-safety .drug-guide-row > div.drug-guide-summary { cursor: default; }
#drug-safety-about > summary { font-size: 12px; color: var(--muted); }
.drug-evidence-group h4,#drug-safety-sources h4 { margin: 12px 0 5px; font: 500 12px/1.4 var(--font-record); }
.drug-evidence-entry { margin: 2px 0; font-size: 12px; }
.drug-evidence-entry > summary { padding: 5px 0; line-height: 1.45; overflow-wrap: anywhere; }
.drug-evidence-entry p { margin: 5px 0 8px; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.drug-evidence-entry .drug-detail-rule { margin: 6px 0 10px; }
.drug-citation { font-size: 10px; white-space: nowrap; }
#drug-safety-sources ol { margin: 5px 0 12px; padding-left: 22px; }
#drug-safety-sources li { margin: 4px 0; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }

/* Заголовки разделов занимают одинаковую строку под календарём. */
.workspace-content .page-heading h2,
.workspace-header .history-heading h2 { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.3; letter-spacing: -.025em; }
.workspace-content .page-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap; gap: 12px; min-height: 44px; margin: 0 0 16px; }
.workspace-content .page-heading > button { flex: none; min-height: 40px; padding: 8px 12px; font-size: 13px; }
.page-heading-main { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.page-heading-main > .hint { flex: none; font-size: 12px; white-space: nowrap; }
.page-heading .page-action-label { color: inherit; }
.page-action-icon { display: none; width: 20px; height: 20px; }
.page-heading + .hint { margin: 0 0 12px; }
#observation-status:empty { display: none; }
#observation-list { margin-top: 8px; }
@media(max-width:700px) {
  .workspace-content .page-heading h2,
 .workspace-header .history-heading h2 { font-size: 18px; }
 .workspace-header .history-heading { min-height: 44px; }
 .workspace-content .page-heading .page-action { display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; flex: 0 0 44px; padding: 0; }
 .page-action-label { display: none; }
 .page-action-icon { display: block; }
 .observation-filters { grid-template-columns: minmax(0,1fr) 115px; gap: 8px; }
}
@media(max-width:360px) {
 .workspace-content .page-heading { align-items: flex-start; }
 .workspace-header .history-heading { align-items: baseline; }
 .workspace-content .page-heading h2,
 .workspace-header .history-heading h2 { margin-top: 10px; }
}

#profile-panel > .page-heading { margin-bottom: 8px; }
.profile-heading { min-width: 0; }
.profile-heading .eyebrow { margin: 0 0 3px; font-size: 10px; line-height: 1.2; font-weight: 300; letter-spacing: .14em; }
#profile-panel > .page-heading h2 { font-size: 20px; line-height: 1.25; font-weight: 600; letter-spacing: -.025em; }
@media(max-width:700px) { #profile-panel > .page-heading h2 { font-size: 18px; } }

/* Shared screen density. The patient profile and printed summary keep their layout. */
@media screen {
 .workspace-content > section:not(#profile-panel), #history-panel { font-size: 14px; line-height: 1.45; }
 .workspace-content > section:not(#profile-panel) > .page-heading { margin-bottom: 12px; }
 .section-head { margin-bottom: 12px; }
 #history-panel { gap: 24px; }
 .event { padding: 11px 12px; gap: 10px; }
 .event small { margin-top: 3px; font-size: 12px; line-height: 1.4; }
 .care-card { gap: 4px; margin: 4px 0; padding: 11px 12px; }
 .care-card small { font-size: 12px; line-height: 1.4; }
 .history-filter { gap: 4px; margin-bottom: 10px; }
 #care-panel .history-filter { display: flex; align-items: center; gap: 8px; width: min(100%,260px); font-size: 12px; }
 #care-panel .history-filter select { min-width: 0; flex: 1; }
 .task-preview { padding: 8px 0; line-height: 1.45; }
 .aside p { margin-top: 8px; font-size: 13px; line-height: 1.45; }
 .aside hr { margin: 20px 0; }
 .stack { margin-top: 8px; gap: 2px; }
 .stack .quiet, .backup-row .quiet { min-height: 36px; padding: 5px 0; font-size: 13px; }
 .empty { padding: 14px 0; line-height: 1.45; }

 dialog { padding: 20px; font-size: 14px; line-height: 1.45; }
 dialog .modal-head { align-items: center; gap: 12px; margin-bottom: 10px; }
 dialog .modal-head h2, #event-dialog .modal-head h2 { margin: 0; font-size: 22px; line-height: 1.3; }
 dialog .modal-head .eyebrow { margin: 0 0 4px; font-size: 10px; font-weight: 400; }
 #report-title, #event-title, #care-detail-title { font-weight: 600; }
 dialog h3 { margin: 14px 0 6px; font-size: 14px; line-height: 1.4; }
 dialog .report-meta { margin: 4px 0 8px; font-size: 12px; line-height: 1.45; }
 dialog .event-notes { margin: 6px 0; font-size: 14px; line-height: 1.45; }
 dialog .hint { font-size: 12px; line-height: 1.45; }
 dialog .record-controls { gap: 0 14px; margin: 6px 0; }
 dialog .record-controls button, dialog .related-care button { min-height: 36px; padding: 5px 0; font-size: 13px; line-height: 1.4; background: transparent; box-shadow: none; }
 .record-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0 20px; margin: 2px 0 6px; }
 .record-toolbar .record-controls { margin: 0; }
 .record-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; margin: 2px 0 6px; }
 .record-links a, .record-links button { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 0; margin: 0; font-size: 13px; line-height: 1.4; color: var(--accent); }
 .record-toolbar .record-links { margin: 0; }
 .record-history > summary { min-height: 36px; padding: 7px 0; font-size: 12px; }
 .record-history .hint { margin: 5px 0; overflow-wrap: anywhere; }
 .care-source-fields > summary { min-height: 36px; padding: 7px 0; font-size: 12px; }
 .care-source-fields > .fields { margin: 4px 0; }
 .record-audit { margin-top: 2px; }
 dialog .related-care { margin: 6px 0; }
 dialog .related-care h3 { margin: 0 0 4px; font-size: 13px; }
 .related-care-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; }
 dialog .related-care-actions button { width: auto; }
 .report-results { margin: 4px 0; }
 #report-dialog { width: min(680px,calc(100% - 24px)); }
 #report-body .result { padding: 8px 0; gap: 6px 12px; line-height: 1.4; }
 #report-body .result small { margin-top: 3px; font-size: 11px; line-height: 1.4; }
 #report-body .profile-toggle { display: flex; width: max-content; max-width: 100%; min-height: 28px; padding: 3px 0; margin-top: 2px; font-size: 11px; }
 #report-body .result strong { font: 600 14px/1.4 var(--font-record); }
 #event-body > .report-meta { margin: 2px 0 10px; }
 .event-detail-columns, .event-detail-columns.has-related { margin-top: 10px; gap: 16px; }
 .event-detail-columns h3 { margin-bottom: 6px; font-size: 14px; }
 .event-description .event-notes { margin: 0 0 8px; line-height: 1.45; }
 .event-description > p { margin: 6px 0; }
 .event-related .related-care { gap: 2px; }
 .event-tooth-actions { margin-bottom: 6px; font-size: 13px; line-height: 1.45; }
 .dental-card .dental-legend { gap: 8px; }
 .dental-card .dental-event-key .hint { margin-top: 12px; line-height: 1.45; }
 .document-photo { margin: 8px 0; }
 .document-read { margin: 0 0 6px; }
 .treatment-draft, .treatment-suggestion { padding: 12px; margin: 8px 0; }
 dialog .document-preview, dialog .upload-preview { margin: 10px auto; }

 #care-editor .modal-head { margin-bottom: 12px; }
 #editor .modal-head { padding: 8px 0; margin-bottom: 6px; }
 #editor footer { padding: 8px 0; margin-top: 8px; }
 dialog footer button { font-size: 13px; }
 dialog .fields textarea { line-height: 1.45; }
 dialog .field-group { gap: 3px; }
 dialog .fields .inline-add { min-height: 28px; padding: 2px 0; font-size: 12px; }
 dialog .status { padding: 10px; margin-top: 10px; font-size: 13px; line-height: 1.45; }
 #photo-ocr { margin: 10px 0; }
 #ocr-text-wrap, #document-text-wrap { margin: 8px 0; }
 #ocr-text-wrap > summary { min-height: 36px; padding: 7px 0; font-size: 12px; }
 .preview-toolbar { margin-top: 10px; }
 .term-card { padding: 12px 0; }
 .term-card h3 { margin: 6px 0; }
 .term-aliases { font-size: 13px; line-height: 1.5; }
 .user-term { padding: 10px 12px; margin: 6px 0; }
 .user-term strong, .user-term small { margin-bottom: 4px; }

 .trend-selection { margin-top: 10px; gap: 8px; }
 .trend-selection > .trend-selector:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
 .trend-selection > .trend-selector:first-child .trend-label, .trend-selection > .trend-selector:first-child .trend-chips { margin: 0; }
 .trend-selection > .trend-selector:first-child .trend-picker[open] { flex-basis: 100%; }
 .trend-picker > summary { min-height: 32px; padding: 6px 0; }
 .trend-chip { min-height: 32px; padding: 5px 10px; }
 .trend-label { margin-bottom: 4px; }
 .trend-filters { margin: 12px 0 8px; gap: 8px 12px; }
 .trend-period { margin: 12px 0 6px; }
 .trend-comparison h3 { margin: 6px 0; }
 .trend-result { padding: 8px 0; }
 .trend-result p { margin: 4px 0; font-size: 13px; line-height: 1.45; }
 .trend-medications { margin: 6px 0 12px; }
 .trend-medication-lane { padding: 6px 0; }
 .summary-sections { margin: 12px 0; gap: 4px 12px; }
 .summary-sections label { min-height: 32px; gap: 8px; font-size: 13px; line-height: 1.4; }
 .summary-directions > summary { min-height: 40px; padding: 9px 12px; font-size: 13px; }
 #summary-preview { padding: 14px 0; }
 #summary-preview > h1 { display: none; }
 #summary-panel .record-controls button { min-height: 36px; padding: 8px 12px; font-size: 13px; }
 .summary-section { margin: 20px 0; }
 .summary-record { padding: 8px 0; }
 .summary-record h3 { font-size: 15px; margin: 0 0 6px; }
 .summary-record p { margin: 5px 0; font-size: 13px; line-height: 1.45; }
 .summary-table { margin: 8px 0; font-size: 12px; }
 .summary-table th, .summary-table td { padding: 7px 8px; line-height: 1.4; }
 #profile-editor .modal-head { top: -20px; padding: 8px 0; }
 #profile-editor footer { bottom: -20px; padding: 8px 0; }
}
@media screen and (min-width:701px) {
 .trend-filters { grid-template-columns: minmax(0,1.3fr) repeat(2,minmax(0,1fr)); }
 .trend-filters label:first-child { grid-column: auto; }
 .trend-filters button { grid-column: 1 / -1; min-height: 28px; padding: 3px 0; }
}
@media screen and (max-width:700px) {
 dialog { padding: 16px 12px; }
 #report-dialog { width: calc(100% - 12px); }
 dialog .modal-head h2, #event-dialog .modal-head h2 { font-size: 20px; }
 dialog .record-controls button, dialog .related-care button, .record-links a, .record-links button { min-height: 40px; }
 input, select, textarea { font-size: 16px; min-height: 44px; }
 .event { padding: 10px; }
 .event-detail-columns.has-related { gap: 12px; }
 #editor .modal-head { top: -16px; }
 #profile-editor .modal-head { top: -16px; }
 #profile-editor footer { bottom: -16px; }
 #care-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
 #care-fields > label { grid-column: 1 / -1; }
 #care-fields > .full { grid-column: 1 / -1; }
 #care-fields > label:has(input[name=start_date],input[name=end_date],input[name=prescribed_on],input[name=due_date],select[name=status],select[name=calendar_mode]) { grid-column: auto; }
 .summary-sections { grid-template-columns: repeat(2,minmax(0,1fr)); }
 .summary-controls > .fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
 .summary-controls > .fields > .full { grid-column: 1 / -1; }
 .summary-sections label { min-height: 40px; }
}
@media screen and (max-width:359px) {
 .summary-sections { grid-template-columns: minmax(0,1fr); }
 .summary-controls > .fields { grid-template-columns: minmax(0,1fr); }
 #care-fields { grid-template-columns: minmax(0,1fr); }
}
/* Компактный вход с той же типографикой, что в карте. */
.login-page { display: grid; place-items: center; min-height: 100dvh; margin: 0; padding: 16px; }
.login-card { width: min(100%,380px); padding: 24px; border-radius: 20px; background: var(--glass); box-shadow: var(--shadow-card); }
.login-card .brand { margin-bottom: 20px; font-size: 21px; }
.login-card h1 { margin: 0 0 16px; font: 600 19px/1.3 var(--font-record); }
.login-card form { display: grid; gap: 12px; }
.login-card input { min-height: 44px; font-size: 16px; }
.login-password { position: relative; display: block; }
.login-password input { padding-right: 44px; }
.login-password button { position: absolute; top: 2px; right: 2px; display: grid; place-items: center; width: 40px; min-height: 40px; padding: 9px; box-shadow: none; }
.login-password svg { width: 22px; height: 22px; }
.login-card #login-error { margin: 0; color: #9a3830; font-size: 13px; line-height: 1.4; }
.login-card .login-note { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.login-card .login-success { margin: 0 0 12px; color: var(--accent); font-size: 13px; line-height: 1.4; }
#account-dialog { width: min(460px,calc(100% - 12px)); padding: 18px; }
#account-dialog .modal-head { align-items: center; gap: 10px; margin-bottom: 4px; }
#account-dialog .modal-head h2 { margin: 0; font: 600 19px/1.3 var(--font-record); }
#account-dialog .account-login { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
#account-password-form { display: grid; gap: 10px; }
#account-password-form label { font-size: 12px; }
#account-password-form input:not([type="checkbox"]) { min-height: 44px; font-size: 16px; }
#account-password-form label small { font-size: 11px; }
#account-dialog .account-show { display: flex; flex-direction: row; align-items: center; gap: 7px; min-height: 30px; }
#account-show-passwords { width: 17px; height: 17px; min-height: 0; margin: 0; padding: 0; }
#account-error { margin: 0; color: #9a3830; font-size: 12px; line-height: 1.4; }
#account-dialog .account-hint { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
#account-sessions { margin-top: 12px; border-top: 1px solid rgb(62 84 72 / 9%); }
#account-sessions > summary { min-height: 40px; padding: 10px 0; color: var(--accent); font-size: 12px; cursor: pointer; }
#account-logout-all { margin-top: 7px; min-height: 40px; padding: 7px 10px; font-size: 12px; }
@media(max-width:700px) { #account-dialog { padding: 14px 12px; } }
