/* =============================================
   ERP System - Custom Styles
   Modern Admin Dashboard Theme
   ============================================= */

:root {
    --sidebar-width: 250px;
    --sidebar-collapsed: 60px;
    --navbar-height: 56px;
    
    /* Light Theme (Day) */
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --primary-rgb: 79, 70, 229;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --dark: #1e293b;
    --darker: #0f172a;
    --light: #f8fafc;
    --border: #e2e8f0;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-navbar: #ffffff;
    --bg-sidebar: #0f172a;
    --text-main: #1e293b;
    --text-muted: #64748b;
    
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all .2s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --achar-color: #f59e0b;
    --shutki-color: #06b6d4;
}

[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-navbar: #1e293b;
    --bg-sidebar: #0f172a;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --light: #334155;
    --dark: #f1f5f9;
    --shadow: 0 1px 3px rgba(0,0,0,.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,.4);
}

/* Global Dark Theme Overrides */
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-card.bg-white,
html[data-theme="dark"] .widget-card.bg-white { background-color: var(--bg-card) !important; color: var(--text-main) !important; }

html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .drawer-body { background-color: var(--bg-body) !important; color: var(--text-main) !important; }

html[data-theme="dark"] .card-header.bg-white,
html[data-theme="dark"] .modal-header.bg-white,
html[data-theme="dark"] .drawer-header { background-color: transparent !important; border-bottom-color: var(--border) !important; }

html[data-theme="dark"] .btn-light { background-color: var(--light) !important; border-color: var(--border) !important; color: var(--text-main) !important; }
html[data-theme="dark"] .btn-light:hover { background-color: #3f4e66 !important; }

html[data-theme="dark"] .text-dark,
html[data-theme="dark"] .journey-value { color: var(--text-main) !important; }

html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .form-text,
html[data-theme="dark"] .help-block,
html[data-theme="dark"] .small { color: var(--text-muted) !important; }

html[data-theme="dark"] .form-label { color: var(--text-main) !important; }

html[data-theme="dark"] .border-start, 
html[data-theme="dark"] .border-end, 
html[data-theme="dark"] .border-bottom, 
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .drawer-section { border-color: var(--border) !important; }

html[data-theme="dark"] .drawer-section { background-color: var(--bg-card) !important; }

html[data-theme="dark"] .product-row:hover,
html[data-theme="dark"] .inventory-row:hover,
html[data-theme="dark"] .table tbody tr:hover,
html[data-theme="dark"] .table-hover tbody tr:hover { background-color: rgba(var(--primary-rgb), 0.08) !important; color: var(--text-main) !important; }

html[data-theme="dark"] .table { color: var(--text-main) !important; }
html[data-theme="dark"] .table td, html[data-theme="dark"] .table th { border-color: var(--border) !important; }

html[data-theme="dark"] .modal-content { background-color: var(--bg-card); color: var(--text-main); border: 1px solid var(--border); }
html[data-theme="dark"] hr { border-color: var(--border); opacity: 1; }

/* Theme Toggle Button Styling */
#themeToggle {
    border-radius: 50%;
    width: 38px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--primary-rgb), 0.05);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#themeToggle:hover {
    background: rgba(var(--primary-rgb), 0.15);
    transform: rotate(15deg);
}

/* Fail-Safe Theme Icon Control */
.bi-sun-fill { display: inline-block; }
.bi-moon-stars-fill { display: none !important; }

html[data-theme="dark"] .bi-sun-fill { display: none !important; }
html[data-theme="dark"] .bi-moon-stars-fill { display: inline-block !important; }

* { box-sizing: border-box; }
body {
    font-family: var(--font);
    background: var(--bg-body);
    margin: 0;
    padding: 0;
    font-size: 14px;
    color: var(--text-main);
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* =============================================
   APP LAYOUT
   ============================================= */
.app-wrapper { min-height: 100vh; }
.app-body { display: flex; padding-top: var(--navbar-height); min-height: 100vh; }

/* =============================================
   TOP NAVBAR
   ============================================= */
.top-navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1040;
    height: var(--navbar-height);
    background: var(--bg-navbar);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px;
    box-shadow: var(--shadow);
    transition: background 0.3s ease, border-color 0.3s ease;
}
.navbar-left, .navbar-right { display: flex; align-items: center; gap: 12px; }
@media (max-width: 767px) {
    .navbar-right { gap: 4px; }
    .navbar-left { gap: 6px; }
}
.navbar-center { display: flex; align-items: center; }

.sidebar-toggle {
    color: var(--dark); text-decoration: none; padding: 4px 8px;
    border-radius: var(--radius); transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--light); color: var(--primary); }

.brand-text { font-size: 16px; color: var(--dark); }

/* Category Filter */
.category-filter .btn { font-size: 12px; padding: 4px 12px; font-weight: 500; border-radius: 20px; }
.category-filter .btn-group { gap: 2px; }

/* Notification */
.notification-btn {
    position: relative; color: var(--secondary); text-decoration: none;
    padding: 6px 10px; border-radius: var(--radius); transition: var(--transition);
}
.notification-btn:hover { background: var(--light); color: var(--primary); }
.notification-badge {
    position: absolute; top: 2px; right: 2px;
    font-size: 10px; padding: 2px 5px; border-radius: 10px;
}
.notification-dropdown { width: 320px; max-height: 400px; overflow-y: auto; padding: 0; }
.notification-item { display: flex; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.notification-item.unread { background: rgba(var(--primary-rgb), 0.05); }
.notif-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: var(--light); border-radius: 50%; flex-shrink: 0; }
.notif-title { font-size: 13px; font-weight: 500; }
.notif-time { font-size: 11px; color: var(--secondary); }

/* User Menu */
.user-menu-btn {
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; color: var(--dark); padding: 4px 8px;
    border-radius: var(--radius); transition: var(--transition);
}
.user-menu-btn:hover { background: var(--light); }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
}
.user-name { font-size: 13px; font-weight: 500; }

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
    position: fixed; top: var(--navbar-height); left: 0; bottom: 0;
    width: var(--sidebar-width); background: var(--bg-sidebar);
    z-index: 1030; overflow-y: auto; overflow-x: hidden;
    transition: var(--transition);
    scrollbar-width: thin; scrollbar-color: #334155 transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.sidebar-header {
    padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    color: #fff; font-size: 18px; font-weight: 700;
}
.sidebar-logo i { font-size: 22px; color: var(--primary-light); }

.sidebar-nav { padding: 8px 0; }
.nav-list { list-style: none; padding: 0; margin: 0; }

.nav-section {
    padding: 16px 20px 6px; font-size: 10px; font-weight: 600;
    color: #64748b; letter-spacing: 1.2px; text-transform: uppercase;
}

.nav-item a {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 20px; color: #94a3b8; text-decoration: none;
    font-size: 13px; font-weight: 400; transition: var(--transition);
    border-left: 3px solid transparent;
}
.nav-item a:hover { color: #e2e8f0; background: rgba(255,255,255,0.04); }
.nav-item.active a {
    color: #fff; background: rgba(var(--primary-rgb), 0.15);
    border-left-color: var(--primary-light); font-weight: 500;
}
.nav-item a i { font-size: 16px; width: 20px; text-align: center; }

/* Sidebar collapsed */
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .nav-item a span { display: none; }
.sidebar.collapsed .nav-item a { justify-content: center; padding: 12px; border-left-width: 0; }
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
    flex: 1; margin-left: var(--sidebar-width);
    transition: var(--transition);
    min-width: 0;
}

.page-header {
    padding: 20px 24px 0;
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 22px; font-weight: 700; margin: 0; color: var(--text-main); }
.page-header .breadcrumb { margin: 0; font-size: 12px; }
.page-header .breadcrumb a { color: var(--primary); text-decoration: none; }

.content-wrapper { padding: 20px 24px; }

/* =============================================
   CARDS
   ============================================= */
.card {
    border: none; border-radius: var(--radius-lg);
    box-shadow: var(--shadow); background: var(--bg-card);
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    background: transparent; border-bottom: 1px solid var(--border);
    padding: 16px 20px; font-weight: 600; color: var(--text-main);
}
.card-body { padding: 20px; color: var(--text-main); }

/* KPI / Stat Cards */
.stat-card {
    border: none; border-radius: var(--radius-lg);
    padding: 20px; background: var(--bg-card);
    box-shadow: var(--shadow); transition: var(--transition);
    position: relative; overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card .stat-icon {
    width: 48px; height: 48px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin-bottom: 12px;
    opacity: 0.9;
}
.stat-card .stat-value { font-size: 24px; font-weight: 700; margin: 0; color: var(--dark); }
.stat-card .stat-label { font-size: 12px; color: var(--secondary); font-weight: 500; margin-top: 4px; }
.stat-card .stat-change {
    font-size: 11px; font-weight: 600; margin-top: 8px; display: flex; align-items: center; gap: 4px;
}
.stat-card .stat-change.up { color: var(--success); }
.stat-card .stat-change.down { color: var(--danger); }

.stat-card.gradient-primary { background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); }
.stat-card.gradient-success { background: linear-gradient(135deg, #10b981 0%, #34d399 100%); }
.stat-card.gradient-warning { background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%); }
.stat-card.gradient-danger { background: linear-gradient(135deg, #f43f5e 0%, #fb7185 100%); }
.stat-card.gradient-info { background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%); }
.stat-card.gradient-indigo { background: linear-gradient(135deg, #4f46e5 0%, #818cf8 100%); }
.stat-card.gradient-rose { background: linear-gradient(135deg, #e11d48 0%, #fda4af 100%); }
.stat-card.gradient-purple { background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%); }
.stat-card.gradient-dark { background: linear-gradient(135deg, #0f172a 0%, #334155 100%); }

/* Card Tinted Styles (Modern Glassmorphism) */
.stat-card.tint-primary { background-color: rgba(99, 102, 241, 0.05); }
.stat-card.tint-success { background-color: rgba(16, 185, 129, 0.05); }
.stat-card.tint-warning { background-color: rgba(245, 158, 11, 0.05); }
.stat-card.tint-danger { background-color: rgba(244, 63, 94, 0.05); }
.stat-card.tint-info { background-color: rgba(14, 165, 233, 0.05); }
.stat-card.gradient-primary .stat-value,
.stat-card.gradient-success .stat-value,
.stat-card.gradient-warning .stat-value,
.stat-card.gradient-danger .stat-value,
.stat-card.gradient-info .stat-value,
.stat-card.gradient-indigo .stat-value,
.stat-card.gradient-rose .stat-value,
.stat-card.gradient-primary .stat-label,
.stat-card.gradient-success .stat-label,
.stat-card.gradient-warning .stat-label,
.stat-card.gradient-danger .stat-label,
.stat-card.gradient-info .stat-label,
.stat-card.gradient-indigo .stat-label,
.stat-card.gradient-rose .stat-label { color: #fff; }
.stat-card.gradient-primary .stat-icon,
.stat-card.gradient-success .stat-icon,
.stat-card.gradient-warning .stat-icon,
.stat-card.gradient-danger .stat-icon,
.stat-card.gradient-info .stat-icon,
.stat-card.gradient-indigo .stat-icon,
.stat-card.gradient-rose .stat-icon { background: rgba(255,255,255,0.2); color: #fff; }

/* =============================================
   TABLES
   ============================================= */
.table-responsive { border-radius: var(--radius); }
.table { margin-bottom: 0; font-size: 13px; }
.table thead th {
    background: var(--light); font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
    border-bottom: 2px solid var(--border); padding: 12px 16px;
    white-space: nowrap;
}
.table tbody td { padding: 12px 16px; vertical-align: middle; border-color: var(--border); }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: rgba(var(--primary-rgb), 0.04); }

/* Status Badges */
.badge { font-weight: 500; font-size: 11px; padding: 4px 10px; border-radius: 20px; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #dbeafe; color: #1e40af; }
.badge-packed { background: #e0e7ff; color: #3730a3; }
.badge-sent { background: #cffafe; color: #0e7490; }
.badge-delivered { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-returned { background: #fce7f3; color: #9d174d; }
.badge-exchange { background: #ede9fe; color: #5b21b6; }

/* Tag Badges */
.badge-regular { background: #e2e8f0; color: #475569; }
.badge-repeat { background: #dbeafe; color: #1e40af; }
.badge-vip { background: #fef3c7; color: #b45309; }
.badge-blacklist { background: #fee2e2; color: #991b1b; }

/* =============================================
   FORMS
   ============================================= */
.form-control, .form-select {
    border-radius: var(--radius); border-color: var(--border);
    background-color: var(--bg-card); color: var(--text-main);
    font-size: 13px; padding: 8px 12px; transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
    background-color: var(--bg-card);
    color: var(--text-main);
}
.form-control:disabled, .form-control[readonly] {
    background-color: var(--light);
    opacity: 0.8;
}
.form-label { font-size: 13px; font-weight: 500; color: var(--text-main); margin-bottom: 4px; }
.input-group-text {
    background: var(--light); border-color: var(--border);
    font-size: 13px; color: var(--text-muted);
}

/* =============================================
   BUTTONS
   ============================================= */
.btn { font-size: 13px; font-weight: 500; padding: 8px 16px; border-radius: var(--radius); transition: var(--transition); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-1px); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { display: inline-flex; align-items: center; gap: 6px; }
.action-btns { display: flex; gap: 4px; }
.action-btns .btn { padding: 4px 8px; font-size: 12px; }

/* Quick Action Buttons */
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-actions .btn { border-radius: 20px; font-size: 12px; padding: 6px 16px; }

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    padding: 20px;
}
.login-card {
    width: 100%; max-width: 420px; background: var(--bg-card);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    overflow: hidden;
    color: var(--text-main);
}
.login-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    padding: 32px; text-align: center; color: #fff;
}
.login-header h2 { margin: 0; font-weight: 700; }
.login-header p { margin: 8px 0 0; opacity: 0.8; font-size: 14px; }
.login-body { padding: 32px; }
.login-body .btn-primary { width: 100%; padding: 10px; font-weight: 600; }

/* =============================================
   DASHBOARD WIDGETS
   ============================================= */
.widget-card { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow); color: var(--text-main); }
.widget-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    color: var(--text-main);
}
.widget-header h5 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-main); }
.widget-body { padding: 16px 20px; color: var(--text-main); }

.widget-list { list-style: none; padding: 0; margin: 0; }
.widget-list li {
    padding: 10px 0; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center; font-size: 13px;
}
.widget-list li:last-child { border-bottom: none; }

/* Chart Container */
.chart-container { position: relative; height: 300px; }

/* =============================================
   INVOICES
   ============================================= */
.invoice-page { background: var(--bg-card); padding: 40px; max-width: 800px; margin: 20px auto; box-shadow: var(--shadow-lg); color: var(--text-main); }
.invoice-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 30px; border-bottom: 3px solid var(--primary); padding-bottom: 20px; }
.invoice-logo { font-size: 24px; font-weight: 700; color: var(--primary); }
.invoice-title { font-size: 28px; font-weight: 700; color: var(--dark); text-align: right; }
.invoice-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px; }
.invoice-table { width: 100%; border-collapse: collapse; }
.invoice-table th { background: var(--dark); color: #fff; padding: 10px 16px; font-size: 12px; text-transform: uppercase; }
.invoice-table td { padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.invoice-total { text-align: right; margin-top: 20px; }
.invoice-total td { padding: 6px 16px; font-size: 14px; }
.invoice-total .grand-total td { font-size: 18px; font-weight: 700; color: var(--primary); border-top: 2px solid var(--dark); }

/* POS Receipt */
.pos-receipt { width: 300px; margin: 0 auto; padding: 20px; background: var(--bg-card); font-size: 12px; color: var(--text-main); }
.pos-receipt .receipt-header { text-align: center; margin-bottom: 10px; }
.pos-receipt table { width: 100%; border-collapse: collapse; }
.pos-receipt td, .pos-receipt th { padding: 3px 0; font-size: 12px; }
.pos-receipt .receipt-divider { border-top: 1px dashed #000; margin: 8px 0; }

/* =============================================
   FILTER BAR
   ============================================= */
.filter-bar {
    background: var(--bg-card); padding: 16px 20px; border-radius: var(--radius-lg);
    box-shadow: var(--shadow); margin-bottom: 20px;
    display: flex; gap: 12px; align-items: end; flex-wrap: wrap;
    color: var(--text-main);
}
.filter-bar .form-group { min-width: 150px; }
.filter-bar .form-group label { font-size: 11px; font-weight: 600; color: var(--secondary); text-transform: uppercase; }

/* =============================================
   PAGINATION
   ============================================= */
.pagination { gap: 4px; }
.page-link {
    border-radius: var(--radius); font-size: 13px;
    color: var(--dark); border-color: var(--border); padding: 6px 12px;
}
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* =============================================
   RESPONSIVE & MOBILE OPTIMIZATION
   ============================================= */

/* Sidebar Backdrop */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1025;
    display: none;
    transition: opacity .3s ease;
}
.sidebar-backdrop.show { display: block; }

/* Responsive Grid & Layout Fixes */
@media (max-width: 1200px) {
    .stat-card .stat-value { font-size: 20px; }
}

@media (max-width: 991px) {
    .sidebar { 
        transform: translateX(-100%); 
        box-shadow: 10px 0 30px rgba(0,0,0,0.1); 
    }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0 !important; width: 100% !important; }
    .category-filter { display: none; }
    
    .navbar-center { margin: 0 auto; }
}

@media (max-width: 767px) {
    .page-header { padding: 12px 16px; flex-direction: column; align-items: flex-start; }
    .page-header h1 { font-size: 1.25rem; }
    .content-wrapper { padding: 12px 16px; }
    
    /* Stack Stat Cards */
    .stat-card { padding: 16px; }
    .stat-card .stat-value { font-size: 1.25rem; }
    
    /* Responsive Tables (Card View) */
    .table-responsive-stack thead { display: none; }
    .table-responsive-stack tr { 
        display: block; 
        margin-bottom: 1.5rem; 
        border: 1px solid var(--border); 
        border-radius: var(--radius-lg);
        background: var(--bg-card);
        box-shadow: var(--shadow-md);
        padding: 8px;
    }
    .table-responsive-stack td { 
        display: flex; 
        justify-content: space-between; 
        align-items: center;
        gap: 15px;
        padding: 10px 12px !important;
        border-bottom: 1px solid rgba(var(--primary-rgb), 0.05);
        min-height: 45px;
    }
    .table-responsive-stack td:last-child { border-bottom: none; }
    .table-responsive-stack td::before { 
        content: attr(data-label); 
        font-weight: 700; 
        text-align: left; 
        font-size: 11px;
        text-transform: uppercase;
        color: var(--primary);
        flex: 1;
        min-width: 100px;
        background: rgba(var(--primary-rgb), 0.05);
        padding: 4px 8px;
        border-radius: 4px;
        margin-right: 10px;
    }
    .table-responsive-stack td > * { 
        flex: 2; 
        text-align: right; 
        display: flex; 
        justify-content: flex-end; 
    }
    .table-responsive-stack .status-select { width: 100% !important; max-width: 150px; }
    .table-responsive-stack .action-btns { flex-wrap: wrap; }

    /* Form spacing */
    .filter-bar { padding: 12px; gap: 8px; }
    .filter-bar .form-group { min-width: 100%; }
    .filter-bar button { width: 100%; margin-top: 4px; }
    
    /* Quick Actions */
    .quick-actions { width: 100%; justify-content: flex-start; gap: 8px; overflow-x: auto; padding-bottom: 5px; }
    .quick-actions .btn { flex: 0 0 auto; white-space: nowrap; }

    /* Layout adjustments */
    .header-actions {
        display: flex;
        overflow-x: auto;
        width: 100%;
        padding-bottom: 8px;
        gap: 8px;
        margin-top: 10px;
    }
    .header-actions .btn { flex: 0 0 auto; white-space: nowrap; }
    
    .status-summary-bar {
        display: flex !important;
        overflow-x: auto;
        flex-wrap: nowrap !important;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }
    .status-card { flex: 0 0 150px !important; }
}

/* Custom Grid Utilities */
.row-cols-mobile-2 > * {
    @media (max-width: 576px) {
        flex: 0 0 50%;
        max-width: 50%;
    }
}
.row-cols-mobile-1 > * {
    @media (max-width: 576px) {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Tablet (Small Laptop) specific Fixes */
@media (min-width: 768px) and (max-width: 1024px) {
    .main-content { margin-left: var(--sidebar-width); }
    .stat-card { min-height: 120px; }
}

/* Fix for horizontal scroll on some pages */
.row { margin-left: 0; margin-right: 0; }
.container-fluid { padding-left: 12px; padding-right: 12px; }
.main-content { overflow-x: hidden; }

/* =============================================
   UTILITY CLASSES
   ============================================= */
.text-primary { color: var(--primary) !important; }
.bg-primary-soft { background: #ede9fe; }
.bg-success-soft { background: #d1fae5; }
.bg-warning-soft { background: #fef3c7; }
.bg-danger-soft { background: #fee2e2; }
.bg-info-soft { background: #cffafe; }
.gap-3 { gap: 16px; }
.fw-600 { font-weight: 600; }
.fs-sm { font-size: 12px; }

/* Print */
@media print {
    .sidebar, .top-navbar, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .invoice-page { box-shadow: none; margin: 0; padding: 0; }
}

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseRed { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }

.fade-in, .animate-fade-in { animation: fadeIn .3s ease forwards; }
.animate-pulse { animation: pulseRed 2s infinite; }

.card, .stat-card, .widget-card { animation: fadeIn .4s ease; }

/* =============================================
   MODERN UI COMPONENTS
   ============================================= */
.bg-soft-danger { background-color: rgba(239, 68, 68, 0.1); }
.text-danger-emphasis { color: #842029; }

.customer-preview-card {
    transition: var(--transition);
}

.duplicate-alert {
    background: linear-gradient(to right, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
}

.transition-all { transition: all .3s ease; }
.rounded-3 { border-radius: 0.75rem !important; }
