:root {
    --primary: #012d1d;
    --on-primary: #ffffff;
    --primary-container: #1b4332;
    --on-primary-container: #86af99;
    --primary-fixed: #c1ecd4;
    --primary-fixed-dim: #a5d0b9;
    --on-primary-fixed: #002114;
    --on-primary-fixed-variant: #274e3d;
    --secondary: #7d562d;
    --on-secondary: #ffffff;
    --secondary-container: #ffca98;
    --on-secondary-container: #7a532a;
    --tertiary: #002d1b;
    --on-tertiary: #ffffff;
    --tertiary-container: #00452d;
    --on-tertiary-container: #65b68e;
    --tertiary-fixed: #a1f4c8;
    --tertiary-fixed-dim: #86d7ad;
    --error: #ba1a1a;
    --on-error: #ffffff;
    --error-container: #ffdad6;
    --on-error-container: #93000a;
    --surface: #f8f9ff;
    --on-surface: #0b1c30;
    --surface-dim: #cbdbf5;
    --surface-bright: #f8f9ff;
    --surface-container-lowest: #ffffff;
    --surface-container-low: #eff4ff;
    --surface-container: #e5eeff;
    --surface-container-high: #dce9ff;
    --surface-container-highest: #d3e4fe;
    --on-surface-variant: #414844;
    --inverse-surface: #213145;
    --inverse-on-surface: #eaf1ff;
    --inverse-primary: #a5d0b9;
    --outline: #717973;
    --outline-variant: #c1c8c2;
    --surface-tint: #3f6653;
    --background: #f8f9ff;
    --on-background: #0b1c30;
    --surface-variant: #d3e4fe;
    --font-en: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-ur: 'Noto Nastaliq Urdu', serif;
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

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

body {
    font-family: var(--font-en);
    background: var(--background);
    color: var(--on-surface);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Login Page Premium */
.login-page {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 60%, #003320 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(255,255,255,0.04) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(197, 236, 212, 0.04) 0%, transparent 50%);
    animation: loginShift 20s ease-in-out infinite alternate;
}

@keyframes loginShift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-5%, -5%) rotate(5deg); }
}

.login-container { width: 100%; max-width: 420px; position: relative; z-index: 1; }

.login-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(1,45,29,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}

.login-card:hover { box-shadow: 0 24px 80px rgba(1,45,29,0.4); }

.login-header {
    text-align: center;
    padding: 40px 30px 20px;
}

.login-icon {
    width: 72px; height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-container));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
    color: #fff;
    box-shadow: 0 8px 24px rgba(1,45,29,0.2);
    transition: transform 0.3s ease;
}

.login-card:hover .login-icon { transform: scale(1.05) rotate(-3deg); }

.login-header h2 { font: 700 24px/30px 'Inter', sans-serif; color: var(--primary); margin: 0 0 4px; }
.login-header p { color: var(--on-surface-variant); font-size: 14px; margin: 0; }
.login-body { padding: 0 30px 30px; }
.login-body .form-label { font-weight: 500; font-size: 13px; color: var(--on-surface-variant); margin-bottom: 6px; letter-spacing: 0.02em; }
.login-body .input-group-text { background: var(--surface-container-low); border: 1.5px solid var(--outline-variant); color: var(--primary); border-radius: 10px 0 0 10px; }
.login-body .form-control { border: 1.5px solid var(--outline-variant); padding: 11px 15px; font-size: 14px; border-radius: 10px; transition: all 0.2s; }
.login-body .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(1,45,29,0.12); }
.btn-login { background: linear-gradient(135deg, #012d1d, #1b4332); color: #fff; padding: 13px; font-size: 15px; font-weight: 600; border: none; border-radius: 12px; transition: all 0.3s; position: relative; overflow: hidden; }
.btn-login::after { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent); transition: left 0.5s; }
.btn-login:hover::after { left: 100%; }
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(1,45,29,0.35); color: #fff; }
.login-footer { padding: 16px 32px; text-align: center; border-top: 1px solid var(--outline-variant); }

/* Sidebar Layout */
.wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--surface-container);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    overflow-y: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--outline-variant);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px 20px;
    border-bottom: 1px solid var(--outline-variant);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header .brand-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, #012d1d, #1b4332);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    flex-shrink: 0;
}

.sidebar-header h5 { font: 600 15px/18px 'Inter', sans-serif; color: var(--primary); margin: 0; }
.sidebar-header p { font-size: 11px; color: var(--on-surface-variant); margin: 0; opacity: 0.7; letter-spacing: 0.02em; }

.sidebar .nav { padding: 8px; flex: 1; }

.sidebar .nav-link {
    color: var(--on-surface-variant);
    padding: 10px 14px;
    font: 600 12px/16px 'Inter', sans-serif;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.15s ease;
    border-radius: 10px;
    margin-bottom: 2px;
    text-decoration: none;
}

.sidebar .nav-link i { font-size: 20px; width: 22px; text-align: center; color: var(--outline); transition: color 0.15s; }

.sidebar .nav-link:hover { background: var(--surface-container-high); color: var(--primary); }
.sidebar .nav-link:hover i { color: var(--primary); }

.sidebar .nav-link.active {
    background: var(--secondary-container);
    color: var(--on-secondary-container);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--primary);
}

.sidebar .nav-link.active i { color: var(--on-secondary-container); }

.nav-divider { height: 1px; background: var(--outline-variant); margin: 8px 16px; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--outline-variant); }

.sidebar-footer .btn {
    width: 100%;
    background: linear-gradient(135deg, #012d1d, #1b4332);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font: 600 12px/16px 'Inter', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.sidebar-footer .btn:hover { opacity: 0.9; box-shadow: 0 4px 15px rgba(1,45,29,0.3); }

/* Content Area */
#content {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0 24px;
    height: var(--topbar-height);
    position: sticky;
    top: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--outline-variant);
}

#sidebarToggle { color: var(--primary); font-size: 24px; text-decoration: none; padding: 8px; border-radius: 50%; transition: background 0.2s; }
#sidebarToggle:hover { background: var(--surface-container-low); }

.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.btn-lang {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--outline-variant);
    padding: 6px 14px;
    border-radius: 20px;
    font: 600 12px/16px 'Inter', sans-serif;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-lang:hover { background: var(--primary-fixed); border-color: var(--primary-fixed-dim); color: var(--primary); }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.topbar-user:hover { background: var(--surface-container-low); }

.topbar-user .user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #012d1d, #1b4332);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
}

.topbar-user .user-info p { margin: 0; line-height: 1.3; }
.topbar-user .user-info .user-name { font: 600 13px/16px 'Inter', sans-serif; color: var(--on-surface); }
.topbar-user .user-info .user-role { font-size: 11px; color: var(--on-surface-variant); }

.main-content { flex: 1; padding: 28px 32px; max-width: 1440px; width: 100%; margin: 0 auto; }

.page-title {
    font: 700 26px/32px 'Inter', sans-serif;
    color: var(--primary);
    margin: 0;
}

/* Premium Dashboard Stats */
.stat-card {
    background: var(--surface-container-lowest);
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--outline-variant);
    position: relative;
    overflow: hidden;
    cursor: default;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(1,45,29,0.03) 0%, transparent 70%);
    transition: all 0.5s ease;
    border-radius: 50%;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(1,45,29,0.1);
    border-color: var(--primary-fixed-dim);
}

.stat-card:hover::before {
    transform: scale(1.5);
}

.stat-card .stat-icon-round {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.stat-card .stat-label {
    font: 600 11px/14px 'Inter', sans-serif;
    color: var(--on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

.stat-card .stat-value {
    font: 700 28px/34px 'Inter', sans-serif;
    color: var(--primary);
    position: relative;
    z-index: 1;
}

.stat-card .stat-sub {
    font-size: 12px;
    color: var(--on-surface-variant);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    z-index: 1;
}

/* Stat card colors */
.stat-green .stat-icon-round { background: #e8f5e9; color: #2e7d32; }
.stat-blue .stat-icon-round { background: #e3f2fd; color: #1565c0; }
.stat-gold .stat-icon-round { background: #fff8e1; color: #f57f17; }
.stat-teal .stat-icon-round { background: #e0f2f1; color: #00695c; }
.stat-purple .stat-icon-round { background: #f3e5f5; color: #6a1b9a; }
.stat-red .stat-icon-round { background: #fce4ec; color: #c62828; }

/* Quick Action Buttons */
.btn-action {
    padding: 10px 22px;
    border-radius: 12px;
    font: 600 13px/16px 'Inter', sans-serif;
    border: none;
    color: #fff;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-action:hover { transform: translateY(-2px); color: #fff; box-shadow: 0 8px 20px rgba(0,0,0,0.15); }

.btn-sale { background: linear-gradient(135deg, #7d562d, #a0764a); }
.btn-payment { background: linear-gradient(135deg, #1b4332, #2e7d32); }
.btn-customer { background: linear-gradient(135deg, #00452d, #00695c); }
.btn-product { background: linear-gradient(135deg, #012d1d, #1b4332); }

/* Cards */
.dashboard-card, .card {
    background: var(--surface-container-lowest);
    border-radius: 16px;
    border: 1px solid var(--outline-variant);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--outline-variant);
    padding: 16px 22px;
    border-radius: 16px 16px 0 0;
}

.card-header h5 { margin: 0; font: 600 15px/20px 'Inter', sans-serif; color: var(--primary); }

.card-body { padding: 22px; }

/* Tables */
.table { font-size: 13px; margin: 0; }

.table thead th {
    background: var(--surface-container);
    color: var(--on-surface-variant);
    font: 600 11px/14px 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--outline-variant);
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-top: 1px solid var(--outline-variant);
    font: 500 13px/18px 'Inter', sans-serif;
}

.table tbody tr:hover { background: var(--surface-container-low); }
.table tbody tr:nth-child(even) { background: #fafcff; }
.table tbody tr:nth-child(even):hover { background: var(--surface-container-low); }

/* Forms */
.form-label {
    font: 600 12px/16px 'Inter', sans-serif;
    color: var(--on-surface-variant);
    margin-bottom: 6px;
    display: block;
}

.form-control, .form-select {
    border: 1.5px solid var(--outline-variant);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    transition: all 0.2s;
    color: var(--on-surface);
    background: var(--surface);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(1,45,29,0.1);
    outline: none;
}

.form-control-sm { padding: 6px 10px; font-size: 13px; }

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #012d1d, #1b4332);
    border: none;
    color: #fff;
    padding: 9px 22px;
    border-radius: 10px;
    font: 600 13px/16px 'Inter', sans-serif;
    transition: all 0.2s;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(1,45,29,0.25); color: #fff; }

.btn-secondary {
    background: var(--surface);
    border: 1px solid var(--outline-variant);
    color: var(--on-surface-variant);
    padding: 9px 22px;
    border-radius: 10px;
    font: 600 13px/16px 'Inter', sans-serif;
    transition: all 0.2s;
}

.btn-secondary:hover { background: var(--surface-container); border-color: var(--outline); }

.btn-info {
    background: var(--surface-container-high);
    border: none;
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 8px;
    font: 600 12px/14px 'Inter', sans-serif;
    transition: all 0.2s;
}

.btn-info:hover { background: var(--primary-fixed); }

.btn-danger {
    background: var(--error-container);
    border: none;
    color: var(--on-error-container);
    padding: 6px 12px;
    border-radius: 8px;
    font: 600 12px/14px 'Inter', sans-serif;
    transition: all 0.2s;
}

.btn-danger:hover { background: var(--error); color: #fff; }

/* Badge */
.badge {
    font: 600 11px/14px 'Inter', sans-serif;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.bg-success { background: #e8f5e9 !important; color: #2e7d32 !important; }
.bg-warning { background: #fff8e1 !important; color: #f57f17 !important; }
.bg-danger { background: var(--error-container) !important; color: var(--on-error-container) !important; }
.bg-info { background: var(--surface-container-high) !important; color: var(--primary) !important; }

/* Status dot */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.success { background: #2e7d32; }
.status-dot.warning { background: #f57f17; }
.status-dot.error { background: #c62828; }
.status-dot.pending { background: var(--outline); }

/* Invoice */
.invoice-box { background: #fff; border-radius: 16px; padding: 40px; border: 1px solid var(--outline-variant); }
.invoice-header { border-bottom: 2px solid var(--primary); padding-bottom: 20px; margin-bottom: 30px; }
.invoice-title { font-size: 28px; font-weight: 800; color: var(--primary); }

/* Footer */
.footer { padding: 14px 24px; background: var(--surface); border-top: 1px solid var(--outline-variant); font-size: 12px; color: var(--on-surface-variant); }

/* DataTables */
.dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; border-radius: 8px; }
.dataTables_wrapper .dataTables_filter input { border: 1.5px solid var(--outline-variant); border-radius: 8px; padding: 6px 12px; }

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 4px; }

/* Animation */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.stat-card, .dashboard-card, .card { animation: fadeInUp 0.4s ease; }

/* Tabs */
.nav-tabs { border-bottom: 1px solid var(--outline-variant); gap: 4px; }
.nav-tabs .nav-link { border: none; color: var(--on-surface-variant); font: 600 12px/16px 'Inter', sans-serif; padding: 10px 20px; border-radius: 8px 8px 0 0; transition: all 0.2s; }
.nav-tabs .nav-link:hover { background: var(--surface-container-low); color: var(--primary); }
.nav-tabs .nav-link.active { background: var(--surface); color: var(--primary); border-bottom: 2px solid var(--primary); }

/* Responsive Breakpoints */

/* Tablet & below */
@media (max-width: 991.98px) {
    .sidebar { left: calc(-1 * var(--sidebar-width)); }
    .sidebar.active { left: 0; box-shadow: 4px 0 20px rgba(0,0,0,0.1); }
    #content { margin-left: 0; }
    .sidebar-overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.4); z-index: 999; display: none;
        backdrop-filter: blur(2px);
    }
    .sidebar-overlay.active { display: block; }

    .stat-card .stat-value { font-size: 24px; }
    .main-content { padding: 20px 20px; }
}

/* Mobile */
@media (max-width: 767.98px) {
    .main-content { padding: 14px; }
    .page-title { font-size: 18px; }
    .topbar { padding: 0 8px; height: 52px; }
    .topbar-right { gap: 6px; }
    #sidebarToggle { font-size: 22px; padding: 4px 6px; }

    .stat-card { padding: 14px; }
    .stat-card .stat-value { font-size: 20px; }
    .stat-card .stat-icon-round { width: 38px; height: 38px; font-size: 17px; margin-bottom: 10px; }
    .stat-card .stat-label { font-size: 10px; letter-spacing: 0.04em; }
    .card-body { padding: 14px; }
    .card-header { padding: 10px 14px; }
    .card-header h5 { font-size: 13px; }

    /* Invoice */
    .invoice-box { padding: 12px; }
    .invoice-title { font-size: 20px; }
    .invoice-header .row > div { width: 100%; text-align: center !important; }
    .invoice-header .text-end { text-align: center !important; margin-top: 8px; }
    .invoice-header h1 { font-size: 22px !important; }

    /* Table horizontal scroll */
    .table-responsive {
        margin: 0 -14px;
        border: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-responsive::-webkit-scrollbar { height: 4px; }
    .table-responsive::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 4px; }
    .table thead th, .table tbody td { padding: 6px 8px; font-size: 11px; white-space: nowrap; }

    /* Sale items table on mobile */
    .table-bordered .form-control-sm, .table-bordered .form-select-sm { font-size: 12px; padding: 6px 8px; min-width: 70px; }
    .table-bordered .btn-sm { padding: 4px 6px; font-size: 12px; }

    /* Stack action buttons */
    .d-flex.gap-2 { gap: 6px !important; flex-wrap: wrap; }
    .btn-action { padding: 8px 14px; font-size: 12px; width: 100%; justify-content: center; }

    /* Stack form rows */
    .row.g-3 > [class*="col-"] { padding: 6px; }
    .btn-lg { padding: 10px 18px; font-size: 13px; }

    /* Better mobile form inputs - prevents iOS zoom */
    .form-control, .form-select { font-size: 16px; padding: 10px 12px; }

    /* Sidebar on mobile */
    .sidebar-header { padding: 14px 16px; }
    .sidebar .nav-link { padding: 10px 14px; font-size: 11px; }

    /* Topbar user */
    .topbar-user .user-info .user-role { display: none; }
    .topbar-user .user-info .user-name { font-size: 12px; }

    .btn-lang { padding: 4px 8px; font-size: 11px; }

    .dropdown-menu { min-width: 180px; }
    .alert { padding: 10px 14px; font-size: 12px; }

    /* Filter cards on mobile */
    .card .card-body.py-2 .row.g-2 > [class*="col-"] { width: 100%; }

    /* Customer view page mobile */
    .customer-details .row > div { width: 100%; }

    /* Hide page title date badge on very small */
    .badge.fs-6 { font-size: 11px !important; padding: 4px 8px !important; }
}

/* Small mobile */
@media (max-width: 480px) {
    .main-content { padding: 10px; }
    .page-title { font-size: 16px !important; }
    .stat-card { padding: 12px; }
    .stat-card .stat-value { font-size: 18px; }
    .stat-card .stat-icon-round { width: 32px; height: 32px; font-size: 14px; margin-bottom: 8px; }
    .stat-card .stat-sub { font-size: 10px; }
    .stat-card .stat-label { font-size: 9px; }
    .card-body { padding: 12px; }
    .card-header { padding: 8px 12px; }
    .card-header h5 { font-size: 12px; }
    .topbar { padding: 0 6px; height: 48px; }
    #sidebarToggle { font-size: 20px; padding: 4px; }

    .row.g-3 { margin: -4px; }
    .row.g-3 > [class*="col-"] { padding: 4px; }

    .btn, .btn-primary, .btn-secondary { padding: 6px 12px; font-size: 11px; }
    .btn-lg { padding: 8px 14px; font-size: 12px; }
    .table thead th, .table tbody td { padding: 5px 6px; font-size: 10px; }

    /* Login page mobile */
    .login-page { padding: 12px; }
    .login-card { border-radius: 16px; }
    .login-header { padding: 28px 20px 16px; }
    .login-icon { width: 56px; height: 56px; font-size: 26px; }
    .login-header h2 { font-size: 20px; }
    .login-body { padding: 0 20px 20px; }
    .login-footer { padding: 12px 20px; }

    /* Sidebar */
    .sidebar { width: 240px; left: calc(-1 * 240px); }
    .sidebar-header { padding: 12px 14px; }
    .sidebar-header .brand-icon { width: 36px; height: 36px; font-size: 18px; }
    .sidebar-header h5 { font-size: 13px; }
    .sidebar .nav-link { padding: 8px 12px; font-size: 11px; gap: 10px; }
    .sidebar .nav-link i { font-size: 18px; width: 20px; }

    /* Hide stat card 6th on small mobile - show only 5 */
    .stat-card .stat-sub { display: none; }
}

/* Select2 mobile fix */
@media (max-width: 767.98px) {
    .select2-container--bootstrap-5 .select2-selection { font-size: 14px; min-height: 40px; }
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered { line-height: 38px; padding: 0 12px; }
    .select2-container--bootstrap-5 .select2-dropdown { font-size: 14px; }
    .select2-search__field { font-size: 16px !important; }
}

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

/* Sidebar width variable for mobile */
@media (max-width: 480px) {
    :root { --sidebar-width: 240px; }
}

/* Voice Input Styles */
@keyframes pulse {
    0% { transform: translateY(-50%) scale(1); opacity: 1; }
    50% { transform: translateY(-50%) scale(1.2); opacity: 0.7; }
    100% { transform: translateY(-50%) scale(1); opacity: 1; }
}
.voice-input-btn.recording {
    animation: pulse 1.5s infinite;
    color: #dc3545 !important;
}
.voice-input-wrapper input {
    padding-right: 35px;
}
[dir="rtl"] .voice-input-wrapper input {
    padding-right: 15px;
    padding-left: 35px;
}
.voice-controls {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding: 0 2px;
}

/* Responsive Table Cards for Mobile Forms */
@media (max-width: 768px) {
    .table-cards thead { display: none; }
    .table-cards tbody tr, .table-cards tfoot tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 1rem;
        border: 1px solid var(--outline-variant);
        border-radius: 8px;
        padding: 12px;
        background: var(--surface);
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    .table-cards td {
        display: flex;
        flex-direction: column;
        border: none;
        padding: 6px 0;
    }
    .table-cards td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 12px;
        color: var(--on-surface-variant);
        margin-bottom: 4px;
    }
    .table-cards td.col-action {
        flex-direction: row;
        justify-content: flex-end;
        border-top: 1px dashed var(--outline-variant);
        margin-top: 8px;
        padding-top: 12px;
    }
    .table-cards td.col-action::before { content: none; }
    
    .table-cards td.hide-mobile { display: none !important; }
    
    .table-cards tfoot tr {
        background: var(--primary-fixed);
        border-color: var(--primary);
    }
    .table-cards tfoot td {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .table-cards tfoot td::before { margin-bottom: 0; font-size: 14px; }
}

/* Fix for Select2 Text Vertical Alignment */
.select2-container--bootstrap-5 .select2-selection--single {
    display: flex !important;
    align-items: center !important;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: normal !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    top: 50% !important;
    transform: translateY(-50%) !important;
}
