/* Modern Admin Portal Styles */

/* Brand accent (Mount Albert navy). A theme (e.g. css/themes/neutral.css, loaded
   via /css/theme.css) overrides these and the page colours below. */
:root {
    --accent-hsl: 223.78 51.39% 28.24%;
    --accent-2-hsl: 223.78 45% 35%;
    --on-page: white;
    --on-page-muted: #e2e8f0;
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: hsl(var(--accent-hsl) / 1);
    min-height: 100vh;
    color: #2d3748;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: transparent;
    padding: 0;
    margin-bottom: 30px;
    border-radius: 0;
    box-shadow: none;
    border: none;
    overflow: visible;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    min-height: 80px;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-image {
    width: 300px;
    height: auto;
    object-fit: contain;
}

.logo-text h1 {
    color: white;
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.logo-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-right {
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
    color: white;
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.user-greeting {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
}

.user-name {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.logout-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.logout-icon {
    font-size: 1rem;
}

.nav-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-tab {
    padding: 16px 24px;
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-weight: 600;
    color: #4a5568;
    position: relative;
    overflow: hidden;
}

.nav-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.nav-tab:hover::before {
    left: 100%;
}

.nav-tab:hover {
    background: hsl(var(--accent-hsl) / 0.1);
    color: hsl(var(--accent-hsl) / 1);
}

.nav-tab.active {
    border-bottom-color: hsl(var(--accent-hsl) / 1);
    background: hsl(var(--accent-hsl) / 0.1);
    color: hsl(var(--accent-hsl) / 1);
}

/* Mobile menu (hamburger) — hidden on desktop, shown via the mobile media query */
.nav-toggle {
    display: none;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 16px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    color: hsl(var(--accent-hsl) / 1);
}

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    content: '';
    display: block;
    width: 22px;
    height: 2.5px;
    border-radius: 2px;
    background: hsl(var(--accent-hsl) / 1);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle-bars {
    position: relative;
    flex-shrink: 0;
}

.nav-toggle-bars::before { position: absolute; top: -7px; }
.nav-toggle-bars::after { position: absolute; top: 7px; }

/* Animate into an X when the menu is open */
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-7px) rotate(-45deg); }

.nav-button {
    padding: 12px 24px;
    background: linear-gradient(135deg, hsl(var(--accent-hsl) / 1) 0%, hsl(var(--accent-2-hsl) / 1) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px hsl(var(--accent-hsl) / 0.3);
    position: relative;
    overflow: hidden;
}

.nav-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.nav-button:hover::before {
    left: 100%;
}

.nav-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px hsl(var(--accent-hsl) / 0.4);
}

.nav-button.active {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

.nav-button.active:hover {
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
}

#logoutButton {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.3);
}

#logoutButton:hover {
    box-shadow: 0 8px 25px rgba(245, 101, 101, 0.4);
}

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

.view.active {
    display: block;
}

.view h2 {
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
}

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

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 8px 4px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, hsl(var(--accent-hsl) / 1) 0%, hsl(var(--accent-2-hsl) / 1) 100%);
    color: white;
    box-shadow: 0 4px 15px hsl(var(--accent-hsl) / 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px hsl(var(--accent-hsl) / 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(237, 242, 247, 0.92) 100%);
    color: #1a202c;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.btn-danger {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 101, 101, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(237, 137, 54, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(237, 137, 54, 0.4);
}

/* Styled file picker (Stock Import) */
.file-input {
    padding: 8px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #f7fafc;
    font-size: 14px;
    color: #1a202c;
    max-width: 100%;
    margin-right: 12px;
    vertical-align: middle;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.file-input:hover {
    border-color: hsl(var(--accent-hsl) / 0.5);
}

.file-input::file-selector-button {
    margin-right: 12px;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, hsl(var(--accent-hsl) / 1) 0%, hsl(var(--accent-2-hsl) / 1) 100%);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.file-input::file-selector-button:hover {
    opacity: 0.9;
}

/* View headers (page title + action buttons) */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.view-header h2 {
    margin-bottom: 0;
}

.view-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Wide data tables scroll horizontally inside their container instead of
   forcing the whole page sideways on small screens. Harmless on desktop
   (no scrollbar appears unless the table actually overflows). */
#usersTable, #productsTable, #categoriesTable, #subcategoriesTable,
#tabsTable, #transactionsTable, #inventoryTable,
#membersTableContainer, #paymentsReport, #priceListResult, #invoiceResult,
.table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.table th,
.table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.table th {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    font-weight: 700;
    color: #2d3748;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tr:hover {
    background: linear-gradient(135deg, #f7fafc 0%, #f1f5f9 100%);
    transform: scale(1.01);
    transition: all 0.2s ease;
}

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

.alert {
    padding: 16px 20px;
    margin: 20px 0;
    border-radius: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: linear-gradient(135deg, #c6f6d5 0%, #9ae6b4 100%);
    color: #22543d;
    border: 1px solid #68d391;
}

.alert-error {
    background: linear-gradient(135deg, #fed7d7 0%, #feb2b2 100%);
    color: #742a2a;
    border: 1px solid #fc8181;
}

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

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

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

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease;
}

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

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

.modal-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.5rem;
    font-weight: 700;
}

.close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #a0aec0;
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: 8px;
}

.close:hover {
    color: #2d3748;
    background: #f7fafc;
    transform: scale(1.1);
}

.form-group {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

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

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f7fafc;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: hsl(var(--accent-hsl) / 1);
    background: white;
    box-shadow: 0 0 0 3px hsl(var(--accent-hsl) / 0.1);
}

.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    background: #f7fafc;
    transition: all 0.3s ease;
}

.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    background: #f7fafc;
    transition: all 0.3s ease;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Login form specific styles */
#loginView {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 400px;
    margin: 50px auto;
}

#loginView h2 {
    text-align: center;
    margin-bottom: 30px;
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#loginForm,
#forgotForm,
#resetForm {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#loginForm input,
#forgotForm input,
#resetForm input {
    padding: 16px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f7fafc;
}

#loginForm input:focus,
#forgotForm input:focus,
#resetForm input:focus {
    outline: none;
    border-color: hsl(var(--accent-hsl) / 1);
    background: white;
    box-shadow: 0 0 0 3px hsl(var(--accent-hsl) / 0.1);
}

#loginForm button,
#forgotForm button,
#resetForm button {
    padding: 16px 20px;
    background: linear-gradient(135deg, hsl(var(--accent-hsl) / 1) 0%, hsl(var(--accent-2-hsl) / 1) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px hsl(var(--accent-hsl) / 0.3);
}

#loginForm button:hover,
#forgotForm button:hover,
#resetForm button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px hsl(var(--accent-hsl) / 0.4);
}

.error-message {
    color: #e53e3e;
    font-size: 14px;
    margin-top: 10px;
    padding: 12px;
    background: linear-gradient(135deg, #fed7d7 0%, #feb2b2 100%);
    border: 1px solid #fc8181;
    border-radius: 8px;
    display: none;
}

/* Dashboard specific styles */
#dashboardView {
    text-align: center;
    padding: 40px;
}

#dashboardView h2 {
    color: white;
    font-size: 2rem;
    margin-bottom: 20px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#dashboardView p {
    color: #4a5568;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.8;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Success/Error animations */
.alert {
    animation: slideInDown 0.3s ease;
}

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

/* Hover effects for cards */
.card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background: linear-gradient(135deg, #c6f6d5 0%, #9ae6b4 100%);
    color: #22543d;
}

.status-inactive {
    background: linear-gradient(135deg, #fed7d7 0%, #feb2b2 100%);
    color: #742a2a;
}

.status-primary {
    background: linear-gradient(135deg, hsl(var(--accent-hsl) / 0.2) 0%, hsl(var(--accent-2-hsl) / 0.2) 100%);
    color: hsl(var(--accent-hsl) / 1);
    border: 1px solid hsl(var(--accent-hsl) / 0.3);
}

.function-tab-badge {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    border: 1px solid #e65100;
    box-shadow: 0 2px 4px rgba(255, 152, 0, 0.3);
}

/* Sortable Table Headers */
.table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.table th.sortable:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.table th.sortable::after {
    content: '↕';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    font-size: 0.8em;
}

.table th.sortable.asc::after {
    content: '↑';
    opacity: 1;
    color: white;
}

.table th.sortable.desc::after {
    content: '↓';
    opacity: 1;
    color: white;
}

.table th.sortable:hover::after {
    opacity: 0.8;
}

/* Drag and Drop Styles */
.draggable-row {
    cursor: move;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.draggable-row.drag-over {
    background-color: #e8f4f8 !important;
    border-top: 2px solid #4299e1;
}

.drag-handle {
    cursor: grab;
    color: #a0aec0;
    font-weight: bold;
    user-select: none;
    padding: 4px;
}

.drag-handle:hover {
    color: #4299e1;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Category Header Styles */
.category-header-row {
    background-color: hsl(var(--accent-hsl) / 1) !important;
}

.category-header-row:hover {
    /* Use the `background` shorthand so it overrides the light gradient *image*
       set by `.table tr:hover` (background-color alone left the gradient on top,
       which washed the dark header out to white). */
    background: hsl(var(--accent-hsl) / 1) !important;
    transform: none;
}

.category-header {
    padding: 12px 15px !important;
    font-size: 16px;
    color: white !important;
    border-bottom: 2px solid #4299e1 !important;
}

.category-count {
    font-size: 13px;
    opacity: 0.8;
    margin-left: 8px;
    font-weight: normal;
}

/* Custom Checkbox Styles */
.checkbox-group {
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #2d3748;
    position: relative;
    padding-left: 35px;
    margin-bottom: 0;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    transform: translateY(-50%);
    transition: all 0.3s ease;
}

.checkbox-label:hover input ~ .checkmark {
    border-color: hsl(var(--accent-hsl) / 1);
    background-color: hsl(var(--accent-hsl) / 0.05);
}

.checkbox-label input:checked ~ .checkmark {
    background-color: hsl(var(--accent-hsl) / 1);
    border-color: hsl(var(--accent-hsl) / 1);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-label input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-label .checkmark:after {
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Action buttons in tables */
.table .btn {
    padding: 8px 16px;
    font-size: 12px;
    margin: 2px;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

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

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

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

/* Responsive design */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .nav-button {
        font-size: 12px;
        padding: 10px 16px;
    }
    
    .container {
        padding: 10px;
    }
    
    .header-content {
        padding: 20px;
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .logo {
        justify-content: center;
    }
    
    .logo-text h1 {
        font-size: 1.8rem;
    }
    
    .user-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .user-details {
        align-items: center;
        text-align: center;
    }
    
    .logo-image {
        width: 220px;
    }

    /* Show the hamburger; collapse the tab bar into a dropdown menu */
    .nav-toggle {
        display: flex;
    }

    .nav-tabs {
        flex-direction: column;
        gap: 4px;
        padding: 8px;
        overflow-x: visible;
    }

    /* Hidden until the hamburger adds .open. !important beats the inline
       display:flex that JS sets for the logged-in state. */
    .nav-tabs:not(.open) {
        display: none !important;
    }

    .nav-tab {
        width: 100%;
        text-align: left;
        padding: 14px 16px;
        font-size: 15px;
        border-bottom: none;
        border-left: 3px solid transparent;
        border-radius: 8px;
    }

    .nav-tab.active {
        border-bottom-color: transparent;
        border-left-color: hsl(var(--accent-hsl) / 1);
    }

    .modal-content {
        padding: 20px;
        width: 95%;
    }

    /* Stack page title above its action buttons; make buttons full-width */
    .view-header {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 20px;
    }

    .view-actions {
        width: 100%;
    }

    .view-actions .btn,
    .view-header > .btn {
        flex: 1 1 auto;
    }

    #dashboardView {
        padding: 16px;
    }

    /* Reflow data tables into stacked "label: value" cards — no sideways scroll.
       Each row becomes a card; each cell shows its column header (added as
       data-label by setupResponsiveTables) on the left, value on the right. */
    .table {
        font-size: 14px;
        min-width: 0;
        margin-top: 16px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    }

    /* Visually hide the header row (kept for accessibility) */
    .table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        border: 0;
    }

    .table,
    .table tbody,
    .table tr {
        display: block;
        width: 100%;
    }

    .table tbody tr {
        padding: 8px 16px;
        border-bottom: 8px solid #edf2f7;
    }

    .table tr:hover {
        transform: none;
        background: transparent;
    }

    .table td {
        display: block;
        border-bottom: 1px solid #f1f5f9;
        padding: 10px 0;
    }

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

    /* Labelled data cells: header on the left, value on the right */
    .table td[data-label] {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        text-align: right;
    }

    .table td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 40%;
        text-align: left;
        font-weight: 700;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        color: #718096;
    }

    /* Action-button cells wrap nicely on the right */
    .table td .btn {
        margin: 2px 0 2px 4px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    /* Full-width vertical menu items stay easy to tap */
    .nav-tab {
        padding: 14px 16px;
        font-size: 15px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .modal-content {
        padding: 15px;
        border-radius: 12px;
    }
}

/* Transaction products dropdown */
.transaction-products-dropdown {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 14px;
    color: #333;
    min-width: 200px;
    cursor: pointer;
}

.transaction-products-dropdown:hover {
    border-color: hsl(var(--accent-hsl) / 1);
}

.transaction-products-dropdown:focus {
    outline: none;
    border-color: hsl(var(--accent-hsl) / 1);
    box-shadow: 0 0 0 2px hsl(var(--accent-hsl) / 0.2);
}

/* Transaction Details Panel Styles */
.transaction-row {
    transition: background-color 0.2s ease;
}

.transaction-row:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.transaction-details-row {
    background-color: rgba(255, 255, 255, 0.05);
    border-top: none;
}

.transaction-details-panel {
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    margin: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.transaction-meta-info {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #e2e8f0;
    color: #4a5568;
}

.happy-hour-badge {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
}

.member-badge {
    background: #dbeafe;
    color: #1e40af;
}

.function-tab-meta-badge {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ff9800;
    font-weight: 700;
}

.non-member-badge {
    background: #f3e8ff;
    color: #6b21a8;
    border: 1px solid #c084fc;
}

.transaction-details-panel h4 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}

/* User Details Panel */
.user-details-panel {
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    margin: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-details-panel h4 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}

.user-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.user-detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

.user-detail-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.user-detail-item strong {
    color: #4a5568;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-detail-item span {
    color: #2d3748;
    font-size: 1rem;
    word-break: break-word;
}

/* User row hover effect */
.user-row:hover {
    background-color: rgba(102, 126, 234, 0.1);
    transition: background-color 0.2s ease;
}

.transaction-items {
    display: grid;
    gap: 12px;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 8px 0;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

.transaction-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-info strong {
    color: #2d3748;
    font-size: 1rem;
    font-weight: 600;
}

.item-id {
    color: #718096;
    font-size: 0.85rem;
    font-weight: 500;
}

.item-details {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.item-quantity,
.item-price,
.item-subtotal,
.item-date,
.item-tab-id {
    background: #f7fafc;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.item-subtotal {
    background: #e6fffa;
    color: #234e52;
    border-color: #b2f5ea;
    font-weight: 600;
}

.item-happy-hour {
    background: #fef5e7;
    color: #c05621;
    border: 1px solid #fbd38d;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.no-items {
    text-align: center;
    color: #718096;
    font-style: italic;
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    border: 2px dashed #cbd5e0;
}

/* Responsive adjustments for transaction details */
@media (max-width: 768px) {
    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .item-details {
        width: 100%;
        justify-content: space-between;
    }
    
    .item-quantity,
    .item-price,
    .item-subtotal,
    .item-date,
    .item-tab-id {
        flex: 1;
        text-align: center;
    }
    
    .user-details-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .user-detail-item {
        padding: 10px;
    }
    
    .user-detail-item strong {
        font-size: 0.8rem;
    }
    
    .user-detail-item span {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .transaction-details-panel {
        margin: 5px;
        padding: 15px;
    }
    
    .item-details {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    
    .item-quantity,
    .item-price,
    .item-subtotal,
    .item-date,
    .item-tab-id {
        width: 100%;
        text-align: center;
    }
}

/* Tab History Panel Styles */
.tab-row {
    transition: background-color 0.2s ease;
}

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

.tab-details-row {
    background-color: #f8f9fa;
}

.tab-details-panel {
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-details-panel h4 {
    margin: 0 0 15px 0;
    color: #2d3748;
    font-size: 1.1rem;
    font-weight: 600;
}

.tab-history-loading {
    text-align: center;
    color: #718096;
    font-style: italic;
    padding: 20px;
}

.tab-history-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tab-history-item {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    transition: box-shadow 0.2s ease;
}

.tab-history-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

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

.history-item-info strong {
    color: #2d3748;
    font-size: 1rem;
}

.history-item-date {
    color: #718096;
    font-size: 0.9rem;
}

.history-item-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.history-item-amount {
    color: #48bb78;
    font-weight: 600;
    font-size: 1.1rem;
}

.history-item-type {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.history-item-type.credit-addition {
    background: #c6f6d5;
    color: #22543d;
}

.history-item-type.tab-purchase {
    background: #fed7d7;
    color: #742a2a;
}

.history-item-products {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.history-product {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    flex-wrap: wrap;
    gap: 10px;
}

.product-name {
    font-weight: 500;
    color: #2d3748;
}

.product-details {
    color: #718096;
    font-size: 0.9rem;
}

.history-item-staff {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    color: #718096;
    font-size: 0.9rem;
}

/* Dashboard Styles */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.dashboard-controls {
    display: flex;
    gap: 10px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Statistics KPI cards — a fixed responsive grid (3 → 2 → 1) so six cards lay
   out evenly instead of the auto-fit grid orphaning the last one (5 + 1). */
.stats-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
@media (max-width: 1100px) { .stats-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .stats-kpis { grid-template-columns: 1fr; } }

.metric-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.metric-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.metric-content {
    flex: 1;
}

.metric-content h3 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 4px;
}

.metric-subtitle {
    font-size: 0.85rem;
    color: #718096;
}

.metric-change {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.metric-change.positive {
    color: #38a169;
    background: #c6f6d5;
}

.metric-change.negative {
    color: #e53e3e;
    background: #fed7d7;
}

.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dashboard-reports-section {
    margin-top: 12px;
    padding-top: 28px;
    border-top: 1px solid #e2e8f0;
}

.dashboard-reports-header {
    margin-bottom: 16px;
}

.dashboard-reports-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
}

.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

.card-header {
    padding: 20px 20px 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
}

.card-controls select {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    color: #4a5568;
}

.card-controls--with-toggle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.dashboard-card .dashboard-card-collapse-toggle {
    margin: 0;
    padding: 8px 10px;
    min-width: 40px;
    min-height: 40px;
}

.dashboard-card-collapse-toggle .dashboard-card-chevron {
    display: block;
    width: 0;
    height: 0;
    margin: 0 auto;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 7px solid #2d3748;
    border-top: 0;
    transition: transform 0.2s ease;
}

.dashboard-card--compact .dashboard-card-collapse-toggle .dashboard-card-chevron {
    transform: rotate(180deg);
}

.dashboard-card--compact .card-content {
    max-height: min(320px, 42vh);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.card-content {
    padding: 0 20px 20px 20px;
}

/* Top Products List */
.top-product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f7fafc;
}

.top-product-item:last-child {
    border-bottom: none;
}

.product-info {
    flex: 1;
}

.product-name {
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 4px;
}

.product-stats {
    font-size: 0.85rem;
    color: #718096;
}

.product-revenue {
    text-align: right;
    font-weight: 600;
    color: #38a169;
}

/* Recent Transactions */
.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin: 6px 0;
    border-bottom: 1px solid #f7fafc;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.transaction-item:hover {
    background-color: #f8f9fa;
}

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

.transaction-info {
    flex: 1;
}

.transaction-id {
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 4px;
}

.transaction-details {
    font-size: 0.85rem;
    color: #718096;
}

.transaction-amount {
    text-align: right;
    font-weight: 600;
    color: #38a169;
}

/* Tab Balances */
.tab-balance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f7fafc;
}

.tab-balance-item:last-child {
    border-bottom: none;
}

.tab-name {
    font-weight: 500;
    color: #2d3748;
}

.tab-balance {
    font-weight: 600;
    color: #38a169;
}

.tab-balance.zero {
    color: #718096;
}

/* Low Stock Items */
.low-stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f7fafc;
}

.low-stock-item:last-child {
    border-bottom: none;
}

.stock-product-name {
    font-weight: 500;
    color: #2d3748;
}

.stock-levels {
    text-align: right;
    font-size: 0.85rem;
}

.stock-quantity {
    font-weight: 600;
    color: #e53e3e;
}

.stock-threshold {
    color: #718096;
}

/* Simple checkbox styling */
.simple-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
    margin: 0;
    justify-content: center;
}

.simple-checkbox-label input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.simple-checkbox-label .checkbox-text {
    font-size: 14px;
    color: #4a5568;
    user-select: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-row {
        grid-template-columns: 1fr;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .metric-card {
        padding: 15px;
    }
    
    .metric-icon {
        font-size: 2rem;
        width: 50px;
        height: 50px;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
}

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

.toast {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 24px 32px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22);
    min-width: 430px;
    max-width: 690px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    pointer-events: auto;
    border-left: 7px solid;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left-color: #10b981;
}

.toast-error {
    border-left-color: #ef4444;
}

.toast-warning {
    border-left-color: #f59e0b;
}

.toast-info {
    border-left-color: #3b82f6;
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 23px;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    background: #d1fae5;
    color: #10b981;
}

.toast-error .toast-icon {
    background: #fee2e2;
    color: #ef4444;
}

.toast-warning .toast-icon {
    background: #fef3c7;
    color: #f59e0b;
}

.toast-info .toast-icon {
    background: #dbeafe;
    color: #3b82f6;
}

.toast-message {
    flex: 1;
    font-size: 22px;
    font-weight: 600;
    color: #374151;
    line-height: 1.42;
}

@media (max-width: 768px) {
    .toast-container {
        left: 12px;
        right: 12px;
        top: 10px;
    }

    .toast {
        min-width: auto;
        max-width: none;
        width: 100%;
        gap: 14px;
        padding: 18px 20px;
        border-radius: 12px;
        border-left-width: 6px;
    }

    .toast-icon {
        width: 38px;
        height: 38px;
        font-size: 22px;
    }

    .toast-message {
        font-size: 18px;
    }
}