/* ส่วนเสริมเฉพาะระบบสุขภาวะชุมชน — ใช้สีและระยะตาม StrikingDash
   primary #5f63f2 · success #20c997 · info #2c99ff · warning #fa8b0c · danger #ff4d4f · light #9299b8 · dark #272b41 */

body, .btn, .form-control, h1, h2, h3, h4, h5, h6, .sidebar_nav, .breadcrumb-title {
    font-family: "Inter", "IBM Plex Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
}
.num { font-variant-numeric: tabular-nums; }

/* brand */
.hc-brand { display: flex; align-items: center; gap: 10px; }
.hc-brand__mark { width: 38px; height: 38px; display: grid; place-items: center; flex: none; }
.hc-brand__mark img { width: 100%; height: 100%; object-fit: contain; }
.hc-auth-logo { display: inline-grid; place-items: center; width: 84px; height: 84px; margin-bottom: 18px; border-radius: 22px; background: #fff; box-shadow: 0 8px 24px rgba(39, 43, 65, .18); }
.hc-auth-logo img { width: 66px; height: 66px; object-fit: contain; }
.hc-brand__text { font-weight: 700; font-size: 16px; color: #272b41; line-height: 1.1; }
.hc-brand__text small { display: block; font-size: 11px; font-weight: 500; color: #9299b8; }
.hc-role-ic { width: 38px; height: 38px; border-radius: 8px; background: #f4f5f7; color: #9299b8; display: grid; place-items: center; }
.hc-role-ic.is-active { background: rgba(95, 99, 242, .12); color: #5f63f2; }
.hc-role-ic svg { width: 18px; height: 18px; }

/* แถบข้อมูลจำลอง */
.hc-sample { font-size: 12px; color: #fa8b0c; background: rgba(250, 139, 12, .1); border-radius: 50px; padding: 2px 12px; white-space: nowrap; }

/* ป้ายแหล่งข้อมูลบนการ์ดตัวเลข */
.hc-src { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #9299b8; font-weight: 600; }

/* ขั้นตอนตามผังการทำงาน */
.hc-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.hc-flow__step { border: 1px solid #e3e6ef; background: #fff; border-radius: 6px; padding: 3px 12px; color: #5a5f7d; white-space: nowrap; }
.hc-flow__step.is-term { border-radius: 50px; }
.hc-flow__step.is-done { border-color: #5f63f2; color: #5f63f2; }
.hc-flow__step.is-active { background: #5f63f2; border-color: #5f63f2; color: #fff; font-weight: 600; }
.hc-flow__arrow { color: #c6c9d8; }

/* สเกลสีต่อเนื่อง (โทน primary) */
.q0 { background: #f1f1fe; } .q1 { background: #dcddfc; } .q2 { background: #bfc1fa; }
.q3 { background: #9ea1f7; } .q4 { background: #7c80f4; color: #fff; } .q5 { background: #5f63f2; color: #fff; } .q6 { background: #3b3fb8; color: #fff; }
.hc-ramp { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #9299b8; }
.hc-ramp span.hc-ramp__cells { display: flex; gap: 2px; }
.hc-ramp i { width: 22px; height: 9px; border-radius: 2px; }

/* แผนที่รายหมู่บ้าน */
.hc-tmap { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.hc-tile { aspect-ratio: 5 / 4; border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; line-height: 1.2; border: 2px solid transparent; color: #272b41; cursor: pointer; text-align: left; min-width: 0; }
.hc-tile strong { font-size: 15px; font-weight: 600; }
.hc-tile.is-selected { border-color: #272b41; }
.hc-tile.is-empty { background: transparent; cursor: default; }
.hc-tile:focus-visible { outline: 2px solid #5f63f2; outline-offset: 2px; }

/* ตาราง heat */
.hc-heat { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 13px; }
.hc-heat th { font-weight: 500; color: #5a5f7d; padding: 4px 6px; white-space: nowrap; }
.hc-heat thead th { font-size: 12px; color: #9299b8; text-align: center; white-space: normal; line-height: 1.3; }
.hc-heat td { text-align: center; padding: 8px 4px; border-radius: 4px; font-variant-numeric: tabular-nums; }

/* ปัญหา → สาเหตุ → ควรทำ */
.hc-chain { display: grid; grid-template-columns: minmax(0, 1fr) 32px minmax(0, 1fr) 32px minmax(0, 1.2fr); align-items: stretch; }
.hc-chain__link { display: grid; place-items: center; color: #5f63f2; }
.hc-chain__cell { border: 1px solid #f1f2f6; border-radius: 10px; padding: 18px 20px; background: #fff; }
.hc-chain__cell.is-action { background: rgba(95, 99, 242, .06); border-color: rgba(95, 99, 242, .3); }
.hc-chain__q { font-size: 12px; font-weight: 600; color: #5f63f2; text-transform: none; margin-bottom: 6px; }
.hc-chain__title { font-size: 17px; font-weight: 600; color: #272b41; line-height: 1.35; margin-bottom: 8px; }
.hc-chain ul { padding-left: 18px; margin: 0; font-size: 14px; color: #5a5f7d; }
.hc-chain li { margin-bottom: 4px; }
@media (max-width: 991px) {
    .hc-chain { grid-template-columns: minmax(0, 1fr); }
    .hc-chain__link { height: 28px; transform: rotate(90deg); }
}

/* BMI */
.hc-bmi { display: grid; grid-template-columns: 18.5fr 4.5fr 2fr 5fr 6fr; gap: 2px; height: 8px; position: relative; margin-top: 10px; }
.hc-bmi i { border-radius: 2px; }
.hc-bmi__mark { position: absolute; top: -5px; width: 3px; height: 18px; border-radius: 2px; background: #272b41; transition: left .2s; }
.hc-bmi-legend { display: grid; grid-template-columns: 18.5fr 4.5fr 2fr 5fr 6fr; gap: 2px; font-size: 11px; color: #9299b8; margin-top: 4px; }

/* ตัวเลือกคำตอบแบบประเมิน */
.hc-likert { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.hc-likert label { border: 1px solid #e3e6ef; border-radius: 6px; padding: 8px 4px; text-align: center; font-size: 13px; cursor: pointer; margin: 0; color: #5a5f7d; }
.hc-likert input { position: absolute; opacity: 0; pointer-events: none; }
.hc-likert label.is-checked { background: #5f63f2; border-color: #5f63f2; color: #fff; }
.hc-question { border: 1px solid #f1f2f6; border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
.hc-question.is-missing { border-color: #ff4d4f; background: rgba(255, 77, 79, .03); }
.hc-question p { color: #272b41; font-size: 14px; margin-bottom: 10px; }
@media (max-width: 575px) { .hc-likert { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* การ์ดเลือกบุคคล */
.hc-person { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid #f1f2f6; border-radius: 8px; background: #fff; cursor: pointer; width: 100%; text-align: left; margin-bottom: 10px; }
.hc-person:hover, .hc-person.is-selected { border-color: #5f63f2; }
.hc-avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; background: rgba(95, 99, 242, .12); color: #5f63f2; display: grid; place-items: center; font-weight: 600; }

/* โครงสร้างฐานข้อมูลกลาง */
.hc-db { border: 1px dashed #c6c9d8; border-radius: 10px; padding: 26px 14px 14px; position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hc-db__label { position: absolute; top: -11px; left: 14px; background: #fff; border: 1px solid #c6c9d8; border-radius: 4px; padding: 0 8px; font-size: 12px; font-weight: 600; color: #5a5f7d; }
.hc-cyl { border: 1px solid #e3e6ef; border-radius: 50% / 14px; background: #f8f9fb; text-align: center; padding: 16px 8px 10px; font-size: 13px; color: #9299b8; }
.hc-cyl strong { display: block; color: #272b41; font-size: 20px; font-weight: 600; }
.hc-cyl.is-wide { grid-column: 1 / -1; }

/* tooltip ของแผนภาพ */
#hc-tip { position: fixed; z-index: 1080; pointer-events: none; background: #272b41; color: #fff; font-size: 12px; line-height: 1.45; padding: 6px 10px; border-radius: 6px; max-width: 260px; }

/* สัดส่วนกลุ่มวัย */
.hc-stack { display: flex; gap: 2px; height: 22px; border-radius: 4px; overflow: hidden; }

@media print {
    .header-top, .sidebar-wrapper, .footer-wrapper, .breadcrumb-action, .no-print { display: none !important; }
    .contents { padding: 0 !important; margin: 0 !important; }
    .card { break-inside: avoid; box-shadow: none !important; border: 1px solid #e3e6ef !important; }
}

/* ปรับเพิ่มหลังตรวจหน้าจอ */
.hc-tile.q4, .hc-tile.q5, .hc-tile.q6 { color: #fff; }
.hc-chain ul { list-style: disc; }
.hc-status { display: inline-block; white-space: nowrap; margin-top: 4px; }
.hc-note { font-size: 13px; color: #5a5f7d; background: rgba(95, 99, 242, .06); border-radius: 6px; padding: 10px 14px; }
.hc-note--warn { background: rgba(250, 139, 12, .1); color: #8a4b00; }
.hc-note--bad { background: rgba(255, 77, 79, .1); color: #a8071a; }

/* ---------- ป้ายแหล่งข้อมูล (ให้เห็นชัด) ---------- */
.hc-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #9299b8; font-weight: 600; }
.hc-src { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: none; line-height: 1; padding: 4px 8px; border-radius: 4px; white-space: nowrap; vertical-align: middle; }
.hc-src--primary { background: #5f63f2; color: #fff; }
.hc-src--dopa { background: #1c7ed6; color: #fff; }
.hc-src--hdc { background: #0ca678; color: #fff; }
.hc-src--model { background: #e8590c; color: #fff; }
.hc-source { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; line-height: 1.5; color: #272b41; background: #f0f1fe; border: 1px solid #c9cbfb; border-radius: 6px; padding: 8px 12px; }
.hc-source > svg { width: 15px; height: 15px; color: #5f63f2; flex: none; }
.hc-source > strong { color: #3b3fb8; font-weight: 700; margin-right: 2px; }
.hc-source .hc-src { margin-left: 6px; }
.hc-source > strong + .hc-src { margin-left: 0; }
.hc-source a { color: #3b3fb8; text-decoration: underline; }

/* ---------- แผนที่ความเสี่ยงรายตำบล ---------- */
.hc-src--osm { background: #7048e8; color: #fff; }
.hc-map { height: 640px; border-radius: 8px; overflow: hidden; background: #eef0f4; z-index: 0; }
@media (max-width: 767px) { .hc-map { height: 440px; } }
.hc-map-legend { background: #fff; border-radius: 8px; padding: 10px 12px; box-shadow: 0 2px 10px rgba(39, 43, 65, .15); font-size: 12px; line-height: 1.7; color: #272b41; min-width: 170px; }
.hc-map-legend strong { display: block; margin-bottom: 4px; font-size: 13px; }
.hc-map-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; border: 1px solid rgba(0, 0, 0, .15); }
.hc-map-legend span { color: #5a5f7d; }
.hc-map-label { background: none; border: 0; font-size: 11px; font-weight: 600; color: #272b41; white-space: nowrap; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; transform: translate(-50%, -50%); pointer-events: none; }
.leaflet-tooltip { font-family: "Inter", "IBM Plex Sans Thai", sans-serif; font-size: 13px; line-height: 1.5; }
.hc-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; border: 1px solid rgba(0, 0, 0, .15); }
.hc-level { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 50px; white-space: nowrap; }
.hc-level--high { background: #ff4d4f; color: #fff; }
.hc-level--mid { background: #fadb14; color: #272b41; }
.hc-level--low { background: #52c41a; color: #fff; }
.hc-level-card { display: flex; align-items: center; gap: 14px; width: 100%; background: #fff; border: 2px solid transparent; border-radius: 12px; padding: 18px 22px; cursor: pointer; transition: opacity .2s, border-color .2s; }
.hc-level-card strong { font-size: 30px; font-weight: 700; color: #272b41; line-height: 1; }
.hc-level-card__swatch { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.hc-level-card--high { border-color: #ff4d4f; } .hc-level-card--high .hc-level-card__swatch { background: #ff4d4f; }
.hc-level-card--mid { border-color: #fadb14; } .hc-level-card--mid .hc-level-card__swatch { background: #fadb14; }
.hc-level-card--low { border-color: #52c41a; } .hc-level-card--low .hc-level-card__swatch { background: #52c41a; }
.hc-level-card.is-off { opacity: .45; border-style: dashed; }
.hc-level-card:focus-visible { outline: 2px solid #5f63f2; outline-offset: 2px; }
.hc-rank { max-height: 380px; overflow-y: auto; }
.hc-rank thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.hc-row-active td { background: #f0f1fe; }
.hc-map--nolabels .hc-map-label { display: none; }
.hc-map-label { font-size: 10px; }
.hc-rank td { padding-top: 8px; padding-bottom: 8px; }

/* ---------- คำอธิบายเมื่อชี้ที่ป้ายแหล่งข้อมูล ---------- */
.hc-src[tabindex] { cursor: help; transition: box-shadow .15s; }
.hc-src[tabindex]:hover, .hc-src[tabindex]:focus-visible { box-shadow: 0 0 0 3px rgba(95, 99, 242, .25); outline: none; }
#hc-tip.is-wide { max-width: 340px; padding: 12px 14px; background: #fff; color: #272b41; border: 1px solid #e3e6ef; box-shadow: 0 8px 24px rgba(39, 43, 65, .18); border-radius: 8px; }
.hc-tip__title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid #f1f2f6; }
.hc-tip__row { display: grid; grid-template-columns: 74px 1fr; gap: 8px; font-size: 12.5px; line-height: 1.5; margin-bottom: 4px; }
.hc-tip__row span { color: #9299b8; }

/* ---------- Laravel: คะแนน POMP 4 ระดับ / หน้ารายด้าน ---------- */
.hc-avatar--sm { width: 32px; height: 32px; font-size: 14px; }
.hc-score { display: inline-block; min-width: 54px; text-align: center; font-weight: 600; font-size: 13px; color: #272b41; border-radius: 4px; padding: 3px 8px; font-variant-numeric: tabular-nums; }
.hc-masked { display: inline-block; min-width: 54px; text-align: center; font-size: 12px; font-weight: 600; color: #9299b8; background: #f4f5f7; border: 1px dashed #c6c9d8; border-radius: 4px; padding: 2px 8px; }
.hc-matrix { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 13px; }
.hc-matrix th { font-weight: 500; color: #5a5f7d; padding: 4px 6px; white-space: nowrap; }
.hc-matrix thead th { font-size: 12px; color: #9299b8; text-align: center; white-space: normal; line-height: 1.3; }
.hc-matrix td { text-align: center; padding: 4px; }
.hc-matrix td small { display: block; color: #9299b8; font-size: 11px; }
.hc-levels-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: #5a5f7d; }
.hc-levels-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }
.hc-filterbar { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.hc-filterbar .form-group { margin-bottom: 0; }
.hc-filterbar label { font-size: 12px; color: #9299b8; margin-bottom: 2px; }
.hc-overview { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: center; }
@media (max-width: 991px) { .hc-overview { grid-template-columns: minmax(0, 1fr); } }
.hc-scorebox { background: #f0f5fa; border-radius: 12px; padding: 22px 24px; }
.hc-scorebox__value { font-size: 44px; font-weight: 700; color: #166088; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hc-scorebox__value small { font-size: 26px; font-weight: 400; color: #166088; }
.hc-scorebox__level { border-radius: 10px; padding: 12px 18px; text-align: center; color: #272b41; }
.hc-scorebox__level strong { display: block; font-size: 17px; }
.hc-legend-list { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.hc-legend-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.hc-legend-list li > span:first-child { display: flex; align-items: center; gap: 10px; color: #272b41; }
.hc-legend-list i { width: 16px; height: 16px; border-radius: 3px; flex: none; }
.hc-legend-list strong { font-variant-numeric: tabular-nums; color: #272b41; white-space: nowrap; }
.hc-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
@media (min-width: 1600px) { .hc-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px) { .hc-cards { grid-template-columns: minmax(0, 1fr); } }
.hc-item { background: #fff; border: 1px solid #e3e6ef; border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; }
.hc-item__q { font-size: 13px; color: #272b41; margin-bottom: 12px; line-height: 1.5; }
.hc-item__q strong { color: #166088; margin-right: 4px; }
.hc-item__body { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 18px; align-items: center; flex: 1; }
@media (max-width: 480px) { .hc-item__body { grid-template-columns: minmax(0, 1fr); } }
.hc-bar { height: 8px; background: #f1f2f6; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.hc-bar > i { display: block; height: 100%; background: #166088; }
.hc-sub { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.hc-sub > div { border: 1px solid #e3e6ef; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.hc-alert-harm { border-left: 4px solid #ff4d4f; }
.hc-question .hc-likert { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.hc-question.is-prefill { background: #f8f9fb; }
.hc-pill { display: inline-block; font-size: 12px; border-radius: 50px; padding: 2px 10px; background: #f0f1fe; color: #5f63f2; }
.hc-offline { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 1085; }
@media print {
    .hc-filterbar, .no-print { display: none !important; }
    .hc-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hc-item { break-inside: avoid; }
}

.list-unstyled .badge-dot { display: inline-block; vertical-align: middle; }
.hc-level-card strong.fs-20 { font-size: 20px; }

/* ปุ่มเข้าสู่ระบบด้วย Google */
.hc-google { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; border: 1px solid #e3e6ef; background: #fff; color: #272b41; font-weight: 500; }
.hc-google:hover { border-color: #5f63f2; color: #272b41; }
.hc-google.disabled { opacity: .55; pointer-events: none; }

/* จุดสีบนกระดิ่ง: แสดงเฉพาะเมื่อมีการแจ้งเตือน (ธีมเดิมแสดงตลอด) */
.navbar-right__menu .nav-notification:not(.has-notes) .nav-item-toggle:before { display: none; }
