/* CVD Remission ระดับจังหวัดเชียงราย (cvdremission.mshprimary.com/dashboard) · ธีมขาว-แดงของโครงการ (docs/CVD-REMISSION-DESIGN.md) */
:root {
  --red: #c8102e;
  --red-dk: #7a0a1c;
  --pink: #fde8ea;
  --soft: #fff4f5;
  --bg: #ffffff;
  --page: #ffffff;
  --fg: #2a1316;
  --muted: #8a7f81;
  --line: #ece6e7;
  --ok: #067647;
  --ok-bg: #f6fef9;
  --err: #b42318;
  --err-bg: #fef3f2;
  --amber: #b54708;
  --f-ui: "Noto Sans Thai", system-ui, sans-serif;
  --msh-navbar-h: 66px;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--page); }
body { margin: 0; background: var(--page); color: var(--fg); font-family: var(--f-ui); font-size: 15px; line-height: 1.6; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.3; text-wrap: balance; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.08rem; }
h3 { font-size: .98rem; }
a { color: var(--red); }
code { font-size: .85em; background: var(--soft); padding: 1px 6px; border-radius: 6px; }
.small { color: var(--muted); font-size: .84rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 8px; z-index: 50; background: #fff; padding: 8px 14px; border-radius: 10px; }
.red { color: var(--red); }
.green { color: var(--ok); }
.material-symbols-outlined { font-size: 20px; line-height: 1; }
:where(button, a, input, select, summary):focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- แถบบน ---------- */
.top { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 2px solid var(--red); }
.top-in { max-width: 1480px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--fg); min-width: 0; }
.logo { width: 44px; height: 44px; border-radius: 50%; flex: none; box-shadow: 0 2px 8px rgba(200, 16, 46, .25); }
.btxt { display: grid; min-width: 0; }
.btxt b { font-size: 1.05rem; }
.eyebrow { font-size: .7rem; letter-spacing: .03em; color: var(--red); font-weight: 700; }
.top-right { display: flex; align-items: center; gap: 8px; flex: none; }
/* เมนูบัญชีผู้ใช้ (หลังเข้าสู่ระบบ) */
.acct { position: relative; }
.acct-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 2px solid var(--pink); border-radius: 50%; background: #fff; cursor: pointer; }
.acct-btn:hover, .acct-btn[aria-expanded="true"] { border-color: var(--red); }
.acct-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: var(--pink); color: var(--red-dk); font-size: .85rem; font-weight: 700; line-height: 1; flex: none; }
.acct-avatar.lg { width: 44px; height: 44px; font-size: 1rem; }
.acct-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: min(300px, calc(100vw - 24px)); padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 32px rgba(122, 10, 28, .16); display: grid; gap: 2px; }
.acct-menu[hidden] { display: none; }
.acct-who { display: flex; align-items: center; gap: 10px; padding: 8px 8px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.acct-id { display: grid; min-width: 0; }
.acct-id b { font-size: .95rem; line-height: 1.35; overflow-wrap: anywhere; }
.acct-id small { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.acct-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: var(--fg); font: inherit; font-size: .92rem; font-weight: 600; text-align: left; cursor: pointer; }
.acct-item:hover { background: var(--soft); }
.acct-item .material-symbols-outlined { color: var(--red); font-size: 1.25rem; }
.acct-item[aria-pressed="true"] { background: var(--pink); color: var(--red-dk); }
.acct-item.out { color: var(--err); }
.acct-item.out .material-symbols-outlined { color: var(--err); }
.mockbar { max-width: 1480px; margin: 10px auto 0; padding: 8px 16px; background: #fff8e6; border: 1px solid #f5d88a; border-radius: 12px; font-size: .88rem; }
@media (max-width: 1512px) { .mockbar { margin: 10px 16px 0; } }

/* ---------- ปุ่ม ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 6px 18px; border-radius: 999px; background: var(--red); color: #fff; border: 2px solid var(--red); font: inherit; font-weight: 700; font-size: .92rem; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--red-dk); border-color: var(--red-dk); }
.btn.ghost { background: #fff; color: var(--red); }
.btn.ghost:hover { background: var(--soft); }
.btn.sm { min-height: 36px; padding: 2px 14px; font-size: .85rem; }
.link { background: none; border: 0; padding: 4px 2px; min-height: 32px; color: var(--red); font: inherit; font-size: .85rem; font-weight: 600; text-decoration: underline; cursor: pointer; }

/* ---------- โครงหน้า ---------- */
.main { max-width: 1480px; margin: 0 auto; padding: 14px 16px 64px; }
.status { color: var(--muted); padding: 6px 0; }
.err { color: var(--err); }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 12px; min-width: 0; }
.card.login, #cvpDenied { max-width: 560px; margin: 24px auto; }
.google { min-height: 44px; }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
/* แถบปุ่ม "คอลัมน์" ของตารางที่ย้ายขึ้นมาอยู่ในหัวกรอบ (liftTableTools ใน cvd-province.js): ชิดขวาเสมอแม้หัวข้อขึ้นบรรทัดใหม่ */
.card-head > .msh-table-tools { margin: 0 0 0 auto; }
.layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 16px; align-items: start; }
/* กล่องตัวกรองยาวลงไปตามหน้า ไม่ติดจอและไม่เลื่อนในตัวเอง ทั้งจอคอมและมือถือ (เจ้าของระบบสั่ง 16 พ.ย. 2569 · เดิมจอกว้างติดจอ+เลื่อนในกล่อง)
   รายการของช่องเลือก (จอกว้าง) ยังเลื่อนในรายการเองได้ (max-height 260px ด้านล่าง) */
.side { position: relative; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.side-head h2 { display: flex; align-items: center; gap: 6px; font-size: 1rem; }
.side-actions { display: flex; gap: 10px; }
.side .msh-filter-toggle { display: none; }
/* ซ่อน/แสดงตัวกรอง (จอคอม · เจ้าของระบบสั่ง 16 พ.ย. 2569): ซ่อนแล้วเนื้อหาขวาขยายเต็มแถว เหลือที่คั่นติดขอบซ้ายของจอ
   จอแคบ (≤ 980px) ใช้ปุ่ม "ซ่อนตัวกรอง" ของตารางกลางแบบเดิม */
.side-hide { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); cursor: pointer; }
.side-hide:hover { color: var(--red); border-color: var(--red); }
.side-hide .material-symbols-outlined { font-size: 20px; }
.layout.side-off { grid-template-columns: minmax(0, 1fr); }
.layout.side-off > .side { display: none; }
.side-tab { position: fixed; left: 0; top: calc(var(--msh-navbar-h, 68px) + 96px); z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 7px 14px 6px; border: 0; border-radius: 0 12px 12px 0; background: var(--red); color: #fff; font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; box-shadow: 2px 4px 14px rgba(200, 16, 46, .28); }
.side-tab[hidden] { display: none; }
.side-tab:hover { padding-left: 10px; }
.side-tab:focus-visible { outline: 3px solid #fff; outline-offset: -5px; }
.side-tab .material-symbols-outlined { font-size: 20px; }
.side-tab-text { writing-mode: vertical-rl; letter-spacing: .02em; }
.side-tab-count { min-width: 20px; padding: 1px 5px; border-radius: 999px; background: #fff; color: var(--red); font-size: .75rem; text-align: center; }
@media (max-width: 980px) { .side .msh-filter-toggle { display: inline; } }
.filters { display: grid; gap: 10px; }
.filters label { display: grid; gap: 4px; font-weight: 600; font-size: .85rem; }
.filters select { width: 100%; min-height: 42px; padding: 6px 10px; border: 1px solid #dccbce; border-radius: 10px; background: #fff; font: inherit; }
/* รายการของช่องเลือกในกล่องตัวกรอง (เจ้าของระบบ 14 พ.ย. 2569): กล่องตัวกรองติดจอและเลื่อนในตัว (overflow:auto)
   รายการลอยกว้าง 320px จึงโดนขอบกล่องตัด ปุ่ม "เสร็จ" หาย → กางในกล่องเต็มความกว้างช่อง ดันช่องด้านล่างลง (แบบ Type area #1860)
   ไม่ใช่ปัญหา iframe (หน้านี้ไม่มี iframe)
   จอแคบ (≤ 980px) กล่องไม่เลื่อนในตัว รายการยังลอยแบบเดิม */
@media (min-width: 981px) {
  .side .msh-ss { flex-wrap: wrap; }
  .side .msh-ss-list { position: static; flex: 0 0 100%; width: 100%; max-width: none; max-height: 260px; margin-top: 4px; box-shadow: none; }
}
.content { display: grid; gap: 14px; min-width: 0; }

/* ---------- แท็บ ---------- */
/* taste-skill (13 พ.ย. 2569 · docs/ai/TASTE.md): แท็บถอยหลังให้ข้อมูล · แท็บที่เลือก = พื้นเทากลาง ตัวหมึกเข้ม (สีแดงเก็บไว้ให้ตัวเลขความเสี่ยง) */
.tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px; border: 0; border-radius: 10px; background: none; color: #6f6466; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tabs button:hover { background: #f6f3f3; color: var(--fg); }
.tabs button[aria-selected="true"] { background: #f1eded; color: var(--fg); }
.view { display: grid; gap: 14px; }

/* ---------- KPI ---------- */
/* taste-skill: ตัวเลขสรุปเป็นแถบเดียวแบ่งด้วยเส้น (ไม่ใช่การ์ดซ้ำแถว) · เส้นแบ่ง = ช่องว่าง 1px บนพื้นสีเส้น · ช่องแถวสุดท้ายขยายเต็มแถว */

/* ---------- ตารางไขว้ ---------- */
.matrix { border: 1px solid var(--line); border-radius: 12px; overflow: auto; }
/* จอคอม: ตารางในหน้าแสดงทุกแถวยาวลงไปตามหน้า ไม่เป็นกล่องเลื่อนในตัวเอง (เจ้าของระบบสั่ง 16 พ.ย. 2569)
   ยังเลื่อนแนวนอนได้เมื่อคอลัมน์เกินกว้าง · ตารางในหน้าต่างรายชื่อ (.modal-table) ไม่อยู่ใน .layout จึงไม่โดน · มือถือคงแบบกลาง */
/* ทุกขนาดจอใช้กฎกลางข้อ 7.7 (styles/msh-table.css) แล้ว · เดิมมีข้อยกเว้นเฉพาะจอคอมตรงนี้ */
.mx { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.mx th, .mx td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
/* taste-skill: หัวตารางพื้นขาว ตัวเทาเล็ก ไม่มีแถบสี · เส้นใต้หัวเข้มกว่าเส้นแถว */
.mx thead th { background: #ffffff; font-size: .82rem; font-weight: 600; color: #6f6466; border-bottom-color: #d9d4d5; }
.mx tbody th, .mx tfoot th { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; }
.mx tfoot th, .mx tfoot td { background: #faf8f8; border-top: 1px solid #d9d4d5; border-bottom: 0; }
.mx .hosp { text-align: left; font-size: .8rem; color: var(--muted); white-space: normal; min-width: 140px; }
.mx .err-h { color: var(--err); }
/* กราฟแท่งแนวนอนรายอำเภอ (renderDistrictChart) · แถวเตี้ย ชิดกัน */
.dchart { display: grid; gap: 6px; margin: 0 0 12px; }
.dchart-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.dchart-legend { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: .8rem; }
.dchart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.dchart .seg button { min-height: 30px; padding: 2px 12px; font-size: .8rem; }
.dchart-rows { display: grid; gap: 2px; }
.dchart-row { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) 7.6em; align-items: center; gap: 8px; min-height: 18px; font-size: .8rem; line-height: 1.2; }
.dchart-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dchart-track { display: flex; height: 14px; min-width: 0; }
.dchart-track button { flex: none; height: 100%; min-width: 0; margin: 0; padding: 0; border: 0; border-right: 1px solid var(--bg); cursor: pointer; }
.dchart-track button:last-child { border-right: 0; border-radius: 0 4px 4px 0; }
.dchart-track button:hover { filter: brightness(.88); }
.dchart-val { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
@media (max-width: 520px) { .dchart-row { grid-template-columns: 5.6em minmax(0, 1fr) 6.8em; gap: 6px; font-size: .76rem; } }
.mx .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.mx .n { min-width: 46px; min-height: 34px; padding: 2px 8px; border: 0; border-radius: 9px; background: #f3e6e8; color: var(--fg); font: inherit; font-weight: 700; cursor: pointer; }
.mx .n:hover { box-shadow: 0 0 0 2px var(--red) inset; }
.mx .n.plain { background: #fff; border: 1px solid var(--line); }
.mx .n.strong { background: var(--red); color: #fff; }
.mx .n.issue { background: var(--err-bg); color: var(--err); }
.mx .n.solid { display: inline-block; cursor: default; color: #fff; }
.mx .z { color: #c9bfc1; }
.mx .pct { display: block; color: var(--muted); font-size: .72rem; }
.mx tr.nodata th { color: var(--muted); font-weight: 500; }
.mx .pending { display: inline-block; padding: 2px 12px; border-radius: 999px; background: #f4f1f2; color: var(--muted); font-size: .8rem; }
.mx .amp { padding: 4px 0; border: 0; background: none; color: var(--fg); font: inherit; font-weight: 700; text-decoration: underline dotted var(--red); text-underline-offset: 4px; cursor: pointer; min-height: 36px; }
.mx .amp:hover { color: var(--red); }
.hint { margin-top: -4px; }
/* สิทธิ์ 7 ระดับ: ไม่มีสิทธิ์รายชื่อ = ตัวเลขกดไม่ได้ */
/* ส่วนนำเสนอ: ปุ่มเข้าสู่ระบบบนแถบบน แทน avatar (ยังไม่มีบัญชีให้แสดง) */
.cvp-shell-login { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 16px; border-radius: 999px; background: var(--red); color: #fff; font-weight: 700; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.cvp-shell-login:hover, .cvp-shell-login:focus-visible { background: var(--red-dk); }
.cvp-shell-login .material-symbols-outlined { font-size: 20px; }
@media (max-width: 640px) { .cvp-shell-login span:not(.material-symbols-outlined) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .cvp-shell-login { padding: 6px 12px; } }
.no-list .mx .n, .no-list [data-statin], .no-list [data-kpi] { pointer-events: none; cursor: default; }
.no-list .mx .n:not(.strong):not(.issue) { background: none; border: 0; }
.access-add { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.access-add label, .area-form label { display: grid; gap: 4px; font-size: .85rem; font-weight: 600; min-width: min(360px, 100%); }
.area-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--pink); color: var(--red-dk); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.modal.narrow { width: min(560px, calc(100vw - 24px)); overflow: visible; }
.area-form { display: grid; gap: 12px; padding: 16px 18px 20px; }
.area-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.area-chips li { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 12px; border-radius: 999px; background: var(--pink); color: var(--red-dk); font-size: .88rem; font-weight: 600; }
.area-chips li.none { background: none; color: var(--muted); font-weight: 400; padding-left: 0; }
.area-chips button { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.area-chips button:hover { background: #fff; }
.area-chips .material-symbols-outlined { font-size: 1.1rem; }

/* ---------- statin ---------- */
.statin { position: relative; display: grid; grid-template-columns: minmax(200px, 360px) minmax(0, 1fr); gap: 20px 56px; align-items: end; }
.statin-svg { width: 100%; height: auto; font-family: var(--f-ui); }
/* เส้นชี้จากวงไปหัวข้อ แบบหน้า /cvdremission ของ รพ. (เส้นบาง ขอบขาว ไม่มีหัวลูกศร) */
.statin-leaders { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; overflow: visible; }
.statin-leaders .halo { fill: none; stroke: #fff; stroke-width: 3; }
.statin-leaders .line { fill: none; stroke: #5c0715; stroke-width: 1.25; }
.statin-svg .out { fill: var(--fg); }
.statin-legend { position: relative; z-index: 2; }
.statin-legend { display: grid; gap: 14px; }
.lv { display: grid; gap: 6px; }
.big { font-size: 1.25rem; }
.big.muted { color: #6f6264; }
.big.red { color: var(--red); }
.big.green { color: #2e7d32; }
.big.dkgreen { color: #1e6b3c; }
/* ตัวเลขสรุป = วงกลมซ้อน + เส้นชี้ แบบวง statin (เจ้าของระบบ 14 พ.ย. 2569) · ใช้ .statin/.statin-leaders ร่วมกัน */
.kpi-sent { margin: 0; color: var(--muted); font-size: .84rem; }
.sets-legend { gap: 10px; }
.sets-legend .sub-row > b.big { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.subset.warn { border-color: #f5c48a; }
.subset.warn .lv .big { font-size: 1rem; }
.set-hit { cursor: pointer; }
.set-hit:hover circle { filter: brightness(.94); }
.set-muted .big { color: #6f6264; }
.set-rose .big { color: #9a1b32; }
.set-amber .big { color: #8a5a00; }
.set-orange .big { color: #b45309; }
.set-red .big { color: var(--red); }
.set-warn .big { color: var(--amber); }
.chip.rose b { color: #9a1b32; }
.chip.orange b { color: #b45309; }
.chip.muted b { color: #6f6264; }
.chip.warn b { color: var(--amber); }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chips.dashed { border: 1px dashed #f0b8c1; border-radius: 12px; padding: 8px 10px; }
.subset { display: grid; gap: 8px; margin-top: 2px; padding: 10px 12px; border: 1px dashed #f0b8c1; border-radius: 12px; }
.subset.green { border-color: #9fd3ae; }
.sub-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sub-row > b { font-size: 1.05rem; }
.sub-row > small { margin-right: 4px; color: var(--fg); }
.dkgreen { color: #1e6b3c; }
.chips .cap { font-weight: 700; font-size: .88rem; margin-right: 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--fg); font: inherit; font-weight: 600; font-size: .86rem; cursor: pointer; }
.chip:hover { background: var(--soft); }
.chip.red b { color: var(--red); }
.chip.amber b { color: var(--amber); }
.chip.green b { color: var(--ok); }
.notes { margin: 0; padding-left: 20px; color: var(--muted); font-size: .8rem; }

/* ---------- ตารางข้อมูล ---------- */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl thead th { background: #ffffff; color: #6f6466; font-size: .82rem; font-weight: 600; border-bottom-color: #d9d4d5; }
.tbl td.empty { text-align: center; color: var(--muted); padding: 24px; }
.mono { white-space: nowrap; }
.risk { font-weight: 700; }
.ta { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: .7rem; font-weight: 700; border: 1px solid #f0b8c1; color: var(--red-dk); background: var(--soft); }
.ta.ta-2, .ta.ta-4, .ta.ta-5 { border-color: #d9d4d5; color: var(--muted); background: #f6f4f4; }
.issue-tag { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: .7rem; font-weight: 700; background: var(--err-bg); color: var(--err); }
.pending { display: inline-block; padding: 2px 12px; border-radius: 999px; background: #f4f1f2; color: var(--muted); font-size: .8rem; }
.searchbar { display: flex; gap: 8px; }
.searchbar input, .modal-search input { flex: 1; min-height: 46px; padding: 8px 14px; border: 1px solid #dccbce; border-radius: 12px; font: inherit; font-size: 1rem; }

/* ---------- หน้าต่างรายชื่อ / แผนรายคน ---------- */
.modal { width: min(1280px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 24px 60px rgba(42, 19, 22, .3); color: var(--fg); }
.modal[open] { display: flex; flex-direction: column; }
.modal::backdrop { background: rgba(42, 19, 22, .45); }
.modal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.modal-search { display: flex; align-items: center; gap: 10px; padding: 10px 18px; }
#cvpList[open] { height: calc(100dvh - 24px); }
.modal-table { --msh-navbar-h: 0px; --msh-table-max: none; flex: 1; min-height: 0; max-height: none; overflow: auto; margin: 0 18px 18px; border: 1px solid var(--line); border-radius: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { min-height: 40px; padding: 4px 14px; border: 0; background: #fff; font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--red); color: #fff; }
.person-body { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 0; overflow: auto; min-height: 0; }
.person-side { padding: 16px 18px; border-right: 1px solid var(--line); display: grid; gap: 16px; align-content: start; background: var(--soft); }
.person-side section { display: grid; gap: 6px; }
.person-side .now b { font-size: 1.2rem; }
.impacts { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.impacts li span { display: block; color: var(--ok); font-size: .82rem; font-weight: 700; }
.reasons { margin: 0; padding-left: 18px; font-size: .82rem; color: #5b4b4e; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; font-size: .85rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.person-paper { padding: 16px; overflow: auto; background: #f2eced; }
.person-paper .rp-paper { margin: 0 auto; background: #fff; box-shadow: 0 4px 18px rgba(0, 0, 0, .08); }

/* ---------- พิมพ์ ---------- */
.print-area { display: none; }
@media print {
  @page { size: A4; margin: 10mm; }
  body[data-print] > *:not(.print-area) { display: none !important; }
  body[data-print] .print-area { display: block; }
  body[data-print="list"] { font-size: 10pt; }
  .print-area { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-head { display: flex; gap: 10px; align-items: center; border-bottom: 2px solid #c8102e; padding-bottom: 6px; margin-bottom: 6px; }
  .print-head .logo { width: 40px; height: 40px; }
  .print-head small { color: #c8102e; font-weight: 700; }
  .print-warn { font-size: 8.5pt; color: #b42318; margin: 4px 0 8px; }
  .print-table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
  .print-table th, .print-table td { border: 1px solid #d9d0d2; padding: 3px 5px; text-align: left; }
  .print-table thead { display: table-header-group; }
  .print-table tr { break-inside: avoid; }
}

/* ---------- มือถือ ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .side-hide, .side-tab { display: none !important; }
  .layout.side-off > .side { display: block; }
  .filters { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .statin { grid-template-columns: 1fr; }
  .statin-svg { max-width: 300px; }
  /* จอแคบ: ภาพอยู่เหนือคำอธิบาย เส้นชี้วิ่งตามรางด้านซ้าย (cvd-province.js layoutLeaders) · เว้นซ้ายให้ราง */
  .statin { padding-left: 28px; }
  .person-body { grid-template-columns: 1fr; }
  .person-side { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .logo { width: 36px; height: 36px; }
  /* แท็บ 4 อันเป็นตาราง 2×2 ไม่ล้นจอ (เดิมเลื่อนแนวนอน มองไม่เห็นว่ามี "ค้นหารายคน" "การส่งข้อมูล") */
  .tabs { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  .tabs button { justify-content: center; padding: 6px 8px; white-space: normal; text-align: center; line-height: 1.3; }
  /* คำอธิบายวงกลม: ตัวเลข+ชื่อกลุ่มบรรทัดแรก · สัดส่วน+ปุ่มดูรายชื่ออยู่บรรทัดเดียวกัน */
  .sets-legend .sub-row > b.big { flex-basis: 100%; }
  .sets-legend .sub-row { row-gap: 2px; }
  /* ตาราง: คอลัมน์โรงพยาบาลแคบลง ให้เห็นตัวเลขความเสี่ยงมากขึ้นก่อนต้องเลื่อน */
  .mx .hosp { min-width: 96px; font-size: .74rem; }
  .mx th, .mx td { padding: 6px 5px; }
  .btxt b { font-size: .95rem; }
  .searchbar { flex-direction: column; }
  .modal { width: 100vw; max-height: 100dvh; border-radius: 0; }
}

/* แถบบนของ Organize บนโดเมน cvdremission: โลโก้หัวใจแดง (cvd-province.js brandShell) + ธีมแดง-ขาวของโครงการ */
body.cvp-shell .msh-shell-topbar { background: #fff; border-bottom: 2px solid var(--red); }
body.cvp-shell .msh-shell-topbar .brand-logo { border-radius: 50%; box-shadow: 0 2px 8px rgba(200, 16, 46, .25); }
body.cvp-shell .msh-shell-brand-copy h1 { color: var(--red-dk) !important; }
body.cvp-shell .msh-nav-button { border-color: var(--pink); background: var(--soft); }
body.cvp-shell .msh-nav-button span { background: var(--red); }
/* ป้ายข้อมูลจริง/สมมติหลังชื่อหน้า (cvd-province.js dataBadge) */
.cvp-data-badge { display: inline-flex; align-items: center; margin-left: 10px; padding: 1px 10px; border-radius: 999px; border: 1px solid; font-size: .74rem; font-weight: 700; line-height: 1.6; white-space: nowrap; vertical-align: middle; }
.cvp-data-badge.real { color: #067647; background: #ecfdf3; border-color: #abefc6; }
.cvp-data-badge.mock { color: #b42318; background: #fef3f2; border-color: #fecdca; }
/* เข้าสู่ระบบแล้ว ป้ายเป็นปุ่มสลับข้อมูลจริง ⇄ ข้อมูลสมมติ (cvd-province.js dataBadge) */
.cvp-data-badge.switch { gap: 3px; padding-right: 6px; font-family: inherit; cursor: pointer; transition: filter .15s, box-shadow .15s; }
.cvp-data-badge.switch .material-symbols-outlined { font-size: 1rem; line-height: 1; color: currentcolor !important; }
.cvp-data-badge.switch:hover { filter: brightness(.96); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }
.cvp-data-badge.switch:focus-visible { outline: 2px solid currentcolor; outline-offset: 2px; }
/* เมนูข้างของโครงการ (cvd-province.js cvdDrawer): หน้าตาเมนูข้างของ Organize สีหลักแดง · ซ่อนเมนู Organize ที่ shell ใส่ไว้ */
#mshNavDrawer.cvp-drawer > :not(header):not(#cvpDrawerNav) { display: none !important; }
#mshNavDrawer.cvp-drawer > header b { color: var(--red-dk); }
#mshNavDrawer.cvp-drawer nav a:hover { border-color: var(--pink); }
#mshNavDrawer.cvp-drawer nav a.active { background: var(--soft); border-color: var(--pink); color: var(--red-dk); }
#mshNavDrawer.cvp-drawer .msh-nav-icon { background: var(--soft); color: var(--red); }
#mshNavDrawer.cvp-drawer a.active .msh-nav-icon { background: #fff; color: var(--red); }
#mshNavDrawer.cvp-drawer .cvd-menu-group { margin: 10px 4px 0; color: var(--muted); font-size: .74rem; font-weight: 700; letter-spacing: .05em; }
#mshNavDrawer.cvp-drawer a:focus-visible { outline-color: rgba(200, 16, 46, .35); }
body.cvp-shell .msh-shell-topbar .material-symbols-outlined,
body.cvp-shell .msh-shell-topbar svg { color: var(--red); }
body.cvp-shell .msh-global-refresh-control { color: var(--red) !important; }
/* เมนูผู้ใช้: ตัวอักษร/ขอบโทนแดงแทนน้ำเงินของ Organize (ปุ่มทำงานเหมือนเดิม) */
body.cvp-shell .user-menu .profile-menu-link,
body.cvp-shell .user-menu .admin-menu-link,
body.cvp-shell .user-menu .account-calendar-connect,
body.cvp-shell .user-menu .profile-menu-link b { color: var(--red-dk) !important; border-color: var(--pink) !important; }
body.cvp-shell .msh-shell-topbar .user-menu-button { border-color: var(--pink); }
body.cvp-shell .msh-shell-topbar .avatar { background: var(--pink); color: var(--red-dk); }
body.cvp-shell #userMenu .account-calendar-connection b { color: var(--red-dk); }
body.cvp-shell #userMenu .account-2fa-guide:hover, body.cvp-shell #userMenu .account-2fa-guide:focus-visible { background: var(--soft); color: var(--red); }
html body.cvp-shell .msh-shell-topbar :is(#mshPageRefresh, .msh-global-refresh-control), html body.cvp-shell .msh-global-status-capsule :is(#mshPageRefresh, .msh-global-refresh-control) { color: var(--red) !important; }
body.cvp-shell .msh-shell-topbar .cvp-shell-login, body.cvp-shell .msh-shell-topbar .cvp-shell-login .material-symbols-outlined { color: #fff; }
