/* Global Design Tokens & Variables */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar-start: #173b9c;
    --sidebar-end: #1e40af;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #172554;
    --muted: #64748b;
    --background: #f5f7fb;
    --card: #ffffff;
    --border: #e5e7eb;
    
    --foreground: #0f172a;
    --card-foreground: #0f172a;
    --popover: #ffffff;
    --popover-foreground: #0f172a;
    --input: #ced4da;
    --ring: #2563eb;
    --radius: 8px;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --sidebar-width: 248px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
}

/* Global Dark Mode Overrides */
.dark {
    --background: #0f172a;
    --foreground: #f8fafc;
    --card: #1e293b;
    --card-foreground: #f8fafc;
    --popover: #1e293b;
    --popover-foreground: #f8fafc;
    --muted: #94a3b8;
    --muted-foreground: #94a3b8;
    --border: #334155;
    --input: #334155;
    --text: #f8fafc;
    --background-alt: rgba(255, 255, 255, 0.04);
}

.dark body {
    background-color: #0f172a !important;
    color: #f8fafc !important;
}

.dark .card-container,
.dark .card,
.dark .app-header,
.dark .dropdown-menu-container {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

.dark input,
.dark select,
.dark textarea,
.dark .form-control {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

.dark .custom-table {
    color: #f8fafc !important;
}

.dark .custom-table th {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

.dark .custom-table td {
    border-color: #334155 !important;
    color: #f8fafc !important;
}

.dark .custom-table tr:hover {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

/* Reset and Core Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font-family: inherit;
}

/* Application Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Fixed Sidebar Styling */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-start) 0%, var(--sidebar-end) 100%);
    color: rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.05);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.15);
}

.sidebar-logo {
    font-weight: 700;
    font-size: 1.25rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
    flex-grow: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

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

/* Sidebar Section Headers */
.sidebar-section-header {
    font-size: 0.675rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.45);
    margin: 1.25rem 1.25rem 0.5rem 1.25rem;
    white-space: nowrap;
}
.sidebar.collapsed .sidebar-section-header {
    display: none;
}

.sidebar-item {
    margin: 0.25rem 0.75rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    font-size: 0.925rem;
    gap: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}

.sidebar-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.06);
}

.sidebar-item.active > .sidebar-link,
.sidebar-item.active > .dropdown-toggle {
    color: #ffffff !important;
    background-color: var(--primary) !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-link span {
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-link span {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.sidebar.collapsed .sidebar-logo span {
    display: none;
}

/* Sidebar Dropdown Menu styling */
.sidebar-item.dropdown {
    display: flex;
    flex-direction: column;
}

.sidebar-link.dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    cursor: pointer;
    user-select: none;
}

.sidebar-link.dropdown-toggle .chevron {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    opacity: 0.7;
}

.sidebar-item.dropdown.open > .dropdown-toggle .chevron {
    transform: rotate(180deg);
}

.sidebar-sub-menu {
    list-style: none;
    padding-left: 1.5rem;
    margin: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-in-out;
    max-height: 0; /* Default collapsed */
}
.sidebar-item.dropdown.open > .sidebar-sub-menu {
    max-height: 800px;
}
.sidebar.collapsed .sidebar-sub-menu {
    display: none !important;
}

/* Submenu Links */
.sub-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    border-radius: var(--radius);
    gap: 0.5rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.sub-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.sub-link.active, .sub-item-active {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.12) !important;
    font-weight: 500;
}

/* Sidebar Plan card */
.sidebar-footer-plan {
    margin: 1rem;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    text-align: center;
}
.sidebar.collapsed .sidebar-footer-plan {
    display: none;
}

/* Sidebar Collapsed Dropdown Overlay (Desktop Only) */
@media (min-width: 769px) {
    .sidebar.collapsed .sidebar-item.dropdown {
        position: relative;
    }
    
    .sidebar.collapsed .sidebar-item.dropdown .chevron {
        display: none !important;
    }
}

/* Main Content Area */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    background-color: var(--background);
}

.sidebar.collapsed ~ .main-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

/* Sticky Header / Topbar Styling */
.app-header {
    height: var(--header-height);
    background-color: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow-sm);
    color: var(--foreground);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.toggle-sidebar-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--muted);
    transition: color 0.2s ease;
}
.toggle-sidebar-btn:hover {
    color: var(--primary);
}

.header-fy {
    font-size: 0.85rem;
    color: var(--muted);
    background-color: var(--muted-foreground);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    background: var(--background);
    border: 1px solid var(--border);
}
.header-fy strong {
    color: var(--primary);
}

/* Center Search Container */
.header-center {
    flex-grow: 1;
    max-width: 400px;
    margin: 0 2rem;
}

.search-box-container {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.9rem;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    outline: none;
    background-color: var(--background);
    color: var(--foreground);
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: var(--primary);
    background-color: var(--card);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--muted);
    position: relative;
    transition: color 0.2s ease;
}
.icon-btn:hover {
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

/* Reusable Profile Dropdown Layout */
.profile-trigger-container,
.notification-trigger-container {
    position: relative;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    transition: background-color 0.2s ease;
}
.user-profile:hover {
    background-color: var(--background);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info-text {
    text-align: left;
}
@media(max-width: 768px) {
    .user-info-text, .header-center {
        display: none;
    }
}

.dropdown-arrow {
    font-size: 0.75rem;
    color: var(--muted);
}

/* Dropdown Container */
.dropdown-menu-container {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 240px;
    display: none;
    z-index: 1100;
    animation: dropdownFade 0.2s ease;
}

.dropdown-menu-container.open {
    display: block !important;
}

@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Settings Navigation Sidebar Tabs */
.settings-nav-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.85rem 1rem;
    border: none;
    background: transparent;
    color: var(--foreground);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.settings-nav-btn:hover {
    background-color: var(--background-alt, rgba(0, 0, 0, 0.04));
    color: var(--primary);
}

.settings-nav-btn.active {
    background-color: var(--primary);
    color: #ffffff !important;
    font-weight: 600;
}

.settings-nav-btn.active .nav-chevron {
    transform: rotate(90deg);
    color: #ffffff !important;
}

.settings-nav-btn.active i {
    color: #ffffff !important;
}

.nav-chevron {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    transition: transform 0.2s ease;
}

.dropdown-list {
    list-style: none;
    padding: 0.35rem 0;
    margin: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
    transition: background-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: var(--background-alt, rgba(0, 0, 0, 0.05));
    color: var(--primary);
}

.dropdown-item i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    color: var(--muted-foreground);
    transition: color 0.15s ease;
}

.dropdown-item:hover i {
    color: var(--primary);
}

/* Theme Switch Toggle */
.theme-switch {
    width: 34px;
    height: 20px;
    background-color: #cbd5e1;
    border-radius: 10px;
    position: relative;
    transition: background-color 0.2s ease;
}
.theme-switch.active {
    background-color: var(--primary);
}
.switch-handle {
    width: 14px;
    height: 14px;
    background-color: #ffffff;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform 0.2s ease;
}
.theme-switch.active .switch-handle {
    transform: translateX(14px);
}

/* Notification Dropdown Custom */
#notification-dropdown {
    width: 300px;
}
.dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dropdown-body {
    max-height: 250px;
    overflow-y: auto;
}

/* Content Body */
.content-body {
    padding: 2rem;
    flex-grow: 1;
}

/* Modern Welcome section */
.dashboard-welcome {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Modern Card Containers */
.card-container {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--foreground);
}

.card-body {
    padding: 1.5rem;
}

/* Dashboard Cards Grid & Custom KPI cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 0.25rem;
}

.stat-card-footer {
    font-size: 0.75rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-card-trend {
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.stat-card-trend.up {
    color: var(--success);
}
.stat-card-trend.down {
    color: var(--danger);
}

/* Stat card KPI colored boundaries (Matching screenshot) */
.kpi-sales { border-left: 4px solid var(--primary); }
.kpi-purchases { border-left: 4px solid #10b981; }
.kpi-collections { border-left: 4px solid #8b5cf6; }
.kpi-alerts { border-left: 4px solid var(--warning); }
.kpi-receivable { border-left: 4px solid var(--primary); }
.kpi-payable { border-left: 4px solid var(--danger); }
.kpi-stock { border-left: 4px solid var(--success); }
.kpi-profit { border-left: 4px solid #06b6d4; }

/* Page Header & Breadcrumb */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--foreground);
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

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

/* Beautiful Action Buttons System */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 0.5rem;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}
.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.btn-secondary {
    background-color: var(--card);
    color: var(--foreground);
    border-color: var(--border);
}
.btn-secondary:hover {
    background-color: var(--background);
    border-color: var(--muted);
}

.btn-success {
    background-color: var(--success);
    color: #ffffff;
}
.btn-success:hover {
    filter: brightness(1.05);
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}
.btn-danger:hover {
    filter: brightness(1.05);
}

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

/* Tables Custom design */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    border-radius: var(--radius);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    background-color: var(--card);
}

.custom-table th {
    background-color: #222222;
    color: #ffffff;
    padding: 1rem;
    font-weight: 600;
    font-size: 0.825rem;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.dark .custom-table th {
    background-color: #111827;
}

.custom-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    vertical-align: middle;
    color: var(--foreground);
}

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

.custom-table tbody tr:hover {
    background-color: var(--background);
}

/* Badges / Pill badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.725rem;
    font-weight: 600;
    border-radius: 9999px;
    gap: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: rgba(22, 163, 74, 0.12);
    color: var(--success);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

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

.badge-info {
    background-color: rgba(37, 99, 235, 0.12);
    color: var(--primary);
}

/* Beautiful Forms Elements */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--foreground);
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--card);
    color: var(--foreground);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Grid Layouts for Forms */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

/* Modern Toast Toast Alert notifications */
.toast-wrapper {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-item {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 450px;
    animation: toastSlideIn 0.3s ease;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-item.success {
    border-left: 4px solid var(--success);
}
.toast-item.success i {
    color: var(--success);
}

.toast-item.error {
    border-left: 4px solid var(--danger);
}
.toast-item.error i {
    color: var(--danger);
}

.toast-item.info {
    border-left: 4px solid var(--primary);
}
.toast-item.info i {
    color: var(--primary);
}

.toast-message {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    flex-grow: 1;
}

.toast-close-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
}
.toast-close-btn:hover {
    color: var(--foreground);
}

/* Empty States component */
.empty-state-container {
    padding: 3rem 1.5rem;
    text-align: center;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--muted);
    opacity: 0.6;
}

/* Footer layout */
.app-footer {
    height: 60px;
    border-top: 1px solid var(--border);
    background-color: var(--card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: auto;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Table Toolbars */
.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
    .sidebar {
        left: -var(--sidebar-width);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-wrapper {
        margin-left: 0 !important;
        width: 100%;
    }
    
    .app-header {
        padding: 0 1rem;
    }
    
    .content-body {
        padding: 1rem;
    }
    
    .app-footer {
        padding: 1rem;
        height: auto;
        flex-direction: column;
        text-align: center;
    }
}

/* Glassmorphism Unified Login Screen Styles */
/* Premium Split-Card Login Screen Styles (Inspired by Reference Image) */
.login-page-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 2rem;
    font-family: 'Inter', sans-serif;
    /* Soft textured look using CSS gradients matching cyan and sand themes */
    background: radial-gradient(circle at 10% 20%, rgba(224, 242, 254, 0.8) 0%, rgba(254, 243, 199, 0.8) 90%),
                linear-gradient(135deg, #e0f2fe 0%, #fef3c7 100%);
    background-size: cover;
    background-position: center;
}

.login-split-container {
    display: flex;
    width: 100%;
    max-width: 980px;
    min-height: 620px;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
    position: relative;
}

/* Thin border line that wraps around inside the main card frame */
.login-split-container::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    pointer-events: none;
    z-index: 10;
}

/* Left Login Form Column */
.login-form-panel {
    width: 44%;
    background: #ffffff;
    padding: 3.5rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 5;
    border-radius: 28px 0 0 28px;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.02);
}

.login-brand-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.login-brand-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.95rem;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.login-brand-name {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.5px;
}

/* Two-tone artistic Welcome heading */
.welcome-text {
    font-family: 'Caveat', 'Pacifico', cursive;
    font-size: 5.25rem;
    font-weight: 700;
    line-height: 1;
    margin-top: 0;
    margin-bottom: 2rem;
    letter-spacing: -0.5px;
    user-select: none;
    transform: rotate(-3deg);
    display: inline-block;
}

.welcome-text span.blue-part {
    color: #0284c7;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-text span.orange-part {
    color: #f97316;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-left: 0.2rem;
}

/* Form Styling */
.login-form-group {
    margin-bottom: 1.25rem;
}

.login-form-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 0.5rem;
    color: #64748b;
}

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

.login-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    font-size: 0.95rem;
    color: #0f172a;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
}

.login-input:focus {
    background-color: #ffffff;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.08);
}

.login-input-icon {
    position: absolute;
    left: 1rem;
    color: #94a3b8;
    font-size: 0.95rem;
    pointer-events: none;
    transition: color 0.3s ease;
}

.login-input:focus ~ .login-input-icon {
    color: #0ea5e9;
}

/* Inline Right Action Button */
.login-input-action {
    position: absolute;
    right: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #0284c7;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    transition: color 0.2s ease;
}

.login-input-action:hover {
    color: #0369a1;
}

/* Checkbox and links alignment */
.login-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.login-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: #64748b;
    cursor: pointer;
    user-select: none;
}

.login-checkbox {
    width: 16px;
    height: 16px;
    accent-color: #0ea5e9;
    cursor: pointer;
}

/* Submit Button */
.login-submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 0.85rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(14, 165, 233, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 20px -3px rgba(14, 165, 233, 0.4);
}

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

/* Social Logins Divider */
.login-social-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.75rem 0;
    color: #94a3b8;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-social-divider::before,
.login-social-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}

.login-social-divider:not(:empty)::before {
    margin-right: .75em;
}

.login-social-divider:not(:empty)::after {
    margin-left: .75em;
}

/* Social Login Pills */
.login-social-grid {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.login-social-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    max-width: 80px;
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    border-radius: 50px;
    color: #64748b;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.login-social-pill:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
    transform: translateY(-1px);
}

/* Django Message Container for Errors */
.login-error-container {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.82rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Right Illustration Panel Column */
.login-illustration-panel {
    width: 56%;
    background-image: url('../image/login_illustration.jpg');
    background-size: cover;
    background-position: center;
    border-radius: 0 28px 28px 0;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.5rem;
}

.login-illustration-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.05) 0%, rgba(15, 23, 42, 0.15) 100%);
    border-radius: 0 28px 28px 0;
    pointer-events: none;
    z-index: 1;
}

/* Glassmorphic Navbar on Illustration Panel */
.login-nav-header {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.login-nav-links {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.login-nav-link {
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: opacity 0.2s ease;
}

.login-nav-link:hover {
    opacity: 0.8;
}

.login-nav-menu-btn {
    color: #ffffff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.login-nav-menu-btn:hover {
    opacity: 0.8;
}

/* Waves Effect overlapping bottom edge */
.login-waves-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    overflow: hidden;
    line-height: 0;
}

.login-waves-container svg {
    position: relative;
    display: block;
    width: 100%;
    height: 70px;
}

/* Responsive Media Queries */
@media (max-width: 960px) {
    .login-split-container {
        max-width: 480px;
        flex-direction: column;
        min-height: auto;
        border-radius: 24px;
        margin: 1rem auto;
    }

    .login-split-container::before {
        border-radius: 18px;
    }

    .login-form-panel {
        width: 100%;
        border-radius: 24px;
        padding: 3rem 2.25rem;
    }

    .login-illustration-panel {
        display: none;
    }
}

@media (max-width: 480px) {
    .login-page-body {
        padding: 1rem;
    }
    
    .login-form-panel {
        padding: 2.25rem 1.5rem;
    }
    
    .welcome-text {
        font-size: 4.25rem;
        margin-bottom: 1.5rem;
    }
}

/* Customer Autocomplete Dropdown Widget */
.customer-autocomplete-group {
    position: relative;
    overflow: visible !important;
}

.customer-search-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
}

.customer-search-wrapper input {
    padding-right: 2.25rem;
}

.customer-dropdown-icon {
    position: absolute;
    right: 0.85rem;
    font-size: 0.8rem;
    color: var(--muted);
    pointer-events: none;
}

.customer-clear-btn {
    position: absolute;
    right: 2rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.customer-clear-btn:hover {
    color: var(--danger);
}

/* Ensure Parent Cards/Rows do not clip the Autocomplete dropdown */
.card-container, .card-body, .form-row {
    overflow: visible !important;
}

.customer-dropdown-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 9999 !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2) !important;
    max-height: 280px;
    overflow-y: auto;
}

.customer-result-item {
    padding: 0.65rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s ease;
    background-color: #ffffff;
}

.customer-result-item:last-child {
    border-bottom: none;
}

.customer-result-item:hover, .customer-result-item.highlighted {
    background-color: #f1f5f9 !important;
}

.customer-result-item .cust-name {
    font-weight: 600;
    color: #0f172a !important;
    font-size: 0.9rem;
}

.customer-result-item .cust-meta {
    font-size: 0.75rem;
    color: #64748b !important;
}

.customer-opt-other {
    padding: 0.75rem 1rem;
    background-color: #f8fafc !important;
    color: #2563eb !important;
    cursor: pointer;
    font-weight: 600;
    border-top: 2px solid #e2e8f0 !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    position: sticky;
    bottom: 0;
}

.customer-opt-other:hover, .customer-opt-other.highlighted {
    background-color: #eff6ff !important;
}

/* Modal Styling for Quick Customer Add — SOLID WHITE MODAL */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: none !important; /* NO glass blur */
    -webkit-backdrop-filter: none !important;
    z-index: 99999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: #ffffff !important; /* SOLID WHITE */
    color: #0f172a !important;
    border-radius: 8px !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.08) !important;
    max-height: 85vh;
    overflow-y: auto;
    width: 90%;
    max-width: 550px;
}

.modal-card input, .modal-card select, .modal-card textarea {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

.modal-card input:focus, .modal-card select:focus, .modal-card textarea:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

/* Sidebar True Black Dark Mode */
.dark .sidebar {
    background: #000000 !important;
}
.dark .sidebar-header {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

/* Modal Dark Mode Fixes */
.dark .modal-card {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
}
.dark .modal-card input,
.dark .modal-card select,
.dark .modal-card textarea {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
}

/* AJAX Pagination Styles */
.table-container-ajax {
    position: relative;
}

.ajax-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.dark .ajax-loader {
    background: rgba(15, 23, 42, 0.4);
}

.spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Print view optimization */
@media print {
    .sidebar, .app-header, .page-header, .card-container form, .pagination-container, .export-btn-group, .empty-state-pagination, footer {
        display: none !important;
    }
    .main-wrapper {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .card-container {
        border: none !important;
        box-shadow: none !important;
        background: #ffffff !important;
        color: #000000 !important;
    }
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .custom-table th {
        background-color: #f1f5f9 !important;
        color: #000000 !important;
        border-bottom: 2px solid #000000 !important;
    }
}

/* Antigravity Custom Utilities */
.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
@media (max-width: 768px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}
.col-span-2 {
    grid-column: span 2;
}
@media (max-width: 768px) {
    .col-span-2 {
        grid-column: span 1;
    }
}

/* Invalid form controls error highlights */
.has-error .form-control,
.has-error input,
.has-error select,
.has-error textarea {
    border-color: var(--danger) !important;
    background-color: rgba(239, 68, 68, 0.02) !important;
}
.has-error .form-control:focus,
.has-error input:focus,
.has-error select:focus,
.has-error textarea:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}
.field-error-message {
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.25rem;
    display: block;
}

/* Collapsible card / accordion transitions */
.collapsible-card-body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0 1.5rem;
    transition: max-height 0.25s ease-out, opacity 0.2s ease-out, padding 0.25s ease-out;
}
.collapsible-card-body.open {
    max-height: 800px;
    opacity: 1;
    padding: 1.5rem;
    transition: max-height 0.25s ease-in, opacity 0.2s ease-in, padding 0.25s ease-in;
}

/* Show/hide password style */
.password-input-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.password-input-container input {
    padding-right: 2.5rem;
}
.password-toggle-btn {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.95rem;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}
.password-toggle-btn:hover {
    color: var(--primary);
}
.dark .password-toggle-btn {
    color: var(--muted-foreground);
}
.dark .password-toggle-btn:hover {
    color: var(--primary);
}

/* Custom form card titles style */
.form-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
    grid-column: span 2;
}
@media (max-width: 768px) {
    .form-section-title {
        grid-column: span 1;
    }
}

