/* Facilitator map (fac-map.js): the admin tab กระบวนกร and the public /network directory. Self-contained so both pages
   draw it the same: the card, header, chips and bar list are its own; colours come from the site tokens (site.css). */
.fm{background:var(--paper);border:1px solid var(--line);border-radius:16px;padding:18px 20px;font-size:15px;line-height:1.6}
.fm .small{font-size:13.5px;line-height:1.55}
.fm .muted{color:var(--gray)}
.fm-head{display:flex;justify-content:space-between;align-items:center;gap:10px 16px;flex-wrap:wrap}
.fm-head h2{font-size:18px;margin:0}
@media (max-width:560px){.fm{padding:14px}}

/* view / count / applicant chips */
.fm-chips{display:flex;gap:6px;flex-wrap:wrap}
.fm-chip{font:inherit;font-size:13.5px;font-weight:600;padding:6px 12px;border-radius:100px;cursor:pointer;
  background:var(--paper);color:var(--ink-2);border:1px solid var(--line);transition:border-color .15s,background .15s}
.fm-chip .cnt{color:var(--gray);font-variant-numeric:tabular-nums}
.fm-chip:hover{border-color:var(--blue)}
.fm-chip:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.fm-chip[aria-pressed="true"]{background:var(--ink);color:var(--paper);border-color:var(--ink)}
.fm-chip[aria-pressed="true"] .cnt{color:inherit;opacity:.7}

/* bar list (the accessible view of the map) */
.fm-bars{list-style:none;margin:10px 0 0;padding:0;display:grid;gap:8px}
.fm-row{display:grid;grid-template-columns:minmax(0,13em) minmax(0,1fr) 6ch;align-items:center;gap:10px;font-size:14px}
.fm-l{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fm-n{text-align:right;font-variant-numeric:tabular-nums}
@media(max-width:480px){.fm-row{grid-template-columns:minmax(0,1fr) 6ch}.fm-row .fm-stack{grid-column:1/-1;grid-row:2}}

/* the map: one-hue blue heat, light → dark by count; dark mode runs dark → light from its surface */
.fm{--heat-0:var(--panel);--heat-1:#B7D3F6;--heat-2:#86B6EF;--heat-3:#3987E5;--heat-4:#1C5CAB;--heat-5:#0D366B;--fm-edge:var(--paper);
  --fm-add:#F2B01E}
:where([data-theme="dark"]) .fm{--heat-1:#184F95;--heat-2:#256ABF;--heat-3:#3987E5;--heat-4:#6DA7EC;--heat-5:#B7D3F6;--fm-add:#E8A93A}
.fm-ctl{display:flex;gap:8px 16px;flex-wrap:wrap}
.fm-sum{margin:4px 0 14px}
.fm-body{display:grid;grid-template-columns:minmax(240px,340px) minmax(0,1fr);gap:20px 32px;align-items:start}
@media (max-width:760px){.fm-body{grid-template-columns:minmax(0,1fr)}.fm-map{max-width:340px;margin:0 auto;width:100%}}
.fm-map{position:relative}
.fm-svg{display:block;width:100%;height:auto;max-height:620px}
.fm-prov{stroke:var(--fm-edge);stroke-width:.6;fill:var(--heat-0);transition:fill .3s}
.fm-prov.is-base{fill:var(--line-2)}
.fm-prov.h0{fill:var(--heat-0)}.fm-prov.h1{fill:var(--heat-1)}.fm-prov.h2{fill:var(--heat-2)}
.fm-prov.h3{fill:var(--heat-3)}.fm-prov.h4{fill:var(--heat-4)}.fm-prov.h5{fill:var(--heat-5)}
.fm-reg{fill:none;stroke:var(--gray-2);stroke-width:1.1;stroke-linejoin:round;pointer-events:none}
.fm-rlabels{pointer-events:none}
.fm-rlabels text{paint-order:stroke;stroke:var(--paper);stroke-width:3.5px;stroke-linejoin:round;fill:var(--ink)}
.fm-rl-n{font-size:17px;font-weight:800;font-variant-numeric:tabular-nums}
.fm-rl-t{font-size:11.5px;font-weight:600;fill:var(--ink-2)}
.fm-mk{stroke:var(--fm-edge);stroke-width:1.6;cursor:pointer;transition:opacity .15s}
.fm-mk.h2{fill:var(--heat-2)}.fm-mk.h3{fill:var(--heat-3)}.fm-mk.h4{fill:var(--heat-4)}.fm-mk.h5{fill:var(--heat-5)}
.fm-mk.is-zero{fill:var(--paper);stroke:var(--gray);stroke-width:1.2;stroke-dasharray:2 1.6}
.fm-marks:hover .fm-mk:not(:hover){opacity:.55}
.fm-tip{position:absolute;z-index:2;display:grid;gap:1px;max-width:240px;padding:8px 11px;border-radius:10px;background:var(--ink);color:var(--paper);
  font-size:12.5px;line-height:1.45;pointer-events:none;box-shadow:0 8px 24px rgba(15,23,42,.18)}
.fm-tip[hidden]{display:none}
.fm-tip b{color:inherit;font-size:13.5px}
.fm-legend{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px;margin-top:10px;font-size:12.5px;color:var(--gray)}
.fm-ramp{display:inline-flex;gap:2px}
.fm-ramp i{width:18px;height:10px;border-radius:2px}
.fm-ramp .h1{background:var(--heat-1)}.fm-ramp .h2{background:var(--heat-2)}.fm-ramp .h3{background:var(--heat-3)}
.fm-ramp .h4{background:var(--heat-4)}.fm-ramp .h5{background:var(--heat-5)}
.fm-key{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.fm-key i{display:inline-block;width:11px;height:11px;background:var(--heat-3)}
.fm-key .fm-k-dot{border-radius:50%}.fm-key .fm-k-sq{border-radius:2.5px}
.fm-key .fm-k-zero{border-radius:50%;background:var(--paper);border:1.2px dashed var(--gray)}
.fm-side h3{font-size:15px;margin:0 0 10px}
.fm-side .fm-bars{margin:0 0 14px}
.fm-name{display:flex;flex-direction:column;min-width:0;line-height:1.35}
.fm-meta{font-size:12px;color:var(--gray)}
.fm-pick{all:unset;cursor:pointer;font-weight:600;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:4px}
.fm-pick:hover{color:var(--blue-deep);text-decoration:underline;text-underline-offset:3px}
.fm-pick:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.fm-list{max-height:430px;overflow-y:auto;padding-right:6px}
.fm-none{margin:0 0 14px;font-size:13px;line-height:1.6;color:var(--gray)}
.fm-none b{color:var(--ink-2);font-weight:600}
.fm-other{border-top:1px solid var(--line);padding-top:12px}
.fm-other h3{margin-bottom:2px}
.fm-other-n{font-variant-numeric:tabular-nums;color:var(--blue-deep)}
.fm-orgs{list-style:none;margin:8px 0 0;padding:0;display:flex;flex-wrap:wrap;gap:6px}
.fm-orgs li{padding:3px 10px;border-radius:100px;background:var(--panel);border:1px solid var(--line);font-size:13px}
.fm-credit{margin:12px 0 0;font-size:11.5px;color:var(--gray)}
/* yellow = this cohort's ขั้นต้น applicants, stacked after the blue facilitator count; numbers stay in text ink */
.fm-stack{display:flex;gap:2px;height:10px;border-radius:6px;background:var(--line-2);overflow:hidden}
.fm-stack i{display:block;height:100%;flex:0 0 calc(var(--w,0) * 100%);transition:flex-basis .45s cubic-bezier(.16,1,.3,1)}
.fm-stack:not(.is-both){gap:0}
.fm-stack .fm-b{background:var(--heat-3)}
.fm-stack .fm-y{background:var(--fm-add)}
.fm-add-n{color:var(--amber);font-weight:700}
.fm-rl-add{font-size:13px;font-weight:800;fill:var(--amber)}
.fm-ring{fill:none;stroke:var(--fm-add);stroke-width:2.4;pointer-events:none}
.fm-key .fm-k-add{border-radius:2.5px;background:var(--fm-add)}
.fm-key .fm-k-ring{border-radius:50%;background:transparent;border:2.4px solid var(--fm-add)}
.fm-add-chip[aria-pressed="true"]{background:var(--fm-add);color:#1F1300;border-color:var(--fm-add)}
.fm-add-chip[aria-pressed="true"] .cnt{color:inherit;opacity:.75}
.fm-prio{margin:0 0 16px;padding:12px 14px;border-radius:12px;background:var(--warn-bg);border:1px solid var(--warn-line)}
.fm-prio h3{margin:0}
.fm-prio p{margin:2px 0 8px}
.fm-prio-list{margin:0;padding-left:1.6em;display:grid;gap:4px;font-size:14px;font-variant-numeric:tabular-nums}
.fm-prio-list li{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px}
.fm-prio-list li .fm-pick{white-space:normal}
.fm-prio-n{font-size:13px;color:var(--gray)}
.fm-prio-list li.is-none .fm-prio-n{color:var(--ink-2);font-weight:600}
/* phones and touch screens: chips and place names are 44 px targets */
@media (max-width:560px),(pointer:coarse){
  .fm-chip{min-height:44px;padding:8px 14px}
  .fm-pick{display:block;box-sizing:border-box;min-height:44px;padding:12px 0}
}
@media (prefers-reduced-motion:reduce){.fm-prov,.fm-mk,.fm-stack i{transition:none}}
