/* Bootstrap Form Floating Placeholder Styles */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ==============================================
           THEME SYSTEM - CSS CUSTOM PROPERTIES
   ============================================== */

:root {
    /* Base Layout Colors - Light Theme */
    --bg-primary: #f8fafc; /* page background */
    --bg-surface: #ffffff; /* cards and surfaces */
    --bg-elevated: #f1f5f9; /* elevated areas */
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    /* Borders & Shadows */
    --border-primary: #e2e8f0;
    --border-secondary: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.9);
    --glass-blur: 16px;
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    /* Geometric Background */
    --geo-color-1: #dbeafe;
    --geo-color-2: #f0f9ff;
    --geo-color-3: #fafafa;
    /* Brand */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-500: #1160B1;
    --primary-600: #0E4E94;
    --primary-700: #1d4ed8;
    --primary-rgb: 17, 96, 177;
    --secondary-500: #23BFBF;
    --accent-500: #f59e0b;
    --accent-600: #d97706;
    --accent-rgb: 245, 158, 11;
    /* Semantic */
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    --info: #0284c7;
    /* Text on colored backgrounds */
    --text-on-primary: #ffffff;
    --text-on-dark: #ffffff;
    --text-on-accent: #000000;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --bg-primary: #0f172a; /* slate-900 */
    --bg-surface: #1e293b; /* slate-800 */
    --bg-elevated: #334155; /* slate-700 */

    --text-primary: #f8fafc; /* slate-50 */
    --text-secondary: #cbd5e1; /* slate-300 */
    --text-muted: #64748b; /* slate-500 */

    --border-primary: #334155; /* slate-700 */
    --border-secondary: #475569; /* slate-600 */

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    /* Dark glass */
    --glass-bg: rgba(30, 41, 59, 0.8);
    --glass-border: rgba(148, 163, 184, 0.2);
    --glass-blur: 20px;
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
    --geo-color-1: #1e3a8a;
    --geo-color-2: #1e40af;
    --geo-color-3: #312e81;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-rgb: 59, 130, 246;
    --secondary-500: #06b6d4;
    --accent-500: #f59e0b;
    --accent-600: #d97706;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #06b6d4;
    --text-on-primary: #ffffff;
    --text-on-accent: #000000;
}

/* Base */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1.6;
}

.top-nav {
    position: sticky;
    top: 0;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--glass-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1020;
}

    .top-nav .nav-link {
        position: relative;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 16px;
        margin: 10px 0;
        border-radius: 16px;
        text-decoration: none;
        cursor: pointer;
        color: var(--text-secondary);
        font-weight: 500;
        font-size: 15px;
        /* Glass tokens */  
        -webkit-backdrop-filter: blur(var(--glass-blur));
        transition: all .2s ease-in-out;
    }

/* =========================
   SIDEBAR (logo fixed, menu scrolls)
   ========================= */
.sidebar-full {
    /* Pin the whole sidebar within the viewport */
    position: sticky;
    top: 0;
    z-index: 1020;
    /* Sizing / layout */
    flex: 0 0 260px;
    width: 260px;
    max-width: 260px;
    min-width: 220px;
    height: 100dvh; /* use dynamic viewport height for mobile-safe 100% */
    /* Make it a column: header (fixed) + scrollable nav */
    display: flex;
    flex-direction: column;
    /* IMPORTANT: stop the entire sidebar from scrolling */
    overflow: hidden;
    /* Theme + glass */
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-right: 1px solid var(--border-primary);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--glass-shadow);
}

/* Sidebar header (logo area) stays pinned */
.sidebar-heading {
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    z-index: 2; 
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-primary);
}

    .sidebar-heading img {
        max-width: 100%;
        height: auto;
        display: block;
        /* Optional: constrain tall logos */
        max-height: 600px;
  
    }

/* Only the menu scrolls */
#sidebarMenu {
    flex: 1 1 auto;
    min-height: 0; /* critical so flex child can shrink and allow scrolling */
    overflow-y: auto; /* scrollable region */
    overflow-x: hidden;
    padding: 0.5rem 1rem 1rem;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: thin; /* Firefox */
}

    /* Optional: subtle top/bottom fades to hint overflow */
    #sidebarMenu::before,
    #sidebarMenu::after {
        content: "";
        position: sticky;
        display: block;
        height: 10px;
        z-index: 1;
    }

    #sidebarMenu::before {
        top: 0;
        background: linear-gradient(to bottom, rgba(0,0,0,.06), transparent);
    }

    #sidebarMenu::after {
        bottom: 0;
        background: linear-gradient(to top, rgba(0,0,0,.06), transparent);
    }

    /* Hide WebKit scrollbars if you prefer a cleaner look */
/* Keep logo fixed; only menu scrolls (already set) */
.sidebar-full {
    position: sticky;
    top: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* sidebar itself does NOT scroll */
}

/* Scrollable menu area */
#sidebarMenu {
    flex: 1 1 auto;
    min-height: 0; /* lets the flex child actually scroll */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 1rem 1rem;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* HIDE SCROLLBARS (but keep scrolling) */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge legacy */
}

    /* WebKit (Chrome/Safari/Edge) */
    #sidebarMenu::-webkit-scrollbar {
        width: 0;
        height: 0;
    }

    #sidebarMenu::-webkit-scrollbar-thumb,
    #sidebarMenu::-webkit-scrollbar-track {
        background: transparent;
        border: none;
    }

    /* Optional: fade hints so users know there’s more content */
    #sidebarMenu::before,
    #sidebarMenu::after {
        content: "";
        position: sticky;
        display: block;
        height: 10px;
        z-index: 1;
    }

    #sidebarMenu::before {
        top: 0;
        background: linear-gradient(to bottom, rgba(0,0,0,.06), transparent);
    }

    #sidebarMenu::after {
        bottom: 0;
        background: linear-gradient(to top, rgba(0,0,0,.06), transparent);
    }


    /* =========================
   LINK STYLES (hover/active + theme)
   ========================= */
   #sidebarMenu .nav-link {
        position: relative;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 16px;
        margin: 10px 0;
        border-radius: 16px;
        text-decoration: none;
        cursor: pointer;
        color: var(--text-secondary);
        font-weight: 500;
        font-size: 15px;
        /* Glass tokens */
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        backdrop-filter: blur(var(--glass-blur));
        -webkit-backdrop-filter: blur(var(--glass-blur));
        box-shadow: 0 4px 10px rgba(0,0,0,.08), inset 1px 1px 3px rgba(255,255,255,.35), inset -1px -1px 2px rgba(0,0,0,.05);
        transition: all .2s ease-in-out;
    }

        #sidebarMenu .nav-link i {
            font-size: 18px;
            color: var(--text-secondary);
            transition: all .2s ease-in-out;
        }

        #sidebarMenu .nav-link:hover {
            background: rgba(var(--primary-rgb), .06);
            border-color: rgba(var(--primary-rgb), .20);
            box-shadow: var(--glass-shadow), 0 0 8px rgba(255,255,255,.25) inset;
            color: var(--primary-500);
        }

            #sidebarMenu .nav-link:hover i {
                color: var(--primary-600);
                filter: drop-shadow(0 0 4px rgba(0, 86, 179, .5));
            }

        /* Active / current route */
        #sidebarMenu .nav-link.active,
        #sidebarMenu .nav-link[aria-current="page"] {
            color: var(--text-on-primary);
            background: var(--primary-500);
            border: 1px solid rgba(var(--primary-rgb), .25);
            border-radius: 20px;
            box-shadow: 0 6px 14px rgba(0,0,0,.14), inset 0 0 6px rgba(255,255,255,.24);
        }

            #sidebarMenu .nav-link.active i,
            #sidebarMenu .nav-link[aria-current="page"] i {
                color: var(--text-on-primary);
            }

            /* Left accent bar for the active item */
            #sidebarMenu .nav-link.active::after,
            #sidebarMenu .nav-link[aria-current="page"]::after {
                content: "";
                position: absolute;
                left: -1px;
                top: 8px;
                bottom: 8px;
                width: 4px;
                border-radius: 4px;
                background: linear-gradient(180deg, var(--primary-600), var(--secondary-500));
                box-shadow: 0 0 0 2px rgba(255,255,255,.18) inset, 0 6px 12px rgba(0,0,0,.12);
            }

/* =========================
   DARK MODE POLISH (inherits your tokens)
   ========================= */
[data-theme="dark"] .sidebar-full {
    box-shadow: 0 12px 30px rgba(0,0,0,.4);
}

[data-theme="dark"] #sidebarMenu::before,
[data-theme="dark"] #sidebarMenu::after {
    background: none; /* fades look heavier on dark; disable or adjust */
}


footer {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--glass-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1020;
}
/* ==============================================
   LAYOUT: SIDEBAR + CONTENT (FIXES RIGHT GAP)
   ============================================== */
.dashboard-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    overflow: hidden; /* prevent phantom horizontal scroll */
}

/* Fixed-width sidebar (works for #sidebar-wrapper or .sidebar-full) */
#sidebar-wrapper,
.sidebar-full {
    flex: 0 0 260px;
    max-width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-primary);
    box-shadow: var(--shadow-sm);
}

/* Content fills remaining space */
#page-content-wrapper {
    flex: 1 1 auto;
    width: auto;
    min-width: 0; /* critical for flex shrink */
    height: 100vh; /* match shell height */
    overflow-y: auto; /* <-- ONLY this scrolls */
    overflow-x: clip;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color .3s ease, color .3s ease;
}

/* Full bleed containers/tables truly full width */
.container-fluid {
    max-width: 100%;
}

.table-responsive {
    width: 100%;
}

/* Optional: collapse sidebar at lg- breakpoint (if desired) */
@media (max-width: 991.98px) {
    #sidebar-wrapper, .sidebar-full {
        flex-basis: 0;
        max-width: 0;
    }
}

/* ==============================================
   COMPONENTS / UI
   ============================================== */

.avatar-sm {
    width: 2rem;
    height: 2rem;
    font-size: 0.875rem;
}

.avatar-xs {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.75rem;
}

.btn-themed {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: var(--text-on-primary);
    border: none;
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

    .btn-themed::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        transition: left 0.5s ease;
    }

    .btn-themed:hover::before {
        left: 100%;
    }

    .btn-themed:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
        background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
        color: var(--text-on-primary);
    }

.btn-themed-secondary {
    background: linear-gradient(135deg, var(--secondary-500), var(--accent-500));
    color: var(--text-on-primary);
    border: none;
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
}

    .btn-themed-secondary:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
        filter: brightness(1.1);
        color: var(--text-on-primary);
    }

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.dropdown-menu {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--shadow-lg);
    border-radius: 0.75rem;
}

.dropdown-item {
    color: var(--text-primary);
    transition: all 0.2s ease;
}

    .dropdown-item:hover {
        background: rgba(var(--primary-rgb), 0.1);
        color: var(--primary-600);
    }

.pagination .page-link:hover {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-600);
}

/* Dashboard Background with Geometric Pattern */
.dashboard-gradient {
    min-height: 100vh;
    background: radial-gradient(circle at 20% 30%, var(--geo-color-1) 0%, transparent 50%), radial-gradient(circle at 80% 70%, var(--geo-color-2) 0%, transparent 50%), radial-gradient(circle at 50% 50%, var(--geo-color-3) 0%, transparent 70%), var(--bg-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Glass Effect */
.glass-effect {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--glass-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* KPI Cards */
.kpi-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--glass-shadow);
    border-radius: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

    .kpi-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.1), transparent);
        transition: left 0.8s ease;
    }

    .kpi-card:hover::before {
        left: 100%;
    }

    .kpi-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-lg), 0 0 30px rgba(var(--primary-rgb), 0.1);
    }

/* AI Forecast Card */
.ai-forecast-card {
    background: linear-gradient(135deg, var(--primary-500), var(--secondary-500));
    color: var(--text-on-primary);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

    .ai-forecast-card::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
        transform: translateX(-100%);
        transition: transform 0.6s ease;
    }

    .ai-forecast-card:hover::before {
        transform: translateX(100%);
    }

/* Chart Container */
.chart-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--glass-shadow);
    border-radius: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Table Styling */
.themed-table {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--glass-shadow);
    border-radius: 1rem;
    overflow: hidden;
}

.table th {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--text-primary);
    border: none;
    padding: 1rem;
    font-weight: 600;
}

.table td {
    color: var(--text-primary);
    border-color: var(--border-primary);
    padding: 1rem;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: rgba(var(--primary-rgb), 0.05);
}

/* Badge Styling */
.badge-themed {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.75rem;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

    .theme-switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border-primary);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 30px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

    .slider:before {
        position: absolute;
        content: "";
        height: 24px;
        width: 24px;
        left: 3px;
        top: 3px;
        background: var(--bg-surface);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 50%;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

input:checked + .slider {
    background: var(--primary-500);
}

    input:checked + .slider:before {
        transform: translateX(30px);
    }

.slider .bi {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.875rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.slider .bi-sun-fill {
    left: 8px;
    color: var(--warning);
    opacity: 1;
}

.slider .bi-moon-fill {
    right: 8px;
    color: var(--primary-100);
    opacity: 0;
}

input:checked + .slider .bi-sun-fill {
    opacity: 0;
}

input:checked + .slider .bi-moon-fill {
    opacity: 1;
}

/* Animations */
.animate-fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-delay-1 {
    animation-delay: 0.1s;
}

.animate-delay-2 {
    animation-delay: 0.2s;
}

.animate-delay-3 {
    animation-delay: 0.3s;
}

.animate-delay-4 {
    animation-delay: 0.4s;
}

/* Icons & Text helpers */
.icon-primary {
    color: var(--primary-500) !important;
}

.icon-success {
    color: var(--success) !important;
}

.icon-danger {
    color: var(--error) !important;
}

.icon-warning {
    color: var(--warning) !important;
}

.icon-info {
    color: var(--info) !important;
}

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

.text-themed-secondary {
    color: var(--text-secondary) !important;
}

.text-themed-muted {
    color: var(--text-muted) !important;
}

/* =========================
   2025 RESPONSIVE UPGRADE
   ========================= */

/* 3D Hover & Modern Card Defaults */
.card.hover-3d, .kpi-card {
    border-radius: 16px;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
    will-change: transform;
}

@media (hover:hover) {
    .card.hover-3d:hover, .kpi-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 30px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
    }
}

.card-2025, .glass-effect {
    border-radius: 16px !important;
}

/* Utility Grid for KPIs & Cards */
.kpi-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.section-grid {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 1200px) {
    .section-grid--2-1 {
        grid-template-columns: 2fr 1fr;
    }

    .section-grid--1-1 {
        grid-template-columns: 1fr 1fr;
    }

    .section-grid--3-2 {
        grid-template-columns: 3fr 2fr;
    }
}

/* Sticky Subheader / Toolbar */
.subheader-sticky {
    position: sticky;
    top: 0;
    z-index: 1020;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
}

/* Table Enhancements */
.themed-table .table {
    --table-radius: 12px;
    border-collapse: separate;
    border-spacing: 0;
}

    .themed-table .table thead th {
        position: sticky;
        top: 0;
        z-index: 1;
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border-primary); /* fixed var */
    }

    .themed-table .table tbody tr:hover {
        background: rgba(var(--primary-rgb), 0.05);
    }

/* Density Modes */
.table-density-comfortable .table td,
.table-density-comfortable .table th {
    padding: 1rem 1rem;
}

.table-density-compact .table td,
.table-density-compact .table th {
    padding: .5rem .75rem;
}

/* Mobile: Cardified Tables (auto) */
@media (max-width: 991.98px) {
    .table[data-responsive="stack"] {
        display: block;
    }

        .table[data-responsive="stack"] thead {
            display: none;
        }

        .table[data-responsive="stack"] tbody {
            display: grid;
            gap: .75rem;
        }

        .table[data-responsive="stack"] tr {
            display: grid;
            background: var(--glass-bg); /* fixed rgba(var(--glass-bg-base)) */
            border: 1px solid var(--glass-border); /* fixed */
            border-radius: 12px;
            padding: .75rem;
            box-shadow: 0 6px 24px rgba(0,0,0,.08);
        }

        .table[data-responsive="stack"] td {
            display: grid;
            grid-template-columns: 42% 58%;
            padding: .25rem 0;
            border: 0 !important;
        }

            .table[data-responsive="stack"] td::before {
                content: attr(data-label);
                font-weight: 600;
                color: var(--text-secondary);
                padding-right: .75rem;
            }
}

/* Offcanvas Filters (mobile-first) */
.filters-inline {
    display: none;
}

.filters-trigger {
    display: inline-flex;
}

@media (min-width: 992px) {
    .filters-inline {
        display: grid;
        grid-auto-flow: column;
        gap: .75rem;
        align-items: end;
    }

    .filters-trigger {
        display: none;
    }
}

/* Details Split Panel (desktop) / Drawer (mobile) */
.split-panel {
    display: grid;
    gap: 1rem;
}

@media (min-width: 1200px) {
    .split-panel {
        grid-template-columns: 2fr 1fr;
    }

    .detail-panel {
        position: sticky;
        top: 88px;
        height: calc(100vh - 120px);
        overflow: auto;
        border: 1px solid var(--border-primary); /* fixed var */
    }
}

/* Bulk Selection Bar (appears on select) */
.bulk-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    background: var(--glass-bg); /* fixed rgba(var(--glass-bg-base)) */
    border-top: 1px solid var(--glass-border); /* fixed */
    box-shadow: 0 -6px 30px rgba(0,0,0,.14);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: translateY(110%);
    transition: transform .2s ease;
}

    .bulk-bar.show {
        transform: translateY(0);
    }

/* Floating Action Button (mobile helpers) */
.fab {
    position: fixed;
    right: 1rem;
    bottom: 5.25rem;
    z-index: 1031;
    border-radius: 999px;
    padding: .85rem 1rem;
    box-shadow: 0 10px 24px rgba(0,0,0,.18);
}

@media (min-width: 992px) {
    .fab {
        display: none;
    }
}

/* Better focus rings everywhere */
.focus-ring, .btn, .form-control, .form-select, .nav-link, .dropdown-item {
    outline: none !important;
}

    .focus-ring:focus, .btn:focus, .form-control:focus, .form-select:focus {
        box-shadow: 0 0 0 0.15rem rgba(var(--primary-rgb), .35) !important; /* fixed var name */
    }

/* Skeletons for loading states */
.skeleton {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, rgba(0,0,0,.06), rgba(0,0,0,.1), rgba(0,0,0,.06));
    border-radius: 10px;
    min-height: 56px;
    animation: skel 1.2s infinite;
}

@keyframes skel {
    0% {
        background-position: -200px 0;
    }

    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Make KPI numbers pop */
.kpi-card .display-6 {
    letter-spacing: .2px;
}

/* Dark mode shadow tweak for stacked cards */
[data-theme="dark"] .table[data-responsive="stack"] tr {
    box-shadow: 0 10px 26px rgba(0,0,0,.35);
}
