:root {
  --bg: #0d1820;
  --panel: #15232d;
  --panel-2: #1a2b36;
  --panel-3: #203541;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #edf6f7;
  --muted: #9fb2bb;
  --teal: #25b7b2;
  --teal-bright: #52d6ca;
  --gold: #f0c96d;
  --a: #55d8cb;
  --b: #f0b86e;
  --danger: #ef7d78;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.33);
  --radius: 10px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input,
textarea {
  font: inherit;
}

button,
select,
input[type="checkbox"] {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(82, 214, 202, 0.35);
  outline-offset: 2px;
}

.app-shell {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: 66px 1fr;
}

.topbar {
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto auto;
  align-items: center;
  gap: 24px;
  min-height: 66px;
  padding: 0 18px;
  background: linear-gradient(180deg, #142630, #101e27);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.24);
}

.brand-block {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(150deg, var(--teal-bright), #168c91);
  color: #082126;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.04em;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.45), 0 6px 16px rgba(0, 0, 0, 0.25);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--teal-bright);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  overflow: hidden;
  color: white;
  font-size: clamp(16px, 1.5vw, 22px);
  font-weight: 720;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

h3 {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.topbar-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-stat {
  min-width: 126px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.top-stat-label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-stat strong {
  color: white;
  font-size: 14px;
}

.topbar-actions {
  display: flex;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 900;
}

.icon-button:hover {
  border-color: var(--teal);
  background: rgba(37, 183, 178, 0.14);
}

.workspace {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 286px minmax(380px, 1fr) 372px;
}

.control-panel,
.comparison-panel {
  z-index: 20;
  min-height: 0;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--panel), #12202a);
  scrollbar-color: #47606b transparent;
  scrollbar-width: thin;
}

.control-panel {
  border-right: 1px solid var(--line-strong);
}

.comparison-panel {
  border-left: 1px solid var(--line-strong);
}

.panel-heading {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 73px;
  padding: 14px 16px;
  background: rgba(21, 35, 45, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.mobile-close {
  display: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 26px;
}

.control-section {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.control-section > label:not(:last-child) {
  display: block;
  margin-bottom: 12px;
}

.field-label,
.check-group legend,
.evidence-section label {
  display: block;
  margin-bottom: 6px;
  color: #c6d4d9;
  font-size: 11px;
  font-weight: 750;
}

.select-control,
.map-search-card select {
  width: 100%;
  min-height: 36px;
  padding: 7px 32px 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #0f1e27;
  color: var(--text);
}

.select-control:hover,
.map-search-card select:hover {
  border-color: rgba(82, 214, 202, 0.5);
}

.two-column-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
}

.toggle-row:first-of-type {
  border-top: 0;
}

.toggle-row span {
  min-width: 0;
}

.toggle-row strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
}

.toggle-row small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.toggle-row input {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 18px;
  appearance: none;
  border-radius: 999px;
  background: #485964;
  transition: 0.2s ease;
}

.toggle-row input::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  content: "";
  transition: 0.2s ease;
}

.toggle-row input:checked {
  background: var(--teal);
}

.toggle-row input:checked::after {
  transform: translateX(16px);
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.text-button {
  padding: 2px;
  border: 0;
  background: transparent;
  color: var(--teal-bright);
  font-size: 11px;
  font-weight: 750;
}

.check-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 14px 0 0;
  padding: 0;
  border: 0;
}

.check-group label {
  color: #d7e2e5;
  font-size: 11px;
}

.vertical-checks {
  grid-template-columns: 1fr;
}

.check-group input {
  accent-color: var(--teal);
}

.investigation-card {
  background: rgba(37, 183, 178, 0.065);
}

.investigation-card p:last-child {
  margin-bottom: 0;
  color: #d2e2e5;
  font-size: 12px;
  line-height: 1.5;
}

.map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #28333a;
}

#map {
  position: absolute;
  inset: 0;
}

.maplibregl-map {
  font-family: inherit;
}

.maplibregl-ctrl-group {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  background: #14252f;
  box-shadow: var(--shadow);
}

.maplibregl-ctrl-group button {
  background-color: #14252f;
}

.maplibregl-ctrl-group button:hover {
  background-color: #203844;
}

.maplibregl-ctrl-group button + button {
  border-top-color: rgba(255, 255, 255, 0.13);
}

.maplibregl-ctrl-icon {
  filter: invert(1) opacity(0.8);
}

.maplibregl-ctrl-scale {
  border-color: #1b2d36;
  background: rgba(238, 245, 246, 0.86);
  color: #14232b;
  font-size: 10px;
}

.maplibregl-popup-content {
  min-width: 235px;
  padding: 13px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #14242e;
  color: var(--text);
  box-shadow: var(--shadow);
}

.maplibregl-popup-tip {
  border-top-color: #14242e !important;
  border-bottom-color: #14242e !important;
}

.maplibregl-popup-close-button {
  color: white;
  font-size: 18px;
}

.popup-title {
  margin: 0 0 8px;
  color: white;
  font-size: 15px;
}

.popup-value {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.popup-value strong {
  color: white;
  font-size: 12px;
}

.popup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}

.popup-actions button {
  min-height: 31px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #203642;
  color: white;
  font-size: 10px;
  font-weight: 800;
}

.popup-actions button:first-child:hover {
  border-color: var(--a);
}

.popup-actions button:last-child:hover {
  border-color: var(--b);
}

.map-search-card,
.legend-card,
.hover-card {
  position: absolute;
  z-index: 8;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(18, 33, 42, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.map-search-card {
  top: 14px;
  left: 14px;
  width: min(300px, calc(100% - 116px));
  padding: 9px 10px 10px;
}

.map-search-card label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.map-search-card select {
  min-height: 33px;
}

.map-search-card button,
.map-mobile-actions button {
  min-width: 45px;
  border: 1px solid rgba(82, 214, 202, 0.45);
  border-radius: 5px;
  background: #1b7f83;
  color: white;
  font-size: 11px;
  font-weight: 800;
}

.hover-card {
  top: 87px;
  left: 14px;
  min-width: 180px;
  padding: 9px 11px;
  pointer-events: none;
}

.hover-card strong,
.hover-card span {
  display: block;
}

.hover-card strong {
  margin-bottom: 2px;
  font-size: 12px;
}

.hover-card span {
  color: var(--teal-bright);
  font-size: 11px;
  font-weight: 750;
}

.legend-card {
  right: 14px;
  bottom: 45px;
  width: 205px;
  padding: 10px;
}

.legend-card.collapsed .legend-items {
  display: none;
}

.legend-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: white;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.legend-collapse {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.legend-items {
  display: grid;
  gap: 5px;
  margin-top: 9px;
}

.legend-row {
  display: grid;
  grid-template-columns: 17px 1fr;
  align-items: center;
  gap: 7px;
  color: #c4d0d4;
  font-size: 10px;
}

.legend-swatch {
  width: 17px;
  height: 11px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.map-status-bar {
  position: absolute;
  z-index: 7;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 31px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 12px;
  overflow: hidden;
  background: rgba(10, 21, 28, 0.89);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: #b9c7cc;
  font-size: 9px;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}

.map-status-bar span:not(:last-child)::after {
  margin-left: 16px;
  color: #57707b;
  content: "•";
}

.map-mobile-actions {
  display: none;
}

.panel-intro {
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.comparison-selectors {
  display: grid;
  grid-template-columns: 1fr 34px 1fr;
  align-items: end;
  gap: 7px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.comparison-selectors label {
  min-width: 0;
}

.county-chip {
  width: 21px;
  height: 21px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 5px;
  border-radius: 50%;
  color: #092126;
  font-size: 10px;
  font-weight: 900;
}

.county-a-chip {
  background: var(--a);
}

.county-b-chip {
  background: var(--b);
}

.swap-button {
  width: 34px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #20343f;
  color: white;
  font-size: 17px;
}

.comparison-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.county-summary-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
}

.county-a-card {
  border-top: 3px solid var(--a);
}

.county-b-card {
  border-top: 3px solid var(--b);
}

.summary-card-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
}

.summary-card-heading .county-chip {
  margin: 0;
}

.summary-card-heading h3 {
  margin: 0;
  overflow: hidden;
  color: white;
  font-size: 12px;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.metric-list {
  margin: 0;
}

.metric-list div {
  padding: 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.metric-list dt {
  color: var(--muted);
  font-size: 9px;
}

.metric-list dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  color: white;
  font-size: 11px;
  font-weight: 750;
}

.comparison-chart-section,
.evidence-section {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.chart-key {
  color: var(--muted);
  font-size: 9px;
}

.chart-key i {
  width: 8px;
  height: 8px;
  display: inline-block;
  margin: 0 3px 0 6px;
  border-radius: 2px;
}

.key-a {
  background: var(--a);
}

.key-b {
  background: var(--b);
}

.stacked-chart {
  display: grid;
  gap: 9px;
}

.type-row {
  display: grid;
  grid-template-columns: 60px 1fr 44px;
  align-items: center;
  gap: 7px;
  font-size: 10px;
}

.type-row-label {
  overflow: hidden;
  color: #c9d5d9;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-bar-track {
  height: 13px;
  display: flex;
  overflow: hidden;
  border-radius: 3px;
  background: #0e1c24;
}

.type-bar-bev {
  background: #27a9a7;
}

.type-bar-phev {
  background: #6a7f89;
}

.type-row-total {
  color: var(--muted);
  text-align: right;
}

#yearComparisonCanvas {
  width: 100%;
  height: 150px;
  display: block;
  border-radius: 5px;
  background: #0f1d25;
}

.evidence-section h3 {
  margin-bottom: 8px;
}

.evidence-section p {
  margin-bottom: 12px;
  padding: 10px;
  border-left: 3px solid var(--teal);
  background: rgba(37, 183, 178, 0.07);
  color: #dce9eb;
  font-size: 11px;
  line-height: 1.5;
}

.evidence-section textarea {
  width: 100%;
  resize: vertical;
  padding: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #0d1a22;
  color: white;
  font-size: 11px;
  line-height: 1.45;
}

.primary-button {
  width: 100%;
  min-height: 37px;
  margin-top: 9px;
  border: 1px solid rgba(82, 214, 202, 0.65);
  border-radius: 5px;
  background: linear-gradient(180deg, #219e9d, #177f83);
  color: white;
  font-size: 11px;
  font-weight: 800;
}

.primary-button:hover {
  filter: brightness(1.1);
}

.copy-status {
  display: block;
  min-height: 16px;
  margin-top: 5px;
  color: var(--teal-bright);
  font-size: 10px;
  text-align: center;
}

.method-dialog {
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - 50px);
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #14242e;
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.method-dialog::backdrop {
  background: rgba(3, 10, 14, 0.73);
  backdrop-filter: blur(4px);
}

.method-dialog form {
  position: relative;
  padding: 12px;
}

.method-dialog h2 {
  margin-bottom: 15px;
  font-size: 23px;
}

.method-dialog h3 {
  margin: 18px 0 6px;
  color: var(--teal-bright);
}

.method-dialog p {
  color: #c8d5d9;
  font-size: 13px;
  line-height: 1.6;
}

.dialog-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: white;
  font-size: 26px;
}

.source-line {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px !important;
}

.loading-overlay,
.error-overlay {
  position: absolute;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  background: #13232c;
  color: white;
  text-align: center;
}

.loading-card,
.error-card {
  max-width: 430px;
  padding: 25px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #182c37;
  box-shadow: var(--shadow);
}

.loading-spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 15px;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--teal-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 258px minmax(360px, 1fr) 340px;
  }

  .top-stat {
    min-width: 105px;
  }
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-rows: 60px 1fr;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 60px;
  }

  .topbar-stats {
    display: none;
  }

  .workspace {
    display: block;
  }

  .map-stage {
    width: 100%;
    height: 100%;
  }

  .control-panel,
  .comparison-panel {
    position: absolute;
    z-index: 60;
    top: 0;
    bottom: 0;
    width: min(380px, calc(100vw - 38px));
    box-shadow: var(--shadow);
    transition: transform 0.23s ease;
  }

  .control-panel {
    left: 0;
    transform: translateX(-105%);
  }

  .comparison-panel {
    right: 0;
    transform: translateX(105%);
  }

  .control-panel.open,
  .comparison-panel.open {
    transform: translateX(0);
  }

  .mobile-close {
    display: block;
  }

  .map-mobile-actions {
    position: absolute;
    z-index: 10;
    top: 14px;
    right: 14px;
    display: flex;
    gap: 6px;
  }

  .map-mobile-actions button {
    min-height: 36px;
    padding: 0 10px;
  }

  .map-search-card {
    right: 165px;
    width: auto;
  }
}

@media (max-width: 620px) {
  .brand-block .eyebrow {
    display: none;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .topbar {
    padding: 0 10px;
  }

  h1 {
    font-size: 15px;
  }

  .map-search-card {
    right: 12px;
    left: 12px;
    width: auto;
  }

  .map-mobile-actions {
    top: 82px;
  }

  .hover-card {
    top: 129px;
  }

  .legend-card {
    right: 9px;
    bottom: 42px;
    width: 175px;
  }

  .map-status-bar span:nth-child(2) {
    display: none;
  }

  .comparison-summary {
    grid-template-columns: 1fr;
  }
}


/* Public charging-station layer */
.live-data-badge {
  padding: 3px 6px;
  border: 1px solid rgba(82, 214, 202, 0.35);
  border-radius: 999px;
  background: rgba(37, 183, 178, 0.09);
  color: var(--teal-bright);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.charging-filter-section label {
  display: block;
  margin-top: 11px;
}

.station-filter-note {
  min-height: 30px;
  margin: 10px 0 0;
  padding: 8px 9px;
  border-left: 3px solid var(--teal);
  background: rgba(37, 183, 178, 0.06);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.station-filter-note.is-warning {
  border-left-color: var(--gold);
  background: rgba(240, 201, 109, 0.07);
  color: #dbcfae;
}

.station-legend {
  display: grid;
  gap: 5px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: #c4d0d4;
  font-size: 10px;
}

.station-legend div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.station-symbol {
  width: 11px;
  height: 11px;
  display: inline-block;
  border: 1.5px solid white;
  border-radius: 50%;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
}

.station-symbol-fast {
  background: var(--gold);
}

.station-symbol-level2 {
  background: var(--teal-bright);
}

.station-symbol-level1 {
  background: #9fb2bb;
}

.legend-card.collapsed .station-legend {
  display: none;
}

.station-popup-address,
.station-popup-note {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.station-popup-note {
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.directions-link {
  min-height: 33px;
  display: grid;
  place-items: center;
  margin-top: 10px;
  border: 1px solid rgba(82, 214, 202, 0.55);
  border-radius: 5px;
  background: #1b7f83;
  color: white;
  font-size: 10px;
  font-weight: 800;
  text-decoration: none;
}

.directions-link:hover {
  filter: brightness(1.1);
}

.map-status-bar {
  overflow-x: auto;
  scrollbar-width: none;
}

.map-status-bar::-webkit-scrollbar {
  display: none;
}

@media (min-width: 961px) {
  .topbar {
    grid-template-columns: minmax(280px, 1fr) auto auto;
    gap: 16px;
  }

  .top-stat {
    min-width: 112px;
  }
}
