/* ==========================================================================
   ReUnited — Admin UI
   Brand: logo orange on white, with a vivid multi-colour data palette.
   ========================================================================== */
:root {
    --brand: #F26B1D;
    --brand-600: #E8590C;
    --brand-50: #FFF4EC;
    --brand-100: #FFE4D1;
    --brand-grad: linear-gradient(135deg, #FF8A3D 0%, #F26B1D 55%, #E8590C 100%);

    --bg: #F7F8FC;
    --surface: #FFFFFF;
    --surface-2: #F9FAFB;
    --text: #1F2433;
    --muted: #6B7280;
    --border: #ECEEF3;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
    --shadow-lg: 0 10px 30px rgba(242, 107, 29, .25);

    --violet: #7C5CFC; --teal: #14B8A6; --blue: #3B82F6; --pink: #EC4899;
    --green: #22C55E;  --amber: #F59E0B; --red: #EF4444; --cyan: #06B6D4;

    --band-under: #9CA3AF; --band-attention: #EF4444; --band-developing: #F59E0B; --band-high: #22C55E;

    --radius: 16px;
    --radius-sm: 10px;
    --sidebar-w: 248px;
    --sidebar-w-collapsed: 76px;
    --topbar-h: 68px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0F1117;
    --surface: #171A23;
    --surface-2: #1E2230;
    --text: #E9EBF1;
    --muted: #9AA1B2;
    --border: #262B3A;
    --brand-50: #2A1A10;
    --brand-100: #3A2212;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --band-under: #4B5263;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
button, input, select { font: inherit; color: inherit; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    transition: width .2s ease, transform .2s ease;
}
.brand { display: flex; align-items: center; height: var(--topbar-h); padding: 0 22px; border-bottom: 1px solid var(--border); }
.brand img { height: 40px; }
.brand-mark { display: none; }
.nav { padding: 16px 14px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: 1; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 12px;
    color: var(--muted); font-weight: 600;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.nav-link i { font-size: 17px; width: 20px; text-align: center; }
.nav-link:hover { background: var(--brand-50); color: var(--brand); }
.nav-link.active { background: var(--brand-grad); color: #fff; box-shadow: var(--shadow-lg); }
.sidebar-foot { padding: 14px 22px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; transition: margin .2s ease; }
.sb-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.sb-collapsed .main { margin-left: var(--sidebar-w-collapsed); }
.sb-collapsed .nav-link span, .sb-collapsed .sidebar-foot { display: none; }
.sb-collapsed .nav-link { justify-content: center; padding: 11px 0; }
.sb-collapsed .brand { justify-content: center; padding: 0; }
.sb-collapsed .brand-full { display: none; }
.sb-collapsed .brand-mark { display: block; height: 38px; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 16px;
    padding: 0 28px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
    padding: 0 14px; height: 40px; width: min(380px, 40vw); color: var(--muted);
}
.topbar-search input { border: 0; outline: 0; background: transparent; width: 100%; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
    position: relative;
    width: 40px; height: 40px; border-radius: 12px;
    border: 1px solid var(--border); background: var(--surface);
    display: grid; place-items: center; cursor: pointer; font-size: 17px; color: var(--muted);
    transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand-100); }
.icon-btn.has-dot::after { content: ""; position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); }
.theme-dark-icon { display: none; }
[data-theme="dark"] .theme-dark-icon { display: inline; }
[data-theme="dark"] .theme-light-icon { display: none; }

.user-menu { position: relative; margin-left: 6px; }
.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; padding: 4px; border-radius: 12px; }
.user-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.user-meta small { color: var(--brand); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.dropdown-menu {
    display: none; position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
}
.user-menu.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 12px; border-radius: 8px; background: none; border: 0; cursor: pointer; text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--brand-50); color: var(--brand); }
.dropdown-menu form { margin: 0; }

.content { padding: 22px 28px 32px; display: flex; flex-direction: column; gap: 20px; }
.footer { padding: 16px 28px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }
.breadcrumb { display: flex; gap: 8px; font-size: 13px; color: var(--muted); }
.breadcrumb .current { color: var(--brand); font-weight: 600; }

.avatar {
    width: 38px; height: 38px; flex: none; border-radius: 50%;
    display: grid; place-items: center;
    background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c);
    font-weight: 700; font-size: 13px;
}
.user-btn .avatar { background: var(--brand-grad); color: #fff; }

/* ---------- Page head & filters ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.select {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 0 12px; height: 42px; color: var(--muted);
}
.select:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.select select { border: 0; outline: 0; background: transparent; color: var(--text); font-weight: 600; max-width: 220px; cursor: pointer; }

.mini-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-filters select {
    border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px;
    padding: 5px 8px; font-size: 12px; font-weight: 600; cursor: pointer; max-width: 140px;
}
.mini-filters select:focus { outline: 2px solid var(--brand-100); border-color: var(--brand); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
    font-weight: 700; cursor: pointer; transition: transform .1s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: var(--shadow-lg); }
.btn-primary:hover { box-shadow: 0 12px 30px rgba(242, 107, 29, .35); }
.btn-soft { background: var(--brand-50); color: var(--brand); }
.btn-soft:hover { background: var(--brand-100); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--muted); }
.btn-block { width: 100%; }
.link { color: var(--brand); font-weight: 700; font-size: 13px; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 17px; }
.card-head .accent { color: var(--brand); font-weight: 600; font-size: 15px; }
.pill { background: var(--brand-50); color: var(--brand); padding: 5px 10px; border-radius: 999px; font-weight: 700; font-size: 12px; }

/* tones */
.tone-violet { --c: var(--violet); } .tone-teal { --c: var(--teal); } .tone-blue { --c: var(--blue); }
.tone-pink { --c: var(--pink); } .tone-green { --c: var(--green); } .tone-amber { --c: var(--amber); }
.tone-red { --c: var(--red); }

/* ---------- KPI strip ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)) minmax(0, 1.35fr); gap: 14px; }
.kpi { display: flex; flex-direction: column; justify-content: space-between; gap: 18px; padding: 18px; position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16, 24, 40, .08); }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c); opacity: .9; }
.kpi-top { display: flex; justify-content: space-between; gap: 8px; }
.kpi-label { display: block; color: var(--muted); font-weight: 600; font-size: 13px; }
.kpi-value { display: block; font-size: 26px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.kpi-icon {
    width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center;
    background: color-mix(in srgb, var(--c, var(--brand)) 14%, transparent); color: var(--c, var(--brand)); font-size: 20px;
}
.kpi-icon.big { width: 72px; height: 72px; font-size: 32px; border-radius: 20px; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; white-space: nowrap; flex-wrap: wrap; }
.kpi-hero .kpi-foot { white-space: normal; }
.trend { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 999px; font-weight: 700; font-size: 12px; }
.trend.up { background: #DCFCE7; color: #15803D; }
.trend.down { background: #FEE2E2; color: #B91C1C; }
.trend.flat { background: var(--surface-2); color: var(--muted); }
[data-theme="dark"] .trend.up { background: #12351F; color: #4ADE80; }
[data-theme="dark"] .trend.down { background: #3B1616; color: #F87171; }

.kpi-hero { background: var(--brand-grad); color: #fff; border: 0; box-shadow: var(--shadow-lg); }
.kpi-hero::before { display: none; }
.kpi-hero .kpi-label { color: rgba(255, 255, 255, .9); }
.kpi-hero .kpi-value { font-size: 30px; }
.kpi-hero .kpi-foot { color: rgba(255, 255, 255, .9); position: relative; z-index: 1; }
.kpi-hero .trend { background: rgba(255, 255, 255, .22); color: #fff; }
.kpi-watermark { position: absolute; right: -8px; top: -10px; font-size: 96px; opacity: .12; }

/* ---------- Main grid ---------- */
.grid-main {
    display: grid; gap: 16px;
    grid-template-columns: minmax(0, 1fr) minmax(0, .9fr) minmax(0, .9fr) minmax(0, 1.8fr);
    grid-template-areas:
        "rem rev rev users"
        "rem brk dis deals";
}
.reminders { grid-area: rem; display: flex; flex-direction: column; }
.revenue { grid-area: rev; }
.users-chart { grid-area: users; display: flex; flex-direction: column; }
.brokers-donut { grid-area: brk; }
.disputes { grid-area: dis; display: flex; flex-direction: column; gap: 12px; }
.deals-card { grid-area: deals; }

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 30px 10px; }
.empty p { margin: 0; font-weight: 700; font-size: 15px; }
.empty-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); font-size: 26px; }
.reminder-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.reminder-list li { display: flex; gap: 12px; align-items: center; }
.reminder-list strong { display: block; font-size: 13px; }
.date-chip {
    width: 46px; flex: none; text-align: center; border-radius: 10px; padding: 5px 0; font-size: 11px; font-weight: 600;
    background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); line-height: 1.15;
}
.date-chip b { display: block; font-size: 17px; }

.rev-list { margin: 0; }
.rev-list > div { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.rev-list dt { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; }
.rev-list dd { margin: 0; font-weight: 700; }
.rev-list .total { border-bottom: 0; background: var(--brand-50); margin-top: 8px; padding: 12px 14px; border-radius: 10px; }
.rev-list .total dt { color: var(--text); font-weight: 700; }
.rev-list .total dd { color: var(--brand); font-size: 17px; }
.sub-head { font-size: 15px; margin: 20px 0 12px; display: flex; justify-content: space-between; align-items: baseline; }
.sub-head small { font-size: 12px; font-weight: 500; }
.renewal { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.renewal .letter {
    width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; font-weight: 800;
    background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c);
}
.renewal-body { flex: 1; min-width: 0; }
.renewal-row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--brand)); min-width: 4px; transition: width .4s ease; }
.bar.split { --c: var(--green); background: color-mix(in srgb, var(--violet) 25%, transparent); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; font-weight: 600; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend b { color: var(--text); }
.legend.center { justify-content: center; margin-top: 12px; }

.chart-box { position: relative; width: 100%; height: 240px; }
.chart-box.tall { flex: 1; min-height: 280px; }

.donut-wrap { position: relative; width: 100%; max-width: 190px; aspect-ratio: 1; margin: 0 auto; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center strong { font-size: 24px; font-weight: 800; }
.donut-center span { color: var(--muted); font-size: 12px; font-weight: 600; }

.stat-row { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--c) 8%, transparent); transition: background .15s; }
.stat-row:hover { background: color-mix(in srgb, var(--c) 14%, transparent); }
.stat-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--c); font-size: 20px; box-shadow: var(--shadow); }
.stat-row span { display: block; color: var(--muted); font-weight: 600; font-size: 13px; }
.stat-row strong { font-size: 24px; font-weight: 800; }

.deals-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.deal-legend { list-style: none; margin: 0; padding: 0; }
.deal-legend li { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px dashed var(--border); font-weight: 600; }
.deal-legend li:last-child { border-bottom: 0; }
.deal-legend span { display: inline-flex; align-items: center; gap: 10px; }
.deal-legend b { font-size: 16px; }

/* ---------- Traffic lights ---------- */
.traffic-body { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.traffic-chart { height: 440px; }
.score { display: inline-block; min-width: 72px; text-align: center; padding: 7px 0; border-radius: 8px; font-weight: 800; color: #fff; }
.band-under { background: var(--band-under); --c: var(--band-under); }
.band-attention { background: var(--band-attention); --c: var(--band-attention); }
.band-developing { background: var(--band-developing); --c: var(--band-developing); }
.band-high { background: var(--band-high); --c: var(--band-high); }
.bands { margin-top: 20px; }
.star { color: var(--amber); font-size: 11px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.table th {
    text-align: left; font-size: 11px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: .04em; white-space: normal; line-height: 1.3;
    padding: 10px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table th:first-child { border-radius: 10px 0 0 10px; }
.table th:last-child { border-radius: 0 10px 10px 0; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--brand-50); }
.table tr.is-selected { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand); }
.table .num { text-align: right; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]::after { content: "\21C5"; margin-left: 6px; opacity: .4; }
.table th[data-dir="asc"]::after { content: "\2191"; opacity: 1; color: var(--brand); }
.table th[data-dir="desc"]::after { content: "\2193"; opacity: 1; color: var(--brand); }
.empty-row { text-align: center; color: var(--muted); padding: 24px !important; }
.who { display: flex; align-items: center; gap: 10px; }
.who a { font-weight: 700; display: block; }
.who a:hover { color: var(--brand); }
.who small { display: block; font-size: 11px; }
.thumb {
    width: 40px; height: 40px; border-radius: 10px; flex: none; display: grid; place-items: center;
    background: linear-gradient(135deg, color-mix(in srgb, var(--c) 85%, #fff), var(--c)); color: #fff; font-size: 17px;
}
.badge {
    display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
    background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c);
}
.who .badge { margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; }
@media (max-width: 1440px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.coming-soon { text-align: center; padding: 64px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.coming-soon .kpi-icon { --c: var(--brand); }
.coming-soon p { max-width: 460px; margin: 0; }

/* ---------- Auth ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
    radial-gradient(circle at 10% 10%, var(--brand-100), transparent 40%),
    radial-gradient(circle at 90% 90%, #EDE9FE, transparent 40%), var(--bg); }
.auth-wrap { display: grid; grid-template-columns: 1.1fr 1fr; width: min(980px, 100%); background: var(--surface); border-radius: 24px; overflow: hidden; box-shadow: 0 30px 80px rgba(16, 24, 40, .12); }
.auth-art { background: var(--brand-grad); color: #fff; padding: 48px; display: flex; flex-direction: column; gap: 18px; }
.auth-logo { height: 48px; align-self: flex-start; background: #fff; padding: 8px 14px; border-radius: 14px; }
.auth-art h1 { font-size: 32px; line-height: 1.15; }
.auth-art p { opacity: .92; margin: 0; }
.auth-art ul { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 12px; font-weight: 600; }
.auth-art li i { background: rgba(255, 255, 255, .2); padding: 6px 8px; border-radius: 8px; margin-right: 8px; }
.auth-card { padding: 48px; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.auth-card h2 { font-size: 24px; }
.auth-card p { margin: 0; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
.auth-card input { height: 46px; border: 1px solid var(--border); border-radius: 12px; padding: 0 14px; background: var(--surface-2); outline: 0; }
.auth-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.auth-card .btn { height: 48px; margin-top: 6px; }
.alert { background: #FEE2E2; color: #B91C1C; padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 1500px) {
    .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .kpi-hero { grid-column: span 2; }
    .grid-main {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-template-areas: "rem rev rev rev" "rem brk dis dis" "users users deals deals";
    }
}
@media (max-width: 1100px) {
    .grid-main { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "rev rev" "rem users" "brk dis" "deals deals"; }
    .traffic-body, .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .traffic-chart { height: 360px; }
    .topbar-search { display: none; }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
    .sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
    .sidebar-open .sidebar-backdrop { position: fixed; inset: 0; background: rgba(15, 17, 23, .4); z-index: 35; }
    .main, .sb-collapsed .main { margin-left: 0; }
    .sb-collapsed .nav-link span, .sb-collapsed .sidebar-foot { display: initial; }
    .sb-collapsed .nav-link { justify-content: flex-start; padding: 11px 14px; }
    .sb-collapsed .brand-full { display: block; } .sb-collapsed .brand-mark { display: none; }
    .auth-wrap { grid-template-columns: 1fr; } .auth-art { display: none; }
}
@media (max-width: 640px) {
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .user-meta { display: none; }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main { grid-template-columns: minmax(0, 1fr); grid-template-areas: "rev" "users" "deals" "brk" "dis" "rem"; }
    .deals-body { grid-template-columns: minmax(0, 1fr); }
    .select select { max-width: 130px; }
    .auth-card { padding: 28px; }
}

/* ==========================================================================
   Brokers module & shared components
   ========================================================================== */
.block { display: block; }
.center { text-align: center; }
.inline { display: inline; margin: 0; }
.verified { color: var(--teal); }
.warn-text { color: #B45309; font-weight: 600; margin-top: 3px; }
[data-theme="dark"] .warn-text { color: #FBBF24; }
.tone-teal { --c: var(--teal); }
.span-all { grid-column: 1 / -1; }

/* Buttons */
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 9px; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #16A34A; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-soft { background: #FEE2E2; color: #B91C1C; }
.btn-danger-soft:hover { background: #FECACA; }
[data-theme="dark"] .btn-danger-soft { background: #3B1616; color: #F87171; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 14px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 700; cursor: pointer; font-size: 13px; }
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Flash messages */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; font-weight: 600; border: 1px solid; }
.flash span { flex: 1; }
.flash-success { background: #ECFDF5; color: #047857; border-color: #A7F3D0; }
.flash-error { background: #FEF2F2; color: #B91C1C; border-color: #FECACA; }
.flash-info { background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE; }
[data-theme="dark"] .flash-success { background: #0F2A1E; color: #6EE7B7; border-color: #14532D; }
[data-theme="dark"] .flash-error { background: #2A1212; color: #FCA5A5; border-color: #7F1D1D; }
.flash-close { background: none; border: 0; font-size: 20px; cursor: pointer; color: inherit; opacity: .6; }
.flash-float { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; box-shadow: var(--shadow); min-width: 300px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 10px 16px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab .count { background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 1px 8px; font-size: 11px; color: var(--muted); }
.tab.active .count { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand); }
.tab .count.warn { background: #FEF3C7; border-color: #FDE68A; color: #B45309; }

/* List toolbar */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.toolbar select, .search-input {
    height: 40px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 0 10px; font-weight: 600; font-size: 13px;
}
.search-input { display: flex; align-items: center; gap: 8px; flex: 1 1 260px; color: var(--muted); }
.search-input input { border: 0; background: transparent; outline: 0; width: 100%; color: var(--text); }
.toolbar select:focus, .search-input:focus-within { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.toolbar .btn { height: 40px; }
tr.row-link { cursor: pointer; }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; font-size: 13px; }
.pager { display: flex; gap: 4px; }
.pager a { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--border); font-weight: 700; padding: 0 8px; }
.pager a:hover { border-color: var(--brand); color: var(--brand); }
.pager a.active { background: var(--brand-grad); color: #fff; border-color: transparent; }
.pager a.disabled { opacity: .4; pointer-events: none; }

/* Forms */
.form-card { display: flex; flex-direction: column; gap: 8px; padding: 28px; }
.form-section { border: 0; padding: 0 0 22px; margin: 0 0 12px; border-bottom: 1px dashed var(--border); min-width: 0; }
.form-section legend { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 0; }
.step { width: 28px; height: 28px; border-radius: 8px; background: var(--brand-grad); color: #fff; display: grid; place-items: center; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid.compact { gap: 12px 14px; }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; min-width: 0; }
.field-label { font-weight: 600; font-size: 13px; }
.field input, .field select, .field textarea, .area-row select, .area-row input, .doc-actions input:not([type=file]) {
    height: 44px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; background: var(--surface-2); outline: 0; width: 100%; font-weight: 500;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .area-row select:focus, .area-row input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); background: var(--surface); }
.field.has-error input, .field.has-error select, .has-error .input-prefix { border-color: var(--red); }
.field-error { color: var(--red); font-weight: 600; font-size: 12px; }
.hint { color: var(--muted); font-weight: 500; font-size: 12px; }
input.upper { text-transform: uppercase; }
.input-prefix { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.input-prefix span { display: grid; place-items: center; padding: 0 12px; color: var(--muted); background: var(--surface); border-right: 1px solid var(--border); font-size: 12px; white-space: nowrap; }
.input-prefix input { border: 0 !important; border-radius: 0; box-shadow: none !important; }
.input-prefix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { position: relative; }
.chip input, .field .chip input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--border); font-weight: 600; cursor: pointer; transition: all .15s; }
.chip input:checked + span { background: var(--brand-50); border-color: var(--brand); color: var(--brand); }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-100); }
.chip-tag { padding: 4px 10px; border-radius: 99px; background: var(--brand-50); color: var(--brand); font-weight: 700; font-size: 12px; }

.area-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.area-row { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; gap: 8px; align-items: center; }

.docs-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.upload { position: relative; display: flex; gap: 12px; align-items: center; padding: 14px; border: 1.5px dashed var(--border); border-radius: 12px; cursor: pointer; transition: all .15s; flex-wrap: wrap; }
.upload:hover, .upload:focus-within { border-color: var(--brand); background: var(--brand-50); }
.upload.has-file { border-style: solid; border-color: var(--green); }
.upload.has-error { border-color: var(--red); }
.upload input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.upload { min-width: 0; overflow: hidden; }
.upload-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); font-size: 18px; flex: none; }
.upload-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.upload-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload .field-error { flex-basis: 100%; }

.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--brand); width: 16px; height: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.form-actions.tight { justify-content: space-between; margin-top: 0; }

/* Profile */
.profile-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.who.big { gap: 16px; }
.who.big h1 { font-size: 22px; }
.who.big p { margin: 2px 0 8px; }
.avatar.xl { width: 64px; height: 64px; font-size: 22px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: color-mix(in srgb, var(--c) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.callout > i { color: var(--c); font-size: 18px; }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.stat > i { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); font-size: 18px; }
.stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.stat strong { font-size: 20px; font-weight: 800; }
.grid-2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.details { margin: 0; }
.details > div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.details > div:last-child { border-bottom: 0; }
.details dt { color: var(--muted); font-weight: 600; }
.details dd { margin: 0; font-weight: 600; word-break: break-word; }
.details.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.details.two-col > div:nth-last-child(2) { border-bottom: 0; }
.area-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.area-item { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.area-item i { font-size: 18px; }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.doc-card { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 12px; }
.doc-preview { width: 52px; height: 64px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--c); font-size: 24px; flex: none; }
a.doc-preview:hover { background: color-mix(in srgb, var(--c) 22%, transparent); }
.doc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.doc-title { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.doc-body small { overflow-wrap: anywhere; }
.doc-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.doc-actions input:not([type=file]) { height: 32px; flex: 1 1 140px; font-size: 12px; }
.doc-actions input[type=file] { font-size: 12px; flex: 1 1 160px; min-width: 0; }

.sub-summary { border-top: 4px solid var(--c); display: flex; flex-direction: column; gap: 6px; }
.sub-summary .kpi-value { color: var(--c); }
.sub-summary p { margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { display: flex; gap: 14px; padding: 0 0 18px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 17px; top: 36px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.tl-icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--c); }

/* Dialogs */
.dialog { border: 0; border-radius: 18px; padding: 0; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
.dialog::backdrop { background: rgba(15, 17, 23, .45); backdrop-filter: blur(2px); }
.dialog form { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.dialog h2 { font-size: 18px; }
.dialog p { margin: 0; }

/* Broker portal */
.auth-page .step-pill { align-self: flex-start; background: var(--brand-50); color: var(--brand); font-weight: 700; font-size: 12px; padding: 4px 10px; border-radius: 99px; }
.auth-card.solo { width: min(440px, 100%); background: var(--surface); border-radius: 24px; box-shadow: 0 30px 80px rgba(16, 24, 40, .12); }
.solo-logo { height: 44px; align-self: flex-start; }
.otp-input { font-size: 26px; letter-spacing: 12px; text-align: center; font-weight: 800; }
.otp-foot { display: flex; justify-content: space-between; gap: 10px; }
.alert.ok { background: #ECFDF5; color: #047857; }
.alert.info { background: #EFF6FF; color: #1D4ED8; }
.alert code { font-size: 12px; }
.auth-wide { display: block; padding: 32px 16px; }
.register-wrap { width: min(980px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.register-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.register-head > div { flex: 1 1 360px; }
.register-head h1 { font-size: 24px; }
.register-head p { margin: 4px 0 0; }
.content.narrow { max-width: 1100px; margin: 0 auto; width: 100%; }
.status-hero { display: flex; gap: 18px; align-items: center; border-left: 5px solid var(--c); }
.status-hero .kpi-icon { --c: inherit; }
.status-hero h1 { font-size: 20px; }
.status-hero p { margin: 4px 0 0; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.checklist li { display: flex; gap: 10px; align-items: center; color: var(--muted); font-weight: 600; }
.checklist li.ok { color: var(--text); }
.checklist li.ok i { color: var(--green); }
.checklist i { font-size: 18px; }

@media (max-width: 1100px) {
    .mini-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-2.even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .form-grid, .details.two-col { grid-template-columns: minmax(0, 1fr); }
    .span-2 { grid-column: auto; }
    .form-card { padding: 18px; }
    .area-row { grid-template-columns: minmax(0, 1fr) auto; }
    .area-row input { grid-column: 1; grid-row: 2; }
    .area-row button { grid-row: 1 / span 2; grid-column: 2; }
    .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .details > div { grid-template-columns: 1fr; gap: 2px; }
    .doc-grid { grid-template-columns: minmax(0, 1fr); }
}
.form-section > .field + .field { margin-top: 18px; }

/* ==========================================================================
   Properties module
   ========================================================================== */
.content.wide { max-width: 1440px; margin: 0 auto; width: 100%; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack form { margin: 0; }
.back-link { color: var(--muted); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.back-link:hover { color: var(--brand); }
.avatar.xs { width: 24px; height: 24px; font-size: 10px; }
.who.sm { gap: 6px; font-weight: 600; font-size: 12px; min-width: 0; }
.thumb.img { object-fit: cover; padding: 0; }
.details.compact > div { grid-template-columns: 70px 1fr; padding: 7px 0; font-size: 13px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-section.private { background: color-mix(in srgb, var(--violet) 5%, transparent); border: 1px dashed color-mix(in srgb, var(--violet) 35%, transparent); border-radius: 14px; padding: 18px; }
.chips.tight .chip span { padding: 6px 12px; }
[hidden] { display: none !important; }

/* Segmented toggle */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; gap: 4px; }
.segmented.full { display: flex; }
.segmented.full label { flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 9px; font-weight: 700; color: var(--muted); cursor: pointer; transition: all .15s; }
.segmented input:checked + span { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); }

/* Maps */
.map-picker, .map-view { height: 280px; border-radius: 12px; border: 1px solid var(--border); overflow: hidden; z-index: 0; }
.map-view { height: 300px; }
.leaflet-container { font: inherit; }

/* Photo previews / management */
.upload.big { padding: 22px; }
.photo-previews, .photo-manage { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.photo-manage.wide { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin: 0; }
.photo-previews figure, .photo-manage figure { margin: 0; position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; border: 2px solid transparent; }
.photo-manage figure.cover, .photo-previews figure:first-child { border-color: var(--brand); }
.photo-previews img, .photo-manage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-previews figcaption, .photo-manage figcaption { position: absolute; left: 6px; top: 6px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 6px; }
.photo-actions { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.photo-manage figure:hover .photo-actions, .photo-manage figure:focus-within .photo-actions { opacity: 1; }
.photo-actions form { margin: 0; }
.photo-actions button { width: 28px; height: 28px; border-radius: 8px; border: 0; background: rgba(15, 17, 23, .7); color: #fff; cursor: pointer; display: grid; place-items: center; }
.photo-actions button:hover { background: var(--brand); }
@media (hover: none) { .photo-actions { opacity: 1; } }

/* Listing page */
.listing-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.listing-head h1 { font-size: 24px; margin: 8px 0 4px; }
.listing-head p { margin: 0; }
.listing-price { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.listing-price strong { font-size: 28px; font-weight: 800; color: var(--brand); letter-spacing: -.02em; }
.listing-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.listing-main, .listing-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.listing-side { position: sticky; top: calc(var(--topbar-h) + 16px); }
.gallery-card { padding: 8px; }
.gallery { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; height: 420px; }
.gallery:not(:has(.gallery-thumbs)) { grid-template-columns: 1fr; }
.gallery a { display: block; position: relative; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.gallery a:hover img { transform: scale(1.03); }
.gallery-thumbs { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; }
.gallery-thumbs a.more::after { content: attr(data-more); position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15, 17, 23, .55); color: #fff; font-size: 22px; font-weight: 800; }
.gallery-empty { height: 260px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); font-weight: 700; }
.gallery-empty i { font-size: 40px; }
.photo-count { position: absolute; right: 10px; bottom: 10px; background: rgba(15, 17, 23, .7); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.fact { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.fact i { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: none; }
.fact span { display: block; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.fact strong { font-size: 14px; }
.prose { line-height: 1.7; color: var(--text); max-width: 75ch; }
.amenities { display: flex; flex-wrap: wrap; gap: 8px; }
.amenities span { display: inline-flex; gap: 6px; align-items: center; padding: 7px 12px; border-radius: 99px; background: color-mix(in srgb, var(--green) 10%, transparent); color: #15803D; font-weight: 600; font-size: 13px; }
[data-theme="dark"] .amenities span { color: #4ADE80; }
.contact-card .who { margin-bottom: 14px; }
.contact-reveal { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.owner-card { border: 1px dashed color-mix(in srgb, var(--violet) 40%, transparent); }
.enquiry-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.enquiry-list li { padding-bottom: 12px; border-bottom: 1px dashed var(--border); }
.enquiry-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.enquiry-list p { margin: 6px 0 0; font-size: 13px; }
.enq-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.timeline.compact li { padding-bottom: 12px; font-size: 13px; }
.timeline.compact .tl-icon { width: 24px; height: 24px; }
.timeline.compact li::before { left: 11px; top: 26px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(10, 11, 15, .92); display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.lightbox button { position: absolute; background: rgba(255, 255, 255, .12); color: #fff; border: 0; width: 48px; height: 48px; border-radius: 50%; font-size: 28px; cursor: pointer; display: grid; place-items: center; }
.lightbox button:hover { background: var(--brand); }
.lb-close { top: 20px; right: 20px; }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-count { position: absolute; bottom: 20px; color: #fff; font-weight: 700; }

/* Property cards */
.prop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.prop-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.prop-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(16, 24, 40, .1); }
.prop-media { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 25%, var(--surface)), color-mix(in srgb, var(--c) 55%, var(--surface))); color: var(--c); font-size: 42px; }
.prop-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.prop-tags { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 8px; background: rgba(255, 255, 255, .95); color: var(--text); box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.tag-sale { color: var(--violet); }
.tag-rent { color: var(--teal); }
.tag-excl { background: var(--brand-grad); color: #fff; }
.tag-status { color: var(--c); }
.heart { position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .95); color: #6B7280; cursor: pointer; display: grid; place-items: center; font-size: 16px; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); transition: transform .15s; }
.heart:hover { transform: scale(1.1); color: var(--red); }
.heart.on, .heart-btn.on { color: var(--red); }
.prop-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.prop-price { font-size: 20px; font-weight: 800; color: var(--brand); letter-spacing: -.01em; }
.prop-price small { font-size: 11px; color: var(--muted); font-weight: 600; }
.prop-title { font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prop-title:hover { color: var(--brand); }
.prop-meta { color: var(--text); font-size: 13px; font-weight: 600; }
.prop-loc { color: var(--muted); font-size: 13px; }
.prop-foot { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--border); display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; }
.prop-wrap { display: flex; flex-direction: column; gap: 6px; }
.prop-stats { display: flex; gap: 12px; font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 4px; align-items: center; }
.prop-stats .link { margin-left: auto; }

/* Search */
.search-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px; align-items: start; }
.search-filters { display: flex; flex-direction: column; gap: 14px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.search-filters .field input, .search-filters .field select { height: 40px; }
.search-results { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sort-select { height: 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 0 10px; font-weight: 600; }

/* Broker portal nav & home */
.dot-count { background: var(--red); color: #fff; font-size: 10px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.quick { display: flex; gap: 12px; align-items: center; transition: transform .15s; }
.quick:hover { transform: translateY(-2px); }
.quick > i { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); font-size: 20px; flex: none; }
.quick strong { display: block; }
.quick span { color: var(--muted); font-size: 12px; }

/* Enquiries */
.enquiry-cards { display: flex; flex-direction: column; gap: 12px; }
.enquiry-card { display: flex; flex-direction: column; gap: 10px; }
.enquiry-card.is-new { border-left: 4px solid var(--amber); }
.enq-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.enq-prop { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.enq-prop span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.enq-prop b { color: var(--brand); }
.enq-prop:hover { border-color: var(--brand); }
.enq-msg { margin: 0; line-height: 1.6; }
.enq-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline-flex; gap: 8px; margin: 0; }

@media (max-width: 1200px) {
    .listing-layout { grid-template-columns: minmax(0, 1fr); }
    .listing-side { position: static; }
    .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .search-layout { grid-template-columns: minmax(0, 1fr); }
    .search-filters { position: static; }
    .gallery { height: 300px; grid-template-columns: 1fr; }
    .gallery-thumbs { display: none; }
    .form-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .hide-sm { display: none !important; }
    .listing-price { align-items: flex-start; text-align: left; }
    .quick-grid { grid-template-columns: minmax(0, 1fr); }
    .form-grid.three { grid-template-columns: minmax(0, 1fr); }
    .gallery { height: 240px; }
    .photo-actions { opacity: 1; }
}
.field textarea { font-family: inherit; line-height: 1.5; }
.field > .segmented { align-self: flex-start; }
@media (max-width: 640px) { .broker-top [data-action="toggle-theme"] { display: none; } .broker-top .user-btn .bi-chevron-down { display: none; } }

/* ==========================================================================
   Deals module
   ========================================================================== */
.deal-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(0, 1.5fr); gap: 12px; }
.deal-kpis .kpi:not(.kpi-hero) { flex-direction: row; align-items: center; gap: 12px; justify-content: flex-start; }
.deal-kpis .kpi.selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-100); }
.deal-kpis .kpi-value { font-size: 22px; margin: 0; }
.seg-link { padding: 8px 14px; border-radius: 9px; font-weight: 700; color: var(--muted); font-size: 13px; }
.seg-link.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.deal-toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs.flat { border-bottom: 0; }
.toolbar.tight { margin-bottom: 8px; }
.toolbar.tight .search-input { flex: 0 1 300px; }
.subtabs { display: flex; gap: 6px; margin-bottom: 12px; }
.subtabs a { padding: 6px 12px; border-radius: 99px; font-weight: 700; font-size: 12px; color: var(--muted); border: 1px solid var(--border); }
.subtabs a.on { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); }
.deals-table td { vertical-align: middle; }
.deals-table .clip { max-width: 240px; white-space: normal; color: var(--muted); font-size: 13px; }
.strong-link { font-weight: 700; }
.strong-link:hover { color: var(--brand); }
tr.needs-action { box-shadow: inset 3px 0 0 var(--amber); }
.you { font-size: 10px; font-weight: 800; color: var(--brand); background: var(--brand-50); padding: 1px 6px; border-radius: 6px; text-transform: uppercase; }
.row-menu { position: relative; display: inline-block; }
.row-menu .dropdown-menu { right: 0; top: calc(100% + 4px); z-index: 20; text-align: left; min-width: 190px; }
.row-menu.open .dropdown-menu { display: block; }
.enq-link { display: block; }
.enq-link:hover strong { color: var(--brand); }

.dialog.wide { width: min(860px, calc(100vw - 32px)); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.deal-parties { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.party { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); min-width: 0; }
.party > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.party strong { overflow-wrap: anywhere; }
.party.prop img, .party-ph { width: 84px; height: 68px; border-radius: 10px; object-fit: cover; flex: none; }
.party-ph { display: grid; place-items: center; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); font-size: 26px; }
.party .price { color: var(--brand); font-size: 16px; }
.party .phone { color: var(--brand); font-weight: 700; font-size: 13px; }
.deal-parties.big .party { background: var(--surface); padding: 16px; }
a.party:hover { border-color: var(--brand); }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.commission-input { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.radio-inline { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; cursor: pointer; }
.radio-inline input { accent-color: var(--brand); width: 16px; height: 16px; }
.commission-input .input-prefix { flex: 1 1 180px; max-width: 260px; }
.commission-input .input-prefix input { height: 42px; padding: 0 12px; background: transparent; outline: 0; width: 100%; font-weight: 700; }

.deal-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.deal-head h1 { font-size: 20px; margin-top: 8px; }
.deal-head p { margin: 6px 0 0; }
.deal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.deal-actions form { margin: 0; }
.deal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.deal-side { display: flex; flex-direction: column; gap: 16px; }
.thread { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow-y: auto; }
.thread .event { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); padding: 0 4px; }
.thread .event span { flex: 1; }
.thread .event time { white-space: nowrap; }
.thread .msg { max-width: 80%; padding: 12px 14px; border-radius: 14px 14px 14px 4px; background: var(--surface-2); border: 1px solid var(--border); }
.thread .msg.mine { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: var(--brand-50); border-color: var(--brand-100); }
.msg-meta { font-size: 12px; color: var(--muted); }
.msg-meta strong { color: var(--text); }
.thread .msg p { margin: 6px 0 0; line-height: 1.55; }
.proposal { color: var(--brand); font-weight: 800; margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.reply { display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--border); padding-top: 14px; }
.reply textarea { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); resize: vertical; font-family: inherit; outline: 0; }
.reply textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.counter summary { cursor: pointer; font-weight: 700; color: var(--brand); font-size: 13px; list-style: none; }
.counter[open] summary { margin-bottom: 10px; }
.big-number { font-size: 30px; font-weight: 800; color: var(--brand); letter-spacing: -.02em; }
.details.wide-dt > div { grid-template-columns: 140px 1fr; }

.perf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.perf { padding: 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.perf:first-child { background: var(--brand-50); border-color: var(--brand-100); }
.perf-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.perf-main { font-size: 26px; font-weight: 800; color: var(--brand); letter-spacing: -.02em; }
.perf dl { margin: 10px 0 0; display: grid; gap: 6px; }
.perf dl div { display: flex; justify-content: space-between; font-size: 13px; }
.perf dt { color: var(--muted); }
.perf dd { margin: 0; font-weight: 700; }

@media (max-width: 1300px) { .deal-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .deal-layout { grid-template-columns: minmax(0, 1fr); } .deal-parties { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .deal-kpis, .perf-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .deal-kpis .kpi-hero { grid-column: span 2; } .perf-grid { grid-template-columns: minmax(0, 1fr); } .thread .msg { max-width: 95%; } }
.ho-note { margin: 8px 0 0; color: var(--brand); font-weight: 600; font-size: 13px; }
.ho-card { border: 1px solid var(--brand-100); background: linear-gradient(180deg, var(--brand-50), var(--surface)); }
.party.field select { height: 40px; }
.party.field { flex-direction: column; align-items: stretch; }
.ho-tag { color: var(--brand); font-weight: 800; }

/* ==========================================================================
   Disputes module
   ========================================================================== */
.deal-kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.deal-kpis.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ticket-body { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 14px; line-height: 1.6; }
.ticket-body p { margin: 0; }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.attachment { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; font-weight: 600; }
.attachment:hover { border-color: var(--brand); color: var(--brand); }
.attachment i { color: var(--brand); }
.attachment small { color: var(--muted); font-weight: 500; }
.thread .msg.staff { border-color: color-mix(in srgb, var(--violet) 30%, transparent); background: color-mix(in srgb, var(--violet) 7%, var(--surface)); }
.thread .msg.note { border: 1px dashed var(--amber); background: color-mix(in srgb, var(--amber) 10%, var(--surface)); }
.thread .msg.mine { align-self: flex-end; }
.role-tag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 6px; background: color-mix(in srgb, var(--violet) 14%, transparent); color: var(--violet); margin-left: 4px; }
.role-tag.fr { background: color-mix(in srgb, var(--teal) 14%, transparent); color: var(--teal); }
.role-tag.note { background: color-mix(in srgb, var(--amber) 18%, transparent); color: #B45309; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.people li { display: flex; gap: 10px; align-items: flex-start; }
.people li > div { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.people a { font-weight: 700; }
.involve { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.involve small { font-weight: 500; opacity: .8; }
.dropzone { border-style: dashed; justify-content: center; text-align: left; }
.dot-count.soft { background: var(--amber); }
@media (max-width: 1100px) { .deal-kpis.four, .deal-kpis.five { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ==========================================================================
   Referrals
   ========================================================================== */
.quick-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important; }
.tone-pink { --c: var(--pink); }
.ref-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
.ref-layout.wide-right { grid-template-columns: minmax(0, 1fr) 300px; }
.leaderboard { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.leaderboard li { display: flex; align-items: center; gap: 10px; }
.leaderboard a { flex: 1; min-width: 0; font-weight: 700; }
.leaderboard a:hover { color: var(--brand); }
.leaderboard strong { font-size: 18px; color: var(--green); }
.rank { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; background: var(--surface-2); color: var(--muted); flex: none; }
.rank.r1 { background: #FDE68A; color: #92400E; } .rank.r2 { background: #E5E7EB; color: #374151; } .rank.r3 { background: #FED7AA; color: #9A3412; }
a.area-item:hover { border-color: var(--brand); }
@media (max-width: 1100px) { .ref-layout, .ref-layout.wide-right { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1500px) { .ref-layout.wide-right { grid-template-columns: minmax(0, 1fr); } .ref-layout.wide-right .leaderboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 20px; } }

/* ---------- Clients & invoicing ---------- */
.logo-field { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.logo-preview { width: 150px; height: 64px; border: 1px dashed var(--border); border-radius: 10px; display: grid; place-items: center; background: #fff; color: var(--muted); font-size: 22px; overflow: hidden; flex: none; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.upload.compact { flex: 1; min-width: 200px; padding: 10px 14px; }
.check.small { font-size: 12px; }
.contact-line { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 0; font-weight: 600; }
.contact-line i { margin-right: 4px; }
.who.big .avatar.xl { flex: none; }
.note-form { display: flex; flex-direction: column; gap: 10px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px dashed var(--border); }
.note-form .segmented { flex-wrap: wrap; align-self: flex-start; }
.note-form .segmented span { padding: 6px 12px; font-size: 12px; }
.note-form textarea { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); resize: vertical; width: 100%; font: inherit; color: inherit; }
.note-form textarea:focus { border-color: var(--brand); outline: 0; box-shadow: 0 0 0 3px var(--brand-50); }
.note-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.inline-field { flex-direction: row; align-items: center; gap: 8px; }
.inline-field input { height: 36px !important; width: auto !important; }

.form-grid.one { grid-template-columns: minmax(0, 1fr); }
.sticky-side { position: sticky; top: calc(var(--topbar-h) + 12px); }
.quick-due { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted); }
.chip-btn:hover { border-color: var(--brand); color: var(--brand); }
.items-wrap { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; margin-top: 14px; }
.items-wrap.has-error .items-table { outline: 1px solid var(--red); border-radius: 10px; }
.items-table { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.items-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 0 6px; }
.items-table td { padding: 0 6px 0 0; vertical-align: middle; }
.items-table input { height: 40px; border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; background: var(--surface-2); width: 100%; font: inherit; color: inherit; outline: 0; }
.items-table input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); background: var(--surface); }
.items-table .c-sac { width: 96px; } .items-table .c-qty { width: 70px; } .items-table .c-rate { width: 130px; }
.items-table .c-amt { width: 130px; text-align: right; font-weight: 700; white-space: nowrap; }
.items-table th.c-amt, .items-table th.c-rate, .items-table th.c-qty { text-align: right; }
.items-table .c-qty input, .items-table .c-rate input { text-align: right; }
.totals { margin: 16px 0 8px; display: flex; flex-direction: column; gap: 6px; }
.totals > div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.totals dt { color: var(--muted); } .totals dd { margin: 0; font-weight: 600; }
.totals .grand { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; font-size: 20px; }
.totals .grand dt { color: var(--text); font-weight: 800; } .totals .grand dd { font-weight: 800; color: var(--brand); }
.from-card .who { align-items: flex-start; }
.from-logo { max-width: 72px; max-height: 40px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px; }
.pay-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pay-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.pay-list form { margin: 0; }
.deal-actions .user-menu .dropdown-menu { right: 0; left: auto; min-width: 220px; }
@media (max-width: 760px) {
    .items-table thead { display: none; }
    .items-table, .items-table tbody { display: block; }
    .items-table tr.item-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
    .items-table tr.item-row td { width: auto; padding: 0; }
    .items-table td.c-desc { grid-column: 1 / -1; }
    .items-table td.c-amt { grid-column: 1 / 4; text-align: left; }
}

/* The invoice itself: always printed on white paper, A4 proportions */
.invoice-layout { grid-template-columns: minmax(0, 1fr) 320px; }
.invoice-paper { min-width: 0; overflow-x: auto; }
.invoice-doc { position: relative; background: #fff; color: #1F2433; border: 1px solid #E5E7EB; border-radius: 12px; box-shadow: var(--shadow); padding: 40px 44px; max-width: 860px; margin: 0 auto; font-size: 13px; line-height: 1.5; overflow: hidden; }
.invoice-doc h1, .invoice-doc h2, .invoice-doc h3 { margin: 0; }
.invoice-doc p { margin: 0; }
.invoice-doc .muted { color: #6B7280; }
.inv-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 20px; border-bottom: 3px solid #F26B1D; flex-wrap: wrap; }
.inv-from { display: flex; flex-direction: column; gap: 4px; max-width: 420px; }
.inv-logo { max-width: 200px; max-height: 72px; object-fit: contain; align-self: flex-start; margin-bottom: 6px; }
.inv-from h2 { font-size: 20px; font-weight: 800; }
.inv-ids { display: flex; gap: 6px 14px; flex-wrap: wrap; margin-top: 4px !important; font-size: 12px; }
.inv-meta { text-align: right; }
.inv-meta h1 { font-size: 24px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: #F26B1D; margin-bottom: 10px; }
.inv-meta dl { margin: 0; display: grid; gap: 4px; }
.inv-meta dl > div { display: flex; justify-content: flex-end; gap: 12px; }
.inv-meta dt { color: #6B7280; } .inv-meta dd { margin: 0; font-weight: 700; min-width: 120px; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 20px 0; }
.invoice-doc h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #9CA3AF; font-weight: 700; margin-bottom: 6px; }
.inv-parties strong { font-size: 15px; display: block; }
.inv-items { width: 100%; border-collapse: collapse; }
.inv-items th { background: #FFF4EC; color: #1F2433; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 10px; }
.inv-items td { padding: 10px; border-bottom: 1px solid #EEF0F4; vertical-align: top; }
.inv-items .num { text-align: right; white-space: nowrap; }
.inv-items th:first-child, .inv-items td:first-child { width: 28px; }
.inv-bottom { display: grid; grid-template-columns: 1fr 300px; gap: 24px; padding: 18px 0; }
.inv-words p { font-weight: 600; }
.inv-totals { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.inv-totals > div { display: flex; justify-content: space-between; gap: 12px; }
.inv-totals dt { color: #6B7280; } .inv-totals dd { margin: 0; font-weight: 600; white-space: nowrap; }
.inv-totals .grand { border-top: 2px solid #1F2433; padding-top: 8px; font-size: 16px; }
.inv-totals .grand dt, .inv-totals .grand dd { color: #1F2433; font-weight: 800; }
.inv-totals .grand.due { border-top-width: 1px; color: #F26B1D; }
.inv-totals .grand.due dd, .inv-totals .grand.due dt { color: #E8590C; }
.inv-foot { display: grid; grid-template-columns: 1fr 260px; gap: 24px; padding: 18px 0; border-top: 1px solid #EEF0F4; align-items: end; }
.inv-bank dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; }
.inv-bank dl > div { display: contents; }
.inv-bank dt { color: #6B7280; } .inv-bank dd { margin: 0; font-weight: 700; }
.inv-sign { display: flex; flex-direction: column; align-items: flex-end; gap: 40px; text-align: right; }
.sign-line { border-top: 1px solid #9CA3AF; padding-top: 6px; min-width: 200px; font-weight: 700; display: flex; flex-direction: column; }
.sign-line small { color: #6B7280; font-weight: 500; }
.inv-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 14px 0; border-top: 1px solid #EEF0F4; font-size: 12px; color: #4B5563; }
.inv-cancel { color: #B91C1C; font-weight: 700; padding-top: 8px; }
.inv-credit { text-align: center; color: #9CA3AF; font-size: 11px; padding-top: 14px; }
.inv-stamp { position: absolute; top: 46%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg); font-size: 96px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em;
    border: 8px solid currentColor; border-radius: 18px; padding: 0 28px; opacity: .1; pointer-events: none; color: #6B7280; white-space: nowrap; }
.stamp-paid .inv-stamp { color: #16A34A; opacity: .14; }
.stamp-cancelled .inv-stamp { color: #DC2626; opacity: .14; }
@media (max-width: 1300px) { .invoice-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
    .invoice-doc { padding: 22px 18px; }
    .inv-meta { text-align: left; } .inv-meta dl > div { justify-content: flex-start; }
    .inv-parties, .inv-bottom, .inv-foot, .inv-notes { grid-template-columns: minmax(0, 1fr); }
    .inv-sign { align-items: flex-start; text-align: left; }
    .inv-stamp { font-size: 54px; }
}

/* Client's public invoice page */
.public-invoice { background: var(--bg); padding: 0 16px 40px; }
.public-bar { max-width: 860px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 0; flex-wrap: wrap; }
.public-bar > div:first-child { display: flex; flex-direction: column; }

@media print {
    @page { size: A4; margin: 12mm; }
    body, .public-invoice { background: #fff !important; padding: 0 !important; }
    .topbar, .sidebar, .sidebar-backdrop, .footer, .flash, .no-print, .back-link, dialog { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; max-width: none !important; }
    .deal-layout, .invoice-layout { display: block !important; }
    .invoice-doc { border: 0; box-shadow: none; border-radius: 0; padding: 0; max-width: none; }
    .inv-head { flex-wrap: nowrap; }
    .inv-parties, .inv-notes { grid-template-columns: 1fr 1fr !important; }
    .inv-bottom { grid-template-columns: 1fr 300px !important; }
    .inv-foot { grid-template-columns: 1fr 260px !important; }
    .inv-items th, .inv-meta h1 { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .inv-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.topbar-actions .btn { white-space: nowrap; }
.deal-toolbar .toolbar.tight { flex-wrap: nowrap; }
@media (max-width: 640px) { .deal-toolbar .toolbar.tight { flex-wrap: wrap; } }
.field input[readonly] { background: var(--bg); color: var(--muted); cursor: not-allowed; }
@media screen and (max-width: 640px) {
    .inv-items th, .inv-items td { padding: 8px 6px; font-size: 12px; }
    .inv-items th:nth-child(3), .inv-items td:nth-child(3), .inv-items th:nth-child(5), .inv-items td:nth-child(5) { display: none; }
    .public-bar .deal-actions { width: 100%; } .public-bar .deal-actions .btn { flex: 1; justify-content: center; }
}

/* ---------- CRM ---------- */
.crm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.crm-head h1 { font-size: 24px; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crm-head p { margin: 4px 0 0; }
.crm-owner-tag { font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 99px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.crm-picker .select { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.crm-picker select { border: 0; background: transparent; font-weight: 700; max-width: 260px; outline: 0; color: inherit; }
.crm-tabs { margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.crm-tabs .tab i { margin-right: 4px; }
.crm-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.seg-link { display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--muted); white-space: nowrap; }
.seg-link.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.segmented:has(.seg-link) { flex-wrap: wrap; }
.crm-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.crm-kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.crm-kpis .kpi { flex-direction: row; align-items: center; gap: 12px; justify-content: flex-start; }
.crm-kpis .kpi > div { display: flex; flex-direction: column; min-width: 0; }
.crm-kpis .kpi-value { font-size: 22px; margin: 0; }
.crm-kpis .kpi small { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.small-value { font-size: 16px !important; }
.crm-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.crm-grid > .span-4 { grid-column: span 4; } .crm-grid > .span-5 { grid-column: span 5; } .crm-grid > .span-7 { grid-column: span 7; } .crm-grid > .span-12 { grid-column: span 12; }
.crm-grid .card { min-width: 0; }
.chart-box.short { height: 190px; }
.card-head.sub { margin-top: 16px; }
.mix-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.compact-table { margin-top: 10px; font-size: 12px; }
.compact-table th, .compact-table td { padding: 6px 8px !important; }
.empty-note { padding: 18px 4px; text-align: center; }
.bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 12px; }
.bar-list li { display: grid; grid-template-columns: 140px 1fr 28px; gap: 10px; align-items: center; }
.bar-list li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bar-list .bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: block; }
.bar-list .bar span { display: block; height: 100%; background: var(--c); border-radius: 99px; }
.bar-list b { text-align: right; }
.task-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.task-mini li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.task-mini li:last-child { border-bottom: 0; }
.task-mini li > i { margin-top: 2px; color: var(--muted); }
.task-mini li > div { flex: 1; min-width: 0; }
.task-mini li > div a { font-weight: 700; }
.task-mini li.od > i { color: var(--red); }
.tone-text { color: var(--c) !important; }
.crm-kind { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; margin-right: 4px; background: var(--surface-2); color: var(--muted); }
.crm-kind.kind-franchisee { background: color-mix(in srgb, var(--teal) 14%, var(--surface)); color: var(--teal); }
.crm-kind.kind-ho { background: color-mix(in srgb, var(--blue) 14%, var(--surface)); color: var(--blue); }
.crm-kind.kind-broker { background: color-mix(in srgb, var(--amber) 16%, var(--surface)); color: #B45309; }
.chip-tag.grey { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.tag-cell { display: flex; flex-wrap: wrap; gap: 4px; max-width: 240px; }
th.chk, td.chk { width: 34px; }
td.chk input, th.chk input { accent-color: var(--brand); width: 16px; height: 16px; }
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: var(--brand-50); border: 1px solid var(--brand-100); margin-bottom: 12px; }
.bulk-bar[hidden] { display: none; }
.bulk-bar select, .bulk-bar input { height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; background: var(--surface); color: inherit; }
.toolbar-gap { flex: 1; }

.stage-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.stage-pill { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--c); }
.stage-pill span { font-size: 12px; font-weight: 700; color: var(--muted); } .stage-pill span small { font-weight: 600; opacity: .7; }
.stage-pill strong { font-size: 20px; } .stage-pill > small { color: var(--muted); font-weight: 600; }
.stage-pill.on, .stage-pill:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 40%, transparent); }

.kanban { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)) minmax(170px, .7fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kan-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 10px; min-height: 300px; display: flex; flex-direction: column; }
.kan-col > header { display: flex; align-items: baseline; gap: 8px; padding: 4px 4px 10px; border-bottom: 3px solid var(--c); margin-bottom: 10px; }
.kan-col > header span { font-weight: 800; } .kan-col > header b { font-size: 12px; background: var(--surface); border-radius: 99px; padding: 1px 8px; }
.kan-col > header small { margin-left: auto; color: var(--muted); font-weight: 700; }
.kan-cards { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 120px; border-radius: 10px; transition: background .15s; }
.kan-cards.over, .kan-drop.over { background: color-mix(in srgb, var(--brand) 10%, transparent); outline: 2px dashed var(--brand); outline-offset: 2px; }
.kan-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; cursor: grab; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.kan-card.dragging { opacity: .45; }
.kan-card.moved { animation: kanflash .9s; }
@keyframes kanflash { 0% { box-shadow: 0 0 0 3px var(--brand-100); } 100% { box-shadow: var(--shadow); } }
.kan-top { display: flex; gap: 6px; align-items: flex-start; }
.kan-title { font-weight: 700; font-size: 13px; line-height: 1.3; color: var(--text); }
.kan-title:hover { color: var(--brand); }
.kan-client { color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kan-meta, .kan-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kan-value { margin-left: auto; font-weight: 800; color: var(--green); }
.kan-foot { border-top: 1px dashed var(--border); padding-top: 6px; }
.kan-foot > span:nth-child(2) { margin-left: auto; }
.kan-owner { max-width: 100%; }
.kan-empty { text-align: center; color: var(--muted); font-size: 12px; padding: 30px 0; margin: 0; }
.kan-close { background: transparent; border-style: dashed; gap: 10px; }
.kan-drop { flex: 1; min-height: 110px; border-radius: 12px; display: grid; place-items: center; text-align: center; font-size: 13px; padding: 10px; color: var(--c); border: 2px dashed currentColor; }
.kan-drop.won { --c: var(--green); } .kan-drop.lost { --c: var(--red); }
.kan-drop i { font-size: 20px; display: block; }
.temp { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-size: 11px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); flex: none; }
.temp-badge { display: inline-flex; gap: 4px; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }

.stage-bar { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; padding: 2px; }
.stage-bar form { flex: 1; margin: 0; display: flex; }
.stage-step { flex: 1; min-width: 96px; border: 0; padding: 11px 14px; font-weight: 700; font-size: 13px; cursor: pointer; background: var(--surface); color: var(--muted); border: 1px solid var(--border);
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); white-space: nowrap; }
.stage-bar form:first-child .stage-step { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 10px 0 0 10px; }
.stage-step:hover:not(:disabled) { background: var(--brand-50); color: var(--brand); }
.stage-step.passed { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--brand-600); }
.stage-step.current { background: var(--brand-grad); color: #fff; cursor: default; }
.stage-step.won { flex: .8; } .stage-step.won.current { background: var(--green); }
.stage-step.lost { flex: .6; } .stage-step.lost.current { background: var(--red); color: #fff; }
.lead-rows { list-style: none; margin: 0; padding: 0; }
.lead-rows li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.lead-rows li:last-child { border-bottom: 0; }
.lead-rows li > a { flex: 1; min-width: 0; }
.lead-rows li > b { min-width: 60px; text-align: right; }
.match-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.match-card { display: flex; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; align-items: center; transition: box-shadow .15s; }
.match-card:hover { box-shadow: var(--shadow); border-color: var(--brand-100); }
.match-card img, .match-ph { width: 72px; height: 60px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.match-card > div { min-width: 0; font-size: 12px; } .match-card strong { font-size: 13px; }
.match-card .price { color: var(--brand); }

.task-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.task.od { border-left: 3px solid var(--red); }
.task.done strong { text-decoration: line-through; color: var(--muted); }
.task-list.compact .task { padding: 8px 10px; }
.task-check { margin: 0; }
.check-btn { border: 0; background: none; padding: 0; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; }
.check-btn:hover, .task.done .check-btn { color: var(--green); }
.task-body { flex: 1; min-width: 0; font-size: 13px; }
.task-body strong i { color: var(--muted); font-size: 12px; }
.task-notes { color: var(--muted); margin-top: 4px; font-size: 12px; }
.today-text { color: var(--brand); font-weight: 700; }
.task-more .dropdown-menu { right: 0; left: auto; min-width: 200px; }
.task-day { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; margin: 16px 0 8px; color: var(--muted); }
.task-day:first-of-type { margin-top: 4px; }
.quick-task { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.quick-task input, .quick-task select { height: 38px; border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; background: var(--surface-2); color: inherit; width: 100%; min-width: 0; }
.quick-row { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr) 86px; gap: 6px; }
.col-list { padding-left: 18px; line-height: 1.9; }
.note-foot select { height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 0 8px; background: var(--surface-2); color: inherit; max-width: 220px; }

@media (max-width: 1400px) {
    .crm-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .crm-grid > .span-7, .crm-grid > .span-5 { grid-column: span 12; }
    .crm-grid > .span-4 { grid-column: span 6; }
    .stage-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
    .crm-kpis, .crm-kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .crm-grid > .span-4 { grid-column: span 12; }
    .stage-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bar-list li { grid-template-columns: 110px 1fr 24px; }
    .crm-picker select { max-width: 200px; }
}
@media (max-width: 1640px) and (min-width: 801px) { .crm-kpis:not(.four) { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.crm-kpis .kpi-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mix-pair > div { min-width: 0; }
@media (max-width: 640px) { .mix-pair { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Calendar ---------- */
.tone-cyan { --c: var(--cyan); } .tone-brand { --c: var(--brand); }
.cal-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-nav h2 { margin: 0 6px; font-size: 20px; min-width: 150px; text-align: center; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cal-card { padding: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cal-dow { padding: 8px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; }
.cal-day { min-height: 112px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-width: 0; transition: background .12s; outline: 0; }
.cal-day:hover { background: var(--brand-50); }
.cal-day:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-day.other { background: var(--surface-2); opacity: .55; }
.cal-day.selected { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); box-shadow: inset 0 0 0 2px var(--brand); }
.cal-num { font-weight: 800; font-size: 13px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--brand-grad); color: #fff; }
.cal-day.has-overdue .cal-num::after { content: ""; position: relative; }
.cal-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-chip { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: color-mix(in srgb, var(--c) 75%, var(--text));
    background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-left: 3px solid var(--c); }
.cal-chip:hover { filter: brightness(.95); }
.cal-chip.done { text-decoration: line-through; opacity: .6; }
.cal-more { font-size: 11px; color: var(--muted); font-weight: 700; padding-left: 4px; }
.cal-dots { display: none; gap: 3px; justify-content: center; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); display: block; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 4px 0; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-side { position: sticky; top: calc(var(--topbar-h) + 12px); }
.cal-day-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cal-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 12px; border: 1px solid var(--border); border-left: 4px solid var(--c); cursor: pointer; font-size: 13px; }
.cal-item:hover, .cal-item:focus-visible { background: var(--surface-2); outline: 0; }
.cal-item.done strong { text-decoration: line-through; color: var(--muted); }
.cal-item > div { flex: 1; min-width: 0; }
.cal-item strong i { color: var(--c); }
.cal-item-time { font-weight: 800; font-size: 12px; min-width: 62px; display: flex; flex-direction: column; color: var(--c); }
.cal-item-time small { color: var(--muted); font-weight: 600; }
.dialog.wide { width: min(640px, calc(100vw - 32px)); }
.cal-types { flex-wrap: wrap; }
.cal-types span { padding: 7px 10px; font-size: 12px; }
.form-grid.compact.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cal-ev-head { display: flex; gap: 12px; align-items: flex-start; }
.cal-ev-head h2 { margin: 0; font-size: 18px; }
.cal-ev-head p { margin: 4px 0 0; }
.cal-ev-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); flex: none; }
#calEvent .form-actions form { margin: 0; }

/* Dashboard calendar widget */
.grid-main > .agenda-card { grid-area: rem; }
.agenda-card { display: flex; flex-direction: column; gap: 6px; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 6px; }
.ws-day { display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: 10px; border: 1px solid var(--border); font-size: 11px; color: var(--muted); }
.ws-day strong { font-size: 15px; color: var(--text); }
.ws-day.today { background: var(--brand-grad); border-color: transparent; color: #fff; }
.ws-day.today strong { color: #fff; }
.ws-day:hover:not(.today) { border-color: var(--brand); }
.ws-dot { min-height: 16px; font-weight: 800; font-size: 10px; color: var(--brand); }
.ws-day.today .ws-dot { color: #fff; }
.ag-overdue { display: flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 700; color: var(--red); background: color-mix(in srgb, var(--red) 8%, var(--surface)); padding: 7px 10px; border-radius: 8px; }
.ag-head { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 8px 0 4px; }
.ag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ag-item { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 10px; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 6%, var(--surface)); font-size: 12px; }
.ag-item > a { flex: 1; min-width: 0; }
.ag-item > a strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-item > a strong i { color: var(--c); }
.ag-item.done > a strong { text-decoration: line-through; color: var(--muted); }
.ag-time { min-width: 52px; font-weight: 800; font-size: 11px; color: var(--c); display: flex; flex-direction: column; line-height: 1.25; }
.ag-time b { text-transform: uppercase; font-size: 10px; color: var(--muted); }
.ag-empty { margin: 2px 0 6px; }
.ag-add { margin-top: 8px; }
.agenda-card.wide { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; }
.agenda-card.wide > .card-head, .agenda-card.wide > .week-strip, .agenda-card.wide > .ag-overdue, .agenda-card.wide > .ag-add { grid-column: 1 / -1; }
.agenda-card.wide > .ag-add { justify-self: start; width: auto; }

@media (max-width: 1100px) { .cal-layout { grid-template-columns: minmax(0, 1fr); } .cal-side { position: static; } }
@media (max-width: 760px) {
    .cal-day { min-height: 54px; align-items: center; padding: 4px 2px; }
    .cal-chips, .cal-more { display: none; }
    .cal-dots { display: flex; }
    .cal-dow { padding: 6px 2px; font-size: 10px; }
    .form-grid.compact.three { grid-template-columns: 1fr 1fr; }
    .agenda-card.wide { grid-template-columns: minmax(0, 1fr); }
}
#calEvent > .stack { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
#calEvent .form-actions { justify-content: flex-end; }
#calEvent .form-actions form { padding: 0; margin: 0; display: block; }
#calEvent .form-actions form:first-child { margin-right: auto; }

/* Calendar sync */
.sync-card { margin-bottom: 16px; }
.sync-intro { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.sync-intro > div { flex: 1; min-width: 260px; }
.sync-intro p { margin: 0 0 6px; }
.sync-apps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.sync-app { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: 12px; transition: all .15s; }
.sync-app:hover { border-color: var(--brand); background: var(--brand-50); }
.sync-app > i { font-size: 24px; color: var(--brand); }
.sync-app small { display: block; color: var(--muted); font-size: 12px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 12px !important; }
.sync-options { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; padding: 14px 0; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); }
.sync-options .field { max-width: 280px; }
.sync-options .btn { align-self: flex-start; }
.sync-help { margin-bottom: 12px; } .sync-help summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--brand); }
.sync-help ul { padding-left: 18px; line-height: 1.7; color: var(--muted); }
.ev-export { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@media (max-width: 760px) { .sync-apps { grid-template-columns: minmax(0, 1fr); } }
.deal-kpis .kpi > div { display: flex; flex-direction: column; min-width: 0; } .deal-kpis .kpi small { font-size: 11px; }

/* ---------- Ratings ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rating-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 800; vertical-align: middle;
    background: color-mix(in srgb, var(--amber) 14%, var(--surface)); color: #B45309; white-space: nowrap; margin-left: 6px; }
.rating-badge i { color: var(--amber); }
.rating-badge small { font-weight: 600; opacity: .8; }
.rating-badge b { margin-left: 4px; padding-left: 6px; border-left: 1px solid currentColor; font-size: 11px; }
.rating-badge.top { background: linear-gradient(135deg, #FDE68A, #F59E0B); color: #78350F; }
.rating-badge.top i { color: #78350F; }
.rating-badge.high { background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: #15803D; }
.rating-badge.new { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.rating-badge.new i { color: var(--muted); }
.rating-badge.sm { padding: 1px 7px; font-size: 11px; }
.who .rating-badge, .deal-parties .rating-badge { margin: 4px 0 0; }
.contact-card .who > div > a { display: inline-block; }
.stars { color: var(--amber); white-space: nowrap; letter-spacing: 1px; }
.star-input { border: 0; padding: 0; margin: 0; min-width: 0; }
.star-input legend { font-weight: 600; font-size: 13px; padding: 0; margin-bottom: 4px; }
.star-input.big legend { font-size: 15px; font-weight: 700; }
.star-row { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.star-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-row label { font-size: 20px; color: var(--border); cursor: pointer; transition: transform .1s, color .1s; line-height: 1; padding: 2px; }
.star-input.big .star-row label { font-size: 36px; }
.star-row label:hover, .star-row label:hover ~ label, .star-row input:checked ~ label { color: var(--amber); }
.star-row label:hover { transform: scale(1.12); }
.star-row input:focus-visible + label { outline: 2px solid var(--brand); border-radius: 4px; }
.rating-form { display: flex; flex-direction: column; gap: 14px; }
.star-cats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.rating-form.compact .star-input.big .star-row label { font-size: 28px; }
.rating-form.compact .star-cats { grid-template-columns: minmax(0, 1fr); }
.recommend { border: 0; padding: 0; margin: 0; }

.rate-page { background: var(--bg); padding: 24px 16px 40px; }
.rate-wrap { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.rate-logo { height: 34px; align-self: center; }
.rate-card { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.rate-card h1 { font-size: 22px; margin: 0; }
.rate-card .who.big p { margin: 4px 0 0; }
.rate-done { text-align: center; padding: 20px 0; }
.rate-done i { font-size: 42px; color: var(--brand); }
.rate-done h2 { margin: 10px 0 4px; }

.ratings-card { margin-top: 16px; }
.ratings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.rate-box { border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.rate-box h3 { margin: 0; font-size: 15px; }
.rate-box p { margin: 0; }
.rate-box details input { height: 38px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; background: var(--surface-2); color: inherit; }

.rating-summary { display: grid; grid-template-columns: 200px minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: center; }
.rs-score { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.rs-score > strong { font-size: 46px; line-height: 1; }
.rs-score .stars { font-size: 18px; }
.rs-score .rating-badge { margin: 0; }
.rs-dist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.rs-dist li { display: grid; grid-template-columns: 36px 1fr 28px; gap: 8px; align-items: center; font-weight: 700; }
.rs-dist li i { color: var(--amber); font-size: 10px; }
.rs-dist .bar { height: 8px; }
.rs-dist b { text-align: right; }
.rs-cats { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: 13px; }
.rs-cats > div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed var(--border); padding-bottom: 6px; }
.rs-cats dt { color: var(--muted); } .rs-cats dd { margin: 0; font-weight: 700; } .rs-cats dd i { color: var(--amber); font-size: 11px; }
.review-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.review-list > li { padding: 14px 0; border-bottom: 1px dashed var(--border); display: flex; flex-direction: column; gap: 6px; }
.review-list > li:last-child { border-bottom: 0; }
.review-list p { margin: 0; }
.rv-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hidden-review { opacity: .65; }
.rv-report summary, .rate-box details summary { cursor: pointer; color: var(--muted); }
.rv-report form { flex-direction: row; display: flex; gap: 6px; margin-top: 6px; }
.rv-report input, .rv-mod input { flex: 1; height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; background: var(--surface-2); color: inherit; min-width: 0; }
.rv-mod { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
@media (max-width: 1100px) { .rating-summary { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .star-cats, .rs-cats { grid-template-columns: minmax(0, 1fr); } .rv-mod { flex-wrap: wrap; } }
.field .segmented input, .recommend .segmented input { width: 1px !important; height: 1px !important; padding: 0; border: 0; }
.who > div > a + a .rating-badge { margin: 2px 0 2px 8px; }
.name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.name-row .rating-badge { margin: 0 !important; }

/* ---------------------------------------------------------------- Client portfolios */
.tone-gray { --c: #94A3B8; }
.up-text { color: var(--green); } [data-theme="dark"] .up-text { color: #4ADE80; }
.amber-text { color: var(--amber); }
.nowrap { white-space: nowrap; } td.wrap, .wrap { white-space: normal; min-width: 180px; }
.grow { flex: 1; min-width: 0; }
.inline { display: inline; margin: 0; }
.kpi-value .unit { font-size: 13px; color: var(--muted); font-weight: 700; margin-left: 2px; }
.kpi-hero .kpi-value .unit { color: rgba(255, 255, 255, .85); }
.pf-form-title { font-size: 16px; font-weight: 800; margin: 14px 0 4px; padding-top: 14px; border-top: 1px dashed var(--border); }
.pf-form-title:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span-3 { grid-column: span 3; }
.check-row { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--brand); }
.field-check { align-self: end; min-height: 40px; }
.form-actions.spread { justify-content: space-between; }
.input-prefix.suffix span { border-right: 0; border-left: 1px solid var(--border); }
.input-prefix.suffix input + span + input { border-left: 1px solid var(--border) !important; }
.dialog.wide .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.pf-kpis { display: grid; grid-template-columns: 1.35fr repeat(6, minmax(0, 1fr)); gap: 12px; }
.pf-kpis.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.pf-kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pf-kpis .kpi { gap: 4px; padding: 16px; justify-content: flex-start; }
.pf-kpis .kpi-hero { grid-column: auto; }
.pf-kpis .kpi-value { font-size: 21px; margin: 2px 0; }
.pf-kpis .kpi-hero .kpi-value { font-size: 26px; }
.pf-kpis .kpi small { font-size: 11.5px; }
.pf-grid { display: grid; gap: 16px; align-items: start; }
.pf-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pf-grid.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
.pf-grid > .card, .pf-grid > .deal-side { height: 100%; }
.pf-alerts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.pf-alerts .callout:hover { box-shadow: var(--shadow); }
.pf-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.mini-head { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 8px; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.health-score { position: relative; width: 150px; height: 150px; margin: 0 auto 8px; }
.health-score svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.health-score circle { fill: none; stroke-width: 12; }
.health-score .track { stroke: var(--surface-2); }
.health-score .fill { stroke: var(--c); stroke-linecap: round; transition: stroke-dasharray .6s; }
.health-score > div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.health-score strong { font-size: 40px; font-weight: 800; color: var(--c); line-height: 1; }
.health-score span { color: var(--muted); font-size: 12px; font-weight: 600; }
.health-parts, .budget-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.health-parts small { font-size: 11px; }
.hp-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.health-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 99px; font-size: 12px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); white-space: nowrap; }
.health-chip b { background: var(--c); color: #fff; border-radius: 99px; padding: 1px 8px; }
.health-chip.big { padding: 6px 16px 6px 6px; font-size: 13px; }
.health-chip.big b { font-size: 22px; padding: 6px 12px; }

.alloc-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alloc-list li { display: grid; grid-template-columns: auto 1fr auto 40px; gap: 8px; align-items: center; font-weight: 600; }
.alloc-list small { text-align: right; }
.alloc-cities { margin: 12px 0 0; }
.occ-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.occ-cell { padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--c) 9%, transparent); display: flex; flex-direction: column; }
.occ-cell strong { font-size: 24px; font-weight: 800; color: var(--c); line-height: 1.1; }
.occ-cell span { font-size: 12px; font-weight: 600; color: var(--muted); }

.pf-map { height: 320px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); z-index: 0; }
.pf-map.small { height: 260px; }
.upcoming-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.upcoming-list li { display: grid; grid-template-columns: 44px 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 10px; }
.upcoming-list li:hover { background: var(--surface-2); }
.up-date { display: flex; flex-direction: column; align-items: center; font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--muted); line-height: 1.1; }
.up-date b { font-size: 17px; color: var(--text); }
.up-icon, .pf-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--c, var(--brand)); background: color-mix(in srgb, var(--c, var(--brand)) 12%, transparent); flex: none; }
.up-amt { font-size: 13px; white-space: nowrap; }
.upcoming-list strong { font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.table.compact td, .table.compact th { padding: 7px 8px; font-size: 13px; }
.table tfoot td { border-top: 2px solid var(--border); font-weight: 700; padding: 11px 10px; }
.pf-table td { vertical-align: middle; }
.pf-name { display: flex; align-items: center; gap: 10px; }
.pf-name .pf-dot { width: 12px; height: 12px; }
.rec-badge { display: inline-flex; align-items: center; gap: 4px; }
.rec-badge.big { font-size: 13px; padding: 6px 12px; }

.pf-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pf-rows > li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.pf-rows > li:last-child { border-bottom: 0; }
.pf-rows > li > div:not(.user-menu) { flex: 1; min-width: 0; }
.pf-rows form { margin: 0; }
.pf-rows li.is-done strong { text-decoration: line-through; color: var(--muted); }
.as-btn { border: 0; cursor: pointer; font-family: inherit; }

.pl-table td { padding: 8px 10px; }
.pl-table .pl-head td { font-weight: 700; }
.pl-table .pl-indent { padding-left: 24px; color: var(--muted); font-weight: 600; }
.pl-table .pl-total td { font-weight: 800; border-top: 2px solid var(--border); background: var(--surface-2); }
.pl-table .pl-total.neg td:last-child { color: var(--red); }
.pl-table tbody tr:hover { background: transparent; }

.segmented a.seg { display: flex; align-items: center; padding: 7px 14px; border-radius: 9px; font-weight: 700; color: var(--muted); font-size: 13px; white-space: nowrap; }
.segmented a.seg.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
nav.segmented { overflow-x: auto; max-width: 100%; }

.rent-grid td, .rent-grid th { padding: 6px; }
.rent-grid th.center, .rent-grid td.center { text-align: center; }
.rent-cell { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 66px; padding: 5px 8px; border-radius: 9px; border: 1px solid transparent; font: 700 12px/1.2 inherit; font-family: inherit; cursor: pointer;
    color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.rent-cell small { font-weight: 600; font-size: 10.5px; opacity: .85; }
.rent-cell:hover { border-color: var(--c); }
.rent-cell.paid { --c: var(--green); } .rent-cell.part { --c: var(--amber); } .rent-cell.late { --c: var(--red); } .rent-cell.open { --c: var(--blue); } .rent-cell.waived { --c: #94A3B8; }
.rent-cell.none { --c: var(--muted); background: transparent; cursor: default; }
.rent-cell.mini { min-width: 0; width: 12px; height: 12px; padding: 0; border-radius: 4px; display: inline-block; cursor: default; }
.legend .rent-cell.mini { background: var(--c); }
.pf-arrears { border: 1px solid color-mix(in srgb, var(--red) 30%, transparent); }

.copy-field { display: flex; gap: 8px; margin: 10px 0; }
.copy-field input { flex: 1; min-width: 0; height: 36px; border: 1px solid var(--border); border-radius: 9px; padding: 0 10px; background: var(--surface-2); color: var(--text); font-size: 12px; }

.lease-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 10px; }
.lease-card.past { opacity: .7; }
.lease-main { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lease-rent { text-align: right; display: flex; flex-direction: column; }
.lease-rent b { font-size: 18px; }
.lease-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.lease-meta b { color: var(--text); text-transform: capitalize; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.inline-form input[type=date] { height: 32px; border: 1px solid var(--border); border-radius: 9px; padding: 0 8px; background: var(--surface-2); color: var(--text); }

.pf-flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.pf-flow > div { display: flex; flex-direction: column; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); min-width: 120px; }
.pf-flow > div.hl { background: var(--brand-50); border-color: var(--brand-100); }
.pf-flow span { font-size: 12px; color: var(--muted); font-weight: 600; }
.pf-flow b { font-size: 18px; font-weight: 800; }
.pf-flow > i { color: var(--muted); }

.stepper { list-style: none; margin: 0 0 16px; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; counter-reset: s; }
.stepper li { flex: 1; min-width: 110px; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 13px; }
.stepper li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); font-size: 12px; flex: none; }
.stepper li.done { color: var(--green); } .stepper li.done span { background: var(--green); color: #fff; border-color: var(--green); }
.stepper li.current { color: var(--brand); background: var(--brand-50); } .stepper li.current span { background: var(--brand); color: #fff; border-color: var(--brand); }
.check-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.check-group h3 { font-size: 14px; margin-bottom: 10px; }
.check-item { margin: 0 0 6px; }
.check-item .check-row { align-items: flex-start; font-weight: 500; }
.check-item .check-row input { margin-top: 2px; flex: none; }
.check-item small { margin-left: auto; padding-left: 6px; }
.timeline li .grow .deal-actions { margin-top: 6px; }

.rec-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.rec-card { border-radius: 16px; padding: 16px 18px; background: color-mix(in srgb, var(--c) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 25%, transparent); display: flex; flex-direction: column; gap: 4px; }
.rec-card .rec-top { display: flex; justify-content: space-between; align-items: center; }
.rec-card .rec-top b { font-size: 22px; color: var(--c); }
.rec-title { font-size: 20px; font-weight: 800; letter-spacing: .02em; color: var(--c); }
.rec-card strong { font-size: 15px; }
.rec-sub { font-size: 13px; color: color-mix(in srgb, var(--c) 75%, var(--text)); font-weight: 500; }
.rec-card ul { margin: 8px 0 0; padding-left: 16px; font-size: 13px; }
.rec-card ul a:hover { color: var(--c); }
.rec-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 18px; }
.rec-picker .rec-card { cursor: pointer; position: relative; transition: box-shadow .15s, transform .15s; }
.rec-picker input { position: absolute; opacity: 0; pointer-events: none; }
.rec-picker .rec-card:has(input:checked) { box-shadow: 0 0 0 2px var(--c); transform: translateY(-1px); }
.rec-picker .rec-card:has(input:checked)::after { content: "\F26E"; font-family: bootstrap-icons; position: absolute; top: 12px; right: 14px; color: var(--c); font-size: 18px; }
.decision-card { border-left: 4px solid var(--c); }
.decision-action { font-size: 15px; font-weight: 700; margin: 0 0 12px; display: flex; gap: 8px; align-items: flex-start; }
.decision-action i { color: var(--c); margin-top: 2px; }
.details.two-col .span-all { grid-column: 1 / -1; }
.decision-facts > div { grid-template-columns: 160px 1fr; }

.ec-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: center; margin-top: 6px; }
.ec-table td { white-space: normal; }
.ec-table tr.is-best td { background: color-mix(in srgb, var(--green) 10%, transparent); }
.np-calc { display: flex; flex-direction: column; gap: 10px; }

/* Client portal */
.pf-portal .portal-top { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 28px; background: var(--surface); border-bottom: 1px solid var(--border); }
.portal-brand img { max-height: 44px; max-width: 200px; display: block; }
.portal-contact { display: flex; align-items: center; gap: 8px; }
.portal-hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.portal-hero h1 { font-size: 26px; margin: 2px 0; }
.portal-hero p { margin: 0; }
.portal-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 18px 0 6px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.portal-foot .supported { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.portal-foot .supported img { height: 22px; }
[data-theme="dark"] .portal-foot .supported img, [data-theme="dark"] .portal-brand img { background: #fff; border-radius: 6px; padding: 2px 4px; }

@media (max-width: 1280px) {
    .pf-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .pf-kpis .kpi-hero { grid-column: span 2; }
    .pf-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pf-grid.three > :first-child { grid-row: span 2; }
    .check-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .pf-grid.two, .pf-grid.three, .ec-grid { grid-template-columns: minmax(0, 1fr); }
    .pf-grid.three > :first-child { grid-row: auto; }
    .pf-kpis, .pf-kpis.five, .pf-kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rec-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid.three, .form-grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .span-3 { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
    .pf-kpis .kpi-hero { grid-column: 1 / -1; }
    .rec-board, .check-groups, .dialog.wide .form-grid, .form-grid.three, .form-grid.five { grid-template-columns: minmax(0, 1fr); }
    .pf-flow > div { flex: 1 1 40%; min-width: 0; }
    .pf-flow > i { display: none; }
    .pf-portal .portal-top { padding: 10px 16px; }
    .decision-facts > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .upcoming-list li { grid-template-columns: 40px minmax(0, 1fr) auto; }
    .upcoming-list .up-icon { display: none; }
    .pf-rows > li { flex-wrap: wrap; }
}
.pl-table td:first-child { white-space: normal; }
@media (max-width: 640px) { .portal-contact > .muted { display: none; } .lease-rent { text-align: left; } }
.mode-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mode-card { position: relative; cursor: pointer; }
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card > span { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; transition: all .15s; }
.mode-card > span i { color: var(--brand); font-size: 18px; }
.mode-card input:checked + span { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 2px var(--brand-100); }
.mode-card input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-100); }
@media (max-width: 900px) { .mode-picker { grid-template-columns: minmax(0, 1fr); } }

.dup-group { border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.dup-group h3 { font-size: 14px; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.dup-group form { display: inline; margin: 0; }
.linked-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.linked-list li { display: flex; gap: 10px; align-items: flex-start; }
.linked-list li > i { color: var(--brand); margin-top: 2px; }

.pf-network { display: flex; flex-direction: column; gap: 14px; }
.pfn-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.pfn-stats > div { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.pfn-stats span { font-size: 12px; font-weight: 600; color: var(--muted); }
.pfn-stats b { font-size: 20px; font-weight: 800; }
.pfn-stats small { font-size: 11.5px; }
.pfn-alloc { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; }
.pfn-alloc span { background: var(--c); }
.pfn-lists .mini-head { margin-top: 0; }
@media (max-width: 1280px) { .pfn-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .pfn-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Exclusive projects ---------- */
.ex-table td { vertical-align: top; }
.danger-text { color: var(--red) !important; }
.dropdown-menu.right { right: 0; left: auto; z-index: 30; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline; }
.row-actions .user-menu { display: inline-block; margin: 0; }
.badge.sm { font-size: 10px; padding: 1px 6px; margin: 2px 2px 0 0; }
.tab .count.hot { background: var(--red); border-color: var(--red); color: #fff; }
.table-foot { margin: 12px 4px 0; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 14px 0; border-top: 1px solid var(--border); z-index: 5; display: flex; justify-content: flex-end; gap: 10px; align-items: center; }
.sticky-actions form { margin: 0; }
.yes { color: var(--green); font-weight: 700; }
.center { text-align: center; }

.ex-overview { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 2.6fr); gap: 16px; align-items: start; }
.ex-side, .ex-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ex-row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
.ex-hero { padding-top: 16px; }
.ex-cover { position: relative; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 16%, var(--surface-2)); color: var(--c); font-size: 54px; }
.ex-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ex-cover a { display: block; width: 100%; height: 100%; }
.ex-ribbon { position: absolute; top: 18px; left: -34px; transform: rotate(-35deg); background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; padding: 5px 44px; z-index: 1; box-shadow: 0 2px 6px rgb(0 0 0 / .2); letter-spacing: .02em; }
.ex-title { text-align: center; font-size: 22px; margin: 16px 0 2px; }
.ex-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: center; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 12px 0; margin: 14px 0; gap: 6px; }
.ex-trio strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.ex-trio span { font-size: 12px; color: var(--muted); }
.ex-thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.ex-thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.ex-sub { font-size: 14px; margin: 0 0 8px; }
.ex-dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 13px; }
.ex-dl dt { color: var(--muted); }
.ex-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.ex-assigned { margin: 0; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.ex-owner { display: flex; gap: 14px; align-items: center; }
.ex-strip { display: flex; flex-wrap: wrap; gap: 8px 28px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.ex-strip strong { color: var(--text); }
.ex-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.ex-facts.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ex-facts.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ex-facts > div span { display: block; font-size: 12px; color: var(--muted); }
.ex-facts > div strong { display: block; font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.ex-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.ex-features span { display: block; font-size: 12px; color: var(--muted); }
.ex-features strong { font-size: 14px; }
.ex-commission { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-top: 16px; }
.ex-commission > div { border-radius: 12px; padding: 12px 14px; border: 1px solid var(--border); }
.ex-commission span { display: block; font-size: 12px; color: var(--muted); }
.ex-commission strong { display: block; font-size: 20px; margin: 2px 0; }
.ex-commission small { font-size: 12px; color: var(--muted); }
.ex-commission .you-earn { background: var(--brand-50); border-color: var(--brand-100); }
.ex-commission .you-earn strong { color: var(--brand); }
.ex-commission .private { background: var(--surface-2); border-style: dashed; }
.ex-stock { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.ex-stock .seg { background: var(--c); }
.ex-stock-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 10px; font-size: 13px; }
.ex-stock-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 4px; }
.ex-units td { white-space: nowrap; }
.ex-units td:last-child, .ex-units td:nth-last-child(2) { white-space: normal; }

.commission-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.split-card { border: 1px solid var(--brand-100); background: var(--brand-50); border-radius: 12px; padding: 14px; }
.split-card.private { background: var(--surface-2); border: 1px dashed var(--border); }
.split-card h3 { font-size: 14px; margin: 0 0 10px; }
.split-card h3 .hint { font-weight: 500; }
.split-margin { grid-column: 1 / -1; margin: 0; font-size: 13px; }
.form-grid.tight { gap: 8px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.feature-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.feature-group h4 { margin: 0 0 8px; font-size: 13px; }
.feature-group .check { margin-bottom: 6px; font-size: 13px; }
.legal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px 18px; }
.legal-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.segmented.small span { padding: 5px 10px; font-size: 12px; }
.segmented input:checked + span { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgb(0 0 0 / .08); }

.ex-brokers { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.ex-broker-list { padding-bottom: 8px; }
.ex-broker { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; color: inherit; text-decoration: none; }
.ex-broker:hover, .ex-broker.active { background: var(--brand-50); }
.ex-broker .grow { flex: 1; min-width: 0; }
.ex-note { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; font-size: 13px; }
.ex-thread { display: flex; flex-direction: column; gap: 10px; max-height: 560px; overflow-y: auto; padding: 4px; margin-bottom: 12px; }
.ex-thread .msg { max-width: 80%; padding: 10px 14px; border-radius: 14px 14px 14px 4px; background: var(--surface-2); border: 1px solid var(--border); }
.ex-thread .msg.mine { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: var(--brand-50); border-color: var(--brand-100); }
.msg-head { display: flex; gap: 10px; justify-content: space-between; font-size: 12px; }
.msg-head small { color: var(--muted); }
.msg-body { margin-top: 4px; line-height: 1.55; overflow-wrap: anywhere; }
.msg-event { font-size: 12px; color: var(--muted); text-align: center; }
.msg-event small { opacity: .8; }
.thread-form textarea { width: 100%; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); color: var(--text); font: inherit; resize: vertical; }
.thread-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

.ex-sales-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.ex-sales-summary > div { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.ex-sales-summary span { display: block; font-size: 12px; color: var(--muted); }
.ex-sales-summary strong { display: block; font-size: 20px; }
.ex-sales-summary .hl { background: var(--brand-50); }
.ex-sales-summary .hl strong { color: var(--brand); }
.ex-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.ex-photos figure { margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ex-photos figure.is-cover { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-100); }
.ex-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.ex-photos figcaption { display: flex; gap: 10px; align-items: center; padding: 8px 10px; flex-wrap: wrap; }
.ex-photos figcaption form { margin: 0; }
.ex-log { list-style: none; margin: 0; padding: 0; }
.ex-log li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.ex-log li:last-child { border-bottom: 0; }

/* broker portal */
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.ex-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.ex-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ex-card .ex-cover { border-radius: 0; aspect-ratio: 16 / 10; }
.ex-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ex-card h3 { margin: 0; font-size: 17px; }
.ex-card .ex-earn { display: flex; justify-content: space-between; align-items: center; background: var(--brand-50); border-radius: 10px; padding: 8px 12px; margin-top: auto; }
.ex-card .ex-earn strong { color: var(--brand); font-size: 16px; }
.ex-card .ex-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.ex-banner { display: flex; gap: 16px; align-items: center; background: linear-gradient(120deg, var(--brand-50), var(--surface)); border: 1px solid var(--brand-100); }
.ex-banner .kpi-icon { --c: var(--brand); flex: none; }
.ex-banner p { margin: 4px 0 0; }
.ex-cta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

@media (max-width: 1280px) {
    .ex-overview { grid-template-columns: minmax(0, 1fr); }
    .ex-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
    .ex-facts.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .ex-row, .ex-brokers, .commission-split { grid-template-columns: minmax(0, 1fr); }
    .ex-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ex-sales-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .ex-facts, .ex-facts.two, .ex-facts.four, .ex-features { grid-template-columns: minmax(0, 1fr); }
    .ex-side { grid-template-columns: minmax(0, 1fr); }
    .ex-thread .msg { max-width: 95%; }
    .legal-item { flex-wrap: wrap; }
}
.ex-broker .avatar, .ex-owner .avatar { background: var(--brand-50); color: var(--brand); flex: none; }
.no-bad { color: var(--red); font-weight: 700; }
.dropdown-menu.floating { position: fixed; right: auto; z-index: 60; }
.preview-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--blue) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--blue) 35%, transparent); position: sticky; top: 8px; z-index: 20; }
.preview-bar > i { color: var(--blue); font-size: 18px; }
.preview-bar span { flex: 1; font-size: 14px; }
.btn.is-disabled { opacity: .55; cursor: default; pointer-events: none; }
@media (max-width: 640px) { .preview-bar { flex-wrap: wrap; } }

/* ---------- Buyers Match ---------- */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch > span { width: 40px; height: 22px; border-radius: 99px; background: var(--border); position: relative; transition: background .15s; flex: none; }
.switch > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgb(0 0 0 / .2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-50); }
.bm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bm-chips span { background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.bm-chips span:first-child { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand); }
.bm-save { margin-top: 16px; border: 1px solid var(--brand-100); }
.bm-save-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.bm-save-actions { display: flex; gap: 8px; justify-content: flex-end; }
.bm-head { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
.bm-alert-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.bm-alert-form .field { margin: 0; }
.bm-matches { display: flex; flex-direction: column; }
.bm-match { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: center; }
.bm-match:last-child { border-bottom: 0; }
.bm-match.is-new { background: linear-gradient(90deg, var(--brand-50), transparent 60%); border-radius: 12px; padding-left: 8px; }
.bm-match.is-gone { opacity: .6; }
.bm-thumb { width: 96px; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 18%, var(--surface-2)); color: var(--c); font-size: 26px; }
.bm-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bm-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bm-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 2px; font-size: 13px; }
.bm-meta strong { color: var(--brand); }
.bm-actions { display: flex; gap: 6px; align-items: center; }
@media (max-width: 900px) { .bm-head { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
    .bm-match { grid-template-columns: 72px minmax(0, 1fr); }
    .bm-thumb { width: 72px; }
    .bm-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
.bm-alert-state { text-align: right; font-size: 13px; }

/* type-to-search dropdowns */
.combo { position: relative; min-width: 0; }
.combo > select { position: absolute; inset: 0; opacity: 0; pointer-events: none; width: 100%; }
.combo-input { width: 100%; height: 42px; padding: 0 34px 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat right 12px center; color: var(--text); font: inherit; font-weight: 500; }
.toolbar .combo-input { height: 40px; min-width: 170px; }
.combo-input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); background-color: var(--surface); }
.combo-list { position: absolute; z-index: 70; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); min-width: 220px; }
.combo-list li { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; font-weight: 500; }
.combo-list li.on { background: var(--brand-50); color: var(--brand); }
.combo-list li.sel { font-weight: 700; }
.combo-list li.more { color: var(--muted); cursor: default; font-size: 12px; }
.combo-list li small { margin-left: 8px; color: var(--muted); font-weight: 500; font-size: 12px; }

/* Configurations → Lists */
.lk-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.lk-jump a { padding: 5px 12px; border: 1px solid var(--border); border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface); }
.lk-jump a:hover { color: var(--brand); border-color: var(--brand); }
.lk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.lk-card { padding: 0; display: flex; flex-direction: column; scroll-margin-top: 80px; }
.lk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
.lk-head h2 { font-size: 16px; margin: 0 0 2px; display: flex; align-items: center; gap: 8px; }
.lk-head .count { background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 1px 8px; font-size: 11px; color: var(--muted); font-weight: 700; }
.lk-add { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; font-size: 16px; }
.lk-add:hover { background: var(--brand-600); }
.lk-body { max-height: 420px; overflow-y: auto; padding: 6px 8px 10px; }
.lk-grp { display: flex; justify-content: space-between; align-items: center; padding: 10px 8px 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.lk-empty { padding: 4px 8px; margin: 0; }
.lk-items { list-style: none; margin: 0; padding: 0; }
.lk-item { display: flex; align-items: center; gap: 8px; padding: 2px 4px 2px 0; border-radius: 8px; }
.lk-item:hover { background: var(--surface-2); }
.lk-label { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 7px 8px; cursor: pointer; color: inherit; font: inherit; font-weight: 600; font-size: 14px; display: flex; flex-direction: column; }
.lk-label small { font-weight: 500; font-size: 12px; }
.lk-label:hover span { color: var(--brand); }
.lk-item.off .lk-label span { color: var(--muted); text-decoration: line-through; }
.lk-meta { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.lk-meta .badge { font-size: 10px; }
.lk-actions { display: inline-flex; flex: none; opacity: 0; transition: opacity .15s; }
.lk-item:hover .lk-actions, .lk-item:focus-within .lk-actions { opacity: 1; }
.lk-icon { width: 26px; height: 26px; border: 0; background: none; border-radius: 6px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.lk-icon:hover:not(:disabled) { background: var(--surface); color: var(--brand); }
.lk-icon:disabled { opacity: .3; cursor: default; }
.lk-dialog-actions .lk-danger { margin-right: auto; display: inline-flex; gap: 4px; }
.lk-dialog-actions [hidden] { display: none !important; }
@media (hover: none) { .lk-actions { opacity: 1; } }

/* Events */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-row form { margin: 0; }
.copy-row { display: flex; gap: 8px; margin: 8px 0 12px; }
.copy-row input { flex: 1; min-width: 0; height: 34px; border: 1px solid var(--border); border-radius: 9px; padding: 0 10px; background: var(--surface-2); color: var(--text); font-size: 13px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state > i { font-size: 34px; color: var(--brand); }
.form-grid.inner { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; }
.mode-pick { margin-bottom: 14px; }
td.nowrap, .nowrap { white-space: nowrap; }
p.lead { font-size: 15px; margin: 0 0 12px; }
.ev-date { flex: none; width: 58px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; align-items: center; padding: 6px 0; line-height: 1.1; overflow: hidden; }
.ev-date small:first-child { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--brand); letter-spacing: .05em; }
.ev-date strong { font-size: 22px; font-weight: 800; }
.ev-date small:last-child { font-size: 11px; color: var(--muted); }
.ev-date.off { opacity: .5; }
.ev-list { display: grid; gap: 10px; margin-bottom: 16px; }
.ev-list.grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin: 0; }
.ev-card { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: inherit; transition: border-color .15s, box-shadow .15s; }
.ev-card:hover { border-color: var(--brand); box-shadow: 0 4px 16px rgba(0,0,0,.05); }
.ev-card.compact { padding: 10px 12px; }
.ev-card-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ev-card-body strong { font-size: 15px; }
.ev-card.compact .ev-card-body strong { font-size: 14px; }
.ev-type { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); }
.ev-state { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.ev-hero { display: flex; gap: 18px; align-items: flex-start; margin: 12px 0 16px; }
.ev-hero .ev-date { width: 70px; }
.ev-hero h1 { margin: 4px 0; font-size: 24px; }
.ev-hero p { margin: 0 0 8px; }
.ev-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; font-weight: 600; }
.ev-facts i { color: var(--muted); margin-right: 4px; }
.ev-overview { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.ev-main, .ev-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ev-pay { padding: 12px 14px; border-radius: 12px; background: #FFF7ED; border: 1px solid #FED7AA; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin: 8px 0; }
[data-theme="dark"] .ev-pay { background: #2A1A0C; border-color: #5A3410; }
.ev-pay .inline-form { flex-wrap: wrap; }
.ev-pay input { height: 32px; border: 1px solid var(--border); border-radius: 9px; padding: 0 10px; background: var(--surface); color: var(--text); min-width: 240px; }
.ev-join { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); margin: 8px 0; word-break: break-all; }
.ev-join > i { font-size: 20px; color: var(--brand); }
.ev-join strong { display: block; }
.ev-series { list-style: none; margin: 0; padding: 0; }
.ev-series li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--border); font-size: 14px; }
.ev-series li:last-child { border-bottom: 0; }
.ev-series li.on a { font-weight: 800; color: var(--brand); }
.ev-series li span { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.ev-msg { padding: 10px 0; border-bottom: 1px solid var(--border); }
.ev-msg:last-child { border-bottom: 0; }
.ev-msg p { margin: 6px 0 0; color: var(--muted); }
.ev-pick { max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.ev-pick-filter { height: 32px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; margin-bottom: 4px; background: var(--surface-2); color: var(--text); }
.ev-pick .check[hidden] { display: none; }
.ev-invite { margin-top: 12px; }
.ev-mini { list-style: none; padding: 0; margin: 12px 0 0; font-size: 13px; }
.ev-mini li { padding: 3px 0; }
.ev-public-main { max-width: 1080px; margin: 0 auto; padding: 20px 28px 40px; }
.ev-about-ru h2 { font-size: 16px; margin: 0 0 6px; }
[data-show-mode][hidden], [data-ev-repeat-count][hidden] { display: none !important; }
@media (max-width: 900px) { .ev-overview { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
    .ev-hero { flex-direction: column; gap: 10px; }
    .ev-hero h1 { font-size: 20px; }
    .ev-public-main { padding: 16px; }
    .form-grid.inner { grid-template-columns: 1fr 1fr; }
    .ev-pay input { min-width: 0; width: 100%; }
}

/* Offers */
.of-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 16px; align-items: start; }
.of-project { padding: 0; overflow: hidden; }
.of-project-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 16px 16px 10px; }
.of-project-head h2 { font-size: 18px; margin: 2px 0; }
.of-project-head h2 a { color: inherit; }
.of-project-head h2 a:hover { color: var(--brand); }
.of-count { flex: none; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 3px 10px; }
.of-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; grid-template-areas: "rate broker act" "rate terms act"; gap: 2px 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); }
.of-row.best { background: color-mix(in srgb, var(--green) 6%, var(--surface)); }
.of-row.own { background: var(--brand-50); }
.of-rate { grid-area: rate; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.of-rate strong { font-size: 18px; font-weight: 800; color: var(--brand); line-height: 1.2; }
.of-broker { grid-area: broker; min-width: 0; }
.of-terms { grid-area: terms; }
.of-act { grid-area: act; display: flex; gap: 10px; align-items: center; }
.of-more { display: block; padding: 10px 16px; border-top: 1px solid var(--border); font-weight: 700; font-size: 13px; }
.of-compare tr.of-best td { background: color-mix(in srgb, var(--green) 6%, var(--surface)); }
.of-hero .of-big { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.of-hero .of-big strong { font-size: 32px; font-weight: 800; color: var(--brand); line-height: 1.1; }
.of-mini { padding: 6px 0; border-bottom: 1px solid var(--border); }
.of-mini:last-of-type { border-bottom: 0; }
.of-thread { display: flex; flex-direction: column; gap: 10px; max-height: 460px; overflow-y: auto; padding: 4px 2px 10px; }
.of-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 80%; }
.of-msg.mine { align-self: flex-end; align-items: flex-end; }
.of-bubble { padding: 9px 13px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); white-space: normal; word-break: break-word; }
.of-msg.mine .of-bubble { background: var(--brand-50); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.of-note { align-self: center; font-size: 12px; color: var(--muted); text-align: center; max-width: 90%; }
.of-compose { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.of-compose textarea { flex: 1; border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; background: var(--surface); color: var(--text); font: inherit; resize: vertical; }
[data-of-show][hidden] { display: none !important; }
@media (max-width: 600px) {
    .of-grid { grid-template-columns: 1fr; }
    .of-row { grid-template-columns: 1fr; grid-template-areas: "rate" "broker" "terms" "act"; }
    .of-msg { max-width: 92%; }
}

/* Microsite (public broker page, /m/slug) */
.ms-body { --ms: var(--brand); background: var(--bg); color: var(--text); font-family: 'Plus Jakarta Sans', system-ui, sans-serif; padding-bottom: 0; }
.ms-wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.ms-top { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 24px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border); }
.ms-brand { display: flex; align-items: center; color: var(--text); min-width: 0; }
.ms-brand img { max-height: 40px; max-width: 200px; object-fit: contain; }
.ms-brand strong { font-size: 18px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-top-right { display: flex; align-items: center; gap: 10px; }
.ms-member { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.ms-member img { height: 24px; }
.ms-hero { position: relative; padding: 56px 0 28px; background:
    radial-gradient(900px 380px at 85% -10%, color-mix(in srgb, var(--ms) 22%, transparent), transparent 70%),
    radial-gradient(700px 300px at 0% 0%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 70%); }
.ms-hero-in { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: center; }
.ms-portrait { width: 220px; aspect-ratio: 1; border-radius: 32px; overflow: hidden; background: linear-gradient(135deg, var(--ms), color-mix(in srgb, var(--ms) 55%, #000)); box-shadow: 0 24px 60px -20px color-mix(in srgb, var(--ms) 55%, transparent), 0 0 0 6px var(--surface); display: grid; place-items: center; transform: rotate(-2deg); }
.ms-portrait img { width: 100%; height: 100%; object-fit: cover; }
.ms-portrait span { color: #fff; font-size: 72px; font-weight: 800; letter-spacing: -.02em; }
.ms-kicker { margin: 0 0 6px; color: var(--ms); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.ms-intro h1 { margin: 0; font-size: clamp(34px, 5vw, 56px); line-height: 1.02; letter-spacing: -.03em; font-weight: 800; }
.ms-headline { margin: 12px 0 18px; font-size: clamp(17px, 2vw, 21px); color: var(--muted); max-width: 46ch; line-height: 1.45; }
.ms-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.ms-badges span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.ms-badges i { color: var(--ms); }
.ms-badges .bi-star-fill { color: #F5A524; }
.ms-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.ms-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 14px; border: 0; background: var(--ms); color: #fff; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--ms) 70%, transparent); text-decoration: none; }
.ms-btn:hover { transform: translateY(-1px); color: #fff; }
.ms-btn.wa { background: #25D366; box-shadow: 0 8px 20px -8px rgba(37, 211, 102, .6); }
.ms-btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.ms-btn.ghost:hover { border-color: var(--ms); color: var(--ms); }
.ms-btn.icon { width: 46px; padding: 0; }
.ms-btn.block { width: 100%; }
.ms-stats { display: flex; flex-wrap: wrap; gap: 0; margin: 40px 0 0; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); overflow: hidden; }
.ms-stats div { flex: 1 1 160px; padding: 18px 22px; border-right: 1px solid var(--border); }
.ms-stats div:last-child { border-right: 0; }
.ms-stats dt { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.ms-stats dd { margin: 4px 0 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.ms-section { padding: 48px 24px; }
.ms-section h2 { margin: 0 0 6px; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.02em; }
.ms-about { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 40px; }
.ms-prose { line-height: 1.75; font-size: 16px; max-width: 68ch; }
.ms-facts { display: flex; flex-direction: column; gap: 20px; padding: 24px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); align-self: start; }
.ms-facts h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ms-facts p, .ms-facts ul { margin: 0; padding: 0; list-style: none; }
.ms-facts li { padding: 3px 0; }
.ms-facts li i { color: var(--ms); }
.ms-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ms-chips span { padding: 5px 12px; border-radius: 99px; background: color-mix(in srgb, var(--ms) 10%, var(--surface)); color: var(--text); font-size: 13px; font-weight: 600; }
.ms-social { display: flex; gap: 8px; }
.ms-social a { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.ms-social a:hover { color: var(--ms); border-color: var(--ms); }
.ms-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.ms-head p { margin: 0; }
.ms-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ms-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.ms-filter button { height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.ms-filter button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.ms-tools select { height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 10px; font: inherit; font-size: 13px; }
.ms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.ms-card { border-radius: 22px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: transform .2s, box-shadow .2s; outline: none; }
.ms-card:hover, .ms-card:focus-visible { transform: translateY(-4px); box-shadow: 0 22px 44px -22px rgba(0, 0, 0, .35); }
.ms-card[hidden] { display: none; }
.ms-img { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.ms-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.ms-card:hover .ms-img img { transform: scale(1.05); }
.ms-noimg { position: absolute; inset: 0; display: grid; place-items: center; font-size: 42px; color: color-mix(in srgb, var(--ms) 50%, var(--muted)); background: color-mix(in srgb, var(--ms) 8%, var(--surface-2)); }
.ms-tag { position: absolute; top: 12px; left: 12px; padding: 5px 11px; border-radius: 99px; background: rgba(255, 255, 255, .94); color: #111; font-size: 12px; font-weight: 800; }
.ms-tag + .ms-tag { left: auto; right: 12px; }
.ms-tag.dark { background: rgba(17, 24, 39, .86); color: #fff; }
.ms-tag.gold { background: linear-gradient(135deg, #F7C948, #E8A317); color: #1F1300; }
.ms-count { position: absolute; bottom: 12px; right: 12px; padding: 4px 10px; border-radius: 99px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; font-weight: 700; }
.ms-card-body { padding: 16px 18px 18px; }
.ms-price { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--ms); }
.ms-price small { font-size: 13px; font-weight: 600; color: var(--muted); }
.ms-card h3 { margin: 4px 0 6px; font-size: 16px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ms-specs { margin: 0; color: var(--text); font-size: 14px; font-weight: 600; }
.ms-where { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.ms-empty { text-align: center; padding: 48px 20px; border: 1px dashed var(--border); border-radius: 22px; color: var(--muted); }
.ms-empty i { font-size: 40px; color: var(--ms); }
.ms-enquire { background: linear-gradient(160deg, color-mix(in srgb, var(--ms) 12%, var(--bg)), var(--bg) 60%); border-top: 1px solid var(--border); scroll-margin-top: 70px; }
.ms-enquire-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 48px; align-items: start; padding: 0; }
.ms-enquire-copy p { font-size: 17px; color: var(--muted); line-height: 1.6; max-width: 42ch; }
.ms-contact { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-direction: column; gap: 12px; font-weight: 600; }
.ms-contact i { color: var(--ms); margin-right: 8px; }
.ms-form { padding: 28px; border-radius: 24px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .25); display: flex; flex-direction: column; gap: 14px; }
.ms-form .field input, .ms-form .field select, .ms-form .field textarea { border-radius: 12px; }
.ms-form .hint { display: inline; font-weight: 500; color: var(--muted); }
.ms-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ms-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.ms-seg input { position: absolute; opacity: 0; pointer-events: none; }
.ms-seg span { display: block; text-align: center; padding: 9px 0; border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--muted); }
.ms-seg input:checked + span { background: var(--surface); color: var(--ms); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.ms-seg input:focus-visible + span { outline: 2px solid var(--ms); }
.ms-fine { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }
.ms-foot { border-top: 1px solid var(--border); background: var(--surface); padding: 28px 0 32px; }
.ms-foot-in { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.ms-foot-in > div { display: flex; flex-direction: column; }
.ms-foot-in > div span { color: var(--muted); font-size: 13px; }
.ms-powered { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 600; }
.ms-powered img { height: 22px; }
.ms-powered em { font-style: normal; border-left: 1px solid var(--border); padding-left: 10px; }
.ms-join { font-weight: 700; font-size: 14px; color: var(--brand); }
.ms-bar { display: none; }
.ms-dialog { width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 24px; background: var(--surface); color: var(--text); overflow: auto; }
.ms-dialog::backdrop { background: rgba(10, 12, 18, .72); backdrop-filter: blur(4px); }
.ms-close { position: absolute; top: 14px; right: 14px; z-index: 3; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: #111; cursor: pointer; font-size: 16px; }
.ms-gallery { position: relative; aspect-ratio: 16 / 9; max-height: 62vh; width: 100%; background: #0B0D12; display: grid; place-items: center; }
.ms-gallery img { width: 100%; height: 100%; object-fit: contain; }
.ms-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); color: #111; cursor: pointer; font-size: 18px; }
.ms-nav.prev { left: 14px; } .ms-nav.next { right: 14px; }
.ms-nav[hidden] { display: none; }
.ms-pos { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); padding: 3px 10px; border-radius: 99px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; font-weight: 700; }
.ms-pos:empty { display: none; }
.ms-thumbs { display: flex; gap: 8px; padding: 10px 16px 0; overflow-x: auto; }
.ms-thumbs:empty { display: none; }
.ms-thumbs button { flex: none; width: 72px; height: 54px; padding: 0; border-radius: 10px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: none; opacity: .7; }
.ms-thumbs button.on { border-color: var(--ms); opacity: 1; }
.ms-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.ms-detail { padding: 22px 26px 28px; }
.ms-detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.ms-detail-head h2 { margin: 4px 0 0; font-size: 24px; letter-spacing: -.02em; }
.ms-detail-cta { display: flex; gap: 8px; }
.ms-detail-cta .ms-btn.wa { width: 46px; padding: 0; }
.ms-detail .ms-specs { margin-top: 14px; }
.ms-factlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 20px; margin: 20px 0; padding: 18px; border-radius: 16px; background: var(--surface-2); }
.ms-factlist dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.ms-factlist dd { margin: 2px 0 0; font-weight: 700; }
.ms-amen h3, .ms-detail .ms-prose h3 { font-size: 15px; margin: 18px 0 10px; }
.ms-detail .ms-fine { text-align: left; margin-top: 18px; }
.ms-toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); padding: 10px 18px; border-radius: 99px; background: #111827; color: #fff; font-weight: 700; z-index: 99; }
.ms-gone { max-width: 420px; margin: 18vh auto; text-align: center; padding: 0 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ms-gone h1 { margin: 18px 0 0; }
.ms-gone p { color: var(--muted); margin: 0 0 16px; }
@media (max-width: 900px) {
    .ms-hero { padding-top: 32px; }
    .ms-hero-in { grid-template-columns: 1fr; gap: 24px; text-align: left; }
    .ms-portrait { width: 132px; border-radius: 26px; }
    .ms-portrait span { font-size: 46px; }
    .ms-about, .ms-enquire-in { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 600px) {
    .ms-wrap { padding: 0 16px; }
    .ms-top { padding: 10px 16px; }
    .ms-member span { display: none; }
    .ms-section { padding: 36px 16px; }
    .ms-enquire-in { padding: 0; }
    .ms-cta .ms-btn:not(.icon) { flex: 1 1 auto; }
    .ms-stats div { flex: 1 1 45%; border-bottom: 1px solid var(--border); }
    .ms-stats dd { font-size: 22px; }
    .ms-grid { grid-template-columns: 1fr; }
    .ms-row { grid-template-columns: 1fr; }
    .ms-form { padding: 20px; }
    .ms-body { padding-bottom: 72px; }
    .ms-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--border); }
    .ms-bar a { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 46px; border-radius: 12px; background: var(--ms); color: #fff; font-weight: 700; }
    .ms-bar a.wa { background: #25D366; }
    .ms-bar a:last-child { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
    .ms-dialog { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; margin: 0; }
    .ms-gallery { aspect-ratio: 4 / 3; }
    .ms-detail { padding: 18px 16px 28px; }
    .ms-foot-in { flex-direction: column; align-items: flex-start; }
}
/* Microsite editor (broker portal) */
.ms-share { display: flex; justify-content: space-between; gap: 24px; align-items: center; flex-wrap: wrap; }
.ms-share-link { flex: 1 1 360px; min-width: 0; }
.ms-share h2 { margin: 0 0 6px; font-size: 18px; }
.ms-qr { flex: none; padding: 10px; background: #fff; border-radius: 14px; border: 1px solid var(--border); line-height: 0; }
.ms-qr img, .ms-qr canvas { width: 168px; height: 168px; }
.ms-edit-media { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 16px; }
.ms-edit-img { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 4px 14px; align-items: start; }
.ms-edit-img > img, .ms-edit-img > span { grid-row: span 2; width: 88px; height: 88px; border-radius: 22px; object-fit: cover; background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: #fff; display: grid; place-items: center; font-size: 30px; font-weight: 800; }
.ms-edit-img.logo > img { object-fit: contain; background: #fff; border: 1px solid var(--border); padding: 6px; }
.ms-edit-img.logo > span { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--border); }
.ms-swatches { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 16px; }
.ms-swatches label { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.ms-swatches input { position: absolute; opacity: 0; }
.ms-swatches span { width: 40px; height: 40px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--border); }
.ms-swatches input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); }
.ms-swatches small { font-size: 11px; color: var(--muted); }
.ms-slug { display: flex; align-items: center; gap: 2px; border: 1px solid var(--border); border-radius: 10px; padding-left: 10px; background: var(--surface-2); overflow: hidden; }
.ms-slug > span { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.ms-slug input { border: 0 !important; background: var(--surface) !important; flex: 1; min-width: 0; }
.ms-pick { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
@media (max-width: 700px) { .ms-edit-media { grid-template-columns: 1fr; } }

/* Listing documents (private) */
.pdoc-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pdoc-list li { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.pdoc-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.pdoc-link > i { font-size: 20px; color: var(--brand); flex: none; }
.pdoc-link span { min-width: 0; }
.pdoc-link small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdoc-link:hover strong { color: var(--brand); }
.pdoc-upload { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.pdoc-upload select { height: 32px; font-size: 12px; flex: 1 1 150px; min-width: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); padding: 0 8px; }
.pdoc-upload input[type=file] { font-size: 12px; flex: 1 1 160px; min-width: 0; }

/* Seller mandates */
.mandate-wrap { max-width: 760px; }
.mandate-letter { padding: 22px 24px; line-height: 1.65; font-size: 14.5px; }
.mandate-letter h1 { font-size: 20px; margin: 0 0 12px; }
.mandate-letter h2 { font-size: 14px; color: var(--brand); margin: 18px 0 4px; text-transform: none; letter-spacing: 0; }
.mandate-letter p { margin: 0 0 10px; }
.card .mandate-letter { padding: 4px 0 0; max-height: 520px; overflow-y: auto; }
.mandate-step { display: flex; align-items: center; gap: 10px; font-size: 17px; margin: 0; }
.mandate-step span { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 13px; flex: none; }
.mandate-code { display: flex; gap: 8px; }
.mandate-code input { flex: 1; min-width: 0; height: 42px; font-size: 20px; letter-spacing: 6px; text-align: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.sig-pad { display: block; width: 100%; height: 150px; margin: 6px 0; border: 1px dashed var(--border); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; }
.mandate-refuse { padding: 14px 18px; }
.mandate-refuse summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.mandate-refuse form { margin-top: 12px; }
.mandate-card .stack form { margin: 0; }
.mandate-card .stack > form + form, .mandate-card .stack > a + form { margin-top: 0; }
.mandate-card input[name=note] { height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; background: var(--surface); color: var(--text); font-size: 13px; }
.mandate-admin { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; font-size: 13px; }
.mandate-admin summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.mandate-admin form { margin-top: 10px; }
.flag-list { margin: 4px 0 0; padding-left: 18px; }
.flag-list li { margin: 2px 0; }
.row-flag td { background: color-mix(in srgb, var(--red) 6%, transparent); }
.flag-why { color: var(--red); max-width: 240px; }
a.callout.dash-flag { text-decoration: none; color: inherit; margin-bottom: 16px; }
.mandate-config { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.mandate-config textarea.mono-text { width: 100%; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--surface); color: var(--text); resize: vertical; }
.mandate-config code { font-size: 11.5px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
@media (max-width: 900px) { .mandate-config { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .mandate-letter { padding: 16px; font-size: 14px; } }

/* My account */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.account-grid .form-card { display: flex; flex-direction: column; gap: 12px; }
.forgot-link { margin: -6px 0 0; text-align: right; }

/* Brand logo: black lettering on light pages, white lettering in dark mode */
:root:not([data-theme="dark"]) .logo-dark-only, :root[data-theme="dark"] .logo-light-only { display: none !important; }

/* Franchises */
.franchise-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 960px) { .franchise-layout { grid-template-columns: 1fr; } }
.broker-filter { width: 100%; height: 36px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; background: var(--surface); color: var(--text); margin: 6px 0 10px; }
.broker-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 14px; max-height: 360px; overflow-y: auto; padding: 4px 2px; }
.broker-pick .check { font-weight: 500; font-size: 13.5px; }
.broker-pick small { display: block; font-weight: 400; }

/* ---------- Broker sidebar: badges on menu items ---------- */
.nav-link .dot-count { margin-left: auto; }
.nav-link.active .dot-count { background: #fff; color: var(--brand); }
.sb-collapsed .nav-link { position: relative; }
.sb-collapsed .nav-link .dot-count { position: absolute; top: 3px; right: 6px; min-width: 16px; height: 16px; font-size: 9px; padding: 0 4px; }
@media (max-width: 900px) {
    .sb-collapsed .nav-link .dot-count { position: static; min-width: 18px; height: 18px; font-size: 10px; }
}

/* ---------- Franchise reports ---------- */
.report-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 16px 18px; }
.report-filters .field { min-width: 170px; flex: 0 1 200px; margin: 0; }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.report-range { flex-basis: 100%; margin: 0; }
.report-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.report-kpis .kpi { gap: 10px; }
.report-kpis .kpi-value { font-size: 22px; }
.report-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.report-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
.report-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); border-color: var(--brand); }
.report-card > div { flex: 1; min-width: 0; }
.report-card p { margin: 3px 0 0; }
.report-card .kpi-icon { flex: none; }
.report-table td, .report-table th { white-space: nowrap; }
.report-table td:first-child { white-space: normal; min-width: 160px; }
.report-table tfoot th { background: var(--surface-2); font-weight: 800; }
.report-table tfoot th:first-child { border-radius: 10px 0 0 10px; } .report-table tfoot th:last-child { border-radius: 0 10px 10px 0; }
.report-ho td { background: color-mix(in srgb, var(--brand) 5%, transparent); }
.rep-trend { font-size: 11px; margin-left: 2px; }
.rep-trend.up { color: var(--green); } .rep-trend.down { color: var(--red); }
.rep-warn { color: var(--amber); font-size: 12px; }
.rep-star { color: var(--amber); font-size: 11px; }
.rep-issue { font-weight: 800; color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.report-grid td.num { font-variant-numeric: tabular-nums; }
.rep-j { color: var(--violet); font-weight: 700; } .rep-r { color: var(--green); font-weight: 700; } .rep-l { color: var(--red); font-weight: 700; }
.report-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.report-bars li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 32px; gap: 10px; align-items: center; font-size: 13px; }
.report-bars b { display: block; height: 10px; width: var(--w); min-width: 4px; border-radius: 6px; background: var(--brand-grad); }
.report-bars em { font-style: normal; font-weight: 700; text-align: right; }
.report-chart { position: relative; height: 280px; }
.report-pipe li { display: grid; grid-template-columns: 1fr 40px 110px; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.report-pipe b { text-align: right; } .report-pipe em { font-style: normal; text-align: right; color: var(--muted); }
.report-split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .report-cards, .report-split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
    .report-filters .field { flex: 1 1 100%; }
    .report-actions { margin-left: 0; width: 100%; } .report-actions .btn { flex: 1; justify-content: center; }
    .report-kpis .kpi-value { font-size: 18px; }
}
.report-section { font-size: 17px; margin: 6px 0 -6px; }
