:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary: #6c757d;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0dcaf0;
    --body-bg: #f1f5f9;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --card-radius: 12px;
    --transition: all 0.3s ease;
    --sidebar-bg: #20263b;
    --sidebar-hover: #278BF5;
    --gradient-1: linear-gradient(135deg, #20263b, #2a3148);
    --gradient-2: linear-gradient(135deg, #0f766e, #14b8a6);
    --gradient-3: linear-gradient(135deg, #dc2626, #f97316);
    --gradient-4: linear-gradient(135deg, #7c3aed, #a78bfa);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--body-bg);
    color: #333;
    overflow-x: hidden;
}

.wrapper { display: flex; min-height: 100vh; }

/* POS Window mode: sidebar/toggle full-view class se control hota hai (default full-view POS) */
@media (min-width: 768px) {
    body.pos-only .main-content { margin-left: var(--sidebar-width); }
}

/* Full View mode: sidebar hide ho jaye, sirf content */
body.full-view .sidebar { display: none !important; }
body.full-view .bottom-nav { display: none !important; }
body.full-view .main-content { margin-left: 0 !important; }
body.full-view .mobile-header .mh-toggle { display: none !important; }

/* Professional toggle switch */
.sw-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    padding: 7px 11px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--pos-border, #e6eaf0);
    box-shadow: 0 2px 8px rgba(15,23,42,.06);
    transition: border-color .2s, box-shadow .2s;
    white-space: nowrap;
}
.sw-toggle:hover { border-color: rgba(16,185,129,.5); box-shadow: 0 4px 14px rgba(16,185,129,.14); }
.sw-toggle:active .sw-track { transform: scale(.96); }
.sw-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw-toggle .sw-track {
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #d3dae6;
    position: relative;
    display: inline-flex;
    flex: none;
    align-items: center;
    transition: background .25s ease;
    box-shadow: inset 0 1px 3px rgba(15,23,42,.2);
}
.sw-toggle .sw-track::after {
    content: "";
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    left: 2px;
    top: 2px;
    transition: transform .28s cubic-bezier(.34,1.56,.64,1);
    box-shadow: 0 2px 6px rgba(15,23,42,.35), 0 0 0 1px rgba(15,23,42,.06);
}
.sw-toggle input:checked + .sw-track { background: linear-gradient(135deg, #059669, #10b981); box-shadow: inset 0 1px 3px rgba(2,44,34,.35); }
.sw-toggle input:checked + .sw-track::after { transform: translateX(20px); }
.sw-toggle input:focus-visible + .sw-track { box-shadow: 0 0 0 4px rgba(16,185,129,.22); }
.sw-toggle .sw-label { font-size: 11px; font-weight: 700; color: #475069; letter-spacing: .4px; text-transform: uppercase; }
.sw-toggle input:checked ~ .sw-label { color: #059669; }
.sw-toggle.sw-sm { padding: 4px 8px; gap: 7px; border-radius: 10px; }
.sw-toggle.sw-sm .sw-track { width: 34px; height: 19px; }
.sw-toggle.sw-sm .sw-track::after { width: 15px; height: 15px; left: 2px; top: 2px; }
.sw-toggle.sw-sm input:checked + .sw-track::after { transform: translateX(15px); }
.sw-toggle.sw-sm .sw-label { font-size: 10px; letter-spacing: .3px; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .menu-item span,
.sidebar.collapsed .submenu,
.sidebar.collapsed .menu-label,
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed .menu-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .menu-icon { margin: 0; font-size: 20px; }
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand {
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.sidebar-brand i { color: var(--sidebar-hover); }

.toggle-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    transition: var(--transition);
}

.toggle-btn:hover { background: var(--sidebar-hover); color: #fff; }

.sidebar-user {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(13,202,240,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sidebar-hover);
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.user-name { color: #fff; font-weight: 600; font-size: 14px; }
.user-role { color: rgba(255,255,255,0.5); font-size: 12px; }

.sidebar-menu { padding: 10px 0; }
.menu-label {
    color: rgba(255,255,255,0.25);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 15px 20px 8px;
}

/* Sidebar sync status widget */
.sidebar-sync {
    margin: 10px 14px 14px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    gap: 8px;
    align-items: center;
    line-height: 1.35;
    border: 1px solid rgba(255,255,255,0.08);
    flex-wrap: wrap;
}
.syncwidget i { font-size: 13px; }
.syncbtn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    margin-left: auto;
}
.syncbtn:hover { background: rgba(255,255,255,0.2); }
.sidebar-sync.syncon { background: rgba(16,185,129,0.16); color: #6ee7b7; }
.sidebar-sync.syncon i { color: #34d399; }
.sidebar-sync.syncwarn { background: rgba(245,158,11,0.15); color: #fcd34d; }
.sidebar-sync.syncwarn i { color: #fbbf24; }
.sidebar-sync.syncoff { background: rgba(148,163,184,0.14); color: #cbd5e1; }
.sidebar-sync.syncoff i { color: #94a3b8; }
.sidebar-sync.syncbusy { background: rgba(59,130,246,0.16); color: #93c5fd; }
.sidebar-sync.syncbusy i { color: #60a5fa; }

/* Mobile sync chip */
.sync-chip {
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 12px;
    flex-shrink: 0;
}
.sync-chip.syncon { background: rgba(16,185,129,0.18); color: #34d399; }
.sync-chip.syncwarn { background: rgba(245,158,11,0.18); color: #fbbf24; }
.sync-chip.syncoff { background: rgba(148,163,184,0.18); color: #94a3b8; }
.sync-chip.syncbusy { background: rgba(59,130,246,0.2); color: #60a5fa; }

.menu-item, .submenu-item {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    font-size: 14px;
    gap: 12px;
}

.menu-item:hover, .submenu-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.menu-item:hover i, .submenu-item:hover i { color: #fff !important; }

.menu-item.active, .submenu-item.active {
    background: rgba(39,139,245,0.2);
    color: #fff;
    border-left: 3px solid var(--sidebar-hover);
}

.menu-item.active i, .submenu-item.active i { color: var(--sidebar-hover) !important; }

.menu-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.submenu-arrow { margin-left: auto; font-size: 12px; transition: transform 0.3s ease; }
.has-submenu.open .submenu-arrow { transform: rotate(90deg); }

.submenu {
    display: none;
    padding-left: 20px;
    overflow: hidden;
    background: rgba(0,0,0,0.15);
    border-radius: 0 0 8px 8px;
}
.submenu-item { padding: 9px 20px; font-size: 13px; }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    padding: 20px 25px;
    min-height: 100vh;
}

/* Top Bar */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding: 15px 20px;
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}

.page-title { font-size: 20px; font-weight: 700; color: #1e293b; margin: 0; }

.top-bar-company {
    min-width: 0;
    max-width: 42%;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    padding: 0 8px;
}

/* Company Switcher Bar */
.company-switcher-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #e8ecf2;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    font-size: 13px;
}
.company-switcher-bar > .fa-building { color: var(--primary); }
.company-switcher-bar .cs-label { font-weight: 600; color: #64748b; }
.company-switcher-bar .cs-current {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #0f172a;
    font-weight: 700;
}
.company-switcher-bar .cs-current:hover { background: #e2e8f0; }

.breadcrumb-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #888;
}

.breadcrumb-custom a { color: var(--primary); text-decoration: none; }

/* Global search highlight row */
table.dataTable tr.search-highlight { background: #fff3cd !important; }
table.dataTable tr.search-highlight td { background: transparent !important; }
table.dataTable tr.search-highlight td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }

.global-search-input,
.global-search-input.form-control,
#globalSearch,
#globalSearchMobile {
    border: 1px solid #94a3b8 !important;
    border-radius: 10px !important;
    transition: border-color .18s ease, box-shadow .18s ease !important;
}
.global-search-input:hover,
#globalSearch:hover,
#globalSearchMobile:hover {
    border-color: #2563eb !important;
}
.global-search-input:focus,
.global-search-input:focus-visible,
#globalSearch:focus,
#globalSearchMobile:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,.15) !important;
    outline: none !important;
}
.global-search-input.search-flash,
#globalSearch.search-flash,
#globalSearchMobile.search-flash {
    animation: searchFlash .35s ease 3 !important;
}
@keyframes searchFlash {
    0%, 100% { border-color: #94a3b8 !important; box-shadow: none !important; }
    50% { border-color: #2563eb !important; box-shadow: 0 0 0 4px rgba(37,99,235,.3) !important; }
}

/* Cards */
.card {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    background: #fff;
    margin-bottom: 20px;
}

.card:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.1); }

.card-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 16px 20px;
    font-weight: 600;
    border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
}

.card-body { padding: 20px; }

.dashboard-card {
    border-radius: var(--card-radius);
    padding: 22px;
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.dashboard-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.15); }

.dashboard-card .card-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 40px;
    opacity: 0.2;
}

.dashboard-card .card-label { font-size: 12px; opacity: 0.85; letter-spacing: 0.3px; margin-bottom: 8px; text-transform: uppercase; }
.dashboard-card .card-value { font-size: 28px; font-weight: 800; margin-bottom: 5px; }
.dashboard-card .card-sub { font-size: 12px; opacity: 0.7; }

.bg-gradient-primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.bg-gradient-success { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.bg-gradient-danger { background: linear-gradient(135deg, #dc2626, #f97316); }
.bg-gradient-warning { background: linear-gradient(135deg, #7c3aed, #a78bfa); }

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 calc(16.66% - 10px);
    padding: 16px 8px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.quick-action-btn i {
    font-size: 20px;
    width: 26px;
    text-align: center;
    flex-shrink: 0;
}

.quick-action-btn:hover {
    background: linear-gradient(135deg, #0dcaf0, #0aa2c0);
    color: #fff;
    border-color: #0dcaf0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13,202,240,0.3);
}

@media (max-width: 1200px) {
    .quick-action-btn { flex: 0 0 calc(33.33% - 7px); padding: 14px 8px; font-size: 13px; }
}
@media (max-width: 768px) {
    .quick-action-btn { flex: 0 0 calc(50% - 5px); }
}

/* Product select overflow fix */
.product-select + .select2-container .select2-selection__rendered,
.item-category + .select2-container .select2-selection__rendered,
.item-warehouse + .select2-container .select2-selection__rendered,
select.form-select.product-select,
select.form-select.item-category,
select.form-select.item-warehouse {
    max-width: 100%;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    display: block;
}
/* Tables */
.table-container { overflow-x: auto; }

/* Fix select2 dropdown clipping inside tables */
.select2-container { z-index: 9999 !important; min-width: 0 !important; width: 100% !important; }

.table .select2-container { width: 100% !important; max-width: 100%; min-width: 0 !important; }
.select2-container--bootstrap-5 .select2-dropdown { border: 1px solid #80bdff; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.select2-container--bootstrap-5 .select2-results__option--highlighted { background: #0d6efd !important; color: #fff !important; }
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered { overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; display: block !important; }
.table .select2-container--bootstrap-5 .select2-selection { width: 100% !important; min-width: 0 !important; }
.form-select.select2-hidden-accessible { width: 100% !important; }

/* select2 styled to look exactly like .form-control (date inputs) - always inactive */
.select2-container--bootstrap-5 .select2-selection {
    background-color: #fff !important;
    border: 1.5px solid #e0e0e0 !important;
    border-radius: 8px !important;
    min-height: 40px;
    padding: 5px 14px;
    box-shadow: none !important;
    font-size: 14px;
}
.select2-container--bootstrap-5 .select2-selection:hover,
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    background-color: #fff !important;
    border-color: #e0e0e0 !important;
    box-shadow: none !important;
}
.select2-container--bootstrap-5 .select2-selection__rendered {
    color: #212529 !important;
    font-size: 14px !important;
    line-height: 24px !important;
    padding-left: 0;
}
.select2-container--bootstrap-5 .select2-selection__placeholder { color: #6c757d !important; }
.select2-container--bootstrap-5 .select2-selection .select2-selection__arrow { height: 100%; }
.select2-container--bootstrap-5 .select2-selection .select2-selection__arrow b { border-top-color: #6c757d !important; }
.select2-container--bootstrap-5.select2-container--open .select2-selection .select2-selection__arrow b { border-bottom-color: #6c757d !important; }

.table {
    margin: 0;
    font-size: 13px;
}

.table thead th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 15px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 15px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
}

.table tbody tr:hover { background: #f8f9ff; }

/* Badges */
.badge { padding: 5px 10px; font-weight: 500; font-size: 11px; border-radius: 6px; }
.bg-success-light { background: #e8f5e9; color: #2e7d32; }
.bg-danger-light { background: #fce4ec; color: #c62828; }
.bg-warning-light { background: #fff8e1; color: #f57f17; }
.bg-info-light { background: #e3f2fd; color: #1565c0; }
.bg-primary-light { background: #dbeafe; color: #1d4ed8; }

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid #e0e0e0;
    padding: 9px 14px;
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-label { font-weight: 500; font-size: 13px; color: #555; margin-bottom: 5px; }

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: none;
    color: #fff;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }

.btn-success { background: #00c853; border: none; }
.btn-danger { background: #ff1744; border: none; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }

/* Stats */
.stat-item { text-align: center; padding: 10px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--primary-dark); }
.stat-label { font-size: 12px; color: #888; }

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo h1 { font-size: 28px; font-weight: 800; color: var(--primary-dark); }
.auth-logo p { color: #888; font-size: 14px; }

/* Print Styles */
@media print {
    .sidebar, .top-bar, .btn, .dataTables_filter, .dataTables_length, .dt-buttons, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd; }
}

/* Mobile Header */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: var(--sidebar-bg);
    padding: 0 16px;
    min-height: 66px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    color: #fff;
}

.mobile-header .mh-brand {
    font-size: 17px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    letter-spacing: -0.2px;
}

.mobile-header .mh-toggle {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: all 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-header .mh-toggle:hover { background: rgba(255,255,255,0.1); color: #fff; }

.mobile-header .mh-profile-drop { display: flex; align-items: center; line-height: 0; }
.mh-profile-drop .dropdown-menu {
    min-width: 240px !important;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(2,8,23,.16);
    padding: 8px;
    margin-top: 10px;
    line-height: 1.5;
    overflow: hidden;
}
.mh-profile-drop .dropdown-menu .pd-head { padding: 14px 16px; border-bottom: 1px solid #eef2f7; margin-bottom: 6px; }
.mh-profile-drop .dropdown-menu .pd-name { font-size: 14px; font-weight: 700; color: #0f172a; line-height: 1.4; white-space: normal; }
.mh-profile-drop .dropdown-menu .pd-mail { font-size: 12px; color: #64748b; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mh-profile-drop .dropdown-menu .pd-company { font-size: 12px; color: #2563eb; font-weight: 600; margin-top: 5px; }
.mh-profile-drop .dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px !important;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.5;
    color: #334155;
    margin: 2px 0;
    white-space: nowrap;
}
.mh-profile-drop .dropdown-menu .dropdown-item i { width: 18px; text-align: center; }
.mh-profile-drop .dropdown-menu .dropdown-item:hover { background: #f1f5f9; }
.mh-profile-drop .dropdown-menu .dropdown-item.text-danger:hover { background: #fef2f2; }
.mh-profile-drop .dropdown-menu .dropdown-divider { margin: 6px 0; border-color: #eef2f7; }
.mobile-header .mh-avatar-wrap { line-height: 0 !important; padding: 0 !important; width: auto !important; height: auto !important; background: none !important; border: none !important; }
.mobile-header .mh-avatar {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    padding: 3px;
    background: conic-gradient(#0ea5e9, #2563eb, #7dd3fc, #0ea5e9);
    box-shadow: 0 0 0 2px #fff, 0 0 10px rgba(79,110,247,0.45);
    animation: mhSpin 5s linear infinite;
}
.mobile-header .mh-avatar img,
.mobile-header .mh-avatar .mh-avatar-initial {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg,#4f6ef7,#7c3aed);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    animation: mhSpin 5s linear infinite reverse;
}
.mobile-header .mh-avatar img { object-fit: cover; display: block; }
.mobile-header .mh-brand { display: flex; align-items: center; overflow: hidden; margin: 0 auto; flex: 1; justify-content: center; text-align: center; }

@keyframes mhSpin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

@media (max-width: 991px), (max-device-width: 991px) {
    .mobile-header { display: flex; }
    .wrapper { padding-top: 66px; }
}

/* Responsive */
@media (max-width: 991px), (max-device-width: 991px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-width));
        top: 54px;
    }
    .sidebar.mobile-open { left: 0; }
    .main-content { margin-left: 0; padding: 15px; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 54px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .sidebar-overlay.show { display: block; }
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 15px;
    }
    .top-bar .d-flex { width: 100%; flex-wrap: wrap; }
    .page-title { font-size: 17px; }
    .breadcrumb-custom { font-size: 12px; }
    .card-body { padding: 14px; }
    .card-header { padding: 12px 14px; }
    .dashboard-card .card-value { font-size: 22px; }
    .dashboard-card { padding: 16px; }
    .quick-action-btn { flex: 0 0 calc(50% - 5px); padding: 12px 6px; font-size: 12px; }
    .quick-action-btn i { font-size: 16px; width: 22px; }
    .table { font-size: 12px; }
    .table thead th { font-size: 11px; padding: 8px 10px; white-space: normal; }
    .table tbody td { padding: 7px 10px; }
    .form-control, .form-select { font-size: 16px; padding: 10px 12px; }
    .btn { padding: 7px 14px; font-size: 13px; }
    .btn-sm { padding: 4px 10px; font-size: 11px; }
    .stat-value { font-size: 20px; }
    .sig td { display: block; width: 100%; text-align: center; padding: 8px 0; }
    .sig hr { width: 40%; }
}

@media (max-width: 576px) {
    .main-content { padding: 10px; }
    .top-bar { padding: 10px 12px; }
    .page-title { font-size: 15px; }
    .card-body { padding: 10px; }
    .dashboard-card .card-value { font-size: 18px; }
    .dashboard-card { padding: 12px; }
    .quick-action-btn { flex: 0 0 100%; padding: 10px 6px; font-size: 13px; }
    .modal-dialog { margin: 10px; }
    .dataTables_length, .dataTables_filter { float: none !important; text-align: left; margin-bottom: 8px; }
    .dataTables_filter input { width: 100% !important; }
    .dt-buttons { float: none !important; text-align: left; margin-bottom: 8px; }
    .dt-buttons .btn { font-size: 11px; padding: 4px 8px; }
}

/* Table responsive wrapper for all tables */
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Force table-responsive behavior */
@media (max-width: 768px) {
    .table-responsive-sm {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table:not(.table):not(.table-responsive-sm) { display: block; width: 100%; overflow-x: auto; }
}

/* Hide sidebar toggle on desktop */
@media (min-width: 992px) {
    .sidebar-overlay { display: none !important; }
}

/* DataTables Custom */
.dataTables_wrapper .dt-buttons .btn { margin: 0 2px; border-radius: 6px; }
.dataTables_filter input { border-radius: 8px !important; }

/* Select2 */
.select2-container--bootstrap-5 .select2-selection { border-radius: 8px !important; min-height: 40px; }

/* select2 dropdowns: wide so long option names show fully */
.select2-dropdown { min-width: 320px !important; }
.select2-results__option { white-space: normal !important; word-break: break-word; }

/* Toastr */
#toast-container > div { border-radius: 8px !important; box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important; }
.border-left { border-left: 4px solid; }

/* Print styles */
@media print {
    .sidebar, .main-content > .card:not(#print-area), .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; width: 100% !important; }
    .card { border: none !important; box-shadow: none !important; }
    .card-header { background: #f8f9fa !important; color: #000 !important; }
    .table { font-size: 11px; }
    .form-control { border: none !important; background: transparent !important; padding: 2px 4px !important; }
    .input-group-text { border: none !important; background: transparent !important; }
    select.form-control, select.form-select { -webkit-appearance: none; appearance: none; border: none !important; }
    .select2-container { display: none !important; }
    .table-container { overflow: visible !important; }
}

.dataTables_length select { width: 100px !important; }
.dataTables_length label { white-space: nowrap; }

/* ============ PWA Install Banner ============ */
.pwa-install{position:fixed;top:10px;left:50%;transform:translateX(-50%);z-index:99999;display:flex;align-items:center;gap:12px;background:#20263b;color:#fff;border:1px solid rgba(39,139,245,0.4);border-radius:12px;padding:10px 16px;box-shadow:0 8px 24px rgba(0,0,0,0.35);cursor:pointer;max-width:calc(100% - 24px)}
.pwa-install i{font-size:20px;color:#278BF5}
.pwa-install-text{display:flex;flex-direction:column;line-height:1.3;min-width:0}
.pwa-install-text strong{font-size:13px;font-weight:600}
.pwa-install-text span{font-size:11px;color:rgba(255,255,255,0.55)}
.pwa-install-close{margin-left:6px;background:none;border:none;color:rgba(255,255,255,0.6);font-size:18px;line-height:1;cursor:pointer;padding:0 2px}
.pwa-install-close:hover{color:#fff}
@media (max-width: 767px), (max-device-width: 767px){
    .pwa-install{top:6px;right:8px;left:auto;transform:none;width:calc(100% - 16px)}
}

/* ============ Mobile App-Like Experience (dashboard only — canvas pages render desktop) ============ */
@media (max-width: 767px) {
    html, body { overflow-x: hidden; }
    body { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }

    .main-content { padding: 10px 10px 64px; overflow-x: hidden; }

    .top-bar { flex-direction: row; justify-content: space-between; align-items: center; padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
    .top-bar > div:first-child { min-width: 0; overflow: hidden; }
    .page-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .top-bar .breadcrumb-custom,
    .top-bar .top-bar-company { display: none !important; }
    .top-bar .d-flex { width: auto; flex-wrap: nowrap; gap: 8px; flex-shrink: 0; }
    .top-bar .d-flex label { display: none; }
    .top-bar .d-flex span { font-size: 11px; white-space: nowrap; }

    .card { border-radius: 12px; box-shadow: 0 1px 4px rgba(15,23,42,0.08); margin-bottom: 12px; }
    .card-header { padding: 12px; font-size: 13px; }
    .card-body { padding: 12px; }

    .form-control, .form-select {
        font-size: 16px;
        padding: 10px 12px;
        height: 44px;
        border-radius: 10px;
    }
    textarea.form-control { height: auto; }
    .form-label { font-size: 12px; margin-bottom: 4px; }
    .form-text, .form-check-label { font-size: 12px; }
    .input-group { flex-wrap: nowrap; }
    .input-group > .form-control, .input-group > .form-select { min-width: 0; }
    .form-check-input { width: 1.15em; height: 1.15em; }

    .btn {
        padding: 10px 14px;
        font-size: 14px;
        border-radius: 10px;
        min-height: 42px;
    }
    .btn-sm { padding: 6px 10px; font-size: 12px; min-height: 34px; }
    .btn-icon { width: 36px; height: 36px; }

    .dashboard-card { padding: 16px; border-radius: 14px; min-width: 0; word-wrap: break-word; }
    .dashboard-card .card-icon { font-size: 32px; }
    .dashboard-card .card-value { font-size: 20px; overflow-wrap: anywhere; }
    .dashboard-card .card-sub { font-size: 11px; }

    .row { margin-left: 0; margin-right: 0; }
    .col-lg-3, .col-md-4, .col-sm-6, .col-6, .col-12 { padding-left: 6px; padding-right: 6px; }
    .g-3 { --bs-gutter-x: 12px; }
    img, canvas, video, iframe { max-width: 100%; }

    .table-container { margin: 0 -6px; padding: 0 6px; }
    .table { font-size: 12px; }
    .table thead th { padding: 9px 10px; }
    .table tbody td { padding: 9px 10px; }
    .table input.form-control, .table select.form-select { width: 100%; min-width: 0; height: 36px; padding: 8px 10px; font-size: 14px; }

    .modal-dialog { margin: 8px; max-width: calc(100% - 16px); }
    .modal-content { border-radius: 14px; border: none; box-shadow: 0 12px 40px rgba(0,0,0,0.18); }
    .modal-header, .modal-footer { padding: 12px; }
    .modal-title { font-size: 15px; }
    .modal-body { max-height: 70vh; overflow-y: auto; }

    .dt-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
    .dt-buttons .btn { margin: 0; }

    .select2-container--bootstrap-5 .select2-selection { min-height: 44px; }

    .stat-item { padding: 8px; }
    .stat-value { font-size: 18px; }
    .stat-label { font-size: 11px; }

    .quick-actions { gap: 8px; }
    .quick-action-btn { padding: 12px 8px; font-size: 12px; border-radius: 10px; }

    .nav-pills .nav-link, .nav-tabs .nav-link { font-size: 13px; padding: 8px 10px; }

    .sidebar-overlay { top: 54px; }
}

/* ============ Mobile App Shell & Bottom Navigation ============ */
.bottom-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9980;
    background: #ffffff;
    border-top: 1px solid #e8ecf2;
    box-shadow: 0 -4px 16px rgba(15,23,42,0.08);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 9px 4px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
    border: none;
    background: none;
    cursor: pointer;
    min-height: 56px;
    position: relative;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.bn-item i { font-size: 18px; }
.bn-item span { line-height: 1.1; }
.bn-item:hover, .bn-item:focus { color: var(--primary); }
.bn-item.active { color: var(--primary); }
.bn-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 34px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

@media (max-width: 767px), (max-device-width: 767px) {
    .bottom-nav { display: flex; }

    .mobile-header {
        height: calc(54px + env(safe-area-inset-top, 0px));
        padding-top: env(safe-area-inset-top, 0px);
        box-shadow: 0 1px 8px rgba(15,23,42,0.15);
    }
    .mobile-header .mh-brand { max-width: 62%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .wrapper { padding-top: calc(66px + env(safe-area-inset-top, 0px)); }
    .main-content { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
    .sidebar-overlay { top: calc(54px + env(safe-area-inset-top, 0px)); }

    /* Drawer sidebar: full-height slide, rounded edge, smooth */
    .sidebar {
        top: 0;
        height: 100vh;
        left: 0;
        width: 290px;
        transform: translateX(-105%);
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
        box-shadow: 0 0 40px rgba(15,23,42,0.35);
        z-index: 9998;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .sidebar-overlay {
        background: rgba(15,23,42,0.55);
        backdrop-filter: blur(2px);
        z-index: 9996;
        transition: opacity 0.25s;
    }
    body.sidebar-open { overflow: hidden; }

    /* Close button replaces toggle on mobile */
    .toggle-btn { display: none; }
    .sidebar-close-btn { display: flex; }

    /* Modals as bottom sheets */
    .modal-dialog { margin: 0; max-width: 100%; width: 100%; }
    .modal.fade .modal-dialog { transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1); }
    .modal.show .modal-dialog { transform: translateY(0); }
    .modal-content {
        border-radius: 18px 18px 0 0;
        border: none;
        min-height: 32vh;
        max-height: 90vh;
        overflow-y: auto;
        box-shadow: 0 -8px 40px rgba(15,23,42,0.2);
    }
    .modal-header { position: sticky; top: 0; background: #fff; z-index: 2; padding: 14px 16px; }
    .modal-footer { position: sticky; bottom: 0; background: #fff; z-index: 2; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); }

    /* Toastr moves above bottom nav */
    #toast-container {
        top: auto !important;
        right: 50% !important;
        bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
        transform: translateX(50%);
        width: calc(100% - 24px);
    }
    #toast-container > div { width: 100%; }

    /* Scrollable tabs / pills */
    .nav-tabs, .nav-pills { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .nav-tabs .nav-link, .nav-pills .nav-link { white-space: nowrap; }

    /* Compact DataTables controls on mobile */
    .dataTables_length, .dataTables_filter { margin-bottom: 6px !important; }
    .dataTables_length select { width: 64px !important; min-height: 26px; padding: 2px 6px; font-size: 12px; }
    .dataTables_filter input { min-height: 26px; padding: 2px 8px; font-size: 12px; }
    .dt-buttons .btn { padding: 3px 8px; font-size: 12px; margin-bottom: 2px; }

    /* Keep table content / action buttons on one line inside fitted tables */
    .table-container table td, .table-container table th { white-space: nowrap; }
}

/* Close arrow for mobile drawer */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.14);
    color: #fff;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    cursor: pointer;
    transition: all 0.2s;
}
.sidebar-close-btn:hover { background: rgba(255,255,255,0.25); color: #fff; }

/* Desktop: main content uses full available width */
@media (min-width: 992px) {
    .main-content { max-width: none; }
    .main-content > .row { margin-left: 0; margin-right: 0; }
}

@media (max-width: 767px), (max-device-width: 767px) {
    .sidebar-close-btn { display: flex; }
}

/* Mobile: professional display tables + easy data-entry forms (dashboard only) */
@media (max-width: 767px) {
    .main-content { padding: 6px 6px 64px !important; }
    .main-content > .row:not(.dash-row) { margin-left: 0 !important; margin-right: 0 !important; }
    .card { margin-bottom: 8px !important; }

    /* ---- Professional display tables ---- */
    .table thead th {
        background: #f8fafc !important;
        color: #334155 !important;
        font-weight: 700 !important;
        font-size: 11px !important;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        border-bottom: 2px solid #e2e8f0 !important;
        padding: 9px 10px !important;
        white-space: nowrap;
    }
    .table tbody td {
        padding: 8px 10px !important;
        border-bottom: 1px solid #f1f5f9 !important;
        vertical-align: middle;
    }
    .table tbody tr:nth-of-type(odd) { background: #fafbfd; }
    .table tbody tr:active { background: #eff6ff; }
    .table tbody td .badge { font-size: 10px; }

    /* ---- Desktop canvas: whole page laptop-width, pan with touch ---- */
    .main-content {
        min-width: 1100px;
        overflow-x: visible !important;
        padding: 6px 14px 64px !important;
    }
    html, body { overflow-x: visible !important; }
    body { -webkit-text-size-adjust: 100%; }

    /* Force desktop grid everywhere inside main content (viewport media queries
       can't see the canvas width, so we re-apply column widths ourselves) */
    .main-content .row:not(.dash-row) { margin-right: 0 !important; margin-left: 0 !important; }
    .main-content .row:not(.dash-row) > .col { flex: 1 1 0% !important; width: auto !important; max-width: none !important; }
    .main-content .row:not(.dash-row) > [class$="-auto"] { width: auto !important; max-width: none !important; }
    .main-content .row:not(.dash-row) > [class*="col-"]:not([class$="-auto"]) { flex: 0 0 auto !important; padding-right: 8px !important; padding-left: 8px !important; }
    .main-content .row:not(.dash-row) > :is(.col-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xl-1,.col-xxl-1) { width: 8.3333% !important; max-width: 8.3333% !important; }
    .main-content .row:not(.dash-row) > :is(.col-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xl-2,.col-xxl-2) { width: 16.6667% !important; max-width: 16.6667% !important; }
    .main-content .row:not(.dash-row) > :is(.col-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xl-3,.col-xxl-3) { width: 25% !important; max-width: 25% !important; }
    .main-content .row:not(.dash-row) > :is(.col-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xl-4,.col-xxl-4) { width: 33.3333% !important; max-width: 33.3333% !important; }
    .main-content .row:not(.dash-row) > :is(.col-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xl-5,.col-xxl-5) { width: 41.6667% !important; max-width: 41.6667% !important; }
    .main-content .row:not(.dash-row) > :is(.col-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xl-6,.col-xxl-6) { width: 50% !important; max-width: 50% !important; }
    .main-content .row:not(.dash-row) > :is(.col-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xl-7,.col-xxl-7) { width: 58.3333% !important; max-width: 58.3333% !important; }
    .main-content .row:not(.dash-row) > :is(.col-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xl-8,.col-xxl-8) { width: 66.6667% !important; max-width: 66.6667% !important; }
    .main-content .row:not(.dash-row) > :is(.col-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xl-9,.col-xxl-9) { width: 75% !important; max-width: 75% !important; }
    .main-content .row:not(.dash-row) > :is(.col-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xl-10,.col-xxl-10) { width: 83.3333% !important; max-width: 83.3333% !important; }
    .main-content .row:not(.dash-row) > :is(.col-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xl-11,.col-xxl-11) { width: 91.6667% !important; max-width: 91.6667% !important; }
    .main-content .row:not(.dash-row) > :is(.col-12,.col-sm-12,.col-md-12,.col-lg-12,.col-xl-12,.col-xxl-12) { width: 100% !important; max-width: 100% !important; }

    /* ---- Compact form controls (filters + entry) ---- */
    .main-content form .form-label, .main-content form label {
        font-size: 12px;
        font-weight: 600;
        color: #475569;
        margin-bottom: 3px;
        display: block;
    }
    .main-content form .form-control, .main-content form .form-select {
        font-size: 14px;
        height: 38px;
        min-height: 38px;
        padding: 6px 10px;
        border-radius: 8px;
        border: 1px solid #dbe2ec;
        background: #fff;
    }
    .main-content form textarea.form-control { height: auto; }
    .main-content form .input-group-text {
        border-radius: 8px 0 0 8px;
        background: #f8fafc;
        border: 1px solid #dbe2ec;
        font-size: 13px;
    }
    .main-content form .input-group > .form-control,
    .main-content form .input-group > .form-select { border-radius: 0 8px 8px 0; }
    .main-content form .select2-container--bootstrap-5 .select2-selection {
        min-height: 38px !important;
        border-radius: 8px !important;
        border: 1px solid #dbe2ec !important;
    }
    .main-content form .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
        line-height: 36px !important;
        font-size: 14px !important;
    }
    .main-content form .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow { height: 36px; }
    .main-content form .btn { min-height: 38px; border-radius: 8px; }
    .main-content form .btn-sm { min-height: 34px; padding: 5px 10px; font-size: 12px; }
    .main-content form .period-btn { padding: 5px 9px; font-size: 11px; }
    .main-content form .row > [class*="col-"] { margin-bottom: 8px; }

    /* Entry tables (items/voucher rows): comfortable */
    .main-content form .table .form-control,
    .main-content form .table .form-select {
        height: 36px;
        min-height: 36px;
        padding: 6px 8px;
        font-size: 14px;
        border-radius: 8px;
        border: 1px solid #dbe2ec;
    }
    .main-content form .table .input-group-text {
        height: 36px;
        border-radius: 8px 0 0 8px;
        font-size: 13px;
    }
    .main-content form .table .btn-icon { width: 34px; height: 34px; }
}

/* Dashboard exception: no desktop canvas — cards stay mobile-native, pinch-zoom works */
@media (max-width: 767px), (max-device-width: 767px) {
    body.dashboard-page .main-content {
        min-width: 0 !important;
        padding: 6px 12px 64px !important;
        overflow-x: visible !important;
    }
    body.dashboard-page .main-content .row.dash-row {
        margin-left: -8px !important;
        margin-right: -8px !important;
    }
}

/* Canvas pages (non-dashboard): behave like a desktop browser — scrollable, no font auto-inflate */
body:not(.dashboard-page) {
    overflow-x: auto !important;
    -webkit-text-size-adjust: 100%;
}

/* ============ Mobile UI Polish (clean, user-friendly) ============ */
@media (max-width: 767px), (max-device-width: 767px) {
    body { background: #f1f5f9; }

    /* App bar: clean white with soft pill buttons */
    .mobile-header {
        background: #ffffff;
        border-bottom: 1px solid #e8ecf2;
        box-shadow: 0 1px 10px rgba(15,23,42,0.05);
        padding: 0 14px;
        min-height: 68px;
        gap: 8px;
    }
    .mobile-header .mh-toggle {
        background: #f8fafc;
        color: #64748b;
        width: 38px;
        height: 38px;
        border-radius: 10px;
        padding: 0;
        font-size: 15px;
        font-weight: 400;
        border: 1px solid #e2e8f0;
    }
    .mobile-header .mh-toggle:hover, .mobile-header .mh-toggle:active { background: #f1f5f9; color: #334155; }
    .mobile-header .mh-brand {
        color: #1e293b;
        font-weight: 600;
        font-size: 16px;
        letter-spacing: -0.2px;
    }

    /* Clean cards on soft gray background */
    .card {
        border: 1px solid rgba(226,232,240,0.8);
        border-radius: 16px;
        box-shadow: 0 1px 3px rgba(15,23,42,0.05), 0 6px 16px rgba(15,23,42,0.04);
    }
    .card-header {
        background: #fff;
        border-bottom: 1px solid #f1f5f9;
        font-weight: 700;
        padding: 14px 16px;
    }
    .card-body { padding: 14px 16px !important; }

    /* Page title: clean, no heavy box */
    .top-bar {
        background: transparent;
        box-shadow: none;
        border-radius: 0;
        border: none;
        padding: 6px 2px 12px;
        margin-bottom: 4px;
    }
    .page-title { font-size: 22px; font-weight: 800; color: #0f172a; letter-spacing: -0.4px; }

    /* Bottom nav: frosted glass, smoother active */
    .bottom-nav {
        background: rgba(255,255,255,0.94);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-top: 1px solid rgba(226,232,240,0.9);
        box-shadow: 0 -6px 20px rgba(15,23,42,0.06);
    }
    .bn-item { gap: 2px; min-height: 58px; }
    .bn-item i { font-size: 20px; }
    .bn-item.active { background: rgba(37,99,235,0.07); }
    .bn-item.active i { transform: translateY(-1px); }
    .bn-item.active::before {
        top: -1px;
        width: 44px;
        height: 3.5px;
        background: linear-gradient(90deg, var(--primary), var(--primary-light));
    }

    /* Consistent rounded buttons */
    .btn { border-radius: 10px; font-weight: 600; }
    .btn-primary {
        background: linear-gradient(135deg, #2563eb, #1d4ed8);
        border: none;
        box-shadow: 0 2px 8px rgba(37,99,235,0.25);
    }
    .btn-icon { border-radius: 10px; }
}

@media print {
    .bottom-nav { display: none !important; }
}

/* Sticky table header inside the scroll container (mobile) */
@media (max-width: 767px) {
    .table-container {
        overflow: auto;
        max-height: 62vh;
    }
    .table-container thead th {
        position: sticky;
        top: 0;
        z-index: 5;
        box-shadow: 0 1px 0 #e2e8f0;
    }
}