:root{
  --bg:#f3f8fe;
  --surface:#ffffff;
  --surface-soft:#f7fbff;
  --line:#d8e7f5;
  --line-strong:#c7ddf2;
  --text:#0f2747;
  --muted:#647b94;
  --blue:#1565d8;
  --blue-2:#3b82f6;
  --teal:#14b8a6;
  --green:#16a34a;
  --amber:#f0b400;
  --orange:#f97316;
  --red:#dc2626;
  --slate:#64748b;
  --shadow:0 10px 28px rgba(11,31,68,.08);
  --header-h:108px;
  --footer-h:58px;
}
*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;max-width:100%;overflow:hidden}
body{
  font-family:"Prompt","Noto Sans Thai",sans-serif;
  color:var(--text);
  background:#eef6ff;
  display:grid;
  grid-template-rows:var(--header-h) minmax(0,1fr) var(--footer-h);
}
button,select{font:inherit}
button{cursor:pointer}

/* ===== Public header ===== */
.topbar{
  position:relative;
  z-index:20;
  width:100%;
  min-width:0;
  height:var(--header-h);
  padding:0 clamp(28px,4vw,72px) 0 clamp(118px,10vw,168px);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
  overflow:hidden;
  background:
    radial-gradient(circle at 88% 18%,rgba(59,130,246,.09) 0 74px,transparent 75px),
    radial-gradient(circle at 94% 60%,rgba(20,184,166,.08) 0 110px,transparent 111px),
    linear-gradient(110deg,#fff 0%,#fff 58%,#f5fbff 80%,#effcf9 100%);
  border-bottom:1px solid var(--line);
  box-shadow:0 6px 22px rgba(11,31,68,.07);
}
.topbar::before{
  content:"";
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  width:96px;
  background:
    linear-gradient(118deg,transparent 0 24%,#14b8a6 24% 36%,transparent 36% 44%,#2f80ed 44% 60%,transparent 60% 100%);
  pointer-events:none;
}
.topbar::after{
  content:"+";
  position:absolute;
  right:31%;
  top:18px;
  color:rgba(59,130,246,.09);
  font-size:76px;
  line-height:1;
  font-weight:800;
  pointer-events:none;
}
.brand{
  position:relative;
  z-index:2;
  min-width:0;
  display:flex;
  align-items:center;
  gap:16px;
}
.brand img{
  width:58px;
  height:58px;
  flex:0 0 auto;
  padding:5px;
  object-fit:contain;
  border:1px solid #d2e6f7;
  border-radius:50%;
  background:#fff;
  box-shadow:0 8px 20px rgba(21,101,216,.10);
}
.brand-copy{min-width:0}
.brand-line{
  display:flex;
  align-items:baseline;
  gap:7px;
  min-width:0;
  white-space:nowrap;
  line-height:1;
  letter-spacing:-.025em;
  font-weight:800;
  font-size:clamp(24px,2.15vw,34px);
}
.brand-smart{color:#184f9f}
.brand-ncd{
  background:linear-gradient(90deg,#1976d2 0%,#14b8a6 100%);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}
.brand-public{color:#0f3d79}
.brand-copy>span{
  display:block;
  margin-top:8px;
  max-width:720px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:#526d8c;
  font-size:13px;
  font-weight:600;
}
.top-actions{
  position:relative;
  z-index:3;
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:12px;
}
.sync{
  min-height:50px;
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(247,251,255,.92);
  box-shadow:0 6px 18px rgba(11,31,68,.06);
  color:#1c3657;
  font-size:11px;
}
.sync i{
  width:10px;
  height:10px;
  border-radius:50%;
  flex:0 0 auto;
  background:#20a65a;
  box-shadow:0 0 0 4px rgba(32,166,90,.09);
}
.sync b{display:block;font-size:12px}
.sync span{display:block;margin-top:2px;color:var(--muted);font-size:10px}
.staff-btn{
  min-height:50px;
  display:inline-flex;
  align-items:center;
  gap:9px;
  padding:0 18px;
  border:0;
  border-radius:13px;
  background:linear-gradient(135deg,#1664d7,#1f76e6);
  color:#fff;
  font-weight:700;
  box-shadow:0 9px 20px rgba(21,101,216,.20);
}
.staff-btn:hover{filter:brightness(.98)}
.lock-icon{
  width:22px;
  height:22px;
  display:grid;
  place-items:center;
  border-radius:7px;
  background:rgba(255,255,255,.14);
  font-size:10px;
}

/* ===== Scroll workspace / background ===== */
.public-main{
  position:relative;
  min-width:0;
  min-height:0;
  overflow:auto;
  scrollbar-width:none;
  -ms-overflow-style:none;
  padding:26px clamp(22px,4vw,64px) 34px;
  background:
    radial-gradient(circle at 2% 10%,rgba(37,99,235,.08),transparent 24%),
    radial-gradient(circle at 96% 18%,rgba(34,211,238,.11),transparent 27%),
    radial-gradient(circle at 78% 96%,rgba(20,184,166,.10),transparent 28%),
    linear-gradient(180deg,#f8fbff 0%,#f3f8fe 52%,#eef9f8 100%);
}
.public-main::-webkit-scrollbar{width:0;height:0;display:none}
.public-main::before,
.public-main::after{
  content:"";
  position:fixed;
  z-index:0;
  pointer-events:none;
  border-radius:50%;
  filter:blur(.2px);
}
.public-main::before{
  width:320px;
  height:320px;
  left:-130px;
  bottom:80px;
  background:rgba(59,130,246,.045);
}
.public-main::after{
  width:380px;
  height:380px;
  right:-160px;
  top:160px;
  background:rgba(20,184,166,.045);
}
.public-main>*{position:relative;z-index:1}
.public-main>section,
.public-main>.state,
.public-main>.privacy{
  width:min(100%,1460px);
  margin-left:auto;
  margin-right:auto;
}

/* ===== Filter ===== */
.filter-card{
  display:grid;
  grid-template-columns:minmax(280px,1fr) repeat(3,minmax(170px,220px));
  gap:16px;
  align-items:end;
  padding:18px 20px;
  border:1px solid var(--line);
  border-radius:18px;
  background:rgba(255,255,255,.95);
  box-shadow:var(--shadow);
}
.filter-title{
  display:flex;
  align-items:center;
  gap:14px;
}
.filter-icon{
  width:52px;
  height:52px;
  flex:0 0 auto;
  display:grid;
  place-items:center;
  border-radius:14px;
  background:linear-gradient(145deg,#eaf3ff,#dcecff);
  color:#1767d8;
  font-size:22px;
  font-weight:800;
}
.filter-title b{display:block;font-size:21px}
.filter-title span:not(.filter-icon){display:block;margin-top:4px;color:var(--muted);font-size:12px}
.filter-card label{color:#58708c;font-size:11px;font-weight:600}
.filter-card select{
  width:100%;
  height:42px;
  margin-top:6px;
  padding:0 12px;
  border:1px solid var(--line-strong);
  border-radius:10px;
  outline:none;
  background:#fff;
  color:var(--text);
  font-weight:600;
}
.filter-card select:focus{border-color:#8bb8ef;box-shadow:0 0 0 3px rgba(59,130,246,.08)}

/* ===== Dashboard sections ===== */
.dashboard-section{
  margin-top:20px;
  padding:16px;
  border:1px solid rgba(199,221,242,.9);
  border-radius:20px;
  background:rgba(255,255,255,.54);
  box-shadow:0 12px 30px rgba(11,31,68,.05);
}
.care-section{border-top:4px solid #2679ec}
.screening-section{border-top:4px solid #16a34a}
.section-heading{
  display:flex;
  align-items:center;
  gap:12px;
  padding:4px 2px 14px;
  border-bottom:1px solid var(--line);
}
.section-heading h2{margin:0;font-size:21px}
.section-heading p{margin:4px 0 0;color:var(--muted);font-size:11px}
.section-icon{
  width:46px;
  height:46px;
  display:grid;
  place-items:center;
  flex:0 0 auto;
  border-radius:14px;
  background:#e6f0ff;
  color:#0d55bb;
  font-size:11px;
  font-weight:800;
}
.screening-section .section-icon{background:#e8f7ec;color:#15803d}
.section-toolbar{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:12px;
  padding-top:14px;
  color:var(--muted);
  font-size:11px;
}
.screening-filter-group{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.screening-filter-group>span{font-weight:600;white-space:nowrap}

/* ===== KPI ===== */
.kpi-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin:14px 0 0;
}
.kpi{
  position:relative;
  min-height:108px;
  padding:14px 15px;
  overflow:hidden;
  display:grid;
  grid-template-columns:46px minmax(0,1fr);
  align-items:center;
  gap:12px;
  border:1px solid var(--line);
  border-top:3px solid #2d7df0;
  border-radius:16px;
  background:#fff;
  box-shadow:0 8px 20px rgba(11,31,68,.06);
}
.kpi-icon{
  width:46px;
  height:46px;
  display:grid;
  place-items:center;
  border-radius:13px;
  background:#eaf3ff;
  color:#1767d8;
}
.kpi-icon .ncd-icon{font-size:23px}
.kpi-copy{min-width:0}
.kpi-copy>span{font-size:11px;color:#526d8c;font-weight:700}
.kpi strong{display:block;margin-top:6px;font-size:31px;line-height:1;color:#0c2c56}
.kpi small{display:block;margin-top:6px;color:#72859b;font-size:10px;line-height:1.35}
.kpi.tone-green{border-top-color:#17a857}.kpi.tone-green .kpi-icon{background:#e9f8ef;color:#159447}
.kpi.tone-amber{border-top-color:#f0ad00}.kpi.tone-amber .kpi-icon{background:#fff5df;color:#e08a00}
.kpi.tone-slate{border-top-color:#7b8ba3}.kpi.tone-slate .kpi-icon{background:#f0f3f8;color:#6b7f99}
.kpi.tone-teal{border-top-color:#14b8a6}.kpi.tone-teal .kpi-icon{background:#e7faf6;color:#0f9f86}

/* ===== Panels / charts ===== */
.panel{
  min-width:0;
  margin-top:14px;
  padding:16px;
  border:1px solid var(--line);
  border-radius:17px;
  background:#fff;
  box-shadow:0 8px 22px rgba(11,31,68,.055);
}
.panel-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  padding-bottom:11px;
  border-bottom:1px solid var(--line);
}
.panel-head h2{margin:0;font-size:17px}
.panel-head p{margin:3px 0 0;color:var(--muted);font-size:11px}
.chart-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.chart-wrap{
  position:relative;
  min-width:0;
  max-width:100%;
  min-height:300px;
  padding:16px 6px 2px;
  overflow:hidden;
}
.chart-scroll-inner{min-width:100%;height:280px}
.scroll-chart{
  max-width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  overscroll-behavior-inline:contain;
  scrollbar-width:thin;
}
.scroll-chart .chart-scroll-inner{max-width:none}
.vchart{
  position:relative;
  box-sizing:border-box;
  width:100%;
  height:280px;
  padding:18px 10px 62px 38px;
  display:flex;
  align-items:flex-end;
  gap:9px;
  background-image:repeating-linear-gradient(to top,transparent 0,transparent calc(25% - 1px),#e6eef8 25%);
  border-left:1px solid #d8e7f5;
  border-bottom:1px solid #d8e7f5;
}
.vbar-item{
  position:relative;
  min-width:0;
  height:100%;
  flex:1;
  display:flex;
  align-items:flex-end;
  justify-content:center;
}
.vbar{
  position:relative;
  width:min(48px,70%);
  min-height:2px;
  border-radius:8px 8px 2px 2px;
  background:linear-gradient(180deg,#4d9af7,#246fdc);
  transition:filter .2s ease,transform .2s ease;
}
.vbar:hover{filter:brightness(.97);transform:translateY(-1px)}
.bar-value{
  position:absolute;
  top:-24px;
  left:50%;
  transform:translateX(-50%);
  white-space:nowrap;
  color:#0b1f44;
  font-size:11px;
  font-weight:800;
}
.bar-label{
  position:absolute;
  top:calc(100% + 10px);
  left:50%;
  width:100%;
  max-width:104px;
  min-height:34px;
  transform:translateX(-50%);
  white-space:normal;
  overflow-wrap:anywhere;
  text-align:center;
  color:#5f7895;
  font-size:9.5px;
  line-height:1.3;
}
.vbar.status-normal{background:#16a34a}
.vbar.status-risk{background:#eab308}
.vbar.status-suspected{background:#f97316}
.vbar.status-newcase{background:#dc2626}
.tooltip{
  position:fixed;
  z-index:100;
  display:none;
  pointer-events:none;
  padding:7px 9px;
  border-radius:8px;
  background:#0b1f44;
  color:#fff;
  box-shadow:0 6px 20px rgba(0,0,0,.18);
  font-size:11px;
}

/* ===== Controls / states ===== */
.segmented{display:flex;gap:4px;padding:3px;border-radius:10px;background:#eaf3ff}
.segmented button{
  border:0;
  border-radius:7px;
  padding:6px 10px;
  background:transparent;
  color:#647b94;
  font-size:11px;
}
.segmented button.active{
  background:#fff;
  color:#0d55bb;
  font-weight:700;
  box-shadow:0 2px 8px rgba(15,23,42,.07);
}
.state{margin-top:14px;padding:18px;border-radius:16px;text-align:center}
.state span{display:block;margin:4px 0 10px}
.error-state{border:1px solid #fecaca;background:#fff1f2;color:#991b1b}
.error-state button{border:0;border-radius:8px;padding:7px 12px;background:#991b1b;color:#fff}
.empty-state{height:260px;display:grid;place-items:center;color:var(--muted);font-size:12px}
.skeleton{
  overflow:hidden;
  border-radius:10px;
  background:linear-gradient(90deg,#f7fbff 25%,#eaf4ff 37%,#f7fbff 63%);
  background-size:400% 100%;
  animation:shimmer 1.25s infinite;
}
.skeleton>*{visibility:hidden}
@keyframes shimmer{0%{background-position:100% 0}100%{background-position:0 0}}
.privacy{
  margin-top:20px;
  margin-bottom:0;
  text-align:center;
  color:#69819d;
  font-size:10px;
}

/* ===== Footer ===== */
.public-footer{
  position:relative;
  z-index:25;
  min-width:0;
  height:var(--footer-h);
  padding:0 clamp(32px,4vw,68px);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  overflow:hidden;
  border-top:1px solid var(--line);
  background:
    linear-gradient(100deg,#f5fbff 0%,#fff 30%,#fff 70%,#f1fcf9 100%);
  box-shadow:0 -5px 18px rgba(11,31,68,.04);
  color:#607794;
  font-size:10px;
}
.public-footer::before,
.public-footer::after{
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  width:34px;
  pointer-events:none;
}
.public-footer::before{
  left:0;
  background:linear-gradient(120deg,#14b8a6 0 34%,transparent 35% 48%,#2f80ed 49% 66%,transparent 67%);
}
.public-footer::after{
  right:0;
  transform:scaleX(-1);
  background:linear-gradient(120deg,#14b8a6 0 34%,transparent 35% 48%,#2f80ed 49% 66%,transparent 67%);
}
.footer-left,.footer-right{display:flex;align-items:center;gap:12px;min-width:0}
.footer-left b{color:#1559bd}
.footer-divider{color:#aab9ca}
.footer-right{font-weight:600}

/* ===== Responsive ===== */
@media (min-width:1200px){
  .scroll-chart .chart-scroll-inner{min-width:100%!important}
  .scroll-chart .vchart{min-width:100%}
}
@media (max-width:1100px){
  :root{--header-h:98px}
  .topbar{padding-left:96px;padding-right:20px}
  .topbar::before{width:76px}
  .brand img{width:52px;height:52px}
  .brand-line{font-size:25px}
  .filter-card{grid-template-columns:1fr repeat(3,minmax(145px,1fr))}
  .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:900px){
  :root{--header-h:92px}
  .topbar{padding-left:24px}
  .topbar::before,.topbar::after{display:none}
  .brand img{width:48px;height:48px}
  .brand-line{font-size:20px}
  .brand-copy>span{font-size:11px}
  .sync{display:none}
  .filter-card{grid-template-columns:1fr 1fr}
  .filter-title{grid-column:1/-1}
  .chart-grid{grid-template-columns:1fr}
  .scroll-chart .chart-scroll-inner{min-width:max(720px,100%)!important}
  .section-toolbar{justify-content:flex-start;flex-wrap:wrap}
}
@media (max-width:640px){
  :root{--header-h:84px;--footer-h:62px}
  .topbar{padding:0 12px;gap:10px}
  .brand{gap:9px}
  .brand img{width:42px;height:42px}
  .brand-line{gap:4px;font-size:15px}
  .brand-copy>span{max-width:58vw;margin-top:5px;font-size:9px}
  .staff-btn{min-height:42px;padding:0 11px;font-size:10px}
  .lock-icon{display:none}
  .public-main{padding:12px 9px 24px}
  .filter-card{grid-template-columns:1fr 1fr;padding:13px;gap:10px}
  .filter-card label:last-child{grid-column:1/-1}
  .filter-title b{font-size:17px}
  .filter-icon{width:44px;height:44px}
  .dashboard-section{padding:10px;margin-top:12px;border-radius:15px}
  .section-heading{align-items:flex-start}
  .section-heading h2{font-size:17px}
  .kpi-grid{gap:8px}
  .kpi{min-height:96px;padding:12px;grid-template-columns:40px minmax(0,1fr);gap:9px}
  .kpi-icon{width:40px;height:40px;border-radius:11px}
  .kpi-icon .ncd-icon{font-size:20px}
  .kpi strong{font-size:26px}
  .panel{padding:12px}
  .chart-wrap{min-height:280px}
  .vchart{padding-bottom:68px}
  .scroll-chart .chart-scroll-inner{min-width:max(760px,100%)!important}
  .section-toolbar{align-items:flex-start}
  .screening-filter-group{width:100%;justify-content:space-between}
  .screening-filter-group .segmented{max-width:100%;overflow-x:auto}
  .public-footer{padding:0 18px;justify-content:center;flex-direction:column;gap:2px}
  .footer-left,.footer-right{gap:7px}
}

/* Smart NCD icon integration v2.39.0 */
.filter-icon .ncd-icon{font-size:24px}
.section-icon .ncd-icon{font-size:23px}
.lock-icon .ncd-icon{font-size:15px}
.privacy{display:flex;align-items:center;justify-content:center;gap:6px}
.privacy .ncd-icon{font-size:13px;flex:0 0 auto}


/* ===== Village target vs screened grouped chart v2.44.1 ===== */
.coverage-panel .panel-head{
  align-items:center;
}
.coverage-legend{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:16px;
  flex-wrap:wrap;
  color:#58708c;
  font-size:11px;
  font-weight:700;
}
.coverage-legend span{
  display:inline-flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
}
.coverage-legend i{
  width:12px;
  height:12px;
  border-radius:4px;
  box-shadow:inset 0 0 0 1px rgba(15,39,71,.05);
}
.coverage-legend i.target{
  background:linear-gradient(180deg,#60a5fa,#3b82f6);
}
.coverage-legend i.screened{
  background:linear-gradient(180deg,#34d399,#10b981);
}
.coverage-chart{
  min-height:350px;
  padding:12px 0 0;
}
.coverage-scroll-inner{
  position:relative;
  height:326px;
  min-width:100%;
  padding-top:8px;
}
.coverage-axis-label{
  position:absolute;
  z-index:2;
  left:6px;
  top:2px;
  color:#7187a0;
  font-size:10px;
  font-weight:700;
}
.coverage-group-chart{
  position:relative;
  width:100%;
  height:318px;
  padding:38px 20px 76px 44px;
  display:flex;
  align-items:flex-end;
  gap:20px;
  background-image:repeating-linear-gradient(
    to top,
    transparent 0,
    transparent calc(25% - 1px),
    #e6eef8 25%
  );
  border-left:1px solid #d8e7f5;
  border-bottom:1px solid #d8e7f5;
}
.coverage-village-group{
  position:relative;
  flex:0 0 126px;
  min-width:126px;
  height:100%;
  display:flex;
  align-items:flex-end;
  justify-content:center;
}
.coverage-bars{
  width:100%;
  height:100%;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  gap:9px;
}
.coverage-bar{
  position:relative;
  width:42px;
  min-height:2px;
  padding:0;
  border:0;
  border-radius:8px 8px 2px 2px;
  transition:transform .18s ease,filter .18s ease,box-shadow .18s ease;
}
.coverage-bar:hover{
  transform:translateY(-2px);
  filter:brightness(.98);
  box-shadow:0 8px 18px rgba(15,39,71,.12);
}
.coverage-bar.target{
  background:linear-gradient(180deg,#60a5fa 0%,#3b82f6 100%);
}
.coverage-bar.screened{
  background:linear-gradient(180deg,#34d399 0%,#10b981 100%);
}
.coverage-count{
  position:absolute;
  top:-23px;
  left:50%;
  transform:translateX(-50%);
  white-space:nowrap;
  color:#0b1f44;
  font-size:10.5px;
  line-height:1;
  font-weight:800;
}
.coverage-percent{
  position:absolute;
  top:-48px;
  left:50%;
  transform:translateX(-50%);
  min-width:48px;
  padding:4px 7px;
  border:1px solid #bbf7d0;
  border-radius:999px;
  background:#ecfdf5;
  color:#059669;
  box-shadow:0 3px 9px rgba(5,150,105,.08);
  white-space:nowrap;
  font-size:9px;
  line-height:1;
  font-weight:800;
}
.coverage-village-label{
  position:absolute;
  top:calc(100% + 13px);
  left:50%;
  width:132px;
  min-height:42px;
  transform:translateX(-50%);
  text-align:center;
  line-height:1.25;
}
.coverage-village-label strong{
  display:block;
  color:#45617f;
  font-size:10px;
}
.coverage-village-label span{
  display:block;
  margin-top:3px;
  color:#6c8199;
  font-size:9px;
  overflow-wrap:anywhere;
}
.coverage-chart .empty-state{
  height:300px;
}
.tooltip{
  white-space:pre-line;
  line-height:1.55;
}
@media (max-width:900px){
  .coverage-panel .panel-head{
    align-items:flex-start;
    flex-direction:column;
  }
  .coverage-legend{
    justify-content:flex-start;
  }
  .coverage-village-group{
    flex-basis:118px;
    min-width:118px;
  }
}
@media (max-width:640px){
  .coverage-chart{min-height:330px}
  .coverage-scroll-inner{height:308px}
  .coverage-group-chart{
    height:300px;
    padding-left:38px;
    gap:14px;
  }
  .coverage-village-group{
    flex-basis:112px;
    min-width:112px;
  }
  .coverage-bar{width:38px}
}

/* Operational area scope: total / in responsibility / out of responsibility */
#careKpis{grid-template-columns:repeat(3,minmax(0,1fr))}
.coverage-village-label .outside-label{display:block;color:#b45309;font-size:9.5px;line-height:1.3}
@media(max-width:900px){#careKpis{grid-template-columns:1fr}}
