/* ── Explorer Page ─────────────────────────────────────── */
/* Inherits reset, variables, fonts, and nav from shared.css */

:root {
  --teal:    #1a6aab;
  --green:   #1a6aab;
  --red:     #D4432A;
  --orange:  #C58C07;

  --dm-trauma:     #b91c1c;
  --dm-ems:        #1d4ed8;
  --dm-ed:         #6d28d9;
  --dm-fire:       #c2410c;
  --dm-911:        #0e7490;
  --dm-air:        #4338ca;
  --dm-disaster:   #a16207;
  --dm-injury:     #15803d;
  --dm-workforce:  #be185d;
  --dm-overdose:   #0f766e;
}

body { background: var(--bg-secondary); }

/* ── Context bar — the page anchor ───────────────────── */
.explore-context {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 1.75rem 0 1.5rem;
}
.explore-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: .25rem;
}
.explore-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.5;
  font-family: var(--font-body);
  letter-spacing: 0;
}
.explore-sub span {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
}

/* ── Layout ───────────────────────────────────────────── */
main {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 48px 80px;
}

.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 28px;
  margin-bottom: 20px;
  transition: border-color .2s;
}
.card:hover {
  border-color: var(--border-hover);
}
.card h2 {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 1.25rem;
}
.card h3 {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin: 1.25rem 0 .5rem;
}

/* ── Jurisdiction toggle ─────────────────────────────── */
.jurisdiction-toggle {
  display: inline-flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 12px;
}
.jt-btn {
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: all .2s;
}
.jt-btn:hover { color: var(--text-primary); }
.jt-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

/* ── Top row: Map on top, Stats below ─────────────────── */
.top-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* Map (SVG) */
.map-container {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
}
#us-map-svg {
  flex: 1;
  max-height: 360px;
}
.state-path {
  fill: #E5E7EB;
  stroke: #fff;
  stroke-width: 1.5;
  cursor: pointer;
  transition: fill .2s, stroke .15s, opacity .15s;
}
.state-path:hover {
  opacity: 0.8;
  stroke: #374151;
  stroke-width: 2;
}
.state-path.active {
  fill: var(--accent) !important;
  stroke: var(--accent);
  stroke-width: 3;
  filter: drop-shadow(0 0 4px rgba(12,155,131,.4));
  opacity: 1;
}
/* Dim unselected states when any state is selected */
.map-container.has-selection .state-path:not(.active) {
  opacity: 0.3;
  filter: saturate(0.3);
}
.map-container.has-selection .state-path:not(.active):hover {
  opacity: 0.6;
  filter: none;
}
.map-container.has-selection .special-tile:not(.active) {
  opacity: 0.35;
  filter: saturate(0.3);
}
.map-container.has-selection .special-tile:not(.active):hover {
  opacity: 0.7;
  filter: none;
}
.map-tooltip {
  display: none;
  position: absolute;
  background: #0F1115;
  color: #fff;
  font-family: var(--font-body);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 20;
  white-space: nowrap;
  line-height: 1.4;
}
.special-tiles {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
}
.tile-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.special-tile {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: #E5E7EB;
  border-radius: 6px;
  cursor: pointer;
  transition: transform .12s, background .2s;
}
.special-tile:hover { transform: scale(1.1); }
.special-tile.active {
  background: var(--accent) !important;
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px rgba(12,155,131,.3);
}
.tile-label {
  font-size: 10px;
  color: var(--text-muted);
}

.heatmap-scale {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
}
.scale-label {
  font-size: 10px;
  color: var(--text-muted);
}
.scale-bar {
  width: 120px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #c7dff2, #85b8da, #4d92bf, #1a6aab, #0d4b7c);
}

.map-actions { display: flex; gap: .5rem; margin-top: .75rem; }
.btn-small {
  font-family: var(--font-body);
  font-size: 12px;
  padding: 5px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
  font-weight: 500;
}
.btn-small:hover {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.selected-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: .5rem;
  min-height: 1.2em;
  letter-spacing: .01em;
}

/* City chips */
.city-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}
.city-chips-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.city-chips-label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-right: 2px;
}
.city-chips-toggle {
  font-size: 11px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
  padding: 2px 6px;
}
.city-chips-toggle:hover { text-decoration: underline; }
.city-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  max-height: 180px;
  overflow-y: auto;
}
.city-state-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  width: 100%;
  margin-top: 4px;
}
.city-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font-body);
}
.city-chip:hover { border-color: var(--accent); color: var(--accent); }
.city-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.city-chip-count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  background: rgba(0,0,0,.08);
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.city-chip.active .city-chip-count {
  background: rgba(255,255,255,.2);
}

/* ── Stats card ──────────────────────────────────────── */
.stats-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: start;
}
.stats-card h2 {
  grid-column: 1 / -1;
}
.mini-chart-section {
  grid-column: 1 / -1;
}
.stat-hero {
  text-align: center;
  padding: .75rem 1rem .75rem 0;
  border-right: 1px solid var(--border);
}
.stat-hero-number {
  font-family: var(--font-mono);
  font-size: 52px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat-hero-context {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: .4rem;
  font-family: var(--font-body);
}

/* Stacked status bar */
.breakdown-section { margin-bottom: 1rem; }
.stacked-bar {
  display: flex;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-tertiary);
  gap: 1px;
}
.stacked-bar-seg {
  height: 100%;
  min-width: 2px;
  transition: width .4s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: default;
  position: relative;
}
.stacked-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .75rem;
  margin-top: .5rem;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-body);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-count {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Funding callout */
.funding-callout {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  padding: 10px 14px;
  background: var(--accent-subtle);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  margin-top: .75rem;
}
.funding-number {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.funding-label { font-size: 12px; color: var(--text-secondary); }

/* Mini bar chart — domain bars */
.bar-chart { display: flex; flex-direction: column; gap: 5px; }
.bar-row { display: flex; align-items: center; gap: .5rem; font-size: 12px; }
.bar-name {
  width: 155px;
  text-align: right;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  font-weight: 500;
  font-size: 11px;
  font-family: var(--font-body);
}
.bar-track {
  flex: 1;
  height: 20px;
  background: var(--bg-tertiary);
  border-radius: 5px;
  overflow: hidden;
  display: block;
}
.bar-fill {
  display: block;
  height: 100%;
  border-radius: 5px;
  transition: width .4s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 4px;
  opacity: .85;
}
.bar-fill:hover { opacity: 1; }
.bar-count {
  font-family: var(--font-mono);
  width: 48px;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Filters ──────────────────────────────────────────── */
/* ── Multi-select dropdown ─────────────────────────────── */
.multiselect {
  position: relative;
}
.ms-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  min-width: 120px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.ms-trigger:hover {
  border-color: var(--text-muted);
}
.ms-trigger:focus,
.multiselect.open .ms-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(12,155,131,.1);
}
.ms-label {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform .2s;
}
.multiselect.open .ms-chevron {
  transform: rotate(180deg);
}
.ms-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  z-index: 50;
  padding: 4px 0;
  max-height: 240px;
  overflow-y: auto;
}
.multiselect.open .ms-dropdown {
  display: block;
}
.ms-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background .1s;
  user-select: none;
}
.ms-option:hover {
  background: var(--bg-secondary);
}
.ms-option input[type="checkbox"] {
  display: none;
}
.ms-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  transition: all .15s;
}
.ms-option input:checked + .ms-check {
  background: var(--accent);
  border-color: var(--accent);
}
.ms-option input:checked + .ms-check::after {
  content: "";
  display: block;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}
.ms-trigger .ms-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  flex: 1;
}
.ms-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 7px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  white-space: nowrap;
}

.filter-section { padding: 24px 28px; }
.filter-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-start; }
.filter-row-secondary { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--border); align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; gap: .4rem; }
.filter-group label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
}
.search-group { flex: 1; min-width: 200px; }
.search-group input { width: 100%; }
.search-wrap { position: relative; }
.search-topics {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.search-topics.visible { display: flex; }
.search-topics-label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-right: 4px;
  white-space: nowrap;
}
.search-topic {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  font-family: var(--font-body);
}
.search-topic:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
}

.pill-group { display: flex; flex-wrap: wrap; gap: 5px; }
.pill {
  font-family: var(--font-body);
  font-size: 11px;
  padding: 4px 11px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  user-select: none;
  font-weight: 500;
}
.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
  transform: translateY(-1px);
}
.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(12,155,131,0.2);
}
.pill-count {
  font-family: var(--font-mono);
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.pill.active .pill-count { background: rgba(255,255,255,.2); color: #fff; }

/* Domain pill colors when active */
.pill[data-domain="Trauma Systems"].active       { background: var(--dm-trauma); border-color: var(--dm-trauma); box-shadow: 0 2px 8px rgba(185,28,28,.2); }
.pill[data-domain="Prehospital EMS"].active      { background: var(--dm-ems); border-color: var(--dm-ems); box-shadow: 0 2px 8px rgba(29,78,216,.2); }
.pill[data-domain="Emergency Department"].active  { background: var(--dm-ed); border-color: var(--dm-ed); box-shadow: 0 2px 8px rgba(109,40,217,.2); }
.pill[data-domain="Fire & Rescue"].active        { background: var(--dm-fire); border-color: var(--dm-fire); box-shadow: 0 2px 8px rgba(194,65,12,.2); }
.pill[data-domain="911 Communications"].active   { background: var(--dm-911); border-color: var(--dm-911); box-shadow: 0 2px 8px rgba(14,116,144,.2); }
.pill[data-domain="Air Medical"].active          { background: var(--dm-air); border-color: var(--dm-air); box-shadow: 0 2px 8px rgba(67,56,202,.2); }
.pill[data-domain="Disaster Preparedness"].active { background: var(--dm-disaster); border-color: var(--dm-disaster); box-shadow: 0 2px 8px rgba(161,98,7,.2); }
.pill[data-domain="Injury Prevention"].active    { background: var(--dm-injury); border-color: var(--dm-injury); box-shadow: 0 2px 8px rgba(21,128,61,.2); }
.pill[data-domain="First Responder Workforce"].active { background: var(--dm-workforce); border-color: var(--dm-workforce); box-shadow: 0 2px 8px rgba(190,24,93,.2); }
.pill[data-domain="Overdose Response"].active    { background: var(--dm-overdose); border-color: var(--dm-overdose); box-shadow: 0 2px 8px rgba(15,118,110,.2); }

select, input[type="text"], input[type="number"] {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 7px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
select:focus, input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(12,155,131,0.12);
  background: var(--bg-primary);
}
input[type="number"] { width: 72px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.year-range { display: flex; align-items: center; gap: .35rem; color: var(--text-muted); font-size: 13px; }

.btn-reset {
  font-family: var(--font-body);
  font-size: 12px;
  padding: 7px 16px;
  border-radius: var(--radius);
  border: 1px solid #fecaca;
  background: var(--status-vetoed-bg);
  color: var(--red);
  cursor: pointer;
  transition: all .2s;
  align-self: flex-end;
  font-weight: 500;
}
.btn-reset:hover {
  background: #fee2e2;
  transform: translateY(-1px);
}

/* ── Table — the core product ────────────────────────── */
.table-section {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
}
.table-section:hover {
  border-color: var(--border);
}
.table-header, .table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  flex-wrap: wrap;
  gap: .5rem;
}
.table-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
}
.table-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
}
.table-header-left { display: flex; align-items: center; gap: .75rem; }
.table-count {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.btn-export {
  font-family: var(--font-body);
  font-size: 12px;
  padding: 5px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  font-weight: 500;
}
.btn-export:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(12,155,131,0.2);
}
.page-controls { display: flex; align-items: center; gap: .5rem; font-size: 13px; color: var(--text-muted); }
.btn-page {
  font-family: var(--font-body);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
  font-weight: 500;
}
.btn-page:hover:not(:disabled) {
  background: var(--bg-secondary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.btn-page:disabled { opacity: .35; cursor: default; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
th {
  font-family: var(--font-body);
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color .15s;
}
th.sortable:hover { color: var(--accent); }
th.sorted-asc, th.sorted-desc { color: var(--accent); }
th.sorted-asc::after { content: ' \25B2'; font-size: 9px; }
th.sorted-desc::after { content: ' \25BC'; font-size: 9px; }
.col-wide { min-width: 260px; }
.col-med { min-width: 160px; }

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-family: var(--font-body);
  color: var(--text-secondary);
  font-size: 13px;
}
td:first-child {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 12px;
}
td.nowrap {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-primary);
  font-size: 12px;
}
tr {
  cursor: pointer;
  transition: background .12s;
}
tr:hover { background: var(--accent-subtle); }

.domain-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  color: #fff;
  white-space: nowrap;
  letter-spacing: .01em;
}
.pf-tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border);
  margin: 1px 2px 1px 0;
  white-space: nowrap;
  font-weight: 500;
}
.funding-yes { color: var(--green); font-weight: 600; }
.funding-no { color: var(--text-muted); }
.status-passed { color: var(--green); font-weight: 600; }
.status-failed { color: var(--red); }
.status-vetoed { color: var(--orange); }

/* ── Modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,17,21,.25);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  max-width: 720px;
  width: 95%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 36px;
  position: relative;
  box-shadow: 0 24px 48px rgba(0,0,0,.1), 0 8px 16px rgba(0,0,0,.05);
  border: 1px solid var(--border);
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  transition: all .2s;
}
.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transform: scale(1.05);
}
.modal h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: .35rem;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: -0.02em;
  line-height: 1.3;
  max-width: 620px;
}
.modal .meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-variant-numeric: tabular-nums;
}
.modal .meta a { color: var(--accent); text-decoration: none; }
.modal .meta a:hover { text-decoration: underline; }
.modal-field { margin-bottom: 1rem; }
.modal-field dt {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: .25rem;
}
.modal-field dd {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.7;
}
.modal-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ── Sponsor list ────────────────────────────────────── */
.sponsor-list { display: flex; flex-direction: column; gap: .5rem; }
.sponsor-item { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.sponsor-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.sponsor-meta { font-size: 12px; color: var(--text-muted); }

/* ── State link button ────────────────────────────────── */
.btn-state-link {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  margin-bottom: 1.5rem;
  transition: all .2s;
  gap: .35rem;
}
.btn-state-link:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(12,155,131,0.2);
  color: #fff;
  text-decoration: none;
}

/* ── Fiscal note links ───────────────────────────────── */
.fiscal-links { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-fiscal, .btn-analysis {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 6px;
  text-decoration: none;
  gap: .25rem;
  transition: all .2s;
}
.btn-fiscal { background: var(--accent); color: #fff; }
.btn-fiscal:hover { background: var(--accent-hover); transform: translateY(-1px); color: #fff; text-decoration: none; }
.btn-analysis { background: #6366f1; color: #fff; }
.btn-analysis:hover { background: #4f46e5; transform: translateY(-1px); color: #fff; text-decoration: none; }
.fiscal-none { font-size: 13px; color: var(--text-muted); font-style: italic; }

/* ── Fiscal detail (parsed) ─────────────────────────── */
.fiscal-detail { display: flex; flex-direction: column; gap: 6px; }
.fiscal-row { display: flex; gap: 10px; font-size: 13.5px; line-height: 1.5; }
.fiscal-label { font-weight: 600; min-width: 110px; color: var(--text-secondary); flex-shrink: 0; }
.fiscal-value { color: var(--text-primary); }
.fiscal-negative { color: #dc2626; font-weight: 600; }
.fiscal-positive { color: #16a34a; font-weight: 600; }
.fiscal-neutral { color: var(--text-muted); font-weight: 600; }

/* ── Timeline ────────────────────────────────────────── */
.timeline { position: relative; padding-left: 1.25rem; border-left: 2px solid var(--border); }
.timeline-item {
  position: relative;
  padding: .4rem 0 .4rem .5rem;
  font-size: 13px;
  line-height: 1.4;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.56rem;
  top: .6rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 0 1px var(--border);
}
.timeline-item:last-child::before { background: var(--text-primary); }
.timeline-date {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
  min-width: 82px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.timeline-action {
  color: var(--text-primary);
  font-size: 13px;
}
.text-muted { color: var(--text-muted); font-size: 13px; }

/* ── Loading ──────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.loading-overlay p {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.loading-logo { height: 40px; width: auto; margin-bottom: .25rem; }
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-card { grid-template-columns: 1fr; }
  .stat-hero { border-right: none; padding-right: 0; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
  main { padding: 20px 20px 64px; }
  .card { padding: 24px; }
  .table-header, .table-footer { padding: 12px 16px; }
  th, td { padding: 9px 12px; }
  .explore-context { padding: 1.25rem 0 1rem; }
  .explore-title { font-size: 22px; }
}

@media (max-width: 600px) {
  main { padding: 12px 16px 48px; }
  .card { padding: 18px; margin-bottom: 14px; }

  /* Context bar */
  .explore-context { padding: .85rem 0 .75rem; }
  .explore-title { font-size: 20px; }
  .explore-sub { font-size: 11px; }

  /* Map */
  .map-container { flex-direction: column; align-items: stretch; }
  #us-map-svg { max-height: 260px; }
  .special-tiles { flex-direction: row; gap: 16px; justify-content: center; }
  .map-actions { justify-content: center; }

  /* Stats */
  .stat-hero-number { font-size: 36px; }
  .stat-hero-context { font-size: 12px; }
  .funding-callout { padding: 8px 10px; }
  .funding-number { font-size: 15px; }
  .funding-label { font-size: 11px; }

  /* Bar chart */
  .bar-name { width: 90px; font-size: 10px; }
  .bar-count { width: 36px; font-size: 10px; }
  .bar-track { height: 16px; }

  /* Filters */
  .filter-section { padding: 18px; }
  .filter-row { flex-direction: column; gap: .75rem; }
  .filter-row-secondary { flex-direction: column; align-items: stretch; gap: .75rem; }
  .filter-group { width: 100%; }
  .pill-group { gap: 4px; }
  .pill { font-size: 10px; padding: 3px 8px; }
  .pill-count { font-size: 8px; min-width: 16px; }
  .year-range { width: 100%; }
  .year-range input[type="number"] { flex: 1; width: auto; min-width: 0; }
  .search-group { min-width: 0; }
  .search-topic { font-size: 11px; padding: 3px 8px; }
  .search-topics-label { font-size: 9px; }
  .btn-reset { width: 100%; text-align: center; }

  /* Table */
  .table-header, .table-footer { padding: 10px 14px; flex-direction: column; gap: .5rem; align-items: stretch; }
  .table-header-left { flex-direction: column; gap: .35rem; }
  .page-controls { justify-content: center; flex-wrap: wrap; }
  .table-count { font-size: 12px; text-align: center; }
  table { font-size: 12px; }
  th { font-size: 9px; padding: 8px 8px; }
  td { padding: 8px 8px; }
  .col-wide { min-width: 180px; }
  .col-med { min-width: 100px; }
  .domain-badge { font-size: 9px; padding: 1px 6px; }
  .pf-tag { font-size: 9px; padding: 1px 5px; }

  /* Modal */
  .modal { padding: 24px; width: 98%; max-height: 90vh; border-radius: 10px; }
  .modal h2 { font-size: 17px; }
  .modal .meta { font-size: 11px; }
  .modal-field dt { font-size: 10px; }
  .modal-field dd { font-size: 13px; }
  .btn-state-link { font-size: 12px; padding: 6px 14px; }
  .sponsor-name { font-size: 13px; }
  .sponsor-meta { font-size: 11px; }
  .timeline-date { font-size: 11px; min-width: 70px; }
  .timeline-action { font-size: 12px; }
  #page-size { font-size: 12px; }
}
