:root {
  --blue: #2f78aa;
  --blue-dark: #245f8d;
  --blue-light: #e8f2fb;
  --blue-pale: #f5f9fd;
  --line: #b6c9d9;
  --line-soft: #d9e4ed;
  --ink: #263946;
  --muted: #62798a;
  --fire: #c84d28;
  --fire-dark: #9c3517;
  --warning: #e2a12f;
  --green: #3f8a54;
  --page: #dce9f3;
  --white: #ffffff;
  --font: Arial, Helvetica, sans-serif;
  --mono: "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.28) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px),
    var(--page);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: var(--font);
}

body { overflow: auto; }

button,
select,
input { font: inherit; }

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid #f2b641;
  outline-offset: 2px;
}

#app {
  width: min(1120px, calc(100% - 24px));
  min-height: 640px;
  margin: 12px auto;
  overflow: hidden;
  border: 1px solid #9eb7c9;
  border-radius: 6px;
  background: var(--white);
  box-shadow: 0 2px 7px rgba(45, 82, 111, 0.28);
}

.topbar {
  position: relative;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: 78px;
  padding: 13px 18px 15px;
  color: var(--white);
  border-bottom: 1px solid #1d557f;
  background: linear-gradient(#78a9d2 0%, #4b8bc0 44%, #2d6f9f 45%, #2b6493 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.topbar::after {
  position: absolute;
  right: 0;
  bottom: -4px;
  left: 0;
  height: 3px;
  content: "";
  background: #f0ad36;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff8d6;
  border: 1px solid #9f481f;
  border-radius: 50%;
  background: linear-gradient(#f1a241 0%, #db6a28 48%, #b74b1e 49%, #9c391a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 2px rgba(20, 50, 75, 0.55);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-shadow: 0 -1px 0 rgba(88, 37, 11, 0.55);
  text-decoration: none;
}

.brand > div { min-width: 0; }

.eyebrow,
.subtitle {
  margin: 0;
  color: rgba(255, 255, 255, 0.83);
  font-size: 11px;
  line-height: 1.3;
}

.eyebrow { font-weight: 700; }

h1 {
  margin: 1px 0 2px;
  color: var(--white);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.08;
  text-shadow: 0 1px 0 rgba(22, 70, 104, 0.7);
  overflow-wrap: anywhere;
}

h1 span { color: #fff0b8; }

.controls {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.field {
  display: grid;
  gap: 4px;
  color: #edf7ff;
  font-size: 11px;
  font-weight: 700;
}

.field select {
  min-width: 128px;
  min-height: 30px;
  padding: 5px 8px;
  color: var(--ink);
  border: 1px solid #1f5d8e;
  border-radius: 3px;
  background: linear-gradient(#ffffff, #e8f0f6);
  box-shadow: inset 0 1px 2px rgba(28, 76, 109, 0.14);
  cursor: pointer;
}

.field select:hover { border-color: #f3b344; }

.btn {
  min-height: 30px;
  padding: 0 13px;
  color: #ffffff;
  border: 1px solid #8d3619;
  border-radius: 4px;
  background: linear-gradient(#e98243 0%, #d7602c 46%, #bd481e 54%, #a93616 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 1px 1px rgba(26, 73, 106, 0.48);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 -1px 0 rgba(104, 34, 15, 0.62);
}

.btn:hover { filter: brightness(1.07); }
.btn:disabled { cursor: wait; filter: grayscale(0.25); opacity: 0.62; }

.layout {
  display: grid;
  grid-template-columns: minmax(288px, 320px) minmax(0, 1fr);
  height: clamp(570px, calc(100svh - 122px), 760px);
  min-height: 0;
  background: var(--blue-pale);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 9px 18px 7px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-soft);
  background: #f6f9fb;
  font-size: 11px;
  line-height: 1.4;
}

.breadcrumbs a,
.seo-content a,
.site-footer a {
  color: #216a9e;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.breadcrumbs a:hover,
.seo-content a:hover,
.site-footer a:hover { color: var(--fire-dark); }

.panel {
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(125px, 1fr) auto;
  gap: 12px;
  min-height: 0;
  padding: 15px 14px;
  border-right: 1px solid var(--line);
  background: #f4f8fb;
  overflow: hidden;
}

.panel-head,
.list-title {
  color: #245e8e;
  font-size: 13px;
  font-weight: 700;
}

.panel-head {
  padding: 7px 8px;
  border: 1px solid #b7cde0;
  border-radius: 4px;
  background: linear-gradient(#f7fbfe 0%, #e3eef7 100%);
  box-shadow: inset 0 1px 0 #ffffff;
}

.stat-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  border: 1px solid #c6d6e2;
  border-radius: 4px;
  background: var(--white);
  overflow: hidden;
}

.stat {
  min-width: 0;
  padding: 10px;
  background: linear-gradient(#ffffff, #f6fafc);
}

.stat + .stat { border-left: 1px solid #d5e1ea; }

.stat-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
}

.stat-value {
  margin-top: 5px;
  color: var(--fire-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 700;
  line-height: 0.95;
}

.stat-value.small {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.legend {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  padding: 9px 10px;
  border: 1px solid #c7d8e5;
  border-radius: 4px;
  background: #edf5fb;
}

.legend-title {
  margin-bottom: 2px;
  color: #426e8d;
  font-size: 10px;
  font-weight: 700;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #4f687b;
  font-size: 10px;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border: 1px solid rgba(48, 67, 82, 0.35);
  border-radius: 50%;
}

.dot.high { background: #d65a35; }
.dot.nominal { background: #e6ae39; }
.dot.low { background: #5e9ac1; }

.status-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 18px;
  padding: 7px 8px;
  border: 1px solid #d6e2eb;
  border-radius: 3px;
  background: var(--white);
}

.status-pulse {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border: 1px solid rgba(80, 72, 37, 0.26);
  border-radius: 50%;
  background: var(--warning);
}

.status { color: var(--muted); font-size: 10px; }
.status.error { color: #a6432d; }
.status.ok { color: #357849; }
.status-wrap:has(.status.error) .status-pulse { background: #d55e3b; }
.status-wrap:has(.status.ok) .status-pulse { background: var(--green); }

.errors {
  padding: 8px 9px;
  color: #98402b;
  border: 1px solid #e0b3a9;
  border-radius: 3px;
  background: #fff0ed;
  font-size: 10px;
  line-height: 1.45;
}

.list-wrap {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.list-title {
  padding: 7px 8px;
  border: 1px solid #a8c2d6;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(#dceaf5 0%, #b9d3e8 100%);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.fire-list {
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
  border: 1px solid #c7d8e4;
  border-top: 0;
  background: var(--white);
  list-style: none;
  scrollbar-color: #8fb2ce #edf4f9;
  scrollbar-width: thin;
}

.fire-list::-webkit-scrollbar { width: 8px; }
.fire-list::-webkit-scrollbar-track { background: #edf4f9; }
.fire-list::-webkit-scrollbar-thumb { background: #8fb2ce; }

.fire-item {
  padding: 8px 9px;
  border-bottom: 1px solid #dbe6ee;
  border-left: 4px solid transparent;
  background: #ffffff;
  cursor: pointer;
}

.fire-item:nth-child(even) { background: #f7fbfe; }

.fire-item:hover,
.fire-item.active {
  border-left-color: #e48b2f;
  background: #fff8db;
}

.fire-item .row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #245f8e;
  font-size: 11px;
  font-weight: 700;
}

.fire-item .row2 {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.badge {
  display: inline-block;
  padding: 2px 4px;
  color: #ffffff;
  border: 1px solid rgba(60, 75, 87, 0.24);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.33);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.badge.high { background: linear-gradient(#e8785a, #c94a2b); }
.badge.nominal { color: #624514; background: linear-gradient(#ffe39a, #edbd4d); }
.badge.low { background: linear-gradient(#7eb4d5, #4f8eb7); }

.footnote {
  padding: 9px;
  color: #596f7e;
  border: 1px solid #cbdce8;
  border-radius: 3px;
  background: #edf5fb;
  font-size: 10px;
  line-height: 1.45;
}

.map-wrap {
  position: relative;
  min-height: 0;
  padding: 10px;
  background: #e6f0f8;
}

.map-wrap::before {
  position: absolute;
  inset: 10px;
  z-index: 410;
  pointer-events: none;
  content: "";
  border: 1px solid #b6ccdc;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.78);
}

.map-hud {
  position: absolute;
  z-index: 500;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 10px;
  padding: 6px 8px;
  color: #215f8f;
  border: 1px solid #91b5cf;
  border-radius: 3px;
  background: linear-gradient(#ffffff, #e7f1f8);
  box-shadow: 0 1px 2px rgba(46, 89, 119, 0.2);
  font-size: 10px;
  font-weight: 700;
}

.map-hud span:last-child { color: #ac4a25; }

#map {
  width: 100%;
  height: 100%;
  background: #d7e5ed;
}

.leaflet-container { color: var(--ink); font-family: var(--font); }

.leaflet-control-zoom {
  border: 1px solid #8eafc7 !important;
  border-radius: 3px !important;
  box-shadow: 0 1px 3px rgba(45, 81, 109, 0.25) !important;
}

.leaflet-control-zoom a {
  width: 30px !important;
  height: 30px !important;
  color: #225f8d !important;
  border-bottom-color: #b9ccda !important;
  border-radius: 0 !important;
  background: linear-gradient(#ffffff, #e3eef6) !important;
}

.leaflet-control-zoom a:hover { color: #ffffff !important; background: #397da9 !important; }

.leaflet-control-attribution {
  color: #62798a !important;
  border-top: 1px solid #cad9e3;
  border-left: 1px solid #cad9e3;
  border-radius: 0 !important;
  background: rgba(255, 255, 255, 0.88) !important;
  font-size: 9px !important;
}

.leaflet-control-attribution a { color: #286b9c !important; }

.leaflet-popup-content-wrapper {
  color: var(--ink);
  border: 1px solid #8fb1c9;
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(44, 80, 107, 0.28);
}

.leaflet-popup-tip { background: #ffffff; }

.leaflet-popup-content {
  margin: 11px 13px;
  font-size: 11px;
  line-height: 1.5;
}

.leaflet-popup-close-button { color: #225f8d !important; }

.popup-title {
  margin-bottom: 6px;
  color: #b94723;
  font-size: 13px;
  font-weight: 700;
}

.popup-note {
  margin-top: 8px;
  padding-top: 7px;
  color: #647887;
  border-top: 1px solid #dce6ed;
  font-size: 10px;
}

.fire-marker {
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 5px rgba(50, 75, 91, 0.45);
}

.seo-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 34px;
  padding: 30px 34px 34px;
  color: #314755;
  border-top: 1px solid #a9c0d1;
  background: #ffffff;
}

.seo-section,
.local-links,
.city-directory {
  min-width: 0;
  padding: 22px 0;
  border-top: 1px solid var(--line-soft);
}

.seo-content .intro-section {
  grid-column: 1 / -1;
  padding-top: 0;
  border-top: 0;
}

.seo-content h2 {
  margin: 0 0 11px;
  color: #245f8e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
}

.seo-content p {
  max-width: 76ch;
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.65;
}

.source-section { color: #526b7b; }

.local-links,
.city-directory { grid-column: 1 / -1; }

.local-links ul,
.city-directory ul {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.local-links li,
.city-directory li {
  min-width: 0;
  padding-left: 12px;
  position: relative;
  font-size: 13px;
  line-height: 1.45;
}

.local-links li::before,
.city-directory li::before {
  position: absolute;
  top: 8px;
  left: 0;
  width: 5px;
  height: 5px;
  content: "";
  border-radius: 50%;
  background: var(--warning);
}

.city-directory a[aria-current="page"] {
  color: var(--fire-dark);
  font-weight: 700;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 18px;
  padding: 16px 34px;
  color: #5a7282;
  border-top: 1px solid #9eb7c9;
  background: linear-gradient(#edf4f9, #dce8f1);
  font-size: 11px;
}

.noscript {
  max-width: 720px;
  margin: 18px auto;
  padding: 12px;
  color: #8e351b;
  border: 1px solid #d8a491;
  background: #fff3ef;
  font-size: 13px;
}

.error-body {
  display: grid;
  min-height: 100svh;
  padding: 24px;
  place-items: center;
}

.error-page {
  width: min(520px, 100%);
  padding: 42px;
  text-align: center;
  border: 1px solid #9eb7c9;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(45, 82, 111, 0.28);
}

.error-page .brand-mark { margin: 0 auto 15px; }

.error-code {
  margin: 0;
  color: var(--fire-dark);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}

.error-page h1 {
  margin: 8px 0 12px;
  color: #245f8e;
  text-shadow: none;
}

.error-page p { line-height: 1.55; }

.error-link {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  text-decoration: none;
}

@media (max-width: 900px) {
  #app {
    width: calc(100% - 14px);
    margin: 7px auto;
  }

  .topbar { align-items: flex-start; }
  .controls { justify-content: flex-start; }
}

@media (max-width: 780px) {
  #app {
    width: 100%;
    min-height: 100svh;
    margin: 0;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .topbar { flex-wrap: wrap; gap: 12px; min-height: 0; padding: 13px 14px 16px; }
  .brand { min-width: 0; }
  .brand-mark { width: 38px; height: 38px; font-size: 13px; }
  h1 { font-size: 22px; }

  .controls {
    display: grid;
    flex: 0 0 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  .field { min-width: 0; }
  .field select { width: 100%; }
  .btn { grid-column: 1 / -1; width: 100%; }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(320px, 48svh) auto;
    height: auto;
  }

  .map-wrap { grid-row: 1; min-height: 320px; padding: 7px; }
  .map-wrap::before { inset: 7px; }
  .panel { grid-row: 2; border-top: 1px solid #b6c9d9; border-right: 0; overflow: visible; }
  .fire-list { max-height: 380px; }
  .map-hud { top: 14px; right: 14px; }
  .map-hud span:last-child { display: none; }

  .breadcrumbs { padding-right: 14px; padding-left: 14px; overflow-wrap: anywhere; }

  .seo-content {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 25px 18px 28px;
  }

  .seo-section,
  .local-links,
  .city-directory { grid-column: 1; }

  .seo-content h2 { font-size: 18px; }
  .seo-content p { font-size: 13px; }

  .local-links ul,
  .city-directory ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .site-footer { padding: 15px 18px; }
}
