/* Realtors Listings — Realtors Group brand: midnight #131E29, Tuscany yellow #F0B323, fog gray #D9D9D6 */
:root {
  --midnight: #131E29;
  --midnight-2: #1E2C3A;
  --yellow: #F0B323;
  --yellow-soft: #FDF3DA;
  --fog: #D9D9D6;
  --fog-soft: #F1F1EF;
  --paper: #FFFFFF;
  --ink: #131E29;
  --muted: #5B6672;
  --line: #E2E2DF;
  --ok: #2F7D4F;
  --warn: #C86B00;
  --bad: #B3261E;
  --radius: 14px;
  --head: 'Playfair Display', Georgia, serif;
  --body: 'Mulish', 'Muli', system-ui, -apple-system, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); font-weight: 500; color: var(--ink); background: var(--fog-soft); font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); }
h1, h2, h3 { font-family: var(--head); font-weight: 700; margin: 0; letter-spacing: .01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hide { display: none !important; }
.boot { min-height: 100vh; display: grid; place-items: center; background: var(--midnight); }

/* ---------- top bar */
.top { background: var(--midnight); color: #fff; position: sticky; top: 0; z-index: 30; padding-top: env(safe-area-inset-top, 0px); }
.top-in { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.top .logo { display: block; width: 210px; height: auto; }
.top .spacer { flex: 1; }
.iconbtn { background: transparent; border: 0; color: #fff; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; position: relative; }
.iconbtn:hover { background: var(--midnight-2); }
.iconbtn svg { width: 24px; height: 24px; }
.badge-dot { position: absolute; top: 4px; right: 2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--yellow); color: var(--midnight); font-size: .72rem; font-weight: 800; display: grid; place-items: center; }
.nav { max-width: 1100px; margin: 0 auto; display: flex; gap: 6px; padding: 0 12px 10px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: #E9ECEF; text-decoration: none; padding: 8px 14px; border-radius: 999px; white-space: nowrap; font-weight: 600; font-size: .95rem; }
.nav a.on { background: var(--yellow); color: var(--midnight); }

/* ---------- layout */
main { max-width: 1100px; margin: 0 auto; padding: 18px 14px calc(110px + var(--safe-b)); }
.card { background: var(--paper); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 0 rgba(19,30,41,.06); margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.pagehead { margin: 4px 2px 16px; }
.pagehead p { margin: 4px 0 0; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--midnight); background: var(--paper); color: var(--midnight); font-weight: 700; cursor: pointer; text-decoration: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.primary { background: var(--midnight); color: #fff; }
.btn.gold { background: var(--yellow); border-color: var(--yellow); color: var(--midnight); }
.btn.ghost { border-color: var(--line); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.small { min-height: 38px; padding: 0 12px; font-size: .9rem; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; }

/* ---------- start tiles (agent home) */
.starts { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 18px; }
@media (min-width: 720px) { .starts { grid-template-columns: repeat(3, 1fr); } }
.start { display: flex; gap: 14px; align-items: center; background: var(--midnight); color: #fff; border-radius: var(--radius); padding: 20px 18px; text-decoration: none; min-height: 96px; }
.start .ic { width: 52px; height: 52px; border-radius: 14px; background: var(--yellow); color: var(--midnight); display: grid; place-items: center; flex: none; }
.start .ic svg { width: 28px; height: 28px; }
.start b { font-family: var(--head); font-size: 1.25rem; display: block; }
.start span { color: #C9CFD6; font-size: .9rem; }

/* ---------- lists */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: block; background: var(--paper); border-radius: 12px; padding: 14px 16px; text-decoration: none; border-left: 4px solid transparent; }
.item.unread { border-left-color: var(--yellow); }
.item .t { font-weight: 800; }
.item .m { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; background: var(--fog-soft); color: var(--midnight); border: 1px solid var(--line); white-space: nowrap; }
.pill.k-valuation { background: #E8EEF5; border-color: #D3DDE9; }
.pill.k-sale { background: var(--yellow-soft); border-color: #F5DE9E; }
.pill.k-rent { background: #E6F2EA; border-color: #C9E3D2; }
.pill.draft { background: #fff; border-style: dashed; color: var(--muted); }
.st { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; color: #fff; background: var(--muted); white-space: nowrap; }
.st-pending, .st-new { background: #7A8591; }
.st-scheduled, .st-processing { background: #3D6A99; }
.st-completed, .st-live { background: var(--midnight); }
.st-postponed, .st-application, .st-under_offer { background: var(--warn); }
.st-cancelled, .st-withdrawn { background: var(--bad); }
.st-going_to_market { background: #6B4FA0; }
.st-mandate { background: var(--yellow); color: var(--midnight); }
.st-sold, .st-let { background: var(--ok); }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 7px 14px; font-weight: 700; cursor: pointer; font-size: .92rem; }
.tab.on { background: var(--midnight); color: #fff; border-color: var(--midnight); }
.search { width: 100%; min-height: 46px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px; background: #fff; }

/* ---------- form */
.formhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin: 2px 2px 14px; }
.savestate { font-size: .82rem; color: var(--muted); white-space: nowrap; padding-top: 6px; }
.capture { background: var(--midnight); color: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.capture h3 { color: var(--yellow); margin-bottom: 4px; }
.capture p { margin: 0 0 12px; color: #C9CFD6; font-size: .9rem; }
.capture .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.capbtn { background: var(--midnight-2); color: #fff; border: 1.5px solid #34465A; border-radius: 12px; min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 700; cursor: pointer; padding: 10px; text-align: center; }
.capbtn svg { width: 30px; height: 30px; color: var(--yellow); }
.capbtn:active { background: #283A4D; }
.aibanner { background: var(--yellow-soft); border: 1.5px solid var(--yellow); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: .92rem; }
.aibanner b { display: block; margin-bottom: 2px; }
details.sec { background: var(--paper); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
details.sec > summary { list-style: none; cursor: pointer; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary h2 { font-size: 1.1rem; }
details.sec > summary .cnt { font-size: .8rem; color: var(--muted); font-weight: 700; }
details.sec > summary .chev { transition: transform .15s; width: 20px; height: 20px; color: var(--muted); }
details.sec[open] > summary .chev { transform: rotate(180deg); }
.secbody { padding: 0 18px 18px; }
.sechint { margin: -6px 0 12px; color: var(--muted); font-size: .88rem; }
.fields { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .fields { grid-template-columns: 1fr 1fr; } .f.full { grid-column: 1 / -1; } }
.f label, .lbl { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.f .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.inp { width: 100%; min-height: 48px; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; font-size: 16px; }
textarea.inp { min-height: 96px; resize: vertical; line-height: 1.4; }
.inp:focus { outline: none; border-color: var(--midnight); box-shadow: 0 0 0 3px rgba(240,179,35,.35); }
select.inp { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23131E29' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 38px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 42px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; cursor: pointer; font-size: .93rem; }
.chip.on { background: var(--midnight); border-color: var(--midnight); color: #fff; }
.feat { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 720px) { .feat { grid-template-columns: repeat(3, 1fr); } }
.feat .chip { border-radius: 12px; text-align: left; display: flex; align-items: center; gap: 8px; }
.feat .chip::before { content: ''; width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--fog); flex: none; }
.feat .chip.on::before { background: var(--yellow); border-color: var(--yellow); box-shadow: inset 0 0 0 3px var(--midnight); }
.f.ai .inp, .f.ai .chips, .chip.ai { box-shadow: 0 0 0 3px var(--yellow); border-radius: 12px; }
.f.check .inp, .f.check .chips, .chip.check { box-shadow: 0 0 0 3px var(--warn); border-radius: 12px; }
.f .tag { display: inline-block; font-size: .7rem; font-weight: 800; padding: 1px 7px; border-radius: 6px; margin-left: 6px; vertical-align: 1px; }
.f.ai .tag { background: var(--yellow); color: var(--midnight); }
.f.check .tag { background: var(--warn); color: #fff; }
.bottombar { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); padding: 10px 14px calc(10px + var(--safe-b)); z-index: 25; backdrop-filter: blur(8px); }
.bottombar .in { max-width: 1100px; margin: 0 auto; display: flex; gap: 10px; }
.bottombar .btn { flex: 1; }

/* ---------- modal */
.modal { position: fixed; inset: 0; background: rgba(19,30,41,.6); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 720px) { .modal { align-items: center; } }
.sheet { background: #fff; width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 20px 18px calc(20px + var(--safe-b)); }
@media (min-width: 720px) { .sheet { border-radius: 20px; } }
.sheet .x { float: right; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.thumb { position: relative; aspect-ratio: 3/4; border-radius: 10px; overflow: hidden; background: var(--fog-soft); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(19,30,41,.8); color: #fff; font-weight: 800; cursor: pointer; }
.mic { width: 112px; height: 112px; border-radius: 50%; border: 0; background: var(--midnight); color: var(--yellow); display: grid; place-items: center; margin: 14px auto; cursor: pointer; }
.mic svg { width: 46px; height: 46px; }
.mic.rec { background: var(--bad); color: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(179,38,30,.5); } 70% { box-shadow: 0 0 0 22px rgba(179,38,30,0); } 100% { box-shadow: 0 0 0 0 rgba(179,38,30,0); } }
.interim { color: var(--muted); font-style: italic; min-height: 1.4em; font-size: .92rem; }
.spinner { width: 46px; height: 46px; border: 5px solid var(--fog); border-top-color: var(--yellow); border-radius: 50%; animation: spin 1s linear infinite; margin: 18px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.tip { background: var(--fog-soft); border-radius: 10px; padding: 10px 12px; font-size: .88rem; color: var(--muted); }

/* ---------- record view */
.kv { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 560px) { .kv { grid-template-columns: 1fr 1fr; column-gap: 24px; } }
.kv div { padding: 8px 0; border-bottom: 1px solid var(--fog-soft); }
.kv dt { font-size: .78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.kv dd { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.kv .wide { grid-column: 1 / -1; }
.featview { display: flex; flex-wrap: wrap; gap: 6px; }
.hist { list-style: none; padding: 0; margin: 0; }
.hist li { padding: 8px 0; border-bottom: 1px solid var(--fog-soft); font-size: .9rem; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photos a { display: block; aspect-ratio: 3/4; border-radius: 10px; overflow: hidden; background: var(--fog-soft); }
.photos img { width: 100%; height: 100%; object-fit: cover; }
.voice { background: var(--fog-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; white-space: pre-wrap; font-size: .92rem; }

/* ---------- tracker */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(6, 1fr); } }
.kpi { background: var(--paper); border-radius: 12px; padding: 14px; }
.kpi .n { font-family: var(--head); font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.kpi .l { font-size: .8rem; color: var(--muted); font-weight: 700; }
.kpi.hl { background: var(--midnight); color: #fff; }
.kpi.hl .n { color: var(--yellow); }
.kpi.hl .l { color: #C9CFD6; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
@media (min-width: 720px) { .filters { grid-template-columns: repeat(4, 1fr); } }
.funnel { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.funnel button { border: 0; cursor: pointer; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 6px; border-bottom: 2px solid var(--fog); }
table.t td { padding: 9px 6px; border-bottom: 1px solid var(--fog-soft); vertical-align: middle; }
.scroll { overflow-x: auto; }
.trow { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; background: var(--paper); border-radius: 12px; padding: 12px 14px; }
.trow .a { font-weight: 800; text-decoration: none; display: block; }
.trow select { min-height: 40px; border-radius: 10px; border: 1.5px solid var(--line); padding: 0 30px 0 10px; font-weight: 700; font-size: .88rem; max-width: 190px; }

/* ---------- notifications panel */
.panel { position: fixed; top: calc(64px + env(safe-area-inset-top, 0px)); right: 10px; width: min(380px, calc(100vw - 20px)); max-height: 70vh; overflow: auto; background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(19,30,41,.25); z-index: 40; }
.panel .ph { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel a { display: block; padding: 12px 14px; border-bottom: 1px solid var(--fog-soft); text-decoration: none; font-size: .92rem; }
.panel a.new { background: var(--yellow-soft); }
.panel .when { font-size: .76rem; color: var(--muted); }

/* ---------- login */
.auth { min-height: 100vh; display: grid; place-items: center; background: var(--midnight); padding: 20px; }
.auth .box { width: 100%; max-width: 420px; }
.auth .logo { width: 100%; max-width: 380px; display: block; margin: 0 auto 26px; }
.auth .card { padding: 22px; }
.auth h1 { margin-bottom: 14px; }
.auth .f { margin-bottom: 12px; }
.err { color: var(--bad); font-weight: 700; font-size: .9rem; min-height: 1.2em; margin: 6px 0; }

#toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--midnight); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 700; opacity: 0; pointer-events: none; transition: all .2s; z-index: 60; max-width: calc(100vw - 30px); text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- print (listing sheet) */
.printhead { display: none; }
@media print {
  body { background: #fff; font-size: 11pt; }
  .top, .bottombar, .noprint, #toast, .panel { display: none !important; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; padding: 6px 0; margin: 0 0 8px; break-inside: avoid; }
  .printhead { display: block; background: var(--midnight); padding: 14px; margin-bottom: 12px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .printhead img { width: 46%; display: block; margin: 0 auto; }
  .printfoot { display: block !important; border-top: 1px solid #999; margin-top: 14px; padding-top: 6px; font-size: 8.5pt; color: #444; text-align: center; }
}
.printfoot { display: none; }
