:root {
  --ink: #0e1a2b;
  --paper: #f7f5ee;
  --rule: #1d2a3d;
  --accent: #b54d2c;
  --muted: #5c6473;
  --good: #2f8c4e;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: ui-serif, "Iowan Old Style", "Georgia", serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
.container { max-width: 920px; margin: 0 auto; padding: 0 24px; }

/* Hero */
.hero { background: var(--ink); color: var(--paper); padding: 72px 0 56px; border-bottom: 1px solid var(--rule); }
.eyebrow { font-family: ui-sans-serif, "Inter", system-ui, sans-serif; font-size: 11px; letter-spacing: 0.18em; color: var(--accent); margin: 0 0 12px; text-transform: uppercase; }
h1 { font-size: clamp(40px, 7vw, 72px); line-height: 1.02; margin: 0 0 16px; font-weight: 500; letter-spacing: -0.02em; }
.ital { color: var(--accent); font-style: italic; font-weight: 400; }
.lede { font-size: 19px; max-width: 640px; margin: 0 0 24px; opacity: 0.85; }
.status { font-family: ui-monospace, "JetBrains Mono", monospace; font-size: 12px; opacity: 0.7; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.12); padding: 8px 12px; border-radius: 4px; display: inline-block; }

/* Search section */
.search { padding: 56px 24px; max-width: 920px; margin: 0 auto; }
h2 { font-size: 28px; margin: 0 0 16px; font-weight: 500; letter-spacing: -0.01em; }
.search-row { display: flex; gap: 8px; margin-bottom: 8px; }
.search-row input { flex: 1; padding: 14px 16px; font-size: 16px; border: 1px solid var(--rule); background: white; border-radius: 4px; font-family: inherit; }
.search-row input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.search-row button { padding: 14px 22px; font-size: 15px; background: var(--ink); color: var(--paper); border: 0; border-radius: 4px; cursor: pointer; font-family: ui-sans-serif, system-ui, sans-serif; font-weight: 500; letter-spacing: 0.01em; }
.search-row button:hover { background: var(--accent); }
.hint { color: var(--muted); font-size: 14px; margin: 0; }

#result { margin-top: 32px; }
.parcel-card { background: white; border: 1px solid var(--rule); border-radius: 6px; padding: 28px; }
.parcel-card h3 { margin: 0 0 4px; font-size: 24px; font-weight: 500; }
.parcel-card .pin { font-family: ui-monospace, monospace; font-size: 13px; color: var(--muted); margin: 0 0 24px; }
.kv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid #e5e1d7; }
.kv-grid .kv { font-family: ui-sans-serif, system-ui, sans-serif; }
.kv-grid .kv .label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.kv-grid .kv .val { font-size: 22px; font-weight: 500; color: var(--ink); }
.kv-grid .kv .sub { font-size: 12px; color: var(--muted); }

.section-title { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; font-family: ui-sans-serif, system-ui, sans-serif; }
.sales-table { width: 100%; border-collapse: collapse; font-size: 14px; font-family: ui-sans-serif, system-ui, sans-serif; }
.sales-table th { text-align: left; font-weight: 500; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 8px 12px 8px 0; border-bottom: 1px solid #e5e1d7; }
.sales-table td { padding: 10px 12px 10px 0; border-bottom: 1px solid #f0eee5; }
.sales-table td:last-child { color: var(--muted); font-size: 13px; }

.amenities { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; letter-spacing: 0.05em; padding: 4px 10px; background: rgba(181, 77, 44, 0.08); color: var(--accent); border-radius: 100px; }

.error { background: #fdf2eb; border: 1px solid #f3c9af; color: #8a3d20; padding: 16px; border-radius: 4px; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 14px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stat-card { background: white; border: 1px solid #e5e1d7; padding: 20px; border-radius: 4px; font-family: ui-sans-serif, system-ui, sans-serif; }
.stat-card .num { font-size: 32px; font-weight: 500; color: var(--ink); letter-spacing: -0.01em; font-family: ui-serif, serif; }
.stat-card .lbl { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }

/* Methodology */
.methodology { padding: 32px 24px 64px; }
.plan { padding-left: 20px; font-size: 16px; color: var(--ink); }
.plan li { margin: 12px 0; }
.plan strong { color: var(--accent); }

/* Footer */
footer { padding: 32px 24px; border-top: 1px solid #e5e1d7; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; color: var(--muted); }
footer a { color: var(--ink); text-decoration: underline; }
footer .src { margin-top: 8px; font-size: 11px; opacity: 0.8; }

@media (max-width: 640px) {
  .kv-grid { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 48px; }
  .search-row { flex-direction: column; }
}

.cand-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.cand { background: #fff; border: 1px solid #e5e1d7; border-radius: 6px; padding: 10px 14px; text-align: left; cursor: pointer; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 14px; color: var(--ink); transition: border-color 0.15s, background 0.15s; }
.cand:hover { border-color: var(--accent); background: #fdf6f1; }
.parcel-card .pin a { color: var(--accent); text-decoration: none; }
.parcel-card .pin a:hover { text-decoration: underline; }

.warn { background: #fdf6e7; border: 1px solid #d4a64a; border-left: 4px solid #b87333; border-radius: 6px; padding: 12px 14px; margin: 0 0 16px; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 14px; color: #5c3a0a; }
.matched-label { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }

/* Valuation band */
.label-sub { font-weight: 400; font-size: 11px; color: var(--muted); letter-spacing: 0.04em; text-transform: none; }
.valuation { background: #fdfbf6; border: 1px solid #e5e1d7; border-radius: 8px; padding: 20px; margin-top: 4px; }
.val-band { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 14px; align-items: stretch; }
.val-band > div { padding: 14px 16px; border-radius: 6px; }
.band-low, .band-high { background: #fff; border: 1px solid #e5e1d7; text-align: center; }
.band-point { background: var(--ink); color: #fdf6e7; text-align: center; box-shadow: 0 4px 12px rgba(11,13,19,0.15); }
.band-label { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 10px; font-weight: 600; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 6px; }
.band-point .band-label { color: rgba(253,246,231,0.7); }
.band-num { font-family: 'EB Garamond', Georgia, serif; font-size: 28px; font-weight: 600; line-height: 1.1; }
.band-point .band-num { font-size: 36px; color: #fff; }
.band-sub { margin-top: 6px; font-size: 11px; font-family: ui-sans-serif, system-ui, sans-serif; }
.gap-up { color: #f4c069; font-weight: 600; }
.gap-down { color: #99c4ec; font-weight: 600; }
.method-note { margin: 16px 0 0; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; color: var(--muted); line-height: 1.55; }
.method-note strong { color: var(--ink); }
.footnote { margin: 12px 0 0; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; color: var(--muted); font-style: italic; }
.comp-detail { margin-top: 12px; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; }
.comp-detail summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 6px 0; }
.comp-detail summary:hover { text-decoration: underline; }
.comps-table { font-size: 12px; margin-top: 8px; }
.comps-table th { padding: 6px 8px; }
.comps-table td { padding: 6px 8px; }

@media (max-width: 640px) {
  .val-band { grid-template-columns: 1fr; }
  .band-num { font-size: 24px; }
  .band-point .band-num { font-size: 28px; }
}

/* HITL override block */
.hitl-block { margin-top: 20px; padding: 16px 18px; background: #f4ede1; border: 1px solid #d6c9aa; border-left: 4px solid var(--accent); border-radius: 6px; }
.hitl-title { margin: 0 0 6px; font-family: 'EB Garamond', Georgia, serif; font-size: 16px; font-weight: 600; color: var(--ink); }
.hitl-body { margin: 0 0 14px; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; color: #4a4a4a; line-height: 1.55; }
.hitl-controls label { display: block; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.hitl-controls label strong { color: var(--ink); font-size: 16px; font-family: 'EB Garamond', Georgia, serif; }
.hitl-controls input[type="range"] { width: 100%; accent-color: var(--accent); margin: 4px 0; }
.hitl-scale { display: flex; justify-content: space-between; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 10px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 4px; }
.cond-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.cond-btn { flex: 1 1 auto; min-width: 120px; padding: 10px 12px; border: 1px solid #d6c9aa; background: #fbf6ea; color: var(--ink); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; font-weight: 500; border-radius: 6px; cursor: pointer; transition: all 0.15s ease; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cond-btn:hover { border-color: var(--accent); background: #fff; }
.cond-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 1px 3px rgba(1,105,111,0.25); }
.cond-btn .cond-mult { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 11px; opacity: 0.8; font-weight: 400; }

/* ZIP breakdown table */
.zip-table { width: 100%; border-collapse: collapse; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 14px; }
.zip-table th { text-align: left; padding: 8px 12px; border-bottom: 2px solid #d6c9aa; font-weight: 600; color: var(--ink); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.zip-table td { padding: 10px 12px; border-bottom: 1px solid #ebe4d3; color: var(--ink); }
.zip-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.zip-table tbody tr:hover { background: #fbf6ea; }

/* Excluded audit block */
.excluded-audit {
  margin-top: 12px;
  background: #fdf6ee;
  border: 1px solid #ead9c4;
  border-radius: 6px;
}
.excluded-audit > summary {
  padding: 10px 14px;
  font-size: 0.92rem;
  color: #6b4a1f;
}
.excl-summary {
  list-style: none;
  padding: 8px 14px 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.88rem;
  color: #5a3d18;
}
.excl-summary li { background: #f5e7d1; padding: 4px 10px; border-radius: 4px; }
.excl-tag {
  display: inline-block;
  background: #e8d2b2;
  color: #5a3d18;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-right: 6px;
  white-space: nowrap;
}
.excl-detail { font-size: 0.82rem; color: #7a5b32; }
.excluded-audit .footnote { padding: 4px 14px 12px; }

/* ─────── Tab navigation ─────── */
.tabnav {
  margin-top: 28px;
  border-bottom: 1px solid rgba(255,255,255,0.18);
  display: flex;
  gap: 4px;
}
.tabnav .tab {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.7);
  padding: 12px 22px;
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 120ms, border-color 120ms;
}
.tabnav .tab:hover { color: #fff; }
.tabnav .tab.active {
  color: #fff;
  border-bottom-color: #d96a4a;
  font-weight: 600;
}
.tabpane { padding-top: 32px; padding-bottom: 48px; }

/* ─────── Hot Sheet header & controls ─────── */
.hotsheet-head {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}
@media (min-width: 960px) {
  .hotsheet-head { flex-direction: row; align-items: flex-end; justify-content: space-between; }
}
.hotsheet-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-end;
}
.ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ctrl-group > label {
  font-size: 0.72rem;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #6b7280;
}
.pill-group { display: flex; gap: 4px; }
.pill {
  background: #f1eee8;
  border: 1px solid transparent;
  color: #5a5650;
  padding: 6px 12px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 120ms;
}
.pill:hover { background: #e8e3da; }
.pill.active {
  background: #d96a4a;
  color: #fff;
  border-color: #b8522f;
  font-weight: 600;
}
.csv-btn {
  background: #1b1f24;
  color: #fff;
  border: 0;
  padding: 9px 16px;
  border-radius: 4px;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.csv-btn:hover { background: #2a3038; }

/* ─────── KPI strip ─────── */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.kpi {
  background: #fff;
  border: 1px solid #e8e3da;
  border-radius: 8px;
  padding: 16px 18px;
}
.kpi-num {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.8rem;
  color: #1b1f24;
  line-height: 1.1;
}
.kpi-lbl {
  font-size: 0.78rem;
  color: #6b7280;
  letter-spacing: 0.3px;
  margin-top: 4px;
}
.kpi.by-zip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.zip-pill {
  background: #f1eee8;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.82rem;
  color: #5a5650;
}
.zip-pill.sm { padding: 2px 7px; font-size: 0.74rem; }

/* ─────── Hot Sheet body layout ─────── */
.hotsheet-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 1100px) {
  .hotsheet-body { grid-template-columns: 1fr 320px; }
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 12px;
}
.section-head h3 { margin: 0; }
.sort-row { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: #6b7280; }
.sort-row select {
  background: #fff;
  border: 1px solid #d6d2c8;
  padding: 5px 9px;
  border-radius: 4px;
  font: inherit;
  font-size: 0.85rem;
}

.hs-main tr[data-pin] { cursor: pointer; }
.hs-main tr[data-pin]:hover { background: #f9f5ed; }
.plat-sub {
  font-size: 0.74rem;
  color: #8a8276;
  font-weight: normal;
}

/* ─────── Side panel ─────── */
.side-card {
  background: #fff;
  border: 1px solid #e8e3da;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.side-card h3 { margin: 0 0 6px; font-size: 1rem; }
.side-card .hint { margin: 0 0 12px; }
.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.mini-table th, .mini-table td {
  padding: 5px 4px;
  text-align: left;
  border-bottom: 1px solid #f1ede6;
}
.mini-table th { font-size: 0.7rem; text-transform: uppercase; color: #6b7280; }
.mini-table td.num, .mini-table th.num { text-align: right; }

.rej-row {
  padding: 10px 0;
  border-bottom: 1px solid #f1ede6;
  font-size: 0.84rem;
}
.rej-row:last-child { border-bottom: 0; }
.rej-top { color: #1b1f24; }
.rej-meta { font-size: 0.78rem; color: #6b7280; margin-top: 2px; }
.rej-meta.names { font-family: 'Courier New', monospace; font-size: 0.74rem; }
.rej-reasons { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.rej-tag {
  background: #fdf1eb;
  color: #8a3a1a;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

/* MLS description parser block */
.mls-block .mls-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #d3ded1;
  border-radius: 6px;
  background: #fff;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  color: var(--ink);
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}
.mls-block .mls-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(1,105,111,0.15);
}
.mls-parse-btn {
  padding: 9px 16px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.mls-parse-btn:hover { opacity: 0.9; }
.mls-parse-btn:disabled { opacity: 0.5; cursor: wait; }
.mls-clear-btn {
  padding: 9px 12px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
}
.mls-result { margin-top: 14px; padding-top: 14px; border-top: 1px dashed #d3ded1; }
.mls-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.mls-badge {
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.mls-infer { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 14px; color: var(--ink); }
.mls-mult { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 13px; color: #4a4a4a; margin-left: auto; }
.mls-signals { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.mls-sig {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  color: #4a4a4a;
  padding: 4px 8px;
  background: #fff;
  border: 1px solid #e2e8de;
  border-radius: 4px;
}
.mls-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.mls-chip {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  padding: 3px 8px;
  background: #fff;
  border: 1px solid #d3ded1;
  border-radius: 999px;
  color: #4a4a4a;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mls-chip-renovation { border-color: #d6c9aa; background: #fbf6ea; }
.mls-chip-luxury { border-color: #b3d3aa; background: #eef7ea; }
.mls-chip-view { border-color: #aac4d3; background: #eaf1f7; }
.mls-chip-location { border-color: #cabbd6; background: #f2eaf7; }
.mls-apply-btn {
  padding: 9px 16px;
  border: 1px solid #437A22;
  background: #437A22;
  color: #fff;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.mls-apply-btn:hover { opacity: 0.9; }
