:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #edf2f5;
  color: #14212a;
}

* {
  box-sizing: border-box;
}

body.traffic-body {
  margin: 0;
  min-height: 100vh;
  background: #edf2f5;
}

button {
  font: inherit;
}

.traffic-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.traffic-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid #d6e0e7;
  background: #fbfcfd;
  padding: 14px 18px;
}

.home-link {
  color: #28516c;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.home-link:hover,
.home-link:focus,
.topbar-links a:hover,
.topbar-links a:focus {
  text-decoration: underline;
}

.title-block {
  min-width: 0;
}

.title-block h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.1;
  letter-spacing: 0;
}

.title-block p {
  margin: 4px 0 0;
  color: #516273;
  font-size: 0.95rem;
}

.topbar-links,
.traffic-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-links a {
  color: #28516c;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.status-pill {
  min-width: 82px;
  border: 1px solid #8cc49f;
  border-radius: 999px;
  background: #cdebd8;
  color: #17412f;
  padding: 7px 10px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 900;
}

.status-pill.loading {
  border-color: #e2b950;
  background: #f8e2aa;
  color: #59410e;
}

.status-pill.error {
  border-color: #e78b8b;
  background: #ffd6d6;
  color: #7c1d1d;
}

.refresh-button,
.layer-button {
  min-height: 38px;
  border: 1px solid #c6d2dc;
  border-radius: 8px;
  background: #ffffff;
  color: #17242c;
  cursor: pointer;
  font-weight: 850;
}

.refresh-button {
  padding: 0 12px;
}

.refresh-button:hover,
.refresh-button:focus,
.layer-button:hover,
.layer-button:focus {
  border-color: #6e879b;
  background: #eef5f8;
  outline: none;
}

.summary-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid #d6e0e7;
  background: #d6e0e7;
}

.summary-bar > div {
  min-height: 62px;
  display: grid;
  align-content: center;
  gap: 2px;
  background: #ffffff;
  padding: 10px 16px;
}

.metric-label {
  color: #627282;
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.summary-bar strong {
  font-size: 1.35rem;
  line-height: 1;
}

.traffic-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 440px);
  min-height: 620px;
  height: calc(100vh - 136px);
}

.traffic-map {
  height: 100%;
  min-height: 0;
  background: #d7e0e4;
}

.traffic-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #c6d2dc;
  background: #ffffff;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e1e8ee;
  padding: 14px 16px;
}

.section-kicker {
  margin: 0 0 3px;
  color: #687888;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.layer-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px;
  border-bottom: 1px solid #e1e8ee;
  padding: 12px 16px;
}

.layer-button {
  min-width: 0;
  padding: 0 8px;
  color: #516273;
}

.layer-button.active {
  border-color: #28516c;
  background: #e7f0f5;
  color: #143247;
}

.source-block {
  border-bottom: 1px solid #e1e8ee;
  padding: 12px 16px;
  color: #5d6b78;
  font-size: 0.9rem;
  line-height: 1.35;
}

.source-block div + div {
  margin-top: 4px;
}

.traffic-list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  list-style: none;
  margin: 0;
  padding: 10px;
}

.traffic-item {
  margin: 0 0 8px;
}

.traffic-item-button {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  border: 1px solid #d8e2e8;
  border-radius: 8px;
  background: #ffffff;
  color: inherit;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.traffic-item-button:hover,
.traffic-item-button:focus {
  border-color: #6e879b;
  background: #f8fbfc;
  outline: none;
}

.item-kind {
  align-self: start;
  min-width: 48px;
  border-radius: 999px;
  padding: 5px 7px;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.item-kind.incident {
  background: #d9342b;
}

.item-kind.dms {
  background: #a85f00;
}

.item-kind.bridge {
  background: #315a85;
}

.item-kind.bridges {
  background: #315a85;
}

.item-kind.rail {
  background: #5c4d7d;
}

.item-kind.wsdot {
  background: #7f2f75;
}

.item-kind.incidents {
  background: #d9342b;
}

.item-kind.roadAlerts {
  background: #7f2f75;
}

.item-kind.closures {
  background: #b42318;
}

.item-kind.cameras {
  background: #2563eb;
}

.item-kind.ferries {
  background: #0f766e;
}

.item-kind.restrictions {
  background: #be185d;
}

.item-kind.passes {
  background: #7c4a03;
}

.item-kind.facilities {
  background: #16864a;
}

.item-kind.travelTimes {
  background: #4f46e5;
}

.item-kind.weather {
  background: #0369a1;
}

.item-kind.border {
  background: #c2410c;
}

.item-kind.plows {
  background: #0891b2;
}

.item-kind.fire {
  background: #ea580c;
}

.item-kind.regionalAlerts,
.item-kind.stateAlerts {
  background: #9333ea;
}

.item-kind.tiles {
  background: #475569;
}

.item-title {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 900;
}

.item-detail {
  display: block;
  margin-top: 3px;
  color: #667787;
  font-size: 0.84rem;
  line-height: 1.35;
}

.empty-list {
  margin: 0;
  border: 1px dashed #c7d4dd;
  border-radius: 8px;
  color: #667787;
  padding: 18px 12px;
  text-align: center;
}

.traffic-map-icon {
  background: transparent;
  border: 0;
}

.traffic-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 2px 9px rgba(17, 31, 42, 0.28);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1;
}

.traffic-icon.red {
  background: #d9342b;
}

.traffic-icon.green {
  background: #16864a;
}

.traffic-icon.amber {
  background: #b96a00;
}

.traffic-icon.gray {
  background: #6b7886;
}

.traffic-icon.purple {
  background: #7f2f75;
}

.traffic-popup {
  min-width: 210px;
  max-width: 320px;
}

.traffic-popup h3 {
  margin: 0 0 7px;
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.traffic-popup p {
  margin: 6px 0;
  color: #364653;
  line-height: 1.35;
}

.traffic-popup dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  margin: 8px 0 0;
}

.traffic-popup dt {
  color: #667787;
  font-weight: 850;
}

.traffic-popup dd {
  margin: 0;
}

.traffic-popup a {
  color: #28516c;
  font-weight: 850;
}

@media (max-width: 900px) {
  .traffic-topbar {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .topbar-links,
  .traffic-actions {
    justify-content: space-between;
  }

  .summary-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .traffic-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .traffic-map {
    height: 58vh;
    min-height: 420px;
  }

  .traffic-panel {
    border-left: 0;
    border-top: 1px solid #c6d2dc;
  }

  .traffic-list {
    max-height: 58vh;
  }
}

@media (max-width: 560px) {
  .traffic-topbar {
    padding: 12px;
  }

  .summary-bar > div {
    padding: 10px 12px;
  }

  .layer-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 12px;
  }

  .traffic-map {
    height: 56vh;
    min-height: 360px;
  }
}
