/* ============================================================
   DS WEALTH MANAGEMENT PORTAL — MASTER THEME CSS (MUI-INSPIRED)
   Brand Primary: #0078aa  |  Accent: #52c4cf
   Version: 3.0 — High-Performance Single Source of Truth
   ============================================================ */

/* ── Google Font ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ══ 1. DESIGN TOKENS (CSS VARIABLES) ══════════════════════ */
:root {
    /* Brand Primary */
    --ds-primary:          #0078aa;
    --ds-primary-hover:    #005f88;
    --ds-primary-dark:     #004e70;
    --ds-primary-light:    #0094d4;
    --ds-primary-soft:     rgba(0, 120, 170, 0.08);
    --ds-primary-soft2:    rgba(0, 120, 170, 0.15);
    --ds-primary-border:   rgba(0, 120, 170, 0.25);
    --ds-accent:           #52c4cf;
    --ds-accent-soft:      rgba(82, 196, 207, 0.12);

    /* Semantic */
    --ds-success:          #16a34a;
    --ds-success-soft:     rgba(22, 163, 74, 0.10);
    --ds-warning:          #d97706;
    --ds-warning-soft:     rgba(217, 119, 6, 0.10);
    --ds-danger:           #dc2626;
    --ds-danger-soft:      rgba(220, 38, 38, 0.10);
    --ds-info:             #0891b2;
    --ds-info-soft:        rgba(8, 145, 178, 0.10);
    --ds-purple:           #7c3aed;
    --ds-purple-soft:      rgba(124, 58, 237, 0.10);

    /* Light Mode Surfaces */
    --ds-bg:               #f1f5f9;
    --ds-surface:          #ffffff;
    --ds-surface-sunken:   #f8fafc;
    --ds-surface-raised:   #ffffff;
    --ds-border:           #e2e8f0;
    --ds-border-strong:    #cbd5e1;
    --ds-border-soft:      rgba(0, 0, 0, 0.05);

    /* Light Mode Typography */
    --ds-text:             #1e293b;
    --ds-text-heading:     #0f172a;
    --ds-text-secondary:   #475569;
    --ds-text-muted:       #64748b;
    --ds-text-disabled:    #94a3b8;

    /* Light Mode Sidebar */
    --ds-sb-bg:            #ffffff;
    --ds-sb-border:        #e2e8f0;
    --ds-sb-title:         #64748b;
    --ds-sb-text:          #334155;
    --ds-sb-icon:          #64748b;
    --ds-sb-hover-bg:      rgba(0, 120, 170, 0.06);
    --ds-sb-active-bg:     rgba(0, 120, 170, 0.11);
    --ds-sb-active-txt:    #0078aa;
    --ds-sb-active-icon:   #0078aa;
    --ds-sb-sub-text:      #475569;

    /* Light Mode Topbar */
    --ds-tb-bg:            #ffffff;
    --ds-tb-border:        #e2e8f0;
    --ds-tb-shadow:        0 1px 0 #e2e8f0, 0 2px 14px rgba(15, 23, 42, 0.04);

    /* Shadows (MUI Elevation) */
    --ds-shadow-1: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --ds-shadow-2: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    --ds-shadow-3: 0 10px 24px -4px rgba(15, 23, 42, 0.10), 0 4px 8px -2px rgba(15, 23, 42, 0.05);
    --ds-shadow-4: 0 20px 32px -8px rgba(15, 23, 42, 0.14);

    /* Radii */
    --r-xs: 4px;
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-pill: 9999px;

    /* Layout dimensions */
    --tb-h: 64px;
    --sb-w: 258px;
    --sb-collapsed-w: 72px;

    /* Transitions */
    --ds-ease: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Legacy compatibility mappings */
    --m-primary:           var(--ds-primary);
    --m-primary-hover:     var(--ds-primary-hover);
    --m-primary-soft:      var(--ds-primary-soft);
    --m-primary-soft2:     var(--ds-primary-soft2);
    --m-bg:                var(--ds-bg);
    --m-surface:           var(--ds-surface);
    --m-surface2:          var(--ds-surface-sunken);
    --m-border:            var(--ds-border);
    --m-text:              var(--ds-text);
    --m-text-muted:        var(--ds-text-muted);
    --m-text-light:        var(--ds-text-disabled);
}

/* ══ 2. REFINED DARK MODE (FINTECH DEEP SLATE NAVY) ════════ */
[data-layout-mode="dark"] {
    /* Brand Accent in Dark Mode */
    --ds-primary:          #38bdf8;
    --ds-primary-hover:    #0ea5e9;
    --ds-primary-dark:     #0284c7;
    --ds-primary-light:    #7dd3fc;
    --ds-primary-soft:     rgba(56, 189, 248, 0.12);
    --ds-primary-soft2:    rgba(56, 189, 248, 0.20);
    --ds-primary-border:   rgba(56, 189, 248, 0.35);
    --ds-accent:           #22d3ee;
    --ds-accent-soft:      rgba(34, 211, 238, 0.14);

    /* Semantic */
    --ds-success:          #4ade80;
    --ds-success-soft:     rgba(74, 222, 128, 0.14);
    --ds-warning:          #fbbf24;
    --ds-warning-soft:     rgba(251, 191, 36, 0.14);
    --ds-danger:           #f87171;
    --ds-danger-soft:      rgba(248, 113, 113, 0.14);
    --ds-info:             #22d3ee;
    --ds-info-soft:        rgba(34, 211, 238, 0.14);
    --ds-purple:           #a78bfa;
    --ds-purple-soft:      rgba(167, 139, 250, 0.14);

    /* Deep Navy Slate Surfaces */
    --ds-bg:               #0a0f1d;
    --ds-surface:          #111827;
    --ds-surface-sunken:   #0d1424;
    --ds-surface-raised:   #182235;
    --ds-border:           rgba(255, 255, 255, 0.08);
    --ds-border-strong:    rgba(255, 255, 255, 0.15);
    --ds-border-soft:      rgba(255, 255, 255, 0.05);

    /* Dark Mode Typography */
    --ds-text:             #cbd5e1;
    --ds-text-heading:     #f8fafc;
    --ds-text-secondary:   #94a3b8;
    --ds-text-muted:       #64748b;
    --ds-text-disabled:    #475569;

    /* Dark Mode Sidebar */
    --ds-sb-bg:            #0d1527;
    --ds-sb-border:        rgba(255, 255, 255, 0.07);
    --ds-sb-title:         #64748b;
    --ds-sb-text:          #94a3b8;
    --ds-sb-icon:          #64748b;
    --ds-sb-hover-bg:      rgba(56, 189, 248, 0.08);
    --ds-sb-active-bg:     rgba(56, 189, 248, 0.14);
    --ds-sb-active-txt:    #38bdf8;
    --ds-sb-active-icon:   #38bdf8;
    --ds-sb-sub-text:      #94a3b8;

    /* Dark Mode Topbar */
    --ds-tb-bg:            #0d1527;
    --ds-tb-border:        rgba(255, 255, 255, 0.07);
    --ds-tb-shadow:        0 1px 0 rgba(255, 255, 255, 0.05), 0 4px 20px rgba(0, 0, 0, 0.45);

    /* Shadows in Dark */
    --ds-shadow-1: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --ds-shadow-2: 0 4px 12px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3);
    --ds-shadow-3: 0 10px 24px rgba(0, 0, 0, 0.65);
    --ds-shadow-4: 0 20px 36px rgba(0, 0, 0, 0.8);

    /* Bootstrap Overrides */
    --bs-body-bg:          #0a0f1d;
    --bs-body-color:       #cbd5e1;
    --bs-card-bg:          #111827;
    --bs-border-color:     rgba(255, 255, 255, 0.08);
}

/* ══ 3. GLOBAL RESET & BASE STYLES ═════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
}

body,
.vertical-menu,
#page-topbar,
.card,
.modal-content,
.dropdown-menu,
.btn,
input, select, textarea {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

body {
    background-color: var(--ds-bg) !important;
    color: var(--ds-text) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Scrollbars */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.16); border-radius: var(--r-pill); }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.28); }
[data-layout-mode="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); }
[data-layout-mode="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); }

/* ══ 4. PRELOADER BUG FIX (CRITICAL) ═══════════════════════ */
/* Ensures page is never washed out or stuck in disabled state */
#preloader {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    background-color: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(4px);
    z-index: 99999;
}
[data-layout-mode="dark"] #preloader {
    background-color: rgba(10, 15, 29, 0.88);
}

/* When hidden, guarantee zero opacity and pointer-events disabled */
#preloader[style*="display: none"],
#preloader[style*="display:none"],
#preloader.hide,
#preloader:not(.show):not([style*="display: block"]):not([style*="display: flex"]) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* When active, show centered spinner */
#preloader[style*="display: block"],
#preloader[style*="display:block"],
#preloader[style*="display: flex"],
#preloader[style*="display:flex"],
#preloader.show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.page-loader {
    pointer-events: none;
}
.page-loader.show,
#preloader[style*="display: block"].page-loader,
#preloader[style*="display: flex"].page-loader {
    pointer-events: auto;
}

/* Spinner styling */
.spinner-chase {
    width: 44px; height: 44px;
    position: relative;
    animation: spinner-chase 2.5s infinite linear both;
}
.chase-dot {
    width: 100%; height: 100%;
    position: absolute; left: 0; top: 0;
    animation: chase-dot 2.0s infinite ease-in-out both;
}
.chase-dot::before {
    content: ''; display: block;
    width: 25%; height: 25%;
    background-color: var(--ds-primary);
    border-radius: 100%;
    animation: chase-dot-before 2.0s infinite ease-in-out both;
}
.chase-dot:nth-child(1) { animation-delay: -1.1s; } .chase-dot:nth-child(1)::before { animation-delay: -1.1s; }
.chase-dot:nth-child(2) { animation-delay: -1.0s; } .chase-dot:nth-child(2)::before { animation-delay: -1.0s; }
.chase-dot:nth-child(3) { animation-delay: -0.9s; } .chase-dot:nth-child(3)::before { animation-delay: -0.9s; }
.chase-dot:nth-child(4) { animation-delay: -0.8s; } .chase-dot:nth-child(4)::before { animation-delay: -0.8s; }
.chase-dot:nth-child(5) { animation-delay: -0.7s; } .chase-dot:nth-child(5)::before { animation-delay: -0.7s; }
.chase-dot:nth-child(6) { animation-delay: -0.6s; } .chase-dot:nth-child(6)::before { animation-delay: -0.6s; }
@keyframes spinner-chase { 100% { transform: rotate(360deg); } }
@keyframes chase-dot { 80%, 100% { transform: rotate(360deg); } }
@keyframes chase-dot-before { 50% { transform: scale(0.4); } 100%, 0% { transform: scale(1.0); } }

/* ══ 5. TOPBAR (HEADER) ════════════════════════════════════ */
#page-topbar {
    background: var(--ds-tb-bg) !important;
    box-shadow: var(--ds-tb-shadow) !important;
    border-bottom: 1px solid var(--ds-tb-border) !important;
    height: var(--tb-h) !important;
    z-index: 1003 !important;
}

.navbar-header {
    height: var(--tb-h) !important;
    padding: 0 20px 0 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

/* Brand Logo Box in Topbar */
.navbar-brand-box {
    background: var(--ds-tb-bg) !important;
    border-right: 1px solid var(--ds-tb-border) !important;
    width: var(--sb-w) !important;
    height: var(--tb-h) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 16px !important;
    flex-shrink: 0 !important;
    transition: width 0.25s ease !important;
}
.navbar-brand-box .logo {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important; width: 100% !important;
    text-decoration: none !important;
}
.navbar-brand-box .logo-dark  { display: flex !important; }
.navbar-brand-box .logo-light { display: none  !important; }
.navbar-brand-box .logo-dark span.logo-lg,
.navbar-brand-box .logo-light span.logo-lg { display: flex !important; align-items: center !important; }
.navbar-brand-box .logo-dark span.logo-sm,
.navbar-brand-box .logo-light span.logo-sm { display: none !important; }

.navbar-brand-box .logo-lg img {
    height: auto !important; max-height: 48px !important;
    width: auto !important; max-width: 190px !important;
    object-fit: contain !important; display: block !important;
}
.navbar-brand-box .logo-sm img {
    height: auto !important; max-height: 38px !important;
    width: auto !important; max-width: 44px !important;
    object-fit: contain !important; display: block !important;
}

/* Collapsed Logo Box */
body.vertical-collpsed .navbar-brand-box {
    width: var(--sb-collapsed-w) !important;
    padding: 0 !important;
    justify-content: center !important;
}
body.vertical-collpsed .navbar-brand-box .logo-dark span.logo-lg { display: none !important; }
body.vertical-collpsed .navbar-brand-box .logo-dark span.logo-sm { display: flex !important; }

/* Hamburger Menu Button */
#vertical-menu-btn {
    background: transparent !important;
    border: none !important;
    color: var(--ds-text-muted) !important;
    height: var(--tb-h) !important;
    width: 58px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    border-radius: 0 !important;
    transition: var(--ds-ease) !important;
}
#vertical-menu-btn:hover {
    color: var(--ds-primary) !important;
    background: var(--ds-primary-soft) !important;
}

/* Command Palette Trigger in Topbar */
.kpal-trigger {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 7px 14px !important;
    background: var(--ds-surface-sunken) !important;
    border: 1.5px solid var(--ds-border) !important;
    border-radius: var(--r-sm) !important;
    color: var(--ds-text-muted) !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: var(--ds-ease) !important;
    min-width: 190px !important;
}
.kpal-trigger:hover {
    border-color: var(--ds-primary) !important;
    color: var(--ds-primary) !important;
    background: var(--ds-primary-soft) !important;
}
.kpal-trigger-kbd {
    margin-left: auto !important;
    display: flex !important; gap: 3px !important;
}
.kpal-trigger-kbd kbd {
    background: var(--ds-border) !important;
    border: 1px solid var(--ds-border) !important;
    border-radius: 4px !important;
    padding: 1px 5px !important;
    font-size: 0.7rem !important;
    color: var(--ds-text-muted) !important;
    font-family: monospace !important;
}

/* User Profile Dropdown Button */
#page-header-user-dropdown {
    display: flex !important;
    align-items: center !important;
    gap: 9px !important;
    height: var(--tb-h) !important;
    padding: 0 14px !important;
    color: var(--ds-text) !important;
    font-weight: 600 !important;
    font-size: 0.82rem !important;
    transition: var(--ds-ease) !important;
    border: none !important;
    background: transparent !important;
}
#page-header-user-dropdown:hover {
    background: var(--ds-primary-soft) !important;
    color: var(--ds-primary) !important;
}
.header-profile-user {
    width: 34px !important; height: 34px !important;
    border-radius: 50% !important;
    border: 2px solid var(--ds-primary-border) !important;
    object-fit: cover !important;
}

/* Fullscreen & Dark/Light Toggle */
.navbar-header .noti-icon {
    width: 38px !important; height: 38px !important;
    border-radius: var(--r-sm) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--ds-text-muted) !important;
    background: transparent !important;
    border: none !important;
    transition: var(--ds-ease) !important;
}
.navbar-header .noti-icon:hover {
    color: var(--ds-primary) !important;
    background: var(--ds-primary-soft) !important;
}

/* ══ 6. MUI-INSPIRED SIDE MENU ═════════════════════════════ */
body .vertical-menu {
    background: var(--ds-sb-bg) !important;
    border-right: 1px solid var(--ds-sb-border) !important;
    box-shadow: 2px 0 20px rgba(15, 23, 42, 0.04) !important;
    position: fixed !important;
    top: 0 !important; left: 0 !important; bottom: 0 !important;
    width: var(--sb-w) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    z-index: 1002 !important;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
[data-layout-mode="dark"] body .vertical-menu {
    box-shadow: 2px 0 28px rgba(0, 0, 0, 0.45) !important;
}

/* Sidebar Logo Block */
.sidebar-logo-box {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: var(--tb-h) !important;
    padding: 10px 20px !important;
    border-bottom: 1px solid var(--ds-sb-border) !important;
    flex-shrink: 0 !important;
}
.sidebar-logo-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important; height: 100% !important;
    text-decoration: none !important;
}
.sidebar-logo-lg {
    max-height: 48px !important; max-width: 190px !important;
    width: auto !important; object-fit: contain !important;
    display: block !important;
}
.sidebar-logo-sm {
    max-height: 38px !important; max-width: 44px !important;
    width: auto !important; object-fit: contain !important;
    display: none !important;
}

/* Sidebar Section Headers (HOME, MASTERS, etc.) */
body #sidebar-menu .menu-title {
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
    color: var(--ds-sb-title) !important;
    padding: 22px 20px 6px !important;
    opacity: 1 !important;
    display: block !important;
}

/* Menu Items (Pill Style) */
body #sidebar-menu ul li a {
    color: var(--ds-sb-text) !important;
    font-size: 0.84rem !important;
    font-weight: 500 !important;
    padding: 10px 14px 10px 18px !important;
    border-radius: var(--r-sm) !important;
    margin: 2px 10px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    transition: var(--ds-ease) !important;
    position: relative !important;
    text-decoration: none !important;
    opacity: 1 !important;
}

/* Icons in Menu */
body #sidebar-menu ul li a i {
    font-size: 1.15rem !important;
    color: var(--ds-sb-icon) !important;
    width: 20px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    transition: color 0.2s, transform 0.2s !important;
}

/* Menu Hover State */
body #sidebar-menu ul li a:hover {
    background: var(--ds-sb-hover-bg) !important;
    color: var(--ds-sb-active-txt) !important;
}
body #sidebar-menu ul li a:hover i {
    color: var(--ds-sb-active-icon) !important;
    transform: scale(1.08);
}

/* Menu Active State (Selected Page) */
body #sidebar-menu ul li.mm-active > a:not(.has-arrow),
body #sidebar-menu ul li a.active:not(.has-arrow) {
    background: var(--ds-sb-active-bg) !important;
    color: var(--ds-sb-active-txt) !important;
    font-weight: 600 !important;
}
body #sidebar-menu ul li.mm-active > a:not(.has-arrow) i,
body #sidebar-menu ul li a.active:not(.has-arrow) i {
    color: var(--ds-sb-active-icon) !important;
}

/* Modern Left Pill Indicator on Active Item */
body #sidebar-menu > ul > li.mm-active > a:not(.has-arrow)::before,
body #sidebar-menu > ul > li > a.active:not(.has-arrow)::before {
    content: '';
    position: absolute;
    left: 0; top: 7px; bottom: 7px;
    width: 3.5px;
    background: var(--ds-primary);
    border-radius: 0 4px 4px 0;
}
[data-layout-mode="dark"] body #sidebar-menu > ul > li.mm-active > a:not(.has-arrow)::before,
[data-layout-mode="dark"] body #sidebar-menu > ul > li > a.active:not(.has-arrow)::before {
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

/* Expandable Parent Menu (with arrow) */
body #sidebar-menu ul li.mm-active > a.has-arrow,
body #sidebar-menu ul li a.mm-active.has-arrow,
body #sidebar-menu ul li a.active.has-arrow {
    background: transparent !important;
    color: var(--ds-text-heading) !important;
    font-weight: 600 !important;
}
body #sidebar-menu ul li.mm-active > a.has-arrow i {
    color: var(--ds-primary) !important;
}
body #sidebar-menu ul li.mm-active > a.has-arrow::after {
    border-color: var(--ds-primary) !important;
}
body #sidebar-menu ul li a.has-arrow::after {
    border-color: var(--ds-text-disabled) !important;
    margin-left: auto !important;
}

/* Submenu Items */
body #sidebar-menu ul li ul.sub-menu {
    padding: 2px 0 6px !important;
}
body #sidebar-menu ul li ul.sub-menu li a {
    font-size: 0.81rem !important;
    color: var(--ds-sb-sub-text) !important;
    padding: 8px 14px 8px 46px !important;
    font-weight: 400 !important;
    border-radius: var(--r-sm) !important;
    margin: 1px 10px !important;
    background: transparent !important;
}
body #sidebar-menu ul li ul.sub-menu li a::before {
    content: '';
    position: absolute;
    left: 28px; top: 50%;
    transform: translateY(-50%);
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--ds-text-disabled);
    transition: background 0.2s, transform 0.2s;
}
body #sidebar-menu ul li ul.sub-menu li a:hover {
    color: var(--ds-sb-active-txt) !important;
    background: var(--ds-sb-hover-bg) !important;
}
body #sidebar-menu ul li ul.sub-menu li a:hover::before {
    background: var(--ds-primary) !important;
    transform: translateY(-50%) scale(1.4) !important;
}
body #sidebar-menu ul li ul.sub-menu li.mm-active a,
body #sidebar-menu ul li ul.sub-menu li a.active {
    color: var(--ds-sb-active-txt) !important;
    font-weight: 600 !important;
    background: var(--ds-primary-soft) !important;
}
body #sidebar-menu ul li ul.sub-menu li.mm-active a::before,
body #sidebar-menu ul li ul.sub-menu li a.active::before {
    background: var(--ds-primary) !important;
    transform: translateY(-50%) scale(1.4) !important;
}

/* ── Collapsed Sidebar (72px) ───────────────────────────── */
body.vertical-collpsed .vertical-menu {
    width: var(--sb-collapsed-w) !important;
}
body.vertical-collpsed .sidebar-logo-box {
    padding: 10px 6px !important;
}
body.vertical-collpsed .sidebar-logo-lg { display: none !important; }
body.vertical-collpsed .sidebar-logo-sm { display: block !important; }
body.vertical-collpsed .vertical-menu { overflow: visible !important; }
body.vertical-collpsed .vertical-menu .h-100[data-simplebar],
body.vertical-collpsed .vertical-menu .simplebar-wrapper,
body.vertical-collpsed .vertical-menu .simplebar-mask,
body.vertical-collpsed .vertical-menu .simplebar-content-wrapper { overflow: visible !important; }

body.vertical-collpsed #sidebar-menu ul li a {
    margin: 0 !important; border-radius: 0 !important;
    padding: 15px 0 !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
}
body.vertical-collpsed #sidebar-menu ul li a i {
    width: auto !important; margin: 0 !important; font-size: 1.45rem !important;
}
body.vertical-collpsed #sidebar-menu .menu-title { display: none !important; }

/* Floating Hover Popover in Collapsed Mode */
body.vertical-collpsed #sidebar-menu > ul > li:hover > a {
    background: var(--ds-surface) !important;
    color: var(--ds-primary) !important;
    border-radius: 0 8px 0 0 !important;
    box-shadow: 3px 0 14px rgba(15, 23, 42, 0.1) !important;
    width: calc(186px + 72px) !important;
    padding: 15px 0 15px 24px !important;
    display: flex !important; align-items: center !important; justify-content: flex-start !important;
}
body.vertical-collpsed #sidebar-menu > ul > li:hover > a i {
    width: auto !important; margin-right: 14px !important;
}
body.vertical-collpsed #sidebar-menu > ul > li:hover > a span {
    font-weight: 600 !important; display: block !important;
}
body.vertical-collpsed #sidebar-menu > ul > li:hover > ul.sub-menu {
    background: var(--ds-surface) !important;
    border-radius: 0 0 8px 8px !important;
    box-shadow: 3px 6px 16px rgba(15, 23, 42, 0.1) !important;
}
body.vertical-collpsed #sidebar-menu ul li ul.sub-menu li a {
    padding: 8px 12px 8px 28px !important; margin: 0 6px !important; text-align: left !important;
}
body.vertical-collpsed #sidebar-menu ul li ul.sub-menu li a::before {
    left: 12px !important;
}

[data-layout-mode="dark"] body.vertical-collpsed #sidebar-menu > ul > li:hover > a,
[data-layout-mode="dark"] body.vertical-collpsed #sidebar-menu > ul > li:hover > ul.sub-menu {
    background: var(--ds-surface-raised) !important;
    box-shadow: 3px 6px 24px rgba(0, 0, 0, 0.6) !important;
}

/* ══ 7. MAIN CONTENT WRAPPER ═══════════════════════════════ */
.main-content {
    background: var(--ds-bg) !important;
    min-height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
}
.page-content {
    padding: calc(var(--tb-h) + 24px) 24px 60px !important;
    flex: 1 !important;
}
#layout-wrapper {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh !important;
    overflow-x: hidden !important;
}

/* ══ 8. MUI-INSPIRED FORM COMPONENTS ═══════════════════════ */
.form-control, .form-select {
    background: var(--ds-surface) !important;
    border: 1.5px solid var(--ds-border-strong) !important;
    border-radius: var(--r-sm) !important;
    color: var(--ds-text) !important;
    font-size: 0.85rem !important;
    padding: 9px 13px !important;
    transition: var(--ds-ease) !important;
    box-shadow: none !important;
}
.form-control:hover, .form-select:hover {
    border-color: #94a3b8 !important;
}
.form-control:focus, .form-select:focus {
    border-color: var(--ds-primary) !important;
    box-shadow: 0 0 0 3px var(--ds-primary-soft2) !important;
    background: var(--ds-surface) !important;
    color: var(--ds-text) !important;
    outline: none !important;
}
.form-control::placeholder {
    color: var(--ds-text-disabled) !important;
}
.form-label {
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    color: var(--ds-text-secondary) !important;
    margin-bottom: 6px !important;
}

/* Dark Form Controls */
[data-layout-mode="dark"] .form-control,
[data-layout-mode="dark"] .form-select {
    background: var(--ds-surface-sunken) !important;
    border-color: var(--ds-border) !important;
    color: var(--ds-text) !important;
}
[data-layout-mode="dark"] .form-control:hover,
[data-layout-mode="dark"] .form-select:hover {
    border-color: rgba(255, 255, 255, 0.2) !important;
}
[data-layout-mode="dark"] .form-control:focus,
[data-layout-mode="dark"] .form-select:focus {
    background: var(--ds-surface-raised) !important;
    border-color: var(--ds-primary) !important;
    box-shadow: 0 0 0 3px var(--ds-primary-soft2) !important;
}
[data-layout-mode="dark"] .form-control::placeholder {
    color: var(--ds-text-muted) !important;
}

/* Input Groups */
.input-group-text {
    background: var(--ds-surface-sunken) !important;
    border: 1.5px solid var(--ds-border-strong) !important;
    border-radius: var(--r-sm) !important;
    color: var(--ds-text-muted) !important;
    font-size: 0.85rem !important;
    padding: 9px 13px !important;
}
.input-group .form-control:not(:first-child) { border-left: none !important; border-radius: 0 var(--r-sm) var(--r-sm) 0 !important; }
.input-group .form-control:not(:last-child)  { border-right: none !important; border-radius: var(--r-sm) 0 0 var(--r-sm) !important; }
.input-group .input-group-text:first-child   { border-right: none !important; border-radius: var(--r-sm) 0 0 var(--r-sm) !important; }
.input-group .input-group-text:last-child    { border-left: none !important; border-radius: 0 var(--r-sm) var(--r-sm) 0 !important; }
[data-layout-mode="dark"] .input-group-text  { background: var(--ds-surface-raised) !important; border-color: var(--ds-border) !important; }

/* Checkboxes & Switches */
.form-check-input {
    cursor: pointer !important;
    border: 1.5px solid var(--ds-border-strong) !important;
    border-radius: 4px !important;
    transition: var(--ds-ease) !important;
}
.form-check-input:checked {
    background-color: var(--ds-primary) !important;
    border-color: var(--ds-primary) !important;
}
.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--ds-primary-soft2) !important;
}
.form-switch .form-check-input {
    border-radius: var(--r-pill) !important;
    width: 2.2em !important; height: 1.2em !important;
}

/* Table Toolbar Search Field */
.search-box {
    position: relative !important;
}
.search-box .search-icon {
    position: absolute !important;
    left: 11px !important; top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 1rem !important;
    color: var(--ds-text-disabled) !important;
    pointer-events: none !important;
    z-index: 2 !important;
}
.search-box .searchfilter,
.searchfilter {
    padding-left: 36px !important;
    background: var(--ds-surface) !important;
    border: 1.5px solid var(--ds-border-strong) !important;
    border-radius: var(--r-sm) !important;
    color: var(--ds-text) !important;
    font-size: 0.84rem !important;
    height: 38px !important;
    transition: var(--ds-ease) !important;
}
.search-box .searchfilter:focus,
.searchfilter:focus {
    border-color: var(--ds-primary) !important;
    box-shadow: 0 0 0 3px var(--ds-primary-soft2) !important;
}

/* ══ 9. SELECT2 (MUI-STYLE & EXCEL MULTI-SELECT) ═══════════ */
.select2-container--default .select2-selection--single {
    background: var(--ds-surface) !important;
    border: 1.5px solid var(--ds-border-strong) !important;
    border-radius: var(--r-sm) !important;
    height: 40px !important;
    display: flex !important; align-items: center !important;
    transition: var(--ds-ease) !important;
}
.select2-container--default .select2-selection--single:focus,
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--ds-primary) !important;
    box-shadow: 0 0 0 3px var(--ds-primary-soft2) !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--ds-text) !important; line-height: 38px !important; padding-left: 12px !important; font-size: 0.85rem !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px !important; right: 8px !important;
}
.select2-dropdown {
    background: var(--ds-surface) !important;
    border: 1px solid var(--ds-border) !important;
    border-radius: var(--r-md) !important;
    box-shadow: var(--ds-shadow-3) !important;
    z-index: 999999 !important;
    overflow: hidden !important;
}
.select2-container--default .select2-results__option--highlighted {
    background: var(--ds-primary-soft) !important;
    color: var(--ds-primary) !important;
}
.select2-container--default .select2-results__option[aria-selected=true] {
    background: var(--ds-primary-soft2) !important;
    color: var(--ds-primary) !important;
    font-weight: 600 !important;
}
.select2-search--dropdown .select2-search__field {
    border: 1.5px solid var(--ds-border-strong) !important;
    border-radius: var(--r-sm) !important;
    padding: 7px 10px !important;
    color: var(--ds-text) !important;
    background: var(--ds-surface-sunken) !important;
    font-size: 0.84rem !important;
    outline: none !important;
}
.select2-search--dropdown .select2-search__field:focus {
    border-color: var(--ds-primary) !important;
    box-shadow: 0 0 0 2px var(--ds-primary-soft2) !important;
}

/* Excel-Style Multi-Select Pill */
.select2-container--default .select2-selection--multiple {
    position: relative !important;
    min-height: 38px !important;
    height: 38px !important;
    border: 1.5px solid var(--ds-border-strong) !important;
    border-radius: var(--r-sm) !important;
    background: var(--ds-surface) !important;
    padding: 0 32px 0 8px !important;
    display: flex !important;
    align-items: center !important;
    cursor: pointer !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    transition: var(--ds-ease) !important;
}
.select2-container--default .select2-selection--multiple::after {
    content: '' !important;
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 0 !important; height: 0 !important;
    border-left: 4.5px solid transparent !important;
    border-right: 4.5px solid transparent !important;
    border-top: 5px solid var(--ds-text-muted) !important;
    pointer-events: none !important;
    transition: transform 0.2s ease !important;
}
.select2-container--default.select2-container--open .select2-selection--multiple::after {
    transform: translateY(-50%) rotate(180deg) !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 4px !important;
    padding: 0 !important; margin: 0 !important;
    width: 100% !important; overflow: hidden !important;
    white-space: nowrap !important; list-style: none !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: var(--ds-primary-soft) !important;
    border: 1px solid var(--ds-primary-border) !important;
    border-radius: 4px !important;
    color: var(--ds-primary) !important;
    font-size: 0.76rem !important;
    font-weight: 600 !important;
    padding: 2px 7px !important;
    display: inline-flex !important;
    align-items: center !important;
    height: 24px !important;
    flex-shrink: 0 !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--ds-primary) !important;
    margin-right: 5px !important;
    font-weight: bold !important;
    cursor: pointer !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: var(--ds-danger) !important;
}
.select2-container--default .select2-selection--multiple .select2-excel-summary-chip {
    background-color: var(--ds-primary-soft) !important;
    border: 1px solid var(--ds-primary) !important;
    color: var(--ds-primary) !important;
    font-weight: 600 !important;
    border-radius: 4px !important;
    padding: 2px 7px !important;
    height: 24px !important;
    display: inline-flex !important;
    align-items: center !important;
}
.select2-container--default .select2-selection--multiple .select2-search--inline {
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important; padding: 0 !important;
    flex: 1 1 auto !important; min-width: 10px !important;
}
.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field {
    margin: 0 !important; padding: 0 4px !important;
    border: none !important; outline: none !important; box-shadow: none !important;
    font-size: 13px !important; height: 24px !important;
    background: transparent !important; color: var(--ds-text) !important;
}
.select2-dropdown .select2-results__options[aria-multiselectable="true"] {
    max-height: 260px !important; overflow-y: auto !important; padding: 4px 0 !important;
}
.select2-results__options[aria-multiselectable="true"] .select2-results__option[role="option"] {
    position: relative !important;
    padding: 8px 14px 8px 38px !important;
    font-size: 13px !important;
    color: var(--ds-text) !important;
    cursor: pointer !important;
    display: flex !important; align-items: center !important;
    user-select: none !important;
    transition: background-color 0.12s ease !important;
}
.select2-results__options[aria-multiselectable="true"] .select2-results__option[role="option"]::before {
    content: '' !important;
    position: absolute !important;
    left: 12px !important; top: 50% !important;
    transform: translateY(-50%) !important;
    width: 17px !important; height: 17px !important;
    border: 1.5px solid var(--ds-border-strong) !important;
    border-radius: 4px !important;
    background-color: var(--ds-surface) !important;
    box-sizing: border-box !important;
    transition: all 0.15s ease !important;
    flex-shrink: 0 !important;
}
.select2-results__options[aria-multiselectable="true"] .select2-results__option[role="option"]:hover,
.select2-results__options[aria-multiselectable="true"] .select2-results__option--highlighted[role="option"] {
    background-color: var(--ds-primary-soft) !important;
    color: var(--ds-primary) !important;
}
.select2-results__options[aria-multiselectable="true"] .select2-results__option[role="option"]:hover::before,
.select2-results__options[aria-multiselectable="true"] .select2-results__option--highlighted[role="option"]::before {
    border-color: var(--ds-primary) !important;
}
.select2-results__options[aria-multiselectable="true"] .select2-results__option[aria-selected="true"]::before {
    background-color: var(--ds-primary) !important;
    border-color: var(--ds-primary) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3E%3Cpath fill-rule='evenodd' d='M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z'/%3E%3C/svg%3E") !important;
    background-size: 11px 11px !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}
[data-layout-mode="dark"] .select2-container--default .select2-selection--single,
[data-layout-mode="dark"] .select2-container--default .select2-selection--multiple {
    background: var(--ds-surface-sunken) !important;
    border-color: var(--ds-border) !important;
}
[data-layout-mode="dark"] .select2-dropdown {
    background: var(--ds-surface-raised) !important;
    border-color: var(--ds-border) !important;
}
[data-layout-mode="dark"] .select2-search--dropdown .select2-search__field {
    background: var(--ds-surface-sunken) !important;
    border-color: var(--ds-border) !important;
    color: var(--ds-text) !important;
}

/* ══ 10. MUI-INSPIRED BUTTONS ══════════════════════════════ */
.btn {
    font-weight: 600 !important;
    font-size: 0.82rem !important;
    border-radius: var(--r-sm) !important;
    padding: 8px 16px !important;
    transition: var(--ds-ease) !important;
    letter-spacing: 0.15px !important;
    border-width: 1.5px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    cursor: pointer;
}
.btn:active { transform: scale(0.97) !important; }
.btn:focus-visible { outline: 2px solid var(--ds-primary) !important; outline-offset: 2px !important; }
.btn-sm { padding: 5px 12px !important; font-size: 0.77rem !important; border-radius: 6px !important; }
.btn-lg { padding: 11px 22px !important; font-size: 0.92rem !important; }

/* Primary Button */
.btn-primary {
    background: var(--ds-primary) !important;
    border-color: var(--ds-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(0, 120, 170, 0.25) !important;
}
.btn-primary:hover {
    background: var(--ds-primary-hover) !important;
    border-color: var(--ds-primary-hover) !important;
    box-shadow: 0 4px 12px rgba(0, 120, 170, 0.35) !important;
    transform: translateY(-1px);
}
[data-layout-mode="dark"] .btn-primary {
    background: #0284c7 !important;
    border-color: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35) !important;
}
[data-layout-mode="dark"] .btn-primary:hover {
    background: #0ea5e9 !important;
    border-color: #0ea5e9 !important;
}

/* Outline Primary */
.btn-outline-primary {
    color: var(--ds-primary) !important;
    border-color: var(--ds-primary) !important;
    background: transparent !important;
}
.btn-outline-primary:hover {
    background: var(--ds-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 120, 170, 0.25) !important;
}

/* Light Button */
.btn-light {
    background: var(--ds-surface-sunken) !important;
    border-color: var(--ds-border) !important;
    color: var(--ds-text-secondary) !important;
}
.btn-light:hover {
    background: var(--ds-border) !important;
    color: var(--ds-text-heading) !important;
}

/* ══ 11. TABLE ACTION BUTTONS (OPERATIONS) ══════════════════ */
.action-btn-group {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
}
.action-icon-btn {
    width: 32px !important; height: 32px !important; min-width: 32px !important;
    padding: 0 !important;
    display: inline-flex !important; align-items: center !important; justify-content: center !important;
    border-radius: var(--r-sm) !important;
    font-size: 15px !important;
    border: 1.5px solid transparent !important;
    cursor: pointer !important;
    transition: var(--ds-ease) !important;
    text-decoration: none !important;
    position: relative;
}
.action-icon-btn i { font-size: 16px !important; }

.action-icon-btn.btn-soft-primary   { background: var(--ds-primary-soft) !important; color: var(--ds-primary) !important; border-color: var(--ds-primary-border) !important; }
.action-icon-btn.btn-soft-primary:hover { background: var(--ds-primary) !important; color: #fff !important; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 120, 170, 0.35) !important; }
.action-icon-btn.btn-soft-success   { background: var(--ds-success-soft) !important; color: var(--ds-success) !important; border-color: rgba(22, 163, 74, 0.2) !important; }
.action-icon-btn.btn-soft-success:hover { background: var(--ds-success) !important; color: #fff !important; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35) !important; }
.action-icon-btn.btn-soft-danger    { background: var(--ds-danger-soft) !important; color: var(--ds-danger) !important; border-color: rgba(220, 38, 38, 0.2) !important; }
.action-icon-btn.btn-soft-danger:hover { background: var(--ds-danger) !important; color: #fff !important; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35) !important; }
.action-icon-btn.btn-soft-secondary { background: rgba(100, 116, 139, 0.1) !important; color: var(--ds-text-muted) !important; border-color: rgba(100, 116, 139, 0.2) !important; }
.action-icon-btn.btn-soft-secondary:hover { background: var(--ds-text-muted) !important; color: #fff !important; transform: translateY(-2px); }
.action-icon-btn.btn-soft-info      { background: var(--ds-info-soft) !important; color: var(--ds-info) !important; border-color: rgba(8, 145, 178, 0.2) !important; }
.action-icon-btn.btn-soft-info:hover { background: var(--ds-info) !important; color: #fff !important; transform: translateY(-2px); }

/* ══ 12. CARDS & TABLES ════════════════════════════════════ */
.card {
    background: var(--ds-surface) !important;
    border: 1px solid var(--ds-border) !important;
    border-radius: var(--r-md) !important;
    box-shadow: var(--ds-shadow-1) !important;
    transition: box-shadow 0.2s, transform 0.2s !important;
}
.card:hover {
    box-shadow: var(--ds-shadow-2) !important;
}
.card-header {
    background: var(--ds-surface) !important;
    border-bottom: 1px solid var(--ds-border) !important;
    padding: 16px 20px !important;
    border-radius: var(--r-md) var(--r-md) 0 0 !important;
}
.card-title {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    color: var(--ds-text-heading) !important;
    margin: 0 !important;
}
.card-body { padding: 20px !important; }
.card-footer {
    background: var(--ds-surface-sunken) !important;
    border-top: 1px solid var(--ds-border) !important;
    padding: 12px 20px !important;
}

/* Tables */
.table {
    color: var(--ds-text) !important;
    border-color: var(--ds-border) !important;
    font-size: 0.84rem !important;
}
.table thead th {
    background: var(--ds-surface-sunken) !important;
    color: var(--ds-text-muted) !important;
    font-weight: 700 !important;
    font-size: 0.72rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-bottom: 2px solid var(--ds-border) !important;
    padding: 11px 14px !important;
    white-space: nowrap !important;
}
.table tbody td {
    border-bottom: 1px solid var(--ds-border) !important;
    padding: 12px 14px !important;
    vertical-align: middle !important;
    color: var(--ds-text) !important;
}
.table tbody tr:last-child td { border-bottom: none !important; }
.table-hover tbody tr:hover {
    background: var(--ds-primary-soft) !important;
}
[data-layout-mode="dark"] .table thead th {
    background: var(--ds-surface-sunken) !important;
}

/* ══ 13. DROPDOWNS & MODALS ════════════════════════════════ */
.dropdown-menu {
    background: var(--ds-surface) !important;
    border: 1px solid var(--ds-border) !important;
    box-shadow: var(--ds-shadow-3) !important;
    border-radius: var(--r-md) !important;
    padding: 6px !important;
    min-width: 190px !important;
}
.dropdown-item {
    border-radius: var(--r-sm) !important;
    padding: 8px 12px !important;
    color: var(--ds-text) !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    transition: var(--ds-ease) !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}
.dropdown-item i {
    font-size: 17px !important;
    width: 20px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    transition: transform 0.15s ease !important;
}
.dropdown-item:hover i {
    transform: scale(1.12) !important;
}
.dropdown-item:hover, .dropdown-item:focus {
    background: var(--ds-primary-soft) !important;
    color: var(--ds-primary) !important;
}
.dropdown-divider { border-color: var(--ds-border) !important; margin: 4px 0 !important; }

/* Modals */
.modal-backdrop {
    background: rgba(10, 15, 29, 0.7) !important;
    backdrop-filter: blur(4px) !important;
}
.modal-content {
    background: var(--ds-surface) !important;
    border: 1px solid var(--ds-border) !important;
    border-radius: var(--r-lg) !important;
    box-shadow: var(--ds-shadow-4) !important;
    overflow: hidden !important;
}
.modal-header {
    background: var(--ds-surface) !important;
    border-bottom: 1px solid var(--ds-border) !important;
    padding: 16px 22px !important;
}
.modal-title { font-size: 0.98rem !important; font-weight: 700 !important; color: var(--ds-text-heading) !important; }
.modal-body { padding: 22px !important; color: var(--ds-text) !important; }
.modal-footer {
    background: var(--ds-surface-sunken) !important;
    border-top: 1px solid var(--ds-border) !important;
    padding: 14px 22px !important;
}

/* ══ 14. COMMAND PALETTE (KPAL) ════════════════════════════ */
.kpal-overlay {
    position: fixed !important; inset: 0 !important;
    z-index: 10000 !important;
    background: rgba(10, 15, 29, 0.7) !important;
    backdrop-filter: blur(4px) !important;
    display: none; align-items: flex-start; justify-content: center;
    padding-top: 10vh;
}
.kpal-overlay.open { display: flex !important; }
.kpal-box {
    background: var(--ds-surface) !important;
    border: 1px solid var(--ds-border) !important;
    border-radius: var(--r-lg) !important;
    box-shadow: var(--ds-shadow-4) !important;
    width: 100%; max-width: 580px; overflow: hidden;
}
.kpal-header { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--ds-border); gap: 10px; }
.kpal-input { flex: 1; border: none !important; outline: none !important; background: transparent !important; color: var(--ds-text) !important; font-size: 0.95rem !important; }
.kpal-results { max-height: 380px; overflow-y: auto; padding: 6px; }
.kpal-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); cursor: pointer; transition: background 0.15s; }
.kpal-item:hover, .kpal-item.kpal-active { background: var(--ds-primary-soft) !important; }
.kpal-item-icon { width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--ds-surface-sunken); display: flex; align-items: center; justify-content: center; font-size: 1rem; color: var(--ds-primary); }
.kpal-footer { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--ds-border); background: var(--ds-surface-sunken); font-size: 0.72rem; color: var(--ds-text-muted); }

/* ══ 15. DASHBOARD SPECIFIC COMPONENTS ═════════════════════ */
.ds-page-title-box {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.ds-page-title { display: flex; align-items: center; gap: 12px; }
.page-icon, .ds-page-icon {
    width: 42px; height: 42px; border-radius: var(--r-sm);
    background: var(--ds-primary-soft);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.page-icon i, .ds-page-icon i { font-size: 1.3rem; color: var(--ds-primary); }
.ds-page-title h4 { font-size: 1.15rem; font-weight: 700; color: var(--ds-text-heading); margin: 0; }
.ds-page-title .breadcrumb { font-size: 0.75rem; margin: 0; padding: 0; background: transparent; }
.ds-page-title .breadcrumb-item, .ds-page-title .breadcrumb-item a { color: var(--ds-text-muted) !important; text-decoration: none; }
.ds-page-title .breadcrumb-item.active { color: var(--ds-primary) !important; font-weight: 600; }

/* Welcome Banner */
.card.ds-welcome-banner {
    background: var(--ds-primary) !important;
    border: none !important;
    border-radius: var(--r-lg) !important;
    box-shadow: 0 6px 28px rgba(0, 120, 170, 0.35) !important;
    position: relative !important;
    overflow: hidden !important;
}
.card.ds-welcome-banner::before {
    content: ''; position: absolute; top: -50px; right: -50px;
    width: 220px; height: 220px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.08); pointer-events: none;
}
.card.ds-welcome-banner::after {
    content: ''; position: absolute; bottom: -70px; right: 80px;
    width: 160px; height: 160px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.05); pointer-events: none;
}
.card.ds-welcome-banner .card-body {
    background: transparent !important;
    padding: 28px 32px !important;
    position: relative; z-index: 1;
}
.welcome-title { font-size: 1.25rem; font-weight: 700; color: #ffffff; margin-bottom: 4px; }
.welcome-sub   { font-size: 0.85rem; color: rgba(255, 255, 255, 0.82); margin-bottom: 0; }
[data-layout-mode="dark"] .card.ds-welcome-banner {
    background: linear-gradient(135deg, #0284c7 0%, #005f88 100%) !important;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5) !important;
}

/* Stat Cards */
.card.ds-stat-card {
    border-radius: var(--r-lg) !important;
    border: 1px solid var(--ds-border) !important;
    background: var(--ds-surface) !important;
    box-shadow: var(--ds-shadow-1) !important;
    transition: var(--ds-ease) !important;
    cursor: pointer; overflow: hidden; position: relative;
}
.card.ds-stat-card:hover {
    box-shadow: var(--ds-shadow-3) !important;
    transform: translateY(-4px) !important;
    border-color: transparent !important;
}
.card.ds-stat-card::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3.5px;
    border-radius: var(--r-lg) var(--r-lg) 0 0; opacity: 0; transition: opacity 0.2s;
}
.card.ds-stat-card:hover::after { opacity: 1; }
.card.ds-stat-card.c-primary::after   { background: var(--ds-primary); }
.card.ds-stat-card.c-success::after   { background: var(--ds-success); }
.card.ds-stat-card.c-warning::after   { background: var(--ds-warning); }
.card.ds-stat-card.c-secondary::after { background: var(--ds-text-muted); }

.ds-stat-body { padding: 22px 20px !important; }
.ds-stat-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--ds-text-muted); margin-bottom: 10px; }
.ds-stat-value { font-size: 2.1rem; font-weight: 800; line-height: 1; margin-bottom: 10px; letter-spacing: -1px; }
.ds-stat-value.c-primary   { color: var(--ds-primary); }
.ds-stat-value.c-success   { color: var(--ds-success); }
.ds-stat-value.c-warning   { color: var(--ds-warning); }
.ds-stat-value.c-secondary { color: var(--ds-text-secondary); }

.ds-stat-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.72rem; font-weight: 600;
    padding: 3px 9px; border-radius: var(--r-pill);
}
.ds-stat-badge.c-primary   { background: var(--ds-primary-soft2); color: var(--ds-primary); }
.ds-stat-badge.c-success   { background: var(--ds-success-soft); color: var(--ds-success); }
.ds-stat-badge.c-warning   { background: var(--ds-warning-soft); color: var(--ds-warning); }
.ds-stat-badge.c-secondary { background: rgba(100, 116, 139, 0.1); color: var(--ds-text-muted); }

.ds-stat-icon { width: 52px; height: 52px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ds-stat-icon i { font-size: 1.6rem; }
.ds-stat-icon.c-primary   { background: var(--ds-primary-soft2); color: var(--ds-primary); }
.ds-stat-icon.c-success   { background: var(--ds-success-soft); color: var(--ds-success); }
.ds-stat-icon.c-warning   { background: var(--ds-warning-soft); color: var(--ds-warning); }
.ds-stat-icon.c-secondary { background: rgba(100, 116, 139, 0.1); color: var(--ds-text-muted); }

/* Quick Access Modern 2x2 Tiles */
.ds-quick-tile {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 14px 10px !important;
    border-radius: var(--r-sm) !important;
    border: 1.5px solid var(--ds-border) !important;
    background: var(--ds-surface-sunken) !important;
    color: var(--ds-text) !important;
    transition: var(--ds-ease) !important;
    cursor: pointer !important;
    text-align: center !important;
    gap: 6px !important;
    min-height: 84px !important;
}
.ds-quick-tile:hover {
    border-color: var(--ds-primary) !important;
    background: var(--ds-primary-soft) !important;
    color: var(--ds-primary) !important;
    transform: translateY(-2px);
    box-shadow: var(--ds-shadow-1) !important;
}
.ds-quick-tile .tile-icon {
    font-size: 1.45rem !important;
    transition: transform 0.2s !important;
}
.ds-quick-tile:hover .tile-icon {
    transform: scale(1.1);
}
.ds-quick-tile .tile-label {
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    color: inherit !important;
}

[data-layout-mode="dark"] .ds-quick-tile {
    background: #0d1527 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #cbd5e1 !important;
}
[data-layout-mode="dark"] .ds-quick-tile:hover {
    background: #151f33 !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
}

/* Quick Access Buttons (Legacy / Full-width) */
.ds-quick-btn {
    display: flex !important; align-items: center !important;
    padding: 12px 14px !important;
    border-radius: var(--r-sm) !important;
    border: 1.5px solid var(--ds-border) !important;
    background: var(--ds-surface-sunken) !important;
    color: var(--ds-text-secondary) !important;
    font-size: 0.83rem !important; font-weight: 500 !important;
    cursor: pointer; transition: var(--ds-ease) !important;
    text-align: left !important; width: 100% !important; text-decoration: none !important;
    gap: 10px !important;
}
.ds-quick-btn:hover {
    border-color: var(--ds-primary) !important;
    background: var(--ds-primary-soft) !important;
    color: var(--ds-primary) !important;
    box-shadow: var(--ds-shadow-1) !important;
}
.ds-quick-btn i.left-icon { font-size: 1.15rem; color: var(--ds-primary); flex-shrink: 0; }
.ds-quick-btn i.arrow-icon { font-size: 1rem; color: var(--ds-text-disabled); transition: transform 0.2s; margin-left: auto; }
.ds-quick-btn:hover i.arrow-icon { transform: translateX(4px); color: var(--ds-primary); }

/* Audit Logs Timeline */
.ds-audit-item { display: flex; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--ds-border-soft); margin-bottom: 12px; align-items: flex-start; }
.ds-audit-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.ds-audit-dot { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; margin-top: 2px; }
.ds-audit-action-badge { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 4px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; font-family: monospace; }
.ds-audit-body { flex: 1; min-width: 0; }
.ds-audit-name { font-size: 0.82rem; font-weight: 600; color: var(--ds-text); margin-bottom: 2px; }
.ds-audit-name span { color: var(--ds-text-muted); font-weight: 400; }
.ds-audit-time { font-size: 0.72rem; color: var(--ds-text-muted); white-space: nowrap; }

/* Investor Initials Avatar */
.inv-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; color: #fff; flex-shrink: 0; }

/* Footer */
.footer {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    margin-top: auto !important;
    background: var(--ds-surface) !important;
    border-top: 1px solid var(--ds-border) !important;
    padding: 16px 24px !important;
    color: var(--ds-text-muted) !important;
    font-size: 0.8rem !important;
}
.footer a { color: var(--ds-primary) !important; text-decoration: none !important; }
.footer a:hover { color: var(--ds-primary-hover) !important; }

/* Dark mode image invert for master diagrams */
[data-layout-mode="dark"] .masterimg { filter: invert(100%) !important; }

/* ══ 17. FLATPICKR MODERN STYLING & EDITABLE YEAR ════════════ */
.flatpickr-calendar {
    font-family: inherit !important;
    border-radius: var(--r-md) !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid var(--ds-border) !important;
    background: var(--ds-surface) !important;
    z-index: 999999 !important;
    overflow: hidden !important;
}

.flatpickr-months {
    background: linear-gradient(135deg, #0078aa 0%, #005a80 100%) !important;
    border-top-left-radius: var(--r-md) !important;
    border-top-right-radius: var(--r-md) !important;
    color: #ffffff !important;
    padding: 6px 0 !important;
    position: relative !important;
}

.flatpickr-current-month {
    color: #ffffff !important;
    fill: #ffffff !important;
    font-size: 1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding-top: 2px !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    background: rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    border-radius: 6px !important;
    padding: 3px 8px !important;
    cursor: pointer !important;
    font-size: 0.9rem !important;
    transition: var(--ds-ease) !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months:hover {
    background: rgba(255, 255, 255, 0.28) !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months option {
    background: #ffffff !important;
    color: #1a202c !important;
}

[data-layout-mode="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months option {
    background: #1e293b !important;
    color: #f1f5f9 !important;
}

/* Ensure year input is ALWAYS clearly editable, clickable, and highlighted */
.flatpickr-current-month .numInputWrapper {
    display: inline-flex !important;
    align-items: center !important;
    width: 78px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.45) !important;
    border-radius: 6px !important;
    padding: 2px 4px !important;
    transition: var(--ds-ease) !important;
}

.flatpickr-current-month .numInputWrapper:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.7) !important;
}

.flatpickr-current-month input.cur-year,
.flatpickr-current-month input.cur-year[disabled],
.flatpickr-current-month input.cur-year[readonly] {
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    cursor: text !important;
    pointer-events: auto !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    opacity: 1 !important;
    text-align: center !important;
    width: 100% !important;
    user-select: text !important;
    -webkit-user-select: text !important;
}

.flatpickr-current-month input.cur-year:focus {
    background: rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7) !important;
    border-radius: 4px !important;
}

.flatpickr-current-month .numInputWrapper span {
    border-color: rgba(255, 255, 255, 0.35) !important;
}
.flatpickr-current-month .numInputWrapper span:hover {
    background: rgba(255, 255, 255, 0.25) !important;
}
.flatpickr-current-month .numInputWrapper span.arrowUp:after {
    border-bottom-color: #ffffff !important;
}
.flatpickr-current-month .numInputWrapper span.arrowDown:after {
    border-top-color: #ffffff !important;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    color: #ffffff !important;
    fill: #ffffff !important;
    padding: 8px 10px !important;
}
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg {
    fill: #ffffff !important;
}
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: #dbeafe !important;
}

span.flatpickr-weekday {
    color: var(--ds-text-muted) !important;
    font-weight: 600 !important;
    font-size: 0.78rem !important;
}

.flatpickr-day {
    color: var(--ds-text) !important;
    border-radius: var(--r-sm) !important;
    transition: var(--ds-ease) !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.prevMonthDay.selected,
.flatpickr-day.nextMonthDay.selected {
    background: var(--ds-primary) !important;
    border-color: var(--ds-primary) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

.flatpickr-day.today {
    border-color: var(--ds-primary) !important;
    font-weight: 600 !important;
}
.flatpickr-day.today:hover {
    background: var(--ds-primary-soft) !important;
    color: var(--ds-primary) !important;
}

.flatpickr-day:hover {
    background: var(--ds-primary-soft) !important;
    color: var(--ds-primary) !important;
}

/* Dark mode styling for flatpickr */
[data-layout-mode="dark"] .flatpickr-calendar {
    background: #1e2433 !important;
    border-color: #2e384d !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5) !important;
}
[data-layout-mode="dark"] span.flatpickr-weekday {
    background: #1e2433 !important;
    color: #94a3b8 !important;
}
[data-layout-mode="dark"] .flatpickr-day {
    color: #f1f5f9 !important;
}
[data-layout-mode="dark"] .flatpickr-day.flatpickr-disabled,
[data-layout-mode="dark"] .flatpickr-day.flatpickr-disabled:hover,
[data-layout-mode="dark"] .flatpickr-day.prevMonthDay,
[data-layout-mode="dark"] .flatpickr-day.nextMonthDay {
    color: #475569 !important;
}
[data-layout-mode="dark"] .flatpickr-day:hover {
    background: rgba(0, 120, 170, 0.25) !important;
    color: #ffffff !important;
}

/* ══ 18. ICON FALLBACKS (BOXICONS ALIASES) ══════════════════ */
.bx.bx-refresh:before,
.bx-refresh:before { content: "\eb67" !important; } /* maps to bx-sync */
.bx.bxs-file-export:before,
.bxs-file-export:before { content: "\ed2b" !important; } /* maps to bxs-spreadsheet */

/* ══ 19. REFINED DARK MODE UI ENHANCEMENTS ══════════════════ */
[data-layout-mode="dark"] .table thead th {
    background: #0d1527 !important;
    color: #cbd5e1 !important;
    font-weight: 700 !important;
    letter-spacing: 0.6px !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.12) !important;
}

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

[data-layout-mode="dark"] .table tbody tr:hover {
    background: rgba(56, 189, 248, 0.06) !important;
}

/* Card surfaces */
[data-layout-mode="dark"] .card {
    background: #111827 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

[data-layout-mode="dark"] .card-header {
    background: #0d1527 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Vibrant Soft Badges for Dark Mode */
[data-layout-mode="dark"] .badge-soft-success {
    color: #4ade80 !important;
    background-color: rgba(74, 222, 128, 0.16) !important;
    border: 1px solid rgba(74, 222, 128, 0.32) !important;
    font-weight: 600 !important;
}

[data-layout-mode="dark"] .badge-soft-primary {
    color: #38bdf8 !important;
    background-color: rgba(56, 189, 248, 0.16) !important;
    border: 1px solid rgba(56, 189, 248, 0.32) !important;
    font-weight: 600 !important;
}

[data-layout-mode="dark"] .badge-soft-warning {
    color: #fbbf24 !important;
    background-color: rgba(251, 191, 36, 0.16) !important;
    border: 1px solid rgba(251, 191, 36, 0.32) !important;
    font-weight: 600 !important;
}

[data-layout-mode="dark"] .badge-soft-danger {
    color: #f87171 !important;
    background-color: rgba(248, 113, 113, 0.16) !important;
    border: 1px solid rgba(248, 113, 113, 0.32) !important;
    font-weight: 600 !important;
}

[data-layout-mode="dark"] .badge-soft-info {
    color: #22d3ee !important;
    background-color: rgba(34, 211, 238, 0.16) !important;
    border: 1px solid rgba(34, 211, 238, 0.32) !important;
    font-weight: 600 !important;
}

[data-layout-mode="dark"] .badge-soft-secondary {
    color: #94a3b8 !important;
    background-color: rgba(148, 163, 184, 0.16) !important;
    border: 1px solid rgba(148, 163, 184, 0.25) !important;
    font-weight: 600 !important;
}

/* Action Icon Buttons in Table */
[data-layout-mode="dark"] .action-icon-btn.btn-soft-primary {
    color: #38bdf8 !important;
    background-color: rgba(56, 189, 248, 0.14) !important;
    border: 1px solid rgba(56, 189, 248, 0.28) !important;
}
[data-layout-mode="dark"] .action-icon-btn.btn-soft-primary:hover {
    background-color: #38bdf8 !important;
    color: #0b1120 !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4) !important;
}

[data-layout-mode="dark"] .action-icon-btn.btn-soft-success {
    color: #4ade80 !important;
    background-color: rgba(74, 222, 128, 0.14) !important;
    border: 1px solid rgba(74, 222, 128, 0.28) !important;
}
[data-layout-mode="dark"] .action-icon-btn.btn-soft-success:hover {
    background-color: #4ade80 !important;
    color: #0b1120 !important;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.4) !important;
}

[data-layout-mode="dark"] .action-icon-btn.btn-soft-info {
    color: #22d3ee !important;
    background-color: rgba(34, 211, 238, 0.14) !important;
    border: 1px solid rgba(34, 211, 238, 0.28) !important;
}
[data-layout-mode="dark"] .action-icon-btn.btn-soft-info:hover {
    background-color: #22d3ee !important;
    color: #0b1120 !important;
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.4) !important;
}

[data-layout-mode="dark"] .action-icon-btn.btn-soft-danger {
    color: #f87171 !important;
    background-color: rgba(248, 113, 113, 0.14) !important;
    border: 1px solid rgba(248, 113, 113, 0.28) !important;
}
[data-layout-mode="dark"] .action-icon-btn.btn-soft-danger:hover {
    background-color: #f87171 !important;
    color: #0b1120 !important;
    box-shadow: 0 0 10px rgba(248, 113, 113, 0.4) !important;
}

[data-layout-mode="dark"] .action-icon-btn.btn-soft-secondary {
    color: #94a3b8 !important;
    background-color: rgba(148, 163, 184, 0.14) !important;
    border: 1px solid rgba(148, 163, 184, 0.25) !important;
}
[data-layout-mode="dark"] .action-icon-btn.btn-soft-secondary:hover {
    background-color: #94a3b8 !important;
    color: #0b1120 !important;
}

/* Search Box & Page Select in Dark Mode */
[data-layout-mode="dark"] .searchfilter,
[data-layout-mode="dark"] .search-box .searchfilter,
[data-layout-mode="dark"] #dataperpage {
    background: #0d1527 !important;
    border: 1.5px solid rgba(255, 255, 255, 0.15) !important;
    color: #f1f5f9 !important;
}

[data-layout-mode="dark"] .searchfilter:focus,
[data-layout-mode="dark"] .search-box .searchfilter:focus,
[data-layout-mode="dark"] #dataperpage:focus {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22) !important;
}

[data-layout-mode="dark"] .searchfilter::placeholder {
    color: #64748b !important;
}

/* Page Title & Breadcrumb */
[data-layout-mode="dark"] .page-title-box h4,
[data-layout-mode="dark"] .ds-page-title-box h4,
[data-layout-mode="dark"] .title {
    color: #f8fafc !important;
}

[data-layout-mode="dark"] .breadcrumb-item,
[data-layout-mode="dark"] .breadcrumb-item a,
[data-layout-mode="dark"] .ds-breadcrumb {
    color: #94a3b8 !important;
}

/* Brand Box & Logo in Dark Mode */
[data-layout-mode="dark"] .navbar-brand-box {
    background: #0b1120 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
}

[data-layout-mode="dark"] #page-topbar {
    background: #0d1527 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
}

[data-layout-mode="dark"] .navbar-brand-box .logo-lg img,
[data-layout-mode="dark"] .navbar-brand-box .logo-sm img {
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.45)) !important;
}

/* Direct Menu Active Styling in Dark Mode */
[data-layout-mode="dark"] body #sidebar-menu > ul > li.mm-active > a:not(.has-arrow),
[data-layout-mode="dark"] body #sidebar-menu > ul > li > a.active:not(.has-arrow) {
    background: rgba(56, 189, 248, 0.18) !important;
    color: #38bdf8 !important;
    font-weight: 600 !important;
}
[data-layout-mode="dark"] body #sidebar-menu > ul > li.mm-active > a:not(.has-arrow) i,
[data-layout-mode="dark"] body #sidebar-menu > ul > li > a.active:not(.has-arrow) i {
    color: #38bdf8 !important;
}

/* ══ 15. COLUMN MANAGER & TABLE FILTER (#tablefilter) ════════ */
#tablefilter {
    min-width: 270px !important;
    max-height: 480px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 6px !important;
    border-radius: 12px !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22) !important;
    border: 1px solid var(--ds-border) !important;
    background: var(--ds-surface) !important;
    z-index: 1060 !important;
}

#managedata {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    font-size: 0.88rem !important;
}

#managedata .list-group-item {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 9px 12px !important;
    margin: 2px 0 !important;
    border-radius: 8px !important;
    background-color: transparent !important;
    color: var(--ds-text) !important;
    border: 1px solid transparent !important;
    font-weight: 500 !important;
    transition: background-color 0.15s ease, border-color 0.15s ease !important;
}

#managedata .list-group-item:hover:not(.disabled) {
    background-color: rgba(0, 120, 170, 0.08) !important;
    border-color: rgba(0, 120, 170, 0.18) !important;
}

#managedata .list-group-item i {
    color: var(--ds-text-muted) !important;
    font-size: 1.05rem !important;
    flex-shrink: 0 !important;
}

#managedata .list-group-item:hover:not(.disabled) i {
    color: var(--ds-primary) !important;
}

#managedata .list-group-item.disabled,
#managedata .list-group-item:disabled {
    background-color: #f1f5f9 !important;
    color: #64748b !important;
    border: 1px dashed #cbd5e1 !important;
    opacity: 0.85 !important;
    cursor: default !important;
}

/* Switches inside #managedata */
#managedata .form-check-input {
    cursor: pointer !important;
    width: 2.2em !important;
    height: 1.25em !important;
    border-radius: 2em !important;
    margin: 0 !important;
}

#managedata .form-check-input:checked {
    background-color: var(--ds-primary) !important;
    border-color: var(--ds-primary) !important;
}

/* ── Dark Mode Table Filter & Column Manager ────────────────── */
[data-layout-mode="dark"] #tablefilter {
    background: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.7) !important;
}

[data-layout-mode="dark"] #managedata {
    background: #0f172a !important;
}

[data-layout-mode="dark"] #managedata .list-group-item {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

[data-layout-mode="dark"] #managedata .list-group-item:hover:not(.disabled) {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border-color: rgba(56, 189, 248, 0.3) !important;
}

[data-layout-mode="dark"] #managedata .list-group-item i {
    color: #64748b !important;
}

[data-layout-mode="dark"] #managedata .list-group-item:hover:not(.disabled) i {
    color: #38bdf8 !important;
}

/* Fix stark white background on disabled items in Dark Mode */
[data-layout-mode="dark"] #managedata .list-group-item.disabled,
[data-layout-mode="dark"] #managedata .list-group-item:disabled,
[data-layout-mode="dark"] .list-group-item.disabled,
[data-layout-mode="dark"] .list-group-item:disabled {
    background-color: #151f33 !important;
    color: #94a3b8 !important;
    border: 1px dashed rgba(255, 255, 255, 0.12) !important;
    opacity: 0.88 !important;
}

[data-layout-mode="dark"] #managedata .form-check-input,
[data-layout-mode="dark"] .form-switch .form-check-input {
    background-color: #334155 !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
}

[data-layout-mode="dark"] #managedata .form-check-input:checked,
[data-layout-mode="dark"] .form-switch .form-check-input:checked {
    background-color: #38bdf8 !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.45) !important;
}

[data-layout-mode="dark"] #managedata .list-group-item.disabled .form-check-input:checked {
    background-color: #0284c7 !important;
    border-color: #0284c7 !important;
    opacity: 0.7 !important;
}

/* Title icon button in dark mode */
[data-layout-mode="dark"] .title_icon,
[data-layout-mode="dark"] .btn-group a .title_icon {
    color: #38bdf8 !important;
}

/* General Dropdown Menu in Dark Mode */
[data-layout-mode="dark"] .dropdown-menu {
    background-color: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.65) !important;
}

[data-layout-mode="dark"] .dropdown-item {
    color: #cbd5e1 !important;
}

[data-layout-mode="dark"] .dropdown-item:hover,
[data-layout-mode="dark"] .dropdown-item:focus {
    background-color: #1e293b !important;
    color: #38bdf8 !important;
}

/* Modals & Forms in Dark Mode */
[data-layout-mode="dark"] .modal-content {
    background-color: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #e2e8f0 !important;
}

[data-layout-mode="dark"] .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

[data-layout-mode="dark"] .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

[data-layout-mode="dark"] .modal-title {
    color: #f8fafc !important;
}

[data-layout-mode="dark"] .modal-content .form-control,
[data-layout-mode="dark"] .modal-content .form-select {
    background-color: #0b1120 !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: #f1f5f9 !important;
}

[data-layout-mode="dark"] .modal-content .form-control:focus,
[data-layout-mode="dark"] .modal-content .form-select:focus {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22) !important;
    background-color: #0b1120 !important;
    color: #ffffff !important;
}

[data-layout-mode="dark"] .modal-content .form-label {
    color: #94a3b8 !important;
}

/* Flatpickr Calendar in Dark Mode */
[data-layout-mode="dark"] .flatpickr-calendar {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6) !important;
    color: #f1f5f9 !important;
}

[data-layout-mode="dark"] .flatpickr-calendar .flatpickr-months {
    background: #0b1120 !important;
    color: #f1f5f9 !important;
}

[data-layout-mode="dark"] .flatpickr-current-month .cur-year,
[data-layout-mode="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months {
    color: #f1f5f9 !important;
    background: transparent !important;
}

[data-layout-mode="dark"] .flatpickr-day {
    color: #cbd5e1 !important;
}

[data-layout-mode="dark"] .flatpickr-day:hover {
    background: #1e293b !important;
}

[data-layout-mode="dark"] .flatpickr-day.selected {
    background: #38bdf8 !important;
    border-color: #38bdf8 !important;
    color: #0b1120 !important;
}

/* ══ 16. COMPREHENSIVE BUTTON COLORS IN DARK MODE ════════════ */

/* A. Welcome Banner Action Buttons */
.card.ds-welcome-banner .btn-light,
.card.ds-welcome-banner .banner-btn-solid,
[data-layout-mode="dark"] .card.ds-welcome-banner .btn-light,
[data-layout-mode="dark"] .card.ds-welcome-banner .banner-btn-solid {
    background: #ffffff !important;
    border-color: #ffffff !important;
    color: #0078aa !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22) !important;
}
.card.ds-welcome-banner .btn-light:hover,
.card.ds-welcome-banner .banner-btn-solid:hover,
[data-layout-mode="dark"] .card.ds-welcome-banner .btn-light:hover,
[data-layout-mode="dark"] .card.ds-welcome-banner .banner-btn-solid:hover {
    background: #f0f9ff !important;
    border-color: #f0f9ff !important;
    color: #0284c7 !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3) !important;
}
.card.ds-welcome-banner .btn-outline-light,
.card.ds-welcome-banner .banner-btn-outline,
[data-layout-mode="dark"] .card.ds-welcome-banner .btn-outline-light,
[data-layout-mode="dark"] .card.ds-welcome-banner .banner-btn-outline {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.6) !important;
    color: #ffffff !important;
    backdrop-filter: blur(4px) !important;
}
.card.ds-welcome-banner .btn-outline-light:hover,
.card.ds-welcome-banner .banner-btn-outline:hover,
[data-layout-mode="dark"] .card.ds-welcome-banner .btn-outline-light:hover,
[data-layout-mode="dark"] .card.ds-welcome-banner .banner-btn-outline:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: #ffffff !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

/* B. General Light Button in Dark Mode */
[data-layout-mode="dark"] .btn-light:not(.banner-btn-solid) {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: #e2e8f0 !important;
}
[data-layout-mode="dark"] .btn-light:not(.banner-btn-solid):hover {
    background: #334155 !important;
    border-color: rgba(255, 255, 255, 0.24) !important;
    color: #ffffff !important;
}

/* C. Secondary & Outline-Secondary Buttons (Actions button, Reset, Cancel) */
[data-layout-mode="dark"] .btn-secondary {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
    color: #e2e8f0 !important;
    font-weight: 500 !important;
}
[data-layout-mode="dark"] .btn-secondary:hover,
[data-layout-mode="dark"] .btn-secondary:focus {
    background: #334155 !important;
    border-color: rgba(255, 255, 255, 0.28) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}
[data-layout-mode="dark"] .btn-outline-secondary {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #cbd5e1 !important;
    font-weight: 500 !important;
}
[data-layout-mode="dark"] .btn-outline-secondary:hover,
[data-layout-mode="dark"] .btn-outline-secondary:focus {
    background: #1e293b !important;
    border-color: #38bdf8 !important;
    color: #38bdf8 !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}

/* D. Primary & Outline-Primary Buttons */
[data-layout-mode="dark"] .btn-primary {
    background: #0284c7 !important;
    border-color: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.35) !important;
}
[data-layout-mode="dark"] .btn-primary:hover,
[data-layout-mode="dark"] .btn-primary:focus {
    background: #0ea5e9 !important;
    border-color: #0ea5e9 !important;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.45) !important;
}
[data-layout-mode="dark"] .btn-outline-primary {
    background: rgba(56, 189, 248, 0.08) !important;
    border-color: rgba(56, 189, 248, 0.45) !important;
    color: #38bdf8 !important;
}
[data-layout-mode="dark"] .btn-outline-primary:hover,
[data-layout-mode="dark"] .btn-outline-primary:focus {
    background: #38bdf8 !important;
    border-color: #38bdf8 !important;
    color: #0b1120 !important;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.4) !important;
}

/* E. Success & Danger Buttons */
[data-layout-mode="dark"] .btn-success {
    background: #10b981 !important;
    border-color: #10b981 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35) !important;
}
[data-layout-mode="dark"] .btn-success:hover,
[data-layout-mode="dark"] .btn-success:focus {
    background: #059669 !important;
    border-color: #059669 !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.45) !important;
}
[data-layout-mode="dark"] .btn-danger {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.35) !important;
}
[data-layout-mode="dark"] .btn-danger:hover,
[data-layout-mode="dark"] .btn-danger:focus {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
}

/* F. Soft Buttons (btn-soft-*) */
[data-layout-mode="dark"] .btn-soft-info {
    background-color: rgba(34, 211, 238, 0.15) !important;
    border: 1px solid rgba(34, 211, 238, 0.3) !important;
    color: #22d3ee !important;
}
[data-layout-mode="dark"] .btn-soft-info:hover,
[data-layout-mode="dark"] .btn-soft-info:focus {
    background-color: #06b6d4 !important;
    border-color: #06b6d4 !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.45) !important;
}
[data-layout-mode="dark"] .btn-soft-primary {
    background-color: rgba(56, 189, 248, 0.15) !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    color: #38bdf8 !important;
}
[data-layout-mode="dark"] .btn-soft-primary:hover,
[data-layout-mode="dark"] .btn-soft-primary:focus {
    background-color: #0284c7 !important;
    border-color: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.45) !important;
}
[data-layout-mode="dark"] .btn-soft-success {
    background-color: rgba(34, 197, 94, 0.15) !important;
    border: 1px solid rgba(34, 197, 94, 0.3) !important;
    color: #4ade80 !important;
}
[data-layout-mode="dark"] .btn-soft-success:hover,
[data-layout-mode="dark"] .btn-soft-success:focus {
    background-color: #16a34a !important;
    border-color: #16a34a !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.45) !important;
}
[data-layout-mode="dark"] .btn-soft-danger {
    background-color: rgba(248, 113, 113, 0.15) !important;
    border: 1px solid rgba(248, 113, 113, 0.3) !important;
    color: #f87171 !important;
}
[data-layout-mode="dark"] .btn-soft-danger:hover,
[data-layout-mode="dark"] .btn-soft-danger:focus {
    background-color: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(248, 113, 113, 0.45) !important;
}
[data-layout-mode="dark"] .btn-soft-secondary {
    background-color: rgba(148, 163, 184, 0.15) !important;
    border: 1px solid rgba(148, 163, 184, 0.28) !important;
    color: #94a3b8 !important;
}
[data-layout-mode="dark"] .btn-soft-secondary:hover,
[data-layout-mode="dark"] .btn-soft-secondary:focus {
    background-color: #475569 !important;
    border-color: #475569 !important;
    color: #ffffff !important;
}

/* G. Modal Close Icon & Footer Buttons */
[data-layout-mode="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%) !important;
    opacity: 0.8 !important;
}
[data-layout-mode="dark"] .btn-close:hover {
    opacity: 1 !important;
}
[data-layout-mode="dark"] .modal-footer .btn-light,
[data-layout-mode="dark"] .modal-footer .btn-secondary {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #cbd5e1 !important;
}
[data-layout-mode="dark"] .modal-footer .btn-light:hover,
[data-layout-mode="dark"] .modal-footer .btn-secondary:hover {
    background: #334155 !important;
    border-color: rgba(255, 255, 255, 0.26) !important;
    color: #ffffff !important;
}

/* H. Quick Access Buttons on Dashboard */
[data-layout-mode="dark"] .ds-quick-btn {
    background: #0d1527 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #cbd5e1 !important;
}
[data-layout-mode="dark"] .ds-quick-btn:hover {
    background: #151f33 !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}
[data-layout-mode="dark"] .ds-quick-btn i.left-icon {
    color: #38bdf8 !important;
}
[data-layout-mode="dark"] .ds-quick-btn i.arrow-icon {
    color: #64748b !important;
}
[data-layout-mode="dark"] .ds-quick-btn:hover i.arrow-icon {
    color: #38bdf8 !important;
}

/* I. Table Pagination Buttons */
[data-layout-mode="dark"] .pagination .page-item .page-link {
    background: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #94a3b8 !important;
    transition: all 0.2s ease !important;
}
[data-layout-mode="dark"] .pagination .page-item .page-link:hover {
    background: #1e293b !important;
    border-color: #38bdf8 !important;
    color: #38bdf8 !important;
}
[data-layout-mode="dark"] .pagination .page-item.active .page-link {
    background: #0284c7 !important;
    border-color: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.45) !important;
}
[data-layout-mode="dark"] .pagination .page-item.disabled .page-link {
    background: #0a101f !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    color: #475569 !important;
    opacity: 0.6 !important;
}

/* ══ 16. RESPONSIVE MEDIA QUERIES ══════════════════════════ */
@media (max-width: 991.98px) {
    .navbar-brand-box { width: var(--sb-collapsed-w) !important; }
    .navbar-brand-box .logo-dark span.logo-lg { display: none !important; }
    .navbar-brand-box .logo-dark span.logo-sm { display: flex !important; }
    body .vertical-menu { width: var(--sb-w) !important; }
}
@media (max-width: 767.98px) {
    .card.ds-welcome-banner .card-body { padding: 20px !important; }
    .welcome-title { font-size: 1.1rem !important; }
    .ds-stat-value { font-size: 1.7rem !important; }
}
@media (max-width: 575.98px) {
    .page-content { padding: calc(var(--tb-h) + 12px) 12px 60px !important; }
    .kpal-box { max-width: calc(100vw - 24px) !important; }
    .ds-page-title-box { flex-direction: column !important; align-items: flex-start !important; }
}
