/* ==========================================================
   SEO DRIVING SCHOOL - ENTERPRISE MODERN DESIGN SYSTEM
   Brand Palette: Deep Navy (#0b1727, #0f172a), Crimson Red (#e11d48, #dc2626), 
   Vibrant Accents (#2563eb, #10b981, #f59e0b)
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --brand-primary: #dc2626;
    --brand-primary-hover: #b91c1c;
    --brand-navy: #0b1727;
    --brand-navy-light: #1e293b;
    --brand-navy-dark: #070d17;
    --brand-accent: #2563eb;
    --brand-success: #10b981;
    --brand-warning: #f59e0b;
    --brand-danger: #ef4444;
    --brand-info: #06b6d4;
    
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-color-subtle: #f1f5f9;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --sidebar-width: 270px;
    --header-height: 70px;
    --border-radius-sm: 8px;
    --border-radius-md: 14px;
    --border-radius-lg: 20px;
    
    --shadow-subtle: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-card: 0 4px 20px -2px rgba(11, 23, 39, 0.06), 0 2px 6px -1px rgba(11, 23, 39, 0.04);
    --shadow-hover: 0 10px 25px -3px rgba(11, 23, 39, 0.1), 0 4px 10px -2px rgba(11, 23, 39, 0.06);
    --shadow-primary: 0 10px 20px -5px rgba(220, 38, 38, 0.35);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 0.925rem;
    letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6, .brand-font {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--brand-navy);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================================
   APP LAYOUT (Sidebar + Main Wrapper)
   ========================================================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.app-sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--brand-navy) 0%, var(--brand-navy-dark) 100%);
    color: #f8fafc;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    overflow-y: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.sidebar-brand-box {
    padding: 1.25rem 1.25rem 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    height: 48px;
    width: auto;
    border-radius: 8px;
    background: #ffffff;
    padding: 3px 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.sidebar-brand-text h5 {
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.sidebar-brand-text span {
    color: #ef4444;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.sidebar-section-title {
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 1rem 1.25rem 0.4rem 1.25rem;
}

.sidebar-menu {
    list-style: none;
    padding: 0.5rem 0.75rem;
    flex-grow: 1;
}

.sidebar-menu li {
    margin-bottom: 3px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.65rem 0.9rem;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-menu a i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    color: #94a3b8;
    transition: color 0.2s ease;
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(3px);
}

.sidebar-menu a:hover i {
    color: #ef4444;
}

.sidebar-menu a.active {
    background: linear-gradient(135deg, var(--brand-primary) 0%, #b91c1c 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.35);
}

.sidebar-menu a.active i {
    color: #ffffff;
}

.sidebar-badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 12px;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

/* ==========================================================
   MAIN CONTENT WRAPPER & NAVBAR
   ========================================================== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-navbar {
    height: var(--header-height);
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: var(--shadow-subtle);
}

.nav-search-bar {
    position: relative;
    width: 320px;
}

.nav-search-bar input {
    width: 100%;
    padding: 0.55rem 1rem 0.55rem 2.5rem;
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: 20px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.nav-search-bar input:focus {
    background: #ffffff;
    border-color: #cbd5e1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.nav-search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-width: 0;
}

.branch-select-badge {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--brand-navy);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    max-width: 170px;
    text-overflow: ellipsis;
    overflow: hidden;
}

.quick-action-btn {
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.45rem 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-subtle);
    white-space: nowrap;
    flex-shrink: 0;
}

.user-profile-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 0.3rem 0.65rem;
    border-radius: 20px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    flex-shrink: 0;
}

.user-profile-menu:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--brand-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.user-info-text {
    max-width: 140px;
    min-width: 0;
    line-height: 1.25;
}

.user-name-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--brand-navy);
    font-size: 0.85rem;
}

.user-role-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.user-dropdown-menu {
    border-radius: var(--border-radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12) !important;
}

/* POS Customer Box in Cart */
.pos-customer-header {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.pos-customer-header.has-student {
    background: #fef2f2;
    border-color: #fecaca;
}

.pos-customer-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* POS Discount Section */
.pos-discount-section {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 0.65rem 0.85rem;
    transition: all 0.2s ease;
}

.pos-discount-section.has-discount {
    background: #ecfdf5;
    border-color: #a7f3d0;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}

.btn-xs {
    padding: 2px 8px;
    font-size: 0.75rem;
    line-height: 1.2;
    border-radius: 12px;
}

.discount-chip {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    transition: all 0.15s ease;
}

.discount-chip:hover, .discount-chip.active {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
}

/* Content Container */
.page-content {
    padding: 1.75rem;
    flex-grow: 1;
}

/* ==========================================================
   CARDS & STATS WIDGETS
   ========================================================== */
.stat-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1.35rem;
    box-shadow: var(--shadow-card);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: #cbd5e1;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.stat-card.stat-primary .stat-icon { background: rgba(220, 38, 38, 0.1); color: var(--brand-primary); }
.stat-card.stat-navy .stat-icon { background: rgba(11, 23, 39, 0.1); color: var(--brand-navy); }
.stat-card.stat-success .stat-icon { background: rgba(16, 185, 129, 0.1); color: var(--brand-success); }
.stat-card.stat-warning .stat-icon { background: rgba(245, 158, 11, 0.1); color: var(--brand-warning); }
.stat-card.stat-info .stat-icon { background: rgba(6, 182, 212, 0.1); color: var(--brand-info); }

.stat-card .stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--brand-navy);
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-footer {
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color-subtle);
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-card);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.app-card-header {
    padding: 1.15rem 1.35rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
}

.app-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    color: var(--brand-navy);
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-card-body {
    padding: 1.35rem;
}

/* ==========================================================
   BUTTONS & BADGES
   ========================================================== */
.btn-primary {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
    font-weight: 600;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--brand-primary-hover) !important;
    border-color: var(--brand-primary-hover) !important;
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.35) !important;
}

.btn-navy {
    background-color: var(--brand-navy);
    border-color: var(--brand-navy);
    color: #ffffff;
    font-weight: 600;
}

.btn-navy:hover, .btn-navy:focus {
    background-color: var(--brand-navy-light);
    border-color: var(--brand-navy-light);
    color: #ffffff;
}

.btn-whatsapp {
    background-color: #25d366;
    border-color: #25d366;
    color: #ffffff;
    font-weight: 600;
}

.btn-whatsapp:hover {
    background-color: #128c7e;
    border-color: #128c7e;
    color: #ffffff;
}

/* Modern Tables */
.table-custom {
    margin-bottom: 0;
}

.table-custom thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-top: none;
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
}

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

.table-custom tbody tr:hover {
    background-color: #f8fafc;
}

/* ==========================================================
   FRONT-DESK POS TERMINAL STYLING
   ========================================================== */
.pos-terminal-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
}

.pos-scanner-box {
    background: linear-gradient(135deg, #0b1727 0%, #1e293b 100%);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    color: #ffffff;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.pos-scanner-box::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.scanner-input-group {
    background: #ffffff;
    border-radius: 30px;
    padding: 6px 8px 6px 18px;
    display: flex;
    align-items: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.scanner-input-group input {
    border: none;
    outline: none;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--brand-navy);
    flex-grow: 1;
    background: transparent;
}

.scanner-input-group input::placeholder {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 400;
}

.pos-item-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.pos-item-card:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.15);
    transform: translateY(-2px);
}

.pos-receipt-panel {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ==========================================================
   THERMAL RECEIPT SIMULATOR & PRINT STYLES (80mm & 58mm)
   ========================================================== */
.thermal-receipt-view {
    width: 300px;
    margin: 0 auto;
    background: #ffffff;
    padding: 18px 14px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    line-height: 1.35;
    color: #000000;
    border: 1px dashed #cbd5e1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.thermal-receipt-view .receipt-header {
    text-align: center;
    border-bottom: 1px dashed #000000;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.thermal-receipt-view .receipt-logo {
    max-height: 40px;
    margin-bottom: 4px;
}

.thermal-receipt-view {
    width: 300px;
    max-width: 100%;
    margin: 0 auto;
    background: #ffffff !important;
    color: #000000 !important;
    font-family: 'Courier New', Courier, monospace, 'Plus Jakarta Sans', sans-serif;
    font-size: 12px;
    line-height: 1.35;
    padding: 16px 12px;
    border: 1px dashed #cbd5e1;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    text-align: left;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

.thermal-receipt-view * {
    color: #000000 !important;
    box-sizing: border-box;
}

.thermal-receipt-view .receipt-table {
    width: 100%;
    margin: 8px 0;
    border-collapse: collapse;
}

.thermal-receipt-view .receipt-table th {
    border-bottom: 1px dashed #000000;
    padding: 4px 0;
    text-align: left;
    color: #000000 !important;
}

.thermal-receipt-view .receipt-table td {
    padding: 3px 0;
    color: #000000 !important;
}

.thermal-receipt-view .receipt-divider {
    border-top: 1px dashed #000000;
    margin: 6px 0;
}

.thermal-receipt-view .receipt-footer {
    text-align: center;
    margin-top: 10px;
    padding-top: 6px;
    border-top: 1px dashed #000000;
    font-size: 10px;
    color: #000000 !important;
}

/* A4 Official Bill / Tax Invoice View */
.a4-invoice-view {
    max-width: 800px;
    margin: 0 auto;
    background: #ffffff !important;
    color: #111827 !important;
    padding: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 6px 25px rgba(0,0,0,0.08);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

/* ==========================================================
   PRINT STYLES: 80MM POS THERMAL SLIP & A4 INVOICE
   ========================================================== */
@media print {
    /* STRICTLY HIDE all background page content, tables, headers, and navigation */
    .app-sidebar,
    .top-navbar,
    .sidebar-backdrop,
    .modal-backdrop,
    .modal-header,
    .modal-footer,
    #receiptFormatTabs,
    .page-content,
    .btn,
    .no-print,
    #cashDrawerIndicator,
    #quickPayModal,
    #selectCustomerModal,
    #newPackageModal,
    #newItemModal {
        display: none !important;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .main-wrapper {
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
        width: 100% !important;
    }

    .modal {
        position: static !important;
        display: block !important;
        padding: 0 !important;
        overflow: visible !important;
        background: transparent !important;
    }

    .modal-dialog {
        max-width: 100% !important;
        margin: 0 !important;
        transform: none !important;
        box-shadow: none !important;
    }

    .modal-content {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        background: transparent !important;
    }

    .modal-body {
        padding: 0 !important;
        overflow: visible !important;
        max-height: none !important;
        background: transparent !important;
    }

    .tab-content {
        overflow: visible !important;
    }

    /* Print Mode 1: 80mm POS Thermal Slip */
    body.print-mode-thermal .tab-pane:not(#paneThermalReceipt) {
        display: none !important;
    }

    body.print-mode-thermal #paneThermalReceipt {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    body.print-mode-thermal .thermal-receipt-view {
        width: 76mm !important;
        max-width: 76mm !important;
        margin: 0 auto !important;
        padding: 2mm 1mm !important;
        border: none !important;
        box-shadow: none !important;
        font-size: 11px !important;
        color: #000000 !important;
        background: #ffffff !important;
    }

    body.print-mode-thermal .thermal-receipt-view * {
        color: #000000 !important;
        border-color: #000000 !important;
    }

    /* Print Mode 2: A4 Full Official Bill / Tax Invoice */
    body.print-mode-a4 .tab-pane:not(#paneA4Invoice) {
        display: none !important;
    }

    body.print-mode-a4 #paneA4Invoice {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    body.print-mode-a4 .a4-invoice-view {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 4mm !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: #ffffff !important;
        color: #000000 !important;
    }

    /* Default fallback when modal is open and user presses Ctrl+P */
    body:not(.print-mode-thermal):not(.print-mode-a4) .tab-pane.active {
        display: block !important;
    }
    body:not(.print-mode-thermal):not(.print-mode-a4) .tab-pane:not(.active) {
        display: none !important;
    }

    @page {
        margin: 5mm;
        size: auto;
    }
}

/* ==========================================================
   GPS TELEMATICS SIMULATOR MAP STYLING
   ========================================================== */
#telematics-map {
    height: 480px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    z-index: 10;
}

.vehicle-marker-icon {
    background: var(--brand-primary);
    color: #ffffff;
    border-radius: 50%;
    padding: 6px;
    font-size: 14px;
    border: 2px solid #ffffff;
    box-shadow: 0 0 10px rgba(0,0,0,0.4);
    text-align: center;
}

/* ==========================================================
   MOBILE BACKDROP & ADVANCED RESPONSIVE ARCHITECTURE
   ========================================================== */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 23, 39, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1035;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* Horizontal Scrolling for Nav Pills (Profile Tabs, Billing Tabs) */
.nav-pills.overflow-x-auto {
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.nav-pills.overflow-x-auto::-webkit-scrollbar {
    height: 3px;
}
.nav-pills.overflow-x-auto .nav-item {
    flex-shrink: 0;
}

/* Touch Friendly Utilities */
.btn, .form-control, .form-select, .nav-link {
    touch-action: manipulation;
}

/* Clamp and Fluid Typography */
.stat-card .stat-value {
    font-size: clamp(1.25rem, 2.5vw, 1.65rem);
}

/* ==========================================================
   BREAKPOINTS OPTIMIZATIONS
   ========================================================== */

/* Tablet & Mobile (< 992px) */
@media (max-width: 991.98px) {
    :root {
        --header-height: 62px;
    }
    
    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: 10px 0 35px rgba(0, 0, 0, 0.4);
    }
    
    .app-sidebar.show {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-left: 0 !important;
        width: 100%;
    }
    
    .top-navbar {
        padding: 0 1rem;
    }
    
    .page-content {
        padding: 1rem 0.85rem;
    }
    
    .pos-terminal-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .user-info-text {
        max-width: 100px;
    }
}

/* Mobile Devices (< 768px) */
@media (max-width: 767.98px) {
    .nav-search-bar {
        display: none;
    }
    
    .top-nav-actions {
        gap: 6px;
    }

    .user-info-text {
        display: none !important;
    }

    .user-profile-menu {
        padding: 2px;
        gap: 0;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .branch-select-badge {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
        max-width: 110px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .quick-action-btn {
        padding: 0.35rem 0.65rem;
        font-size: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.15rem;
        margin-bottom: 0.65rem;
    }

    .app-card-header {
        padding: 0.85rem 1rem;
        flex-wrap: wrap;
        gap: 8px;
    }

    .app-card-body {
        padding: 1rem;
    }

    .table-custom thead th, 
    .table-custom tbody td {
        padding: 0.65rem 0.75rem;
        font-size: 0.8rem;
    }

    .scanner-input-group {
        padding: 4px 6px 4px 14px;
    }

    .scanner-input-group input {
        font-size: 0.95rem;
    }

    #telematics-map {
        height: 320px;
    }

    /* Modals Mobile Scrollable Fix */
    .modal-dialog {
        margin: 0.5rem;
    }
    .modal-body {
        padding: 1rem !important;
        max-height: calc(100vh - 160px);
        overflow-y: auto;
    }
}

/* Extra Small Phones (< 480px) */
@media (max-width: 479.98px) {
    .top-nav-actions {
        gap: 4px;
    }

    .branch-select-badge span {
        display: none;
    }

    .branch-select-badge {
        padding: 0.35rem 0.5rem;
    }

    .quick-action-btn span {
        display: none !important;
    }

    .quick-action-btn {
        padding: 0.35rem 0.6rem;
    }

    .stat-card .stat-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .pos-item-card {
        padding: 0.75rem;
    }
}
