/* FCMS Module 1 (EMR + users) — additions to journey.css. Colours only through design-system / journey tokens. */
.emr-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.emr-head .who { flex: 1; min-width: 260px; }
.emr-head .who .nm { font-size: 24px; font-weight: 700; color: var(--dept-deep); line-height: 1.25; }
.emr-head .who .nm2 { font-size: 16px; color: var(--on-dark-85); font-weight: 600; }
.emr-head .chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.emr-head .chip { background: var(--white); border: 1px solid var(--border-soft); border-radius: 999px; padding: 4px 12px; font-size: 13.5px; font-weight: 600; color: var(--ink-body); }
.emr-head .chip b { color: var(--gold); }
.emr-head .side { min-width: 240px; }
.emr-head a { color: var(--sapphire); }

.allergy { display: flex; gap: 10px; align-items: center; border-radius: 6px; padding: 10px 14px; font-weight: 700; font-size: 15px; margin: 12px 0; flex-wrap: wrap; }
.allergy.has { background: var(--pill-danger-bg); color: var(--pill-danger-ink); border-left: 5px solid var(--ruby); }
.allergy.none { background: var(--pill-ok-bg); color: var(--pill-ok-ink); border-left: 5px solid var(--emerald); }
.allergy.unknown { background: var(--pill-warn-bg); color: var(--pill-warn-ink); border-left: 5px solid var(--color-warning); }

.lock-banner { background: var(--sapphire-muted); color: var(--sapphire-deep); border-left: 5px solid var(--sapphire-deep); border-radius: 6px; padding: 10px 14px; font-weight: 700; margin-bottom: 14px; }
.warn-box { background: var(--warning-muted); border: 1.5px solid var(--color-warning); border-radius: 6px; padding: 12px 14px; margin: 10px 0; }
.danger-box { background: var(--ruby-muted); border: 1.5px solid var(--ruby); border-radius: 6px; padding: 12px 14px; margin: 10px 0; color: var(--ruby-dark); }
.ok-box { background: var(--emerald-muted); border: 1.5px solid var(--emerald); border-radius: 6px; padding: 12px 14px; margin: 10px 0; }

/* lab flags: N emerald · L sapphire · H ruby · LL/HH ruby-dark + pulse · A amber */
.flag { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; border-radius: 999px; padding: 3px 10px; font-size: 12.5px; font-weight: 700; letter-spacing: .04em; }
.flag.N { background: var(--pill-ok-bg); color: var(--pill-ok-ink); }
.flag.L { background: var(--pill-info-bg); color: var(--pill-info-ink); }
.flag.H { background: var(--pill-danger-bg); color: var(--pill-danger-ink); }
.flag.LL, .flag.HH { background: var(--ruby-dark); color: var(--white); animation: emr-pulse 1.4s ease-in-out infinite; }
.flag.A { background: var(--pill-warn-bg); color: var(--pill-warn-ink); }
@keyframes emr-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--ruby-light); } 50% { box-shadow: 0 0 0 5px var(--ruby-muted); } }
/* a result value in the chart: abnormal (high, low, critical, abnormal) ruby · normal emerald — no tag beside it (Dr. Pat, 19 Nov 2026) */
.val-H, .val-HH, .val-L, .val-LL, .val-A { color: var(--ruby); font-weight: 700; }
.val-N { color: var(--emerald); font-weight: 700; }
.lab-open { cursor: pointer; }
.lab-open:hover b, .lab-open:focus-visible b { text-decoration: underline; }

.tabs button .cnt { display: inline-block; margin-left: 6px; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--sand-deep); color: var(--ink); font-size: 12px; }
.tabs button.on .cnt { background: var(--ruby-muted); color: var(--ruby-dark); }

.formsec { border: 1px solid var(--border-soft); border-radius: 6px; padding: 14px; margin-bottom: 12px; background: var(--cream-deep); }
.formsec h4 { margin: 0 0 10px; font-size: 15px; color: var(--dept-deep); }
.req::after { content: " *"; color: var(--ruby); }
.hint { font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }
.err-text { font-size: 12.5px; color: var(--ruby-dark); font-weight: 700; }

.dd { position: relative; }
.dd-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--white); border: 1px solid var(--border-strong); border-radius: 6px; box-shadow: var(--shadow); max-height: 340px; overflow: auto; }
.dd-list .opt { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border-soft); }
.dd-list .opt:hover, .dd-list .opt.hi { background: var(--sapphire-muted); }
.dd-list .opt:last-child { border-bottom: 0; }

.soap textarea { width: 100%; min-height: 96px; resize: vertical; }
.soap .lbl { display: flex; gap: 8px; align-items: baseline; }
.soap .lbl b { font-size: 18px; color: var(--ruby); width: 18px; }
.note-view { white-space: pre-wrap; font-size: 15px; line-height: 1.55; }
.note-view h5 { margin: 10px 0 2px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.addendum { border-left: 4px solid var(--gold); background: var(--cream-deep); padding: 10px 12px; border-radius: 0 6px 6px 0; margin-top: 10px; }

.vitals-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .vitals-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bmi-box { border-radius: 6px; padding: 10px 12px; background: var(--sapphire-muted); color: var(--sapphire-deep); font-weight: 700; }
.bmi-box b { font-size: 26px; }

.dup-row { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--border-warm); flex-wrap: wrap; }
.dup-row:last-child { border-bottom: 0; }
.pdpa-text { max-height: 220px; overflow: auto; white-space: pre-wrap; font-size: 14px; background: var(--white); border: 1px solid var(--border-soft); border-radius: 6px; padding: 10px 12px; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.t-scroll { overflow-x: auto; }
table.t td.nowrap, table.t th.nowrap { white-space: nowrap; }
.gplal { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; text-align: center; }
.gplal div { background: var(--cream-deep); border-radius: 6px; padding: 8px 4px; }
.gplal b { display: block; font-size: 26px; color: var(--dept-deep); }
.gplal span { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--ink-soft); }
.trend { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.trend .card { padding: 12px 14px; margin: 0; }
.denied { text-align: center; padding: 40px 20px; }
@media (max-width: 760px) { .vitals-grid, .gplal { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* journey.css spaces stacked cards (.card + .card); cards placed side by side in a grid must stay aligned */
.grid > .card + .card { margin-top: 0; }
table.t td .pill, table.t td .flag, .tag { white-space: nowrap; }
@media (min-width: 1200px) { .vitals-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
/* chart / visit layout: full-row cards never create extra implicit columns; one column on a portrait tablet */
.grid > .span2 { grid-column: span 2; }
.grid > .span-all { grid-column: 1 / -1; }
@media (max-width: 1100px) { .grid.c3 > .span2 { grid-column: 1 / -1; } }
@media (max-width: 1000px) { .grid.emr-grid { grid-template-columns: minmax(0, 1fr); } .grid.emr-grid > * { grid-column: 1 / -1; } }
.kv > div { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 1000px) { table.t .hide-narrow { display: none; } }
.allergy .allergy-note { font-weight: 600; font-size: 13px; }
/* /admin/users: the additional roles of an account (checkboxes) and every role in the list */
.role-field { display: flex; flex-direction: column; gap: 6px; }
.role-field > span { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.role-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.role-checks label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-body); }
.role-checks label.off { color: var(--gray-500); }
.role-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* Patient chart → Visits: the list on the left, the clicked visit on the right (11 Nov 2026). Whole width until a visit is clicked. */
.vsplit.on { display: grid; grid-template-columns: minmax(280px, 36%) minmax(0, 1fr); gap: 14px; align-items: start; }
.vsplit .vlist tbody tr { cursor: pointer; }
.vsplit .vlist tbody tr.sel td { background: var(--sapphire-muted); }
.vsplit .vlist tbody tr:focus-visible { outline: 2px solid var(--sapphire); outline-offset: -2px; }
.vsplit .vpane { min-width: 0; }
.vsplit .vpane-head { gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.vsplit .vpane .grid.c2.emr-grid { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 980px) { .vsplit.on { grid-template-columns: minmax(0, 1fr); } }

/* Export history picker on the patient chart (Dr. Pat, 19 Nov 2026) */
.hx-parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.hx-group { border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; background: var(--bg-card); }
.hx-gh { font-weight: 700; color: var(--sapphire-deep); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.hx-part { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.hx-part .cnt { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--sapphire-muted); color: var(--sapphire-deep); font-size: 12px; text-align: center; }
.hx-part.none { color: var(--text-secondary); }
.hx-part.none .cnt { background: transparent; color: var(--text-secondary); }
.hx-days { max-height: 46vh; overflow: auto; border: 1px solid var(--border-color); border-radius: var(--border-radius); }
.hx-days tr.clickable { cursor: pointer; }
.hx-days tr.hx-off td { opacity: .45; }

/* Visit page from the consultation room — Dr. Pat's sketch, 19 Nov 2026 19:54: left (about 55 %) chief complaint and details · vital
   signs · SOAP · diagnosis; right (about 45 %) Shortcuts · Billing; Results full width after. One column on a tablet / narrow window. */
.visit-layout { display: grid; grid-template-columns: minmax(0, 55fr) minmax(0, 45fr); gap: 14px; align-items: start; margin-bottom: 14px; }
.visit-layout > .visit-main, .visit-layout > .visit-side { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.visit-layout > .visit-main > *, .visit-layout > .visit-side > * { margin-top: 0; margin-bottom: 0; }
.visit-layout .soap-2x2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; }
@media (max-width: 1100px) { .visit-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) { .visit-layout .soap-2x2 { grid-template-columns: minmax(0, 1fr); } }
/* the visit's vital-signs record as one line (visit-workspace.js Vitals) */
.vitals-rec { display: flex; flex-direction: column; gap: 6px; }
.vitals-line { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 8px 10px; border-radius: 6px; background: var(--sapphire-muted); font-size: 14px; }
.vitals-line.void { opacity: .6; background: transparent; border: 1px dashed var(--border-color); }
/* the narrower columns of that layout: the bill fits without sideways scrolling on a 1440 px screen —
   the bill without its time column and with a short "Pkg" heading, tables a little tighter, idle sort arrows hidden */
.visit-layout table.t { font-size: 13.5px; } .visit-layout table.t th, .visit-layout table.t td { padding: 8px 7px; }
.visit-layout table.t th[data-rn-sort] { white-space: normal; } .visit-layout table.t th[data-rn-sort][aria-sort="none"]::after { display: none; }
.visit-side [data-testid="vb-table"] th:nth-child(2), .visit-side [data-testid="vb-table"] td:nth-child(2) { display: none; }
.visit-side [data-testid="vb-table"] input[data-testid="vb-price"] { width: 78px !important; }
.visit-side [data-testid="visit-bill"] .vb-long { display: none; } .visit-side [data-testid="visit-bill"] .vb-short { display: inline; }
/* the editable bill in the side column without sideways scrolling down to a 1280 px window (Dr. Pat, 21 Nov 2026: "plenty
   spaces. You clutter the area"): the type sits small above the item instead of its own column, number boxes without
   spinners, compact labels; a click on the row opens the price editor (no separate ⋯ button here) */
.visit-side [data-testid="vb-table"] th:nth-child(3), .visit-side [data-testid="vb-table"] td:nth-child(3) { display: none; }
.visit-side [data-testid="vb-table"] .vb-type-inline { display: block; font-size: 11.5px; color: var(--gray-600); line-height: 1.2; }
.visit-side [data-testid="vb-table"] td:nth-child(4) { min-width: 96px !important; }
.visit-side [data-testid="vb-table"] input[type=number] { -moz-appearance: textfield; appearance: textfield; padding: 4px 6px; }
.visit-side [data-testid="vb-table"] input[type=number]::-webkit-inner-spin-button,
.visit-side [data-testid="vb-table"] input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.visit-side [data-testid="vb-table"] input[data-testid="vb-price"] { width: 54px !important; }
.visit-side [data-testid="vb-table"] input[data-testid="vb-set-qty"], .visit-side [data-testid="vb-table"] input[data-testid="vb-qty"] { width: 44px !important; }
/* … except on a prescription line: its row click opens the prescription, so its ⋯ (price list) stays (Codex 8ab4f3c6 #1) */
.visit-side [data-testid="vb-table"] input[data-testid="vb-price"] + button:not(.vb-pl-keep) { display: none; }
.visit-side [data-testid="vb-table"] input[data-testid="vb-price"] + button.vb-pl-keep { padding: 1px 5px; margin-left: 2px; }
.visit-side [data-testid="vb-table"] .pill { padding: 3px 7px; font-size: 12.5px; }
.visit-layout .visit-side table.t[data-testid="vb-table"] th, .visit-layout .visit-side table.t[data-testid="vb-table"] td { padding-left: 5px; padding-right: 5px; }
.visit-side [data-testid="vb-table"] [data-testid="vb-del"], .visit-side [data-testid="vb-table"] [data-testid="vb-del-yes"] { padding: 1px 6px; margin-left: 4px !important; }
.visit-main .vitals-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
