/* FunnyBunny POS - Main Stylesheet */

:root {
    --primary-color: #DB3322;
    --primary-color-hex: #DB3322;
    --secondary-color: #FFD700;
    --accent-blue: #4169E1;
    --accent-green: #32CD32;
    --hover-color: #C22D1D;
    --logo-red: #DB3322;
    
    /* Safe area insets for iPhone notch, home indicator, etc. */
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-inset-left: env(safe-area-inset-left, 0px);
}

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

body { 
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif; 
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #2c3e50; 
    line-height: 1.6;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

/* Selection colors */
::selection {
    background: var(--secondary-color);
    color: #333;
}

/* Enhanced font smoothing */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    /* Safe area for notched devices */
    padding-top: var(--safe-area-inset-top);
    padding-left: var(--safe-area-inset-left);
    padding-right: var(--safe-area-inset-right);
}

/* Main app container with safe areas */
#app {
    min-height: calc(100vh - var(--safe-area-inset-top) - var(--safe-area-inset-bottom));
    padding-bottom: var(--safe-area-inset-bottom);
}

/* Mobile Touch Improvements */
button, 
.btn,
.menu-item,
.filter-tab {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px; /* Apple's minimum tap target size */
    min-width: 44px;
}

/* Smooth Scrolling for Containers */
.content-area,
.modal-content,
.sidebar {
    -webkit-overflow-scrolling: touch;
}

/* Table Styles */
table { 
    width: 100%; 
    border-collapse: collapse; 
    background: white; 
    border-radius: 12px; 
    overflow: hidden; 
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
}

thead th { 
    background: linear-gradient(135deg, var(--primary-color), var(--hover-color));
    color: white; 
    padding: 16px 20px; 
    text-align: left; 
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody td { 
    padding: 14px 20px; 
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #2c3e50;
}

tbody tr {
    transition: all 0.2s ease;
}

tbody tr:hover { 
    background: linear-gradient(90deg, rgba(255,68,68,0.03), transparent);
    transform: scale(1.001);
}

tbody tr:last-child td {
    border-bottom: none;
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 15px 0;
}

/* Make all tables scrollable on mobile */
table {
    min-width: 600px;
}

thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Mobile-Friendly Table Styling */
@media (max-width: 768px) {
    table {
        font-size: 14px;
        min-width: 100%;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    table th,
    table td {
        padding: 8px !important;
        font-size: 13px;
    }
    
    /* Stack table cells vertically on very small screens */
    @media (max-width: 480px) {
        table, thead, tbody, th, td, tr {
            display: block;
        }
        
        thead tr {
            position: absolute;
            top: -9999px;
            left: -9999px;
        }
        
        tr {
            border: 1px solid #ddd;
            margin-bottom: 10px;
            border-radius: 5px;
            overflow: hidden;
        }
        
        td {
            border: none;
            position: relative;
            padding-left: 50% !important;
            text-align: right;
        }
        
        td:before {
            content: attr(data-label);
            position: absolute;
            left: 10px;
            width: 45%;
            padding-right: 10px;
            white-space: nowrap;
            font-weight: bold;
            text-align: left;
        }
    }
}

/* Sidebar Styles */
.sidebar {
    width: 250px;
    background: #DB3322;
    color: white;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar.mobile-hidden { 
    transform: translateX(-100%); 
}

.sidebar-header {
    padding: 20px 15px;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
    background: #DB3322;
}

.sidebar-welcome {
    padding: 12px 15px;
    text-align: center;
    background: #DB3322;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.sidebar-welcome h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--secondary-color);
}

.sidebar-welcome p {
    margin: 3px 0 0 0;
    font-size: 15px;
    font-weight: bold;
    color: white;
}

.sidebar-menu-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-menu-container::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}

.sidebar-menu-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.sidebar-menu-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

.logo { 
    font-size: 24px; 
    font-weight: bold; 
    margin-bottom: 40px; 
    text-align: center; 
}

/* Menu Styles */
.menu-item { 
    padding: 15px; 
    margin: 10px 0; 
    cursor: pointer; 
    border-radius: 5px; 
    transition: all 0.3s; 
}

.menu-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--hover-color));
    color: white;
    border-left: 4px solid var(--secondary-color);
}

.menu-item:hover {
    background: #FFE5E5;
    color: #333;
    border-left: 3px solid var(--primary-color);
    transform: translateX(3px);
}

.logout-item {
    padding: 15px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
    border-top: 2px solid rgba(255,255,255,0.2);
    margin-top: 10px;
    flex-shrink: 0;
    background: #B82818;
}

.logout-item:hover {
    background: #FFE5E5;
    color: #333;
    border-left: 3px solid var(--primary-color);
    transform: translateX(3px);
}

/* Profile Dropdown */
.profile-menu {
    position: relative;
    display: inline-block;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
}

.profile-trigger:hover {
    background: var(--primary-color);
    color: white;
}

.profile-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.profile-name {
    font-weight: 600;
    color: #333;
}

.profile-trigger:hover .profile-name {
    color: white;
}

.profile-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    background: white;
    border: 2px solid #eee;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 220px;
    display: none;
    z-index: 1000;
}

.profile-dropdown.show {
    display: block;
}

.profile-dropdown-header {
    padding: 15px;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, var(--primary-color), var(--hover-color));
    color: white;
    border-radius: 8px 8px 0 0;
}

.profile-dropdown-header h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
}

.profile-dropdown-header p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
}

.profile-dropdown-item {
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    border-bottom: 1px solid #f5f5f5;
}

.profile-dropdown-item:hover {
    background: #FFE5E5;
    color: var(--primary-color);
}

.profile-dropdown-item:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1100;
    background: var(--primary-color);
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(203, 66, 48, 0.4);
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(203, 66, 48, 0.6);
}

.mobile-overlay { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.5); 
    z-index: 999; 
}

.mobile-overlay.show { 
    display: block; 
}

/* Main Content */
.main-content {
    margin-left: 250px;
    padding: 30px;
    background: transparent;
    min-height: 100vh;
}

/* Card Styles */
.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
}

.card:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.card-header h2 {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.card-header h3 {
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 0;
}

.header { 
    display: none;
}

.content-area { 
    background: white; 
    padding: 30px; 
    border-radius: 10px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
}

/* Buttons */
.btn { 
    padding: 10px 22px; 
    border: 2px solid transparent;
    border-radius: 10px; 
    cursor: pointer; 
    font-size: 14px;
    font-weight: 600;
    transition: none !important;
    margin: 5px;
    box-shadow: none !important;
    text-transform: none;
    letter-spacing: 0.3px;
    box-sizing: border-box;
    min-height: 40px;
    outline: none !important;
}

.btn:hover {
    box-shadow: none !important;
    outline: none !important;
}

.btn:active {
    box-shadow: none !important;
    transform: none !important;
    outline: none !important;
}

.btn:focus {
    box-shadow: none !important;
    outline: none !important;
}

.btn-primary {
    background: var(--primary-color) !important;
    color: white !important;
    border: 2px solid var(--primary-color) !important;
    box-shadow: none !important;
}

.btn-primary:hover {
    background: var(--primary-color) !important;
    border: 2px solid var(--primary-color) !important;
    box-shadow: none !important;
}

.btn-primary:active {
    box-shadow: none !important;
}

.btn-primary:focus {
    box-shadow: none !important;
    outline: none !important;
}

.btn-secondary {
    background: white !important;
    color: #333 !important;
    border: 2px solid #ddd !important;
    box-shadow: none !important;
}

.btn-secondary:hover {
    background: white !important;
    border: 2px solid #ddd !important;
    box-shadow: none !important;
}

.btn-secondary:active {
    box-shadow: none !important;
}

.btn-secondary:focus {
    box-shadow: none !important;
    outline: none !important;
}

.btn-success { 
    background: #28a745; 
    color: white; 
}

.btn-danger { 
    background: #dc3545; 
    color: white; 
}

.btn-warning { 
    background: var(--secondary-color); 
    color: #333;
    font-weight: 600;
}

.btn-warning:hover {
    background: #FFC700;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Form Elements */
input[type="text"], 
input[type="number"], 
input[type="email"], 
input[type="password"], 
input[type="date"], 
input[type="tel"], 
select, 
textarea { 
    width: 100%; 
    padding: 12px 16px; 
    border: 2px solid #e0e0e0; 
    border-radius: 10px; 
    margin: 5px 0; 
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

input[type="text"]:focus, 
input[type="number"]:focus, 
input[type="email"]:focus, 
input[type="password"]:focus, 
input[type="date"]:focus, 
input[type="tel"]:focus, 
select:focus, 
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 68, 68, 0.1);
    transform: translateY(-1px);
}

input[type="text"]:hover, 
input[type="number"]:hover, 
input[type="email"]:hover, 
input[type="password"]:hover, 
input[type="date"]:hover, 
input[type="tel"]:hover, 
select:hover, 
textarea:hover {
    border-color: #c0c0c0;
}

label { 
    display: block; 
    margin: 12px 0 6px; 
    font-weight: 600; 
    color: #2c3e50;
    font-size: 14px;
    letter-spacing: 0.3px;
}

/* Utility Classes */
.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--secondary-color); }
.text-success { color: #28a745; }
.text-danger { color: #dc3545; }
.text-muted { color: #6c757d; }

.bg-primary { background-color: var(--primary-color); color: white; }
.bg-secondary { background-color: var(--secondary-color); color: #333; }
.bg-light { background-color: #f8f9fa; }
.bg-white { background-color: white; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }

.rounded { border-radius: 10px; }
.rounded-lg { border-radius: 15px; }
.shadow-sm { box-shadow: 0 2px 5px rgba(0,0,0,0.08); }
.shadow { box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.shadow-lg { box-shadow: 0 5px 20px rgba(0,0,0,0.15); }

.search-box { 
    padding: 10px; 
    border: 2px solid #DB3322; 
    border-radius: 5px; 
    margin-bottom: 20px; 
    font-size: 16px; 
}

/* Tabs */
.tab-content { 
    display: none; 
}

.tab-content.active { 
    display: block; 
}

.filter-tabs { 
    display: flex; 
    gap: 10px; 
    margin: 20px 0; 
    border-bottom: 2px solid #ddd; 
}

.filter-tab { 
    padding: 10px 20px; 
    cursor: pointer; 
    border: none; 
    background: none; 
    border-bottom: 3px solid transparent; 
}

.filter-tab.active { 
    border-bottom-color: #DB3322; 
    color: #DB3322; 
    font-weight: bold; 
}

/* Brand Tabs */
.brand-tabs {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
    margin: 20px 0 0 0;
    padding: 0;
    border-bottom: 3px solid #e0e0e0;
}

.brand-tab {
    padding: 12px 24px;
    cursor: pointer;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    position: relative;
    margin-bottom: -3px;
}

.brand-tab:hover {
    background: #f8f9fa;
    color: #333;
}

.brand-tab.active {
    background: transparent;
    color: #DB3322;
    border-bottom-color: #DB3322;
    font-weight: 600;
}

/* Item Grid */
.items-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); 
    gap: 20px; 
    margin-top: 20px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    padding-right: 10px;
}

/* Smooth scrolling for grids */
.items-grid::-webkit-scrollbar {
    width: 8px;
}

.items-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.items-grid::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.items-grid::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Invoices Grid - Scrollable */
#invoicesGrid {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    padding-right: 10px;
}

#invoicesGrid::-webkit-scrollbar {
    width: 8px;
}

#invoicesGrid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#invoicesGrid::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

#invoicesGrid::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Expenses Table Container - Scrollable */
#expensesTableContainer {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    overflow-x: auto;
}

#expensesTableContainer::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#expensesTableContainer::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#expensesTableContainer::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

#expensesTableContainer::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.item-card { 
    border: 1px solid #ddd; 
    padding: 20px; 
    border-radius: 10px; 
}

.item-card h3 { 
    color: #DB3322; 
    margin-bottom: 10px; 
}

/* Dropdown */
.dropdown { 
    position: relative; 
}

.dropdown-list { 
    position: absolute; 
    top: 100%; 
    left: 0; 
    right: 0; 
    background: white; 
    border: 2px solid #DB3322; 
    border-radius: 5px; 
    max-height: 300px; 
    overflow-y: auto; 
    z-index: 1000; 
    display: none; 
}

.dropdown-list.show { 
    display: block; 
}

.dropdown-item { 
    padding: 10px; 
    cursor: pointer; 
    border-bottom: 1px solid #eee; 
}

.dropdown-item:hover { 
    background: #f8f8f8; 
}

/* Billing Layout */
.bill-row { 
    display: grid; 
    grid-template-columns: 2fr 0.8fr 1fr 0.8fr 1fr 1.2fr auto; 
    gap: 10px; 
    margin: 10px 0; 
    align-items: center; 
    padding: 10px; 
    background: #f8f8f8; 
    border-radius: 5px; 
    position: relative; 
}

.bills-layout { 
    display: flex; 
    gap: 20px; 
}

.bills-sidebar { 
    width: 250px; 
    border-right: 2px solid #ddd; 
    padding-right: 20px;
    max-height: calc(100vh - 320px);
    overflow-y: auto;
}

/* Bills sidebar scrollbar styling */
.bills-sidebar::-webkit-scrollbar {
    width: 8px;
}

.bills-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.bills-sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.bills-sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.bill-list-item { 
    padding: 15px; 
    margin: 10px 0; 
    border: 2px solid #DB3322; 
    border-radius: 5px; 
    cursor: pointer; 
    transition: all 0.3s;
    background: #DB3322;
    color: white;
}

.bill-list-item * {
    color: white !important;
}

.bill-list-item:hover { 
    border-color: #B82818; 
    background: #B82818; 
}

.bill-list-item.active { 
    background: #8B0000; 
    color: white; 
    border-color: #8B0000; 
}

.bill-list-item.paid {
    background: #28a745;
    border-color: #28a745;
}

.bill-list-item.paid.active {
    background: #1e7e34;
    border-color: #1e7e34;
}

.bill-content { 
    flex: 1; 
}

.add-item-bottom { 
    margin-top: 20px; 
    padding: 20px; 
    background: #f8f8f8; 
    border-radius: 10px; 
    text-align: center; 
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    overflow: auto;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 35px;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border: 2px solid var(--secondary-color);
    animation: slideUp 0.3s ease;
}

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

@keyframes slideUp {
    from { 
        transform: translateY(30px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 26px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-content h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: 600;
}

/* Bluetooth Status */
.bluetooth-status { 
    background: #f8f8f8; 
    padding: 15px; 
    border-radius: 5px; 
    margin: 20px 0; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.status-dot { 
    width: 12px; 
    height: 12px; 
    border-radius: 50%; 
    background: #dc3545; 
    display: inline-block; 
    margin-right: 8px; 
}

.status-dot.connected { 
    background: #28a745; 
}

/* Report Cards */
.report-card {
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.report-view {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Chart containers */
canvas {
    max-height: 400px !important;
}

/* Responsive tables in reports */
@media (max-width: 768px) {
    .report-card {
        padding: 15px;
    }
    
    #salesDetailTable {
        font-size: 13px;
    }
    
    #salesDetailTable th,
    #salesDetailTable td {
        padding: 8px !important;
    }
}

/* Login Screen */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    background: #DB3322;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 9999;
    padding: 20px 0;
}

/* Removed animated background elements */

.login-box {
    background: transparent;
    padding: 0;
    width: 420px;
    max-width: 90%;
    position: relative;
    z-index: 10;
    text-align: center;
    margin: auto;
}

.login-box h2 {
    color: white !important;
    margin-bottom: 10px;
}

.login-box p {
    color: rgba(255, 255, 255, 0.9) !important;
    margin-bottom: 30px;
}

.login-box label {
    color: white !important;
    text-align: left;
    display: block;
}

.login-box input {
    background: rgba(255, 255, 255, 0.25) !important;
    border: 2px solid rgba(255, 255, 255, 0.4) !important;
    color: white !important;
    font-weight: 500;
}

.login-box input::placeholder {
    color: rgba(255, 255, 255, 0.7) !important;
}

.login-box input:focus {
    background: rgba(255, 255, 255, 0.35) !important;
    border-color: white !important;
}

/* Removed slideIn animation */

.login-logo { 
    font-size: 48px; 
    text-align: center; 
    margin-bottom: 10px; 
}

.login-title { 
    font-size: 24px; 
    font-weight: bold; 
    text-align: center; 
    margin-bottom: 30px; 
    color: #DB3322; 
}

/* Profile Menu */
.profile-menu { 
    position: relative; 
}

.profile-dropdown { 
    position: absolute; 
    top: 100%; 
    left: 0; 
    right: 0; 
    background: white; 
    border-radius: 5px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); 
    display: none; 
    z-index: 1000; 
    margin-top: 10px; 
}

.profile-dropdown.show { 
    display: block; 
}

.profile-dropdown-item { 
    padding: 12px 15px; 
    cursor: pointer; 
    border-bottom: 1px solid #eee; 
    color: #333; 
    transition: all 0.2s; 
}

.profile-dropdown-item:hover { 
    background: #f5f5f5; 
}

.profile-dropdown-item:last-child { 
    border-bottom: none; 
}

.profile-toggle { 
    cursor: pointer; 
    padding: 10px; 
    background: rgba(255,255,255,0.2); 
    border-radius: 5px; 
    transition: all 0.2s; 
    margin-bottom: 20px; 
}

.profile-toggle:hover { 
    background: rgba(255,255,255,0.3); 
}

/* Permission Grid */
.permission-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 10px; 
    margin: 15px 0; 
}

.permission-item { 
    padding: 10px; 
    background: #f8f8f8; 
    border-radius: 5px; 
}

/* Customer & Birthday */
.kid-entry { 
    padding: 15px; 
    background: #f8f8f8; 
    border-radius: 5px; 
    margin: 10px 0; 
    border: 2px solid #ddd; 
}

.birthday-badge { 
    display: inline-block; 
    padding: 5px 10px; 
    border-radius: 15px; 
    font-size: 12px; 
    font-weight: bold; 
}

.birthday-upcoming { 
    background: #fff3cd; 
    color: #856404; 
}

.birthday-today { 
    background: #d4edda; 
    color: #155724; 
    animation: pulse 2s infinite; 
}

@keyframes pulse { 
    0%, 100% { transform: scale(1); } 
    50% { transform: scale(1.05); } 
}

/* Attendance Calendar Styles */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.calendar-header {
    text-align: center;
    font-weight: bold;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 5px;
    color: #495057;
    font-size: 14px;
}

.calendar-day {
    aspect-ratio: 1;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.calendar-day:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-color: #DB3322;
}

.calendar-day.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: #f8f9fa;
}

.calendar-day.disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: #e9ecef;
}

.calendar-day.today {
    border: 3px solid #DB3322;
    font-weight: bold;
}

.calendar-day.present {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.calendar-day.absent {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.calendar-day.half-day {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.calendar-day.leave {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

.calendar-day-number {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.calendar-day-status {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 5px;
}

.calendar-day-icon {
    font-size: 20px;
    margin: 5px 0;
}

/* Attendance Summary Cards */
.attendance-summary-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #e9ecef;
    transition: all 0.3s;
}

.attendance-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.attendance-summary-card h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #6c757d;
    text-transform: uppercase;
}

.attendance-summary-card .count {
    font-size: 36px;
    font-weight: bold;
    margin: 10px 0;
}

/* Responsive Calendar */
@media (max-width: 768px) {
    .calendar-grid {
        gap: 4px;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 5px;
    }
    
    .calendar-day-number {
        font-size: 14px;
    }
    
    .calendar-day-status {
        font-size: 9px;
    }
    
    .calendar-day-icon {
        font-size: 16px;
    }
    
    .calendar-header {
        padding: 8px;
        font-size: 12px;
    }
}

/* Responsive Design - Enhanced Mobile Experience */
@media (max-width: 768px) {
    /* Mobile Sidebar */
    .sidebar { 
        transform: translateX(-100%); 
        width: 280px;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }
    
    .sidebar.mobile-show { 
        transform: translateX(0); 
    }
    
    .mobile-menu-btn { 
        display: block; 
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }
    
    /* Main Content */
    .main-content { 
        margin-left: 0; 
        padding: 15px;
        padding-top: 60px;
    }
    
    .header {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .content-area {
        padding: 15px;
    }
    
    /* Billing Layout */
    .bills-layout { 
        flex-direction: column; 
    }
    
    .bills-sidebar { 
        width: 100%; 
        border-right: none; 
        border-bottom: 2px solid #ddd; 
        padding-right: 0;
        padding-bottom: 15px; 
        margin-bottom: 15px;
        max-height: 300px;
        overflow-y: auto;
    }
    
    .bill-row {
        grid-template-columns: 1fr;
        gap: 5px;
        padding: 15px;
    }
    
    .bill-row > div,
    .bill-row > input,
    .bill-row > button {
        width: 100% !important;
    }
    
    /* Grids */
    .responsive-grid { 
        grid-template-columns: 1fr !important; 
    }
    
    .items-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        max-height: calc(100vh - 240px);
        overflow-y: auto;
    }
    
    #invoicesGrid {
        max-height: calc(100vh - 240px);
        overflow-y: auto;
    }
    
    #expensesTableContainer {
        max-height: calc(100vh - 280px);
        overflow-y: auto;
        overflow-x: visible; /* No horizontal scroll needed with card layout */
        width: 100%;
    }
    
    .permission-grid {
        grid-template-columns: 1fr;
    }
    
    /* Buttons */
    .btn {
        padding: 12px 20px;
        font-size: 16px;
        width: 100%;
        margin: 5px 0;
    }
    
    /* Forms */
    input, textarea, select {
        font-size: 16px;
        padding: 12px;
    }
    
    .search-box {
        font-size: 16px;
        padding: 12px;
    }
    
    /* Tables - Convert to card layout on mobile for better UX */
    table {
        display: block;
        width: 100% !important;
    }
    
    /* Hide table headers on mobile */
    table thead {
        display: none;
    }
    
    /* Make table rows stack like cards */
    table tbody {
        display: block;
        width: 100%;
    }
    
    table tbody tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 15px;
        padding: 15px;
        background: #f9f9f9;
        border-radius: 8px;
        border: 1px solid #e0e0e0;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0 !important;
        border: none !important;
        text-align: left !important;
    }
    
    /* Add label before each cell on mobile */
    table tbody td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #333;
        margin-right: 10px;
        min-width: 100px;
    }
    
    /* Action buttons in table */
    table tbody td button {
        width: auto !important;
        margin: 2px !important;
        padding: 8px 15px !important;
    }
    
    /* Ensure action column buttons are visible */
    table tbody td:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-start;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid #ddd !important;
    }
    
    table tbody td:last-child:before {
        content: 'Actions: ';
        width: 100%;
    }
    
    /* Modal */
    .modal-content {
        width: 95%;
        max-height: 85vh;
        padding: 20px;
    }
    
    /* Login Screen */
    .login-box {
        width: 95%;
        padding: 30px 20px;
    }
    
    .login-logo {
        font-size: 40px;
    }
    
    .login-title {
        font-size: 20px;
    }
    
    /* Filter Tabs */
    .filter-tabs {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .filter-tab {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    /* Item Cards */
    .item-card {
        padding: 15px;
    }
    
    .item-card h3 {
        font-size: 18px;
    }
    
    /* Profile Menu */
    .profile-toggle {
        font-size: 12px;
    }
    
    /* Bill List Items */
    .bill-list-item {
        padding: 12px;
        font-size: 14px;
    }
    
    /* Report Cards */
    .report-card {
        padding: 15px;
    }
    
    /* Birthday Badge */
    .birthday-badge {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    /* Dropdown */
    .dropdown-list {
        max-height: 200px;
    }
    
    /* Add Item Bottom */
    .add-item-bottom {
        padding: 15px;
    }
}

/* Extra Small Devices (phones, 480px and down) */
@media (max-width: 480px) {
    .main-content {
        padding: 10px;
        padding-top: 55px;
    }
    
    .header {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .content-area {
        padding: 10px;
    }
    
    .modal-content {
        width: 98%;
        padding: 15px;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .logo {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .menu-item {
        padding: 12px;
        font-size: 14px;
    }
    
    .item-card {
        padding: 12px;
    }
    
    .item-card h3 {
        font-size: 16px;
    }
    
    .login-box {
        padding: 20px 15px;
    }
    
    /* Coupon input container */
    .coupon-input-container {
        flex-direction: column !important;
    }
    
    .coupon-input-container input {
        width: 100% !important;
        margin-bottom: 10px;
    }
    
    .coupon-input-container button {
        width: 100% !important;
        margin-bottom: 5px;
    }
    
    /* Mobile table scrolling for conversion modal */
    #billsListContainer {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-height: 350px;
    }
    
    #unconvertedBillsList table {
        min-width: 100%;
        font-size: 12px;
    }
    
    #unconvertedBillsList th,
    #unconvertedBillsList td {
        padding: 8px 5px !important;
        white-space: nowrap;
    }
    
    /* Ensure checkboxes are visible */
    .bill-checkbox, #selectAllBills {
        width: 18px !important;
        height: 18px !important;
        min-width: 18px !important;
        cursor: pointer;
        margin: 0 auto;
        display: block;
    }
    
    /* Mobile modal adjustments */
    .modal-content {
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
    
    /* Convert to invoice modal specific */
    #convertToInvoiceModal .modal-content {
        width: 95% !important;
        margin: 20px auto !important;
    }
}

/* Landscape Mode for Small Devices */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        padding-top: 15px;
    }
    
    .login-screen {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .login-box {
        margin: 20px auto;
    }
}

/* Touch-friendly Improvements */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn,
    .menu-item,
    .filter-tab,
    .dropdown-item,
    .bill-list-item {
        min-height: 44px;
    }
    
    /* Remove hover states on touch devices */
    .menu-item:hover,
    .item-card:hover,
    .btn:hover {
        transform: none;
    }
    
    /* Better active states for touch */
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    .menu-item:active {
        background: rgba(255,255,255,0.4) !important;
    }
}

/* Invoice Card Styles for Mobile-Responsive View */
.invoice-list-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 10px;
}

.invoice-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.invoice-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.invoice-card-header {
    background: linear-gradient(135deg, #DB3322, #C22D1D);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.invoice-card-body {
    padding: 15px;
    background: #f8f9fa;
}

.invoice-info {
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
    color: #333;
}

.invoice-info:last-child {
    border-bottom: none;
}

.invoice-info .label {
    font-weight: 600;
    color: #666;
    min-width: 80px;
    display: inline-block;
}

.invoice-info .value {
    color: #333;
    font-weight: 500;
}

.invoice-card-actions {
    padding: 15px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    background: white;
}

.btn-sm {
    padding: 8px 12px !important;
    font-size: 13px !important;
    flex: 1;
    min-width: 80px;
    white-space: nowrap;
}

/* Denomination Calculator Responsive Styles */
#denominationRows table {
    width: 100%;
    border-collapse: collapse;
}

#denominationRows input[type="number"] {
    width: 100% !important;
    max-width: 100px;
    padding: 8px;
    text-align: center;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: border-color 0.2s;
}

#denominationRows input[type="number"]:focus {
    border-color: var(--primary-color);
    outline: none;
}

@media (max-width: 768px) {
    /* Make denomination calculator more mobile-friendly */
    #denominationRows td {
        padding: 10px 5px !important;
        font-size: 14px;
    }
    
    #denominationRows input[type="number"] {
        width: 60px !important;
        font-size: 14px;
        padding: 6px;
    }
    
    /* Invoice cards optimization for mobile */
    .invoice-list-container {
        padding: 5px;
        gap: 10px;
    }
    
    .invoice-card-header {
        font-size: 14px;
        padding: 12px;
    }
    
    .invoice-card-body {
        padding: 12px;
    }
    
    .invoice-info {
        font-size: 13px;
        padding: 6px 0;
    }
    
    .invoice-card-actions {
        padding: 10px;
        gap: 6px;
    }
    
    .btn-sm {
        padding: 10px 8px !important;
        font-size: 12px !important;
        min-width: 70px;
    }
}

@media (min-width: 769px) {
    /* On larger screens, show as grid with multiple columns */
    .invoice-list-container {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
        gap: 20px;
        padding: 20px;
    }
}

/* Icon-only buttons for edit/delete */
.btn-icon {
    padding: 8px 12px;
    font-size: 18px;
    line-height: 1;
    min-width: auto;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    transform: scale(1.1);
}

.btn-edit {
    background: #4CAF50;
    color: white;
}

.btn-edit:hover {
    background: #45a049;
}

.btn-delete {
    background: #f44336;
    color: white;
}

.btn-delete:hover {
    background: #da190b;
}

.btn-view {
    background: #2196F3;
    color: white;
}

.btn-view:hover {
    background: #0b7dda;
}

/* ===========================
   MOBILE RESPONSIVE & SAFE AREA
   =========================== */

/* iPhone Safe Area Support */
@supports (padding: max(0px)) {
    body {
        padding-left: max(12px, var(--safe-area-inset-left));
        padding-right: max(12px, var(--safe-area-inset-right));
    }
    
    .sidebar {
        padding-bottom: max(20px, var(--safe-area-inset-bottom));
    }
    
    .modal-content {
        padding-bottom: max(20px, var(--safe-area-inset-bottom));
    }
    
    /* Bottom buttons with safe area */
    .modal-actions,
    .action-buttons {
        padding-bottom: max(15px, var(--safe-area-inset-bottom));
    }
}

/* Small Mobile Phones (< 375px) */
@media (max-width: 374px) {
    body {
        font-size: 14px;
    }
    
    .btn, button {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .modal-content {
        max-width: 95%;
        padding: 15px;
    }
    
    table {
        font-size: 12px;
    }
    
    input, select, textarea {
        font-size: 14px !important; /* Prevent zoom on focus */
    }
}

/* Standard Mobile (375px - 767px) */
@media (max-width: 767px) {
    /* Horizontal scrolling tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
    
    /* Stack forms vertically */
    form > div,
    .form-row {
        flex-direction: column;
        width: 100%;
    }
    
    /* Full width inputs */
    input, select, textarea {
        width: 100% !important;
        max-width: 100%;
    }
    
    /* Touch-friendly spacing */
    .menu-item {
        padding: 15px;
        margin: 5px 0;
    }
    
    /* Larger touch targets */
    .btn-icon {
        padding: 10px 14px;
        font-size: 20px;
    }
    
    /* Modal adjustments */
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* Grid adjustments */
    .item-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* Tablets (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    
    .content-area {
        margin-left: 200px;
    }
    
    .item-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* Landscape Phone Orientation */
@media (max-width: 896px) and (orientation: landscape) {
    .login-box {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-content {
        max-height: 85vh;
        overflow-y: auto;
    }
    
    /* Compact spacing in landscape */
    .content-area {
        padding: 10px;
    }
}

/* iPhone X/XS/11/12/13/14 series (notch devices) */
@media only screen 
  and (device-width: 375px) 
  and (device-height: 812px) 
  and (-webkit-device-pixel-ratio: 3) {
    .sidebar {
        padding-top: calc(20px + var(--safe-area-inset-top));
    }
}

/* iPhone 14 Pro/Pro Max (Dynamic Island) */
@media only screen 
  and (device-width: 393px) 
  and (device-height: 852px) 
  and (-webkit-device-pixel-ratio: 3) {
    body {
        padding-top: max(20px, var(--safe-area-inset-top));
    }
}

/* Large Tablets and Desktop */
@media (min-width: 1025px) {
    /* Optimize for larger screens */
    .content-area {
        max-width: 1400px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .modal-content {
        max-width: 800px;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .menu-item,
    .btn,
    button {
        display: none;
    }
    
    body {
        padding: 0;
    }
    
    .content-area {
        margin: 0;
        max-width: 100%;
    }
}

/* High DPI/Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper borders */
    .btn,
    input,
    select,
    .card {
        border-width: 0.5px;
    }
}

/* Dark mode support (future) */
@media (prefers-color-scheme: dark) {
    :root {
        /* Reserved for dark mode implementation */
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===========================
   BILLING SCREEN RESPONSIVE
   =========================== */

/* Billing responsive grid helper */
.responsive-grid {
    display: grid;
}

/* Mobile: Stack billing forms vertically */
@media (max-width: 767px) {
    /* Optimize main content width - remove left margin on mobile */
    .main-content {
        margin-left: 0 !important;
        padding: 15px !important;
    }
    
    /* Customer/Billed By/Comments row */
    #billArea .responsive-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    
    /* Bill items table - convert to card layout on mobile */
    #billArea > div[style*="grid-template-columns"] {
        display: none !important; /* Hide grid header on mobile */
    }
    
    /* Bill row items - card-based layout */
    .bill-row {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 15px;
        padding: 15px;
        background: #f9f9f9;
        border-radius: 8px;
        border: 1px solid #e0e0e0;
    }
    
    .bill-row > div,
    .bill-row > input {
        width: 100% !important;
        margin: 3px 0;
    }
    
    .bill-row button {
        width: 100% !important;
        padding: 10px !important;
    }
    
    /* Payment section - stack vertically */
    #billArea div[style*="display:grid"][style*="grid-template-columns:1fr 1fr auto"],
    #billArea .responsive-grid[style*="grid-template-columns:1fr 1fr auto"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    
    /* Payment section container */
    #billArea div[style*="background:#fff3cd"] {
        padding: 15px !important;
        margin-top: 15px !important;
    }
    
    #billArea div[style*="background:#fff3cd"] h3 {
        font-size: 18px !important;
        margin-bottom: 12px !important;
    }
    
    /* Payment inputs and buttons */
    #billArea div[style*="background:#fff3cd"] select,
    #billArea div[style*="background:#fff3cd"] input {
        width: 100% !important;
        font-size: 16px !important;
        padding: 12px !important;
    }
    
    #billArea div[style*="background:#fff3cd"] button {
        width: 100% !important;
        padding: 12px 20px !important;
        font-size: 16px !important;
        margin-top: 10px;
    }
    
    /* Balance Due section - make text responsive */
    #billArea div[style*="Balance Due"] {
        font-size: 16px !important;
    }
    
    #billArea div[style*="Balance Due"] div {
        flex-wrap: wrap !important;
    }
    
    /* Amount calculation box */
    #billArea > div[style*="background:#f8f8f8"],
    #billArea div[style*="background:#f8f8f8"] {
        font-size: 14px !important;
        padding: 12px !important;
        margin-top: 15px !important;
    }
    
    #billArea > div[style*="background:#f8f8f8"] table,
    #billArea div[style*="background:#f8f8f8"] table {
        font-size: 13px !important;
        width: 100% !important;
    }
    
    #billArea > div[style*="background:#f8f8f8"] table td,
    #billArea div[style*="background:#f8f8f8"] table td {
        padding: 6px 0 !important;
        word-wrap: break-word;
    }
    
    #billArea > div[style*="background:#f8f8f8"] h2,
    #billArea div[style*="background:#f8f8f8"] h2 {
        font-size: 18px !important;
        margin: 5px 0 !important;
    }
    
    /* Coupon section */
    #billArea div[style*="background:#fff5f5"] {
        padding: 15px !important;
        margin-top: 15px !important;
    }
    
    #billArea div[style*="background:#fff5f5"] h4 {
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }
    
    .coupon-input-container {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .coupon-input-container input {
        width: 100% !important;
        font-size: 16px !important;
        padding: 12px !important;
    }
    
    .coupon-input-container button {
        width: 100% !important;
        padding: 12px !important;
        font-size: 16px !important;
    }
    
    /* Payment history */
    #billArea div[style*="Payment History"] > div {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    #billArea div[style*="Payment History"] button {
        margin-top: 8px;
        width: 100%;
    }
    
    /* Save/Print/Close buttons */
    #billArea > div:last-child {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    #billArea > div:last-child button {
        width: 100%;
        padding: 15px !important;
        font-size: 16px !important;
    }
}

/* Additional billing improvements */
@media (max-width: 767px) {
    /* Ensure no overlays or floating elements in billing area */
    #billArea * {
        position: relative !important;
    }
    
    /* Better alignment for form inputs */
    #billArea input[type="text"],
    #billArea input[type="number"],
    #billArea input[type="date"],
    #billArea input[type="time"],
    #billArea select {
        box-sizing: border-box;
        width: 100%;
    }
}

/* Tablets: Slightly better layout */
@media (min-width: 768px) and (max-width: 1024px) {
    .main-content {
        margin-left: 200px !important;
        padding: 20px !important;
    }
    
    .sidebar {
        width: 200px !important;
    }
    
    .bill-row {
        display: grid;
        grid-template-columns: 1.5fr 0.6fr 0.8fr 0.6fr 0.8fr 1fr 60px;
        gap: 6px;
        padding: 10px;
        background: #f9f9f9;
        border-radius: 5px;
        margin-bottom: 10px;
    }
}

/* Desktop: Optimize space usage */
@media (min-width: 1025px) {
    .bill-row {
        display: grid;
        grid-template-columns: 2fr 0.8fr 1fr 0.8fr 1fr 1.2fr auto;
        gap: 10px;
        padding: 12px;
        background: #f9f9f9;
        border-radius: 5px;
        margin-bottom: 10px;
        align-items: center;
    }
    
    .bill-row > div,
    .bill-row > input {
        margin: 0;
    }
    
    #billArea .responsive-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }
}
}