:root {
  --bg: #0d1220;
  --bg-soft: #131c2f;
  --panel: #18243b;
  --panel-soft: #1d2b44;
  --line: rgba(129, 156, 197, 0.22);
  --text: #ecf3ff;
  --muted: #9eb1cf;
  --accent: #4d8dff;
  --accent-soft: rgba(77, 141, 255, 0.18);
  --good: #18d39a;
  --warn: #ffb347;
  --bad: #ff6f6f;
  --shadow: 0 24px 54px rgba(4, 8, 16, 0.55);
  --font-body: "Sora", "Avenir Next", "Avenir", "Segoe UI", sans-serif;
  --font-display: "Sora", "Avenir Next", "Avenir", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 1px 1px, rgba(123, 142, 174, 0.26) 1px, transparent 0) 0 0 / 20px 20px,
    #f2f3f5;
}

body {
  overflow-x: hidden;
  overflow-y: auto;
}

.app-shell {
  height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid #2f3f5d;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--bg);
}

.header {
  background: linear-gradient(180deg, #1a2943, #16243b);
  border-bottom: 1px solid #2c3e60;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  z-index: 20;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.build-badge {
  display: inline-flex;
  margin-top: 6px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  color: #80a9ff;
  background: rgba(77, 141, 255, 0.08);
}

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

.controls label,
.controls select,
.controls button {
  font-size: 0.88rem;
}

.control-hidden {
  display: none !important;
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #9ab0d2;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.68rem;
  font-weight: 600;
}

.controls select {
  min-height: 38px;
  border: 1px solid #304667;
  background: #1a2841;
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  min-width: 170px;
}

button {
  border: 1px solid #365a95;
  background: #2e6fea;
  color: #ecf3ff;
  border-radius: 12px;
  min-height: 38px;
  padding: 8px 14px;
  font-weight: 650;
}

button:hover {
  border-color: #6ea1ff;
}

button.ghost {
  background: transparent;
}

button.active {
  border-color: #73a5ff;
  background: var(--accent-soft);
}

.content {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 500px;
  min-height: 0;
  gap: 0;
}

.content.content-map-only {
  grid-template-columns: 1fr;
}

@media (min-width: 1800px) {
  .content {
    grid-template-columns: 1fr 800px;
  }
}

.map-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--panel-soft);
  border-right: 1px solid #2c3e60;
  overflow: hidden;
}

.content.content-map-only .map-wrap {
  border-right: 0;
}

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

.legend {
  position: absolute;
  left: 12px;
  bottom: 14px;
  z-index: 700;
  background: rgba(16, 23, 37, 0.84);
  border: 1px solid #345078;
  border-radius: 14px;
  padding: 10px 12px;
  min-width: 220px;
  backdrop-filter: blur(3px);
}

.legend h2 {
  margin: 0;
  font-size: 0.9rem;
  color: #a4b7d4;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.legend-row {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  font-size: 0.8rem;
}

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.detail-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

#panel-content {
  height: 100%;
  background: #1a2740;
  padding: 16px;
  overflow-y: auto;
}

.detail-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.detail-card-mobile{ 
  padding: 0px 20px;
}

.insight-shell,
.compare-shell {
  border: 1px solid #2d466c;
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(180deg, #1a2a45, #17263e);
}

.insight-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.insight-kicker {
  margin: 0;
  color: #8da8cf;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  font-size: 0.82rem;
}

.detail-title {
  margin: 4px 0 0;
  font-size: 1.46rem;
  font-weight: 700;
  font-family: var(--font-display);
}

#detail-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.live-pill {
  border: 1px solid rgba(24, 211, 154, 0.42);
  color: #2fe0ac;
  background: rgba(17, 173, 129, 0.18);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  font-size: 0.72rem;
  border: 1px solid #37547e;
  border-radius: 999px;
  padding: 3px 10px;
  color: #b8c9e2;
  background: rgba(97, 138, 207, 0.15);
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.kpi-card {
  border: 1px solid #2e486f;
  border-radius: 14px;
  background: #1b2b46;
  padding: 12px;
}

.kpi-label {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.metric-value {
  margin: 6px 0 2px;
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-display);
}

#metric-sub {
  margin: 0;
  color: #9cb2d3;
  font-size: 0.82rem;
}

.delta {
  margin: 8px 0 0;
  font-weight: 700;
  font-size: 1.2rem;
  color: #d6e4fa;
}

.delta.positive {
  color: var(--good);
}

.delta.negative {
  color: var(--bad);
}

.insight-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.insight-line {
  margin: 0;
  color: #abbedb;
  font-size: 0.85rem;
}

.insight-chip {
  margin: 8px 0 0;
  display: inline-flex;
  border: 1px solid #31627f;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: #aeeecf;
  background: rgba(61, 191, 128, 0.16);
}

.insight-chip.warn {
  background: rgba(255, 143, 77, 0.15);
  color: #ffc08f;
}

.panel-section {
  border: 1px solid #2c4569;
  border-radius: 14px;
  background: #1b2a44;
  padding: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-section h3 {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.9rem;
  color: #9eb6d7;
}

#trend-chart,
#compare-trend-chart,
#seasonality-chart {
  width: 100%;
  height: 190px;
  border: 1px solid #324f78;
  border-radius: 12px;
  margin-top: 8px;
  background: linear-gradient(180deg, rgba(29, 43, 67, 0.9), rgba(23, 35, 56, 0.9));
}

#seasonality-chart {
  height: 170px;
}

.seasonality-label {
  margin: 8px 0 8px;
  color: #9eb4d3;
  font-size: 0.8rem;
}

.seasonality-heatmap {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 4px;
}

.seasonality-cell {
  min-height: 46px;
  border: 1px solid #304d74;
  border-radius: 8px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.seasonality-cell.peak {
  outline: 1px solid var(--warn);
}

.seasonality-month {
  font-size: 0.66rem;
  color: #b2c4de;
}

.seasonality-value {
  font-size: 0.72rem;
  font-weight: 600;
}

#category-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.category-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 1fr 62px;
  gap: 6px;
  align-items: center;
  font-size: 0.83rem;
}

.bar-bg {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: 1px solid #314f76;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(93, 174, 255, 0.9), rgba(50, 213, 160, 0.85));
}

.tiny {
  min-height: 28px;
  font-size: 0.75rem;
  padding: 4px 8px;
}

#category-filter-row {
  margin-top: 8px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.spike-item {
  border: 1px solid #2f4a71;
  border-radius: 10px;
  padding: 10px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.02);
}

.spike-item h4 {
  margin: 0;
  font-size: 0.84rem;
}

.spike-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

#hotspots-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.hotspot-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #2f4d75;
  border-radius: 12px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.hotspot-rank {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 700;
  color: #f5f8ff;
  background: linear-gradient(180deg, #506ca0, #2a3e66);
}

.hotspot-item h4 {
  margin: 0;
  font-size: 0.9rem;
}

.hotspot-item p {
  margin: 2px 0 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.compare-col h3 {
  margin: 0 0 6px;
  font-size: 0.86rem;
  color: #9eb7d9;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.compare-mini-card {
  border: 1px solid #2e486d;
  border-radius: 12px;
  padding: 10px;
  background: #1b2b45;
}

.compare-mini-card h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #d7e6ff;
  text-transform: none;
  letter-spacing: normal;
}

.compare-mini-label {
  margin: 0 0 4px;
  color: #94afd3;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 650;
}

.compare-mini-card .metric-value {
  font-size: 1.35rem;
  margin-top: 6px;
}

.compare-summary {
  margin: 8px 0 0;
  color: #bdd0ea;
  font-size: 0.84rem;
}

#compare-hotspots-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.placeholder {
  color: #a7bad8;
  margin: 12px 0;
}

.footer {
  border-top: 1px solid #2c3e5f;
  font-size: 0.74rem;
  padding: 8px 12px;
  color: #9ab0d2;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  background: #132037;
}

.debug-status {
  margin: 4px 0 0;
  font-size: 0.74rem;
  color: #9db5d9;
}

.footer a {
  color: #95beff;
}

.mobile-seo-header-links {
  display: none;
}

.footer-seo-links {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.header-seo-links {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  padding: 8px 12px;
  border-top: 1px solid rgba(74, 104, 152, 0.32);
  border-bottom: 1px solid rgba(74, 104, 152, 0.32);
  background: rgba(10, 25, 50, 0.92);
}

.header-seo-links a {
  flex: 0 0 auto;
}

.footer-seo-links a {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(126, 160, 214, 0.3);
  background: rgba(19, 42, 78, 0.45);
  color: #b8d3ff;
  text-decoration: none;
}

.footer-seo-links a:hover {
  text-decoration: none;
  border-color: rgba(126, 182, 255, 0.62);
  background: rgba(27, 57, 101, 0.62);
}

.footer details {
  width: 100%;
}

.footer summary {
  color: #d2e2ff;
  cursor: pointer;
}

.footer p {
  margin: 0;
}

.footer-purpose {
  width: 100%;
  color: #9eb6d9;
}

.map-tooltip {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 800;
  background: rgba(15, 23, 35, 0.9);
  border: 1px solid #35517a;
  border-radius: 10px;
  padding: 10px;
  font-size: 0.82rem;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.map-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.map-loading {
  position: absolute;
  inset: 0;
  z-index: 750;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(9, 14, 23, 0.58);
  backdrop-filter: blur(1px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.map-loading-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #35527b;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(20, 29, 44, 0.95);
  color: var(--text);
  font-size: 0.85rem;
}

.map-loading-spinner {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(149, 200, 255, 0.25);
  border-top-color: #95c8ff;
  animation: spin 900ms linear infinite;
}

body.loading .map-loading {
  opacity: 1;
}

body.loading #map {
  cursor: progress;
}

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

.bottom-sheet {
  position: sticky;
  bottom: 0;
  margin-top: 8px;
  border-top: 1px solid #2c4468;
  border-radius: 12px;
  background: rgba(19, 29, 46, 0.95);
  padding: 8px;
  display: none;
  gap: 6px;
}

.sheet-handle {
  width: 48px;
  height: 5px;
  border-radius: 999px;
  background: #5d6f8f;
  margin: 2px auto 6px;
}

.sheet-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.sheet-actions button {
  font-size: 0.78rem;
}

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

  .controls {
    justify-content: start;
  }
}

@media (max-width: 980px) {
  body {
    padding: 0;
  }

  .app-shell {
    height: 100vh;
    border-radius: 0;
  }

  .content {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .detail-panel {
    position: fixed;
    z-index: 1000;
    left: 10px;
    right: 10px;
    bottom: 8px;
    border-radius: 14px;
    max-height: 90vh;
    transform: translateY(calc(80vh - 56px));
    transition: transform 220ms ease;
    box-shadow: var(--shadow);
  }

  #panel-content {
    border-radius: 14px 14px 0 0;
    height: min(90vh, 680px);
    max-height: calc(90vh - 8px);
    padding-bottom: 12px;
  }

  .map-wrap {
    height: calc(100vh - 248px);
    border-right: 0;
  }

  .bottom-sheet {
    display: flex;
    flex-direction: column;
  }

  .kpi-grid,
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    padding-bottom: 12px;
  }

  .header-seo-links {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    margin-bottom: 12px;
  }

  .header-seo-links a {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid rgba(126, 160, 214, 0.35);
    background: rgba(19, 42, 78, 0.56);
    color: #b8d3ff;
    font-size: 12px;
    text-decoration: none;
    white-space: nowrap;
    font-size: 16px;
  }

  .header-seo-links a:hover {
    border-color: rgba(126, 182, 255, 0.62);
    background: rgba(27, 57, 101, 0.62);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

.leaflet-tile-pane {
  filter: grayscale(72%) contrast(0.98);
}

.leaflet-interactive {
  transition: stroke-width 120ms ease, fill-opacity 120ms ease;
}

@media (min-width: 981px) {
  .leaflet-interactive {
    transition: none;
  }
}

/* Build 20260216-20 insight panel restyle */
#panel-content {
  padding: 20px;
  background: linear-gradient(180deg, #071634 0%, #06112a 100%);
}

.insight-shell,
.compare-shell {
  border: 1px solid rgba(90, 120, 168, 0.28);
  border-radius: 26px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(8, 24, 56, 0.96), rgba(6, 18, 44, 0.96));
  box-shadow: inset 0 1px 0 rgba(142, 176, 225, 0.08);
  gap: 18px;
}

.insight-header {
  margin-bottom: 2px;
}

.insight-kicker {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7c95bc;
  font-size: 0.84rem;
  font-weight: 700;
}

.detail-title {
  margin-top: 8px;
  font-size: 3.1rem;
  line-height: 1;
  font-weight: 750;
  color: #f0f5ff;
}

#detail-meta {
  margin-top: 10px;
  color: #8ea3c3;
  font-size: 0.9rem;
}

.kpi-grid {
  gap: 16px;
}

.kpi-card,
.compare-col {
  border: 1px solid rgba(97, 124, 169, 0.34);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(27, 44, 79, 0.82), rgba(24, 37, 67, 0.88));
  padding: 18px;
}

.metric-value,
.compare-big {
  font-size: 3.35rem;
  line-height: 1;
  margin: 10px 0 8px;
  font-weight: 780;
  color: #f7f9ff;
}

.compare-grid {
  gap: 18px;
}

.compare-col h3 {
  margin: 0;
  color: #7f96bb;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.compare-small {
  margin: 0;
  color: #8da4c8;
  font-size: 1rem;
  font-weight: 550;
}

.panel-section {
  border: 1px solid rgba(85, 109, 149, 0.25);
  border-radius: 20px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(14, 30, 63, 0.7), rgba(10, 23, 51, 0.72));
}

.section-head {
  margin-bottom: 14px;
}

.section-head h3 {
  margin: 0;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: #7e95bb;
  font-size: 1.02rem;
  font-weight: 760;
}

.section-head-split {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-link {
  margin: 0;
  color: #3a84ff;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-size: 0.92rem;
  font-weight: 700;
}

.compare-summary {
  margin-top: 12px;
  color: #a3b6d4;
  font-size: 1.05rem;
  line-height: 1.45;
}

.hotspot-row {
  display: grid;
  grid-template-columns: 58px 1fr 20px;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(91, 117, 160, 0.28);
  border-radius: 18px;
  padding: 13px 14px;
  background: linear-gradient(125deg, rgba(29, 45, 78, 0.88), rgba(23, 36, 64, 0.9));
  margin-top: 10px;
}

.hotspot-rank {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  border: 1px solid rgba(219, 96, 96, 0.4);
  color: #ff8d8d;
  background: rgba(66, 42, 56, 0.44);
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 760;
}

.hotspot-copy {
  min-width: 0;
}

.hotspot-name {
  margin: 0;
  font-size: 1.15rem;
  color: #eef4ff;
  font-weight: 700;
}

.hotspot-meta {
  margin: 4px 0 0;
  color: #8ea5c8;
  font-size: 0.95rem;
}

.hotspot-chevron {
  color: #617ca6;
  font-size: 2rem;
  line-height: 1;
  text-align: right;
}

.category-row {
  cursor: default;
}

.category-row.readonly {
  pointer-events: none;
  user-select: none;
}

#category-filter-row {
  margin-top: 8px;
}

#category-filter-state {
  margin: 0;
  color: #8fa8cd;
  font-size: 0.88rem;
}

.legend h2 {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.92rem;
}

.legend-row {
  margin-top: 8px;
  align-items: start;
}

.legend-row small {
  color: #96abc9;
  font-size: 0.73rem;
}

@media (max-width: 1500px) {
  .detail-title {
    font-size: 2.2rem;
  }

  .metric-value,
  .compare-big {
    font-size: 2.55rem;
  }
}

/* Build 20260216-21: extracted header designs + breakdown card */
:root {
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-display: "Inter", "Segoe UI", sans-serif;
}

.app-header {
  background: #020617;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: 0 20px 40px rgba(2, 6, 23, 0.45);
  overflow: hidden;
}

.app-header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(37, 99, 235, 0.1) 0px, transparent 50%);
}

.app-header-compare::before {
  background-image:
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(37, 99, 235, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(29, 78, 216, 0.05) 0px, transparent 50%);
}

.header-shell {
  position: relative;
  max-width: 1600px;
  margin: 0 auto;
  padding: 14px 24px 16px;
  z-index: 2;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.compare-top {
  margin-bottom: 20px;
}

.header-title-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.header-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.compare-title {
  font-size: 1.45rem;
}

.header-title .material-icons-round {
  font-size: 2rem;
  color: #3b82f6;
}

.header-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 20px;
}

.divider {
  color: #64748b;
  font-size: 0.84rem;
}

.header-meta p {
  margin: 0;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 500;
}

.compare-mode-copy {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

.header-build {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid #334155;
  color: #9ca3af;
  font-size: 0.62rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.mode-active-pill {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.22);
  color: #60a5fa;
  font-size: 0.62rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  display: grid;
  place-items: center;
}

.icon-btn:hover {
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.08);
}

.action-divider {
  width: 1px;
  height: 24px;
  background: #1e293b;
  margin: 0 4px;
}

.primary-pill-btn,
.secondary-pill-btn {
  border: none;
  border-radius: 999px;
  min-height: 40px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 650;
}

.primary-pill-btn {
  color: #fff;
  background: #3b82f6;
  box-shadow: 0 12px 20px rgba(59, 130, 246, 0.24);
}

.primary-pill-btn:hover {
  background: #2563eb;
}

.secondary-pill-btn {
  color: #cbd5e1;
  background: rgba(30, 41, 59, 0.92);
  border: 1px solid #334155;
}

.secondary-pill-btn:hover {
  background: rgba(51, 65, 85, 0.95);
}

.header-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.filter-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(71, 85, 105, 0.72);
  background: rgba(30, 41, 59, 0.42);
  transition: border-color 0.18s ease;
}

.filter-card:hover {
  border-color: rgba(59, 130, 246, 0.6);
}

.filter-card > .material-icons-round,
.compact-filter > .material-icons-round {
  color: #94a3b8;
}

.floating-input {
  position: relative;
  flex: 1;
  min-width: 0;
}

.floating-input label {
  position: absolute;
  top: -0.54rem;
  left: 0.68rem;
  padding: 0 0.42rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #64748b;
  background: #0f1b35;
  z-index: 2;
}

.floating-input select {
  width: 100%;
  appearance: none;
  border: 1px solid rgba(71, 85, 105, 0.72);
  background-color: transparent;
  color: #e2e8f0;
  border-radius: 10px;
  min-height: 44px;
  padding: 8px 38px 8px 12px;
  font-size: 0.92rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.7rem center;
  background-repeat: no-repeat;
  background-size: 1.35em 1.35em;
}

.floating-input select:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.74);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.compare-select-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.compare-select-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(71, 85, 105, 0.7);
  border-radius: 14px;
  min-height: 94px;
  padding: 15px;
  background: rgba(30, 41, 59, 0.45);
}

.compare-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.28);
  background: rgba(59, 130, 246, 0.12);
  display: grid;
  place-items: center;
}

.compare-icon-wrap .material-icons-round {
  color: #3b82f6;
}

.compare-icon-wrap.neutral {
  border-color: rgba(100, 116, 139, 0.3);
  background: rgba(100, 116, 139, 0.1);
}

.compare-icon-wrap.neutral .material-icons-round {
  color: #94a3b8;
}

.compare-select-card .floating-input label {
  color: #60a5fa;
  background: #020617;
}

.compare-select-card:not(.primary) .floating-input label {
  color: #64748b;
}

.compare-select-card .floating-input select {
  font-size: 1.08rem;
  font-weight: 650;
  color: #fff;
  min-height: 48px;
}

.vs-pill {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.35);
  border: 2px solid #020617;
}

.compare-control-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 260px)) 1fr;
  gap: 10px;
  align-items: center;
}

.compact-filter {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid rgba(30, 41, 59, 0.95);
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.35);
}

.floating-input.compact label {
  font-size: 0.58rem;
  top: -0.46rem;
}

.floating-input.compact select {
  border: none;
  min-height: 32px;
  font-size: 0.86rem;
  color: #cbd5e1;
  padding-top: 5px;
  padding-bottom: 5px;
}

.floating-input.compact select:focus {
  box-shadow: none;
}

.compare-note {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 246, 0.16);
  background: rgba(59, 130, 246, 0.08);
  color: rgba(96, 165, 250, 0.86);
  font-size: 0.73rem;
  font-style: italic;
  font-weight: 600;
}

.compare-note .material-icons-round {
  font-size: 1rem;
}

/* Incident breakdown card per reference */
.breakdown-panel {
  background: #f3f4f6;
  border: 1px solid #e3e8ef;
  border-radius: 14px;
  padding: 22px;
}

.breakdown-title {
  margin: 0 0 18px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
  font-weight: 800;
  color: #94a3b8;
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.breakdown-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.breakdown-name {
  margin: 0;
  color: #233149;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.3;
}

.breakdown-value {
  margin: 0;
  color: #233149;
  font-size: 1.02rem;
  font-weight: 800;
}

.breakdown-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #d8dde5;
  overflow: hidden;
}

.breakdown-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.breakdown-fill.fill-0 {
  background: #3b82f6;
}

.breakdown-fill.fill-1 {
  background: #17b78b;
}

.breakdown-fill.fill-2 {
  background: #f19135;
}

.breakdown-footnote {
  margin-top: 10px;
  color: #8fa0b9;
  font-size: 0.76rem;
}

@media (max-width: 1320px) {
  .header-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .header-filter-grid.compare-enabled.layer-crime,
  .header-filter-grid.compare-enabled.layer-income {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compare-control-row {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .compare-note {
    justify-self: start;
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .header-top,
  .compare-top,
  .compare-select-row {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .vs-pill {
    margin: -4px 0;
    align-self: center;
  }

  .header-filter-grid,
  .compare-control-row {
    grid-template-columns: 1fr;
  }
}

/* Build 20260216-23: sizing, contrast, compare-focus, mobile usability */
.insight-community-title {
  font-size: 86px;
}

.insight-updated-line {
  font-size: 34px;
}

.insight-updated-line .material-icons-round {
  font-size: 30px;
}

.insight-badge-row .badge {
  font-size: 26px;
}

.kpi-hero-label {
  font-size: 24px;
}

.kpi-hero-value {
  font-size: 150px;
}

.kpi-hero-foot {
  font-size: 34px;
}

.kpi-hero-selected span:first-child {
  font-size: 106px;
}

.kpi-hero-selected span:last-child {
  font-size: 60px;
}

.kpi-chip {
  font-size: 22px;
}

.stat-copy {
  font-size: 32px;
}

.delta-main {
  font-size: 80px;
}

.delta-sub {
  font-size: 30px;
}

.breakdown-panel {
  background: #ffffff;
  border-color: #cfd8e6;
  box-shadow: 0 10px 28px rgba(24, 38, 66, 0.14);
}

.breakdown-title {
  color: #7f90ab;
}

.breakdown-name,
.breakdown-value {
  color: #1f2d44;
}

.breakdown-track {
  background: #d8dee8;
}

.breakdown-footnote {
  color: #7489a7;
}

@media (max-width: 1660px) {
  .insight-community-title {
    font-size: 48px;
  }

  .insight-updated-line {
    font-size: 22px;
  }

  .insight-badge-row .badge {
    font-size: 17px;
    min-height: 46px;
  }

  .kpi-hero-label {
    font-size: 16px;
  }

  .kpi-hero-value {
    font-size: 104px;
  }

  .kpi-hero-foot {
    font-size: 22px;
  }

  .kpi-hero-selected span:first-child {
    font-size: 72px;
  }

  .kpi-hero-selected span:last-child {
    font-size: 42px;
  }

  .kpi-chip {
    font-size: 14px;
  }

  .stat-copy {
    font-size: 22px;
  }

  .delta-main {
    font-size: 54px;
  }

  .delta-sub {
    font-size: 21px;
  }
}

@media (max-width: 1200px) {
  .insight-community-title {
    font-size: 50px;
  }

  .insight-updated-line {
    font-size: 17px;
  }

  .insight-updated-line .material-icons-round {
    font-size: 19px;
  }

  .insight-badge-row .badge {
    font-size: 13px;
    min-height: 40px;
    padding: 0 14px;
  }

  .kpi-hero-label {
    font-size: 13px;
  }

  .kpi-hero-value {
    font-size: 76px;
  }

  .kpi-hero-foot {
    font-size: 14px;
  }

  .kpi-hero-selected span:first-child {
    font-size: 52px;
  }

  .kpi-hero-selected span:last-child {
    font-size: 30px;
  }

  .kpi-chip {
    font-size: 12px;
    padding: 7px 11px;
  }

  .stat-copy {
    font-size: 17px;
  }

  .delta-main {
    font-size: 39px;
  }

  .delta-sub {
    font-size: 15px;
  }
}

@media (max-width: 980px) {
  html,
  body {
    overflow: auto;
  }


  .app-shell {
    height: auto;
    min-height: calc(100dvh - 16px);
  }

  .content {
    grid-template-columns: 1fr;
    grid-template-rows: 52dvh auto;
  }

  .map-wrap {
    height: 52dvh;
    border-right: none;
    border-bottom: 1px solid #2c3e60;
  }

  .detail-panel {
    height: auto;
  }

  #panel-content {
    height: auto;
    overflow: visible;
    padding: 12px;
  }

  .legend {
    left: 8px;
    bottom: 8px;
    min-width: 0;
    max-width: 76vw;
  }

  .header-shell {
    padding: 10px 12px 12px;
  }

  .header-title {
    font-size: 30px;
  }

  .compare-title {
    font-size: 24px;
  }

  .filter-card,
  .compare-select-card {
    min-height: 74px;
    padding: 10px;
  }

  .floating-input select {
    min-height: 40px;
    font-size: 14px;
  }

  .compare-select-card .floating-input select {
    font-size: 16px;
    min-height: 42px;
  }

  .compact-filter {
    min-height: 50px;
  }

  .kpi-hero {
    grid-template-columns: 1fr;
    border-radius: 20px;
    padding: 16px;
  }

  .kpi-hero-divider {
    display: none;
  }

  .insight-community-title {
    font-size: 42px;
    line-height: 0.95;
  }

  .insight-updated-line {
    font-size: 15px;
  }

  .insight-updated-line .material-icons-round {
    font-size: 18px;
  }

  .kpi-hero-value {
    font-size: 72px;
  }

  .kpi-hero-selected span:first-child {
    font-size: 50px;
  }

  .kpi-hero-selected span:last-child {
    font-size: 34px;
  }

  .kpi-hero-foot {
    font-size: 14px;
  }

  .kpi-chip {
    font-size: 12px;
  }

  .insight-stat-item {
    align-items: flex-start;
  }

  .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  .stat-icon .material-icons-round {
    font-size: 26px;
  }

  .stat-copy {
    font-size: 15px;
  }

  .delta-main {
    font-size: 34px;
  }

  .delta-sub {
    font-size: 14px;
  }

  .breakdown-title {
    font-size: 12px;
  }

  .breakdown-name,
  .breakdown-value {
    font-size: 15px;
  }
}

@media (max-width: 640px) {
  .header-title {
    font-size: 24px;
  }

  .insight-community-title {
    font-size: 34px;
  }

  .insight-badge-row .badge {
    font-size: 12px;
    min-height: 36px;
  }

  .kpi-hero-value {
    font-size: 62px;
  }

  .kpi-hero-selected span:first-child {
    font-size: 40px;
  }

  .kpi-hero-selected span:last-child {
    font-size: 27px;
  }
}

/* Build 20260216-22: Insight panel top (until Monthly Trend) */
.insight-shell .insight-panel-top {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 8px;
}

.insight-community-title {
  margin: 0;
  color: #f8fbff;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  font-size: 5.1rem;
  line-height: 0.92;
  font-weight: 800;
  word-break: break-word;
}

.insight-updated-line {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #8ea1be;
  font-size: 0.86rem;
  font-weight: 500;
}

.insight-updated-line .material-icons-round {
  font-size: 1.2rem;
  color: #7f96b7;
}

.insight-badge-row {
  margin-top: 4px;
  margin-bottom: 12px;
  gap: 14px;
}

.insight-badge-row .badge {
  min-height: 56px;
  padding: 0 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border-color: #2f456c;
  background: #0f1f3a;
  color: #c2cede;
  font-size: 1rem;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.kpi-hero {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 22px;
  align-items: stretch;
  border: 1px solid rgba(72, 100, 139, 0.32);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(8, 24, 56, 0.86), rgba(8, 20, 47, 0.86));
  padding: 22px;
  margin-top: 2px;
  margin-bottom: 10px;
}

.kpi-hero-divider {
  width: 1px;
  background: rgba(84, 111, 152, 0.32);
}

.kpi-hero-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.kpi-hero-label {
  margin: 0;
  color: #6f88ab;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.74rem;
  font-weight: 760;
}

.kpi-hero-value {
  margin: 0;
  color: #f7f9ff;
  font-size: 8.2rem;
  line-height: 0.9;
  font-weight: 800;
}

.kpi-hero-foot {
  margin: 0;
  color: #95aac8;
  font-size: 0.92rem;
  font-weight: 520;
}

.kpi-hero-selected {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-hero-selected span:first-child {
  color: #f7f9ff;
  font-size: 3.5rem;
  line-height: 0.95;
  font-weight: 760;
}

.kpi-hero-selected span:last-child {
  color: #f7f9ff;
  font-size: 2.2rem;
  line-height: 1;
  font-weight: 700;
}

.kpi-chip {
  margin: 0;
  align-self: flex-start;
  border: 1px solid rgba(9, 142, 136, 0.55);
  border-radius: 999px;
  background: rgba(6, 70, 90, 0.42);
  color: #1fd0c0;
  padding: 8px 14px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.insight-stat-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 8px;
}

.insight-stat-item {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
}

.stat-icon.neutral {
  background: rgba(31, 47, 77, 0.9);
  border-color: rgba(74, 97, 132, 0.35);
}

.stat-icon.down {
  background: rgba(6, 80, 58, 0.65);
  border-color: rgba(48, 191, 128, 0.35);
}

.stat-icon.up {
  background: rgba(95, 66, 18, 0.6);
  border-color: rgba(239, 172, 69, 0.4);
}

.stat-icon.flat {
  background: rgba(37, 55, 88, 0.7);
  border-color: rgba(86, 116, 167, 0.35);
}

.stat-icon .material-icons-round {
  font-size: 2rem;
  color: #95aac8;
}

.stat-icon.down .material-icons-round {
  color: #47db94;
}

.stat-icon.up .material-icons-round {
  color: #ffbe62;
}

.stat-copy {
  margin: 0;
  color: #b6c2d6;
  font-size: 0.92rem;
  line-height: 1.35;
}

.stat-copy strong {
  color: #f7f9ff;
  font-weight: 760;
}

.delta-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.delta-main {
  margin: 0;
  font-size: 2.05rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
}

.delta-main.down {
  color: #45df96;
}

.delta-main.up {
  color: #ffba57;
}

.delta-main.flat {
  color: #8db0dd;
}

.delta-sub {
  margin: 0;
  color: #7f95b7;
  font-size: 0.84rem;
  font-weight: 600;
}

@media (max-width: 1600px) {
  .insight-community-title {
    font-size: 3.8rem;
  }

  .kpi-hero-value {
    font-size: 6.2rem;
  }

  .kpi-hero-selected span:first-child {
    font-size: 2.8rem;
  }

  .kpi-hero-selected span:last-child {
    font-size: 1.7rem;
  }
}

@media (max-width: 1320px) {
  .insight-community-title {
    font-size: 3rem;
  }

  .kpi-hero {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .kpi-hero-divider {
    display: none;
  }

  .kpi-hero-value {
    font-size: 5rem;
  }
}

/* Build 20260216-24: mobile collapsible header + insight sizing cleanup */
.mobile-header-toggle {
  display: none;
}

@media (min-width: 981px) {
  .header-collapse {
    max-height: none !important;
    opacity: 1 !important;
    overflow: visible !important;
    pointer-events: auto !important;
  }
}

@media (max-width: 980px) {
  .mobile-header-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(71, 85, 105, 0.75);
    border-radius: 999px;
    background: rgba(15, 30, 58, 0.9);
    color: #c9d5e8;
    min-height: 34px;
    padding: 0 12px;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: 0.02em;
  }

  .mobile-header-toggle .material-icons-round {
    font-size: 17px;
  }

  .header-collapse {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height 220ms ease, opacity 180ms ease;
  }

  .header-collapse.expanded {
    max-height: 1800px;
    opacity: 1;
    overflow: visible;
    pointer-events: auto;
    margin-top: 8px;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .primary-pill-btn,
  .secondary-pill-btn {
    min-height: 36px;
    font-size: 13px;
    padding: 0 14px;
  }

  .header-meta p {
    font-size: 12px;
  }

  .header-build {
    font-size: 10px;
  }
}

.insight-shell {
  overflow: hidden;
}

.insight-community-title {
  font-size: 48px !important;
  line-height: 0.94 !important;
}

.insight-updated-line {
  font-size: 18px !important;
}

.insight-updated-line .material-icons-round {
  font-size: 22px !important;
}

.insight-badge-row .badge {
  font-size: 18px !important;
  min-height: 44px !important;
}

.kpi-hero-label {
  font-size: 16px !important;
}

.kpi-hero-value {
  font-size: 48px !important;
  word-break: break-word;
}

.kpi-hero-foot {
  font-size: 20px !important;
}

.kpi-hero-selected span:first-child {
  font-size: 48px !important;
  line-height: 0.92;
  word-break: break-word;
}

.kpi-hero-selected span:last-child {
  font-size: 36px !important;
  line-height: 0.96;
  word-break: break-word;
}

.kpi-chip {
  font-size: 13px !important;
}

.stat-copy {
  font-size: 20px !important;
}

.delta-main {
  font-size: 46px !important;
}

.delta-sub {
  font-size: 18px !important;
}

.breakdown-panel {
  background: #f7f9fc !important;
  border-color: #c5d0df !important;
  box-shadow: 0 8px 24px rgba(17, 27, 43, 0.14) !important;
}

.breakdown-title {
  color: #7a8da9 !important;
}

.breakdown-name,
.breakdown-value {
  color: #16253d !important;
}

.breakdown-track {
  background: #ccd6e5 !important;
}

.breakdown-footnote {
  color: #7187a5 !important;
}

@media (max-width: 1200px) {
  .insight-community-title {
    font-size: 44px !important;
  }

  .insight-updated-line {
    font-size: 15px !important;
  }

  .insight-updated-line .material-icons-round {
    font-size: 19px !important;
  }

  .insight-badge-row .badge {
    font-size: 13px !important;
    min-height: 38px !important;
    padding: 0 12px !important;
  }

  .kpi-hero-value {
    font-size: 74px !important;
  }

  .kpi-hero-foot {
    font-size: 14px !important;
  }

  .kpi-hero-selected span:first-child {
    font-size: 50px !important;
  }

  .kpi-hero-selected span:last-child {
    font-size: 27px !important;
  }

  .kpi-chip {
    font-size: 12px !important;
  }

  .stat-copy {
    font-size: 16px !important;
  }

  .delta-main {
    font-size: 34px !important;
  }

  .delta-sub {
    font-size: 14px !important;
  }
}

@media (max-width: 980px) {
  html,
  body {
    overflow: auto !important;
  }

  /* body {
    padding: 8px !important;
  } */

  .app-shell {
    min-height: calc(100dvh - 16px) !important;
    height: auto !important;
  }

  .content {
    display: flex !important;
    flex-direction: column;
    min-height: 0;
    gap: 0;
  }

  .map-wrap {
    height: 44dvh !important;
    min-height: 280px;
    border-right: none;
    border-bottom: 1px solid #2c3e60;
    flex: none;
  }

  .detail-panel {
    height: auto !important;
    min-height: 0;
    overflow: visible;
  }

  #panel-content {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 12px 10px 18px !important;
  }

  .insight-community-title {
    font-size: 34px !important;
  }

  .insight-badge-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .kpi-hero {
    padding: 14px !important;
    border-radius: 18px;
  }

  .kpi-hero-value {
    font-size: 62px !important;
  }

  .kpi-hero-selected span:first-child {
    font-size: 42px !important;
  }

  .kpi-hero-selected span:last-child {
    font-size: 24px !important;
  }

  .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .stat-icon .material-icons-round {
    font-size: 24px;
  }

  .delta-main {
    font-size: 30px !important;
  }

  .delta-sub {
    font-size: 13px !important;
  }
}

@media (max-width: 640px) {
  .header-title {
    font-size: 18px;
    line-height: 1.1;
  }

  .header-title .material-icons-round {
    font-size: 20px;
  }

  .header-meta {
    gap: 6px;
  }

  .header-meta p {
    font-size: 11px;
    line-height: 1.2;
  }

  .header-build {
    font-size: 9px;
    padding: 2px 8px;
  }

  .insight-community-title {
    font-size: 28px !important;
  }

  .insight-updated-line {
    font-size: 13px !important;
  }

  .insight-updated-line .material-icons-round {
    font-size: 16px !important;
  }

  .kpi-hero-label {
    font-size: 12px !important;
  }

  .kpi-hero-value {
    font-size: 50px !important;
  }

  .kpi-hero-foot {
    font-size: 13px !important;
  }

  .kpi-hero-selected span:first-child {
    font-size: 34px !important;
  }

  .kpi-hero-selected span:last-child {
    font-size: 20px !important;
  }

  .kpi-chip {
    font-size: 11px !important;
    padding: 6px 10px !important;
  }

  .stat-copy {
    font-size: 14px !important;
  }

  .delta-main {
    font-size: 26px !important;
  }

  .delta-sub {
    font-size: 12px !important;
  }

  .breakdown-panel {
    padding: 16px !important;
  }

  .breakdown-name,
  .breakdown-value {
    font-size: 14px !important;
  }
}

.insight-community-title-mobile {
margin-bottom: 20px
}
/* Build 20260216-26: mobile legend position, KPI layout, hover states, compare sizing */
button,
.icon-btn,
.mobile-header-toggle,
.drawer-close-btn,
.primary-pill-btn,
.secondary-pill-btn,
.hotspot-row {
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease, box-shadow 180ms ease;
}

button:hover:not(:disabled),
.drawer-close-btn:hover,
.mobile-header-toggle:hover,
.icon-btn:hover,
.primary-pill-btn:hover,
.secondary-pill-btn:hover {
  transform: translateY(-1px);
}

select:hover {
  border-color: rgba(89, 133, 204, 0.75);
}

.kpi-hero.kpi-hero-single {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: 22px;
  padding: 18px;
}

.kpi-main-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.kpi-hero-value-inline {
  margin: 0;
  color: #f5f8ff;
  font-size: 68px;
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.kpi-selected-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.kpi-selected-copy {
  margin: 0;
  color: #b2c2da;
  font-size: 20px;
  line-height: 1.25;
}

.kpi-selected-copy strong {
  color: #f0f5ff;
  font-weight: 760;
}

.insight-community-title {
  font-size: 52px !important;
}

.insight-updated-line {
  font-size: 16px !important;
}

.insight-updated-line .material-icons-round {
  font-size: 19px !important;
}

.insight-badge-row .badge {
  font-size: 15px !important;
  min-height: 40px !important;
}

.stat-copy {
  font-size: 17px !important;
}

.delta-main {
  font-size: 38px !important;
}

.delta-sub {
  font-size: 15px !important;
}

.breakdown-panel {
  background: #eef3f8 !important;
  border-color: #b6c5da !important;
  box-shadow: 0 8px 22px rgba(19, 30, 48, 0.14) !important;
}

.breakdown-track {
  background: #c4d0df !important;
}

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

.compare-shell .compare-col {
  min-width: 0;
}

.compare-shell .compare-big {
  margin: 8px 0 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 0.98;
}

.compare-shell .compare-big span:first-child {
  font-size: 88px;
  font-weight: 780;
  color: #f5f8ff;
}

.compare-shell .compare-big span:last-child {
  font-size: 30px;
  font-weight: 700;
  color: #e6eefb;
}

.compare-shell .compare-big.compare-big-income span:first-child {
  font-size: 58px;
}

.compare-shell .compare-big.compare-big-income span:last-child {
  font-size: 22px;
}

.compare-shell .compare-small {
  font-size: 24px;
}

.lowest-jump-btn {
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.lowest-jump-btn:hover {
  border-color: rgba(120, 157, 219, 0.62);
  background: linear-gradient(125deg, rgba(41, 60, 98, 0.92), rgba(30, 46, 78, 0.95));
}

.lowest-jump-btn:focus-visible {
  outline: 2px solid #69a7ff;
  outline-offset: 2px;
}

.spotlight-head {
  margin-bottom: 12px;
}

.spotlight-head h3 {
  margin: 0;
  color: #d9e6fa;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 18px;
  font-weight: 780;
}

.spotlight-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spotlight-item {
  width: 100%;
  border-radius: 22px;
  border: 1px solid rgba(145, 171, 206, 0.28);
  background: linear-gradient(160deg, rgba(28, 45, 78, 0.86), rgba(19, 32, 57, 0.9));
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 140px;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.spotlight-item-btn {
  cursor: pointer;
  color: inherit;
  text-align: left;
  font: inherit;
}

.spotlight-item-high:hover {
  border-color: rgba(239, 114, 114, 0.56);
  background: linear-gradient(160deg, rgba(47, 41, 61, 0.9), rgba(35, 31, 49, 0.92));
}

.spotlight-item-low:hover,
.spotlight-item-btn:hover {
  border-color: rgba(94, 206, 176, 0.56);
  background: linear-gradient(160deg, rgba(30, 54, 66, 0.9), rgba(21, 43, 54, 0.92));
}

.spotlight-item-btn:focus-visible {
  outline: 2px solid #75b8ff;
  outline-offset: 2px;
}

.spotlight-rank {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 46px;
  font-weight: 780;
  line-height: 1;
}

.spotlight-rank-high {
  border: 1px solid rgba(243, 138, 138, 0.45);
  color: #ff7a7a;
  background: linear-gradient(150deg, rgba(248, 127, 127, 0.11), rgba(230, 97, 97, 0.08));
}

.spotlight-rank-low {
  border: 1px solid rgba(85, 211, 186, 0.45);
  color: #58dcc2;
  background: linear-gradient(150deg, rgba(73, 208, 180, 0.11), rgba(62, 190, 166, 0.08));
}

.spotlight-copy {
  min-width: 0;
}

.spotlight-name {
  margin: 0;
  color: #f2f7ff;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 26px;
  font-weight: 760;
}

.spotlight-meta {
  margin: 6px 0 0;
  color: #a2b8da;
  font-size: 17px;
}

.spotlight-meter {
  width: 100%;
  max-width: 136px;
  height: 10px;
  justify-self: end;
  border-radius: 999px;
  background: rgba(157, 175, 203, 0.35);
  overflow: hidden;
}

.spotlight-meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.spotlight-meter-fill-high {
  background: linear-gradient(90deg, #ef4444, #fb6c6c);
}

.spotlight-meter-fill-low {
  background: linear-gradient(90deg, #14b8a6, #36cfc1);
}

.income-kpi {
  border-color: rgba(88, 153, 123, 0.28);
  background: linear-gradient(180deg, rgba(14, 52, 58, 0.54), rgba(8, 28, 39, 0.62));
}

.income-cards-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.income-mini-card {
  border: 1px solid rgba(97, 124, 169, 0.3);
  border-radius: 14px;
  background: rgba(20, 36, 64, 0.56);
  padding: 12px;
}

.income-mini-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8ea7ca;
  font-size: 11px;
  font-weight: 700;
}

.income-mini-value {
  margin: 8px 0 0;
  color: #f2f7ff;
  font-size: 20px;
  font-weight: 760;
  line-height: 1.2;
}

.income-mini-copy {
  margin: 8px 0 0;
  color: #9fb6d8;
  font-size: 13px;
  line-height: 1.4;
}

.income-delta-up {
  color: #67ecba;
}

.income-delta-down {
  color: #ff9c9c;
}

.income-delta-flat {
  color: #c3d3ea;
}

.income-context-inline .section-head {
  margin-bottom: 8px;
}

.income-inline-grid {
  display: grid;
  gap: 6px;
}

.income-inline-grid p {
  margin: 0;
  font-size: 14px;
  color: #bdd0ea;
  line-height: 1.45;
}

.income-inline-grid p strong {
  color: #edf5ff;
}

.income-inline-delta {
  font-weight: 700;
}

@media (min-width: 981px) {
  .stat-icon {
    width: 84px;
    height: 84px;
    border-radius: 24px;
  }

  .stat-icon .material-icons-round {
    font-size: 42px !important;
    line-height: 1;
  }

  .stat-icon.neutral .material-icons-round {
    font-size: 42px !important;
  }
}

@media (max-width: 1200px) {
  .kpi-hero-value-inline {
    font-size: 52px;
  }

  .kpi-selected-copy {
    font-size: 16px;
  }

  .insight-community-title {
    font-size: 38px !important;
  }

  .compare-shell .compare-big span:first-child {
    font-size: 58px;
  }

  .compare-shell .compare-big span:last-child {
    font-size: 22px;
  }

  .compare-shell .compare-small {
    font-size: 16px;
  }

  .spotlight-item {
    grid-template-columns: 76px minmax(0, 1fr) 120px;
  }

  .spotlight-rank {
    width: 58px;
    height: 58px;
    font-size: 40px;
  }

  .spotlight-name {
    font-size: 21px;
  }

  .spotlight-meta {
    font-size: 15px;
  }
}

@media (max-width: 980px) {
  .income-cards-grid {
    grid-template-columns: 1fr;
  }

  .spotlight-item {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .spotlight-rank {
    width: 52px;
    height: 52px;
    font-size: 34px;
    border-radius: 14px;
  }

  .spotlight-name {
    font-size: 18px;
  }

  .spotlight-meta {
    font-size: 14px;
  }

  .spotlight-meter {
    grid-column: 2 / 3;
    justify-self: start;
    max-width: 120px;
    height: 8px;
    margin-top: 4px;
  }
}

@media (max-width: 980px) {
  .legend {
    top: 10px !important;
    right: 10px !important;
    left: auto !important;
    bottom: auto !important;
    max-width: 62vw;
  }

  .kpi-hero-value-inline {
    font-size: 44px;
  }

  .kpi-selected-copy {
    font-size: 14px;
  }

  .insight-community-title {
    font-size: 30px !important;
  }

  .insight-updated-line {
    font-size: 13px !important;
  }

  .insight-badge-row .badge {
    font-size: 12px !important;
    min-height: 34px !important;
  }

  .compare-shell .compare-grid {
    grid-template-columns: 1fr;
  }

  .compare-shell .compare-big span:first-child {
    font-size: 50px;
  }

  .compare-shell .compare-big span:last-child {
    font-size: 18px;
  }

  .compare-shell .compare-small {
    font-size: 14px;
  }
}

@media (max-width: 640px) {
  .kpi-hero-value-inline {
    font-size: 38px;
  }

  .kpi-selected-copy {
    font-size: 13px;
  }
}

/* Build 20260216-25: compare row + mobile drawer behavior */
.compare-inline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.compare-inline-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(71, 85, 105, 0.72);
  background: rgba(30, 41, 59, 0.42);
}

.compare-inline-card > .material-icons-round {
  color: #94a3b8;
}

.vs-pill.mini {
  width: 42px;
  height: 42px;
  font-size: 12px;
}

.inline-reset {
  min-height: 40px;
  padding: 0 14px;
}

.header-filter-grid.compare-enabled.layer-crime {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.header-filter-grid.compare-enabled.layer-income {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .compare-inline-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .compare-inline-card {
    min-height: 68px;
    padding: 10px;
  }

  .inline-reset {
    justify-self: start;
  }

  .header-filter-grid.compare-enabled.layer-crime,
  .header-filter-grid.compare-enabled.layer-income {
    grid-template-columns: 1fr;
  }

  .content {
    display: block !important;
    position: relative;
  }

  .map-wrap {
    height: calc(100dvh - 180px) !important;
    min-height: 320px;
  }

  .detail-panel.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(92vw, 430px);
    height: 100dvh !important;
    max-height: 100dvh;
    z-index: 1800;
    background: linear-gradient(180deg, #0a1732 0%, #08142b 100%);
    border-left: 1px solid #2a4267;
    box-shadow: -20px 0 46px rgba(1, 7, 20, 0.62);
    transform: translateX(100%);
    transition: transform 220ms ease;
    pointer-events: none;
  }

  .detail-panel.mobile-drawer.drawer-open {
    transform: translateX(0);
    pointer-events: auto;
  }

  .detail-panel.mobile-drawer.drawer-closed {
    transform: translateX(100%);
  }

  .detail-panel.mobile-drawer #panel-content {
    height: 100dvh !important;
    overflow-y: auto !important;
    padding: 12px 12px 20px !important;
  }

  .drawer-close-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
  }

  .drawer-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    padding: 0;
    border: 1px solid rgba(97, 124, 169, 0.45);
    background: rgba(20, 36, 64, 0.82);
    color: #d4e0f2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
  }

  .drawer-close-btn:hover {
    background: rgba(27, 47, 83, 0.95);
    border-color: rgba(122, 158, 219, 0.72);
    transform: translateY(-1px);
  }

  .drawer-close-btn:focus-visible {
    outline: 2px solid #74aaff;
    outline-offset: 2px;
  }

  .drawer-close-btn .material-icons-round {
    font-size: 22px;
    line-height: 1;
  }
}

@media (max-width: 640px) {
  .map-wrap {
    height: calc(100dvh - 164px) !important;
    min-height: 280px;
  }

  .detail-panel.mobile-drawer {
    width: 96vw;
  }
}

/* Build 20260216-28: Terms of Use modal */
.modal-open {
  overflow: hidden !important;
}

.terms-link-button {
  border: none;
  background: transparent;
  color: #7eb0ff;
  padding: 0;
  margin: 0 0 0 6px;
  font-size: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.terms-link-button:hover {
  color: #a5c8ff;
}

.terms-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  background: rgba(3, 7, 18, 0.72);
  padding: 16px;
}

.terms-modal {
  position: relative;
  width: min(960px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(97, 124, 169, 0.45);
  background: linear-gradient(180deg, #0f1f3b 0%, #0a172f 100%);
  box-shadow: 0 24px 56px rgba(2, 7, 18, 0.65);
  z-index: 2;
}

.terms-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(84, 109, 149, 0.35);
  background: rgba(8, 20, 44, 0.98);
}

.terms-modal-header h2 {
  margin: 0;
  font-size: 24px;
  color: #f3f7ff;
}

.terms-modal-header p {
  margin: 4px 0 0;
  color: #9bb0cf;
  font-size: 14px;
}

.terms-close-btn {
  border: 1px solid rgba(97, 124, 169, 0.45);
  background: rgba(17, 34, 63, 0.86);
  color: #e5ecfa;
  border-radius: 999px;
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
}

.terms-close-btn .material-icons-round {
  font-size: 17px;
}

.terms-modal-body {
  padding: 16px 18px 22px;
  color: #c8d6eb;
  line-height: 1.55;
  font-size: 14px;
}

.terms-modal-body h3 {
  margin: 18px 0 8px;
  color: #f2f7ff;
  font-size: 17px;
}

.terms-modal-body p {
  margin: 8px 0;
}

.terms-modal-body ul {
  margin: 8px 0 10px 18px;
  padding: 0;
}

.terms-modal-body li {
  margin: 4px 0;
}

.terms-overlay-dismiss {
  position: fixed;
  inset: 0;
  border: none;
  background: transparent;
  z-index: 1;
  cursor: default;
}

@media (max-width: 640px) {
  .terms-modal-overlay {
    padding: 8px;
  }

  .terms-modal {
    max-height: calc(100dvh - 16px);
    border-radius: 12px;
  }

  .terms-modal-header {
    padding: 12px;
  }

  .terms-modal-header h2 {
    font-size: 20px;
  }

  .terms-modal-header p {
    font-size: 12px;
  }

  .terms-modal-body {
    padding: 12px;
    font-size: 13px;
  }
}

/* Build 20260216-33: mobile compact expandable legend */
.legend-mobile-toggle {
  display: none;
}

@media (max-width: 980px) {
  .legend-mobile-toggle {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    min-height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(91, 124, 172, 0.52);
    background: rgba(17, 30, 54, 0.86);
    color: #d8e5fb;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0 10px;
    margin: 0;
  }

  .legend-mobile-toggle .material-icons-round {
    font-size: 18px;
  }

  .legend-mobile h2 {
    display: none;
  }

  .legend-mobile .legend-rows.closed {
    display: none;
  }

  .legend-mobile .legend-rows.open {
    margin-top: 8px;
  }

  .legend-mobile.legend-count .legend-rows.open {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
  }

  .legend-mobile.legend-count .legend-row {
    display: grid;
    grid-template-columns: 13px minmax(0, 1fr);
    column-gap: 8px;
    row-gap: 4px;
    align-items: start;
    margin-top: 0;
    font-size: 12px;
    line-height: 1.25;
  }

  .legend-mobile.legend-count .legend-row .swatch {
    display: block;
    grid-column: 1;
    grid-row: 1;
    width: 13px;
    height: 13px;
    margin: 2px 0 0 0;
  }

  .legend-mobile.legend-count .legend-row strong {
    display: block;
    grid-column: 2;
    grid-row: 1;
    color: #e7f0ff;
    font-size: 12px;
  }

  .legend-mobile.legend-count .legend-row small {
    display: block;
    grid-column: 2;
    grid-row: 2;
    color: #9ab1d3;
    font-size: 11px;
  }
}

.header-title-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 8px;
  flex: 0 0 30px;
  box-shadow: 0 6px 14px rgba(17, 24, 39, 0.35);
}

@media (max-width: 980px) {
  .header-title-logo {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
    border-radius: 6px;
  }
}

/* Build 20260221-01: filter summary header + refine modal */
.filter-summary-shell {
  display: grid;
  gap: 14px;
  padding: 22px 24px 20px;
}

.filter-summary-top {
  margin-bottom: 0;
}

.filter-summary-headline {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 0.94;
  letter-spacing: -0.03em;
  color: #f6fbff;
}

.filter-summary-copy {
  margin: 0;
  color: #9eb5d8;
  font-size: clamp(18px, 2.2vw, 32px);
  line-height: 1.25;
}

.applied-filter-controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.applied-filter-chip-row {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.applied-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid rgba(118, 145, 190, 0.42);
  background: rgba(18, 39, 75, 0.72);
  color: #dce9fb;
  min-height: 42px;
  padding: 0 16px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.applied-filter-chip .material-icons-round {
  font-size: 18px;
  color: #4f9dff;
}

.refine-filter-btn {
  width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(59, 130, 246, 0.82);
  background: #3b82f6;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: background-color 140ms ease, transform 120ms ease, box-shadow 140ms ease;
  box-shadow: 0 10px 22px rgba(59, 130, 246, 0.25);
  flex: 0 0 auto;
}

.refine-filter-btn:hover {
  border-color: rgba(37, 99, 235, 0.9);
  background: #2563eb;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.3);
}

.refine-filter-btn:active {
  transform: scale(0.98);
}

.refine-filter-btn .material-icons-round {
  font-size: 20px;
}

.refine-filter-btn-label {
  display: none;
}

.filter-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 4200;
  background: rgba(4, 10, 22, 0.62);
  backdrop-filter: blur(4px);
  padding: 18px;
  display: grid;
  place-items: center;
  animation: filterModalOverlayIn 220ms ease-out both;
}

.filter-modal-panel {
  width: min(840px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  border-radius: 30px;
  border: 1px solid rgba(93, 125, 179, 0.5);
  background:
    radial-gradient(circle at 16% 0%, rgba(63, 126, 214, 0.22), transparent 52%),
    linear-gradient(180deg, #0c1831 0%, #0a1530 100%);
  box-shadow: 0 34px 64px rgba(3, 9, 21, 0.66);
  will-change: transform, opacity;
  transform-origin: center bottom;
  animation: filterModalPanelIn 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.filter-modal-handle {
  width: 82px;
  height: 8px;
  border-radius: 999px;
  background: rgba(144, 171, 210, 0.34);
  margin: 16px auto 10px;
}

.filter-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  padding: 4px 84px 6px 20px;
}

.filter-modal-head > div {
  min-width: 0;
}

.filter-modal-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f4f9ff;
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.filter-modal-title .material-icons-round {
  color: #4f9dff;
  font-size: clamp(30px, 4vw, 44px);
}

.filter-modal-subtitle {
  margin: 8px 0 0;
  color: #9eb5d8;
  font-size: 18px;
}

.filter-modal-close-btn {
  position: absolute;
  top: 6px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(96, 127, 175, 0.5);
  background: rgba(26, 46, 84, 0.8);
  color: #d7e5fb;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.filter-modal-close-btn .material-icons-round {
  font-size: 28px;
}

.filter-modal-body {
  padding: 8px 20px 12px;
  display: grid;
  gap: 16px;
}

.filter-modal-section {
  display: grid;
  gap: 10px;
}

.filter-modal-label {
  margin: 0;
  color: #8ea8cd;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 13px;
  font-weight: 750;
}

.filter-select-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(82, 112, 161, 0.62);
  border-radius: 22px;
  min-height: 108px;
  padding: 14px;
  background: rgba(24, 40, 72, 0.66);
}

.filter-select-card.compact {
  min-height: 88px;
}

.filter-select-icon {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 18px;
  border: 1px solid rgba(80, 138, 226, 0.45);
  background: rgba(49, 108, 194, 0.24);
  display: grid;
  place-items: center;
}

.filter-select-icon .material-icons-round {
  color: #4f9dff;
  font-size: 28px;
}

.filter-select-icon.neutral {
  border-color: rgba(108, 129, 162, 0.45);
  background: rgba(59, 80, 113, 0.25);
}

.filter-select-icon.neutral .material-icons-round {
  color: #9eb5d8;
}

.filter-select-icon.warning {
  border-color: rgba(219, 136, 61, 0.44);
  background: rgba(109, 62, 34, 0.34);
}

.filter-select-icon.warning .material-icons-round {
  color: #ff9838;
}

.filter-select-icon.compact {
  width: 46px;
  height: 46px;
  flex-basis: 46px;
  border-radius: 14px;
}

.filter-select-icon.compact .material-icons-round {
  font-size: 22px;
}

.filter-modal-panel .floating-input label {
  background: #0f1e3c;
  color: #7e98bd;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.filter-modal-panel .floating-input select {
  min-height: 52px;
  border: 1px solid rgba(84, 114, 160, 0.72);
  background-color: rgba(18, 34, 64, 0.34);
  color: #eef4ff;
  font-size: 20px;
  font-weight: 650;
  border-radius: 14px;
}

.filter-modal-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.filter-modal-grid-two > div .filter-modal-label {
  margin-bottom: 10px;
}

.compare-toggle-btn {
  border: 1px dashed rgba(96, 126, 176, 0.58);
  background: transparent;
  color: #a6bcdd;
  border-radius: 14px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 14px;
  font-size: 20px;
  font-weight: 600;
}

.compare-toggle-btn .material-icons-round {
  font-size: 22px;
}

.compare-toggle-btn.active {
  border-style: solid;
  border-color: rgba(78, 156, 255, 0.74);
  color: #d7e7ff;
  background: rgba(23, 52, 95, 0.46);
}

.filter-vs-wrap {
  display: grid;
  place-items: center;
  margin: 2px 0;
}

.filter-vs-pill {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  border: 2px solid rgba(72, 140, 235, 0.55);
  background: linear-gradient(135deg, #3d88ff 0%, #2563eb 100%);
  color: #f3f8ff;
  font-size: 24px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 0 20px rgba(61, 136, 255, 0.35);
}

.filter-modal-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px 20px;
  border-top: 1px solid rgba(77, 104, 148, 0.34);
}

.filter-reset-btn {
  width: 80px;
  height: 72px;
  border-radius: 20px;
  border: 1px solid rgba(96, 125, 170, 0.56);
  background: rgba(30, 49, 84, 0.76);
  color: #d6e4fa;
  display: grid;
  place-items: center;
}

.filter-reset-btn .material-icons-round {
  font-size: 34px;
}

.filter-apply-btn {
  flex: 1;
  min-height: 72px;
  border-radius: 20px;
  border: 1px solid rgba(92, 153, 255, 0.86);
  background: linear-gradient(135deg, #4f98ff 0%, #3f7de0 100%);
  color: #ffffff;
  font-size: clamp(20px, 2.2vw, 30px);
  font-weight: 750;
  letter-spacing: -0.01em;
  box-shadow: 0 14px 26px rgba(54, 118, 216, 0.45);
}

.filter-apply-btn:hover {
  background: linear-gradient(135deg, #5aa2ff 0%, #4a86e8 100%);
}

@keyframes filterModalOverlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes filterModalPanelIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 980px) {
  .filter-summary-shell {
    padding: 18px 14px 16px;
    gap: 12px;
  }

  .filter-summary-headline {
    font-size: clamp(24px, 9vw, 44px);
  }

  .filter-summary-copy {
    font-size: 16px;
  }

  .applied-filter-chip {
    min-height: 38px;
    font-size: 14px;
    padding: 0 12px;
    flex: 0 0 auto;
  }

  .applied-filter-chip .material-icons-round {
    font-size: 16px;
  }

  .applied-filter-controls-row {
    display: grid;
    gap: 10px;
  }

  .applied-filter-chip-row {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    padding-bottom: 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .applied-filter-chip-row::-webkit-scrollbar {
    display: none;
  }

  .refine-filter-btn {
    width: 100%;
    height: auto;
    min-height: 46px;
    font-size: 16px;
    border-radius: 16px;
    gap: 8px;
    padding: 0 14px;
  }

  .refine-filter-btn .material-icons-round {
    font-size: 18px;
  }

  .refine-filter-btn-label {
    display: inline;
  }

  .filter-modal-overlay {
    padding: 0;
    align-items: end;
  }

  .filter-modal-panel {
    width: 100%;
    max-height: calc(100dvh - 10px);
    border-radius: 28px 28px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    animation-name: filterModalPanelInMobile;
  }

  .filter-modal-head {
    padding: 4px 66px 6px 14px;
  }

  .filter-modal-title {
    font-size: 22px;
  }

  .filter-modal-title .material-icons-round {
    font-size: 24px;
  }

  .filter-modal-subtitle {
    font-size: 14px;
  }

  .filter-modal-close-btn {
    top: 4px;
    right: 14px;
    width: 46px;
    height: 46px;
  }

  .filter-modal-close-btn .material-icons-round {
    font-size: 24px;
  }

  .filter-modal-body {
    padding: 8px 14px 12px;
    gap: 14px;
  }

  .filter-modal-label {
    font-size: 11px;
    letter-spacing: 0.16em;
  }

  .filter-select-card {
    min-height: 84px;
    border-radius: 18px;
    padding: 10px;
  }

  .filter-select-card.compact {
    min-height: 76px;
  }

  .filter-select-icon {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
    border-radius: 14px;
  }

  .filter-select-icon .material-icons-round {
    font-size: 24px;
  }

  .filter-modal-panel .floating-input select {
    min-height: 46px;
    font-size: 16px;
  }

  .filter-modal-grid-two {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .compare-toggle-btn {
    min-height: 46px;
    font-size: 16px;
    padding: 0 12px;
  }

  .compare-toggle-btn .material-icons-round {
    font-size: 20px;
  }

  .filter-vs-pill {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .filter-modal-footer {
    gap: 10px;
    padding: 12px 14px 14px;
  }

  .filter-reset-btn {
    width: 62px;
    height: 58px;
    border-radius: 14px;
  }

  .filter-reset-btn .material-icons-round {
    font-size: 28px;
  }

  .filter-apply-btn {
    min-height: 58px;
    border-radius: 14px;
    font-size: 16px;
  }
}

@keyframes filterModalPanelInMobile {
  from {
    opacity: 0;
    transform: translateY(36px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .filter-modal-overlay,
  .filter-modal-panel {
    animation: none !important;
  }
}
