/* ============================================================
   BEST INVEST — Real Estate & Builders premium design system
   Palette: deep black-navy base, rich gold accents, soft slate surfaces
   ============================================================ */
:root {
    --navy-900: #070b16;
    --navy-800: #0a0f1e;
    --navy-700: #16233c;
    --gold-500: #d4a853;
    --gold-400: #e3c37a;
    --primary: #0a0f1e;
    --primary-600: #060b16;
    --primary-soft: #eef0f5;
    --bg: #f4f6fa;
    --surface: #ffffff;
    --line: #e5e9f2;
    --text: #1c2434;
    --muted: #64748b;
    --green: #16a34a;   --green-soft: #e8f7ee;
    --red: #dc2626;     --red-soft: #fdecec;
    --amber: #d97706;   --amber-soft: #fdf3e3;
    --blue: #2563eb;    --blue-soft: #e8effd;
    --purple: #7c3aed;  --purple-soft: #f1ebfd;
    --teal: #0d9488;    --teal-soft: #e2f6f3;
    --pink: #db2777;    --pink-soft: #fdeaF4;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
    --shadow-lg: 0 8px 32px rgba(16, 24, 40, .14);
    font-size: 15px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg); color: var(--text);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }
.ic { vertical-align: -3px; flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
code { background: #eef2f8; padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

/* ============================================================ App shell */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 24px 28px 40px; max-width: 1500px; width: 100%; margin: 0 auto; }
.app-foot { padding: 14px 28px; color: #9aa5b8; font-size: 12px; border-top: 1px solid var(--line); background: var(--surface); }

/* ============================================================ Sidebar */
.sidebar {
    width: 250px; flex-shrink: 0; background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 100%);
    color: #c6d0e0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden;
    z-index: 50;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.07); min-width: 0; overflow: hidden; }
.brand-mark { font-size: 24px; background: linear-gradient(135deg, var(--gold-500), #b07d1a); border-radius: 10px; padding: 6px 8px; line-height: 1; }
/* Brand logo is a wide lockup on a white field: render as a contained white chip that can never overflow the 250px sidebar. */
.brand-logo { height: 40px; width: auto; max-width: 118px; object-fit: contain; display: block; flex: 0 0 auto; background: #fff; border-radius: 9px; padding: 4px 7px; box-shadow: 0 0 0 1px rgba(212,168,83,.28); }
.brand-text { font-weight: 800; font-size: 16px; color: #fff; letter-spacing: .3px; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text small { font-weight: 500; font-size: 10.5px; color: #8fa0ba; letter-spacing: 1.5px; text-transform: uppercase; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 12px 20px; scrollbar-width: thin; scrollbar-color: #2a3a58 transparent; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #2a3a58; border-radius: 4px; }
.nav-group { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.6px; color: #64769a; margin: 16px 8px 6px; }
.nav-link {
    display: flex; align-items: center; gap: 10px; padding: 8.5px 10px; border-radius: 9px;
    color: #b9c4d6; font-size: 13.5px; font-weight: 500; margin-bottom: 1px; transition: all .15s;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: linear-gradient(90deg, rgba(212,164,55,.16), rgba(212,164,55,.05)); color: var(--gold-400); font-weight: 700; box-shadow: inset 3px 0 0 var(--gold-500); }
.nav-ic { display: inline-flex; opacity: .85; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.07); }
.demo-pill {
    display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 1.5px; color: var(--navy-900);
    background: linear-gradient(135deg, var(--gold-500), var(--gold-400)); padding: 4px 10px; border-radius: 20px; margin-bottom: 8px;
}
.brand-pill {
    display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 1.5px; color: var(--navy-900);
    background: linear-gradient(135deg, var(--gold-500), var(--gold-400)); padding: 4px 12px; border-radius: 20px; margin-bottom: 8px;
    box-shadow: 0 2px 10px rgba(212, 168, 83, .35);
}
.sidebar-backdrop { display: none; }

/* ============================================================ Topbar */
.topbar {
    display: flex; align-items: center; gap: 16px; padding: 12px 28px; background: var(--surface);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40;
}
.topbar-title h1 { font-size: 19px; font-weight: 800; letter-spacing: -.2px; }
.crumb { font-size: 11.5px; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-search { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; color: var(--muted); }
.topbar-search input { border: 0; background: transparent; outline: 0; font-family: inherit; font-size: 13.5px; width: 170px; color: var(--text); }
.icon-btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
    color: #475569; cursor: pointer; transition: all .15s;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.badge-dot {
    position: absolute; top: -5px; right: -5px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 20px; padding: 1.5px 5.5px; border: 2px solid var(--surface);
}
.user-chip { display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 5px 12px 5px 6px; cursor: pointer; font-family: inherit; }
.user-chip:hover { border-color: #cdd6e4; }
.user-meta { text-align: left; display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 13px; }
.user-meta small { font-size: 11px; color: var(--muted); }

/* dropdowns */
.dropdown { position: relative; }
.dropdown-panel {
    display: none; position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface);
    border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 240px; z-index: 60; overflow: hidden;
}
.dropdown.open .dropdown-panel { display: block; }
.dp-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--line); }
.dp-head a { font-weight: 500; font-size: 12px; }
.dp-empty { padding: 20px 14px; color: var(--muted); font-size: 13px; text-align: center; }
.dp-link { display: flex; gap: 9px; align-items: center; padding: 10px 14px; font-size: 13.5px; color: var(--text); }
.dp-link:hover { background: var(--bg); }
.notif-panel { width: 330px; max-height: 420px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid #f0f3f9; color: var(--text); }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: #f7faff; }
.notif-ic { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ni-hot_lead { background: var(--red-soft); color: var(--red); }
.ni-followup { background: var(--amber-soft); color: var(--amber); }
.ni-call { background: var(--blue-soft); color: var(--blue); }
.ni-visit { background: var(--teal-soft); color: var(--teal); }
.ni-message { background: var(--green-soft); color: var(--green); }
.ni-deal { background: var(--purple-soft); color: var(--purple); }
.ni-warning { background: var(--amber-soft); color: var(--amber); }
.ni-info { background: var(--primary-soft); color: var(--primary); }
.notif-body { display: flex; flex-direction: column; line-height: 1.35; font-size: 13px; }
.notif-body small { color: var(--muted); font-size: 11.5px; }

/* ============================================================ Cards & stats */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 10px; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-body { padding: 18px 20px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 18px; }
/* minmax(0,1fr) tracks let children shrink below their min-content width,
   preventing the 1fr=minmax(auto,1fr) overflow (e.g. settings_meta at 905px). */
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.field input, .field select { min-width: 150px; }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow); transition: transform .15s; }
.stat-card:hover { transform: translateY(-2px); }
.stat-ic { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.si-blue { background: var(--blue-soft); color: var(--blue); }
.si-green { background: var(--green-soft); color: var(--green); }
.si-amber { background: var(--amber-soft); color: var(--amber); }
.si-red { background: var(--red-soft); color: var(--red); }
.si-purple { background: var(--purple-soft); color: var(--purple); }
.si-teal { background: var(--teal-soft); color: var(--teal); }
.si-gold { background: #fbf3df; color: #a37b18; }
.stat-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.stat-meta strong { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.stat-meta small { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* ============================================================ Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 7px; border-radius: 10px; border: 1px solid transparent;
    padding: 8.5px 16px; font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-gold { background: linear-gradient(135deg, var(--gold-500), #c3922a); color: #fff; }
.btn-gold:hover { filter: brightness(1.06); }
.btn-outline { background: var(--surface); border-color: var(--line); color: #334155; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { filter: brightness(1.08); }
.btn-red { background: var(--red-soft); color: var(--red); border-color: #f5caca; }
.btn-red:hover { background: #fbdcdc; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg); }
.btn-sm { padding: 5.5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============================================================ Badges & avatars */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3.5px 9px; border-radius: 20px; letter-spacing: .3px; white-space: nowrap; }
.badge-hot { background: var(--red-soft); color: var(--red); }
.badge-warm { background: var(--amber-soft); color: var(--amber); }
.badge-cold { background: var(--blue-soft); color: var(--blue); }
.badge-new { background: var(--blue-soft); color: var(--blue); }
.badge-contacted { background: #eef2f8; color: #475569; }
.badge-interested { background: var(--teal-soft); color: var(--teal); }
.badge-qualified { background: var(--purple-soft); color: var(--purple); }
.badge-shared { background: #fbf3df; color: #a37b18; }
.badge-visit { background: var(--teal-soft); color: var(--teal); }
.badge-negotiation { background: var(--amber-soft); color: var(--amber); }
.badge-won { background: var(--green-soft); color: var(--green); }
.badge-lost { background: var(--red-soft); color: var(--red); }
.badge-soldp { background: #eceff4; color: #64748b; }
.badge-muted { background: #eef2f8; color: #64748b; }
.badge-lg { font-size: 12.5px; padding: 6px 14px; }
.avatar {
    display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%;
    font-size: 12.5px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 10.5px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.av-blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.av-green { background: linear-gradient(135deg, #22c55e, #15803d); }
.av-purple { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.av-orange { background: linear-gradient(135deg, #f97316, #c2410c); }
.av-teal { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.av-pink { background: linear-gradient(135deg, #ec4899, #be185d); }

/* ============================================================ Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; padding: 11px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); background: #f8fafd; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid #f0f3f9; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #f8fafd; }
.table .cell-main { font-weight: 600; }
.table .cell-sub { font-size: 12px; color: var(--muted); }
.pagination { display: flex; gap: 6px; padding: 14px 16px; justify-content: flex-end; }
.pg-btn { min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--line); color: #475569; font-size: 13px; font-weight: 600; padding: 0 8px; }
.pg-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pg-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.empty-state { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty-state .es-ic { font-size: 34px; margin-bottom: 8px; }

/* ============================================================ Forms */
label { display: block; font-size: 12.5px; font-weight: 600; color: #475569; margin: 12px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=tel], input[type=search], input[type=url], input:not([type]),
select, textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-family: inherit;
    font-size: 13.5px; color: var(--text); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:not([type=hidden]):focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 107, 219, .12); }
textarea { resize: vertical; min-height: 80px; }
/* Hidden inputs must never show borders/padding */
input[type=hidden] { display: none; }
/* Checkbox / radio inside fields: natural sizing */
input[type=checkbox], input[type=radio] { width: auto; min-width: 0; padding: 0; border: 0; accent-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span-2 { grid-column: span 2; }
/* Normalize label margins inside form-grid (bare-sibling pattern) */
.form-grid > label { margin: 10px 0 3px; align-self: end; }
.form-grid > input, .form-grid > select, .form-grid > textarea { align-self: center; }
.form-grid > .span-2 > label { margin: 10px 0 3px; }
/* .form-row: robust field wrapper — works for both wrapped and bare patterns */
.form-row { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.form-row > label { margin: 8px 0 0; }
.form-row > label:first-child { margin-top: 0; }
.form-error { background: var(--red-soft); color: var(--red); border: 1px solid #f5caca; padding: 10px 14px; border-radius: 10px; font-size: 13px; margin: 10px 0; }
.form-ok { background: var(--green-soft); color: var(--green); border: 1px solid #bfe8cd; padding: 10px 14px; border-radius: 10px; font-size: 13px; margin: 10px 0; }
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-bar select, .filter-bar input { width: auto; min-width: 130px; }
.search-input { position: relative; }
.search-input .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input input { padding-left: 34px; }

/* ============================================================ Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 16, 30, .55); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 100; backdrop-filter: blur(2px); }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; animation: pop .18s ease; }
.modal-lg { max-width: 760px; }
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15.5px; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal-x { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }

/* ============================================================ Toasts */
#toasts { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    display: flex; align-items: center; gap: 9px; background: var(--navy-900); color: #fff; padding: 12px 16px;
    border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: slideIn .25s ease; max-width: 380px;
}
.toast-success .ic { color: #4ade80; }
.toast-error .ic { color: #f87171; }
.toast-info .ic { color: #93c5fd; }
.toast-x { background: none; border: 0; color: #94a3b8; font-size: 17px; cursor: pointer; margin-left: 4px; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============================================================ Kanban */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.kanban-col { min-width: 255px; width: 255px; background: #edf0f6; border-radius: 14px; flex-shrink: 0; }
.kanban-head { display: flex; justify-content: space-between; align-items: center; padding: 11px 13px; font-size: 11.5px; font-weight: 800; letter-spacing: 1px; color: #475569; }
.kanban-count { background: var(--surface); border-radius: 20px; padding: 2px 9px; font-size: 11px; color: var(--muted); }
.kanban-body { padding: 2px 10px 12px; min-height: 80px; display: flex; flex-direction: column; gap: 9px; }
.kanban-col.drag-over .kanban-body { outline: 2px dashed var(--primary); outline-offset: -4px; border-radius: 12px; background: rgba(47, 107, 219, .05); }
.kcard { background: var(--surface); border-radius: 12px; padding: 12px; box-shadow: var(--shadow); cursor: grab; border: 1px solid transparent; transition: border-color .15s, transform .15s; }
.kcard:hover { border-color: #cfdaf0; transform: translateY(-1px); }
.kcard.dragging { opacity: .45; }
.kcard-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 7px; }
.kcard-name { font-weight: 700; font-size: 13.5px; }
.kcard-budget { font-size: 13px; font-weight: 800; color: var(--primary); margin: 3px 0; }
.kcard-meta { font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.kcard-meta span { display: flex; align-items: center; gap: 5px; }
.kcard-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line); }
.kcard-foot small { font-size: 10.5px; color: var(--muted); }

/* ============================================================ Timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -26px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); display: flex; align-items: center; justify-content: center; }
.tl-dot .ic { width: 9px; height: 9px; color: var(--primary); }
.tl-dot.tl-green { border-color: var(--green); } .tl-dot.tl-green .ic { color: var(--green); }
.tl-dot.tl-amber { border-color: var(--amber); } .tl-dot.tl-amber .ic { color: var(--amber); }
.tl-dot.tl-red { border-color: var(--red); } .tl-dot.tl-red .ic { color: var(--red); }
.tl-title { font-weight: 700; font-size: 13.5px; }
.tl-desc { font-size: 13px; color: #475569; margin-top: 2px; }
.tl-when { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ============================================================ Property visuals */
.prop-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.prop-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column; }
.prop-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.prop-img { height: 150px; position: relative; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.9); }
.prop-img .ic { width: 42px; height: 42px; opacity: .85; }
.prop-status { position: absolute; top: 10px; left: 10px; }
.prop-price { position: absolute; bottom: 10px; right: 10px; background: rgba(11, 18, 32, .82); color: #fff; font-weight: 800; font-size: 13px; padding: 4px 10px; border-radius: 8px; backdrop-filter: blur(4px); }
.prop-body { padding: 13px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.prop-title { font-weight: 700; font-size: 14px; }
.prop-loc { font-size: 12.5px; color: var(--muted); display: flex; gap: 5px; align-items: center; }
.prop-feats { display: flex; gap: 12px; font-size: 12px; color: #475569; border-top: 1px dashed var(--line); padding-top: 9px; margin-top: auto; }
.prop-feats span { display: inline-flex; gap: 4px; align-items: center; }
/* gradient "photos" */
.theme-house1 { background: linear-gradient(135deg, #1e3a5f, #3f6ea5); }
.theme-house2 { background: linear-gradient(135deg, #2d4a2b, #6da06a); }
.theme-house3 { background: linear-gradient(135deg, #4a2d5e, #8b6bb0); }
.theme-apt1 { background: linear-gradient(135deg, #0f4c5c, #4a9eb5); }
.theme-apt2 { background: linear-gradient(135deg, #5c3a0f, #b58b4a); }
.theme-plot1 { background: linear-gradient(135deg, #6b705c, #a5a58d); }
.theme-plot2 { background: linear-gradient(135deg, #3a5a40, #7f9f7f); }
.theme-shop1 { background: linear-gradient(135deg, #7d2e2e, #c06c6c); }
.theme-shop2 { background: linear-gradient(135deg, #8338ec, #b18ae8); }
.theme-office1 { background: linear-gradient(135deg, #14213d, #4f6d99); }
.theme-office2 { background: linear-gradient(135deg, #264653, #5aa9a2); }
.theme-bldg1 { background: linear-gradient(135deg, #3d2645, #83538f); }
.theme-land1 { background: linear-gradient(135deg, #606c38, #a3b18a); }
.match-pct { position: absolute; top: 10px; right: 10px; background: var(--green); color: #fff; font-weight: 800; font-size: 12.5px; padding: 4px 10px; border-radius: 8px; }

/* ============================================================ WhatsApp UI */
.wa-wrap { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 190px); min-height: 480px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.wa-list { border-right: 1px solid var(--line); overflow-y: auto; }
.wa-list-head { padding: 14px 16px; font-weight: 800; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.wa-item { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid #f1f4f9; cursor: pointer; }
.wa-item:hover, .wa-item.active { background: #f6f9ff; }
.wa-item.active { box-shadow: inset 3px 0 0 var(--green); }
.wa-item-body { min-width: 0; flex: 1; }
.wa-item-body strong { font-size: 13.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-item-body small { font-size: 12px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-unread { background: var(--green); color: #fff; border-radius: 20px; font-size: 10.5px; font-weight: 800; padding: 2px 7px; align-self: center; }
.wa-chat { display: flex; flex-direction: column; background: #efeae2; }
.wa-chat-head { display: flex; align-items: center; gap: 11px; padding: 11px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.wa-msgs { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 9px; }
.wa-msg { max-width: 68%; padding: 9px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; box-shadow: 0 1px 1px rgba(0,0,0,.06); position: relative; }
.wa-msg time { display: block; font-size: 10px; color: #8696a0; text-align: right; margin-top: 4px; }
.wa-in { background: #fff; align-self: flex-start; border-top-left-radius: 3px; }
.wa-out { background: #d9fdd3; align-self: flex-end; border-top-right-radius: 3px; }
.wa-msg.wa-prop { background: #fff; border: 1px solid var(--line); }
.wa-prop-thumb { width: 200px; height: 90px; border-radius: 8px; margin-bottom: 7px; display: flex; align-items: center; justify-content: center; color: #fff; }
.wa-input { display: flex; gap: 9px; padding: 12px 14px; background: var(--surface); border-top: 1px solid var(--line); }
.wa-input input { flex: 1; }
.wa-demo-tag { font-size: 10px; font-weight: 800; letter-spacing: 1px; color: var(--green); background: var(--green-soft); padding: 3px 9px; border-radius: 20px; }

/* ============================================================ Tracking map */
.track-wrap { display: grid; grid-template-columns: 1fr 340px; gap: 18px; }
.track-map {
    position: relative; border-radius: var(--radius); min-height: 480px; overflow: hidden; border: 1px solid var(--line);
    background:
        linear-gradient(rgba(47, 107, 219, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(47, 107, 219, .045) 1px, transparent 1px),
        radial-gradient(circle at 30% 30%, #eef4ee 0%, #e9eef5 55%, #e4e9f2 100%);
    background-size: 34px 34px, 34px 34px, 100% 100%;
}
.track-map::after { content: 'Simulated GPS map - Demo Mode'; position: absolute; bottom: 12px; right: 14px; font-size: 11px; color: #8b98ad; background: rgba(255,255,255,.85); padding: 4px 10px; border-radius: 8px; }
.map-road { position: absolute; background: rgba(148, 163, 184, .35); border-radius: 6px; }
.map-pin {
    position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center;
    cursor: pointer; transition: transform .15s; z-index: 2;
}
.map-pin:hover { transform: translate(-50%, -104%) scale(1.06); z-index: 5; }
.map-pin .pin-av { border: 3px solid #fff; box-shadow: var(--shadow-lg); }
.map-pin .pin-name { background: var(--navy-900); color: #fff; font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 7px; margin-top: 5px; white-space: nowrap; box-shadow: var(--shadow); }
.pin-status { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; position: absolute; right: -1px; bottom: 12px; }
.st-online { background: var(--green); }
.st-offline { background: #94a3b8; }
.st-onsite { background: var(--amber); }
.st-office { background: var(--blue); }
.st-away { background: var(--purple); }
.route-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.route-item:last-child { border-bottom: 0; }
.route-time { font-weight: 800; color: var(--primary); width: 52px; flex-shrink: 0; }

/* ============================================================ Score & charts */
.score-ring { width: 130px; height: 130px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto; position: relative; }
.score-ring::before { content: ''; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); }
.score-ring strong { position: relative; font-size: 30px; font-weight: 800; }
.score-ring small { position: relative; display: block; font-size: 10px; color: var(--muted); text-align: center; }
.bar-row { margin-bottom: 13px; }
.bar-label { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.bar-label strong { font-weight: 700; }
.bar-track { height: 8px; background: #edf0f6; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--primary), #6ea0f0); transition: width .6s ease; }
.bar-fill.gold { background: linear-gradient(90deg, var(--gold-500), var(--gold-400)); }
.bar-fill.green { background: linear-gradient(90deg, #16a34a, #4ade80); }
.chart-box { position: relative; height: 260px; }
.chart-box-sm { position: relative; height: 210px; }

/* ============================================================ Login & install */
.login-body { background: linear-gradient(135deg, var(--navy-900), var(--navy-700)); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-wrap { display: grid; grid-template-columns: 1fr 420px; max-width: 980px; width: 100%; background: var(--surface); border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.login-brand { background: linear-gradient(160deg, var(--navy-900), #1b2c4d 70%, #2c4370); color: #dbe4f2; padding: 44px 38px; display: flex; flex-direction: column; }
.login-brand-logo { margin-bottom: 16px; }
.login-logo-img { height: 74px; width: auto; max-width: 100%; object-fit: contain; display: block; background: #fff; border-radius: 12px; padding: 8px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.login-brand h1 { color: #fff; font-size: 26px; margin-bottom: 10px; }
.login-brand p { font-size: 14px; line-height: 1.6; color: #aebbd3; }
.login-feats { list-style: none; margin-top: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.login-feats li { color: #cdd8ea; }
.login-demotag { margin-top: auto; padding-top: 26px; font-size: 10.5px; letter-spacing: 2px; font-weight: 800; color: var(--gold-400); }
.login-panel { padding: 40px 36px; }
.login-panel h2 { font-size: 22px; margin-bottom: 4px; }
.login-panel form { margin-top: 8px; }
.login-panel .btn { margin-top: 20px; }
.login-accounts { margin-top: 22px; border-top: 1px dashed var(--line); padding-top: 16px; }
.login-accounts-title { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-acct {
    border: 1px solid var(--line); border-radius: 10px; background: #fafbfe; padding: 9px 10px; font-family: inherit;
    font-size: 12.5px; font-weight: 700; cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; transition: all .15s;
}
.demo-acct small { font-weight: 500; color: var(--muted); font-size: 11px; }
.demo-acct:hover { border-color: var(--primary); background: var(--primary-soft); }
.install-body { background: linear-gradient(135deg, var(--navy-900), var(--navy-700)); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.install-card { background: var(--surface); border-radius: 20px; padding: 40px 44px; max-width: 560px; width: 100%; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.install-logo { display: flex; align-items: center; gap: 12px; font-size: 22px; margin-bottom: 14px; }
.install-logo-img { height: 64px; width: auto; max-width: 100%; object-fit: contain; display: block; flex: 0 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.install-card h1 { font-size: 22px; margin-bottom: 14px; }
.install-ok { background: var(--green-soft); color: var(--green); padding: 14px 16px; border-radius: 12px; font-size: 14px; margin-bottom: 8px; }
.install-err { background: var(--red-soft); color: var(--red); padding: 12px 16px; border-radius: 12px; font-size: 13px; margin-bottom: 10px; word-break: break-word; }

/* ============================================================ Misc components */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 17px; font-weight: 800; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 18px; font-size: 13.5px; font-weight: 600; color: var(--muted); border-bottom: 2.5px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.info-row:last-child { border-bottom: 0; }
.info-row .lbl { color: var(--muted); }
.info-row .val { font-weight: 600; text-align: right; }
.progress-mini { width: 90px; height: 6px; background: #edf0f6; border-radius: 5px; overflow: hidden; display: inline-block; vertical-align: middle; }
.progress-mini i { display: block; height: 100%; background: var(--primary); border-radius: 5px; }
.attention-item { display: flex; gap: 11px; align-items: flex-start; padding: 11px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.attention-item:last-child { border-bottom: 0; }
.attention-item .ic { margin-top: 1px; }
.ai-bubble { background: linear-gradient(135deg, #eef3ff, #f6f9ff); border: 1px solid #dde7fb; border-radius: 14px; padding: 14px 16px; font-size: 13.5px; line-height: 1.55; }
.chat-box { display: flex; flex-direction: column; gap: 12px; max-height: 460px; overflow-y: auto; padding: 4px; }
.chat-msg { display: flex; gap: 10px; }
.chat-msg .cm-body { background: var(--bg); border: 1px solid var(--line); padding: 11px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; max-width: 85%; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-msg.user .cm-body { background: var(--primary); color: #fff; border-color: var(--primary); }
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl { position: absolute; inset: 0; background: #cbd5e1; border-radius: 20px; transition: .2s; cursor: pointer; }
.switch .sl::before { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; left: 3px; top: 3px; transition: .2s; }
.switch input:checked + .sl { background: var(--green); }
.switch input:checked + .sl::before { transform: translateX(18px); }
.divider { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.kbd { font-size: 11px; background: #eef2f8; border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; color: #475569; }
.wf-node { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); display: flex; align-items: center; gap: 10px; font-size: 13px; }
.wf-node.when { border-left: 4px solid var(--blue); }
.wf-node.if { border-left: 4px solid var(--amber); }
.wf-node.then { border-left: 4px solid var(--green); }
.wf-arrow { color: var(--muted); font-size: 18px; text-align: center; }

/* ============================================================ Responsive */
@media (max-width: 1250px) {
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
    .grid-5 { grid-template-columns: repeat(3, 1fr); }
    .prop-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1024px) {
    .grid-main, .grid-3, .track-wrap { grid-template-columns: minmax(0, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wa-wrap { grid-template-columns: 260px 1fr; }
}
@media (max-width: 860px) {
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .25s ease; height: 100vh; }
    body.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(10,16,30,.5); z-index: 45; }
    .mobile-menu { display: inline-flex; }
    .topbar { padding: 10px 16px; }
    .topbar-search { display: none; }
    .content { padding: 16px 14px 32px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .prop-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .login-wrap { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: span 1; }
    .user-meta { display: none; }
}
@media (max-width: 560px) {
    .prop-grid, .stat-grid, .grid-4, .grid-5 { grid-template-columns: 1fr; }
    .wa-wrap { grid-template-columns: 1fr; height: auto; }
    .wa-list { max-height: 260px; }
    .wa-chat { min-height: 420px; }
    /* Hide data columns on narrow screens but PRESERVE last column (actions) */
    .table th:nth-child(n+5):not(:last-child),
    .table td:nth-child(n+5):not(:last-child) { display: none; }
    /* Compact action buttons on mobile */
    .table td:last-child .btn { padding: 4px 8px; font-size: 11.5px; }
    .table td:last-child .row { gap: 4px; }
}
.mobile-menu { display: none; }
@media (max-width: 860px) { .mobile-menu { display: inline-flex; } }

/* Text utilities */
.text-red { color: #dc2626; }
.text-green { color: #16a34a; }
.text-amber { color: #d97706; }
.match-chip { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: 12px; padding: 3px 10px; border-radius: 20px; background: #eafaf0; color: #16a34a; }
.match-chip.mid { background: #fef7e7; color: #d97706; }
.match-chip.low { background: #eef2f8; color: #64748b; }
.score-ring.sm { width: 74px; height: 74px; }
.wa-wrap { display: grid; grid-template-columns: 320px 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); height: calc(100vh - 220px); min-height: 480px; }
.wa-list { overflow-y: auto; border-right: 1px solid var(--line); }
.wa-item { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #f0f3f9; cursor: pointer; align-items: center; }
.wa-item:hover { background: #f8fafd; }
.wa-item.active { background: #eef3ff; }
.wa-item .wi-name { font-weight: 600; font-size: 13.5px; }
.wa-item .wi-last { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.wa-chat { display: flex; flex-direction: column; background: #f5f7ee; }
.wa-chat-head { padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.wa-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.wa-msg { max-width: 70%; padding: 9px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; background: #fff; border: 1px solid #e6e9df; align-self: flex-start; }
.wa-msg.out { align-self: flex-end; background: #d9fdd3; border-color: #cdeec4; }
.wa-msg .wm-time { display: block; font-size: 10.5px; color: #8a9790; margin-top: 3px; text-align: right; }
.wa-input { display: flex; gap: 8px; padding: 12px 14px; background: var(--surface); border-top: 1px solid var(--line); }
.wa-input input { flex: 1; margin: 0; }
.track-wrap { display: grid; grid-template-columns: 1fr 380px; gap: 18px; }
.map-canvas { position: relative; height: 480px; border-radius: var(--radius); background: linear-gradient(135deg, #dbe7f0, #eef3f8); overflow: hidden; border: 1px solid var(--line); background-image: repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(100,116,139,.12) 40px), repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(100,116,139,.12) 40px); }
.map-pin { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.map-pin .mp-dot { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 8px rgba(11,18,32,.35); }
.map-pin .mp-dot span { transform: rotate(45deg); font-size: 10px; font-weight: 800; }
.map-pin .mp-name { margin-top: 4px; background: rgba(11,18,32,.8); color: #fff; font-size: 10.5px; padding: 2px 8px; border-radius: 8px; white-space: nowrap; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.rank-row:last-child { border-bottom: 0; }
.rank-pos { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; background: #eef2f8; flex-shrink: 0; }
.rank-pos.r1 { background: linear-gradient(135deg, #d4a437, #f0c96a); color: #5b430f; }
.rank-pos.r2 { background: #e2e8f0; color: #475569; }
.rank-pos.r3 { background: #f3d9c3; color: #8a4b1b; }
.cat-bar { display: flex; align-items: center; gap: 10px; font-size: 12.5px; margin-bottom: 8px; }
.cat-bar .cb-lbl { width: 130px; color: var(--muted); }
.cat-bar .cb-track { flex: 1; height: 8px; background: #edf0f6; border-radius: 6px; overflow: hidden; }
.cat-bar .cb-track i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--primary), #4f80e0); }
.cat-bar .cb-val { width: 34px; font-weight: 700; text-align: right; }

/* ============================================================ Phase 2 · Projects */
.proj-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.proj-card {
    position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
    transition: transform .18s cubic-bezier(.2,.7,.3,1), box-shadow .18s, border-color .18s;
}
.proj-card:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(7,11,22,.16); border-color: #d8dfea; }
@keyframes riseIn { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }
.proj-grid .proj-card { animation: riseIn .45s cubic-bezier(.2,.7,.3,1) both; }
@media (prefers-reduced-motion: reduce) {
    .proj-grid .proj-card, .inv-cell { animation: none; }
    .proj-card, .inv-cell, .proj-card:hover, .inv-cell:hover { transition: none; transform: none; }
}
.proj-cover {
    position: relative; height: 132px; display: flex; align-items: flex-end; padding: 12px 14px;
    background: linear-gradient(135deg, var(--navy-900) 0%, #16233c 55%, #2b3f66 100%);
    background-size: cover; background-position: center; overflow: hidden;
}
/* blueprint drafting grid over every cover */
.proj-cover::before {
    content: ''; position: absolute; inset: 0; opacity: .5;
    background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px);
    background-size: 22px 22px;
}
.proj-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7,11,22,0) 30%, rgba(7,11,22,.72) 100%); }
.proj-cover > * { position: relative; z-index: 2; }
.proj-cover .pc-ic { position: absolute; top: 12px; right: 14px; color: rgba(227,195,122,.55); z-index: 2; }
.proj-cover .pc-ic .ic { width: 34px; height: 34px; }
.proj-flag {
    position: absolute; top: 11px; left: 0; z-index: 3; display: inline-flex; align-items: center; gap: 4px;
    background: linear-gradient(135deg, var(--gold-500), var(--gold-400)); color: #241a04;
    font-size: 10px; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase;
    padding: 4px 11px 4px 9px; border-radius: 0 20px 20px 0; box-shadow: 0 3px 10px rgba(212,168,83,.4);
}
.proj-cover .pc-city { color: #e8edf6; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.proj-body { padding: 14px 15px 15px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.proj-name { font-size: 15px; font-weight: 800; letter-spacing: -.2px; line-height: 1.3; color: var(--text); }
.proj-name:hover { color: var(--navy-700); }
.proj-dev { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.proj-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 4px; padding-top: 11px; border-top: 1px dashed var(--line); }
.proj-nums div { text-align: center; }
.proj-nums strong { display: block; font-size: 15px; font-weight: 800; letter-spacing: -.3px; line-height: 1.15; }
.proj-nums small { font-size: 9.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 700; }
.proj-nums .n-avail strong { color: var(--green); }
.proj-nums .n-res strong { color: var(--amber); }
.proj-nums .n-book strong { color: var(--blue); }
.proj-nums .n-sold strong { color: #64748b; }
.proj-sell { height: 6px; border-radius: 5px; background: #edf0f6; overflow: hidden; display: flex; }
.proj-sell i { display: block; height: 100%; }
.proj-sell .s-sold { background: linear-gradient(90deg, var(--navy-800), #33456b); }
.proj-sell .s-book { background: var(--blue); }
.proj-sell .s-res { background: var(--amber); }
.proj-foot { display: flex; gap: 8px; align-items: center; padding: 10px 15px; border-top: 1px solid var(--line); background: #fbfcfe; }
.proj-foot .btn { flex: 1; justify-content: center; }

/* ---- project hero (detail page) ---- */
.proj-hero {
    position: relative; border-radius: var(--radius); overflow: hidden; margin-bottom: 18px;
    background: linear-gradient(120deg, var(--navy-900) 0%, #14203a 48%, #2a3f68 100%);
    color: #e8edf6; padding: 26px 28px; box-shadow: var(--shadow-lg);
}
.proj-hero::before {
    content: ''; position: absolute; inset: 0; opacity: .45;
    background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 26px 26px;
}
.proj-hero::after { content: ''; position: absolute; right: -70px; top: -70px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(212,168,83,.22), transparent 68%); }
.proj-hero > * { position: relative; z-index: 2; }
.proj-hero .ph-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 9px; }
.proj-hero h2 { color: #fff; font-size: 25px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 7px; }
.proj-hero .ph-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: #b9c6dd; }
.proj-hero .ph-meta span { display: inline-flex; align-items: center; gap: 6px; }
.proj-hero .ph-meta .ic { color: var(--gold-400); }
.proj-hero .ph-actions { position: absolute; right: 28px; top: 26px; display: flex; gap: 8px; z-index: 3; }
.proj-hero .btn-gold { box-shadow: 0 6px 18px rgba(212,168,83,.32); }
.hero-stat-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; margin-top: 20px; background: rgba(255,255,255,.11); border-radius: 12px; overflow: hidden; }
.hero-stat-strip > div { background: rgba(9,14,28,.62); padding: 12px 14px; backdrop-filter: blur(2px); }
.hero-stat-strip strong { display: block; font-size: 21px; font-weight: 800; color: #fff; letter-spacing: -.5px; line-height: 1.15; }
.hero-stat-strip small { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #93a4c2; font-weight: 700; }
.hero-stat-strip .hs-avail strong { color: #5ee08d; }
.hero-stat-strip .hs-res strong { color: #f6c86a; }
.hero-stat-strip .hs-book strong { color: #7fb2ff; }
.hero-stat-strip .hs-sold strong { color: var(--gold-400); }

/* ---- blocks & streets ---- */
.block-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; transition: box-shadow .15s, border-color .15s; }
.block-card:hover { border-color: #d3dce9; box-shadow: var(--shadow); }
.block-head { display: flex; align-items: center; gap: 11px; padding: 13px 15px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fbfcfe, #f6f8fc); }
.block-ic { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--navy-800); color: var(--gold-400); flex-shrink: 0; }
.block-title { font-weight: 800; font-size: 14px; }
.block-sub { font-size: 11.5px; color: var(--muted); }
.block-body { padding: 13px 15px; }
.street-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.street-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; background: #eef2f8; color: #475569; border-radius: 20px; padding: 4px 11px; }
.inline-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-add input, .inline-add select { width: auto; min-width: 130px; flex: 1; margin: 0; }

/* ============================================================ Phase 2 · Inventory map */
.inv-shell { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.inv-toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 15px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fbfcfe, #f5f7fb); }
.inv-toolbar .it-field { min-width: 190px; }
.inv-toolbar label { margin: 0 0 5px; }
.inv-legend { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.inv-key { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: #475569; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px 4px 6px; cursor: default; transition: transform .12s, box-shadow .12s; }
.inv-key:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.inv-key i { width: 13px; height: 13px; border-radius: 4px; display: inline-block; flex-shrink: 0; }
.inv-key b { font-weight: 800; color: var(--text); }
.inv-canvas {
    padding: 20px 18px 26px;
    background-color: #f7f9fc;
    background-image:
        linear-gradient(rgba(22,35,60,.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22,35,60,.055) 1px, transparent 1px),
        linear-gradient(rgba(22,35,60,.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22,35,60,.028) 1px, transparent 1px);
    background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px;
}
.inv-street-label {
    display: inline-flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 800; letter-spacing: 1.4px;
    text-transform: uppercase; color: #6b7a94; margin: 4px 0 9px; padding-left: 2px;
}
.inv-street-label::after { content: ''; display: block; width: 46px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--gold-500), transparent); }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 9px; margin-bottom: 24px; }
.inv-cell {
    position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px 11px 9px; min-height: 68px;
    border-radius: 10px; border: 1px solid transparent; border-left-width: 4px; background: var(--surface);
    box-shadow: 0 1px 2px rgba(16,24,40,.06); cursor: pointer; overflow: hidden;
    transition: transform .14s cubic-bezier(.2,.7,.3,1), box-shadow .14s;
    animation: invIn .3s ease both;
}
@keyframes invIn { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
.inv-cell:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 10px 22px rgba(7,11,22,.17); z-index: 2; }
.inv-cell .iu { font-size: 13.5px; font-weight: 800; letter-spacing: -.2px; line-height: 1.2; word-break: break-word; }
.inv-cell .ia { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.inv-cell .ip { font-size: 11px; font-weight: 800; margin-top: auto; }
.inv-cell .imarks { position: absolute; top: 7px; right: 8px; display: flex; gap: 3px; }
.inv-cell .imarks .ic { width: 11px; height: 11px; opacity: .75; }
.inv-cell--available { border-color: #bfe6cd; border-left-color: var(--green); background: linear-gradient(160deg, #f2fbf5, #fff); }
.inv-cell--available .ip { color: var(--green); }
.inv-cell--hold { border-color: #f6dfb8; border-left-color: var(--amber); background: linear-gradient(160deg, #fef8ec, #fff); }
.inv-cell--hold .ip { color: var(--amber); }
.inv-cell--reserved { border-color: #f2e2ae; border-left-color: #c9a227; background: linear-gradient(160deg, #fdf9e8, #fff); }
.inv-cell--reserved .ip { color: #a3821a; }
.inv-cell--booked { border-color: #c3d7fb; border-left-color: var(--blue); background: linear-gradient(160deg, #f1f6fe, #fff); }
.inv-cell--booked .ip { color: var(--blue); }
.inv-cell--sold { border-color: #f3cccc; border-left-color: var(--red); background: linear-gradient(160deg, #fdf2f2, #fff); }
.inv-cell--sold .ip { color: var(--red); }
.inv-cell--transferred { border-color: #ddd0f7; border-left-color: var(--purple); background: linear-gradient(160deg, #f7f3fe, #fff); }
.inv-cell--transferred .ip { color: var(--purple); }
.inv-cell--cancelled { border-color: #f0c9d9; border-left-color: var(--pink); background: linear-gradient(160deg, #fdf2f7, #fff); }
.inv-cell--cancelled .ip { color: var(--pink); }
.inv-cell--blocked, .inv-cell--inactive { border-color: #dde2ea; border-left-color: #94a3b8; background: linear-gradient(160deg, #f4f6f9, #fff); }
.inv-cell--blocked .ip, .inv-cell--inactive .ip { color: #64748b; }
.inv-cell--rented { border-color: #bce4df; border-left-color: var(--teal); background: linear-gradient(160deg, #f0fbf9, #fff); }
.inv-cell--rented .ip { color: var(--teal); }
.inv-cell--unknown { border-color: var(--line); border-left-color: #cbd5e1; }
.k-avail { background: var(--green); } .k-hold { background: var(--amber); } .k-reserved { background: #c9a227; }
.k-booked { background: var(--blue); } .k-sold { background: var(--red); } .k-transferred { background: var(--purple); }
.k-cancelled { background: var(--pink); } .k-blocked { background: #94a3b8; } .k-rented { background: var(--teal); } .k-inactive { background: #cbd5e1; }

/* ============================================================ Phase 2 · shared bits */
.crumbs { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: #475569; font-weight: 600; }
.crumbs a:hover { color: var(--primary); text-decoration: underline; }
.crumbs .sep { color: #c3ccdb; font-size: 11px; }
.crumbs .now { color: var(--text); font-weight: 800; }
.crumbs .ic { width: 12px; height: 12px; opacity: .7; }

.feat-chip {
    display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; letter-spacing: .2px;
    background: linear-gradient(135deg, #fbf4e2, #fdf8ee); color: #8a6a17; border: 1px solid #ecd9a8;
    border-radius: 20px; padding: 3.5px 10px;
}
.feat-chip .ic { width: 11px; height: 11px; }
.feat-row { display: flex; gap: 6px; flex-wrap: wrap; }
.feat-none { font-size: 12.5px; color: var(--muted); }

.price-box { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.price-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 15px; font-size: 13.5px; border-bottom: 1px dashed var(--line); }
.price-line .pl-lbl { color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.price-line .pl-val { font-weight: 700; }
.price-line.strike .pl-val { text-decoration: line-through; color: #94a3b8; font-weight: 600; }
.price-line.disc { background: #fffaf0; }
.price-line.disc .pl-val { color: var(--amber); }
.price-line.total { background: linear-gradient(135deg, var(--navy-900), #1d2c4c); border-bottom: 0; }
.price-line.total .pl-lbl { color: #a9b7d0; }
.price-line.total .pl-val { color: var(--gold-400); font-size: 18px; font-weight: 800; letter-spacing: -.3px; }

.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 5px; }
.check-pill { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px; cursor: pointer; transition: all .15s; background: var(--surface); margin: 0; font-size: 13px; font-weight: 600; color: #475569; }
.check-pill:hover { border-color: #c9d4e4; background: #fbfcfe; }
.check-pill input { width: 16px; height: 16px; min-width: 0; accent-color: var(--navy-800); cursor: pointer; margin: 0; flex-shrink: 0; }
.check-pill:has(input:checked) { border-color: var(--gold-500); background: linear-gradient(135deg, #fdf8ec, #fffdf7); color: #6d5312; box-shadow: inset 0 0 0 1px rgba(212,168,83,.35); }
.check-pill .ic { opacity: .6; }
.check-pill:has(input:checked) .ic { opacity: 1; color: var(--gold-500); }

.hist-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }
.hist-card .card-head h3 { display: flex; align-items: center; gap: 8px; }
.delta-up { color: var(--green); font-weight: 800; }
.delta-down { color: var(--red); font-weight: 800; }
.own-row { display: flex; gap: 11px; align-items: flex-start; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.own-row:last-child { border-bottom: 0; }
.own-badge { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--primary-soft); color: var(--primary); }
.own-badge.Ob-dealer { background: var(--purple-soft); color: var(--purple); }
.own-badge.Ob-customer { background: var(--teal-soft); color: var(--teal); }

.sect-title { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: #8b98ad; margin: 20px 0 10px; display: flex; align-items: center; gap: 9px; }
.sect-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

/* form + sticky preview split (project editor) */
.form-split { grid-template-columns: minmax(0, 1fr) 330px; align-items: start; }
.form-split > .stack { position: sticky; top: 84px; }
@media (max-width: 1100px) { .form-split { grid-template-columns: 1fr; } .form-split > .stack { position: static; } }

@media (max-width: 1250px) { .proj-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
    .hero-stat-strip { grid-template-columns: repeat(3, 1fr); }
    .proj-hero .ph-actions { position: static; margin-top: 16px; }
}
@media (max-width: 640px) {
    .proj-grid { grid-template-columns: 1fr; }
    .hero-stat-strip { grid-template-columns: repeat(2, 1fr); }
    .check-grid { grid-template-columns: 1fr; }
    .inv-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
}

/* ============================================================ Kebab / row-action menu (mobile) */
.kebab { position: relative; display: inline-flex; }
.kebab-btn {
    background: none; border: 1px solid var(--line); border-radius: 8px; width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted);
    font-size: 16px; line-height: 1; transition: all .15s;
}
.kebab-btn:hover { border-color: var(--primary); color: var(--primary); }
.kebab-menu {
    display: none; position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface);
    border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 150px;
    z-index: 70; overflow: hidden; padding: 4px 0;
}
.kebab.open .kebab-menu { display: block; }
.kebab-menu a, .kebab-menu button {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 14px; font-size: 13px;
    color: var(--text); background: none; border: 0; cursor: pointer; font-family: inherit; text-align: left;
}
.kebab-menu a:hover, .kebab-menu button:hover { background: var(--bg); }
.kebab-menu .btn-red { color: var(--red); }

/* ============================================================ Responsive grid utilities */
.responsive-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.responsive-grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* Overflow hardening: long unbroken strings (URLs, codes, tokens) must wrap
   rather than expand a card/grid track and cause horizontal page overflow. */
.card { min-width: 0; }
.card code, .card-body code, td code { overflow-wrap: anywhere; word-break: break-word; }
.card .table { table-layout: auto; }
.card-body { min-width: 0; }

/* ============================================================ CORRECTIVE RESPONSIVE (after WhatsApp/tracking duplicates) 
   These MUST come last to override the duplicate declarations above. */
@media (max-width: 1024px) {
    .track-wrap { grid-template-columns: 1fr; }
    .wa-wrap { grid-template-columns: 260px 1fr; }
}
@media (max-width: 860px) {
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .form-grid .span-2 { grid-column: span 1; }
    .wa-wrap { grid-template-columns: minmax(0, 1fr); height: auto; }
    .track-wrap { grid-template-columns: minmax(0, 1fr); }
    .grid-2, .grid-3, .grid-4, .grid-5, .grid-main { grid-template-columns: minmax(0, 1fr); }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .prop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .proj-grid { grid-template-columns: minmax(0, 1fr); }
    .hero-stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .stat-grid, .prop-grid, .grid-4, .grid-5 { grid-template-columns: 1fr; }
    .wa-wrap { grid-template-columns: 1fr; height: auto; }
    .wa-list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--line); }
    .wa-chat { min-height: 420px; }
    .track-wrap { grid-template-columns: 1fr; }
    .table th:nth-child(n+5):not(:last-child),
    .table td:nth-child(n+5):not(:last-child) { display: none; }
    .table td:last-child .btn { padding: 4px 8px; font-size: 11.5px; }
    .responsive-grid { grid-template-columns: 1fr; }
    .kebab-btn { width: 28px; height: 28px; }
    /* Prevent horizontal overflow on all pages */
    .content { overflow-x: hidden; }
    .card { overflow-x: auto; }
}

/* ============================================================ TASK #117: bulk controls, duplication, draft badge */
.bulk-col { width: 34px; text-align: center; }
.bulk-col input[type=checkbox], .bulk-cb { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand, #2563eb); }
.bulk-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    position: sticky; bottom: 0; z-index: 20;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 10px 14px; margin: 10px 0; box-shadow: var(--shadow-lg);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar .bulk-count { font-weight: 600; }
.bulk-bar .spacer { flex: 1; }
.bulk-warn { color: var(--red, #dc2626); font-size: 12.5px; font-weight: 600; }
.bulk-warn[hidden] { display: none; }
.crm-check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; cursor: pointer; }
.crm-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand, #2563eb); }
.crm-dup-preview {
    margin-top: 12px; padding: 10px 12px; background: var(--bg);
    border: 1px dashed var(--line); border-radius: var(--radius);
    max-height: 200px; overflow: auto; font-size: 13px;
}
.badge-draft {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    background: #fef3c7; color: #92400e; border: 1px solid #fde68a;
    font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.prop-card .card-check { position: absolute; top: 10px; left: 10px; z-index: 3; }
.prop-card { position: relative; }