:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #090d16;
  --surface: #111827;
  --surface-subtle: #1e293b;
  --surface-elevated: #1a2234;
  --border: #243044;
  --border-strong: #3b4b66;
  --blue: #38bdf8;
  --blue-hover: #0284c7;
  --blue-subtle: rgba(56, 189, 248, 0.12);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --emerald: #34d399;
  --emerald-subtle: rgba(52, 211, 153, 0.12);
  --purple: #c084fc;
  --purple-subtle: rgba(192, 132, 252, 0.12);
  --amber: #fbbf24;
  --amber-subtle: rgba(251, 191, 36, 0.12);
  --rose: #fb7185;
  --rose-subtle: rgba(251, 113, 133, 0.12);
  --input-bg: #111827;
  --navy: #38bdf8;
  --navy-hover: #7dd3fc;
  --navy-light: rgba(56, 189, 248, 0.15);
  --accent-amber: #fbbf24;
  --accent-teal: #34d399;
  --accent-red: #fb7185;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --surface-elevated: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --blue: #0284c7;
  --blue-hover: #0369a1;
  --blue-subtle: #e0f2fe;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --emerald: #059669;
  --emerald-subtle: #ecfdf5;
  --purple: #7e22ce;
  --purple-subtle: #faf5ff;
  --amber: #b45309;
  --amber-subtle: #fffbeb;
  --rose: #e11d48;
  --rose-subtle: #fff1f2;
  --input-bg: #ffffff;
  --navy: #0b1f3a;
  --navy-hover: #1e3a5f;
  --navy-light: #e0e7ff;
  --accent-amber: #b45309;
  --accent-teal: #0f766e;
  --accent-red: #be123c;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  max-width: 1440px;
  padding: 0 1.25rem 3rem;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
}

/* Header & Navigation */
header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.brand-link {
  text-decoration: none;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #0284c7;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.85rem;
  border-radius: 7px;
  letter-spacing: -0.02em;
  transition: transform 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.brand-link:hover .brand-logo {
  transform: scale(1.05);
  background: #0369a1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.btn-settings {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 8px;
  font-size: 1.15rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.btn-settings:hover {
  background: var(--surface-elevated);
  border-color: var(--border-strong);
}

.status {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.status[hidden], .startup-error[hidden] {
  display: none;
}

.status.fallback {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.startup-error {
  max-width: 42rem;
  margin: 1.25rem auto 0;
  color: var(--text-main);
  background: var(--rose-subtle);
  border: 1px solid var(--rose);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  text-align: left;
}

.home-browse {
  max-width: 720px;
  margin: 0 auto 3rem;
  padding: 0 1rem;
}

.home-browse-details {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

.home-browse-details > summary {
  width: fit-content;
  padding: 0.8rem 0;
  cursor: pointer;
  font-size: 0.9rem;
}

.home-browse-details > summary:hover,
.home-browse-details a:hover {
  color: var(--blue-hover);
}

.home-browse-details > summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.home-browse-content {
  padding: 0 0 1rem;
}

.home-browse-content h2 {
  color: var(--text-main);
  font-size: 1.15rem;
  margin: 0.5rem 0;
}

.home-browse-content h3 {
  color: var(--text-main);
  font-size: 0.95rem;
  margin: 1.25rem 0 0.5rem;
}

.browse-note { margin: 0.25rem 0 0.75rem; }

.browse-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.35rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-browse-content a { color: var(--blue); }
.browse-private { margin: 0; }

#update {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
  border: none;
  cursor: pointer;
}

#update:hover { background: var(--navy-hover); }

/* Center Hero Section */
.hero-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 1rem 3rem;
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  transition: padding 0.2s ease;
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.2;
  margin: 0 0 0.6rem;
  color: var(--text-main);
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 2.2rem;
  line-height: 1.5;
}

/* Search Pane */
.search-pane {
  width: 100%;
  max-width: 680px;
  position: relative;
  text-align: left;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 1.1rem;
  font-size: 1.05rem;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 2;
}

#search {
  width: 100%;
  height: 54px;
  padding: 0 1.25rem 0 3.1rem;
  font-size: 1rem;
  background: var(--input-bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text-main);
  outline: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#search:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-subtle), 0 8px 24px rgba(0, 0, 0, 0.15);
}

#search::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
  font-size: 0.95rem;
}

.hint, #search-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.55rem 0 0;
  padding: 0 0.5rem;
}

/* Home vs View-Active State */
body:not(.view-active) #dossier-pane {
  max-width: 680px;
  margin: 1.5rem auto 0;
  text-align: center;
}

body:not(.view-active) #dossier > p:first-child {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

#private-sales-entry {
  margin: 0.75rem 0;
}

#private-sales-entry button {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  max-width: 100%;
  white-space: normal;
  line-height: 1.35;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#private-sales-entry button:hover {
  background: var(--surface-elevated);
  border-color: var(--border-strong);
}

body.view-active .hero-section {
  padding: 0.75rem 0;
  max-width: 100%;
  margin: 0;
  text-align: left;
}

body.view-active .hero-title,
body.view-active .hero-subtitle {
  display: none;
}

body.view-active .search-pane {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.25rem 0 0.5rem;
}

body.view-active #dossier-pane {
  display: block;
  max-width: 1080px;
  margin: 0 auto;
  text-align: left;
}

body.view-active #dossier-pane:has(.has-map) {
  max-width: 1400px;
}

/* Results Dropdown */
.results {
  position: relative;
  margin-top: 0.5rem;
  max-height: 24rem;
  max-width: 100%;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  list-style: none;
  padding: 0;
}

.results[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.results li {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.results li:last-child {
  border-bottom: none;
}

.search-results-notice {
  padding: 0.65rem 1.1rem;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.search-notice-content {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.search-notice-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.search-notice-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.results button {
  width: 100%;
  text-align: left;
  padding: 0.8rem 1.1rem;
  font-size: 0.92rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: background 0.12s ease;
}

.results button:hover,
.results button:focus-visible {
  background: var(--surface-subtle);
  outline: none;
}

.search-result-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 0.5rem;
}

.result-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.pill-postal {
  background: var(--amber-subtle);
  color: var(--amber);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.pill-hdb {
  background: var(--blue-subtle);
  color: var(--blue);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.pill-ura {
  background: var(--emerald-subtle);
  color: var(--emerald);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.pill-town {
  background: var(--rose-subtle);
  color: var(--rose);
  border: 1px solid rgba(251, 113, 133, 0.35);
}

.pill-transit {
  background: var(--purple-subtle);
  color: var(--purple);
  border: 1px solid rgba(192, 132, 252, 0.35);
}

.results button {
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.8rem;
  font-size: 0.92rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-main);
}

.search-result-title,
.search-result-destination { display: block; }
.search-result-title { font-weight: 650; }
.search-result-destination { margin-top: 0.12rem; color: var(--text-muted); font-size: 0.78rem; }

/* The exact-postal answer's explicit states ("no verified block", "not in this release"):
   a statement, not a selectable row — never a silent empty list. */
.search-result-note {
  display: block;
  padding: 0.7rem 0.8rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

/* The block's verified postal, shown beside the town label at BLOCK level ("Postal 520313 ·
   HDB block") — it identifies the block, never the user's unit. */
.property-postal-label {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}

.results button:hover,
.results button:focus-visible {
  background: var(--surface-subtle);
  outline: 2px solid var(--navy);
  outline-offset: -2px;
}

.results li > button:first-child { flex: 1; }

.nearby-txn-action {
  flex: 0 0 auto;
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 0.25rem 0.4rem;
}

.nearby-txn-action:hover,
.nearby-txn-action:focus-visible {
  background: var(--navy-light);
  border-color: var(--navy);
}

/* Dossier Layout (Desktop Split vs. Mobile Stack) */
#dossier-pane {
  margin-top: 0.5rem;
}

.dossier h2:focus, h2[tabindex="-1"]:focus { outline: none; }

.property-heading-pane {
  margin-bottom: 0.8rem;
}

.property-heading-pane h2 {
  font-size: 1.45rem;
  margin-bottom: 0.15rem;
}

.property-town-label {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.property-fact-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.4rem 0 0.6rem;
}

/* The block's flat composition as one compact header line ("84 five-room · 8 executive");
   wraps naturally at narrow widths, never hides a type. */
.property-composition-line {
  font-size: 0.9rem;
  color: var(--text-main);
  margin: -0.2rem 0 0.6rem;
}

.fact-pill {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 9999px;
  color: var(--text-main);
}

.fact-pill.pill-subtle {
  color: var(--text-muted);
}

.property-facts {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0.5rem 0 0.25rem;
}

.availability-details {
  width: fit-content;
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.availability-details summary { cursor: pointer; }

.unavailable {
  color: var(--accent-amber);
  font-size: 0.85rem;
  margin: 0.25rem 0;
}

.back-to-nearby {
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  margin-bottom: 0.6rem;
  display: inline-flex;
  align-items: center;
  color: var(--navy);
}

.back-to-nearby:hover, .back-to-nearby:focus-visible {
  background: var(--surface-subtle);
  border-color: var(--navy);
}

/* The exact block answer spans the page; nearby and building context follow it. */
.property-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr);
  grid-template-areas: "prices prices" "nearby details";
  gap: 1.25rem 1.75rem;
  align-items: start;
}
.property-workspace-grid > * { min-width: 0; width: 100%; }
.property-price-pane { grid-area: prices; }
.property-right-column { grid-area: nearby; display: flex; flex-direction: column; gap: 1rem; }
.building-details-accordion { grid-area: details; }
@media (max-width: 1023px) {
  .property-workspace-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "prices" "nearby" "details"; }
}

.block-answer-intro { margin: 0 0 0.65rem; color: var(--text-muted); font-size: 0.9rem; }
.property-recorded-summary { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.property-recorded-summary > h3 { margin-bottom: 0.65rem; }

/* Property Filters Bar */
.property-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  padding: 0.65rem 0.85rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.filter-select {
  padding: 0.45rem 2rem 0.45rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background-color: var(--surface);
  color: var(--text-main);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-select:hover {
  border-color: var(--navy);
}

.filter-select:focus-visible {
  border-color: var(--navy);
  outline: 2px solid var(--navy);
  outline-offset: 1px;
}

/* Price Cards Grid */
.price-cards-section {
  margin-bottom: 1.25rem;
}

.price-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}

.price-evidence-card {
  padding: 0.75rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.price-evidence-card.primary-card {
  border-color: var(--navy);
  background: light-dark(#f8fafc, #1e293b);
  box-shadow: 0 2px 6px rgba(11, 31, 58, 0.08);
}

.price-evidence-card .card-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 0.25rem;
}

.price-evidence-card .card-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  letter-spacing: -0.02em;
}

.price-evidence-card .card-value.highlight-value {
  color: var(--navy);
}

.price-evidence-card .card-value-small {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}

.insufficient-card {
  background: var(--surface-subtle);
  border: 1px dashed var(--border-strong);
  padding: 0.85rem 1rem;
}

.insufficient-card .card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.insufficient-card .card-subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.price-cutoff-note {
  margin-top: 0.4rem;
  font-size: 0.8rem;
}

/* Transactions Table */
.property-transactions-section {
  margin-bottom: 0;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border-bottom: 2px solid var(--border);
}

tr:last-child td { border-bottom: none; }

.transactions-table th:nth-child(3),
.transactions-table td:nth-child(3) {
  text-align: center;
}

.transactions-table th:nth-child(4),
.transactions-table td:nth-child(4),
.transactions-table th:nth-child(5),
.transactions-table td:nth-child(5),
.transactions-table th:nth-child(6),
.transactions-table td:nth-child(6) {
  text-align: right;
}

.transactions-table td {
  font-variant-numeric: tabular-nums;
}

.transactions-table tbody tr:hover td {
  background: var(--surface-subtle);
}

.table-order-note {
  margin-bottom: 0.35rem;
}

.table-pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.btn-pager {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.btn-pager:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-pager:not(:disabled):hover {
  background: var(--surface-subtle);
  border-color: var(--navy);
  color: var(--navy);
}

.pager-indicator {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Nearby Attributed Transactions Table (Desktop Column Balancing) */
.nearby-transactions-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

@media (min-width: 601px) {
  .nearby-transactions-table th:nth-child(1),
  .nearby-transactions-table td:nth-child(1) {
    width: 100px;
    padding-left: 1rem;
  }
  .nearby-transactions-table th:nth-child(2),
  .nearby-transactions-table td:nth-child(2) {
    min-width: 220px;
    white-space: normal;
  }
  .nearby-transactions-table th:nth-child(3),
  .nearby-transactions-table td:nth-child(3) {
    width: 110px;
  }
  .nearby-transactions-table th:nth-child(4),
  .nearby-transactions-table td:nth-child(4) {
    width: 100px;
  }
  .nearby-transactions-table th:nth-child(5),
  .nearby-transactions-table td:nth-child(5) {
    width: 105px;
    text-align: right;
  }
  .nearby-transactions-table th:nth-child(6),
  .nearby-transactions-table td:nth-child(6) {
    width: 125px;
    text-align: right;
    font-weight: 750;
    color: var(--text-main);
    padding-right: 1rem;
  }
  .nearby-transactions-table td {
    font-variant-numeric: tabular-nums;
  }
  .nearby-transactions-table tbody tr:hover td {
    background: var(--surface-subtle);
  }
}

/* Segment Filter Tabs (All / HDB / Private) */
.segment-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.85rem 0 1rem;
}

.segment-tab-btn {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.45rem 0.95rem;
  border-radius: 9999px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.segment-tab-btn:hover {
  background: var(--surface-elevated);
  border-color: var(--border-strong);
  color: var(--text-main);
}

.segment-tab-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 2px 6px rgba(43, 90, 237, 0.25);
}

/* Side-by-Side Space vs Facilities Comparison */
.buyer-compare-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1rem;
}

@media (max-width: 860px) {
  .buyer-compare-columns {
    grid-template-columns: 1fr;
  }
}

.buyer-compare-col {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
}

.buyer-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.buyer-col-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.buyer-col-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* Space vs. Facilities Trade-off Callout */
.tradeoff-banner {
  background: linear-gradient(135deg, var(--blue-subtle) 0%, var(--surface-elevated) 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.85rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  line-height: 1.4;
}

.tradeoff-banner-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* Seller Sub Mode Switcher */
.seller-sub-toggle {
  display: inline-flex;
  gap: 0.35rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem;
  margin-bottom: 0.85rem;
}

.seller-sub-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
}

.seller-sub-btn:hover {
  color: var(--text-main);
}

.seller-sub-btn.active {
  background: var(--surface);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Dual-Lens Workspace (Buyer Budget vs Seller Valuation) */
.dual-lens-workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.15rem;
  margin: 1rem 0 1.25rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.dual-lens-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

@media (max-width: 640px) {
  .dual-lens-toggle {
    grid-template-columns: 1fr;
  }
}

.lens-tab-btn {
  background: var(--surface-subtle);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 0.75rem 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-main);
}

.lens-tab-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-elevated);
}

.lens-tab-btn.active {
  border-color: var(--blue);
  background: var(--blue-subtle);
}

.lens-tab-title {
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.2rem;
  color: var(--text-main);
}

.lens-tab-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.dual-lens-content {
  margin-top: 0.75rem;
}

/* Buyer Lens Pills & Cards */
.buyer-budget-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.budget-bar-label {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-main);
}

.budget-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.budget-pill-btn {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.budget-pill-btn:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

.budget-pill-btn.active {
  background: var(--blue-subtle);
  border-color: var(--blue);
  color: var(--blue);
}

.affordability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem;
  margin-top: 0.6rem;
}

.afford-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.afford-card:hover {
  border-color: var(--blue);
  background: var(--surface-elevated);
}

.afford-card.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}

.afford-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.afford-tag-yes {
  color: var(--emerald);
  background: var(--emerald-subtle);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.afford-tag-stretch {
  color: var(--amber);
  background: var(--amber-subtle);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.afford-tag-none {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.afford-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.afford-range {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Seller Lens Controls & Figures */
.seller-controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

.seller-picker-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.seller-select {
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.seller-benchmark-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
}

@media (max-width: 640px) {
  .seller-benchmark-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

.benchmark-stat-group {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.benchmark-stat-item {
  display: flex;
  flex-direction: column;
}

.benchmark-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

.benchmark-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

.benchmark-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.benchmark-corridor {
  font-size: 1rem;
  font-weight: 750;
  color: var(--blue);
}

.floor-premium-badge {
  background: var(--emerald-subtle);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--emerald);
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

.benchmark-psf, .corridor-psf {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--blue);
  margin-left: 0.35rem;
}

.psf-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--blue);
  margin-left: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.range-psf {
  color: var(--blue);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-left: 0.25rem;
}

.cell-sub {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.25;
  margin-top: 2px;
}

.cell-psf {
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Nearby Amenities Card */
.nearby-amenities-card {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.nearby-heading {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.amenity-items-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.amenity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.88rem;
}

.amenity-icon {
  font-size: 1.1rem;
  line-height: 1.2;
}

.amenity-text {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.amenity-name {
  font-weight: 600;
}

.amenity-distance {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.distance-note {
  margin-top: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}


/* Expandable Map Panel & Workspace Layout */
.btn-toggle-map {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  min-height: 32px;
}

.btn-toggle-map:hover {
  background: var(--surface-hover);
  border-color: var(--navy);
}

.btn-toggle-map.is-open {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}

.btn-show-on-map {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.btn-show-on-map:hover {
  color: var(--navy);
  border-color: var(--navy);
  background: var(--surface-subtle);
}

.expandable-map-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.expandable-map-panel[hidden] {
  display: none !important;
}

.nearby-workspace {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

@media (min-width: 1024px) {
  .nearby-workspace.has-map {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    grid-template-areas: "results map";
    gap: 1.5rem;
    align-items: start;
  }
  .nearby-workspace.has-map > .nearby-state {
    grid-area: results;
    min-width: 0;
  }
  .nearby-workspace.has-map > .nearby-map-panel {
    grid-area: map;
    min-width: 0;
    position: sticky;
    top: 1rem;
  }
}

@media (max-width: 1023px) {
  .nearby-workspace.has-map {
    display: flex;
    flex-direction: column;
  }
  .nearby-workspace.has-map > .nearby-map-panel {
    order: 1;
  }
  .nearby-workspace.has-map > .nearby-state {
    order: 2;
  }
}

/* Expandable Secondary Sections */
.building-details-accordion {
  margin-top: 0;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.details-block {
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.details-summary-heading {
  padding: 0.6rem 0.85rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-subtle);
}

.details-content {
  padding: 0.75rem 0.85rem;
}

/* Composition & Summary (Preserved for test compatibility) */
.composition {
  margin: 0.8rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
}

.composition h3 {
  font-size: 0.85rem;
  margin: 0 0 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.composition table { margin-top: 0.25rem; }
.composition .composition-total { font-size: 0.85rem; margin: 0.25rem 0 0; }

.empty-history {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-top: 0.5rem;
  background: var(--surface);
}

.empty-history p { margin: 0.2rem 0; font-size: 0.9rem; }
.empty-history .next-actions { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.5rem; }

.address-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.address-link:hover, .address-link:focus-visible { text-decoration-thickness: 2px; color: var(--navy); }

.summary {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0.8rem 0;
  background: var(--surface);
}

.summary-label { font-weight: 600; margin: 0 0 0.15rem; }
.summary-caveat { color: var(--accent-amber); font-size: 0.82rem; margin: 0 0 0.3rem; }
.summary-figures { margin: 0 0 0.2rem; font-size: 1.05rem; }
.summary-definition { color: var(--text-muted); font-size: 0.78rem; margin: 0; }

/* Nearby List styles (Preserved for tests) */
.nearby-coverage { border-left: 3px solid var(--accent-amber); background: rgba(180, 83, 9, 0.1); padding: 0.5rem 0.7rem; font-size: 0.85rem; margin: 0.6rem 0; }
.nearby-coverage-short { font-size: 0.8rem; color: var(--text-muted); margin: 0.4rem 0 0.2rem; }
.nearby-coverage-details { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 0.4rem; }
.nearby-coverage-details summary { cursor: pointer; }
.nearby-coverage-details p { margin: 0.3rem 0; }
.nearby-flat-type, .nearby-period { margin-left: 0.5rem; font-size: 0.82rem; }
.properties-table { margin-top: 0.3rem; }
.properties-table td, .properties-table th { vertical-align: middle; }
.nearby-scope { font-weight: 600; font-size: 0.9rem; margin: 0.5rem 0 0.2rem; }
.nearby-town-switcher { margin-left: 0.7rem; font-size: 0.85rem; }
.nearby-return-search { font-size: 0.82rem; padding: 0.3rem 0.55rem; cursor: pointer; background: none; border: 1px solid var(--border-strong); border-radius: 6px; margin-left: 0.7rem; }
.nearby-return-search:hover, .nearby-return-search:focus-visible { background: var(--surface-subtle); }
.nearby-count { font-size: 0.85rem; font-weight: 600; margin: 0.6rem 0 0.2rem; }
.empty-nearby { border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.8rem; font-size: 0.9rem; }
.nearby-pagination button { margin-right: 0.5rem; }
.nearby-pagination button:disabled { opacity: 0.45; cursor: default; }
.nearby-tx-filter { font-size: 0.82rem; margin-left: 0.7rem; }
.nearby-view-switch { margin-right: 0.7rem; }
.nearby-view-switch button { font-size: 0.82rem; padding: 0.3rem 0.55rem; cursor: pointer; background: none; border: 1px solid var(--border-strong); }
.nearby-view-switch button:first-child { border-radius: 6px 0 0 6px; }
.nearby-view-switch button:last-child { border-radius: 0 6px 6px 0; }
.nearby-view-switch button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.nearby-primary-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.65rem; margin: 0.65rem 0; }
.nearby-primary-actions .nearby-view-switch { margin-right: 0; }
.nearby-refinement-controls { width: fit-content; margin: 0 0 0.7rem; }
.nearby-refinement-body { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; max-width: 60rem; padding: 0.5rem 0.65rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-subtle); }
.nearby-refinement-body .nearby-flat-type,
.nearby-refinement-body .nearby-period,
.nearby-refinement-body .nearby-town-switcher,
.nearby-refinement-body .nearby-return-search,
.nearby-refinement-body .nearby-tx-filter { margin-left: 0; }
.nearby-refinement-body > .hint { flex: 1 1 24rem; margin: 0; }
.nearby-townwide-action { display: block; margin-top: 0.5rem; font-size: 0.85rem; padding: 0.45rem 0.6rem; cursor: pointer; background: none; border: 1px dashed var(--border-strong); border-radius: 6px; text-align: left; }
.nearby-townwide-action:hover, .nearby-townwide-action:focus-visible { background: var(--surface-subtle); }

/* Diagnostics */
#diagnostics { margin-top: 2.5rem; font-size: 0.8rem; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 1rem; }
#diagnostics summary { cursor: pointer; }
.diagnostics-body dt { font-weight: 600; margin-top: 0.4rem; }
.diagnostics-body dd { margin: 0 0 0.2rem; overflow-wrap: anywhere; }

footer { margin-top: 2.5rem; font-size: 0.75rem; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Panel loading and error */
.panel-loading { display: flex; align-items: center; gap: 0.6rem; padding: 1rem 0; color: var(--text-muted); font-size: 0.88rem; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--navy); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.panel-error { padding: 0.75rem; background: rgba(190, 18, 60, 0.08); border: 1px solid rgba(190, 18, 60, 0.2); border-radius: 6px; color: var(--accent-red); font-size: 0.88rem; margin: 0.5rem 0; }
.btn-retry { margin-top: 0.4rem; padding: 0.3rem 0.6rem; font-size: 0.82rem; cursor: pointer; }

@media (prefers-color-scheme: dark) {
  :root {
    --navy: #38bdf8;
    --navy-hover: #7dd3fc;
  }
  .status, .hint, .summary-definition, footer { color: #94a3b8; }
  .unavailable, .summary-caveat { color: #fbbf24; }
  .price-evidence-card.primary-card { border-color: #38bdf8; }
  .filter-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  }
}

/* Search Paths (Preserved) */
.search-paths { position: relative; width: fit-content; }
.search-paths > summary { cursor: pointer; color: var(--navy); font-size: 0.8rem; font-weight: 600; list-style: none; }
.search-paths > summary::-webkit-details-marker { display: none; }
.search-path-options { position: absolute; z-index: 22; top: 100%; left: 0; width: min(22rem, calc(100vw - 2rem)); padding: 0.35rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 8px 20px #0002; }
.search-path-options button { display: block; width: 100%; padding: 0.55rem 0.65rem; border: 0; border-radius: 5px; background: none; text-align: left; cursor: pointer; font-weight: 600; }
.search-path-options button span { display: block; color: var(--text-muted); font-size: 0.75rem; font-weight: 400; }
.search-path-options button:hover, .search-path-options button:focus-visible { background: var(--surface-subtle); }
.coverage-note { font-size: 0.8rem; color: var(--text-muted); margin: 0.8rem 0 1.2rem; }
.area-answer-header { max-width: 58rem; margin-bottom: 0.8rem; }
.area-answer-header h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 0.2rem; }
.area-answer-lede { margin: 0; font-size: 1rem; }
.area-answer-summary { margin: 0.55rem 0 0; font-weight: 650; }
.area-answer-truth { margin-top: 0.2rem; }
.area-answer-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.65rem; margin: 0.8rem 0; }
.secondary-controls { border: 0; }
.secondary-controls > summary { cursor: pointer; min-height: 32px; color: var(--navy); font-size: 0.85rem; font-weight: 650; }
.area-filter-row { display: flex; flex-wrap: wrap; gap: 0.5rem; padding-top: 0.45rem; }
.area-filter-row .nearby-flat-type,
.area-filter-row .nearby-period { margin-left: 0; min-height: 40px; }
.area-recorded-sales > table { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.area-recorded-sales .nearby-townwide-note { color: var(--text-muted); font-size: 0.82rem; }
.property-details-section { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.7rem; padding: 0.6rem 0.8rem; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03); }
.property-details-summary { font-weight: 600; cursor: pointer; }
.property-details-summary:hover { color: var(--navy); }
.property-details-section[open] > .property-details-summary { margin-bottom: 0.65rem; border-bottom: 1px solid var(--border); padding-bottom: 0.45rem; }
.property-details-section > .composition, .property-details-section > .summary { border: 0; padding: 0; }
.filter-group { min-width: 0; flex-wrap: wrap; }
.filter-select { max-width: 100%; min-height: 44px; }
.amenity-text { min-width: 0; overflow-wrap: anywhere; }
table { display: block; max-width: 100%; overflow-x: auto; }
.table-responsive table { display: table; }
.responsive-transaction-table { display: table; table-layout: auto; }
.dossier { min-width: 0; }
button, summary { min-height: 32px; }
button { color: inherit; font: inherit; }
.btn-retry, .btn-pager { min-height: 44px; }
button:focus-visible, select:focus-visible, summary:focus-visible, .table-responsive:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.panel-error { color: var(--text-main); }
@media (max-width: 600px) {
  body { padding-inline: 1rem; }
  .header-brand h1 { font-size: 1rem; }
  #search-label, #search-hint { display: none; }
  .property-heading-pane h2 { font-size: 1.25rem; }
  .property-filters-bar { gap: 0.5rem; padding: 0.6rem; }
  .property-filters-bar .filter-group { flex: 1 1 9rem; }
  .property-filters-bar .filter-select { width: 100%; }
  .price-cards-grid { grid-template-columns: minmax(0, 1fr); }
  .search-path-options { position: fixed; top: 7.1rem; left: 1rem; right: 1rem; width: auto; }
  .area-answer-actions { align-items: center; }
  .nearby-primary-actions { align-items: stretch; }
  .nearby-primary-actions .nearby-view-switch { display: flex; flex: 1 1 100%; }
  .nearby-primary-actions .nearby-view-switch button { flex: 1 1 50%; min-height: 44px; }
  .nearby-refinement-controls { width: 100%; }
  .nearby-refinement-body { align-items: stretch; }
  .nearby-refinement-body select { width: 100%; min-height: 44px; }
  .table-responsive { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .table-responsive table,
  .responsive-transaction-table,
  .responsive-transaction-table tbody { display: block; width: 100%; max-width: 100%; overflow: visible; }
  .table-responsive thead,
  .responsive-transaction-table thead {
    display: none;
  }
  .responsive-transaction-table tbody { display: grid; gap: 0.65rem; }
  .responsive-transaction-table .responsive-transaction-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem 0.75rem;
    padding: 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  }
  .responsive-transaction-table .responsive-transaction-row td {
    min-width: 0;
    padding: 0;
    border: 0;
    white-space: normal;
    text-align: left;
    overflow-wrap: anywhere;
  }
  .responsive-transaction-table .responsive-transaction-row td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.06rem;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }
  .responsive-transaction-table .responsive-transaction-row td[data-label="Price"] {
    grid-column: 2;
    grid-row: 1;
    color: var(--text-main);
    font-weight: 750;
    text-align: right;
    white-space: nowrap;
  }
  .responsive-transaction-table .responsive-transaction-row td[data-label="Date"] {
    grid-column: 1;
    grid-row: 1;
    font-weight: 650;
  }
  .nearby-transaction-row td[data-label="Property"] { grid-column: 1 / -1; }
  .nearby-transaction-row td[data-label="Flat type"],
  .nearby-transaction-row td[data-label="Floor band"],
  .nearby-transaction-row td[data-label="Area"] { grid-column: auto; }
  .block-transaction-row td[data-label="Flat type"] { grid-column: 1 / -1; }
  .btn-show-on-map { margin: 0.25rem 0 0 0.5rem; }
  .table-pagination,
  .nearby-pagination { justify-content: space-between; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .drawer, .drawer-overlay { transition: none !important; }
}

/* Slide-out Side Drawer */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 90vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 999;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
  transform: translateX(100%);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  overflow-y: auto;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer.open {
  transform: translateX(0);
}

.drawer[hidden] {
  display: none !important;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.drawer-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  margin: 0;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text-main);
}

.drawer-section {
  margin-bottom: 1.5rem;
}

.drawer-section h3 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.8rem;
}

.theme-segmented {
  display: flex;
  background: var(--surface-subtle);
  padding: 0.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.theme-btn {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.theme-btn.active {
  background: var(--surface);
  color: var(--text-main);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.provenance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.provenance-table tr {
  border-bottom: 1px solid var(--border);
}

.provenance-table td {
  padding: 0.5rem 0;
  color: var(--text-muted);
}

.provenance-table td:last-child {
  text-align: right;
  font-weight: 600;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.rules-list {
  list-style: none;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0;
  margin: 0;
}

.rules-list li strong {
  color: var(--text-main);
  display: block;
  margin-bottom: 0.15rem;
}

.drawer #diagnostics {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.drawer-footer {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}
