@font-face {
  font-family: "Inter";
  src: url("vendor/inter/inter-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("vendor/inter/inter-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("vendor/inter/inter-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #221d18;
  --muted: #6f6a63;
  --accent: #c2410c;
  --accent-tint: #fdf3ee;
  --hairline: #e7e2db;
  --bg: #f7f5f2;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(30, 20, 10, 0.04), 0 4px 14px rgba(30, 20, 10, 0.05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0 0 4rem;
  background: var(--bg);
  color: var(--ink);
  font: 15.5px/1.55 "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

button, select, input { transition: border-color 0.15s, background-color 0.15s, color 0.15s, box-shadow 0.15s; }

:where(button, select, input, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Hero header */
.hero {
  background: linear-gradient(140deg, #c94a12 0%, #a33307 55%, #872905 100%);
  padding: 1.9rem 0 2.3rem;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
  color: inherit;
  text-decoration: none;
}

.brand:hover .logo { background: rgba(255, 255, 255, 0.28); }

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  transition: background-color 0.15s;
}

.hero h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.tagline {
  margin: 0.15rem 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
}

/* Search */
.search-wrap { position: relative; }

#search {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 2.7rem;
  font: inherit;
  color: var(--ink);
  background: var(--card)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f6a63' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.8-3.8'/%3E%3C/svg%3E")
    no-repeat 0.9rem center / 1.1rem;
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(40, 15, 0, 0.25);
  outline: none;
}

#search:focus { box-shadow: 0 6px 20px rgba(40, 15, 0, 0.25), 0 0 0 3px rgba(255, 255, 255, 0.35); }

.suggestions {
  position: absolute;
  z-index: 20;
  left: 0; right: 0;
  margin: 0.3rem 0 0;
  padding: 0.25rem;
  list-style: none;
  color: var(--ink); /* don't inherit the hero's white text */
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(30, 20, 10, 0.14);
  max-height: 20rem;
  overflow-y: auto;
}

.suggestions li {
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  border-radius: 6px;
}

.suggestions li.active,
.suggestions li:hover { background: var(--accent-tint); }

.suggestions .s-street { color: var(--muted); font-size: 0.85rem; }
.suggestions .s-count { float: right; color: var(--muted); font-size: 0.85rem; }
.suggestions li.none { color: var(--muted); cursor: default; background: none; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.4rem 1.4rem;
  margin-top: 1.5rem;
}

.card-title { margin: 0 0 0.75rem; font-size: 1.02rem; letter-spacing: -0.005em; }

/* Empty state (before a project is chosen) */
.empty-state { text-align: left; }

.empty-state h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }

.empty-state .meta { margin: 0 0 1rem; }

.try-label {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.examples { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.example-chip {
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  cursor: pointer;
}

.example-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-tint); }

/* Market snapshot (landing page) */
.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.snapshot-tile {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
  padding: 0.5rem 0.65rem 0.55rem;
  background: #fbfaf8;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.snapshot-tile:hover { border-color: var(--accent); background: var(--accent-tint); }

.snap-name {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.snap-psf { font-weight: 600; font-variant-numeric: tabular-nums; }

.snapshot-tile .trend { font-size: 0.72rem; }

.snapshot-note { margin-top: 0.85rem; }

/* Project header + quick stats */
#project-view { margin-top: 0; }

.project-head { margin-top: 2rem; }

.head-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

#project-name { margin: 0; font-size: 1.3rem; letter-spacing: -0.01em; }

#copy-link {
  font: inherit;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  cursor: pointer;
  white-space: nowrap;
}

#copy-link:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-tint); }

.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.55rem; }

.tag {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.78rem;
  color: var(--ink);
  white-space: nowrap;
}

.tag.freehold { background: #e5f3e9; color: #1c6b38; border-color: transparent; }

.meta {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.stat {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.7rem 0.95rem 0.8rem;
  min-width: 0;
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.stat-value {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.15rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-sub {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.trend { font-weight: 600; }
.trend.up { color: #1c6b38; }
.trend.down { color: #b3261e; }

.stat-value.up { color: #1c6b38; }
.stat-value.down { color: #b3261e; }

/* Chart */
.chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

#legend { display: inline-flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; }

.legend-chip { display: inline-flex; align-items: center; gap: 0.4rem; }

.chip-remove {
  border: none;
  background: none;
  padding: 0 0.1rem;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.chip-remove:hover { color: var(--accent); }

.compare-wrap { flex: 0 0 auto; }

.compare-wrap input {
  width: 12.5rem;
  padding: 0.3rem 0.6rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  outline: none;
}

.compare-wrap input:focus { border-color: var(--accent); }
.compare-wrap input:disabled { background: var(--bg); color: var(--muted); }

.compare-wrap .suggestions { min-width: 24rem; }
.legend-chip.toggle { cursor: pointer; }
.legend-chip input { margin: 0; accent-color: var(--accent); }

#size-filters { display: inline-flex; flex-wrap: wrap; gap: 0.75rem; }

.size-filter-wrap { position: relative; }

.size-filter-wrap button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  background: var(--card);
  cursor: pointer;
}

.size-filter-wrap button:hover { border-color: var(--accent); background: var(--accent-tint); }

.size-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.3rem);
  left: 0;
  min-width: 11rem;
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.45rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(30, 20, 10, 0.14);
  color: var(--ink);
}

.size-panel[hidden] { display: none; }

.size-panel label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0;
  cursor: pointer;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.size-panel label:first-child {
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 0.35rem;
  margin-bottom: 0.2rem;
}

.size-panel input { accent-color: var(--accent); }

.swatch.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.swatch.dash {
  width: 16px; height: 0;
  border-top: 2px solid var(--muted);
}

.swatch.dash.trend { border-top: 2px dashed var(--accent); }

.swatch.ring {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: transparent;
  flex: none;
}

/* Chart time-range segmented control */
.seg {
  display: inline-flex;
  margin-left: auto;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--card);
  overflow: hidden;
}

.seg button {
  font: inherit;
  font-size: 0.8rem;
  border: none;
  background: none;
  padding: 0.22rem 0.75rem;
  color: var(--muted);
  cursor: pointer;
}

.seg button + button { border-left: 1px solid var(--hairline); }
.seg button.active { background: var(--accent); color: #fff; }
.seg button:not(.active):hover { background: var(--accent-tint); color: var(--accent); }

.chart-wrap {
  position: relative;
  height: 330px;
  margin-bottom: 0.25rem;
}

#chart-note { margin-bottom: 0; }

/* Transactions table */
.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.table-controls #row-count { margin: 0; }

.pager { display: inline-flex; align-items: center; gap: 0.5rem; }

.pager[hidden] { display: none; }

.pager button {
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  cursor: pointer;
}

.pager button:disabled { opacity: 0.4; cursor: default; }
.pager button:not(:disabled):hover { border-color: var(--accent); background: var(--accent-tint); }

/* Table size filter sits near the right edge — open its panel leftwards. */
#txn-size-filter .size-panel { left: auto; right: 0; }

.table-controls select {
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 0.15rem 0.3rem;
  background: var(--card);
}

.table-scroll { overflow-x: auto; }

/* Long tables scroll inside the card with the header row pinned. The header's
   collapsed border can't stick with it, so an inset shadow draws the rule. */
.table-scroll.tall { max-height: 70vh; overflow: auto; }

.table-scroll.tall thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--card);
  border-bottom: none;
  box-shadow: inset 0 -2px 0 #d8d2c9;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

th, td {
  padding: 0.45rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
}

th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 2px solid #d8d2c9;
}

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th.sorted-asc::after { content: " ▲"; font-size: 0.65rem; color: var(--accent); }
th.sorted-desc::after { content: " ▼"; font-size: 0.65rem; color: var(--accent); }

#txn-table tbody tr:nth-child(even),
#district-table tbody tr:nth-child(even) { background: #faf8f5; }
#txn-table tbody tr:hover,
#district-table tbody tr:hover { background: var(--accent-tint); }
#txn-table tbody tr:last-child td,
#district-table tbody tr:last-child td { border-bottom: none; }

#district-table a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

#district-table a:hover { text-decoration: underline; }

.num { text-align: right; }

/* Sale-type badges */
.pill {
  display: inline-block;
  padding: 0.08rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill.sale-new { background: #e5f3e9; color: #1c6b38; }
.pill.sale-sub { background: #fcf0d4; color: #8f5a0a; }
.pill.sale-resale { background: #e9eefb; color: #3752a4; }

td .bulk {
  color: var(--accent);
  font-size: 0.8rem;
  white-space: nowrap;
  margin-left: 0.35rem;
}

/* Price by floor band */
#floor-table { width: auto; min-width: 26rem; }
#floor-table tr.thin td { color: var(--muted); font-size: 0.85rem; }

/* Nearby comparable projects */
#comps-table a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

#comps-table a:hover { text-decoration: underline; }

#comps-table td { white-space: nowrap; }
#comps-table td:first-child { white-space: normal; }

.comps-compare {
  font: inherit;
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  cursor: pointer;
  white-space: nowrap;
}

.comps-compare:not(:disabled):hover { border-color: var(--accent); color: var(--accent); background: var(--accent-tint); }
.comps-compare:disabled { opacity: 0.55; cursor: default; }

/* Layouts grid */
.grid-scroll { overflow-x: auto; margin-top: 0.25rem; }

#layout-grid { width: auto; border-collapse: collapse; }

#layout-grid th, #layout-grid td {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--hairline);
  vertical-align: top;
  font-size: 0.78rem;
  white-space: nowrap;
}

#layout-grid thead th {
  text-align: right;
  border-bottom: 2px solid #d8d2c9;
  background: var(--card);
}

#layout-grid thead th:first-child { text-align: left; }

#layout-grid th .sub { display: block; font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: 0; }

#layout-grid tbody th {
  text-align: left;
  font-weight: 600;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  position: sticky;
  left: 0;
  background: var(--card);
  border-right: 2px solid #d8d2c9;
}

#layout-grid td.empty { background: #faf8f5; }

#layout-grid .cell-txn { display: block; }

#layout-grid td.summary { background: #fbf7f2; }
#layout-grid td.summary .cell-n { display: block; font-weight: 600; }
#layout-grid td.summary .cell-txn { color: var(--muted); }

/* Radius map */
.map-layout {
  display: grid;
  grid-template-columns: 1fr 16rem;
  gap: 1rem;
  margin-top: 0.75rem;
}

.map-layout[hidden] { display: none; }

#map {
  height: 420px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
}

#nearby-panel h4 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

#nearby-panel h4 + ul {
  margin: 0 0 1.1rem;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
}

#nearby-panel li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.15rem 0;
}

#nearby-panel li.none { color: var(--muted); }

#nearby-panel .dist {
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.swatch.dot.school { background: #c2410c; }
.swatch.dot.station { background: #4a3aa7; }

footer {
  margin-top: 3rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 600px) {
  body { padding-bottom: 3rem; }
  .container { padding: 0 0.75rem; }
  .hero { padding: 1.4rem 0 1.8rem; }
  .snapshot-grid { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 1rem 0.9rem 1.1rem; }
  th, td { padding: 0.4rem 0.4rem; font-size: 0.85rem; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  #floor-table { min-width: 0; }
  .map-layout { grid-template-columns: 1fr; }
  #map { height: 300px; }
  .compare-wrap .suggestions { min-width: 0; }
  .table-controls { flex-wrap: wrap; }
  /* 16px stops iOS Safari from auto-zooming when an input or select is focused. */
  #search, .compare-wrap input, .table-controls select { font-size: 16px; }
  /* Roomier touch targets. */
  .seg button { padding: 0.4rem 0.85rem; }
  .pager button { padding: 0.3rem 0.8rem; }
  .size-filter-wrap button { padding: 0.32rem 0.8rem; }
  .example-chip { padding: 0.42rem 0.95rem; }
  .comps-compare { padding: 0.25rem 0.7rem; }
}
