:root {
    --ink: #17202a;
    --muted: #64748b;
    --line: #d8dee8;
    --paper: #f7f8fb;
    --panel: #ffffff;
    --brand: #ef4444;
    --brand-dark: #b91c1c;
    --green: #16a34a;
    --blue: #0284c7;
    --amber: #d97706;
    --violet: #7c3aed;
    --radius: 8px;
    --shadow: 0 16px 40px rgba(15, 23, 42, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
}

.side-nav {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: #111827;
    color: #f8fafc;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.brand-block {
    display: grid;
    gap: 8px;
}

.brand-block img {
    width: 54px;
    height: 54px;
    object-fit: contain;
}

.brand-block span,
.eyebrow {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.side-nav nav {
    display: grid;
    gap: 8px;
}

.nav-section-title {
    margin: 10px 4px 0;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.side-nav a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-weight: 700;
}

.side-nav a.active,
.side-nav a:hover {
    color: #fff;
    background: #273449;
}

.status-pill {
    color: #bbf7d0;
    background: rgba(22, 163, 74, .15);
    border: 1px solid rgba(34, 197, 94, .3);
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 13px;
}

.logout-btn {
    width: 100%;
    min-height: 38px;
    color: #fecaca;
    background: rgba(239, 68, 68, .12);
    border: 1px solid rgba(248, 113, 113, .35);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.logout-btn:hover {
    color: #fff;
    background: rgba(239, 68, 68, .28);
}

.language-switch {
    display: grid;
    gap: 6px;
    margin-top: auto;
}

.language-switch + .status-pill {
    margin-top: 0;
}

.language-switch label {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.language-select {
    width: 100%;
    min-height: 38px;
    border: 1px solid rgba(148, 163, 184, .35);
    border-radius: var(--radius);
    color: #f8fafc;
    background: #1f2937;
    padding: 0 10px;
    font-weight: 800;
}

.qr-language-switch {
    display: flex;
    justify-content: flex-end;
    max-width: 760px;
    margin: 10px auto 0;
    padding: 0 12px;
}

.qr-language-switch .language-select {
    max-width: 160px;
    color: var(--ink);
    background: #fff;
    border-color: var(--line);
}

.workspace {
    min-width: 0;
    padding: 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.workspace > section {
    flex: 1 0 auto;
}

.app-footer {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto;
    gap: 4px !important;
    margin-top: 18px;
    padding: 8px 12px 10px !important;
    border-top: 1px solid var(--line);
    color: #17202a;
    background: #f5f6f8;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.footer-line {
    color: #17202a;
    font-size: 13px;
    line-height: 1.2;
}

.footer-copy {
    font-size: 14px;
    font-weight: 400;
    order: 1;
}

.footer-role {
    font-weight: 700;
    order: 2;
}

.footer-author {
    font-weight: 800;
    font-style: italic;
    order: 3;
}

.footer-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #008f5d;
    border-radius: 5px;
    color: #008f5d;
    background-color: #f9f9f9;
    text-decoration: none;
    font-size: 13px;
    font-weight: bold;
    min-height: 28px;
    padding: 4px 8px;
    margin-top: 6px;
    gap: 5px;
    order: 4;
    transition: all 0.2s ease-in-out;
}

.footer-whatsapp svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.footer-whatsapp span {
    font-weight: 800;
    line-height: 1;
}

.footer-whatsapp:hover {
    background-color: #008f5d;
    color: #ffffff;
}

.qr-page-footer {
    max-width: 760px;
    margin: 12px auto 0;
}

.screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.screen-header h1,
.cart-top h2,
.wide-panel h2,
.lane h2 {
    margin: 0;
}

.screen-header p,
.cart-top p,
.operation-log {
    margin: 4px 0 0;
    color: var(--muted);
}

.header-actions,
.cart-actions,
.payment-strip,
.legend-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.pay-method {
    min-height: 46px;
    border: 0;
    border-radius: var(--radius);
    padding: 0 16px;
    font-weight: 800;
    cursor: pointer;
}

.primary-btn {
    color: white;
    background: var(--brand);
}

.primary-btn:hover {
    background: var(--brand-dark);
}

button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.secondary-btn {
    color: white;
    background: var(--blue);
}

.ghost-btn {
    color: var(--ink);
    background: #e8edf5;
}

.general-table-qr-btn,
.table-general-qr-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.1;
    white-space: nowrap;
}

.pos-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    gap: 18px;
    align-items: start;
}

.products-zone,
.cart-zone,
.wide-panel,
.lane,
.metric-tile {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.products-zone,
.cart-zone {
    padding: 18px;
}

.category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.category-tab {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    min-height: 40px;
    padding: 0 16px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}

.category-tab.active {
    color: #fff;
    background: #17202a;
    border-color: #17202a;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.product-btn {
    display: flex;
    flex-direction: column;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: var(--radius);
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
}

.product-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.product-img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-bottom: 1px solid var(--line);
}

.product-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
    gap: 4px;
}

.product-btn strong {
    font-size: 14px;
    color: var(--ink);
}

.product-btn small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
}

.product-btn span {
    color: var(--brand);
    font-size: 16px;
    font-weight: 800;
    margin-top: 4px;
}

.cart-zone {
    position: sticky;
    top: 18px;
    display: grid;
    gap: 16px;
}

.cart-qr-actions {
    display: grid;
    gap: 8px;
}

.client-order-qr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid rgba(22, 163, 74, .28);
    border-radius: var(--radius);
    color: #fff;
    background: linear-gradient(180deg, #22c55e, #16a34a);
    box-shadow: 0 8px 18px rgba(22, 163, 74, .22);
    font-size: 14px;
    font-weight: 900;
    text-align: center;
    text-decoration: none;
}

.client-order-qr-btn:hover {
    background: linear-gradient(180deg, #16a34a, #15803d);
}

.header-actions .client-order-qr-btn {
    min-height: 46px;
    white-space: nowrap;
}

.header-qr-btn {
    box-shadow: 0 8px 18px rgba(22, 163, 74, .18);
}

.cart-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.cart-top select,
.cart-summary input,
.qr-cart input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 12px;
}

.order-type-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.order-type-btn {
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: #eef2f7;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.order-type-btn.active {
    color: #fff;
    border-color: var(--green);
    background: var(--green);
}

.order-type-hint {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.pos-staff-select {
    display: grid;
    gap: 4px;
}

.pos-staff-select label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.pos-staff-select select:disabled {
    color: var(--muted);
    background: #f1f5f9;
    cursor: not-allowed;
}

.table-bill-card {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid rgba(239, 68, 68, .28);
    border-left: 6px solid var(--brand);
    border-radius: var(--radius);
    background: #fff7f7;
}

.table-bill-card strong {
    display: block;
    margin-top: 2px;
    color: var(--brand-dark);
    font-size: 28px;
    line-height: 1;
}

.table-bill-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.cart-items {
    display: grid;
    gap: 8px;
    min-height: 220px;
    max-height: 360px;
    overflow: auto;
    align-content: start;
}

.cart-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fafc;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    margin-bottom: 8px;
}

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

.cart-item-actions button {
    width: 32px;
    height: 32px;
    border-radius: 50% !important;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.2s;
}

.cart-item-actions button:hover {
    background: var(--paper);
}

.cart-summary {
    display: grid;
    gap: 10px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
}

.summary-row.total {
    font-size: 24px;
}

.summary-row.charge-row {
    color: var(--muted);
    font-size: 14px;
}

.assignment-grid,
.charge-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.assignment-grid label,
.charge-input-grid label {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.assignment-grid select,
.charge-input-grid input {
    width: 100%;
}

.assignment-grid select {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 10px;
    background: #fff;
}

.charge-input-grid input[readonly] {
    color: var(--muted);
    background: #eef2f7;
}

.billing-summary {
    display: grid;
    gap: 8px;
    margin: 12px 0 18px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fafc;
}

.billing-summary > div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 14px;
}

.billing-summary strong {
    color: var(--ink);
}

.billing-summary .billing-total {
    padding-top: 8px;
    border-top: 1px solid var(--line);
    color: var(--ink);
    font-size: 18px;
    font-weight: 900;
}

.pay-method {
    flex: 1;
    color: var(--ink);
    background: #eef2f7;
}

.pay-method.active {
    color: white;
    background: var(--green);
}

.cart-actions button {
    flex: 1;
    min-height: 56px;
}

.cart-actions #chargeBtn.order-empty {
    color: #fff;
    background: #ef4444;
    box-shadow: 0 8px 18px rgba(239, 68, 68, .24);
    opacity: 1;
}

.cart-actions #chargeBtn.order-ready {
    color: #fff;
    background: #16a34a;
    box-shadow: 0 8px 18px rgba(22, 163, 74, .26);
    opacity: 1;
}

.kanban {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.lane {
    min-height: 70vh;
    padding: 14px;
}

.lane h2 {
    font-size: 18px;
    margin-bottom: 12px;
}

.lane-items {
    display: grid;
    gap: 10px;
}

.kitchen-ticket,
.table-tile,
.top-product-row {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 12px;
}

.kitchen-ticket-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.kitchen-ticket-header strong {
    font-size: 18px;
}

.kitchen-ticket-meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.kitchen-ticket-total {
    color: var(--brand-dark);
    font-size: 20px;
    font-weight: 900;
    white-space: nowrap;
}

.kitchen-order-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    color: white;
    background: #17202a;
    font-size: 12px;
    font-weight: 900;
}

.ticket-items {
    margin: 10px 0;
    padding-left: 18px;
}

.ticket-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.small-btn {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #eef2f7;
    font-weight: 800;
    cursor: pointer;
}

.table-map {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.table-tile {
    min-height: 110px;
    display: grid;
    gap: 6px;
    padding: 10px !important;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--panel);
}

.table-tile.free {
    border-left: 5px solid var(--green);
    background: #f0fdf4 !important; /* Soft green */
}
.table-tile.occupied {
    border-left: 5px solid var(--brand);
    background: #fef2f2 !important; /* Soft red */
    animation: pulse-red 2s infinite alternate;
}
.table-tile.reserved {
    border-left: 5px solid var(--violet);
    background: #faf5ff !important; /* Soft purple */
}
.table-tile.cleaning {
    border-left: 5px solid var(--amber);
    background: #fffbeb !important; /* Soft yellow/amber */
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0px rgba(239, 68, 68, 0.4);
        background: #fef2f2 !important;
    }
    100% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.05);
        background: #fee2e2 !important;
    }
}

.table-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.table-tile .small-btn {
    padding: 3px 6px !important;
    font-size: 11px !important;
    min-height: 24px !important;
    font-weight: bold;
    cursor: pointer;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #f1f5f9;
    color: var(--ink);
}

.table-tile .small-btn:hover {
    background: #e2e8f0;
}

.table-tile .table-general-qr-link {
    min-height: 28px !important;
    padding: 0 8px !important;
    color: var(--blue);
    text-decoration: none;
}

.table-tile strong {
    font-size: 14px;
}

.table-tile div {
    font-size: 11px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot.free { background: var(--green); }
.dot.occupied { background: var(--brand); }
.dot.reserved { background: var(--violet); }
.dot.cleaning { background: var(--amber); }

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.finance-submenu {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.finance-submenu a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    font-weight: 900;
    text-decoration: none;
}

.finance-submenu a.active {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

[data-finance-section][hidden],
.traceability-only[hidden] {
    display: none !important;
}

#financeFormsGrid > [data-finance-section]:not([hidden]) {
    grid-column: 1 / -1;
}

.metric-tile {
    padding: 18px;
    display: grid;
    gap: 8px;
}

.metric-tile span {
    color: var(--muted);
    font-weight: 700;
}

.metric-tile strong {
    font-size: 28px;
}

.wide-panel {
    margin-top: 16px;
    padding: 18px;
}

.top-products {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.top-product-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.qr-body {
    background: #f4f7fb;
}

.qr-shell {
    max-width: 760px;
    margin: 0 auto;
    padding: 18px;
}

.qr-header,
.qr-cart {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}

.qr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.qr-products {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.qr-shell[data-role="cliente"] .qr-products {
    display: block !important;
}

.qr-client-form {
    background: #f8fafc;
    border-radius: 10px;
    padding: 16px;
}

.qr-client-form .form-group {
    gap: 7px;
}

.qr-client-form label {
    color: #334155;
    letter-spacing: 0;
}

.qr-client-control,
.qr-client-form input,
.qr-client-form select,
.qr-client-form textarea {
    min-height: 48px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    padding: 0 14px;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.qr-client-form select.qr-client-control {
    cursor: pointer;
}

.qr-client-form textarea.qr-client-control {
    min-height: 86px;
    padding: 12px 14px;
    resize: vertical;
}

.qr-client-control-readonly,
.qr-client-form input[readonly] {
    color: #475569;
    background: #eef2f7 !important;
}

.qr-client-control:focus,
.qr-client-form input:focus,
.qr-client-form select:focus,
.qr-client-form textarea:focus {
    border-color: var(--blue);
    outline: none;
    box-shadow: 0 0 0 4px rgba(2, 132, 199, .14);
}

.delivery-fee-row[hidden],
.qr-client-form .form-group[hidden] {
    display: none !important;
}

.qr-payment-info {
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid rgba(2, 132, 199, .22);
    border-radius: 10px;
    color: #0f172a;
    background: #eff6ff;
    font-size: 13px;
    line-height: 1.35;
}

.qr-payment-info[hidden] {
    display: none !important;
}

.qr-payment-info strong {
    color: #075985;
}

#cartModal.qr-checkout-modal {
    align-items: center;
    overflow-y: auto;
    padding: clamp(8px, 2vw, 18px);
}

#cartModal.qr-checkout-modal .qr-checkout-content {
    display: grid;
    grid-template-rows: auto minmax(0, auto) minmax(0, 1fr) auto auto auto;
    width: min(560px, calc(100vw - 24px)) !important;
    max-width: min(560px, calc(100vw - 24px)) !important;
    max-height: calc(100dvh - 24px);
    overflow: hidden;
}

#cartModal.qr-checkout-modal #qrCartItems {
    max-height: min(28dvh, 210px) !important;
    overflow-y: auto !important;
}

#cartModal.qr-checkout-modal #checkoutFormArea {
    max-height: min(42dvh, 420px);
    overflow-y: auto;
}

#cartModal.qr-checkout-modal .qr-client-control,
#cartModal.qr-checkout-modal .qr-client-form input,
#cartModal.qr-checkout-modal .qr-client-form select,
#cartModal.qr-checkout-modal .qr-client-form textarea {
    min-height: 44px;
}

.qr-cart {
    display: grid;
    gap: 10px;
    position: sticky;
    bottom: 0;
}

.whatsapp-link {
    display: none;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--green);
    color: white;
    text-decoration: none;
    font-weight: 900;
}

.whatsapp-link.visible {
    display: flex;
}

@media (max-width: 980px) {
    .app-shell,
    .pos-grid,
    .kanban,
    .metric-grid,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .side-nav {
        position: sticky;
        top: 0;
        z-index: 10;
        height: auto;
        overflow-y: visible;
        display: block;
        padding: 12px;
    }

    .brand-block {
        grid-template-columns: 38px 1fr;
        align-items: center;
    }

    .brand-block img {
        width: 38px;
        height: 38px;
    }

    .brand-block span {
        grid-column: 2;
    }

    .side-nav nav {
        display: flex;
        overflow-x: auto;
        margin-top: 10px;
    }

    .status-pill {
        display: none;
    }

    .workspace {
        padding: 14px;
    }

    .cart-zone {
        position: static;
    }

    .screen-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .qr-products {
        grid-template-columns: 1fr;
    }

    .finance-line-item {
        grid-template-columns: 1fr;
    }

    .header-actions {
        flex-wrap: wrap;
    }

    .header-actions .client-order-qr-btn {
        width: 100%;
    }
}

@media (max-width: 640px) {
    #cartModal.qr-checkout-modal {
        align-items: stretch;
        padding: 0;
    }

    #cartModal.qr-checkout-modal .qr-checkout-content {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 100dvh;
        max-height: 100dvh;
        border-radius: 0 !important;
        padding: 16px !important;
    }

    #cartModal.qr-checkout-modal #qrCartItems {
        max-height: 24dvh !important;
    }

    #cartModal.qr-checkout-modal #checkoutFormArea {
        max-height: 46dvh;
    }
}

@media (max-height: 720px) and (min-width: 641px) {
    #cartModal.qr-checkout-modal #qrCartItems {
        max-height: 18dvh !important;
    }

    #cartModal.qr-checkout-modal #checkoutFormArea {
        max-height: 40dvh;
    }
}

/* ==========================================
   Admin Catalog Styling (Tabs, Forms, Modals)
   ========================================== */

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-bottom: 2px solid var(--line);
    margin-bottom: 24px;
}

.admin-tab-btn {
    background: none;
    border: none;
    padding: 12px 18px;
    color: var(--muted);
    font-weight: 700;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.admin-tab-btn:hover {
    color: var(--ink);
}

.admin-tab-btn.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.25s ease-out;
}

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

.panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header-row h2 {
    margin: 0;
}

.table-container {
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
    border: 1px solid var(--line);
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th,
.admin-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.admin-table th {
    background: #f8fafc;
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table tbody tr:hover {
    background: rgba(247, 248, 251, 0.5);
}

.admin-table td {
    font-size: 14px;
}

.color-badge {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9999px;
    text-transform: uppercase;
}

.badge.pending {
    background: rgba(217, 119, 6, 0.1);
    color: var(--amber);
    border: 1px solid rgba(217, 119, 6, 0.2);
}

.badge.synced {
    background: rgba(22, 163, 74, 0.1);
    color: var(--green);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.badge.active {
    background: rgba(22, 163, 74, 0.15);
    color: var(--green);
}

.badge.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--brand);
}

.action-buttons {
    display: flex;
    gap: 6px;
}

.action-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--line);
    background: var(--panel);
    transition: all 0.15s ease;
}

.action-btn.edit:hover {
    background: #eff6ff;
    color: var(--blue);
    border-color: #bfdbfe;
}

.action-btn.delete:hover {
    background: #fef2f2;
    color: var(--brand);
    border-color: #fca5a5;
}

/* Modals */
.admin-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.admin-modal.open {
    display: flex;
}

.modal-content {
    background: var(--panel);
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 520px;
    padding: 24px;
    position: relative;
    animation: modalSlide 0.2s ease-out;
}

.system-modal {
    z-index: 1600;
}

.system-modal-content {
    max-width: 430px;
    padding: 0;
    overflow: hidden;
}

.system-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    color: var(--muted);
    background: #f1f5f9;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.system-modal-close:hover {
    color: var(--ink);
    background: #e2e8f0;
}

.system-modal-head {
    padding: 22px 24px 14px;
    border-bottom: 1px solid var(--line);
}

.system-modal-kicker {
    display: block;
    margin-bottom: 6px;
    color: var(--brand);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.system-modal-head h3 {
    margin: 0;
    padding-right: 34px;
    font-size: 21px;
    line-height: 1.2;
}

.system-modal-body {
    display: grid;
    gap: 14px;
    padding: 18px 24px;
}

.system-modal-body p {
    margin: 0;
    color: var(--ink);
    font-size: 15px;
    line-height: 1.45;
}

.system-modal-input-wrap {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.system-modal-input-wrap input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 12px;
    color: var(--ink);
    background: #fff;
    font-size: 20px;
    font-weight: 900;
}

.system-modal-input-wrap input:focus {
    border-color: var(--blue);
    outline: 3px solid rgba(2, 132, 199, .14);
}

.system-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 22px;
    border-top: 1px solid var(--line);
    background: #f8fafc;
}

.system-modal-actions button {
    min-width: 110px;
}

.order-person-label {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

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

.close-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    font-size: 24px;
    cursor: pointer;
    color: var(--muted);
    line-height: 1;
}

.close-btn:hover {
    color: var(--ink);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

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

.form-group label {
    font-weight: 700;
    font-size: 13px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--brand);
}

.finance-metrics .metric-tile:nth-child(2) strong,
.finance-metrics .metric-tile:nth-child(3) strong {
    color: var(--amber);
}

.finance-line-items {
    display: grid;
    gap: 8px;
    margin: 12px 0;
}

.finance-line-item {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) minmax(140px, 1.2fr) 90px 110px 120px auto;
    gap: 8px;
    align-items: center;
}

.finance-line-item input,
.finance-line-item select {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 10px;
}

.finance-total {
    display: flex;
    align-items: center;
    min-height: 42px;
    color: var(--brand-dark);
    font-size: 22px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    height: 100%;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* ==========================================
   QR Table Selection View Styling
   ========================================== */

.qr-table-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    min-height: 140px;
}

.qr-table-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.qr-table-card.free {
    border-top: 5px solid var(--green);
    background: #f0fdf4 !important;
}

.qr-table-card.occupied {
    border-top: 5px solid var(--brand);
    background: #fef2f2 !important;
    animation: pulse-red-qr 2s infinite alternate;
}

.qr-table-card.reserved {
    border-top: 5px solid var(--blue);
    background: #faf5ff !important;
}

.qr-table-card.cleaning {
    border-top: 5px solid var(--amber);
    background: #fffbeb !important;
}

@keyframes pulse-red-qr {
    0% {
        box-shadow: 0 0 0 0px rgba(239, 68, 68, 0.3);
    }
    100% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

.table-badge {
    margin-top: 12px;
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 20px;
    text-transform: uppercase;
}

.table-badge.free {
    background: rgba(22, 163, 74, 0.15);
    color: var(--green);
}

.table-badge.occupied {
    background: rgba(239, 68, 68, 0.15);
    color: var(--brand);
}

.table-badge.reserved {
    background: rgba(2, 132, 199, 0.15);
    color: var(--blue);
}

.table-badge.cleaning {
    background: rgba(217, 119, 6, 0.15);
    color: var(--amber);
}

/* Blinking Navigation Animation */
.blink-delivery {
    animation: blink-alert 1.2s infinite alternate !important;
}

@keyframes blink-alert {
    0% {
        background-color: transparent;
    }
    100% {
        background-color: var(--brand);
        color: white;
    }
}

/* Compact Mobile View Overrides */
@media (max-width: 600px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .product-btn {
        min-height: auto !important;
    }
    .product-img {
        height: 70px !important;
    }
    .product-info {
        padding: 6px !important;
        gap: 2px !important;
    }
    .product-info strong {
        font-size: 11px !important;
        line-height: 1.2 !important;
    }
    .product-info small {
        font-size: 9px !important;
        display: none !important;
    }
    .product-info span {
        font-size: 11px !important;
        font-weight: bold !important;
    }
    
    /* Compact Cart */
    .qr-cart, .cart-zone {
        padding: 10px !important;
    }
    .cart-item {
        font-size: 12px !important;
        padding: 4px 0 !important;
    }
}

/* Category Accordion Premium Styling */
.accordion-item {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.accordion-item:hover {
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
}

.accordion-header {
    width: 100%;
    padding: 16px 20px;
    background: var(--panel);
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 16px;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    outline: none;
    transition: background-color 0.2s ease;
}

.accordion-header:hover {
    background-color: var(--paper);
}

.accordion-header.active {
    background-color: #fff9f9;
    color: var(--brand);
    border-bottom: 1px solid var(--line);
}

.accordion-icon {
    font-size: 12px;
    color: var(--muted);
    transition: transform 0.2s ease;
}

.accordion-header.active .accordion-icon {
    color: var(--brand);
}

.accordion-content {
    background-color: var(--paper);
    padding: 16px;
}

/* PC/Tablet Large View Adjustments */
@media (min-width: 601px) {
    .qr-shell {
        max-width: 1200px !important;
        width: 100% !important;
    }
    .product-grid {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 20px !important;
    }
    .product-btn {
        min-height: 240px !important;
    }
    .product-img {
        height: 150px !important;
    }
    .product-info {
        padding: 14px !important;
        gap: 6px !important;
    }
    .product-info strong {
        font-size: 16px !important;
    }
    .product-info small {
        font-size: 12px !important;
    }
    .product-info span {
        font-size: 18px !important;
    }
    .accordion-header {
        font-size: 18px !important;
        padding: 20px 24px !important;
    }
}

/* Sidebar Dropdown Menu Styles */
.nav-dropdown {
    display: grid;
    gap: 4px;
}

.nav-dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: transparent;
    border: none;
    color: #cbd5e1;
    text-align: left;
    padding: 12px 14px;
    border-radius: var(--radius, 6px);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-dropdown-btn:hover {
    color: #fff;
    background: #273449;
}

.nav-dropdown-btn.active {
    color: #fff;
    background: rgba(39, 52, 73, 0.5);
}

.nav-dropdown-btn .chevron-icon {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.nav-dropdown-btn.open .chevron-icon {
    transform: rotate(180deg);
}

.nav-dropdown-content {
    display: none;
    grid-gap: 4px;
    padding-left: 12px;
    border-left: 2px solid #273449;
    margin-left: 8px;
}

.nav-dropdown-content.show {
    display: grid;
}

.nav-dropdown-content a {
    font-size: 13px;
    padding: 8px 12px;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(8px);
}

.auth-modal.open {
    display: flex;
}

.auth-card {
    width: min(100%, 390px);
    display: grid;
    gap: 14px;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #ffffff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.auth-card-head {
    display: grid;
    gap: 6px;
}

.auth-kicker {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.auth-card h2 {
    margin: 0;
    color: var(--ink);
    font-size: 26px;
    line-height: 1.1;
}

.auth-card p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.35;
}

.auth-card label {
    display: grid;
    gap: 6px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.auth-card input {
    width: 100%;
    min-height: 46px;
    border-radius: 8px;
    border: 1px solid var(--line);
    padding: 10px 12px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
    background: var(--paper);
}

.auth-card input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
    background: #fff;
}

.auth-error {
    color: var(--brand) !important;
    font-weight: 800;
}

.auth-submit {
    min-height: 46px;
}
