:root {
  --green-900: #21422f;
  --green-800: #2c5a44;
  --green-700: #356a52;
  --green-600: #3f7a5f;
  --sage: #c2cf95;
  --sage-soft: #e3e8cb;
  --sage-line: #b6c486;
  --coral: #e07a6f;
  --coral-soft: #f3c9c3;
  --gold: #b58a3e;
  --paper: #f4f3ed;
  --paper-2: #eceadf;
  --card: #ffffff;
  --ink: #1b2620;
  --ink-2: #34423a;
  --muted: #76806f;
  --line: #e4e2d6;
  --line-strong: #d3d0c0;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(33,66,47,.06), 0 1px 1px rgba(33,66,47,.04);
  --shadow-md: 0 6px 22px rgba(33,66,47,.08), 0 2px 6px rgba(33,66,47,.05);
  --shadow-lg: 0 18px 50px rgba(33,66,47,.14);
  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

#root { min-height: 100vh; }

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 40px 96px;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 4px 18px;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--green-800);
  display: grid; place-items: center;
  color: var(--sage); flex: none;
  box-shadow: var(--shadow-sm);
}
.brand-mark svg { width: 23px; height: 23px; }
.brand-title { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -.01em; line-height: 1; }
.brand-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; letter-spacing: .01em; }
.addr-pill {
  display: flex; align-items: center; gap: 9px;
  background: var(--card); border: 1px solid var(--line);
  padding: 9px 15px; border-radius: 999px; box-shadow: var(--shadow-sm);
  font-size: 13.5px; color: var(--ink-2); font-weight: 600;
}
.addr-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-600); }

/* ---------- Metric band ---------- */
.metric-band {
  background: var(--green-800);
  border-radius: 18px;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.metric-band::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 140% at 0% 0%, rgba(255,255,255,.06), transparent 45%);
  pointer-events: none;
}
.metric {
  padding: 16px 20px 16px;
  display: flex; flex-direction: column; gap: 8px;
  position: relative;
}
.metric + .metric::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px;
  width: 1px; background: rgba(255,255,255,.12);
}
.metric-label {
  font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: rgba(255,255,255,.62);
  min-height: 28px; line-height: 1.25;
}
.metric-value {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(20px, 1.7vw, 27px); color: #fff; line-height: 1;
  letter-spacing: -.02em;
}
.metric.is-profit .metric-value { color: var(--sage); }
.metric.is-profit.neg .metric-value { color: var(--coral-soft); }
.metric-spark { font-size: 11px; color: rgba(255,255,255,.5); font-weight: 600; }

/* ---------- Tabs ---------- */
.tabs { display: flex; flex-wrap: nowrap; gap: 6px; margin: 24px 0 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; }
.tab {
  border: 1px solid transparent; background: transparent;
  padding: 10px 18px; border-radius: 11px; white-space: nowrap;
  font-size: 14px; font-weight: 600; color: var(--muted);
  display: flex; align-items: center; gap: 9px; transition: all .15s;
}
.tab:hover { color: var(--ink); background: var(--paper-2); }
.tab.active {
  background: var(--card); color: var(--green-800);
  border-color: var(--line); box-shadow: var(--shadow-sm);
}
.tab .tab-ic { width: 16px; height: 16px; opacity: .85; }

/* ---------- Layout grid ---------- */
.grid {
  display: grid;
  grid-template-columns: 320px 1fr 1fr;
  gap: 18px;
  align-items: start;
}
.col { display: flex; flex-direction: column; gap: 18px; }
.span-charts { grid-column: 3 / 4; }

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px;
  background: var(--sage-soft);
  border-bottom: 1px solid var(--line);
}
.card-head h3 {
  margin: 0; font-family: var(--font-display); font-weight: 600;
  font-size: 13px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--green-900);
}
.card-head .head-total { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--green-800); }
.card-body { padding: 8px 16px 14px; }

/* ---------- Field rows ---------- */
.frow {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px dashed var(--line);
}
.frow:last-child { border-bottom: none; }
.frow-label { font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.frow-label small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 1px; }

.in {
  border: 1px solid transparent; background: transparent;
  text-align: right; font-size: 14px; color: var(--ink);
  padding: 6px 9px; border-radius: 8px; width: 118px;
  font-variant-numeric: tabular-nums; font-weight: 600;
  transition: all .13s;
}
.in:hover { background: var(--paper); }
.in:focus { outline: none; background: #fff; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(63,122,95,.13); }
.in.txt { text-align: left; font-weight: 500; }
.in.zero { color: var(--muted); font-weight: 500; }
.in.wide { width: 150px; }

.in-highlight .in { background: var(--sage-soft); }
.in-highlight .in:hover { background: var(--sage); }

select.in {
  text-align: left; width: 150px; background: var(--sage-soft); font-weight: 600;
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2334423a' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; padding-right: 26px;
}

/* ---------- Property card ---------- */
.prop-photo { width: 100%; height: 184px; display: block; }
.prop-photo image-slot { width: 100%; height: 184px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; padding: 4px 0; }
.kv .frow-label { font-size: 13px; }

.stat-mini {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px;
}
.stat-mini .cell {
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px;
}
.stat-mini .cell .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat-mini .cell .v { font-family: var(--font-display); font-weight: 700; font-size: 16px; margin-top: 3px; }

/* ---------- Totals ---------- */
.totals-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.total-chip {
  background: var(--green-800); color: #fff; border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.total-chip .l { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.65); }
.total-chip .v { font-family: var(--font-display); font-weight: 700; font-size: 25px; letter-spacing: -.02em; }

/* ---------- Profit panel ---------- */
.profit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.profit-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.profit-card .pc-head {
  text-align: center; padding: 14px; font-family: var(--font-display);
  font-weight: 700; font-size: 16px; letter-spacing: .03em; text-transform: uppercase; color: var(--ink);
}
.profit-card .pc-big {
  text-align: center; padding: 22px 14px; font-family: var(--font-display);
  font-weight: 700; font-size: 40px; letter-spacing: -.02em;
  background: var(--coral); color: #fff;
}
.profit-card.good .pc-big { background: var(--green-700); }
.profit-card .pc-sub {
  display: grid; grid-template-columns: 1fr; text-align: center;
  border-top: 1px solid var(--line);
}
.pc-goal-label { padding: 12px; font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); border-top: 1px solid var(--line); }
.pc-goal-val { padding: 16px; font-family: var(--font-display); font-weight: 700; font-size: 26px; background: var(--sage-soft); color: var(--green-900); }
.pc-goal-val .delta { font-size: 13px; font-weight: 600; margin-top: 4px; }
.delta.pos { color: var(--green-700); }
.delta.neg { color: var(--coral); }

/* ---------- KPI strip ---------- */
.kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 16px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; box-shadow: var(--shadow-sm);
}
.kpi .l { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .v { font-family: var(--font-display); font-weight: 700; font-size: 23px; margin-top: 9px; letter-spacing: -.01em; }
.kpi .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.kpi.accent .v { color: var(--green-700); }
.kpi .v.neg { color: var(--coral); }

/* ---------- Charts ---------- */
.chart-card .card-body { padding: 16px; }
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.donut-center { font-family: var(--font-display); }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 16px; width: 100%; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.legend-item .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-item .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-item .pc { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }

.bars { display: flex; flex-direction: column; gap: 13px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; }
.bar-row .bl { font-size: 12px; font-weight: 600; color: var(--ink-2); text-align: right; line-height: 1.2; }
.bar-track { position: relative; height: 30px; }
.bar-fill {
  height: 100%; border-radius: 7px; display: flex; align-items: center; justify-content: flex-end;
  padding: 0 10px; color: #fff; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  min-width: 4px; transition: width .4s cubic-bezier(.4,0,.2,1);
}
.bar-fill.out { color: var(--ink-2); padding-left: 8px; justify-content: flex-start; }

/* ---------- Finance tabs ---------- */
.fin-wrap { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
.fin-result {
  background: var(--green-800); border-radius: var(--radius); padding: 26px;
  color: #fff; box-shadow: var(--shadow-md);
}
.fin-result .big-num { font-family: var(--font-display); font-weight: 700; font-size: 46px; letter-spacing: -.02em; }
.fin-result .big-lbl { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.6); }
.fin-breakdown { margin-top: 22px; display: flex; flex-direction: column; gap: 2px; }
.fin-breakdown .fb {
  display: flex; justify-content: space-between; padding: 11px 0;
  border-bottom: 1px solid rgba(255,255,255,.12); font-size: 14px;
}
.fin-breakdown .fb:last-child { border-bottom: none; }
.fin-breakdown .fb .fl { color: rgba(255,255,255,.78); }
.fin-breakdown .fb .fv { font-weight: 700; font-variant-numeric: tabular-nums; }
.fin-breakdown .fb.total { font-size: 16px; padding-top: 14px; }
.fin-breakdown .fb.total .fl { color: var(--sage); }

.field-stack { display: flex; flex-direction: column; gap: 2px; }
.field-stack .fs-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px dashed var(--line);
}
.field-stack .fs-row:last-child { border-bottom: none; }
.fs-row label { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.fs-row label small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.amort-note { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.5; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Custom / add rows ---------- */
.custom-row .custom-label {
  text-align: left; width: 100%; max-width: 200px; border: 1px solid var(--line); background: var(--paper);
  border-radius: 8px; padding: 6px 10px; font-weight: 600;
}
.custom-row .custom-label:focus { outline: none; border-color: var(--green-600); background: #fff; box-shadow: 0 0 0 3px rgba(63,122,95,.12); }
.row-del {
  border: none; background: transparent; color: var(--muted); font-size: 13px; width: 24px; height: 24px;
  border-radius: 6px; flex: none; transition: all .12s; line-height: 1;
}
.row-del:hover { background: var(--coral-soft); color: var(--coral); }
.add-row {
  display: flex; align-items: center; gap: 7px; width: 100%; justify-content: center;
  margin-top: 8px; padding: 9px; border: 1px dashed var(--line-strong); background: transparent;
  border-radius: 9px; color: var(--green-700); font-size: 12.5px; font-weight: 600; transition: all .14s;
}
.add-row:hover { background: var(--sage-soft); border-color: var(--sage-line); }
.add-row svg { width: 15px; height: 15px; }

/* ---------- Photo URL ---------- */
.photo-url { display: flex; align-items: center; gap: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 7px 11px; margin: 4px 0 10px; }
.photo-url svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.photo-url input { flex: 1; border: none; background: transparent; font-size: 12.5px; color: var(--ink); }
.photo-url input:focus { outline: none; }
.photo-clear { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 7px; border: none; background: rgba(20,30,24,.55); color: #fff; font-size: 12px; backdrop-filter: blur(4px); }
.photo-clear:hover { background: rgba(20,30,24,.8); }

/* ---------- Top action buttons ---------- */
.actions { display: flex; gap: 8px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  padding: 9px 15px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-sm); transition: all .14s;
}
.btn:hover { background: var(--paper-2); border-color: var(--line-strong); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--green-800); color: #fff; border-color: var(--green-800); }
.btn.primary:hover { background: var(--green-700); }
.btn .badge { background: var(--sage); color: var(--green-900); border-radius: 999px; padding: 0 7px; font-size: 11px; font-weight: 800; }

/* ---------- Lookup bar ---------- */
.lookup {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.lookup-row { display: flex; gap: 10px; align-items: center; }
.lookup .pin { width: 18px; height: 18px; color: var(--green-600); flex: none; }
.lookup input.addr {
  flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px;
  font-size: 14.5px; color: var(--ink); background: var(--paper);
}
.lookup input.addr:focus { outline: none; border-color: var(--green-600); background: #fff; box-shadow: 0 0 0 3px rgba(63,122,95,.12); }
.lookup-note { font-size: 11.5px; color: var(--muted); margin-top: 10px; display: flex; align-items: center; gap: 7px; line-height: 1.5; }
.lookup-note .info { width: 14px; height: 14px; flex: none; color: var(--gold); }
.spin { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.demo-banner {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  background: #fbf3e2; border: 1px solid #ecd9ad; border-radius: 10px; padding: 10px 13px;
  font-size: 12.5px; color: #7a5a1e; line-height: 1.45;
}
.demo-banner b { color: #5e4513; }
.demo-banner .x { margin-left: auto; cursor: pointer; color: #b08a3e; font-weight: 700; flex: none; padding: 0 4px; }

/* ---------- Estimate comparison ---------- */
.est-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.est-row:last-of-type { border-bottom: none; }
.est-row .src { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.est-row .src .tag { font-size: 9.5px; font-weight: 800; letter-spacing: .03em; padding: 2px 6px; border-radius: 5px; color: #fff; flex: none; }
.est-bar-track { height: 10px; background: var(--paper-2); border-radius: 6px; overflow: hidden; }
.est-bar-fill { height: 100%; border-radius: 6px; transition: width .4s cubic-bezier(.4,0,.2,1); }
.est-avg {
  display: flex; justify-content: space-between; align-items: center; margin-top: 12px;
  background: var(--sage-soft); border-radius: 10px; padding: 12px 14px;
}
.est-avg .l { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--green-900); }
.est-avg .v { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--green-900); }
.use-btn {
  border: 1px solid var(--green-600); background: transparent; color: var(--green-700);
  font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 7px; white-space: nowrap; transition: all .13s;
}
.use-btn:hover { background: var(--green-700); color: #fff; }

/* ---------- Schedule table ---------- */
.sched-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 10px; }
.seg { display: inline-flex; background: var(--paper-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; padding: 6px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.seg button.on { background: #fff; color: var(--green-800); box-shadow: var(--shadow-sm); }
.sched-scroll { max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
table.sched { width: 100%; border-collapse: collapse; font-size: 13px; }
table.sched thead th {
  position: sticky; top: 0; background: var(--sage-soft); color: var(--green-900);
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  padding: 9px 12px; text-align: right; z-index: 1;
}
table.sched thead th:first-child { text-align: left; }
table.sched td { padding: 8px 12px; text-align: right; font-variant-numeric: tabular-nums; border-top: 1px solid var(--line); color: var(--ink-2); }
table.sched td:first-child { text-align: left; font-weight: 600; color: var(--ink); }
table.sched tbody tr:nth-child(even) { background: #faf9f4; }
table.sched tbody tr:hover { background: var(--sage-soft); }
.term-sheet { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.term-cell { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.term-cell .l { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.term-cell .v { font-family: var(--font-display); font-weight: 700; font-size: 19px; margin-top: 5px; }

/* ---------- Saved deals drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; background: rgba(20,30,24,.4); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 90vw; background: var(--paper);
  z-index: 41; box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .24s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.drawer-head h2 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.drawer-body { padding: 16px 22px; overflow-y: auto; flex: 1; }
.saved-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.saved-item .si-top { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.saved-item .si-name { font-weight: 700; font-size: 14.5px; }
.saved-item .si-addr { font-size: 12px; color: var(--muted); margin-top: 2px; }
.saved-item .si-profit { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.saved-item .si-actions { display: flex; gap: 8px; margin-top: 12px; }
.saved-item .si-actions button { flex: 1; font-size: 12.5px; padding: 7px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); font-weight: 600; color: var(--ink-2); }
.saved-item .si-actions .load { background: var(--green-800); color: #fff; border-color: var(--green-800); }
.saved-empty { text-align: center; color: var(--muted); font-size: 13.5px; padding: 50px 20px; line-height: 1.6; }

.footnote { margin-top: 30px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.6; }

/* ---------- Fetch status ---------- */
.fetch-status { margin-top: 12px; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--paper); }
.fetch-status.ok { background: #eef5ee; border-color: #cfe2cd; }
.fetch-status.warn { background: #fbf3e2; border-color: #ecd9ad; }
.fs-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.fs-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.fs-chip .d { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.fs-chip.live .d { background: var(--green-600); box-shadow: 0 0 0 3px rgba(63,122,95,.18); }
.fs-chip.sample { color: #8a6d2e; border-color: #e3cf9d; background: #fff8ec; }
.fs-chip.sample .d { background: var(--gold); }
.fs-msg { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }

/* ---------- Source pill ---------- */
.src-pill { font-size: 10.5px; font-weight: 800; letter-spacing: .03em; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; white-space: nowrap; flex: none; }
.src-pill.live { background: var(--sage-soft); color: var(--green-800); }
.src-pill.sample { background: #fff8ec; color: #8a6d2e; }
.src-pill.warn-pill { background: var(--coral-soft); color: #b1463b; }

/* ---------- Deal summary row ---------- */
.deal-summary-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
  align-items: stretch;
}
.deal-summary-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 16px 14px;
}
.deal-summary-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 8px;
}
.deal-summary-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  color: var(--ink);
  display: flex;
  align-items: center;
  min-height: 42px;
}
.deal-summary-value.small { font-size: 20px; }
.deal-summary-value.pos { color: var(--green-700); }
.deal-summary-value.neg { color: var(--coral); }
.deal-summary-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.offer-guidance-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--sage-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.offer-guidance-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-800);
}
.offer-guidance-copy {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

/* ---------- Market + Offer ---------- */
.market-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; align-items: start; }
.mp-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 12px; }
.mp-h > span:first-child { min-width: 0; white-space: nowrap; }
.mp-mid { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--ink); }
.mp-mid small { font-size: 12px; color: var(--muted); font-weight: 600; }
.mp-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 11px; font-size: 11.5px; color: var(--muted); }

.rangebar { padding-top: 22px; }
.rb-track { position: relative; height: 12px; border-radius: 7px; background: var(--paper-2); }
.rb-fill { position: absolute; inset: 0; border-radius: 7px; opacity: .28; }
.rb-mid { position: absolute; top: -4px; width: 3px; height: 20px; border-radius: 3px; border-left: 3px solid; transform: translateX(-1.5px); }
.rb-mid-val { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); font-family: var(--font-display); font-weight: 700; font-size: 14px; white-space: nowrap; }
.rb-ends { display: flex; justify-content: space-between; margin-top: 8px; }
.rb-ends b { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink); display: block; }
.rb-ends small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }

.offer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.offer-row > div:first-child { min-width: 0; flex: 1 1 auto; }
.offer-row.best { background: var(--sage-soft); border-radius: 10px; padding: 12px 14px; border-bottom: none; margin-bottom: 4px; }
.ol-l { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ol-s { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.offer-v { flex: none; font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--green-800); background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 5px 10px; transition: all .13s; font-variant-numeric: tabular-nums; }
.offer-v:hover { background: #fff; border-color: var(--green-600); box-shadow: var(--shadow-sm); }
.offer-row.best .offer-v { font-size: 21px; }
.offer-current { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); font-weight: 600; }
.offer-current b { font-family: var(--font-display); font-size: 19px; }
.offer-current b.pos { color: var(--green-700); }
.offer-current b.neg { color: var(--coral); }
.offer-hint { font-size: 12px; line-height: 1.5; margin-top: 9px; color: var(--ink-2); }

/* ---------- Linked finance rows ---------- */
.linked-wrap { display: inline-flex; align-items: center; gap: 4px; }
.link-btn { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); display: grid; place-items: center; flex: none; transition: all .13s; }
.link-btn svg { width: 14px; height: 14px; }
.link-btn.on { background: var(--sage-soft); border-color: var(--sage-line); color: var(--green-700); }
.link-btn:hover { border-color: var(--green-600); }

@media (max-width: 1160px) {
  .grid { grid-template-columns: 300px 1fr; }
  .span-charts { grid-column: 1 / -1; }
  .span-charts .col { flex-direction: row; }
  .span-charts .card { flex: 1; }
}
@media (max-width: 980px) {
  .app { padding: 0 22px 72px; }
  .market-grid { grid-template-columns: 1fr; }
  .deal-summary-row { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { padding: 0 16px 64px; }
  .topbar { flex-wrap: wrap; gap: 12px; padding: 16px 2px 14px; }
  .actions { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .actions::-webkit-scrollbar { display: none; }
  .actions .btn { flex: none; }
  .user-chip { flex: none; }
  .metric-band { grid-template-columns: repeat(2, 1fr); gap: 0; }
  .metric::before { display: none !important; }
  .metric { padding: 14px 16px; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 18px -16px 16px; padding: 0 16px; }
  .tabs::-webkit-scrollbar { display: none; }
  .grid { grid-template-columns: 1fr; }
  .span-charts .col { flex-direction: column; }
  .fin-wrap { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .totals-row, .kpi-strip { grid-template-columns: 1fr 1fr; }
  .in, .in.wide, select.in { width: 110px; }
}
@media (max-width: 560px) {
  .app { padding: 0 12px 56px; }
  .brand-sub { display: none; }
  .metric-value { font-size: 19px; }
  .totals-row { grid-template-columns: 1fr; }
  .kpi-strip { grid-template-columns: 1fr 1fr; }
  .profit-grid { grid-template-columns: 1fr; }
  .stat-mini { grid-template-columns: 1fr 1fr; }
  .lookup-row { flex-wrap: wrap; }
  .lookup input.addr { flex: 1 1 100%; order: 2; }
  .lookup .btn.primary { order: 3; width: 100%; justify-content: center; }
  .rb-mid-val { font-size: 12px; }
}

/* ============ New-feature styles ============ */
.brand-mark { background: #fff; border: 1px solid var(--line); color: inherit; }
.brand-mark svg { width: 30px; height: 30px; }

.tab-title { font-family: var(--font-display); font-weight: 700; font-size: 20px; margin: 0; letter-spacing: -.01em; }
.tab-desc { font-size: 13px; color: var(--muted); margin-top: 3px; }
.comps-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.hold-period { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); }

/* Autocomplete */
.ac-wrap { position: relative; flex: 1; }
.ac-wrap .addr { width: 100%; }
.ac-list { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; }
.ac-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: none; background: transparent; padding: 11px 14px; font-size: 13.5px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: var(--sage-soft); }
.ac-item svg { width: 15px; height: 15px; color: var(--green-600); flex: none; }

/* Settings */
.settings-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.settings-wrap .card:first-child { grid-row: span 2; }
.set-input { border: 1px solid var(--line); background: var(--paper); border-radius: 9px; padding: 9px 12px; font-size: 13.5px; color: var(--ink); width: 200px; font-family: inherit; }
.set-input:focus { outline: none; border-color: var(--green-600); background: #fff; box-shadow: 0 0 0 3px rgba(63,122,95,.12); }
.set-label { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 18px 0 10px; }
.theme-row { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-chip { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); background: var(--paper); border-radius: 11px; padding: 9px 13px; font-size: 13px; font-weight: 600; color: var(--ink-2); transition: all .14s; }
.theme-chip.on { border-color: var(--green-600); background: var(--sage-soft); color: var(--green-900); box-shadow: 0 0 0 2px rgba(63,122,95,.15); }
.theme-sw { display: inline-flex; border-radius: 5px; overflow: hidden; border: 1px solid rgba(0,0,0,.1); }
.theme-sw span { width: 13px; height: 18px; display: block; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.key-row:last-child { border-bottom: none; }
.key-name { font-size: 13.5px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.key-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.key-input { width: 230px; flex: none; }

/* Scenarios */
.assume-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.assume { display: flex; flex-direction: column; gap: 4px; }
.assume label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.assume small { font-size: 11.5px; color: var(--muted); }
.scn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.scn-card { border-radius: var(--radius); padding: 20px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); text-align: center; }
.scn-card.good { background: var(--sage-soft); border-color: var(--sage-line); }
.scn-card.bad { background: var(--coral-soft); border-color: #e8b6ad; }
.scn-card.base { background: var(--card); }
.scn-head { font-family: var(--font-display); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.scn-profit { font-family: var(--font-display); font-weight: 700; font-size: 30px; margin: 8px 0 4px; letter-spacing: -.02em; color: var(--green-800); }
.scn-card.bad .scn-profit { color: #b1463b; }
.scn-profit.neg { color: var(--coral); }
.scn-sub { font-size: 12px; color: var(--muted); font-weight: 600; }

table.cmp-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.cmp-tbl thead th { background: var(--sage-soft); color: var(--green-900); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; padding: 10px 14px; text-align: right; }
table.cmp-tbl thead th:first-child { text-align: left; }
table.cmp-tbl td { padding: 9px 14px; text-align: right; font-variant-numeric: tabular-nums; border-top: 1px solid var(--line); color: var(--ink-2); }
table.cmp-tbl td:first-child { text-align: left; font-weight: 600; color: var(--ink); }
table.cmp-tbl tbody tr:nth-child(even) { background: #faf9f4; }
table.cmp-tbl tbody tr:hover { background: var(--sage-soft); }
table.cmp-tbl .cmp-em td { font-weight: 700; color: var(--ink); background: var(--sage-soft); }
.good-c { color: var(--green-700); }
.bad-c { color: var(--coral); }
.be-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.be-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.be-l { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.be-v { font-family: var(--font-display); font-weight: 700; font-size: 28px; margin: 7px 0 6px; color: var(--green-800); }
.be-v.neg { color: var(--coral); }
.be-s { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }

/* Holding */
.hold-row { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.hold-row:last-child { border-bottom: none; }
.hold-label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.hold-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.hold-bar-wrap { height: 8px; background: var(--paper-2); border-radius: 5px; overflow: hidden; }
.hold-bar { height: 100%; background: var(--green-600); border-radius: 5px; transition: width .35s; }
.hold-val { width: 118px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; padding: 6px 9px; }
.hold-val.locked { color: var(--muted); }

/* Neighborhood */
.nb-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
.nb-map { height: 320px; width: 100%; }
.nb-map-card .card-body { min-height: 0; }
.nb-sv { width: 100%; height: 320px; object-fit: cover; display: block; }
.nb-empty { display: grid; place-items: center; height: 320px; color: var(--muted); font-size: 13px; text-align: center; padding: 20px; background: var(--paper); }
.nb-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 16px; }
.nb-stat { padding: 15px 17px; }
.nb-stat-h { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.nb-stat-v { font-family: var(--font-display); font-weight: 700; font-size: 24px; margin-top: 9px; }
.nb-stat-s { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.gate { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 9px; line-height: 1.4; }
.gate svg { width: 22px; height: 22px; flex: none; color: var(--sage-line); }
.drive-add { display: flex; gap: 10px; margin-bottom: 12px; }
.drive-add .set-input { flex: 1; width: auto; }
.drive-list { display: flex; flex-direction: column; gap: 8px; }
.drive-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.drive-item svg { width: 18px; height: 18px; color: var(--green-600); flex: none; }
.dr-to { flex: 1; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.dr-time { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--green-800); }
.dr-mi { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .settings-wrap, .nb-grid, .scn-grid, .assume-row, .be-grid { grid-template-columns: 1fr; }
  .settings-wrap .card:first-child { grid-row: auto; }
  .nb-stats { grid-template-columns: 1fr 1fr; }
  .key-input, .set-input { width: 150px; }
  .scn-grid { grid-template-columns: 1fr; }
}

/* Buttons / icon button */
.icon-btn { padding: 9px; width: 40px; justify-content: center; }
.icon-btn svg { width: 17px; height: 17px; }

/* % chips on cost rows */
.frow-right { display: flex; align-items: center; gap: 6px; }
.pct-chip { font-size: 11px; font-weight: 700; color: var(--green-700); background: var(--sage-soft); border-radius: 6px; padding: 2px 7px; font-variant-numeric: tabular-nums; min-width: 42px; text-align: center; }
.head-pct { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 4px; }

/* Listing portal quick links */
.listing-links { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 4px 0 12px; }
.listing-link { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); text-decoration: none; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; transition: all .13s; }
.listing-link:hover { background: #fff; border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.listing-link .ll-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.listing-link svg { width: 13px; height: 13px; margin-left: auto; color: var(--muted); }

/* Modal (offer letter) */
.modal-scrim { position: fixed; inset: 0; background: rgba(20,25,22,.5); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { background: var(--paper); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 940px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.modal-body { display: grid; grid-template-columns: 320px 1fr; gap: 18px; padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 9px; padding: 14px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .btn { text-decoration: none; }
.ol-form { display: flex; flex-direction: column; gap: 10px; }
.ol-field { display: flex; flex-direction: column; gap: 4px; }
.ol-field label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.ol-field .set-input { width: 100%; }
.ol-field .in { width: 130px; }
.ol-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.ol-quick button { border: 1px solid var(--line); background: var(--card); border-radius: 7px; padding: 5px 9px; font-size: 11.5px; font-weight: 600; color: var(--green-700); }
.ol-quick button:hover { background: var(--sage-soft); }
.ol-preview { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; overflow-y: auto; }
.ol-preview pre { margin: 0; font-family: 'Georgia', serif; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; color: var(--ink); }
@media (max-width: 760px) { .modal-body { grid-template-columns: 1fr; } }

/* AI Deal Score */
.ai-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 20px; margin-bottom: 18px; }
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ai-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 9px; }
.ai-spark { color: var(--gold); font-size: 16px; }
.ai-badge { font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; background: var(--sage-soft); color: var(--green-800); border-radius: 999px; padding: 2px 8px; }
.ai-idle { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; }
.ai-idle p { margin: 0; font-size: 13px; color: var(--muted); }
.ai-loading { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); padding: 14px 0 4px; }
.ai-err { color: var(--coral); font-size: 13px; padding: 10px 0; }
.ai-result { margin-top: 14px; }
.ai-score-wrap { display: flex; align-items: center; gap: 18px; }
.ai-score-ring { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ai-score-inner { width: 58px; height: 58px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; }
.ai-score-inner span { font-size: 26px; line-height: 1; }
.ai-score-inner small { font-size: 10px; color: var(--muted); }
.ai-verdict { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.ai-summary { font-size: 13px; color: var(--ink-2); margin-top: 3px; line-height: 1.45; }
.ai-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 16px; }
.ai-col-h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.ai-col-h.good { color: var(--green-700); }
.ai-col-h.bad { color: var(--coral); }
.ai-cols ul { margin: 0; padding-left: 18px; }
.ai-cols li { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin-bottom: 3px; }
.ai-disclaimer { font-size: 11px; color: var(--muted); margin-top: 14px; }
@media (max-width: 640px) { .ai-cols { grid-template-columns: 1fr; } .ai-idle { flex-direction: column; align-items: stretch; } }

/* Photo toggle + section reset */
.photo-toggle { display: flex; gap: 6px; margin-bottom: 10px; }
.photo-toggle button { flex: 1; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.photo-toggle button.on { background: var(--sage-soft); color: var(--green-800); border-color: var(--sage-line); }
.photo-toggle button:disabled { opacity: .5; cursor: not-allowed; }
.sec-reset { border: none; background: transparent; color: var(--muted); width: 24px; height: 24px; border-radius: 6px; vertical-align: middle; margin-left: 6px; padding: 0; display: inline-grid; place-items: center; }
.sec-reset svg { width: 13px; height: 13px; }
.sec-reset:hover { background: var(--paper-2); color: var(--green-700); }

/* Manual comps */
.mc-form { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.mc-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mc-field label { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.mc-in { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 7px 9px; font-size: 13px; color: var(--ink); width: 100%; font-family: inherit; }
.mc-in:focus { outline: none; border-color: var(--green-600); background: #fff; box-shadow: 0 0 0 3px rgba(63,122,95,.12); }
.mc-field .in { width: 100%; text-align: left; background: var(--paper); border: 1px solid var(--line); }
.mc-calc { font-family: var(--font-display); font-weight: 700; font-size: 14px; padding: 7px 0; color: var(--green-700); }
.mc-addwrap { justify-content: flex-end; }
.mc-addwrap .btn { width: 100%; justify-content: center; }
.mc-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.mc-stat { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.mc-stat .l { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.mc-stat .v { font-family: var(--font-display); font-weight: 700; font-size: 19px; margin-top: 4px; }
@media (max-width: 980px) { .mc-form { grid-template-columns: repeat(3, 1fr); } .mc-summary { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .mc-form { grid-template-columns: 1fr 1fr; } }

/* Street View iframe */
iframe.nb-sv { width: 100%; height: 320px; border: 0; display: block; }

/* Calculators sub-nav */.calc-nav { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.calc-pill { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 15px; font-size: 13px; font-weight: 600; color: var(--muted); transition: all .13s; }
.calc-pill:hover { background: var(--paper-2); color: var(--ink); }
.calc-pill.on { background: var(--green-800); color: #fff; border-color: var(--green-800); }

/* AI tools */
.ai-mini-btn { border: 1px solid var(--sage-line); background: var(--sage-soft); color: var(--green-800); border-radius: 7px; padding: 3px 9px; font-size: 11px; font-weight: 800; letter-spacing: .02em; margin-left: 6px; vertical-align: middle; }
.ai-mini-btn:hover { background: var(--sage); }
.ai-mini-btn .ai-spark { color: var(--gold); margin-right: 3px; }
.ai-textarea { width: 100%; min-height: 120px; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; font-family: inherit; color: var(--ink); line-height: 1.5; resize: vertical; }
.ai-textarea:focus { outline: none; border-color: var(--green-600); background: #fff; box-shadow: 0 0 0 3px rgba(63,122,95,.12); }
.voice-btn { position: absolute; bottom: 12px; right: 12px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 13px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); box-shadow: var(--shadow-sm); }
.voice-btn svg { width: 14px; height: 14px; }
.voice-btn.rec { background: var(--coral); color: #fff; border-color: var(--coral); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(224,122,111,.4); } 50% { box-shadow: 0 0 0 6px rgba(224,122,111,0); } }
.ai-rehab-result { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ai-market-text p { margin: 0 0 7px; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }

/* Chat assistant */
.chat-fab { position: fixed; bottom: 22px; right: 22px; z-index: 50; width: 54px; height: 54px; border-radius: 50%; background: var(--green-800); color: #fff; border: none; display: grid; place-items: center; box-shadow: var(--shadow-lg); }
.chat-fab svg { width: 23px; height: 23px; }
.chat-fab:hover { background: var(--green-700); }
.chat-panel { position: fixed; bottom: 88px; right: 22px; z-index: 50; width: 360px; max-width: calc(100vw - 44px); height: 480px; max-height: calc(100vh - 130px); background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.chat-head { padding: 14px 16px; border-bottom: 1px solid var(--line); font-family: var(--font-display); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; background: var(--sage-soft); color: var(--green-900); }
.chat-head .ai-spark { color: var(--gold); }
.chat-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 85%; padding: 9px 13px; border-radius: 13px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.chat-msg.user { align-self: flex-end; background: var(--green-800); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant { align-self: flex-start; background: var(--paper-2); color: var(--ink); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; font-family: inherit; }
.chat-input input:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(63,122,95,.12); }
.chat-input .btn { padding: 9px 12px; }
.chat-input .btn svg { width: 16px; height: 16px; }
@media print { .chat-fab, .chat-panel { display: none !important; } }

/* Access control */
.auth-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: radial-gradient(120% 120% at 50% 0%, var(--paper-2), var(--paper)); }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 28px; }
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.auth-brand .brand-mark { background: #fff; border: 1px solid var(--line); }
.auth-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.auth-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.auth-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.auth-input { width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 11px 13px; font-size: 14px; font-family: inherit; color: var(--ink); }
.auth-input:focus { outline: none; border-color: var(--green-600); background: #fff; box-shadow: 0 0 0 3px rgba(63,122,95,.12); }
.auth-err { color: var(--coral); font-size: 12.5px; margin-top: 12px; }
.auth-btn { width: 100%; justify-content: center; margin-top: 18px; padding: 12px; }
.auth-remember { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); margin-top: 14px; cursor: pointer; }
.auth-remember input { width: 15px; height: 15px; accent-color: var(--green-700); }
.auth-note { font-size: 11px; color: var(--muted); line-height: 1.5; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

.user-chip { display: flex; align-items: center; gap: 9px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 6px 5px 8px; box-shadow: var(--shadow-sm); }
.uc-avatar { width: 28px; height: 28px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; flex: none; }
.uc-info { display: flex; flex-direction: column; line-height: 1.1; }
.uc-name { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.uc-role { font-size: 10.5px; color: var(--muted); }
.uc-logout { border: none; background: transparent; color: var(--muted); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.uc-logout:hover { background: var(--paper-2); color: var(--coral); }
.uc-logout svg { width: 15px; height: 15px; }

/* Role restrictions */
.role-readonly input, .role-readonly select, .role-readonly textarea, .role-readonly .image-slot { pointer-events: none !important; }
.role-readonly .add-row, .role-readonly .row-del, .role-readonly .sec-reset, .role-readonly .use-btn, .role-readonly .offer-v, .role-readonly .ai-mini-btn, .role-readonly .offer-letter-btn, .role-readonly .photo-toggle, .role-readonly .photo-clear { display: none !important; }
.role-nofin .metric.is-profit, .role-nofin .profit-grid, .role-nofin .kpi-strip, .role-nofin .market-grid, .role-nofin .ai-card, .role-nofin .totals-row, .role-nofin .chat-fab { display: none !important; }
.role-nofin .metric-band { grid-template-columns: repeat(5, 1fr); }

/* Admin dashboard */
.admin-modal { max-width: 820px; }
.admin-tabs { display: flex; gap: 4px; padding: 10px 22px 0; }
.admin-tabs button { border: none; background: transparent; padding: 9px 14px; border-radius: 9px 9px 0 0; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.admin-tabs button.on { background: var(--sage-soft); color: var(--green-900); }
.admin-add { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr auto; gap: 8px; margin-bottom: 16px; }
.admin-add .set-input { width: 100%; }
.admin-users { display: flex; flex-direction: column; gap: 10px; }
.admin-user { border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; }
.au-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.au-name { font-weight: 700; font-size: 14px; }
.au-handle { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.au-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.role-select { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 5px 9px; font-size: 12.5px; font-weight: 600; font-family: inherit; }
.role-desc { font-size: 11.5px; color: var(--muted); }
.au-actions { display: flex; align-items: center; gap: 8px; }
.au-toggle { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 4px 11px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.au-toggle.on { background: var(--sage-soft); color: var(--green-800); border-color: var(--sage-line); }
.au-you { font-size: 11px; color: var(--muted); font-style: italic; }
.au-deals { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 11px; padding-top: 11px; border-top: 1px dashed var(--line); }
.au-deals-l { font-size: 11.5px; font-weight: 700; color: var(--ink-2); margin-right: 4px; }
.deal-chip { border: 1px solid var(--line); background: var(--paper); border-radius: 7px; padding: 4px 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.deal-chip.on { background: var(--green-800); color: #fff; border-color: var(--green-800); }
.activity-log { display: flex; flex-direction: column; }
.act-row { display: grid; grid-template-columns: 140px 1fr auto; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.act-user { font-weight: 700; color: var(--ink); }
.act-action { color: var(--ink-2); }
.act-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.all-deals { display: flex; flex-direction: column; }
.deal-row { grid-template-columns: 110px 1fr auto auto; align-items: center; }
.deal-profit { font-family: var(--font-display); font-weight: 700; font-size: 13.5px; }
.deal-profit.pos { color: var(--green-700); }
.deal-profit.neg { color: var(--coral); }

/* Print composer */
.print-pick { display: flex; flex-direction: column; gap: 7px; }
.pick-item { display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 11px 13px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); text-align: left; }
.pick-item.on { background: var(--sage-soft); border-color: var(--sage-line); color: var(--green-900); }
.pick-box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-strong); background: #fff; display: grid; place-items: center; flex: none; color: var(--green-700); }
.pick-item.on .pick-box { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.pick-box svg { width: 13px; height: 13px; }
.print-presets { display: flex; gap: 10px; margin-top: 12px; }
.print-presets button { border: none; background: transparent; color: var(--green-700); font-size: 12.5px; font-weight: 700; padding: 4px 6px; }
@media (max-width: 700px) { .admin-add { grid-template-columns: 1fr 1fr; } }

/* ============ Print report (letter) ============ */
.print-report { display: none; }
@media print {
  @page { size: letter portrait; margin: 0.6in 0.65in; }
  html, body { background: #fff !important; }
  .app, .drawer, .drawer-scrim { display: none !important; }
  .print-report {
    display: block; width: 100%; color: #18221c;
    font-family: var(--font-body); -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .print-report * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .pr-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2.5px solid #2c5a44; padding-bottom: 7px; }
  .pr-brand { font-family: var(--font-display); font-weight: 700; font-size: 16pt; color: #21422f; display: flex; align-items: baseline; gap: 8px; white-space: nowrap; flex-shrink: 0; }
  .pr-logo { color: #3f7a5f; }
  .pr-brand .pr-sub { font-family: var(--font-body); font-weight: 600; font-size: 9pt; color: #76806f; letter-spacing: .04em; text-transform: uppercase; }
  .pr-date { font-size: 8.5pt; color: #76806f; }

  .pr-address { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
  .pr-photo { width: 120px; height: 80px; object-fit: cover; border-radius: 6px; flex: none; }
  .pr-address h1 { font-family: var(--font-display); font-weight: 700; font-size: 15pt; margin: 0; letter-spacing: -.01em; }
  .pr-loc { font-size: 9.5pt; color: #34423a; margin-top: 2px; }
  .pr-specs { font-size: 8.5pt; color: #76806f; margin-top: 3px; }
  .pr-headline { margin-left: auto; text-align: right; flex-shrink: 0; }
  .pr-hl-l { font-size: 7.5pt; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #76806f; white-space: nowrap; }
  .pr-hl-v { font-family: var(--font-display); font-weight: 700; font-size: 21pt; color: #2f7d6b; line-height: 1.05; }
  .pr-hl-v.neg { color: #d4502e; }
  .pr-hl-s { font-size: 8.5pt; color: #34423a; }

  .pr-metrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 13px; }
  .pr-metric { background: #2c5a44; color: #fff; border-radius: 6px; padding: 8px 9px; }
  .pm-l { font-size: 6.5pt; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: rgba(255,255,255,.7); }
  .pm-v { font-family: var(--font-display); font-weight: 700; font-size: 11.5pt; margin-top: 3px; }

  .pr-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
  .pr-card { border: 1px solid #d3d0c0; border-radius: 7px; overflow: hidden; break-inside: avoid; }
  .pr-card-h {
    background: #e3e8cb; color: #21422f; font-family: var(--font-display); font-weight: 700;
    font-size: 8.5pt; letter-spacing: .05em; text-transform: uppercase; padding: 6px 10px;
    display: flex; justify-content: space-between;
  }
  table.pr-tbl { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
  table.pr-tbl td { padding: 4px 10px; border-top: 1px solid #ece9dd; }
  table.pr-tbl td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
  table.pr-tbl tr:first-child td { border-top: none; }
  table.pr-tbl .pr-total td { background: #f4f3ed; font-weight: 800; color: #21422f; border-top: 1.5px solid #b6c486; }

  .pr-foot { margin-top: 14px; padding-top: 8px; border-top: 1px solid #d3d0c0; font-size: 7pt; color: #76806f; line-height: 1.5; }
}

/* ============ Full interactive print (section-composed) ============ */
.print-full { display: none; }
.pf-header { display: none; }
@media print {
  @page { size: letter portrait; margin: 0.5in 0.55in; }
  html, body { background: #fff !important; }
  .app, .chat-fab, .chat-panel, .drawer, .drawer-scrim, .modal-scrim, .print-report { display: none !important; }
  .print-full { display: block !important; color: var(--ink); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-full * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pf-header { display: flex !important; align-items: center; justify-content: space-between; border-bottom: 2.5px solid var(--green-800); padding-bottom: 8px; margin-bottom: 12px; }
  .pf-brand { display: flex; align-items: center; gap: 10px; }
  .pf-title { font-family: var(--font-display); font-weight: 700; font-size: 15pt; color: var(--green-900); }
  .pf-addr { font-size: 9pt; color: var(--muted); }
  .pf-date { font-size: 8.5pt; color: var(--muted); }
  .pf-metrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 14px; }
  .pf-metric { background: var(--green-800); color: #fff; border-radius: 6px; padding: 8px 10px; }
  .pf-metric .pm-l { font-size: 6.5pt; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: rgba(255,255,255,.7); }
  .pf-metric .pm-v { font-family: var(--font-display); font-weight: 700; font-size: 12pt; margin-top: 2px; }
  .pf-sec { break-inside: auto; margin-bottom: 14px; }
  .pf-sec-title { font-family: var(--font-display); font-weight: 700; font-size: 12pt; color: var(--green-900); margin: 0 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
  .pf-foot { margin-top: 14px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 7.5pt; color: var(--muted); }

  /* Make on-screen components print cleanly */
  .print-full button, .print-full .add-row, .print-full .sec-reset, .print-full .ai-mini-btn,
  .print-full .use-btn, .print-full .offer-v, .print-full .voice-btn, .print-full .photo-toggle,
  .print-full .photo-clear, .print-full .offer-letter-btn, .print-full .ai-card, .print-full .lookup,
  .print-full .fetch-status, .print-full .comps-head .btn, .print-full .hold-period .in,
  .print-full .row-del { display: none !important; }
  .print-full input, .print-full select, .print-full textarea {
    border: none !important; background: transparent !important; box-shadow: none !important;
    -webkit-appearance: none; appearance: none; color: #000 !important; padding: 2px 0 !important; text-align: right;
  }
  .print-full .card { box-shadow: none; break-inside: avoid; }
  .print-full .card-body { padding: 8px 12px; }
  .print-full .card-head { padding: 8px 12px; }
  .print-full .big-num { font-size: 26px; }
  .print-full .fin-result { padding: 16px; }
  .print-full .metric-band { padding: 4px; }
  .print-full .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .print-full .col { gap: 10px; }
  .print-full .fin-wrap, .print-full .market-grid, .print-full .two-col, .print-full .be-grid,
  .print-full .nb-grid, .print-full .scn-grid { grid-template-columns: 1fr 1fr !important; }
  .print-full .nb-map, .print-full iframe.nb-sv { height: 200px; }
}
