:root {
  --ink: #153a34;
  --muted: #607b75;
  --paper: #f2f8f6;
  --card: #ffffff;
  --green: #16a085;
  --lime: #72d6c4;
  --line: #d5e5e1;
  --nav: #0d4f45;
}

body { background-color: var(--paper); color: var(--ink); }
.sidebar { background: var(--nav); }
.brand-mark, .export-button, .upload-submit { background: var(--green); }
.export-button:hover, .upload-submit:hover { background: #117864; }
.sidebar nav a.active, .sidebar nav a:hover { background: #176f60; }
.sidebar nav a.active { border-color: #72d6c4; }
.pulse { background: #3bc9b0; box-shadow: 0 0 0 7px #3bc9b022; }
.filters, .district-selector { background: #e7f4f1; border-color: #9bd8cc; }
.suggestions li:hover, .suggestions li.active { background: #e1f3ef; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px #16a08522; }
.legend-target, .badge, .table-card tfoot td, .history-table tfoot td { background: #dff2ee; }
.badge { color: #0f6f60; }
.y69:before { background: var(--green); }
.table-card thead th, .history-table thead th { border-bottom-color: #86cdbf; }
.province-tab.active { background: var(--green); border-color: var(--green); color: #fff; }
.province-tab:not(.active):hover { border-color: var(--green); color: #0f6f60; }
.bar:not(.over) { background: var(--green); }
.mini-fill { background: linear-gradient(90deg, #72d6c4, var(--green)); }
.kpi-card { border-top-color: #72d6c4; }
.kpi-card.accent, .kpi-card.green { border-top-color: var(--green); }
.trend-wrap { width: 100%; overflow-x: auto; margin-top: 18px; }
.trend-chart { display: block; width: 100%; min-width: 680px; height: auto; overflow: visible; }
.empty-state { color: var(--muted); text-align: center; padding: 44px 16px; }
.filters { flex-wrap: wrap; }
.filters .organization-search { flex: 1 1 280px; }
.position-line-table { max-height: 620px; }
.position-line-table thead th { position: sticky; top: 0; z-index: 2; background: var(--card); }
.main-professions { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-top: 14px; }
.profession-card { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--green); border-radius: 13px; padding: 17px 19px; }
.profession-card.dentist { border-top-color: #45b8a3; }
.profession-card.pharmacist { border-top-color: #72d6c4; }
.profession-card.nurse { border-top-color: #0d7665; }
.profession-card > span { color: var(--muted); font-size: 13px; }
.profession-card > strong { display: block; color: var(--ink); font: 800 29px Manrope; margin: 5px 0 8px; }
.profession-card > div { display: flex; justify-content: space-between; gap: 10px; }
.profession-card small { color: var(--muted); font-size: 11px; }
.profession-card small b { color: var(--ink); font-weight: 700; }
@media(max-width:1000px){.main-professions{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.main-professions{grid-template-columns:1fr}}
.position-checkbox-filter { position: relative; min-width: 230px; }
.position-checkbox-filter > span, .position-checkbox-form .selector-label span { display: block; color: var(--muted); font-size: 11px; font-weight: 600; margin-bottom: 4px; }
.position-checkbox-filter details, details.position-checkbox-filter { position: relative; }
.position-checkbox-filter summary { list-style: none; min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 11px; background: #fff; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-size: 13px; cursor: pointer; }
.position-checkbox-filter summary::-webkit-details-marker { display: none; }
.position-checkbox-filter summary:after { content: '▾'; color: var(--green); }
.position-checkbox-filter[open] summary:after { transform: rotate(180deg); }
.checkbox-options { position: absolute; z-index: 20; top: calc(100% + 5px); left: 0; width: min(390px,80vw); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 35px #153a3422; overflow: hidden; }
.checkbox-list { max-height: 280px; overflow: auto; padding: 8px; }
.checkbox-options label, .filters .checkbox-options label { display: flex; align-items: flex-start; gap: 9px; min-width: 0; padding: 7px 8px; border-radius: 7px; color: var(--ink); font-size: 13px; font-weight: 500; cursor: pointer; }
.checkbox-options label:hover { background: #e7f4f1; }
.checkbox-options input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--green); flex: 0 0 auto; }
.checkbox-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 9px; border-top: 1px solid var(--line); background: #f4faf8; }
.checkbox-actions button { min-height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font: 600 12px inherit; cursor: pointer; }
.checkbox-actions .apply-checkbox { border-color: var(--green); background: var(--green); color: #fff; }
.position-checkbox-form { align-items: center; }
.position-checkbox-form .position-checkbox-filter { flex: 1; }
.clear-position-lines { color: #0f6f60; font-size: 12px; font-weight: 600; text-decoration: none; }
.combined-selector { grid-template-columns: 110px repeat(2,minmax(0,1fr)); align-items: end; }
.combined-filter-field { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 600; }
@media(max-width:760px){.combined-selector{grid-template-columns:1fr}.combined-selector .selector-label{display:flex;justify-content:space-between}}
.province-filter-bar { align-items: end; margin-top: 14px; }
.filters { flex-wrap: wrap; }
#monthFilter { min-width: 170px; }
.province-filter-bar label { flex: 1 1 260px; min-width: 220px; }
.province-filter-bar select { width: 100%; }
.province-filter-bar .filter-reset { display: inline-flex; align-items: center; justify-content: center; height: 36px; margin-left: auto; padding: 0 14px; border: 1px solid #cad2ca; border-radius: 8px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.province-filter-bar .filter-reset:hover { border-color: var(--green); color: #0f6f60; }
.province-filter-bar .filter-submit { margin-left: 0; border-color: var(--green); background: var(--green); color: #fff; font-weight: 700; }
.province-filter-bar .organization-search { flex: 2 1 340px; }
.province-insight-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(360px,.85fr); gap: 14px; margin-top: 14px; }
.province-map-card, .province-target-card { min-width: 0; }
.map-frame { position: relative; min-height: 430px; margin-top: 14px; overflow: hidden; border: 1px solid #f0d6d3; border-radius: 11px; background: #fdebea; }
#districtMap, #regionMap { width: 100%; height: 430px; background: #fdebea; }
#districtMap .leaflet-control-zoom, #regionMap .leaflet-control-zoom { overflow: hidden; border: 0; border-radius: 9px; box-shadow: 0 4px 16px #123b3526; }
#districtMap .leaflet-control-zoom a, #regionMap .leaflet-control-zoom a { color: #0f6f60; border-color: #e0e9e6; }
#districtMap .leaflet-control-attribution, #regionMap .leaflet-control-attribution { padding: 2px 5px; color: #71817d; background: #ffffffd9; font-size: 9px; }
#districtMap .leaflet-tooltip { padding: 8px 10px; border: 1px solid #d5e5e1; border-radius: 8px; color: var(--ink); box-shadow: 0 6px 18px #153a3422; font-family: inherit; font-size: 12px; line-height: 1.5; }
.map-summary { position: absolute; z-index: 600; display: grid; gap: 3px; min-width: 185px; max-width: min(230px,calc(100% - 16px)); padding: 12px 14px; border: 1px solid #d5e5e1; border-radius: 10px; background: #fffffff2; box-shadow: 0 8px 24px #153a3422; }
.map-summary[hidden] { display: none; }
.map-summary strong { font-size: 17px; }
.map-summary span { color: var(--muted); font-size: 12px; }
.map-summary b { color: var(--green); font-size: 13px; }
.map-district-button { margin-top: 7px; padding: 7px 10px; border: 0; border-radius: 7px; background: var(--green); color: #fff; font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.map-district-button:hover { background: #0f806c; }
.map-legend { position: absolute; z-index: 500; bottom: 14px; left: 14px; display: grid; gap: 5px; padding: 10px 12px; border: 1px solid #dfe5e3; border-radius: 9px; background: #fffffff2; box-shadow: 0 6px 18px #153a341a; color: var(--muted); font-size: 11px; }
.map-legend strong { color: var(--ink); font-size: 12px; }
.map-legend span { display: flex; align-items: center; gap: 7px; }
.map-legend i { width: 10px; height: 10px; border-radius: 3px; background: #aeb8b5; }
.map-legend i.within { background: #38c982; }
.map-legend i.over { background: #ef6a61; }
.map-loading { position: absolute; z-index: 650; inset: 0; display: grid; place-items: center; background: #fdebea; color: #5e7771; font-size: 13px; font-weight: 600; }
.map-loading[hidden] { display: none; }
.dashboard-map-panel { margin-top: 14px; }
.dashboard-map-frame, #regionMap { min-height: 520px; height: 520px; }
.organization-trend-panel { margin-bottom: 14px; }
.organization-trend-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 14px; color: var(--muted); font-size: 11px; }
.organization-trend-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.organization-trend-legend span:before { content: ''; width: 9px; height: 9px; border-radius: 3px; background: #bfd1f6; }
.organization-trend-legend .vacant:before { background: #16a085; }
.organization-trend-legend .within:before { border-radius: 50%; background: #16a085; }
.organization-trend-legend .over:before { border-radius: 50%; background: #ef5b50; }
.organization-trend-legend .target:before { height: 3px; border-radius: 0; background: #19b96f; }
.organization-trend-wrap { margin-top: 14px; overflow-x: auto; overflow-y: hidden; }
.organization-trend-chart { display: block; min-width: 1180px; max-width: none; }
.organization-total-bar { fill: #cbd8f7; }
.organization-vacant-bar.within { fill: #16a085; }
.organization-vacant-bar.over { fill: #ef5b50; }
.organization-rate-segment { stroke: #16a085; stroke-width: 4; stroke-linecap: round; }
.organization-rate-segment.over { stroke: #ef5b50; }
.organization-rate-dot { fill: #16a085; stroke: #fff; stroke-width: 2; }
.organization-rate-dot.over { fill: #ef5b50; }
.organization-target-line { stroke: #19b96f; stroke-width: 2; stroke-dasharray: 7 5; }
.organization-target-label { fill: #118953; font: 700 11px 'IBM Plex Sans Thai'; }
.organization-bar-value { fill: #50605a; font: 600 9px Manrope; }
.organization-bar-value.vacant { fill: #0e7564; }
.organization-rate-value { fill: #0d806d; font: 800 10px Manrope; }
.organization-rate-value.over { fill: #d94339; }
.organization-name { fill: #263b34; font: 600 10px 'IBM Plex Sans Thai'; }
.target-layout { display: grid; grid-template-columns: minmax(190px,.8fr) minmax(220px,1.2fr); align-items: center; gap: 24px; min-height: 390px; }
.province-target-gauge { width: min(220px,100%); aspect-ratio: 1; margin: auto; border-radius: 50%; background: conic-gradient(var(--gauge-color) var(--p),#e8efec 0); display: grid; place-items: center; position: relative; }
.province-target-gauge:after { content: ''; position: absolute; inset: 28px; border-radius: 50%; background: #fff; }
.province-target-gauge > div { position: relative; z-index: 1; text-align: center; }
.province-target-gauge strong, .province-target-gauge small { display: block; }
.province-target-gauge strong { color: var(--ink); font: 800 31px Manrope; }
.province-target-gauge small { color: var(--muted); font-size: 12px; }
.target-status { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 14px; border-radius: 9px; }
.target-status.over { color: #9c3029; background: #fde9e6; }
.target-status.within { color: #0f6f60; background: #dff2ee; }
.target-status span { font-size: 13px; font-weight: 600; }
.target-status strong { font: 800 22px Manrope; }
.target-metrics dl { margin: 12px 0 0; }
.target-metrics dl div { display: flex; justify-content: space-between; gap: 15px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.target-metrics dt { color: var(--muted); font-size: 12px; }
.target-metrics dd { margin: 0; color: var(--ink); font: 700 14px Manrope; }
@media(max-width:1050px){.province-insight-grid{grid-template-columns:1fr}}
@media(max-width:600px){.target-layout{grid-template-columns:1fr;padding-top:20px}.map-frame,#districtMap,#regionMap,.dashboard-map-frame{height:390px;min-height:390px}.map-summary{min-width:175px}.map-legend{bottom:10px;left:10px}.map-summary span{display:inline}.map-summary .map-district-button{justify-self:start}}
.auth-page { min-height: 100vh; background: linear-gradient(145deg,#0c5549 0,#16a085 42%,#edf7f4 42%); }
.auth-shell { min-height: 100vh; margin: 0; padding: 44px 20px; display: grid; place-items: center; max-width: none; }
.auth-card { width: min(460px,100%); padding: 30px; box-shadow: 0 24px 70px #073c342b; }
.auth-card.auth-register { width: min(760px,100%); }
.auth-card h1 { margin-top: 24px; font-size: 28px; }
.auth-card > p { margin: 5px 0 20px; color: var(--muted); }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand strong,.auth-brand small { display: block; }
.auth-brand strong { font: 800 20px Manrope; }
.auth-brand small { color: var(--muted); font-size: 11px; }
.auth-card form { display: grid; gap: 14px; }
.auth-card label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 600; }
.auth-card input { width: 100%; height: 42px; border: 1px solid #cadbd6; border-radius: 8px; padding: 0 12px; color: var(--ink); font: 500 14px 'IBM Plex Sans Thai'; background: #fff; }
.auth-card input:focus { outline: 2px solid #16a08555; border-color: #16a085; }
.auth-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.auth-form-grid .full-field { grid-column: 1/-1; }
.auth-links { display: flex; justify-content: space-between; gap: 15px; margin-top: 18px; }
.auth-links a,.user-actions a { color: #0f806c; font-size: 13px; font-weight: 600; text-decoration: none; }
.user-header { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 10px 14px; }
.user-header span { color: var(--muted); font-size: 12px; font-weight: 600; }
.user-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.user-actions form { display: inline-flex; gap: 5px; }
.user-actions select { padding: 5px 26px 5px 8px; border: 1px solid #cbd8d4; border-radius: 6px; background: #fff; color: #31554b; font-family: inherit; }
.user-actions select:disabled { background: #eef3f1; color: #789087; cursor: not-allowed; }
.user-actions button { padding: 5px 8px; border: 1px solid #cbd8d4; border-radius: 6px; background: #fff; color: #31554b; cursor: pointer; font-family: inherit; }
.user-actions .danger-button { border-color: #efc8c4; color: #bd3f35; }
.auth-card .password-field { position: relative; display: block; width: 100%; }
.auth-card .password-field input { width: 100%; padding-right: 48px; }
.auth-card .password-field .password-toggle { position: absolute; z-index: 2; top: 50%; right: 7px; transform: translateY(-50%); display: grid; place-items: center; width: 36px; height: 36px; margin: 0; padding: 0; border: 0; border-radius: 9px; background: transparent; color: #647b73; cursor: pointer; }
.auth-card .password-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-card .password-toggle .eye-closed { display: none; }
.auth-card .password-toggle[aria-pressed="true"] .eye-open { display: none; }
.auth-card .password-toggle[aria-pressed="true"] .eye-closed { display: block; }
.auth-card .password-toggle:hover { color: #0f806c; background: #e4f3ef; }
.auth-card .password-toggle:focus-visible { color: #0f806c; background: #e4f3ef; outline: 2px solid #16a08566; outline-offset: 1px; }
@media(max-width:600px){.auth-shell{padding:20px 12px}.auth-card{padding:22px}.auth-form-grid{grid-template-columns:1fr}.auth-form-grid .full-field{grid-column:auto}.auth-links{flex-direction:column}.user-header{justify-content:flex-start}}
