﻿/* ==========================================================================
   1. GLOBAL LIGHT TOKENS (:root)
   ========================================================================== */
:root {
    /* 🎨 Primary Brand & Accent */
    --primary-color: #152278;
    --primary-rgb: 21, 34, 120;
    --primary-hover: #101a61;
    --primary-hover-border: #0d154f;
    --primary-active: #0d154f;
    --primary-active-border: #090f3c;
    --primary-light-tint: rgba(var(--primary-rgb), 0.08);
    --accent-color: #38bdf8;
    /* 🎨 Invoice Primary Colors */
    --inv-primary: #152278;
    --inv-primary-hover: #0c1555;
    --inv-primary-bg: rgba(21, 34, 120, 0.04);
    --inv-primary-alpha: rgba(21, 34, 120, 0.1);
    /* 🟢 Success Theme */
    --success-color: #15803d;
    --success-rgb: 21, 128, 61;
    --success-hover: #116a32;
    --success-hover-border: #0e5c2b;
    --success-active: #0e5c2b;
    --success-active-border: #0c4a22;
    /* 🌊 Teal / Download Theme */
    --teal-color: #0d9488;
    --teal-rgb: 13, 148, 136;
    --teal-hover: #0f766e;
    --teal-hover-border: #0b6059;
    --teal-active: #0b6059;
    --teal-active-border: #09504a;
    /* 🏙️ Neutral Backgrounds (Light) */
    --bg-app: #fff;
    --bg-surface: #ffffff;
    --bg-subtle: #f8fafc;
    --bg-hover: #f1f5f9;
    --menu-label-dark: #1b1b1b;
    /* 🏙️ Invoice UI Backgrounds (Light) */
    --inv-bg: #ffffff;
    --inv-text-white: #fff;
    --inv-surface: #ffffff;
    --inv-toolbar-bg: #f8fafc;
    --inv-metric-bg: #ecf1fb;
    --inv-filter-bg: #fafcff;
    --inv-footer-bg: #f9fafb;
    --inv-tertiary-hover-bg: #cce4f7;
    /* 🔤 Global Text Colors (Light) */
    --text-white: #fff;
    --text-dark: #000000;
    --text-main: #0f172a;
    --text-primary: #1e293b;
    --text-secondary: #334155;
    --text-muted: #475569;
    --text-subtle: #64748b;
    --text-disabled: #94a3b8;
    /* 🔤 Invoice UI Text (Light) */
    --inv-text-strong: #0f172a;
    --inv-text-base: #334155;
    --inv-text-muted: #64748b;
    /* 📐 Borders & Dividers (Light) */
    --border-subtle: #e2e8f0;
    --border-light: #f1f5f9;
    --border-muted: #cbd5e1;
    --submenu-border: #cccccc;
    --avatar-bg: #e2e8f0;
    /* 📐 Invoice UI Borders (Light) */
    --inv-border-light: #f1f5f9;
    --inv-border: #e2e8f0;
    --inv-border-strong: #cbd5e1;
    /* 📊 Status & Semantic Backgrounds */
    --primary-soft-bg: #f0f2fa;
    --primary-soft-border: #dcdff2;
    --primary-soft-hover-bg: #dcdff2;
    --primary-soft-hover-border: #c5cbe8;
    --primary-soft-active-bg: #c5cbe8;
    --primary-soft-active-border: #aab2de;
    --success-soft-bg: #f0fdf4;
    --success-soft-border: #dcfce7;
    --success-soft-hover-bg: #dcfce7;
    --success-soft-hover-border: #bbf7d0;
    --success-soft-active-bg: #bbf7d0;
    --success-soft-active-border: #86efac;
    --inv-danger: #ef4444;
    --inv-warn-bg: #fff1f2;
    --inv-warn-border: rgba(255, 83, 71, 0.1);
    --inv-success-bg: #ecfdf5;
    --inv-success-text: #059669;
    --inv-pending-bg: #fffbeb;
    --inv-pending-text: #d97706;
    --inv-failed-bg: #fef2f2;
    --inv-failed-text: #dc2626;
    --inv-teal-bg: #f0fdfa;
    --inv-teal-text: #0f766e;
    --inv-teal-border: rgba(15, 118, 110, 0.2);
    --inv-teal-badge-bg: #0d9488;
    --inv-highlight-bg: #f0fdfa;
    --inv-highlight-text: #14b8a6;
    --inv-highlight-border: rgba(20, 184, 166, 0.2);
    --inv-counter-bg: rgba(0, 0, 0, 0.08);
    --inv-counter-border: rgba(0, 0, 0, 0.1);
    /* 🎛️ Active Filter Chip Tokens (Light) */
    --inv-chip-bg: #fdedec;
    --inv-chip-border: #ff8e88;
    --inv-chip-btn-text: #ff3026;
    --inv-chip-btn-hover: #ef4444;
    /* Cancel Buttons */
    --primary-cancel-text: #3e4983;
    --primary-cancel-border: #d0d5ed;
    --primary-cancel-hover-border: #b3bce2;
    --primary-cancel-active-bg: #e2e6f6;
    --primary-cancel-active-border: #99a5d7;
    /* 🔝 Topbar Component (Light) */
    --topbar-bg: var(--primary-color);
    --topbar-text: var(--text-white);
    --topbar-bar-color: rgba(255, 255, 255, 0.85);
    --topbar-border: rgba(255, 255, 255, 0.15);
    --topbar-icon-bg: rgba(255, 255, 255, 0.12);
    --topbar-icon-hover: rgba(255, 255, 255, 0.22);
    --topbar-icon-border: rgba(255, 255, 255, 0.05);
    --topbar-icon-hover-border: rgba(255, 255, 255, 0.2);
    --topbar-icon-active-bg: rgba(255, 255, 255, 0.3);
    --topbar-icon-active-border: rgba(255, 255, 255, 0.35);
    /* 📂 Dropdown & Sidebar Components (Light) */
    --dropdown-bg: var(--bg-surface);
    --dropdown-border: var(--border-subtle);
    --dropdown-header-bg: var(--bg-subtle);
    --dropdown-footer-bg: var(--bg-subtle);
    --dropdown-shadow: 0 12px 30px -4px rgba(15, 23, 42, 0.2), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
    --sidebar-bg: var(--bg-surface);
    --sidebar-shadow: rgba(0, 0, 0, 0.15);
    --sidebar-item-text: var(--text-muted);
    --sidebar-item-hover-bg: var(--bg-hover);
    --sidebar-item-hover-text: var(--text-main);
    --sidebar-icon-color: var(--text-subtle);
    --sidebar-icon-hover-color: var(--primary-color);
    --sidebar-group-open-bg: var(--bg-subtle);
    --sidebar-group-open-border: var(--border-light);
    --scrollbar-thumb: var(--border-muted);
    /* 🌑 Shadows & Geometry */
    --inv-radius-sm: 6px;
    --inv-radius-md: 8px;
    --inv-radius-lg: 12px;
    --inv-shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --inv-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
    --inv-shadow-modal: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
    --inv-shadow-inset: inset 0 2px 4px rgba(15, 23, 42, 0.02);
    --btn-shadow-inset-light: inset 0 3px 5px rgba(0, 0, 0, 0.08);
    --btn-shadow-inset-md: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    --btn-shadow-inset-dark: inset 0 3px 5px rgba(0, 0, 0, 0.15);
    /* 🔴 RED THEME */
    --dst-red-color: #dc2626; /* Solid Red (Text / Borders / Buttons) */
    --dst-red-hover: #b91c1c; /* Hover State */
    --dst-red-bg-soft: #fef2f2; /* Light Surface Background */
    --dst-red-bg-accent: #fee2e2; /* Slightly Deeper Accent Surface */
    --dst-red-alpha-bg: rgba(220, 38, 38, 0.08); /* Translucent Overlay */
    /* 🔵 BLUE THEME */
    --dst-blue-color: #152278; /* Primary Brand Navy/Blue */
    --dst-blue-hover: #0c1555; /* Hover State */
    --dst-blue-bg-soft: #f0f2fa; /* Soft Light Background */
    --dst-blue-bg-accent: #e2e6f6; /* Active / Selected Light Surface */
    --dst-blue-alpha-bg: rgba(21, 34, 120, 0.08); /* Translucent Overlay */
    /* 🟢 GREEN THEME */
    --dst-green-color: #15803d; /* Solid Success Green */
    --dst-green-hover: #116a32; /* Hover State */
    --dst-green-bg-soft: #f0fdf4; /* Soft Light Mint Background */
    --dst-green-bg-accent: #dcfce7; /* Active / Badge Surface */
    --dst-green-alpha-bg: rgba(21, 128, 61, 0.08); /* Translucent Overlay */
    /* 🟡 YELLOW THEME */
    --dst-yellow-color: #b45309; /* Readable Dark Amber (For Text/Icons) */
    --dst-yellow-hover: #92400e; /* Hover State */
    --dst-yellow-bg-soft: #fffbeb; /* Soft Light Warm Yellow Background */
    --dst-yellow-bg-accent: #fef3c7; /* Active / Callout Surface */
    --dst-yellow-alpha-bg: rgba(180, 83, 9, 0.08); /* Translucent Overlay */
    /* 🌸 PINK THEME */
    --dst-pink-color: #be185d; /* Solid Deep Pink */
    --dst-pink-hover: #9d174d; /* Hover State */
    --dst-pink-bg-soft: #fdf2f8; /* Soft Light Rose/Pink Background */
    --dst-pink-bg-accent: #fce7f3; /* Active / Badge Surface */
    --dst-pink-alpha-bg: rgba(190, 24, 93, 0.08); /* Translucent Overlay */
}

/* ==========================================================================
   2. GLOBAL DARK TOKENS ([data-theme="dark"])
   ========================================================================== */
[data-theme="dark"], body.dark-mode {
    /* 🏙️ Neutral Backgrounds (Pure Black & Deep Slate) */
    --bg-app: #000000;
    --bg-surface: #111827;
    --bg-subtle: #1f2937;
    --bg-hover: #374151;
    --menu-label-dark: #f8fafc;
    /* Dashboard & Invoice UI Backgrounds */
    --inv-bg: #000000;
    --inv-surface: #111827;
    --inv-toolbar-bg: #111827;
    --inv-metric-bg: #1f2937;
    --inv-filter-bg: #000000;
    --inv-footer-bg: #111827;
    --inv-tertiary-hover-bg: #1f2937;
    /* 🔤 Text Colors (Inverted for Dark Mode) */
    --text-dark: #f8fafc;
    --text-main: #f1f5f9;
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-subtle: #64748b;
    --text-disabled: #4b5563;
    /* Invoice UI Text */
    --inv-text-strong: #f8fafc;
    --inv-text-base: #e2e8f0;
    --inv-text-muted: #94a3b8;
    /* 📐 Borders & Dividers */
    --border-subtle: #374151;
    --border-light: #1f2937;
    --border-muted: #4b5563;
    --submenu-border: #374151;
    --avatar-bg: #374151;
    /* Invoice UI Borders */
    --inv-border-light: #1f2937;
    --inv-border: #374151;
    --inv-border-strong: #4b5563;
    /* 🔝 Topbar Override */
    --topbar-bg: #0d154f;
    --topbar-border: rgba(255, 255, 255, 0.05);
    /* 📂 Flyout Dropdown & Sidebar */
    --dropdown-bg: #111827;
    --dropdown-border: #374151;
    --dropdown-header-bg: #1f2937;
    --dropdown-footer-bg: #1f2937;
    --dropdown-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.8), 0 4px 12px -2px rgba(0, 0, 0, 0.6);
    --sidebar-bg: #111827;
    --sidebar-item-hover-bg: #1f2937;
    --sidebar-item-hover-text: #f8fafc;
    --sidebar-icon-color: #94a3b8;
    --sidebar-group-open-bg: #1f2937;
    --sidebar-group-open-border: #374151;
    --scrollbar-thumb: #4b5563;
    /* ✨ Soft Tint Buttons (Converted to Translucent RGBA for Dark Mode) */
    --primary-soft-bg: rgba(21, 34, 120, 0.25);
    --primary-soft-border: rgba(21, 34, 120, 0.4);
    --primary-soft-hover-bg: rgba(21, 34, 120, 0.35);
    --inv-primary-bg: rgba(21, 34, 120, 0.2);
    --inv-primary-alpha: rgba(21, 34, 120, 0.4);
    --success-soft-bg: rgba(21, 128, 61, 0.15);
    --teal-bg: rgba(13, 148, 136, 0.15);
    --inv-success-bg: rgba(5, 150, 105, 0.15);
    --inv-pending-bg: rgba(217, 119, 6, 0.15);
    --inv-failed-bg: rgba(220, 38, 38, 0.15);
    --inv-highlight-bg: rgba(20, 184, 166, 0.1);
    /* 🛑 Button Counters (Brightened to contrast against black) */
    --inv-counter-bg: rgba(255, 255, 255, 0.1);
    --inv-counter-border: rgba(255, 255, 255, 0.15);
    /* 🎛️ Active Filter Chip Tokens (Dark) */
    --inv-chip-bg: rgba(220, 38, 38, 0.15);
    --inv-chip-border: rgba(220, 38, 38, 0.4);
    --inv-chip-btn-text: #f87171;
    --inv-chip-btn-hover: #fca5a5;
    /* 🌑 Shadows (Darkened so they appear on dark surfaces) */
    --inv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --inv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
    --inv-shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.8), 0 8px 10px -6px rgba(0, 0, 0, 0.6);
    --inv-shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    /* Red Dark Surface */
    --dst-red-color: #f87171;
    --dst-red-bg-soft: rgba(220, 38, 38, 0.15);
    --dst-red-bg-accent: rgba(220, 38, 38, 0.25);
    /* Blue Dark Surface */
    --dst-blue-color: #818cf8;
    --dst-blue-bg-soft: rgba(21, 34, 120, 0.25);
    --dst-blue-bg-accent: rgba(21, 34, 120, 0.35);
    /* Green Dark Surface */
    --dst-green-color: #4ade80;
    --dst-green-bg-soft: rgba(21, 128, 61, 0.15);
    --dst-green-bg-accent: rgba(21, 128, 61, 0.25);
    /* Yellow Dark Surface */
    --dst-yellow-color: #fbbf24;
    --dst-yellow-bg-soft: rgba(180, 83, 9, 0.15);
    --dst-yellow-bg-accent: rgba(180, 83, 9, 0.25);
    /* Pink Dark Surface */
    --dst-pink-color: #f472b6;
    --dst-pink-bg-soft: rgba(190, 24, 93, 0.15);
    --dst-pink-bg-accent: rgba(190, 24, 93, 0.25);
}

/* ==========================================================================
   3. BASE APPLICATION STYLES
   ========================================================================== */
body {
    background-color: var(--bg-app);
    font-family: "Inter", "Roboto", sans-serif;
    color: var(--text-dark);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Base structural transitions for smooth Light/Dark toggling */
.topbar, .sidebar, .inv-modal, .inv-data-card, .inv-metric-card, .inv-dropdown-menu {
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ==========================================================================
   4. TOPBAR COMPONENT
   ========================================================================== */
.topbar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--topbar-text);
    padding: 0 24px;
    z-index: 1100; /* Higher than sidebar */
}

    .topbar .left-side {
        display: flex;
        align-items: center;
        gap: 16px;
    }

    .topbar .bar {
        background: transparent;
        border: none;
        font-size: 1.4rem;
        cursor: pointer;
        color: var(--topbar-bar-color);
        padding: 6px;
        border-radius: 8px;
        transition: all 0.2s ease;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

        .topbar .bar:hover {
            background: var(--topbar-icon-bg);
            color: var(--topbar-text);
        }

    .topbar .logo {
        display: flex;
        align-items: center;
        font-weight: 700;
        font-size: 1.15rem;
        gap: 10px;
        color: var(--topbar-text);
        letter-spacing: -0.015em;
    }

        .topbar .logo i {
            color: var(--accent-color);
            font-size: 1.35rem;
        }

    .topbar .right-side {
        display: flex;
        align-items: center;
        gap: 10px;
    }

        .topbar .right-side .icon {
            position: relative;
            padding: 4px;
        }

    .topbar .logout-btn {
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 4px;
    }

    .topbar .icon-circle {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--topbar-text);
        font-size: 1.15rem;
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .topbar .icon:hover .icon-circle,
    .topbar .logout-btn:hover .icon-circle {
        background: var(--topbar-icon-hover);
        color: var(--topbar-text);
        transform: translateY(-1px);
        border-color: var(--topbar-icon-hover-border);
    }

    /* ==========================================================================
   5. PREMIUM FLYOUT DROPDOWNS
   ========================================================================== */
    .topbar .dropdown-content {
        display: none;
        position: absolute;
        right: 0;
        top: 100%;
        margin-top: 8px;
        background: var(--dropdown-bg);
        width: 340px;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: var(--dropdown-shadow);
        border: 1px solid var(--dropdown-border);
        z-index: 1050;
        transform-origin: top right;
    }

    .topbar .icon.dropdown.show-dropdown .dropdown-content {
        display: block;
        animation: fadeInDropdown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .topbar .icon.dropdown.show-dropdown .icon-circle {
        background: var(--topbar-icon-active-bg) !important;
        color: var(--topbar-text) !important;
        border-color: var(--topbar-icon-active-border) !important;
    }

@keyframes fadeInDropdown {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(4px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.topbar .dropdown-header {
    background: var(--dropdown-header-bg);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--dropdown-border);
}

    .topbar .dropdown-header span {
        font-weight: 700;
        color: var(--text-main);
        font-size: 14px;
    }

    .topbar .dropdown-header .mark-read {
        background: transparent;
        border: none;
        font-size: 12px;
        color: var(--primary-color);
        font-weight: 600;
        cursor: pointer;
        padding: 4px 8px;
        border-radius: 4px;
        transition: all 0.2s;
    }

        .topbar .dropdown-header .mark-read:hover {
            background: var(--primary-light-tint);
            color: var(--primary-color);
        }

.topbar .dropdown-list {
    max-height: 280px;
    overflow-y: auto;
}

.topbar .dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s ease;
    cursor: pointer;
}

    .topbar .dropdown-item:last-child {
        border-bottom: none;
    }

    .topbar .dropdown-item:hover {
        background: var(--bg-subtle);
    }

    .topbar .dropdown-item .avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        object-fit: cover;
        background: var(--avatar-bg);
        flex-shrink: 0;
    }

    .topbar .dropdown-item .item-content {
        display: flex;
        flex-direction: column;
        gap: 3px;
        min-width: 0;
    }

    .topbar .dropdown-item .item-title {
        font-size: 13.5px;
        font-weight: 500;
        color: var(--text-primary);
        line-height: 1.4;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar .dropdown-item .item-meta {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 12px;
        color: var(--text-subtle);
    }

    .topbar .dropdown-item .item-sender {
        font-weight: 600;
        color: var(--text-muted);
    }

    .topbar .dropdown-item .item-divider {
        color: var(--border-muted);
    }

    .topbar .dropdown-item .item-time {
        color: var(--text-disabled);
    }

.topbar .dropdown-footer {
    padding: 12px;
    background-color: var(--dropdown-footer-bg);
    border-top: 1px solid var(--dropdown-border);
    text-align: center;
}

    .topbar .dropdown-footer a {
        color: var(--primary-color);
        font-weight: 600;
        font-size: 13px;
        text-decoration: none;
        display: inline-block;
        padding: 6px 16px;
        border-radius: 6px;
        transition: all 0.2s;
    }

        .topbar .dropdown-footer a:hover {
            background: var(--primary-light-tint);
        }

/* ==========================================================================
   6. SIDEBAR COMPONENT
   ========================================================================== */
.sidebar {
    width: 260px;
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    z-index: 1000;
    background: var(--sidebar-bg);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

    .sidebar .inner-sidebar {
        overflow-y: auto;
        padding: 16px 12px;
        height: 100%;
        scrollbar-width: thin;
        scrollbar-color: var(--scrollbar-thumb) transparent;
    }

    .sidebar .menu-label {
        font-size: 11px;
        text-transform: uppercase;
        color: var(--text-disabled);
        padding: 16px 12px 8px;
        letter-spacing: 0.05em;
        font-weight: 700;
        background: linear-gradient(90deg, var(--primary-color) 0%, var(--menu-label-dark) 50%, var(--accent-color) 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .sidebar .menu-item {
        display: flex;
        align-items: center;
        padding: 10px 12px;
        border-radius: 8px;
        color: var(--sidebar-item-text);
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        text-decoration: none !important;
        transition: all 0.2s ease;
        margin-bottom: 2px;
    }

        .sidebar .menu-item:hover {
            background: var(--sidebar-item-hover-bg);
            color: var(--sidebar-item-hover-text);
        }

        .sidebar .menu-item .left {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .sidebar .menu-item i {
            font-size: 1.15rem;
            color: var(--sidebar-icon-color);
            width: 20px;
            transition: color 0.2s;
        }

        .sidebar .menu-item:hover i {
            color: var(--sidebar-icon-hover-color);
        }

        .sidebar .menu-item .arrow {
            margin-left: auto;
            font-size: 0.75rem;
            color: var(--text-disabled);
        }

    .sidebar .menu-group.open {
        background: var(--sidebar-group-open-bg);
        border-radius: 8px;
        padding-bottom: 4px;
        margin-bottom: 6px;
        border: 1px solid var(--sidebar-group-open-border);
    }

    .sidebar .title-active {
        background-color: var(--primary-light-tint) !important;
        color: var(--primary-color) !important;
        font-weight: 600 !important;
    }

        .sidebar .title-active i, .sidebar .title-active .arrow {
            color: var(--primary-color) !important;
        }

    .sidebar .submenu {
        margin: 2px 4px 2px 16px;
        padding-left: 8px;
        border-left: 1px solid var(--submenu-border);
        display: flex;
        flex-direction: column;
    }

        .sidebar .submenu .submenu-item {
            display: flex;
            align-items: center;
            padding: 8px 12px;
            font-size: 13.5px;
            color: var(--text-secondary);
            border-radius: 6px;
            text-decoration: none !important;
            transition: all 0.2s ease;
        }

            .sidebar .submenu .submenu-item i {
                font-size: 0.95rem;
                margin-right: 8px;
                width: 16px;
            }

            .sidebar .submenu .submenu-item:hover {
                background: var(--sidebar-item-hover-bg);
                color: var(--sidebar-item-hover-text);
            }

            .sidebar .submenu .submenu-item.active,
            .sidebar .menu-item.active:not(.dropdown) {
                background-color: var(--primary-color) !important;
                color: var(--text-white) !important;
                font-weight: 600;
            }

                .sidebar .submenu .submenu-item.active i,
                .sidebar .menu-item.active:not(.dropdown) i {
                    color: var(--text-white) !important;
                }

/* ==========================================================================
   7. BOOTSTRAP BUTTON DESIGN SYSTEM
   ========================================================================== */
.btn-primary {
    --bs-btn-color: var(--text-white) !important;
    --bs-btn-bg: var(--primary-color) !important;
    --bs-btn-border-color: var(--primary-color) !important;
    --bs-btn-hover-color: var(--text-white) !important;
    --bs-btn-hover-bg: var(--primary-hover) !important;
    --bs-btn-hover-border-color: var(--primary-hover-border) !important;
    --bs-btn-focus-shadow-rgb: var(--primary-rgb) !important;
    --bs-btn-active-color: var(--text-white) !important;
    --bs-btn-active-bg: var(--primary-active) !important;
    --bs-btn-active-border-color: var(--primary-active-border) !important;
    --bs-btn-active-shadow: var(--btn-shadow-inset-md) !important;
    --bs-btn-disabled-color: var(--text-white) !important;
    --bs-btn-disabled-bg: var(--primary-color) !important;
    --bs-btn-disabled-border-color: var(--primary-color) !important;
}

.btn-secondary {
    --bs-btn-color: var(--primary-color) !important;
    --bs-btn-bg: var(--primary-soft-bg) !important;
    --bs-btn-border-color: var(--primary-soft-border) !important;
    --bs-btn-hover-color: var(--primary-active) !important;
    --bs-btn-hover-bg: var(--primary-soft-hover-bg) !important;
    --bs-btn-hover-border-color: var(--primary-soft-hover-border) !important;
    --bs-btn-focus-shadow-rgb: var(--primary-rgb) !important;
    --bs-btn-active-color: var(--primary-active) !important;
    --bs-btn-active-bg: var(--primary-soft-active-bg) !important;
    --bs-btn-active-border-color: var(--primary-soft-active-border) !important;
    --bs-btn-active-shadow: var(--btn-shadow-inset-light) !important;
    --bs-btn-disabled-color: var(--text-disabled) !important;
    --bs-btn-disabled-bg: var(--bg-subtle) !important;
    --bs-btn-disabled-border-color: var(--border-subtle) !important;
}

.btn-success {
    --bs-btn-color: var(--text-white) !important;
    --bs-btn-bg: var(--success-color) !important;
    --bs-btn-border-color: var(--success-color) !important;
    --bs-btn-hover-color: var(--text-white) !important;
    --bs-btn-hover-bg: var(--success-hover) !important;
    --bs-btn-hover-border-color: var(--success-hover-border) !important;
    --bs-btn-focus-shadow-rgb: var(--success-rgb) !important;
    --bs-btn-active-color: var(--text-white) !important;
    --bs-btn-active-bg: var(--success-active) !important;
    --bs-btn-active-border-color: var(--success-active-border) !important;
    --bs-btn-active-shadow: var(--btn-shadow-inset-dark) !important;
    --bs-btn-disabled-color: var(--text-white) !important;
    --bs-btn-disabled-bg: var(--text-disabled) !important;
    --bs-btn-disabled-border-color: var(--text-disabled) !important;
}

.btn-success-secondary {
    --bs-btn-color: var(--success-color) !important;
    --bs-btn-bg: var(--success-soft-bg) !important;
    --bs-btn-border-color: var(--success-soft-border) !important;
    --bs-btn-hover-color: var(--success-hover) !important;
    --bs-btn-hover-bg: var(--success-soft-hover-bg) !important;
    --bs-btn-hover-border-color: var(--success-soft-hover-border) !important;
    --bs-btn-focus-shadow-rgb: var(--success-rgb) !important;
    --bs-btn-active-color: var(--success-active) !important;
    --bs-btn-active-bg: var(--success-soft-active-bg) !important;
    --bs-btn-active-border-color: var(--success-soft-active-border) !important;
    --bs-btn-active-shadow: var(--btn-shadow-inset-light) !important;
    --bs-btn-disabled-color: var(--text-disabled) !important;
    --bs-btn-disabled-bg: var(--bg-subtle) !important;
    --bs-btn-disabled-border-color: var(--border-subtle) !important;
}

.btn-download {
    --bs-btn-color: var(--text-white) !important;
    --bs-btn-bg: var(--teal-color) !important;
    --bs-btn-border-color: var(--teal-color) !important;
    --bs-btn-hover-color: var(--text-white) !important;
    --bs-btn-hover-bg: var(--teal-hover) !important;
    --bs-btn-hover-border-color: var(--teal-hover-border) !important;
    --bs-btn-focus-shadow-rgb: var(--teal-rgb) !important;
    --bs-btn-active-color: var(--text-white) !important;
    --bs-btn-active-bg: var(--teal-active) !important;
    --bs-btn-active-border-color: var(--teal-active-border) !important;
    --bs-btn-disabled-color: var(--text-white) !important;
    --bs-btn-disabled-bg: var(--text-disabled) !important;
    --bs-btn-disabled-border-color: var(--text-disabled) !important;
}

.btn-cancel {
    --bs-btn-color: var(--primary-cancel-text) !important;
    --bs-btn-bg: var(--bg-surface) !important;
    --bs-btn-border-color: var(--primary-cancel-border) !important;
    --bs-btn-hover-color: var(--primary-color) !important;
    --bs-btn-hover-bg: var(--primary-soft-bg) !important;
    --bs-btn-hover-border-color: var(--primary-cancel-hover-border) !important;
    --bs-btn-focus-shadow-rgb: var(--primary-rgb) !important;
    --bs-btn-active-color: var(--primary-active) !important;
    --bs-btn-active-bg: var(--primary-cancel-active-bg) !important;
    --bs-btn-active-border-color: var(--primary-cancel-active-border) !important;
    --bs-btn-disabled-color: var(--text-disabled) !important;
    --bs-btn-disabled-bg: var(--bg-surface) !important;
    --bs-btn-disabled-border-color: var(--border-subtle) !important;
    border-width: 1px;
    font-weight: 500;
    transition: all .2s ease-in-out;
}

/* ==========================================================================
   8. UTILITIES & HEADER
   ========================================================================== */
.inv-app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0.5rem;
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.inv-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.inv-page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--inv-text-strong);
    letter-spacing: -0.02em;
    margin: 0 0 0.25rem 0;
}

.inv-page-subtitle {
    font-size: 0.875rem;
    color: var(--inv-text-muted);
    margin: 0;
}

/* ==========================================================================
   9. INVOICE CUSTOM BUTTONS
   ========================================================================== */
.inv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--inv-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    line-height: 1.25;
    border: 1px solid transparent;
}

    .inv-btn:has(.inv-btn-count-block) {
        padding-right: 0;
        overflow: hidden;
        position: relative;
        z-index: 1;
    }

.inv-btn-count-block {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.85rem;
    margin-left: 0.75rem;
    font-weight: 600;
}

    .inv-btn-count-block::before {
        content: '';
        position: absolute;
        top: -50px;
        bottom: -50px;
        left: 0;
        right: 0;
        background-color: var(--inv-counter-bg);
        border-left: 1px solid var(--inv-counter-border);
        z-index: -1;
    }

.inv-btn-primary {
    background: var(--inv-primary) !important;
    color: var( --inv-text-white) !important;
    box-shadow: var(--inv-shadow-sm);
}

    .inv-btn-primary:hover {
        background: var(--inv-primary-hover) !important;
    }

.inv-btn-secondary {
    background: var(--inv-surface);
    border-color: var(--inv-border-strong);
    color: var(--inv-text-strong);
    box-shadow: var(--inv-shadow-sm);
}

    .inv-btn-secondary:hover {
        background: var(--inv-border-light);
    }

.inv-btn-tertiary {
    background: var(--inv-border-light);
    color: var(--inv-text-base);
    border-color: transparent;
    transition: all 0.15s ease-in-out;
}

    .inv-btn-tertiary:hover:not(:disabled) {
        background: var(--inv-border);
        color: var(--inv-text-strong);
    }

    .inv-btn-tertiary:active:not(:disabled) {
        background: var(--inv-border-strong);
        color: var(--inv-text-strong);
    }

    .inv-btn-tertiary:disabled, .inv-btn-tertiary[disabled] {
        opacity: 0.5;
        color: var(--inv-text-muted);
        cursor: not-allowed;
        background: transparent;
        border-color: transparent;
    }

.inv-btn-tertiary-active {
    background: var(--inv-border);
    color: var(--inv-text-strong);
    border-color: transparent;
}

    .inv-btn-tertiary-active:hover {
        background: var(--inv-border-strong);
        color: var(--inv-text-strong);
        box-shadow: var(--inv-shadow-sm);
    }

.inv-btn-text {
    background: transparent;
    padding: 0.25rem 0.5rem;
    border-radius: var(--inv-radius-sm);
    color: var(--inv-text-base);
}

    .inv-btn-text:hover {
        background: var(--inv-border);
        color: var(--inv-text-strong);
    }

.inv-btn-soft-primary {
    background: var(--inv-primary-bg);
    color: var(--inv-primary);
    border-color: var(--inv-primary-alpha);
}

    .inv-btn-soft-primary:hover:not([disabled]) {
        background: var(--inv-primary);
        color: var( --inv-text-white);
    }

.inv-btn-soft-teal {
    background: var(--inv-teal-bg);
    color: var(--inv-teal-text);
    border-color: var(--inv-teal-border);
}

    .inv-btn-soft-teal:hover:not([disabled]) {
        background: var(--inv-teal-text);
        color: var( --inv-text-white);
    }

.inv-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   10. INTERACTIVE ACTION PILLS
   ========================================================================== */
.inv-action-pill {
    position: relative;
    display: inline-flex;
    cursor: pointer;
    margin: 0;
}

    .inv-action-pill input {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
    }

    .inv-action-pill .pill-text {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.2rem 0.75rem;
        font-size: 0.8125rem;
        font-weight: 500;
        color: var(--inv-text-base);
        background: var(--inv-surface);
        border: 1px solid var(--inv-border-strong);
        border-radius: 5px;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        user-select: none;
    }

    .inv-action-pill:hover input:not(:disabled):not(:checked) + .pill-text {
        background: var(--inv-bg-hover);
        color: var(--inv-text-strong);
        border-color: var(--inv-text-muted);
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05);
    }

    .inv-action-pill input:checked:not(:disabled) + .pill-text {
        background: var(--inv-primary);
        color: var(--text-white);
        border-color: var(--inv-primary);
        box-shadow: 0 4px 6px -1px var(--inv-primary-alpha);
    }

    .inv-action-pill:hover input:checked:not(:disabled) + .pill-text {
        background: var(--inv-primary-hover);
        border-color: var(--inv-primary-hover);
        transform: translateY(-1px);
        box-shadow: 0 6px 8px -2px var(--inv-primary-alpha);
    }

    .inv-action-pill:active input:not(:disabled) + .pill-text {
        transform: scale(0.95) translateY(0);
        box-shadow: none;
    }

    .inv-action-pill input:disabled + .pill-text {
        opacity: 0.4;
        color: var(--inv-text-disabled);
        background: var(--inv-border-light);
        border-color: var(--inv-border);
        cursor: not-allowed;
    }

    .inv-action-pill input:disabled:checked + .pill-text {
        background: var(--inv-primary-alpha);
        border-color: var(--inv-primary-alpha);
        color: var(--inv-primary);
        opacity: 0.6;
    }

    .inv-action-pill:has(input:disabled) {
        cursor: not-allowed;
    }

    .inv-action-pill input:focus-visible + .pill-text {
        box-shadow: 0 0 0 3px var(--inv-primary-bg), 0 0 0 4px var(--inv-primary);
    }

/* ==========================================================================
   11. METRICS GRID & HIGHLIGHTS
   ========================================================================== */
.inv-metrics-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background-color: transparent;
    border: 1px solid var(--inv-border);
    border-radius: var(--inv-radius-lg);
    box-shadow: var(--inv-shadow-inset);
    padding: 1rem;
    margin-bottom: 1rem;
    gap: 1rem;
}

.inv-metric-card {
    display: flex;
    flex-direction: column;
    padding-right: 1rem;
    border-right: 1px solid var(--inv-border-strong);
}

    .inv-metric-card:last-child {
        border-right: none;
        padding-right: 0;
    }

.inv-metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--inv-text-strong);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.inv-metric-value {
    font-size: 0.93rem;
    font-weight: 700;
    color: var(--inv-primary);
    letter-spacing: -0.02em;
}

.inv-metric-card.highlight {
    background: var(--inv-highlight-bg);
    color: var(--inv-highlight-text) !important;
    padding: 0.5rem 1rem;
    border-radius: var(--inv-radius-md);
    box-shadow: var(--inv-shadow-sm);
    border: 1px solid var(--inv-highlight-border) !important;
    grid-column: span 2;
}

@media (min-width: 769px) {
    .inv-metric-card.highlight {
        margin: -0.5rem 0 -0.5rem -0.5rem;
        grid-column: auto;
    }
}

.inv-metric-card.highlight .inv-metric-label,
.inv-metric-card.highlight .inv-metric-value {
    color: var(--inv-highlight-text) !important;
}

/* ==========================================================================
   12. MAIN DATA CARD & TOOLBAR
   ========================================================================== */
.inv-data-card {
    background: var(--inv-toolbar-bg);
    border: 1px solid var(--inv-border);
    border-radius: var(--inv-radius-md);
    box-shadow: var(--inv-shadow-sm);
    display: flex;
    flex-direction: column;
}

.inv-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--inv-border);
    gap: 1rem;
    flex-wrap: wrap;
    background-color: var(--inv-toolbar-bg) !important;
}

.inv-toolbar-left, .inv-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.inv-search-box {
    position: relative;
    width: 280px;
}

    .inv-search-box i {
        position: absolute;
        left: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--inv-text-muted);
    }

    .inv-search-box input {
        width: 100%;
        padding: 0.5rem 0.75rem 0.5rem 2.25rem;
        border: 1px solid var(--inv-border-strong);
        background-color: var(--inv-surface);
        border-radius: var(--inv-radius-sm);
        font-size: 0.875rem;
        color: var(--inv-text-strong);
        transition: border-color 0.15s, box-shadow 0.15s, background-color 0.3s;
    }

        .inv-search-box input:focus {
            outline: none;
            border-color: var(--inv-primary);
            box-shadow: 0 0 0 3px var(--inv-primary-bg);
        }

.inv-filter-group, .inv-action-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inv-toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--inv-border);
    margin: 0 0.25rem;
}

/* ==========================================================================
   13. ACTIVE FILTERS & CHIPS (Fully Tokenized)
   ========================================================================== */
.inv-active-filters {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--inv-border);
    background: var(--inv-surface) !important;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.inv-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--inv-chip-bg);
    border: 1px solid var(--inv-chip-border);
    padding: 0.15rem 0.5rem 0.15rem 0.75rem;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--inv-text-strong);
}

    .inv-chip button {
        background: transparent;
        border: none;
        color: var(--inv-chip-btn-text);
        padding: 0;
        display: flex;
        align-items: center;
        cursor: pointer;
    }

        .inv-chip button:hover {
            color: var(--inv-chip-btn-hover);
        }

/* ==========================================================================
   14. DROPDOWN MENUS (Z-Index Fixed)
   ========================================================================== */
.inv-filter-group .dropdown {
    z-index: 1060 !important;
}

    .inv-filter-group .dropdown:focus-within,
    .inv-filter-group .dropdown:active,
    .inv-filter-group .dropdown.show {
        z-index: 1060 !important;
    }

.inv-dropdown-menu {
    z-index: 1060 !important;
    border: 1px solid var(--inv-border) !important;
    background: var(--dropdown-bg);
    border-radius: var(--inv-radius-md) !important;
    box-shadow: var(--inv-shadow-modal) !important;
    padding: 0.5em 1em !important;
    min-width: 220px;
    margin-top: 0.5rem !important;
}

.inv-dropdown-section {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--inv-border-light);
}

    .inv-dropdown-section:last-child {
        border-bottom: none;
    }

.inv-dropdown-header {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--inv-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.inv-radio-item, .inv-check-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--inv-text-base);
    padding: 0.35rem 0;
    cursor: pointer;
}

    .inv-radio-item input, .inv-check-item input {
        accent-color: var(--inv-primary);
        cursor: pointer;
    }

.inv-scroll-list {
    max-height: 200px;
    overflow-y: auto;
}

/* ==========================================================================
   15. DATA TABLES
   ========================================================================== */
.inv-table-wrapper {
    width: 100%;
    overflow-x: auto;
    min-height: 400px;
}

.inv-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

    .inv-table th {
        background-color: var(--inv-metric-bg) !important;
        padding: 0.75rem 1rem;
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--inv-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        border-bottom: 1px solid var(--inv-border);
        white-space: nowrap;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .inv-table td {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
        color: var(--inv-text-base);
        background-color: var(--inv-surface);
        border-bottom: 1px solid var(--inv-border-light);
        white-space: nowrap;
    }

    .inv-table tbody tr:hover td {
        background: var(--inv-border-light);
    }

    .inv-table tbody tr.inv-row-warn td {
        background: var(--inv-warn-bg);
        border-bottom-color: var(--inv-warn-border);
    }

.inv-text-subtle {
    color: var(--inv-text-muted);
}

.inv-th-filter-btn {
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

/* ==========================================================================
   16. STATUS PILLS & BADGES
   ========================================================================== */
.inv-status-pill {
    display: inline-flex;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

    .inv-status-pill.success {
        background: var(--inv-success-bg);
        color: var(--inv-success-text);
    }

    .inv-status-pill.pending {
        background: var(--inv-pending-bg);
        color: var(--inv-pending-text);
    }

    .inv-status-pill.failed {
        background: var(--inv-failed-bg);
        color: var(--inv-failed-text);
    }

.inv-badge-dark {
    background: var(--inv-text-strong);
    color: var(--inv-surface);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.7rem;
}

.inv-badge-primary {
    background: var(--inv-primary);
    color: var(--text-white);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.7rem;
}

.inv-badge-teal {
    background: var(--inv-teal-badge-bg);
    color: var(--text-white);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.7rem;
}

/* ==========================================================================
   16.5 PAGINATION BAR
   ========================================================================== */
.inv-pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: var(--inv-toolbar-bg);
    border-top: 1px solid var(--inv-border);
    border-bottom-left-radius: var(--inv-radius-md);
    border-bottom-right-radius: var(--inv-radius-md);
    flex-wrap: wrap;
    gap: 1rem;
}

.inv-page-size {
    display: flex;
    align-items: center;
}

    .inv-page-size span {
        color: var(--inv-text-muted);
        font-weight: 500;
    }

.inv-radio-inline {
    display: inline-flex;
    align-items: center;
    margin-right: 0.85rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--inv-text-base);
    cursor: pointer;
    transition: color 0.2s ease;
}

    .inv-radio-inline:hover {
        color: var(--inv-text-strong);
    }

    .inv-radio-inline input[type="radio"] {
        margin-right: 0.35rem;
        width: 1rem;
        height: 1rem;
        accent-color: var(--inv-primary);
        cursor: pointer;
    }

.inv-page-info {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--inv-text-muted);
    text-align: center;
    flex: 1;
}

.inv-page-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .inv-page-controls .inv-btn {
        padding: 0.35rem 0.85rem;
        font-size: 0.8125rem;
    }
/* ==========================================================================
   17. MODALS & FORMS (WITH RESPONSIVE SIZES)
   ========================================================================== */
.inv-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.6);
    z-index: 1101;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 2rem 1rem;
}

/* Base Modal (Default Medium) */
.inv-modal {
    background: var(--inv-surface);
    border-radius: var(--inv-radius-lg);
    box-shadow: var(--inv-shadow-modal);
    border: 1px solid var(--inv-border);
    width: 100%;
    max-width: 600px; /* Default Medium Size */
    margin: 1.75rem auto;
    display: flex;
    flex-direction: column;
}

    /* Modal Sizing Variants (High Specificity to guarantee override) */
    .inv-modal.inv-modal-sm {
        max-width: 450px !important;
    }

    .inv-modal.inv-modal-md {
        max-width: 600px !important;
    }

    .inv-modal.inv-modal-lg {
        max-width: 800px !important;
    }

    .inv-modal.inv-modal-xl {
        max-width: 1140px !important;
    }

    .inv-modal.inv-modal-xxl {
        max-width: 1400px !important;
    }

    /* Full Screen Modal Edge-to-Edge */
    .inv-modal.inv-modal-full {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        margin: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        border-radius: 0 !important;
        border: none !important;
        overflow-y: auto;
    }

/* Modal Inner Components */
.inv-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem;
    border-bottom: 1px solid var(--inv-border);
}

.inv-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--inv-text-strong);
    margin: 0 0 0.25rem 0;
}

.inv-modal-subtitle {
    font-size: 0.875rem;
    color: var(--inv-text-muted);
    margin: 0;
}

.inv-modal-close {
    background: transparent;
    border: none;
    color: var(--inv-text-muted);
    font-size: 1.25rem;
    cursor: pointer;
}

    .inv-modal-close:hover {
        color: var(--inv-text-strong);
    }

.inv-modal-body {
    padding: 1.5rem;
}

    .inv-modal-body .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

        .inv-modal-body .row > [class*="col-"] {
            padding-left: 0 !important;
            padding-right: 0 !important;
        }

@media (min-width: 768px) {
    .inv-modal-body .row > [class*="col-md-6"]:first-child {
        padding-right: 0.5rem !important;
    }

    .inv-modal-body .row > [class*="col-md-6"]:last-child {
        padding-left: 0.5rem !important;
    }
}

.inv-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--inv-text-strong);
    margin-bottom: 0.5rem;
}

.inv-input, .form-control {
    background-color: var(--inv-surface);
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--inv-border-strong);
    border-radius: var(--inv-radius-sm);
    font-size: 0.875rem;
    color: var(--inv-text-strong);
}

    .inv-input:focus, .form-control:focus {
        outline: none;
        border-color: var(--inv-primary);
        box-shadow: 0 0 0 3px var(--inv-primary-bg);
    }

.inv-input-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.8125rem;
    border: 1px solid var(--inv-border);
    border-radius: var(--inv-radius-sm);
}

.inv-error {
    display: block;
    font-size: 0.75rem;
    color: var(--inv-danger);
    margin-top: 0.25rem;
}

.inv-modal-footer {
    padding: 1.25rem 1.5rem;
    background: var(--inv-footer-bg);
    border-top: 1px solid var(--inv-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    border-bottom-left-radius: var(--inv-radius-lg);
    border-bottom-right-radius: var(--inv-radius-lg);
}

.inv-modal-table-wrap {
    border: 1px solid var(--inv-border);
    border-radius: var(--inv-radius-md);
    overflow: hidden;
}

.inv-table-sm th {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    background: var(--inv-toolbar-bg);
}

.inv-table-sm td {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--inv-border-light);
}

.inv-table-sm tr:last-child td {
    border-bottom: none;
}
/* ==========================================================================
   18. SCROLLBARS
   ========================================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--inv-border-strong);
    border-radius: 10px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--inv-text-muted);
    }
/* ==========================================================================
   19. INTERACTIVE UPLOAD & ANIMATIONS (Global)
   ========================================================================== */

/* Interactive Upload Zone */
.upload-zone {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px dashed var(--inv-border-strong);
    border-radius: var(--inv-radius-lg);
    background-color: var(--inv-bg-subtle);
    padding: 3rem 2rem;
}

    .upload-zone:hover {
        background-color: var(--inv-border-light) !important;
        border-color: var(--inv-primary) !important;
    }

        .upload-zone:hover .upload-icon-wrapper {
            transform: translateY(-5px) scale(1.05);
        }

            .upload-zone:hover .upload-icon-wrapper i {
                color: var(--inv-primary) !important;
            }

.upload-icon-wrapper {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover Buttons */
.upload-btn {
    transition: transform 0.2s, box-shadow 0.2s;
}

    .upload-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2); /* Matches Teal token */
    }

/* Warning Row Highlight */
.inv-row-warn {
    background-color: var(--inv-warn-bg) !important;
    border-left: 3px solid var(--inv-pending-text);
}

    .inv-row-warn td {
        background-color: transparent !important; /* Let the row background show through */
    }

/* Global Spin Animation */
.spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}
/* ==========================================================================
   2. INVOICE DETAILS DASHBOARD & STAT CARDS (Global)
   ========================================================================== */
/* Add these new variables to your existing :root block at the top of dst.css */
:root {
    --inv-purple-bg: #f5f3ff;
    --inv-purple-text: #8b5cf6;
    --inv-purple-border: rgba(139, 92, 246, 0.2);
    --inv-orange-bg: #fff7ed;
    --inv-orange-text: #f97316;
    --inv-orange-border: rgba(249, 115, 22, 0.2);
}

/* Add these new variables to your existing [data-theme="dark"] block in dst.css */
[data-theme="dark"], body.dark-mode {
    --inv-purple-bg: rgba(139, 92, 246, 0.15);
    --inv-purple-text: #a78bfa;
    --inv-purple-border: rgba(139, 92, 246, 0.3);
    --inv-orange-bg: rgba(249, 115, 22, 0.15);
    --inv-orange-text: #fb923c;
    --inv-orange-border: rgba(249, 115, 22, 0.3);
}

/* Layout Grids */
.inv-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.inv-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

@media (max-width: 1024px) {
    .inv-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .inv-grid-2, .inv-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Tab Navigation */
.inv-tabs {
    display: flex;
    gap: 2rem;
    border-bottom: 1px solid var(--inv-border-strong);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}

    .inv-tabs::-webkit-scrollbar {
        display: none;
    }

.inv-tab-btn {
    background: transparent;
    border: none;
    padding: 0.75rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--inv-text-muted);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    white-space: nowrap;
}

    .inv-tab-btn:hover, .inv-tab-btn.active {
        color: var(--inv-primary);
    }

        .inv-tab-btn.active::after {
            content: '';
            position: absolute;
            bottom: -1px;
            left: 0;
            width: 100%;
            height: 2px;
            background: var(--inv-primary);
            border-radius: 2px 2px 0 0;
        }
   
/* Detail Cards */
.inv-detail-card {
    background: var(--bg-subtle);
    border: 1px solid var(--inv-border);
    border-radius: var(--inv-radius-lg);
    padding: 1.25rem;
    box-shadow: var(--inv-shadow-sm);
    transition: box-shadow 0.2s, transform 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

    .inv-detail-card:hover {
        box-shadow: var(--inv-shadow-md);
    }
.inv-detail-card-plain {
    background: var(--bg-surface);
    border: 1px solid transparent;

    box-shadow: none;
  
}

    .inv-detail-card-plain:hover {
        box-shadow: none;
    }

.inv-detail-title {
    font-size: 0.8125rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--inv-text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.05em;
}

.inv-data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px dashed var(--inv-border-strong)!important;
}

/* Universal fix for .inv-data-row inside ANY Bootstrap col-md-* column (1 through 12) */

    .inv-data-row:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

.inv-data-label {
    font-size: 0.75rem;
    color: var(--inv-text-muted);
    font-weight: 600;
}

.inv-data-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--inv-text-strong);
    text-align: right;
}

/* Colorful Stat Cards */
.inv-stat-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--inv-radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left-width: 4px;
    border-left-style: solid;
    border-top: 1px solid var(--inv-border);
    border-right: 1px solid var(--inv-border);
    border-bottom: 1px solid var(--inv-border);
    z-index: 1;
    background: var(--inv-surface);
}

.inv-stat-bg-icon {
    position: absolute;
    font-size: 6rem;
    right: -0.5rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.08;
    z-index: -1;
}

/* Stat Variants mapped to Global Tokens */
.inv-stat-purple {
    background: var(--inv-purple-bg);
    border-left-color: var(--inv-purple-text);
    border-color: var(--inv-purple-border);
}

    .inv-stat-purple .inv-data-label, .inv-stat-purple .inv-stat-bg-icon {
        color: var(--inv-purple-text);
    }

.inv-stat-orange {
    background: var(--inv-orange-bg);
    border-left-color: var(--inv-orange-text);
    border-color: var(--inv-orange-border);
}

    .inv-stat-orange .inv-data-label, .inv-stat-orange .inv-stat-bg-icon {
        color: var(--inv-orange-text);
    }

.inv-stat-teal {
    background: var(--inv-teal-bg);
    border-left-color: var(--inv-teal-text);
    border-color: var(--inv-teal-border);
}

    .inv-stat-teal .inv-data-label, .inv-stat-teal .inv-stat-bg-icon {
        color: var(--inv-teal-text);
    }
/* ==========================================================================
   21. Red Dot Notification Badge (Global)
   ========================================================================== */
/* Red Dot Notification Badge */
.inv-tab-dot {
    position: absolute;
    top: 6px;
    right: -12px; /* Pushes the dot just outside the text */
    width: 8px;
    height: 8px;
    background-color: var(--inv-danger);
    border-radius: 50%;
    /* Creates a small cutout effect against the background */
    box-shadow: 0 0 0 2px var(--bg-app);
}

    /* Optional: Adds a professional pulsing radar effect */
    .inv-tab-dot::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: var(--inv-danger);
        border-radius: 50%;
        animation: ping-dot 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
    }

@keyframes ping-dot {
    75%, 100% {
        transform: scale(2.5);
        opacity: 0;
    }
}
/* ==========================================================================
   22.  ENTERPRISE BILLING / INVOICE MODULE (`dst-billing-*` Scoped)
   ========================================================================== */

/* Main Container & Base Card Mechanics */




/* Custom Input Controls & Theme Integration */
.dst-billing-input {
    background-color: var(--inv-surface, #ffffff) !important;
    border: 1px solid var(--inv-border-strong, #cbd5e1) !important;
    color: var(--inv-text-strong, #0f172a) !important;
    border-radius: var(--inv-radius-sm, 6px);
}

    .dst-billing-input:focus {
        border-color: var(--inv-primary, #152278) !important;
        box-shadow: 0 0 0 3px var(--inv-primary-bg, rgba(21, 34, 120, 0.04)) !important;
    }

.dst-billing-input-sm {
    background-color: var(--inv-surface, #ffffff) !important;
    border: 1px solid var(--inv-border, #e2e8f0) !important;
    color: var(--inv-text-strong, #0f172a) !important;
}

.dst-billing-address-box {
    background-color: var(--inv-toolbar-bg, #f8fafc) !important;
    border: 1px solid var(--inv-border-light, #f1f5f9);
    color: var(--inv-text-base, #334155) !important;
    line-height: 1.5;
    white-space: pre-line;
}

.dst-billing-ledger-card {
    background-color: var(--inv-toolbar-bg, #f8fafc);
    border-left: 4px solid var(--inv-primary, #152278) !important;
}

/* Line-Items Table Infrastructure */
.dst-billing-table-wrapper {
    background-color: var(--inv-surface, #ffffff);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dst-billing-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

    .dst-billing-table th {
        background-color: var(--inv-metric-bg, #ecf1fb) !important;
        color: var(--inv-text-muted, #64748b);
        padding: 0.75rem 0.5rem;
        font-size: 0.72rem;
        letter-spacing: 0.05em;
        border-bottom: 1px solid var(--inv-border, #e2e8f0);
        position: sticky;
        top: 0;
        z-index: 2;
    }

    .dst-billing-table td {
        background-color: var(--inv-surface, #ffffff);
        color: var(--inv-text-base, #334155);
        border-bottom: 1px solid var(--inv-border-light, #f1f5f9);
        padding: 0.5rem;
    }

.dst-billing-row:hover td {
    background-color: var(--inv-tertiary-hover-bg, #cce4f7) !important;
}

/* Component Modals */
.dst-billing-modal-textarea {
    height: 85px;
}

/* Width & Text Layout Utilities */
.dst-billing-width-80 {
    max-width: 80px;
}

.dst-billing-width-110 {
    max-width: 110px;
}



.dst-billing-tracking-wider {
    letter-spacing: 0.04em !important;
}

.dst-billing-min-h-60 {
    min-height: 60px;
}

.dst-billing-resize-none {
    resize: none;
}

.dst-billing-pre-line {
    white-space: pre-line;
}

.dst-billing-small-placeholder::placeholder {
    font-size: 0.82rem;
    opacity: 0.65;
}

/* Responsive Grid Border Separation */
@media (min-width: 992px) {
    .border-start-lg {
        border-left: 1px dashed var(--inv-border-strong, #cbd5e1) !important;
    }
}
/* ==========================================================================

                   METRICS BAR LAYOUT (Single-Line for Tablet & Laptop)

                   ========================================================================== */



.dst-billing-metrics-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: center;
}



.dst-billing-metric-item {
    display: flex;
    flex-direction: column;
    padding-right: 1rem;
    border-right: 1px dashed var(--inv-border-strong, #cbd5e1);
}



    .dst-billing-metric-item:last-child {
        border-right: none;
        padding-right: 0;
    }



.dst-billing-metric-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--inv-text-muted, #64748b);
    margin-bottom: 0.25rem;
    white-space: nowrap;
}



.dst-billing-metric-value {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
}



/* Mobile Responsiveness (Stacks 2x2 on Mobile Screens below 768px) */

@media (max-width: 767.98px) {

    .dst-billing-metrics-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem 1rem;
    }



    .dst-billing-metric-item:nth-child(2) {
        border-right: none;
        padding-right: 0;
    }



    .dst-billing-metric-item:nth-child(1),
    .dst-billing-metric-item:nth-child(2) {
        border-bottom: 1px dashed var(--inv-border-strong, #cbd5e1);
        padding-bottom: 0.75rem;
    }
}

/* ==========================================================================
   23. RESPONSIVE DESIGN MATRIX (All Screen Sizes)
   ========================================================================== */

/* --- BASE SIDEBAR VISIBILITY (Controlled strictly by your Blazor 'isOpen' boolean) --- */
.sidebar {
    transform: translateX(-100%); /* Hidden if no .open class */
}

    .sidebar.open {
        transform: translateX(0) !important; /* Visible if .open class exists */
    }

/* --- A. DESKTOP & LAPTOP BEHAVIOR (Screens > 992px) --- */
@media (min-width: 993px) {
    .main {
        margin-left: 0;
        padding-top: 0;
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Indent the main content ONLY when the sidebar is open on a laptop */
    .sidebar.open ~ .main {
        margin-left: 260px !important;
    }
}

/* --- B. TABLETS & MOBILE BEHAVIOR (Screens <= 992px) --- */
@media (max-width: 992px) {
    .sidebar {
        top: 64px;
    }

        /* When open on mobile, it overlays the screen and gets a shadow */
        .sidebar.open {
            box-shadow: 4px 0 24px var(--sidebar-shadow);
        }

    .main {
        margin-left: 0 !important; /* Never indent main content on mobile/tablet */
    }

    .topbar {
        padding: 0 16px;
    }

    .dropdown-content {
        width: 310px;
    }

    .inv-metrics-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .inv-metric-card:nth-child(3), .inv-metric-card:nth-child(6) {
        border-right: none;
    }
}

/* --- C. LARGE PHONES & SMALL TABLETS --- */
@media (max-width: 768px) {
    .inv-app-container {
        padding: 1rem;
    }

    .w-100-mobile {
        width: 100%;
    }

    .w-50-mobile {
        width: 50%;
    }

    .w-25-mobile {
        width: 25%;
    }

    .w-75-mobile {
        width: 75%;
    }

    .inv-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem 1rem;
        padding: 1rem;
    }

    .inv-metric-card:nth-child(even) {
        border-right: none;
        padding-right: 0;
    }

    .inv-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .inv-toolbar-left, .inv-toolbar-right {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .inv-search-box {
        width: 100%;
    }

    .inv-filter-group {
        flex-wrap: wrap;
        position: relative;
        gap: 0.5rem;
    }

        .inv-filter-group .dropdown {
            position: static !important;
            flex: 1 1 calc(50% - 0.25rem);
        }

        .inv-filter-group .inv-btn {
            width: 100%;
            justify-content: space-between;
        }

        .inv-filter-group .inv-dropdown-menu {
            top: 100% !important;
            left: 0 !important;
            right: 0 !important;
            width: 100% !important;
            max-width: 100%;
            transform: none !important;
            margin-top: 0.5rem !important;
        }

    .inv-action-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        width: 100%;
    }

    .inv-toolbar-divider {
        display: none;
    }

    .inv-action-group .inv-btn {
        width: 100%;
        justify-content: center;
    }

    .inv-pagination-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .inv-page-controls {
        display: flex;
        justify-content: space-between;
    }

        .inv-page-controls .inv-btn {
            flex: 1;
            margin: 0 0.25rem;
        }
}

/* --- D. STANDARD MOBILE PHONES (iPhone, Android) --- */
@media (max-width: 576px) {
    .inv-page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .topbar {
        height: 56px;
        padding: 0 12px;
    }

    .sidebar {
        top: 56px;
    }

    .logo span {
        display: none;
    }

    .left-side {
        gap: 8px;
    }

    .right-side {
        gap: 6px;
    }

    .icon-circle {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        font-size: 1.05rem;
    }

    .dropdown-content {
        position: fixed !important;
        top: 56px !important;
        left: 12px !important;
        right: 12px !important;
        width: calc(100vw - 24px) !important;
        max-width: none !important;
        transform-origin: top center;
    }

    .dropdown-list {
        max-height: 240px;
    }
}

/* --- E. EXTRA SMALL MOBILE PHONES --- */
@media (max-width: 390px) {
    .inv-metrics-grid {
        grid-template-columns: 1fr;
    }

    .inv-metric-card {
        border-right: none;
        padding-right: 0;
        border-bottom: 1px solid var(--inv-border-strong);
        padding-bottom: 1rem;
    }

        .inv-metric-card:last-child {
            border-bottom: none;
            padding-bottom: 0;
        }

    .inv-action-group {
        grid-template-columns: 1fr;
    }
}
/* ==========================================================================
   UTILITY CLASSES FOR CARDS, BADGES & SURFACES
   ========================================================================== */

/* Red Classes */
.dst-theme-red {
    background-color: var(--dst-red-bg-soft) !important;
    border: 1px solid var(--dst-red-bg-accent) !important;
    color: var(--dst-red-color) !important;
}

/* Blue Classes */
.dst-theme-blue {
    background-color: var(--dst-blue-bg-soft) !important;
    border: 1px solid var(--dst-blue-bg-accent) !important;
    color: var(--dst-blue-color) !important;
}

/* Green Classes */
.dst-theme-green {
    background-color: var(--dst-green-bg-soft) !important;
    border: 1px solid var(--dst-green-bg-accent) !important;
    color: var(--dst-green-color) !important;
}

/* Yellow Classes */
.dst-theme-yellow {
    background-color: var(--dst-yellow-bg-soft) !important;
    border: 1px solid var(--dst-yellow-bg-accent) !important;
    color: var(--dst-yellow-color) !important;
}

/* Pink Classes */
.dst-theme-pink {
    background-color: var(--dst-pink-bg-soft) !important;
    border: 1px solid var(--dst-pink-bg-accent) !important;
    color: var(--dst-pink-color) !important;
}