/* RentOptix live dashboard. Uses the site's blue; green/rose carry pass/fail. */
.dash-body {
  --ink: #0f172a;
  --slate: #475569;
  --muted: #64748b;
  --line: #e2e8f0;
  --page: #f6f8fb;
  --panel: #ffffff;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --pos: #047857;
  --pos-dot: #059669;
  --pos-soft: #ecfdf5;
  --neg: #be123c;
  --neg-dot: #e11d48;
  --near: #d97706;
  background: var(--page);
  color: var(--ink);
}
.dash { max-width: 1480px; margin: 0 auto; padding: 1.25rem 1.25rem 3rem; }
.dash [hidden] { display: none !important; }
.dash button { font: inherit; }
.dash :focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* --- search --- */
.dash-search { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.25rem .75rem; }
.scan-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; }
.scan-field { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.scan-field label { font-size: .8rem; font-weight: 600; color: var(--slate); }
.scan-field input, .scan-field select {
  height: 2.5rem; border: 1px solid #cbd5e1; border-radius: 8px; padding: 0 .75rem;
  background: #fff; color: var(--ink); width: 9.5rem;
}
.scan-field-zip input { width: 6.5rem; }
.scan-field-city input { width: 10rem; }
.scan-field-state input { width: 4rem; text-transform: uppercase; }
.scan-field-beds select { width: 6rem; }
.scan-field input:focus, .scan-field select:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.scan-or { align-self: center; padding-top: 1.2rem; color: var(--muted); font-size: .85rem; }
.scan-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 2.5rem; padding: 0 1.25rem; border: 0; border-radius: 8px;
  background: var(--blue); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer;
}
.scan-btn:hover { background: #1d4ed8; color: #fff; }
.scan-btn:disabled { opacity: .6; cursor: progress; }
.scan-status { margin: .75rem 0 0; font-size: .875rem; color: var(--slate); }
.scan-status.is-error { color: var(--neg); font-weight: 600; }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ghost-btn { height: 2.25rem; padding: 0 .9rem; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: var(--ink); font-weight: 600; font-size: .875rem; cursor: pointer; }
.ghost-btn:hover { border-color: var(--blue); color: var(--blue); }

/* --- logged-out --- */
.dash-gate { max-width: 44rem; margin: 3rem auto; text-align: left; }
.dash-gate h1 { font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.dash-gate p { color: var(--slate); font-size: 1.05rem; line-height: 1.6; max-width: 38rem; }
.gate-actions { display: flex; gap: 1.25rem; align-items: center; margin-top: 1.25rem; }
.gate-link { color: var(--blue); font-weight: 600; }

/* --- layout --- */
.dash-grid { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 1.25rem; margin-top: 1.25rem; align-items: start; }

/* --- assumptions --- */
.assume { position: sticky; top: 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.assume summary { font-weight: 700; cursor: pointer; list-style: none; }
.assume summary::-webkit-details-marker { display: none; }
.assume summary::after { content: "\2212"; float: right; color: var(--muted); }
.assume details:not([open]) summary::after { content: "+"; }
.assume-hint { font-size: .8rem; color: var(--muted); margin: .25rem 0 .75rem; }
.assume-grid { display: grid; gap: .6rem; }
.assume-grid label { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: .5rem; font-size: .8rem; font-weight: 600; color: var(--slate); }
.assume-grid label span { font-weight: 500; color: var(--muted); }
.assume-grid input {
  grid-column: 1 / -1; margin-top: .2rem; height: 2.1rem; border: 1px solid #cbd5e1; border-radius: 7px;
  padding: 0 .6rem; font-variant-numeric: tabular-nums; color: var(--ink); width: 100%;
}
.assume-grid label:first-child input { border-color: var(--blue); background: var(--blue-soft); font-weight: 700; }
.assume-foot { font-size: .75rem; color: var(--muted); line-height: 1.5; margin: .9rem 0 .5rem; }

/* --- results --- */
.results { min-width: 0; display: flex; flex-direction: column; gap: 1rem; }
.demo-banner { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 10px; padding: .6rem .9rem; font-size: .875rem; font-weight: 600; }

/* The ROI strip: every listing on one line, target marked. The one bold element on the page. */
.strip-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.25rem 1.5rem; }
.strip-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: baseline; margin-bottom: 2rem; }
.strip-count { margin: 0; font-size: 1.05rem; color: var(--slate); }
.strip-count strong.is-zero { color: var(--ink); }
.strip-count strong { font-size: 2.25rem; font-weight: 800; color: var(--pos); letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-right: .15rem; }
.strip-stats { display: flex; gap: 1.75rem; margin: 0; }
.strip-stats dt { font-size: .75rem; font-weight: 600; color: var(--muted); }
.strip-stats dd { margin: 0; font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.strip { position: relative; height: 2.75rem; border-radius: 6px;
  background: linear-gradient(90deg, #fff1f2 0%, #f8fafc 45%, #f8fafc 60%, #ecfdf5 100%); }
.strip-zero { position: absolute; top: 0; bottom: 0; width: 1px; background: #cbd5e1; }
.strip-target { position: absolute; top: -.6rem; bottom: -.3rem; width: 2px; background: var(--ink); }
.strip-target span { position: absolute; top: -1.15rem; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .72rem; font-weight: 700; }
.tick { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; padding: 0; border-radius: 50%;
  border: 1.5px solid #fff; background: #94a3b8; cursor: pointer; transition: transform .12s; }
.tick:nth-child(3n) { top: 30%; } .tick:nth-child(3n+1) { top: 70%; }
.tick:hover, .tick:focus-visible { transform: scale(1.6); z-index: 2; }
.tick.is-hit { background: var(--pos-dot); width: 12px; height: 12px; margin: -6px 0 0 -6px; }
.tick.is-near { background: var(--near); }
.tick.is-neg { background: #fda4af; }
.strip-axis { position: relative; height: 1rem; margin-top: .35rem; }
.strip-axis span { position: absolute; transform: translateX(-50%); font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 3px; background: #fff; }
.tab { border: 0; background: none; padding: .35rem .9rem; border-radius: 6px; font-weight: 600; color: var(--slate); cursor: pointer; }
.tab.is-active { background: var(--ink); color: #fff; }
.tab span { font-variant-numeric: tabular-nums; opacity: .75; margin-left: .2rem; }
.toggle { display: inline-flex; gap: .45rem; align-items: center; font-size: .9rem; font-weight: 600; color: var(--slate); margin: 0; cursor: pointer; }
.toggle input { width: 1rem; height: 1rem; accent-color: var(--pos-dot); }
.toolbar-right { margin-left: auto; display: flex; gap: .5rem; }

.map { height: 340px; border-radius: 12px; border: 1px solid var(--line); z-index: 0; }

/* table */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.ltable { width: 100%; border-collapse: collapse; font-size: .875rem; font-variant-numeric: tabular-nums; }
.ltable th { position: sticky; top: 0; background: #f8fafc; font-size: .75rem; font-weight: 700; color: var(--slate);
  text-align: right; padding: .65rem .75rem; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
.ltable th.is-sorted { color: var(--ink); }
.ltable th.is-sorted::after { content: " \2193"; }
.ltable th[aria-sort="ascending"]::after { content: " \2191"; }
.ltable td { text-align: right; padding: .6rem .75rem; border-bottom: 1px solid #f1f5f9; white-space: nowrap; vertical-align: top; }
.ltable .t-left { text-align: left; }
.ltable tbody tr:hover { background: #f8fafc; }
.ltable tr.row-hit td:first-child { box-shadow: inset 3px 0 0 var(--pos-dot); }
.ltable tr.flash { background: #fef9c3; transition: background .6s; }
.ltable .addr { background: none; border: 0; padding: 0; font-weight: 700; color: var(--ink); text-align: left; cursor: pointer; }
.ltable .addr:hover { color: var(--blue); text-decoration: underline; }
.ltable .sub, .dash .sub { display: block; font-size: .75rem; color: var(--muted); font-weight: 400; }
.ltable .strong { font-weight: 800; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .muted { color: var(--muted); }
.rent-src { display: block; font-size: .68rem; color: var(--muted); }
.rent-src.is-refined { color: var(--blue); font-weight: 700; }
.t-actions { white-space: nowrap; }
.mini { height: 1.8rem; padding: 0 .6rem; margin-left: .3rem; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; font-size: .78rem; font-weight: 600; color: var(--slate); cursor: pointer; }
.mini:hover { border-color: var(--blue); color: var(--blue); }
.mini.is-on { background: var(--pos-soft); border-color: #a7f3d0; color: var(--pos); }
.mini:disabled { opacity: .6; }
.empty { padding: 2rem 1.25rem; margin: 0; color: var(--slate); }
.source-note { font-size: .78rem; color: var(--muted); margin: 0; max-width: 60rem; line-height: 1.5; }

/* drawer */
.drawer-scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 1040; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(28rem, 100vw); background: #fff; z-index: 1050;
  overflow-y: auto; padding: 1.5rem 1.5rem 2rem; box-shadow: -12px 0 32px rgba(15, 23, 42, .12);
  padding-top: calc(1.5rem + env(safe-area-inset-top, 0px)); }
.drawer-close { position: absolute; top: .75rem; right: .9rem; border: 0; background: none; font-size: 1.75rem; line-height: 1; color: var(--muted); cursor: pointer; }
.drawer h2 { font-size: 1.35rem; font-weight: 800; margin: 0 2rem 0 0; letter-spacing: -.01em; }
.drawer h3 { font-size: .8rem; font-weight: 700; color: var(--muted); margin: 1.25rem 0 .4rem; }
.drawer-facts { margin: .6rem 0 1rem; font-weight: 600; }
.drawer-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.drawer-kpis div { background: #f8fafc; border-radius: 8px; padding: .6rem .7rem; }
.drawer-kpis span { display: block; font-size: .72rem; color: var(--muted); font-weight: 600; }
.drawer-kpis strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.ledger { margin: 0; font-variant-numeric: tabular-nums; font-size: .875rem; }
.ledger div { display: flex; justify-content: space-between; padding: .28rem 0; border-bottom: 1px dashed #eef2f7; }
.ledger dt { font-weight: 500; color: var(--slate); }
.ledger dd { margin: 0; }
.ledger dd.total { font-weight: 800; }
.ledger div:has(dd.total) { border-bottom: 1px solid var(--line); }
.notice { background: #fffbeb; border-radius: 8px; padding: .75rem; font-size: .875rem; }
.drawer-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1.25rem 0 .75rem; }
.note-label { display: block; font-weight: 700; font-size: .8rem; margin-top: .5rem; }
.drawer textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 8px; padding: .5rem .6rem; margin: .3rem 0 .4rem; font-size: .9rem; }

.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: .6rem 1rem; border-radius: 8px; font-size: .875rem; font-weight: 600; z-index: 1060; max-width: 90vw;
  margin-bottom: env(safe-area-inset-bottom, 0px); }

@media (max-width: 900px) {
  .dash { padding: .75rem .75rem 2rem; }
  .dash-grid { grid-template-columns: 1fr; }
  .assume { position: static; }
  .assume-grid { grid-template-columns: 1fr 1fr; }
  .scan-field input, .scan-field select { width: 100%; }
  .scan-field { flex: 1 1 8rem; }
  .scan-or { display: none; }
  .scan-btn { flex: 1 1 100%; }
  .strip-stats { gap: 1rem; }
  .toolbar-right { margin-left: 0; }
  .map { height: 260px; }
}
@media (prefers-reduced-motion: reduce) {
  .tick, .ltable tr.flash { transition: none; }
}
#drawer-body > p.sub { margin-top: .9rem; }


/* --- for-sale map markers (green) and legend --- */
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; font-size: .8rem; color: var(--muted); margin: .4rem 0 0; }
.legend-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px #cbd5e1; vertical-align: -1px; margin-right: .3rem; }
.legend-dot.is-hit { width: 15px; height: 15px; background: #15803d; box-shadow: 0 0 0 2px #064e3b; }
.legend-dot.is-norent { background: #94a3b8; }

/* --- client report from selected listings --- */
.t-select { width: 2.2rem; text-align: center; }
.t-select input, .row-select { width: 1rem; height: 1rem; cursor: pointer; }
.report-btn { padding: 0 .9rem; height: 2.25rem; }
.report-btn[disabled] { opacity: .5; cursor: not-allowed; }
.report-panel { background: var(--blue-soft); border: 1px solid #bfdbfe; border-radius: 10px; padding: .8rem 1rem; margin: .6rem 0; }
.report-panel-title { margin: 0 0 .5rem; color: var(--ink); }
.report-panel-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem .8rem; }
.report-panel-fields label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; font-weight: 600; color: var(--slate); }
.report-panel-fields input { height: 2.3rem; border: 1px solid #cbd5e1; border-radius: 8px; padding: 0 .7rem; width: 15rem; max-width: 100%; }
tr.is-selected td { background: #eff6ff; }
