:root {
  --bg: #edf2f6;
  --bg-wash: radial-gradient(circle at top left, #ffffff 0%, #edf2f6 42%, #dfe7ee 100%);
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --surface-tint: #f7fafc;
  --ink: #122033;
  --ink-soft: #5b6c7f;
  --ink-faint: #8090a3;
  --border: rgba(17, 37, 62, 0.12);
  --border-strong: rgba(17, 37, 62, 0.24);
  --line: rgba(17, 37, 62, 0.08);
  --primary: #1b5cff;
  --primary-deep: #133fb5;
  --primary-soft: rgba(27, 92, 255, 0.12);
  --accent: #0f766e;
  --recommended: #1768e4;
  --watch: #c47910;
  --pass: #a63f45;
  --incomplete: #7b8797;
  --recommended-soft: rgba(23, 104, 228, 0.14);
  --watch-soft: rgba(196, 121, 16, 0.14);
  --pass-soft: rgba(166, 63, 69, 0.14);
  --incomplete-soft: rgba(123, 135, 151, 0.14);
  --shadow-sm: 0 6px 14px rgba(12, 27, 45, 0.045);
  --shadow-lg: 0 18px 44px rgba(12, 27, 45, 0.09);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --page-width: 1500px;
  --font-ui: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg-wash);
  overflow-x: hidden;
  min-height: 100%;
}

button,
input {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.page-shell {
  width: min(calc(100% - 32px), var(--page-width));
  margin: 12px auto 0;
  padding-bottom: 28px;
  overflow-x: clip;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 18px;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 253, 0.94));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
}

.hero__copy {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 320px;
  min-width: 0;
}

.hero__copy .eyebrow {
  flex-shrink: 0;
}

.hero__copy h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero__meta {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  flex-wrap: wrap;
  min-width: 0;
}

.meta-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  white-space: normal;
}

.meta-pill__label {
  color: var(--ink-faint);
  font-weight: 600;
}

.meta-pill strong {
  color: var(--ink);
  font-weight: 800;
}

.kpi,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.kpi__value,
.selection-score strong,
.selection-stats strong,
.market-facts dd,
.lead-table td,
.lead-table th,
.badge {
  font-variant-numeric: tabular-nums;
}

.kpi__label,
.eyebrow,
.table-card__hint,
.selection-panel__subhead,
.selection-score span,
.selection-stats span,
.market-facts dt,
.kpi__subtle {
  color: var(--ink-faint);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.68rem;
  font-weight: 700;
}

.dashboard {
  display: grid;
  gap: 12px;
  min-width: 0;
}

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

.kpi {
  padding: 10px 14px;
  border-radius: var(--radius-md);
}

.kpi__value {
  display: block;
  margin: 4px 0 3px;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1;
}

.kpi__subtle {
  font-size: 0.82rem;
}

.card {
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.controls {
  display: grid;
  gap: 10px;
  padding: 10px 16px;
}

.controls--embedded {
  padding: 0 0 12px;
}

.controls__row {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  flex: 1 1 320px;
  position: relative;
}

.field span {
  font-size: 0.84rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.field input {
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  padding: 0 14px;
  color: var(--ink);
  outline: none;
}

.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 12;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

.search-suggestions[hidden],
.search-suggestions:empty {
  display: none !important;
}

.search-suggestion {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  color: var(--ink);
  display: grid;
  gap: 4px;
  cursor: pointer;
}

.search-suggestion:hover,
.search-suggestion:focus-visible,
.search-suggestion.is-active {
  border-color: var(--primary-soft);
  background: rgba(27, 92, 255, 0.08);
  outline: none;
}

.search-suggestion__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-suggestion__value {
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.search-suggestion__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.search-suggestion__meta {
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--ink-soft);
}

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

.chip {
  border: 1px solid var(--border);
  background: var(--surface-strong);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--ink-soft);
  transition: 160ms ease;
  font-size: 0.84rem;
}

.chip:hover,
.chip:focus-visible {
  border-color: var(--primary);
  color: var(--primary-deep);
}

.chip.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.72fr);
  gap: 12px;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  align-items: start;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.section-heading > div {
  min-width: 0;
}

.section-heading h2 {
  margin: 4px 0 0;
  font-size: 1.28rem;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.section-heading--compact h2 {
  font-size: 1.16rem;
}

.map-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  justify-content: flex-end;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend__swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.legend__swatch--recommended {
  background: var(--recommended);
}

.legend__swatch--watch {
  background: var(--watch);
}

.legend__swatch--pass {
  background: var(--pass);
}

.legend__swatch--incomplete {
  background: var(--incomplete);
}

.legend__swatch--hot {
  background: #ff6b57;
}

.legend__swatch--warm {
  background: #ffad4d;
}

.legend__swatch--cool {
  background: #4d8dff;
}

.legend__swatch--waitlist {
  background: rgba(118, 129, 144, 0.24);
  border: 2px dashed rgba(77, 88, 104, 0.82);
}

.legend__swatch--related-missing {
  background: rgba(206, 132, 31, 0.28);
  border: 2px solid rgba(160, 91, 10, 0.9);
}

.chip-group--compact {
  gap: 8px;
}

.chip--map {
  padding: 7px 11px;
}

.chip--portfolio {
  padding: 7px 11px;
}

.portfolio-card {
  display: grid;
  gap: 14px;
}

.planner-controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.planner-budget-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  gap: 12px;
  flex: 1 1 auto;
}

.field--budget {
  min-width: min(100%, 220px);
  flex: 0 1 220px;
}

.planner-mode {
  display: grid;
  gap: 8px;
}

.planner-mode__label,
.planner-stat span {
  font-size: 0.82rem;
  color: var(--ink-faint);
  font-weight: 700;
}

.planner-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.planner-stat {
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(247, 250, 252, 0.98), rgba(240, 245, 250, 0.98));
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.planner-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 1.02rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.planner-summary {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.portfolio-picks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.portfolio-pick {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 252, 0.98));
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.portfolio-pick:hover,
.portfolio-pick:focus-visible {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
  outline: none;
}

.portfolio-pick.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.portfolio-pick__top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.portfolio-pick__top strong {
  display: block;
  font-size: 1rem;
  line-height: 1.1;
}

.portfolio-pick__top span span {
  display: block;
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.35;
}

.portfolio-pick__metrics {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.portfolio-empty {
  margin: 0;
  padding: 16px;
  border-radius: 16px;
  border: 1px dashed var(--border-strong);
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.54);
}

.map-frame {
  position: relative;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(241, 246, 251, 0.95), rgba(228, 235, 243, 0.9)),
    linear-gradient(145deg, rgba(27, 92, 255, 0.08), rgba(15, 118, 110, 0.04));
  border: 1px solid var(--border);
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  transform: translateZ(0);
  isolation: isolate;
  min-height: clamp(420px, 52vw, 720px);
}

.zip-map {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.zip-map__region {
  cursor: pointer;
  transition: opacity 180ms ease, transform 180ms ease;
}

.zip-map__region path {
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.zip-map__region--waitlist {
  cursor: default;
}

.zip-map__region--waitlist path {
  stroke: rgba(92, 103, 118, 0.58);
  stroke-dasharray: 5 6;
}

.zip-map__region--waitlist.is-background-waitlist path {
  stroke: rgba(92, 103, 118, 0.5);
  stroke-width: 1.8;
  stroke-dasharray: 5 6;
}

.zip-map__region:hover path,
.zip-map__region.is-hovered path {
  stroke: var(--ink);
  stroke-width: 2.5;
}

.zip-map__region.is-selected path {
  stroke: var(--ink);
  stroke-width: 3.5;
  filter: drop-shadow(0 12px 18px rgba(18, 32, 51, 0.18));
}

.zip-map__region--waitlist.is-related-missing path {
  stroke: rgba(160, 96, 23, 0.82);
  stroke-width: 2.6;
  stroke-dasharray: 6 4;
  filter: drop-shadow(0 8px 16px rgba(160, 96, 23, 0.12));
}

.zip-map__label {
  font-size: 11px;
  font-weight: 800;
  fill: rgba(18, 32, 51, 0.82);
  letter-spacing: 0.03em;
  pointer-events: none;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(244, 248, 252, 0.9);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.zip-map__monthly,
.zip-map__effective {
  font-size: 7.7px;
  font-weight: 700;
  fill: rgba(18, 32, 51, 0.72);
  letter-spacing: 0.01em;
  pointer-events: none;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(244, 248, 252, 0.88);
  stroke-width: 2.2px;
  stroke-linejoin: round;
}

.zip-map__monthly {
  fill: rgba(18, 32, 51, 0.78);
}

.zip-map__waitlist-label {
  font-size: 10px;
  font-weight: 800;
  fill: rgba(78, 89, 102, 0.92);
  letter-spacing: 0.03em;
  pointer-events: none;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(244, 248, 252, 0.9);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.map-tooltip {
  position: absolute;
  z-index: 4;
  min-width: 210px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(17, 26, 40, 0.94);
  color: #fff;
  box-shadow: 0 20px 40px rgba(17, 26, 40, 0.25);
  pointer-events: none;
}

.map-tooltip strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.map-tooltip__grid {
  display: grid;
  gap: 3px;
  font-size: 0.78rem;
}

.map-note {
  margin: 10px 2px 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.map-overlap-panel {
  position: absolute;
  right: 18px;
  top: 54%;
  transform: translateY(-50%);
  z-index: 3;
  width: min(250px, calc(100% - 36px));
  padding: 12px 13px;
  border-radius: 16px;
  background: rgba(255, 251, 244, 0.92);
  border: 1px solid rgba(160, 96, 23, 0.18);
  box-shadow: 0 10px 26px rgba(22, 34, 53, 0.1);
  backdrop-filter: blur(12px);
}

.map-overlap-panel__eyebrow {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(125, 76, 15, 0.82);
}

.map-overlap-panel__list {
  display: grid;
  gap: 8px;
}

.map-overlap-pill {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(160, 96, 23, 0.14);
}

.map-overlap-pill strong {
  font-size: 0.96rem;
  letter-spacing: -0.01em;
  color: rgba(108, 60, 6, 0.98);
}

.map-overlap-pill span {
  font-size: 0.8rem;
  line-height: 1.35;
  color: rgba(108, 60, 6, 0.76);
}

.detail-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-card {
  display: flex;
  flex-direction: column;
}

.coverage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 12px;
}

.coverage-card,
.waitlist-card,
.coverage-matrix {
  padding: 14px 16px;
}

.map-card,
.detail-card {
  padding: 14px 16px;
}

.selection-empty {
  color: var(--ink-soft);
  line-height: 1.45;
  padding: 10px 0 4px;
}

.selection-panel {
  display: grid;
  gap: 10px;
}

.selection-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.selection-panel__header h3 {
  margin: 6px 0 2px;
  font-size: clamp(1.6rem, 4vw, 1.9rem);
  line-height: 0.92;
  overflow-wrap: anywhere;
}

.selection-score {
  text-align: right;
}

.selection-score strong {
  display: block;
  font-size: 1.45rem;
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge--recommended {
  color: var(--recommended);
  background: var(--recommended-soft);
}

.badge--watch {
  color: var(--watch);
  background: var(--watch-soft);
}

.badge--pass {
  color: var(--pass);
  background: var(--pass-soft);
}

.badge--incomplete {
  color: var(--incomplete);
  background: var(--incomplete-soft);
}

.selection-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.selection-stats article {
  border-radius: var(--radius-md);
  padding: 10px;
  background: var(--surface-tint);
  border: 1px solid var(--line);
}

.selection-stats span {
  font-size: 0.78rem;
}

.selection-stats strong {
  display: block;
  margin-top: 3px;
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.market-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  margin: 0;
}

.market-facts div {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.market-facts dt {
  font-size: 0.68rem;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.market-facts dd {
  margin: 0;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.selection-shot {
  margin: 0;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
}

.selection-shot__link {
  display: block;
}

.selection-shot img {
  width: 100%;
  aspect-ratio: 16 / 8.2;
  object-fit: cover;
  background: #dde6ef;
}

.selection-shot figcaption {
  padding: 6px 10px 8px;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.coverage-panel {
  display: grid;
  gap: 12px;
}

.coverage-summary,
.special-waitlist__copy {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

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

.coverage-block {
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--surface-tint);
  border: 1px solid var(--line);
  min-width: 0;
}

.coverage-block--missing {
  background: rgba(166, 63, 69, 0.05);
}

.coverage-block__label,
.coverage-group__label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.72rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.token-list,
.scope-list,
.zip-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.token,
.zip-chip,
.scope-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.2;
}

.token,
.zip-chip {
  color: var(--ink-soft);
}

.scope-pill {
  flex-direction: column;
  align-items: flex-start;
  border-radius: 14px;
  max-width: 100%;
}

.scope-pill strong {
  color: var(--ink);
  font-size: 0.76rem;
}

.scope-pill span {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.scope-empty {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.4;
}

.scope-empty--good {
  color: var(--accent);
}

.coverage-groups {
  display: grid;
  gap: 10px;
}

.coverage-group {
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.coverage-group__head h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.coverage-group__head p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

.coverage-group__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.mini-table-wrap {
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
}

.mini-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.mini-table th,
.mini-table td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.82rem;
  line-height: 1.35;
}

.mini-table th {
  background: rgba(246, 249, 252, 0.98);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.special-waitlist {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.table-wrap {
  position: relative;
  isolation: isolate;
  overflow-x: auto;
  overflow-y: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  max-width: 100%;
  max-height: 520px;
  background: rgba(255, 255, 255, 0.96);
  -webkit-overflow-scrolling: touch;
}

.table-card,
.map-card,
.hero,
.controls,
.kpis {
  min-width: 0;
}

.lead-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  table-layout: auto;
  background: rgba(255, 255, 255, 0.9);
}

.lead-table th,
.lead-table td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
  font-size: 0.72rem;
  line-height: 1.12;
}

.lead-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(246, 249, 252, 0.98);
}

.lead-table th button {
  border: 0;
  background: transparent;
  padding: 0;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  width: 100%;
  text-align: inherit;
  line-height: 1.1;
  overflow-wrap: normal;
  word-break: keep-all;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.lead-table th button::after {
  content: "↕";
  font-size: 0.68em;
  color: var(--ink-faint);
  flex-shrink: 0;
  opacity: 0.6;
}

.lead-table th.is-sort-active button {
  color: var(--primary);
}

.lead-table th.is-sort-active button::after {
  color: var(--primary);
  opacity: 1;
}

.lead-table th[data-sort-dir="desc"].is-sort-active button::after {
  content: "↓";
}

.lead-table th[data-sort-dir="asc"].is-sort-active button::after {
  content: "↑";
}

.lead-table .badge {
  padding: 4px 8px;
  font-size: 0.56rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.lead-table .cell-num,
.lead-table .cell-tier {
  white-space: nowrap;
}

.lead-table .cell-score,
.lead-table .cell-tier {
  width: 1%;
}

.lead-table .cell-zip {
  white-space: nowrap;
}

.lead-table .cell-text {
  min-width: 120px;
}

.lead-table tbody tr {
  cursor: pointer;
  transition: background-color 160ms ease;
}

.lead-table tbody tr:hover {
  background: rgba(27, 92, 255, 0.04);
}

.lead-table tbody tr.is-selected {
  background: rgba(27, 92, 255, 0.1);
}

.row-title {
  display: grid;
  gap: 2px;
}

.row-title__zip {
  font-weight: 800;
}

.row-title__sub {
  display: none;
}

.value-soft {
  color: var(--ink-soft);
}

.footer-note {
  color: var(--ink-soft);
  font-size: 0.82rem;
  padding: 0 6px;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .planner-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero__copy {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .hero__copy h1 {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .hero__meta {
    justify-content: flex-start;
    flex: 1 1 100%;
  }

  .top-grid,
  .coverage-grid {
    grid-template-columns: 1fr;
  }

  .coverage-group__grid,
  .selection-stats,
  .market-facts {
    grid-template-columns: 1fr;
  }

  .map-toolbar {
    width: 100%;
    justify-content: flex-start;
    align-items: flex-start;
  }

  .legend {
    justify-content: flex-start;
  }

  .map-frame {
    min-height: clamp(340px, 70vw, 560px);
  }
}

@media (max-width: 1180px) {
  .planner-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .map-frame {
    min-height: 460px;
  }

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

  .detail-card {
    overflow-y: visible;
  }
}

@media (max-width: 760px) {
  .planner-budget-fields {
    grid-template-columns: 1fr;
  }

  .planner-controls {
    align-items: stretch;
  }

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

  .portfolio-picks {
    grid-template-columns: 1fr;
  }

  .page-shell {
    width: min(calc(100% - 20px), var(--page-width));
    margin: 8px auto 20px;
  }

  .hero {
    gap: 8px;
    padding: 10px 14px;
  }

  .hero__copy h1 {
    font-size: 0.98rem;
  }

  .meta-pill {
    width: 100%;
    justify-content: space-between;
  }

  .card {
    padding: 12px 14px;
  }

  .controls {
    padding: 10px 12px;
  }

  .controls--embedded {
    padding: 0 0 12px;
  }

  .controls__row {
    align-items: stretch;
  }

  .field,
  .chip-group {
    flex-basis: 100%;
  }

  .field input {
    font-size: 16px;
  }

  .kpis,
  .selection-stats,
  .market-facts,
  .coverage-group__grid {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .selection-panel__header,
  .map-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .section-heading h2,
  .section-heading--compact h2 {
    font-size: 1.06rem;
  }

  .map-frame {
    min-height: 0;
    aspect-ratio: 1 / 1.02;
  }

  .legend {
    justify-content: flex-start;
    font-size: 0.72rem;
  }

  .legend span {
    gap: 6px;
  }

  .map-overlap-panel {
    top: auto;
    left: 14px;
    right: 14px;
    bottom: 14px;
    transform: none;
    width: auto;
  }

  .selection-shot img {
    aspect-ratio: 4 / 3;
  }

  .zip-map__effective,
  .zip-map__monthly {
    display: none;
  }

  .zip-map__label {
    font-size: 9px;
  }

  .map-frame {
    aspect-ratio: auto;
    min-height: 340px;
  }

  .table-wrap,
  .mini-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    max-height: none;
  }

  .lead-table,
  .mini-table {
    min-width: 0;
    width: 100%;
    background: transparent;
  }

  .lead-table thead,
  .mini-table thead {
    display: none;
  }

  .lead-table tbody,
  .mini-table tbody {
    display: grid;
    gap: 12px;
  }

  .lead-table tbody tr,
  .mini-table tbody tr {
    display: grid;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.94);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
  }

  .lead-table td,
  .mini-table td {
    display: grid;
    grid-template-columns: minmax(98px, 112px) 1fr;
    gap: 10px;
    padding: 10px 12px;
    white-space: normal;
    border-bottom: 1px solid var(--line);
    font-size: 0.8rem;
    line-height: 1.35;
  }

  .lead-table td:last-child,
  .mini-table td:last-child {
    border-bottom: 0;
  }

  .lead-table td::before,
  .mini-table td::before {
    content: attr(data-label);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }

  .lead-table .cell-num,
  .lead-table .cell-tier,
  .lead-table .cell-zip {
    white-space: normal;
  }

  .lead-table .cell-tier .badge {
    justify-self: start;
  }

  .row-title__sub {
    display: block;
    color: var(--ink-soft);
    font-size: 0.78rem;
  }

  .lead-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.94);
  }
}

@media (max-width: 520px) {
  .planner-stats {
    grid-template-columns: 1fr;
  }

  .page-shell {
    width: min(calc(100% - 16px), var(--page-width));
  }

  .hero,
  .card {
    border-radius: 18px;
  }

  .kpi {
    padding: 9px 12px;
  }

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

  .kpi__value {
    font-size: 1.18rem;
  }

  .chip {
    width: 100%;
    justify-content: center;
  }

  .map-note,
  .footer-note {
    font-size: 0.76rem;
  }

  .portfolio-pick {
    padding: 12px;
  }

  .portfolio-pick__top {
    flex-direction: column;
    align-items: stretch;
  }

  .planner-summary,
  .map-note,
  .coverage-summary,
  .special-waitlist__copy {
    font-size: 0.78rem;
  }

  .lead-table td,
  .mini-table td {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px 11px;
  }

  .lead-table td::before,
  .mini-table td::before {
    margin-bottom: 2px;
  }
}
