/* ═══════════════════════════════════════════════════════════════════════
   AGENCY CRM — COMPREHENSIVE MULTI-THEME & FAMOUS CRM/ERP DESIGN SYSTEM
   Supports: Dark & Light Mode, Famous CRM Presets, Custom Primary Colors,
   Sidebar Styles, Typography Scaling, and Density.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    /* Base Font & Sizing */
    --crm-font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --crm-font-size-base: 0.875rem; /* 14px */
    --crm-radius: 0.75rem;          /* 12px */

    /* Default Brand Colors (Modern Indigo) */
    --crm-primary: #4f46e5;
    --crm-primary-rgb: 79, 70, 229;
    --crm-primary-light: #818cf8;
    --crm-primary-dark: #3730a3;
    --crm-primary-hover: #4338ca;
    --crm-accent: #06b6d4;

    /* Bootstrap 5 Primary Mapping */
    --bs-primary: var(--crm-primary);
    --bs-primary-rgb: var(--crm-primary-rgb);

    /* Light Mode Backgrounds & Surfaces */
    --crm-body-bg: #f8fafc;
    --crm-card-bg: #ffffff;
    --crm-card-border: #e2e8f0;
    --crm-text: #0f172a;
    --crm-text-muted: #64748b;
    --crm-input-bg: #ffffff;
    --crm-input-border: #cbd5e1;

    /* Sidebar Defaults (Dark Navy) */
    --sidebar-bg: #0f172a;
    --sidebar-border: rgba(255, 255, 255, 0.07);
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
    --sidebar-active-bg: rgba(79, 70, 229, 0.18);
    --sidebar-active-border: var(--crm-primary);
    --sidebar-heading: #64748b;
    --sidebar-divider: #1e293b;

    /* Topbar */
    --topbar-bg: #ffffff;
    --topbar-border: #e2e8f0;

    /* Soft Badges */
    --badge-success-bg: #dcfce7;
    --badge-success-text: #15803d;
    --badge-primary-bg: #e0e7ff;
    --badge-primary-text: #3730a3;
    --badge-warning-bg: #fef3c7;
    --badge-warning-text: #a16207;
    --badge-info-bg: #e0f2fe;
    --badge-info-text: #0369a1;
    --badge-danger-bg: #fee2e2;
    --badge-danger-text: #b91c1c;

    /* Elevation & Shadows */
    --crm-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --crm-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --crm-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

/* ═══════════════════════════════════════════════════════════════════════
   PRESET 1: SALESFORCE LIGHTNING (ENTERPRISE BLUE)
   ═══════════════════════════════════════════════════════════════════════ */
[data-crm-preset="salesforce"] {
    --crm-primary: #0176d3;
    --crm-primary-rgb: 1, 118, 211;
    --crm-primary-light: #4b9bdf;
    --crm-primary-dark: #014486;
    --crm-primary-hover: #0b5cab;
    --crm-accent: #04844b;
    --sidebar-bg: #032d60;
    --sidebar-hover-bg: #0b3e7a;
    --sidebar-active-bg: rgba(255, 255, 255, 0.14);
    --sidebar-active-border: #0176d3;
    --crm-radius: 0.375rem;
}
[data-crm-preset="salesforce"]:not([data-bs-theme="dark"]):not([data-theme="dark"]) {
    --crm-body-bg: #f3f3f3;
    --crm-card-border: #dddbda;
}

/* ═══════════════════════════════════════════════════════════════════════
   PRESET 2: HUBSPOT MODERN (WARM INBOUND CORAL)
   ═══════════════════════════════════════════════════════════════════════ */
[data-crm-preset="hubspot"] {
    --crm-primary: #ff5c35;
    --crm-primary-rgb: 255, 92, 53;
    --crm-primary-light: #ff7a59;
    --crm-primary-dark: #e5431b;
    --crm-primary-hover: #e5431b;
    --crm-accent: #00a4bd;
    --sidebar-bg: #2d3e50;
    --sidebar-hover-bg: #374a5f;
    --sidebar-active-bg: rgba(255, 92, 53, 0.2);
    --sidebar-active-border: #ff5c35;
    --crm-radius: 0.75rem;
}
[data-crm-preset="hubspot"]:not([data-bs-theme="dark"]):not([data-theme="dark"]) {
    --crm-body-bg: #f5f8fa;
    --crm-card-border: #cbd6e2;
}

/* ═══════════════════════════════════════════════════════════════════════
   PRESET 3: PERFEX CRM CLASSIC (AGENCY TEAL-BLUE)
   ═══════════════════════════════════════════════════════════════════════ */
[data-crm-preset="perfex"] {
    --crm-primary: #0284c7;
    --crm-primary-rgb: 2, 132, 199;
    --crm-primary-light: #38bdf8;
    --crm-primary-dark: #0369a1;
    --crm-primary-hover: #0369a1;
    --crm-accent: #10b981;
    --sidebar-bg: #212529;
    --sidebar-hover-bg: #2c3238;
    --sidebar-active-bg: rgba(2, 132, 199, 0.22);
    --sidebar-active-border: #0284c7;
    --crm-radius: 0.375rem;
}
[data-crm-preset="perfex"]:not([data-bs-theme="dark"]):not([data-theme="dark"]) {
    --crm-body-bg: #eef2f5;
    --crm-card-border: #dbe2e8;
}

/* ═══════════════════════════════════════════════════════════════════════
   PRESET 4: ZOHO ONE / CATALYST (EXECUTIVE CRIMSON)
   ═══════════════════════════════════════════════════════════════════════ */
[data-crm-preset="zoho"] {
    --crm-primary: #e42528;
    --crm-primary-rgb: 228, 37, 40;
    --crm-primary-light: #ef4444;
    --crm-primary-dark: #b91c1c;
    --crm-primary-hover: #b91c1c;
    --crm-accent: #2563eb;
    --sidebar-bg: #18181b;
    --sidebar-hover-bg: #27272a;
    --sidebar-active-bg: rgba(228, 37, 40, 0.18);
    --sidebar-active-border: #e42528;
    --crm-radius: 0.375rem;
}
[data-crm-preset="zoho"]:not([data-bs-theme="dark"]):not([data-theme="dark"]) {
    --crm-body-bg: #f4f4f5;
    --crm-card-border: #e4e4e7;
}

/* ═══════════════════════════════════════════════════════════════════════
   PRESET 5: LINEAR / VERCEL DARK (CYBER MINIMALIST)
   ═══════════════════════════════════════════════════════════════════════ */
[data-crm-preset="linear"] {
    --crm-primary: #5e6ad2;
    --crm-primary-rgb: 94, 106, 210;
    --crm-primary-light: #818cf8;
    --crm-primary-dark: #4338ca;
    --crm-primary-hover: #4f46e5;
    --crm-accent: #a855f7;
    --sidebar-bg: #09090b;
    --sidebar-hover-bg: #18181b;
    --sidebar-active-bg: rgba(94, 106, 210, 0.22);
    --sidebar-active-border: #5e6ad2;
    --crm-radius: 0.5rem;
}
[data-crm-preset="linear"]:not([data-bs-theme="dark"]):not([data-theme="dark"]) {
    --crm-body-bg: #f8fafc;
    --crm-card-border: #e2e8f0;
}

/* ═══════════════════════════════════════════════════════════════════════
   PRESET 6: EMERALD GROWTH ERP
   ═══════════════════════════════════════════════════════════════════════ */
[data-crm-preset="emerald"] {
    --crm-primary: #059669;
    --crm-primary-rgb: 5, 150, 105;
    --crm-primary-light: #34d399;
    --crm-primary-dark: #047857;
    --crm-primary-hover: #047857;
    --crm-accent: #0ea5e9;
    --sidebar-bg: #064e3b;
    --sidebar-hover-bg: #065f46;
    --sidebar-active-bg: rgba(255, 255, 255, 0.16);
    --sidebar-active-border: #34d399;
    --crm-radius: 0.75rem;
}
[data-crm-preset="emerald"]:not([data-bs-theme="dark"]):not([data-theme="dark"]) {
    --crm-body-bg: #f0fdf4;
    --crm-card-border: #bbf7d0;
}

/* ═══════════════════════════════════════════════════════════════════════
   PRESET 7: SUNSET AMBER & GOLD
   ═══════════════════════════════════════════════════════════════════════ */
[data-crm-preset="sunset"] {
    --crm-primary: #d97706;
    --crm-primary-rgb: 217, 119, 6;
    --crm-primary-light: #fbbf24;
    --crm-primary-dark: #b45309;
    --crm-primary-hover: #b45309;
    --crm-accent: #dc2626;
    --sidebar-bg: #1c1917;
    --sidebar-hover-bg: #292524;
    --sidebar-active-bg: rgba(217, 119, 6, 0.22);
    --sidebar-active-border: #d97706;
    --crm-radius: 0.75rem;
}
[data-crm-preset="sunset"]:not([data-bs-theme="dark"]):not([data-theme="dark"]) {
    --crm-body-bg: #fffbeb;
    --crm-card-border: #fde68a;
}

/* ═══════════════════════════════════════════════════════════════════════
   DARK MODE ARCHITECTURE (Applied whenever data-bs-theme="dark" or data-theme="dark")
   ═══════════════════════════════════════════════════════════════════════ */
[data-bs-theme="dark"],
[data-theme="dark"] {
    /* Bootstrap Theme Variables */
    --bs-body-bg: #0b0f19 !important;
    --bs-body-color: #f1f5f9 !important;
    --bs-emphasis-color: #ffffff !important;
    --bs-card-bg: #111827 !important;
    --bs-card-color: #f1f5f9 !important;
    --bs-card-border-color: rgba(255, 255, 255, 0.08) !important;
    --bs-border-color: rgba(255, 255, 255, 0.08) !important;
    --bs-tertiary-bg: #172033 !important;
    --bs-light-rgb: 23, 32, 51 !important;
    --bs-dark-rgb: 241, 245, 249 !important;

    /* Core Surface & Text Variables */
    --crm-body-bg: #0b0f19 !important;
    --crm-card-bg: #111827 !important;
    --crm-card-border: rgba(255, 255, 255, 0.08) !important;
    --crm-text: #f1f5f9 !important;
    --crm-text-muted: #94a3b8 !important;
    --topbar-bg: #0f172a !important;
    --topbar-border: rgba(255, 255, 255, 0.08) !important;
    --crm-input-bg: #1a2234 !important;
    --crm-input-border: #334155 !important;

    /* Badges in Dark Mode */
    --badge-success-bg: rgba(22, 163, 74, 0.22);
    --badge-success-text: #4ade80;
    --badge-primary-bg: rgba(79, 70, 229, 0.22);
    --badge-primary-text: #a5b4fc;
    --badge-warning-bg: rgba(217, 119, 6, 0.22);
    --badge-warning-text: #fde047;
    --badge-info-bg: rgba(14, 165, 233, 0.22);
    --badge-info-text: #7dd3fc;
    --badge-danger-bg: rgba(220, 38, 38, 0.22);
    --badge-danger-text: #fca5a5;
}

/* Headings in Dark Mode */
[data-bs-theme="dark"] h1, [data-theme="dark"] h1,
[data-bs-theme="dark"] h2, [data-theme="dark"] h2,
[data-bs-theme="dark"] h3, [data-theme="dark"] h3,
[data-bs-theme="dark"] h4, [data-theme="dark"] h4,
[data-bs-theme="dark"] h5, [data-theme="dark"] h5,
[data-bs-theme="dark"] h6, [data-theme="dark"] h6 {
    color: #f8fafc !important;
}

/* Text Overrides in Dark Mode (Eliminates invisible black text) */
[data-bs-theme="dark"] .text-dark,
[data-theme="dark"] .text-dark,
[data-bs-theme="dark"] .text-black,
[data-theme="dark"] .text-black,
[data-bs-theme="dark"] .text-body,
[data-theme="dark"] .text-body {
    color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .text-muted,
[data-theme="dark"] .text-muted,
[data-bs-theme="dark"] .text-secondary,
[data-theme="dark"] .text-secondary {
    color: #94a3b8 !important;
}

/* Background Utility Classes in Dark Mode */
[data-bs-theme="dark"] .bg-white,
[data-theme="dark"] .bg-white {
    background-color: #111827 !important;
    color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .bg-light,
[data-theme="dark"] .bg-light {
    background-color: #172033 !important;
    color: #cbd5e1 !important;
}

/* Cards & Metric Cards in Dark Mode */
[data-bs-theme="dark"] .card,
[data-theme="dark"] .card {
    background-color: #111827 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .stat-card,
[data-theme="dark"] .stat-card {
    background-color: #111827 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .stat-card h3,
[data-theme="dark"] .stat-card h3,
[data-bs-theme="dark"] .stat-card h4,
[data-theme="dark"] .stat-card h4,
[data-bs-theme="dark"] .stat-card .fw-bold,
[data-theme="dark"] .stat-card .fw-bold {
    color: #f8fafc !important;
}

/* Borders in Dark Mode */
[data-bs-theme="dark"] .border,
[data-theme="dark"] .border,
[data-bs-theme="dark"] .border-top,
[data-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-bottom,
[data-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-start,
[data-theme="dark"] .border-start,
[data-bs-theme="dark"] .border-end,
[data-theme="dark"] .border-end {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Tables in Dark Mode */
[data-bs-theme="dark"] .table,
[data-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: #f1f5f9;
    --bs-table-border-color: rgba(255, 255, 255, 0.08);
    color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .table th,
[data-theme="dark"] .table th,
[data-bs-theme="dark"] .table-light,
[data-theme="dark"] .table-light,
[data-bs-theme="dark"] .table-light > * > *,
[data-theme="dark"] .table-light > * > *,
[data-bs-theme="dark"] thead.table-light > tr > th,
[data-theme="dark"] thead.table-light > tr > th {
    background-color: #172033 !important;
    color: #cbd5e1 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .table td,
[data-theme="dark"] .table td {
    color: #f1f5f9 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

[data-bs-theme="dark"] .table-hover tbody tr:hover,
[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

/* Form Controls in Dark Mode */
[data-bs-theme="dark"] .form-control,
[data-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-theme="dark"] .form-select {
    background-color: #1a2234 !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #1e293b !important;
    border-color: var(--crm-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(var(--crm-primary-rgb), 0.25) !important;
}

[data-bs-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .form-control::placeholder {
    color: #64748b !important;
}

[data-bs-theme="dark"] .input-group-text,
[data-theme="dark"] .input-group-text {
    background-color: #1a2234 !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

/* Modals & Offcanvas in Dark Mode */
[data-bs-theme="dark"] .modal-content,
[data-theme="dark"] .modal-content,
[data-bs-theme="dark"] .offcanvas,
[data-theme="dark"] .offcanvas {
    background-color: #111827 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .modal-header,
[data-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer,
[data-theme="dark"] .modal-footer,
[data-bs-theme="dark"] .offcanvas-header,
[data-theme="dark"] .offcanvas-header,
[data-bs-theme="dark"] .offcanvas-footer,
[data-theme="dark"] .offcanvas-footer {
    background-color: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Dropdowns in Dark Mode */
[data-bs-theme="dark"] .dropdown-menu,
[data-theme="dark"] .dropdown-menu {
    background-color: #111827 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5) !important;
}

[data-bs-theme="dark"] .dropdown-item,
[data-theme="dark"] .dropdown-item {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

/* List Groups in Dark Mode */
[data-bs-theme="dark"] .list-group-item,
[data-theme="dark"] .list-group-item {
    background-color: transparent !important;
    color: #f1f5f9 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Light Buttons in Dark Mode */
[data-bs-theme="dark"] .btn-light,
[data-theme="dark"] .btn-light {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
[data-bs-theme="dark"] .btn-light:hover,
[data-theme="dark"] .btn-light:hover {
    background-color: #334155 !important;
    color: #ffffff !important;
}

/* Topbar Elements in Dark Mode */
[data-bs-theme="dark"] .topbar-search,
[data-theme="dark"] .topbar-search {
    background: #172033 !important;
    border-color: #334155 !important;
}
[data-bs-theme="dark"] .topbar-search-input,
[data-theme="dark"] .topbar-search-input {
    color: #f1f5f9 !important;
}
[data-bs-theme="dark"] .topbar-icon-btn,
[data-theme="dark"] .topbar-icon-btn {
    color: #94a3b8 !important;
}
[data-bs-theme="dark"] .topbar-icon-btn:hover,
[data-theme="dark"] .topbar-icon-btn:hover {
    background: #1e293b !important;
    color: #f1f5f9 !important;
}
[data-bs-theme="dark"] .topbar-user-btn,
[data-theme="dark"] .topbar-user-btn {
    background: #172033 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
}
[data-bs-theme="dark"] .topbar-breadcrumb .breadcrumb-item.active,
[data-theme="dark"] .topbar-breadcrumb .breadcrumb-item.active {
    color: #f1f5f9 !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   SIDEBAR STYLES (Dark Navy, Jet Black, Brand Gradient, Clean White)
   ═══════════════════════════════════════════════════════════════════════ */
[data-sidebar-style="dark"] {
    --sidebar-bg: #0f172a !important;
    --sidebar-hover-bg: #1e293b !important;
    --sidebar-text: #94a3b8 !important;
    --sidebar-text-active: #ffffff !important;
    --sidebar-border: rgba(255, 255, 255, 0.06) !important;
    --sidebar-divider: #1e293b !important;
}

[data-sidebar-style="black"] {
    --sidebar-bg: #000000 !important;
    --sidebar-hover-bg: #111827 !important;
    --sidebar-text: #9ca3af !important;
    --sidebar-text-active: #ffffff !important;
    --sidebar-border: rgba(255, 255, 255, 0.08) !important;
    --sidebar-divider: rgba(255, 255, 255, 0.08) !important;
}
[data-sidebar-style="black"] .crm-sidebar {
    background: #000000 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
}

[data-sidebar-style="brand"] {
    --sidebar-bg: linear-gradient(180deg, var(--crm-primary-dark, #3730a3) 0%, #0f172a 100%) !important;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.12) !important;
    --sidebar-text: #cbd5e1 !important;
    --sidebar-text-active: #ffffff !important;
    --sidebar-border: rgba(255, 255, 255, 0.1) !important;
    --sidebar-divider: rgba(255, 255, 255, 0.1) !important;
}
[data-sidebar-style="brand"] .crm-sidebar {
    background: linear-gradient(180deg, var(--crm-primary-dark, #3730a3) 0%, #0f172a 100%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
}
[data-sidebar-style="brand"] .sidebar-menu-link {
    color: rgba(255, 255, 255, 0.82) !important;
}
[data-sidebar-style="brand"] .sidebar-menu-link:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
}
[data-sidebar-style="brand"] .sidebar-menu-item.active > .sidebar-menu-link {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    border-left-color: #ffffff !important;
}

[data-sidebar-style="light"] {
    --sidebar-bg: #ffffff !important;
    --sidebar-text: #475569 !important;
    --sidebar-text-active: var(--crm-primary, #4f46e5) !important;
    --sidebar-hover-bg: #f8fafc !important;
    --sidebar-active-bg: rgba(var(--crm-primary-rgb, 79, 70, 229), 0.1) !important;
    --sidebar-active-border: var(--crm-primary, #4f46e5) !important;
    --sidebar-border: #e2e8f0 !important;
    --sidebar-divider: #e2e8f0 !important;
    --sidebar-heading: #94a3b8 !important;
}
[data-sidebar-style="light"] .crm-sidebar {
    background: #ffffff !important;
    border-right: 1px solid #e2e8f0 !important;
}
[data-sidebar-style="light"] .sidebar-brand {
    border-bottom: 1px solid #e2e8f0 !important;
}
[data-sidebar-style="light"] .sidebar-brand-link {
    color: #0f172a !important;
}
[data-sidebar-style="light"] .sidebar-brand-text {
    color: #0f172a !important;
}
[data-sidebar-style="light"] .sidebar-collapse-btn {
    border-color: #e2e8f0 !important;
    color: #64748b !important;
}
[data-sidebar-style="light"] .sidebar-collapse-btn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}
[data-sidebar-style="light"] .sidebar-menu-link {
    color: #475569 !important;
}
[data-sidebar-style="light"] .sidebar-menu-link:hover {
    background: #f8fafc !important;
    color: var(--crm-primary, #4f46e5) !important;
}
[data-sidebar-style="light"] .sidebar-menu-item.active > .sidebar-menu-link {
    background: rgba(var(--crm-primary-rgb, 79, 70, 229), 0.1) !important;
    color: var(--crm-primary, #4f46e5) !important;
    border-left-color: var(--crm-primary, #4f46e5) !important;
}
[data-sidebar-style="light"] .sidebar-submenu {
    background: #f8fafc !important;
}
[data-sidebar-style="light"] .sidebar-submenu li a {
    color: #64748b !important;
}
[data-sidebar-style="light"] .sidebar-submenu li a:hover {
    color: var(--crm-primary, #4f46e5) !important;
    background: rgba(0, 0, 0, 0.03) !important;
}
[data-sidebar-style="light"] .sidebar-submenu li.active a {
    color: var(--crm-primary, #4f46e5) !important;
    font-weight: 600 !important;
}
[data-sidebar-style="light"] .sidebar-submenu li.active a::before {
    background: var(--crm-primary, #4f46e5) !important;
}
[data-sidebar-style="light"] .sidebar-divider {
    background: #e2e8f0 !important;
}
[data-sidebar-style="light"] .sidebar-footer {
    border-top: 1px solid #e2e8f0 !important;
}
[data-sidebar-style="light"] .sidebar-user-name {
    color: #0f172a !important;
}
[data-sidebar-style="light"] .sidebar-user-role {
    color: #64748b !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   TYPOGRAPHY FONT FAMILIES
   ═══════════════════════════════════════════════════════════════════════ */
[data-font-family="inter"] { font-family: 'Inter', system-ui, sans-serif !important; }
[data-font-family="jakarta"] { font-family: 'Plus Jakarta Sans', system-ui, sans-serif !important; }
[data-font-family="outfit"] { font-family: 'Outfit', system-ui, sans-serif !important; }
[data-font-family="roboto"] { font-family: 'Roboto', system-ui, sans-serif !important; }
[data-font-family="poppins"] { font-family: 'Poppins', system-ui, sans-serif !important; }

/* ═══════════════════════════════════════════════════════════════════════
   FONT SIZES & DENSITY SCALING
   ═══════════════════════════════════════════════════════════════════════ */
[data-font-size="compact"] {
    font-size: 13px !important;
}
[data-font-size="compact"] .table td,
[data-font-size="compact"] .table th {
    padding-top: 0.4rem !important;
    padding-bottom: 0.4rem !important;
}
[data-font-size="compact"] .btn {
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
    font-size: 0.8125rem !important;
}
[data-font-size="compact"] .card-body {
    padding: 0.85rem !important;
}

[data-font-size="standard"] {
    font-size: 14px !important;
}

[data-font-size="comfortable"] {
    font-size: 15.5px !important;
}
[data-font-size="comfortable"] .table td,
[data-font-size="comfortable"] .table th {
    padding-top: 0.85rem !important;
    padding-bottom: 0.85rem !important;
}
[data-font-size="comfortable"] .card-body {
    padding: 1.5rem !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   BORDER RADIUS MODES
   ═══════════════════════════════════════════════════════════════════════ */
[data-border-radius="sharp"] {
    --crm-radius: 0px !important;
}
[data-border-radius="sharp"] .card,
[data-border-radius="sharp"] .btn,
[data-border-radius="sharp"] .form-control,
[data-border-radius="sharp"] .form-select,
[data-border-radius="sharp"] .badge,
[data-border-radius="sharp"] .rounded,
[data-border-radius="sharp"] .rounded-3,
[data-border-radius="sharp"] .rounded-circle {
    border-radius: 0 !important;
}

[data-border-radius="rounded"] {
    --crm-radius: 0.375rem !important; /* 6px */
}

[data-border-radius="smooth"] {
    --crm-radius: 0.75rem !important; /* 12px */
}

[data-border-radius="pill"] {
    --crm-radius: 1.25rem !important; /* 20px */
}
[data-border-radius="pill"] .btn {
    border-radius: 50rem !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   GLOBAL ELEMENT BINDINGS TO DYNAMIC VARIABLES
   ═══════════════════════════════════════════════════════════════════════ */
body {
    background-color: var(--crm-body-bg) !important;
    color: var(--crm-text) !important;
    font-family: inherit;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.crm-sidebar {
    background: var(--sidebar-bg) !important;
    border-right: 1px solid var(--sidebar-border) !important;
}

.sidebar-menu-link {
    color: var(--sidebar-text) !important;
}

.sidebar-menu-link:hover {
    background: var(--sidebar-hover-bg) !important;
    color: var(--sidebar-text-active) !important;
}

.sidebar-menu-item.active > .sidebar-menu-link,
.sidebar-submenu li.active a {
    background: var(--sidebar-active-bg) !important;
    color: var(--sidebar-text-active) !important;
    border-left: 3px solid var(--sidebar-active-border);
}

.crm-topbar {
    background: var(--topbar-bg) !important;
    border-bottom: 1px solid var(--topbar-border) !important;
}

.card {
    background-color: var(--crm-card-bg) !important;
    border: 1px solid var(--crm-card-border) !important;
    border-radius: var(--crm-radius) !important;
    color: var(--crm-text);
}

.btn-primary {
    background-color: var(--crm-primary) !important;
    border-color: var(--crm-primary) !important;
    color: #ffffff !important;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--crm-primary-hover, var(--crm-primary)) !important;
    border-color: var(--crm-primary-hover, var(--crm-primary)) !important;
}

.btn-outline-primary {
    color: var(--crm-primary) !important;
    border-color: var(--crm-primary) !important;
}

.btn-outline-primary:hover {
    background-color: var(--crm-primary) !important;
    border-color: var(--crm-primary) !important;
    color: #ffffff !important;
}

.text-primary {
    color: var(--crm-primary) !important;
}

.bg-primary-subtle {
    background-color: rgba(var(--crm-primary-rgb), 0.12) !important;
    color: var(--crm-primary) !important;
}

.border-primary {
    border-color: var(--crm-primary) !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   FLOATING THEME CUSTOMIZER DRAWER (OFFCANVAS)
   ═══════════════════════════════════════════════════════════════════════ */
.theme-trigger-btn {
    position: fixed;
    right: 20px;
    bottom: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--crm-primary);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(var(--crm-primary-rgb), 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    cursor: pointer;
    border: none;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.theme-trigger-btn:hover {
    transform: scale(1.1) rotate(30deg);
    color: #ffffff;
}

.preset-card-option {
    border: 2px solid var(--crm-card-border);
    border-radius: 0.5rem;
    padding: 0.65rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--crm-card-bg);
}

.preset-card-option:hover {
    border-color: var(--crm-primary);
    transform: translateY(-2px);
}

.preset-card-option.active {
    border-color: var(--crm-primary) !important;
    background-color: rgba(var(--crm-primary-rgb), 0.08) !important;
    box-shadow: 0 0 0 2px rgba(var(--crm-primary-rgb), 0.25);
}

.color-swatch-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Active buttons in Theme Drawer */
[data-set-mode].active,
[data-set-sidebar].active,
[data-set-font].active,
[data-set-size].active,
[data-set-radius].active {
    background-color: var(--crm-primary) !important;
    border-color: var(--crm-primary) !important;
    color: #ffffff !important;
}

[data-set-mode].active i,
[data-set-mode].active span {
    color: #ffffff !important;
}

/* Offcanvas in Dark Mode */
[data-bs-theme="dark"] .offcanvas,
[data-theme="dark"] .offcanvas {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .offcanvas-header,
[data-theme="dark"] .offcanvas-header,
[data-bs-theme="dark"] .offcanvas-footer,
[data-theme="dark"] .offcanvas-footer {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .offcanvas-title,
[data-theme="dark"] .offcanvas-title {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .btn-close,
[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}
