:root { --navy: #0f1f3a; --navy2: #1b2f55; --gold: #c9a24b; --bg: #f3f1ec; --card: #fff; --ink: #14181f; --muted: #6b7280; --line: #e5e1d8; --soft: #f8f6f1; --ok: #15803d; --warn: #b45309; --bad: #b91c1c; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color-scheme: light; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); }

.top { position: sticky; top: 0; z-index: 3000; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; background: var(--navy); color: #fff; }
.brand { display: flex; gap: 10px; align-items: center; }
.brand b { letter-spacing: .14em; font-size: 15px; display: block; }
.brand small { color: #c8cfdc; font-size: 11px; }
.mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: var(--navy); background: linear-gradient(135deg, #e7cf8f, var(--gold)); }
.top-r { display: flex; align-items: center; gap: 8px; min-width: 0; }
.who { font-size: 12px; color: #c8cfdc; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ghost { border: 0; border-radius: 10px; padding: 7px 12px; background: rgba(255,255,255,.12); color: #fff; }

.tabs { position: sticky; top: 56px; z-index: 2900; display: flex; gap: 4px; padding: 8px 12px; overflow-x: auto; background: var(--navy2); }
.tabs button { flex: none; border: 0; border-radius: 10px; padding: 8px 12px; background: transparent; color: #c8cfdc; font-weight: 600; font-size: 14px; }
.tabs button.on { background: var(--gold); color: var(--navy); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 4px 0 12px; flex-wrap: wrap; }
.row-head h2 { margin: 0; font-size: 20px; }
.btn { border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 700; background: var(--navy); color: #fff; }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.line { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.bad { background: #fff; color: var(--bad); border: 1px solid #f3c7c7; }
.btn:disabled { opacity: .5; cursor: default; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters select, .filters input { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 10px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; text-align: left; padding: 0; display: flex; flex-direction: column; }
.card .im { height: 150px; background: linear-gradient(135deg, #dfe4ee, #c9d2e3); display: grid; place-items: center; font-size: 40px; position: relative; }
.card .im img { width: 100%; height: 100%; object-fit: cover; }
.card .tx { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.card b { font-size: 15px; }
.card .price { font-size: 17px; font-weight: 800; color: var(--navy); }
.small { font-size: 12px; color: var(--muted); }
.badge { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: rgba(15,31,58,.85); color: #fff; }
.badge.off_market { background: var(--gold); color: var(--navy); }
.badge.public { background: rgba(21,128,61,.9); }
.pill { display: inline-block; width: fit-content; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); }
.pill.active, .pill.won, .pill.closed { background: #e7f6ec; color: var(--ok); border-color: #bfe5cb; }
.pill.under_offer, .pill.offer, .pill.viewing, .pill.due_diligence, .pill.preliminary, .pill.contract { background: #fdf3e1; color: var(--warn); border-color: #f2dcae; }
.pill.lost, .pill.cancelled, .pill.withdrawn { background: #fbeaea; color: var(--bad); border-color: #f3c7c7; }

.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; justify-content: space-between; gap: 10px; align-items: center; text-align: left; width: 100%; }
.item .l { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.item b { font-size: 15px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; background: var(--card); border: 1px dashed var(--line); border-radius: 16px; }
.mapbox { position: relative; z-index: 0; isolation: isolate; height: 320px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 12px; }
.mapbox.small-map { height: 220px; }

.sheet { position: fixed; inset: 0; z-index: 5000; background: rgba(10,15,25,.5); display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; padding: 24px 12px; }
.sheet-card { background: var(--card); border-radius: 20px; width: min(760px, 100%); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.sheet-card h3 { margin: 0; font-size: 18px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.x { border: 0; background: var(--soft); border-radius: 10px; width: 36px; height: 36px; font-size: 18px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form .full { grid-column: 1 / -1; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.f input, label.f select, label.f textarea { border: 1px solid var(--line); background: var(--soft); border-radius: 10px; padding: 9px 10px; font-size: 14px; }
label.f textarea { min-height: 70px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 5px 10px; font-size: 12px; font-weight: 600; }
.chips button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sect { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.sect > h4 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.stages { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
.stages span { flex: 1; min-width: 74px; text-align: center; font-size: 11px; font-weight: 700; padding: 6px 4px; border-radius: 8px; background: var(--soft); color: var(--muted); }
.stages span.done { background: #e7f6ec; color: var(--ok); }
.stages span.now { background: var(--navy); color: #fff; }
.dd { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--soft); font-size: 13px; }
.dd select { border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; font-size: 12px; }
.dd.ok span { color: var(--ok); } .dd.issue span { color: var(--bad); font-weight: 700; }
.msg { border-left: 3px solid var(--line); padding: 4px 10px; font-size: 13px; }
.msg small { display: block; color: var(--muted); font-size: 11px; }
.msg.buyer { border-color: #3b82f6; } .msg.seller { border-color: var(--gold); }
table.comm { width: 100%; border-collapse: collapse; font-size: 13px; }
table.comm td { padding: 5px 0; border-bottom: 1px solid var(--soft); }
table.comm td:last-child { text-align: right; font-weight: 700; }

.login { min-height: 70vh; display: grid; place-items: center; }
.login .card { padding: 24px; width: min(420px, 100%); gap: 12px; }
.login h1 { margin: 0; font-size: 22px; }

.toast { position: fixed; left: 0; right: 0; bottom: 20px; margin: 0 auto; width: fit-content; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px; background: #111; color: #fff; z-index: 6000; }
@media (max-width: 640px) { .form { grid-template-columns: 1fr; } .tabs { top: 56px; } }

.badge.fire { left: auto; right: 8px; background: #dc2626; }
.fire-card { border-color: #f5c6a5; background: linear-gradient(180deg, #fff7ef, #fff); }
.check { display: flex; gap: 6px; align-items: center; font-size: 14px; }
