:root {
  --ink: #1a1f36;
  --muted: #5a6178;
  --line: #e2e5ee;
  --brand: #1f6feb;
  --brand-dark: #1858c4;
  --bg: #f6f7fb;
  --warn-bg: #fff4e0;
  --warn-ink: #8a5a00;
  --ok-ink: #1e7a3c;
  --bad-ink: #a11;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.wrap { max-width: 680px; margin: 0 auto; padding: 0 20px; }

.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.site-header .wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 16px 20px;
}
.logo { font-weight: 700; font-size: 20px; }
.logo-sub { color: var(--muted); }

main.wrap { padding-top: 32px; padding-bottom: 64px; }

h1 { font-size: 27px; margin: 0 0 8px; }
h2 { font-size: 21px; margin: 0 0 8px; }
h3 { font-size: 17px; margin: 0 0 6px; }

.lead { color: var(--muted); margin: 0 0 24px; }

/* ── forms / inputs ─────────────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}

.field { display: block; margin: 0 0 16px; }
.field:last-child { margin-bottom: 0; }
.field > span { display: block; font-weight: 500; margin-bottom: 6px; }

.field-check { display: flex; align-items: flex-start; gap: 8px; }
.field-check input { width: auto; margin-top: 4px; }
.field-check span { font-weight: 400; }

.input-prefix, .input-suffix { display: flex; align-items: stretch; }
.input-prefix .prefix, .input-suffix .suffix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #eef1f8;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
}
.input-prefix .prefix { border-right: 0; border-radius: 8px 0 0 8px; }
.input-suffix .suffix { border-left: 0; border-radius: 0 8px 8px 0; }
.input-prefix input { border-radius: 0 8px 8px 0; }
.input-suffix input { border-radius: 8px 0 0 8px; }

.btn {
  display: inline-block;
  padding: 12px 20px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn:disabled { opacity: 0.5; cursor: default; }

.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--brand);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}
.linkish.danger { color: var(--bad-ink); }

.disclaimer, .cta-ack { color: var(--muted); font-size: 14px; margin-top: 12px; }

/* ── the wizard ────────────────────────────────────────────────────────── */
.wizard-progress { margin: 8px 0 24px; }
.progress-track {
  width: 100%;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.progress-pct { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }

.wizard-q { font-size: 21px; margin: 0 0 6px; }
.wizard-hint { color: var(--muted); margin: 0 0 18px; }
.wizard-body { margin-bottom: 8px; }
.wizard-note { font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.wizard-note.ok { color: var(--ok-ink); font-weight: 600; }
.wizard-note.warn { color: var(--warn-ink); }
.state-override { margin-top: 10px; }

.wizard-nav { display: flex; gap: 12px; margin-top: 24px; }
.wizard-nav .btn-primary { margin-left: auto; }

.wizard-error {
  background: #fdecec;
  color: var(--bad-ink);
  border: 1px solid #f4c4c4;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 14px 0 0;
  font-size: 14px;
}

.opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 8px;
  cursor: pointer;
}
.opt input { margin-top: 3px; }
.opt:hover { border-color: var(--brand); }

/* comparable-sales cards */
.comp-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #fff;
  margin-bottom: 12px;
}
.comp-card input { margin-bottom: 8px; }
.comp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.comp-grid input { margin-bottom: 0; }
.comp-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}
.comp-foot .opt { border: 0; padding: 0; margin: 0; background: none; }

/* per-comp finish rating — the user's own call: finished result vs that sale */
.finish-pick {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.finish-pick-label { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.finish-pick > label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.finish-pick > label:hover { border-color: var(--brand); }
.finish-pick input { margin: 0; flex: none; }

/* comparable-sales pool (PropRadar) */
.comps-count { font-size: 14px; font-weight: 600; color: var(--muted); margin: 0 0 10px; }
.pool-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  margin-bottom: 8px;
}
.pool-card:hover { border-color: var(--brand); }
.pool-card.selected { border-color: var(--brand); background: #f0f6ff; }
.pool-toprow { display: flex; gap: 12px; align-items: flex-start; }
.pool-toprow .photo-strip { width: 108px; height: 74px; }
@media (max-width: 480px) {
  .pool-toprow .photo-strip { width: 84px; height: 58px; }
}
.pool-select {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
.pool-select > input { margin-top: 3px; flex: none; }
.pool-main { min-width: 0; flex: 1; }

/* a comp's photo gallery — smart-default shot + click-through next/prev.
   Used on the wizard's pool cards and the report's GRV-evidence table. */
.photo-strip {
  position: relative;
  flex: none;
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}
.photo-strip img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-nav:hover { background: rgba(0, 0, 0, 0.7); }
.photo-prev { left: 4px; }
.photo-next { right: 4px; }
.photo-count {
  position: absolute;
  right: 4px;
  bottom: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 1px 6px;
  border-radius: 999px;
  line-height: 1.4;
}
.pool-top { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.pool-price { font-size: 16px; font-weight: 700; }
.pool-median {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.pool-median-low { background: #e8f0ff; color: #1858c4; }
.pool-median-mid { background: #eef1f8; color: var(--muted); }
.pool-median-high { background: #fdf2e0; color: var(--warn-ink); }
.pool-addr { font-weight: 500; margin-top: 2px; }
.pool-meta { font-size: 13px; color: var(--muted); margin-top: 3px; }

.manual-comps { margin-top: 14px; }
.manual-comps > summary { cursor: pointer; font-size: 14px; color: var(--brand); margin-bottom: 10px; }

.opt-group {
  margin: 20px 0 10px;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}
.opt-group:first-child { margin-top: 0; }
.opt-field span { font-size: 14px; }

/* TradeUp dense-screen fields (fork path) */
.tu-panel {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.tu-panel-figure {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 28px;
  font-weight: 700;
  margin: 4px 0 2px;
}

/* review screen */
.review-list { margin: 0; }
.review-row {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.review-row:last-child { border-bottom: 0; }
.review-row dt { flex: 0 0 42%; color: var(--muted); margin: 0; }
.review-row dd {
  margin: 0;
  flex: 1;
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: flex-end;
  text-align: right;
}
.review-row dd span { min-width: 0; }

/* ── working / report shells ──────────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 4px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-top: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sample-banner {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border: 1px solid #f0d9b0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 16px;
}
.delivery-note {
  background: #eef4ff;
  border: 1px solid #cfe0ff;
  color: #1a3a6b;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  margin: 0 0 16px;
}
#qualitative { font-size: 17px; }

.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

.error {
  background: #fdecec;
  color: var(--bad-ink);
  border: 1px solid #f4c4c4;
  border-radius: 8px;
  padding: 12px;
  margin-top: 20px;
}

.unlock-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  background: #fff;
  margin-top: 24px;
}

/* ── the report ───────────────────────────────────────────────────────── */
.report-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: #fff;
  margin-bottom: 14px;
}
.report-heading { margin: 0 0 10px; font-size: 17px; }
.report-section p { margin: 0; }
.spaced-list { padding-left: 20px; margin: 0; }
.spaced-list li { margin-bottom: 8px; }
.muted-note { color: var(--muted); font-size: 14px; }

.report-head .glance-where {
  margin: 0 0 4px;
  font-size: 13px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.verdict-block { border-width: 2px; }
.verdict-block.verdict-PASS { border-color: var(--ok-ink); }
.verdict-block.verdict-MARGINAL { border-color: var(--warn-ink); }
.verdict-block.verdict-FAIL { border-color: var(--bad-ink); }

.verdict-badge {
  display: inline-block;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 6px;
}
.verdict-badge-PASS { background: #e6f4ea; color: var(--ok-ink); }
.verdict-badge-MARGINAL { background: #fdf2e0; color: var(--warn-ink); }
.verdict-badge-FAIL { background: #fdecec; color: var(--bad-ink); }
.verdict-badge-NO_VERDICT_YET { background: #eef1f8; color: var(--muted); }

.verdict-blurb { margin: 8px 0 12px !important; color: var(--muted) !important; }
.verdict-commentary { margin-top: 12px !important; }

.kv-list { margin: 0; }
.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.kv-row:last-child { border-bottom: 0; }
.kv-row dt { color: var(--muted); margin: 0; }
.kv-row dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.kv-row.kv-strong dt, .kv-row.kv-strong dd { font-weight: 700; }
.kv-row.kv-warn dd { color: var(--bad-ink); font-weight: 700; }

.lever-label { font-weight: 700 !important; font-size: 16px; margin-bottom: 6px !important; }

.warn-list li { color: var(--warn-ink); }
.inline-note {
  color: var(--warn-ink);
  background: var(--warn-bg);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
}

.table-scroll { overflow-x: auto; margin: 10px 0; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  white-space: nowrap;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}
.data-table thead th { color: var(--muted); font-weight: 600; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td.neg { color: var(--bad-ink); }
.data-table .row-highlight { background: #f0f6ff; }
.data-table td.comp-photo-cell,
.data-table th.comp-photo-cell { padding: 4px 6px; width: 92px; }
.data-table .photo-strip { width: 84px; height: 58px; border-radius: 6px; }
.data-table td.finish-cell { font-weight: 600; white-space: nowrap; }
.data-table td.finish-superior { color: var(--brand-dark); }
.data-table td.finish-comparable { color: var(--muted); }
.data-table td.finish-inferior { color: var(--warn-ink); }

.stress-grid tbody th { color: var(--muted); font-weight: 600; }
.stress-grid td.cell-worst {
  background: #fdecec;
  font-weight: 700;
  outline: 2px solid var(--bad-ink);
  outline-offset: -2px;
}

.evidence-status {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 10px 0 4px !important;
}
.evidence-supported { color: var(--ok-ink); }
.evidence-thin { color: var(--warn-ink); }
.evidence-unsupported { color: var(--bad-ink); }

.eq-status {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 6px;
  margin: 0 0 10px !important;
}
.eq-well_supported { background: #e6f4ea; color: var(--ok-ink); }
.eq-mixed { background: #fdf2e0; color: var(--warn-ink); }
.eq-weak { background: #fdecec; color: var(--bad-ink); }
.eq-partial_supported,
.eq-partial_weak { background: #eef1f8; color: var(--muted); }
.eq-not_assessable { background: #eef1f8; color: var(--muted); }

.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.check-list li:last-child { border-bottom: 0; }
.check-mark {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 1px 7px;
  border-radius: 4px;
  margin-right: 8px;
}
.check-ok .check-mark { background: #e6f4ea; color: var(--ok-ink); }
.check-check .check-mark { background: #fdf2e0; color: var(--warn-ink); }
.check-label { font-weight: 600; }
.check-detail { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }

.report-footnote { background: #fafbfe; }
.report-footnote .disclaimer { margin-top: 10px; font-size: 13px; }

@media (max-width: 520px) {
  .comp-grid { grid-template-columns: 1fr 1fr; }
  .review-row { flex-direction: column; gap: 4px; }
  .review-row dd { text-align: left; }
}
