/* ===== Kho nguồn BĐS — giao diện Đợt 1 ===== */
:root{
  --bg:#f5f6f8; --card:#ffffff; --text:#1a1d21; --muted:#6b7280;
  --line:#e5e7eb; --brand:#0f766e; --brand-soft:#ccfbf1;
  --ban:#2563eb; --thue:#9333ea;
  --st-dang:#16a34a; --st-coc:#d97706; --st-xong:#6b7280; --st-ngung:#9ca3af;
  --danger:#dc2626; --warn:#f59e0b;
  --tabbar-h:64px; --topbar-h:104px;
  --safe-b:env(safe-area-inset-bottom,0px);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0f1216; --card:#1a1f26; --text:#e7eaee; --muted:#9aa4b2;
    --line:#2a313a; --brand:#2dd4bf; --brand-soft:#134e4a;
  }
}
:root[data-theme="dark"]{
  --bg:#0f1216; --card:#1a1f26; --text:#e7eaee; --muted:#9aa4b2;
  --line:#2a313a; --brand:#2dd4bf; --brand-soft:#134e4a;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  background:var(--bg); color:var(--text); font-size:16px; line-height:1.45;
  -webkit-text-size-adjust:100%;
}
button{font-family:inherit; cursor:pointer}
input,select,textarea{font-family:inherit; font-size:16px} /* 16px: iPhone không tự phóng to */

/* ===== Thanh trên ===== */
.topbar{
  position:sticky; top:0; z-index:20; background:var(--card);
  border-bottom:1px solid var(--line); padding:10px 14px 10px; }
.brand{font-weight:800; font-size:18px; display:flex; align-items:center; gap:8px}
.dot{font-size:13px; color:#fff; background:var(--brand); border-radius:999px; padding:1px 9px; font-weight:700}
.topbar-search{margin-top:8px}
.topbar-search input{
  width:100%; height:44px; border:1px solid var(--line); border-radius:12px;
  padding:0 14px; background:var(--bg); color:var(--text); }

/* ===== Vùng nội dung ===== */
main{padding:14px 14px calc(var(--tabbar-h) + var(--safe-b) + 90px); max-width:1100px; margin:0 auto}
.seg{display:flex; gap:8px; margin-bottom:12px}
.seg button{
  flex:1; height:40px; border:1px solid var(--line); background:var(--card); color:var(--muted);
  border-radius:10px; font-weight:700; }
.seg button.on{background:var(--brand-soft); color:var(--brand); border-color:var(--brand)}
.muted{color:var(--muted)}
.empty{text-align:center; color:var(--muted); padding:48px 16px}
.empty .big{font-size:40px; margin-bottom:8px}

/* ===== Thẻ căn ===== */
.cards{display:grid; grid-template-columns:1fr; gap:12px}
@media(min-width:720px){ .cards{grid-template-columns:1fr 1fr} }
@media(min-width:1024px){ .cards{grid-template-columns:1fr 1fr 1fr} }
.card{
  background:var(--card); border:1px solid var(--line); border-radius:16px; overflow:hidden;
  box-shadow:0 1px 2px rgba(0,0,0,.04); }
.card .thumb{height:150px; background:linear-gradient(135deg,#e2e8f0,#cbd5e1); display:flex;
  align-items:center; justify-content:center; font-size:40px; color:#94a3b8; position:relative}
.card .thumb img{width:100%; height:100%; object-fit:cover}
.card .fav{position:absolute; top:8px; right:8px; width:40px; height:40px; border-radius:50%;
  border:none; background:rgba(0,0,0,.45); color:#fff; font-size:20px}
.card .body{padding:12px 14px}
.card .price{font-size:20px; font-weight:800; color:var(--brand)}
.card .spec{color:var(--muted); font-size:14px; margin:3px 0 8px}
.card .addr{font-size:14px; margin-bottom:8px}
.card .addr .old{color:var(--muted); font-size:12.5px}
.badge{display:inline-block; font-size:12px; font-weight:800; padding:3px 9px; border-radius:999px; color:#fff}
.b-dang{background:var(--st-dang)} .b-coc{background:var(--st-coc)}
.b-xong{background:var(--st-xong)} .b-ngung{background:var(--st-ngung)}
.b-ma{background:var(--line); color:var(--muted)}
.row-badges{display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin-bottom:8px}
.actions{display:flex; gap:6px; flex-wrap:wrap; border-top:1px solid var(--line); padding-top:10px}
.actions button{flex:1; min-width:84px; height:40px; border-radius:10px; border:1px solid var(--line);
  background:var(--bg); color:var(--text); font-weight:600; font-size:13.5px}
.actions button.danger{color:var(--danger); border-color:#fecaca}
.actions button.primary{background:var(--brand); color:#fff; border-color:var(--brand)}

/* ===== Form ===== */
.form label{display:block; font-weight:700; margin:12px 0 5px; font-size:14px}
.form .hint{color:var(--muted); font-weight:400; font-size:13px}
.form input,.form select,.form textarea{
  width:100%; min-height:46px; border:1px solid var(--line); border-radius:12px;
  padding:10px 12px; background:var(--card); color:var(--text); }
.form textarea{min-height:120px; resize:vertical; line-height:1.5}
.grid2{display:grid; grid-template-columns:1fr 1fr; gap:10px}
.req::after{content:" *"; color:var(--danger)}
.block{background:var(--card); border:1px solid var(--line); border-radius:16px; padding:14px; margin-bottom:14px}
.block h3{margin:0 0 4px; font-size:15px}
.chips{display:flex; gap:8px; flex-wrap:wrap}
.chip{border:1px solid var(--line); background:var(--bg); border-radius:999px; padding:8px 12px; font-size:14px}
.chip.on{background:var(--brand-soft); color:var(--brand); border-color:var(--brand); font-weight:700}
.btn{height:50px; border-radius:14px; border:none; background:var(--brand); color:#fff;
  font-weight:800; font-size:16px; width:100%; }
.btn.sec{background:var(--card); color:var(--text); border:1px solid var(--line)}
.btn.danger{background:var(--danger)}
.filled{outline:2px solid var(--st-dang); outline-offset:-2px}

/* ===== Nút nổi + thanh dưới ===== */
.fab{position:fixed; right:16px; bottom:calc(var(--tabbar-h) + var(--safe-b) + 14px); z-index:30;
  width:58px; height:58px; border-radius:50%; border:none; background:var(--brand); color:#fff;
  font-size:30px; box-shadow:0 6px 18px rgba(15,118,110,.45); }
.tabbar{position:fixed; left:0; right:0; bottom:0; z-index:25; display:flex; background:var(--card);
  border-top:1px solid var(--line); height:calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom:var(--safe-b); }
.tab{flex:1; border:none; background:none; color:var(--muted); display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:2px; font-size:11px; min-height:44px}
.tab span{font-size:22px; line-height:1}
.tab.active{color:var(--brand); font-weight:800}

/* ===== Toast + modal ===== */
.toast{position:fixed; left:50%; transform:translateX(-50%); bottom:calc(var(--tabbar-h) + 80px);
  background:#111827; color:#fff; padding:12px 18px; border-radius:12px; z-index:50; font-weight:600;
  max-width:90%; text-align:center; box-shadow:0 8px 24px rgba(0,0,0,.3)}
.sheet-bg{position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:40; display:flex; align-items:flex-end}
@media(min-width:720px){ .sheet-bg{align-items:center; justify-content:center} }
.sheet{background:var(--card); width:100%; max-width:560px; max-height:88vh; overflow:auto;
  border-radius:18px 18px 0 0; padding:18px 16px calc(18px + var(--safe-b))}
@media(min-width:720px){ .sheet{border-radius:18px} }
.sheet h2{margin:0 0 10px; font-size:18px}
.msgbox{white-space:pre-wrap; background:var(--bg); border:1px solid var(--line); border-radius:12px;
  padding:12px; font-size:14px; max-height:40vh; overflow:auto}
.pick{display:flex; align-items:center; gap:10px; padding:10px; border:1px solid var(--line);
  border-radius:12px; margin-bottom:8px; background:var(--card)}
.pick input{width:22px; height:22px}
.pill-ban{color:var(--ban)} .pill-thue{color:var(--thue)}
