:root {
  color-scheme: light;
  --ink: #333333;
  --muted: #5f6763;
  --line: rgba(32, 96, 92, 0.2);
  --panel: rgba(255, 252, 229, 0.72);
  --soft: rgba(255, 252, 229, 0.66);
  --soft-strong: rgba(223, 247, 193, 0.86);
  --dealer-dark: #154440;
  --dealer: #20605c;
  --dealer-light: #dff7c1;
  --gold: #fdd841;
  --gold-dark: #9f870e;
  --cream: #fffce5;
  --charcoal: #333333;
  --glass: rgba(255, 254, 240, 0.64);
  --glass-strong: rgba(255, 254, 240, 0.82);
  --shadow: 0 22px 58px rgba(21, 68, 64, 0.22);
  --inner-glow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  font-family: "Source Sans Pro", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: #333333;
  background:
    linear-gradient(135deg, rgba(253, 216, 65, 0.28) 0%, rgba(255, 252, 229, 0) 26%),
    linear-gradient(225deg, rgba(32, 96, 92, 0.18) 0%, rgba(255, 252, 229, 0) 31%),
    linear-gradient(145deg, #fffce5 0%, #eef9dd 48%, #fdd841 155%);
  background-attachment: fixed;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: #333333;
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

button:hover {
  border-color: var(--dealer);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(21, 68, 64, 0.14);
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(253, 216, 65, 0.46);
  outline-offset: 2px;
}

a {
  color: var(--dealer);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(310px, 380px) minmax(0, 1fr);
  min-height: 100vh;
  position: relative;
}

.sidebar {
  background:
    linear-gradient(165deg, rgba(21, 68, 64, 0.98) 0%, rgba(32, 96, 92, 0.94) 66%, rgba(253, 216, 65, 0.32) 155%),
    linear-gradient(25deg, rgba(253, 216, 65, 0.18), rgba(21, 68, 64, 0) 42%);
  backdrop-filter: blur(26px) saturate(155%);
  -webkit-backdrop-filter: blur(26px) saturate(155%);
  border-right: 1px solid rgba(253, 216, 65, 0.24);
  color: var(--cream);
  padding: 28px;
  overflow: auto;
  box-shadow: 24px 0 70px rgba(21, 68, 64, 0.24);
}

.brand-block h1,
.topbar h2,
.panel-heading h3 {
  margin: 0;
  letter-spacing: 0;
  font-family: Montserrat, "Source Sans Pro", sans-serif;
  font-weight: 800;
}

.brand-block h1 {
  font-size: 2rem;
  line-height: 1.05;
  max-width: 11ch;
}

.brand-logo-link {
  display: block;
  max-width: 300px;
  border-radius: 8px;
  background: transparent;
  padding: 0;
  margin-bottom: 22px;
  box-shadow: none;
  transition: transform 180ms ease, filter 180ms ease;
}

.brand-logo-link:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.18));
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.76rem;
  font-family: Montserrat, "Source Sans Pro", sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro {
  margin: 16px 0 0;
  color: rgba(255, 252, 229, 0.9);
  line-height: 1.55;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 26px 0;
}

.metric-grid div,
.message-card {
  background: rgba(255, 252, 229, 0.13);
  border: 1px solid rgba(253, 216, 65, 0.24);
  border-radius: 8px;
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
  box-shadow: var(--inner-glow);
}

.metric-grid div {
  min-height: 86px;
  padding: 14px 10px;
  position: relative;
  overflow: hidden;
}

.metric-grid div::after {
  content: "";
  position: absolute;
  inset: auto 10px 8px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--dealer-light));
}

.metric-grid strong {
  display: block;
  font-size: 1.65rem;
  line-height: 1;
}

.metric-grid span,
.message-card span {
  display: block;
  color: var(--dealer-light);
  font-size: 0.76rem;
  font-family: Montserrat, "Source Sans Pro", sans-serif;
  font-weight: 800;
  line-height: 1.25;
  margin-top: 8px;
  text-transform: uppercase;
}

.control-block {
  margin-top: 22px;
}

.section-title,
.panel-heading,
.target-meta,
.detail-actions,
.detail-stat-row {
  display: flex;
  align-items: center;
}

.section-title,
.panel-heading {
  justify-content: space-between;
  gap: 16px;
}

.section-title span {
  color: var(--cream);
  font-size: 0.82rem;
  font-family: Montserrat, "Source Sans Pro", sans-serif;
  font-weight: 800;
  text-transform: uppercase;
}

.text-button {
  min-height: 30px;
  padding: 0 8px;
  border-color: rgba(223, 247, 193, 0.28);
  background: transparent;
  color: var(--dealer-light);
}

.filter-grid,
.segmented {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.filter-grid {
  grid-template-columns: 1fr;
}

.filter-grid button,
.segmented button {
  background: rgba(255, 252, 229, 0.09);
  color: rgba(247, 249, 233, 0.92);
  border-color: rgba(253, 216, 65, 0.22);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  justify-content: flex-start;
}

.filter-grid button {
  display: grid;
  grid-template-columns: 13px 1fr auto;
  align-items: center;
  gap: 9px;
  text-align: left;
}

.filter-grid button.is-active,
.segmented button.is-active {
  background: linear-gradient(135deg, rgba(253, 216, 65, 0.98), rgba(223, 247, 193, 0.88));
  color: var(--charcoal);
  border-color: rgba(255, 252, 229, 0.64);
  box-shadow: 0 12px 30px rgba(21, 68, 64, 0.2), 0 0 0 1px rgba(253, 216, 65, 0.16), var(--inner-glow);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.segmented {
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
}

.compact-search label {
  display: block;
  color: var(--cream);
  font-size: 0.82rem;
  font-family: Montserrat, "Source Sans Pro", sans-serif;
  font-weight: 800;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.compact-search input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(253, 216, 65, 0.26);
  border-radius: 6px;
  background: rgba(255, 252, 229, 0.16);
  color: var(--cream);
  padding: 0 12px;
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}

.compact-search input::placeholder {
  color: #cadbb7;
}

.message-card {
  margin-top: 24px;
  padding: 16px;
}

.message-card p {
  margin: 8px 0 0;
  color: rgba(255, 252, 229, 0.92);
  font-size: 0.92rem;
  line-height: 1.5;
}

.map-workspace {
  min-width: 0;
  padding: 24px;
  display: grid;
  grid-template-rows: auto minmax(360px, 54vh) minmax(320px, 1fr);
  gap: 18px;
}

.topbar,
.map-panel,
.target-panel,
.detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(160%);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 252, 229, 0.46), var(--inner-glow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.topbar h2 {
  font-size: 1.45rem;
  color: #333333;
}

.topbar .eyebrow {
  color: #333333;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-actions button:last-child {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--dealer), var(--dealer-dark));
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 14px 34px rgba(21, 68, 64, 0.28), 0 0 0 1px rgba(223, 247, 193, 0.2), var(--inner-glow);
}

.topbar-actions button:last-child::after,
.action-link.primary::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: translateX(-120%) skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 252, 229, 0.34), transparent);
  transition: transform 520ms ease;
}

.topbar-actions button:last-child:hover::after,
.action-link.primary:hover::after {
  transform: translateX(120%) skewX(-18deg);
}

.map-panel {
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 360px;
}

.map-fallback {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 500;
  display: grid;
  gap: 4px;
  max-width: 520px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: rgba(255, 252, 229, 0.94);
  color: #333333;
  padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(22, 34, 45, 0.16);
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
  gap: 18px;
  min-height: 0;
}

.target-panel,
.detail-panel {
  min-width: 0;
  overflow: hidden;
}

.panel-heading {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h3 {
  font-size: 1.05rem;
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.84rem;
}

.target-list {
  max-height: 440px;
  overflow: auto;
}

.target-card {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  width: 100%;
  min-height: 104px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 252, 229, 0.68);
  text-align: left;
  padding: 14px 16px;
}

.target-card:hover,
.target-card.is-selected {
  transform: none;
  background: rgba(223, 247, 193, 0.62);
}

.target-card.is-selected::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px 0;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, var(--gold), var(--dealer));
}

.target-number,
.map-marker {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(21, 68, 64, 0.22), 0 0 0 2px rgba(255, 252, 229, 0.76);
}

.target-card h4 {
  margin: 0 0 8px;
  color: #333333;
  font-size: 0.98rem;
  font-family: Montserrat, "Source Sans Pro", sans-serif;
  font-weight: 800;
  line-height: 1.25;
}

.target-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.target-meta {
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--soft-strong);
  color: var(--dealer-dark);
  font-size: 0.72rem;
  font-family: Montserrat, "Source Sans Pro", sans-serif;
  font-weight: 800;
  padding: 0 9px;
  text-transform: uppercase;
}

.detail-panel {
  padding: 20px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 300px;
  color: var(--muted);
  text-align: center;
}

.empty-state span {
  color: #333333;
  font-size: 1.08rem;
  font-family: Montserrat, "Source Sans Pro", sans-serif;
  font-weight: 800;
}

.empty-state p {
  max-width: 34ch;
  margin: 8px auto 0;
  line-height: 1.5;
}

.detail-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-family: Montserrat, "Source Sans Pro", sans-serif;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-panel h3 {
  margin: 10px 0 8px;
  font-size: 1.55rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.address {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.detail-actions {
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.action-link {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 229, 0.72);
  color: #333333;
  font-size: 0.9rem;
  font-family: Montserrat, "Source Sans Pro", sans-serif;
  font-weight: 800;
  padding: 0 12px;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.action-link:hover {
  transform: translateY(-2px);
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(21, 68, 64, 0.14);
}

.action-link.primary {
  background: linear-gradient(135deg, var(--dealer), var(--dealer-dark));
  border-color: var(--dealer);
  color: #ffffff;
}

.detail-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 16px;
}

.detail-section h4 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-family: Montserrat, "Source Sans Pro", sans-serif;
  text-transform: uppercase;
}

.detail-section p {
  margin: 0;
  color: #333333;
  line-height: 1.55;
}

.detail-stat-row {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.leaflet-popup-content {
  min-width: 220px;
  color: #333333;
}

.popup-title {
  display: block;
  margin-bottom: 6px;
  font-family: Montserrat, "Source Sans Pro", sans-serif;
  font-weight: 900;
}

.popup-copy {
  color: #333333;
  line-height: 1.4;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 24px;
  }

  .brand-block h1 {
    max-width: none;
  }

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

  .map-workspace {
    grid-template-rows: auto minmax(360px, 52vh) auto;
  }
}

@media (max-width: 780px) {
  .map-workspace {
    padding: 14px;
  }

  .topbar,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions button {
    flex: 1 1 120px;
  }

  .filter-grid,
  .segmented,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .target-list {
    max-height: none;
  }
}

@media print {
  @page {
    margin: 0.5in;
  }

  html,
  body {
    min-height: 0;
    height: auto;
    background: #ffffff;
  }

  .sidebar,
  .map-panel,
  .topbar-actions {
    display: none;
  }

  .app-shell,
  .map-workspace,
  .content-grid {
    display: block !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  .map-workspace {
    padding: 0 !important;
    gap: 0;
  }

  .topbar {
    padding: 0 0 12px;
    border: 0;
    background: #ffffff;
    box-shadow: none;
    margin: 0 0 12px;
  }

  .topbar .eyebrow {
    color: #333333;
  }

  .target-panel,
  .detail-panel {
    background: #ffffff;
    box-shadow: none;
    border-color: #9aa8b4;
    break-inside: auto;
    page-break-inside: auto;
    margin: 0 0 16px;
    overflow: visible;
  }

  .target-list {
    max-height: none !important;
    overflow: visible !important;
  }

  .target-card {
    background: #ffffff;
    break-inside: avoid;
    page-break-inside: avoid;
    min-height: 0;
  }

  .panel-heading {
    padding: 10px 12px;
  }

  .detail-panel:has(.empty-state) {
    display: none;
  }
}
