:root {
  --bg: #f3f6f6;
  --panel: #ffffff;
  --ink: #142424;
  --muted: #5d7070;
  --line: #dde5e5;
  --line-strong: #c4d1d1;
  --primary: #0b7a6f;
  --primary-ink: #ffffff;
  --primary-soft: #e3f3f1;
  --side: #0d2b2a;
  --side-ink: #c9dcda;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --warn: #b7791f;
  --warn-soft: #fff6e0;
  --ok: #1e8e3e;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 40, 40, .06), 0 2px 8px rgba(16, 40, 40, .05);
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.4; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Khung ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 16px 14px 12px; border-bottom: 1px solid rgba(255,255,255,.07); }
.logo { width: 36px; height: 36px; border-radius: 9px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 20px; font-weight: 700; flex: none; }
.brand-name { color: #fff; font-weight: 650; font-size: 14px; line-height: 1.25; }
.brand-sub { font-size: 11.5px; opacity: .7; }
.side nav { flex: 1; overflow-y: auto; padding: 8px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .55; padding: 14px 10px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--side-ink); text-decoration: none; margin: 1px 0; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item span:first-of-type { flex: 1; }
.nav-badge { min-width: 22px; padding: 1px 7px; border-radius: 11px; background: #e8a33a; color: #1d1300; font-size: 12px; font-weight: 700; text-align: center; }
.nav-badge:empty { display: none; }
.nav-item.active .nav-badge { background: #fff; color: var(--primary); }
.icon-btn.light.off { opacity: .45; }
.side-user { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.07); }
.side-user .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-user .who b { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who small { opacity: .7; font-size: 11.5px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #1d4d4a; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.main { min-width: 0; position: relative; }
.icon-btn.menu-btn { display: none; position: absolute; left: 10px; top: 12px; z-index: 5; }

.page { padding: 18px 22px 40px; max-width: 1600px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; font-weight: 650; flex: 1; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.loading, .empty-state { padding: 40px; text-align: center; color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 14px; }
.card-title { font-weight: 650; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.card-title .spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.split { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; align-items: start; }
.split.wide-left { grid-template-columns: minmax(0, 1fr) 380px; }
.split > *, .grid2 > * { min-width: 0; }
.split.narrow { grid-template-columns: 290px minmax(0, 1fr); }
.sticky-col { position: sticky; top: 12px; }
.split.wide-left.pay { grid-template-columns: minmax(0, 1fr) 310px; }
.row-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- Nút ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line-strong); background: #fff; cursor: pointer; font-weight: 550; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: #f4f8f8; border-color: #aebfbf; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: #096a60; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.warn-btn { background: #fff4e5; border-color: #f0b25c; color: #8a4b00; }
.btn.warn-btn:hover { background: #ffe8c7; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.lg { padding: 10px 18px; font-size: 15px; }
.btn.block { width: 100%; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 6px; border-radius: 6px; display: inline-grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: rgba(0,0,0,.06); color: var(--ink); }
.icon-btn.light { color: var(--side-ink); }
.icon-btn.light:hover { background: rgba(255,255,255,.1); color: #fff; }
.link-btn { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 0; font-weight: 550; white-space: nowrap; }
.link-btn.danger { color: var(--danger); }

/* ---------- Form ---------- */
input[type=text], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11,122,111,.14); }
input[readonly] { background: #f6f8f8; }
textarea { resize: vertical; }
input.num { text-align: right; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 12px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid.two { grid-template-columns: repeat(2, 1fr); }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid.vitals { grid-template-columns: repeat(9, minmax(70px, 1fr)); align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field .lbl { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.field .req { color: var(--danger); }
.field .hint { color: var(--muted); font-size: 11.5px; }
.field.span2 { grid-column: span 2; } .field.span3 { grid-column: span 3; } .field.span4 { grid-column: span 4; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; padding: 8px 0; }
.daterange { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.daterange input { width: 150px; }
.daterange .presets { display: flex; gap: 2px; flex-wrap: wrap; }
.search-box { position: relative; }
.search-box input { padding-left: 30px; }
.search-box::before { content: "⌕"; position: absolute; left: 9px; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 16px; }

/* ---------- Bảng ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; background: #f2f6f6; text-align: left; font-weight: 600; font-size: 12.5px; color: #3d5555; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid #edf2f2; vertical-align: middle; }
.tbl.compact td { padding: 4px 6px; }
.tbl.compact th { padding: 6px; }
.tbl tbody tr:hover { background: #f8fbfb; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.selected { background: var(--primary-soft) !important; }
.tbl tr.muted td { color: #95a5a5; }
.tbl tr.warn { background: var(--warn-soft); }
.tbl tr.bad { background: var(--danger-soft); }
.tbl tfoot td { font-weight: 700; background: #f7fafa; border-top: 1px solid var(--line); }
.tbl td.empty { text-align: center; color: var(--muted); padding: 24px; }
.a-right { text-align: right !important; } .a-center { text-align: center !important; }
.tbl input, .tbl select { padding: 4px 6px; }
.tbl .w-num { width: 64px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 8px 9px; cursor: pointer; border-bottom: 2.5px solid transparent; color: var(--muted); font-weight: 550; white-space: nowrap; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 10px; background: #e7eeee; color: #3d5555; font-size: 11.5px; text-align: center; }
.tab.active .badge { background: var(--primary); color: #fff; }

.chip { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #eef2f2; color: #456; white-space: nowrap; }
.chip.amber { background: #fff3d6; color: #8a5a00; } .chip.blue { background: #e1efff; color: #1d5fb4; }
.chip.violet { background: #efe6ff; color: #6236b8; } .chip.green { background: #e1f5e6; color: #18733a; }
.chip.gray { background: #eceff0; color: #6c7a7a; }
.chip.cyan { background: #dcf4f7; color: #0b6a78; } .chip.orange { background: #ffe9d6; color: #a14a00; } .chip.red { background: var(--danger-soft); color: var(--danger); }

/* ---------- Thông báo ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { background: #173332; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 420px; transition: opacity .3s, transform .3s; }
.toast.err { background: var(--danger); } .toast.warn { background: #9a6700; } .toast.info { background: #0b6a78; }
.toast.hide { opacity: 0; transform: translateY(8px); }
.alert { padding: 8px 12px; border-radius: 7px; margin: 6px 0; font-size: 13px; }
.alert.danger { background: var(--danger-soft); color: #8e2418; border: 1px solid #f3c3bd; }
.alert.warn { background: var(--warn-soft); color: #7a5200; border: 1px solid #f1dda6; }
.alert.info { background: var(--primary-soft); color: #075d55; border: 1px solid #bfe3df; }

/* ---------- Hộp thoại ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10, 30, 30, .42); display: grid; place-items: start center; padding: 5vh 12px; z-index: 500; overflow-y: auto; }
.modal { background: #fff; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.25); max-width: calc(100vw - 24px); display: flex; flex-direction: column; max-height: 90vh; }
.modal-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; flex: 1; font-size: 16px; }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); background: #fafcfc; border-radius: 0 0 10px 10px; }

/* ---------- Gợi ý ---------- */
.ta-list { position: fixed; z-index: 900; background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.15); max-height: 340px; overflow-y: auto; max-width: 640px; }
.ta-item { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid #f0f4f4; }
.ta-item.active, .ta-item:hover { background: var(--primary-soft); }
.ta-item .t1 { font-weight: 600; }
.ta-item .t2 { font-size: 12px; color: var(--muted); }
.ta-empty { padding: 10px; color: var(--muted); }

/* ---------- Đăng nhập ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #0d2b2a 0%, #0b5f57 100%); padding: 20px; }
.auth-box { background: #fff; padding: 28px 28px 24px; border-radius: 14px; width: 380px; max-width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-box h2 { margin: 10px 0 2px; }
.auth-logo { width: 46px; height: 46px; border-radius: 12px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 700; }
.auth-err { color: var(--danger); min-height: 18px; font-size: 13px; }

/* ---------- Tổng quan ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--muted); }
.stat.alert-stat .v { color: var(--danger); }
.chart { width: 100%; height: 220px; }
.chart .bar { fill: var(--primary); } .chart .bar2 { fill: #7cc4bc; }
.chart text { font-size: 10.5px; fill: var(--muted); }
.chart .grid { stroke: #e8eeee; }

/* ---------- Hàng chờ ---------- */
.queue { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 230px); overflow-y: auto; padding-right: 2px; }
.q-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; cursor: pointer; display: grid; grid-template-columns: 38px 1fr auto; gap: 8px; align-items: center; }
.q-item:hover { border-color: #9fc9c3; }
.q-item.active { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.q-item.returned { border-color: #f0b4ac; background: #fff7f6; }
.q-item.back { border-color: #f3c58f; background: #fff8ef; }
.q-item.back .q-no { background: #f5a623; color: #fff; }
.q-flag { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-flag.ok { color: #a14a00; } .q-flag.bad { color: var(--danger); } .q-flag.info { color: #0b6a78; }
.order-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: #fff; }
.order-row.done { background: #f2faf4; border-color: #cce8d4; }
.order-row .nm { font-weight: 650; font-size: 15px; }
.order-row .meta { font-size: 12px; color: var(--muted); }
.order-row input { max-width: 220px; }
.q-no { width: 34px; height: 34px; border-radius: 8px; background: #eef4f4; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #2c4c4a; }
.q-item.active .q-no { background: var(--primary); color: #fff; }
.q-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-time { font-size: 12px; color: var(--muted); text-align: right; max-width: 96px; }
.q-time .chip { font-size: 11px; padding: 1px 6px; white-space: normal; }

/* ---------- Khám bệnh ---------- */
.pt-head { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.pt-name { font-size: 18px; font-weight: 700; }
.pt-meta { color: var(--muted); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.pt-meta b { color: var(--ink); font-weight: 600; }
.allergy { background: var(--danger-soft); color: var(--danger); border: 1px solid #f3c3bd; padding: 3px 9px; border-radius: 6px; font-weight: 650; font-size: 13px; }
.rx-table td { padding: 3px 3px; }
.rx-table th { padding: 7px 4px; }
.rx-table input { padding: 4px 5px; }
.rx-table .w-dose { width: 42px; text-align: center; }
.rx-table td:nth-child(2) { min-width: 170px; }
.rx-table input[list] { min-width: 130px; }
.rx-table .w-qty { width: 64px; }
.rx-table .pname { font-weight: 600; }
.rx-table .psub { font-size: 11.5px; color: var(--muted); }
.rx-add { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.rx-add input { max-width: 520px; }
.sticky-foot { position: sticky; bottom: 0; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); padding: 10px 14px; margin: 0 -16px -14px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; border-radius: 0 0 var(--radius) var(--radius); z-index: 3; }
.sticky-foot.standalone { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 -4px 16px rgba(16,40,40,.08); }
.totals { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; font-variant-numeric: tabular-nums; }
.totals .t { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.totals .t b { font-size: 15px; color: var(--ink); }
.totals .t.big b { font-size: 20px; color: var(--primary); }
.quick-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.quick-chips button { border: 1px dashed var(--line-strong); background: #fff; border-radius: 14px; padding: 2px 10px; font-size: 12px; cursor: pointer; }
.quick-chips button:hover { border-color: var(--primary); color: var(--primary); }
.hist-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.hist-item .hd { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 10px; font-size: 13.5px; }
.kv .k { color: var(--muted); }

.pay-box { background: #f7fbfa; border: 1px solid #d6ebe8; border-radius: 8px; padding: 12px; }
.pay-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; gap: 10px; }
.pay-row .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.pay-row.total { border-top: 1px solid #cfe3e0; margin-top: 4px; padding-top: 8px; font-size: 18px; }
.pay-row.total .v { color: var(--primary); font-size: 22px; }
.pay-row input { width: 150px; }
.qr { text-align: center; } .qr img { width: 210px; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; }

@media (max-width: 1100px) {
  .split, .split.wide-left, .split.narrow, .split.wide-left.pay, .grid2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid.vitals { grid-template-columns: repeat(3, 1fr); }
  .queue { max-height: 300px; }
  .sticky-col { position: static; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: -260px; width: 240px; z-index: 50; transition: left .2s; }
  .shell.nav-open .side { left: 0; box-shadow: 0 0 30px rgba(0,0,0,.35); }
  .shell.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(10, 30, 30, .4); z-index: 49; }
  .icon-btn.menu-btn { display: inline-grid; }
  .page { padding: 14px 12px 40px; }
  .page-head { padding-left: 36px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr 1fr; }
  .sticky-foot.standalone { position: static; }
  .order-row { flex-wrap: wrap; }
  .order-row > div:first-child { flex: 1 1 100% !important; }
  .order-row input { max-width: none; flex: 1; }
  #toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
  .modal-back { padding: 2vh 8px; }
}

/* ===== Lễ tân (v1.1) ===== */
.pt-banner { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--primary-soft); border: 1px solid #bfe3df; margin: 0 0 10px; }
.pt-banner.has-allergy { background: #fff8f7; border-color: #f3c3bd; }
.pt-banner-main { flex: 1; min-width: 0; }
.pt-banner-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.prio-field .check { padding: 6px 10px; border: 1px dashed #f0c27a; border-radius: 7px; background: #fffaf0; cursor: pointer; }
.prio-field .check:has(input:checked) { background: #fff1d6; border-style: solid; border-color: #f5a623; }
.form-grid.vitals.vit8 { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); align-items: start; gap: 4px 10px; }

input.invalid { border-color: var(--danger) !important; background: #fff6f5 !important; }
input.warn { border-color: #e0a030 !important; background: #fffaf0 !important; }
.vhint { min-height: 14px; font-size: 11.5px; line-height: 14px; }
input.invalid + .vhint { color: var(--danger); }
input.warn + .vhint { color: #a16207; font-weight: 600; }
.bmi { font-size: 12.5px; }
.bmi:empty { display: none; }
.rec-toolbar { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.rec-toolbar .search-box { flex: 1; }
.rec-toolbar select { max-width: 180px; }
.rec-summary { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--muted); margin: 2px 0 8px; }
.rec-summary b { color: var(--ink); }
.rec-summary .late, .rec-summary .late b { color: var(--danger); }
.prio-txt { color: #b45309; font-weight: 600; }
.stt { display: inline-grid; place-items: center; min-width: 32px; height: 30px; border-radius: 7px; background: #eef4f4; font-weight: 700; padding: 0 6px; position: relative; }
.stt.prio { background: #f5a623; color: #fff; }
.stt small { font-size: 10px; position: absolute; top: -8px; right: -8px; }
.tbl tr.row-prio td { background: #fffaf0; }
.wait { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.wait.slow { color: #a16207; font-weight: 600; }
.wait.late { color: var(--danger); font-weight: 700; }
td .sub { font-size: 12px; margin-top: 2px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: nowrap; }
@keyframes pkflash { from { background: #cdf3e8; } to { background: transparent; } }
.tbl tr.flash { animation: pkflash 3s ease-out; }
.dup-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.dup-item { display: flex; gap: 10px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.dup-item .t1 { font-weight: 600; } .dup-item .t2 { font-size: 12.5px; color: var(--muted); }
.btn.danger-ghost { background: transparent; border-color: #f0b4ac; color: var(--danger); }
.btn.danger-ghost:hover { background: var(--danger-soft); }
.ta-list .chip, .dup-item .chip { margin-left: 6px; font-size: 11px; padding: 1px 6px; }
.q-prio { color: #b45309; font-weight: 700; }
@media (max-width: 760px) {
  .form-grid.vitals.vit8 { grid-template-columns: repeat(2, 1fr); }
  .hide-sm { display: none; }
  .pt-banner { flex-direction: column; }
  .rec-form .row-flex .spacer { display: none; }
  .row-actions { gap: 8px; }
  .rec-toolbar { flex-wrap: wrap; } .rec-toolbar select { max-width: none; flex: 1; }
}
.rec-cards { display: flex; flex-direction: column; gap: 8px; }
.rec-card { display: grid; grid-template-columns: 38px 1fr; gap: 10px; border: 1px solid var(--line); border-radius: 9px; padding: 10px; background: #fff; }
.rec-card.row-prio { background: #fffaf0; border-color: #f3d39a; }
.rec-card.muted { opacity: .65; }
.rec-card.flash { animation: pkflash 3s ease-out; }
.rec-card-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rec-card-top { display: flex; align-items: center; gap: 6px; }
.rec-card-top .spacer { flex: 1; }
.rec-card-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.rec-card-foot .row-actions { gap: 14px; }
@media (max-width: 760px) {
  .form-grid > .field:has(input[type=date]) { grid-column: 1 / -1; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs .tab { flex: none; }
}

/* ===== Bác sĩ (v1.2) ===== */
.q-flags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.q-flags .chip { font-size: 11px; padding: 1px 6px; }
.q-time .wait { font-size: 11px; margin-top: 2px; }
/* Chọn phòng khám đang ngồi */
.room-list { display: flex; flex-direction: column; gap: 8px; }
.room-btn { text-align: left; border: 1px solid var(--line-strong); background: #fff; border-radius: 10px; padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; width: 100%; }
.room-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.room-btn.current { border-color: var(--primary); box-shadow: inset 4px 0 0 var(--primary); }
.room-btn.pref { border-color: #9cc3ef; }
.room-btn.all { margin-top: 10px; border-style: dashed; }
.room-name { font-weight: 700; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.room-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.side-user .who.clickable { cursor: pointer; }
.side-user .who.clickable:hover small { text-decoration: underline; }
