:root {
  --fg: #1d2330; --muted: #5d6675; --line: #e2e5ea; --soft: #f4f6f8; --accent: #0b6e4f;
  --rural: #1b9e5a; --urban: #2f6fd6; --approx: #d48806;
  --near: #e0671b; --a: #7b3fbf; --b: #0f8a8a; --assigned: #c2185b; --other: #f0a500;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--fg); background: #fff; }
[hidden] { display: none !important; }

#app { display: flex; height: 100%; }
#panel { width: 360px; flex: none; overflow-y: auto; border-right: 1px solid var(--line); padding: 14px 16px 28px; background: #fff; }
#map { flex: 1; min-width: 0; }
@media (max-width: 720px) {
  #app { flex-direction: column-reverse; }
  #map { flex: none; height: 58vh; }
  #panel { width: 100%; flex: 1; border-right: 0; border-top: 1px solid var(--line); }
}

h1 { font-size: 18px; margin: 0 0 2px; }
h2 { font-size: 14px; margin: 0 0 8px; }
h3 { font-size: 13px; margin: 10px 0 6px; color: var(--muted); font-weight: 600; }
header { padding-bottom: 10px; }
section { padding: 12px 0; border-top: 1px solid var(--line); }
.muted, small { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0; }

input[type=search], input[type=text], input[type=url], input[readonly], select {
  width: 100%; padding: 8px 10px; border: 1px solid #c9ced6; border-radius: 8px; font: inherit; background: #fff; color: var(--fg);
}
button { font: inherit; cursor: pointer; padding: 6px 10px; border-radius: 8px; border: 1px solid #c9ced6; background: var(--soft); color: var(--fg); }
button:hover { background: #e9edf1; }
button.danger { color: #b3261e; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; text-align: left; }
.linkbtn:hover { background: none; }
.row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
label { display: block; margin: 6px 0; }
label.chk { display: flex; align-items: center; gap: 6px; }
.filters select { margin-bottom: 6px; }
.count { margin: 8px 0 0; color: var(--muted); }

.results { list-style: none; margin: 4px 0 0; padding: 0; max-height: 260px; overflow-y: auto; }
.results li { padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.results li:hover { background: var(--soft); }
.results li span { display: block; font-size: 12px; color: var(--muted); }
.results li.none { cursor: default; color: var(--muted); }

.sitelist, .assign-list, .vol-list { list-style: none; margin: 0; padding: 0; }
.sitelist .grp { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 10px 0 4px; }
.sitelist .site { display: flex; gap: 8px; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0; padding: 6px 4px; border-radius: 6px; }
.sitelist .site:hover { background: var(--soft); }
.sitelist .site small { display: block; }
.routes a { display: block; margin: 4px 0; color: var(--accent); }

.num, .num-pin { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; }
.num { width: 22px; height: 22px; font-size: 11px; }
.num-pin { width: 28px; height: 28px; font-size: 12px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.pin-nearby { background: var(--near); }
.pin-cluster-a { background: var(--a); }
.pin-cluster-b { background: var(--b); }
.pin-assigned { background: var(--assigned); }
.other-pin { width: 14px; height: 14px; border-radius: 50%; background: var(--other); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .45); }

.phc-dot { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.phc-rural { background: var(--rural); }
.phc-urban { background: var(--urban); }
.phc-dot.phc-approx { box-shadow: 0 0 0 2px var(--approx); }
.legend div { display: flex; align-items: center; gap: 6px; margin: 5px 0; flex-wrap: wrap; }
.legend .phc-dot { display: inline-block; width: 12px; height: 12px; }

.pop h3 { margin: 4px 0 6px; font-size: 15px; color: var(--fg); }
.pop table { border-collapse: collapse; width: 100%; font-size: 12px; }
.pop th { text-align: left; color: var(--muted); font-weight: 500; padding: 2px 10px 2px 0; white-space: nowrap; vertical-align: top; }
.pop td { padding: 2px 0; word-break: break-word; }
.pop .hint { margin-top: 8px; }
.pop .act { margin-top: 10px; width: 100%; background: var(--accent); color: #fff; border-color: var(--accent); }
.badges { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; color: #fff; }
.b-rural { background: var(--rural); }
.b-urban { background: var(--urban); }
.b-approx { background: var(--approx); }
.links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.links a { font-size: 12px; padding: 4px 8px; border-radius: 6px; background: var(--soft); border: 1px solid var(--line); color: var(--accent); text-decoration: none; }
.mine-tag, .tag-free { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; display: inline-block; }
.mine-tag { background: #fdecea; color: #9c1c4d; }
.tag-free { background: var(--soft); color: var(--muted); }

.locate-btn { width: 34px; height: 34px; font-size: 18px; line-height: 1; background: #fff; border: 2px solid rgba(0, 0, 0, .2); border-radius: 4px; padding: 0; }

dialog { max-width: 560px; border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; color: var(--fg); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog p, dialog li { margin: 6px 0; }

/* admin page */
.private { font-size: 11px; background: #b3261e; color: #fff; padding: 2px 6px; border-radius: 4px; vertical-align: middle; }
.warn { color: #b3261e; font-size: 12px; margin: 4px 0 0; }
.vol-list { max-height: 320px; overflow-y: auto; margin: 6px 0; }
.vol-list li { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.vol-list li span { grid-column: 1; font-size: 12px; color: var(--muted); }
.vol-list li em { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-style: normal; font-weight: 600; background: var(--soft); border-radius: 999px; padding: 1px 8px; }
.vol-list li em.zero { color: #b3261e; }
.vol-list li:hover { background: var(--soft); }
.vol-list li.sel { background: #e6f4ee; outline: 1px solid var(--accent); }
.assign-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); }
.assign-list li.muted { display: block; border: 0; }
.assign-list .num { grid-row: 1 / span 2; }
.assign-list small { grid-column: 2; }
.assign-list .ops { grid-column: 3; grid-row: 1 / span 2; display: flex; gap: 2px; }
.assign-list .ops button { padding: 2px 7px; }
.notes { font-size: 12px; background: var(--soft); padding: 6px 8px; border-radius: 6px; }
.notes:empty { display: none; }
