:root {
    /* Colors - Neon Premium Slate Palette */
    --bg: #090e17;
    --background: #090e17;
    --bg-elev: #0c121e;
    --surface: #121927;
    --surface-strong: #172133;
    --surface-soft: #1a2536;
    --surface-light: #1a2536;
    --border: rgba(255, 255, 255, 0.06);
    --text: #f0f4f8;
    --text-soft: #94a3b8;
    --text-muted: #94a3b8;
    --card-bg: linear-gradient(180deg, rgba(23, 33, 51, 0.96), rgba(18, 25, 39, 0.96));
    
    /* Neon Colors */
    --primary: #00f2fe;
    --primary-strong: #4facfe;
    --primary-hover: #4facfe;
    --secondary: #64748b;
    --accent: #b224ef;
    --success: #00f260;
    --success-light: rgba(0, 242, 96, 0.12);
    --warning: #ffb75e;
    --error: #ff3366;
    --danger: #ff3366;
    --error-light: rgba(255, 51, 102, 0.12);
    --info: #00f2fe;
    --info-light: rgba(0, 242, 254, 0.12);
    
    /* Layout */
    --header-height: 70px;
    --sidebar-width: 260px;

    /* Shadow & Glassmorphism & Neon Glow */
    --shadow-1: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 16px 40px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-neon: 0 0 20px rgba(0, 242, 254, 0.15);
    --shadow-neon-strong: 0 0 25px rgba(0, 242, 254, 0.3);
    --shadow: var(--shadow-1);
    --shadow-lg: var(--shadow-2);
    --glass-bg: linear-gradient(180deg, rgba(18, 25, 39, 0.96), rgba(12, 18, 30, 0.96));
    --glass-border: var(--border);

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;

    /* Radius - More rounded */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius: 16px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* Font */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--surface-light);
    border-radius: 10px;
    border: 2px solid var(--background);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Admin/Manager Visibility System */
.admin-only,
.superadmin-only,
.admin-manager-only {
    display: none !important;
}

.is-admin .admin-only,
.is-admin .admin-manager-only,
.is-manager .admin-manager-only {
    display: block !important;
}

.is-super .superadmin-only {
    display: block !important;
}

/* Specific display for list items to prevent layout breaking */
.is-admin li.admin-only,
.is-admin li.admin-manager-only,
.is-manager li.admin-manager-only,
.is-super li.superadmin-only {
    display: list-item !important;
}

.is-admin div.admin-only,
.is-admin div.admin-manager-only,
.is-manager div.admin-manager-only,
.is-super div.superadmin-only {
    display: block !important;
}

.is-admin span.admin-only,
.is-admin span.admin-manager-only,
.is-manager span.admin-manager-only,
.is-super span.superadmin-only {
    display: inline-block !important;
}

.is-admin th.admin-only,
.is-admin td.admin-only,
.is-admin th.admin-manager-only,
.is-admin td.admin-manager-only,
.is-manager th.admin-manager-only,
.is-manager td.admin-manager-only,
.is-super th.superadmin-only,
.is-super td.superadmin-only {
    display: table-cell !important;
}


/* Light Theme Overrides */
:root.light-theme {
    --background: #f1f5f9;
    --bg: #f1f5f9;
    --bg-elev: #e2e8f0;
    --surface: #ffffff;
    --surface-light: #f8fafc;
    --surface-strong: #e2e8f0;
    --surface-soft: #f1f5f9;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-soft: #64748b;
    --border: #e2e8f0;
    --card-bg: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 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.04), 0 4px 6px -4px rgb(0 0 0 / 0.02);
    --shadow-neon: 0 10px 15px -3px rgb(0 0 0 / 0.04), 0 4px 6px -4px rgb(0 0 0 / 0.02);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--background);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    min-height: 100vh;
}

/* Base Styles */
h1,
h2,
h3,
h4 {
    color: var(--text);
    font-weight: 600;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

button {
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.2s;
    border: none;
    outline: none;
}

input {
    font-family: var(--font-main);
}

/* Glass Utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    transition: var(--transition-base);
}

.glass:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

/* Premium Visual Elements */
.premium-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-row:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    background: var(--surface-light);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 0.70rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-pill.error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-pill.success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-pill.primary {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}


/* Utility Classes */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.gap-2 {
    gap: var(--space-2);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-6 {
    gap: var(--space-6);
}

.gap-8 {
    gap: var(--space-8);
}

.w-full {
    width: 100%;
}

.m-auto {
    margin: auto;
}

.p-4 {
    padding: var(--space-4);
}

.p-6 {
    padding: var(--space-6);
}

.p-8 {
    padding: var(--space-8);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-xl {
    border-radius: var(--radius-xl);
}

/* Form Elements */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1.25rem;
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.input-container i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
}

.input-container .input-control {
    padding-left: 40px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input-control {
    width: 100%;
    background: var(--surface-light);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.2s;
    outline: none;
}

.input-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: var(--surface);
}

/* Firefox Fix: Ensure options are visible in dark theme */
select option {
    background-color: var(--surface);
    color: var(--text);
}


.input-control[readonly] {
    background: rgba(255, 255, 255, 0.03);
    border-color: transparent;
    cursor: default;
    color: var(--text-muted);
}

.input-control[readonly]:focus {
    box-shadow: none;
}

.text-center {
    text-align: center;
}

.text-sm {
    font-size: 0.875rem;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: #090e17;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: var(--radius);
    font-weight: 500;
}

.btn-secondary {
    background: #334155;
    color: var(--text);
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--secondary);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-secondary:active {
    transform: translateY(0);
}

.d-none {
    display: none !important;
}

.sales-mobile-nav {
    display: none;
    flex-direction: column;
    gap: var(--space-4);
}

.mobile-tab-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}

.mobile-tab-nav .btn-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.mobile-tab-nav .btn-tab.active {
    background: var(--primary);
    color: #090e17;
    font-weight: 700;
    border-color: var(--primary) !important;
}

.mobile-action-nav .btn-ghost {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-ghost:hover {
    background: var(--surface-light);
    color: var(--text);
}

.btn-tab {
    background: transparent;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 500;
    border-bottom: 2px solid transparent;
}

.btn-tab:hover {
    color: var(--text);
}

.btn-tab.active {
    background: var(--surface-light);
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* Loader */
.loader {
    width: 24px;
    height: 24px;
    border: 3px solid var(--surface-light);
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    animation: rotation 1s linear infinite;
}

.loader-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Additional Utilities */
.glass-light {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(4px);
}

.letter-spacing-1 {
    letter-spacing: 1px;
}

.badge-primary {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.table-row-hover:hover {
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
}

/* Layout Utilities */
.justify-between {
    justify-content: space-between;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-8 {
    margin-top: 2rem;
}

.mt-12 {
    margin-top: 3rem;
}

.mt-16 {
    margin-top: 4rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.text-xs {
    font-size: 0.75rem;
}

.font-bold {
    font-weight: 700;
}

.font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    max-height: 95vh;
    overflow-y: auto;
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: var(--text-muted);
    cursor: pointer;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-top: var(--space-6);
}

.justify-end {
    justify-content: flex-end;
}

.org-badge {
    background: var(--surface-light);
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: var(--primary);
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    height: 38px;
    margin-left: 12px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0;
    margin-left: auto;
    /* Pushes to the right if in flex container */
}

#companyProfileLogo {
    height: 38px !important;
    width: auto !important;
    max-width: 150px !important;
    object-fit: contain !important;
    border-radius: 8px !important;
    vertical-align: middle !important;
    background: white;
    /* Often logos look better on white if they have transparency issues */
    padding: 4px;
    flex-shrink: 0;
}

.header {
    height: var(--header-height);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-8);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Mobile Menu Trigger */
.menu-trigger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--surface-light);
    color: var(--text);
    cursor: pointer;
    border: 1px solid var(--border);
    margin-right: var(--space-4);
}

.menu-trigger i {
    width: 24px;
    height: 24px;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Sidebar & Navigation */
.sidebar {
    width: var(--sidebar-width, 260px) !important;
    height: 100vh !important;
    border-right: 1px solid var(--border) !important;
    display: flex !important;
    flex-direction: column !important;
    padding: var(--space-6) !important;
    background: var(--surface) !important;
    flex-shrink: 0 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 50 !important;
    transition: width 0.3s ease !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-logo {
    display: flex !important;
    align-items: center !important;
    gap: var(--space-4) !important;
    margin-bottom: var(--space-8) !important;
    font-weight: 700 !important;
    font-size: 1.25rem !important;
    color: var(--text) !important;
    text-decoration: none !important;
}

.nav-list {
    list-style: none !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.nav-item {
    margin-bottom: var(--space-2) !important;
    list-style: none !important;
}

.nav-link {
    display: flex !important;
    align-items: center !important;
    gap: var(--space-4) !important;
    padding: 12px 16px !important;
    border-radius: var(--radius) !important;
    color: var(--text-muted) !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
    cursor: pointer !important;
}

.nav-link i {
    width: 20px !important;
    height: 20px !important;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text) !important;
    background: var(--surface-light) !important;
}

.nav-link.active {
    color: var(--primary) !important;
    background: rgba(59, 130, 246, 0.1) !important;
}

/* Warehouse selection styles */
.sidebar-item.active {
    border-color: var(--primary) !important;
    background: rgba(59, 130, 246, 0.1) !important;
    box-shadow: 0 0 0 1px var(--primary) !important;
}

.sidebar-item:hover {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-footer {
    margin-top: auto !important;
    border-top: 1px solid var(--border) !important;
    padding-top: var(--space-6) !important;
    flex-shrink: 0 !important;
}

.main-container {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: var(--background) !important;
    position: relative !important;
    min-width: 0 !important;
}

/* Header & Tools Layout */
.header-tools {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex: 1;
}

.search-wrapper {
    position: relative;
    width: 300px;
}

.search-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
}

.search-wrapper input {
    padding-left: 42px !important;
}

.filter-section {
    margin-bottom: var(--space-6);
    background: var(--surface);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    position: relative;
    z-index: 100;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.filter-group select {
    flex: 1;
    min-width: 150px;
    max-width: 200px;
}

.reset-btn {
    padding: 10px !important;
    flex-shrink: 0;
}

.reset-btn i {
    width: 18px;
}

/* Page Title & Actions */
.page-title-area {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-8);
}

.page-actions {
    display: flex;
    gap: var(--space-2);
}

.page-actions .btn-ghost,
.page-actions .btn-primary {
    width: auto;
    padding: 10px 15px;
}

.page-actions .btn-ghost {
    border: 1px solid var(--border);
}

.page-actions i {
    width: 18px;
    margin-right: 8px;
}

/* Mobile Responsive Styles */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 80px !important;
    }

    .sidebar span,
    .sidebar-footer #userName,
    .sidebar-footer #userRoleBadge {
        display: none !important;
    }

    .sidebar-logo {
        justify-content: center !important;
    }

    .nav-link {
        justify-content: center !important;
        padding: 12px !important;
    }

    .nav-link i {
        margin: 0 !important;
    }

    #userProfile {
        justify-content: center !important;
        padding: 8px !important;
    }

    .search-wrapper {
        width: 170px;
    }
}

@media (max-width: 768px) {
    body {
        display: block !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: auto !important;
    }

    .menu-trigger {
        display: flex !important;
    }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 260px !important;
        height: 100vh !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 9999 !important;
        padding: var(--space-6) !important;
        display: flex !important;
    }

    .sidebar.active {
        transform: translateX(0) !important;
    }

    .sidebar-logo,
    .sidebar-footer {
        display: flex !important;
    }

    .sidebar span,
    .sidebar-footer #userName,
    .sidebar-footer #userRoleBadge {
        display: block !important;
    }

    .nav-list {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        height: auto !important;
        justify-content: flex-start !important;
        align-items: stretch !important;
        gap: 4px !important;
        margin-top: var(--space-4) !important;
    }

    .nav-item {
        margin-bottom: var(--space-2) !important;
    }

    .nav-link {
        flex-direction: row !important;
        gap: var(--space-4) !important;
        padding: 12px 16px !important;
        font-size: 0.95rem !important;
        height: auto !important;
        justify-content: flex-start !important;
        border-radius: var(--radius) !important;
    }

    .nav-link i {
        width: 20px !important;
        height: 20px !important;
    }

    .main-container {
        width: 100% !important;
        height: auto !important;
        padding-bottom: 0 !important;
        display: block !important;
        overflow: visible !important;
    }

    .header {
        position: sticky !important;
        top: 0 !important;
        height: 64px !important;
        padding: 0 var(--space-4) !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0 !important;
        z-index: 1000 !important;
    }

    .header-tools {
        flex-direction: row !important;
        align-items: center !important;
        flex: 1 !important;
    }

    .filter-section {
        margin-bottom: var(--space-4) !important;
        padding: var(--space-2) !important;
        background: transparent !important;
        border: none !important;
    }

    .filter-group {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: var(--space-2) !important;
    }

    .filter-group select {
        width: 100% !important;
        max-width: none !important;
    }

    .reset-btn {
        grid-column: span 2 !important;
        justify-content: center !important;
    }

    .content {
        padding: 16px !important;
        display: block !important;
        grid-template-columns: 1fr !important;
    }

    /* Page Title Area Mobile */
    .page-title-area {
        flex-direction: column !important;
        gap: var(--space-6) !important;
        margin-bottom: var(--space-6) !important;
    }

    .page-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: var(--space-2) !important;
        width: 100% !important;
    }

    .page-actions .btn-primary {
        grid-column: span 2 !important;
    }

    .page-actions .btn-ghost span {
        font-size: 0.75rem !important;
    }

    /* Grid Adjustments */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .form-grid {
        grid-template-columns: 1fr !important;
    }

    /* Table to Cards Transformation */
    .table-container {
        margin: 0 -16px !important;
        width: calc(100% + 32px) !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block !important;
    }

    thead tr {
        position: absolute !important;
        top: -9999px !important;
        left: -9999px !important;
    }

    tr {
        background: var(--surface) !important;
        margin-bottom: var(--space-4) !important;
        border-radius: var(--radius-xl) !important;
        border: 1px solid var(--border) !important;
        padding: var(--space-4) !important;
        box-shadow: var(--shadow-sm) !important;
    }

    td {
        border: none !important;
        padding: 8px 0 !important;
        position: relative !important;
        padding-left: 50% !important;
        text-align: right !important;
    }

    td:before {
        position: absolute !important;
        left: 0 !important;
        width: 45% !important;
        padding-right: 10px !important;
        white-space: nowrap !important;
        text-align: left !important;
        font-weight: 600 !important;
        color: var(--text-muted) !important;
        content: attr(data-label) !important;
    }

    /* Highlight the product name */
    td[data-label="Запчасть"] {
        padding-left: 0 !important;
        text-align: left !important;
        border-bottom: 2px solid var(--border) !important;
        margin-bottom: 12px !important;
        padding-bottom: 12px !important;
    }

    td[data-label="Запчасть"]:before {
        display: none !important;
    }

    td:last-child {
        text-align: right !important;
        padding-left: 0 !important;
    }

    td:last-child:before {
        display: none !important;
    }

    /* Sales Page Mobile */
    #viewNewSale.content {
        display: flex !important;
        flex-direction: column !important;
    }

    .cart-section {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        margin-top: 20px !important;
    }

    /* Modal Adjustments */
    .modal-content {
        padding: var(--space-4) !important;
        width: 95% !important;
        margin: 10px !important;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.1rem !important;
    }

    .header nav,
    #salesImportButtons {
        display: none !important;
    }

    .sales-mobile-nav {
        display: flex !important;
    }

    .org-badge {
        display: none !important;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Premium Card Effects */
.stat-card.glass {
    position: relative;
    overflow: hidden;
}

.stat-card.glass::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(225deg, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.stat-card.glass:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.3);
}

.table-container,
.data-table-container {
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--glass-border);
}

.btn-primary:hover {
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

/* ============================================================
   TOAST NOTIFICATION SYSTEM
   Заменяет браузерные alert() во всех страницах
   ============================================================ */

#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 380px;
    width: 100%;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(12px);
    pointer-events: all;
    overflow: hidden;
    position: relative;

    /* Анимация появления */
    animation: toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.toast.toast-hiding {
    animation: toast-out 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(110%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
        max-height: 120px;
        margin-bottom: 0;
    }
    to {
        opacity: 0;
        transform: translateX(110%) scale(0.9);
        max-height: 0;
        margin-bottom: -12px;
        padding-top: 0;
        padding-bottom: 0;
    }
}

/* Иконка типа */
.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Текст */
.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.3;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    word-break: break-word;
}

/* Кнопка закрытия */
.toast-close {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.6;
    transition: opacity 0.2s;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.toast-close:hover { opacity: 1; }

/* Прогресс-бар */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 12px 12px;
    animation: toast-progress linear both;
    transform-origin: left;
}

@keyframes toast-progress {
    from { width: 100%; }
    to   { width: 0%; }
}

/* Типы тостов */
.toast-success {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.08);
}
.toast-success .toast-icon  { color: var(--success); }
.toast-success .toast-title { color: var(--success); }
.toast-success .toast-progress { background: var(--success); }

.toast-error {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.08);
}
.toast-error .toast-icon  { color: var(--error); }
.toast-error .toast-title { color: var(--error); }
.toast-error .toast-progress { background: var(--error); }

.toast-warning {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.08);
}
.toast-warning .toast-icon  { color: #f59e0b; }
.toast-warning .toast-title { color: #f59e0b; }
.toast-warning .toast-progress { background: #f59e0b; }

.toast-info {
    border-color: rgba(168, 85, 247, 0.35);
    background: rgba(168, 85, 247, 0.08);
}
.toast-info .toast-icon  { color: #a855f7; }
.toast-info .toast-title { color: #a855f7; }
.toast-info .toast-progress { background: #a855f7; }

/* Мобильная адаптация */
@media (max-width: 480px) {
    #toast-container {
        top: auto;
        bottom: 24px;
        right: 12px;
        left: 12px;
        max-width: 100%;
    }

    .toast {
        animation-name: toast-in-mobile;
    }

    .toast.toast-hiding {
        animation-name: toast-out-mobile;
    }

    @keyframes toast-in-mobile {
        from { opacity: 0; transform: translateY(80px) scale(0.95); }
        to   { opacity: 1; transform: translateY(0) scale(1); }
    }

    @keyframes toast-out-mobile {
        from { opacity: 1; transform: translateY(0) scale(1); max-height: 120px; }
        to   { opacity: 0; transform: translateY(40px) scale(0.95); max-height: 0; padding: 0; }
    }
}

/* Searchable Select styles */
.searchable-select-wrapper {
    position: relative;
    display: inline-block;
    flex: 1;
    min-width: 150px;
    max-width: 200px;
    z-index: 10;
}

.searchable-select-wrapper:focus-within {
    z-index: 1000;
}

.searchable-select-input {
    width: 100% !important;
    max-width: none !important;
    cursor: text;
}

.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.searchable-select-dropdown.open {
    display: block;
}

.searchable-select-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    transition: background 0.2s ease, color 0.2s ease;
}

.searchable-select-item:hover {
    background: var(--primary-light, rgba(79, 70, 229, 0.1));
}

.searchable-select-item.selected {
    background: var(--primary);
    color: #fff;
}

.hover-gallery-popover {
    position: fixed;
    z-index: 99999;
    width: 280px;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    overflow: hidden;
    pointer-events: none; /* Разрешаем сквозной клик, когда скрыт */
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.hover-gallery-popover.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto; /* Включаем клики, когда галерея активна */
}

.hover-gallery-main {
    width: 100%;
    height: 200px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hover-gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.hover-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.6);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: bold;
}

.hover-gallery-nav:hover {
    background: rgba(59, 130, 246, 0.8);
}

.hover-gallery-prev {
    left: 8px;
}

.hover-gallery-next {
    right: 8px;
}

.hover-gallery-thumbs {
    display: flex;
    gap: 4px;
    padding: 6px;
    overflow-x: auto;
    background: rgba(15, 23, 42, 0.4);
    border-top: 1px solid var(--border);
}

.hover-gallery-thumbs::-webkit-scrollbar {
    height: 4px;
}

.hover-gallery-thumb {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s;
    flex-shrink: 0;
}

.hover-gallery-thumb.active {
    border-color: var(--primary);
}

.hover-gallery-counter {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.hover-gallery-zoom {
    position: absolute;
    top: 8px;
    left: 8px;
    background: transparent;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.hover-gallery-zoom:hover {
    background: rgba(0, 0, 0, 0.4);
    transform: scale(1.1);
}

.hover-gallery-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.hover-gallery-fs-img {
    max-width: 840px;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    cursor: default;
}

.hover-gallery-fs-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.hover-gallery-fs-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Custom Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

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

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

/* Tooltip styles */
.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
    margin-left: 6px;
    vertical-align: middle;
}

.tooltip-icon {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    opacity: 0.6;
    transition: opacity 0.2s;
}

.tooltip-container:hover .tooltip-icon {
    opacity: 1;
    color: var(--primary);
}

.tooltip-text {
    visibility: hidden;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(15, 23, 42, 0.95);
    color: #f8fafc;
    text-align: left;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    width: 250px;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.4;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    white-space: normal;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(15, 23, 42, 0.95) transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Prevent tooltip clipping by parent containers */
.stats-grid, .stat-card, .chart-container, .data-table-container {
    overflow: visible !important;
}

/* =========================================
   NEW SAAS DESIGN MATRIX COMPONENT STYLES 
   ========================================= */

.glass,
.stat-card,
.client-card,
.part-card,
.cart-section,
.modal-content {
  background: var(--card-bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-1) !important;
}

.glass:hover,
.stat-card:hover,
.client-card:hover,
.part-card:hover {
  border-color: rgba(79, 140, 255, 0.3) !important;
  box-shadow: var(--shadow-2) !important;
  transform: translateY(-2px) !important;
}

.btn-primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-strong)) !important;
  color: #fff !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 18px rgba(45, 109, 246, 0.28) !important;
  border: none !important;
}

.btn-secondary {
  background: rgba(79, 140, 255, 0.08) !important;
  color: var(--text) !important;
  border: 1px solid rgba(79, 140, 255, 0.18) !important;
  border-radius: 12px !important;
}

.status-pill {
  border-radius: 999px !important;
  padding: 6px 10px !important;
  font-size: 11px !important;
  letter-spacing: 0.04em !important;
  background: rgba(148, 163, 184, 0.08) !important;
  border: 1px solid rgba(148, 163, 184, 0.12) !important;
  color: var(--text-soft) !important;
}

.status-pill.success {
  background: rgba(31, 200, 138, 0.12) !important;
  border-color: rgba(31, 200, 138, 0.2) !important;
  color: var(--success) !important;
}

.status-pill.warning {
  background: rgba(247, 185, 85, 0.12) !important;
  border-color: rgba(247, 185, 85, 0.22) !important;
  color: var(--warning) !important;
}

.status-pill.error {
  background: rgba(255, 107, 107, 0.12) !important;
  border-color: rgba(255, 107, 107, 0.2) !important;
  color: var(--danger) !important;
}

table th {
  background: rgba(148, 163, 184, 0.04) !important;
  color: var(--text-soft) !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  border-bottom: 1px solid var(--border) !important;
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
  background: rgba(148, 163, 184, 0.03) !important;
}

/* KPI Card Styles */
.kpi-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    padding: 20px 18px 16px;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 242, 254, 0.4);
    box-shadow: var(--shadow-neon);
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.kpi-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(79, 140, 255, 0.1);
    color: var(--primary);
}

.kpi-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    font-size: 0.72rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.kpi-value {
    font-size: clamp(1.5rem, 2vw, 2rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

.kpi-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-height: 18px;
}

.kpi-delta-up {
    color: var(--success);
}

.kpi-delta-down {
    color: var(--error);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.panel-title {
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.insight-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(79, 140, 255, 0.08);
    border: 1px solid rgba(79, 140, 255, 0.14);
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 600;
}

@keyframes pulsate {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}
.pulsate {
    animation: pulsate 1s infinite;
    background-color: var(--error) !important;
    border-color: var(--error) !important;
}
