/* ============================================================================
   ATLAS REDESIGN — Quick Valuation (AVM) screen styles  ·  Wave-3 polish 2026-07-04
   Branch: atlas-redesign-2026-06-29

   Prefix: .rd-avm. Tokens only (--r-*) so Calm (almanac) + Operator themes
   both work automatically. No hardcoded hex. Theme-specific selectors
   (html[data-rtheme="operator"] …) are used only where a token can't express
   the tweak (rare). No class substrings -card/-panel/-badge/status-/rail.

   ADDRESS-DRIVEN valuation: window.fetchAvm(address) → POST /api/cma/avm.
   Nothing is computed client-side — every number here is either a real
   server-returned figure or the honest em-dash "—". No mock values are ever
   seeded. This file is presentation-only polish; the data flow lives in
   js/redesign/screens/avm.js and is unchanged.
   ========================================================================== */

.rd-avm {
  font-family: var(--r-font-body);
  color: var(--r-body);
  padding: var(--r-gutter);
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---- page header --------------------------------------------------------- */
.rd-avm-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rd-avm-eyebrow {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--r-clay);
}
.rd-avm-h1 {
  font-family: var(--r-font-display);
  font-size: var(--r-fs-h1);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.01em;
  color: var(--r-ink);
  margin: 0;
}
.rd-avm-sub {
  margin: 2px 0 0;
  font-size: var(--r-fs-body);
  line-height: 1.5;
  color: var(--r-muted);
  max-width: 640px;
}

/* ---- two-column body (Property | Estimate) ------------------------------- */
.rd-avm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* shared card chrome */
.rd-avm-card {
  background: var(--r-surface);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 22px 24px;
}
.rd-avm-card-title {
  margin: 0 0 4px;
  font-family: var(--r-font-display);
  font-size: var(--r-fs-h2);
  font-weight: 600;
  color: var(--r-ink);
}
.rd-avm-card-note {
  margin: 0;
  font-size: var(--r-fs-meta);
  color: var(--r-muted);
}

/* ---- property form ------------------------------------------------------- */
.rd-avm-field {
  display: block;
  margin-top: 16px;
}
.rd-avm-field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--r-muted);
  margin-bottom: 6px;
}
.rd-avm-input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-control);
  padding: 0 13px;
  font-size: 15px;
  font-family: inherit;
  color: var(--r-ink);
  background: var(--r-surface);
  outline: none;
  transition: border-color var(--r-dur) var(--r-ease),
              box-shadow var(--r-dur) var(--r-ease);
  -moz-appearance: textfield;
}
.rd-avm-input::-webkit-outer-spin-button,
.rd-avm-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rd-avm-input::placeholder { color: var(--r-faint); }
.rd-avm-input:hover { border-color: color-mix(in srgb, var(--r-primary) 30%, var(--r-border)); }
.rd-avm-input:focus {
  border-color: var(--r-primary);
  box-shadow: 0 0 0 3px var(--r-select);
}
.rd-avm-input:focus-visible { outline: var(--r-focus); outline-offset: 2px; }

/* ---- estimate panel ------------------------------------------------------ */
.rd-avm-estimate {
  background: linear-gradient(180deg, var(--r-surface), var(--r-surface-2));
}
.rd-avm-est-label {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--r-faint);
}
.rd-avm-est-value {
  font-family: var(--r-font-display);
  font-size: 42px;
  font-weight: 600;
  line-height: 1.05;
  margin-top: 6px;
  color: var(--r-ink);
}

/* ---- range band: low ——●—— high (same visual language as cma.js's
   rd-cma-band — dynamic mark position, not a fixed midpoint) ---------------- */
.rd-avm-band { margin-top: 14px; }
.rd-avm-band-track {
  position: relative;
  height: 8px;
  border-radius: var(--r-radius-pill);
  background: var(--r-hairline);
  overflow: visible;
}
.rd-avm-band-fill {
  position: absolute; inset: 0;
  width: 0;
  border-radius: var(--r-radius-pill);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--r-primary) 35%, transparent),
    var(--r-primary));
  transition: width .5s var(--r-ease);
}
.rd-avm-band-fill.is-in { width: 100%; }
.rd-avm-band-mark {
  position: absolute; top: 50%;
  width: 16px; height: 16px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--r-surface);
  border: 3px solid var(--r-primary);
  box-shadow: 0 1px 3px rgba(33, 31, 26, .25);
}
.rd-avm-band-ends {
  display: flex; justify-content: space-between;
  margin-top: 7px;
  font-family: var(--r-font-mono);
  font-size: 11.5px; font-weight: 600;
  color: var(--r-muted);
  font-variant-numeric: tabular-nums;
}

/* confidence + comp source row */
.rd-avm-conf {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.rd-avm-conf-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--r-font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--r-primary);
  background: var(--r-mint-surface);
  border: 1px solid color-mix(in srgb, var(--r-primary) 35%, transparent);
  border-radius: var(--r-radius-pill);
  padding: 5px 10px;
}
.rd-avm-conf-badge[data-conf="med"] {
  color: var(--r-amber);
  background: color-mix(in srgb, var(--r-amber) 16%, transparent);
  border-color: color-mix(in srgb, var(--r-amber) 45%, transparent);
}
.rd-avm-conf-badge[data-conf="low"] {
  color: var(--r-clay-2);
  background: color-mix(in srgb, var(--r-clay) 16%, transparent);
  border-color: color-mix(in srgb, var(--r-clay) 45%, transparent);
}
.rd-avm-conf-badge[data-conf="none"] {
  color: var(--r-faint);
  background: var(--r-well);
  border-color: var(--r-border);
}
.rd-avm-conf-badge i { font-size: 12px; }
.rd-avm-conf-src {
  font-size: 12px;
  color: var(--r-faint);
}

/* honest empty / pending note inside the estimate panel */
.rd-avm-est-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0 0;
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .03em;
  color: var(--r-faint);
  line-height: 1.5;
  padding: 11px 12px;
  border: 1px dashed var(--r-border);
  border-radius: var(--r-radius-control);
}
.rd-avm-est-note i { flex: 0 0 auto; margin-top: 1px; font-size: 14px; color: var(--r-faint); }
/* failure / guidance note (service down or address not resolvable) reads as an alert */
.rd-avm-est-note[data-tone="alert"] {
  border-style: solid;
  border-color: color-mix(in srgb, var(--r-alert) 35%, var(--r-border));
  color: var(--r-body);
}
.rd-avm-est-note[data-tone="alert"] i { color: var(--r-alert); }

/* Build the full CMA CTA */
.rd-avm-cta {
  appearance: none;
  margin-top: 18px;
  width: 100%;
  height: 44px;
  border-radius: var(--r-radius-control);
  border: none;
  background: var(--r-primary);
  color: var(--r-primary-ink);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: filter var(--r-dur) var(--r-ease),
              transform var(--r-dur) var(--r-ease),
              box-shadow var(--r-dur) var(--r-ease);
}
.rd-avm-cta i { font-size: 15px; }
.rd-avm-cta:hover { filter: brightness(1.06); box-shadow: var(--r-shadow-hover); transform: translateY(-2px); }
.rd-avm-cta:active { transform: translateY(0); }
.rd-avm-cta:focus-visible { outline: var(--r-focus); outline-offset: 2px; }

/* secondary/ghost variant — "Build the full CMA" reads as the follow-up
   action, never competing visually with "Value this address". */
.rd-avm-cta.rd-avm-cta--ghost {
  background: var(--r-surface);
  color: var(--r-primary);
  border: 1px solid var(--r-border);
}
.rd-avm-cta.rd-avm-cta--ghost:hover {
  background: var(--r-canvas-raised);
  border-color: var(--r-primary);
  filter: none;
  box-shadow: none;
  transform: none;
}

/* ---- responsive collapse ------------------------------------------------- */
@media (max-width: 980px) {
  .rd-avm-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .rd-avm-est-value { font-size: 34px; }
}

/* ==== resolved-subject chips + comps list ================================= */
.rd-avm-subject { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.rd-avm-subject:empty { display: none; }
.rd-avm-subject-chip {
  font-family: var(--r-font-mono); font-size: 12px; color: var(--r-muted);
  background: var(--r-well); border: 1px solid var(--r-hairline);
  border-radius: var(--r-radius-badge); padding: 4px 9px;
}
.rd-avm-subject-chip b { color: var(--r-ink); font-weight: 600; }

.rd-avm-comps[hidden] { display: none; }
.rd-avm-comps-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.rd-avm-comps-title { margin: 0; font-family: var(--r-font-display); font-size: var(--r-fs-h2); font-weight: 600; color: var(--r-ink); }
.rd-avm-comps-note { font-size: 12px; color: var(--r-muted); }
.rd-avm-comp-list { display: flex; flex-direction: column; }
.rd-avm-comp {
  display: grid;
  grid-template-columns: 1.7fr 0.9fr 0.7fr 0.7fr 0.8fr;
  gap: 10px; align-items: center;
  padding: 11px 8px; border-top: 1px solid var(--r-hairline);
  border-radius: var(--r-radius-chip);
  font-size: 13px;
  transition: background var(--r-dur) var(--r-ease);
}
.rd-avm-comp:first-child { border-top: none; }
.rd-avm-comp:not(.rd-avm-comp-head):hover { background: var(--r-canvas-raised); }
.rd-avm-comp-addr { font-weight: 600; color: var(--r-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-avm-comp-price { font-family: var(--r-font-mono); font-weight: 600; color: var(--r-ink); text-align: right; }
.rd-avm-comp-cell { font-family: var(--r-font-mono); font-size: 12px; color: var(--r-muted); text-align: right; }
.rd-avm-comp-head { border-radius: 0; }
.rd-avm-comp-head .rd-avm-comp-addr,
.rd-avm-comp-head .rd-avm-comp-price,
.rd-avm-comp-head .rd-avm-comp-cell {
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--r-faint); font-weight: 600;
}
@media (max-width: 720px) {
  .rd-avm-comp { grid-template-columns: 1.5fr 0.9fr 0.8fr; }
  .rd-avm-comp-sqft, .rd-avm-comp-date { display: none; }
}
