:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #151b23;
  --surface-2: #1c2430;
  --hover: #222c3a;
  --text: #e6ebf1;
  --muted: #8b96a5;
  --border: #29323e;
  --accent: #5aa9ff;
  --accent-strong: #2f81f7;
  --confirmed: #ef4458;
  --possible: #f5c031;
  --nonprofit: #3fbf6f;
  --government: #4c8dff;
  --other: #8a929e;
  --topbar-h: 58px;
  --panel-w: 420px;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
[hidden] { display: none !important; }
::selection { background: rgba(90,169,255,.35); }
* { scrollbar-color: #364152 transparent; scrollbar-width: thin; }

/* top bar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 20px 0;
  display: flex; align-items: center; gap: 16px;
  background: rgba(13,17,23,.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { color: var(--text); font-weight: 700; text-decoration: none; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.brand::before {
  content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 9px;
  background: var(--confirmed); box-shadow: 0 0 0 3px rgba(239,68,88,.25); vertical-align: 1px;
}
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a {
  color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 8px; font-weight: 500; font-size: 14px;
  transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--text); background: var(--surface-2); }
.nav a.donate-link { background: var(--possible); color: #1a1400; font-weight: 700; margin-left: 8px; }
.nav a.donate-link:hover { filter: brightness(1.08); }
.menu-toggle { display: none; margin-left: auto; background: none; border: 0; color: var(--text); font-size: 24px; cursor: pointer; padding: 4px 8px; }

.page { position: fixed; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); bottom: 0; left: 0; right: 0; }
.page.content { overflow-y: auto; padding: 28px 20px 56px; }
.page.content > * { max-width: 1100px; margin-left: auto; margin-right: auto; }
h1, h2.page-title { font-size: 30px; line-height: 1.2; letter-spacing: -.02em; margin: 6px auto 8px; }
h2 { font-size: 19px; letter-spacing: -.01em; margin-top: 30px; }
.lede { color: var(--muted); font-size: 16px; }
.muted { color: var(--muted); }

/* map page layout */
.page.content > .map-layout, .page.content > .map-intro, .page.content > .disclaimer { max-width: 1440px; }
.map-intro h1 { margin-top: 0; }
.map-intro .lede { margin: 0 0 18px; }
.map-layout {
  display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px;
  height: max(520px, calc(100vh - var(--topbar-h) - 230px));
}
.map-card {
  position: relative; overflow: hidden; min-height: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
#leaflet-map { position: absolute; inset: 0; background: #0f141b; }
.map-card { isolation: isolate; }  /* keep the map's z-indexes inside the card */
.finder {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  overflow-y: auto; min-height: 0;
}
.disclaimer {
  display: flex; gap: 12px; align-items: flex-start;
  margin-top: 16px; padding: 14px 16px; font-size: 14px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--possible);
  border-radius: 10px;
}
.disclaimer b { color: var(--text); }
.disclaimer .icon { color: var(--possible); font-size: 18px; line-height: 1.2; flex: none; }
.disclaimer p { margin: 0; }

/* controls */
#search-form { display: flex; gap: 6px; }
input[type="search"], select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
input[type="search"]::placeholder { color: #66717f; }
input[type="search"]:focus, select:focus { outline: none; border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(47,129,247,.25); }
#search-form input { flex: 1; min-width: 0; padding: 9px 11px; }
input[type="checkbox"] { accent-color: var(--accent-strong); }
button {
  font: inherit; font-size: 14px; cursor: pointer; border: 0; border-radius: 8px; padding: 9px 14px;
  background: var(--accent-strong); color: #fff; font-weight: 600; transition: filter .15s, background .15s;
}
button:hover { filter: brightness(1.1); }
button.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); width: 100%; margin-top: 8px; }
button.secondary:hover { background: var(--hover); filter: none; }
button:disabled { opacity: .5; cursor: default; }
button.link { background: none; color: var(--accent); padding: 0; font-weight: 600; font-size: 13px; }
button.link:hover { text-decoration: underline; filter: none; }

.results { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--border); border-radius: 8px; max-height: 240px; overflow-y: auto; background: var(--bg); }
.results li { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--border); }
.results li:last-child { border-bottom: 0; }
.results li:hover { background: var(--hover); }
.results small { color: var(--muted); display: block; }

.filter-head {
  display: flex; align-items: baseline; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--border);
}
.filter-actions { margin-left: auto; text-transform: none; letter-spacing: 0; color: var(--muted); }
.legend { margin-top: 8px; display: grid; gap: 2px; }
.legend label {
  display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none;
  padding: 4px 6px; margin: 0 -6px; border-radius: 6px; font-size: 14px; transition: background .12s, opacity .12s;
}
.legend label:hover { background: var(--surface-2); }
.legend label.off { opacity: .45; }
.legend .count { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; flex: none; vertical-align: 0; box-shadow: 0 0 0 1.5px rgba(0,0,0,.5); }
.dot.confirmed { background: var(--confirmed); }
.dot.possible { background: var(--possible); }
.dot.nonprofit { background: var(--nonprofit); }
.dot.government { background: var(--government); }
.dot.other { background: var(--other); }

.nearby { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.nearby summary { cursor: pointer; font-weight: 600; }
.nearby ol { margin: 8px 0 0; padding-left: 22px; }
.nearby li { margin: 5px 0; cursor: pointer; font-size: 14px; }
.nearby li:hover span.name { text-decoration: underline; }
.nearby small { color: var(--muted); }

/* right-side panel (inside the map card) */
.panel {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 1100;  /* above Leaflet's controls (1000) */
  width: min(var(--panel-w), 100%);
  background: rgba(21,27,35,.97); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-left: 1px solid var(--border); box-shadow: -10px 0 30px rgba(0,0,0,.4);
  transform: translateX(105%); transition: transform .28s cubic-bezier(.2,.8,.2,1);
  overflow-y: auto; padding: 20px 20px 40px;
}
.panel.open { transform: translateX(0); }
.panel-close {
  position: sticky; top: 0; float: right; background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  width: 34px; height: 34px; padding: 0; font-size: 20px; line-height: 32px; border-radius: 50%;
}
.p-address { font-size: 15px; font-weight: 600; margin: 0 44px 8px 0; line-height: 1.4; }
.p-address a { color: var(--text); text-decoration: none; border-bottom: 1px dashed #4a5566; }
.p-address a:hover { border-bottom-color: var(--accent); }
.p-address small { color: var(--muted); font-weight: 500; }
.p-name { font-size: 22px; letter-spacing: -.01em; margin: 6px 0 12px; line-height: 1.25; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px;
  padding: 4px 11px; border-radius: 999px; border: 1px solid;
}
.badge.confirmed { background: rgba(239,68,88,.15); color: #ff8592; border-color: rgba(239,68,88,.45); }
.badge.possible { background: rgba(245,192,49,.14); color: #f8d26a; border-color: rgba(245,192,49,.45); }
.badge.nonprofit { background: rgba(63,191,111,.14); color: #6fd896; border-color: rgba(63,191,111,.45); }
.badge.government { background: rgba(76,141,255,.15); color: #8db6ff; border-color: rgba(76,141,255,.45); }
.badge.other { background: rgba(138,146,158,.15); color: #b8bfc9; border-color: rgba(138,146,158,.45); }
.p-section { margin-top: 20px; }
.p-section h3 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 5px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.evidence { margin-top: 8px; font-size: 13.5px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; overflow-wrap: anywhere; color: #c5cdd8; }
.owners { width: 100%; border-collapse: collapse; font-size: 13px; }
.owners th { color: var(--muted); font-weight: 600; }
.owners th, .owners td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.owners td:last-child, .owners th:last-child { text-align: right; white-space: nowrap; }
.note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.owners.staff td small { display: block; color: var(--muted); font-size: 11.5px; }
.owners.staff td:first-child { white-space: nowrap; color: var(--muted); }
.pill { display: inline-block; margin-top: 3px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; border: 1px solid; }
.pill.pe { color: #ff8592; background: rgba(239,68,88,.12); border-color: rgba(239,68,88,.45); }
.pill.former { color: #b8bfc9; background: rgba(138,146,158,.12); border-color: rgba(138,146,158,.45); }
.finder .hint { margin: 6px 0 0; font-size: 12.5px; }

/* Leaflet in dark */
.leaflet-container { background: #0f141b; font: inherit; }
.leaflet-bar { border: 1px solid var(--border) !important; box-shadow: var(--shadow) !important; border-radius: 10px !important; overflow: hidden; }
.leaflet-bar a, .leaflet-bar a:hover { background: var(--surface); color: var(--text); border-bottom-color: var(--border); }
.leaflet-bar a:hover { background: var(--hover); }
.leaflet-control-attribution { background: rgba(13,17,23,.75) !important; color: var(--muted); font-size: 11px; }
.leaflet-control-attribution a { color: #a9b4c2; }
.leaflet-tooltip {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.4); font-size: 13px; font-weight: 600;
}
.leaflet-tooltip-top::before { border-top-color: var(--surface-2); }
.osm-dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9); }

/* tables page */
.downloads { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px auto 20px; }
.downloads a {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none;
  background: var(--surface); color: var(--text); font-size: 13.5px; transition: border-color .15s, background .15s;
}
.downloads a:hover { border-color: var(--accent-strong); background: var(--surface-2); }
.table-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.table-controls input, .table-controls select { padding: 8px 10px; }
.table-controls input { flex: 1 1 260px; }
#t-count { color: var(--muted); margin-left: auto; font-size: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
#t { border-collapse: collapse; width: 100%; font-size: 14px; }
#t th {
  position: sticky; top: 0; background: var(--surface-2); text-align: left; padding: 10px 10px; cursor: pointer; white-space: nowrap;
  border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
#t th:hover { color: var(--text); }
#t th.sorted { color: var(--text); }
#t th.sorted::after { content: " \25BE"; }
#t th.sorted.asc::after { content: " \25B4"; }
#t td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
#t tr:last-child td { border-bottom: 0; }
#t td.ev { max-width: 380px; color: var(--muted); font-size: 13px; }
#t tbody tr:hover td { background: var(--hover); }
#t tr.row-link { cursor: pointer; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; color: var(--muted); font-size: 14px; }
.pager button { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }

.page.content > .about-map { max-width: 1440px; margin-top: 22px; }
.about-map h2 { font-size: 17px; margin: 0 0 6px; }
.about-map p { color: var(--muted); font-size: 14.5px; max-width: 900px; margin: 0 0 10px; }

.site-footer {
  display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between;
  margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted);
}
.page.content > .site-footer { max-width: 1440px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.noscript { position: fixed; inset: auto 16px 16px; z-index: 2000; padding: 12px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }

/* report form */
.nav a.report-link { color: var(--text); box-shadow: inset 0 0 0 1px var(--border); margin-left: 6px; }
.nav a.report-link:hover, .nav a.report-link.active { box-shadow: inset 0 0 0 1px var(--confirmed); background: rgba(239,68,88,.1); }
.page.content > .report-form { max-width: 820px; margin-left: auto; margin-right: auto; }
.report-form fieldset {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 18px 18px 6px; margin: 0 0 16px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 14px;
}
.report-form legend { padding: 0 8px; margin-left: -8px; font-weight: 700; font-size: 15px; }
.field { grid-column: span 2; margin-bottom: 14px; position: relative; }
.field.full { grid-column: 1 / -1; }
.field.small { grid-column: span 1; }
.field > label, .field > .label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.req { color: var(--confirmed); }
.opt { color: var(--muted); font-weight: 400; }
.report-form input:not([type="checkbox"]), .report-form select, .report-form textarea {
  width: 100%; padding: 9px 11px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 14px;
}
.report-form textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.report-form input:focus, .report-form textarea:focus { outline: none; border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(47,129,247,.25); }
.report-form .invalid { border-color: var(--confirmed) !important; }
.report-form .results { position: absolute; left: 0; right: 0; z-index: 20; box-shadow: var(--shadow); }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; font-size: 14px; }
.checks label, .consent label, .field label.inline { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.checks input, .consent input, .field label.inline input { margin-top: 4px; flex: none; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.warn { grid-column: 1 / -1; font-size: 13px; color: var(--muted); margin: 0 0 14px; padding: 9px 12px; border-radius: 8px; background: rgba(245,192,49,.08); border: 1px solid rgba(245,192,49,.3); }
.warn b { color: var(--text); }
.consent { padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 14px; }
.form-error { color: #ff8592; font-weight: 600; margin: 12px 0 0; }
.alert { border-radius: 10px; padding: 14px 16px; margin-top: 14px; font-size: 14.5px; border: 1px solid; }
.alert.error { color: #ffb3bb; background: rgba(239,68,88,.12); border-color: rgba(239,68,88,.5); font-weight: 600; }
.alert.success { color: var(--text); background: rgba(63,191,111,.1); border-color: rgba(63,191,111,.5); }
.report-done { max-width: 820px; margin: 8px auto 0; padding: 22px 24px; outline: none; }
.report-done h2 { margin: 0 0 8px; color: #6fd896; font-size: 22px; }
.report-done button.secondary { width: auto; margin-top: 6px; }
#t-download { width: auto; margin-top: 0; white-space: nowrap; }
.donate-box { margin: 22px auto 18px; padding: 22px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.donate-btn {
  display: inline-block; padding: 12px 26px; border-radius: 999px; font-weight: 700; font-size: 16px; text-decoration: none;
  background: var(--possible); color: #1a1400; transition: filter .15s;
}
.donate-btn:hover { filter: brightness(1.08); }
.donate-box .hint { margin-top: 10px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.ghost:hover { background: var(--surface-2); filter: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 600; color: var(--text); }
.offscreen { position: fixed; left: -9999px; top: 0; }
.nowrap-break, .mono { overflow-wrap: anywhere; }
#p-report { margin-top: 16px; }
.report-form fieldset { padding-top: 20px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }  /* spam trap */

/* creator page */
#page-creator > :not(.site-footer) { max-width: 820px; }
.creator section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 22px 10px; margin-bottom: 14px; }
.creator h2 { font-size: 18px; margin: 18px 0 8px; }
.creator p { color: #c5cdd8; }

.method li { margin-bottom: 10px; }
.sources li { margin-bottom: 10px; }

@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px 16px 12px;
  }
  .nav.open { display: flex; }
  .nav a.donate-link { margin-left: 0; }
  h1, h2.page-title { font-size: 24px; }
  /* Phones: search first, then the map, then nearby hospitals, then the filters.
     display: contents lets the sidebar's pieces be ordered around the map. */
  .map-layout { grid-template-columns: 1fr; height: auto; gap: 10px; }
  .finder { display: contents; }
  .finder > * { order: 4; }
  #search-form { order: 0; }
  #locate { order: 1; margin-top: 0; }
  #search-results { order: 1; margin-top: 0; }
  .map-card { order: 2; height: 62vh; min-height: 360px; }
  #nearby-box { order: 3; margin-top: 4px; }
  .finder .filter-head { margin-top: 8px; }
  .legend label { margin: 0; }
  .map-intro .lede { margin-bottom: 10px; }
  .kv { grid-template-columns: 110px 1fr; }
  .nav a.report-link { margin-left: 0; }
  .report-form fieldset { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field, .field.full { grid-column: 1 / -1; }
  .field.small { grid-column: span 1; }
  .checks { grid-template-columns: 1fr; }
}
@media (min-width: 761px) and (max-width: 1080px) {
  .brand { font-size: 0; }
  .brand::before { margin-right: 0; }
  .nav a { padding: 7px 9px; }
}
