:root {
  /* light theme (the palette proven in scenarios print mode) */
  --bg: #ffffff; --panel: #f6f8fa; --panel2: #eef1f4; --border: #d3dbe2;
  --text: #1c2733; --muted: #5a6a78; --accent: #8a6a1c; --accent2: #25714f;
  --danger: #a8433d; --on-accent: #ffffff;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, "Segoe UI", sans-serif; display: flex; flex-direction: column; }

header { display: flex; gap: 16px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--panel); z-index: 500; }
.brand h1 { font-size: 19px; color: var(--accent); display: inline; }
.brand h1 a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.brand .brandmark { height: 24px; width: auto; display: block; }
.brand .tag { color: var(--muted); font-size: 11px; margin-left: 8px; display: block; }
#search { flex: 1; max-width: 440px; background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px; font-size: 14px; }
.conn { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--border); white-space: nowrap; }
.pill.ok { border-color: var(--accent2); color: var(--accent2); }
.pill.err { border-color: var(--danger); color: var(--danger); }
select, input { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; font-size: 14px; }
input::placeholder { color: var(--muted); }

#split { flex: 1; display: flex; min-height: 0; }
#listings { width: 390px; min-width: 300px; border-right: 1px solid var(--border); background: var(--panel); display: flex; flex-direction: column; }
#listings-head { padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
#cards { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.prop-card { background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: border-color .15s; }
.prop-card:hover, .prop-card.hot { border-color: var(--accent); }
.prop-card .price { font-size: 17px; font-weight: 700; color: var(--accent); }
.prop-card .addr { font-size: 13px; margin: 2px 0; }
.prop-card .meta { font-size: 11px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.badge { font-size: 10px; padding: 2px 8px; border-radius: 999px; background: var(--accent2); color: #fff; }
.badge.acq { background: var(--muted); }
.badge.exited { background: var(--danger); }
.badge.sold { background: #7a6b8f; }

#map { flex: 1; background: #dfe6ec; }
.price-pin { background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 2px solid #ffffff; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.price-pin.sold { background: #7a6b8f; color: #fff; }
.price-pin.oh { background: #3d6f99; color: #fff; border-color: var(--on-accent); }
.prop-card img.thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; margin-bottom: 8px; display: block; }
.prop-card .ohfav { float: right; background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: 2px 10px; font-size: 14px; cursor: pointer; }
.prop-card .ohfav.on { border-color: var(--danger); color: var(--danger); }

/* ---- deal pipeline stepper ---- */
.deal-card { margin-top: 12px; }
.deal-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.deal-head .addr { font-weight: 600; }
.deal-steps { display: flex; margin: 12px 0 6px; flex-wrap: wrap; }
.dstep { flex: 1; min-width: 74px; text-align: center; position: relative; padding-top: 2px; }
.dstep .dot { width: 14px; height: 14px; border-radius: 999px; background: var(--panel2); border: 2px solid var(--border); display: inline-block; position: relative; z-index: 1; }
.dstep.done .dot { background: var(--accent2); border-color: var(--accent2); }
.dstep.cur .dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(138,106,28,.18); }
.dstep label { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; line-height: 1.25; }
.dstep.done label { color: var(--accent2); }
.dstep.cur label { color: var(--accent); font-weight: 700; }
.dstep::before { content: ""; position: absolute; top: 9px; left: -50%; width: 100%; height: 2px; background: var(--border); }
.dstep.done::before, .dstep.cur::before { background: var(--accent2); }
.dstep:first-child::before { display: none; }
.deal-acts input { max-width: 220px; font-size: 12px; }
.leaflet-container { font: inherit; }

.overlay { position: fixed; inset: 0; background: rgba(28,39,51,.35); z-index: 1100; display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; padding: 4vh 2vw; }
/* keep Leaflet's zoom & attribution controls under our overlays */
.leaflet-top, .leaflet-bottom { z-index: 800; }
.overlay.hidden { display: none; }
.sheet { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; width: min(1060px, 96vw); padding: 18px 22px; }
.sheet.narrow { width: min(520px, 94vw); pointer-events: auto; }
#sell.overlay { background: transparent; pointer-events: none; justify-content: flex-end; align-items: flex-start; }
.sheet-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sheet-head h2 { font-size: 18px; color: var(--accent); }
.sheet-head .sub { display: flex; gap: 12px; align-items: center; margin-top: 4px; }
.price { color: var(--accent); font-weight: 700; }
button.close { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 8px; padding: 4px 10px; font-size: 14px; cursor: pointer; }

.dtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 8px 0 14px; }
.dtabs button { background: none; border: none; color: var(--muted); padding: 8px 13px; cursor: pointer; font-size: 13px; border-bottom: 2px solid transparent; }
.dtabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

.hidden { display: none !important; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.card.wide { grid-column: 1 / -1; }
.card h3 { font-size: 14px; margin-bottom: 8px; color: var(--accent); }
.role-req { color: var(--muted); font-size: 11px; font-weight: normal; }
.note { color: var(--muted); font-size: 12px; margin: 5px 0; }
.mono { font-family: var(--mono); font-size: 11px; }

table.kv { width: 100%; border-collapse: collapse; }
table.kv td { padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
table.kv td:first-child { color: var(--muted); width: 46%; }
table.list { width: 100%; border-collapse: collapse; font-size: 12px; }
table.list th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 8px; border-bottom: 1px solid var(--border); }
table.list td { padding: 4px 8px; border-bottom: 1px solid var(--panel2); font-family: var(--mono); font-size: 11px; }

.row { display: flex; gap: 8px; margin: 8px 0; align-items: center; flex-wrap: wrap; }
.row input[type=number], .row input[type=text], .row input[type=search] { flex: 1; min-width: 110px; }
.chk { color: var(--muted); font-size: 13px; }
button { background: var(--accent); color: var(--on-accent); border: none; border-radius: 7px; padding: 8px 15px; font-size: 13px; font-weight: 600; cursor: pointer; }
button:hover { filter: brightness(1.1); }
button.danger { background: var(--danger); color: #fff; }
/* eligibility-check chips on the buy-request review row */
button.chip { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--panel2); color: var(--muted); border: 1px solid var(--border); }
button.chip.ok { border-color: var(--accent2); color: var(--accent2); background: var(--panel2); }
button.chip.danger { border-color: var(--danger); color: var(--danger); background: var(--panel2); }
button.cta { background: var(--accent2); color: #fff; }
#btn-unfreeze, #btn-claim, #btn-recover { background: var(--accent2); color: #fff; }

#toast { position: fixed; bottom: 20px; right: 20px; max-width: 440px; background: var(--panel2); border: 1px solid var(--accent2); border-radius: 10px; padding: 12px 16px; font-size: 13px; z-index: 1200; white-space: pre-wrap; }
#toast.err { border-color: var(--danger); }

.progress { height: 14px; background: var(--panel2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 8px 0 12px; }
#fin-bar { height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); width: 0%; transition: width .4s; }
.badge.fin { background: var(--accent); color: var(--on-accent); }

#filterbar { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
#filterbar button { background: var(--panel2); color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 500; }
#filterbar button.active { color: var(--accent); border-color: var(--accent); }
button.cta2 { background: var(--accent); color: var(--on-accent); }
#btn-bell { background: none; border: 1px solid var(--border); border-radius: 999px; padding: 6px 10px; position: relative; font-size: 14px; }
.bellcount { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; border-radius: 999px; font-size: 10px; padding: 1px 5px; font-weight: 700; }
.badge.raise { background: #3d6f99; }
#request.overlay, #notifs.overlay { background: transparent; pointer-events: none; justify-content: flex-end; align-items: flex-start; }
#request .sheet, #notifs .sheet { pointer-events: auto; }
#btn-watch.on { background: var(--accent); color: var(--on-accent); }

/* ---- friendly-first UI: big human numbers, tech behind details ---- */
.hero { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.stat-big { flex: 1; min-width: 150px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; }
.stat-big label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.stat-big span { font-size: 24px; font-weight: 700; color: var(--accent); }
.stat-big.calm span { color: var(--text); }
details.tech { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 0; margin: 10px 0; }
details.tech > summary { cursor: pointer; list-style: none; padding: 11px 16px; color: var(--muted); font-size: 13px; user-select: none; }
details.tech > summary::before { content: "▸ "; color: var(--accent); }
details.tech[open] > summary::before { content: "▾ "; }
details.tech > summary:hover { color: var(--text); }
details.tech > .inner { padding: 4px 16px 14px; }
.prop-card .meta2 { font-size: 12px; color: var(--muted); margin-top: 4px; }
.prop-card .meta2 b { color: var(--text); font-weight: 600; }

/* header link to the scenarios page */
a#btn-scenarios { text-decoration: none; color: var(--accent); border-color: var(--accent); }
a#btn-scenarios:hover { background: var(--panel); }
