/* =====================================================================
   EstateHub UI – modern light theme (indigo accent, slate neutrals)
   No build step required. Edit the tokens below to rebrand.
   ===================================================================== */
:root {
    /* Indigo + Slate – modern SaaS palette */
    --primary: #4f46e5;
    --primary-600: #4338ca;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;

    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --text: #0f172a;
    --text-2: #475569;
    --muted: #94a3b8;

    --green: #059669;   --green-bg: #ecfdf5;
    --violet: #7c3aed;  --violet-bg: #f5f3ff;
    --amber: #d97706;   --amber-bg: #fffbeb;
    --red: #dc2626;     --red-bg: #fef2f2;
    --blue: #2563eb;    --blue-bg: #eff6ff;
    --gray-bg: #f1f5f9;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, .25);
    --sidebar-w: 252px;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 13px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); }
p { margin: 0 0 .75em; }
img { max-width: 100%; }
[x-cloak] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---------------------------------------------------------------- shell */
.app { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--surface);
    border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40;
    transition: transform .2s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 22px; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 8px; background: var(--primary); color: #fff;
    display: grid; place-items: center; flex: none;
}
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: -.3px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0 16px; }
.nav-section { padding: 14px 24px 6px; font-size: 11px; color: var(--muted); font-weight: 600; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 24px; color: var(--text-2);
    font-weight: 500; position: relative; cursor: pointer; width: 100%; background: none; border: 0;
    font: inherit; font-weight: 500; text-align: left;
}
.nav-item svg { width: 18px; height: 18px; color: #7b8494; flex: none; }
.nav-item:hover { color: var(--primary); background: #fafbfc; }
.nav-item:hover svg { color: var(--primary); }
.nav-item.active { color: var(--primary); font-weight: 600; }
.nav-item.active svg { color: var(--primary); }
.nav-item .chev { margin-left: auto; width: 14px; height: 14px; transition: transform .2s; }
.nav-item[aria-expanded="true"] .chev { transform: rotate(180deg); }
.nav-item .count { margin-left: auto; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.nav-sub { padding: 2px 0 6px; }
.nav-sub a {
    display: flex; align-items: center; gap: 12px; padding: 8px 24px 8px 30px; color: var(--text-2); font-weight: 500; position: relative;
}
.nav-sub a::before { content: ''; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid #9aa3b2; flex: none; }
.nav-sub a:hover { color: var(--primary); }
.nav-sub a.active { background: var(--surface-2); color: var(--text); font-weight: 600; margin-left: 14px; border-radius: 6px 0 0 6px; padding-left: 16px; }
.nav-sub a.active::before { border-color: var(--primary); background: var(--primary); }
.nav-sub a.active::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.sidebar-foot { padding: 16px 24px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }
.sidebar-foot strong { color: var(--text); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px; padding: 14px 28px; min-height: 68px;
}
.topbar-title h1 { font-size: 18px; font-weight: 700; }
.topbar-title p { margin: 2px 0 0; color: var(--muted); font-size: 11.5px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--text-2);
    display: grid; place-items: center; cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--primary); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 24px; cursor: pointer; border: 0; background: none; font: inherit; }
.user-chip:hover { background: var(--surface-2); }
.user-chip .who { text-align: left; line-height: 1.2; }
.user-chip .who strong { display: block; font-size: 12.5px; }
.user-chip .who span { font-size: 11px; color: var(--muted); }

.topsearch { position: relative; }
.topsearch input { width: 0; opacity: 0; transition: all .2s; border: 1px solid var(--border); border-radius: 20px; padding: 8px 14px 8px 34px; font: inherit; }
.topsearch.open input { width: 260px; opacity: 1; }
.topsearch svg.lead { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; color: var(--muted); pointer-events: none; }

.tabs { display: flex; gap: 4px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 28px; overflow-x: auto; }
.tabs a { padding: 14px 36px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--primary); }
.tabs a.active { color: var(--text); font-weight: 600; border-bottom-color: var(--primary); }

.content { padding: 24px 28px 40px; flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.page-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

@media (min-width: 1025px) {
    .app.collapsed .sidebar { transform: translateX(-100%); }
    .app.collapsed .main { margin-left: 0; }
}
.main { transition: margin-left .2s ease; }

/* ---------------------------------------------------------------- grid & utils */
.grid { display: grid; gap: 18px; }
.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-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-side { grid-template-columns: minmax(0, 1fr) 340px; }
.span-2 { grid-column: span 2; }
.span-full { grid-column: 1 / -1; }
.flex { display: flex; } .inline-flex { display: inline-flex; } .wrap { flex-wrap: wrap; }
.items-center { align-items: center; } .items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; } .justify-center { justify-content: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.grow { flex: 1; min-width: 0; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.p-0 { padding: 0 !important; }
.w-full { width: 100%; }
.muted { color: var(--muted); } .text-2 { color: var(--text-2); }
.small { font-size: 11.5px; } .tiny { font-size: 10.5px; } .big { font-size: 16px; }
.strong { font-weight: 600; } .bold { font-weight: 700; }
.right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); } .text-primary { color: var(--primary); }
.hidden { display: none; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #eef0f3; }
.card-body { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 13.5px; font-weight: 700; }
.card-head .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); }

.stat { padding: 18px 20px 16px; }
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.stat-label { font-size: 10.5px; font-weight: 700; color: var(--text); letter-spacing: .3px; text-transform: uppercase; }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -.3px; }
.stat-value.sm { font-size: 19px; }
.stat-rows { margin-top: 14px; display: grid; gap: 6px; }
.stat-rows div { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-2); }
.stat-rows b { color: var(--text); font-weight: 600; }
.tile { width: 42px; height: 42px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.tile svg { width: 20px; height: 20px; }
.tile.violet { background: var(--violet-bg); color: var(--violet); }
.tile.green  { background: var(--green-bg); color: var(--green); }
.tile.teal   { background: var(--primary-50); color: var(--primary); }
.tile.amber  { background: var(--amber-bg); color: var(--amber); }
.tile.red    { background: var(--red-bg); color: var(--red); }
.tile.blue   { background: var(--blue-bg); color: var(--blue); }
.tile.sm { width: 34px; height: 34px; } .tile.sm svg { width: 17px; height: 17px; }

/* ---------------------------------------------------------------- buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px;
    border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 12.5px;
    cursor: pointer; white-space: nowrap; line-height: 1.2; transition: background .15s, border-color .15s, color .15s;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); color: #fff; }
.btn-light { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-light:hover { border-color: var(--primary); color: var(--primary); }
.btn-soft { background: var(--primary-50); color: var(--primary-600); }
.btn-soft:hover { background: var(--primary-100); color: var(--primary-600); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--primary); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover { background: #1ebe5b; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 11.5px; }
.btn-xs { padding: 4px 8px; font-size: 11px; border-radius: 5px; }
.btn-icon { padding: 7px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11px; color: var(--muted); }
.field .error { font-size: 11px; color: var(--red); }
.input, .select, .textarea {
    width: 100%; font: inherit; font-size: 13px; color: var(--text); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 12px; transition: border-color .15s, box-shadow .15s;
}
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.textarea { min-height: 90px; resize: vertical; }
.textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; min-height: 160px; }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--red); }
.input-group { position: relative; }
.input-group svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.input-group .input { padding-left: 34px; }
.input-addon { display: flex; }
.input-addon span { padding: 9px 11px; background: var(--surface-2); border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); font-weight: 600; font-size: 12px; }
.input-addon .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text-2); cursor: pointer; font-size: 12.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 20px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(16px); }
.color-input { width: 42px; height: 38px; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; }
.form-section { padding: 20px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section > h4 { font-size: 12.5px; font-weight: 700; margin-bottom: 14px; color: var(--text); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); background: #fbfcfd; border-radius: 0 0 var(--radius) var(--radius); }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; }
.segmented label, .segmented a { padding: 7px 14px; border-radius: 6px; font-weight: 600; font-size: 12px; color: var(--text-2); cursor: pointer; }
.segmented input { display: none; }
.segmented input:checked + span, .segmented a.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }
.segmented label span { display: block; padding: 7px 14px; margin: -7px -14px; border-radius: 6px; }

/* ---------------------------------------------------------------- tables */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar h2 { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.toolbar .filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar .filters .select, .toolbar .filters .input { width: auto; min-width: 140px; padding-top: 8px; padding-bottom: 8px; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 15px; color: var(--text-2); }
.search-box input { border: 0; border-bottom: 1px solid var(--border-strong); background: transparent; padding: 8px 6px 8px 24px; width: 290px; font: inherit; font-size: 12px; }
.search-box input:focus { outline: 0; border-bottom-color: var(--primary); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th { background: var(--surface-2); color: var(--text); font-weight: 600; text-align: left; padding: 13px 16px; font-size: 11.5px; white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.table tbody tr:hover td { background: #fafcfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .strong, .table td.strong { color: var(--text); }
.table th.right, .table td.right { text-align: right; }
.table.compact td { padding: 10px 14px; }
.table.compact th { padding: 10px 14px; }
.table tfoot td { font-weight: 700; color: var(--text); background: #fbfcfd; border-top: 1px solid var(--border); }
.table-card .table th:first-child, .table-card .table td:first-child { padding-left: 22px; }
.link-num { color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .meta { min-width: 0; line-height: 1.3; }
.person .meta strong { display: block; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .meta span { font-size: 11px; color: var(--muted); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; background: var(--primary-50); color: var(--primary-600); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.c1 { background: #efedfc; color: #6a5ad6; } .avatar.c2 { background: #e6f6ec; color: #23894f; }
.avatar.c3 { background: #fff3e3; color: #c46f12; } .avatar.c4 { background: #e8f1fc; color: #2f6fba; }
.avatar.c5 { background: #fdecec; color: #c43b3a; }

/* ---------------------------------------------------------------- badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.violet { background: var(--violet-bg); color: var(--violet); }
.badge.gray { background: var(--gray-bg); color: #667085; }
.badge.teal { background: var(--primary-50); color: var(--primary-600); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 6px; background: var(--surface-2); font-size: 11.5px; font-weight: 500; color: var(--text-2); }
.chip code { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--primary-600); }
button.chip { border: 0; cursor: pointer; font: inherit; font-size: 11.5px; }
button.chip:hover { background: var(--primary-50); }

/* ---------------------------------------------------------------- alerts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-weight: 500; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert.success { background: var(--green-bg); color: #1f7a4a; }
.alert.warning { background: var(--amber-bg); color: #9a5a0f; }
.alert.error { background: var(--red-bg); color: #a92f2e; }
.alert.info { background: var(--primary-50); color: var(--primary-600); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert .close { margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit; opacity: .6; }

/* ---------------------------------------------------------------- pagination */
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 16px; }
.pager a, .pager span { min-width: 28px; height: 28px; padding: 0 8px; display: grid; place-items: center; border-radius: 5px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.pager a:hover { background: var(--surface-2); color: var(--primary); }
.pager .current { background: var(--surface-2); color: var(--text); font-weight: 700; border: 1px solid var(--border-strong); }
.pager .arrow { border: 1px solid var(--border-strong); background: #fff; }
.pager .disabled { opacity: .4; }
.pager-info { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 12px; margin-top: -8px; }

/* ---------------------------------------------------------------- lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow strong { display: block; font-weight: 600; color: var(--text); font-size: 12.5px; }
.list .grow span { font-size: 11px; color: var(--muted); }
.date-chip { width: 44px; text-align: center; border-radius: 8px; background: var(--surface-2); padding: 5px 0; flex: none; line-height: 1.1; }
.date-chip b { display: block; font-size: 15px; color: var(--text); }
.date-chip span { font-size: 9.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.date-chip.red { background: var(--red-bg); } .date-chip.red b, .date-chip.red span { color: var(--red); }
.date-chip.amber { background: var(--amber-bg); } .date-chip.amber b, .date-chip.amber span { color: var(--amber); }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; margin: 0; font-size: 12.5px; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; color: var(--text); font-weight: 600; word-break: break-word; }

.progress { height: 6px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.progress.amber > span { background: var(--amber); } .progress.red > span { background: var(--red); }

.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: var(--border-strong); margin-bottom: 10px; }
.empty strong { display: block; color: var(--text); font-size: 13.5px; margin-bottom: 4px; }

/* ---------------------------------------------------------------- building floor stack */
.stack { display: flex; flex-direction: column; gap: 5px; }
.stack-floor { display: flex; align-items: center; gap: 8px; }
.stack-floor .fl { width: 26px; font-size: 10.5px; font-weight: 700; color: var(--muted); text-align: right; flex: none; }
.stack-units { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.u { min-width: 46px; height: 32px; border-radius: 5px; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; padding: 0 6px; border: 1px solid transparent; color: #fff; position: relative; }
.u.lg { min-width: 92px; height: 64px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 7px 9px; font-size: 12px; text-align: left; }
.u.lg small { font-size: 10px; font-weight: 500; opacity: .9; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u.occupied { background: var(--primary); }
.u.vacant { background: #fff; border-color: var(--border-strong); color: var(--text-2); border-style: dashed; }
.u.reserved { background: var(--blue); }
.u.maintenance { background: var(--amber); }
a.u:hover { filter: brightness(1.08); color: #fff; }
a.u.vacant:hover { border-color: var(--primary); color: var(--primary); }
.stack-base { height: 6px; border-radius: 3px; background: var(--border-strong); margin: 6px 0 0 34px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.building-card { overflow: hidden; display: flex; flex-direction: column; }
.building-cover { height: 120px; background: linear-gradient(135deg, var(--primary-50), #f6f7f9); position: relative; display: flex; align-items: flex-end; padding: 12px 16px; }
.building-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.building-cover .badge { position: relative; }
.building-cover .code { position: absolute; top: 12px; right: 14px; background: rgba(255,255,255,.92); padding: 3px 9px; border-radius: 5px; font-size: 11px; font-weight: 700; color: var(--text); }

/* ---------------------------------------------------------------- dropdown & modal */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border); padding: 6px; z-index: 50; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 6px; color: var(--text-2); font: inherit; font-weight: 500; background: none; border: 0; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); color: var(--primary); }
.dropdown-menu svg { width: 16px; height: 16px; }
.dropdown-menu .sep { height: 1px; background: var(--border); margin: 5px 0; }
.dropdown-menu.wide { min-width: 320px; padding: 0; }

.modal-back { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); }
.modal.lg { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 14px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: #fbfcfd; border-radius: 0 0 10px 10px; }

/* ---------------------------------------------------------------- misc */
.doc-preview { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 28px 34px; font-family: 'DejaVu Sans', Arial, sans-serif; font-size: 12px; line-height: 1.55; color: #222; max-height: 720px; overflow: auto; }
.doc-preview table { border-collapse: collapse; }
.doc-preview h2 { font-size: 17px; margin: 0 0 8px; } .doc-preview h3 { font-size: 13px; margin: 16px 0 6px; }
.msg-bubble { background: #e7fbe6; border-radius: 10px 10px 10px 2px; padding: 10px 12px; white-space: pre-wrap; font-size: 12.5px; color: #1f2a37; }
.mail-preview { white-space: pre-wrap; font-size: 12.5px; background: var(--surface-2); border-radius: 8px; padding: 12px 14px; }
.timeline { list-style: none; margin: 0; padding: 0 20px; }
.timeline li { position: relative; padding: 12px 0 12px 22px; border-left: 2px solid var(--border); }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--primary); }
.timeline li.failed::before { border-color: var(--red); } .timeline li.skipped::before { border-color: var(--amber); }
.placeholder-list { display: flex; flex-wrap: wrap; gap: 6px; }
.section-title { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; margin: 14px 0 8px; }

/* chart containers */
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.auth-art { background: var(--primary); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art h2 { color: #fff; font-size: 30px; font-weight: 700; max-width: 420px; letter-spacing: -.4px; }
.auth-art p { color: rgba(255,255,255,.85); max-width: 400px; font-size: 14px; }
.auth-art .skyline { position: absolute; left: 0; right: 0; bottom: 0; opacity: .18; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form form { width: 100%; max-width: 380px; }
.demo-logins { margin-top: 22px; border: 1px dashed var(--border-strong); border-radius: 8px; padding: 12px 14px; font-size: 11.5px; color: var(--text-2); }
.demo-logins button { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; }

/* responsive */
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main, .grid-side { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: none; }
    .main { margin-left: 0; }
    .sidebar-backdrop { position: fixed; inset: 0; background: rgba(17,24,39,.35); z-index: 35; }
}
@media (max-width: 760px) {
    .grid-2, .grid-3, .grid-4, .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .content { padding: 16px; }
    .topbar { padding: 12px 16px; }
    .tabs { padding: 0 8px; } .tabs a { padding: 12px 16px; }
    .search-box input { width: 100%; }
    .topsearch.open input { width: 160px; }
    .user-chip .who { display: none; }
    .auth { grid-template-columns: 1fr; } .auth-art { display: none; }
    .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
    .sidebar, .topbar, .tabs, .btn, .toolbar .filters { display: none !important; }
    .main { margin: 0; } .card { box-shadow: none; }
}

/* Let row dropdowns escape the table on desktop; keep horizontal scrolling on small screens */
@media (min-width: 1100px) { .table-wrap { overflow: visible; } }
.table tr:last-child .dropdown-menu, .table tr:nth-last-child(2) .dropdown-menu { top: auto; bottom: calc(100% + 6px); }

/* ---------------------------------------------------------------- modern layer */
body { font-size: 13.5px; -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; letter-spacing: -.005em; }
.brand-mark { border-radius: 10px; background: linear-gradient(135deg, var(--primary), #7c3aed); box-shadow: 0 4px 12px rgba(79, 70, 229, .35); }
.brand-name { font-weight: 700; letter-spacing: -.4px; }
.sidebar { background: #fff; border-right-color: var(--border); }
.sidebar-nav { padding: 8px 12px 16px; }
.nav-item { padding: 9px 12px; border-radius: 8px; margin: 1px 0; color: var(--text-2); }
.nav-item svg { color: #94a3b8; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:hover svg { color: var(--text-2); }
.nav-item.active { background: var(--primary-50); color: var(--primary-600); font-weight: 600; }
.nav-item.active svg { color: var(--primary); }
.nav-sub { padding: 2px 0 6px 12px; }
.nav-sub a { border-radius: 8px; }
.nav-sub a.active { background: var(--surface-2); margin-left: 0; border-radius: 8px; color: var(--primary-600); }
.nav-sub a.active::after { display: none; }
.topbar { background: rgba(255, 255, 255, .85); backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--border); }
.topbar-title h1 { font-weight: 700; letter-spacing: -.4px; }
.card { border: 1px solid var(--border); box-shadow: var(--shadow); }
.card-head h3 { font-weight: 650; letter-spacing: -.2px; }
.stat-label { color: var(--muted); font-weight: 600; letter-spacing: .4px; }
.stat-value { font-weight: 700; letter-spacing: -.6px; }
.tile { border-radius: 10px; }
.btn { border-radius: 8px; font-weight: 600; transition: background .15s, box-shadow .15s, transform .15s, color .15s; }
.btn-primary { box-shadow: 0 1px 2px rgba(79, 70, 229, .25), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(79, 70, 229, .3); }
.input, .select, .textarea { border-radius: 8px; border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); outline: none; }
.table th { color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.badge { border-radius: 999px; font-weight: 600; }
.dropdown-menu { border-radius: 12px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.modal { border-radius: 16px; }
.auth-art { background: linear-gradient(140deg, #312e81 0%, var(--primary) 55%, #7c3aed 100%); }
.progress span { background: linear-gradient(90deg, var(--primary), #7c3aed); }