:root {
    --primary: #d97706;
    --primary-light: #d97706;
    --secondary: #138808;
    --secondary-light: #1ea30b;
    --gold: #d97706;
    --gold-light: #ffea70;
    --indigo-original: #000000;
    --indigo-dark: #2c3e50;
    --dark: #121212;
    --light: #f8fafc;
    --gray: #64748b;
    --glass: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.2);
    --sidebar-width: 260px;
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

/* Select2 Premium Styles */
.select2-premium+.select2-container--default .select2-selection--single {
    border-radius: 6px !important;
    border: 1px solid #cbd5e1 !important;
    height: calc(1.6rem + 2px) !important;
    display: flex;
    align-items: center;
    background-color: #fff;
    padding: 0.3rem 0.4rem !important;
}

.select2-premium+.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(255, 153, 51, 0.1) !important;
    outline: none !important;
}

.select2-premium+.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 0 !important;
    padding-right: 1.5rem !important;
    color: #374151 !important;
    font-size: 0.8rem !important;
    line-height: 1 !important;
    height: 100%;
    display: flex;
    align-items: center;
}

.select2-premium+.select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute !important;
    right: 30px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #ef4444 !important;
    font-weight: bold !important;
    font-size: 1.1rem !important;
}

body .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary) !important;
    color: white !important;
}

body .select2-dropdown {
    border: 1px solid var(--primary) !important;
    border-radius: 6px !important;
    z-index: 1060 !important;
}

/* .select2-container {
    z-index: 1060 !important;
} */

body .select2-container--default .select2-search--dropdown .select2-search__field {
    border-radius: 6px !important;
    border: 1px solid #d1d5db !important;
    padding: 6px 12px !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Inter", sans-serif;
}

body {
    background: #f1f5f9;
    color: var(--dark);
    overflow-x: hidden;
}

select {
    padding: 0.3rem 0.4rem;
    height: 38px !important;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--dark);
    color: white;
    padding: 1rem 0.5rem;
    z-index: 1000;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.sidebar-collapsed .sidebar {
    width: 70px;
    padding: 1.5rem 0.5rem;
}

.sidebar-collapsed .sidebar .sidebar-header span,
.sidebar-collapsed .sidebar .nav-link span,
.sidebar-collapsed .sidebar .sidebar-label {
    display: none;
}

.sidebar-collapsed .sidebar .nav-link {
    justify-content: center;
}

.sidebar-collapsed .sidebar .sidebar-header {
    justify-content: center;
}

.sidebar-collapsed .main-wrapper {
    margin-left: 60px;
}

.sidebar-header {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar-header i {
    color: var(--primary-light);
}

.nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 5px 4px;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.nav-link:hover {
    background: rgba(217, 119, 6, 0.1);
    color: var(--primary);
}

.nav-link.active {
    background: rgba(217, 119, 6, 0.15);
    color: var(--primary);
    font-weight: 600;
    border-left: 4px solid var(--primary);
    border-radius: 5px;
    padding: 5px;
}

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

/* Sidebar Dropdown */
.nav-link[data-custom-toggle="sidebar-collapse"] {
    position: relative;
}

.nav-link[data-custom-toggle="sidebar-collapse"]::after {
    content: "\f107";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    margin-left: auto;
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}

.nav-link[data-custom-toggle="sidebar-collapse"][aria-expanded="true"]::after {
    transform: rotate(180deg);
}

.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-submenu .nav-link {
    padding-left: 1.5rem;
    font-size: 0.85rem;
}

/* Main Content */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 10px;
    padding-top: 100px;
}

@media (max-width: 991px) {
    .main-wrapper {
        padding: 15px;
        padding-top: 100px;
    }
}

/* Glass Cards */
.glass-card {
    background: var(--glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* KPI Cards - Dashboard */
.kpi-card {
    padding: 1.5rem;
    border-radius: 20px;
    color: white;
    position: relative;
    overflow: hidden;
    height: 140px !important;
    min-height: 140px !important;
    margin-bottom: 1rem;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

.kpi-card h3 {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.kpi-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2px 0;
}

.kpi-card i {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 5rem;
    opacity: 0.1;
}

.bg-saffron {
    background: linear-gradient(135deg, #d97706, #f59e0b) !important;
}

.bg-green {
    background: linear-gradient(135deg, #138808, #2ecc71) !important;
}

.bg-black {
    background: linear-gradient(135deg, #000000, #434343) !important;
}

.bg-gold {
    background: linear-gradient(135deg, #ffd700, #ffea70) !important;
}

.bg-purple {
    background: linear-gradient(135deg, #6b21a8, #9333ea) !important;
}

.bg-teal {
    background: linear-gradient(135deg, #0d9488, #14b8a6) !important;
}

.bg-orange {
    background: linear-gradient(135deg, #ea580c, #fb923c) !important;
}

.bg-rose {
    background: linear-gradient(135deg, #e11d48, #fb7185) !important;
}

.bg-cyan {
    background: linear-gradient(135deg, #0891b2, #22d3ee) !important;
}

/* Flow Visualization */
.flow-diagram {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0;
    position: relative;
}

.flow-node {
    text-align: center;
    z-index: 1;
}

.node-icon {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin: 0 auto 10px;
    color: var(--primary);
    font-size: 1.5rem;
    border: 2px solid var(--primary-light);
}

.node-label {
    font-weight: 600;
    font-size: 0.85rem;
}

.node-sub {
    font-size: 0.75rem;
    color: var(--gray);
}

.btn-primary {
    background: var(--gold) !important;
    color: white !important;
    border: var(--gold) !important;
}

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

.flow-line {
    flex-grow: 1;
    height: 2px;
    background: var(--gray);
    margin: 0 10px;
    position: relative;
    opacity: 0.3;
}

.flow-line.active {
    background: var(--primary);
    opacity: 1;
}

.flow-line.active::after {
    content: "\f105";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    right: 0;
    top: -11px;
    color: var(--primary);
}

/* Product Grid */
.product-card {
    border-radius: 15px;
    overflow: hidden;
    background: white;
    height: 100%;
}

.product-img {
    height: 200px;
    background-size: cover;
    background-position: center;
}

.product-info {
    padding: 1rem;
}

.product-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.product-vendor {
    font-size: 0.8rem;
    color: var(--gray);
    margin-bottom: 10px;
}

.product-price {
    color: var(--primary);
    font-weight: 700;
}

/* Badges */
.badge-approval {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Shared Styling for Warehouse and Dispatch Sub-Tabs */
#warehouseTabs .nav-link,
#dispatchFilters .nav-link {
    color: var(--dark) !important;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 12px;
    padding: 0.5rem 1rem;
}

#warehouseTabs .nav-link:hover,
#dispatchFilters .nav-link:hover {
    color: var(--primary) !important;
    background-color: rgba(217, 119, 6, 0.1);
}

#warehouseTabs .nav-link.active,
#dispatchFilters .nav-link.active {
    background: var(--primary) !important;
    /* Orange background */
    color: white !important;
    /* White text */
    box-shadow: 0 4px 6px rgba(217, 119, 6, 0.25);
}

/* Responsive */
@media (max-width: 991px) {
    body {
        overflow-x: hidden;
    }

    .sidebar {
        width: 60px;
        padding: 1rem 0.5rem;
        transform: translateX(-100%);
        z-index: 1060;
    }

    .sidebar-header span,
    .nav-link span,
    .sidebar-label {
        display: none !important;
    }

    .main-header {
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        padding: 8px 10px !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        position: fixed !important;
        top: 0 !important;
        z-index: 1020 !important;
    }

    .sidebar-header {
        justify-content: center;
        margin-bottom: 1.5rem;
    }

    .nav-link i {
        font-size: 1.2rem;
    }

    /* Mobile Open State */
    body.sidebar-mobile-open .sidebar {
        width: var(--sidebar-width);
        padding: 1.5rem;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
        z-index: 1060;
        transform: translateX(0);
        /* Above header */
    }

    body.sidebar-mobile-open .sidebar-header span,
    body.sidebar-mobile-open .nav-link span,
    body.sidebar-mobile-open .sidebar-label {
        display: inline-block !important;
    }

    body.sidebar-mobile-open .sidebar-header {
        justify-content: flex-start;
        margin-bottom: 1rem;
    }

    body.sidebar-mobile-open .nav-link {
        justify-content: flex-start;
        padding: 0.4rem 0.7rem;
    }

    /* Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1050;
        /* Above header */
        backdrop-filter: blur(2px);
    }

    body.sidebar-mobile-open .sidebar-overlay {
        display: block;
    }
}

/* Material Grid Selection */
.material-card {
    border: 2px solid transparent;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 100%;
    position: relative;
    background: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.material-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.material-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.material-img {
    height: 300px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
    background-color: #f8f9fa;
    /* Light background for spacing */
}

.check-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: 2px solid #ddd;
}

.material-card.selected .check-overlay {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.material-card.selected .check-overlay i {
    display: block;
    color: white;
    font-size: 14px;
}

.check-overlay i {
    display: none;
}

.material-details {
    padding: 1rem;
}

.card-inputs {
    max-height: 0;
    overflow: hidden;
    transition:
        max-height 0.3s ease-out,
        opacity 0.3s ease;
    opacity: 0;
    margin-top: 0;
}

.material-card.selected .card-inputs {
    max-height: 300px;
    opacity: 1;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #eee;
}

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

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

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

/* Premium Form Styles */
.form-section {
    margin-bottom: 2rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.form-section-title {
    background: #e2e8f0;
    color: var(--dark);
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-section-body {
    padding: 1.5rem;
}

.bg-indigo-dark {
    background-color: var(--indigo-dark) !important;
    color: white !important;
}

.bg-indigo-dark i {
    color: white !important;
}

.compact-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--dark);
    text-transform: uppercase;
}

.compact-label-sub {
    font-size: 0.75rem;
    text-transform: uppercase;
}

.btn-cstm-submit:hover {
    background-color: #e68a2e !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 153, 51, 0.2);
}

.btn-reset-outline {
    border: 1px solid #64748b;
    color: #64748b;
    background: white;
    border-radius: 50px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-reset-outline:hover {
    background: #f8fafc;
    color: #334155;
    border-color: #334155;
}

.premium-input,
select.premium-input {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
    transition: all 0.2s;
    box-sizing: border-box;
}

.premium-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

/* Ensure select boxes match input field size exactly */
.form-select,
select.form-control,
select {
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    padding: 0.3rem 0.4rem !important;
    font-size: 0.8rem !important;
    height: calc(1.6rem + 2px) !important;
    line-height: 1 !important;
    transition: all 0.2s;
    box-sizing: border-box !important;
}

.form-select:focus,
select.form-control:focus,
select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
    outline: none !important;
}

/* New Theme Buttons and Colors */
.btn-indigo,
.btn-saffron {
    background: var(--primary) !important;
    color: white !important;
    border: none;
    transition: all 0.3s;
}

.btn-indigo:hover,
.btn-saffron:hover {
    background: var(--primary-light) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 153, 51, 0.3);
}

.btn-green {
    background: var(--secondary) !important;
    color: white !important;
    border: none;
}

.text-indigo-original,
.text-saffron {
    color: var(--primary) !important;
}

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

.bg-indigo-original {
    background-color: var(--indigo-original) !important;
    color: white !important;
}

.bg-secondary-theme {
    background-color: var(--secondary) !important;
    color: white !important;
}

.bg-light-gray {
    background-color: #f3f4f6 !important;
}

.report-header-premium {
    background-color: #e2e8f0 !important;
}

.report-header-premium span,
.report-header-premium i {
    color: #ffffff !important;
}

.table-head-premium th {
    background-color: #e2e8f0 !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.form-divider {
    border-top: 1px solid #f1f5f9;
    margin: 1.5rem 0;
}

.no-caret::after {
    display: none !important;
}

.cursor-pointer {
    cursor: pointer;
}

/* Global Checkbox and Switch Overrides */
.form-check-input:checked {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.form-check-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(217, 119, 6, 0.25) !important;
}

.form-switch .form-check-input:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e") !important;
}

.form-switch .form-check-input:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e") !important;
}

/* Global Hover and Active State Overrides */
.dropdown-item:hover,
.dropdown-item:focus {
    background-color: rgba(217, 119, 6, 0.15) !important;
    color: var(--primary) !important;
}

.dropdown-item:active {
    background-color: var(--primary) !important;
    color: white !important;
}

.dropdown-item i {
    transition: color 0.2s;
}

.dropdown-item:hover i,
.dropdown-item:focus i {
    color: var(--primary) !important;
}

.dropdown-item:active i {
    color: white !important;
}

/* Link Hover Colors */
a:hover {
    color: var(--primary-light) !important;
}

/* Header & Dropdown Fixes */
.main-wrapper header,
.main-wrapper .d-flex.justify-content-between.align-items-center.mb-2 {
    position: relative;
    z-index: 1050;
}

.main-header {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    z-index: 1020;
    background: rgba(241, 245, 249, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow: visible !important;
    transition: all 0.3s ease;
}

/* Adjust header when sidebar is collapsed */
.sidebar-collapsed .main-header {
    left: 70px;
}

/* Fix dropdown positioning context specific to header */
.main-header .dropdown-menu {
    margin-top: 0.5rem !important;
    right: 0 !important;
    left: auto !important;
    transform: none !important;
    /* Disable Popper.js transform if it's causing issues with sticky */
    top: 100% !important;
}

.dropdown-menu {
    z-index: 2000 !important;
    border: none;
    box-shadow:
        0 10px 25px -5px rgba(0, 0, 0, 0.1),
        0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
}

/* Premium Error Styling */
.premium-input.is-invalid {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23ef4444'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23ef4444' stroke='none'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right calc(0.375em + 0.1875rem) center !important;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem) !important;
    padding-right: calc(1.5em + 0.75rem) !important;
    box-shadow: 0 0 0 0.25rem rgba(239, 68, 68, 0.1) !important;
}

.invalid-feedback-premium {
    display: none;
    width: 100%;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: #ef4444;
    font-weight: 500;
    align-items: center;
    gap: 3px;
}

.is-invalid~.invalid-feedback-premium {
    display: flex !important;
}

/* Premium Breadcrumb Styles */
.breadcrumb-premium {
    background: transparent;
    padding: 0;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    align-items: center;
    /* Vertical Center */
}

.breadcrumb-premium .breadcrumb-item a {
    color: #64748b;
    transition: color 0.2s;
    font-weight: 500;
    text-decoration: none;
}

.breadcrumb-premium .breadcrumb-item a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.breadcrumb-premium .breadcrumb-item.active {
    color: var(--primary) !important;
    /* Info Color */
    font-weight: 600;
}

.breadcrumb-premium .breadcrumb-item+.breadcrumb-item::before {
    font-family: "Font Awesome 5 Free";
    content: "\f105";
    /* chevron-right */
    font-weight: 900;
    color: #cbd5e1;
    font-size: 0.75rem;
    padding-top: 1px;
}

/* Breadcrumb Wrapper - Outside Main Wrapper */
.breadcrumb-wrapper {
    margin-left: var(--sidebar-width);
    padding: 10px;
    position: fixed;
    top: 49px;
    /* Below header */
    left: 0;
    right: 0;
    background: rgba(241, 245, 249, 0.95);
    backdrop-filter: blur(8px);
    z-index: 1010;
    transition: all 0.3s ease;
}

.sidebar-collapsed .breadcrumb-wrapper {
    margin-left: 70px;
}

@media (max-width: 991px) {
    .breadcrumb-wrapper {
        margin-left: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 46px !important;
        padding: 6px 10px 4px 10px !important;
    }

    .main-wrapper {
        padding-top: 90px !important;
        margin-left: 0 !important;
    }
}

/* Standardized Custom Buttons */
.btn-cstm-submit {
    background: var(--primary);
    color: #fff !important;
    border: none !important;
    border-radius: 50px !important;
    padding: 6px 14px !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    box-shadow: 0 4px 10px rgba(217, 119, 6, 0.3);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.btn-cstm-reset {
    background: #343a40 !important;
    color: #f8f9fa !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 50px !important;
    padding: 6px 14px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.btn-cstm-cancel {
    background: #343a40 !important;
    color: #f8f9fa !important;
    border: none !important;
    border-radius: 50px !important;
    padding: 6px 14px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

/* Custom Card Header - Centralized Styling */
.card-header-cstm,
.glass-card .card-header-cstm {
    background: var(--indigo-original) !important;
    color: white !important;
    padding: 5px 12px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-radius: 10px 10px 0 0 !important;
    /* position: sticky !important; */
    top: 88px;
    z-index: 999;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.card-header-cstm .header-title {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-weight: bold !important;
    /* font-size: 0.95rem !important; */
}

.card-header-cstm .header-title i {
    font-size: 1rem !important;
}

.card-header-cstm .header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

/* Responsive adjustments for card header */
@media (max-width: 768px) {
    .card-header-cstm {
        padding: 8px 10px !important;
    }

    .card-header-cstm .header-title h6 {
        font-size: 0.85rem !important;
    }

    .card-header-cstm .header-title i {
        font-size: 0.9rem !important;
    }
}

/* Custom Back Button for Card Headers */
.btn-header-back {
    background: white !important;
    color: #1e293b !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 50px !important;
    padding: 3px 10px !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-header-back i {
    font-size: 12px;
}

/* Responsive adjustments for back button */
@media (max-width: 768px) {
    .btn-header-back {
        padding: 4px 10px !important;
        font-size: 12px !important;
        gap: 4px;
    }

    .btn-header-back i {
        font-size: 11px;
    }
}

/* Custom Gold Button for Export Report */
.btn-gold {
    background: var(--gold) !important;
    color: white !important;
    border: none !important;
    font-weight: 600 !important;
    padding: 5px 10px;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(217, 119, 6, 0.3);
}

.btn-gold:hover {
    background: var(--gold) !important;
    color: white !important;
    box-shadow: 0 6px 15px rgba(217, 119, 6, 0.4);
}

.btn-gold:active,
.btn-gold:focus {
    background: var(--gold) !important;
    color: white !important;
    box-shadow: 0 4px 10px rgba(217, 119, 6, 0.3);
}

/* Custom Compact Table Styling */
.table-cstm {
    font-size: 0.85rem !important;
}

.table-cstm thead tr {
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table-cstm thead th {
    padding: 0.6rem !important;
    background-color: #f8fafc !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

.table-cstm tbody tr {
    transition: all 0.2s ease;
}

.table-cstm tbody tr:hover {
    background-color: #f8fafc !important;
}

.table-cstm tbody td {
    padding: 0.35rem 0.6rem !important;
    vertical-align: middle !important;
}

.table-cstm .badge {
    font-size: 0.7rem !important;
    padding: 0.25rem 0.5rem !important;
}

.table-cstm .btn-sm {
    font-size: 0.75rem !important;
    /* padding: 0.25rem 0.75rem !important; */
}

/* Table action buttons */
.table-cstm .table-action-btn {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
    border-radius: 6px !important;
}

.table-col-id {
    background: var(--primary);
    padding: 4px 8px;
    border-radius: 8px;
    display: inline-block;
    font-size: 10px;
    color: #fff;
}

.x-small {
    font-size: 0.7rem !important;
}

/* Dropdown Toggle Isolation */
.nav-dropdown-toggle {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.4rem 0.7rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    text-decoration: none;
}

.nav-dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-dropdown-toggle.active {
    background: rgba(217, 119, 6, 0.15);
    color: var(--primary);
    font-weight: 600;
    border-left: 4px solid var(--primary);
    border-radius: 0 12px 12px 0;
    margin-left: -1.5rem;
    padding-left: 2.2rem;
}

.nav-dropdown-toggle i {
    width: 20px;
}

/* Handle .nav-dropdown-toggle in collapsed sidebar */
.sidebar-collapsed .sidebar .nav-dropdown-toggle span,
.sidebar-collapsed .sidebar .nav-dropdown-toggle .fa-chevron-down {
    display: none;
}

.sidebar-collapsed .sidebar .nav-dropdown-toggle {
    justify-content: center;
}

/* Global Overrides for SweetAlert2 Buttons */
.swal2-popup {
    border-radius: 20px !important;
    padding: 1.5rem !important;
    font-family: 'Inter', sans-serif !important;
}

.swal2-title {
    color: #334155 !important;
    font-weight: 700 !important;
    margin-bottom: 0.5rem !important;
}

.swal2-html-container {
    color: #64748b !important;
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
}

.swal2-actions {
    gap: 6px !important;
    /* margin-top: 1.5rem !important; */
}

.swal2-styled.swal2-confirm {
    background-color: #ff9933 !important;
    border-radius: 50px !important;
    /* padding: 0.6rem 1.8rem !important; */
    font-weight: 700 !important;
    font-size: 0.9rem !important;
    box-shadow: 0 4px 15px rgba(255, 153, 51, 0.3) !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    min-height: 42px !important;
}

/* Add check icon to confirm button */
.swal2-styled.swal2-confirm::before {
    content: "\f058";
    font-family: "Font Awesome 5 Free";
    font-weight: 400;
    font-size: 1rem;
}

.swal2-styled.swal2-cancel {
    background-color: #334155 !important;
    border-radius: 50px !important;
    padding: 0.6rem 1.8rem !important;
    font-weight: 700 !important;
    font-size: 0.9rem !important;
    border: none !important;
    min-height: 42px !important;
}

.swal2-icon {
    border-width: 3px !important;
    margin: 1rem auto 1.5rem !important;
}

.swal2-icon.swal2-warning {
    border-color: #ff9933 !important;
    color: #ff9933 !important;
}

.swal2-icon.swal2-success {
    border-color: #10b981 !important;
}

.swal2-icon.swal2-success [class^='swal2-success-line'] {
    background-color: #10b981 !important;
}

.swal2-icon.swal2-success .swal2-success-ring {
    border: .25em solid rgba(16, 185, 129, .3) !important;
}

/* ==========================================
   GLOBAL TABLE RESPONSIVENESS & SCROLLING
   ========================================== */

/* The table container MUST have these to trigger horizontal scroll correctly */
.table-responsive {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    position: relative;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 5px;
    min-width: 0 !important;
}

/* Force X-Scroll for better layout on big tables (excluding modals for compact view) */
.table-cstm:not(.modal-body *) {
    width: 100% !important;
    min-width: 1250px !important;
    table-layout: auto !important;
}

/* Compact version for modals or small areas */
.modal-body .table-cstm {
    min-width: 0 !important;
    width: 100% !important;
}

.table-cstm th,
.table-cstm td {
    white-space: nowrap !important;
    padding: 10px 12px !important;
}

/* Custom scrollbar for all scrollable areas within glass cards */
.table-responsive,
.glass-card>form,
.glass-card>div {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.table-responsive::-webkit-scrollbar,
.glass-card>form::-webkit-scrollbar,
.glass-card>div::-webkit-scrollbar {
    height: 10px !important;
    width: 8px !important;
}

.table-responsive::-webkit-scrollbar-track,
.glass-card>form::-webkit-scrollbar-track,
.glass-card>div::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.table-responsive::-webkit-scrollbar-thumb,
.glass-card>form::-webkit-scrollbar-thumb,
.glass-card>div::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
    border: 2px solid #f1f5f9;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.glass-card>form::-webkit-scrollbar-thumb:hover,
.glass-card>div::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Premium Sticky Headers for all tables */
.table-cstm thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 10;
    background: #f8fafc !important;
    box-shadow: inset 0 -1px 0 #dee2e6, 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}

/* Fixed Pagination at bottom */
.card-footer-pagination {
    flex-shrink: 0;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 0.5rem;
}

/* ==========================================
   PREMIUM FIXED LAYOUT & VERTICAL FILL (DESKTOP)
   ========================================== */
/* Apply full-height fixed layout ONLY if body has .full-layout class */
@media (min-width: 992px) {
    body.full-layout {
        height: 100vh !important;
        overflow: hidden !important;
        width: 100vw !important;
    }

    body.full-layout .main-wrapper {
        height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        padding-top: 98px !important;
        margin-left: var(--sidebar-width) !important;
        max-width: calc(100vw - var(--sidebar-width)) !important;
    }

    /* Target rows that are meant to fill height (Report/Entry pages usually have one col-12) */
    body.full-layout .main-wrapper>.row:has(.glass-card) {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        min-height: 0;
    }

    body.full-layout .main-wrapper>.row>[class*="col-"]:has(.glass-card) {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        min-height: 0;
    }

    /* Glass cards should stretch to fill height in full-layout */
    body.full-layout .glass-card {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        margin-bottom: 0px !important;
    }

    /* Simple chain: Header is fixed, main content grows and scrolls */
    body.full-layout .card-header-cstm,
    body.full-layout .sticky-desktop,
    body.full-layout .sticky-top,
    body.full-layout .bg-light {
        flex: 0 0 auto !important;
        flex-grow: 0 !important;
        flex-shrink: 0 !important;
    }

    body.full-layout .glass-card>form,
    body.full-layout .glass-card>div:not(.card-header-cstm):not(.card-footer-pagination):not(.sticky-desktop):not(.sticky-top):not(.bg-light) {
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        min-height: 0;
    }

    /* Target specific scroll areas for redundancy */
    body.full-layout .table-responsive,
    body.full-layout .product-scroll-area {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        min-height: 0;
    }

    /* Ensure internal sticky elements work */
    body.full-layout .sticky-top,
    body.full-layout .sticky-desktop {
        top: 0 !important;
        position: sticky !important;
        z-index: 1020;
    }
}

/* Master Cards & Dashboard KPI Fix: Ensure they don't stretch */
/* Dashboard KPI Fix: Ensure they don't stretch */
.kpi-card .value {
    font-size: 1.8rem !important;
    margin: 0 !important;
}

/* Master Cards & Standard Grid: Strict restoration */
.main-wrapper:not(.full-layout) .glass-card {
    height: auto !important;
    margin-bottom: 1.5rem !important;
}

/* Global Reset Button Hover Fix: Ensure icon and text are white */
.btn-outline-secondary:hover,
.btn-outline-secondary:hover i,
a[title="Reset"]:hover,
a[title="Reset"]:hover i,
button[title="Reset"]:hover,
button[title="Reset"]:hover i {
    color: #ffffff !important;
    background-color: #6c757d !important;
    /* Bootstrap secondary color */
}