/* Minimalist & Premium Design System */
:root {
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;

    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    --primary: #2563eb;
    /* Modern Blue */
    --primary-hover: #1d4ed8;

    --border-color: #e5e7eb;

    --sidebar-width: 260px;
    --header-height: 64px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 14px;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    /* Prevent body scroll, use inner scroll */
    display: flex;
    user-select: none;
    -webkit-user-select: none;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    height: 100vh;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0.5rem;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: block;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: #f9fafb;
    color: var(--text-primary);
}

.nav-link.active {
    background: #eff6ff;
    color: var(--primary);
}

.nav-icon {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow: hidden;
    /* App-like: inner elements scroll */
    padding: 1.5rem 2rem 1rem 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 100%;
}

/* Header (in content) */
.page-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Cards & Containers */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group.full-width {
    grid-column: span 2;
}

label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

input,
select,
textarea,
[contenteditable] {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    user-select: text;
    -webkit-user-select: text;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.section-label {
    grid-column: span 2;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--text-primary);
    color: #fff;
}

.btn-primary:hover {
    background-color: #000;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--text-muted);
    background: #f9fafb;
}

/* Tables */
.table-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    min-width: 600px;
}

th {
    text-align: left;
    padding: 0.75rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: #f9fafb;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.meta-main {
    font-weight: 500;
    color: var(--text-primary);
}

.meta-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    min-width: 300px;
    max-width: 450px;
    padding: 1rem 1.25rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideIn 0.4s ease-out forwards;
    border-left: 4px solid transparent;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    border-left-color: #22c55e;
    background: #f0fdf4;
}

.toast-success .toast-title {
    color: #15803d;
}

.toast-success .toast-icon {
    color: #166534;
}

.toast-error {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.toast-error .toast-title {
    color: #b91c1c;
}

.toast-error .toast-icon {
    color: #991b1b;
}

.toast-info {
    border-left-color: #3b82f6;
    background: #eff6ff;
}

.toast-info .toast-title {
    color: #1d4ed8;
}

.toast-info .toast-icon {
    color: #2563eb;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.875rem;
    color: #4b5563;
    line-height: 1.4;
}

.toast-close {
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.25rem;
    line-height: 1;
}

.toast-close:hover {
    color: #4b5563;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        flex-direction: column;
        overflow: auto;
        /* Allow body scroll on mobile */
    }

    /* Sidebar Mobile Overlays */
    .sidebar {
        display: none;
        /* Hidden by default */
        position: fixed;
        top: 0;
        left: 0;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        z-index: 100;
        box-shadow: 10px 0 20px rgba(0, 0, 0, 0.1);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        display: flex;
        /* Keep flex context */
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* Overlay backdrop */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 90;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full-width {
        grid-column: span 1;
    }

    .section-label {
        grid-column: span 1;
    }

    /* Mobile Header with Menu Button */
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem;
        background: #fff;
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        z-index: 50;
    }

    .menu-toggle {
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.5rem;
    }

    /* Table adjustments */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
        /* Force scroll for wide tables */
    }

    /* Toast adjustments */
    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        width: auto;
    }

    .toast {
        min-width: 0;
        width: 100%;
    }
}

/* Utilities for hiding/showing */
.desktop-only {
    display: flex;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }
}

/* --- MERGED DASHBOARD STYLES --- */

/* Modal System (Enhanced) */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #fff;
    margin: auto;
    padding: 2rem;
    border: 1px solid #e5e7eb;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    color: #9ca3af;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover,
.close-modal:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.modal-title {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

/* Tables Grid System */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 5), 1fr);
    gap: 1.5rem;
    padding: 1.5rem;
}

.table-card {
    aspect-ratio: 1;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.table-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
    z-index: 2;
}

.table-card.available {
    border-top: 4px solid #22c55e;
}

.table-card.occupied {
    border-top: 4px solid #ef4444;
    background-color: #fef2f2;
}

.table-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1e293b;
}

.add-table-card {
    border: 2px dashed #e2e8f0;
    color: #94a3b8;
    cursor: pointer;
    border-top: none;
}

.add-table-card:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    transform: translateY(-2px);
}

.add-table-icon {
    font-size: 3rem;
    line-height: 1;
}

/* Ribbons */
.status-ribbon {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    border-bottom-left-radius: 8px;
    color: white;
    box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.1);
}

.status-ribbon.available {
    background: #22c55e;
}

.status-ribbon.occupied-mine {
    background: #eab308;
}

.status-ribbon.occupied-other {
    background: #ef4444;
}

.status-ribbon.reserved {
    background: #a855f7;
}

/* Responsible Name text */
.table-responsible {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
    height: 1.2em;
}

/* Context Menu */
#tableContextMenu {
    display: none;
    position: fixed;
    z-index: 1000;
    width: 150px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.context-menu-item {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.context-menu-item:hover {
    background-color: #f3f4f6;
}

.context-menu-item.delete {
    color: #ef4444;
}

.context-menu-item.delete:hover {
    background-color: #fef2f2;
}

/* Modal Body Grid (Responsive) */
.modal-body-grid {
    display: flex;
    gap: 1rem;
    height: 60vh;
    flex-wrap: wrap;
}

.modal-col-left {
    flex: 3;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-right: 1px solid #e2e8f0;
    padding-right: 1rem;
    min-width: 300px;
}

.modal-col-right {
    flex: 2;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding-left: 0.5rem;
    min-width: 250px;
}

@media (max-width: 768px) {
    .modal-content {
        width: 98% !important;
        max-height: 95vh;
        margin: 2% auto;
        padding: 1rem;
        overflow-y: auto;
    }

    .modal-body-grid {
        flex-direction: column;
        height: auto !important;
        display: block;
    }

    .modal-col-left {
        width: 100%;
        min-width: 0;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        padding-right: 0;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
        height: 300px;
    }

    .modal-col-right {
        width: 100%;
        min-width: 0;
        padding-left: 0;
        height: auto;
        min-height: 200px;
    }

    #dishesList {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important;
    }
}

/* Dish Cards */
.dish-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.8rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dish-img {
    width: 100%;
    height: 80px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 4px;
    border: 1px solid #f1f5f9;
}

.dish-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.dish-img span {
    font-size: 2rem;
}

.dish-name {
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.2;
    margin-bottom: 0.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #1e293b;
    width: 100%;
}

.dish-price {
    color: #0ea5e9;
    font-weight: 700;
    font-size: 0.9rem;
}

.dish-add-icon {
    display: none;
}

/* List View Overrides */
.dishes-list-view {
    display: flex !important;
    flex-direction: column;
    gap: 0.5rem;
}

.dish-card.list-view {
    flex-direction: row;
    text-align: left;
    height: auto;
    padding: 0.5rem;
    align-items: center;
}

.dish-card.list-view .dish-img {
    width: 50px;
    height: 50px;
    margin-bottom: 0;
    margin-right: 0.8rem;
    flex-shrink: 0;
}

.dish-card.list-view .dish-img span {
    font-size: 1.5rem;
}

.dish-card.list-view .dish-name {
    -webkit-line-clamp: 1;
    margin-bottom: 0;
    font-size: 0.9rem;
    flex: 1;
}

.dish-card.list-view .dish-price {
    margin-left: auto;
    margin-right: 1rem;
}

.dish-card.list-view .dish-add-icon {
    display: block;
    font-size: 1.2rem;
    color: #3b82f6;
    font-weight: bold;
}

.dish-desc-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 10;
    border-radius: 7px;
    overflow: hidden;
}

/* --- TABLE VIEW HELPERS (Extracted) --- */
.page-header.with-controls {
    flex-wrap: wrap;
    gap: 1rem;
}

.layout-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-left: auto;
}

.layout-controls input[type=range] {
    width: 100px;
    cursor: pointer;
    padding: 0;
    border: none;
}

.col-count-display {
    font-weight: 700;
    width: 20px;
    text-align: center;
    color: #3b82f6;
}

.card.flush {
    padding: 0;
}

/* Modal Internal Layouts */
.modal-search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.dish-grid-container {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.8rem;
    align-content: start;
    padding-bottom: 1rem;
}

.order-items-container {
    flex: 1;
    overflow-y: auto;
    background: #f8fafc;
    border-radius: 6px;
    padding: 0.5rem;
    border: 1px solid #f1f5f9;
    min-height: 100px;
}

.order-item-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px dashed #e2e8f0;
    padding-bottom: 0.25rem;
}

.item-quantity {
    font-weight: 600;
    color: #334155;
}

.item-name-note {
    display: inline-flex;
    align-items: center;
}

.btn-remove-item {
    cursor: pointer;
    color: #ef4444;
    background: none;
    border: none;
    font-weight: bold;
    margin-left: 0.5rem;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 5px;
}

.btn-pay-confirm {
    width: 100%;
    background: #22c55e;
    color: white;
    margin-top: 1rem;
    font-weight: bold;
    box-shadow: 0 4px 6px -1px rgba(34, 197, 94, 0.4);
}

/* --- ORDER ITEM STATUSES --- */
.item-status-indicator {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 0.5rem;
}

.item-status-pending {
    background: #e2e8f0;
    color: #475569;
}

.item-status-cooking {
    background: #ffedd5;
    color: #c2410c;
}

.item-status-served {
    background: #dcfce7;
    color: #15803d;
}


/* --- DISH CARD CATEGORY COLORS --- */
.badge-category {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Default */
.cat-color-default {
    background: #e2e8f0;
    color: #475569;
}

/* Specific Categories - matching common restaurant themes */
.cat-color-entradas {
    background: #fee2e2;
    color: #991b1b;
}

/* Redish */
.cat-color-fondos {
    background: #ffedd5;
    color: #9a3412;
}

/* Orange */
.cat-color-bebidas {
    background: #dbeafe;
    color: #1e40af;
}

/* Blue */
.cat-color-postres {
    background: #fce7f3;
    color: #9d174d;
}

/* Pink */
.cat-color-guarniciones {
    background: #dcfce7;
    color: #166534;
}

/* Green */
.cat-color-parrillas {
    background: #fef08a;
    color: #854d0e;
}

/* Yellow */


/* --- STATUS BADGES --- */
.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Cash History Module Styles */
.report-option input:checked+.option-card {
    border-color: #10b981 !important;
    background: #ecfdf5;
}

.report-option input:checked+.option-card div {
    color: #047857 !important;
}

.option-card:hover {
    border-color: #94a3b8;
    transform: translateY(-2px);
}

.page-pill {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s ease;
}

.page-pill:hover:not(.disabled):not(.active) {
    background: rgba(255, 255, 255, 0.5);
    color: #0f172a;
}

.page-pill.active {
    background: white;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 700;
    transform: scale(1.05);
}

.page-pill.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* Prevent wrapping in financial columns */
.cashier-table th,
.cashier-table td {
    white-space: nowrap;
}

.cashier-table tbody tr {
    transition: background-color 0.2s ease;
}

.cashier-table tbody tr:hover {
    background-color: #e0f7fa !important;
}

/* Grid Style from Reference */
.cashier-table th {
    background-color: #dbeafe !important;
    color: #334155 !important;
    border: 1px solid #93c5fd !important;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 1rem;
    /* Adding padding here to ensure consistency if not present */
}

.cashier-table td {
    border: 1px solid #cbd5e1;
}

/* Mobile Adjustments */
@media (max-width: 640px) {
    .page-header {
        margin-bottom: 1rem;
        /* Reduce space from 2rem to 1rem on mobile */
        flex-wrap: wrap;
        gap: 1rem;
    }

    /* Ensure title also doesn't push too much if wrapped */
    .page-title {
        width: 100%;
        margin-bottom: 0.25rem;
    }

    /* Make buttons full width on very small screens if desired, or just auto */
    .page-header .btn {
        width: 100%;
        justify-content: center;
    }
}

/* --- USERS VIEW EDIT USER STYLES --- */
.edit-user-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    overflow: hidden;
    padding: 1rem;
}

.edit-user-card {
    width: 100%;
    max-width: 900px;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    flex: 1;
    overflow-y: auto;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-actions {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.section-title {
    grid-column: 1 / -1;
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 0.5rem;
}

/* Mobile Optimization */
@media (max-width: 640px) {
    .edit-user-wrapper {
        padding: 0.5rem;
    }

    .edit-user-card {
        padding: 1.5rem !important;
        border-radius: 12px;
    }

    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .form-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
        margin-top: 2rem;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 0.75rem !important;
    }

    .back-btn-container {
        justify-content: flex-start !important;
        margin-bottom: 0.5rem !important;
    }
}

/* --- TABLES VIEW STYLES --- */

.tables-view-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
    padding: 0 1rem;
}

.tables-view-container .card.flush {
    border-radius: 12px !important;
}

.tables-view-container .page-header {
    margin-bottom: 0.75rem !important;
    flex-shrink: 0;
}

.floor-tabs {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding: 4px;
    align-items: center;
    flex-wrap: nowrap;
    min-height: 54px;
    position: relative;
    z-index: 10;
    width: 100%;
}

.floor-tab {
    background: white;
    border: 1px solid #cbd5e1;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.95rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.floor-tab:hover {
    background: #f1f5f9;
    color: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.floor-tab.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.floor-add-btn {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    color: #64748b;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.floor-add-btn:hover {
    border-color: #94a3b8;
    background: #e2e8f0;
    color: #334155;
}

/* Mobile Compact Tabs & Grid Optimization (Tables) */
@media (max-width: 640px) {
    .tables-view-container .page-header {
        margin-bottom: 0.5rem !important;
    }

    .tables-view-container .page-title {
        margin-bottom: 0.25rem !important;
    }

    .tables-view-container .card.flush {
        overflow-x: auto;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .tables-view-container .card.flush::-webkit-scrollbar {
        display: none;
    }

    .floor-tabs {
        margin-top: 0.5rem !important;
        margin-bottom: 0.5rem !important;
        min-height: auto !important;
        padding: 2px 0 !important;
        gap: 0.4rem !important;
    }

    .floor-tab {
        padding: 0.4rem 0.85rem !important;
        font-size: 0.85rem !important;
        border-radius: 6px !important;
    }

    .floor-add-btn {
        width: 34px !important;
        height: 34px !important;
        font-size: 1.2rem !important;
    }

    .floor-tabs span {
        font-size: 0.75rem !important;
    }

    .tables-grid {
        grid-template-columns: repeat(var(--cols), minmax(85px, 1fr)) !important;
        width: max-content;
        min-width: 100%;
        padding: 1rem 0.5rem !important;
        gap: 0.5rem !important;
    }

    .table-number {
        font-size: 1.25rem !important;
    }

    .status-ribbon {
        font-size: 0.55rem !important;
        padding: 2px 4px !important;
        top: 4px !important;
    }

    .table-responsible {
        font-size: 0.6rem !important;
    }
}

/* --- KITCHEN VIEW STYLES --- */
.kitchen-view-container {
    padding: 0 1rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent container itself from scrolling */
}

.kitchen-scroll-wrapper {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 2rem;
    /* Custom Scrollbar for better UX */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.kitchen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    /* No overflow here, just layout */
}

.ticket-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s;
}

.ticket-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.ticket-header {
    background: #f8fafc;
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ticket-table {
    font-weight: 700;
    font-size: 1.25rem;
    color: #1e293b;
}

.ticket-time {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

.ticket-waiter {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 0.25rem;
}

.ticket-body {
    padding: 1rem;
    flex: 1;
}

.ticket-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px dashed #e2e8f0;
}

.ticket-item:last-child {
    border-bottom: none;
}

.item-qty {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1e293b;
    width: 32px;
    flex-shrink: 0;
}

.item-details {
    flex: 1;
    padding-right: 0.5rem;
}

.item-name {
    font-weight: 600;
    color: #334155;
    font-size: 1rem;
}

.item-notes {
    background: #fffbeb;
    color: #b45309;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.25rem;
    display: inline-block;
    border: 1px solid #fcd34d;
}

.item-status-btn {
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

/* Status Colors */
.status-pending {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fca5a5;
}

/* Red - To Do */
.status-cooking {
    background: #fff7ed;
    color: #ea580c;
    border: 1px solid #fdba74;
}

/* Orange - Cooking */
.status-ready {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #86efac;
}

/* Green - Ready */
.status-served {
    background: #f1f5f9;
    color: #94a3b8;
    border: 1px solid #cbd5e1;
    text-decoration: line-through;
}

/* Grey - Done */

.ticket-footer {
    padding: 1rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

@media (max-width: 640px) {
    .kitchen-grid {
        grid-template-columns: 1fr;
    }
}
/* --- DELIVERY VIEW STYLES --- */
/* Mobile Optimization for Delivery Grid */
@media (max-width: 640px) {
    .delivery-container .card.flush {
        overflow-y: auto !important;
        height: auto !important;
        flex: 1 1 auto;
    }

    .delivery-container .tables-grid {
        grid-template-columns: 1fr !important;
        width: 100% !important;
        padding: 1rem 0.5rem !important;
        gap: 1rem !important;
    }

    .delivery-container .table-card {
        min-height: auto !important;
        height: auto !important;
        aspect-ratio: auto !important;
        width: 100%;
        justify-content: flex-start !important;
        gap: 0.8rem;
    }

    .delivery-container .table-card>div {
        flex-grow: 0 !important;
    }

    .delivery-container .table-card>div[style*="flex-grow: 1"]:empty {
        display: none !important;
    }

    .delivery-container .table-number {
        font-size: 1.25rem !important;
        margin: 0 !important;
    }

    .delivery-container .status-ribbon {
        font-size: 0.65rem !important;
        padding: 3px 6px !important;
    }

    .delivery-container .table-responsible {
        font-size: 0.75rem !important;
    }
}
/* --- SETTINGS VIEW STYLES --- */
.settings-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}

.settings-section:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.settings-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.settings-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.settings-section-icon {
    font-size: 1.25rem;
    color: #64748b;
}

.sunat-section {
    background: #fcfaff;
    border-color: #e9d5ff;
}

.sunat-section .settings-section-header {
    border-bottom-color: #f3e8ff;
}

.sunat-section .settings-section-title {
    color: #6b21a8;
}
/* Delivery View Spacers */
.delivery-container .card-spacer {
    flex-grow: 1;
}

.delivery-container .card-address {
    flex-grow: 1;
}

/* Mobile Optimization for Delivery Spacers */
@media (max-width: 640px) {
    .delivery-container .card-spacer {
        display: none !important;
        /* Hide spacer completely on mobile */
    }

    .delivery-container .card-address {
        flex-grow: 0 !important;
        /* Don't grow address on mobile */
        margin-bottom: 0.5rem !important;
    }

    /* CRITICAL FIX: Stop footer from pushing to bottom on mobile */
    .delivery-container .card-footer {
        margin-top: 0.5rem !important;
    }
}
/* --- CASHIER VIEW STYLES --- */
@media (max-width: 640px) {
    .cashier-header-responsive {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
        margin-bottom: 0 !important;
    }

    .cashier-header-responsive>div {
        width: 100% !important;
    }

    .cashier-info-badge {
        width: 100% !important;
        justify-content: center !important;
        box-sizing: border-box;
    }

    .cashier-actions {
        width: 100% !important;
        justify-content: space-between !important;
        gap: 0.5rem !important;
    }

    .cashier-actions .action-btn {
        flex: 1 !important;
        width: auto !important;
        text-align: center !important;
        justify-content: center !important;
        padding: 0.75rem 0.25rem !important;
        min-width: 0;
        font-size: 0.85rem !important;
        white-space: nowrap !important;
    }

    .desktop-only {
        display: none !important;
    }
}

/* Metrics Row */
.metrics-container {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* Force bottom border on last row as requested */
.cashier-table tr:last-child td {
    border-bottom: 1px solid #e2e8f0 !important;
}

@media (max-width: 900px) {
    .metrics-container {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0;
        /* Hide scrollbar for cleaner look */
        -ms-overflow-style: none;
        /* IE and Edge */
        scrollbar-width: none;
        /* Firefox */
    }

    .metrics-container::-webkit-scrollbar {
        display: none;
    }

    .metrics-container>.card {
        min-width: 260px;
        /* Ensure cards don't shrink too much */
    }
}

/* Table Mobile Optimization (separated from 900px block) */
@media (max-width: 768px) {

    .cashier-table th,
    .cashier-table td {
        padding: 0.75rem 0.5rem !important;
        /* Reduce padding significantly */
        font-size: 0.8rem !important;
    }

    .cashier-table th {
        text-transform: capitalize !important;
        /* Save space vs UPPERCASE */
    }

    /* MESA (Col 3) & TOTAL (Col 6) adjustments */
    .cashier-table td:nth-child(3),
    .cashier-table th:nth-child(3),
    .cashier-table td:nth-child(6),
    .cashier-table th:nth-child(6) {
        white-space: nowrap;
        width: 1%;
        /* Auto fit content */
    }
}
/* --- CASH HISTORY VIEW STYLES --- */
.responsive-spacer {
    width: 100%;
    height: 0.5rem;
}

@media (min-width: 768px) {
    .responsive-spacer {
        width: auto;
        flex-grow: 1;
        height: 0;
    }
}