/* Hệ thiết kế "Hành trình tìm con" – xem design-system/MASTER.md */
:root {
  --bg: #FFF7FA;
  --card: #FFFFFF;
  --ink: #2B2125;
  --ink-2: #4A3B41;
  --muted: #6B5A61;
  --line: #F5E1E9;
  --line-2: #EBD3DE;
  --soft: #F8E8EF;
  --peach: #F0528C;
  --peach-dark: #C2185B;
  --peach-darker: #8C1043;
  --peach-tint: #FDE3EE;
  --green: #3F6B34;
  --green-dark: #2E5226;
  --green-tint: #E8F3E3;
  --danger: #B42318;
  --radius: 18px;
  --shadow: 0 6px 20px rgba(194, 24, 91, 0.08);
  font-family: 'Be Vietnam Pro', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--peach-dark); }
a:hover { color: var(--peach-darker); }
h1 { font-size: 24px; margin: 0; line-height: 1.3; }
h2 { font-size: 17px; margin: 0; }
h3 { font-size: 15px; margin: 0; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--peach); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.bold { font-weight: 700; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }

.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.accent { border: 2px solid var(--peach); }
.card.tint { background: var(--peach-tint); box-shadow: none; }
.card.green { background: var(--green-tint); box-shadow: none; }

.btn {
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.btn:hover { background: #FFF0F5; color: var(--ink); }
.btn.primary { background: var(--peach-dark); color: #fff; border-color: var(--peach-dark); font-weight: 600; }
.btn.primary:hover { background: var(--peach-darker); color: #fff; }
.btn.green { background: var(--green); color: #fff; border-color: var(--green); font-weight: 600; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.link { border: none; background: none; color: var(--peach-dark); padding: 0 4px; font-weight: 600; }
.btn:disabled { opacity: 0.5; cursor: default; }

.chip { display: inline-flex; align-items: center; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--soft); color: var(--ink-2); white-space: nowrap; }
.chip.proc { background: var(--peach-dark); color: #fff; font-weight: 700; }
.chip.ok { background: var(--green-tint); color: var(--green-dark); font-weight: 600; }
.chip.warn { background: var(--peach-tint); color: var(--peach-darker); font-weight: 600; }

label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: 12px;
  min-height: 44px; padding: 8px 12px; width: 100%;
}
textarea { min-height: 88px; resize: vertical; }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; accent-color: var(--green); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 8px; }
td { padding: 10px 8px; border-top: 1px solid var(--soft); vertical-align: top; }
.table-wrap { overflow-x: auto; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--bg); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 16px; font-weight: 700; }

.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--soft); }
.list-item:first-child { border-top: none; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 12px; z-index: 50; max-width: 90vw; font-size: 14px;
}
.toast.err { background: var(--danger); }

dialog { border: none; border-radius: 20px; padding: 0; width: min(520px, 94vw); max-height: 90vh; }
dialog::backdrop { background: rgba(43, 33, 37, 0.45); }
dialog form, dialog .dlg { padding: 22px; display: flex; flex-direction: column; gap: 14px; }

.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.pin-code { font-size: 36px; font-weight: 700; letter-spacing: 6px; text-align: center; color: var(--peach-dark); }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: var(--peach-tint); border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg .meta { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---------- Khung trang nhân viên ---------- */
.app { min-height: 100vh; display: flex; }
.side {
  width: 240px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line); padding: 24px 14px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 0 12px 18px; }
.brand .t { font-size: 17px; font-weight: 700; color: var(--peach-dark); }
.nav a {
  min-height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-radius: 12px;
  color: var(--ink); text-decoration: none; font-size: 15px;
}
.nav a.on { background: var(--peach-tint); color: var(--peach-darker); font-weight: 600; }
.nav a .badge { font-size: 12px; font-weight: 700; color: #fff; background: var(--peach-dark); border-radius: 999px; padding: 1px 8px; }
.main { flex: 1; min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 40px; display: flex; flex-direction: column; gap: 20px; max-width: 1280px; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > .c3 { flex: 3 1 440px; min-width: 0; }
.cols > .c2 { flex: 2 1 300px; min-width: 0; }
.proc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 12px 14px; min-height: 46px; display: inline-flex; align-items: center; text-decoration: none; color: var(--muted); white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a.on { color: var(--peach-darker); font-weight: 600; border-bottom-color: var(--peach-dark); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.step { display: flex; flex-direction: column; gap: 6px; }
.step .bar { height: 6px; border-radius: 3px; background: var(--soft); }
.step.done .bar { background: var(--green); }
.step.cur .bar { background: var(--peach); }
.bottom-nav { display: none; }

/* Chu kỳ đã xong gập 1 dòng (bacsi/app.js cycleFold) */
.cyc-fold { padding: 0; }
.cyc-fold > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 16px; min-height: 48px; cursor: pointer; list-style: none; }
.cyc-fold > summary::-webkit-details-marker { display: none; }
.cyc-fold > summary::before { content: '›'; font-size: 20px; line-height: 1; color: var(--muted); transition: transform .15s; }
.cyc-fold[open] > summary::before { transform: rotate(90deg); }
.cyc-fold > .card { border-radius: 0 0 16px 16px; box-shadow: none; padding-top: 0; }
.cyc-fold > .card > .row.between:first-child { display: none; }
.intake-fold .intake { box-shadow: none; border-radius: 0 0 16px 16px; }
.intake-fold > summary { justify-content: flex-start; }

@media (max-width: 820px) {
  .side { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px 12px; }
  .tile .v { font-size: 15px; }
  .main { padding: 20px 16px 110px; }
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; background: #fff;
    border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); z-index: 20;
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px;
    text-decoration: none; color: var(--muted); font-size: 11px; position: relative; white-space: nowrap; min-width: 0;
  }
  .bottom-nav a.on { color: var(--peach-dark); font-weight: 600; }
  .bottom-nav .badge { position: absolute; top: 2px; right: 22%; background: var(--peach-dark); color: #fff; font-size: 10px; border-radius: 999px; padding: 0 6px; }
  h1 { font-size: 21px; }
}

/* ---------- Bệnh nhân (điện thoại) ---------- */
.p-app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 24px 18px 110px; display: flex; flex-direction: column; gap: 16px; }
.p-nav {
  position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); z-index: 20;
}
.p-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center; text-decoration: none; color: var(--muted); font-size: 12px; }
.p-nav a.on { color: var(--peach-dark); font-weight: 600; }
.timeline { display: flex; flex-direction: column; }
.tl { display: flex; gap: 12px; }
.tl .rail { display: flex; flex-direction: column; align-items: center; }
.tl .dot { width: 28px; height: 28px; border-radius: 14px; border: 2px solid var(--line-2); background: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tl.done .dot { background: var(--green); border-color: var(--green); }
.tl.cur .dot { border: 3px solid var(--peach); }
.tl .line { width: 2px; flex: 1; min-height: 20px; background: var(--line); }
.tl.done .line { background: var(--green); }
.tl .body { padding: 3px 0 16px; }
.tl.cur .name { color: var(--peach-dark); font-weight: 700; }
.count { background: var(--peach-tint); border-radius: 14px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.count .n { font-size: 32px; font-weight: 700; color: var(--peach-dark); line-height: 1; }
.date-box { width: 54px; height: 58px; border-radius: 12px; background: var(--green-tint); color: var(--green); display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
.date-box .d { font-size: 20px; font-weight: 700; line-height: 1.1; }
.date-box .w { font-size: 11px; font-weight: 600; }
.login { max-width: 420px; margin: 0 auto; padding: 48px 20px; display: flex; flex-direction: column; gap: 18px; min-height: 100vh; justify-content: center; }

/* Tuổi: vợ > 32 tuổi đỏ, ≤ 32 xanh */
.age { display: inline-block; font-size: 0.72em; font-weight: 700; padding: 1px 8px; border-radius: 999px; vertical-align: middle; background: var(--soft); color: var(--ink-2); white-space: nowrap; }
.age.old { background: #FDE2E1; color: var(--danger); }
.age.young { background: var(--green-tint); color: var(--green-dark); }
.live-hint { display: block; min-height: 1.2em; margin-top: 2px; font-weight: 500; }

/* Ô số điện thoại: ✓ xanh bên trong ô khi đúng, viền đỏ khi sai */
.phone-field { position: relative; display: block; }
.phone-field input { width: 100%; padding-right: 40px; letter-spacing: 0.3px; font-variant-numeric: tabular-nums; }
.phone-field .ph-ok { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--green); font-weight: 700; opacity: 0; transition: opacity .15s; pointer-events: none; }
.phone-field.ok .ph-ok { opacity: 1; }
.phone-field.bad input { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12); }
.phone-field.intl.ok .ph-ok::after { content: ' QT'; font-size: 11px; }
.login-pick { color: var(--ink-2); cursor: pointer; }
.login-pick input[type=radio] { width: 18px; height: 18px; min-height: 0; flex: none; margin: 0; padding: 0; accent-color: var(--peach-dark); box-shadow: none; }

/* Hồ sơ bệnh nhân: thanh đề mục dính trên cùng khi cuộn */
.rec-tabs { position: sticky; top: 0; z-index: 15; background: var(--bg); margin: -8px 0 -6px; }
.tabs .t-short { display: none; }
@media (max-width: 900px) {
  .tabs .t-full { display: none; }
  .tabs .t-short { display: inline; }
  .tabs a { padding: 12px 11px; }
}
/* Điện thoại: tab xuống dòng dạng nút, thấy đủ không bị khuất */
@media (max-width: 600px) {
  .rec-tabs { flex-wrap: wrap; overflow: visible; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .rec-tabs a { min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
  .rec-tabs a.on { background: var(--peach-tint); border-color: var(--peach); }
}
.pin-strip { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; background: var(--peach-tint); color: var(--peach-darker); border-radius: 12px; padding: 10px 14px; font-size: 13px; }

/* Phiếu khám ban đầu */
.intake .sec-t { font-size: 15px; color: var(--peach-darker); padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.intake-head { position: sticky; top: 46px; z-index: 5; background: #fff; margin: -18px -20px 0; padding: 12px 20px; border-radius: var(--radius) var(--radius) 0 0; border-bottom: 1px solid var(--line); }
.intake-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.intake-grid.two { grid-template-columns: 1fr 1fr; }
.field-block { display: flex; flex-direction: column; gap: 6px; }
.field-block > .field { font-size: 13px; color: var(--muted); }
.intake textarea { min-height: 64px; resize: none; overflow: hidden; }
.intake input.bad { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12); }
.live-hint.bad { color: var(--danger); }
.save-state.ok { color: var(--green-dark); font-weight: 600; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-opt { flex: 1 1 0; min-width: 120px; position: relative; }
.seg-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-opt span { display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; cursor: pointer; font-weight: 500; }
.seg-opt input:checked + span { background: var(--peach-dark); border-color: var(--peach-dark); color: #fff; font-weight: 600; }
.seg-opt input:focus-visible + span { outline: 3px solid var(--peach); outline-offset: 2px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.qchip { min-height: 38px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer; }
.qchip:hover { background: var(--peach-tint); border-color: var(--peach); }
.seg.freq { display: grid; grid-template-columns: repeat(4, 1fr); }
.seg.freq .seg-opt { min-width: 0; }
.seg.freq .seg-opt span { flex-direction: column; gap: 2px; min-height: 60px; padding: 6px 10px; text-align: center; line-height: 1.25; }
.seg.freq small { font-size: 12px; font-weight: 400; opacity: 0.85; }
.qchip.on { background: var(--peach-tint); border-color: var(--peach); color: var(--peach-darker); font-weight: 600; }
@media (max-width: 820px) {
  .seg-opt { min-width: 0; }
  .seg.freq { grid-template-columns: 1fr 1fr; }
  .intake-head { flex-wrap: nowrap; }
  .intake-head h2 { font-size: 16px; }
  .rec-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .rec-actions .btn { min-height: 42px; padding: 0 10px; font-size: 14px; white-space: nowrap; justify-content: center; }
}

/* Phiếu khám chi tiết (bản 1.3.0) */
.intake .sec-t h3 { font-size: 15px; color: var(--peach-darker); }
.intake .sec-t.row { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.intake-cols { display: grid; gap: 24px; }
@media (min-width: 1000px) { .intake-cols.two { grid-template-columns: 1fr 1fr; gap: 28px; } }
.side-switch { display: none; }
.seg-btn { flex: 1; min-height: 46px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.seg-btn.on { background: var(--peach-dark); color: #fff; border-color: var(--peach-dark); }
.seg.two-line .seg-opt span { flex-direction: column; gap: 2px; min-height: 56px; text-align: center; line-height: 1.25; }
.seg.two-line small { font-size: 12px; font-weight: 400; opacity: .85; }
.seg.sm { gap: 6px; }
.seg.sm .seg-opt { flex: 0 1 auto; min-width: 0; }
.seg.sm .seg-opt span { min-height: 40px; padding: 0 12px; font-size: 14px; }
.para { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.para input { text-align: center; }
.pcard { border: 1px solid var(--line-2); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; background: #fff; }
.tcard { border-radius: 12px; padding: 12px 14px; background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; align-items: start; }
.pgrid.five { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.stepper { display: flex; align-items: stretch; }
.stepper input { text-align: center; border-radius: 0; min-width: 0; padding: 8px 4px; font-variant-numeric: tabular-nums; }
.stepper .st { width: 40px; flex: none; border: 1px solid var(--line-2); background: var(--bg); font: inherit; font-size: 20px; cursor: pointer; color: var(--peach-dark); }
.stepper .st:first-child { border-radius: 12px 0 0 12px; border-right: none; }
.stepper .st:last-child { border-radius: 0 12px 12px 0; border-left: none; }
.psum { background: var(--green-tint); color: var(--green-dark); border-radius: 12px; padding: 10px 14px; line-height: 1.6; white-space: pre-wrap; }
.chip.flag, .pin-strip .flag { background: #FDE2E1; color: var(--danger); font-weight: 600; border-radius: 999px; padding: 2px 10px; }
@media (max-width: 999px) {
  .side-switch { display: flex; gap: 8px; position: sticky; top: 112px; z-index: 4; background: #fff; padding: 6px 0; }
  .intake[data-show="vo"] [data-side="chong"], .intake[data-show="chong"] [data-side="vo"] { display: none; }
}
@media (max-width: 820px) { .side-switch { top: 104px; } .para { gap: 6px; } }
@media (max-width: 820px) {
  .intake .seg:not(.freq):not(.two-line) .seg-opt { flex: 1 1 auto; }
  .intake .seg:not(.freq):not(.two-line) .seg-opt span { white-space: nowrap; padding: 0 12px; font-size: 14px; }
}

/* Dải báo trên bản thử */
.staging-bar { background: var(--green-tint); color: var(--green-dark); text-align: center; font-size: 13px; padding: 8px 16px; border-bottom: 1px solid #CFE3C6; }

/* ---------- Công cụ lâm sàng (bản 1.4.0) ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.tool h2 { color: var(--peach-darker); }
.semen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 14px; }
.tool-out { display: flex; flex-direction: column; gap: 6px; background: var(--bg); border-radius: 12px; padding: 10px 12px; min-height: 44px; }
.tool-nums { display: flex; flex-wrap: wrap; gap: 4px 16px; font-variant-numeric: tabular-nums; }
.cycle-tools { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.tool-sec { border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 14px; background: #fff; }
.tool-sec > summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; list-style: none; }
.tool-sec > summary::-webkit-details-marker { display: none; }
.tool-sec > summary::before { content: '›'; font-size: 18px; color: var(--peach-dark); transition: transform .15s; }
.tool-sec[open] > summary::before { transform: rotate(90deg); }
.tool-sec[open] > summary { margin-bottom: 10px; }
.tool-sec[open] { display: flex; flex-direction: column; gap: 10px; }
.tool-sec table input { min-height: 38px; padding: 4px 8px; font-size: 14px; }
.tool-sec td { vertical-align: middle; }
.advice { font-size: 13px; padding: 8px 12px; border-radius: 10px; background: var(--soft); }
.advice.go { background: var(--green-tint); color: var(--green-dark); font-weight: 600; }
.advice.warn { background: #FDE2E1; color: var(--danger); font-weight: 600; }
.med-table tr.today td:first-child { box-shadow: inset 3px 0 0 var(--peach); }
.scan-chart { width: 100%; max-width: 560px; height: auto; display: block; }
.scan-chart .grid { stroke: var(--line); stroke-width: 1; }
.scan-chart .ax { font-size: 11px; fill: var(--muted); font-family: inherit; }
.scan-chart polyline { fill: none; stroke-width: 2.5; }
.scan-chart polyline.lead, .scan-chart circle.lead { stroke: var(--peach-dark); }
.scan-chart circle.lead { fill: var(--peach-dark); }
.scan-chart polyline.endo, .scan-chart circle.endo { stroke: var(--green); }
.scan-chart circle.endo { fill: var(--green); }
.scan-chart .bar { fill: var(--peach-tint); }
.chart-key { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); }
.chart-key i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.k-lead { background: var(--peach-dark); } .k-endo { background: var(--green); } .k-bar { background: var(--peach-tint); height: 10px !important; }

/* Bệnh nhân */
.trig { border: 2px solid var(--peach); }
.trig-time { font-size: 34px; font-weight: 700; color: var(--peach-dark); line-height: 1.1; font-variant-numeric: tabular-nums; }
.trig-time span { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.trig-left { font-weight: 600; }
.med-row { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--soft); }
.med-row:first-of-type { border-top: none; }
.med-time { min-width: 52px; font-weight: 700; color: var(--peach-dark); font-variant-numeric: tabular-nums; }
.prep-list, .guide-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.5; }
.preg-ga { font-size: 28px; font-weight: 700; color: var(--green-dark); }

/* Gợi ý chỉ hiện khi bấm vào ô (bản 1.4.1) */
.intake .field-block.has-quick > .quick { display: none; }
.intake .field-block.has-quick:focus-within > .quick { display: flex; }
/* Điều trị trước: mỗi chu kỳ 1 thẻ, tiêu đề kèm kết quả */
.pcard-head { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
#prior { display: flex; flex-direction: column; gap: 12px; }

/* Điều trị trước đây: danh sách gọn + popup (bản 1.4.2) */
.plist { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 14px; background: #fff; }
.prow { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); }
.prow:first-child { border-top: none; }
.prior-dlg { width: min(760px, 96vw); padding: 0; }
.prior-dlg .dlg-form { display: flex; flex-direction: column; max-height: 90vh; padding: 0; gap: 0; }
.prior-dlg .dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.prior-dlg .dlg-head h2 { color: var(--peach-darker); }
.prior-dlg .dlg-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.prior-dlg .dlg-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }
@media (max-width: 600px) {
  .prior-dlg { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .prior-dlg .dlg-form { height: 100%; max-height: 100dvh; }
  .prior-dlg .dlg-foot .btn { min-height: 48px; }
}

/* Phiếu khám: thanh 3 mục ghim trên cùng; khám nam khoa là mục phụ (bản 1.4.2) */
.intake-head { display: flex; flex-direction: column; gap: 8px; }
.sec-nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.sec-nav button { flex: 1 1 0; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink-2); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.sec-nav button.on { background: var(--peach-dark); border-color: var(--peach-dark); color: #fff; }
.intake [data-sec] { scroll-margin-top: 170px; }
.intake .side-switch { display: none !important; }
.intake[data-show="vo"] [data-side="chong"], .intake[data-show="chong"] [data-side="vo"] { display: flex !important; }
.andro-fs { border: none; padding: 0; margin: 0; min-width: 0; }
.andro-fs[disabled] { display: none; }
.andro > summary .chip { margin-left: 4px; }

/* Ghi chú PARA tự hiện */
.para-note { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.para-grp { display: flex; flex-direction: column; gap: 4px; }
.para-note.flash { animation: flash 1.2s ease-out 1; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--peach); } to { box-shadow: 0 0 0 0 transparent; } }

/* Tiền sử gộp 1 ô (bản 1.4.3) */
.hist > summary { flex-wrap: wrap; }
.hist-sum { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.hist-sum .chip { white-space: normal; }

/* Cận lâm sàng (bản 1.5.0) */
.cls-bar { gap: 8px; }
.cls-todo { gap: 4px; white-space: normal; }
.cls-todo small { font-weight: 400; opacity: .8; }
.x { border: none; background: none; color: inherit; font: inherit; font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; min-width: 28px; min-height: 28px; border-radius: 8px; }
.x:hover { background: rgba(0,0,0,.06); }
.cls-sheet table { width: auto; min-width: 100%; }
.cls-sheet th, .cls-sheet td { white-space: nowrap; padding: 4px 6px; vertical-align: middle; }
.cls-sheet thead th { text-align: center; font-variant-numeric: tabular-nums; }
.cls-sheet thead th.newest { color: var(--peach-darker); font-weight: 700; }
.cls-sheet .sticky { position: sticky; left: 0; background: #fff; z-index: 1; text-align: left; color: var(--ink); font-weight: 600; font-size: 14px; border-right: 1px solid var(--soft); }
.cls-sheet tbody th.sticky { min-width: 175px; max-width: 240px; white-space: normal; }
.cls-rh { display: flex; align-items: flex-start; gap: 2px; line-height: 1.3; }
.cls-rh > span { padding-top: 5px; }
.cls-rh small { display: block; font-size: 12px; }
.cls-sheet tbody th small { font-weight: 400; }
.cls-cell { border: none; background: none; font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; padding: 6px 10px; border-radius: 8px; cursor: pointer; min-height: 36px; min-width: 52px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.cls-cell:hover { background: var(--soft); }
.cls-cell.bad { background: #FDE2E1; color: var(--danger); font-weight: 700; }
.cls-cell.warn { background: #FFF1DC; color: #8A4B00; font-weight: 600; }
.cls-star { border: none; background: none; cursor: pointer; font-size: 17px; color: #E3CDD7; min-width: 30px; min-height: 30px; border-radius: 8px; padding: 0; }
.cls-star.on { color: #D99A00; }
.cls-star:hover { background: var(--soft); }
.cls-list { display: flex; flex-direction: column; }
.cls-row { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-top: 1px solid var(--soft); }
.cls-row:first-child { border-top: none; }
.cls-row .d { font-size: 13px; color: var(--muted); min-width: 84px; font-variant-numeric: tabular-nums; }
.cls-open-row { flex: 1; text-align: left; border: none; background: none; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; padding: 6px 8px; border-radius: 8px; line-height: 1.45; }
.cls-open-row:hover { background: var(--soft); }
.cls-open-row .bad { color: var(--danger); font-weight: 600; }
.cls-entry { border: 2px solid var(--peach); }
.cls-head { gap: 12px; align-items: center; }
.cls-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 10px; }
.cls-item { border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 12px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.cls-item.filled { border-color: var(--green); background: #FBFEF9; }
.cls-item-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cls-item-h .x { margin-left: auto; }
.cls-ed { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cls-ed input.num { width: 120px; font-variant-numeric: tabular-nums; }
.cls-ed input.sm { width: 76px; }
.cls-ed select { width: auto; }
.grow { flex: 1 1 200px; min-width: 0; }
.cls-st { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.cls-st:empty { display: none; }
.cls-hint { font-size: 12px; color: var(--muted); }
.cls-hint.bad { color: var(--danger); font-weight: 600; }
.cls-grp { display: flex; flex-direction: column; gap: 4px; }
.cls-chips .qchip { min-height: 36px; }
.cls-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 12px; }
.cls-checks label { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 34px; }
.cls-checks label.sub { padding-left: 14px; color: var(--ink-2); }
@media (max-width: 600px) { .cls-items { grid-template-columns: 1fr; } .cls-sheet tbody th.sticky { min-width: 128px; max-width: 150px; font-size: 13px; }
  .cls-sheet .cls-star { min-width: 24px; font-size: 15px; } }

/* 1.6.0: quên mật khẩu / PIN */
.ok-box { background: var(--green-tint); color: var(--green-dark); border-radius: 12px; padding: 10px 14px; font-size: 14px; line-height: 1.45; }
.cls-item .stack > input.grow, dialog .cls-item .stack > input.grow { flex: none; }
.cls-vgroup { grid-column: 1 / -1; border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 12px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.cls-vgroup.filled { border-color: var(--green); background: #FBFEF9; }
.cls-vitems { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.cls-vitems .cls-item { padding: 8px 10px; }
.cls-sugg .advice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: space-between; }
input[data-year].invalid { border-color: var(--danger); box-shadow: 0 0 0 2px #FDE2E1; }
.code-chip { font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .5px; font-variant-numeric: tabular-nums; border: 1px solid var(--line-2); background: #fff; color: var(--peach-darker); cursor: pointer; }
.code-txt { font-weight: 500; letter-spacing: .3px; font-variant-numeric: tabular-nums; }

/* Nhãn mức chứng cứ (y học thực chứng) */
.ev { display: inline-flex; align-items: center; font: inherit; font-size: 11px; font-weight: 600; line-height: 1.3; padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; vertical-align: middle; white-space: normal; text-align: left; }
.ev-high { background: #E3F1E0; color: #2E5226; border-color: #C5E0BD; }
.ev-mid { background: #FFF1DC; color: #7A4300; border-color: #F3D9AE; }
.ev-low { background: #EEEAEC; color: #5A4A51; border-color: #DCD3D7; }
.ev:hover { filter: brightness(.96); }
.ev-table td { vertical-align: top; }

/* Trang chào (public/index.html) – điện thoại trước, máy tính 2 cột */
body.wl { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: 80px; }
body.wl main { flex: 1; }
.wl-wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.wl-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: 8px; }
.wl-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.wl-brand span { display: flex; flex-direction: column; line-height: 1.25; }
.wl-brand small { color: var(--muted); font-size: 12px; }
.wl-login { position: relative; flex: none; }
.wl-login summary { list-style: none; cursor: pointer; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); display: inline-flex; align-items: center; font-weight: 600; font-size: 14px; color: var(--peach-dark); }
.wl-login summary::-webkit-details-marker { display: none; }
.wl-login[open] summary { background: var(--peach-tint); }
.wl-login-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 250px; background: var(--card); border-radius: 16px; box-shadow: 0 12px 32px rgba(43, 33, 37, .16); padding: 6px; display: flex; flex-direction: column; }
.wl-login-menu a { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); line-height: 1.35; }
.wl-login-menu a:hover { background: var(--bg); color: var(--ink); }
.wl-login-menu small { color: var(--muted); font-size: 12px; }
.wl-hero { display: grid; gap: 24px; padding: 24px 0 8px; align-items: center; }
.wl-hero h1 { font-size: 28px; line-height: 1.28; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
.wl-hero h1 span { color: var(--peach-dark); }
.wl-lead { color: var(--ink-2); font-size: 16px; line-height: 1.6; margin-top: 14px; max-width: 32em; }
.wl-cta { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.wl-go, .wl-go2 { min-height: 54px; font-size: 16px; border-radius: 16px; }
.wl-go { box-shadow: 0 8px 22px rgba(194, 24, 91, .22); }
.wl-go2 { color: var(--peach-dark); font-weight: 600; }
.wl-doc { display: none; margin: 0; }
.wl-tools, .wl-story { padding-top: 32px; scroll-margin-top: 12px; }
.wl-tools h2, .wl-story h2 { font-size: 20px; }
.wl-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.wl-tool-grid { display: grid; gap: 10px; margin-top: 14px; }
.wl-tool { display: flex; gap: 14px; align-items: center; min-height: 72px; padding: 12px 16px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; border: 1px solid transparent; }
.wl-tool:hover { border-color: var(--peach); color: var(--ink); }
.wl-tool svg { flex: none; width: 44px; height: 44px; padding: 10px; border-radius: 50%; background: var(--peach-dark); fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wl-tool span { display: flex; flex-direction: column; line-height: 1.35; }
.wl-tool b { font-size: 15px; }
.wl-tool small { color: var(--muted); font-size: 13px; }
.wl-story-card { display: flex; flex-direction: column; margin-top: 14px; border-radius: 20px; overflow: hidden; background: var(--card); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.wl-story-card:hover { color: var(--ink); }
.wl-story-card img { width: 100%; height: auto; aspect-ratio: 16 / 11; object-fit: cover; object-position: 50% 75%; display: block; }
.wl-story-b { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.wl-story-b small { color: var(--peach-dark); font-weight: 600; font-size: 13px; }
.wl-story-b h3 { font-size: 18px; line-height: 1.35; }
.wl-story-b p { color: var(--ink-2); font-size: 14px; }
.wl-story-b blockquote { margin: 6px 0 0; padding: 10px 14px; border-left: 3px solid var(--peach); background: var(--bg); border-radius: 0 12px 12px 0; font-weight: 500; color: var(--peach-darker); }
.wl-story-b cite { display: block; font-style: normal; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.wl-story-more { font-weight: 600; color: var(--peach-dark); margin-top: 4px; }
.wl-note { font-size: 12px; color: var(--muted); margin-top: 10px; }
.wl-about { margin: 32px 0 8px; padding: 22px 20px; border-radius: 22px; background: var(--peach-tint); display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.wl-about-head { display: flex; gap: 12px; align-items: center; }
.wl-about-head img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: 50% 8%; background: #fff; }
.wl-about-head div { display: flex; flex-direction: column; line-height: 1.35; }
.wl-about-head span { color: var(--muted); font-size: 13px; }
.wl-about blockquote { margin: 0; font-size: 16px; line-height: 1.6; color: var(--peach-darker); font-weight: 500; }
.wl-cred { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }
.wl-cred li { padding-left: 18px; position: relative; }
.wl-cred li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 7px; height: 7px; border-radius: 50%; background: var(--peach); }
.wl-about-cta { min-height: 48px; padding: 0 24px; border-radius: 14px; }
.wl-foot { padding-top: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); margin-top: 24px; border-top: 1px solid var(--line); font-size: 14px; }
.wl-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 18px; }
.wl-links a { display: inline-flex; align-items: center; min-height: 44px; }

/* Nút nổi "Hỏi bác sĩ": ảnh bác sĩ + huy hiệu Zalo + lời chào (assets/fab.js) */
.fab-doc { position: fixed; z-index: 30; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; }
.fab-doc > * { pointer-events: auto; }
.fab-btn { position: relative; width: 60px; height: 60px; border-radius: 50%; border: 3px solid #fff; background: var(--peach-tint); box-shadow: 0 6px 20px rgba(194, 24, 91, .28); display: block; }
.fab-btn img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 8%; display: block; }
.fab-btn i { position: absolute; right: -6px; bottom: -4px; height: 22px; padding: 0 6px; border-radius: 999px; background: #0068FF; color: #fff; border: 2px solid #fff; font-style: normal; font-size: 10px; font-weight: 700; display: flex; align-items: center; }
.fab-btn:hover { transform: translateY(-2px); }
.fab-tip { position: relative; max-width: 230px; background: var(--card); border-radius: 16px 16px 4px 16px; box-shadow: 0 10px 28px rgba(43, 33, 37, .16); padding: 12px 34px 12px 14px; font-size: 14px; line-height: 1.45; opacity: 0; transform: translateY(8px) scale(.96); transform-origin: bottom right; visibility: hidden; transition: opacity .25s, transform .25s, visibility .25s; }
.fab-tip.on { opacity: 1; transform: none; visibility: visible; }
.fab-tip a { color: var(--ink); text-decoration: none; font-weight: 500; }
.fab-x { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border: 0; background: none; color: var(--muted); border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.fab-x:hover { background: var(--soft); }

@media (min-width: 720px) {
  .wl-hero h1 { font-size: 36px; }
  .wl-cta { flex-direction: row; }
  .wl-go, .wl-go2 { padding: 0 24px; }
  .wl-tool-grid { grid-template-columns: repeat(4, 1fr); }
  .wl-tool { flex-direction: column; align-items: flex-start; padding: 18px; }
  .wl-story-card { flex-direction: row; }
  .wl-story-card img { width: 46%; height: auto; aspect-ratio: 4 / 3; }
  .wl-story-b { padding: 24px 28px; justify-content: center; }
  .wl-story-b h3 { font-size: 22px; }
}
@media (min-width: 900px) {
  .wl-top { padding-top: 20px; }
  .wl-hero { grid-template-columns: 1.2fr .8fr; gap: 48px; padding: 36px 0 8px; }
  .wl-hero h1 { font-size: 42px; }
  .wl-lead { font-size: 18px; }
  .wl-doc { display: block; }
  .wl-photo { border-radius: 28px; overflow: hidden; aspect-ratio: 4 / 4.2; background: var(--peach-tint); box-shadow: var(--shadow); }
  .wl-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; display: block; }
  .wl-about { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px 40px; padding: 32px 36px; align-items: start; }
  .wl-about blockquote { grid-column: 1; font-size: 19px; }
  .wl-about-head { grid-column: 1; }
  .wl-cred { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .wl-about-cta { grid-column: 2; justify-self: start; }
}

/* Trang Theo dõi chu kỳ (/chu-ky/) */
.ck { max-width: 640px; display: flex; flex-direction: column; gap: 14px; padding-top: 8px; }
.ck-head h1 { font-size: 26px; }
.ck-add { display: flex; flex-direction: column; gap: 12px; }
.ck-today { min-height: 54px; font-size: 16px; border-radius: 14px; }
.ck-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.ck-form .field { flex: 1 1 200px; }
.ck-good { background: var(--green-tint); color: var(--green-dark); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.ck-alert { background: var(--peach-tint); color: var(--peach-darker); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.ck-sum { display: flex; flex-direction: column; gap: 12px; }
.ck-big { display: flex; align-items: baseline; gap: 8px; }
.ck-big b { font-size: 40px; line-height: 1; color: var(--peach-dark); }
.ck-dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.ck-dl dt { font-size: 12px; color: var(--muted); }
.ck-dl dd { margin: 0; font-weight: 600; }
.ck-len { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ck-len input { width: 76px; text-align: center; }
.ck-cal { display: flex; flex-direction: column; gap: 14px; }
.ck-mh { font-weight: 600; margin-bottom: 6px; }
.ck-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.ck-wd span { font-size: 12px; color: var(--muted); }
.ck-d { font: inherit; font-size: 14px; height: 40px; border: 0; border-radius: 10px; background: none; color: var(--ink); cursor: pointer; }
.ck-d:hover { background: var(--soft); }
.ck-d.p { background: var(--peach-dark); color: #fff; font-weight: 600; }
.ck-d.pp { background: none; box-shadow: inset 0 0 0 2px var(--peach); color: var(--peach-darker); }
.ck-d.f { background: var(--green-tint); color: var(--green-dark); font-weight: 600; }
.ck-d.ov { background: var(--green); color: #fff; font-weight: 700; }
.ck-d.now { outline: 2px solid var(--ink); outline-offset: -2px; }
.ck-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); }
.ck-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 6px; vertical-align: -2px; }
.ck-legend i.p { background: var(--peach-dark); } .ck-legend i.pp { box-shadow: inset 0 0 0 2px var(--peach); } .ck-legend i.f { background: var(--green-tint); border: 1px solid #C5E0BD; } .ck-legend i.ov { background: var(--green); }
.ck-hist { list-style: none; padding: 0; margin: 10px 0; }
.ck-hist li { display: flex; justify-content: space-between; align-items: center; min-height: 40px; border-bottom: 1px solid var(--line); font-size: 14px; }
.ck details summary { cursor: pointer; min-height: 32px; }
.ck-tips { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.ck-tips ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.ck-src { font-size: 12px; color: var(--muted); }
.ck-src ol { padding-left: 18px; }
.ck-privacy { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.ck-privacy svg { flex: none; margin-top: 2px; }

/* ---- Bảng 509 đột biến & đối chiếu nguồn (assets/thal-table.js) ---- */
.th-vt-btn { align-self: flex-start; }
.th-legend { font-size: 13px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--card); }
.th-legend summary { cursor: pointer; font-weight: 600; color: var(--peach-dark); min-height: 28px; display: flex; align-items: center; }
.th-legend dl { margin: 8px 0 4px; display: grid; gap: 6px; }
.th-legend dl > div { display: grid; grid-template-columns: 150px 1fr; gap: 10px; }
.th-legend dt { font-weight: 700; }
.th-legend dd { margin: 0; color: var(--ink-2); line-height: 1.45; }
.th-legend p { margin: 4px 0 0; }
@media (max-width: 600px) { .th-legend dl > div { grid-template-columns: 1fr; gap: 0; } }
dialog.th-vt { width: min(1180px, 100vw); max-width: 100vw; height: min(94dvh, 100dvh); max-height: 100dvh; padding: 0 16px 12px; border: 0; border-radius: 16px; background: var(--card); display: flex; flex-direction: column; overflow: hidden; }
dialog.th-vt:not([open]) { display: none; }
dialog.th-vt::backdrop { background: rgba(0,0,0,.4); }
@media (max-width: 600px) { dialog.th-vt { width: 100vw; height: 100dvh; border-radius: 0; padding: 0 10px 10px; } }
.th-vt .th-zoom-bar { position: static; padding: 10px 0; }
.vt-tools { display: flex; flex-direction: column; gap: 8px; }
.vt-tools input { max-width: 360px; }
.vt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.vt-chips small { opacity: .7; margin-left: 2px; }
.vt-tools p { margin: 0; }
.vt-wrap { flex: 1; overflow: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; }
.vt-wrap table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 980px; font-size: 13px; }
.vt-wrap th { position: sticky; top: 0; z-index: 2; background: var(--soft); color: var(--ink-2); font-weight: 600; text-align: left; padding: 8px; }
.vt-wrap td { padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.vt-wrap td small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; word-break: break-word; }
.vt-wrap td a { color: var(--peach-dark); font-weight: 600; }
.vt-wrap .vt-no { color: var(--muted); width: 40px; }
.vt-wrap .vt-name { min-width: 190px; position: sticky; left: 0; background: var(--card); z-index: 1; }
.vt-wrap .vt-name i { font-style: normal; color: #D89A00; }
.vt-wrap .vt-note { min-width: 170px; }
.vt-wrap .vt-note > * { display: block; }
.vt-wrap .bad { color: var(--danger); }
.vt-wrap tr.conf td { background: #FFF6E5; }
.vt-count { margin: 6px 0 0; }
@media (max-width: 600px) { .vt-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; } .vt-chips .qchip { flex: none; } .vt-tools p { display: none; } .th-vt .th-zoom-bar b { font-size: 16px; } }

/* ---- Menu Công cụ (app bác sĩ): danh sách đánh số, bấm mở cửa sổ ---- */
.tool-list { display: flex; flex-direction: column; gap: 10px; }
.tool-item { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; font: inherit; color: var(--ink); border: 1px solid transparent; cursor: pointer; }
.tool-item:hover { border-color: var(--peach); }
.tool-no { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--peach-dark); color: #fff; font-weight: 700; font-size: 15px; }
.tool-tx { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tool-tx b { font-size: 16px; }
.tool-tx small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.tool-go { flex: none; color: var(--peach-dark); font-weight: 600; font-size: 14px; }
dialog.tool-dlg { width: min(860px, 100vw); max-width: 100vw; height: min(92dvh, 100dvh); max-height: 100dvh; padding: 0; border: 0; border-radius: 18px; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
dialog.tool-dlg:not([open]) { display: none; }
dialog.tool-dlg::backdrop { background: rgba(0,0,0,.4); }
.tool-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.tool-bar b { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.tool-bar .tool-no { width: 26px; height: 26px; font-size: 13px; }
.tool-body { flex: 1; overflow-y: auto; padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.tool-body.frame { padding: 0; overflow: hidden; }
.tool-body > .card > .row.between:first-child { justify-content: flex-end; }
.tool-body > .card > .row.between:first-child > h2 { display: none; }
.tool-frame { flex: 1; width: 100%; height: 100%; border: 0; background: var(--bg); }
@media (max-width: 600px) { dialog.tool-dlg { width: 100vw; height: 100dvh; border-radius: 0; } .tool-go { display: none; } }
/* Trang Thalassemia nhúng trong cửa sổ Công cụ */
.embed .wl-top, .embed .wl-foot, .embed .fab-doc, .embed .th-head, .embed .th-cta, .embed .th-c > a.btn, .embed .th-info > a.btn { display: none !important; }
.embed body.wl, .embed .th { padding-top: 0; }

/* ---- Sàng lọc Thalassemia (/thalassemia/) ---- */
.th { max-width: 1040px; display: flex; flex-direction: column; gap: 14px; padding-top: 8px; }
.th-head h1 { font-size: 26px; }
.th-head h1 span { font-weight: 500; color: var(--muted); }
.th-bar-top { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.th-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.th-seg { display: inline-flex; background: var(--soft); border-radius: 12px; padding: 3px; }
.th-seg button { font: inherit; font-size: 14px; font-weight: 600; min-height: 40px; padding: 0 16px; border: 0; border-radius: 10px; background: none; color: var(--ink-2); cursor: pointer; }
.th-seg button[aria-pressed="true"] { background: var(--card); color: var(--peach-dark); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.th-people { display: grid; gap: 14px; align-items: start; }
@media (min-width: 900px) { .th-people:not(.one) { grid-template-columns: 1fr 1fr; } .th-people.one { max-width: 640px; } }
.th-p { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.th-ph { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.th-ph h2 { font-size: 20px; margin: 0; }
.th-step { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.th-step > legend, .th-step > summary { font-weight: 600; font-size: 15px; padding: 0 4px; }
.th-step > summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; gap: 0; }
.th-step > legend b, .th-step > summary b, .th-opt-h b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--peach-dark); color: #fff; font-size: 12px; margin-right: 8px; }
.th-opt-h { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; min-height: 36px; cursor: pointer; }
.th-opt-h b { margin-right: 0; }
.th-opt-b { display: flex; flex-direction: column; gap: 10px; }
.th-opt-b[hidden] { display: none; }
.th-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
@media (max-width: 480px) { .th-p { padding: 16px 14px; } .th-step { padding: 8px 10px 10px; } }
.th-f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.th-in { position: relative; display: block; }
.th-in input { width: 100%; padding-right: 46px; font-size: 16px; }
.th-in i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12px; color: var(--muted); pointer-events: none; }
.th-in input.lo { border-color: var(--peach-dark); background: var(--peach-tint); color: var(--peach-darker); font-weight: 600; }
.th-chk { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; min-height: 36px; }
.th-chks { display: flex; flex-wrap: wrap; gap: 0 16px; }
.th-gene { display: grid; grid-template-columns: 48px 1fr 1fr; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; }
.th-combo { position: relative; min-width: 0; }
.th-combo input { width: 100%; font-size: 15px; text-overflow: ellipsis; }
.th-pop { position: absolute; z-index: 30; left: 0; top: calc(100% + 4px); width: max(100%, 300px); max-width: calc(100vw - 32px); max-height: 320px; overflow-y: auto; background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.14); padding: 4px; }
.th-combo[data-i="1"] .th-pop { left: auto; right: 0; }
.th-pop[hidden] { display: none; }
.th-pop button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; font: inherit; font-size: 14px; border: 0; background: none; color: var(--ink); padding: 8px 10px; border-radius: 8px; cursor: pointer; min-height: 44px; }
.th-pop button.on, .th-pop button:hover { background: var(--soft); }
.th-pop button b { font-weight: 600; }
.th-pop button i { font-style: normal; color: #D89A00; }
.th-pop button small { color: var(--muted); font-size: 12px; font-weight: 400; }
.th-pop button em { font-style: normal; color: #9A5B00; }
.th-pop button em.bad { color: var(--danger); }
.th-pop p { margin: 8px 10px; }
@media (max-width: 480px) { .th-gene { grid-template-columns: 1fr 1fr; } .th-gene span { grid-column: 1 / -1; } }
.th-paste textarea { width: 100%; font-size: 14px; margin-top: 6px; }
.th-res:empty { display: none; }
.th-res { border-top: 1px dashed var(--line-2); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.th-verdict { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; border-radius: 12px; padding: 10px 12px; background: var(--soft); font-size: 16px; line-height: 1.4; }
.th-verdict.ok { background: var(--green-tint); color: var(--green-dark); }
.th-verdict.warn, .th-verdict.mid { background: #FFF1DC; color: #7A4300; }
.th-verdict.carrier { background: var(--peach-tint); color: var(--peach-darker); }
.th-verdict.bad { background: #FDE2E1; color: #8A1C12; }
.th-pill { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; opacity: .85; }
.th-find, .th-warn { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.th-find li, .th-warn li { padding-left: 18px; position: relative; line-height: 1.45; }
.th-find li::before, .th-warn li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.th-find li.ok::before { background: var(--green); }
.th-find li.warn::before, .th-warn li::before { background: #E08A00; }
.th-find li.bad::before { background: var(--danger); }
.th-find li.info::before { background: var(--muted); }
.th-links { display: flex; flex-direction: column; gap: 4px; font-size: 13px; background: var(--soft); border-radius: 10px; padding: 8px 10px; }
.th-links a { color: var(--peach-dark); font-weight: 600; }
.cls-ep { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.th-mini { display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.th-mini:hover { box-shadow: 0 0 0 2px var(--peach) inset, var(--shadow); }
.th-mini .th-more { color: var(--peach-dark); font-weight: 600; }
.th-mini-row { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; }
dialog.th-detail { width: min(760px, 100vw); max-width: 100vw; max-height: 100dvh; padding: 12px 16px 20px; border: 0; border-radius: 16px; background: var(--card); overflow-y: auto; }
@media (max-width: 600px) { dialog.th-detail { width: 100vw; height: 100dvh; margin: 0; border-radius: 0; } }
dialog.th-detail::backdrop { background: rgba(0,0,0,.4); }
.th-dp { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.th-card .advice { align-items: flex-start; }
.chip.th-wrap { white-space: normal; height: auto; line-height: 1.35; padding-top: 4px; padding-bottom: 4px; align-self: flex-start; }
.th-dgs { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.th-dg { width: 100%; max-width: 520px; height: auto; display: block; font-family: inherit; }
.th-dg text { fill: var(--ink); font-size: 11px; }
.th-dg .dg-h { font-size: 15px; font-weight: 700; }
.th-dg .dg-sub { font-size: 10.5px; fill: var(--muted); }
.th-dg .dg-who { font-size: 11px; font-weight: 600; fill: var(--ink-2); }
.th-dg .dg-al rect { fill: #EEF5EB; stroke: #C5E0BD; }
.th-dg .dg-al.bad rect { fill: var(--peach-tint); stroke: var(--peach); }
.th-dg .dg-al text { font-size: 11px; font-weight: 600; }
.th-dg .dg-cell rect { stroke-width: 1.5; }
.th-dg .dg-p { font-size: 16px; font-weight: 700; }
.th-dg .dg-r { font-size: 11px; font-weight: 600; }
.th-dg .dg-t { font-size: 10px; fill: var(--ink-2); }
.th-dg .r0 rect { fill: #EEF5EB; stroke: #C5E0BD; } .th-dg .r0 .dg-kid { fill: var(--green); }
.th-dg .r1 rect { fill: var(--peach-tint); stroke: #F7B3CB; } .th-dg .r1 .dg-kid { fill: var(--peach); }
.th-dg .r2 rect { fill: #FFF6DE; stroke: #F2D58A; } .th-dg .r2 .dg-kid { fill: #F2B544; }
.th-dg .r3 rect { fill: #FFEBD6; stroke: #F1B276; } .th-dg .r3 .dg-kid { fill: #E07A00; }
.th-dg .r4 rect { fill: #FDE2E1; stroke: #F2A39E; } .th-dg .r4 .dg-kid { fill: var(--danger); }
.th-dg .r4 .dg-p, .th-dg .r4 .dg-r { fill: #8A1C12; }
.th-zoom-btn { align-self: flex-start; }
.th-dg-grid { display: flex; flex-direction: column; gap: 10px; }
dialog.th-zoom { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); border: 0; border-radius: 0; background: var(--card); overflow-y: auto; }
dialog.th-zoom::backdrop { background: rgba(0,0,0,.4); }
.th-zoom-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; position: sticky; top: -12px; background: var(--card); padding: 8px 0; z-index: 1; }
.th-zoom-bar b { font-size: 18px; }
.th-zoom .th-dg { max-width: none; }
.th-zoom .th-dgs { max-width: 1100px; margin: 0 auto; }
@media (orientation: landscape) and (min-width: 700px) { .th-zoom .th-dg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; } }
.th-dg-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink-2); }
.th-dg-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.th-scen { width: 100%; overflow-x: auto; }
.th-scen table { width: 100%; border-collapse: collapse; font-size: 13px; }
.th-scen th, .th-scen td { border-bottom: 1px solid var(--line); padding: 6px; text-align: left; vertical-align: top; }
.th-scen td small { display: block; color: var(--muted); font-size: 12px; }
.th-scen td.bad { color: var(--danger); font-weight: 700; }
.th-next { font-size: 14px; }
.th-next ol { margin: 6px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; line-height: 1.45; }
.th-c { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; border-top: 4px solid var(--line-2); }
.th-c h2 { font-size: 20px; margin: 0; }
.th-c.ok { border-top-color: var(--green); } .th-c.warn, .th-c.mid { border-top-color: #E08A00; } .th-c.bad { border-top-color: var(--danger); }
.th-c .th-verdict { font-size: 18px; width: 100%; }
.th-kids { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.th-gk { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.th-gn { font-size: 14px; }
.th-stack { display: flex; height: 18px; border-radius: 9px; overflow: hidden; gap: 2px; }
.th-kids ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.th-kids li { display: grid; grid-template-columns: 14px 56px 1fr; gap: 8px; align-items: baseline; font-size: 14px; }
.th-kids li i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.th-kids li b { font-size: 16px; text-align: right; }
.th-kids li small { display: block; color: var(--muted); font-size: 12px; }
.r0 { background: var(--green); } .r1 { background: var(--peach); } .r2 { background: #F2B544; } .r3 { background: #E07A00; } .r4 { background: var(--danger); }
.th-cta { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.th-cta small { color: var(--muted); font-size: 13px; }
.th-cite { font-size: 11px; line-height: 0; margin-left: 1px; }
.th-cite a { color: var(--peach-dark); text-decoration: none; font-weight: 600; }
.th-pc { font-size: 12px; color: var(--muted); font-style: italic; }
span.ev { cursor: default; vertical-align: 1px; }
#th-src li { margin-bottom: 4px; line-height: 1.5; }
.th-info ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.th-info h2 { font-size: 18px; margin: 4px 0 0; }
.th-info p { margin: 0; font-size: 14px; line-height: 1.55; }
@media print {
  .wl-top, .wl-foot, .fab-doc, .th-actions, .th-paste, .th-bar-top, .th-info, .ck-privacy, .ev, .th-c .btn { display: none !important; }
  #th-src summary { list-style: none; font-weight: 600; }
  body.wl { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .th-opt:has(.th-opt-b[hidden]) { display: none; }
}

/* Chân trang: hàng biểu tượng liên hệ */
.wl-social { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.wl-social a { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 60px; padding: 6px 0; font-size: 12px; color: var(--ink-2); text-decoration: none; text-align: center; line-height: 1.25; }
.wl-social a:hover { color: var(--peach-dark); }
.wl-social i { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-style: normal; transition: transform .15s; }
.wl-social a:hover i { transform: translateY(-2px); }
.wl-social svg { width: 24px; height: 24px; }
.wl-social b { font-size: 13px; letter-spacing: .01em; }
.s-call i { background: var(--green); }
.s-zalo i { background: #0068FF; }
.s-fb i { background: #1877F2; }
.s-group i { background: var(--peach-dark); }
.s-tt i { background: #111; }
/* Kết quả chính: bấm ô để điền / sửa */
.key-cell { all: unset; box-sizing: border-box; display: block; width: 100%; min-height: 32px; padding: 4px 6px; margin: -4px -6px; border-radius: 8px; cursor: pointer; text-align: left; }
.key-cell:hover { background: var(--soft); }
.key-cell:focus-visible { outline: 2px solid var(--peach); outline-offset: 1px; }
/* Danh mục thuốc chia nhóm */
.drug-grp { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
/* Siêu âm nang: nút bấm nhanh kích thước, dòng AFC */
.qchip.sm { min-height: 34px; padding: 0 10px; min-width: 40px; }
.scan-quick { border: 1px dashed var(--line-2); border-radius: 12px; padding: 10px 12px; }
.scan-table tr.scan-afc td { background: var(--soft); }
.scan-table tr.scan-sub td { padding-top: 0; border-top: none; }
.scan-table tr.scan-sub input { width: 100%; }
/* Chu kỳ IVF theo lần khám (1.14.0) */
.pills { gap: 4px; flex-wrap: wrap; align-items: center; }
.pill { all: unset; box-sizing: border-box; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--soft); color: var(--ink-2); cursor: pointer; }
span.pill { cursor: default; }
.pill .muted { font-size: 12px; }
.pill.ok { background: var(--green-tint); color: var(--green-dark); }
.pill.cur { background: var(--peach-tint); color: var(--peach-darker); font-weight: 600; outline: 1px solid var(--peach); }
.pill:focus-visible { outline: 2px solid var(--peach); }
.pill-sep { color: var(--muted); font-size: 13px; }
.visits { gap: 8px; }
.visit { border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 14px; background: var(--card); }
.visit.done { background: var(--bg); }
.visit.open { border: 2px solid var(--peach); gap: 8px; }
.vline { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.vlab { font-size: 13px; color: var(--muted); min-width: 74px; padding-top: 8px; }
.vline input { min-height: 38px; }
.qchip.xs { min-height: 30px; padding: 0 8px; min-width: 34px; font-size: 12px; }
.vquick summary { cursor: pointer; color: var(--muted); }
.vquick > div { margin-top: 6px; }
.hv { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
.qchip.sug { border-color: var(--peach); border-style: dashed; color: var(--peach-darker); }

/* Điện thoại, iPad dựng: bảng siêu âm nang / lịch thuốc thành thẻ, không phải vuốt ngang */
@media (max-width: 820px) {
  .table-wrap:has(> .table-cards) { overflow: visible; }
  .table-cards, .table-cards tbody { display: block; width: 100%; min-width: 0; }
  .table-cards thead { display: none; }
  .table-cards tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .table-cards td { display: block; padding: 0; border: none; min-width: 0; }
  .table-cards td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
  .table-cards td.full { grid-column: 1 / -1; }
  .table-cards td.td-pad { display: none; }
  .table-cards td.td-del { text-align: right; }
  .table-cards input, .table-cards select { width: 100%; min-width: 0 !important; max-width: none !important; }
  .scan-table tr:not(.scan-sub) { border-bottom: none; padding-bottom: 0; }
  .scan-table tr.scan-sub { padding-top: 6px; }
  .med-table tr.today { box-shadow: inset 3px 0 0 var(--peach); padding-left: 10px; }
  .med-table tr.today td:first-child { box-shadow: none; }
  .scan-table tr.scan-afc { background: var(--soft); border-radius: 10px; padding-left: 8px; padding-right: 8px; }
  .scan-table tr.scan-afc td { background: none; }
}

/* Máy cảm ứng (điện thoại, iPad): nút tối thiểu 40px cho dễ chạm; máy tính dùng chuột giữ gọn */
@media (pointer: coarse) {
  .btn.small { min-height: 40px; }
  .x { min-width: 40px; min-height: 40px; }
  .cls-star, .cls-sheet .cls-star { min-width: 40px; min-height: 40px; }
  .key-cell { min-height: 40px; }
  a.chip, button.chip { min-height: 40px; padding: 0 14px; font-size: 13px; }
  .qchip, .qchip.sm { min-height: 40px; }
  input[type=radio] { width: 22px; height: 22px; }
  details > summary.small { padding: 10px 0; }
  .tool-sec > summary { min-height: 44px; }
  .pill { min-height: 40px; }
}

/* Điện thoại: bảng Kết quả chính – tên mục 1 dòng riêng, vợ / chồng 2 cột rộng */
@media (max-width: 600px) {
  .key-table, .key-table thead, .key-table tbody { display: block; width: 100%; }
  .key-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--soft); }
  .key-table th, .key-table td { display: block; padding: 0; border: none; }
  .key-table th:first-child { display: none; }
  .key-table td:first-child { grid-column: 1 / -1; font-weight: 600; font-size: 13px; color: var(--muted); }
  .table-wrap:has(> .key-table) { overflow: visible; }
  .rec-tabs { gap: 4px; padding: 6px 0; }
  .rec-tabs a { min-height: 36px; padding: 6px 11px; font-size: 14px; }
}

/* Trang bệnh nhân: chữ to, nút to (BS Tùng chọn 23/10/2026) */
.p-app { font-size: 17px; }
.p-app .small { font-size: 15px; }
.p-app .chip { font-size: 14px; padding: 5px 12px; }
.p-app .btn { min-height: 50px; font-size: 16px; }
.p-app .btn.small { min-height: 44px; font-size: 15px; }
.p-app h2 { font-size: 20px; }
.p-app input, .p-app select, .p-app textarea { font-size: 17px; }
.p-app details > summary { min-height: 44px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.here { border: 2px solid var(--green); }
.here .here-now { font-size: 24px; line-height: 1.25; color: var(--peach-darker); }
.here .here-when { font-weight: 600; margin-top: 2px; }
.here .here-next { background: var(--bg); border-radius: 12px; padding: 10px 14px; }
.here-all > summary { color: var(--peach-dark); font-weight: 600; font-size: 15px; }
.p-app details > summary { list-style: none; }
.p-app details > summary::-webkit-details-marker { display: none; }
.p-app details > summary::before { content: '›'; font-size: 22px; line-height: 1; color: var(--peach-dark); transition: transform .15s; }
.p-app details[open] > summary::before { transform: rotate(90deg); }

/* Tóm tắt nhanh: phần gập (Điều trị trước, Kết quả chính) – 1.17.1 */
.sum-fold > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; list-style: none; }
.sum-fold > summary::-webkit-details-marker { display: none; }
.sum-fold > summary::before { content: '›'; font-size: 20px; line-height: 1; color: var(--muted); transition: transform .15s; }
.sum-fold[open] > summary::before { transform: rotate(90deg); }
.tile-btn { border: 0; text-align: left; cursor: pointer; font: inherit; display: flex; flex-direction: column; }
.tile-btn:hover { filter: brightness(.97); }
.drug-more > summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; color: var(--peach-darker); }

/* Ngân hàng phôi theo top – 1.18.0 */
.tops-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.top-li { display: grid; grid-template-columns: 52px minmax(0, 1fr) 30px minmax(0, auto); gap: 2px 10px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); }
.top-li:first-child { border-top: 0; }
.top-li .top-p { grid-column: 2 / -1; color: var(--ink-2); }
.top-li.top-used { color: var(--muted); background: var(--bg); }
.top-li.top-bad .top-g, .top-li.top-bad .top-p, .top-pick.top-bad { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.top-row { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.top-row.top-used { background: var(--bg); }
.top-row select, .top-row input { min-height: 38px; padding: 4px 8px; }
.top-no { min-width: 48px; }
/* Bệnh nhân: phiếu phôi trữ như phiếu labo */
.top-card { width: 100%; border-collapse: collapse; background: #FCE4EC; border-radius: 10px; overflow: hidden; font-size: 17px; }
.top-card th, .top-card td { border: 1px solid #F3B5C9; padding: 8px 10px; text-align: center; }
.top-card th { font-weight: 700; }
.top-li .top-s .chip { white-space: normal; text-align: center; }

/* Thống kê – 1.19.0 */
.stat-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stat-table th, .stat-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.stat-table td:first-child { white-space: normal; min-width: 180px; }
.stat-table th { font-size: 13px; color: var(--muted); font-weight: 600; }
.skel { background: linear-gradient(90deg, var(--bg) 25%, #fff 50%, var(--bg) 75%); background-size: 200% 100%; animation: skel 1.2s infinite; }
@keyframes skel { to { background-position: -200% 0; } }

/* Trang Hôm nay – lịch khám: bấm tên mở hồ sơ, Đã khám / Đổi lịch tại chỗ */
.appt-bar { height: 6px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.appt-bar span { display: block; height: 100%; background: var(--green); transition: width .3s; }
.appt-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 12px 8px; margin: 0 -8px; border-top: 1px solid var(--soft); border-radius: 12px; }
.appt-row:first-child { border-top: none; }
.appt-row .t { font-weight: 700; font-size: 18px; }
.appt-row .who { color: inherit; text-decoration: none; min-width: 0; }
.appt-row .who:hover .bold { color: var(--peach-dark); text-decoration: underline; }
.appt-row .acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.appt-row.next { background: var(--peach-tint); border-top-color: transparent; }
.appt-row.done .t, .appt-row.done .who { opacity: .55; }
@media (max-width: 600px) {
  .appt-row { grid-template-columns: 48px 1fr; }
  .appt-row .acts { grid-column: 1 / -1; }
  .appt-row .acts .btn:not(.link):not(.icon-btn) { flex: 1; white-space: nowrap; }
}

/* Dải "Hiện tại" đầu tab Hành trình – 1.20.1 */
.now-strip { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--green-tint); border: 1px solid rgba(46,125,50,.18); border-radius: 14px; padding: 12px 16px; }
div.now-strip { cursor: default; }
.now-row { font-size: 15px; line-height: 1.45; }
.now-k { font-size: 12px; font-weight: 700; color: var(--green-dark); text-transform: uppercase; letter-spacing: .02em; }
.now-meds { display: inline-block; font-size: 13px; color: var(--ink-2); background: #fff; border-radius: 8px; padding: 1px 8px; margin-left: 4px; }
.now-warn { color: var(--danger); font-size: 14px; font-weight: 600; }
.day-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.day-nav > span { min-width: 170px; text-align: center; }
.day-nav .btn:not(.link) { min-width: 44px; font-size: 20px; padding: 0 10px; }
#today-sched { transition: opacity .15s; }
.btn.icon-btn { padding: 0 10px; color: var(--peach-dark); }
.proc-card.done .proc-body { opacity: .55; }
/* Thẻ thủ thuật trang Hôm nay (bản 1.27.0): ô tích đã làm + bấm thẻ mở khung nhập kết quả */
.proc-tick { flex: none; width: 36px; height: 36px; margin-top: 2px; border-radius: 10px; border: 2px solid var(--peach); background: #fff; color: #fff; font: 700 20px/1 inherit; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.proc-tick:hover { background: var(--peach-tint); }
.proc-tick.on { background: var(--green); border-color: var(--green); }
.proc-tick:disabled { cursor: default; }
.proc-body { display: flex; gap: 6px; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.proc-card.open { grid-column: 1 / -1; }
.proc-res { border-top: 1px dashed var(--line-2); padding-top: 10px; }
.flash { animation: flash 1.6s ease-out 2; border-radius: 10px; }
@keyframes flash { 0% { box-shadow: 0 0 0 4px var(--peach); } 100% { box-shadow: 0 0 0 4px transparent; } }
.day-nav [hidden] { display: none; }

/* Thông báo: chuông (điện thoại: nút nổi góc trên phải; máy tính: mục "Thông báo" ở menu trái) */
.bell-fab { display: none; }
@media (max-width: 820px) {
  .bell-fab { display: flex; position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 25; width: 44px; height: 44px; border-radius: 999px;
    align-items: center; justify-content: center; background: #fff; color: var(--ink); box-shadow: 0 2px 10px rgba(0,0,0,.12); text-decoration: none; }
  .bell-fab.hidden { display: none; }
  .bell-fab .badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--danger, #D32F2F); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
  .bell-fab .badge[hidden] { display: none; }
  .main > :first-child { padding-right: 52px; } /* chừa chỗ cho chuông */
}
.notif { display: flex; gap: 12px; align-items: flex-start; padding: 12px 10px; border-radius: 12px; text-decoration: none; color: inherit; }
.notif + .notif { margin-top: 2px; }
.notif:hover { background: var(--bg); }
.notif.unread { background: var(--peach-tint); }
.notif .ic { width: 40px; height: 40px; flex: none; border-radius: 999px; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: 0 0 0 1px var(--line); }
.notif .t { display: block; font-weight: 500; }
.notif.unread .t { font-weight: 700; }
.notif .b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; color: var(--ink-2); white-space: pre-line; }
.notif .w { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.notif.unread .w { color: var(--peach-dark); font-weight: 600; }
.notif .dot { width: 10px; height: 10px; border-radius: 999px; background: var(--peach-dark); flex: none; margin-top: 6px; }
.nset-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--soft); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: none; background: #fff; padding: 8px 12px; font: inherit; font-size: 13px; cursor: pointer; min-height: 36px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--peach-dark); color: #fff; font-weight: 600; }

/* Mượt mà (1.21.2): thanh chờ mảnh trên cùng, khung xương lúc mở app, dải "Đã có bản mới" */
#busy-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1000; pointer-events: none; opacity: 0; transition: opacity .2s; overflow: hidden; }
#busy-bar.on { opacity: 1; }
#busy-bar::before { content: ''; position: absolute; top: 0; bottom: 0; width: 40%; background: var(--peach); border-radius: 3px; animation: busy 1s ease-in-out infinite; }
@keyframes busy { from { left: -40%; } to { left: 100%; } }
.skel-page { display: grid; gap: 14px; }
.skel-page i { display: block; border-radius: var(--radius); }
.skel-page .s-h { height: 30px; width: 55%; border-radius: 10px; }
.skel-page .s-c { height: 120px; }
.skel-page .s-c2 { height: 220px; }
.upd-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 900; display: flex; gap: 10px; align-items: center; background: var(--ink); color: #fff; padding: 8px 8px 8px 16px; border-radius: 999px; box-shadow: var(--shadow); font-size: 14px; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { #busy-bar::before, .skel { animation: none; } }

/* Thẻ tiêm trigger (bản 1.25.0): chọn phác đồ bằng 4 ô lớn, lịch mũi tiêm + giờ chọc trứng */
.trig-regs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; flex: 1 1 100%; }
.trig-reg { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink-2); font: inherit; cursor: pointer; min-height: 44px; }
.trig-reg span { font-size: 12px; color: var(--muted); line-height: 1.3; }
.trig-reg:hover { border-color: var(--peach); }
.trig-reg.on { background: var(--peach-tint); border: 2px solid var(--peach); color: var(--peach-darker); }
.trig-plan { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--peach-tint); font-size: 14px; margin: 6px 0; }
.trig-shot { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-bottom: 1px dashed var(--line-2); }
.trig-shot:last-of-type { border-bottom: 0; }
/* Vào khám từ trang Hôm nay (bản 1.27.0): dải "Đang khám" đầu hồ sơ */
.kham-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: var(--peach-tint); border: 1px solid var(--peach); }
.kham-bar.ok { background: var(--green-tint); border-color: var(--green); color: var(--green-dark); }
.cycle-tools .visit.open, .cycle-tools { scroll-margin-top: 120px; }

/* Thông tin quan trọng ★ (bản 1.31.0): dấu sao ở Khám ban đầu / Cận lâm sàng → ô bấm được ở đầu tab Hành trình */
.has-star { position: relative; }
.star-btn { position: absolute; top: 0; right: 0; z-index: 1; width: 34px; height: 34px; border: 0; background: none; font-size: 21px; line-height: 1; color: var(--muted); cursor: pointer; border-radius: 8px; }
.star-btn:hover { background: var(--peach-tint); color: var(--peach-dark); }
.star-btn.on { color: #E0A100; }
.star-strip { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: #FFF8E5; border: 1px solid #F1D98B; }
.star-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.star-chip { display: inline-block; max-width: 100%; padding: 4px 10px; border-radius: 999px; background: #fff; border: 1px solid #F1D98B; color: var(--ink); font-size: 13px; line-height: 1.35; text-decoration: none; }
.star-chip b { font-weight: 600; color: var(--ink-2); }
.star-chip.bad { border-color: var(--danger); color: var(--danger); }
.star-chip.bad b { color: var(--danger); }
.star-chip:hover { background: var(--peach-tint); }
.star-more summary { cursor: pointer; color: var(--peach-dark); }
.star-more .star-chips { margin-top: 6px; }

/* Kết quả IVF chia chặng + từng phôi (bản 1.36.0) */
.lab-sec { margin: 14px 0 4px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 14px; color: var(--peach-darker); }
.emb-box { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.emb-row .top-no { min-width: 58px; }
.emb-row.top-bad { background: #fafafa; }
.seg-mini { display: inline-flex; gap: 4px; margin-left: auto; }
input[data-auto] { background: var(--green-tint, #eef7ef); color: var(--ink); }
.emb-row select, .emb-row input { width: auto; flex: 0 0 auto; }
@media (max-width: 560px) { .seg-mini { margin-left: 0; } }
/* BMI, khuyến cáo, theo dõi cân nặng */
.bmi-box { display: flex; flex-direction: column; gap: 6px; }
.bmi-box .advice.warn-soft { background: #FFF4E5; }
.bmi-ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.wlog-add { display: flex; gap: 8px; align-items: center; }
.wlog-add input { flex: 1; min-width: 0; }
.wlog-list { display: flex; flex-direction: column; gap: 2px; }
.wlog-row { display: flex; gap: 10px; align-items: center; }
.wlog-row > span:first-child { min-width: 84px; color: var(--muted); }
.wlog-goal { font-weight: 600; color: var(--danger); }
.wlog-goal.ok { color: var(--green-dark); }
.wl-up { color: var(--danger); } .wl-down { color: var(--green-dark); }
.wl-del { background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 8px; cursor: pointer; margin-left: auto; }

/* ---- Trang bệnh nhân v1.36: đếm ngày, việc hôm nay, màn chào, cài app gọn ---- */
.hero-count { display: flex; align-items: center; gap: 18px; padding: 18px; }
.hero-ring { position: relative; width: 128px; height: 128px; flex: none; }
.hero-n { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--peach-dark); line-height: 1; }
.hero-n b { font-size: 40px; font-weight: 700; }
.hero-n span { font-size: 14px; margin-top: 2px; }
.hero-big { font-size: 24px; font-weight: 700; color: var(--peach-darker, var(--peach-dark)); line-height: 1.2; }
@media (max-width: 360px) { .hero-count { gap: 12px; padding: 14px; } .hero-ring, .hero-ring svg { width: 104px; height: 104px; } .hero-n b { font-size: 32px; } }
.med-tick { flex: none; width: 44px; height: 44px; border-radius: 22px; border: 2px solid var(--line-2, #EBD3DE); background: #fff; color: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.med-tick.on { background: var(--green-dark, #3F6B34); border-color: var(--green-dark, #3F6B34); color: #fff; }
.med-done .med-name { text-decoration: line-through; color: var(--muted); }
.med-done .med-time { color: var(--muted); }
.intro { min-height: 100vh; min-height: 100dvh; display: flex; background: var(--bg, #FFF7FA); }
.intro-slide { flex: 1; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; padding: calc(16px + env(safe-area-inset-top)) 22px calc(22px + env(safe-area-inset-bottom)); }
.intro-top { display: flex; justify-content: space-between; min-height: 44px; }
.intro-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; font-size: 18px; line-height: 1.6; }
.intro-body h1 { font-size: 30px; line-height: 1.25; margin: 0; }
.intro-body p { margin: 0; }
.intro-splash .intro-body { align-items: center; text-align: center; }
.intro-splash .intro-body h1 { color: var(--peach-dark); }
.intro-avatar { width: 64px; height: 64px; border-radius: 32px; background: var(--peach-tint); color: var(--peach-dark); font-weight: 700; font-size: 22px; display: flex; align-items: center; justify-content: center; }
.intro-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.intro-list li { display: flex; gap: 14px; align-items: flex-start; background: #fff; border-radius: 18px; padding: 14px 16px; font-size: 16px; line-height: 1.5; box-shadow: 0 1px 3px rgba(194, 24, 91, .06); }
.intro-list svg { flex: none; color: var(--peach-dark); margin-top: 2px; }
.intro-foot { display: flex; flex-direction: column; gap: 18px; align-items: center; }
.intro-dots { display: flex; gap: 8px; }
.intro-dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--line-2, #EBD3DE); transition: width .2s; }
.intro-dots i.on { width: 24px; background: var(--peach-dark); }
.consent-shield { width: 76px; height: 76px; border-radius: 38px; margin: 4px auto 6px; background: var(--peach-tint); color: var(--peach-dark); display: flex; align-items: center; justify-content: center; }
.install-mini { display: flex; align-items: center; gap: 4px; background: #fff; border-radius: 14px; border: 1px solid var(--line, #F5E1E9); }
.install-mini-go { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 12px; background: none; border: 0; font: inherit; font-size: 15px; color: var(--ink, #2B2125); text-align: left; cursor: pointer; }
.install-mini-go img { border-radius: 7px; }
.install-mini-x { width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 16px; cursor: pointer; }

/* ---- Bản 1.37.0: gọn hồ sơ và trang Hôm nay trên điện thoại ---- */
/* Đầu hồ sơ: nút phụ (Thủ thuật, Nhắn, Xuất tóm tắt, Thư mục marketing) – máy tính hiện thẳng, điện thoại gom vào "⋯ Thêm" */
.rec-more { display: none; position: relative; }
.rec-more > summary { list-style: none; cursor: pointer; }
.rec-more > summary::-webkit-details-marker { display: none; }
.rec-more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px; padding: 8px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 8px 28px rgba(43, 33, 37, 0.16); }
.rec-more-menu .btn { justify-content: flex-start; width: 100%; }
/* Lần siêu âm cũ gập 1 dòng (chỉ điện thoại / iPad dựng) */
.scan-brief-row { display: none; }
.scan-brief { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; font-size: 14px; color: var(--ink); text-align: left; cursor: pointer; }
.scan-brief .scan-edit { margin-left: auto; color: var(--peach-darker); font-weight: 600; }
@media (max-width: 820px) {
  .scan-brief-row:not(.hidden-row) { display: block; padding: 6px 0; border-bottom: none !important; }
  .scan-brief-row td { display: block; padding: 0; border: none; }
  .scan-table tr.scan-old:not(.open) { display: none; }
  .scan-table tr:not(.scan-sub):not(.scan-brief-row) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scan-table td[data-label="Ngày"] { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .rec-actions { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 8px; width: 100%; }
  .rec-actions > .rec-sec, .rec-actions > .rec-newcy { display: none; }
  .rec-actions .btn, .rec-more > summary { min-height: 44px; }
  /* Tab Ảnh, Tin nhắn nằm trong "⋯ Thêm" (bản 1.42.0) để 5 tab chính vừa bề ngang; đang mở tab đó thì vẫn hiện */
  .rec-tabs a.t-extra:not(.on) { display: none; }
  .rec-tabs a { min-height: 44px; padding: 6px 3px; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; flex: 1 1 auto; white-space: nowrap; }
  .rec-more { display: block; }
  .rec-more > summary { min-height: 42px; padding: 0 14px; white-space: nowrap; }
  /* Tab hồ sơ: 1 hàng kéo ngang (trước là 2 hàng), luôn dính trên cùng */
  .rec-tabs { flex-wrap: nowrap; overflow-x: auto; padding: 6px 0; gap: 4px; }
  /* Thông tin quan trọng: mỗi mục 1 dòng, dài thì cắt "…" */
  .star-chips .chip, .star-chips a, .star-chips button { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
  .sum-phone > summary { list-style: none; cursor: pointer; flex-wrap: nowrap; }
  .sum-phone > summary::-webkit-details-marker { display: none; }
  .sum-phone > summary h2::before { content: '› '; color: var(--peach-dark); }
  .sum-phone[open] > summary h2::before { content: '⌄ '; }
  .sum-phone:not([open]) { padding-top: 12px; padding-bottom: 12px; gap: 0; }
  .sum-phone > summary { align-items: center; }
  /* Trang Hôm nay: thủ thuật + lịch khám → việc cần bác sĩ xem → câu hỏi, sắp tới */
  #today-sched { display: contents; }
  #today-sched > .c2 { order: 3; }
  #today-help, #today-regs, #today-review, #today-follow, #today-req { order: 2; }
}
/* Dòng thời gian cả hành trình (đầu tab Hành trình) */
.journey { display: flex; flex-direction: column; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.jn-list { display: flex; gap: 0; margin: 0; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: thin; }
.jn { flex: 1 0 104px; position: relative; min-width: 104px; }
.jn::before { content: ''; position: absolute; top: 15px; left: 0; right: 0; height: 3px; background: var(--line-2); }
.jn:first-child::before { left: 50%; }
.jn:last-child::before { right: 50%; }
.jn.done::before, .jn.win::before, .jn.stop::before, .jn.now::before { background: var(--peach); }
.jn-b { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; width: 100%; padding: 6px 4px 4px; border: none; background: none; font: inherit; color: inherit; text-align: center; cursor: pointer; border-radius: 10px; }
button.jn-b:hover { background: var(--peach-tint); }
.jn-dot { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--peach); margin-bottom: 4px; }
.jn.done .jn-dot { background: var(--peach); }
.jn.now .jn-dot { background: #fff; border-color: var(--peach-dark); box-shadow: 0 0 0 4px var(--peach-tint); }
.jn.win .jn-dot { background: var(--green-dark, #3F6B34); border-color: var(--green-dark, #3F6B34); }
.jn.stop .jn-dot { background: #fff; border-color: var(--muted); }
.jn.goal .jn-dot { border-style: dashed; border-color: var(--green-dark, #3F6B34); }
.jn-t { font-size: 13px; font-weight: 600; line-height: 1.25; }
.jn-d { font-size: 12px; color: var(--muted); }
.jn-r { font-size: 12px; line-height: 1.25; color: var(--ink-2); }
.jn.win .jn-r { color: var(--green-dark, #3F6B34); font-weight: 600; }
.jn.now .jn-r { color: var(--peach-darker); font-weight: 600; }
.jn.goal .jn-t { color: var(--green-dark, #3F6B34); }
@media (max-width: 600px) { .journey { padding: 10px 10px; } .jn { flex-basis: 92px; min-width: 92px; } }
/* Mốc khám thai (bản 1.37.0) */
.thai-mark { display: grid; grid-template-columns: auto auto 1fr auto; gap: 6px 10px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--soft); font-size: 14px; }
.thai-mark .tm-box { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line-2); background: #fff; color: #fff; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.thai-mark .tm-box.on { background: var(--green-dark, #3F6B34); border-color: var(--green-dark, #3F6B34); }
.thai-mark .tm-wk { min-width: 86px; justify-content: center; }
.thai-mark .tm-d { font-size: 13px; color: var(--muted); white-space: nowrap; }
.thai-mark.now { background: var(--green-tint, #E8F3E3); border-radius: 10px; }
.thai-mark.now .tm-t { font-weight: 600; }
.thai-mark.late .tm-wk { background: #FDE2E1; color: var(--danger); }
.thai-mark.done .tm-t { color: var(--muted); }
.thai-mark.pending { opacity: 0.6; }
.thai-mark.pending .tm-box { border-style: dashed; cursor: default; }
.thai-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.thai-chart { margin: 0; background: var(--bg); border-radius: 12px; padding: 8px 10px; }
.thai-chart svg { width: 100%; height: auto; display: block; }
@media (max-width: 600px) {
  .thai-mark { grid-template-columns: auto auto 1fr; gap: 4px 8px; }
  .thai-mark .tm-box { grid-row: 1 / span 2; align-self: start; }
  .thai-mark .tm-wk { grid-column: 2; grid-row: 1; min-width: 0; }
  .thai-mark .tm-d { grid-column: 3; grid-row: 1; justify-self: end; }
  .thai-mark .tm-t { grid-column: 2 / -1; grid-row: 2; }
}

/* Nguyên nhân vô sinh (bản 1.37.0): gợi ý = viền đứt, bấm để chọn / bỏ */
.cause-box { border-top: 1px solid var(--line-2); padding-top: 10px; }
.qchip.cause.suggest { border-style: dashed; }
.qchip.cause.suggest-new { border-style: dashed; border-color: var(--peach); }

/* Bản 1.40.0: điện thoại – ô nhập chữ 16px (iPhone không tự phóng to khi chạm), chuông không che tab hồ sơ */
@media (max-width: 820px) {
  .main input, .main select, .main textarea, dialog input, dialog select, dialog textarea { font-size: 16px; }
  .bell-fab { transition: opacity .15s; }
  body.scrolled:has(.rec-tabs) .bell-fab { opacity: 0; pointer-events: none; }
}
#today-search input { min-height: 48px; }
/* Bản 1.40.0 – trang bệnh nhân: ô tích theo từng lần dùng thuốc, chấm trả lời mới, màn đồng ý tách dòng, thẻ gập */
.med-multi { flex-wrap: wrap; }
.med-slots { display: flex; gap: 14px; width: 100%; padding-left: 64px; }
.med-slots label { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; color: var(--muted); }
.p-nav a { position: relative; }
.p-dot { position: absolute; top: 6px; left: calc(50% + 8px); width: 10px; height: 10px; border-radius: 5px; background: var(--danger, #D32F2F); border: 2px solid #fff; box-sizing: content-box; }
.consent-pt { display: block; margin-top: 8px; }
.p-fold > summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }

/* ---- Phiếu khám của 1 lượt (bản 1.42.0): lưới ô việc + các mục gập ---- */
.pk-badge { display: inline-flex; width: 48px; height: 48px; border-radius: 14px; background: var(--peach-tint, #FDE3EE); align-items: center; justify-content: center; font-size: 24px; flex: none; }
.pk-head { gap: 8px; letter-spacing: .02em; }
.pk-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.pk-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px 12px; min-height: 104px; border: 1px solid var(--line); border-radius: 16px; background: var(--card, #fff); font: inherit; color: inherit; cursor: pointer; text-align: center; }
.pk-tile:hover, .pk-tile:focus-visible { border-color: #F0528C; outline: none; box-shadow: 0 0 0 3px #FDE3EE; }
.pk-tile .pk-ico { font-size: 22px; line-height: 1; }
.pk-tile .pk-st { font-size: 12.5px; color: var(--muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pk-tile.done { border-color: #B7D7AC; background: #F3F9F0; } .pk-tile.done .pk-st { color: #2E5226; font-weight: 600; }
.pk-sec { padding: 0; }
.pk-sec > summary { display: flex; align-items: center; gap: 10px; padding: 14px 16px; min-height: 52px; cursor: pointer; list-style: none; font-size: 17px; }
.pk-sec > summary::-webkit-details-marker { display: none; }
.pk-sec > summary::after { content: '›'; margin-left: auto; font-size: 22px; color: var(--muted); transition: transform .15s; }
.pk-sec[open] > summary::after { transform: rotate(90deg); }
.pk-sec > summary .pk-ico { font-size: 20px; }
.pk-body { padding: 0 16px 16px; }
.pk-sum { background: var(--peach-tint, #FFF7FA); border-radius: 14px; padding: 12px 14px; }
.pk-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 4px 16px; margin: 8px 0 0; font-size: 14px; }
.pk-dl dt { color: var(--muted); font-size: 12.5px; } .pk-dl dd { margin: 0; white-space: pre-line; }
.pk-rx ul { margin: 0; padding-left: 20px; }
.pk .intake { box-shadow: none; padding: 0; }
.pk-done { width: 100%; min-height: 54px; font-size: 17px; justify-content: center; }
.pk-foot .btn { justify-content: center; }
.bad-txt { color: var(--bad, #B42318); font-weight: 600; }
/* ---- Danh sách bệnh nhân dạng thẻ gọn 3 dòng (bản 1.42.0) ---- */
.rec-card { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; border-left: 5px solid var(--line); }
.rec-card.st-active { border-left-color: #F0528C; }
.rec-card.is-today { background: var(--peach-tint, #FFF7FA); }
.rec-card.st-pregnant, .rec-card.st-born { border-left-color: #7DB36B; }
.rec-l1, .rec-l23 { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rec-ava { display: inline-flex; width: 40px; height: 40px; border-radius: 12px; background: var(--peach-tint, #FDE3EE); color: #C2185B; font-weight: 700; font-size: 18px; align-items: center; justify-content: center; flex: none; text-decoration: none; }
.rec-card.st-pregnant .rec-ava, .rec-card.st-born .rec-ava { background: #E8F3E3; color: #2E5226; }
.rec-name { flex: 1; min-width: 0; font-size: 16.5px; line-height: 1.3; color: inherit; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rec-txt { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.rec-l2 { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); text-decoration: none; }
.rec-l3 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.rec-cy { color: #C2185B; font-weight: 600; }
.rec-next { color: #C2185B; font-weight: 600; }
.rec-next svg { vertical-align: -2px; }
.ok-txt { color: var(--green-dark, #2E5226); font-weight: 600; }
.warn-txt { color: #9A5B00; font-weight: 600; }
.rec-row-acts { display: inline-flex; gap: 6px; flex: none; align-items: center; }
.rec-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.rec-filters .chip { text-decoration: none; padding: 8px 12px; flex: none; }
.rec-filters .chip.on { background: var(--ink); color: #fff; }
.rec-search-l { display: block; }
@media (max-width: 600px) {
  .rec-card .btn.small { min-height: 44px; min-width: 44px; justify-content: center; }
  .rec-row-acts { gap: 4px; }
  .rec-search-l { display: none; }
  .rec-head { flex-wrap: nowrap; padding-right: 52px; } /* chừa chỗ cho chuông thông báo */
  .rec-head h1 { font-size: 22px; white-space: nowrap; }
  .rec-head .btn { min-height: 44px; padding: 0 12px; font-size: 14px; white-space: nowrap; }
  .rec-filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
  .rec-filters::-webkit-scrollbar { display: none; }
  .rec-filters .chip { min-height: 40px; display: inline-flex; align-items: center; }
}
@media (max-width: 420px) { .pk-tiles { gap: 8px; } .pk-tile { padding: 12px 4px 10px; } }

/* ---- Phiếu theo dõi (bản 1.42.0) ---- */
.pk-tiles.td { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 600px) { .pk-tiles.td { grid-template-columns: repeat(2, 1fr); } }
.td-ab { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.td-med { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--line); }
.td-med:first-child { border-top: none; }
.qchip.sug { border-color: #F0528C; }

/* ---- Tóm tắt khám ban đầu chia nhóm (bản 1.42.0) ---- */
.ib-g { border-top: 1px solid var(--line); padding-top: 6px; } .ib-g:first-of-type { border-top: none; padding-top: 0; }
.ib-g > b { font-size: 13px; color: #C2185B; text-transform: uppercase; letter-spacing: .03em; }
.ib-l { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 14px; line-height: 1.5; }
.ib-it { min-width: 0; overflow-wrap: anywhere; }

/* ---- Đầu hồ sơ gọn (bản 1.42.0): một nút Khám hôm nay, nút nổi, khối gập 1 dòng trên điện thoại ---- */
.rec-actions > .only-menu { display: none; }
.kham-fab { position: fixed; z-index: 22; right: max(16px, env(safe-area-inset-right)); bottom: 24px; display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 18px 0 14px;
  border-radius: 999px; background: #C2185B; color: #fff; font-weight: 600; font-size: 15px; text-decoration: none; box-shadow: 0 6px 20px rgba(194, 24, 91, .32); }
.kham-fab:hover { background: #A8134D; }
@media (max-width: 820px) { .kham-fab { bottom: calc(78px + env(safe-area-inset-bottom)); } }
/* Đầu trang đã có nút Khám hôm nay: nút nổi chỉ hiện khi đã cuộn xuống */
.kham-fab { transition: opacity .15s; }
body:not(.scrolled) .kham-fab { opacity: 0; pointer-events: none; }
@media print { .kham-fab { display: none; } }
.ph-fold { background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.ph-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 12px; font-size: 15px; }
.ph-fold > summary::-webkit-details-marker { display: none; }

.ph-fold > summary > * { white-space: nowrap; }
.ph-fold > summary b::before { content: '› '; color: var(--peach-dark); }
.ph-fold[open] > summary b::before { content: '⌄ '; }
.ph-fold > section { border: 0; border-radius: 0 0 12px 12px; }
.ph-fold .star-h, .ph-fold .journey > .row > b { display: none; }
/* Điện thoại: dòng chu kỳ đã xong / thủ thuật / khám ban đầu đang gập chỉ cao 1 dòng, dài thì cắt "…" */
.cyc-fold > summary .t-short { display: none; }
@media (max-width: 600px) {
  .cyc-fold > summary .t-full { display: none; }
  .cyc-fold > summary .t-short { display: inline; }
  .cyc-fold:not([open]) > summary { flex-wrap: nowrap; padding: 10px 12px; }
  .cyc-fold:not([open]) > summary > * { flex: none; white-space: nowrap; }
  .cyc-fold:not([open]) > summary > :last-child { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .cyc-fold:not([open]) > summary > :first-child { flex: 0 1 auto; min-width: 0; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
}

/* ---- Bảng nhập của phiếu khám (bản 1.42.0): trượt từ dưới lên, hàng tab chuyển mục ---- */
.pk-sheet { display: none; }
.pk-sheet.on { display: block; position: fixed; inset: 0; z-index: 60; }
body:has(.pk-sheet.on) { overflow: hidden; }
.pk-sheet-bg { position: absolute; inset: 0; background: rgba(43, 33, 37, .42); }
.pk-sheet-box { position: absolute; left: 0; right: 0; bottom: 0; height: 88vh; height: 88dvh; display: flex; flex-direction: column; background: var(--card, #fff);
  border-radius: 20px 20px 0 0; box-shadow: 0 -10px 34px rgba(43, 33, 37, .22); animation: pk-up .2s ease-out; }
@keyframes pk-up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.pk-sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; border-bottom: 1px solid var(--line); }
.pk-sheet-head::before { content: ''; position: absolute; top: 5px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line); }
.pk-stabs { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; padding-top: 4px; }
.pk-stabs::-webkit-scrollbar { display: none; }
.pk-stab { flex: 1 0 auto; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font: inherit; font-size: 14.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.pk-stab.done { color: var(--green-dark, #2E5226); border-color: #BFDDB2; background: #F2F8EF; }
.pk-stab.on { background: #C2185B; border-color: #C2185B; color: #fff; }
.pk-sheet-x { flex: none; min-height: 44px; min-width: 44px; padding: 0; justify-content: center; font-size: 18px; }
.pk-sheet-sum { padding: 6px 14px; color: var(--ink-2); background: var(--peach-tint, #FFF7FA); border-bottom: 1px solid var(--line); line-height: 1.45; }
.pk-sheet-sum:empty { display: none; }
.pk-pane[hidden] { display: none !important; }
.pk-sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 20px; -webkit-overflow-scrolling: touch; }
.pk-sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--card, #fff); }
.pk-sheet-foot .btn { min-height: 48px; padding: 0 22px; font-size: 16px; }
@media (min-width: 821px) {
  .pk-sheet-box { left: 50%; right: auto; top: 50%; bottom: auto; width: min(760px, 92vw); height: min(84vh, 860px); transform: translate(-50%, -50%); border-radius: 20px; animation: none; }
  .pk-sheet-head::before { display: none; }
}
@media (max-width: 420px) { .pk-stabs { gap: 4px; } .pk-stab { padding: 0 6px; font-size: 13.5px; } .pk-sheet-head { padding: 10px 8px 6px; } }
@media print { .pk-sheet { display: none !important; } }

/* ---- Bàn bấm nhanh kích thước nang (bản 1.42.0, public/bacsi/fol-pad.js) ---- */
.fol-pad { position: fixed; z-index: 80; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 34px rgba(43, 33, 37, .22); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.fol-pad[hidden] { display: none; }
.fol-pad.dock { left: 0; right: 0; bottom: 0; top: auto; border-radius: 18px 18px 0 0; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
.fp-head { display: flex; align-items: center; gap: 6px; }
.fp-sides { display: flex; gap: 4px; flex: 1; min-width: 0; }
.fp-side { flex: 1; min-height: 40px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.fp-side.on { background: #C2185B; border-color: #C2185B; color: #fff; }
.fp-btn { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; color: var(--ink); }
.fp-btn:disabled { opacity: .4; cursor: default; }
.fp-ok { background: #C2185B; border-color: #C2185B; color: #fff; font-weight: 600; }
.fp-read { background: var(--peach-tint, #FFF7FA); border-radius: 10px; padding: 8px 10px; font-size: 15px; line-height: 1.45; min-height: 42px; }
.fp-lab { font-weight: 700; color: #C2185B; }
.fp-bad { color: var(--danger, #B42318); font-size: 13.5px; margin-top: 4px; }
.fp-sizes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.fp-size { min-height: 46px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; font-size: 17px; font-weight: 600; color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; touch-action: manipulation; }
.fp-size:active, .fp-size.hit { background: var(--peach-tint, #FDE3EE); border-color: #F0528C; }
.fp-size[data-v="<10"], .fp-size[data-v=">25"] { font-size: 15px; color: var(--ink-2); }
.fp-foot { display: flex; gap: 6px; }
.fp-foot .fp-btn { flex: 1; }
input.fp-on { outline: 3px solid #F0528C; outline-offset: 1px; }
@media (min-width: 821px) and (pointer: fine) { .fp-sizes { grid-template-columns: repeat(9, minmax(0, 1fr)); } .fp-size { min-height: 38px; font-size: 15px; } }
@media print { .fol-pad { display: none !important; } }

/* ---- Buổi khám đầu (bản 1.43.0): thẻ "Khám lần đầu", hộp thông tin ở chặng Khám đầu, phiếu khám ban đầu trong bảng nhập ---- */
.fv-new { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1.5px solid #F0528C; background: var(--peach-tint, #FFF7FA); }
.fv-new .grow { flex: 1 1 180px; min-width: 0; }
.fv-new b { font-size: 17px; }
.fv-new .btn { min-height: 48px; padding: 0 22px; font-size: 16px; }
@media (max-width: 600px) { .fv-new .btn { width: 100%; justify-content: center; } }
.jn-pop { position: fixed; z-index: 70; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(43, 33, 37, .22); border: 1px solid var(--line); max-height: 70vh; overflow-y: auto; }
.jn-pop[hidden] { display: none; }
.jn-pop .btn { min-height: 44px; }
.pk-brief .ib > .row .btn { min-height: 44px; }
.pk-sheet .intake { border: 0; box-shadow: none; padding: 0; background: none; }
.pk-sheet .intake-head { position: sticky; top: -14px; margin: 0; padding: 8px 0; border-radius: 0; z-index: 5; }
.pk-sheet .intake-head h2 { display: none; }
.pk-sheet .intake-head > .row { justify-content: flex-end; }
.pk-sheet .sec-nav button { min-height: 44px; }
.pk-sheet .intake .intake-cols { display: block; }
.pk-sheet .intake[data-part="chung"] section[data-sec]:not([data-sec="chung"]),
.pk-sheet .intake[data-part="vo"] section[data-sec]:not([data-sec="vo"]),
.pk-sheet .intake[data-part="chong"] section[data-sec]:not([data-sec="chong"]) { display: none !important; }
@media print { .jn-pop { display: none !important; } }
.pk-sheet .intake-head [data-act="save-intake"] { display: none; }
/* Hỏi bệnh lần đầu (bản 1.43.0): đếm ô đã hỏi, chồng không đến, phần Khám chung phiếu */
.sec-nav .nav-n { font-weight: 500; font-size: 12.5px; opacity: .8; }
.sec-nav button.full:not(.on) { border-color: #BFDDB2; background: #F2F8EF; color: var(--green-dark, #2E5226); }
.intake .h-abs-note { display: none; }
.intake section.h-absent > :not(.sec-t):not(.h-abs-note) { display: none !important; }
.intake section.h-absent .h-abs-note { display: block; }
.intake section.h-absent .sec-t [data-act="intake-normal"], .intake section.h-absent .h-abs-btn { display: none; }
.intake:has(section.h-absent) [data-sec="kham"] .h-ex { display: none; }
.intake:has(section.h-absent) [data-sec="kham"] .h-abs-note { display: block; }
.pk-sheet .sec-nav .nav-kham { display: none; }
.pk-sheet .intake:not(:has(section[data-pk-kham])) .sec-nav .nav-kham { display: inline-flex; }
.pk-sheet .intake[data-part="kham"] section[data-sec]:not([data-sec="kham"]) { display: none !important; }
.pk-sheet .intake:not([data-part="kham"]) section[data-sec="kham"] { display: none !important; }
.pk-sheet .intake[data-part="kham"] .intake-head { display: none; }
.pk-pane[data-pane="hoi"]:has(#intake[data-part="kham"]) .pk-hoi-top { display: none; }
.sec-t .h-abs-btn { white-space: nowrap; }
/* Tóm tắt · Kết quả chính (17/11/2026): ô gọn hơn; Kết luận 1 dòng, bấm mới mở nút chọn */
.sum-tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.sum-tiles .tile { padding: 8px 12px; border-radius: 10px; }
.sum-tiles .tile .v { font-size: 15px; line-height: 1.3; }
@media (max-width: 600px) { .sum-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; } .sum-tiles .tile .v { font-size: 14px; } }
.concl-line { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; font: inherit; text-align: left; cursor: pointer; color: inherit; }
.concl-line:hover { border-color: #F0528C; }
.concl-line .grow { min-width: 0; font-weight: 600; }
.concl-car { color: var(--muted); }
@media (max-width: 600px) { .concl-line { flex-wrap: wrap; } }
.sum-tiles ~ .cause-box, .cause-box:has(.concl-line) { border-top: 0; padding-top: 0; }
@media (max-width: 600px) { [data-keyfold] > summary .muted { display: none; } }
/* Ô Tóm tắt chạm được (bản 1.43.0): tinh dịch đồ 5 chỉ số, hộp xem đầy đủ */
.sum-tiles .tile-btn { background: var(--bg); color: inherit; }
.sum-tiles .tile-btn:hover { box-shadow: inset 0 0 0 1.5px #F6B8CF; }
.sum-tiles .tile-wide { grid-column: span 2; }
.sp-row { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.sp-row .sp small { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.sp-row .sp.bad { color: var(--danger); }
.sum-pop .sd-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.sum-pop .sd-row > span:last-child { text-align: right; font-weight: 600; }
.sd-tb { width: 100%; border-collapse: collapse; font-size: 14px; }
.sd-tb th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; }
.sd-tb td { padding: 4px 6px 4px 0; border-top: 1px dashed var(--line); vertical-align: top; }
.sd-adv { margin: 4px 0 0; padding-left: 18px; }
/* Xét nghiệm cổ tử cung trong mục Khám */
.cx-order { border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; gap: 6px; }
.cx-chip { min-height: 44px; }
.cx-chip.suggest { border-style: dashed; border-color: var(--peach); color: var(--peach-darker); font-weight: 600; }

/* ---- Mỗi giai đoạn chu kỳ là 1 bảng gập được (BS Tùng 24/11/2026) ---- */
.tool-sec.phase > summary b { font-size: 15px; }
.tool-sec.phase:has(.phase-now) { border-color: var(--peach); box-shadow: 0 0 0 1px var(--peach) inset; }
.tool-sec.phase:not([open]) { background: var(--soft, #faf7f8); }
.tool-sec.phase:not([open]) > summary .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tool-sec.phase:not([open]) > summary { flex-wrap: nowrap; }
.tool-sec.phase:not([open]) > summary b, .tool-sec.phase > summary .phase-now { flex: none; }
.chip.phase-now { font-size: 11px; padding: 2px 8px; }
.tool-sec.phase > .visits { margin-top: 0; }
