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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4eee5; /* soft sand like the cup background */
    min-height: 100vh;
    padding: 10px;
}

/* Takaza tea shop color scheme inspired by cup */
:root {
    --tea-primary: #b53030;      /* deep red from pattern/logo */
    --tea-primary-dark: #7e2020; /* darker red */
    --tea-black: #111111;        /* for accents and text */
    --tea-sand: #f4eee5;         /* page background */
    --tea-cream: #fff8ec;        /* card background */
    --tea-border: #c7b092;       /* warm beige border */
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--tea-cream);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.16);
    overflow: hidden;
}

/* Improved touch targets for iPad and mobile */
button, .nav-btn, .btn-primary, .btn-secondary, .btn-danger,
.payment-btn, .quantity-btn, .pagination-btn {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

header {
    background: var(--tea-cream);
    color: var(--tea-black);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-bottom: 4px solid var(--tea-border);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 30px;
    border-bottom: 0;
    position: relative;
}

/* Decorative band inspired by cup pattern */
header::before,
header::after {
    content: "";
    display: block;
    height: 10px;
    background-image: repeating-linear-gradient(
        90deg,
        var(--tea-primary) 0,
        var(--tea-primary) 12px,
        #ffffff 12px,
        #ffffff 18px,
        var(--tea-black) 18px,
        var(--tea-black) 22px,
        #ffffff 22px,
        #ffffff 28px
    );
}

header::before {
    border-bottom: 1px solid var(--tea-border);
}

header::after {
    border-top: 1px solid var(--tea-border);
}

.header-logo-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.header-logo {
    width: 110px;
    height: 110px;
    object-fit: contain;
    display: block;
}

.header-title {
    font-size: 1.8em;
    margin: 0;
    font-weight: 600;
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 0;
}

header h1 {
    font-size: 1.8em;
    margin: 0;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-roles {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.role-badge-small {
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

/* Language Switch */
.language-switcher-container {
    display: flex;
    align-items: center;
}

.language-switch {
    position: relative;
    display: inline-block;
    width: 70px;
    height: 32px;
    cursor: pointer;
}

.language-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: 0.3s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 4px;
    bottom: 4px;
    background-color: var(--tea-primary);
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 3px 6px rgba(181, 48, 48, 0.35);
}

input:checked + .slider {
    background-color: rgba(255, 255, 255, 0.4);
}

input:checked + .slider:before {
    left: auto;
    right: 4px;
}

.lang-text {
    font-size: 11px;
    font-weight: 600;
    z-index: 1;
    transition: opacity 0.3s, color 0.3s, order 0.3s;
    position: relative;
}

/* Default state (Arabic selected): Arabic on right (order: 2), English on left (order: 1) */
.lang-text.lang-ar {
    opacity: 1;
    color: #ffffff;
    order: 2;
}

.lang-text.lang-en {
    opacity: 0.5;
    color: #5C4A3A;
    order: 1;
}

/* When checked (English selected): English on right (order: 2), Arabic on left (order: 1) */
input:checked + .slider .lang-text.lang-en {
    opacity: 1;
    color: #ffffff;
    order: 2;
}

input:checked + .slider .lang-text.lang-ar {
    opacity: 0.5;
    color: #5C4A3A;
    order: 1;
}

.btn-logout {
    background: var(--tea-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: var(--tea-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(181, 48, 48, 0.45);
}

/* RTL Support for Header */
[dir="rtl"] .header-top {
    flex-direction: row-reverse;
}

[dir="rtl"] .header-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .user-info {
    flex-direction: row-reverse;
}

[dir="rtl"] .user-details {
    text-align: right;
}

/* Responsive Header */
@media (max-width: 768px) {
    .header-top {
        flex-direction: row;
        gap: 10px;
        padding: 12px 15px;
        align-items: center;
        position: relative;
    }
    
    .header-logo-container {
        position: static;
        transform: none;
        margin: 0;
        flex-shrink: 0;
    }
    
    .header-logo {
        width: 45px;
        height: 45px;
        margin: 0;
    }
    
    .header-title {
        font-size: 1.2em;
        display: none; /* Hide title on mobile to save space */
    }
    
    header h1 {
        font-size: 1.2em;
    }
    
    .header-actions {
        width: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 8px;
        flex: 1;
        margin-left: auto;
    }
    
    .user-info {
        flex: 0 0 auto;
        min-width: auto;
        padding: 6px 12px;
        gap: 8px;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .user-details {
        display: none; /* Hide user details text on very small screens */
    }
    
    .user-name {
        font-size: 11px;
    }
    
    .user-roles {
        font-size: 9px;
        display: none; /* Hide roles on mobile */
    }
    
    .language-switcher-container {
        flex-shrink: 0;
    }
    
    .language-switch {
        width: 60px;
        height: 28px;
    }
    
    .slider:before {
        height: 20px;
        width: 20px;
    }
    
    input:checked + .slider:before {
        transform: translateX(32px);
    }
    
    .btn-logout {
        padding: 8px 14px;
        font-size: 12px;
        border-radius: 16px;
        white-space: nowrap;
        flex-shrink: 0;
        min-height: 36px;
    }
    
    nav {
        padding: 10px 12px;
        gap: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    nav::-webkit-scrollbar {
        display: none;
    }
}

nav {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.1);
}

.nav-btn {
    padding: 10px 22px;
    background: transparent;
    border: 2px solid transparent;
    color: #5C4A3A;
    border-radius: 999px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.4);
    transform: translateY(-1px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.nav-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.nav-btn.active {
    background: transparent;
    color: var(--tea-primary-dark);
    font-weight: 700;
    border-color: var(--tea-primary);
    box-shadow: none;
}

.page {
    display: none;
    padding: 30px;
    padding-bottom: 80px; /* Space for footer */
    min-height: calc(100vh - 250px);
}

.page.active {
    display: block;
}

/* Footer */
.app-footer {
    background: linear-gradient(135deg, #5C4A3A 0%, #3d2f23 100%);
    color: #fff;
    padding: 20px 30px;
    margin-top: 40px;
    border-top: 4px solid #b53030;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-item {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.footer-item strong {
    color: #fff;
    font-weight: 600;
}

@media (max-width: 768px) {
    .app-footer {
        padding: 15px;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .footer-item {
        font-size: 12px;
    }
}

.page h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2em;
}

/* Sales Page */
.sales-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}

.cart-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.cart-section h3 {
    margin-bottom: 15px;
    color: #C9B99A;
}

#cart-items {
    min-height: 200px;
    margin-bottom: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

#cart-items::-webkit-scrollbar {
    width: 6px;
}

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

#cart-items::-webkit-scrollbar-thumb {
    background: #E8D5B7;
    border-radius: 10px;
}

#cart-items::-webkit-scrollbar-thumb:hover {
    background: #C9B99A;
}

.cart-item {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.cart-item.insufficient-stock {
    background: #ffe6e6;
    border: 2px solid #ff6b6b;
}

.cart-item-info {
    flex: 1;
}

.cart-item-info strong {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-size: 16px;
}

.cart-item.insufficient-stock .cart-item-info strong {
    color: #ff6b6b;
}

.cart-item .insufficient-stock-message {
    color: #ff6b6b;
    font-weight: bold;
    font-size: 0.85em;
    margin: 5px 0;
}

.cart-item-price {
    color: #C9B99A;
    font-weight: bold;
    margin-top: 5px;
}

.cart-item-customizations {
    color: #28a745;
    font-size: 0.9em;
    margin-top: 5px;
    font-weight: 500;
}

.cart-item-notes {
    color: #6c757d;
    font-size: 0.85em;
    margin-top: 5px;
    font-style: italic;
    padding: 5px;
    background: #f8f9fa;
    border-radius: 5px;
    border-right: 3px solid #E8D5B7;
}

.cart-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cart-item-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity-btn {
    background: #E8D5B7;
    color: #5C4A3A;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.quantity-btn:hover {
    background: #C9B99A;
    transform: scale(1.1);
}

.quantity-display {
    min-width: 30px;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    color: #333;
}

.cart-total {
    padding: 15px;
    background: #E8D5B7;
    color: #5C4A3A;
    border-radius: 10px;
    text-align: center;
    font-size: 1.5em;
    margin-bottom: 15px;
}

.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-actions .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-actions .form-group label {
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.cart-actions input {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    width: 100%;
}

/* Payment Method Buttons */
.payment-method-buttons {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.payment-btn {
    flex: 1;
    padding: 16px 24px;
    border: 2px solid #e9ecef;
    border-radius: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #495057;
    position: relative;
    overflow: hidden;
}

.payment-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.05), rgba(212, 196, 168, 0.05));
    opacity: 0;
    transition: opacity 0.3s;
}

.payment-btn:hover {
    border-color: var(--tea-primary);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.payment-btn:hover::before {
    opacity: 1;
}

.payment-btn.active {
    background: linear-gradient(135deg, var(--tea-primary), var(--tea-secondary));
    border-color: var(--tea-primary);
    color: white;
    box-shadow: 0 6px 20px rgba(139, 69, 19, 0.4);
    transform: translateY(-2px);
}

.payment-btn.active::before {
    opacity: 0;
}

.payment-icon {
    font-size: 32px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.payment-btn.active .payment-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.products-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.product-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.product-card.insufficient-stock {
    background: #ffe6e6;
    border: 2px solid #ff6b6b;
    opacity: 0.7;
    cursor: not-allowed;
}

.product-card.insufficient-stock:hover {
    transform: none;
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
}

.product-card h4 {
    color: #C9B99A;
    margin-bottom: 10px;
}

.product-card.insufficient-stock h4 {
    color: #ff6b6b;
}

.product-card .available-cups {
    color: #28a745;
    font-weight: bold;
    margin: 10px 0;
}

.product-card.insufficient-stock .available-cups {
    color: #ff6b6b;
}

.product-card .insufficient-stock-message {
    color: #ff6b6b;
    font-weight: bold;
    font-size: 0.9em;
    margin: 5px 0;
}

.product-card .price {
    color: #333;
    font-size: 1.2em;
    margin: 10px 0;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--tea-primary) 0%, var(--tea-primary-dark) 100%);
    margin: 10px;
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-secondary-filter {
    margin-top: 20px;
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 14px;
}

.btn-danger:hover {
    background: #c82333;
}

/* Inventory Item Action Buttons */
.btn-edit-item,
.btn-delete-item {
    min-width: auto;
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn-edit-item {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
}

.btn-edit-item:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(108, 117, 125, 0.4);
}

.btn-delete-item {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.btn-delete-item:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(231, 76, 60, 0.4);
}

.edit-icon,
.delete-icon {
    font-size: 14px;
    line-height: 1;
}

/* Storage page specific button sizing */
#storage-page #add-item-btn {
    font-size: 13px;
    padding: 8px 18px;
    margin: 10px 0;
}

#storage-page .inventory-table .btn-primary {
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 18px;
    margin: 0;
}

.btn-cancel-invoice {
    margin-top: 10px;
    min-width: auto;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.btn-cancel-invoice:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.5);
}

.btn-cancel-invoice:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.4);
}

.cancel-icon {
    font-size: 18px;
    line-height: 1;
}

/* Inventory Filters */
.inventory-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* Language buttons removed - using switch now */

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.filter-group input[type="date"] {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

/* Inventory Table */
.inventory-table {
    margin-top: 20px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

thead {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
    color: #5C4A3A;
}

th, td {
    padding: 10px 8px;
    text-align: right;
    font-size: 12px;
    white-space: nowrap;
}

th {
    font-size: 13px;
    font-weight: 600;
}

tbody tr {
    border-bottom: 1px solid #eee;
}

tbody tr:hover {
    background: #f8f9fa;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.close {
    color: #aaa;
    float: left;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #C9B99A;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    /* gap: 8px; */
}

.form-group label {
    font-weight: bold;
    color: #333;
    font-size: 14px;
    margin-top: 8px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.modal-content input,
.modal-content select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    width: 100%;
}

/* RTL (Arabic) - padding on right for password fields */
[dir="rtl"] .password-group input[type="password"],
[dir="rtl"] .password-group input[type="text"] {
    padding-right: 45px;
}

/* LTR (English) - padding on left for password fields */
[dir="ltr"] .password-group input[type="password"],
[dir="ltr"] .password-group input[type="text"] {
    padding-left: 45px;
}

.password-group {
    position: relative;
}

.password-group > div {
    position: relative;
}

.password-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #5C4A3A;
    user-select: none;
    transition: color 0.3s, opacity 0.3s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

/* RTL (Arabic) - icon on left */
[dir="rtl"] .password-toggle {
    left: 15px;
    right: auto;
}

/* LTR (English) - icon on right */
[dir="ltr"] .password-toggle {
    right: 15px;
    left: auto;
}

.password-toggle:hover {
    color: #C9B99A;
    opacity: 0.8;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

.password-group input[type="password"],
.password-group input[type="text"] {
    padding-right: 45px;
}

.modal-content input:focus,
.modal-content select:focus {
    outline: none;
    border-color: #C9B99A;
}

.modal-content input[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.ingredient-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    align-items: center;
}

.recipe-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.recipe-card-image {
    flex-shrink: 0;
    width: 150px;
    height: 150px;
    border-radius: 10px;
    overflow: hidden;
}

.recipe-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recipe-card-content {
    flex: 1;
}

.recipe-card h4 {
    color: #C9B99A;
    margin-bottom: 10px;
}

.recipe-card .available-cups {
    background: #28a745;
    color: #5C4A3A;
    padding: 10px 20px;
    border-radius: 20px;
    display: inline-block;
    margin: 10px 0;
    font-weight: bold;
}

.sale-report-item {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sale-report-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Thermal invoice styling for screen display */
.thermal-invoice {
    font-family: 'Courier New', monospace;
    max-width: 57mm;
    margin: 0 auto;
}

.thermal-invoice h2 {
    font-size: 14px;
    margin: 0 0 3px 0;
}

.thermal-invoice p {
    font-size: 9px;
    margin: 1px 0;
}

.thermal-invoice table {
    font-size: 8px;
    width: 100%;
}

.thermal-invoice table th,
.thermal-invoice table td {
    font-size: 7px;
    padding: 2px 1px;
}

.thermal-invoice small {
    font-size: 6px;
}

@media print {
    @page {
        size: 57mm auto;
        margin: 0;
        padding: 0;
    }
    
    * {
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box;
    }
    
    html, body {
        width: 57mm !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }
    
    /* Hide everything by default except invoice modal */
    body > *:not(#invoice-modal) {
        display: none !important;
    }
    
    /* Show invoice modal */
    #invoice-modal {
        display: block !important;
        position: static !important;
        background: transparent !important;
        z-index: 1 !important;
        visibility: visible !important;
    }
    
    #invoice-modal .modal-content {
        display: block !important;
        position: static !important;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    
    #invoice-modal .close,
    #invoice-modal button {
        display: none !important;
    }
    
    /* Show only invoice content */
    #invoice-content {
        display: block !important;
        position: relative !important;
        left: 0 !important;
        top: 0 !important;
        width: 57mm !important;
        max-width: 57mm !important;
        margin: 0 !important;
        padding: 5mm 3mm !important;
        font-size: 9px !important;
        line-height: 1.2 !important;
        color: #000 !important;
        background: white !important;
        page-break-after: auto !important;
        page-break-inside: avoid !important;
    }
    
    #invoice-content * {
        display: revert !important;
    }
    
    #invoice-content .thermal-invoice {
        width: 100%;
    }
    
    #invoice-content h2 {
        font-size: 12px;
        font-weight: bold;
        margin: 0 0 3px 0;
        padding: 0;
        text-align: center;
    }
    
    #invoice-content p {
        font-size: 8px;
        margin: 2px 0;
        padding: 0;
        line-height: 1.2;
    }
    
    #invoice-content hr {
        margin: 3px 0;
        border: none;
        border-top: 1px solid #000;
    }
    
    #invoice-content table {
        width: 100%;
        font-size: 8px;
        border-collapse: collapse;
        margin: 3px 0;
    }
    
    #invoice-content table thead {
        display: table-header-group;
    }
    
    #invoice-content table thead th {
        font-size: 7px;
        font-weight: bold;
        padding: 2px 1px;
        text-align: left;
        border-bottom: 1px solid #000;
    }
    
    #invoice-content table tbody td {
        font-size: 7px;
        padding: 2px 1px;
        text-align: left;
        vertical-align: top;
    }
    
    #invoice-content table tfoot td {
        font-size: 9px;
        font-weight: bold;
        padding: 3px 1px;
        border-top: 1px solid #000;
    }
    
    #invoice-content small {
        font-size: 6px;
        display: block;
        margin-top: 1px;
    }
    
    /* Cancelled invoice styling for print */
    #invoice-content div[style*="CANCELLED"],
    #invoice-content div[style*="ملغاة"] {
        font-size: 11px !important;
        font-weight: bold !important;
        color: #000 !important;
        background: #fff !important;
        border: 2px solid #000 !important;
        padding: 2px !important;
        margin-bottom: 3px !important;
        text-align: center !important;
    }
    
}

/* Tabs */
.admin-tabs, .products-tabs, .recipe-modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
}

.tab-btn, .products-tab-btn, .recipe-tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
    position: relative;
    bottom: -2px;
}

.tab-btn:hover, .products-tab-btn:hover, .recipe-tab-btn:hover {
    color: #C9B99A;
    background: rgba(102, 126, 234, 0.1);
}

.tab-btn.active, .products-tab-btn.active, .recipe-tab-btn.active {
    color: #C9B99A;
    border-bottom-color: #C9B99A;
    font-weight: bold;
}

.tab-content, .products-tab-content, .recipe-tab-content {
    display: none;
}

.tab-content.active, .products-tab-content.active, .recipe-tab-content.active {
    display: block;
}

.special-order-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
}

/* User Management Styles */
.user-modal-content {
    max-width: 600px;
}

.user-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.form-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.section-title {
    color: #C9B99A;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 5px;
}

.required-star {
    color: #e74c3c;
    font-size: 16px;
    margin-right: 5px;
}

.form-hint {
    color: #6c757d;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Roles Grid */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 10px;
}

.role-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.role-checkbox:hover {
    border-color: #C9B99A;
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.role-checkbox input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 22px;
    height: 22px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    position: relative;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.role-checkbox input[type="checkbox"]:checked + .checkbox-custom {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
    border-color: #C9B99A;
}

.role-checkbox input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #5C4A3A;
    font-size: 14px;
    font-weight: bold;
}

.role-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.role-name {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.role-name-en {
    font-size: 12px;
    color: #6c757d;
    font-weight: 400;
}

/* Status Checkbox */
.status-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.status-checkbox:hover {
    border-color: #C9B99A;
    background: #f0f4ff;
}

.status-checkbox input[type="checkbox"] {
    display: none;
}

.status-checkbox .checkbox-custom {
    width: 22px;
    height: 22px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    position: relative;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.status-checkbox input[type="checkbox"]:checked + .checkbox-custom {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
    border-color: #C9B99A;
}

.status-checkbox input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #5C4A3A;
    font-size: 14px;
    font-weight: bold;
}

.status-label {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 10px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

.form-actions .btn-primary,
.form-actions .btn-secondary {
    margin: 0;
    min-width: 120px;
}

.error-message {
    color: #e74c3c;
    background: #ffeaea;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    display: none;
    font-size: 14px;
    margin-bottom: 15px;
}

.error-message:not(:empty) {
    display: block;
}

/* Users Table Improvements */
.users-table {
    margin-top: 20px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.users-table table {
    margin: 0;
    width: 100%;
    border-collapse: collapse;
}

.users-table thead tr {
    background: linear-gradient(135deg, #C9B99A 0%, #D4C4A8 100%);
    color: #5C4A3A;
}

.users-table th {
    padding: 12px;
    text-align: right;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #E8D5B7;
}

[dir="ltr"] .users-table th {
    text-align: left;
}

.users-table tbody tr {
    transition: background-color 0.2s ease;
}

.users-table tbody tr:hover {
    background-color: #F5EDE0;
}

.users-table td {
    padding: 12px;
    border-bottom: 1px solid #E8D5B7;
    vertical-align: middle;
}

.role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin: 2px;
    background: #e9ecef;
    color: #495057;
}

.role-badge.admin {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
    color: #5C4A3A;
}

.role-badge.worker {
    background: #17a2b8;
    color: white;
}

.role-badge.warehouse_manager {
    background: #28a745;
    color: white;
}

.role-badge.sales_manager {
    background: #ffc107;
    color: #333;
}

.role-badge.reports_viewer {
    background: #17a2b8;
    color: white;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.active {
    background: #28a745;
    color: white;
}

.status-badge.inactive {
    background: #dc3545;
    color: white;
}

@media (max-width: 768px) {
    body {
        padding: 5px;
        font-size: 14px;
    }
    
    .container {
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.2);
        margin: 0 auto;
        max-width: 100%;
        overflow: hidden;
    }
    
    .page {
        padding: 15px 12px;
        min-height: auto;
    }
    
    .page h2 {
        font-size: 1.5em;
        margin-bottom: 15px;
        padding: 0;
        line-height: 1.3;
    }
    
    /* Better spacing for all pages on mobile */
    .page > * {
        margin-bottom: 15px;
    }
    
    .page > *:last-child {
        margin-bottom: 0;
    }
    
    .sales-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
    
    .product-card {
        padding: 15px;
    }
    
    .cart-section {
        padding: 15px;
    }
    
    .roles-grid {
        grid-template-columns: 1fr;
    }
    
    .user-modal-content {
        max-width: 95%;
        padding: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions .btn-primary,
    .form-actions .btn-secondary {
        width: 100%;
        padding: 14px;
    }
    
    .nav-btn {
        padding: 10px 14px;
        font-size: 13px;
        flex: 0 0 auto;
        min-width: 70px;
        white-space: nowrap;
        border-radius: 20px;
        min-height: 40px;
    }
    
    nav {
        padding: 10px 12px;
        gap: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: flex-start;
    }
    
    nav::-webkit-scrollbar {
        display: none;
    }
    
    .header-logo {
        width: 45px;
        height: 45px;
    }
    
    .header-title {
        font-size: 1.2em;
    }
    
    /* Improve header on very small screens */
    @media (max-width: 480px) {
        .header-top {
            padding: 10px 12px;
        }
        
        .header-logo {
            width: 40px;
            height: 40px;
        }
        
        .user-info {
            padding: 5px 10px;
        }
        
        .user-avatar {
            width: 28px;
            height: 28px;
            font-size: 12px;
        }
        
        .btn-logout {
            padding: 7px 12px;
            font-size: 11px;
            min-height: 32px;
        }
        
        .language-switch {
            width: 55px;
            height: 26px;
        }
        
        .slider:before {
            height: 18px;
            width: 18px;
        }
        
        input:checked + .slider:before {
            transform: translateX(29px);
        }
        
        .nav-btn {
            padding: 9px 12px;
            font-size: 12px;
            min-width: 65px;
            min-height: 38px;
        }
    }
    
    .btn-primary, .btn-secondary, .btn-danger {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .cart-total {
        font-size: 1.3em;
        padding: 12px;
    }
    
    .payment-btn {
        padding: 14px 12px;
        font-size: 13px;
    }
    
    .quantity-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* iPad specific optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .nav-btn {
        padding: 14px 22px;
    }
    
    .page {
        padding: 25px;
    }
}

/* Toast Messages */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    min-width: 300px;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out, fadeOut 0.3s ease-in 2.7s;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.5);
    animation: progressBar 3s linear forwards;
}

.toast-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.toast-error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.toast-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #333;
}

.toast-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes progressBar {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Confirm Dialog */
.confirm-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.confirm-dialog.show {
    display: flex;
}

.confirm-dialog-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
    text-align: center;
}

.confirm-dialog-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

.confirm-dialog-content h3 {
    color: #333;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 15px;
}

.confirm-dialog-content p {
    color: #666;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 25px;
}

.confirm-dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-confirm-yes,
.btn-confirm-no {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 100px;
}

.btn-confirm-yes {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
    color: #5C4A3A;
}

.btn-confirm-yes:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-confirm-no {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e9ecef;
}

.btn-confirm-no:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

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

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

/* RTL Support for Toast */
[dir="rtl"] #toast-container {
    right: auto;
    left: 20px;
}

[dir="rtl"] .toast {
    animation: slideInLeft 0.3s ease-out, fadeOutLeft 0.3s ease-in 2.7s;
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    padding: 20px;
}

.pagination-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
    color: #5C4A3A;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pagination-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.pagination-btn:disabled:not(.active) {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc;
}

.pagination-info {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    padding: 10px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.pagination-ellipsis {
    padding: 10px 5px;
    color: #5C4A3A;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.pagination-btn.active {
    background: linear-gradient(135deg, #5C4A3A 0%, #8B6F47 100%);
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 8px rgba(92, 74, 58, 0.3);
}

.pagination-btn.active:disabled {
    cursor: default;
    opacity: 1;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOutLeft {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateX(-100%);
    }
}

/* Dashboard Styles */
.dashboard-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-title {
    text-align: center;
    color: #5C4A3A;
    font-size: 2.5em;
    margin-bottom: 30px;
    font-weight: bold;
}

.dashboard-section {
    margin-bottom: 40px;
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.section-title {
    color: #5C4A3A;
    font-size: 1.5em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #E8D5B7;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.stat-icon {
    font-size: 3em;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-label {
    color: #5C4A3A;
    font-size: 0.9em;
    margin-bottom: 5px;
    font-weight: 500;
}

.stat-value {
    color: #5C4A3A;
    font-size: 2em;
    font-weight: bold;
}

.stat-sublabel {
    color: #8B6F47;
    font-size: 0.8em;
    margin-top: 5px;
}

.revenue-card {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
}

.orders-card {
    background: linear-gradient(135deg, #D4C4A8 0%, #C9B99A 100%);
}

/* Payment Method Grid */
.payment-method-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* Revenue Chart Styles */
.chart-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    min-height: 400px;
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.chart-period-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.section-description {
    color: #8B6F47;
    font-size: 0.9em;
    margin-bottom: 20px;
    font-style: italic;
    line-height: 1.5;
}

.period-btn {
    padding: 10px 20px;
    border: 2px solid #E8D5B7;
    background: white;
    color: #5C4A3A;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    min-height: 44px;
}

.period-btn:hover {
    background: #f8f6f3;
    border-color: #C9B99A;
    transform: translateY(-2px);
}

.period-btn.active {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
    color: #5C4A3A;
    border-color: #C9B99A;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.payment-stat-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 2px solid #E8D5B7;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.payment-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.cash-card {
    border-color: #28a745;
}

.bank-card {
    border-color: #007bff;
}

.payment-icon {
    font-size: 2.5em;
    margin-bottom: 15px;
}

.payment-label {
    color: #5C4A3A;
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 15px;
}

.payment-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.payment-stat {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #E8D5B7;
    color: #5C4A3A;
    font-size: 1em;
}

.payment-stat:last-child {
    border-bottom: none;
}

.payment-stat span:last-child {
    font-weight: bold;
    color: #8B6F47;
}

/* Account Balances Grid */
.account-balances-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.account-balance-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 2px solid #E8D5B7;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    gap: 20px;
}

.account-balance-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.cash-balance-card {
    border-color: #28a745;
}

.bank-balance-card {
    border-color: #007bff;
}

.account-icon {
    font-size: 3em;
    flex-shrink: 0;
}

.account-content {
    flex: 1;
}

.account-label {
    color: #5C4A3A;
    font-size: 1em;
    margin-bottom: 10px;
    font-weight: 500;
}

.account-value {
    color: #5C4A3A;
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 5px;
}

.account-sublabel {
    color: #8B6F47;
    font-size: 0.9em;
}

/* Cancelled Grid */
.cancelled-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.cancelled-card {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.cancelled-card:hover {
    transform: translateY(-5px);
}

.cancelled-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.cancelled-label {
    color: #721c24;
    font-size: 1em;
    margin-bottom: 10px;
    font-weight: 500;
}

.cancelled-value {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cancelled-count {
    color: #721c24;
    font-size: 2em;
    font-weight: bold;
}

.cancelled-revenue {
    color: #8B6F47;
    font-size: 1.2em;
    font-weight: 600;
}

/* Inventory Stats Grid */
.inventory-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.inventory-stat-card {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.inventory-stat-card:hover {
    transform: translateY(-5px);
}

.low-stock-card {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #ffc107;
}

.inventory-icon {
    font-size: 3em;
    flex-shrink: 0;
}

.inventory-content {
    flex: 1;
}

.inventory-label {
    color: #5C4A3A;
    font-size: 0.9em;
    margin-bottom: 5px;
    font-weight: 500;
}

.inventory-value {
    color: #5C4A3A;
    font-size: 2em;
    font-weight: bold;
}

.inventory-sublabel {
    color: #8B6F47;
    font-size: 0.8em;
    margin-top: 5px;
}

/* Low Stock Section */
.low-stock-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #E8D5B7;
}

.low-stock-title {
    color: #5C4A3A;
    font-size: 1.2em;
    margin-bottom: 15px;
    font-weight: 600;
}

.low-stock-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.low-stock-item {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.low-stock-item:hover {
    background: #ffeaa7;
}

.low-stock-item-name {
    color: #5C4A3A;
    font-weight: 600;
    font-size: 1.1em;
}

.low-stock-item-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.low-stock-stat {
    color: #5C4A3A;
    font-size: 0.95em;
}

.low-stock-percentage {
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9em;
}

.low-stock-percentage.critical {
    background: #dc3545;
    color: white;
}

.low-stock-percentage.warning {
    background: #ffc107;
    color: #5C4A3A;
}

/* Sales ranking */
.selling-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.selling-card {
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    border: 1px solid #eee;
}

.selling-card h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: var(--tea-primary-dark);
}

.selling-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.selling-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    background: #fafafa;
}

.selling-rank {
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tea-primary) 0%, var(--tea-primary-dark) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(181, 48, 48, 0.25);
}

.selling-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.selling-name {
    font-weight: 700;
    color: #333;
}

.selling-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    color: #555;
    font-size: 13px;
}

.selling-stats strong {
    color: var(--tea-primary-dark);
}

.empty-list {
    padding: 10px;
    color: #777;
    font-size: 14px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.sales-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sales-filter input[type="date"] {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.sales-filter .btn-secondary {
    margin: 0;
}

.sales-range-info {
    color: #555;
    font-size: 13px;
}

.table-wrapper {
    overflow-x: auto;
}

.chart-wrapper {
    width: 100%;
    height: 280px;
    margin-bottom: 15px;
}

/* System Stats Grid */
.system-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.system-stat-card {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.system-stat-card:hover {
    transform: translateY(-5px);
}

.system-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.system-label {
    color: #5C4A3A;
    font-size: 1em;
    margin-bottom: 10px;
    font-weight: 500;
}

.system-value {
    color: #5C4A3A;
    font-size: 2.5em;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 10px;
    }
    
    .dashboard-title {
        font-size: 1.8em;
        margin-bottom: 20px;
    }
    
    .stats-grid,
    .payment-method-grid,
    .account-balances-grid,
    .cancelled-grid,
    .inventory-stats-grid,
    .system-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card,
    .payment-stat-card,
    .account-balance-card,
    .cancelled-card,
    .inventory-stat-card,
    .system-stat-card {
        padding: 15px;
    }
    
    .stat-value,
    .inventory-value,
    .system-value {
        font-size: 1.5em;
    }
    
    .low-stock-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .low-stock-item-stats {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .payment-method-grid {
        grid-template-columns: 1fr;
    }
    
    /* Revenue Chart Section - Mobile */
    .dashboard-section {
        padding: 15px;
        margin-bottom: 20px;
        background: #faf9f7;
        border-radius: 12px;
    }
    
    .dashboard-section h3.section-title {
        font-size: 1.2em;
        margin-bottom: 15px;
        color: #5C4A3A;
        font-weight: 600;
    }
    
    .section-description {
        font-size: 0.85em !important;
        margin-bottom: 15px !important;
        padding: 0 5px;
    }
    
    .chart-container {
        padding: 12px;
        min-height: 280px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .chart-period-selector {
        width: 100%;
        justify-content: stretch;
        gap: 8px;
        margin-bottom: 15px;
        background: white;
        padding: 10px;
        border-radius: 12px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    }
    
    .period-btn {
        flex: 1;
        min-width: 0;
        padding: 12px 8px;
        font-size: 12px;
        min-height: 44px;
        border-radius: 8px;
        white-space: nowrap;
        touch-action: manipulation;
    }
    
    .period-btn:active {
        transform: scale(0.95);
    }
    
    /* Chart header layout on mobile */
    .chart-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        margin-bottom: 15px !important;
    }
    
    .chart-header h3 {
        width: 100% !important;
        margin: 0 !important;
        text-align: right;
    }
    
    .revenue-chart-section {
        background: #faf9f7;
    }
    
    .cancelled-grid,
    .inventory-stats-grid,
    .system-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Revenue Chart - Very Small Screens (up to 480px) */
@media (max-width: 480px) {
    .chart-container {
        padding: 10px;
        min-height: 250px;
    }
    
    .chart-period-selector {
        padding: 8px;
        gap: 6px;
    }
    
    .period-btn {
        padding: 10px 6px;
        font-size: 11px;
        min-height: 40px;
    }
    
    .section-description {
        font-size: 0.8em !important;
        line-height: 1.4;
    }
    
    .dashboard-section {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .dashboard-section h3.section-title {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
}

/* Financial Management Styles */
.financial-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.account-balances-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.account-balance-item {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
    border-radius: 15px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.balance-icon {
    font-size: 3em;
    flex-shrink: 0;
}

.balance-info {
    flex: 1;
}

.balance-label {
    color: #5C4A3A;
    font-size: 1em;
    margin-bottom: 10px;
    font-weight: 500;
}

.balance-value {
    color: #5C4A3A;
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 5px;
}

.balance-currency {
    color: #8B6F47;
    font-size: 0.9em;
}

.transactions-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid #E8D5B7;
    border-radius: 8px;
    background: white;
    color: #5C4A3A;
    font-size: 14px;
    cursor: pointer;
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: #C9B99A;
}

.transactions-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

/* Mobile cards container - hidden by default on desktop */
.transactions-cards-container {
    display: none;
}

.transactions-table-container::-webkit-scrollbar {
    height: 8px;
}

.transactions-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.transactions-table-container::-webkit-scrollbar-thumb {
    background: #E8D5B7;
    border-radius: 4px;
}

.transactions-table-container::-webkit-scrollbar-thumb:hover {
    background: #D4C4A8;
}

.transactions-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.transactions-table thead {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
}

.transactions-table th {
    padding: 15px;
    text-align: right;
    color: #5C4A3A;
    font-weight: bold;
    border-bottom: 2px solid #C9B99A;
}

.transactions-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #E8D5B7;
    color: #333;
}

.transactions-table tbody tr:hover {
    background: #f8f9fa;
}

.transactions-table .amount.positive {
    color: #28a745;
    font-weight: bold;
}

.transactions-table .amount.negative {
    color: #dc3545;
    font-weight: bold;
}

.receipt-link {
    color: #E8D5B7;
    text-decoration: none;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 5px;
    background: #5C4A3A;
    transition: all 0.3s;
}

.receipt-link:hover {
    background: #8B6F47;
    color: white;
}

/* Responsive Design for Financial Page - Mobile Phones (up to 480px) */
@media (max-width: 480px) {
    #financial-page {
        padding: 10px 5px;
    }
    
    .financial-section {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 12px;
        background: #faf9f7;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    }
    
    .section-title {
        font-size: 1.1em;
        margin-bottom: 15px;
        color: #5C4A3A;
        font-weight: 600;
    }
    
    .page-title {
        font-size: 1.5em;
        margin-bottom: 20px;
        color: #5C4A3A;
    }
    
    /* Improve spacing and organization */
    .financial-buttons-container {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-top: 15px;
    }
    
    .financial-buttons-container button {
        width: 100%;
    }
    
    .account-balances-display {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .account-balance-item {
        padding: 18px;
        flex-direction: column;
        text-align: center;
        gap: 12px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .balance-icon {
        font-size: 2.5em;
    }
    
    .balance-value {
        font-size: 2em;
        font-weight: bold;
    }
    
    .balance-label {
        font-size: 0.9em;
        font-weight: 500;
    }
    
    .financial-stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .financial-stat-card {
        padding: 18px;
        flex-direction: column;
        text-align: center;
        gap: 12px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .stat-icon {
        font-size: 2.5em;
    }
    
    .stat-value {
        font-size: 1.5em;
        font-weight: bold;
    }
    
    .stat-label {
        font-size: 0.85em;
        font-weight: 500;
        line-height: 1.4;
    }
    
    .stat-breakdown {
        display: flex;
        flex-direction: column;
        gap: 6px;
        margin-top: 8px;
        font-size: 0.85em;
    }
    
    .stat-count {
        font-size: 0.85em;
        color: #8B6F47;
        margin-top: 6px;
    }
    
    .date-range-filter {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        gap: 12px;
        background: white;
        border-radius: 10px;
        margin-bottom: 15px;
    }
    
    .date-range-filter .btn-primary,
    .date-range-filter .btn-secondary {
        width: 100%;
        min-width: 100%;
    }
    
    .date-input-group {
        min-width: 100%;
    }
    
    .date-input-group label {
        font-size: 0.9em;
    }
    
    .date-input {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .transactions-filters {
        flex-direction: column;
        gap: 12px;
        padding: 15px;
        background: white;
        border-radius: 10px;
        margin-bottom: 15px;
    }
    
    .filter-select {
        width: 100%;
        min-width: 100%;
        padding: 10px 12px;
        font-size: 14px;
    }
    
    /* Hide table on mobile, show cards instead */
    .transactions-table-container {
        display: none;
    }
    
    .transactions-cards-container {
        display: block;
        margin-top: 15px;
    }
    
    .transaction-card {
        background: white;
        border-radius: 12px;
        padding: 15px;
        margin-bottom: 15px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        border-right: 4px solid #E8D5B7;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        touch-action: manipulation;
    }
    
    .transaction-card:active {
        transform: scale(0.98);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    }
    
    .transaction-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        padding-bottom: 10px;
        border-bottom: 1px solid #E8D5B7;
    }
    
    .transaction-card-date {
        font-weight: bold;
        color: #5C4A3A;
        font-size: 0.95em;
    }
    
    .transaction-card-amount {
        font-size: 1.2em;
        font-weight: bold;
    }
    
    .transaction-card-amount.positive {
        color: #28a745;
    }
    
    .transaction-card-amount.negative {
        color: #dc3545;
    }
    
    .transaction-card-body {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        font-size: 0.9em;
    }
    
    .transaction-card-item {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    
    .transaction-card-label {
        color: #8B6F47;
        font-size: 0.85em;
        font-weight: 500;
    }
    
    .transaction-card-value {
        color: #5C4A3A;
        font-weight: 600;
    }
    
    .transaction-card-item.full-width {
        grid-column: 1 / -1;
    }
    
    .transaction-card-receipt {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid #E8D5B7;
    }
    
    .transaction-card-receipt .receipt-link {
        display: inline-block;
        padding: 8px 16px;
        font-size: 0.9em;
    }
    
    .pagination-container {
        flex-wrap: wrap;
        gap: 8px;
        padding: 15px 10px;
        justify-content: center;
        margin-top: 15px;
    }
    
    .pagination-btn {
        padding: 10px 14px;
        font-size: 0.9em;
        min-width: 44px;
        min-height: 44px;
        width: auto;
        border-radius: 8px;
    }
    
    .pagination-ellipsis {
        padding: 8px 2px;
        font-size: 0.9em;
    }
    
    .pagination-info {
        font-size: 0.9em;
        padding: 8px 16px;
        text-align: center;
        width: 100%;
    }
    
    /* Buttons in financial section */
    .financial-section button {
        width: 100%;
        margin: 5px 0;
        padding: 14px;
        min-height: 44px; /* Minimum touch target size */
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Ensure all interactive elements have proper touch targets */
    .filter-select,
    .date-input {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Modal responsive */
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
        max-height: 85vh;
    }
    
    .modal-content h3 {
        font-size: 1.2em;
    }
    
    .modal-content input,
    .modal-content select {
        padding: 10px;
        font-size: 14px;
    }
}

/* Responsive Design for Financial Page - Tablets/iPads (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .financial-section {
        padding: 20px;
        margin-bottom: 25px;
    }
    
    .section-title {
        font-size: 1.2em;
    }
    
    .page-title {
        font-size: 1.8em;
    }
    
    .account-balances-display {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    
    .account-balance-item {
        padding: 20px;
    }
    
    .balance-icon {
        font-size: 2.8em;
    }
    
    .balance-value {
        font-size: 2.2em;
    }
    
    .financial-stats-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    
    .financial-stat-card {
        padding: 20px;
    }
    
    .stat-icon {
        font-size: 2.8em;
    }
    
    .stat-value {
        font-size: 1.8em;
    }
    
    .date-range-filter {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 18px;
    }
    
    .date-range-filter .btn-primary,
    .date-range-filter .btn-secondary {
        min-width: 100px;
        flex-shrink: 0;
    }
    
    .date-input-group {
        flex: 1;
        min-width: calc(50% - 10px);
    }
    
    .transactions-filters {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .filter-select {
        flex: 1;
        min-width: calc(50% - 10px);
        min-height: 44px;
        font-size: 16px;
    }
    
    /* Show table on tablets, hide cards */
    .transactions-table-container {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .transactions-cards-container {
        display: none;
    }
    
    .transactions-table {
        font-size: 0.85em;
        min-width: 700px;
    }
    
    .financial-section button {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .transactions-table th,
    .transactions-table td {
        padding: 10px;
    }
    
    .pagination-container {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .pagination-btn {
        padding: 10px 16px;
        font-size: 0.95em;
        min-width: 44px;
    }
    
    .pagination-ellipsis {
        padding: 10px 3px;
        font-size: 0.95em;
    }
    
    .modal-content {
        width: 85%;
        padding: 25px;
    }
}

/* Responsive Design for Financial Page - Small Tablets/iPads (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .financial-section {
        padding: 22px;
    }
    
    .section-title {
        font-size: 1.3em;
    }
    
    .page-title {
        font-size: 2em;
    }
    
    .account-balances-display {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .financial-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .date-range-filter {
        flex-wrap: wrap;
    }
    
    .date-input-group {
        flex: 1;
        min-width: calc(33.333% - 10px);
    }
    
    .transactions-table {
        font-size: 0.9em;
    }
    
    .transactions-table th,
    .transactions-table td {
        padding: 12px;
    }
    
    .modal-content {
        width: 80%;
        max-width: 550px;
    }
}

/* Responsive Design for Financial Page - Desktop (1025px and above) */
@media (min-width: 1025px) {
    .account-balances-display {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    .financial-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .date-range-filter {
        flex-wrap: nowrap;
    }
    
    .transactions-table {
        font-size: 1em;
    }
}

/* Financial Statistics Styles */
.financial-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.financial-stat-card {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
    border-radius: 15px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.financial-stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 3em;
    flex-shrink: 0;
}

.stat-info {
    flex: 1;
}

.stat-label {
    color: #5C4A3A;
    font-size: 0.95em;
    margin-bottom: 10px;
    font-weight: 500;
}

.stat-value {
    color: #5C4A3A;
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-currency {
    color: #8B6F47;
    font-size: 0.85em;
    margin-bottom: 8px;
}

.stat-count {
    color: #8B6F47;
    font-size: 0.9em;
    font-weight: 500;
}

.stat-breakdown {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 8px;
    font-size: 0.9em;
    color: #8B6F47;
}

.stat-breakdown span {
    display: flex;
    justify-content: space-between;
}

.stat-breakdown strong {
    color: #5C4A3A;
    font-weight: 600;
}

/* Date Range Filter Styles */
.date-range-filter {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f6f3;
    border-radius: 10px;
    flex-wrap: wrap;
}

.date-range-filter .btn-primary,
.date-range-filter .btn-secondary {
    margin: 0;
    padding: 10px 20px;
    min-width: 100px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 150px;
}

.date-input-group label {
    color: #5C4A3A;
    font-size: 0.95em;
    font-weight: 500;
}

.date-input {
    padding: 10px 15px;
    border: 2px solid #E8D5B7;
    border-radius: 8px;
    background: white;
    color: #5C4A3A;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.date-input:focus {
    outline: none;
    border-color: #C9B99A;
}

.date-input:hover {
    border-color: #D4C4A8;
}

/* Responsive for financial stats - covered in comprehensive responsive section above */

/* Financial Page Button Container */
.financial-buttons-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Receipt Preview Styles */
.receipt-preview {
    display: none;
    margin-top: 10px;
}

.receipt-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Responsive Modal Styles for Financial Page */
@media (max-width: 480px) {
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 15px;
        max-height: 90vh;
        border-radius: 15px;
    }
    
    .modal-content h3 {
        font-size: 1.1em;
        margin-bottom: 15px;
    }
    
    .modal-content form {
        gap: 12px;
    }
    
    .form-group label {
        font-size: 13px;
        margin-top: 6px;
    }
    
    .modal-content input,
    .modal-content select {
        padding: 10px;
        font-size: 14px;
    }
    
    .receipt-preview img {
        max-width: 100%;
        max-height: 150px;
    }
    
    .financial-buttons-container {
        flex-direction: column;
    }
    
    .financial-buttons-container button {
        width: 100%;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .modal-content {
        width: 85%;
        padding: 20px;
    }
    
    .receipt-preview img {
        max-width: 250px;
        max-height: 200px;
    }
    
    .financial-buttons-container {
        gap: 12px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .modal-content {
        width: 75%;
        max-width: 550px;
    }
    
    .receipt-preview img {
        max-width: 300px;
        max-height: 250px;
    }
}

/* Storage Tabs Styles */
.storage-tabs {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #E8D5B7;
}

.storage-tabs .tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #5C4A3A;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: -2px;
    white-space: nowrap;
}

.storage-tabs .tab-btn:hover {
    color: #C9B99A;
    background: rgba(232, 213, 183, 0.1);
}

.storage-tabs .tab-btn.active {
    color: #5C4A3A;
    border-bottom-color: #C9B99A;
    font-weight: 600;
}

.storage-tab-content {
    display: none;
}

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

.inventory-transactions-table {
    overflow-x: auto;
    margin-top: 20px;
}

.inventory-transactions-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.inventory-transactions-table thead {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
}

.inventory-transactions-table th {
    font-size: 12px;
    padding: 10px 8px;
    text-align: right;
    color: #5C4A3A;
    font-weight: 600;
    border-bottom: 2px solid #C9B99A;
    white-space: nowrap;
}

.inventory-transactions-table td {
    padding: 8px;
    border-bottom: 1px solid #E8D5B7;
    color: #5C4A3A;
    font-size: 11px;
    white-space: nowrap;
}

.inventory-transactions-table tbody tr:hover {
    background: #f8f6f3;
}

.inventory-transactions-table tbody tr:last-child td {
    border-bottom: none;
}

/* Responsive for storage tabs */
@media (max-width: 768px) {
    .storage-tabs {
        flex-direction: row;
        gap: 0;
        border-bottom: 2px solid #E8D5B7;
        margin-bottom: 15px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .storage-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .storage-tabs .tab-btn {
        flex: 1;
        min-width: 50%;
        text-align: center;
        border-bottom: 3px solid transparent;
        border-left: none;
        margin-bottom: -2px;
        padding: 12px 16px;
        white-space: nowrap;
    }
    
    .storage-tabs .tab-btn.active {
        border-left-color: transparent;
        border-bottom-color: #C9B99A;
        background: rgba(232, 213, 183, 0.1);
    }
    
    .inventory-filters {
        flex-direction: column;
        gap: 12px;
        padding: 15px;
        background: #f8f9fa;
        border-radius: 10px;
        margin-bottom: 15px;
    }
    
    .inventory-filters .filter-group {
        width: 100%;
    }
    
    .inventory-filters .btn-secondary-filter {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }
    
    .transactions-filters {
        flex-direction: column;
        gap: 12px;
        padding: 15px;
        background: #f8f9fa;
        border-radius: 10px;
        margin-bottom: 15px;
    }
    
    .transactions-filters .filter-group {
        width: 100%;
    }
    
    .transactions-filters .btn-secondary-filter {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }
    
    .inventory-transactions-table {
        font-size: 0.9em;
    }
    
    .inventory-transactions-table th,
    .inventory-transactions-table td {
        font-size: 10px;
        padding: 8px;
    }
    
    /* Fix expiry date input size on mobile */
    .modal-content input[type="date"] {
        font-size: 14px !important;
        padding: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    #item-expiry-date,
    #restock-expiry-date {
        font-size: 14px !important;
        padding: 10px !important;
        width: 100% !important;
    }
}

/* Employees Page Styles */
.employees-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.employees-filter {
    display: flex;
    gap: 10px;
    align-items: center;
}

.employees-filter label {
    font-weight: 500;
    color: #5C4A3A;
}

.employees-filter select {
    padding: 10px 12px;
    border: 2px solid #E8D5B7;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    color: #5C4A3A;
    min-width: 150px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.employees-filter select:hover {
    border-color: #C9B99A;
}

.employees-filter select:focus {
    outline: none;
    border-color: #C9B99A;
    box-shadow: 0 0 0 3px rgba(232, 213, 183, 0.2);
}

/* Employees Table Styles - Hidden, cards only */
.employees-table-container {
    display: none !important;
}

.employees-table-container::-webkit-scrollbar {
    height: 8px;
}

.employees-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.employees-table-container::-webkit-scrollbar-thumb {
    background: #E8D5B7;
    border-radius: 4px;
}

.employees-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.employees-table thead {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
}

.employees-table th {
    padding: 15px;
    text-align: right;
    color: #5C4A3A;
    font-weight: 600;
    border-bottom: 2px solid #C9B99A;
    font-size: 0.95em;
}

.employees-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #E8D5B7;
    color: #5C4A3A;
    vertical-align: middle;
}

.employees-table tbody tr:hover {
    background: #f8f9fa;
}

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

.employees-table tbody tr.inactive {
    opacity: 0.7;
    background-color: #f8f9fa;
}

/* Actions Dropdown */
.actions-dropdown {
    position: relative;
    display: inline-block;
    z-index: 10000;
    margin-right: 8px;
    overflow: visible !important;
}

.employee-card-status-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Three dots menu button */
.actions-menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    min-width: 32px;
    min-height: 32px;
    color: #5C4A3A;
}

.actions-menu-btn:hover {
    background: rgba(232, 213, 183, 0.3);
}

.actions-menu-btn:active {
    transform: scale(0.95);
}

.actions-menu-btn.active {
    background: rgba(232, 213, 183, 0.5);
}

.actions-menu-icon {
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
    display: inline-block;
    transform: rotate(90deg);
    letter-spacing: -2px;
}

/* Legacy button style (for table view) */
.actions-dropdown-btn {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4C4A8 100%);
    color: #5C4A3A;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: all 0.3s ease;
}

.actions-dropdown-btn:hover {
    background: linear-gradient(135deg, #D4C4A8 0%, #C9B99A 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.actions-dropdown-btn:active {
    transform: scale(0.98);
}

.actions-dropdown-btn::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.3s ease;
}

.actions-dropdown-btn.active::after {
    transform: rotate(180deg);
}

.actions-dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 99999 !important;
    display: none !important;
    overflow: visible;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #E8D5B7;
    min-height: 50px;
    padding: 0;
    margin-top: 5px;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

/* Position menu for header actions */
.employee-card-status-container .actions-dropdown-menu {
    top: calc(100% + 8px);
    right: 0;
}

.employee-card-header {
    position: relative;
    z-index: 1;
    overflow: visible !important;
}

.employee-card-status-container {
    position: relative;
    z-index: 1;
    overflow: visible !important;
}

.actions-dropdown-menu * {
    box-sizing: border-box;
}

.actions-dropdown-menu.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    animation: slideDown 0.3s ease;
    pointer-events: auto !important;
    width: 200px !important;
    min-width: 200px !important;
    max-width: 300px !important;
    height: auto !important;
    min-height: 100px !important;
}

/* Ensure menu content is visible */
.actions-dropdown-menu.show .actions-dropdown-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: 44px !important;
}

/* Force visibility of all children */
.actions-dropdown-menu.show > * {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

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

.actions-dropdown-item {
    display: block !important;
    width: 100% !important;
    padding: 12px 16px !important;
    text-align: right !important;
    color: #5C4A3A !important;
    text-decoration: none;
    border: none;
    background: white !important;
    cursor: pointer;
    font-size: 14px !important;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 0 !important;
    line-height: 1.5 !important;
    height: auto !important;
    min-height: 44px !important;
}

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

.actions-dropdown-item:hover {
    background: #f8f9fa;
}

.actions-dropdown-item.danger {
    color: #dc3545;
}

.actions-dropdown-item.danger:hover {
    background: #fff5f5;
    color: #c82333;
}

.actions-dropdown-item.primary {
    color: #007bff;
}

.actions-dropdown-item.primary:hover {
    background: #f0f8ff;
    color: #0056b3;
}

.actions-dropdown-item.warning {
    color: #ffc107;
}

.actions-dropdown-item.warning:hover {
    background: #fffbf0;
    color: #e0a800;
}

/* Cards Container - Always visible */
.employees-cards-container,
.users-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Employee/User Card Styles */
.employee-card,
.user-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-right: 4px solid #E8D5B7;
    position: relative;
    overflow: visible;
    z-index: 1;
.employee-card.inactive,
.user-card.inactive {
    opacity: 0.7;
    background-color: #f8f9fa;
}

.employee-card-header,
.user-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #E8D5B7;
    position: relative;
    z-index: 1;
}

.employee-card-name,
.user-card-title {
    font-weight: bold;
    color: #5C4A3A;
    font-size: 1.1em;
}

.employee-card-status,
.user-card-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
}

.employee-card-status.active,
.user-card-status.active {
    background-color: #28a745;
    color: white;
}

.employee-card-status.inactive,
.user-card-status.inactive {
    background-color: #dc3545;
    color: white;
}

.employee-card-body,
.user-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 0.9em;
    margin-bottom: 12px;
}

.employee-card-item,
.user-card-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.employee-card-label,
.user-card-label {
    color: #8B6F47;
    font-size: 0.85em;
    font-weight: 500;
}

.employee-card-value,
.user-card-value {
    color: #5C4A3A;
    font-weight: 600;
}

.employee-card-item.full-width,
.user-card-item.full-width {
    grid-column: 1 / -1;
}

.employee-card-user {
    color: #28a745;
    font-size: 0.9em;
    margin-bottom: 10px;
    padding: 8px;
    background: #f0f9f4;
    border-radius: 6px;
}

.employee-card-actions,
.user-card-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #E8D5B7;
    position: relative;
    z-index: 100;
}

/* Hide tables for cards-first views - Always hide employees table */
.employees-table-container {
    display: none !important;
}

/* Always show employees cards */
.employees-cards-container {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Users: show cards only, hide table across devices */
.users-table {
    display: none !important;
}
.users-cards-container {
    display: grid !important;
}

/* Responsive Design for Employees Cards */
@media (max-width: 768px) {
    .employees-cards-container,
    .users-cards-container {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-top: 15px;
        display: grid !important;
    }
    
    .employee-card-body,
    .user-card-body {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    #employees-page,
    #users-page {
        padding: 15px 12px;
    }
    
    #employees-page h2,
    #users-page h2 {
        font-size: 1.5em;
        margin-bottom: 15px;
    }
    
    .employees-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    #add-employee-btn,
    #add-user-btn {
        width: 100%;
        padding: 14px;
        min-height: 44px;
        font-size: 16px;
    }
    
    .employees-filter {
        width: 100%;
    }
    
    .employees-filter select {
        width: 100%;
        padding: 12px;
        min-height: 44px;
        font-size: 16px;
    }
    
    .actions-dropdown-menu {
        min-width: calc(100% - 20px) !important;
        max-width: calc(100vw - 40px) !important;
        width: auto !important;
    }
    
    .actions-dropdown-menu.show {
        max-height: 70vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
    
    .actions-menu-btn {
        min-width: 36px;
        min-height: 36px;
    }
    
    .actions-menu-icon {
        font-size: 18px;
    }
}

/* Tablet/iPad Design (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .employees-cards-container,
    .users-cards-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
    
    .employee-card-body,
    .user-card-body {
        grid-template-columns: 1fr 1fr;
    }
}

/* Desktop Design (1025px and above) */
@media (min-width: 1025px) {
    .employees-cards-container,
    .users-cards-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .employee-card-body,
    .user-card-body {
        grid-template-columns: 1fr 1fr;
    }
}

/* Very Small Screens (up to 480px) */
@media (max-width: 480px) {
    .employee-card,
    .user-card {
        padding: 12px;
    }
    
    .employee-card-header,
    .user-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .employee-card-name,
    .user-card-title {
        font-size: 1em;
    }
    
    .employee-card-body,
    .user-card-body {
        gap: 8px;
    }
    
    .employee-card-label,
    .user-card-label {
        font-size: 0.8em;
    }
    
    .employee-card-value,
    .user-card-value {
        font-size: 0.9em;
    }
    
    .actions-dropdown-btn {
        min-width: 100%;
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .actions-dropdown-menu {
        min-width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        width: calc(100vw - 20px) !important;
        right: 10px !important;
        left: auto !important;
    }
    
    .actions-dropdown-menu.show {
        max-height: 60vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
}

/* Item Detail Page Button Styles (aligned with theme) */
.item-detail-btn {
    padding: 12px 24px;
    border: none !important;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.item-detail-btn:focus {
    outline: 3px solid rgba(181, 48, 48, 0.18);
    outline-offset: 2px;
}

/* Restock button - primary gradient */
.item-detail-btn-restock {
    background: linear-gradient(135deg, var(--tea-primary) 0%, var(--tea-primary-dark) 100%) !important;
    color: #fff !important;
}

.item-detail-btn-restock:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(181, 48, 48, 0.25);
}

/* Waste button - danger */
.item-detail-btn-waste {
    background: #dc3545 !important;
    color: #fff !important;
}

.item-detail-btn-waste:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(220, 53, 69, 0.25);
}

/* Edit button - neutral */
.item-detail-btn-edit {
    background: #6c757d !important;
    color: #fff !important;
}

.item-detail-btn-edit:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(108, 117, 125, 0.25);
}

/* Delete button - danger */
.item-detail-btn-delete {
    background: #dc3545 !important;
    color: #fff !important;
}

.item-detail-btn-delete:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(220, 53, 69, 0.25);
}

/* Subscriptions History Table */
.subscriptions-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Hide cards by default on desktop */
.subscriptions-cards-container {
    display: none;
}

.subscriptions-table thead {
    background: var(--tea-primary);
    color: white;
}

.subscriptions-table th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    font-size: 0.95em;
    border-bottom: 2px solid var(--tea-primary-dark);
}

.subscriptions-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    text-align: right;
}

.subscriptions-table tbody tr:hover {
    background: #f8f9fa;
}

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

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.status-badge.status-active {
    background: #d4edda;
    color: #155724;
}

.status-badge.status-trial {
    background: #d1ecf1;
    color: #0c5460;
}

.status-badge.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

/* Subscription */
.subscription-banner {
    margin: 10px 30px 20px;
    padding: 15px 20px;
    border-radius: 12px;
    background: var(--tea-cream);
    color: var(--tea-black);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 15px;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 2px solid var(--tea-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    text-align: center;
}

.subscription-banner strong {
    font-weight: 600;
    color: var(--tea-primary);
}

.subscription-banner .banner-content {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    justify-content: center;
    width: 100%;
}
.subscription-banner.ok {
    background: #e6f7ed;
    color: #2c6b3f;
    border: 2px solid #b8e2c6;
}
.subscription-banner.warning {
    background: #fff3cd;
    color: #7a5b05;
    border: 2px solid #ffe08a;
}
.subscription-page {
    padding: 20px 30px;
}
.subscription-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}
.subscription-header .page-title {
    font-size: 1.8em;
    color: var(--tea-black);
    margin: 0 0 5px 0;
    font-weight: 600;
}
.subscription-header .page-subtitle {
    color: #636e72;
    margin: 0;
    font-size: 0.95em;
}
.subscription-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

/* Subscription cards - ULTIMATE FORCE */
.subscription-card,
div[class="subscription-card"],
div[class~="subscription-card"],
[class*="subscription-card"],
#renew-card,
#register-card,
#pending-request-card {
    background: #fff !important;
    background-color: #fff !important;
    background-image: none !important;
    border: 5px solid #d32f2f !important;
    border-radius: 20px !important;
    padding: 30px !important;
    margin-bottom: 25px !important;
    box-shadow: 0 8px 25px rgba(211, 47, 47, 0.3) !important;
    display: block !important;
    min-height: 150px !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Preview card */
#subscription-preview {
    background: #f8f9fa;
    border-color: #b53030;
}

/* Card title */
.card-title,
h3.card-title {
    font-size: 1.4em;
    color: #b53030;
    margin: 0 0 20px 0;
    font-weight: 700;
    padding-bottom: 15px;
    border-bottom: 3px solid #8B6F47;
    display: block;
}

/* Status container and rows */
.status-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
}

.status-row:last-child {
    border-bottom: none;
}

.status-label {
    color: #636e72;
    font-weight: 500;
}

.status-value {
    color: #111111;
    font-weight: 600;
}

.status-row.status-warning {
    background: #fff3cd;
    padding: 12px;
    border-radius: 8px;
    margin-top: 8px;
    border: 1px solid #ffe08a;
}
.status-row.status-warning .status-label,
.status-row.status-warning .status-value {
    color: #7a5b05;
}
.subscription-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.subscription-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.subscription-form .form-group label {
    font-weight: 600;
    color: var(--tea-black);
    font-size: 14px;
}
.subscription-form .form-group input,
.subscription-form .form-group select {
    padding: 12px;
    border-radius: 8px;
    border: 2px solid var(--tea-border);
    font-size: 14px;
    background: #fff;
    color: var(--tea-black);
    transition: border-color 0.3s;
    width: 100%;
    box-sizing: border-box;
}
.subscription-form .form-group input:focus,
.subscription-form .form-group select:focus {
    outline: none;
    border-color: var(--tea-primary);
}
.subscription-form .form-group input[readonly] {
    background: #f5f5f5;
    cursor: not-allowed;
}
.subscription-form .form-select {
    cursor: pointer;
}
.btn-block {
    width: 100%;
    margin-top: 5px;
}
.instructions-box {
    margin-top: 20px;
    padding: 18px;
    background: #f8f9fb;
    border: 2px dashed var(--tea-border);
    border-radius: 10px;
}
.instructions-title {
    font-size: 1.1em;
    color: var(--tea-primary);
    margin: 15px 0 8px 0;
    font-weight: 600;
}
.instructions-title:first-child {
    margin-top: 0;
}
.instruction-value {
    font-family: 'Courier New', Courier, monospace;
    white-space: pre-wrap;
    word-break: break-word;
    background: #fff;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
    margin-bottom: 10px;
    color: var(--tea-black);
    font-size: 13px;
}
.mono {
    font-family: 'Courier New', Courier, monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Promo Code Validation */
.promo-code-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.promo-code-wrapper input {
    padding-right: 35px;
}

.promo-code-status {
    position: absolute;
    right: 10px;
    font-size: 18px;
    font-weight: bold;
    pointer-events: none;
    transition: all 0.3s;
}

.promo-code-status.valid {
    color: #28a745;
}

.promo-code-status.invalid {
    color: #dc3545;
}

.promo-code-status.checking {
    color: #ffc107;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.promo-code-message {
    margin-top: 5px;
    font-size: 12px;
    padding: 5px;
    border-radius: 4px;
    min-height: 20px;
}

.promo-code-message.valid {
    color: #28a745;
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.promo-code-message.invalid {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

/* Responsive Subscription */
@media (max-width: 768px) {
    .subscription-page {
        padding: 15px 12px;
    }
    .subscription-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .subscription-header .page-title {
        font-size: 1.5em;
    }
    .subscription-header .page-subtitle {
        font-size: 0.9em;
    }
    .subscription-header .btn {
        width: 100%;
        padding: 12px;
    }
    .subscription-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .subscription-card {
        padding: 12px;
        border-radius: 12px;
    }
    .subscription-card .card-title {
        font-size: 1em;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    .status-row {
        padding: 8px 0;
        font-size: 13px;
        flex-wrap: wrap;
    }
    .status-row .status-label {
        font-size: 13px;
        width: 100%;
        margin-bottom: 4px;
    }
    .status-row .status-value {
        font-size: 13px;
        width: 100%;
        text-align: right;
    }
    .subscription-form .form-group {
        gap: 8px;
    }
    .subscription-form .form-group input,
    .subscription-form .form-group select {
        padding: 10px;
        font-size: 14px;
    }
    .subscription-form .form-group label {
        font-size: 13px;
    }
    .btn-block {
        padding: 12px;
        font-size: 14px;
    }
    .subscription-banner {
        margin: 10px 0 15px 0;
        padding: 12px 15px;
        font-size: 13px;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 8px;
    }
    
    .subscription-banner .banner-content {
        flex-direction: column;
        gap: 6px;
    }
    /* Hide table on mobile, show cards instead */
    .subscription-card .table-container {
        display: none !important;
    }
    .subscriptions-table {
        display: none !important;
    }
    .subscriptions-cards-container {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 15px;
        margin-top: 15px;
    }
    
    /* Subscription History Cards */
    .subscription-history-card {
        background: white;
        border-radius: 12px;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        border: 2px solid var(--tea-border);
    }
    
    .subscription-history-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--tea-border);
    }
    
    .subscription-history-card-body {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .subscription-history-card-item {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    
    .subscription-history-card-label {
        color: #636e72;
        font-size: 0.85em;
        font-weight: 500;
    }
    
    .subscription-history-card-value {
        color: var(--tea-black);
        font-weight: 600;
        font-size: 0.95em;
    }
    
    /* Pending request card in history */
    #pending-request-history-card .subscription-history-card {
        border: 2px solid #ffc107 !important;
        background: #fff3cd !important;
    }
    
    #pending-request-history-card .subscription-history-card-header {
        border-bottom-color: #ffc107;
    }
}

/* Desktop: Show table, hide cards */
@media (min-width: 769px) {
    .subscriptions-cards-container {
        display: none !important;
    }
    .subscription-card .table-container {
        display: block !important;
    }
    .subscriptions-table {
        display: table !important;
    }
}

/* Customers Page Styles */
#customers-page h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--tea-primary);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
}

#customers-page h2::before {
    content: '👥';
    font-size: 36px;
}

.customers-header {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: center;
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.search-box {
    flex: 1;
    min-width: 300px;
}

.search-box input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s;
    background: #f8f9fa;
}

.search-box input:focus {
    outline: none;
    border-color: var(--tea-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.filter-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f8f9fa;
    border-radius: 12px;
}

.filter-box label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #495057;
    user-select: none;
}

.filter-box input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Customers page: 3 cards side by side */
#customers-page .customers-stats {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 968px) {
    #customers-page .customers-stats {
        grid-template-columns: 1fr !important;
    }
}

#customers-page .customers-stats .stat-card {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 160px;
    min-width: 0; /* allow grid item to shrink */
}

#customers-page .customers-stats .stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--tea-primary), var(--tea-secondary));
}

#customers-page .customers-stats .stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

#customers-page .customers-stats .stat-card:nth-child(1)::before {
    background: linear-gradient(90deg, #667eea, #764ba2);
}

#customers-page .customers-stats .stat-card:nth-child(2)::before {
    background: linear-gradient(90deg, #f093fb, #f5576c);
}

#customers-page .customers-stats .stat-card:nth-child(3)::before {
    background: linear-gradient(90deg, #4facfe, #00f2fe);
}

#customers-page .customers-stats .stat-title {
    font-size: 15px;
    font-weight: 600;
    color: #636e72;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#customers-page .customers-stats .stat-title::before {
    font-size: 24px;
}

#customers-page .customers-stats .stat-card:nth-child(1) .stat-title::before {
    content: '👥';
}

#customers-page .customers-stats .stat-card:nth-child(2) .stat-title::before {
    content: '✅';
}

#customers-page .customers-stats .stat-card:nth-child(3) .stat-title::before {
    content: '💰';
}

#customers-page .customers-stats .stat-value {
    font-size: 36px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--tea-primary), var(--tea-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 8px;
    line-height: 1.2;
}

.customers-table-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.customers-table {
    width: 100%;
    border-collapse: collapse;
}

.customers-table thead {
    background: linear-gradient(135deg, var(--tea-primary), var(--tea-secondary));
    color: white;
}

.customers-table th {
    padding: 18px 20px;
    text-align: right;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    font-size: 13px;
}

.customers-table td {
    padding: 16px 20px;
    text-align: right;
    border-bottom: 1px solid #f0f0f0;
    font-size: 15px;
    color: #2d3436;
}

.customers-table tbody tr {
    transition: all 0.2s ease;
}

.customers-table tbody tr:hover {
    background: linear-gradient(to right, #f8f9fa, #ffffff);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

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

.debt-amount {
    color: #e74c3c;
    font-weight: 700;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.payment-amount {
    color: #27ae60;
    font-weight: 700;
    background: linear-gradient(135deg, #27ae60, #229954);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.status-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-active {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-active::before {
    background: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}

.status-inactive {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-inactive::before {
    background: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

.actions-cell {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.btn-icon {
    background: white;
    border: 2px solid #e9ecef;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--tea-primary);
}

.btn-icon.btn-danger {
    border-color: #ffcdd2;
}

.btn-icon.btn-danger:hover {
    background: #ffebee;
    border-color: #dc3545;
    transform: translateY(-3px) scale(1.05);
}

.customer-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-item strong {
    color: #636e72;
    font-size: 14px;
}

.detail-notes {
    margin: 15px 0;
    padding: 15px;
    background: #fff3cd;
    border-radius: 8px;
    border-right: 4px solid #ffc107;
}

.customer-details-tabs {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    border-bottom: 2px solid var(--tea-border);
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #636e72;
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--tea-primary);
    border-bottom-color: var(--tea-primary);
}

.tab-btn:hover {
    color: var(--tea-primary);
}

.customer-details-content {
    margin-top: 20px;
}

.tab-content {
    display: none;
}

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

.payment-header {
    margin-bottom: 15px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.data-table thead {
    background: var(--tea-light);
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid var(--tea-border);
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.modal-large {
    max-width: 900px;
    width: 90%;
}

/* Customer selection in sales page */
.customer-selection {
    background: white;
    padding: 20px;
    border-radius: 16px;
    border: 2px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.customer-type-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.customer-tab-btn {
    flex: 1;
    padding: 12px 24px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #495057;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.customer-tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--tea-primary), var(--tea-secondary));
    opacity: 0;
    transition: opacity 0.3s;
}

.customer-tab-btn span {
    position: relative;
    z-index: 1;
}

.customer-tab-btn.active {
    background: linear-gradient(135deg, var(--tea-primary), var(--tea-secondary));
    color: white;
    border-color: var(--tea-primary);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.customer-tab-btn.active::before {
    opacity: 1;
}

.customer-tab-btn:hover:not(.active) {
    border-color: var(--tea-primary);
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.customer-tab-content {
    animation: fadeIn 0.3s;
}

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

#add-customer-btn {
    background: linear-gradient(135deg, var(--tea-primary), var(--tea-secondary));
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

#add-customer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 69, 19, 0.4);
}

#add-customer-btn:active {
    transform: translateY(0);
}

.required {
    color: #dc3545;
    font-weight: bold;
    margin-right: 4px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s;
}

.modal-actions .btn-primary {
    background: linear-gradient(135deg, var(--tea-primary), var(--tea-secondary));
    border: none;
    color: white;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.modal-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 69, 19, 0.4);
}

.modal-actions .btn-secondary {
    background: white;
    border: 2px solid #e9ecef;
    color: #495057;
}

.modal-actions .btn-secondary:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}

/* Customer modal form: 3 columns for name, phone, address */
.modal-content-customer-form .customer-form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.modal-content-customer-form .customer-form-grid .form-group-full,
.modal-content-customer-form .customer-form-grid .modal-actions {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .modal-content-customer-form .customer-form-grid {
        grid-template-columns: 1fr;
    }
}

/* Enhanced Input Fields Styling - same as .search-box input */
.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group select,
.form-group textarea,
#new-customer-name,
#new-customer-phone,
#new-customer-address,
#existing-customer-select,
#customer-name,
#customer-phone,
#customer-address,
#customer-notes,
#payment-amount,
#payment-notes {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s;
    background: #f8f9fa;
    color: #2d3436;
}

.form-group input[type="text"]:focus,
.form-group input[type="tel"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="email"]:focus,
.form-group select:focus,
.form-group textarea:focus,
#new-customer-name:focus,
#new-customer-phone:focus,
#new-customer-address:focus,
#existing-customer-select:focus,
#customer-name:focus,
#customer-phone:focus,
#customer-address:focus,
#customer-notes:focus,
#payment-amount:focus,
#payment-notes:focus {
    outline: none;
    border-color: var(--tea-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2d3436;
    font-size: 14px;
}

/* Enhanced Cart Action Buttons */
#checkout-btn,
#clear-cart-btn {
    padding: 16px 32px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 12px;
}

#checkout-btn {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

#checkout-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.5);
}

#checkout-btn:active {
    transform: translateY(-1px);
}

#clear-cart-btn {
    background: white;
    border: 2px solid #e9ecef;
    color: #495057;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#clear-cart-btn:hover {
    background: #f8f9fa;
    border-color: #dc3545;
    color: #dc3545;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
}

/* Cart Section Enhancement */
.cart-section {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.cart-section h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--tea-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-section h3::before {
    content: '🛒';
    font-size: 28px;
}

.cart-total {
    padding: 16px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    margin: 20px 0;
    border: 2px solid #dee2e6;
}

.cart-total strong {
    font-size: 20px;
    color: var(--tea-primary);
}

/* Worker Name Field Enhancement */
#worker-name {
    background: #e9ecef !important;
    cursor: not-allowed !important;
    font-weight: 600;
    color: #495057 !important;
}

/* Customer Selection Enhancement for Sales Page */
#customer-selection-group {
    margin-top: 20px;
    animation: slideDown 0.3s ease;
}

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

#customer-selection-group label {
    font-size: 16px;
    font-weight: 700;
    color: var(--tea-primary);
    margin-bottom: 12px;
    display: block;
}

/* Enhanced Select Dropdown */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23495057' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 15px center;
    padding-right: 45px;
}

select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238B4513' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* Products Section Enhancement */
.products-section h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--tea-primary);
    margin-bottom: 16px;
}

/* Enhanced Product Tabs */
.products-tabs {
    background: white;
    padding: 8px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.products-tab-btn {
    flex: 1;
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #495057;
    transition: all 0.3s ease;
}

.products-tab-btn.active {
    background: linear-gradient(135deg, var(--tea-primary), var(--tea-secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.products-tab-btn:hover:not(.active) {
    background: #f8f9fa;
}

/* Enhanced Modal Styling */
.modal-content {
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: none;
}

.modal-content h3 {
    color: var(--tea-primary);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e9ecef;
}

/* Small text helper */
.form-group small {
    display: block;
    margin-top: 6px;
    color: #6c757d;
    font-size: 13px;
}

/* Customer Debts Section in Financial Page */
.debts-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 35px;
}

@media (max-width: 968px) {
    .debts-stats-grid {
        grid-template-columns: 1fr;
    }
}

.debt-stat-card {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 160px;
}

.debt-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
}

.debt-stat-card.total-debt::before {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.debt-stat-card.overdue-debt::before {
    background: linear-gradient(90deg, #e67e22, #d35400);
}

.debt-stat-card.recent-debt::before {
    background: linear-gradient(90deg, #3498db, #2980b9);
}

.debt-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.debt-stat-icon {
    font-size: 36px;
    margin-bottom: 15px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.debt-stat-label {
    font-size: 14px;
    font-weight: 600;
    color: #636e72;
    margin-bottom: 12px;
}

.debt-stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.2;
}

.debt-stat-value:not(.overdue):not(.recent) {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.debt-stat-value.overdue {
    background: linear-gradient(135deg, #e67e22, #d35400);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.debt-stat-value.recent {
    background: linear-gradient(135deg, #3498db, #2980b9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.debt-stat-count {
    font-size: 14px;
    color: #95a5a6;
    font-weight: 600;
}

.top-debtors-section,
.recent-credit-sales-section {
    margin-top: 35px;
}

.subsection-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--tea-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 3px solid #e9ecef;
}

.top-debtors-container,
.recent-sales-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.top-debtors-table,
.recent-sales-table {
    width: 100%;
    border-collapse: collapse;
}

.top-debtors-table thead,
.recent-sales-table thead {
    background: linear-gradient(135deg, var(--tea-primary), var(--tea-secondary));
    color: white;
}

.top-debtors-table th,
.recent-sales-table th {
    padding: 16px;
    text-align: right;
    font-weight: 600;
    font-size: 14px;
}

.top-debtors-table td,
.recent-sales-table td {
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.top-debtors-table tbody tr:hover,
.recent-sales-table tbody tr:hover {
    background: linear-gradient(to right, #f8f9fa, #ffffff);
}

.top-debtors-table tbody tr:last-child td,
.recent-sales-table tbody tr:last-child td {
    border-bottom: none;
}

.debtor-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tea-primary), var(--tea-secondary));
    color: white;
    font-weight: 700;
    font-size: 14px;
}

.debtor-rank.rank-1 {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #8B4513;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.debtor-rank.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    color: #495057;
}

.debtor-rank.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #b8860b);
    color: white;
}

.debt-amount-cell {
    font-weight: 700;
    color: #e74c3c;
    font-size: 15px;
}

.days-overdue-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.days-overdue-badge.critical {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.days-overdue-badge.warning {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
}

.days-overdue-badge.normal {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.sale-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.sale-status-badge.recent {
    background: #d4edda;
    color: #155724;
}

.sale-status-badge.medium {
    background: #fff3cd;
    color: #856404;
}

.sale-status-badge.overdue {
    background: #f8d7da;
    color: #721c24;
}

.debt-balance {
    border-left: 5px solid #e74c3c !important;
}

.debt-value {
    color: #e74c3c !important;
}

.contact-customer-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.contact-customer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}
