/* EstateView dashboard — Phase 1 design system.
   Light, premium, EstateView native. Brand blue #2563EB used sparingly;
   gold reserved for featured / premium moments. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --ink: #0b0e14;
  --ink-2: #3d4654;
  --muted: #6b7484;
  --line: #e4e7ec;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #e8effe;
  --gold: #b98a2f;
  --gold-soft: #faf3e3;
  --green: #15803d;
  --green-soft: #e7f6ec;
  --amber: #b45309;
  --amber-soft: #fdf3e3;
  --red: #b42318;
  --red-soft: #fdecea;
  --slate: #475569;
  --slate-soft: #eef2f7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(11,14,20,.05), 0 8px 24px -12px rgba(11,14,20,.18);
  --shadow-lg: 0 2px 4px rgba(11,14,20,.06), 0 20px 44px -16px rgba(11,14,20,.25);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.hidden { display: none !important; }
button { font-family: var(--font); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 480px at 15% -5%, #dbe7ff 0%, transparent 60%),
    radial-gradient(700px 420px at 95% 110%, #f3e8c8 0%, transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 28px;
  animation: rise .45s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.brandmark { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.brandmark .cube {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #1e40af);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: 0 6px 14px -6px rgba(37,99,235,.6);
}
.brandmark .word { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.brandmark .word span { color: var(--brand); }
.login-sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.role-pills { display: flex; gap: 8px; margin-bottom: 18px; }
.role-pill {
  flex: 1; padding: 10px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 13.5px; font-weight: 700; color: var(--ink-2);
  cursor: pointer; transition: all .15s;
}
.role-pill.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input {
  width: 100%; padding: 12px 14px; font-size: 15px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
select.input { appearance: none; }
textarea.input { resize: vertical; min-height: 80px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: #fff; border: none; border-radius: 10px;
  padding: 12px 20px; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: transform .12s, box-shadow .12s, background .12s;
  box-shadow: 0 8px 18px -8px rgba(37,99,235,.55);
}
.btn:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface-2); color: var(--ink); box-shadow: none; }
.btn.ghost:hover { background: #e2e6ec; }
.btn.gold { background: var(--gold); box-shadow: 0 8px 18px -8px rgba(185,138,47,.55); }
.btn.gold:hover { background: #a37c28; }
.btn.danger-ghost { background: var(--red-soft); color: var(--red); box-shadow: none; }
.btn.sm { padding: 8px 14px; font-size: 13.5px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.login-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 16px; font-size: 13.5px; }
.login-row a, .login-alt a { color: var(--brand); font-weight: 600; text-decoration: none; cursor: pointer; }
.login-row a:hover, .login-alt a:hover { text-decoration: underline; }
.remember { display: flex; align-items: center; gap: 7px; color: var(--ink-2); cursor: pointer; }
.login-alt { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--muted); }
.err {
  display: none; background: var(--red-soft); color: var(--red);
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px; font-weight: 600; margin-bottom: 14px;
}
.err.show { display: block; }
.okmsg {
  display: none; background: var(--green-soft); color: var(--green);
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px; font-weight: 600; margin-bottom: 14px;
}
.okmsg.show { display: block; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 20px 14px;
}
.sidebar .brandmark { padding: 0 8px 18px; margin: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--muted); padding: 14px 12px 6px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; border: none; background: none;
  font-size: 14.5px; font-weight: 600; color: var(--ink-2); cursor: pointer;
  text-align: left; transition: background .12s;
  width: 100%;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); }
.nav-item .ico { width: 20px; text-align: center; font-size: 16px; }
.nav-item .soon {
  margin-left: auto; font-size: 10px; font-weight: 700; color: var(--gold);
  background: var(--gold-soft); padding: 2px 7px; border-radius: 20px;
}
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; }
.user-chip .avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), #1e40af);
  color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.user-chip .who { font-size: 13px; font-weight: 700; line-height: 1.25; }
.user-chip .who small { display: block; font-weight: 500; color: var(--muted); }
.signout { margin-top: 6px; width: 100%; }

.main { flex: 1; min-width: 0; padding: 28px 32px 96px; max-width: 1200px; }
.page-head { margin-bottom: 22px; animation: rise .35s ease both; }
.page-head h1 { font-size: 27px; margin: 0 0 4px; letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--muted); font-size: 14.5px; }
.page-head .actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }

/* Metric cards */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.metric {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
  animation: rise .4s ease both;
}
.metric:nth-child(2) { animation-delay: .06s; }
.metric:nth-child(3) { animation-delay: .12s; }
.metric:nth-child(4) { animation-delay: .18s; }
.metric .m-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.metric .m-value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 2px; }
.metric .m-note { font-size: 12.5px; color: var(--muted); }
.metric .m-note .live { color: var(--green); font-weight: 700; }
.phase-tag {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .05em;
  color: var(--gold); background: var(--gold-soft); border-radius: 20px; padding: 2px 8px;
  margin-left: 6px; vertical-align: middle;
}

/* Cards & tables */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
  animation: rise .35s ease both;
}
.card h3 { margin: 0 0 4px; font-size: 17px; }
.card .sub { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th {
  text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
table.grid td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tr:hover td { background: #fafbfc; }
.prop-cell { display: flex; align-items: center; gap: 12px; }
.prop-thumb {
  width: 52px; height: 40px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
  background: var(--surface-2);
}
.prop-cell .addr { font-weight: 700; }
.prop-cell .meta { font-size: 12.5px; color: var(--muted); }
.pill {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 20px;
  white-space: nowrap;
}
.pill.active { background: var(--green-soft); color: var(--green); }
.pill.pending { background: var(--amber-soft); color: var(--amber); }
.pill.sold { background: var(--slate-soft); color: var(--slate); }
.pill.draft { background: var(--surface-2); color: var(--muted); }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.link-btn {
  background: none; border: none; color: var(--brand); font-weight: 700; font-size: 13px;
  cursor: pointer; padding: 6px 4px;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--red); }

/* Filter chips */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 700; padding: 8px 14px; border-radius: 20px; cursor: pointer;
  transition: all .12s;
}
.chip.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.search { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.search .input { padding-left: 36px; }
.search .s-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* Listing cards (realtor view / mobile) */
.lcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.lcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
  animation: rise .35s ease both;
}
.lcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.lcard .ph { height: 150px; background: var(--surface-2); position: relative; overflow: hidden; }
.lcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.lcard .ph .pill { position: absolute; top: 10px; left: 10px; }
.lcard .ph .feat {
  position: absolute; top: 10px; right: 10px; background: var(--gold); color: #fff;
  font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 20px;
}
.lcard .body { padding: 14px 16px 16px; }
.lcard .price { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.lcard .addr { font-size: 13.5px; color: var(--ink-2); margin: 2px 0 8px; }
.lcard .specs { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.lcard .stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.lcard .stats b { color: var(--ink); }
.lcard .ops { display: flex; gap: 8px; }

/* Empty states */
.empty {
  text-align: center; padding: 56px 24px; color: var(--muted);
  background: var(--surface); border: 1.5px dashed var(--line); border-radius: var(--radius);
}
.empty .e-ico { font-size: 40px; margin-bottom: 12px; }
.empty h3 { color: var(--ink); margin: 0 0 6px; font-size: 17px; }
.empty p { margin: 0 auto 16px; max-width: 420px; font-size: 14px; line-height: 1.55; }

/* Modals */
.modal-bk {
  position: fixed; inset: 0; background: rgba(11,14,20,.5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 60;
  animation: fade .18s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; padding: 26px;
  animation: rise .25s ease both;
}
.modal.wide { max-width: 720px; }
.modal h3 { margin: 0 0 4px; font-size: 19px; }
.modal .hint { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; line-height: 1.5; }
.modal .mrow { display: flex; gap: 10px; margin-top: 18px; }
.modal .mrow .btn { flex: 1; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.warn-box {
  background: var(--amber-soft); border: 1px solid #f0dfba; color: #7c4a03;
  border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.55; margin-bottom: 14px;
}
.warn-box b { color: #7c4a03; }

/* Wizard */
.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.step { flex: 1; text-align: center; }
.step .dot {
  height: 6px; border-radius: 4px; background: var(--line); margin-bottom: 6px; transition: background .2s;
}
.step.done .dot, .step.now .dot { background: var(--brand); }
.step .sl { font-size: 11px; font-weight: 700; color: var(--muted); }
.step.now .sl { color: var(--brand-dark); }

/* Map */
.map-frame { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #0b0e14; position: relative; }
.map-frame iframe { width: 100%; height: calc(100vh - 300px); min-height: 480px; border: none; display: block; }
.map-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: #0b0e14; color: #cbd5e1; z-index: 2;
}
.map-loading p { font-size: 14px; margin: 0; }
.spin {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.18); border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; z-index: 100;
  transition: all .25s; box-shadow: var(--shadow-lg); max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* Bottom nav (mobile) */
.bottomnav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
}
.bottomnav .bn-row { display: flex; }
.bn-item {
  flex: 1; border: none; background: none; display: flex; flex-direction: column;
  align-items: center; gap: 3px; padding: 8px 4px; font-size: 10.5px; font-weight: 700;
  color: var(--muted); cursor: pointer;
}
.bn-item .ico { font-size: 20px; }
.bn-item.active { color: var(--brand-dark); }

/* Marketing prototype grid */
.mkt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.mkt {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; text-align: center; box-shadow: var(--shadow);
}
.mkt .m-ico { font-size: 32px; margin-bottom: 10px; }
.mkt h4 { margin: 0 0 4px; font-size: 15px; }
.mkt p { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .bottomnav { display: block; }
  .main { padding: 20px 16px 110px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .page-head h1 { font-size: 23px; }
  table.grid thead { display: none; }
  table.grid, table.grid tbody, table.grid tr, table.grid td { display: block; width: 100%; }
  table.grid tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: #fff; }
  table.grid td { border: none; padding: 8px 14px; }
  table.grid td:first-child { padding-top: 14px; }
  table.grid td:last-child { padding-bottom: 14px; }
  .f2 { grid-template-columns: 1fr; }
  .map-frame iframe { height: calc(100vh - 340px); min-height: 380px; }
}

/* ---------- 3D Listing Studio: hotspot editor (Phase 3, Part 1) ---------- */
.hs-row { display:flex; justify-content:space-between; gap:10px; border:1px solid var(--line);
  border-radius:10px; padding:10px 12px; margin-bottom:8px; }
.hs-row .hs-body { font-size:12.5px; color:var(--muted); margin-top:2px; line-height:1.5; }
.hs-ops { display:flex; gap:6px; align-items:flex-start; white-space:nowrap; }

/* Marketing Center (Phase 3, Part 2) */
.pill.danger { background: #fdecec; color: var(--red); }
.mkt-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.mchk { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.mchk input { margin-top: 3px; accent-color: var(--brand); }
.mchk b { display: block; font-size: 14px; }
.mchk i { display: block; font-style: normal; font-size: 12px; color: var(--muted); }
.mkt-caption { background: var(--surface-2); border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; margin: 12px 0; display: flex; gap: 12px; align-items: flex-start; }
.mkt-caption p { margin: 0; flex: 1; font-size: 14.5px; line-height: 1.55; }
.mkt-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.mkt-prev { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.mkt-prev img, .mkt-prev video { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; background: #0b0e14; }
.mkt-prev > div { padding: 8px 10px 2px; font-size: 13px; }
.mkt-prev .link-btn { margin: 0 10px 10px; }
.hint { color: var(--muted); font-size: 13px; }
.mrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
