/* Approved Cobalt direction. Existing page controllers own data and interactions. */
/* Full-screen photos share the same opaque surfaces and control geometry. */
.gallery-viewer__backdrop,
.gallery-viewer__panel {
  background: var(--bg-solid);
}
.gallery-viewer__panel {
  inset: 0;
  gap: 20px;
  padding: max(20px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}
.gallery-viewer__header {
  align-items: center;
  min-height: 48px;
}
.gallery-viewer__meta {
  color: var(--ink);
}
.gallery-viewer__meta strong {
  font: 14px var(--font-mono);
}
.gallery-viewer__meta span {
  color: var(--ink-soft);
  white-space: nowrap;
}
.gallery-viewer__close,
.gallery-nav {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-solid);
  color: var(--ink);
  box-shadow: none;
  backdrop-filter: none;
}
.gallery-viewer__close:hover,
.gallery-nav:hover {
  background: var(--bg-muted);
}
.gallery-nav[hidden] {
  display: none;
}
.gallery-viewer__stage {
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  grid-template-rows: minmax(0, 1fr);
  gap: 20px;
  touch-action: pan-y pinch-zoom;
}
.gallery-viewer__image {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  user-select: none;
}
.gallery-nav {
  position: static;
  grid-row: 1;
  transform: none;
}
.gallery-nav:active {
  transform: none;
}
.gallery-nav--prev { grid-column: 1; }
.gallery-nav--next { grid-column: 3; }
.gallery-viewer__thumbs {
  gap: 12px;
  padding: 4px;
  min-width: 0;
}
.gallery-viewer__thumb {
  flex: 0 0 80px;
  border: 2px solid transparent;
  border-radius: 4px;
  background: var(--bg-muted);
}
.gallery-viewer__thumb.is-active { border-color: var(--accent); }
.gallery-viewer__thumb img {
  width: 76px;
  height: 56px;
}
@media(max-width:720px) {
  .gallery-viewer__panel {
    gap: 12px;
    padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .gallery-viewer__stage {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    grid-template-rows: minmax(0, 1fr) 48px;
    gap: 12px;
  }
  .gallery-viewer__image { grid-column: 1 / -1; }
  .gallery-nav { grid-row: 2; }
  .gallery-viewer__stage:has(.gallery-nav[hidden]) { grid-template-rows: minmax(0, 1fr); }
}
:root {
  --font-sans: Arial,Helvetica,sans-serif;
  --font-mono: Consolas,ui-monospace,monospace;
  --bg: #eff2f8;
  --bg-solid: #fafbff;
  --bg-elevated: #fafbff;
  --bg-muted: #e2e8f4;
  --bg-accent: #e2e8f4;
  --ink: #18243e;
  --ink-soft: #586783;
  --line: #c9d2e3;
  --line-strong: #9baecb;
  --accent: #2454d6;
  --accent-strong: #1b43b4;
  --on-accent: #fff;
  --radius-xl: 4px;
  --radius-lg: 4px;
  --radius-md: 4px;
  --radius-sm: 4px;
  --shadow-lg: 0 16px 40px #10172824;
  --shadow-md: none;
  --shadow-sm: none;
}

:root[data-theme=dark] {
  --bg: #101728;
  --bg-solid: #182238;
  --bg-elevated: #182238;
  --bg-muted: #22324e;
  --bg-accent: #22324e;
  --ink: #e9efff;
  --ink-soft: #a6b6d2;
  --line: #354764;
  --line-strong: #627897;
  --accent: #89aaff;
  --accent-strong: #a9c1ff;
  --on-accent: #10224e;
  --shadow-lg: 0 16px 40px #0005;
  --shadow-md: none;
  --shadow-sm: none;
}

body {
  background: var(--bg);
  font-size: 14px;
}

button,input,select {
  font: inherit;
}

button,a,input,select {
  touch-action: manipulation;
}

button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  box-shadow: none;
}

.app-shell {
  width: 100%;
  max-width: 1680px;
  padding: 0 36px 36px;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
  padding: 0;
  margin: 0 0 28px;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.atlas-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 80px;
  text-decoration: none;
  color: var(--ink);
}

.atlas-brand strong {
  font-size: 34px;
  letter-spacing: -2px;
}

.atlas-mark {
  display: grid;
  grid-template-columns: repeat(3,5px);
  gap: 3px;
  height: 26px;
}

.atlas-mark i {
  background: currentColor;
}

.atlas-mark i:nth-child(2) {
  height: 7px;
  align-self: center;
}

.mode-switch,.map-mode-switch {
  display: flex;
  grid-column: 2;
  grid-row: 1;
  gap: 28px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  align-self: stretch;
}

.mode-switch__item,.map-mode-switch__item {
  min-height: 80px;
  padding: 0;
  border-radius: 0;
  border-bottom: 3px solid transparent;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}

.mode-switch__item.is-active,.map-mode-switch__item.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  background: none;
  box-shadow: none;
}

.topbar__actions {
  grid-column: 3;
  grid-row: 1;
}

.atlas-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  height: 44px;
  width: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-solid);
  color: var(--ink);
  font-size: 23px;
  cursor: pointer;
  justify-self: end;
}

.topbar__search {
  grid-column: 1/-1;
  grid-row: 2;
  padding: 16px;
  background: var(--bg-solid);
  border: 1px solid var(--line);
}

.search-field {
  border-radius: 4px;
  box-shadow: none;
  background: var(--bg);
  min-height: 48px;
}

.display-toggle {
  border-radius: 4px;
  min-height: 44px;
  box-shadow: none;
}

.display-panel {
  border-radius: 4px;
  background: var(--bg-solid);
}

.workspace {
  display: block;
  margin-top: 0;
}

.results-panel {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.results-summary {
  width: auto;
  gap: 12px;
}

.results-summary h2 {
  font-size: 22px;
  font-weight: 500;
}

.results-market-line {
  display: none;
}

.results-panel__topline {
  align-items: center;
}

.results-toolbar {
  grid-template-columns: 180px 90px;
}

.results-toolbar select {
  height: 44px;
  min-height: 44px;
}

.results-filter-button {
  display: inline-flex;
  justify-self: start;
  min-height: 44px;
  border-radius: 4px;
  grid-column: auto;
  grid-row: auto;
}

.active-filters {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.active-filter,.metric-pill,.badge,.chip,.segmented-control,.filter-picker__trigger,.filter-picker__menu,.toolbar-button,.pagination button {
  border-radius: 4px;
  box-shadow: none;
}

.toolbar-button,.filter-picker__trigger,.field input,.field select {
  min-height: 48px;
}

.field input,.field select,.filter-picker__trigger {
  background: var(--bg);
  font-weight: 400;
}

.field__label,.filter-section h3,.stats-control span {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
}

.filters-apply,.segmented-control .is-active {
  background: var(--accent);
  color: var(--on-accent);
}

.filters-backdrop {
  display: block;
  z-index: 44;
}

.filters-panel {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 45;
  width: min(390px,100vw);
  max-height: 100dvh;
  padding: 24px 20px;
  border-radius: 0;
  transform: translateX(-110%);
  visibility: hidden;
  background: var(--bg-solid);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.filters-panel.is-open {
  transform: none;
  visibility: visible;
}

.filters-panel__header {
  flex-shrink: 0;
}

.filters-close {
  display: inline-flex;
}

#filters-form {
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  padding: 20px 0;
}

.filters-panel__footer {
  display: block;
  flex-shrink: 0;
  padding: 16px 0 0;
  margin: 0;
  border-top: 1px solid var(--line);
  background: var(--bg-solid);
}

.filters-apply {
  width: 100%;
}

.filters-panel__actions {
  gap: 6px;
}

.filters-panel .toolbar-button {
  padding: 0 10px;
}

.filter-section {
  padding: 16px 0;
}

.filter-section__header {
  margin-bottom: 12px;
}

.results-grid {
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 8px;
}

.listing-card {
  display: grid;
  grid-template-columns: 210px minmax(0,1fr);
  column-gap: 22px;
  padding: 20px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.listing-card__media {
  grid-row: 1/3;
  aspect-ratio: auto;
  min-height: 174px;
  border-radius: 4px;
}

.listing-card__main {
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  background: none;
}

.listing-card__title {
  order: -2;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.35;
  margin: 0;
}

.listing-card__location {
  order: -1;
  margin: 0;
  font-size: 12px;
}

.listing-card__price {
  font-size: 25px;
  font-weight: 600;
}

.listing-card__price-row {
  margin-top: auto;
}

.listing-card__metrics {
  gap: 6px;
}

.metric-pill {
  font: 11px var(--font-mono);
  padding: 4px 6px;
}

.listing-card__footer {
  grid-column: 2;
  padding: 10px 0 0;
  justify-content: space-between;
  flex-direction: row;
  border: 0;
  gap: 12px;
}

.listing-card__link {
  font-size: 11px;
}

.listing-card__delta {
  font: 11px var(--font-mono);
}

.badge {
  font-size: 9px;
  min-height: 24px;
  padding: 4px 6px;
}

.detail-drawer__panel,.detail-section,.detail-history__item,.detail-metric {
  border-radius: 4px;
}

.detail-header h1 {
  font-weight: 500;
}

.stats-shell {
  max-width: 1680px;
}

.stats-topbar {
  margin-bottom: 28px;
}

.stats-masthead {
  padding: 0;
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats-masthead h1 {
  font-size: 32px;
  font-weight: 500;
}

.stats-filter-card {
  width: 100%;
  grid-template-columns: repeat(5,minmax(0,1fr));
  border-radius: 0;
  padding: 16px;
  background: var(--bg-solid);
}

.stats-control select {
  min-height: 48px;
  border-radius: 4px;
  font-weight: 400;
}

.stats-card {
  padding: 24px;
  border-radius: 0;
  box-shadow: none;
  background: var(--bg-solid);
}

.stats-card h2,.stats-subsection__header h3 {
  font-size: 20px;
  font-weight: 500;
}

.stats-card__header p {
  font-size: 12px;
}

.stats-column {
  display: contents;
}

.stats-layout {
  grid-template-columns: minmax(0,1.7fr) minmax(320px,1fr);
  gap: 24px;
}

.stats-card--snapshot {
  grid-column: 1/-1;
  grid-row: 1;
}

.stats-card--snapshot .stats-card__header {
  display: none;
}

.stats-kpis {
  grid-template-columns: repeat(4,minmax(0,1fr));
}

.stats-card--trend {
  grid-column: 1;
  grid-row: 2;
}

.stats-card--activity {
  grid-column: 2;
  grid-row: 2;
}

.stats-card--activity .stats-kpis {
  grid-template-columns: 1fr;
}

.stats-kpi {
  border-radius: 0;
  box-shadow: none;
  background: none;
}

.stats-badge {
  border-radius: 3px;
}

.stats-table__row,.stats-range-row {
  border-radius: 0;
}

.atlas-context {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
}

.stats-chart text {
  font-family: var(--font-mono);
}

.atlas-map-header {
  height: 80px;
  padding: 0 36px;
  display: flex;
  gap: 40px;
  align-items: center;
  background: var(--bg-solid);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 30;
}

.atlas-map-header .atlas-theme {
  margin-left: auto;
}

.map-screen {
  height: calc(100dvh - 80px);
  display: block;
  background: var(--bg);
}

.map-map-shell {
  position: absolute;
  inset: 0;
  min-height: 0;
}

.map-map {
  height: 100%;
}

.map-sidebar {
  position: absolute;
  left: 24px;
  top: 100px;
  bottom: 24px;
  width: 400px;
  padding: 0;
  background: var(--bg-solid);
  border: 1px solid var(--line);
  box-shadow: none;
  backdrop-filter: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  z-index: 20;
}

.map-sidebar__header:has(.hidden) {
  display: none;
}

.map-summary:empty {
  display: none;
}

.map-panel {
  border-radius: 0;
  box-shadow: none;
  border: 0;
  min-height: 0;
  flex: 1;
  background: var(--bg-solid);
}

.map-panel__body {
  overflow-y: auto;
}

.map-group {
  border-radius: 4px;
  box-shadow: none;
  background: var(--bg-solid);
}

.map-floating-hud {
  top: 16px;
  left: 24px;
  right: auto;
  transform: none;
  align-items: start;
  max-width: 400px;
}

.map-floating-hud__copy {
  display: none;
}

.map-segmented {
  border-radius: 4px;
  background: var(--bg-solid);
  border: 1px solid var(--line);
  box-shadow: none;
}

.map-segmented__button {
  border-radius: 3px;
  min-height: 44px;
}

.map-segmented__button.is-active {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: none;
}

.map-area-label,.map-listing-pin {
  border-radius: 4px;
  background: var(--bg-solid);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  border-color: var(--line);
}

.map-area-label__count {
  border-radius: 3px;
  background: var(--bg-muted);
  color: var(--ink);
  font-family: var(--font-mono);
}

.map-area-label.is-active {
  background: var(--accent);
  color: var(--on-accent);
}

.map-map-shell__back {
  top: 16px;
  left: 440px;
  border-radius: 4px;
}

.maplibregl-ctrl-group {
  border-radius: 4px!important;
  background: var(--bg-solid)!important;
}

.maplibregl-ctrl-attrib {
  background: var(--bg-solid)!important;
  color: var(--ink)!important;
  border-radius: 3px!important;
}

.map-state {
  border-radius: 4px;
  background: var(--bg-solid);
}

.atlas-embed .atlas-map-header,.atlas-embed .map-sidebar,.atlas-embed .map-floating-hud,.atlas-embed .map-map-shell__back {
  display: none!important;
}

.atlas-embed .map-screen {
  height: 100dvh;
}

.atlas-embed .maplibregl-ctrl-bottom-right {
  display: block;
}

@media(max-width:1100px) {
  .listing-card {
    grid-template-columns: 150px minmax(0,1fr);
    gap: 14px;
  }

  .stats-kpis {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }

}

@media(max-width:1024px) {
  .map-sidebar {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
    width: auto;
    max-height: 45%;
    padding: 0;
    border-radius: 4px;
  }

  .map-sidebar__header:has(.hidden) {
    display: block;
  }

  .map-screen {
    height: calc(100dvh - 144px - env(safe-area-inset-bottom));
  }

  .atlas-map-header {
    height: 80px;
  }

  .atlas-map-header .map-mode-switch {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 0 16px env(safe-area-inset-bottom);
    background: var(--bg-solid);
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 0;
    z-index: 35;
  }

  .map-mode-switch__item {
    min-height: 0;
    height: 64px;
    width: 100%;
    margin: 0;
  }

  .map-map-shell {
    min-height: 0;
  }

  .map-sidebar.is-mobile-collapsed {
    height: auto;
    max-height: none;
  }

  .map-sidebar.is-listings .map-panel {
    height: auto;
    max-height: 40dvh;
  }

  .map-floating-hud {
    left: 12px;
    top: 12px;
  }

  .map-map-shell__back {
    left: auto;
    right: 12px;
    top: 72px;
  }

  .maplibregl-ctrl-top-right .maplibregl-ctrl-attrib {
    margin-top: 70px!important;
  }

}

@media(max-width:720px) {
  .app-shell {
    padding: 0 16px calc(84px + env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 12px;
    margin-bottom: 20px;
    grid-template-columns: 1fr auto;
  }

  .atlas-brand {
    min-height: 68px;
  }

  .atlas-brand strong {
    font-size: 29px;
  }

  .atlas-mark {
    grid-template-columns: repeat(3,4px);
    height: 24px;
  }

  .topbar__actions {
    grid-column: 2;
    width: auto;
    gap: 8px;
  }

  .topbar>.atlas-theme {
    grid-column: 2;
    grid-row: 1;
  }

  .mode-switch {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 0 16px env(safe-area-inset-bottom);
    background: var(--bg-solid);
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 0;
    z-index: 35;
    gap: 0;
  }

  .mode-switch__item {
    min-height: 0;
    height: 64px;
    width: 100%;
    margin: 0;
  }

  .topbar__search {
    padding: 12px;
  }

  .results-panel__topline {
    flex-direction: column;
    align-items: stretch;
  }

  .results-summary {
    width: 100%;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .results-filter-button {
    grid-column: 2;
    grid-row: 1;
  }

  .results-summary h2 {
    font-size: 20px;
  }

  .results-toolbar {
    grid-template-columns: 1fr 90px;
    width: 100%;
  }

  .listing-card {
    grid-template-columns: 110px minmax(0,1fr);
    gap: 12px;
    padding: 16px 0;
  }

  .listing-card__media {
    min-height: 160px;
  }

  .listing-card__title {
    font-size: 16px;
  }

  .listing-card__price {
    font-size: 21px;
  }

  .listing-card__metrics {
    gap: 4px;
  }

  .metric-pill {
    font-size: 10px;
    padding: 3px;
  }

  .listing-card__footer {
    flex-wrap: wrap;
    gap: 6px;
  }

  .badge {
    font-size: 8px;
    padding: 3px;
  }

  .listing-card__main {
    gap: 6px;
  }

  .filters-panel {
    width: 100vw;
    padding: 20px 16px;
  }

  .stats-filter-card {
    grid-template-columns: 1fr 1fr;
  }

  .stats-control:first-child {
    grid-column: 1/-1;
  }

  .stats-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .stats-card {
    width: 100%;
    padding: 16px;
  }

  .stats-card--snapshot {
    order: -2;
  }

  .stats-card--trend {
    order: -1;
  }

  .stats-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .stats-masthead h1 {
    font-size: 28px;
  }

  .atlas-map-header {
    height: 68px;
    padding: 0 16px;
  }

  .map-screen {
    height: calc(100dvh - 132px - env(safe-area-inset-bottom));
  }

  .map-area-label {
    border-radius: 4px;
  }

  .map-area-label__count {
    border-radius: 3px;
  }

  .map-group {
    border-radius: 4px;
  }

  .map-sidebar.is-listings .map-panel {
    max-height: 38dvh;
  }

  .atlas-embed .map-screen {
    height: 100dvh;
  }

  .display-toggle__icon {
    display: none;
  }

  .display-toggle {
    padding: 0 10px;
  }

}

@media(prefers-reduced-motion:reduce) {
  * {
    scroll-behavior: auto!important;
    transition: none!important;
  }

}

.atlas-mobile-zone {
  display: none;
}

@media(max-width:1024px) {
  .atlas-mobile-zone {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-right: auto;
  }

  .map-sidebar__toolbar {
    padding: 12px;
  }

  .map-sidebar__header:has(.hidden) {
    display: block;
  }

}

.stats-kpi__value {
  font-family: var(--font-mono);
  font-size: 26px!important;
  overflow-wrap: anywhere;
}

.stats-kpi__top {
  font: 11px var(--font-mono);
  color: var(--ink-soft);
}

.topbar__search {
  width: 100%;
  max-width: none;
}

.search-field input,.results-toolbar select {
  border-radius: 4px;
}

.active-filter {
  font: 11px var(--font-mono);
  padding: 6px 8px;
  min-height: 32px;
}

.active-filter button {
  background: none;
}

.stats-chart,.stats-empty,.stats-legend__item,.stats-kpi__meta span,.stats-rank {
  border-radius: 4px;
  box-shadow: none;
}

.stats-chart {
  background: none;
  border: 0;
}

.stats-card--snapshot {
  padding: 0;
}

.stats-card--snapshot .stats-kpis {
  gap: 0;
}

.stats-card--snapshot .stats-kpi {
  border: 0;
  border-right: 1px solid var(--line);
  padding: 24px;
}

.stats-card--snapshot .stats-kpi:last-child {
  border-right: 0;
}

.stats-kpi__meta {
  font-size: 11px;
  font-weight: 400;
}

.stats-card--activity .stats-kpi {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.stats-card--activity .stats-kpi__meta {
  display: none;
}

.stats-card--activity .stats-chart {
  min-height: 0;
  height: 170px;
}

.stats-card--trend {
  align-self: stretch;
}

.stats-card--ranking {
  grid-column: 1/-1;
}

.stats-empty {
  padding: 24px;
  min-height: 0;
}

.stats-card--activity .stats-kpi__top span:last-child {
  display: none;
}

.map-sidebar {
  height: fit-content;
  max-height: calc(100% - 130px);
  bottom: auto;
}

.map-panel__body {
  max-height: calc(100dvh - 270px);
}

.map-floating-hud {
  width: 400px;
  align-items: flex-start;
}

.map-floating-hud .map-segmented {
  width: 100%;
}

.map-segmented--floating .map-segmented__button {
  min-height: 44px;
}

.map-map-shell .maplibregl-ctrl-group {
  border-radius: 4px!important;
}

.stats-method {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.6;
}

.stats-method summary {
  cursor: pointer;
}

@media(max-width:1024px) {
  .map-sidebar {
    bottom: 12px;
    top: auto;
    max-height: 45%;
  }

  .map-panel__body {
    max-height: 30dvh;
  }

  .map-floating-hud {
    width: auto;
    max-width: calc(100% - 90px);
  }

  .map-floating-hud .map-segmented {
    width: auto;
  }

}

@media(max-width:720px) {
  .stats-card--snapshot .stats-kpi {
    padding: 16px 12px;
    border-bottom: 1px solid var(--line);
  }

  .stats-kpi__value {
    font-size: 20px!important;
  }

  .stats-card--snapshot .stats-kpi:nth-child(2) {
    border-right: 0;
  }

  .stats-card--snapshot .stats-kpi:nth-child(n+3) {
    border-bottom: 0;
  }

}

.stats-card--activity {
  order: -1;
}

.stats-kpi__value {
  font-weight: 500;
}

.stats-legend__item {
  font-weight: 400;
}

.map-sidebar__sheet-toggle {
  border-radius: 4px;
}

.map-group__title {
  font-weight: 500;
}

.topbar__search input {
  width: 100%;
  min-height: 48px;
}

.stats-masthead #stats-selection-summary {
  display: none;
}

@media(max-width:720px) {
  .stats-card--trend .stats-chart {
    height: auto;
    min-height: 0;
    aspect-ratio: 420/250;
  }

  .stats-card--trend .stats-chart svg {
    height: auto;
    width: 100%;
  }

  .listing-card__footer {
    font-weight: 400;
  }

}

.stats-card--activity .stats-chart svg {
  height: 170px;
  min-height: 0;
}

.stats-rank__title button {
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
  min-height: 32px;
}

.map-floating-hud .atlas-context {
  padding: 8px;
  background: var(--bg-solid);
  border: 1px solid var(--line);
  border-radius: 4px;
}

/* Shared controls and narrow map cards use the same Cobalt geometry. */
.filter-section,:root[data-theme=dark] .filter-section {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
  padding: 16px 0;
  gap: 12px;
}

.filter-section__header {
  margin: 0;
}

.filter-section__header h3 {
  font: 12px var(--font-mono);
  color: var(--ink-soft);
}

.segmented-button,.option-chip,.display-segment,.display-segment__button {
  border-radius: 4px;
  box-shadow: none;
}

.segmented-button,.option-chip label,.display-segment__button {
  min-height: 44px;
  font-weight: 500;
}

.segmented-control--stacked .segmented-button {
  padding: 12px;
  align-items: center;
}

.display-segment__button.is-active,.option-chip input:checked+label {
  color: var(--on-accent);
}

.segmented-button.is-active .segmented-button__count,.option-chip input:checked+label .option-chip__count {
  color: inherit;
}

.display-panel__label {
  font: 11px var(--font-mono);
}

.display-toggle__icon {
  display: none;
}

.display-toggle:hover {
  transform: none;
}

.map-map-shell__back {
  height: 50px;
  min-height: 50px;
  box-shadow: none;
  background: var(--bg-solid);
  border: 1px solid var(--line);
  color: var(--ink);
}

.map-listings .listing-card {
  grid-template-columns: 100px minmax(0,1fr);
  gap: 10px;
  padding: 14px 0;
  background: none;
}

.map-listings .listing-card__media {
  min-height: 130px;
  grid-row: 1;
  aspect-ratio: 3/4;
}

.map-listings .listing-card__main {
  gap: 6px;
}

.map-listings .listing-card__title {
  font-size: 15px;
}

.map-listings .listing-card__price {
  font-size: 18px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.map-listings .listing-card__footer {
  grid-column: 1/-1;
  padding: 0 0 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.map-listings .listing-card__link {
  font-size: 11px;
}

.map-listings .badge {
  font-size: 8px;
  padding: 3px;
  min-height: 20px;
}

.map-listings .metric-pill {
  font-size: 10px;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media(min-width:1025px) {
  body:not(.map-body) .app-shell:not(.stats-shell) {
    max-width: 1320px;
  }

}

@media(max-width:1024px) {
  .map-map-shell__back {
    top: 12px;
    right: 12px;
    height: 50px;
  }

  .map-map-shell__back .map-pill__label {
    max-width: none;
  }

  .map-floating-hud {
    max-width: calc(100% - 130px);
  }

}

.map-floating-hud .map-segmented {
  padding: 2px;
  height: 50px;
  box-shadow: none;
  backdrop-filter: none;
}

.map-segmented--floating .map-segmented__button.is-active {
  box-shadow: none;
}

@media(max-width:720px) {
}

.badge {
  background: var(--bg-solid);
  color: var(--ink);
  border: 1px solid var(--line);
}

.badge--status[data-status=sale] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.badge--status[data-status=rent] {
  background: var(--bg-muted);
  color: var(--ink);
  border-color: var(--line-strong);
}

/* Listing hierarchy: uncluttered photographs, one facts line, explicit breathing room. */
input,select,textarea,.filter-picker__search,.filter-picker__option {
  border-radius: 4px;
}

.results-panel,.results-panel__header,.results-grid,.listing-card,.map-listings .listing-card {
  background: transparent;
}

.results-panel__topline {
  gap: 24px;
  align-items: end;
  padding-bottom: 24px;
}

.results-summary {
  display: flex;
  align-items: center;
  gap: 24px;
}

.results-summary h2 {
  margin: 0;
}

.results-filter-button {
  height: 48px;
}

.results-grid {
  margin-top: 0;
}

.listing-card {
  padding: 24px 0;
  column-gap: 24px;
}

.listing-card__media {
  min-height: 0;
  aspect-ratio: 4/3;
  align-self: start;
  border-radius: 4px;
}

.listing-card__main {
  gap: 12px;
}

.listing-card__price-row {
  margin-top: 0;
  gap: 12px;
  flex-wrap: wrap;
}

.listing-card__metrics {
  gap: 0;
  row-gap: 4px;
}

.listing-card .metric-pill {
  background: none;
  border: 0;
  padding: 0;
  font: 13px var(--font-sans);
  color: var(--ink-soft);
  border-radius: 0;
}

.listing-card .metric-pill+.metric-pill::before {
  content: '·';
  padding: 0 8px;
  color: var(--ink-soft);
}

.listing-card__footer {
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
  padding-top: 4px;
}

.listing-card__link {
  font-size: 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.listing-card__footer .badge--status {
  background: none;
  border: 0;
  color: var(--ink-soft);
  padding: 0;
  font: 12px var(--font-sans);
  max-width: none;
}

.map-panel__body {
  padding: 0 20px;
}

.map-listings {
  gap: 0;
}

.map-listings .listing-card {
  grid-template-columns: 96px minmax(0,1fr);
  gap: 8px 16px;
  padding: 24px 0;
}

.map-listings .listing-card__media {
  grid-row: 1;
  min-height: 0;
  aspect-ratio: 1;
  align-self: start;
}

.map-listings .listing-card__main {
  gap: 8px;
}

.map-listings .listing-card__price-row {
  order: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.map-listings .listing-card__price {
  font-size: 23px;
  line-height: 1.2;
}

.map-listings .listing-card__delta {
  font: 12px var(--font-sans);
  text-align: left;
}

.map-listings .listing-card__title {
  order: 1;
  font-size: 16px;
  line-height: 1.4;
}

.map-listings .listing-card__location {
  order: 2;
  font-size: 12px;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.map-listings .listing-card__metrics {
  order: 3;
}

.map-listings .metric-pill {
  font: 13px var(--font-sans);
}

.map-listings .listing-card__footer {
  grid-column: 2;
  padding: 0;
  gap: 0;
}

.map-listings .listing-card__link {
  font-size: 12px;
}

@media(max-width:720px) {
  .results-panel__topline {
    gap: 16px;
  }

  .results-summary {
    justify-content: space-between;
    gap: 16px;
  }

  .listing-card {
    grid-template-columns: 96px minmax(0,1fr);
    gap: 12px 16px;
    padding: 24px 0;
  }

  .listing-card__main {
    gap: 8px;
  }

  .listing-card__media {
    aspect-ratio: 1;
    min-height: 0;
  }

  .listing-card__footer {
    grid-column: 2;
  }

  .listing-card .metric-pill {
    font-size: 12px;
  }

  .map-panel__body {
    padding: 0 16px;
  }

}

@media(max-width:360px) {
  .map-listings .listing-card {
    grid-template-columns: 80px minmax(0,1fr);
    column-gap: 12px;
  }

  .map-listings .listing-card__price {
    font-size: 20px;
  }

  .map-listings .metric-pill {
    font-size: 12px;
  }

}

.detail-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  padding: 12px 0;
  background: var(--bg-solid);
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.detail-toolbar button {
  min-width: 80px;
  min-height: 44px;
}

.detail-drawer__panel {
  padding-top: 0;
}

.detail-gallery__hero,.detail-gallery__hero-button,.detail-gallery__thumb,.detail-pill,.detail-meta-row .toolbar-button {
  border-radius: 4px;
}

.topbar__search {
  padding: 0;
  border: 0;
  background: none;
}

.search-field {
  margin: 0;
}

.map-panel__header {
  padding: 16px 20px;
}

.map-listings .listing-card__delta:empty {
  display: none;
}

.map-listings .listing-card__metrics {
  gap: 0;
  row-gap: 4px;
}

.map-listings .listing-card__footer {
  margin: 0;
}

.detail-pill-row .metric-pill,.detail-pill-row .detail-pill {
  background: none;
  border: 0;
  padding: 0;
  font: 14px var(--font-sans);
  color: var(--ink-soft);
}

.detail-pill-row {
  gap: 12px;
}

.detail-meta-row .toolbar-button {
  width: auto;
  min-height: 48px;
  padding: 0 16px;
}

@media(max-width:1024px) {
  .map-sidebar__header {
    padding: 12px 16px;
  }

  .map-sidebar__toolbar {
    min-height: 44px;
  }

  .map-sidebar.is-listings .map-panel__header {
    padding: 8px 16px;
  }

  .map-panel__handle {
    display: none!important;
  }

  .map-sidebar.is-listings {
    gap: 0;
  }

  .map-panel__header {
    padding: 12px 16px;
  }

}

.map-panel__label {
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  line-height: 1.4;
}

@media(max-width:1024px) {
  .map-sidebar:not(.is-mobile-collapsed) .map-sidebar__header {
    display: none;
  }

  .map-sidebar.is-listings .map-panel__header,.map-panel__header {
    min-height: 0;
    height: 64px;
    width: 100%;
    margin: 0;
    padding: 10px 16px;
  }

  .map-panel__toggle {
    width: 44px;
    height: 44px;
    border-radius: 4px;
  }

  .map-panel__header-actions {
    gap: 8px;
  }

}

.detail-source-title {
  margin: 20px 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

.detail-source-title summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-source-title summary::before {
  content: '+';
}

.detail-source-title[open] summary::before {
  content: '−';
}

@media(max-width:1024px) {
  .map-panel__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

}

#filters-form {
  scroll-padding-block: 20px;
}

.range-grid .field {
  scroll-margin-block: 12px;
}

.results-panel,.map-panel,.map-sidebar,.display-panel,.filters-panel {
  backdrop-filter: none;
}

.detail-gallery__hint,.detail-gallery__hint-count {
  border-radius: 4px;
}

/* Retain the approved prototype's header and search proportions. */
body:not(.map-body) .app-shell:not(.stats-shell) { max-width: 1680px; }
.topbar::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(50% - 50vw);
  width: 100vw;
  height: 80px;
  z-index: -1;
  background: var(--bg-solid);
  border-bottom: 1px solid var(--line);
}
.topbar__search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: end; }
.topbar__search > label { display: block; grid-column: 1 / -1; margin: 0; }
.search-field { overflow: visible; height: 48px; box-sizing: border-box; }
#search-submit { height: 48px; width: 140px; padding: 0 18px; border: 1px solid var(--accent); border-radius: 4px; background: var(--accent); color: var(--on-accent); cursor: pointer; }
.topbar__search .search-field input { min-width: 0; min-height: 0; height: 46px; }
@media(max-width:720px) {
  .topbar::before { height: 68px; }
  #search-submit { width: 83px; padding: 0 12px; }
}

.results-grid .loading-card { display: grid; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.results-grid .loading-card__body { padding: 0; align-content: start; }
.loading-card__line { border-radius: 4px; }

.site-preferences { display: flex; align-items: center; gap: 4px; }
.atlas-map-header > .site-preferences { margin-left: auto; }
#header-language { appearance: auto; width: 56px; min-width: 0; height: 44px; padding: 0 4px; border: 0; border-radius: 0; background: transparent; color: var(--ink); font: 12px var(--font-sans); color-scheme: light; }
[data-theme="dark"] #header-language { color-scheme: dark; }
#header-theme { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--ink); cursor: pointer; }
#header-theme svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; }
#header-language:focus { box-shadow: none; }
.search-field input:focus { outline: none; box-shadow: none; }
.search-field:focus-within { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: -2px; box-shadow: none; }
.search-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.search-actions #search-submit, .search-actions #filters-toggle { display: flex; justify-content: center; align-items: center; height: 48px; min-height: 48px; width: 100%; margin: 0; padding: 0 20px; font: 600 14px var(--font-sans); }
@media(max-width:720px) {
  .topbar__search { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .search-actions { margin-top: 4px; }
}

/* Main browsing grid; map results retain their compact horizontal rows. */
body:not(.map-body) .topbar:not(.stats-topbar) { row-gap: 16px; margin-bottom: 16px; }
.results-panel__header { gap: 16px; }
.results-panel__topline { padding-bottom: 0; }
.active-filters:empty { display: none; }
.results-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 24px 20px;
  margin-top: 20px;
}
.results-grid .listing-card,
.results-grid .loading-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  gap: 0;
  padding: 0;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.results-grid .listing-card__media,
.results-grid .loading-card__media {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
}
.results-grid .listing-card__main,
.results-grid .loading-card__body { padding: 16px 0 0; gap: 8px; justify-content: flex-start; }
.results-grid .listing-card__price-row { order: 0; margin: 0; flex-wrap: wrap; }
.results-grid .listing-card__price { font-size: 25px; line-height: 1.2; overflow-wrap: anywhere; }
.results-grid .listing-card__title { order: 1; font-size: 17px; line-height: 1.4; }
.results-grid .listing-card__location {
  order: 2;
  font-size: 13px;
  line-height: 1.5;
  min-height: 3em;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.results-grid .listing-card__metrics { order: 3; margin-top: 0; }
.results-grid .listing-card__footer { grid-column: 1; padding: 4px 0 8px; margin: 0; }
@media (min-width: 600px) { .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .results-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1600px) { .results-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 599px) { .results-grid { gap: 24px; } }

/* Mobile map sheet: one full-height reading view and one context bar. */
@media (max-width: 1024px) {
  .map-sidebar.is-mobile-sheet {
    inset: 0;
    width: auto;
    height: auto;
    max-height: none;
    padding: 0;
    border: 0;
    border-radius: 0;
  }
  .map-sidebar.is-mobile-sheet .map-sidebar__header { display: none; }
  .map-sidebar.is-mobile-sheet .map-panel {
    display: flex;
    height: 100%;
    max-height: none;
    overflow: hidden;
    border-radius: 0;
  }
  .map-sidebar.is-mobile-sheet .map-panel__header {
    flex: 0 0 64px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 1fr 1fr;
    gap: 2px 12px;
  }
  .map-sidebar.is-mobile-sheet .map-panel__label {
    grid-column: 1;
    grid-row: 1;
    align-self: end;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .map-sidebar.is-mobile-sheet .map-panel__header-actions { display: contents; }
  .map-sidebar.is-mobile-sheet .map-panel__hint {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    text-align: left;
    justify-self: start;
  }
  .map-sidebar.is-mobile-sheet .map-panel__toggle {
    grid-column: 2;
    grid-row: 1 / 3;
    width: auto;
    min-width: 44px;
    padding: 0 10px;
    gap: 6px;
  }
  .map-sidebar.is-mobile-sheet .map-panel__body { max-height: none; padding: 0 16px; }
  .map-sidebar.is-mobile-sheet.is-mobile-collapsed {
    top: auto;
    height: 64px;
    max-height: 64px;
    border-top: 1px solid var(--line);
  }
  .map-sidebar.is-mobile-sheet.is-mobile-collapsed .map-panel__body { display: none; }
  .map-sidebar.is-mobile-sheet.is-mobile-collapsed .map-panel__toggle svg { transform: rotate(180deg); }
  .map-sidebar.is-mobile-sheet:not(.is-mobile-collapsed) ~ .map-map-shell {
    visibility: hidden;
  }
}

/* Keep mobile pagination on one row without shrinking its touch targets. */
.pagination__numbers { display: flex; align-items: center; gap: 10px; }
.pagination__status { display: none; }
.pagination__button { min-height: 44px; }
@media(max-width:720px) {
  .pagination { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; }
  .pagination__numbers { display: none; }
  .pagination__status { display: block; white-space: nowrap; font: 13px var(--font-mono); color: var(--ink-soft); }
  .pagination > .pagination__button { min-width: 0; padding: 0 8px; white-space: nowrap; font-size: 14px; }
}

/* Shared dropdown surfaces; the hidden native fields retain existing form state. */
.select-native { display: none !important; }
.select-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--ink); font: 14px var(--font-sans); text-align: left; cursor: pointer; }
.select-trigger > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.select-trigger svg { flex: 0 0 16px; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.select-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.site-preferences { gap: 12px; }
#header-language-trigger { width: 52px; height: 44px; padding: 0 4px; border: 0; background: transparent; font-size: 12px; }
.select-trigger:focus:not(:focus-visible) { outline: none; box-shadow: none; }
.select-picker { position: fixed; inset: auto; margin: 0; box-sizing: border-box; overflow: auto; overscroll-behavior: contain; padding: 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-solid); color: var(--ink); box-shadow: var(--shadow-lg); }
.select-picker > button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 44px; height: auto; padding: 10px 12px; border: 0; border-radius: 2px; background: transparent; color: var(--ink); font: 14px var(--font-sans); text-align: left; white-space: normal; cursor: pointer; }
.select-picker > button[aria-selected="true"] { font-weight: 600; }
.select-picker > button[aria-selected="true"]::after { content: '✓'; color: var(--accent); }
.select-picker > button:hover, .select-picker > button:focus-visible { background: var(--bg-muted); outline: 2px solid var(--accent); outline-offset: -2px; box-shadow: none; }
.filter-picker__trigger.is-open { border-color: var(--accent); box-shadow: none; }
.filter-picker__menu--multi .filter-picker__option-check { border-radius: 2px; }

.filter-picker__menu--multi .filter-picker__option.is-selected .filter-picker__option-check::after { content: '✓'; inset: 0; display: grid; place-items: center; border: 0; border-radius: 0; background: none; color: var(--on-accent); font: 12px var(--font-sans); }

.filter-picker__chevron svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }

.select-trigger > span { font: inherit; letter-spacing: normal; text-transform: none; }
