@charset "UTF-8";

:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --surface: #ffffff;
  --ink: #16343a;
  --muted: #6b7f83;
  --subtle: #91a1a3;
  --primary: #157568;
  --primary-dark: #0d5c52;
  --primary-light: #e9f5f1;
  --line: #dfe8e8;
  --line-light: #edf1f1;
  --amber: #976119;
  --amber-bg: #fff7e9;
  --red: #b54243;
  --red-bg: #fff0ef;
  --blue: #3e698c;
  --blue-bg: #eef5fa;
  --shadow: 0 3px 16px #203b4105, 0 1px 2px #203b4103;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; scroll-padding-top: 24px; scroll-padding-bottom: 110px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.65 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button, select, summary { cursor: pointer; }
button { touch-action: manipulation; }
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--primary-dark); }
svg { flex-shrink: 0; vertical-align: middle; }
svg:not([width]) { width: 20px; height: 20px; }
img { max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { padding-left: 1.4em; }
li + li { margin-top: 5px; }
strong { font-weight: 600; }
small { font-size: 12px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #4e9f91; outline-offset: 3px; }
::selection { background: #d2eae3; color: #133d34; }

.app-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 86px; padding: 19px max(28px, calc((100vw - 1544px) / 2)); background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; color: var(--primary); background: #eaf4f0; border: 1px solid #d9ebe4; }
.brand-mark svg { width: 30px; height: 30px; }
.brand-title { font-size: 19px; font-weight: 650; line-height: 1.4; letter-spacing: .035em; }
.brand-caption { color: var(--muted); font-size: 10px; letter-spacing: .14em; line-height: 1.6; margin-top: 1px; }
.header-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 15px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font-weight: 500; line-height: 1.5; text-decoration: none; transition: background .16s ease, border-color .16s ease, box-shadow .16s ease; }
.button:hover, .icon-button:hover { background: #f6f9f8; border-color: #b8ccca; }
.button.primary { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 2px 3px #15756812; }
.button.primary:hover { border-color: var(--primary-dark); background: var(--primary-dark); }
.button.secondary { background: var(--primary-light); border-color: #cce3da; color: var(--primary-dark); }
.button.secondary:hover { background: #dcede5; }
.button.ghost { background: transparent; border-color: transparent; color: #60767a; }
.button.ghost:hover { background: #edf4f2; color: var(--primary-dark); }
.button.danger { color: var(--red); background: #fff; border-color: #edc5c2; }
.button.danger:hover { background: var(--red-bg); border-color: #d99d99; }
.button.small { font-size: 12px; padding: 6px 11px; min-height: 36px; }
.icon-button { width: 40px; height: 40px; flex: 0 0 40px; padding: 0; }
.button svg, .icon-button svg { width: 17px; height: 17px; }
button:disabled, .button[aria-disabled="true"] { cursor: not-allowed; color: #91a09e; background: #f0f3f2; border-color: #e2e7e5; box-shadow: none; }

.workspace { width: 100%; max-width: 1600px; margin: 0 auto; padding: 28px 28px 22px; }
.patient-strip { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 20px; padding: 19px 23px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.patient-summary { display: flex; align-items: center; gap: 13px; min-width: 145px; }
.patient-summary > svg { width: 41px; height: 41px; padding: 10px; color: var(--primary); background: #edf6f3; border-radius: 50%; }
.patient-summary h2, .patient-summary strong { font-size: 16px; letter-spacing: .02em; }
.patient-summary small { display: block; color: var(--muted); }
.patient-facts { display: flex; align-items: flex-start; flex-wrap: wrap; flex: 1; gap: 15px 30px; }
.fact { min-width: 74px; }
.fact-label { color: var(--muted); font-size: 11px; line-height: 1.4; margin-bottom: 4px; }
.fact-value { font-size: 14px; font-weight: 550; line-height: 1.5; font-variant-numeric: tabular-nums; }
.patient-tags { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; max-width: 440px; }
.badge, .pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border: 1px solid transparent; border-radius: 5px; font-size: 11px; line-height: 1.65; font-weight: 500; vertical-align: middle; white-space: normal; }
.badge.teal, .pill.teal { color: #196b58; background: #eaf5ef; border-color: #d8ebe0; }
.badge.amber, .pill.amber { color: var(--amber); background: var(--amber-bg); border-color: #f1e2c4; }
.badge.red, .pill.red { color: var(--red); background: var(--red-bg); border-color: #f0d2d0; }
.badge.blue, .pill.blue { color: var(--blue); background: var(--blue-bg); border-color: #dbe7ef; }
.badge.gray, .pill, .badge:not(.teal):not(.amber):not(.red):not(.blue) { color: #6a7e80; background: #f2f5f5; border-color: #e7ecec; }
.mode-tabs { display: flex; gap: 4px; width: fit-content; max-width: 100%; margin: 22px 0; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.mode-tab { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 22px; border: 0; border-radius: 6px; background: transparent; color: #627a7e; font-size: 13px; font-weight: 500; transition: background .16s ease, color .16s ease; }
.mode-tab svg { width: 16px; height: 16px; }
.mode-tab:hover { background: #f2f6f5; }
.mode-tab.active { color: var(--primary-dark); background: #eaf4f0; font-weight: 650; }
.mode-tab[data-mode="emergency"].active { color: var(--red); background: var(--red-bg); }

.workbench { display: grid; grid-template-columns: 220px minmax(0, 1fr) 310px; align-items: start; gap: 24px; }
.step-sidebar { position: sticky; top: 24px; padding: 14px 0; min-width: 0; }
.step-item { position: relative; display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; padding: 16px 13px; min-height: 76px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #7c8d8f; }
.step-item::after { content: ""; position: absolute; width: 1px; height: 20px; left: 28px; bottom: -10px; background: #d8e3e0; z-index: 0; }
.step-item:last-of-type::after { display: none; }
.step-item + .step-item { margin-top: 7px; }
.step-item:hover { background: #ebf2f0; }
.step-item.active { color: var(--primary-dark); background: #e7f1ed; border-color: #d7e7df; }
.step-item.active::after { background: #bfd7cd; }
.step-number { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 29px; border: 1px solid #d4dedc; border-radius: 50%; background: var(--bg); color: #8c9c9c; font-size: 12px; font-weight: 600; line-height: 1; z-index: 1; }
.step-item.active .step-number { color: #fff; background: var(--primary); border-color: var(--primary); }
.step-item.complete .step-number { color: var(--primary); background: #e8f3ed; border-color: #cce1d6; }
.step-title { display: block; margin-top: 1px; font-size: 14px; font-weight: 600; line-height: 1.6; }
.step-caption { display: block; margin-top: 3px; color: #8b9c9d; font-size: 11px; line-height: 1.5; }
.step-item.active .step-caption { color: #64877d; }
.sidebar-foot { margin: 31px 13px 0; padding-top: 18px; border-top: 1px solid var(--line); color: #829392; font-size: 11px; line-height: 1.8; }
.sidebar-foot svg { width: 14px; height: 14px; margin-right: 5px; }
.sidebar-foot p + p { margin-top: 8px; }
.main-content { min-width: 0; }
.main-content :is(input, select, textarea, button, summary) { scroll-margin-top: 24px; scroll-margin-bottom: 110px; }
.content-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin: 7px 0 22px; }
.eyebrow { margin-bottom: 6px; color: var(--primary); font-size: 10px; font-weight: 650; letter-spacing: .16em; text-transform: uppercase; }
.page-title { font-size: 25px; line-height: 1.5; letter-spacing: .015em; font-weight: 650; }
.page-description { margin-top: 6px; max-width: 650px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.section-card { padding: 24px; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.section-title { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; font-size: 15px; font-weight: 650; line-height: 1.6; margin-bottom: 5px; }
.section-title > svg { width: 18px; height: 18px; color: var(--primary); }
.section-note { color: var(--muted); font-size: 12px; line-height: 1.75; margin: 3px 0 20px; }
.section-title + .form-grid, .section-title + .risk-grid, .section-title + .toolbar { margin-top: 19px; }
.section-card > p + .form-grid, .section-card > p + .risk-grid { margin-top: 18px; }
.section-card > .alert:last-child { margin-bottom: 0; }
.section-card hr { height: 1px; margin: 22px 0; border: 0; background: var(--line-light); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label, .field > .field-label { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; color: #3f595d; font-size: 12px; font-weight: 550; }
.field label .required { color: var(--primary); }
.field > small, .field .help-text { display: block; margin-top: 6px; color: #899999; font-size: 11px; line-height: 1.65; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea { width: 100%; min-width: 0; min-height: 41px; padding: 8px 11px; border: 1px solid #dce5e5; border-radius: 6px; background: #fff; color: var(--ink); font-size: 13px; line-height: 1.65; transition: border-color .15s ease, box-shadow .15s ease; }
input::placeholder, textarea::placeholder { color: #a2afaf; opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: #bdceca; }
input:focus, select:focus, textarea:focus { border-color: #67a394; box-shadow: 0 0 0 3px #1575680c; outline: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #73ac9f; outline-offset: 2px; }
input:disabled, select:disabled, textarea:disabled { background: #f3f6f5; color: #7d9292; cursor: not-allowed; }
input[type="date"], input[type="datetime-local"], input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; flex: 0 0 16px; margin: 2px 0 0; accent-color: var(--primary); cursor: pointer; }
input[type="file"] { max-width: 100%; color: var(--muted); font-size: 12px; }
input[type="file"]::file-selector-button { min-height: 38px; margin-right: 12px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px; background: #f6f9f8; color: var(--ink); cursor: pointer; }
textarea { min-height: 94px; resize: vertical; }
.input-unit { position: relative; display: flex; align-items: center; }
.input-unit input { padding-right: 50px !important; }
.input-unit > span, .input-unit > small { position: absolute; right: 12px; color: #91a1a1; font-size: 12px; pointer-events: none; }
.inline-fields { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; }
.inline-fields > * { flex: 1; min-width: 110px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 8px; min-height: 40px; padding: 10px 0; color: #526e70; font-size: 12px; line-height: 1.65; cursor: pointer; }
.checkbox-row label { cursor: pointer; }
.radio-group { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.choice { display: inline-flex; align-items: center; gap: 7px; min-height: 39px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 6px; color: #647d7f; font-size: 12px; cursor: pointer; }
.choice:has(input:checked), .choice.selected { color: var(--primary-dark); background: var(--primary-light); border-color: #b8d8ca; }
.choice:hover { border-color: #b6ceca; }
details { border-top: 1px solid var(--line-light); margin-top: 18px; padding-top: 14px; }
summary { color: #587c77; font-size: 12px; font-weight: 550; min-height: 35px; }
details[open] > summary { margin-bottom: 12px; }

.risk-grid { display: grid; gap: 0; }
.risk-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 65px; padding: 12px 0; border-bottom: 1px solid var(--line-light); }
.risk-item:last-child { border-bottom: 0; padding-bottom: 0; }
.risk-item:first-child { padding-top: 0; }
.risk-title { color: #496064; font-size: 13px; font-weight: 500; line-height: 1.7; }
.risk-title small { display: block; color: #8b9b9e; font-size: 11px; font-weight: 400; }
.tri-state { display: inline-flex; flex-shrink: 0; gap: 3px; padding: 3px; border: 1px solid #e1e8e7; background: #f9fbfa; border-radius: 7px; }
.tri-state button { min-width: 39px; min-height: 33px; padding: 5px 10px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: #879a9b; font-size: 11px; line-height: 1.5; }
.tri-state button:hover { background: #edf3f1; color: var(--primary-dark); }
.tri-state button.selected { color: #536e70; background: #fff; border-color: #dce5e3; box-shadow: 0 1px 3px #24473e05; }
.tri-state button.selected.yes { color: #a0443d; border-color: #f0c6bf; background: #fff0eb; }
.tri-state button.selected.no { color: #216f5c; border-color: #c7e0d3; background: #ecf7ef; }
.tri-state button.selected.unknown { color: #647a7c; border-color: #d8e2e2; background: #fff; }
.alert { padding: 14px 16px; margin: 16px 0; border: 1px solid #d8e7ec; border-radius: 8px; background: var(--blue-bg); color: #536f7f; font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.alert.info { background: #f1f7f8; border-color: #dce9eb; color: #58737b; }
.alert.warning { background: #fffaef; border-color: #efe0c0; color: #8b6a32; }
.alert.danger { background: #fff1ef; border-color: #ecc9c3; color: #a34f46; }
.alert.success { background: #edf6f0; border-color: #d2e7da; color: #3b7864; }
.alert-title { display: block; color: inherit; font-size: 13px; font-weight: 650; margin-bottom: 4px; }
.alert p + p { margin-top: 6px; }
.alert ul { margin: 7px 0 0; }
.alert:first-child { margin-top: 0; }
.alert .button { margin-top: 10px; }

.summary-panel { position: sticky; top: 24px; padding: 19px 20px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); min-width: 0; }
.summary-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 16px; margin-bottom: 2px; border-bottom: 1px solid var(--line-light); font-size: 13px; font-weight: 650; }
.summary-heading svg { width: 16px; height: 16px; margin-right: 5px; color: #748e87; }
.summary-heading small { font-size: 10px; color: #8ca09b; font-weight: 400; }
.summary-card { padding: 16px 0; border-bottom: 1px solid var(--line-light); }
.summary-card:last-child { border-bottom: none; }
.summary-label { display: block; color: #92a29f; font-size: 10px; font-weight: 500; letter-spacing: .07em; margin-bottom: 6px; }
.summary-value { color: #39585a; font-size: 13px; font-weight: 600; line-height: 1.8; overflow-wrap: anywhere; }
.summary-detail { color: #8b9b9a; font-size: 11px; line-height: 1.8; margin-top: 5px; overflow-wrap: anywhere; }
.summary-list { margin: 8px 0 0; padding: 0; list-style: none; color: #7f9290; font-size: 11px; }
.summary-list li { position: relative; padding-left: 11px; margin-bottom: 8px; line-height: 1.7; }
.summary-list li::before { content: ""; position: absolute; top: 7px; left: 0; width: 4px; height: 4px; background: #c3d2cc; border-radius: 50%; }
.summary-list button, .summary-card > button { width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; font: inherit; line-height: inherit; text-decoration: underline; text-decoration-color: #c4d4ce; text-underline-offset: 3px; }
.summary-list button:hover { color: var(--primary); }
.summary-panel .alert { padding: 10px 12px; margin-top: 12px; font-size: 11px; }
.summary-panel .alert-title { font-size: 11px; }
.mobile-summary { display: none; }

.bottom-bar { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 0 12px; margin-top: 8px; border-top: 1px solid var(--line); background: #f4f7f8f5; backdrop-filter: blur(12px); z-index: 5; }
.bottom-left, .bottom-right { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.bottom-left small, .bottom-bar .save-status { color: #8b9c99; font-size: 11px; }
.footer-note { margin: 22px 0 0; padding-top: 15px; color: #94a39f; font-size: 10px; line-height: 1.9; text-align: center; }

.six-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; margin: 18px 0; }
.result-card { position: relative; padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 0; }
.result-card > .card-number { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-bottom: 12px; border-radius: 6px; background: #eef5f2; color: #588b7c; font-size: 10px; font-weight: 650; }
.result-title { color: #819692; font-size: 11px; margin-bottom: 8px; }
.result-title strong { display: block; color: var(--ink); font-size: 16px; margin-top: 6px; }
.result-body { color: #5e7575; font-size: 12px; line-height: 1.9; overflow-wrap: anywhere; }
.result-body > strong { display: block; color: #365d55; font-size: 14px; margin-bottom: 6px; }
.result-body ul { margin-top: 8px; padding-left: 1.3em; }
.result-card .badge { margin-bottom: 7px; }
.result-card.urgent, .result-card.emergency { border-color: #e7bfb8; background: #fffafa; }
.result-card.urgent .card-number, .result-card.emergency .card-number { color: var(--red); background: #ffebe7; }

.lab-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--line); border-radius: 8px; scrollbar-width: thin; scrollbar-color: #c7d8d1 #f6f9f7; }
table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
th { color: #79918c; background: #f4f8f6; font-size: 11px; font-weight: 500; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line-light); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.lab-table { min-width: 800px; }
.lab-table th { white-space: nowrap; }
.lab-table td { padding: 10px 7px; }
.lab-table td:first-child, .lab-table th:first-child { padding-left: 12px; }
.lab-table input, .lab-table select { min-width: 72px; min-height: 36px !important; padding: 5px 7px !important; font-size: 11px !important; }
.lab-table input[type="date"] { min-width: 122px; }
.lab-table select { min-width: 86px; }
.lab-table input[type="checkbox"] { min-width: 16px; min-height: 16px !important; }
.lab-table .field { min-width: 75px; }
.lab-table .field > label { font-size: 10px; margin-bottom: 3px; }
.lab-table .inline-fields { min-width: 150px; gap: 5px; flex-wrap: nowrap; }
.lab-table .inline-fields > * { min-width: 65px; }
.verification { margin: 10px 0; padding: 13px 15px; background: #f8faf9; border: 1px solid var(--line-light); border-radius: 7px; }
.verification > strong { display: block; color: #587c6f; font-size: 11px; margin-bottom: 7px; }
.verify-fields { display: flex; gap: 5px 14px; flex-wrap: wrap; }
.check-mini { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; color: #778e89; font-size: 10px; cursor: pointer; }
.check-mini input { width: 14px; height: 14px; flex-basis: 14px; }
.lab-normalized { margin-top: 8px; padding: 8px 11px; background: #f0f7f3; border-radius: 5px; color: #57816e; font-size: 11px; line-height: 1.7; font-variant-numeric: tabular-nums; }
.lab-normalized.error { background: #fff6e7; color: #9c733b; }
.remove-row { width: 33px; height: 36px; border: 0; border-radius: 5px; background: transparent; color: #a3b0ad; }
.remove-row:hover { color: #b04d43; background: #fff0ec; }
.lab-table .remove-row { margin-top: 1px; }
.toolbar { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 8px; margin: 15px 0; }
.toolbar > input, .toolbar > select { flex: 1; max-width: 320px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #718a83; font-size: 11px; }
.chip.selected, .chip.active { color: #27705e; border-color: #bad5c7; background: #edf6f0; }
.chip:hover { border-color: #bdd4ca; }
.empty-state { padding: 36px 22px; border: 1px dashed #d6e3dc; border-radius: 9px; background: #fafcfb; text-align: center; color: #8a9f96; font-size: 12px; line-height: 1.9; }
.empty-state > svg { width: 31px; height: 31px; margin-bottom: 12px; color: #a8bfb2; }
.empty-state strong { display: block; color: #627e71; font-size: 14px; margin-bottom: 5px; }
.empty-state .button { margin-top: 15px; }

.medication-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.week-grid .field > label { justify-content: center; font-size: 11px; color: #7b9189; }
.week-grid input { padding-left: 3px !important; padding-right: 3px !important; text-align: center; min-height: 37px !important; font-size: 12px !important; }
.dose-arrow { display: flex; align-items: center; gap: 12px; padding: 16px 0; }
.dose-arrow > svg { width: 21px; height: 21px; color: #91afa1; }
.dose-box { flex: 1; min-width: 0; padding: 14px; border-radius: 7px; border: 1px solid #e0e9e4; background: #f8fbf9; color: #729082; font-size: 11px; }
.dose-box strong { display: block; color: #2c6251; font-size: 20px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.dose-box:last-child { border-color: #c7dfd0; background: #edf6ef; }
.dose-change { font-size: 11px; color: #659379; line-height: 1.8; }
.timeline { position: relative; margin: 18px 0 0; padding-left: 18px; }
.timeline::before { position: absolute; top: 9px; bottom: 9px; left: 3px; content: ""; width: 1px; background: #d7e6dd; }
.timeline-entry { position: relative; padding: 0 0 20px 8px; }
.timeline-entry:last-child { padding-bottom: 0; }
.timeline-entry::before { position: absolute; top: 7px; left: -18px; content: ""; width: 8px; height: 8px; border: 2px solid #f4f8f5; border-radius: 50%; background: #8aaf98; }
.timeline-date { color: #63846e; font-size: 11px; font-weight: 600; margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.timeline-content { padding: 13px 16px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #708a79; font-size: 12px; line-height: 1.8; }
.timeline-content p + p { margin-top: 5px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 28px; background: #17383159; backdrop-filter: blur(3px); }
.modal { display: flex; flex-direction: column; width: 660px; max-width: 100%; max-height: calc(100dvh - 56px); background: #fff; border: 1px solid #d8e4dc; border-radius: 15px; box-shadow: 0 28px 90px #14322936; overflow: hidden; }
.modal.wide { width: 1080px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; flex-shrink: 0; padding: 22px 27px; border-bottom: 1px solid var(--line); }
.modal-header h2, .modal-header h3 { font-size: 19px; font-weight: 600; }
.modal-header p { font-size: 11px; color: #8ba092; margin-top: 3px; }
.modal-header .icon-button { border: 0; background: #f4f7f5; color: #849a8c; }
.modal-body { padding: 25px 27px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; scrollbar-width: thin; scrollbar-color: #c4d8c9 #fff; }
.modal-body > p { color: #6d8775; font-size: 12px; }
.modal-body > p + p { margin-top: 8px; }
.modal-footer { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 9px; flex-shrink: 0; padding: 17px 27px; background: #fafcfb; border-top: 1px solid var(--line); }
.tabs { display: flex; flex-wrap: wrap; gap: 5px; padding-bottom: 13px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tab { min-height: 39px; padding: 7px 13px; border: 0; background: transparent; color: #7c9282; border-radius: 5px; font-size: 12px; }
.tab:hover { background: #f2f7f3; }
.tab.active { color: #2e7752; background: #eaf5ec; font-weight: 600; }
.disease-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.disease-card { padding: 19px; border: 1px solid var(--line); border-radius: 9px; background: #fff; min-width: 0; }
.disease-card h3 { margin-bottom: 7px; color: #466b50; font-size: 14px; font-weight: 600; }
.disease-card p { margin-top: 8px; color: #859788; font-size: 11px; line-height: 1.85; }
.disease-card .coverage-level { display: inline-block; font-size: 10px; color: #5b8e69; background: #edf6ee; border-radius: 4px; padding: 3px 7px; }
.source-list { display: grid; gap: 12px; }
.source-item { padding: 17px 19px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; line-height: 1.85; overflow-wrap: anywhere; }
.source-item a { color: #437b51; font-weight: 550; }
.source-item p { margin-top: 5px; color: #809483; font-size: 11px; }
.rule-item { padding: 16px 0; border-top: 1px solid var(--line); }
.rule-item:first-child { border-top: 0; }
.rule-item > summary { color: #456e50; }
.rule-item > p, .rule-item dl { font-size: 11px; color: #7d9381; line-height: 1.85; }
.rule-item dt { color: #56755d; font-weight: 600; margin-top: 10px; }
.rule-item dd { margin: 3px 0 0; }
.output-preview { margin: 17px 0; padding: 22px; border: 1px solid #dde8df; border-radius: 9px; background: #fafcfb; color: #4f6c55; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.95 var(--font); }
.toast { position: fixed; bottom: 28px; left: 50%; z-index: 200; max-width: min(580px, calc(100% - 32px)); padding: 12px 20px; border: 1px solid #315f44; border-radius: 8px; box-shadow: 0 7px 25px #18362424; color: #fff; background: #28543e; font-size: 13px; line-height: 1.7; opacity: 0; transform: translate(-50%, 12px); transition: opacity .2s ease, transform .2s ease; pointer-events: none; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: #9e5143; background: #a15c4d; }
.print-output { display: none; }

/* Shared components follow the application markup, including compact metadata. */
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; border: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; clip-path: inset(50%) !important; white-space: nowrap !important; }
.text-link { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 2px 0; border: 0; background: transparent; color: var(--primary); text-align: left; font-size: 11px; line-height: 1.65; text-decoration: underline; text-decoration-color: #bfd7cc; text-underline-offset: 3px; }
.text-link:hover { color: var(--primary-dark); text-decoration-color: var(--primary); }
.patient-summary { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 12px; }
.patient-summary > .eyebrow { grid-column: 1 / -1; margin-bottom: 4px; font-size: 9px; letter-spacing: .12em; }
.patient-summary > strong { font-size: 17px; }
.patient-summary > span { align-self: center; color: #80958e; font-size: 11px; overflow-wrap: anywhere; }
.fact-label, .fact-value { display: block; }
.mode-tab { position: relative; flex-direction: column; gap: 1px; min-width: 136px; padding-top: 9px; padding-bottom: 9px; }
.mode-tab > strong { font-size: 13px; font-weight: 600; }
.mode-tab > span { font-size: 10px; color: #8fa19c; font-weight: 400; }
.mode-tab.active > span { color: #71978b; }
.mode-tab > i { position: absolute; right: 12px; top: 12px; width: 4px; height: 4px; border-radius: 50%; background: #65a08c; }
.step-sidebar > nav { width: 100%; min-width: 0; }
.step-sidebar > .eyebrow { padding-left: 14px; margin-bottom: 11px; color: #93a29e; font-size: 9px; letter-spacing: .07em; }
.sidebar-foot > svg { display: block; margin-bottom: 7px; color: #88a596; }
.sidebar-foot > strong { display: block; margin-bottom: 6px; color: #6b8a7c; font-size: 11px; }
.sidebar-foot > .text-link { margin-top: 10px; color: #7b998b; font-size: 10px; }
.section-count { margin-left: auto; color: #9aa9a4; font-size: 10px; font-weight: 400; }
.condition-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.condition-chips .chip { min-height: 35px; font-size: 11px; cursor: pointer; }
.condition-chips .chip input { width: 13px; height: 13px; flex-basis: 13px; margin-top: 0; }
.field > label > small { font-size: 10px; color: #8b9e96; font-weight: 400; }
.full { grid-column: 1 / -1; }
.checkbox-row > span > small { display: block; color: #91a299; font-size: 10px; line-height: 1.8; margin-top: 3px; }
.section-card > .form-grid + .field, .section-card > .field + .form-grid, .section-card > .form-grid + .form-grid { margin-top: 19px; }
.section-card > .field + .field { margin-top: 17px; }
.section-card > .field > .week-grid { margin-top: 10px; }
.section-card > .form-grid + .checkbox-row { margin-top: 11px; }
.risk-item > div > small { display: block; color: #8e9e99; font-size: 10px; line-height: 1.75; margin-top: 3px; }
.symptom-groups { margin: 17px 0 21px; border: 1px solid #e4ece6; border-radius: 8px; overflow: hidden; }
.symptom-groups details { margin: 0; padding: 0; border-top: 1px solid #e7eee9; }
.symptom-groups details:first-child { border-top: 0; }
.symptom-groups summary { margin: 0; padding: 12px 14px; background: #fbfcfb; color: #6d8877; font-size: 11px; }
.symptom-groups summary > span { float: right; margin-left: 10px; color: #a0afa5; font-size: 9px; font-weight: 400; }
.symptom-groups details[open] > summary { margin-bottom: 0; color: #457c56; background: #f5f9f5; }
.symptom-groups .condition-chips { padding: 12px 14px 15px; }
.import-panel { margin-top: 17px; margin-bottom: 19px; padding: 0; border: 1px solid #dce8e1; border-radius: 8px; background: #fbfdfb; }
.import-panel > summary { margin: 0; padding: 13px 15px; color: #5c876b; font-size: 12px; list-style-position: inside; }
.import-panel > summary > svg { margin-right: 4px; }
.import-panel > summary > span { display: inline-block; margin-left: 10px; color: #97ab9c; font-size: 10px; font-weight: 400; }
.import-panel[open] { padding: 0 15px 15px; }
.import-panel[open] > summary { margin: 0 -15px 12px; background: #f4faf5; border-radius: 7px 7px 0 0; border-bottom: 1px solid #e1ece4; }
.import-panel > label { display: block; color: #72927c; font-size: 11px; margin: 8px 0 6px; }
.import-panel .toolbar { margin: 10px 0; }
.import-panel .section-note { margin: 8px 0 0; font-size: 10px; }
#import-message { color: #9b793c; font-size: 11px; white-space: pre-wrap; margin-top: 10px; }
.lab-row + .lab-row > tr:first-child > td { padding-top: 18px; border-top: 2px solid #e4ece7; }
.lab-meta-row > td { background: #fcfdfc; padding-top: 0 !important; padding-bottom: 14px !important; }
.lab-meta-row > td > .inline-fields { min-width: 0; align-items: flex-start; gap: 12px; }
.lab-meta-row .inline-fields > .field { min-width: 120px; flex: 1; }
.lab-meta-row .inline-fields > .field:nth-child(2) { flex: 1.6; }
.lab-meta-row .inline-fields > .field > label { font-size: 10px; color: #8da197; }
.lab-normalized { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.lab-normalized > .badge { margin: 0; flex-shrink: 0; }
.verification { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 14px; padding: 8px 11px; margin-bottom: 0; background: #fff; }
.verification > span { font-size: 10px; color: #80988a; }
.verify-fields { flex: 1; }
.lab-table .check-mini input { width: 14px; min-width: 14px; height: 14px; min-height: 14px !important; flex-basis: 14px; }
.summary-heading { display: block; }
.summary-heading > .eyebrow { display: block; color: #92a79b; font-size: 9px; margin-bottom: 4px; letter-spacing: .13em; }
.summary-heading > h2 { color: #426c51; font-size: 15px; line-height: 1.65; font-weight: 600; }
.summary-heading > .badge { margin-top: 7px; font-size: 9px; font-weight: 400; }
.summary-label > svg { margin: -1px 3px 0 0; width: 13px; height: 13px; }
.summary-label > .pill { min-width: 18px; justify-content: center; margin-left: 5px; padding: 0 5px; font-size: 9px; }
.summary-list li { padding-left: 10px; margin-top: 9px; margin-bottom: 10px; }
.summary-list li > small { display: block; margin-top: 3px; color: #9aaba0; font-size: 9px; line-height: 1.7; }
.summary-list .text-link { min-height: 0; padding: 0; text-decoration: none; color: #668975; }
.summary-note { display: flex; align-items: flex-start; gap: 8px; padding-bottom: 5px; color: #9aaba0; font-size: 10px; line-height: 1.8; }
.summary-note > svg { width: 14px; height: 14px; margin-top: 3px; color: #91b09c; }
.result-label { display: flex; align-items: center; gap: 8px; color: #91a498; font-size: 10px; line-height: 1.5; margin-bottom: 13px; }
.result-label > .card-number { display: inline-grid; place-items: center; width: 23px; height: 23px; border-radius: 6px; background: #edf5ef; color: #72a382; font-size: 9px; font-weight: 600; }
.result-title { color: #365e43; font-size: 15px; font-weight: 600; line-height: 1.75; margin-bottom: 8px; }
.result-card > ul { color: #84988a; font-size: 11px; line-height: 1.8; padding-left: 1.4em; }
.result-card.urgent .result-label > .card-number { color: var(--red); background: #ffece6; }
.result-card.urgent .result-title { color: #ab5b4c; }
.missing-list { margin-top: 13px; }
.missing-item { display: flex; align-items: center; justify-content: space-between; gap: 17px; padding: 15px 0; border-bottom: 1px solid var(--line-light); }
.missing-item:last-child { border-bottom: 0; padding-bottom: 3px; }
.missing-item:first-child { padding-top: 4px; }
.missing-item > div { min-width: 0; }
.missing-item strong { color: #6b806d; font-size: 12px; font-weight: 550; }
.missing-item p { margin-top: 3px; color: #8b9d8d; font-size: 11px; line-height: 1.8; }
.missing-item small { display: block; margin-top: 3px; color: #a0ad9e; font-size: 10px; line-height: 1.8; }
.missing-item .button { flex-shrink: 0; }
.followup-window { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 19px 0 12px; }
.followup-window > div { padding: 15px 10px; border: 1px solid #e5ece3; border-radius: 7px; background: #fafcf9; text-align: center; }
.followup-window small { display: block; color: #94a38e; font-size: 10px; margin-bottom: 5px; }
.followup-window strong { display: block; color: #718568; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.followup-window > .recommended { border-color: #cddfc4; background: #f0f7ec; }
.followup-window > .recommended small { color: #83a070; }
.followup-window > .recommended strong { color: #60834e; }
.form-grid .field > ul { padding-left: 1.4em; color: #7e9176; font-size: 11px; line-height: 1.9; }
.dose-change { display: flex; align-items: center; gap: 12px; padding: 13px 0; }
.dose-change .dose-arrow { display: block; flex-shrink: 0; padding: 0; color: #a2b6a3; font-size: 21px; }
.dose-box.suggested { border-color: #c8ddcb; background: #edf5ed; }
.section-card > .dose-change ~ p { color: #7b927a; font-size: 11px; line-height: 1.9; margin-top: 4px; }
.record-list { display: grid; gap: 11px; }
.record-item { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.record-item > div { min-width: 0; }
.record-item strong { color: #526e4e; font-size: 14px; font-weight: 600; }
.record-item p { color: #83957a; font-size: 11px; margin-top: 5px; }
.record-item small { color: #a2af98; font-size: 10px; }
.record-item .toolbar { margin: 0; }
.export-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 4px 0 20px; }
.export-grid .button { min-height: 51px; }
.example-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.example-list .button { min-height: 56px; justify-content: flex-start; padding: 13px 15px; text-align: left; font-size: 12px; }
.report-preview { display: block; width: 100%; height: min(65vh, 670px); min-height: 300px; margin-top: 15px; border: 1px solid var(--line); border-radius: 7px; background: #f7faf7; }
.report-image { display: block; width: auto; max-width: 100%; height: auto; margin: 17px auto 0; border: 1px solid var(--line); border-radius: 7px; }
.save-dot { width: 5px; height: 5px; flex: 0 0 5px; margin-left: 2px; background: #8fb58d; border-radius: 50%; box-shadow: 0 0 0 3px #edf4e9; }
[data-save-status] { color: #95a58e; font-size: 10px; }
.footer-note > span { display: inline-block; margin-left: 13px; color: #a7b39d; }
.modal-body > h3 { font-size: 13px; color: #76926b; margin: 23px 0 12px; }
.disease-card > .coverage-level { display: block; width: fit-content; padding: 0; margin-bottom: 9px; background: none; }
.disease-card > small { display: block; font-size: 10px; line-height: 1.8; color: #9dad93; margin-top: 8px; }
.disease-card > ul { font-size: 11px; line-height: 1.85; color: #899e7b; margin-bottom: 0; }
.source-item > small { color: #9daf90; font-size: 10px; line-height: 1.8; }

@media (min-width: 1601px) {
  .app-header { padding-left: calc((100vw - 1544px) / 2); padding-right: calc((100vw - 1544px) / 2); }
}
@media (max-width: 1300px) {
  .workbench { grid-template-columns: 190px minmax(0, 1fr) 280px; gap: 20px; }
  .patient-facts { gap: 14px 24px; }
  .header-actions .button { padding-left: 11px; padding-right: 11px; }
}
@media (max-width: 1150px) {
  .app-header { padding: 18px 22px; }
  .workspace { padding: 24px 22px 20px; }
  .workbench { grid-template-columns: 180px minmax(0, 1fr) 260px; gap: 16px; }
  .section-card { padding: 20px; }
  .summary-panel { padding: 16px; }
  .step-item { padding-left: 9px; padding-right: 8px; gap: 9px; }
  .step-item::after { left: 24px; }
  .patient-strip { gap: 16px; }
  .patient-tags { max-width: 300px; }
  .risk-item { align-items: flex-start; flex-direction: column; gap: 9px; }
  .tri-state { align-self: flex-end; }
  .six-cards { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
  .workbench { grid-template-columns: 165px minmax(0, 1fr); gap: 20px; }
  .step-caption { display: none; }
  .step-item { min-height: 61px; align-items: center; gap: 10px; }
  .step-item::after { height: 14px; bottom: -7px; }
  .step-item + .step-item { margin-top: 5px; }
  .step-title { font-size: 12px; }
  .summary-panel { grid-column: 2; position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
  .summary-heading { grid-column: 1 / -1; }
  .summary-panel > .alert { grid-column: 1 / -1; }
  .summary-card:nth-last-child(2) { border-bottom: 0; }
  .patient-strip { align-items: flex-start; }
  .patient-summary { min-width: 160px; }
  .patient-facts { gap: 12px 23px; }
  .patient-tags { width: 100%; max-width: none; }
  .header-actions { gap: 1px; }
  .header-actions .button { font-size: 12px; }
  .brand-title { font-size: 17px; }
  .brand-caption { font-size: 9px; letter-spacing: .08em; }
  .risk-item { flex-direction: row; align-items: center; gap: 15px; }
  .tri-state { align-self: center; }
  .six-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  html { scroll-padding-bottom: 175px; }
  .main-content :is(input, select, textarea, button, summary) { scroll-margin-bottom: 175px; }
  .app-header { flex-wrap: wrap; gap: 13px; padding: 17px 18px 12px; }
  .brand { gap: 10px; }
  .brand-mark { width: 39px; height: 39px; border-radius: 11px; }
  .brand-mark svg { width: 26px; height: 26px; }
  .brand-title { font-size: 17px; }
  .brand-caption { font-size: 8px; }
  .header-actions { width: 100%; justify-content: flex-start; gap: 2px; padding-top: 9px; border-top: 1px solid var(--line-light); }
  .header-actions .button { min-height: 40px; padding: 6px 9px; font-size: 11px; }
  .header-actions > .badge { margin-left: auto; }
  .workspace { padding: 18px 14px 18px; }
  .patient-strip { padding: 16px; gap: 14px; }
  .patient-summary { width: 100%; }
  .patient-facts { gap: 12px 22px; }
  .fact { min-width: 65px; }
  .fact-value { font-size: 13px; }
  .patient-tags { gap: 5px; }
  .badge { font-size: 10px; }
  .mode-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; margin: 17px 0 15px; padding: 4px; gap: 3px; }
  .mode-tab { min-width: 0; min-height: 57px; padding: 7px 3px; gap: 2px; font-size: 11px; }
  .mode-tab > strong { font-size: 12px; }
  .mode-tab > span { font-size: 8px; line-height: 1.5; }
  .mode-tab > i { right: 6px; top: 7px; width: 3px; height: 3px; }
  .mode-tab svg { width: 13px; height: 13px; }
  .workbench { display: flex; flex-direction: column; gap: 0; }
  .step-sidebar { position: static; display: block; width: 100%; padding: 2px 0 18px; overflow: visible; }
  .step-sidebar > .eyebrow { padding-left: 3px; margin: 1px 0 8px; font-size: 8px; }
  .step-sidebar > nav { display: flex; align-items: stretch; gap: 6px; width: 100%; max-width: 100%; overflow-x: auto; scrollbar-width: thin; overscroll-behavior-x: contain; }
  .step-item { flex: 1 0 86px; align-items: center; justify-content: center; flex-direction: column; gap: 6px; min-height: 74px; width: auto; padding: 10px 7px; border-radius: 8px; text-align: center; }
  .step-item::after { display: none; }
  .step-item + .step-item { margin: 0; }
  .step-number { width: 25px; height: 25px; flex-basis: 25px; font-size: 10px; }
  .step-title { margin: 0; font-size: 11px; white-space: nowrap; }
  .sidebar-foot { display: none; }
  .main-content { width: 100%; }
  .content-heading { margin: 6px 2px 18px; }
  .eyebrow { font-size: 9px; margin-bottom: 4px; }
  .page-title { font-size: 22px; }
  .page-description { font-size: 11px; }
  .section-card { padding: 19px 17px; margin-bottom: 14px; border-radius: 10px; }
  .section-title { font-size: 14px; }
  .section-note { font-size: 11px; margin-bottom: 17px; }
  .form-grid, .medication-grid { grid-template-columns: 1fr; gap: 16px; }
  .field.full { grid-column: auto; }
  .full { grid-column: auto; }
  .field > label { font-size: 12px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea { font-size: 16px; min-height: 43px; }
  .lab-table input, .lab-table select { font-size: 16px !important; }
  .inline-fields { gap: 9px; }
  .risk-title { font-size: 12px; }
  .risk-item { gap: 13px; }
  .tri-state button { min-height: 40px; padding: 5px 7px; min-width: 36px; font-size: 10px; }
  .condition-chips .chip, .button.small, .check-mini { min-height: 40px; }
  .summary-panel { width: 100%; margin-top: 19px; display: grid; grid-template-columns: 1fr 1fr; padding: 17px; gap: 0 18px; }
  .summary-card { padding: 14px 0; }
  .summary-value { font-size: 12px; }
  .summary-detail { font-size: 10px; }
  .summary-list { font-size: 10px; }
  .bottom-bar { flex-wrap: wrap; padding: 9px 0 8px; gap: 6px; }
  .bottom-left, .bottom-right { gap: 6px; }
  .bottom-left { width: 100%; flex-wrap: nowrap; }
  .bottom-left > .button { margin-left: auto; }
  .bottom-right { width: 100%; flex-wrap: nowrap; }
  .bottom-right > .button { min-width: 0; flex: 1; }
  .bottom-right > .button.primary { flex: 1.5; }
  .bottom-left .button, .bottom-right .button { min-height: 41px; padding: 8px 11px; font-size: 12px; }
  .bottom-left small { display: none; }
  .six-cards { gap: 12px; }
  .result-card { padding: 18px; }
  .result-title { font-size: 14px; }
  .result-body { font-size: 11px; }
  .result-body > strong { font-size: 13px; }
  .week-grid { gap: 4px; }
  .week-grid input { font-size: 14px !important; }
  .week-grid .field > label { font-size: 10px; }
  .modal-backdrop { padding: 12px; }
  .modal { max-height: calc(100dvh - 24px); border-radius: 12px; }
  .modal-header { padding: 18px; }
  .modal-header h2, .modal-header h3 { font-size: 17px; }
  .modal-body { padding: 19px 18px; }
  .modal-footer { padding: 14px 18px; }
  .followup-window { gap: 6px; }
  .followup-window > div { padding: 12px 6px; }
  .followup-window strong { font-size: 12px; }
  .dose-change { gap: 7px; }
  .dose-box { padding: 10px; }
  .dose-box strong { font-size: 16px; }
  .missing-item { align-items: flex-start; gap: 10px; }
  .missing-item .button { font-size: 10px; padding: 6px 8px; }
  .record-item { padding: 14px; }
  .record-item .toolbar { width: 100%; }
  .record-item .toolbar .button { flex: 1; }
  .example-list { gap: 9px; }
  .example-list .button { font-size: 11px; padding: 11px; }
  .report-preview { height: 55dvh; min-height: 270px; }
  .disease-grid { grid-template-columns: 1fr; }
  .disease-card { padding: 16px; }
  .tabs { gap: 4px; }
  .tab { padding: 7px 10px; font-size: 11px; }
  .output-preview { padding: 16px; font-size: 11px; }
  .footer-note { font-size: 9px; text-align: left; margin-top: 18px; }
}
@media (max-width: 440px) {
  .header-actions .button { padding-left: 6px; padding-right: 6px; }
  .header-actions .button svg { width: 14px; height: 14px; }
  .mode-tab { font-size: 10px; gap: 3px; }
  .mode-tab svg { display: none; }
  .risk-item { flex-direction: column; align-items: flex-start; gap: 8px; }
  .risk-item .tri-state { align-self: flex-end; }
  .summary-panel { grid-template-columns: 1fr; }
  .summary-card:nth-last-child(2) { border-bottom: 1px solid var(--line-light); }
  .six-cards { grid-template-columns: 1fr; }
  .followup-window { grid-template-columns: 1fr; }
  .followup-window > div { display: flex; align-items: center; justify-content: space-between; padding: 12px; }
  .followup-window small { margin: 0; }
  .example-list, .export-grid { grid-template-columns: 1fr; }
  .import-panel > summary > span { display: block; margin: 5px 0 0 17px; }
  .section-count { font-size: 9px; }
  .missing-item { flex-wrap: wrap; }
  .missing-item .button { margin-left: auto; }
  .dose-change { align-items: stretch; gap: 5px; }
  .dose-change .dose-arrow { align-self: center; font-size: 17px; }
  .dose-box strong { font-size: 14px; overflow-wrap: anywhere; }
  .bottom-left [data-save-status] { font-size: 9px; }
  .bottom-bar { justify-content: flex-end; }
  .bottom-left { flex: 1; }
  .bottom-left .button, .bottom-right .button { padding: 8px 9px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  @page { size: A4; margin: 18mm 17mm; }
  :root { --ink: #111; --muted: #555; --line: #bbb; }
  html, body { min-width: 0; background: #fff !important; color: #111; font-size: 10pt; }
  .app-header, .patient-strip, .mode-tabs, .step-sidebar, .summary-panel, .bottom-bar, .footer-note, .modal-backdrop, .toast, .toolbar, button, .button, .no-print { display: none !important; }
  .workspace { margin: 0; padding: 0; max-width: none; }
  .workbench { display: block; }
  .main-content { width: 100%; }
  .section-card, .result-card { box-shadow: none; border-color: #ccc; break-inside: avoid; padding: 12px; }
  .six-cards { gap: 10px; grid-template-columns: 1fr 1fr; }
  .content-heading { margin: 0 0 14px; }
  .page-title { font-size: 17pt; }
  .alert { border-color: #bbb; color: #222; background: #fff !important; }
  .badge { border-color: #aaa !important; color: #222 !important; background: #fff !important; }
  a { color: #111; text-decoration: none; }
  .lab-table-wrap { overflow: visible; }
  .lab-table { min-width: 0; }
  .output-preview { border: none; padding: 0; background: #fff; color: #111; font-size: 10pt; }
  body.printing > :not(.print-output) { display: none !important; }
  body.printing .print-output { display: block !important; color: #111; white-space: pre-wrap; font: 10.5pt/1.9 var(--font); overflow-wrap: anywhere; }
  .print-output h1 { font-size: 19pt; line-height: 1.4; margin-bottom: 13px; }
  .print-output h2 { font-size: 12pt; margin-top: 17px; }
  .print-output p { margin-bottom: 7px; }
  .print-output small { color: #555; }
}
