/* ============================================================
   Balkans RE · Editorial design system
   Serif headlines · sans body · tabular monospaced numerals
   ============================================================ */

:root {
  /* ---------- Type ---------- */
  --font-serif: "Newsreader", "Iowan Old Style", "Georgia", "Times New Roman", serif;
  --font-sans:  "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* ---------- Light theme (warm paper, deep ink) ---------- */
  --paper:       #f6f8f3;   /* cool off-white, research terminal paper */
  --paper-soft:  #e9eee6;   /* slightly toned panel */
  --card:        #ffffff;
  --ink:         #101714;   /* near-black with green undertone */
  --ink-soft:    #24302b;
  --ink-muted:   #65736b;
  --ink-faint:   #99a59e;
  --rule:        #d3dbd4;   /* cool hairline */
  --rule-strong: #101714;

  --accent:        #176b5f;   /* teal-green analytical accent */
  --accent-soft:   #dcebe6;
  --accent-strong: #0f4c43;
  --accent-blue:   #2e4f7d;
  --accent-warm:   #a37021;

  --warn:        #9b3f32;     /* brick red for negative discount */
  --warn-soft:   #f2dfda;

  /* Histogram bar color follows the accent family — defined here so it can
     be re-themed independently in dark mode. */
  --hist-bar: rgba(45, 90, 63, 0.55);
  --hist-bar-mid: rgba(26, 22, 17, 0.55);
  --shadow-soft: 0 14px 40px rgba(16, 23, 20, 0.08);
  --shadow-tight: 0 8px 20px rgba(16, 23, 20, 0.08);
  --shadow-card: 0 1px 2px rgba(16, 23, 20, 0.04);
  --shadow-lift: 0 6px 20px rgba(16, 23, 20, 0.07);
  --radius: 8px;
  --radius-lg: 14px;   /* cards (canvas) */
  --radius-btn: 9px;   /* buttons (canvas) */
  --card-border: #e3e7df;

  /* ---------- Opportunity labels (plain-language, canvas) ---------- */
  --opp-good-bg:  #e3f0ea;  --opp-good-fg:  #145d52;  --opp-good-dot:  #1f8a5b;
  --opp-fair-bg:  #eef1ea;  --opp-fair-fg:  #5a635e;  --opp-fair-dot:  #8a918c;
  --opp-prem-bg:  #f5e6e1;  --opp-prem-fg:  #8f3a2d;  --opp-prem-dot:  #b14d3c;
  --opp-thin-bg:  #f3eee2;  --opp-thin-fg:  #7a6a45;  --opp-thin-dot:  #b89b5e;

  /* ---------- Layout ---------- */
  --container-max: 1180px;
  --gutter: 1.5rem;
}

:root[data-theme="dark"] {
  --paper:       #0e1311;
  --paper-soft:  #171f1b;
  --card:        #141c18;
  --ink:         #edf3e9;
  --ink-soft:    #d7e1d5;
  --ink-muted:   #9cab9f;
  --ink-faint:   #657367;
  --rule:        #28352f;
  --rule-strong: #edf3e9;

  --accent:        #6ec48a;   /* lifted green so it carries on dark paper */
  --accent-soft:   #1f3026;
  --accent-strong: #a4dab5;
  --accent-blue:   #8fb2ee;
  --accent-warm:   #e1a84f;

  --warn:        #e07c69;
  --warn-soft:   #3a221c;

  --hist-bar: rgba(110, 196, 138, 0.45);
  --hist-bar-mid: rgba(236, 230, 212, 0.55);
  --shadow-soft: none;
  --shadow-tight: none;
  --shadow-card: none;
  --shadow-lift: 0 6px 20px rgba(0, 0, 0, 0.4);
  --card-border: #28352f;

  --opp-good-bg:  #16271f;  --opp-good-fg:  #8fdcb1;  --opp-good-dot:  #6ec48a;
  --opp-fair-bg:  #1c2420;  --opp-fair-fg:  #9cab9f;  --opp-fair-dot:  #6b756e;
  --opp-prem-bg:  #2f1d18;  --opp-prem-fg:  #e69985;  --opp-prem-dot:  #e07c69;
  --opp-thin-bg:  #262017;  --opp-thin-fg:  #cdb789;  --opp-thin-dot:  #b89b5e;

  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(16, 23, 20, 0.030) 1px, transparent 1px),
    linear-gradient(180deg, rgba(16, 23, 20, 0.030) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px, 28px 28px, auto;
  background-attachment: fixed;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, picture, svg, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
ul { padding: 0; }

/* ---------- Container ---------- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
main.container { padding-top: 2rem; padding-bottom: 4rem; }

/* ---------- Headings ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.18;
  color: var(--ink);
}
h2 {
  font-size: clamp(1.85rem, 2.4vw + 1rem, 2.7rem);
  font-weight: 700;
  margin-bottom: 0.45rem;
}
h3 {
  font-size: 1.25rem;
  margin-top: 2.6rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--rule);
}
h3 small { font-family: var(--font-sans); font-weight: 400; font-size: 0.78rem; color: var(--ink-muted); letter-spacing: 0; }
h2 small  { font-family: var(--font-sans); font-weight: 400; font-size: 0.85rem; color: var(--ink-muted); letter-spacing: 0; }

hgroup { margin-bottom: 1.6rem; }
hgroup p {
  color: var(--ink-muted);
  font-size: 1rem;
  line-height: 1.55;
  margin-top: 0.5rem;
  max-width: 64ch;
}

p { line-height: 1.6; }
section { margin-bottom: 2rem; }

/* ---------- Links ---------- */
a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 0.05em;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.22em;
  transition: color 0.12s ease, text-decoration-color 0.12s ease;
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
table a, .card, .masthead a, .filter-bar a, .kpi a, footer a, h2 a, h3 a, hgroup a { text-decoration: none; }
table a:hover, h2 a:hover, h3 a:hover { color: var(--accent); }

.muted { color: var(--ink-muted); }
.mono { font-family: var(--font-mono); font-size: 0.92em; font-variant-numeric: tabular-nums; }

/* ---------- Masthead ---------- */
/* ---------- Masthead (sticky, blurred — canvas) ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 0 0 2rem;
  padding: 0;
  max-width: none;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.masthead-inner {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  height: 64px;
}
.masthead-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: none;
  text-decoration: none;
  color: inherit;
}
.masthead-logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  flex: none;
}

/* ---- City switcher (custom in-page dropdown) ---- */
.city-switcher { position: relative; display: inline-flex; }
.city-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  background: var(--paper-soft);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.city-switcher-btn:hover,
.city-switcher.is-open .city-switcher-btn { border-color: var(--accent); }
.city-switcher-pin { color: var(--accent); font-size: 0.6rem; line-height: 1; }
.city-switcher-caret {
  color: var(--ink-muted);
  font-size: 0.55rem;
  transition: transform 0.15s ease;
}
.city-switcher.is-open .city-switcher-caret { transform: rotate(180deg); }
.city-switcher-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  z-index: 1500;
  min-width: 11rem;
  padding: 0.4rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
}
.city-switcher-group {
  margin: 0.4rem 0.55rem 0.2rem;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
}
.city-switcher-group:first-child { margin-top: 0.1rem; }
.city-switcher-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.34rem 0.55rem;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}
.city-switcher-opt:hover {
  background: var(--accent-soft);
  color: var(--ink);
  text-decoration: none;
}
.city-switcher-opt.is-current { color: var(--accent); font-weight: 600; }
.city-switcher-opt.is-current::after { content: "✓"; font-size: 0.75rem; }

/* ---- Navigation progress bar ---- */
.page-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
}
.page-progress.is-active {
  width: 92%;
  opacity: 1;
  transition: width 0.9s cubic-bezier(0.1, 0.7, 0.2, 1), opacity 0.2s ease;
}
.masthead-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding-top: 1px;
  white-space: nowrap;
}
.masthead-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: 1;
}
.masthead-link {
  position: relative;
  padding: 0.5rem 0.7rem;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  line-height: 1.2;
  transition: background 0.12s ease, color 0.12s ease;
}
.masthead-link::after {
  content: "";
  display: block;
  height: 2px;
  border-radius: 2px;
  margin-top: 4px;
  background: transparent;
}
.masthead-link:hover { background: var(--paper-soft); color: var(--ink); }
.masthead-link.is-active { color: var(--ink); }
.masthead-link.is-active::after { background: var(--accent); }

/* Atlas = land/refurb investment map — slight emphasis in the primary nav */
.masthead-link-atlas {
  font-weight: 600;
  letter-spacing: 0.01em;
}
.masthead-link-atlas.is-active {
  color: var(--accent);
}
.masthead-link-atlas.is-active::after {
  background: var(--accent);
}

.masthead-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: none;
}
.masthead-actions .theme-toggle { height: 36px; }
.saved-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 36px;
  padding: 0 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s ease;
}
.saved-btn:hover { border-color: var(--accent); color: var(--ink); }

/* ---------- KPI strip (broadsheet figures) ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0;
  margin: 1.5rem 0 2.25rem;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.kpi {
  padding: 0.95rem 1.1rem 1rem;
  border-right: 1px solid var(--rule);
  background: transparent;
}
.kpi:last-child { border-right: none; }
.kpi .label {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-muted);
  font-weight: 500;
}
.kpi .value {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 0.3rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kpi .value.mono { font-family: var(--font-mono); font-size: 1rem; font-weight: 500; }

.discount-pos { color: var(--accent); font-weight: 600; }
.discount-neg { color: var(--warn);   font-weight: 600; }

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  font-feature-settings: "tnum", "zero";
  margin-bottom: 0.5rem;
}
thead th {
  text-align: left;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}
tbody td {
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
tbody tr { transition: background-color 0.08s ease; }
tbody tr:hover { background: var(--paper-soft); }

table.compact { font-size: 0.88rem; }
table.compact td, table.compact th { padding: 0.45rem 0.55rem; }

/* Right-align the last N columns of a table (N inferred from the class).
   Use right-num-N where N matches how many trailing columns are numeric. */
table.right-num   td:nth-last-child(-n+5), table.right-num   th:nth-last-child(-n+5),
table.right-num-1 td:nth-last-child(-n+1), table.right-num-1 th:nth-last-child(-n+1),
table.right-num-2 td:nth-last-child(-n+2), table.right-num-2 th:nth-last-child(-n+2),
table.right-num-3 td:nth-last-child(-n+3), table.right-num-3 th:nth-last-child(-n+3),
table.right-num-4 td:nth-last-child(-n+4), table.right-num-4 th:nth-last-child(-n+4),
table.right-num-5 td:nth-last-child(-n+5), table.right-num-5 th:nth-last-child(-n+5),
table.right-num-6 td:nth-last-child(-n+6), table.right-num-6 th:nth-last-child(-n+6),
table.right-num-7 td:nth-last-child(-n+7), table.right-num-7 th:nth-last-child(-n+7) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* "th" rows (key/value layout) */
tbody th {
  text-align: left;
  font-weight: 500;
  color: var(--ink-muted);
  font-size: 0.85rem;
  padding: 0.5rem 0.7rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  width: 36%;
}

.sort-link { color: var(--ink-muted); text-decoration: none; font-weight: 500; }
.sort-link.active { color: var(--ink); }
.sort-link:hover { color: var(--accent); }

/* ---------- Listing card grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.75rem 1.5rem;
}
.card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.card:hover { opacity: 0.95; }
.card:hover .price { color: var(--accent); }
.card:hover .photo img { transform: scale(1.025); }

.card .photo {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--paper-soft);
  margin-bottom: 0.75rem;
  border: 1px solid var(--rule);
}
.card .photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.card .photo.no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.card .body { padding: 0; }
.card .card-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin-bottom: 0.35rem;
}
.card-text { padding: 1rem 1.1rem; }
.card-text:hover { background: var(--accent-soft); }
.card .price {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
  transition: color 0.15s ease;
}
.card .price .muted {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.85rem;
}
.card .meta {
  color: var(--ink-muted);
  font-size: 0.84rem;
  margin-top: 0.18rem;
  line-height: 1.45;
}

.badge {
  display: inline-block;
  padding: 0.22rem 0.5rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  margin-top: 0.55rem;
  border-radius: 0;
  font-family: var(--font-sans);
}
.badge-under { background: var(--accent-soft); color: var(--accent-strong); }
.badge-over  { background: var(--warn-soft);   color: var(--warn); }

.spark {
  display: block;
  width: 100%;
  max-width: 320px;
  height: 22px;
  overflow: visible;
}
.spark-figure {
  margin: 1rem 0 0.5rem;
}
.spark-figure figcaption {
  margin-top: 0.4rem;
}
.spark-axis {
  stroke: rgba(0, 0, 0, 0.12);
  stroke-width: 1;
}
.spark-box {
  fill: rgba(0, 0, 0, 0.10);
}
.spark-median {
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 1.5;
}
.spark-dot-under {
  fill: var(--accent-strong);
  stroke: white;
  stroke-width: 1.5;
}
.spark-dot-over {
  fill: var(--warn);
  stroke: white;
  stroke-width: 1.5;
}

.source-cta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin: 1.4rem 0 1.8rem;
}
.source-cta-bottom { margin-top: 2.4rem; }

.nbhd-hero {
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 4px;
  margin: 0.6rem 0 2rem;
  min-height: 180px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.nbhd-hero-inner {
  padding: 1.6rem 1.8rem 1.4rem;
  color: #fff;
  width: 100%;
}
.nbhd-hero-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  opacity: 0.85;
  margin-bottom: 0.5rem;
}
.nbhd-hero h2 {
  color: #fff;
  margin: 0 0 0.35rem;
  font-size: 2rem;
  letter-spacing: -0.01em;
}
.nbhd-hero-meta {
  font-size: 0.95rem;
  opacity: 0.92;
  font-variant-numeric: tabular-nums;
}

/* ---------- Photo gallery (listing detail) ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.4rem;
  margin-top: 0.85rem;
}
.gallery a { display: block; }
.gallery img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border: 1px solid var(--rule);
  transition: opacity 0.15s ease;
}
.gallery a:hover img { opacity: 0.88; }

/* ---------- AI take (editorial pull-quote feel) ---------- */
.ai-take {
  margin-top: 1.5rem;
  padding: 1.15rem 1.35rem 1.25rem;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  position: relative;
}
.ai-take > summary {
  cursor: pointer;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: var(--accent-strong);
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.ai-take > summary::-webkit-details-marker { display: none; }
.ai-take > summary::marker { content: ""; }
.ai-take > summary strong { font-weight: 600; letter-spacing: 0.16em; }
.ai-take > summary small { letter-spacing: 0.04em; text-transform: none; font-weight: 400; color: var(--ink-muted); }
.ai-take[open] > summary { margin-bottom: 0.75rem; }
.ai-take .ai-content {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--ink);
  font-weight: 400;
}
.ai-take .ai-content.loading {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-style: italic;
  color: var(--ink-muted);
}
.ai-take .ai-content.ready { animation: ai-fade-in 0.4s ease-out; }
@keyframes ai-fade-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Article wrapper ---------- */
article {
  margin-bottom: 1.5rem;
}
article > p { margin-bottom: 0.85rem; }
article > p:last-child { margin-bottom: 0; }

.quality-warning {
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--warn);
  background: var(--warn-soft);
}
.quality-warning strong { margin-right: 0.35rem; }

/* ---------- Two-column grid (Pico's `.grid`) ---------- */
section.grid, article.grid, div.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

/* Paragraphs that wrap a button need vertical breathing room
   (otherwise they crash into the next section). .cta-row opts out
   so it can control its own margin. */
p:has(> [role="button"]):not(.cta-row) { margin: 1.25rem 0 1.75rem; }
section.grid > [role="button"] { width: 100%; text-align: center; }

/* ---------- Filter bar ---------- */
.filter-bar {
  padding: 0.85rem 1rem 1rem;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  margin-bottom: 1.75rem;
}
.filter-bar form {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: end;
  margin: 0;
}
.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  font-weight: 500;
}

/* ---------- Form inputs (Pico replacement) ---------- */
input[type="text"],
input[type="number"],
input[type="search"],
input[type="email"],
select,
textarea {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  border-radius: 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  min-width: 0;
  width: auto;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 1.6rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
input::placeholder { color: var(--ink-faint); }

/* ---------- Buttons ---------- */
button,
[role="button"] {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.55rem 1.1rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  cursor: pointer;
  border-radius: 0;
  text-decoration: none;
  display: inline-block;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
button:hover,
[role="button"]:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
[role="button"].outline,
[role="button"].secondary,
[role="button"].contrast {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
[role="button"].outline:hover,
[role="button"].secondary:hover,
[role="button"].contrast:hover {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- Lists (about page etc.) ---------- */
main ul:not(.masthead-links) {
  list-style: square;
  padding-left: 1.2rem;
  margin-bottom: 1rem;
  max-width: 70ch;
}
main ul:not(.masthead-links) li {
  padding: 0.18rem 0;
  line-height: 1.55;
}
main ul:not(.masthead-links) li::marker { color: var(--accent); }

/* ---------- Footer ---------- */
footer.container {
  margin-top: 4rem;
  padding-bottom: 2.5rem;
}
.footer-rule {
  height: 1px;
  background: var(--rule);
  margin-bottom: 1rem;
}
footer small {
  font-size: 0.78rem;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

/* ============================================================
   Tooltip — hover an inline label, get a definition
   Use:  <span class="tip" data-tip="…">label</span>
   ============================================================ */
.tip {
  position: relative;
  border-bottom: 1px dotted var(--ink-faint);
  cursor: help;
  font-weight: inherit;
  white-space: normal;
}
.tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 400;
  font-style: normal;
  text-transform: none;
  letter-spacing: 0.01em;
  line-height: 1.5;
  padding: 0.7rem 0.85rem;
  width: max-content;
  max-width: 300px;
  z-index: 20;
  box-shadow: 0 6px 18px rgba(26, 22, 17, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.tip:hover::after,
.tip:focus::after { opacity: 1; transform: translateY(0); }

/* ---------- Confidence / quality labels ---------- */
.conf {
  font-weight: 500;
  font-size: 0.88rem;
}
.conf-strong { color: var(--accent); }
.conf-mid    { color: #a06b15; }
.conf-weak   { color: var(--warn); }

/* ============================================================
   Landing-page elements: hero, markets, country tiles
   ============================================================ */

/* ---------- Hero ---------- */
.hero {
  padding: 1rem 0 3rem;
  max-width: 56ch;
}
.hero-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 1.85rem;
  color: var(--ink);
}
.hero-mark::before, .hero-mark::after {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--ink);
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 4vw + 1.2rem, 3.85rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--ink);
  margin-bottom: 1.1rem;
}
.hero-sub {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--ink-soft);
  font-weight: 400;
  font-style: italic;
  max-width: 52ch;
}

/* ---------- Markets section ---------- */
.markets { margin: 2rem 0 3.5rem; }
.markets-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--ink);
}
.markets-head h2 {
  font-size: 1.55rem;
  font-weight: 600;
  margin-bottom: 0;
}
.markets-head .markets-meta {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-muted);
  font-weight: 500;
}

.market-country { margin-bottom: 2.25rem; }
.market-country:last-child { margin-bottom: 0; }
.market-country-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}
.market-country-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.market-country-meta {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-muted);
  font-weight: 500;
}

.market-cities {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.market-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid var(--rule);
  background: var(--card);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  min-height: 110px;
}
.market-card:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(26, 22, 17, 0.06);
}
.market-card.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.market-card.active:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.market-card-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.market-card-stat {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  margin-top: 0.45rem;
}
.market-card.active .market-card-stat { color: rgba(250, 247, 240, 0.75); }
.market-card-status {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  font-weight: 600;
  margin-top: 0.45rem;
}
.market-card.active .market-card-status {
  color: var(--paper);
  opacity: 0.7;
}
.market-card-arrow {
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  opacity: 0.7;
  font-weight: 400;
}

/* ---------- Lede (headline signal under spotlight) ---------- */
.lede { margin-bottom: 2.75rem; }
.lede-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}
.lede-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.lede-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
  padding: 0;
  border: none;
}
.lede-more {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.2rem;
  white-space: nowrap;
}
.lede-more:hover { color: var(--accent); border-bottom-color: var(--accent); }
.lede-sub {
  color: var(--ink-muted);
  font-size: 0.92rem;
  max-width: 64ch;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

/* ---------- CTA row at the bottom of long pages ---------- */
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin: 1.5rem 0 2.5rem;
}
.cta-row [role="button"] { margin: 0; }

/* ---------- Spotlight section header ---------- */
.spotlight-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 3rem 0 1.5rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--ink);
}
.spotlight-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.spotlight-head h2 { font-size: 1.85rem; margin: 0; }
.spotlight-head .spotlight-meta {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-muted);
  font-weight: 500;
}

/* ---------- Coming-soon stub ---------- */
.coming-soon {
  padding: 3.5rem 0 4rem;
  max-width: 56ch;
}
.coming-soon-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 1rem;
}
.coming-soon h2 {
  font-size: clamp(2.2rem, 3.5vw + 1rem, 3.2rem);
  font-weight: 700;
  margin-bottom: 0.7rem;
}
.coming-soon-sub {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--ink-soft);
  font-weight: 400;
  font-style: italic;
  margin-bottom: 1.75rem;
  max-width: 52ch;
}
.coming-soon-back {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.2rem;
}
.coming-soon-back:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Responsive nudges ---------- */
@media (max-width: 720px) {
  .masthead-inner { gap: 0.75rem; }
  .masthead-nav {
    gap: 0.05rem;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .masthead-nav::-webkit-scrollbar { display: none; }
  .masthead-link { padding: 0.5rem 0.5rem; white-space: nowrap; }
  .masthead-title { font-size: 1.1rem; }
  h2 { font-size: 1.85rem; }
  .kpi .value { font-size: 1.4rem; }
  main.container { padding-top: 1.25rem; }
}

/* ============================================================
   NEW LAYER · sortable tables, scored cards, verdict panel, etc.
   Everything below was added in the May 2026 readability pass —
   the goal is to make the editorial broadsheet *skim* faster
   without breaking the broadsheet identity.
   ============================================================ */

/* ---------- Compact hero (homepage) ----------
   The old .hero had a duplicate "Balkans RE" wordmark above the
   H1 even though the masthead already shows the brand. Removed
   on the homepage; this variant just tightens spacing. */
.hero-compact { padding: 0.25rem 0 2rem; }
.hero-compact .hero-title { margin-bottom: 0.6rem; }

/* ---------- Eyebrow utility (used on muni-detail) ---------- */
.eyebrow {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

/* ---------- Breadcrumbs ---------- */
.breadcrumb { margin-bottom: 0.6rem; }
.breadcrumb a { text-decoration-color: var(--rule); }

/* ---------- Sortable table headers ---------- */
.sort-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15rem;
  color: var(--ink-muted);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  padding: 0 0;
}
.sort-link:hover { color: var(--accent); }
.sort-link.active { color: var(--ink); }
.sort-link.active::before {
  content: "";
  display: inline-block;
  width: 4px; height: 4px;
  background: var(--accent);
  margin-right: 0.45rem;
  border-radius: 50%;
}
.sort-arrow {
  font-family: var(--font-sans);
  font-size: 0.78em;
  margin-left: 0.05em;
  color: var(--accent);
}

/* ---------- Sticky table heads ----------
   Tables with .sticky-head keep their header row pinned while the
   user scrolls long lists. Pairs with .table-wrap for mobile. */
table.sticky-head thead th {
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 2;
  /* sticky cells lose their bottom border in some browsers — use a box-shadow line */
  box-shadow: inset 0 -1px 0 var(--ink);
}

/* ---------- Table wrap (mobile horizontal scroll) ----------
   Wide tables (search results, neighborhoods) horizontal-scroll
   silently when the viewport gets narrow. The wrapper makes that
   scroll visible and gives sticky thead a positioning context. */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0.5rem;
}
.table-wrap > table { min-width: 100%; }

/* ---------- Municipality link emphasis ----------
   Inside dense tables it isn't obvious that the muni cell is
   clickable. A dotted underline + slightly darker hover signals
   it's a real drill-down to /municipalities/<slug>. */
.muni-link {
  text-decoration: underline dotted;
  text-decoration-color: var(--ink-faint);
  text-underline-offset: 0.22em;
  font-weight: 500;
}
.muni-link:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* Make the neighborhood-hero municipality eyebrow visibly clickable too. */
.nbhd-hero-muni {
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-color: rgba(255,255,255,0.6);
  text-underline-offset: 0.25em;
}
.nbhd-hero-muni:hover { color: #fff; text-decoration-color: #fff; }

/* ---------- Filter bar polish ---------- */
.filter-hint {
  align-self: center;
  font-size: 0.72rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-faint);
  font-weight: 400;
}
.result-count {
  margin-top: -0.5rem;
  margin-bottom: 0.85rem;
  font-size: 0.85rem;
}

/* ---------- Scored card (used on /underpriced, /overpriced, index, muni) ----------
   Lead with the delta — it's the actual signal — then title, price,
   then the box-plot bar showing where this listing sits in the
   comp distribution. The whole card is one big link. */
.scored-card {
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.15rem 1.15rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left-width: 3px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s ease, transform 0.15s ease, box-shadow 0.15s ease, background 0.12s ease;
}
.scored-card:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(26, 22, 17, 0.06);
  background: var(--paper-soft);
}
.scored-card-under { border-left-color: var(--accent); }
.scored-card-over  { border-left-color: var(--warn); }

.scored-card-delta {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  margin-bottom: 0.4rem;
}
.scored-card-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.scored-card-muni {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  margin-top: 0.15rem;
  font-weight: 500;
}
.scored-card-price {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 0.65rem;
}
.scored-card-price .muted {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.85rem;
}
.scored-card-bar {
  margin-top: 0.65rem;
  margin-bottom: 0.15rem;
}
.scored-card-bar .spark {
  max-width: 100%;
  height: 22px;
}
.scored-card-foot {
  margin-top: 0.55rem;
  line-height: 1.45;
}

/* ---------- Verdict panel (listing detail, top of page) ----------
   The whole product proposition is "this listing sits at X vs the
   comps". That belongs above the fold on the listing page, not
   tucked inside a paragraph of analysis prose. */
.verdict {
  margin: 0.6rem 0 1.4rem;
  padding: 1.1rem 1.3rem 1.2rem;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--ink);
}
.verdict-under { border-left-color: var(--accent); background: var(--accent-soft); }
.verdict-over  { border-left-color: var(--warn);   background: var(--warn-soft); }
.verdict-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.verdict-head {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.verdict-delta {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2rem, 3vw + 0.5rem, 2.85rem);
  line-height: 1.0;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.verdict-delta small {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  margin-top: 0.25rem;
}
.verdict-body { flex: 1 1 280px; min-width: 0; }
.verdict-line { font-size: 1rem; margin-bottom: 0.4rem; }
.verdict-note { font-size: 0.92rem; color: var(--ink-soft); margin-top: 0.4rem; }
.verdict-spark {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.3rem 0 0.2rem;
}
.verdict-spark .spark { width: 200px; height: 24px; }
.verdict-spark small { font-size: 0.72rem; }

/* ---------- AI-take skeleton (replaces verbose loading sentence) ---------- */
.ai-content.loading {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.skeleton-line {
  display: block;
  height: 0.95em;
  width: 100%;
  background: linear-gradient(90deg, rgba(0,0,0,0.06) 0%, rgba(0,0,0,0.12) 50%, rgba(0,0,0,0.06) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 2px;
}
.skeleton-line-short { width: 65%; }
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Coverage roadmap compact (homepage bottom) ----------
   The "Markets" section used to be huge tiles at the top of the
   homepage even though only Belgrade is live. Demoted to a slim
   chip row below the actual content. */
.markets-compact { margin: 3.5rem 0 1.5rem; }
.markets-compact .markets-head { margin-bottom: 1rem; padding-bottom: 0.4rem; }
.markets-compact .markets-head h3 {
  font-size: 1rem;
  margin: 0;
  padding: 0;
  border: none;
  font-family: var(--font-serif);
  font-weight: 600;
}
.market-country-slim { margin-bottom: 1.2rem; }
.market-country-slim .market-country-head {
  margin-bottom: 0.55rem;
  padding-bottom: 0.25rem;
}
.market-country-slim .market-country-name { font-size: 1rem; }
.market-chip-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, max-content));
  gap: 0.45rem;
  padding: 0;
  margin: 0;
  align-items: center;
  justify-content: start;
}
/* Let the <a> chip participate in the grid directly — wrapping <li> boxes
   were still stretching to full column width in some browsers. */
.market-chip-list > li {
  list-style: none;
  margin: 0;
  padding: 0;
  display: contents;
}
.market-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--rule);
  background: var(--card);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.market-chip:hover { border-color: var(--ink); }
.market-chip-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.market-chip-active:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Confidence inline badge (used in listing-detail subtitle) ---------- */
.conf {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  border-radius: 2px;
  background: rgba(0,0,0,0.04);
}
.conf-strong { color: var(--accent-strong); background: var(--accent-soft); }
.conf-mid    { color: #8a5b15; background: rgba(160, 107, 21, 0.12); }
.conf-weak   { color: var(--warn); background: var(--warn-soft); }

/* ---------- Mobile: hide low-priority columns on narrow tables ---------- */
@media (max-width: 720px) {
  .scored-card-delta { font-size: 1.4rem; }
  .verdict-head { gap: 0.85rem; }
  .verdict-delta { font-size: 1.85rem; }
  .filter-bar form { gap: 0.6rem; }
  .filter-hint { display: none; }
}

/* ============================================================
   REDESIGN LAYER 2 · histograms, dark mode, /browse, watchlist
   Added during the second pass. The product surfaces went from
   three sibling pages (under/over/search) to one /browse view +
   richer detail pages with EUR/m² distributions.
   ============================================================ */

/* ---------- Theme toggle button (masthead) ---------- */
.theme-toggle {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  letter-spacing: 0;
  text-transform: none;
  transition: color 0.12s ease, border-color 0.12s ease;
  line-height: 1;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--rule); background: transparent; }
.theme-toggle .theme-toggle-dark { display: none; }
.theme-toggle .theme-toggle-light { display: inline; }
:root[data-theme="dark"] .theme-toggle .theme-toggle-light { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-toggle-dark { display: inline; }

/* Push the toggle a touch up so it baselines with the link row. */
.masthead-links button { padding-top: 0; padding-bottom: 0; }

/* ---------- Watchlist nav badge ---------- */
.watchlist-nav { align-items: center; gap: 0.22em; }
.watchlist-nav .watchlist-star { font-size: 0.9em; color: var(--ink-muted); }
.watchlist-nav:hover .watchlist-star { color: var(--accent); }
.watchlist-count {
  display: inline-block;
  background: var(--accent);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.3rem;
  border-radius: 999px;
  margin-left: 0.2em;
  min-width: 1.05em;
  text-align: center;
  line-height: 1.2;
}

/* ---------- Footer row (about link + meta) ---------- */
.footer-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-links a {
  font-size: 0.78rem;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.22em;
}

/* ---------- Hero CTA pair ---------- */
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.2rem; }

/* ---------- City-wide histogram block ---------- */
.city-hist {
  margin: 1.6rem 0 2.4rem;
  padding: 1rem 1.1rem 0.8rem;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
}
.city-hist-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.city-hist-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
  padding: 0;
  border: none;
}
.city-hist-figure { margin: 0; }
.city-hist-figure figcaption { margin-top: 0.35rem; }
.city-hist-figure .histogram {
  width: 100%;
  height: auto;
  max-height: 140px;
}

.market-context-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.market-context h4 {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--ink-muted);
}
.market-context p,
.market-context ul {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
}
.market-context ul {
  padding-left: 1.1rem;
}
.market-context-note {
  margin-top: 0.85rem;
  color: var(--ink-muted);
}
.market-context-note span::before {
  content: " ";
}

/* SVG building blocks for histogram_svg() in web.py. Colors come from
   CSS variables so they re-theme automatically in dark mode. */
.histogram .hist-bar { fill: var(--hist-bar); }
.histogram .hist-bar-median { fill: var(--accent); }
.histogram .hist-axis { stroke: var(--rule); stroke-width: 1; }
.histogram .hist-median {
  stroke: var(--ink);
  stroke-width: 1.8;
}
.histogram .hist-iqr {
  stroke: var(--ink-muted);
  stroke-width: 1.4;
  stroke-dasharray: 5 3;
  opacity: 0.85;
}
.histogram .hist-mark {
  stroke: var(--accent);
  stroke-width: 2.2;
}
.histogram .hist-label {
  fill: var(--ink-muted);
  font-family: var(--font-sans);
  font-size: 9.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.histogram .hist-label-mid { fill: var(--ink); font-weight: 600; }
.histogram .hist-label-iqr {
  fill: var(--ink-soft);
  font-weight: 600;
  font-size: 8.5px;
  letter-spacing: 0.12em;
}
.histogram .hist-label-mark { fill: var(--accent); font-weight: 600; }

/* ---------- Segmented control (under/over/all on /browse) ---------- */
.segmented {
  display: inline-flex;
  border: 1px solid var(--ink);
  margin: 0 0 1.3rem;
  flex-wrap: wrap;
}
.segmented-option {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: var(--ink);
  border-right: 1px solid var(--ink);
  background: transparent;
  transition: background 0.12s ease, color 0.12s ease;
}
.segmented-option:last-child { border-right: none; }
.segmented-option:hover { background: var(--paper-soft); color: var(--accent); }
.segmented-option.is-active {
  background: var(--ink);
  color: var(--paper);
}
.segmented-count {
  display: inline-block;
  margin-left: 0.4em;
  font-size: 0.7em;
  color: inherit;
  opacity: 0.7;
}

/* ---------- View toggle (cards / table) ---------- */
.view-toggle { display: inline-flex; gap: 0; border: 1px solid var(--rule); }
.view-toggle-option {
  padding: 0.3rem 0.7rem;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--ink-muted);
  text-decoration: none;
  border-right: 1px solid var(--rule);
}
.view-toggle-option:last-child { border-right: none; }
.view-toggle-option:hover { color: var(--accent); }
.view-toggle-option.is-active { background: var(--ink); color: var(--paper); }

/* ---------- Result bar (between filter + content) ---------- */
.result-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin: 0 0 1.1rem;
}
.result-bar .result-count { margin: 0; }

/* ---------- Collapsible filter bar (replaces always-visible bar) ---------- */
.filter-bar-collapsible {
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  margin-bottom: 1.1rem;
}
.filter-bar-collapsible > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.7rem 1rem;
  display: flex;
  gap: 0.85rem;
  align-items: baseline;
  flex-wrap: wrap;
  font-family: var(--font-sans);
}
.filter-bar-collapsible > summary::-webkit-details-marker { display: none; }
.filter-bar-collapsible > summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 0.85em;
}
.filter-bar-collapsible[open] > summary::after { content: "▴"; }
.filter-bar-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
}
.filter-bar-summary { font-size: 0.85rem; }
.filter-form {
  padding: 0.4rem 1rem 1rem;
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  align-items: end;
  margin: 0;
}
.filter-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  font-weight: 500;
}
.filter-location input { min-width: min(22rem, 72vw); }
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  font-weight: 500;
}
.filter-field-rooms {
  min-width: min(34rem, 100%);
}
/* Keep the boolean toggles (Registered / Developer direct) as their own
   captioned block so they don't read as extra room-band options. */
.filter-field-flags {
  min-width: min(20rem, 100%);
}
.filter-field-label {
  display: block;
}
.filter-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: center;
  padding-top: 0.1rem;
}
.filter-actions { display: inline-flex; gap: 0.6rem; align-items: center; }
.filter-reset {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  text-decoration: underline;
  text-decoration-color: var(--rule);
}
.filter-reset:hover { color: var(--accent); }

/* ---------- Empty state ---------- */
.empty-state {
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--rule);
  background: var(--paper-soft);
  text-align: center;
  margin: 1.5rem 0 2rem;
}
.empty-state p { margin: 0.4rem auto; max-width: 50ch; }
.empty-state p:first-child { font-family: var(--font-serif); font-size: 1.1rem; color: var(--ink-soft); }

/* ---------- Scored card · stretched-link rebuild ----------
   The card itself is now an <article>; the anchor stretches across
   it via position:absolute. The star button sits in the top-right
   corner with a higher z-index so it stays clickable. */
.scored-card { position: relative; }
.scored-card-link {
  position: absolute;
  inset: 0;
  text-indent: -9999px;
  z-index: 1;
}
.scored-card > :not(.scored-card-link):not(.watch-star) {
  position: relative;
  z-index: 2;
  pointer-events: none;   /* let the link catch the click underneath */
}
.scored-card .watch-star {
  position: absolute;
  top: 0.55rem;
  right: 0.6rem;
  z-index: 3;
}
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ---------- Star button ---------- */
.watch-star {
  font-family: var(--font-sans);
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 0.18rem 0.35rem;
  font-size: 1.1rem;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  border-radius: 2px;
  transition: color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}
.watch-star:hover { color: var(--accent); background: var(--paper-soft); }
.watch-star.is-watched { color: var(--accent); background: var(--accent-soft); }
.watch-star.is-watched:hover { color: var(--accent-strong); }
.watch-star-lg {
  font-size: 1rem;
  padding: 0.45rem 0.85rem;
  color: var(--ink);
  border: 1px solid var(--ink);
  background: transparent;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  font-size: 0.74rem;
}
.watch-star-lg.is-watched {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.watch-star-lg .watch-star-label { margin-left: 0.4em; font-weight: 600; }
.watch-star-table {
  padding: 0.1rem 0.4rem;
  font-size: 1rem;
}
.watch-cell { width: 2.2rem; }
.watch-star-inline {
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Listing detail header (title + watchlist button row) ---------- */
.listing-head {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.listing-head-main { flex: 1 1 360px; min-width: 0; }
.listing-head .watch-star-lg { flex: 0 0 auto; }

/* ---------- Eyebrow link variant (used on nbhd_detail) ---------- */
.eyebrow-link {
  color: var(--ink-muted);
  text-decoration: underline dotted;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.22em;
}
.eyebrow-link:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ---------- About page two-col ---------- */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin: 1.5rem 0 2rem;
}
.about-grid h3 { margin-top: 0; }
.about-markets { margin-top: 2.5rem; }

/* ---------- Watchlist toolbar ---------- */
.watchlist-toolbar { margin: 1rem 0 1.5rem; }

/* ---------- Dark-mode-specific overrides ----------
   Most colors already swap via CSS variables, but a few effects use
   rgba() with hardcoded blacks — re-tune those here. */
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .scored-card { box-shadow: none; }
:root[data-theme="dark"] .scored-card:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
:root[data-theme="dark"] .spark-axis  { stroke: rgba(255,255,255,0.16); }
:root[data-theme="dark"] .spark-box   { fill:   rgba(255,255,255,0.18); }
:root[data-theme="dark"] .spark-median{ stroke: rgba(255,255,255,0.7); }
:root[data-theme="dark"] .spark-dot-under { stroke: var(--paper); }
:root[data-theme="dark"] .spark-dot-over  { stroke: var(--paper); }
:root[data-theme="dark"] .market-card.active { background: var(--ink-soft); }
:root[data-theme="dark"] .nbhd-hero-inner { color: var(--ink); }

/* Masthead bottom border uses var(--rule), which is already dark-aware. */

/* Form inputs in dark mode need a darker background; the default white
   card color is fine because --card is re-themed, but we want a stronger
   border. */
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="number"],
:root[data-theme="dark"] input[type="search"],
:root[data-theme="dark"] input[type="email"],
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: var(--paper-soft);
  border-color: var(--rule);
}

/* ---------- Regional coverage strip (bottom of homepage) ----------
   Slim, country-grouped chip rows. Signals "this is a regional product"
   without taking prime real estate. Used to live at the top — moved
   here because empty-tile coverage was competing with the live data. */
.coverage-strip {
  margin: 3rem 0 1rem;
  padding: 1.4rem 0 0;
  border-top: 1px solid var(--rule);
}
.coverage-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem;
  margin-bottom: 1.1rem;
  max-width: 64ch;
}
.coverage-head .eyebrow { margin: 0; }
.coverage-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  padding: 0;
  border: none;
}
.coverage-sub { font-size: 0.92rem; margin: 0.2rem 0 0; line-height: 1.5; }
.coverage-countries {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem 2rem;
  align-items: start;
}
@media (min-width: 768px) {
  .coverage-countries {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.coverage-country {
  min-width: 0;
}
.coverage-country-name {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 0.55rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--rule);
}

/* ---------- Compact key/value tables (label + value rows) ----------
   Used in listing-detail's "Listing details" and "Neighborhood context"
   panels. Not wrapped in .table-wrap so they don't get a stray
   horizontal scrollbar; instead, long values wrap inside the value cell. */
table.kv-table { width: 100%; table-layout: fixed; }
table.kv-table th {
  width: 38%;
  white-space: nowrap;
  vertical-align: top;
}
table.kv-table td {
  word-break: break-word;
  overflow-wrap: anywhere;
  vertical-align: top;
}

/* ---------- Comparable-table per-row delta vs this listing ---------- */
.comp-delta-up   { color: var(--warn); font-weight: 600; font-variant-numeric: tabular-nums; }
.comp-delta-down { color: var(--accent-strong); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- "vs city" deviation cell (homepage neighborhood tables) ----------
   Shows how much a neighborhood's median EUR/m² deviates from the city
   median. Signed percent — negative renders in the same green as
   underpriced rows, positive in the same orange as overpriced rows.
   Tabular-num so the +/− line up across rows. */
.vs-city {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---------- No-baseline empty state on listing detail ---------- */
.no-baseline {
  margin: 0.6rem 0 1.4rem;
  padding: 1rem 1.2rem;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--ink-faint);
}
.no-baseline-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.no-baseline p { margin: 0.2rem 0; font-size: 0.95rem; line-height: 1.5; }

/* ---------- Stronger card hover (clearer feedback) ---------- */
.scored-card-under:hover { border-left-color: var(--accent-strong); }
.scored-card-over:hover  { border-left-color: var(--warn); }

/* ---------- Raw card variant (no comp baseline) ----------
   Used by the "All listings" segment that absorbed /search. These rows
   don't have a discount delta, so we suppress the colored left border
   and de-emphasize the delta slot. */
.scored-card-raw { border-left-color: var(--rule); }
.scored-card-raw:hover { border-left-color: var(--ink-faint); }
.scored-card-delta-raw {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  font-weight: 600;
}

/* ---------- Rental cards ---------- */
.rental-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.rental-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 185px;
  padding: 1.1rem 1.15rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ink);
  transition: border-color 0.12s ease, transform 0.15s ease, box-shadow 0.15s ease, background 0.12s ease;
}
.rental-card:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(26, 22, 17, 0.06);
  background: var(--paper-soft);
}
.rental-card > :not(.scored-card-link) {
  position: relative;
  z-index: 2;
  pointer-events: none;
}
.rental-card-rent {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.rental-card-rent small {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-left: 0.2rem;
}
.rental-card-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.25;
}
.rental-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.2rem;
}
.rental-card-meta span {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--ink-muted);
  border: 1px solid var(--rule);
  padding: 0.14rem 0.35rem;
}

/* ---------- Freshness / change signals ---------- */
.price-drop-badge {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  margin-top: 0.55rem;
  padding: 0.45rem 0.55rem;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  color: var(--accent-strong);
  font-size: 0.78rem;
  line-height: 1.35;
}
.price-drop-badge strong {
  font-family: var(--font-mono);
  font-size: 0.86em;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.table-badge {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.freshness-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.3rem;
}
.freshness-col {
  border-top: 2px solid var(--ink);
  padding-top: 0.85rem;
}
.freshness-col h4 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  margin-bottom: 0.65rem;
}
.freshness-list {
  list-style: none;
  display: grid;
  gap: 0.7rem;
}
.freshness-list li {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.7rem;
}
.freshness-list a {
  display: block;
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}
.freshness-list small {
  display: block;
  margin-top: 0.15rem;
  color: var(--ink-muted);
}
.change-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
  margin: 1rem 0 1.1rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.change-controls label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
}
.change-controls input,
.change-controls select {
  min-height: 2.1rem;
}
.change-window {
  margin: 0.5rem 0 1rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}
.change-list {
  display: grid;
  border-top: 1px solid var(--ink);
}
.change-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}
.change-label {
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.change-title {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
}
.change-meta {
  margin-top: 0.25rem;
  color: var(--ink-muted);
  font-size: 0.86rem;
}
.change-metric {
  min-width: 10rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.change-metric strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1.1;
}
.change-metric span {
  display: block;
  margin-top: 0.15rem;
  color: var(--ink-muted);
  font-size: 0.82rem;
}
.status-pill {
  display: inline-block;
  padding: 0.08rem 0.45rem;
  border: 1px solid var(--rule);
  background: var(--paper-soft);
  color: var(--ink-muted);
  font-size: 0.82em;
}
.status-pill-retired {
  border-color: var(--warn);
  color: var(--warn);
  background: var(--warn-soft);
}
.status-banner {
  margin: 0.6rem 0 1.2rem;
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--ink-faint);
  background: var(--paper-soft);
}
.status-banner-retired { border-left-color: var(--warn); }
.status-banner span { color: var(--ink-muted); }
.kpi-grid.is-retired .kpi:nth-child(-n+2) .value {
  opacity: 0.62;
  text-decoration: line-through;
  text-decoration-thickness: 0.06em;
}
.history-drop { background: var(--accent-soft); }

/* ---------- Mobile niceties ---------- */
@media (max-width: 720px) {
  .segmented { width: 100%; }
  .segmented-option { flex: 1 1 0; text-align: center; padding-left: 0.5rem; padding-right: 0.5rem; }
  .freshness-grid { grid-template-columns: 1fr; }
  .change-controls { align-items: stretch; }
  .change-controls label, .change-controls button { flex: 1 1 100%; }
  .change-row { grid-template-columns: 1fr; }
  .change-metric { min-width: 0; text-align: left; }
  .listing-head { gap: 0.6rem; }
  .watch-star-lg .watch-star-label { display: none; }
  .city-hist-head { gap: 0.4rem; }
  .city-hist-figure .histogram { max-height: 110px; }
  .market-context-grid { grid-template-columns: 1fr; }
  .hero-cta { flex-direction: column; }
  .hero-cta > [role="button"] { width: 100%; text-align: center; }

  /* Masthead shrink handled in the 720px block above (sticky single-row
     bar with a horizontally-scrolling nav). */

  .coverage-head { gap: 0.2rem; }
  .coverage-title { font-size: 1.15rem; }
  .coverage-countries { gap: 0.85rem; }
}

/* ============================================================
   Signal chips, trend lines, compare + afford pages
   ============================================================ */

/* ---------- Signal chips (uknjižen + days-on-market) ----------
   Used on listing cards (browse, homepage widgets) and inline on the
   listing-detail hero. Chips read at a glance with a soft outline so
   they're informational, not action-priority. */
.signal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.45rem;
  margin-top: 0.45rem;
}
.signal-chips:empty { display: none; }
.signal-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--rule);
  background: var(--paper-soft);
  color: var(--ink-muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
  white-space: nowrap;
  border-radius: 1px;
}
.signal-chip-registered {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent);
}
.signal-chip-unregistered {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn);
}
.signal-chip-dom-fresh {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent);
}
.signal-chip-dom-aging {
  color: #8a5b15;
  background: rgba(160, 107, 21, 0.10);
  border-color: rgba(160, 107, 21, 0.45);
}
.signal-chip-dom-stale {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn);
}
:root[data-theme="dark"] .signal-chip-dom-aging {
  color: #d9b066;
  background: rgba(217, 176, 102, 0.12);
  border-color: rgba(217, 176, 102, 0.5);
}

/* ---------- Opportunity badge ----------------------------------------
   Plain-language verdict pill (opportunity.py). Worth checking = accent
   green, High premium = brick warn, Thin data = amber caution, Fair =
   quiet neutral. The score rides in a slightly inset chip on the right. */
.opportunity-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  padding: 0.25rem 0.6rem;
  margin-bottom: 0.5rem;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  text-transform: none;
  line-height: 1.4;
  white-space: nowrap;
}
.opportunity-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--opp-dot, currentColor);
  flex: none;
}
.opportunity-badge-score {
  font-variant-numeric: tabular-nums;
  font-size: 0.76rem;
  font-weight: 600;
  padding-left: 0.4rem;
  margin-left: 0.1rem;
  border-left: 1px solid currentColor;
  opacity: 0.7;
}
.opportunity-worth   { color: var(--opp-good-fg); background: var(--opp-good-bg); --opp-dot: var(--opp-good-dot); }
.opportunity-fair    { color: var(--opp-fair-fg); background: var(--opp-fair-bg); --opp-dot: var(--opp-fair-dot); }
.opportunity-premium { color: var(--opp-prem-fg); background: var(--opp-prem-bg); --opp-dot: var(--opp-prem-dot); }
.opportunity-thin    { color: var(--opp-thin-fg); background: var(--opp-thin-bg); --opp-dot: var(--opp-thin-dot); }
.verdict-opportunity { margin-bottom: 0.4rem; }
.opportunity-reasons {
  list-style: none;
  margin: 0 0 0.8rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--ink-muted);
}
.opportunity-reasons li { position: relative; padding-left: 0.85rem; }
.opportunity-reasons li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ---------- Similar listings rail (listing detail) -------------------- */
.similar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
  margin: 0.6rem 0 1.6rem;
}
.similar-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left-width: 3px;
}
.similar-card-loc {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  font-weight: 600;
}
.similar-card-specs {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--ink-muted);
}
.similar-card-price {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.similar-card-price span { font-family: var(--font-sans); font-size: 0.78rem; margin-left: 0.35rem; }
.similar-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
  margin-top: 0.2rem;
  font-size: 0.8rem;
}

/* Table-row badge variants align with the chip tones above. */
.table-badge-registered {
  color: var(--accent-strong);
}
.table-badge-dom-fresh    { color: var(--accent-strong); }
.table-badge-dom-aging    { color: #8a5b15; }
.table-badge-dom-stale    { color: var(--warn); }
:root[data-theme="dark"] .table-badge-dom-aging { color: #d9b066; }

/* Listing-detail head chip row inherits the same chip class set. */
.listing-head-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin-top: 0.6rem;
}
.listing-head-chips:empty { display: none; }

/* Filter toggle (checkbox + label) used by browse + afford forms. */
.filter-toggle {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.45rem;
  min-height: 2.05rem;
  white-space: nowrap;
}
.filter-toggle input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* ---------- Neighborhood trend chart ---------- */
.trendline {
  width: 100%;
  height: auto;
  max-height: 200px;
}
.trend-axis      { stroke: var(--rule); stroke-width: 1; }
.trend-axis-label{
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--ink-muted);
}
.trend-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.trend-dot     { fill: var(--accent); }
.trend-dot-end { fill: var(--accent-strong); stroke: var(--paper); stroke-width: 1.5; }

.nbhd-trend figcaption { margin-top: 0.4rem; }

/* ---------- Compare page ---------- */
.kpi-grid-compare {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.1rem;
}
.kpi-compare-meta {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  line-height: 1.4;
}
.compare-band-table th,
.compare-band-table td {
  vertical-align: top;
}
.compare-band-table tbody th {
  font-weight: 500;
  color: var(--ink-soft);
}
.compare-munis {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.6rem;
  margin-top: 1.6rem;
}
.compare-munis h3 {
  margin-top: 0.6rem;
}
.cta-row {
  margin-top: 0.8rem;
}

/* ---------- Afford page ---------- */
.afford-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 1.2rem 0 1.6rem;
  padding: 1.2rem 1.3rem;
  border: 1px solid var(--rule);
  background: var(--paper-soft);
}
.afford-form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.9rem 1.2rem;
}
.afford-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-weight: 600;
  letter-spacing: 0.03em;
}
.afford-form input,
.afford-form select {
  min-height: 2.4rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.95rem;
}
.afford-form-budget input {
  font-size: 1.1rem;
  font-weight: 600;
  min-width: 12rem;
}
.afford-form-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.afford-form-actions button {
  padding: 0.55rem 1.3rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.afford-form-actions button:hover { background: var(--ink-soft); }
.kpi-grid-afford {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.afford-group {
  margin: 2rem 0 1.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.afford-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}
.afford-group-title {
  font-size: 1.45rem;
  margin: 0.2rem 0 0;
  padding: 0;
  border: 0;
}
.afford-group-title a {
  text-decoration: none;
  color: var(--ink);
  background: linear-gradient(transparent 62%, var(--accent-soft) 62%);
}
.afford-empty {
  padding: 1.4rem 0;
  border-top: 1px solid var(--rule);
}
.afford-steps {
  margin: 1rem 0 0 1.2rem;
  display: grid;
  gap: 0.55rem;
  line-height: 1.55;
}
.afford-truncation {
  margin: 0 0 1.4rem;
  padding: 0.75rem 0.9rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  font-size: 0.92rem;
  line-height: 1.5;
}
.afford-truncation a {
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Afford: preferred-municipality checklist ---------- */
.afford-muni-picker {
  margin: 0 0 1.25rem;
  border: 1px solid var(--rule);
  background: var(--paper-soft);
}
.afford-muni-picker > summary {
  padding: 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  cursor: pointer;
  list-style: none;
}
.afford-muni-picker > summary::-webkit-details-marker { display: none; }
.afford-muni-picker[open] > summary {
  border-bottom: 1px solid var(--rule);
}
.afford-muni-picker-body {
  padding: 0.85rem 1rem 1rem;
}
.afford-muni-picker-hint {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  line-height: 1.45;
}
.afford-muni-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  margin-bottom: 0.75rem;
}
.afford-muni-picker-actions button {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink-muted);
  cursor: pointer;
}
.afford-muni-picker-actions button:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.afford-muni-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.35rem;
}
.afford-muni-check {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: start;
  gap: 0.1rem 0.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.88rem;
}
.afford-muni-check input {
  grid-row: 1 / span 2;
  margin: 0.15rem 0 0;
  accent-color: var(--accent);
}
.afford-muni-check:hover {
  border-color: var(--rule);
  background: var(--card);
}
.afford-muni-check-name {
  font-weight: 500;
  line-height: 1.25;
}
.afford-muni-check-meta {
  grid-column: 2;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-muted);
  line-height: 1.35;
}
.empty-state {
  margin: 1.5rem 0;
  padding: 1.2rem 1.3rem;
  border: 1px dashed var(--rule);
  background: var(--paper-soft);
}

/* ---------- Listing facts panel (asking price + specs) ----------
   The bridge between the verdict block above (analysis) and the TCO
   block below (cost-to-own breakdown). Same left-border treatment as
   .tco so the page reads as a series of anchored editorial panels,
   but a softer paper-toned background so it doesn't compete with TCO
   for the eye. Asking price is the dominant number — big serif. */
.listing-facts {
  margin: 1rem 0 1.2rem;
  padding: 1rem 1.2rem 1.1rem;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--ink);
}
.listing-facts .eyebrow {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-muted);
  font-weight: 600;
  margin: 0 0 0.6rem;
}
.listing-facts-body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 2.2rem;
  justify-content: space-between;
}
.listing-facts-headline {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 0 1 auto;
  min-width: 0;
}
.listing-facts-label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
}
.listing-facts-price {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2.1rem, 3.2vw + 0.5rem, 3rem);
  line-height: 1;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.listing-facts-price small {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-left: 0.15rem;
  color: var(--ink-muted);
}
.listing-facts-ppm2 {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  margin-top: 0.15rem;
}
.listing-facts-ppm2 small {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}
.listing-facts-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.6rem;
  margin: 0;
  padding: 0;
  align-items: flex-end;
}
.listing-facts-stats > div {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}
.listing-facts-stats dt {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  margin: 0;
}
.listing-facts-stats dd {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
/* Retired listings: dim the price headline so the off-market banner
   above still owns the message. */
.listing-facts.is-retired .listing-facts-price,
.listing-facts.is-retired .listing-facts-ppm2 {
  color: var(--ink-muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* ---------- Total cost of ownership panel ----------
   Lives between the price/area KPI grid and the AI take on /listings/<id>.
   Shape mirrors the .verdict block visually so the page reads as a
   continuous editorial column (eyebrow → title → big numbers → details). */
.tco {
  margin: 1.5rem 0 1.8rem;
  padding: 1.2rem 1.3rem 1.3rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
}
.tco-head { margin-bottom: 1rem; }
.tco-head .eyebrow {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.tco-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.1;
}
.tco-sub {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  max-width: 56ch;
}

.tco-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.85rem;
  margin: 0.5rem 0 1.1rem;
}
.tco-kpi-headline {
  border: 1px solid var(--rule);
  border-top: 2px solid var(--accent);
  background: var(--paper);
  padding: 0.85rem 0.95rem 0.9rem;
}
.tco-kpi-headline .label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.tco-kpi-headline .value {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(1.6rem, 2.4vw + 0.4rem, 2.2rem);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.tco-kpi-headline .value small {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-left: 0.1rem;
  color: var(--ink-muted);
}
.tco-kpi-headline small.muted {
  display: block;
  font-size: 0.78rem;
  line-height: 1.35;
  margin-top: 0.4rem;
  color: var(--ink-muted);
}

/* ---- Payment mode toggle (cash / mortgage). Visual language matches
       the existing segmented controls on /browse and /price-changes. ---- */
.tco-mode-toggle {
  display: inline-flex;
  margin: 0 0 1.1rem;
  border: 1px solid var(--rule);
  background: var(--paper-soft);
  padding: 0.2rem;
  gap: 0.2rem;
}
.tco-mode-btn {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.45rem 0.95rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
}
.tco-mode-btn:hover { color: var(--ink); }
.tco-mode-btn.is-active {
  background: var(--card);
  border-color: var(--rule);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}

/* Cash mode hides mortgage-only inputs + the mortgage row in the
   monthly-carry breakdown. Mortgage mode shows everything. */
.tco[data-tco-mode="cash"] .tco-mortgage-only { display: none; }

.tco-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.85rem 1.1rem;
  padding: 0.9rem 1rem;
  margin: 0 0 1.1rem;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
}
/* When cash mode hides all the mortgage-only inputs, the leftover row
   (just the three checkboxes) is still framed by the panel. */
.tco[data-tco-mode="cash"] .tco-inputs:empty,
.tco[data-tco-mode="cash"] .tco-inputs > .tco-mortgage-only ~ * {
  /* no-op anchor — kept so the rule above stays readable */
}
.tco-input {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.88rem;
  cursor: pointer;
}
.tco-input-label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}
.tco-input-label output {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}
.tco-input input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  margin: 0;
}
.tco-input select {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink);
}
.tco-check {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.55rem;
  cursor: pointer;
}
.tco-check input[type="checkbox"] {
  margin: 0.2rem 0 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}
.tco-check span {
  line-height: 1.35;
}
.tco-check small.muted {
  display: block;
  font-size: 0.74rem;
  margin-top: 0.15rem;
}

.tco-grids {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1rem 1.5rem;
}
.tco-h4 {
  margin: 0 0 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
}
.tco-table th {
  font-weight: 500;
  color: var(--ink-soft);
}
.tco-table td {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.tco-row-total th,
.tco-row-total td {
  border-top: 1px solid var(--rule-strong);
  font-weight: 700;
  color: var(--ink);
}
.tco-disclaimer {
  display: block;
  margin: 1rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  max-width: 70ch;
}

/* "✓ auto-detected" hint next to the new-build checkbox label. Looks
   like the existing signal chips so users read it as "the system did
   this, you can override it." */
.tco-autodetect {
  display: inline-block;
  margin: 0 0.35rem;
  padding: 0.05rem 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  cursor: help;
}

/* ============================================================
   2026 Product polish + reports
   ============================================================ */

/* (Masthead now styled by the sticky-bar block near the top of this file.) */

button,
[role="button"] {
  border-radius: 6px;
  box-shadow: var(--shadow-tight);
}
button.secondary,
button.outline,
[role="button"].outline,
[role="button"].secondary,
[role="button"].contrast {
  background: color-mix(in srgb, var(--card) 86%, transparent);
  color: var(--ink);
  border-color: var(--rule-strong);
  box-shadow: none;
}
button.secondary:hover,
button.outline:hover,
[role="button"].outline:hover,
[role="button"].secondary:hover,
[role="button"].contrast:hover {
  background: var(--ink);
  color: var(--paper);
}

input,
select,
textarea {
  border-radius: 6px;
  background-color: var(--card);
}

.kpi-grid {
  gap: 0.8rem;
  border: none;
}
.kpi {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  box-shadow: var(--shadow-tight);
}
.kpi:last-child { border-right: 1px solid var(--rule); }

.city-hist,
.filter-bar-collapsible,
.empty-state,
.freshness-col,
.change-controls,
.tco,
.afford-panel {
  border-radius: var(--radius);
  box-shadow: var(--shadow-tight);
}

.scored-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.scored-card:hover {
  box-shadow: var(--shadow-lift);
}

.table-wrap {
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--card) 92%, transparent);
}

.report-workbench {
  display: grid;
  grid-template-columns: minmax(18rem, 0.85fr) minmax(0, 1.6fr);
  gap: 1.25rem;
  align-items: end;
  padding: 1rem 1.1rem;
  margin: 0 0 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--card) 92%, transparent), color-mix(in srgb, var(--paper-soft) 78%, transparent));
  box-shadow: var(--shadow-tight);
}
.report-workbench h2 {
  margin: 0;
  font-size: clamp(1.6rem, 1.6vw + 1rem, 2.25rem);
}
.report-workbench p { margin: 0.2rem 0 0; }
.report-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(7.5rem, 1fr));
  gap: 0.65rem;
  align-items: end;
  margin: 0;
}
.report-controls label {
  display: grid;
  gap: 0.28rem;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  font-weight: 600;
}
.report-controls select,
.report-controls input {
  width: 100%;
  min-width: 0;
}
.report-actions {
  display: inline-flex;
  gap: 0.45rem;
  justify-content: flex-end;
  grid-column: 1 / -1;
}
.report-actions button {
  white-space: nowrap;
}

.report-page {
  position: relative;
  padding: 1.25rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--card) 96%, transparent);
  box-shadow: var(--shadow-soft);
}
.report-page::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 50%, rgba(23, 107, 95, 0.05) 50% 100%),
    linear-gradient(180deg, rgba(16, 23, 20, 0.04), transparent 16rem);
  background-size: 18px 100%, 100% 100%;
}
.report-page > * {
  position: relative;
  z-index: 1;
}
.report-cover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.42fr);
  gap: 1.5rem;
  align-items: end;
  padding: 0.4rem 0 1.2rem;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 1rem;
}
.report-cover h1 {
  font-size: clamp(2.35rem, 3.6vw + 1rem, 4.4rem);
  max-width: 12ch;
  margin: 0;
}
.report-cover p:not(.eyebrow) {
  max-width: 60ch;
  margin-top: 0.65rem;
  color: var(--ink-soft);
  font-size: 1rem;
}
.report-meta {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0.8rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-soft);
}
.report-meta div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.6rem;
  align-items: baseline;
}
.report-meta dt {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  font-weight: 600;
}
.report-meta dd {
  margin: 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.report-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 1rem 0 1.3rem;
}
.report-kpi {
  min-height: 6.25rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper-soft) 72%, var(--card));
}
.report-kpi span {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  font-weight: 600;
}
.report-kpi strong {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.report-section {
  margin: 1.25rem 0;
}
.method-note {
  max-width: 88ch;
  margin: 0 0 0.9rem;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.report-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--rule);
}
.report-section h3 {
  margin: 0;
  padding: 0;
  border: none;
  font-size: 1.35rem;
}
.report-section .eyebrow,
.report-cover .eyebrow,
.report-workbench .eyebrow {
  margin: 0 0 0.2rem;
}
.report-distribution {
  padding: 0.9rem 1rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-soft);
}
.report-distribution .histogram,
.report-section .trendline {
  width: 100%;
  height: auto;
  max-height: 170px;
}

.report-grid,
.report-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.report-card-grid {
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 0.9rem;
}
.report-card-grid .scored-card {
  box-shadow: none;
}
.report-freshness .freshness-col {
  background: var(--card);
}













/* ---------- Everyone-first entry points + valuation ---------- */
.pathfinder {
  margin: 0 0 2rem;
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: var(--shadow-tight);
}
.pathfinder-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.7rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--rule);
}
.pathfinder-head h3 {
  margin: 0;
  padding: 0;
  border: none;
  font-size: 1.45rem;
}
.pathfinder-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}
.path-card {
  position: relative;
  min-height: 12rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--paper-soft) 70%, var(--card)), var(--card));
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.path-card::before {
  content: "";
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.3;
}
.path-card::after {
  content: "";
  position: absolute;
  top: 1.52rem;
  right: 1.52rem;
  width: 0.75rem;
  height: 0.75rem;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.45;
}
.path-card:hover {
  transform: translateY(-2px);
  border-color: var(--ink);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
}
.path-card-kicker {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-muted);
  font-weight: 700;
}
.path-card strong {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 1.08;
  letter-spacing: -0.015em;
}
.path-card small {
  color: var(--ink-muted);
  line-height: 1.4;
}
.path-card-home { color: var(--accent-blue); }
.path-card-value { color: var(--accent); }
.path-card-invest { color: var(--warn); }
.path-card-research { color: var(--accent-warm); }

.value-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 0.38fr);
  gap: 1.25rem;
  align-items: end;
  margin-bottom: 1rem;
}
.value-hero h2 {
  margin-bottom: 0.4rem;
}
.value-hero-result,
.value-empty,
.value-confidence {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-soft);
}
.value-hero-result {
  padding: 1rem;
}
.value-hero-result span,
.value-confidence span {
  display: block;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  font-weight: 700;
}
.value-hero-result strong {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--font-serif);
  font-size: 2rem;
  line-height: 1;
}
.value-hero-result small,
.value-confidence small {
  color: var(--ink-muted);
}
.value-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: var(--shadow-tight);
}
.value-form {
  margin: 0;
}
.value-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.value-form label {
  display: grid;
  gap: 0.28rem;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  font-weight: 600;
}
.value-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.9rem;
}
.value-empty {
  padding: 0.9rem 1rem;
}
.value-empty strong,
.value-empty span {
  display: block;
}
.value-empty span {
  margin-top: 0.2rem;
  color: var(--ink-muted);
}
.value-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 0.3fr);
  gap: 1rem;
  margin: 1.2rem 0;
  padding: 1rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(23, 107, 95, 0.07) 0 50%, transparent 50% 100%),
    var(--card);
  background-size: 16px 100%, auto;
  box-shadow: var(--shadow-tight);
}
.value-range {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 3.4vw + 1rem, 4rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.02;
}
.value-center {
  margin: 0.5rem 0 0.15rem;
}
.value-confidence {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.9rem;
}
.value-confidence strong {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  line-height: 1;
}
.value-explain {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(17rem, 0.7fr);
  gap: 1rem;
  margin: 1.2rem 0;
}
.value-explain h3,
.value-comps h3 {
  margin-top: 0;
}
.value-caveats {
  padding: 1rem 1.1rem 1rem 1.45rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-soft);
}

/* ---------- Market overview map ---------- */
.market-map-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ink);
}
.market-map-hero h2 {
  margin-bottom: 0.35rem;
}
.market-map-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}
.market-map-shell {
  display: grid;
  grid-template-columns: minmax(19rem, 0.34fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}
.market-map-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
  padding: 0.95rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: var(--shadow-tight);
}
.market-map-form {
  margin: 0;
}
.map-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}
.map-filter-grid label {
  display: grid;
  gap: 0.28rem;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-muted);
  font-weight: 650;
}
.map-filter-wide {
  grid-column: 1 / -1;
}
.map-filter-grid input,
.map-filter-grid select {
  width: 100%;
}
.market-map-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.market-map-actions button {
  flex: 1 1 8rem;
  text-align: center;
}
.map-readout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}
.map-readout div {
  min-width: 0;
  padding: 0.65rem 0.55rem;
  border-right: 1px solid var(--rule);
}
.map-readout div:last-child {
  border-right: none;
}
.map-readout span,
.market-map-legend span,
.map-area-btn small {
  display: block;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  font-weight: 650;
}
.map-readout strong {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.market-map-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.65rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
}
.market-map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.74rem;
}
.legend-dot {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid var(--ink);
}
.legend-under { background: var(--accent); }
.legend-over { background: var(--warn); }
.legend-fair { background: var(--accent-blue); }
.legend-rent { background: var(--accent-warm); }
.legend-deal { background: var(--warn); }

/* Deal-pipeline red dots (/pipeline). A solid brick-red marker with a soft
   halo so a live opportunity reads at a glance against the map tiles. */
.deal-marker { background: transparent; border: 0; }
.deal-marker .deal-dot {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--warn);
  border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(155, 63, 50, 0.28), var(--shadow-tight);
  transition: transform 0.12s ease;
}
.deal-marker:hover .deal-dot { transform: scale(1.18); }

/* Machine picks from the nightly batch underwriter — amber, so the board
   separates "we're pursuing this" (red) from "the machine found this". */
.deal-marker .deal-dot-auto {
  background: var(--accent-warm, #c98a2b);
  box-shadow: 0 0 0 3px rgba(201, 138, 43, 0.28), var(--shadow-tight);
}
.legend-deal-auto { background: var(--accent-warm, #c98a2b); }

/* Agent-tracked opportunities (atlas/agent.py) — blue, so the board
   separates curated (red), machine picks (amber), and what the agent is
   actively working through its lifecycle (blue). */
.deal-marker .deal-dot-agent {
  background: var(--accent-blue, #2b6cb0);
  box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.28), var(--shadow-tight);
}
.legend-deal-agent { background: var(--accent-blue, #2b6cb0); }

/* Agent opportunity card sections inside the /pipeline popup */
.map-popup .agent-card-section {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin-top: 0.45rem;
  padding-top: 0.35rem;
}

.map-area-list {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  max-height: 21rem;
  overflow: auto;
  padding-right: 0.2rem;
}
/* /pipeline: the list is the panel's main body — let it fill the space the
   map sets rather than stopping at a fixed cap with dead air below. The
   panel must cap its own height (matching the map column) or the list's
   content height would stretch the shared grid row — and the map with it. */
.pipeline-panel {
  max-height: 42rem;
  overflow: hidden;
}
.map-area-list--fill {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}
.map-list-heading {
  display: flex;
  justify-content: space-between;
  margin: 0.55rem 0 0;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-muted);
  font-weight: 650;
}
.map-area-list .map-list-heading:first-child { margin-top: 0; }
/* /pipeline source filter — segmented control sized to the side panel. */
.pipeline-filter {
  display: flex;
  margin: 0;
}
.pipeline-filter .segmented-option {
  flex: 1 1 0;
  padding: 0.42rem 0.3rem;
  text-align: center;
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  border: 0;
  border-right: 1px solid var(--ink);
  border-radius: 0;
}
.pipeline-filter .segmented-option:last-child { border-right: none; }
.map-area-btn {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  padding: 0.62rem 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}
.map-area-btn:hover {
  background: transparent;
  border-color: var(--ink);
  color: var(--accent);
}
.map-area-btn strong,
.map-area-btn b {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.map-area-btn b {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-align: right;
}
.map-area-btn small {
  margin-top: 0.16rem;
}
.market-map-canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 42rem;
  height: 100%;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-soft);
  box-shadow: var(--shadow-tight);
}
#market-map {
  width: 100%;
  height: 100%;
  min-height: 42rem;
  background: var(--paper-soft);
}
/* Minimal Leaflet layout fallback. The CDN stylesheet normally supplies
   these pane rules; keeping them local prevents a blank/stacked map if the
   external CSS is blocked while the JS still loads. */
.leaflet-container {
  position: relative;
  overflow: hidden;
  outline-style: none;
}
.leaflet-pane,
.leaflet-map-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-overlay-pane svg,
.leaflet-overlay-pane canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  user-select: none;
  -webkit-user-drag: none;
}
.leaflet-tile {
  max-width: none !important;
  max-height: none !important;
}
.leaflet-control {
  position: relative;
  z-index: 800;
  pointer-events: auto;
}
.leaflet-top,
.leaflet-bottom {
  position: absolute;
  z-index: 900;
  pointer-events: none;
}
.leaflet-top { top: 0; }
.leaflet-right { right: 0; }
.leaflet-bottom { bottom: 0; }
.leaflet-left { left: 0; }
.leaflet-control-zoom {
  margin: 0.7rem;
  border: 1px solid var(--ink);
  background: var(--paper);
}
.leaflet-container .leaflet-control-zoom a {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  line-height: 1;
  padding: 0;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.leaflet-control-zoom a:last-child {
  border-bottom: 0;
}
.leaflet-control-attribution {
  margin: 0 0.35rem 0.25rem 0;
  padding: 0.1rem 0.35rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  color: var(--ink-muted);
  font-size: 0.68rem;
}
.map-cluster-icon {
  width: 64px !important;
  height: 64px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 10px 24px rgba(16, 23, 20, 0.22);
  text-align: center;
}
.map-cluster-icon::before {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.28;
}
.map-cluster-icon span {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 0.95;
}
.map-cluster-icon small {
  display: block;
  margin-top: 0.08rem;
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.map-cluster-icon-medium {
  background: var(--accent);
}
.map-cluster-icon-large {
  background: var(--warn);
}
.map-status {
  position: absolute;
  z-index: 800;
  left: 50%;
  top: 1rem;
  transform: translateX(-50%);
  max-width: calc(100% - 2rem);
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 600;
  box-shadow: var(--shadow-tight);
}
.map-status.is-error {
  border-color: var(--warn);
  color: var(--warn);
  background: var(--warn-soft);
}
.map-price-marker {
  width: 92px !important;
  height: 42px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.02rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(16, 23, 20, 0.16);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}
.map-price-marker small {
  display: block;
  max-width: 78px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
  font-family: var(--font-sans);
  font-size: 0.55rem;
  font-weight: 700;
  opacity: 0.88;
}
.map-price-marker-under {
  background: var(--accent);
  border-color: var(--accent-strong);
  color: #fff;
}
.map-price-marker-over {
  background: var(--warn);
  border-color: var(--warn);
  color: #fff;
}
.map-price-marker-fair {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}
.map-price-marker-rent {
  background: var(--accent-warm);
  border-color: var(--accent-warm);
  color: #fff;
}
.map-price-marker-raw {
  background: var(--paper);
  border-color: var(--ink-muted);
  color: var(--ink);
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}
.leaflet-popup-content {
  margin: 0;
  min-width: 15rem;
}
.map-popup {
  margin: 0;
  padding: 0.85rem;
}
.map-popup h4 {
  margin: 0 0 0.3rem;
  font-family: var(--font-serif);
  font-size: 1.08rem;
}
.map-popup p,
.map-popup small {
  display: block;
  margin: 0 0 0.35rem;
  color: var(--ink-muted);
}
.map-popup strong {
  display: block;
  margin: 0.25rem 0 0.2rem;
  font-family: var(--font-serif);
  font-size: 1.45rem;
  line-height: 1;
}
.map-popup-signal {
  color: var(--accent) !important;
  font-weight: 650;
}
.map-popup-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.45rem 0 0.55rem;
}
.map-popup-tags span {
  padding: 0.12rem 0.4rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-muted);
  font-size: 0.68rem;
}
.map-popup a {
  font-weight: 700;
  color: var(--accent);
}

@media (max-width: 980px) {
  .pathfinder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .value-form-grid,
  .value-hero,
  .value-result,
  .value-explain,
  .market-map-hero,
  .market-map-shell {
    grid-template-columns: 1fr;
  }
  .market-map-hero {
    display: grid;
    align-items: start;
  }
  .market-map-hero-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .pathfinder-grid {
    grid-template-columns: 1fr;
  }
  .path-card {
    min-height: 9.5rem;
  }
  .value-shell,
  .value-result {
    padding: 0.85rem;
  }
  .value-range,
  .value-hero-result strong {
    overflow-wrap: anywhere;
  }
  .value-range {
    font-size: clamp(2rem, 12vw, 3rem);
  }
  .map-filter-grid,
  .map-readout,
  .market-map-legend {
    grid-template-columns: 1fr;
  }
  .market-map-panel {
    padding: 0.85rem;
  }
  .market-map-canvas-wrap,
  #market-map {
    min-height: 32rem;
  }
  .market-map-canvas-wrap {
    height: 32rem;
  }
  #market-map {
    height: 100%;
  }
  .map-area-btn {
    grid-template-columns: 1fr;
  }
  .map-area-btn b {
    text-align: left;
  }
}

@media (max-width: 980px) {
  .report-workbench {
    grid-template-columns: 1fr;
  }
  .report-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .report-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .report-cover,
  .report-grid,
  .report-split {
    grid-template-columns: 1fr;
  }
  .report-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  
}

@media (max-width: 640px) {
  .report-page {
    padding: 0.85rem;
  }
  .report-meta div {
    grid-template-columns: 1fr;
    gap: 0.05rem;
  }
  .report-meta dd {
    text-align: left;
  }
  .masthead-links {
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    overflow-x: visible;
    padding-bottom: 0.35rem;
    gap: 0.3rem 0.5rem;
  }
  .masthead-links a {
    white-space: nowrap;
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }
  html,
  body {
    background: #fff !important;
    color: #111 !important;
  }
  .no-print,
  .masthead,
  footer,
  .page-progress,
  .watch-star,
  .scored-card-link {
    display: none !important;
  }
  main.container {
    max-width: none;
    padding: 0;
  }
  .report-page {
    border: 0;
    box-shadow: none;
    padding: 0;
    background: #fff;
  }
  .report-page::before {
    display: none;
  }
  .report-cover {
    break-after: avoid;
  }
  .report-section,
  .report-kpi,
  .scored-card,
  tr {
    break-inside: avoid;
  }
  .report-kpis {
    grid-template-columns: repeat(3, 1fr);
  }
  .report-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  a {
    color: #111 !important;
    text-decoration: none !important;
  }
  .scored-card,
  .report-kpi,
  .report-meta,
  .report-distribution,
  .table-wrap {
    box-shadow: none !important;
    background: #fff !important;
  }
}

/* ============================================================
   HOME · canvas redesign (Phase 1)
   Calm analytics-terminal landing. All new classes are home-
   prefixed so they don't collide with the older landing styles.
   Colors come from the shared design tokens so dark mode follows.
   ============================================================ */

.home-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.4rem;
}
.home-h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.65rem;
  letter-spacing: -0.01em;
  margin: 0;
}
.home-h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.3rem;
  letter-spacing: -0.005em;
  margin: 0.1rem 0 0.3rem;
}
.home-muted { color: var(--ink-muted); font-size: 0.85rem; line-height: 1.5; margin: 0; }

.home-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.home-section { margin: 3rem 0; }
.home-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
}
.home-section-note { font-size: 0.85rem; color: var(--ink-muted); }
.home-more {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

/* ---------- Hero + KPI panel ---------- */
.home-hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3rem;
  align-items: center;
  padding: 2.5rem 0 1rem;
}
.home-hero-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(2.1rem, 1.4rem + 2.4vw, 3rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  text-wrap: balance;
}
.home-hero-sub {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 1.6rem;
  max-width: 33em;
  text-wrap: pretty;
}
.home-hero-cta { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.home-btn-primary,
.home-btn-ghost {
  display: inline-flex;
  align-items: center;
  height: 46px;
  padding: 0 1.35rem;
  border-radius: var(--radius-btn);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.home-btn-primary { background: var(--accent); color: var(--paper); border: 1px solid var(--accent); }
.home-btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.home-btn-ghost { background: var(--card); color: var(--ink); border: 1px solid var(--rule); }
.home-btn-ghost:hover { border-color: var(--accent); }

.home-kpi {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-card);
}
.home-kpi-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.home-kpi-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.home-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--card-border);
  border-radius: 10px;
  overflow: hidden;
}
.home-kpi-cell { background: var(--card); padding: 1rem; }
.home-kpi-num {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.home-kpi-num-accent { color: var(--accent); }
.home-kpi-cap { font-size: 0.75rem; color: var(--ink-muted); margin-top: 0.2rem; }
.home-kpi-foot {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 0.9rem;
}

/* ---------- Pathfinder ---------- */
.home-paths {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.home-path {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 184px;
  padding: 1.35rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.home-path:hover { border-color: var(--accent); box-shadow: var(--shadow-lift); }
.home-path-num { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.06em; color: var(--accent); }
.home-path-title { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 500; letter-spacing: -0.01em; }
.home-path-desc { font-size: 0.85rem; line-height: 1.5; color: var(--ink-muted); flex: 1; text-wrap: pretty; }
.home-path-cta { font-size: 0.82rem; color: var(--accent); font-weight: 500; }

/* ---------- Price spread + picks ---------- */
.home-split {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 2rem;
  /* Equal-height columns: the spread card stretches to match the taller picks
     rail, and the histogram centres itself in the extra room (see
     .home-spread-fig) so the balance reads intentional, not like dead space. */
  align-items: stretch;
  margin: 3rem 0;
}
.home-spread {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}
.home-spread-fig {
  margin: 1.2rem 0 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.home-spread-fig svg,
.home-spread-fig .histogram { width: 100%; height: auto; max-height: 150px; }
/* Homepage variant carries its own axis labels + aspect ratio; give it room
   to render at full size (uniform scaling means it never distorts). */
.home-spread-fig .histogram-clean { max-height: 210px; }
.histogram .hist-clean-label {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--ink-muted);
}
.histogram .hist-clean-label-mid { fill: var(--ink); font-weight: 600; }
.home-spread-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--ink-muted);
}

.home-picks-head { margin-bottom: 0.9rem; }
.home-picks-list { display: flex; flex-direction: column; gap: 0.9rem; }
.home-pick {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1.05rem 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.home-pick:hover { border-color: var(--accent); box-shadow: 0 3px 14px rgba(23, 107, 95, 0.09); }
.home-pick-score {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.home-pick-score-num { font-family: var(--font-mono); font-size: 1.3rem; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.home-pick-score-cap { font-size: 0.5rem; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.7; }
.home-pick-body { flex: 1; min-width: 0; }
.home-pick-title { display: block; font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-pick-meta { display: block; font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-muted); margin-top: 0.2rem; }
.home-pick-sep { color: var(--rule); margin: 0 0.4rem; }
.home-pick-right {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  text-align: right;
}
.home-pick-delta { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500; white-space: nowrap; }
.home-pick-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-strong);
  white-space: nowrap;
}
.home-pick-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* ---------- What changed ---------- */
.home-changed-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.home-changed-card { display: flex; flex-direction: column; padding: 1.25rem; }
.home-changed-click { cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.home-changed-click:hover,
.home-changed-click:focus-visible { border-color: var(--accent); box-shadow: var(--shadow-lift); outline: none; }
.home-changed-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.85rem; }
.home-changed-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.home-changed-title { font-weight: 600; font-size: 0.9rem; }
.home-changed-count { margin-left: auto; font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-muted); }
.home-changed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
}
.home-changed-row:hover { opacity: 0.72; }
.home-changed-row-title { font-size: 0.85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-changed-row-val { font-family: var(--font-mono); font-size: 0.82rem; flex: none; }
.home-changed-empty { padding-top: 0.4rem; }
.home-changed-note { font-size: 0.85rem; line-height: 1.55; color: var(--ink-muted); margin: 0; }
.home-changed-more {
  display: inline-flex;
  margin-top: auto;
  padding-top: 0.85rem;
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.home-changed-more:hover { color: var(--accent-strong); }

/* ---------- Coverage panel ---------- */
.home-coverage {
  background: #101714;
  border-radius: 16px;
  padding: 2.1rem;
  color: #e8ece6;
  background-image: radial-gradient(circle at 80% 0%, rgba(23, 107, 95, 0.35), transparent 55%);
}
.home-coverage-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 2.25rem; align-items: center; }
.home-coverage-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7fc7b9;
  margin: 0 0 0.7rem;
}
.home-coverage-h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.75rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.7rem;
  color: #fff;
}
.home-coverage-sub { font-size: 0.92rem; line-height: 1.6; color: #aeb7af; margin: 0; text-wrap: pretty; }
.home-coverage-lists { display: flex; flex-direction: column; gap: 0.9rem; }
.home-coverage-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7fc7b9;
  margin: 0 0 0.55rem;
}
.home-coverage-label-soon { color: #8e9890; }
.home-coverage-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.home-coverage-chip {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #e8ece6;
  text-decoration: none;
  transition: background 0.15s ease;
}
.home-coverage-chip:hover { background: rgba(255, 255, 255, 0.13); }
.home-coverage-chip.is-current { border-color: #7fc7b9; }
.home-coverage-soon {
  font-size: 0.82rem;
  color: #8e9890;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0.38rem 0.7rem;
  text-decoration: none;
}
.home-coverage-soon:hover { color: #c3ccc4; border-color: rgba(255, 255, 255, 0.34); }

/* ---------- Home responsive ---------- */
@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; gap: 1.75rem; padding-top: 1.75rem; }
  .home-paths { grid-template-columns: 1fr 1fr; }
  .home-split { grid-template-columns: 1fr; }
  .home-changed-grid { grid-template-columns: 1fr; }
  .home-coverage-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}
@media (max-width: 560px) {
  .home-paths { grid-template-columns: 1fr; }
  .home-kpi-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Explore (Phase 2) — intent nav + sticky filter rail
   ============================================================ */
.explore-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.explore-head hgroup { margin: 0; }

/* Intent / persona nav — threads the four personas. Buy is this page;
   Rent + Under budget navigate out to their reskinned pages. */
.persona-nav { display: inline-flex; gap: 0.4rem; flex-shrink: 0; }
.persona-tab {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-muted);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.persona-tab:hover { border-color: var(--accent); color: var(--accent); }
.persona-tab.is-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* Two-column shell: sticky rail + results. min-width:0 on the main column
   lets the auto-fill card grid shrink instead of overflowing. */
.explore {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
.explore-rail { position: sticky; top: 84px; align-self: start; }
.explore-main { min-width: 0; }

.explore-filters {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-card);
  padding: 0.25rem 1.1rem 1.1rem;
}
.explore-filters > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 0 0.35rem;
  cursor: pointer;
}
.explore-filters > summary::-webkit-details-marker { display: none; }
.explore-filters > summary::after {
  content: "▴";
  color: var(--ink-muted);
  font-size: 0.7rem;
}
.explore-filters:not([open]) > summary::after { content: "▾"; }

/* The rail form stacks its fields vertically (overrides the horizontal
   .filter-form flow used elsewhere). */
.explore-filter-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}
.explore-filter-form label,
.explore-filter-form .filter-field { width: 100%; }
.explore-filter-form .filter-location input,
.explore-filter-form input[type="number"],
.explore-filter-form select {
  width: 100%;
  min-width: 0;
}
.filter-range { display: flex; align-items: center; gap: 0.5rem; }
.filter-range input { flex: 1; min-width: 0; }
.filter-range-sep { color: var(--ink-faint); }
.filter-sort-row { display: flex; gap: 0.5rem; }
.filter-sort-row select { flex: 1; min-width: 0; }
.explore-filter-form .filter-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}
.explore-filter-form .filter-actions button { flex: 1; }

/* On the narrow layout the rail drops above the results and the filter
   panel collapses (a real toggle again). */
@media (max-width: 900px) {
  .explore { grid-template-columns: 1fr; gap: 1.25rem; }
  .explore-rail { position: static; }
  .explore-head { margin-bottom: 1rem; }
}


/* ---- Homepage live map ---- */
.home-map-card {
  padding: 0;
  overflow: hidden;
}
#home-map {
  height: 440px;
  width: 100%;
  background: var(--paper-soft, #eee);
}
.home-map-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--line, #ddd);
  font-size: 0.85rem;
}
.home-map-foot .market-map-legend {
  margin: 0;
}
@media (max-width: 720px) {
  #home-map { height: 320px; }
}

/* ---- Opportunity map toolbar + movement layers ---- */
.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}
.map-city-tabs {
  display: flex;
  gap: 0.35rem;
}
.map-city-tab {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--ink);
}
.map-city-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.map-layer-chips {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.map-layer-chips button {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
  width: auto;
  margin: 0;
}
.map-layer-chips button.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper, #fff);
}
.map-price-marker-drop {
  background: var(--warn);
  border-color: var(--warn);
  color: #fff;
}
.map-price-marker-new {
  background: var(--accent);
  border-color: var(--accent-strong);
  color: #fff;
}
.market-map-form.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ---- Command view ---- */
.cmd-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.cmd-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1rem;
  align-items: start;
}
.cmd-map-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
#cmd-map {
  height: calc(100vh - 220px);
  min-height: 480px;
  width: 100%;
}
.cmd-map-status {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 500;
  background: var(--paper, #fff);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}
.cmd-rail {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}
.cmd-ask input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  font-size: 0.9rem;
}
.cmd-ask-note {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  min-height: 1em;
}
.cmd-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: var(--paper, #fff);
}
.cmd-panel-title {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft, #666);
}
.cmd-today-line {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
}
.cmd-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--ink);
}
.cmd-row > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.cmd-deal {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) max-content;
  align-items: start;
}
.cmd-deal-score {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  min-width: 2rem;
}
.cmd-deal-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.cmd-deal-body > span {
  overflow-wrap: anywhere;
}
.cmd-deal > .discount-pos {
  white-space: nowrap;
  text-align: right;
}
@media (max-width: 760px) {
  .cmd-shell { grid-template-columns: 1fr; }
  #cmd-map { height: 55vh; min-height: 360px; }
  .cmd-rail { max-height: none; }
}

/* ---- Developer card + land markers ---- */
.map-price-marker-land {
  background: var(--accent-warm);
  border-color: var(--accent-warm);
  color: #fff;
}
.cmd-dev-card {
  position: relative;
  border-color: var(--accent);
  box-shadow: 0 4px 18px rgba(23, 107, 95, 0.12);
}
.cmd-dev-close {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  width: auto;
  padding: 0 0.4rem;
  margin: 0;
  border: none;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--ink-soft, #666);
  cursor: pointer;
}
.cmd-dev-plot {
  margin: 0 0 0.15rem;
  font-weight: 600;
  font-size: 0.92rem;
}
.cmd-dev-meta {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  color: var(--ink-soft, #666);
}
.cmd-dev-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.cmd-dev-tabs button {
  width: auto;
  margin: 0;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.cmd-dev-tabs button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.cmd-iso {
  display: block;
  width: 100%;
  max-height: 150px;
  margin: 0.2rem 0 0.4rem;
}
.cmd-dev-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.8rem;
  margin-bottom: 0.6rem;
}
.cmd-dev-grid > div {
  display: flex;
  flex-direction: column;
}
.cmd-dev-grid span {
  font-weight: 700;
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
}
.cmd-dev-grid small {
  font-size: 0.72rem;
  color: var(--ink-soft, #666);
}
.cmd-dev-assumptions {
  font-size: 0.72rem;
  margin: 0.4rem 0 0.2rem;
}

.deal-row-link {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent, #1a6d5a);
  text-decoration: underline;
  cursor: pointer;
}
.deal-row-link:hover {
  text-decoration: none;
}

/* Returns headline — the annualized number a developer actually compares. */
.cmd-dev-return {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  padding: 0.45rem 0.6rem;
  margin: 0 0 0.6rem;
  border-radius: 10px;
  background: rgba(23, 107, 95, 0.08);
  border: 1px solid rgba(23, 107, 95, 0.18);
}
.cmd-dev-return.is-neg {
  background: rgba(180, 65, 45, 0.08);
  border-color: rgba(180, 65, 45, 0.20);
}
.cmd-dev-return strong {
  font-size: 1.5rem;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.cmd-dev-return.is-neg strong { color: var(--warn); }
.cmd-dev-return small {
  font-size: 0.72rem;
  color: var(--ink-soft, #666);
}
.cmd-dev-return span {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
/* Assumption sliders — editable defaults, not fixed claims. Collapsed by
   default so the card reads clean; pros expand to re-underwrite. */
.cmd-dev-adjust {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--line);
}
.cmd-dev-adjust > summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent);
  user-select: none;
}
.cmd-dev-adjust > summary::-webkit-details-marker { display: none; }
.cmd-dev-adjust > summary::before {
  content: "▸";
  display: inline-block;
  font-size: 0.95rem;
  margin-right: 0.35rem;
}
.cmd-dev-adjust[open] > summary::before { content: "▾"; }
.cmd-dev-adjust[open] > summary { margin-bottom: 0.5rem; }
.cmd-dev-sliders {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.cmd-dev-slider {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  position: relative;  /* anchor for the info tooltip */
}
.cmd-dev-slider-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.74rem;
  color: var(--ink-soft, #666);
}
.cmd-dev-slider-name {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.cmd-dev-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 0.6rem;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  opacity: 0.55;
  cursor: help;
}
.cmd-dev-info:hover, .cmd-dev-info:focus { opacity: 0.9; outline: none; }
/* Hover/focus tooltip — spans the slider row, opens above it. Reliable (no
   native `title` delay) and can't be clipped horizontally since it's row-width. */
.cmd-dev-info::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  background: #1f2723;
  color: #f2f5f1;
  font-family: var(--font-sans, inherit);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
  text-align: left;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(3px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  pointer-events: none;
}
.cmd-dev-info:hover::after,
.cmd-dev-info:focus::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.cmd-dev-slider-top b {
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.cmd-dev-slider input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ==========================================================================
   Deal page — provenance chips
   A colored dot next to each headline number: where does this figure come
   from? (listing / scraped median / assumption / override / verified plan)
   ========================================================================== */
.prov-chip {
  display: inline-flex;
  align-items: center;
  border: none;
  background: none;
  padding: 0 .1rem;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1;
}
.prov-dot {
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px var(--paper);
  transition: transform .12s ease;
}
.prov-chip:hover .prov-dot { transform: scale(1.35); }
.prov-listing .prov-dot  { background: var(--ink-muted); }
.prov-scraped .prov-dot  { background: var(--accent-blue); }
.prov-derived .prov-dot,
.prov-assumed .prov-dot  { background: var(--accent-warm); }
.prov-override .prov-dot { background: var(--accent-strong); box-shadow: 0 0 0 2px var(--accent-soft); }
.prov-verified .prov-dot { background: var(--accent); }
.prov-computed .prov-dot { background: var(--ink-faint); }

/* Zoning card: the tier badge is the headline — a weaker tier must never
   look like a stronger one. */
.zoning-card {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
  padding: .7rem .9rem;
  margin-bottom: 1rem;
}
.zoning-card input, .zoning-card textarea {
  font: inherit;
  padding: .35em .5em;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg);
  color: inherit;
}
.zoning-tier {
  font-size: .62em;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .18em .55em;
  border-radius: 999px;
  vertical-align: middle;
  color: #fff;
}
.zoning-tier-parcel_verified { background: var(--accent); }
.zoning-tier-seller_claimed  { background: var(--accent-warm); }
.zoning-tier-zone_indicative { background: var(--accent-blue); }
.zoning-tier-assumption      { background: var(--ink-faint); }

.prov-pop {
  position: absolute;
  z-index: 60;
  max-width: 280px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: .55rem .75rem;
  font-size: .78rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.prov-pop strong {
  display: block;
  margin-bottom: .15rem;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-muted);
}

/* ---------- Deal page: assumptions drawer ---------- */
.assumptions-drawer {
  margin: 0 0 1.2rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 0;
}
.assumptions-drawer > summary {
  cursor: pointer;
  padding: .7rem 1rem;
  font-weight: 600;
  font-size: .9rem;
  list-style: none;
}
.assumptions-drawer > summary::-webkit-details-marker { display: none; }
.assumptions-drawer > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: .5rem;
  color: var(--ink-muted);
  transition: transform .15s ease;
}
.assumptions-drawer[open] > summary::before { transform: rotate(90deg); }
.assumptions-drawer[open] > summary { border-bottom: 1px solid var(--rule); }
.assumptions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .8rem 1.2rem;
  padding: .9rem 1rem .4rem;
}
.assumptions-grid label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.assumptions-grid small { font-weight: 400; }
.assumptions-drawer input[type="number"] {
  font: inherit;
  font-family: var(--font-mono);
  font-size: .85rem;
  padding: .35rem .5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}
.assumptions-drawer input[type="number"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.assumptions-scenarios { margin: .4rem 1rem .6rem; width: calc(100% - 2rem); }
.assumptions-scenarios input[type="number"] { max-width: 6.5rem; }
.assumptions-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .5rem 1rem .8rem;
  font-size: .8rem;
}
[data-scenario-buttons] .map-area-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* ---------- Deal page: interactive timeline ---------- */
.tl-wrap { position: relative; }
.tl-svg { width: 100%; font-family: inherit; display: block; }
.tl-phase { opacity: .85; transition: opacity .12s ease; }
.tl-phase:hover { opacity: 1; }
.tl-zero { stroke: var(--ink-faint); stroke-dasharray: 4 3; }
.tl-cash { fill: none; stroke: var(--accent-blue); stroke-width: 2.5; }
.tl-axis { fill: var(--ink-muted); }
.tl-neg { fill: var(--warn); }
.tl-pos { fill: var(--accent); }
.tl-peak { fill: var(--warn); stroke: var(--paper); stroke-width: 1.5; }
.tl-peak-label { fill: var(--warn); font-weight: 600; }
.tl-hover-dot { fill: var(--accent-blue); stroke: var(--paper); stroke-width: 2; }
.tl-guide { stroke: var(--ink-faint); stroke-dasharray: 2 3; }
.tl-tip {
  position: absolute;
  z-index: 50;
  pointer-events: none;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: .45rem .65rem;
  font-size: .76rem;
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 190px;
}
.tl-tip strong { display: block; color: var(--ink); }

/* ---------- Deal page: design chat ---------- */
.design-chat { margin-top: .7rem; }
.design-chat-history {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .45rem;
}
.design-chip {
  font-size: .72rem;
  padding: .15rem .55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid var(--rule);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.design-chat form {
  display: flex;
  gap: .5rem;
}
.design-chat input[type="text"] {
  flex: 1;
  font: inherit;
  font-size: .88rem;
  padding: .5rem .7rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-btn);
  background: var(--card);
  color: var(--ink);
}
.design-chat input[type="text"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.design-chat input[type="text"]:disabled { opacity: .6; }
.design-chat-status {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: .78rem;
  margin: .35rem 0 0;
}
.design-chat-status a { color: var(--ink-muted); }
.design-busy { animation: design-pulse 1.2s ease-in-out infinite; }
@keyframes design-pulse { 50% { opacity: .45; } }

/* ---------- Deal page: buttons (the map's .map-area-btn is full-width grid;
   these are inline pills) ---------- */
.deal-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  padding: .35rem .7rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .08s ease;
}
.deal-btn:hover { border-color: var(--accent); color: var(--accent-strong); }
.deal-btn:active { transform: scale(.97); }
.deal-btn:disabled { opacity: .55; cursor: default; }
.deal-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* ---------- Deal page: questions & risks panel ---------- */
.q-card {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
  margin-bottom: .5rem;
  overflow: hidden;
}
.q-card > summary {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .6rem .8rem;
  cursor: pointer;
  list-style: none;
  font-size: .88rem;
}
.q-card > summary::-webkit-details-marker { display: none; }
.q-card[open] > summary { border-bottom: 1px solid var(--rule); }
.q-dot {
  width: .55rem; height: .55rem; border-radius: 50%; flex: none;
}
.q-high .q-dot { background: var(--warn); }
.q-medium .q-dot { background: var(--accent-warm); }
.q-low .q-dot { background: var(--ink-faint); }
.q-kind {
  flex: none;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-muted);
  background: var(--paper-soft);
  border-radius: 4px;
  padding: .1rem .4rem;
}
.q-origin {
  flex: none;
  font-size: .68rem;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: .1rem .4rem;
}
.q-text { flex: 1; min-width: 0; }
.q-badge {
  flex: none;
  font-size: .68rem;
  color: var(--ink-muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .05rem .45rem;
}
.q-done > summary { opacity: .65; }
.q-body { padding: .6rem .8rem .8rem; font-size: .85rem; }
.q-body p { margin: 0 0 .5rem; }
.q-draft {
  font-family: var(--font-mono);
  font-size: .72rem;
  line-height: 1.5;
  background: var(--paper);
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  padding: .6rem .7rem;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  margin: 0 0 .6rem;
}
.q-research {
  border-left: 3px solid var(--accent);
  background: var(--paper);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: .55rem .75rem;
  margin: 0 0 .6rem;
  font-size: .82rem;
}
.q-research strong { display: block; margin-bottom: .25rem; color: var(--accent-strong); }
.q-research em { font-style: normal; font-weight: 600; font-size: .75rem; color: var(--ink-muted); }
.q-research ul { margin: .15rem 0 .5rem 1.1rem; padding: 0; }
.q-research li { margin-bottom: .15rem; }
.q-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  align-items: center;
}
.q-dismiss { color: var(--ink-muted); }
.q-actions-row {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-top: .3rem;
  font-size: .8rem;
}

/* Deal page two-column shell — single column under 900px so the massing
   viewer and scenario tables don't crush on mobile. */
.deal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .deal-grid-2 { grid-template-columns: 1fr; }
}

/* ============================================================
   CONSOLE · Tasks + Calendar (JARVIS surfaces)
   Shares the home-* canvas vocabulary: same card tokens, mono
   eyebrows, serif headings. All classes are console- prefixed.
   ============================================================ */

.console-head { padding: 2.2rem 0 0.4rem; max-width: 62ch; }
.console-head .home-hero-sub { margin-bottom: 0; }

.console-feed {
  margin: 1.4rem 0 0;
  max-width: 46rem;
}
.console-feed-form { display: flex; gap: 0.6rem; align-items: stretch; }
.console-feed-input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 1rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-card);
}
.console-feed-input:focus { outline: none; border-color: var(--accent); }
.console-feed-input::placeholder { color: var(--ink-faint); }
.console-feed-status { margin: 0.45rem 0 0; min-height: 1.2em; font-size: 0.85rem; color: var(--ink-muted); }

.console-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1.6rem 0 3rem;
  align-items: start;
}
.console-card { padding: 1.15rem 1.25rem; }
.console-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}
.console-card-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0;
}
.console-card-title .console-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 0.45rem;
  vertical-align: 1px;
  background: var(--ink-faint);
}
.console-dot-now { background: var(--opp-prem-dot, #9b3f32); }
.console-dot-next { background: var(--accent); }
.console-dot-wait { background: var(--accent-warm); }
.console-card-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}
.console-list { list-style: none; margin: 0; padding: 0; }
.console-item { padding: 0.6rem 0; border-top: 1px solid var(--card-border); }
.console-item:first-child { border-top: 0; }
.console-item-title { font-size: 0.92rem; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.console-item-meta { display: block; margin-top: 0.15rem; font-size: 0.8rem; color: var(--ink-muted); line-height: 1.45; overflow-wrap: anywhere; }
.console-empty { padding: 0.6rem 0 0.2rem; font-size: 0.85rem; color: var(--ink-faint); margin: 0; }

/* ---- Calendar ---- */
.console-statline {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin: 1.1rem 0 0;
}
.console-day.is-today { border-color: var(--accent); }
.console-day-date { display: flex; align-items: baseline; gap: 0.5rem; }
.console-today-pill {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}
.console-event { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.7rem; align-items: start; }
.console-event-time {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  white-space: nowrap;
  padding-top: 0.15rem;
}
.console-event-src { font-size: 0.78rem; color: var(--ink-faint); }
.console-foot { margin: 0 0 3rem; max-width: 62ch; font-size: 0.85rem; color: var(--ink-muted); }

.console-alert {
  margin: 1.6rem 0 3rem;
  padding: 1rem 1.25rem;
  max-width: 46rem;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

@media (max-width: 640px) {
  .console-head { padding-top: 1.4rem; }
  .console-board { grid-template-columns: 1fr; }
  .console-feed-form { flex-direction: column; }
}

/* ---------- Accounts: sign-in page + masthead identity chip ---------- */

.auth-page {
  display: flex;
  justify-content: center;
  padding: clamp(2rem, 8vh, 5rem) 0;
}

.auth-card {
  width: min(26rem, 100%);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.75rem;
}

.auth-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.auth-title {
  font-family: var(--font-serif);
  margin: 0.35rem 0 0.5rem;
}

.auth-sub {
  color: var(--ink-muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

.auth-error {
  background: var(--warn-soft);
  color: var(--warn);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  margin: 0 0 1rem;
}

.auth-form { display: flex; flex-direction: column; }

.auth-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.3rem;
}

.auth-input {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-btn);
  padding: 0.6rem 0.7rem;
  margin-bottom: 1rem;
}

.auth-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.auth-submit {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-btn);
  padding: 0.65rem 1rem;
  cursor: pointer;
}

.auth-submit:hover { background: var(--accent-strong); }

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.account-chip-who {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.account-chip-who:hover { color: var(--ink); }

.account-chip-role {
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
}

.account-chip-out {
  font: inherit;
  font-size: 0.72rem;
  color: var(--ink-muted);
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius-btn);
  padding: 0.25rem 0.55rem;
  cursor: pointer;
}

.account-chip-out:hover { color: var(--ink); border-color: var(--rule-strong); }

/* The masthead is dense on phones; the chip is the first thing to go. */
@media (max-width: 40rem) {
  .account-chip-who { display: none; }
}

/* ---------- Per-account API key settings ---------- */

.key-settings {
  max-width: 58rem;
  margin: 2.5rem auto 4rem;
}

.key-settings-head {
  max-width: 46rem;
  margin-bottom: 2rem;
}

.key-settings-head h1 {
  margin: 0.2rem 0 0.75rem;
}

.key-settings-head p,
.key-settings-note p,
.key-card > p {
  color: var(--ink-muted);
}

.key-settings-eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.key-settings-message,
.key-settings-note {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: 1rem 1.15rem;
  margin: 0 0 1.25rem;
}

.key-settings-message {
  border-color: var(--accent);
  color: var(--ink);
}

.key-settings-message.is-error {
  border-color: var(--warn);
  color: var(--warn);
}

.key-settings-note h2 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.key-settings-note p {
  margin: 0;
}

.key-settings-note.is-warning {
  margin-top: 2rem;
  border-color: var(--warn);
}

.key-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.key-card {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 1.1rem;
}

.key-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.key-card-head h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.key-card-head code {
  font-size: 0.68rem;
  color: var(--ink-muted);
}

.key-card-state {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.67rem;
  color: var(--accent-strong);
}

.key-card-state.is-empty { color: var(--ink-muted); }

.key-card-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.key-card-form {
  margin: 1rem 0 0;
}

.key-card-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.key-card-actions {
  display: flex;
  gap: 0.5rem;
}

.key-card-actions input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--rule);
  border-radius: var(--radius-btn);
  background: var(--paper);
  padding: 0.55rem 0.65rem;
}

.key-card-actions button {
  flex: 0 0 auto;
}

.key-card-delete {
  margin: 0.75rem 0 0;
}

.key-card-delete button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--warn);
  font-size: 0.75rem;
  text-decoration: underline;
}

@media (max-width: 48rem) {
  .key-settings-grid { grid-template-columns: 1fr; }
  .key-card-head,
  .key-card-actions { align-items: stretch; flex-direction: column; }
}

/* ---------- Admin account register ---------- */

.account-admin {
  max-width: 66rem;
  margin: 2.5rem auto 4rem;
}

.account-admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.account-admin-head > div {
  max-width: 46rem;
}

.account-admin-head h1 {
  margin: 0.2rem 0 0.75rem;
}

.account-admin-head p,
.account-issue-copy p,
.account-admin-footnote {
  color: var(--ink-muted);
}

.account-admin-key-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  margin-top: 1rem;
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
}

.account-admin-key-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.account-register-index {
  margin: 0 0 0.45rem;
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.account-issue {
  display: grid;
  grid-template-columns: minmax(13rem, 0.8fr) minmax(22rem, 1.2fr);
  gap: clamp(2rem, 6vw, 5rem);
  padding: 1.6rem;
  border: 1px solid var(--rule-strong);
  background: var(--paper-raised, var(--card));
  box-shadow: var(--shadow-tight);
}

.account-issue h2,
.account-register-head h2 {
  margin: 0 0 0.55rem;
  font-size: clamp(1.55rem, 2vw + 0.7rem, 2.15rem);
}

.account-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(7rem, 0.6fr);
  gap: 0.9rem;
}

.account-create-form label,
.account-reset label {
  display: grid;
  gap: 0.32rem;
}

.account-create-form label > span,
.account-reset label > span,
.account-inline-form label {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.account-create-form input,
.account-create-form select,
.account-inline-form select,
.account-reset input {
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-btn);
  background: var(--paper);
  padding: 0.58rem 0.68rem;
}

.account-create-form input:focus-visible,
.account-create-form select:focus-visible,
.account-inline-form select:focus-visible,
.account-reset input:focus-visible,
.account-admin button:focus-visible,
.account-admin summary:focus-visible,
.account-admin-key-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.account-primary-action,
.account-inline-form button,
.account-reset button {
  border: 1px solid var(--accent);
  border-radius: var(--radius-btn);
  color: #fff;
  background: var(--accent);
  padding: 0.58rem 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.account-primary-action {
  align-self: end;
}

.account-create-form > small {
  align-self: center;
  color: var(--ink-muted);
}

.account-primary-action:hover,
.account-inline-form button:hover,
.account-reset button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.account-register {
  margin-top: 3rem;
}

.account-register-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--rule-strong);
}

.account-register-head > p {
  padding-bottom: 0.3rem;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.account-register-list {
  border-bottom: 1px solid var(--rule-strong);
}

.account-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(16rem, 1fr) minmax(23rem, 1.25fr);
  gap: 2rem;
  padding: 1.35rem 1rem 1.35rem 1.35rem;
  border-bottom: 1px solid var(--rule);
}

.account-row:last-child {
  border-bottom: 0;
}

.account-row-status {
  position: absolute;
  inset: 1.35rem auto 1.35rem 0;
  width: 3px;
  background: var(--accent);
}

.account-row.is-disabled .account-row-status {
  background: var(--warn);
}

.account-row.is-disabled .account-row-identity {
  opacity: 0.68;
}

.account-row-title {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.account-row-title h3 {
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: 0;
  font-family: var(--font-sans);
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-self {
  flex: 0 0 auto;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 0.08rem 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.account-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.25rem;
  margin-top: 0.75rem;
}

.account-row-meta div {
  display: grid;
  gap: 0.08rem;
}

.account-row-meta dt {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.account-row-meta dd {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.account-row-meta dd.is-active {
  color: var(--accent-strong);
}

.account-row-meta dd.is-disabled {
  color: var(--warn);
}

.account-row-controls {
  display: grid;
  gap: 0.85rem;
}

.account-inline-form {
  display: grid;
  grid-template-columns: auto minmax(6.5rem, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
}

.account-inline-form button {
  padding-inline: 0.75rem;
}

.account-inline-form :disabled,
.account-row-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.account-row-actions {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.account-row-actions form {
  margin: 0;
}

.account-state-action,
.account-reset summary {
  border: 1px solid var(--rule);
  border-radius: var(--radius-btn);
  color: var(--ink-muted);
  background: transparent;
  padding: 0.48rem 0.7rem;
  font-size: 0.72rem;
  cursor: pointer;
}

.account-state-action:hover,
.account-reset summary:hover {
  color: var(--ink);
  border-color: var(--rule-strong);
}

.account-state-action.is-danger {
  color: var(--warn);
}

.account-reset {
  min-width: 9rem;
}

.account-reset summary {
  width: fit-content;
  list-style: none;
}

.account-reset summary::-webkit-details-marker {
  display: none;
}

.account-reset[open] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--rule);
  background: var(--paper-soft);
}

.account-reset[open] summary {
  margin-bottom: 0.75rem;
  padding: 0;
  border: 0;
}

.account-reset form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.account-reset button,
.account-reset small {
  align-self: end;
}

.account-reset small,
.account-self-note {
  color: var(--ink-muted);
  font-size: 0.68rem;
}

.account-self-note {
  align-self: center;
}

.account-admin-footnote {
  max-width: 46rem;
  margin-top: 1.25rem;
  font-size: 0.78rem;
}

@media (max-width: 50rem) {
  .account-admin-head,
  .account-register-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-issue,
  .account-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 34rem) {
  .account-admin-page .masthead-inner {
    justify-content: space-between;
  }

  .account-admin-page .masthead-nav,
  .account-admin-page .city-switcher,
  .account-admin-page .saved-btn,
  .account-admin-page .theme-toggle {
    display: none;
  }

  .account-admin-page .masthead-actions {
    margin-left: auto;
  }

  .account-create-form,
  .account-reset form {
    grid-template-columns: 1fr;
  }

  .account-inline-form {
    grid-template-columns: 1fr auto;
  }

  .account-inline-form label {
    grid-column: 1 / -1;
  }
}
