:root {
  --ink: #17202a;
  --muted: #607085;
  --line: #d8dee7;
  --panel: #ffffff;
  --page: #f5f7fa;
  --teal: #087f73;
  --blue: #275fba;
  --rust: #a34816;
  --gold: #b7791f;
  --danger: #b42318;
  --ok: #147a3f;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(8, 127, 115, 0.12), rgba(39, 95, 186, 0.08)),
    var(--page);
}

.auth-card {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(23, 32, 42, 0.12);
}

.auth-card h1 {
  font-size: 34px;
  line-height: 1.08;
}

.auth-copy {
  margin: 10px 0 20px;
  color: var(--muted);
  font-weight: 700;
}

.supabase-sign-in {
  display: grid;
  gap: 12px;
}

.supabase-sign-in label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.supabase-sign-in input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
}

.auth-message {
  margin: 14px 0 0;
  color: var(--ok);
  font-size: 14px;
  font-weight: 700;
}

.auth-message.auth-error {
  color: var(--danger);
}

.auth-setup-hint {
  margin: 16px 0 0;
  border: 1px solid #f4c27a;
  border-radius: 8px;
  padding: 12px;
  color: #7a3e05;
  background: #fff7ea;
  font-size: 14px;
  font-weight: 700;
}

.auth-access-hint {
  margin: 16px 0 0;
  border: 1px solid #f4a09a;
  border-radius: 8px;
  padding: 12px;
  color: #8f1f17;
  background: #fff1f0;
  font-size: 14px;
  font-weight: 700;
}

.search-panel,
.status-strip,
.results-column,
.detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search-panel {
  padding: 18px;
}

.brand-row,
.toolbar,
.source-layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.mapping-view {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
}

.mapping-rows { display: grid; gap: 10px; margin-top: 14px; }
.mapping-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.mapping-row p { margin: 5px 0; font-weight: 750; }
.mapping-row small { color: var(--muted); }

.brand-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.user-button-mount {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 32px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.user-button-mount .secondary-button {
  min-height: 32px;
  padding: 0 9px;
}

.eyebrow,
.section-title {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.primary-button {
  min-width: 116px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--teal);
  font-weight: 750;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
}

.criteria-grid {
  display: grid;
  grid-template-columns: 2fr repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.advanced-toggle,
.advanced-filters {
  grid-column: 1 / -1;
}

.history-comparison-field {
  grid-column: span 2;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
}

.history-comparison-field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.history-comparison-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(125px, 1fr));
  gap: 8px;
}

.history-comparison-field p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.period-live-toggle {
  display: inline-flex;
  width: auto;
  margin-top: 8px;
}

.period-live-toggle span {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.period-live-toggle input {
  width: 16px;
  height: 16px;
}

.advanced-toggle {
  display: flex;
  justify-content: flex-end;
}

.advanced-filters {
  border-top: 1px solid var(--line);
}

.filter-section {
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.filter-heading h2 {
  font-size: 19px;
}

.filter-heading span {
  color: var(--ink);
  font-weight: 900;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  max-width: 920px;
}

.compact-row {
  grid-template-columns: repeat(2, minmax(180px, 230px));
}

.checkbox-grid,
.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
}

.checkbox-grid label,
.radio-row label,
.inline-check,
.mode-grid label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 30px;
  color: var(--ink);
}

.checkbox-grid input,
.radio-row input,
.inline-check input,
.mode-grid input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.feature-grid {
  max-width: 1180px;
}

.inline-check {
  width: fit-content;
  margin-top: 14px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.mode-grid fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.mode-grid legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(8, 127, 115, 0.22);
  outline-offset: 1px;
}

.source-layout {
  margin-top: 18px;
  align-items: flex-end;
}

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

.agency-pill,
.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.agency-pill input,
.toggle-row input {
  width: 16px;
  height: 16px;
}

.agency-pill.disabled {
  color: var(--muted);
  background: #f6f8fb;
  border-style: dashed;
}

.verified-star {
  display: inline-block;
  margin-left: 5px;
  color: #c88719;
  font-size: 14px;
  line-height: 1;
  vertical-align: 1px;
}

.agency-pill .verified-star {
  margin-left: 3px;
}

.location-field {
  position: relative;
  min-width: 0;
}

.selected-locations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.location-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 7px 4px 10px;
  color: #07574f;
  background: #e7f7f3;
  font-size: 12px;
  font-weight: 800;
}

.location-chip button {
  width: 19px;
  height: 19px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  color: inherit;
  background: rgba(7, 87, 79, 0.12);
  font-size: 16px;
  line-height: 1;
}

.location-help {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.location-suggestions {
  position: absolute;
  z-index: 20;
  top: 71px;
  right: 0;
  left: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.14);
  background: #fff;
}

.location-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.location-option:last-child { border-bottom: 0; }
.location-option:hover, .location-option:focus-visible { background: #f0fbf8; }
.location-option span, .location-empty { color: var(--muted); font-size: 12px; }
.location-empty { padding: 11px 12px; }

/* Places already searched, offered back as one-click chips under the search bar. */
.recent-locations {
  grid-column: 1 / -1;
  min-width: 0;
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.recent-locations-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recent-locations-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.recent-locations-head .secondary-button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.recent-location-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 118px;
  overflow-y: auto;
  margin-top: 8px;
}

.recent-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.recent-chip:hover,
.recent-chip:focus-visible {
  border-color: var(--teal);
  color: #07574f;
  background: #f0fbf8;
}

/* A chip carries its own forget button, so one term can go without the lot. */
.recent-chip-wrap {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
}

.recent-chip-wrap .recent-chip {
  border: 0;
  border-radius: 0;
  padding-right: 7px;
  background: transparent;
}

.recent-chip-wrap:hover,
.recent-chip-wrap:focus-within {
  border-color: var(--teal);
}

.recent-chip-wrap:has(.recent-chip.added) {
  border-color: transparent;
  background: #e7f7f3;
}

.recent-chip-forget {
  border: 0;
  padding: 0 8px 0 2px;
  color: var(--muted);
  background: transparent;
  font-size: 15px;
  line-height: 1;
}

.recent-chip-forget:hover:not(:disabled),
.recent-chip-forget:focus-visible {
  color: var(--danger);
}

.recent-chip-forget:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

/* Cut the results back to one or more of the places that were searched. */
.result-locations {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.result-locations-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.result-location-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.result-location-chip span {
  color: var(--muted);
  font-weight: 700;
}

.result-location-chip:hover,
.result-location-chip:focus-visible {
  border-color: var(--teal);
}

.result-location-chip.on {
  border-color: transparent;
  color: #fff;
  background: var(--teal);
}

.result-location-chip.on span {
  color: rgba(255, 255, 255, 0.78);
}

.result-location-clear {
  border: 0;
  padding: 5px 6px;
  color: var(--blue);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  text-decoration: underline;
}

.recent-chip:disabled,
.location-chip button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.recent-chip.added {
  border-color: transparent;
  color: #07574f;
  background: #e7f7f3;
}

.recent-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.recent-locations .location-help {
  margin-top: 8px;
}

/* The same one-click treatment for keyword terms, under the keyword box. */
.recent-keywords {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.recent-keywords-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recent-keywords-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.recent-keywords-head .secondary-button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.recent-keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 118px;
  overflow-y: auto;
  margin-top: 8px;
}

.recent-keywords .location-help {
  margin-top: 8px;
}

/* Batch run: one queued job per location, with its own saved-search result. */
.batch-panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.batch-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.batch-summary {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.batch-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.batch-actions .secondary-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.batch-jobs {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.batch-job {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: #fff;
  font-size: 13px;
}

.batch-state {
  min-width: 78px;
  border-radius: 999px;
  padding: 2px 9px;
  color: var(--muted);
  background: #eef1f6;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.batch-job.running .batch-state { color: #234a8a; background: #e6eefb; }
.batch-job.done .batch-state { color: #0d5c31; background: #e4f4ea; }
.batch-job.read .batch-state { color: #6b4a12; background: #fbf1dd; }
.batch-job.failed .batch-state { color: #8b1f17; background: #fdeae7; }

.batch-location {
  font-weight: 800;
}

.batch-note {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.batch-job .secondary-button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.agency-error {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #f1b7aa;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff4f1;
  color: #8b3125;
  font-weight: 800;
}

.secondary-button.active {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.pill-soon {
  border-radius: 999px;
  padding: 1px 7px;
  background: #eef3f8;
  color: #607085;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-strip {
  margin-top: 12px;
  padding: 10px;
}

.status-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px 10px;
}

.status-sort select {
  height: 34px;
}

.status-body.collapsed {
  display: none;
}

.status-rows {
  overflow-x: auto;
}

.status-table {
  width: 100%;
  border-collapse: collapse;
}

.status-table thead th {
  padding: 6px 11px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-table thead th:last-child {
  text-align: right;
}

.status-table tbody tr.status-row {
  border-bottom: 1px solid var(--line);
  transition: background 0.14s ease;
}

.status-table tbody tr.status-row:last-child {
  border-bottom: 0;
}

.status-table tbody tr.status-row.clickable {
  cursor: pointer;
}

.status-table tbody tr.status-row.clickable:hover {
  background: #f0fbf8;
}

.status-table tbody tr.status-row.active {
  background: #eefaf6;
}

.status-table td {
  padding: 9px 11px;
  vertical-align: middle;
}

.status-caret {
  margin-left: 4px;
  color: var(--teal);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.status-name {
  font-weight: 750;
}

.status-search {
  max-width: 460px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.status-location { min-width: 180px; }

.location-quality {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 850;
  text-transform: capitalize;
}

.location-quality.exact { color: #07574f; background: #dff6ef; }
.location-quality.normalised { color: #155da4; background: #e7f0fc; }
.location-quality.fallback, .location-quality.mixed { color: #8a4b08; background: #fff1d6; }
.location-quality.not-set { color: #58677a; background: #edf1f5; }

.location-summary {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.link-divider { color: var(--muted); }

.status-search a {
  display: inline-block;
  max-width: 460px;
  color: var(--blue);
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.status-count {
  text-align: right;
  white-space: nowrap;
}

.status-expand-toggle {
  width: 100%;
  margin-top: 4px;
  padding: 9px 11px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--blue);
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.status-expand-toggle:hover {
  background: #f0f5fc;
}

.status-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  color: #fff;
  background: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-badge.loading {
  background: var(--gold);
}

.status-badge.done {
  background: var(--ok);
}

.status-badge.error {
  background: var(--danger);
}

.status-state {
  min-width: 180px;
}

.status-detail {
  display: block;
  max-width: 360px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.status-detail.error {
  color: #a92d21;
}

.status-detail-label {
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 12px;
  margin-top: 12px;
}

.results-column,
.detail-panel {
  min-height: 580px;
  padding: 14px;
}

.toolbar-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sort-control span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.sort-control select {
  width: auto;
  height: 38px;
}

.segmented {
  display: inline-grid;
  flex-shrink: 0;
  grid-auto-flow: column;
  grid-auto-columns: minmax(max-content, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  min-width: 82px;
  height: 38px;
  padding: 0 14px;
  border: 0;
  color: var(--muted);
  background: #fff;
  font-weight: 750;
  white-space: nowrap;
}

.segmented button.active {
  color: #fff;
  background: var(--blue);
}

.list-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.property-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.property-card:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
}

.card-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 0;
}

.bookmark-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #eef3f8;
  color: #607085;
  font-size: 18px;
  line-height: 1;
}

.bookmark-btn:hover {
  color: var(--gold);
}

.bookmark-btn.active {
  color: var(--gold);
}

.detail-bookmark.active {
  border-color: var(--gold);
  color: var(--gold);
}

.property-card.selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 127, 115, 0.16);
}

.property-card img {
  width: 100%;
  height: 172px;
  object-fit: cover;
  background: #e8edf4;
}

.property-body {
  padding: 8px 12px 12px;
}

.property-body h3 {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.25;
}

.meta-row,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.meta-row {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.price {
  color: var(--teal);
  font-size: 19px;
  font-weight: 850;
}

.badge {
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef3f8;
  color: #425267;
  font-size: 12px;
  font-weight: 750;
}

.badge.demo {
  color: #7a3a0c;
  background: #fff4df;
}

.badge.dist {
  color: #1e4620;
  background: #e6f4ea;
}

.badge.new-listing {
  color: #07574f;
  background: #d7f4eb;
}

.badge.property-match.confirmed {
  color: #1e4620;
  background: #dff6ef;
}

.badge.property-match.possible {
  color: #7a4b05;
  background: #fff1d6;
}

.property-match-detail {
  margin-top: 14px;
  border: 1px solid #cce9df;
  border-radius: 8px;
  padding: 10px;
  background: #f5fcf9;
}

.property-match-detail h4,
.property-match-detail p {
  margin: 0;
}

.property-match-detail h4 {
  font-size: 13px;
}

.property-match-detail p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.property-match-detail div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.property-match-detail a {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.empty-state {
  display: grid;
  min-height: 360px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
}

.map-view {
  margin-top: 14px;
}

.leaflet-map {
  height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  z-index: 0;
}

.map-canvas {
  position: relative;
  height: 560px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(8, 127, 115, 0.11), transparent 45%),
    linear-gradient(45deg, rgba(39, 95, 186, 0.14), transparent 55%),
    #eef4f0;
}

.map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(23, 32, 42, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 42, 0.08) 1px, transparent 1px);
  background-size: 72px 72px;
}

.map-label {
  position: absolute;
  color: rgba(23, 32, 42, 0.45);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.north {
  top: 12px;
  left: 50%;
}

.south {
  bottom: 12px;
  left: 50%;
}

.west {
  top: 50%;
  left: 12px;
}

.east {
  top: 50%;
  right: 12px;
}

.marker {
  position: absolute;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--rust);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.marker.selected {
  width: 28px;
  height: 28px;
  background: var(--teal);
}

/* Search-area centre: a crosshair ring the property markers are measured from. */
.map-center {
  position: absolute;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  border: 3px solid var(--blue);
  border-radius: 50%;
  background: rgba(39, 95, 186, 0.16);
  box-shadow: 0 0 0 2px #fff;
  pointer-events: none;
  z-index: 1;
}

.map-center::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--blue);
}

.map-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.legend-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.detail-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
}

.detail-panel img {
  width: 100%;
  height: 210px;
  border-radius: 8px;
  object-fit: cover;
  background: #e8edf4;
}

.detail-image {
  cursor: zoom-in;
}

.detail-media {
  position: relative;
}

.detail-media-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: rgba(23, 32, 42, 0.55);
  color: #fff;
  font-size: 19px;
  line-height: 1;
}

.detail-media-nav:hover {
  background: rgba(23, 32, 42, 0.75);
}

.detail-media-nav.prev {
  left: 8px;
}

.detail-media-nav.next {
  right: 8px;
}

.detail-media-count {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(23, 32, 42, 0.6);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* --- image lightbox (click a photo to view it larger, with gallery nav) --- */

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(10, 14, 20, 0.85);
}

.image-lightbox.hidden {
  display: none;
}

.image-lightbox img {
  max-width: min(92vw, 1100px);
  max-height: 88vh;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 28px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-nav.hidden {
  display: none;
}

.lightbox-nav.prev {
  left: 20px;
}

.lightbox-nav.next {
  right: 20px;
}

.lightbox-count {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.detail-panel h3 {
  margin: 12px 0 8px;
  font-size: 21px;
  line-height: 1.2;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.detail-actions .secondary-button {
  flex: 1 1 auto;
}

.detail-panel a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  flex: 1 1 auto;
  border-radius: 8px;
  padding: 0 12px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

/* --- data source panel (collapsible) -------------------------------------- */

.source-panel {
  margin-top: 18px;
}

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

.source-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.source-selection-toggle {
  min-height: 38px;
  padding: 0 11px;
  font-size: 12px;
}

.source-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--ink);
}

.source-toggle .section-title {
  margin: 0;
}

.source-caret {
  color: var(--muted);
  font-size: 14px;
  transition: transform 0.15s ease;
}

.source-toggle.closed .source-caret {
  transform: rotate(-90deg);
}

.source-summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.source-body {
  margin-top: 10px;
}

.source-body.collapsed {
  display: none;
}

/* --- analysis strip (price distribution) ---------------------------------- */

.analysis-strip {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.analysis-body {
  margin-top: 12px;
}

.analysis-body.collapsed {
  display: none;
}

.analysis-chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  margin-bottom: 12px;
}

.analysis-chart-head h3 {
  margin: 0;
  font-size: 16px;
}

.price-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.price-stats .stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.stat-k {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.stat-v {
  font-size: 15px;
  font-weight: 800;
}

.price-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: end;
  gap: 8px;
  height: 168px;
  padding-top: 6px;
}

.bar-col {
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: end;
  justify-items: center;
  gap: 4px;
  height: 100%;
  border: 0;
  background: none;
  padding: 0;
}

.bar-count {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.bar {
  width: 100%;
  max-width: 54px;
  min-height: 3px;
  border-radius: 6px 6px 0 0;
  background: var(--blue);
  transition:
    background 0.14s ease,
    filter 0.14s ease;
  align-self: end;
}

.bar-col.peak .bar {
  background: var(--teal);
}

.bar-col:hover .bar {
  filter: brightness(1.08);
}

.bar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

/* --- publisher line + price change ---------------------------------------- */

.price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.price-change {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
}

.price-change.down {
  color: #1e4620;
  background: #e6f4ea;
}

.price-change.up {
  color: #7a1c14;
  background: #fdecea;
}

.publisher {
  margin-top: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.publisher-label {
  color: var(--muted);
  font-weight: 700;
}

.publisher-via {
  color: var(--muted);
  font-weight: 600;
}

.price-history {
  margin: 14px 0 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfe;
}

.ph-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.price-history ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 5px;
}

.price-history li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.ph-date {
  color: var(--muted);
  font-weight: 700;
}

.ph-price {
  font-weight: 800;
}

.ph-diff {
  font-weight: 800;
  text-align: right;
}

.ph-diff.down {
  color: var(--ok);
}

.ph-diff.up {
  color: var(--danger);
}

.ph-diff.flat {
  color: var(--muted);
}

/* --- search history view -------------------------------------------------- */

.history-view {
  margin-top: 14px;
}

.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.history-toolbar-actions,
.history-date-form {
  display: inline-flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px;
}

.history-date-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.history-date-form input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  color: var(--ink);
  background: #fff;
}

.history-period,
.history-snapshots {
  margin-top: 22px;
}

.history-period-heading h2,
.history-snapshots h2 {
  margin: 0;
  font-size: 17px;
}

.history-period-heading p {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.history-listing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fafffe;
}

.history-listing h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.history-listing a {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.history-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.history-list {
  display: grid;
  gap: 10px;
}

/* A grid, not space-between: every row's title then starts at the same x. */
.history-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}

.history-card.selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(8, 127, 115, 0.13);
}

.history-select {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 6px;
}

.history-select-input {
  width: 17px;
  height: 17px;
  accent-color: var(--teal);
}

.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;
}

.history-main {
  min-width: 0;
}

.history-main h3 {
  margin: 0 0 4px;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.history-meta {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.history-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.history-change {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.history-warning {
  color: #8b1f17;
}

/* Nightly run: the watch list at the top of History. Rows reuse .batch-job. */
.nightly-panel {
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fafffe;
}

.nightly-panel h2 {
  margin: 0;
  font-size: 17px;
}

.nightly-problems {
  margin: 6px 0 0;
  padding-left: 18px;
  color: #8b1f17;
  font-size: 12px;
}

.history-actions {
  display: inline-flex;
  gap: 8px;
  flex: 0 0 auto;
}

.history-actions .secondary-button {
  min-height: 36px;
}

.hidden {
  display: none;
}

/* Two price views make the raw portal count and grouped-home count explicit. */
.analysis-note { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.price-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.price-distribution { min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 11px; background: #fbfcfe; }
.price-distribution-head { display: grid; gap: 8px; margin-bottom: 10px; }
.price-distribution h4, .price-distribution p { margin: 0; }
.price-distribution h4 { font-size: 14px; }
.price-distribution p { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.35; }

/* Bedroom & bathroom facets above the histogram. */
.price-facets { display: grid; gap: 6px; margin-bottom: 12px; }
.price-facets:empty { display: none; }
.facet-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.facet-row-label { min-width: 74px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.facet-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.facet-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; border: 1px solid var(--line); border-radius: 999px; padding: 0 11px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 700; }
.facet-chip:hover { border-color: var(--blue); background: #f2f6fc; }
.facet-chip:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
.facet-chip.active { border-color: var(--blue); background: #eef3fb; color: var(--blue); font-weight: 800; }
.facet-chip-count { color: var(--muted); font-size: 11px; font-weight: 800; }
.facet-chip.active .facet-chip-count { color: var(--blue); }

/* --- rooms & price change dashboard ---------------------------------------- */

.analysis-tabs { margin-bottom: 12px; }
.analysis-tabs button { min-width: 150px; height: 34px; font-size: 13px; }

.room-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; }
.room-controls label { display: grid; gap: 3px; }
.room-controls label span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.room-controls select { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 9px; background: #fff; color: var(--ink); }
.room-controls .secondary-button { min-height: 40px; }

.room-quick-ranges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.room-quick-label { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.room-quick-ranges .secondary-button { min-height: 32px; padding: 0 10px; font-size: 12px; }

.room-dashboard { display: grid; gap: 12px; }
.room-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 18px; }
.room-summary-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.room-summary-actions .secondary-button { min-height: 32px; padding: 0 10px; font-size: 12px; }
.room-legend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.room-legend .swatch { width: 12px; height: 12px; border-radius: 3px; }
.room-legend .swatch.start { background: #9db4d8; }
.room-legend .swatch.end { background: var(--blue); }
.room-legend .swatch.start + .swatch.end, .room-legend .swatch.end:not(:first-child) { margin-left: 6px; }
.room-notice { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.room-empty { border: 1px dashed var(--line); border-radius: 8px; padding: 14px; color: var(--muted); font-size: 13px; line-height: 1.45; }

.room-chart { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; gap: 10px; padding-top: 4px; overflow-x: auto; }
.room-col { display: grid; grid-template-rows: auto 176px auto auto; align-items: end; justify-items: center; gap: 5px; min-width: 92px; border: 1px solid transparent; border-radius: 8px; padding: 6px 4px; background: none; }
.room-col:hover { background: #f2f6fc; }
.room-col.active { border-color: var(--blue); background: #eef3fb; }
.room-col:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
.room-delta { font-size: 11px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.room-delta.up { color: var(--rust); }
.room-delta.down { color: var(--ok); }
/* The padding reserves the strip a full-height bar's value label sits in, so it
   can never collide with the change text above the column. */
.room-bars { display: flex; align-items: flex-end; justify-content: center; gap: 6px; width: 100%; height: 100%; padding-top: 20px; }
.room-bar { position: relative; display: block; width: 30px; min-height: 4px; border-radius: 6px 6px 0 0; background: #9db4d8; }
.room-bar.end { background: var(--blue); }
.room-bar-value { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.room-label { font-size: 12px; font-weight: 800; }
.room-sub { color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }

.room-table-wrap { overflow-x: auto; }
.room-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.room-table th, .room-table td { padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.room-table thead th { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.room-table tbody th { font-weight: 800; }
.room-table tbody tr[data-bucket] { cursor: pointer; }
.room-table tbody tr[data-bucket]:hover { background: #f4f7fc; }
.room-table tbody tr.active { background: #eef3fb; }
.room-delta-cell.up { color: var(--rust); font-weight: 800; }
.room-delta-cell.down { color: var(--ok); font-weight: 800; }

/* --- selected room group: split by the search filters ---------------------- */

.room-breakdown { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fbfcfe; }
.room-breakdown-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.room-breakdown-head h4 { margin: 0; font-size: 14px; }
.room-breakdown-head p { margin: 3px 0 10px; color: var(--muted); font-size: 12px; }
.breakdown-picker { min-width: 0; }
.breakdown-picker summary { color: var(--blue); font-size: 12px; font-weight: 800; cursor: pointer; }
.breakdown-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 4px 14px; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fff; }
.breakdown-option { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; }
.breakdown-option input { width: 15px; height: 15px; }
.room-price-drill { margin-bottom: 12px; }
.room-price-drill .price-distribution { background: #fff; }

/* --- price drill-down trail ------------------------------------------------ */

.price-drill { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.price-crumb { border: 0; border-radius: 6px; padding: 3px 8px; background: #eef3fb; color: var(--blue); font-size: 12px; font-weight: 800; }
.price-crumb:hover { background: #e2ebf9; }
.price-crumb-sep { color: var(--muted); font-size: 12px; }
.price-drill-up { min-height: 30px; padding: 0 10px; font-size: 12px; }
.room-breakdown-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.breakdown-group { min-width: 0; }
.breakdown-group h5 { margin: 0 0 6px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.breakdown-base { font-weight: 700; text-transform: none; opacity: 0.85; }
.breakdown-row { display: grid; grid-template-columns: minmax(0, 1fr) 56px auto; align-items: center; gap: 8px; width: 100%; border: 0; border-radius: 6px; padding: 4px 6px; background: none; color: var(--ink); font-size: 12px; text-align: left; }
.breakdown-row:not(.static):hover { background: #eef3fb; }
.breakdown-row.static { color: var(--muted); }
.breakdown-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.breakdown-bar { height: 6px; border-radius: 999px; background: #e6ecf5; overflow: hidden; }
/* A share under a percent still has to be visible, or a real count reads as none. */
.breakdown-bar span { display: block; min-width: 2px; height: 100%; border-radius: 999px; background: var(--blue); }
.breakdown-row.static .breakdown-bar span { background: #9db4d8; }
.breakdown-count { color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }

/* --- listings over time ---------------------------------------------------- */

.room-trend { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; }
.room-trend-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.room-trend-head h4 { margin: 0; font-size: 14px; }
.room-trend-head p { margin: 3px 0 10px; max-width: 62ch; color: var(--muted); font-size: 12px; }
.trend-mode button { min-width: 0; height: 32px; padding: 0 12px; font-size: 12px; }
.room-trend-plot { position: relative; }
.room-trend-svg { display: block; width: 100%; height: auto; overflow: visible; }
.trend-grid { stroke: #e6ecf5; stroke-width: 1; }
.trend-crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.trend-axis { fill: var(--muted); font-size: 12px; font-weight: 700; }
.trend-label { fill: var(--ink); font-size: 12px; font-weight: 800; }
.room-trend-tip { position: absolute; top: 4px; transform: translateX(-50%); display: grid; gap: 2px; min-width: 132px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #fff; box-shadow: 0 6px 18px rgba(15, 25, 40, 0.12); font-size: 12px; pointer-events: none; z-index: 2; }
.room-trend-tip strong { font-size: 12px; }
.tip-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 6px; color: var(--muted); }
.tip-row b { color: var(--ink); }
.tip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--series); }
.room-trend-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.trend-legend-item { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 700; }
.trend-legend-item:hover { background: #f4f7fc; }
.trend-legend-item.off { color: var(--muted); background: #f6f8fb; }
.trend-legend-item.off .trend-swatch { background: #c7d1de; }
.trend-swatch { width: 16px; height: 3px; border-radius: 2px; background: var(--series); }
.trend-swatch.dashed { background: repeating-linear-gradient(90deg, var(--series) 0 5px, transparent 5px 8px); }
.trend-legend-item.off .trend-swatch.dashed { background: repeating-linear-gradient(90deg, #c7d1de 0 5px, transparent 5px 8px); }
.room-trend-table { margin-top: 10px; }
.room-trend-table summary { color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.room-trend-table .room-table { margin-top: 8px; }

.badge.saved-listing { color: #5b4708; background: #fdf3d4; }

.property-match-detail .match-listing-actions { display: grid; gap: 8px; }
.match-listing-action { padding-top: 8px; border-top: 1px solid #dcece6; }
.match-listing-action:first-child { padding-top: 0; border-top: 0; }
.match-listing-action > div { margin-top: 6px; }
.match-listing-action .secondary-button, .match-listing-action a { min-height: 31px; padding: 5px 8px; font-size: 12px; }
.match-listing-action a { display: inline-flex; align-items: center; border-radius: 7px; color: var(--blue); background: transparent; font-weight: 800; text-decoration: none; }

/* In-app photo comparison for potential cross-platform matches. */
.match-review { position: fixed; inset: 0; z-index: 1001; display: grid; place-items: center; padding: 24px; background: rgba(10, 14, 20, 0.72); }
.match-review.hidden { display: none; }
.match-review-dialog { position: relative; width: min(980px, 100%); max-height: min(92vh, 820px); overflow: auto; border-radius: 12px; padding: 24px; background: #fff; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35); }
.match-review-close { position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #eef3f8; color: var(--ink); font-size: 23px; }
.match-review-heading { padding-right: 44px; }
.match-review-heading h2, .match-review-heading p { margin: 0; }
.match-review-heading h2 { margin-top: 4px; font-size: 21px; }
.match-review-heading > p:last-child { margin-top: 7px; color: var(--muted); line-height: 1.45; }
.match-photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.match-photo-panel { min-width: 0; margin: 0; }
.match-photo-panel > p:last-child { min-height: 38px; margin: 7px 0 0; color: var(--ink); font-size: 13px; font-weight: 700; }
.match-photo-source { margin: 0 0 6px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.match-photo-frame { position: relative; background: #e8edf4; }
.match-photo-frame img { display: block; width: 100%; height: min(42vw, 360px); min-height: 230px; object-fit: cover; }
.match-photo-nav { position: absolute; top: 50%; width: 34px; height: 34px; transform: translateY(-50%); border: 0; border-radius: 50%; background: rgba(23, 32, 42, 0.67); color: #fff; font-size: 21px; }
.match-photo-nav.prev { left: 8px; }
.match-photo-nav.next { right: 8px; }
.match-photo-nav:disabled { opacity: 0.35; cursor: not-allowed; }
.match-photo-count { position: absolute; right: 8px; bottom: 8px; padding: 3px 7px; border-radius: 999px; background: rgba(23, 32, 42, 0.67); color: #fff; font-size: 11px; font-weight: 800; }
.match-review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 18px; }
.match-status { color: #07574f; font-size: 13px; font-weight: 800; }

.result-filter-button {
  margin-left: 4px;
  border: 0;
  border-radius: 999px;
  padding: 4px 9px;
  background: #d7f4eb;
  color: #07574f;
  font: inherit;
  font-size: 0.58em;
  font-weight: 850;
  vertical-align: middle;
}

.result-filter-button:hover {
  background: #bcebdc;
}

@media (max-width: 700px) {
  .price-chart-grid, .match-photo-grid { grid-template-columns: 1fr; }
  .match-review-dialog { padding: 18px; }
  .match-photo-frame img { height: min(74vw, 340px); }
  .analysis-tabs { width: 100%; }
  .analysis-tabs button { min-width: 0; }
  .room-controls label { flex: 1 1 132px; }
  .room-col { grid-template-rows: auto 140px auto auto; min-width: 84px; }
}

@media (max-width: 980px) {
  .criteria-grid,
  .workspace,
  .filter-row,
  .compact-row,
  .mode-grid {
    grid-template-columns: 1fr;
  }

  .brand-row,
  .toolbar,
  .source-layout {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }

  .detail-panel {
    min-height: auto;
  }

  .history-comparison-field {
    grid-column: auto;
  }
}
