:root {
  --hntb-primary:      #001822;
  --hntb-white:        #FFFFFF;
  --hntb-orange:       #F26522;

  --hntb-blue-dark:    #376186;
  --hntb-blue:         #5080B7;
  --hntb-blue-mid:     #699AC6;
  --hntb-blue-light:   #A2BEDB;

  --hntb-gray-dark:    #455C6D;
  --hntb-gray:         #597280;
  --hntb-gray-mid:     #7F93A0;
  --hntb-gray-light:   #A7B5BA;
  --hntb-cool-7:       #74767A;
  --hntb-cool-5:       #AEB2B6;
  --hntb-cool-3:       #CCCECF;
  --hntb-cool-2:       #E0E1E0;

  --hntb-hl-blue:      #3990BF;
  --hntb-hl-green:     #60A04E;
  --hntb-hl-gold:      #B58919;

  --hntb-font-headline: "Interstate", Arial, sans-serif;
  --hntb-font-body:     "Interstate", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--hntb-font-body);
  color: var(--hntb-primary);
  background: var(--hntb-cool-2);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--hntb-primary);
  color: var(--hntb-white);
  padding: 10px 20px;
}

.app-header .logo {
  height: 40px;
}

.title-block h1 {
  font-family: var(--hntb-font-headline);
  text-transform: uppercase;
  font-size: 18px;
  margin: 0;
  color: var(--hntb-white);
  letter-spacing: 0.5px;
}

.title-block .subtitle {
  margin: 2px 0 0 0;
  font-size: 12.5px;
  color: var(--hntb-gray-light);
}

.app-body {
  display: flex;
  height: calc(100vh - 62px);
}

.sidebar {
  width: 340px;
  min-width: 340px;
  overflow-y: auto;
  background: var(--hntb-white);
  border-right: 1px solid var(--hntb-cool-3);
  padding: 12px;
}

.map-wrap {
  flex: 1;
  position: relative;
}

#map {
  height: 100%;
  width: 100%;
}

.panel {
  border: 1px solid var(--hntb-cool-3);
  border-radius: 6px;
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--hntb-white);
}

.panel-header {
  background: var(--hntb-cool-2);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: default;
}

.panel-header.collapsible {
  cursor: pointer;
  user-select: none;
}

.panel-header h2 {
  font-family: var(--hntb-font-headline);
  text-transform: uppercase;
  font-size: 13px;
  margin: 0;
  color: var(--hntb-primary);
}

.chevron {
  color: var(--hntb-gray);
  font-size: 11px;
  transition: transform 0.15s ease;
}

.panel-header.collapsed .chevron {
  transform: rotate(-90deg);
}

.panel-body {
  padding: 10px 12px 14px 12px;
}

.panel-body.collapsed {
  display: none;
}

.help-text {
  font-size: 11.5px;
  color: var(--hntb-cool-7);
  margin: 0 0 8px 0;
  line-height: 1.4;
}

.help-text.disclaimer {
  font-style: italic;
  font-size: 10.5px;
}

.stat {
  font-size: 14px;
  margin-bottom: 8px;
}

.stat #countShown {
  font-weight: bold;
  color: var(--hntb-blue-dark);
}

.btn-secondary {
  width: 100%;
  padding: 7px 10px;
  background: var(--hntb-white);
  border: 1px solid var(--hntb-gray-mid);
  color: var(--hntb-primary);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12.5px;
}

.btn-secondary:hover {
  background: var(--hntb-cool-2);
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
  cursor: pointer;
}

.check-list .swatch-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: none;
}

.check-list .count {
  margin-left: auto;
  color: var(--hntb-cool-7);
  font-size: 11.5px;
}

.aadt-filter {
  border-top: 1px solid var(--hntb-cool-2);
  padding-top: 10px;
  margin-top: 6px;
}

.aadt-filter:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  cursor: pointer;
}

.toggle-row.secondary {
  font-weight: 400;
  font-size: 12px;
  margin-top: 6px;
}

.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--hntb-gray-dark);
}

.slider-row input[type="number"] {
  width: 90px;
  padding: 3px 6px;
  border: 1px solid var(--hntb-cool-3);
  border-radius: 4px;
  font-size: 12px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--hntb-blue);
}

input[type="range"]:disabled {
  opacity: 0.4;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--hntb-cool-7);
}

.legend-list {
  font-size: 12px;
}

.legend-group-title {
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  color: var(--hntb-gray-dark);
  margin: 10px 0 4px 0;
}

.legend-group-title:first-child {
  margin-top: 0;
}

.legend-subtext {
  font-size: 10.5px;
  font-style: italic;
  color: var(--hntb-cool-7);
  margin: -2px 0 6px 0;
  line-height: 1.35;
}

.legend-list .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.legend-list .swatch-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: none;
}

/* Leaflet popup content */
.signal-popup h3 {
  font-family: var(--hntb-font-headline);
  text-transform: uppercase;
  font-size: 13px;
  margin: 0 0 6px 0;
  color: var(--hntb-primary);
}

.signal-popup table {
  border-collapse: collapse;
  font-size: 12px;
}

.signal-popup td {
  padding: 1px 6px 1px 0;
  vertical-align: top;
}

.signal-popup td.k {
  color: var(--hntb-cool-7);
  white-space: nowrap;
}

.signal-popup .badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  color: white;
  font-size: 11px;
  margin-right: 4px;
}

@media (max-width: 860px) {
  .app-body { flex-direction: column; }
  .sidebar { width: 100%; min-width: 0; max-height: 45vh; }
  #map { height: 55vh; }
}
