:root {
    --primary: #1a3c5e;
    --primary-light: #2563a8;
    --accent: #ec293e;
    --accent-hover: #e09010;
    --sidebar-bg: #094281;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-h: 64px;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --text: #1a2332;
    --text-muted: #6b7a8d;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.crm-body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---- SIDEBAR ---- */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    z-index: 1000;
    overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .user-details,
.sidebar.collapsed .brand-role { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }

.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-icon {
    width: 42px; height: 42px;
    background: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #fff;
    flex-shrink: 0;
}
.brand-name {
    font-family: 'DM Sans', 'Syne', sans-serif;
    font-weight: 800; font-size: 18px; color: #fff;
    display: block; line-height: 1;
}
.brand-role { font-size: 11px; display: block; margin-top: 2px; }

.brand-text{
    background: #fff;
    border-radius: 10px;
    color: #000;
    text-align: center;
}


.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-section-label {
    font-size: 10px; font-weight: 600; letter-spacing: 1.5px;
    color: rgba(255,255,255,0.3); padding: 12px 20px 4px;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px; color: rgba(255,255,255,0.65);
    text-decoration: none; font-size: 14px; font-weight: 500;
    border-radius: 0; transition: all 0.2s; position: relative;
    white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active {
    background: rgb(229 50 53 / 15%); color: var(--accent);
    border-right: 3px solid var(--accent);
}
.nav-item i { font-size: 18px; flex-shrink: 0; width: 20px; text-align: center; }
.badge-count {
    margin-left: auto; background: var(--danger); color: #fff;
    font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 10px;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 14px 16px;
    display: flex; align-items: center; gap: 10px;
}
.user-avatar {
    width: 38px; height: 38px;
    background: var(--accent); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: #fff; display: block; white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.4); display: block; }
.btn-logout {
    margin-left: auto; background: rgba(255,255,255,0.08); border: none;
    color: rgba(255,255,255,0.5); width: 36px; height: 36px;
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; font-size: 18px; flex-shrink: 0;
}
.btn-logout:hover { background: var(--danger); color: #fff; }

/* ---- MAIN CONTENT ---- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    display: flex; flex-direction: column;
}
.main-content.expanded { margin-left: var(--sidebar-collapsed); }

.topbar {
    position: sticky; top: 0; z-index: 100;
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 24px; gap: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.sidebar-toggle {
    background: none; border: 1px solid var(--border); color: var(--text-muted);
    width: 38px; height: 38px; border-radius: 8px; font-size: 20px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    transition: all 0.2s;
}
.sidebar-toggle:hover { background: var(--bg); }
.topbar-title {
    font-family: 'DM Sans', 'Syne', sans-serif; font-weight: 700;
    font-size: 18px; color: var(--text);
}
.topbar-right { margin-left: auto; }
.topbar-time { font-size: 13px; color: var(--text-muted); font-weight: 500; }

.content-area { padding: 28px; flex: 1; }

/* ---- CARDS ---- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header-custom {
    padding: 18px 24px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header-custom h5 {
    font-family: 'DM Sans', 'Syne', sans-serif; font-weight: 700; margin: 0; font-size: 16px;
}
.card-body-p { padding: 24px; }

/* ---- STAT CARDS ---- */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 20px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; flex-shrink: 0;
}
.stat-icon.blue { background: rgba(37,99,168,0.1); color: var(--primary-light); }
.stat-icon.amber { background: rgba(245,166,35,0.12); color: var(--accent); }
.stat-icon.green { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-icon.red { background: rgba(239,68,68,0.1); color: var(--danger); }
.stat-icon.purple { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.stat-value { font-family: 'DM Sans', 'Syne', sans-serif; font-size: 28px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ---- BUTTONS ---- */
.btn-primary-crm {
    background: var(--primary); color: #fff; border: none;
    padding: 9px 20px; border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 7px;
}
.btn-primary-crm:hover { background: var(--primary-light); color: #fff; }
.btn-accent {
    background: var(--accent); color: #fff; border: none;
    padding: 9px 20px; border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 7px;
    text-decoration: none;
}
.btn-accent:hover { background: var(--accent-hover); color: #fff; }

/* ---- TABLES ---- */
.table-crm { border-collapse: separate; border-spacing: 0; width: 100%; }
.table-crm th {
    background: #f8fafc; color: var(--text-muted); font-size: 12px;
    font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
    padding: 12px 16px; border-bottom: 2px solid var(--border);
}
.table-crm td {
    padding: 13px 16px; border-bottom: 1px solid var(--border);
    font-size: 14px; vertical-align: middle;
}
.table-crm tr:last-child td { border-bottom: none; }
.table-crm tbody tr:hover { background: #f8fafc; }

/* ---- STATUS BADGES ---- */
.status-badge {
    padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; display: inline-block;
}
.status-available { background: rgba(16,185,129,0.1); color: #059669; }
.status-booked { background: rgba(59,130,246,0.1); color: #2563eb; }
.status-registered { background: rgba(139,92,246,0.1); color: #7c3aed; }
.status-mortgage { background: rgba(245,158,11,0.1); color: #d97706; }
.status-hold { background: rgba(239,68,68,0.1); color: #dc2626; }
.status-pending { background: rgba(245,158,11,0.1); color: #b45309; }
.status-confirmed { background: rgba(16,185,129,0.1); color: #065f46; }
.status-rejected { background: rgba(239,68,68,0.1); color: #991b1b; }

/* ---- FORMS ---- */
.form-control-crm {
    border: 1.5px solid var(--border); border-radius: 8px;
    padding: 9px 14px; font-size: 14px; width: 100%;
    transition: border-color 0.2s; background: #fff; color: var(--text);
    font-family: 'DM Sans', sans-serif;
}
.form-control-crm:focus { border-color: var(--primary-light); outline: none; box-shadow: 0 0 0 3px rgba(37,99,168,0.08); }
.form-label-crm { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; display: block; }

/* ---- LAYOUT MAP ---- */
.layout-map-container {
    position: relative; background: #f0f4f8;
    border: 2px solid var(--border); border-radius: var(--radius);
    overflow: auto; min-height: 400px;
}
.layout-map-img { display: block; max-width: 100%; }
.plot-overlay {
    position: absolute; border: 2px solid rgba(255,255,255,0.8);
    cursor: pointer; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff;
    transition: all 0.2s; text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.plot-overlay:hover { filter: brightness(0.85); transform: scale(1.05); z-index: 10; }
.plot-overlay.available { background: rgba(16,185,129,0.75); }
.plot-overlay.booked { background: rgba(59,130,246,0.8); }
.plot-overlay.registered { background: rgba(139,92,246,0.8); }
.plot-overlay.mortgage { background: rgba(245,158,11,0.8); }
.plot-overlay.hold { background: rgba(239,68,68,0.8); }

/* ---- PLOT LEGEND ---- */
.plot-legend { display: flex; gap: 12px; flex-wrap: wrap; padding: 12px 0; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.legend-dot { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }

/* ---- AUTH PAGES ---- */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f1f33 0%, #1a3c5e 50%, #0f1f33 100%);
    position: relative; overflow: hidden;
}
.auth-page::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(245,166,35,0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 20%, rgba(37,99,168,0.15) 0%, transparent 50%);
}
.auth-card {
    background: #fff; border-radius: 20px;
    width: 420px; padding: 44px 40px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.35);
    position: relative; z-index: 1;
}
.auth-logo {
    text-align: center; margin-bottom: 32px;
}
.auth-logo-icon {
    width: 64px; height: 64px; background: var(--accent);
    border-radius: 16px; display: inline-flex; align-items: center;
    justify-content: center; font-size: 30px; color: #fff; margin-bottom: 12px;
}
.auth-title {
    font-family: 'DM Sans', 'Syne', sans-serif; font-weight: 800;
    font-size: 26px; color: var(--text); text-align: center;
}
.auth-subtitle { font-size: 14px; color: var(--text-muted); text-align: center; margin-top: 4px; }
.auth-tabs { display: flex; gap: 0; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 28px; }
.auth-tab {
    flex: 1; padding: 9px; border: none; background: none; border-radius: 7px;
    font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all 0.2s;
}
.auth-tab.active { background: #fff; color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.btn-auth {
    width: 100%; background: var(--primary); color: #fff; border: none;
    padding: 12px; border-radius: 10px; font-size: 15px; font-weight: 700;
    cursor: pointer; transition: all 0.2s; font-family: 'DM Sans', sans-serif;
    margin-top: 8px;
}
.btn-auth:hover { background: var(--primary-light); }

/* ---- PUBLIC PAGE ---- */
.public-hero {
    background: linear-gradient(135deg, #0f1f33 0%, #1a3c5e 100%);
    padding: 60px 0 40px; color: #fff; text-align: center;
}
.public-hero h1 { font-family: 'DM Sans', 'Syne', sans-serif; font-weight: 800; font-size: 36px; }
.public-hero p { color: rgba(255,255,255,0.65); font-size: 16px; }

/* ---- MODAL IMPROVEMENTS ---- */
.modal-content { border: none; border-radius: 16px; box-shadow: var(--shadow-lg); }
.modal-header {
    background: var(--primary); color: #fff; border-radius: 16px 16px 0 0;
    padding: 18px 24px;
}
.modal-header .btn-close { filter: invert(1) brightness(2); }
.modal-title { font-family: 'DM Sans', 'Syne', sans-serif; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; background: #f8fafc; border-radius: 0 0 16px 16px; }

/* ---- PAGE HEADER ---- */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h4 {
    font-family: 'DM Sans', 'Syne', sans-serif; font-weight: 700; margin: 0;
}
.breadcrumb-crm { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .content-area { padding: 16px; }
    .auth-card { width: 95%; padding: 32px 24px; }
}

/* ---- ANIMATIONS ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp 0.4s ease forwards; }

/* ---- UTILITIES ---- */
.text-primary-crm { color: var(--primary); }
.text-accent { color: var(--accent); }
.fw-700 { font-weight: 700; }
.font-syne { font-family: 'DM Sans', 'Syne', sans-serif; }
.rounded-12 { border-radius: 12px; }
.table-responsive { border-radius: var(--radius); overflow: hidden; }


/* ============================================================
   NEW STATUS BADGE & MAP CLASSES (added for extended statuses)
   ============================================================ */
.status-allotment-pending         { background: rgba(6,182,212,0.12);   color: #0e7490; }
.status-allotment-paid            { background: rgba(8,145,178,0.12);   color: #0c4a6e; }
.status-full-payment-paid         { background: rgba(124,58,237,0.12);  color: #5b21b6; }
.status-registration-charges-paid { background: rgba(16,185,129,0.12);  color: #047857; }
.status-reg-money-partial-paid    { background: rgba(249,115,22,0.12);  color: #c2410c; }
.status-others                    { background: rgba(148,163,184,0.12); color: #475569; }

.plot-overlay.allotment-pending          { background: rgba(6,182,212,0.82);   }
.plot-overlay.allotment-paid             { background: rgba(8,145,178,0.82);   }
.plot-overlay.full-payment-paid          { background: rgba(124,58,237,0.82);  }
.plot-overlay.registration-charges-paid  { background: rgba(16,185,129,0.82);  }
.plot-overlay.reg-money-partial-paid     { background: rgba(249,115,22,0.82);  }
.plot-overlay.others                     { background: rgba(148,163,184,0.82); }

.plot-card.allotment-pending          { background: linear-gradient(135deg,#06b6d4,#0891b2); }
.plot-card.allotment-paid             { background: linear-gradient(135deg,#0891b2,#0c4a6e); }
.plot-card.full-payment-paid          { background: linear-gradient(135deg,#7c3aed,#5b21b6); }
.plot-card.registration-charges-paid  { background: linear-gradient(135deg,#10b981,#047857); }
.plot-card.reg-money-partial-paid     { background: linear-gradient(135deg,#f97316,#c2410c); }
.plot-card.others                     { background: linear-gradient(135deg,#94a3b8,#64748b); }
