@font-face {
  font-family: "Montserrat";
  src: url("./assets/fonts/Montserrat-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("./assets/fonts/Montserrat-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("./assets/fonts/Montserrat-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --canvas: #dce5f0;
  --surface: #ffffff;
  --well: #edf2f8;
  --well-hover: #e3ebf5;
  --ink: #163047;
  --muted: #5b7186;
  --slate: #64748b;
  --border: #d7e2ee;
  --brand: #0b6e99;
  --brand-dark: #085678;
  --brand-soft: #e6f2f8;
  --good: #146c43;
  --good-bg: #e7f5ee;
  --amber: #b45309;
  --shadow-card: 0 10px 30px rgba(15, 39, 68, 0.12), 0 1px 4px rgba(15, 39, 68, 0.06);
  --shadow-sm: 0 6px 18px rgba(15, 39, 68, 0.1), 0 1px 2px rgba(15, 39, 68, 0.05);
  --font-ui: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sheet-width: 444px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.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;
}

.app-shell,
.workspace,
.map-pane {
  position: relative;
  width: 100%;
  height: 100%;
}

.map-canvas {
  position: absolute;
  inset: 0;
  background: var(--canvas);
}

/* Top Floating Bar (Desktop) */
.top-floating-bar {
  position: absolute;
  top: 20px;
  left: 24px;
  right: 24px;
  height: 56px;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.top-left-group {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-home-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 2px;
  background: transparent;
  border: 0;
  border-radius: 10px;
  text-align: left;
  flex-shrink: 0;
}

.brand-home-btn:hover {
  background: var(--well);
}

.brand-pin-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
}

.brand-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.city-segment {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--well);
  border-radius: 10px;
}

.city-tab {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  transition: background-color 0.14s ease, color 0.14s ease;
}

.city-tab:hover {
  color: var(--ink);
}

.city-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 39, 68, 0.08);
}

/* Search Box */
.search-wrap {
  position: relative;
  flex: 1 1 320px;
  max-width: 400px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  background: var(--well);
  border: 1px solid transparent;
  border-radius: 10px;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.search-box:focus-within {
  background: var(--surface);
  border-color: var(--brand);
}

.search-icon {
  color: var(--muted);
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  outline: none;
}

.search-input::placeholder {
  color: var(--muted);
}

.search-clear-btn {
  border: 0;
  background: transparent;
  padding: 2px;
  display: inline-flex;
  color: var(--muted);
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  z-index: 40;
}

.search-status {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 4px 6px 8px;
  max-height: 320px;
  overflow-y: auto;
}

.search-result-btn {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.search-result-btn:hover,
.search-result-btn.is-active {
  background: var(--well);
}

.search-res-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.search-res-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-res-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-res-kind {
  font-size: 10px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}

.search-hl {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 3px;
  padding: 0 1px;
}

.compare-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.compare-toggle-btn:hover {
  background: var(--well);
}

.compare-toggle-btn.is-active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

/* Mobile Compact Top Bar */
.mobile-top-bar,
.mobile-heat-chips {
  display: none;
}

/* Start Prompt Pill (Overview 00) */
.start-prompt-pill {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 16;
  padding: 10px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  pointer-events: none;
}

/* Desktop Active Point Map Context Pill */
.map-context-pill {
  position: absolute;
  top: 88px;
  left: 24px;
  z-index: 16;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  max-width: calc(100vw - 530px);
  pointer-events: none;
}

.context-swatch {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  flex-shrink: 0;
}

.context-swatch.is-contour {
  background: rgba(11, 110, 153, 0.22);
  border: 1.8px solid var(--brand);
}

.context-swatch.is-rings {
  background: radial-gradient(circle, var(--brand) 0%, var(--brand) 38%, rgba(11, 110, 153, 0.22) 45%, rgba(11, 110, 153, 0.22) 100%);
  border: 1.5px solid var(--brand);
}

.context-swatch.is-highlight {
  background: rgba(245, 158, 11, 0.28);
  border: 1.8px solid #D97706;
}

/* Bottom-Left Stack (Catchment Legend + Heat Layer Toggle) */
.bottom-left-stack {
  position: absolute;
  left: 24px;
  bottom: 20px;
  z-index: 16;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.catchment-legend-card {
  width: 264px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.catchment-legend-kicker {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 2px;
}

.catchment-legend-title {
  margin: 0 0 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.catchment-legend-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.catchment-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.catchment-legend-left {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-weight: 500;
}

.catchment-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex-shrink: 0;
}

.catchment-swatch.is-zone-10 {
  background: rgba(11, 110, 153, 0.55);
  border: 1px solid rgba(11, 110, 153, 0.95);
}

.catchment-swatch.is-zone-20 {
  background: rgba(11, 110, 153, 0.30);
  border: 1px solid rgba(11, 110, 153, 0.70);
}

.catchment-swatch.is-zone-30 {
  background: rgba(11, 110, 153, 0.14);
  border: 1px solid rgba(11, 110, 153, 0.50);
}

.catchment-swatch.is-zone-far {
  background: transparent;
  border: 1.2px dashed rgba(100, 116, 139, 0.85);
}

.catchment-legend-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
}

.catchment-legend-val.is-far {
  color: var(--slate);
}

.contour-swatch-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1.8px solid var(--brand);
}

.heat-layer-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 41px;
  padding: 4px 10px 4px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.heat-bar-label {
  padding: 0 5px 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.heat-tab {
  border: 0;
  background: transparent;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.heat-tab:hover {
  color: var(--ink);
}

.heat-tab.is-active {
  background: var(--ink);
  color: var(--surface);
  font-weight: 700;
}

.density-scale-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.scale-blocks {
  display: inline-flex;
  gap: 2px;
}

.scale-blocks i {
  display: block;
  width: 12px;
  height: 9px;
  border-radius: 2px;
}

.scale-blocks i:nth-child(1) { background: #dce3df; }
.scale-blocks i:nth-child(2) { background: #b8cfc1; }
.scale-blocks i:nth-child(3) { background: #86b49b; }
.scale-blocks i:nth-child(4) { background: #47956d; }
.scale-blocks i:nth-child(5) { background: #17643f; }

.density-scale-inline.is-affluence .scale-blocks i:nth-child(1) { background: #e8eef4; }
.density-scale-inline.is-affluence .scale-blocks i:nth-child(2) { background: #c5dece; }
.density-scale-inline.is-affluence .scale-blocks i:nth-child(3) { background: #8ec5a8; }
.density-scale-inline.is-affluence .scale-blocks i:nth-child(4) { background: #499d73; }
.density-scale-inline.is-affluence .scale-blocks i:nth-child(5) { background: #146c43; }

/* Bottom-Right Stack */
.bottom-right-stack {
  position: absolute;
  right: 24px;
  bottom: 20px;
  z-index: 16;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  transition: right 0.16s ease;
}

body[data-view-mode="point"] .bottom-right-stack {
  right: 484px;
}

body[data-view-mode="compare"] .bottom-right-stack {
  right: 540px;
}

.guard-legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  transition: opacity 0.14s ease, border-color 0.14s ease;
}

.guard-legend-pill:hover {
  border-color: #2c4762;
}

.guard-legend-pill:not(.is-active) {
  opacity: 0.65;
}

.guard-check-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1.5px solid #2c4762;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guard-legend-pill.is-active .guard-check-dot {
  background: #2c4762;
  box-shadow: inset 0 0 0 2px #ffffff;
}

.guard-dot-solid {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: rgba(44, 71, 98, 0.16);
  border: 1.3px solid #2c4762;
}

.guard-dot-dashed {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 1.3px dashed #2c4762;
}

.guard-muted {
  color: var(--muted);
}

.zoom-controls {
  display: inline-flex;
  align-items: center;
  height: 41px;
  padding: 3px;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.zoom-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.zoom-btn:hover {
  background: var(--well);
}

.compare-pin-bar {
  position: absolute;
  top: 88px;
  left: 24px;
  z-index: 16;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  font-size: 12px;
}

.compare-pin-sep {
  color: var(--border);
  margin: 0 2px;
}

.compare-pin-hint {
  color: var(--muted);
  font-weight: 500;
}

.compare-pin-btn {
  border: 1px solid var(--border);
  background: var(--well);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}

.compare-pin-btn.is-a.is-active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

.compare-pin-btn.is-b.is-active {
  background: var(--good-bg);
  border-color: var(--good);
  color: var(--good);
}

.map-attribution-tag {
  position: absolute;
  right: 24px;
  bottom: 4px;
  z-index: 12;
  font-size: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.84);
  padding: 1px 6px;
  border-radius: 6px;
  pointer-events: auto;
}

body[data-view-mode="point"] .map-attribution-tag {
  right: 484px;
}

body[data-view-mode="compare"] .map-attribution-tag {
  right: 540px;
}

.map-attribution-tag a {
  color: var(--muted);
  text-decoration: none;
}

/* Map Pins & Badges */
.club-pill-marker,
.rival-pill-marker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
}

.club-pill-marker:hover,
.rival-pill-marker:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.rival-pill-marker {
  max-width: 196px;
}

.rival-pill-marker span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.marker-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand);
  flex-shrink: 0;
}

.marker-dot.is-high { background: var(--amber); }
.marker-dot.is-medium { background: var(--brand); }
.marker-dot.is-low { background: var(--slate); }

.candidate-pin-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.candidate-pin-badge {
  margin-bottom: 4px;
  padding: 4px 11px;
  background: var(--ink);
  color: var(--surface);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.candidate-pin-badge.is-pin-b {
  background: var(--good);
}

.candidate-pin-svg {
  display: block;
  filter: drop-shadow(0 4px 8px rgba(15, 39, 68, 0.25));
}

/* Right Floating Sheet */
.inspector-sheet {
  position: absolute;
  top: 90px;
  right: 24px;
  bottom: 20px;
  width: var(--sheet-width);
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body[data-view-mode="compare"] .inspector-sheet {
  width: 500px;
}

.mobile-sheet-grabber {
  display: none;
}

.loading-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  animation: loadingSlide 1.1s infinite ease-in-out;
  z-index: 5;
}

@keyframes loadingSlide {
  0% { transform: translateX(-60%); }
  100% { transform: translateX(60%); }
}

.quiet-error-banner {
  margin: 10px 18px 0;
  padding: 9px 12px;
  background: var(--well);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  color: var(--amber);
  font-weight: 500;
}

.sheet-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  flex-shrink: 0;
}

.sheet-title-wrap {
  min-width: 0;
}

.sheet-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}

.sheet-subtitle {
  margin: 4px 0 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.sheet-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-circle-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.icon-circle-btn:hover {
  background: var(--well);
  color: var(--ink);
}

.ooc-alert-well {
  margin: 0 20px 12px;
  padding: 10px 12px;
  background: var(--well);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}

/* 4-Step Segmented Stepper */
.core-stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 0 20px;
  padding: 4px 4px 14px;
  background: transparent;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

.core-stepper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 10px;
  background: var(--well);
  border-radius: 11px;
  z-index: 0;
}

.step-tab {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  padding: 7px 6px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.step-tab:hover {
  color: var(--ink);
}

.step-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 39, 68, 0.08);
}

.sheet-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 20px 20px;
  background: #f8fbfe;
  box-shadow: inset 0 6px 10px -10px rgba(15, 39, 68, 0.16);
}

.sheet-section-caption {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding-left: 2px;
  margin-top: 2px;
}

.step-panel {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

/* Recessed Wells */
.recessed-well {
  background: var(--well);
  border: 1px solid rgba(22, 48, 71, 0.06);
  border-radius: 13px;
  padding: 12px 14px;
}

.well-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.well-label.is-brand {
  color: var(--brand);
}

.well-title {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.well-title-sm {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.well-meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.well-sub {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

.well-caption {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}

.well-head-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hero-stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.hero-big-num {
  font-size: 29px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.green-rank-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--good-bg);
  color: var(--good);
  font-size: 11px;
  font-weight: 700;
}

.two-wells-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mini-well.is-brand-tint {
  background: var(--brand-soft);
}

.mini-well-num {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.hero-kpi-val {
  display: block;
  margin-top: 3px;
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* Strata & Progress Bars */
.strata-bar,
.progress-track {
  display: flex;
  height: 7px;
  width: 100%;
  margin-top: 9px;
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
  gap: 2px;
}

.strata-seg {
  height: 100%;
  border-radius: 999px;
}

.strata-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 7px;
  font-size: 11px;
  color: var(--muted);
}

.strata-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.strata-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
}

.progress-fill.is-green {
  background: var(--good);
}

.affluence-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--good);
  background: var(--good-bg);
  padding: 2px 8px;
  border-radius: 999px;
}

/* Rivals List */
.rivals-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 9px;
}

.rival-row-btn {
  width: 100%;
  border: 0;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  transition: background-color 0.12s ease;
}

.rival-row-btn:hover {
  background: #f6fafe;
}

.rival-row-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.rival-row-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rival-row-sub {
  font-size: 11px;
  color: var(--muted);
}

.threat-indicator {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.threat-indicator.is-high { color: var(--amber); }
.threat-indicator.is-medium { color: var(--brand); }
.threat-indicator.is-low { color: var(--slate); }

/* Step 3 Inputs, Flow Bars & Slots */
.well-number-input {
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.flow-bars-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 10px;
}

.flow-bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flow-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.flow-bar-label {
  color: var(--muted);
  font-weight: 500;
}

.flow-bar-label.is-strong {
  color: var(--ink);
  font-weight: 700;
}

.flow-bar-pct {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.flow-bar-pct.is-brand {
  color: var(--brand);
}

.flow-bar-track {
  height: 6px;
  width: 100%;
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
}

.flow-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.slots-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.slot-row-name {
  color: var(--muted);
}

.slot-row-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.info-tint-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--brand-soft);
  font-size: 12px;
}

.nearest-label {
  font-weight: 500;
  color: var(--ink);
}

.nearest-status {
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}

.nearest-status.is-warn {
  color: var(--amber);
}

/* Primary & Outline CTAs */
.primary-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: var(--surface);
  font-size: 13px;
  font-weight: 700;
  transition: background-color 0.14s ease;
}

.primary-cta-btn:hover {
  background: var(--brand-dark);
}

.outline-cta-btn {
  width: 100%;
  height: 42px;
  border: 1.5px solid var(--brand);
  border-radius: 12px;
  background: var(--surface);
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

/* Step 4 Forecast & Format Cards */
.forecast-top-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.hall-mode-switch {
  display: inline-flex;
  padding: 2px;
  background: var(--surface);
  border-radius: 9px;
  border: 1px solid var(--border);
}

.hall-opt {
  border: 0;
  background: transparent;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.hall-opt.is-active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
}

.month-stage-group {
  display: inline-flex;
  gap: 5px;
}

.compact-select,
.compact-select-full {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
}

.compact-select-full {
  width: 100%;
}

.budget-slider-block {
  margin-top: 10px;
}

.budget-display {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.budget-slider {
  width: 100%;
  margin: 8px 0 4px;
  accent-color: var(--brand);
  cursor: pointer;
}

.budget-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.horizon-toggle {
  display: inline-flex;
  gap: 4px;
}

.horizon-chip {
  border: 0;
  background: transparent;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.horizon-chip.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.advanced-link-btn,
.link-quiet-btn,
.back-link-btn {
  border: 0;
  background: transparent;
  padding: 2px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
}

.advanced-drawer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.param-inline-field label {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 3px;
}

.well-number-input-sm {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.curve-well .well-head-split {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.curve-well .well-title-sm,
.curve-well .well-meta {
  white-space: nowrap;
}

.curve-well svg {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 6px;
}

.formats-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-heading {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.formats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.format-card {
  padding: 10px 12px;
  background: var(--well);
  border-radius: 11px;
}

.format-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.format-card-name {
  font-weight: 700;
  color: var(--ink);
}

.format-prob-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.format-prob-val.is-strong { color: var(--good); }
.format-prob-val.is-mid { color: var(--brand); }
.format-prob-val.is-weak { color: var(--slate); }

.format-enable-dual-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 7px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
}

.format-enable-dual-btn:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.format-bar-track {
  margin-top: 7px;
  height: 7px;
  width: 100%;
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
}

.format-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.format-bar-fill.is-brand { background: var(--brand); }
.format-bar-fill.is-muted { background: var(--slate); opacity: 0.72; }

.forecast-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
}

.footer-honesty-note {
  font-size: 10.5px;
  color: var(--muted);
}

.mobile-compare-cta {
  display: none;
}

/* Compare A / B View */
.compare-cards-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 12px;
}

.compare-pin-card {
  padding: 10px 12px;
  background: var(--well);
  border: 1.5px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compare-pin-card.is-a.is-selected {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.compare-pin-card.is-b.is-selected {
  background: var(--good-bg);
  border-color: var(--good);
}

.cmp-card-tag {
  font-size: 10px;
  font-weight: 700;
}

.cmp-card-tag.is-a { color: var(--brand); }
.cmp-card-tag.is-b { color: var(--good); }

.cmp-card-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmp-card-inputs {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.cmp-card-inputs label {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--muted);
}

.cmp-card-inputs input {
  width: 52px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 2px 5px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.swap-ab-btn {
  align-self: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 700;
  color: var(--ink);
}

.compare-table-well {
  padding: 10px 12px;
  margin-bottom: 12px;
}

.compare-clean-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.compare-clean-table th,
.compare-clean-table td {
  padding: 7px 6px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.compare-clean-table tr:last-child td {
  border-bottom: 0;
}

.compare-clean-table th.num,
.compare-clean-table td.num {
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
}

.compare-clean-table th.is-a { color: var(--brand); }
.compare-clean-table th.is-b { color: var(--good); }
.compare-clean-table td.is-win { color: var(--good); }

.info-tint-box {
  padding: 12px 14px;
  background: var(--brand-soft);
  border-radius: 12px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 39, 68, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
}

.modal-title {
  margin: 10px 0 4px;
  font-size: 18px;
  font-weight: 700;
}

.modal-sub {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
}

.modal-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.modal-metric-cell span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.modal-metric-cell strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  font-weight: 800;
}

.modal-metric-cell small {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
}

.modal-two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.modal-clean-list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toast-pill {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-card);
}

/* Hide rule enforcement for [hidden] */
[hidden] {
  display: none !important;
}

/* Shared Mobile Search Modal styles (safe across viewport resize / tablet rotation) */
.mobile-search-ico {
  color: var(--muted);
  flex-shrink: 0;
}

.mobile-search-modal {
  position: fixed;
  inset: 0;
  z-index: 75;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  padding: 14px 14px 0;
}

.mobile-search-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.mobile-city-tabs {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--well);
  border-radius: 10px;
}

.mobile-city-tab {
  border: 0;
  background: transparent;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.mobile-city-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(15, 39, 68, 0.08);
}

.mobile-search-close {
  border: 0;
  background: transparent;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
}

.mobile-search-input-wrap {
  margin-bottom: 6px;
}

.mobile-search-results {
  max-height: none;
  flex: 1 1 auto;
  padding: 4px 0 20px;
}

/* Compact Desktop Viewport 769px..1420px: prevent bottom-left & bottom-right stack overlap */
@media (max-width: 1420px) and (min-width: 769px) {
  .bottom-left-stack {
    left: 16px;
  }

  .heat-layer-bar {
    padding: 4px 8px 4px 6px;
    gap: 2px;
  }

  .heat-bar-label,
  .density-scale-inline .scale-label-low {
    display: none;
  }

  .heat-tab {
    padding: 5px 8px;
    font-size: 11px;
  }

  .density-scale-inline {
    margin-left: 4px;
    padding-left: 7px;
    gap: 4px;
    font-size: 10.5px;
  }

  .scale-blocks i {
    width: 9px;
    height: 8px;
  }

  body[data-view-mode="point"] .bottom-right-stack {
    right: 480px;
  }

  .guard-legend-pill {
    padding: 0 9px;
    gap: 5px;
    font-size: 10.5px;
    height: 34px;
  }
}

/* Mobile Responsive <= 768px */
@media (max-width: 768px) {
  .top-floating-bar,
  .start-prompt-pill,
  .map-context-pill,
  .bottom-left-stack,
  .bottom-right-stack,
  .compare-pin-bar {
    display: none !important;
  }

  .map-attribution-tag {
    right: 8px !important;
    bottom: 4px;
    font-size: 9px;
    padding: 1px 5px;
    z-index: 10;
  }

  .mobile-top-bar {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    height: 44px;
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
  }

  .mobile-place-pill {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 5px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 0;
  }

  .mobile-city-tag {
    flex-shrink: 0;
    color: var(--ink);
  }

  .mobile-sep {
    color: var(--muted);
  }

  .mobile-place-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
  }

  .mobile-top-action {
    border: 0;
    background: transparent;
    padding: 4px 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--brand);
    flex-shrink: 0;
  }

  .mobile-heat-chips {
    position: absolute;
    top: 66px;
    left: 14px;
    z-index: 16;
    display: flex;
    gap: 6px;
    transition: opacity 0.14s ease;
  }

  body[data-sheet-state="expanded"] .mobile-heat-chips {
    opacity: 0;
    pointer-events: none;
  }

  .heat-chip {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 11px;
    font-weight: 500;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
  }

  .heat-chip.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--surface);
    font-weight: 700;
  }

  .inspector-sheet {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 48vh;
    max-height: calc(100vh - 76px);
    border-radius: 20px 20px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    transition: height 0.2s ease;
  }

  body[data-sheet-state="expanded"] .inspector-sheet {
    height: calc(100vh - 72px);
  }

  .mobile-sheet-grabber {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 22px;
    border: 0;
    background: transparent;
    flex-shrink: 0;
  }

  .sheet-handle-bar {
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: #c5d4e2;
  }

  .sheet-header {
    padding: 2px 16px 10px;
  }

  .core-stepper {
    margin: 0 16px 12px;
  }

  .sheet-scroll-body {
    padding: 0 16px 20px;
  }

  .mobile-compare-cta {
    display: block;
    margin-top: 2px;
  }

  .compare-cards-row {
    grid-template-columns: 1fr;
  }

  .swap-ab-btn {
    display: none;
  }

  .modal-metrics-grid,
  .modal-two-cols {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
