/* EHR styles (shared chrome lives in shared/kit.css, charts in shared/charts.css). */
#app { background: var(--page); }

/* ---------- the user button's picture (shared/records.css) ---------- */
.user-av { width: 28px; height: 28px; border-radius: 50%; background: var(--prog-soft); color: var(--prog-strong); display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600; flex: none; }

/* ---------- counts on the chart's tabs ---------- */
.tab-n { font-size: 11px; font-weight: 600; border-radius: 10px; padding: 0 7px; background: var(--line); color: var(--text-2); }
.tab-n.new { background: var(--warn-soft); color: var(--warn); }
.tab-n.alert { background: var(--danger-soft); color: var(--danger); }
.tab-n[hidden] { display: none; }
/* its own stacking context, so sticky banners stay under the header's patient search list */
#ehr-main { flex: 1; min-height: 0; overflow: auto; padding: 20px 24px 32px; outline: none; isolation: isolate; }

/* ---------- common ---------- */
.page { max-width: 1480px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 16px 8px; }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.card-foot { padding: 10px 16px 12px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.card-foot.muted { font-size: 12px; line-height: 1.5; }
.card-link { font-size: 13px; color: var(--accent); text-decoration: none; }
.card-link:hover { text-decoration: underline; }
.pad { padding: 12px 16px; }
.muted.pad, .muted.block, .block { display: block; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.push-right { margin-left: auto; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -.01em; }
.rec-link, .ref-link { color: var(--accent); text-decoration: none; }
.rec-link:hover, .ref-link:hover { text-decoration: underline; }
.rec-link { font-weight: 500; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:disabled:hover { background: var(--surface); }
.btn.primary:disabled:hover { background: #18181b; }
.icon-btn.on { background: var(--accent-soft); color: #041e49; }
.obj-ico { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; color: #fff; flex: none; }
.obj-ico .material-symbols-outlined { font-size: 18px; }
.obj-ico.lg { width: 40px; height: 40px; border-radius: 8px; }
.obj-ico.lg .material-symbols-outlined { font-size: 24px; }
.badge { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 10px; background: var(--line); color: var(--text-2); white-space: nowrap; vertical-align: middle; }
.badge.tone-good { background: var(--ok-soft); color: var(--ok); }
.badge.tone-bad { background: var(--danger-soft); color: var(--danger); }
.badge.tone-warn { background: var(--warn-soft); color: var(--warn); }
.badge.tone-info { background: var(--info-soft); color: var(--info); }
.badge.tone-muted { background: var(--hover); color: var(--faint); }
.check-note { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.check-note.bad { background: var(--danger-soft); color: var(--danger); }
.check-label { display: inline-flex; align-items: flex-start; gap: 8px; font-size: 14px; cursor: pointer; padding: 6px 0; }
.check-label input { margin-top: 3px; }
.toolbar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-row .inp { width: auto; }
.err-list { margin: 6px 0; padding-left: 18px; font-size: 13px; line-height: 1.55; max-height: 50vh; overflow: auto; }
.kbd-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.kbd-table td { padding: 5px 6px; border-bottom: 1px solid var(--line-soft); }
kbd { font: 12px Consolas, monospace; background: var(--hover); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; white-space: nowrap; }
ul.feat { padding-left: 18px; margin: 4px 0; line-height: 1.55; font-size: 13px; }
.load-error { max-width: 520px; padding: 16px; color: var(--danger); }
.tabs-line { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs-line .tab { padding: 10px 14px; color: var(--muted); text-decoration: none; font-size: 14px; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs-line .tab:hover { color: var(--text); background: var(--sunk); }
.tabs-line .tab.on { color: var(--prog); border-bottom-color: var(--prog); font-weight: 500; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; margin-bottom: 10px; }
.list-bar .chips { margin-bottom: 0; }
.chip-btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 4px 10px 4px 12px; font-size: 13px; cursor: pointer; color: var(--text-2); white-space: nowrap; }
.chip-btn:hover { background: var(--hover); }
.chip-btn.on { background: var(--prog-soft); border-color: var(--prog-soft); color: #0c2f66; font-weight: 500; }
.chip-n { font-size: 11px; background: var(--line-soft); color: var(--muted); border-radius: 10px; padding: 0 7px; font-weight: 500; }
.chip-btn.on .chip-n { background: var(--surface); color: #0c2f66; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.ph-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ph-kicker { font-size: 12px; color: var(--muted); }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 500; text-wrap: balance; }
.page-head .muted { font-size: 13px; margin-top: 2px; }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ph-actions .inp { width: auto; }
.chart-body .page-head h1, .chart-body > .page-head h1 { font-size: 18px; }

/* ---------- tables ---------- */
.list-page { display: flex; flex-direction: column; height: 100%; min-height: 460px; }
.list-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.list-bar .inp { width: auto; }
.lb-search { width: 260px !important; border-radius: 18px; padding: 6px 12px; }
.tbl-wrap { overflow-x: auto; }
.tbl-wrap.fixed { flex: 1; min-height: 0; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.ehr-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.ehr-table th { background: var(--panel); color: var(--text-2); font-weight: 500; text-align: left; padding: 0 10px; height: 36px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl-wrap.fixed .ehr-table th { position: sticky; top: 0; z-index: 1; }
.ehr-table td { padding: 0 10px; height: 38px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.ehr-table tbody tr:hover td { background: var(--hover); }
.ehr-table tr.clickable { cursor: pointer; }
.ehr-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ehr-table tr.dim td { color: var(--muted); }
.ehr-table tr.spacer td, .ehr-table tr.spacer:hover td { padding: 0; border: 0; height: auto; background: none; }
.ehr-table td .btn { padding: 3px 10px; font-size: 12px; }
.card > .tbl-wrap .ehr-table tr:last-child td { border-bottom: 0; }
.tbl-card { overflow: hidden; }
.th-btn { border: 0; background: none; font: inherit; color: inherit; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; padding: 0; }
.th-btn:disabled { cursor: default; }
.num .th-btn { flex-direction: row-reverse; }
.sort-ic { font-size: 15px; color: var(--accent); }
.crm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.crm-table th { text-align: left; font-weight: 500; color: var(--text-2); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.crm-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
.crm-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.lines-scroll { overflow-x: auto; }
.pt-cell { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.mini-alert .material-symbols-outlined, .mini-prot .material-symbols-outlined { font-size: 16px; vertical-align: -3px; }
.mini-alert { color: var(--danger); }
.mini-prot { color: #5f3dc4; }

/* ---------- forms & dialogs ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; padding: 4px 16px 16px; }
.card > .form-grid:first-child { padding-top: 16px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal .form-grid { padding: 4px 0 8px; }
.fg-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fg-cell.wide { grid-column: 1 / -1; }
.fg-cell.check { flex-direction: row; align-items: center; gap: 8px; }
.fg-cell.check input { width: 18px; height: 18px; margin: 0; }
.fg-hint { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.req { color: var(--danger); text-decoration: none; margin-right: 2px; }
.inp.num { text-align: right; font-variant-numeric: tabular-nums; }
.inp.invalid, .inp.invalid:focus { outline: 2px solid #e8a39c; outline-offset: -1px; border-color: transparent; background: var(--bg); }
.inp[readonly], .inp:disabled { background: var(--sunk); color: var(--text-2); }
textarea.inp { resize: vertical; line-height: 1.45; }
.dlg-form .dlg-err { color: var(--danger); font-size: 13px; min-height: 18px; }
.dlg-form > .fg-cell { margin-bottom: 12px; }
.dd { position: fixed; z-index: 1500; background: var(--surface); border-radius: 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, .2); padding: 4px 0; max-height: 320px; overflow: auto; max-width: min(520px, calc(100vw - 16px)); }
.dd-opt { padding: 6px 12px; cursor: pointer; }
.dd-opt:hover, .dd-opt.hi { background: var(--sunk); }
.dd-main { font-size: 13px; }
.dd-code { margin-right: 8px; color: var(--prog); font-weight: 600; }
.dd-sub { font-size: 11.5px; color: var(--muted); }
.dd-empty { padding: 8px 12px; font-size: 13px; color: var(--muted); }
.save-bar { position: sticky; top: -20px; z-index: 50; display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 16px; margin-bottom: 14px; background: #fff8e1; border: 1px solid #f9df9a; border-radius: 12px; box-shadow: 0 2px 6px rgba(60, 64, 67, .12); }
.save-bar .sb-text { flex: 1; font-size: 13px; color: var(--warn); font-weight: 500; }

/* ---------- home ---------- */
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.home-head h1 { margin: 0; font-size: 24px; font-weight: 500; }
.home-head .muted { font-size: 13px; margin-top: 2px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.home-col { min-width: 0; display: flex; flex-direction: column; }
.day-list { list-style: none; margin: 0; padding: 0 8px 8px; }
.day-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 8px; border-left: 3px solid transparent; }
.day-item:hover { background: var(--bg); }
.day-item.st-arrived { border-left-color: #e37400; background: #fffaf2; }
.day-item.st-completed, .day-item.st-no-show, .day-item.st-cancelled { opacity: .65; }
.day-time { font-variant-numeric: tabular-nums; font-weight: 600; width: 44px; flex: none; }
.day-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.day-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.day-acts .btn { padding: 4px 10px; font-size: 12px; }
.todo { list-style: none; margin: 0; padding: 0 8px 8px; }
.todo-btn { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 8px; text-decoration: none; color: var(--text); }
.todo-btn:hover { background: var(--sunk); }
.todo-btn > .material-symbols-outlined:first-child { color: var(--prog); background: var(--prog-soft); border-radius: 50%; padding: 6px; font-size: 18px; }
.todo-btn.warn > .material-symbols-outlined:first-child { color: var(--warn); background: var(--warn-soft); }
.todo-text { flex: 1; display: flex; flex-direction: column; gap: 1px; font-size: 14px; min-width: 0; }
.todo-go { color: var(--muted); }
.recent { list-style: none; margin: 0; padding: 0 8px 8px; }
.recent-link { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; text-decoration: none; color: var(--text); }
.recent-link:hover { background: var(--sunk); }
.recent-text { flex: 1; display: flex; flex-direction: column; min-width: 0; font-size: 14px; }
.chart-card .card-head { align-items: flex-start; flex-wrap: nowrap; }
.chart-body { padding: 4px 16px 14px; overflow-x: auto; }
.chart-host { min-height: 120px; }

/* ---------- patient chart ---------- */
.chart { max-width: 1480px; margin: 0 auto; }
.pt-banner { position: sticky; top: -20px; z-index: 40; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; margin: -4px 0 0; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--prog); border-radius: 12px 12px 0 0; }
.pt-banner.protected { border-top-color: #5f3dc4; }
.pt-banner.deceased { border-top-color: #5f6368; }
.pt-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--prog-soft); color: #0c2f66; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; flex: none; }
.pt-avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.pt-id { min-width: 0; }
.pt-name { margin: 0; font-size: 20px; font-weight: 500; line-height: 1.2; }
.pt-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-top: 2px; }
.pt-pnr { font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: .01em; }
.alert-signal { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 10px; background: #fff4e5; border: 1px solid #f6c56a; color: #7a3600; text-decoration: none; max-width: 420px; min-width: 0; }
.alert-signal:hover { background: #ffecd1; }
.alert-signal > .material-symbols-outlined { font-size: 26px; color: #d93025; font-variation-settings: 'FILL' 1; }
.as-text { display: flex; flex-direction: column; font-size: 12px; min-width: 0; }
.as-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.protected-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: #3d2296; background: #ede7fb; padding: 4px 10px; border-radius: 12px; }
.protected-badge .material-symbols-outlined { font-size: 16px; }
.pt-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.chart-tabs { display: flex; gap: 2px; padding: 0 8px; background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
.chart-tabs::-webkit-scrollbar { display: none; }
.chart-tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; color: var(--text-2); text-decoration: none; font-size: 14px; border-bottom: 3px solid transparent; white-space: nowrap; }
.chart-tab .material-symbols-outlined { font-size: 18px; }
.chart-tab:hover { background: var(--bg); }
.chart-tab.on { color: var(--prog); border-bottom-color: var(--prog); font-weight: 500; }
.chart-body { min-width: 0; }
/* overview */
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.ov-grid .card { margin-bottom: 0; }
.ov-wide { grid-column: 1 / -1; }
.ov-alerts { border-color: #f6c56a; background: var(--bg); }
.ov-list { list-style: none; margin: 0; padding: 0 16px 12px; }
.ov-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.ov-list li:last-child { border-bottom: 0; }
.ov-list li.muted { display: block; font-size: 13px; }
.ov-main { min-width: 0; }
.ov-main .muted { font-size: 12px; margin-top: 1px; }
.ov-right { font-size: 13px; white-space: nowrap; }
.ov-new { margin: 0 16px 6px; padding: 6px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 500; }
.ov-sub { padding: 0 16px 4px; }
.ov-news { padding: 0 16px 8px; }
.vital-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; padding: 0 16px 14px; }
.vital { background: var(--bg); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.vital-l { font-size: 11.5px; color: var(--muted); }
.vital-v { font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; }
.vital-u { font-size: 12px; color: var(--muted); font-weight: 400; }
.vital-t { font-size: 11px; color: var(--muted); }
/* results */
.res-v { font-variant-numeric: tabular-nums; }
.res-v.abn { color: var(--danger); font-weight: 600; }
.res-v.fresh { box-shadow: inset 0 -2px 0 #f6c56a; }
.flag { display: inline-block; margin-left: 2px; font-weight: 700; }
.flag-h { color: var(--danger); }
.flag-l { color: var(--info); }
.flag-a { color: var(--danger); }
.cumulative td, .cumulative th { height: 34px; }
.cumulative .cum-name { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 180px; }
.cumulative th.cum-name { background: var(--bg); }
.cumulative .cum-ref { min-width: 90px; }
.cumulative th .muted { font-size: 11px; }
.trend .chart-host { margin-bottom: 12px; }
/* NEWS2 */
.news { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 10px; white-space: nowrap; }
.news-low { background: var(--ok-soft); color: var(--ok); }
.news-medium { background: #ffe3c2; color: #8a3b00; }
.news-high { background: #d93025; color: #fff; }
.vit-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px 12px; padding: 4px 16px 14px; }
.vit-form .inp { padding: 6px 8px; }
.vit-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.vit-news { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.news-parts { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.news-part { font-size: 11px; background: var(--hover); border-radius: 8px; padding: 0 6px; }
.vit-charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.vit-charts .card { margin-bottom: 0; }
.vit-charts + .card { margin-top: 16px; }
.vit-card .chart-host { padding: 0 12px 12px; }
/* journal */
.journal-bar .inp { width: auto; }
.journal-q { width: 220px !important; }
.journal { display: flex; flex-direction: column; gap: 12px; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.note.unsigned { border-color: #f6c56a; }
.note.nullified { opacity: .7; }
.note.nullified .note-body { text-decoration: line-through; color: var(--muted); }
.note { scroll-margin-top: 96px; }
.note.selected { border-color: var(--prog); box-shadow: 0 0 0 1px var(--prog); }
.note.flash { animation: note-flash 1.6s ease-out; }
@keyframes note-flash { 0% { box-shadow: 0 0 0 3px #8ab4f8; } 100% { box-shadow: 0 0 0 0 transparent; } }
.note-head { display: flex; align-items: flex-start; gap: 8px 16px; flex-wrap: wrap; padding: 10px 14px 8px; background: var(--bg); border-bottom: 1px solid var(--line-soft); }
.note.unsigned .note-head { background: #fffaf0; }
.note-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.note-when { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.note-title h3 { margin: 0; font-size: 15px; font-weight: 600; }
.note-meta { font-size: 12.5px; color: var(--text-2); flex: 1; min-width: 200px; padding-top: 1px; }
.note-acts { display: flex; align-items: center; gap: 6px; }
.note-acts .btn { padding: 3px 10px; font-size: 12px; }
.note-body { padding: 10px 14px 4px; display: flex; flex-direction: column; gap: 8px; }
.note-sec { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; }
.note-kw { font-size: 12.5px; font-weight: 600; color: var(--text-2); padding-top: 1px; }
.note-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-text mark { background: #fde293; }
.note-foot { font-size: 12px; color: var(--muted); padding: 6px 14px 10px; }
.note-src { font-style: italic; }
/* note editor */
.note-editor { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.ne-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 14px 16px 4px; }
.ne-head h2 { margin: 0; font-size: 18px; font-weight: 500; }
.ne-head .muted { font-size: 12.5px; }
.ne-sections { display: flex; flex-direction: column; gap: 10px; padding: 0 16px; }
.ne-sec { border: 1px solid var(--line-soft); border-radius: 10px; padding: 6px 8px 8px; background: var(--bg); }
.ne-sec:focus-within { border-color: #8ab4f8; background: var(--surface); }
.ne-sec-head { display: flex; align-items: center; gap: 6px; }
.ne-kw { flex: 1; border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 4px 4px; min-width: 0; }
.ne-kw:focus { outline: 2px solid var(--accent); border-radius: 4px; background: var(--surface); }
.ne-sec-tools .icon-btn { width: 28px; height: 28px; }
.ne-sec-tools .material-symbols-outlined { font-size: 18px; }
.ne-text { min-height: 44px; font-size: 14px; }
.ne-add { padding: 10px 16px; }
.ne-add .inp { width: auto; }
.ne-buttons { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 16px 16px; border-top: 1px solid var(--line-soft); margin-top: 6px; }
/* alerts */
.alert-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.alert-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid #d93025; border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.alert-card.inactive { border-left-color: var(--line-strong); opacity: .75; }
.ac-head { display: flex; align-items: flex-start; gap: 10px; }
.ac-title { flex: 1; min-width: 0; }
.ac-title h3 { margin: 0; font-size: 15px; font-weight: 600; }
.ac-title .muted { font-size: 12px; }
.ac-text { margin: 0; font-size: 14px; line-height: 1.45; }
.ac-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.ac-foot .btn { padding: 3px 10px; font-size: 12px; }

/* ---------- schedule ---------- */
.sched-page { display: flex; flex-direction: column; height: 100%; min-height: 520px; }
.sched-sum { margin: -6px 0 10px; font-size: 13px; }
.sched-scroll { flex: 1; min-height: 0; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.sched { display: flex; min-width: max-content; }
.sched-col { flex: 1 0 190px; border-left: 1px solid var(--line-soft); min-width: 190px; }
.sched-col.axis-col { flex: 0 0 56px; min-width: 56px; border-left: 0; }
.sched-colhead { position: sticky; top: 0; z-index: 3; height: 48px; padding: 6px 10px; background: var(--bg); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sched-colhead .muted { font-size: 11px; }
.sched-axis, .sched-lane { position: relative; }
.sched-lane { cursor: copy; }
.sched-hour { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sched-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-soft); pointer-events: none; }
.sched-line.half { border-top-style: dashed; border-top-color: var(--line-soft); }
.sched-now { position: absolute; left: 0; right: 0; border-top: 2px solid #d93025; z-index: 2; pointer-events: none; }
.appt { position: absolute; left: 4px; right: 4px; display: block; padding: 2px 8px; border: 0; border-left: 4px solid #1e6fd9; border-radius: 6px; background: #e8f0fe; color: #0b2a5c; font: inherit; font-size: 12px; line-height: 16px; text-align: left; cursor: pointer; overflow: hidden; z-index: 1; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.appt:hover { filter: brightness(.97); z-index: 2; }
.appt.sel { z-index: 2; box-shadow: 0 0 0 2px var(--prog-strong), 0 2px 6px rgba(0, 0, 0, .15); }
.appt.ty-phone, .appt.ty-video { border-left-color: #0f7a5a; background: #e6f4ee; color: #093d2c; }
.appt.ty-nurse-visit, .appt.ty-vaccination, .appt.ty-health-check { border-left-color: #8430ce; background: #f3e8fd; color: #3d0f66; }
.appt.st-arrived { background: #fff1d6; border-left-color: #e37400; color: #5b2e00; }
.appt.st-completed { background: var(--line-soft); border-left-color: var(--faint); color: var(--text-2); }
.appt.st-no-show, .appt.st-cancelled { background: #fbeaea; border-left-color: #d93025; color: #7a1812; }
.appt.st-no-show .appt-l1, .appt.st-cancelled .appt-l1 { text-decoration: line-through; }
.appt-l1, .appt-sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-l1 { font-weight: 500; }
.appt-time { font-variant-numeric: tabular-nums; }
.appt-sub { font-size: 11px; opacity: .85; }

/* ---------- import / export / setup ---------- */
.imp-pick { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 1.5fr); gap: 16px; padding: 16px; align-items: stretch; }
.imp-drop { border: 2px dashed #b9c4ce; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 22px 16px; text-align: center; background: var(--bg); }
.imp-drop.over { border-color: var(--accent); background: var(--info-soft); }
.imp-drop > .material-symbols-outlined { font-size: 36px; color: var(--accent-strong); }
.imp-drop-title { font-size: 16px; font-weight: 500; }
.imp-kinds { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.55; color: var(--text-2); display: flex; flex-direction: column; gap: 8px; }
.imp-busy { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.imp-busy .spinner { width: 20px; height: 20px; border-width: 2px; }
.plan-table td { height: auto; padding: 7px 10px; white-space: normal; vertical-align: top; }
.plan-table select { width: auto; min-width: 150px; padding: 4px 6px; font-size: 13px; }
.imp-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2px 20px; padding: 10px 16px 6px; border-top: 1px solid var(--line-soft); }
.imp-opts .muted { font-size: 12px; }
.pay-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.pay-total { font-size: 14px; font-weight: 500; margin-right: auto; }
.imp-result h2 .material-symbols-outlined { color: var(--ok); }
.imp-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.imp-list li { display: flex; align-items: center; gap: 8px; }
.imp-list .material-symbols-outlined { font-size: 18px; color: var(--prog); }
.imp-more { margin-top: 8px; font-size: 13px; }
.imp-more summary { cursor: pointer; font-weight: 500; }
.imp-more.bad summary { color: var(--danger); }
.imp-help { padding: 0; }
.imp-help > summary { padding: 14px 16px; cursor: pointer; font-weight: 500; font-size: 15px; }
.exp-form { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.exp-form .form-grid { padding: 0; width: 100%; max-width: 560px; }
.exp-form p { margin: 0; max-width: 72ch; font-size: 13px; line-height: 1.5; }
.exp-list { display: flex; flex-direction: column; }
.exp-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line-soft); }
.exp-row:first-child { border-top: 0; }
.exp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.exp-main .muted { font-size: 13px; }
.exp-title { font-size: 15px; font-weight: 500; }
.tpl-list { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 12px; }
.tpl-row { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(0, 2fr) auto; gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }

/* ---------- printing a journal copy ---------- */
#print-area { display: none; }
@media print {
  body.printing #app, body.printing #app-nav, body.printing .toast, body.printing #loading, body.printing .cmd-mega, body.printing .cmd-fly, body.printing .menu, body.printing .popover { display: none !important; }
  body.printing #print-area { display: block; }
  body.printing { overflow: visible; height: auto; background: #fff; }
  html:has(body.printing) { overflow: visible; height: auto; }
}
.print-doc { font-family: Georgia, 'Times New Roman', serif; font-size: 11pt; color: #000; padding: 0 4mm; }
.print-head { border-bottom: 1px solid #000; padding-bottom: 6pt; margin-bottom: 10pt; }
.print-head h1 { font-size: 16pt; margin: 0 0 2pt; }
.print-doc h2 { font-size: 12pt; margin: 12pt 0 4pt; }
.print-doc ul { margin: 0; padding-left: 16pt; }
.print-note { break-inside: avoid; border-top: 1px solid #999; padding-top: 6pt; margin-top: 8pt; }
.print-note h3 { font-size: 11pt; margin: 0 0 4pt; }
.print-note p { margin: 0 0 3pt; white-space: pre-wrap; }
.print-doc .muted { color: #444; font-size: 9pt; }

/* ---------- responsive ---------- */
@media (max-width: 1150px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 800px) {
  .imp-pick { grid-template-columns: 1fr; }
  .note-sec { grid-template-columns: 1fr; gap: 2px; }
  .tpl-row { grid-template-columns: 1fr; }
  .form-grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  #ehr-main { padding: 14px 16px 24px; }
  /* the patient search folds into its icon and opens across row 1 when it gets focus (click, / or F2) */
  .page-head h1 { font-size: 20px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .pt-banner { top: -14px; gap: 10px; }
  .pt-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .alert-signal { max-width: 100%; }
  .ov-grid, .vit-charts, .alert-list { grid-template-columns: minmax(0, 1fr); }
  .chart-tab span:not(.material-symbols-outlined):not(.tab-n) { display: none; }
  .chart-tab.on span { display: inline !important; }
  .lb-search { width: 100% !important; }
  .day-item { flex-wrap: wrap; }
  .day-acts { width: 100%; }
  .journal-q { width: 100% !important; }
  .save-bar { top: -14px; }
}
