/* POS Styles - Optimized for Tablet/Kiosk */
/* Uses unified design tokens */
@import url('../css/design-tokens.css');

/* POS-specific overrides */
:root {
    --primary-dark: var(--color-primary-dark);
}

/* Shared Date Picker */
.date-picker-wrapper {
    position: relative;
    width: 100%;
}

.date-picker-wrapper--lg .date-picker-trigger {
    gap: 10px;
    min-height: 52px;
    padding: 14px 16px;
    font-size: 15px;
    border-radius: 14px;
}

.date-picker-wrapper--lg .date-picker-trigger .dp-icon {
    width: 18px;
    height: 18px;
}

.date-picker-wrapper--sm .date-picker-trigger {
    gap: 8px;
    min-height: 40px;
    padding: 9px 12px;
    font-size: 13px;
    border-radius: 10px;
}

.date-picker-wrapper--sm .date-picker-trigger .dp-icon {
    width: 16px;
    height: 16px;
}

.date-picker-wrapper--xs .date-picker-trigger {
    gap: 6px;
    min-height: 32px;
    padding: 6px 9px;
    font-size: 12px;
    border-radius: 8px;
}

.date-picker-wrapper--xs .date-picker-trigger .dp-icon {
    width: 14px;
    height: 14px;
}

.date-picker-wrapper.is-disabled .date-picker-trigger {
    cursor: not-allowed;
    background: var(--bg);
    color: var(--text-secondary);
    border-color: #dbe4f0;
    box-shadow: none;
}

.date-picker-wrapper.is-disabled .date-picker-trigger:hover,
.date-picker-wrapper.is-disabled .date-picker-trigger.open {
    border-color: #dbe4f0;
    box-shadow: none;
}

.date-picker-wrapper.is-disabled .date-picker-trigger .dp-icon,
.date-picker-wrapper.is-disabled .date-picker-trigger .dp-placeholder {
    color: #c4d0e0;
}

.date-picker-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    font-size: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: var(--card, white);
    color: var(--text, #1d1d1f);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.date-picker-trigger:hover {
    border-color: #cbd5e1;
}

.date-picker-trigger.open {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.date-picker-trigger .dp-icon {
    color: var(--text-secondary, #6e6e73);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.date-picker-trigger .dp-text {
    flex: 1;
    min-width: 0;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.25;
}

.date-picker-trigger .dp-placeholder {
    color: var(--text-secondary, #6e6e73);
    font-weight: 400;
}

.calendar-popup {
    position: absolute;
    top: calc(100% + 4px);
    background: var(--card, white);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 10005;
    min-width: 280px;
    display: none;
}

.calendar-popup.open {
    display: block;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.calendar-header-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #1d1d1f);
}

.calendar-header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.calendar-nav-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    background: var(--card, white);
    color: var(--text, #1d1d1f);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.calendar-nav-btn:hover {
    border-color: #cbd5e1;
}

.calendar-nav-btn i {
    width: 14px;
    height: 14px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.calendar-day-header {
    padding: 6px 0;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #6e6e73);
}

.calendar-day {
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text, #1d1d1f);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, color 0.15s;
}

.calendar-day:hover {
    background: var(--color-gray-100, #f3f4f6);
}

.calendar-day.inactive {
    color: #cbd5e1;
    cursor: default;
}

.calendar-day.inactive:hover {
    background: transparent;
}

.calendar-day.today {
    font-weight: 700;
    color: var(--primary);
}

.calendar-day.selected {
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-family);
    background: var(--color-gray-100);
    color: var(--color-gray-900);
    height: 100vh;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

#app {
    display: grid;
    grid-template-columns: 1fr 380px;
    grid-template-rows: 60px 1fr;
    height: 100vh;
}

/* Header */
#posHeader {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--gray-800);
    color: white;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
}

.header-select {
    background: var(--gray-700);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
}

.order-type-btn {
    background: transparent;
    border: 1px solid var(--gray-600);
    color: var(--gray-400);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.08s, color 0.08s, border-color 0.08s;
}

.order-type-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
}

.btn-icon:hover {
    background: var(--gray-700);
}

#currentTime {
    font-size: 14px;
    color: var(--gray-400);
}

/* Main Content */
#posMain {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Category Bar */
#categoryBar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--card, white);
    border-bottom: 1px solid var(--border, #e5e7eb);
    overflow-x: auto;
    flex-shrink: 0;
}

.category-btn {
    background: var(--gray-100);
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.08s, color 0.08s;
}

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

/* Products Grid */
#productsGrid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 16px;
    overflow-y: auto;
    align-content: start;
}

.product-card {
    background: var(--card, white);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.08s;
    border: 2px solid transparent;
}

.product-card:active {
    border-color: var(--primary);
}

.product-img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
}

.product-emoji {
    font-size: 40px;
    margin-bottom: 8px;
}

.product-name {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    height: 2.4em;
    overflow: hidden;
    margin-bottom: 4px;
}

.product-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
}

/* Cart Panel */
#cartPanel {
    display: flex;
    flex-direction: column;
    background: var(--card, white);
    border-left: 1px solid var(--border, #e5e7eb);
    padding-top: 12px;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.cart-header h3 {
    font-size: 18px;
}

#orderNumber {
    color: var(--gray-500);
    font-size: 14px;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px 8px 8px 8px;
    container-type: inline-size;
}

.empty-cart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--gray-400);
    gap: 8px;
}

.empty-icon {
    font-size: 48px;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg, #f9fafb);
    border-radius: 8px;
    margin-bottom: 8px;
}

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

.cart-item-name {
    font-weight: 500;
    font-size: 14px;
}

.cart-item-price {
    font-size: 12px;
    color: var(--gray-500);
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin: 0 8px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border, #d1d5db);
    background: var(--card, white);
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
}

.qty-btn:active {
    background: var(--gray-100);
}

.cart-item-qty {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
}

.cart-item-total {
    min-width: 80px;
    text-align: right;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Cart Footer */
.cart-footer {
    padding: 16px;
    border-top: 1px solid var(--gray-200);
}

.cart-footer.compact {
    padding: 10px 12px;
}

.cart-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.total-row {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

.discount-row {
    color: var(--success);
}

.cart-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.cart-actions-compact {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

.btn {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.08s, color 0.08s;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 16px;
}

.btn-ghost {
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
}

.btn-ghost:active {
    background: var(--gray-200);
}

.btn-outline {
    background: var(--card, white);
    border: 1px solid var(--border, #d1d5db);
}

.btn-outline:active {
    background: var(--gray-100);
}

.btn-pay {
    width: 100%;
    padding: 18px;
    font-size: 18px;
    font-weight: 700;
    background: var(--success);
    color: white;
}

.btn-pay-sm {
    flex: 1;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 700;
    background: var(--success);
    color: white;
    border-radius: 8px;
}

.btn-kitchen-sm {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    background: #f59e0b;
    color: white;
    border-radius: 8px;
}

.btn-kitchen-sm:disabled,
.btn-pay-sm:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

.btn-pay:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

.btn-pay:not(:disabled):active {
    background: #059669;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 100;
}

.modal-overlay.active {
    display: block;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card, white);
    border-radius: 16px;
    padding: 24px;
    min-width: 320px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    display: none;
    z-index: 101;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* B13: When modal has flex layout for table move, contain overflow */
.modal.modal--flex {
    overflow: hidden;
    display: none;
    padding: 0;
}

.modal.modal--flex.active {
    display: flex;
    flex-direction: column;
}

.modal.active {
    display: block;
}

/* When OSK keyboard is open, modal floats to top and shrinks */
body.osk-active .modal.active {
    top: auto;
    bottom: 260px;
    transform: translateX(-50%);
    max-height: calc(100vh - 290px);
}

.modal h3 {
    margin-bottom: 20px;
    font-size: 20px;
}

/* Payment Modal */
.payment-total {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
}

.payment-methods {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.payment-method-btn {
    padding: 24px 16px;
    border: 2px solid var(--border, #e5e7eb);
    background: var(--card, white);
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    text-align: center;
}

.payment-method-btn.active {
    border-color: var(--primary);
    background: #eef2ff;
}

.payment-method-btn span {
    display: block;
    font-size: 28px;
    margin-bottom: 8px;
}

.cash-input {
    margin-bottom: 16px;
}

.cash-input input {
    width: 100%;
    padding: 16px;
    font-size: 24px;
    text-align: center;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
}

.change-display {
    text-align: center;
    font-size: 18px;
    margin-bottom: 16px;
}

.change-display.positive {
    color: var(--success);
}

.change-display.negative {
    color: var(--danger);
}

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

.modal-actions .btn {
    flex: 1;
}

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

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

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

/* Toast */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 200;
}

.toast {
    background: var(--gray-800);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 8px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Discount List */
.discount-list {
    display: grid;
    gap: 8px;
    margin-bottom: 20px;
}

.discount-option {
    padding: 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.discount-option:hover {
    border-color: var(--primary);
}

.discount-option.active {
    border-color: var(--primary);
    background: #eef2ff;
}

/* Responsive */
@media (max-width: 900px) {
    #app {
        grid-template-columns: 1fr 320px;
    }

    #productsGrid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}

@media (max-width: 700px) {
    #app {
        grid-template-columns: 1fr;
        grid-template-rows: 60px 1fr 50vh;
    }

    #cartPanel {
        border-left: none;
        border-top: 1px solid var(--gray-200);
    }
}

/* ========== SQUARE SCREEN OPTIMIZATION (POS Terminals) ========== */
/* Targets 4:3 and square aspect ratios common on POS hardware */
@media (max-aspect-ratio: 5/4) {

    /* Narrower cart panel */
    #app {
        grid-template-columns: 1fr 280px;
        grid-template-rows: 48px 1fr;
    }

    /* Compact header */
    #posHeader {
        padding: 0 12px;
    }

    .logo {
        font-size: 16px;
    }

    .order-type-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .header-select {
        padding: 6px 10px;
        font-size: 13px;
    }

    /* Smaller category buttons */
    #categoryBar {
        padding: 8px 12px;
        gap: 6px;
    }

    .category-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    /* Denser product grid */
    #productsGrid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
        padding: 10px;
    }

    .product-card {
        padding: 8px;
        border-radius: 10px;
    }

    .product-emoji {
        font-size: 32px;
        margin-bottom: 4px;
    }

    .product-img {
        width: 48px;
        height: 48px;
        margin-bottom: 4px;
    }

    .product-name {
        font-size: 12px;
        height: 2.2em;
    }

    .product-price {
        font-size: 13px;
    }

    /* Compact cart */
    .cart-header {
        padding: 10px 12px;
    }

    .cart-header h3 {
        font-size: 15px;
    }

    .cart-items {
        padding: 10px 6px 6px 6px;
    }

    .cart-item {
        padding: 8px 10px;
        margin-bottom: 6px;
    }

    .cart-item-name {
        font-size: 13px;
    }

    .cart-item-price {
        font-size: 11px;
    }

    .qty-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .cart-item-total {
        font-size: 13px;
        min-width: 60px;
    }

    /* Compact footer */
    .cart-footer {
        padding: 10px 12px;
    }

    .cart-row {
        font-size: 13px;
    }

    .total-row {
        font-size: 17px;
        margin-bottom: 10px;
    }

    .btn-pay {
        padding: 14px;
        font-size: 16px;
    }

    /* Guest/Course selectors */
    .guest-selector-row,
    .course-selector-row {
        padding: 6px 10px;
    }

    .gc-btn {
        min-width: 38px;
        min-height: 38px;
        padding: 8px 10px;
        font-size: 13px;
    }
}

/* Extra compact for very square screens (1:1) */
@media (max-aspect-ratio: 1/1) {
    #app {
        grid-template-columns: 1fr 240px;
    }

    #productsGrid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 6px;
        padding: 8px;
    }

    .product-card {
        padding: 6px;
    }

    .product-emoji {
        font-size: 28px;
    }

    .product-name {
        font-size: 11px;
    }

    .product-price {
        font-size: 12px;
    }
}

/* ========== GUEST/COURSE SELECTORS ========== */
.guest-selector-row,
.course-selector-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--gray-100);
    border-radius: 10px;
    margin-bottom: 8px;
}

.dark-theme .guest-selector-row,
.dark-theme .course-selector-row {
    background: #20232f;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.guest-selector-row span,
.course-selector-row span {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    min-width: 50px;
}

.gc-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px 14px;
    border: 2px solid var(--gray-300);
    background: white;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.dark-theme .gc-btn {
    background: #252836;
    border-color: rgba(255, 255, 255, 0.14);
    color: #e2e8f0;
}

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

.gc-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.gc-btn.add {
    background: var(--gray-100);
    border-style: dashed;
    color: var(--gray-500);
}

.dark-theme .gc-btn.add {
    background: #20232f;
    border-color: rgba(255, 255, 255, 0.14);
    color: #94a3b8;
}

.gc-btn.add:active {
    background: var(--gray-200);
}

/* Course-specific colors */
.gc-btn.small {
    min-width: 40px;
    padding: 8px 12px;
}

.gc-btn.course-1.active {
    background: #10b981;
    border-color: #10b981;
}

.gc-btn.course-2.active {
    background: #3b82f6;
    border-color: #3b82f6;
}

.gc-btn.course-3.active {
    background: #f59e0b;
    border-color: #f59e0b;
}

.gc-btn.course-4.active {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

/* ========== CART GUEST HEADERS ========== */
button.cart-guest-header,
button.cart-guest-subheader {
    display: block;
    width: 100%;
    border: 0;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-appearance: none;
    appearance: none;
}

button.cart-guest-header {
    padding: 8px 12px;
    background: linear-gradient(90deg, var(--gray-200), transparent);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-600);
    margin: 8px 0 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

button.cart-guest-subheader {
    padding: 5px 12px;
    background: transparent;
    color: var(--gray-500);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.35px;
}

button.cart-guest-header:hover,
button.cart-guest-subheader:hover,
button.cart-guest-header.active,
button.cart-guest-subheader.active {
    color: var(--primary);
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.16), transparent);
}

button.cart-guest-header:focus-visible,
button.cart-guest-subheader:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.dark-theme button.cart-guest-header {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.18), transparent);
    color: #bfdbfe;
}

.dark-theme button.cart-guest-subheader {
    background: transparent;
    color: #94a3b8;
}

.dark-theme button.cart-guest-header:hover,
.dark-theme button.cart-guest-subheader:hover,
.dark-theme button.cart-guest-header.active,
.dark-theme button.cart-guest-subheader.active {
    color: #dbeafe;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.28), transparent);
}

/* ========== CART ITEM COURSE COLORS ========== */
.cart-item {
    border-left: 4px solid transparent;
}

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

.cart-header-action {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cart-header-action.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #3b82f6;
}

.dark-theme .cart-header-action {
    background: #252836;
    border-color: rgba(255, 255, 255, 0.12);
    color: #94a3b8;
}

.dark-theme .cart-header-action.active {
    background: rgba(59, 130, 246, 0.18);
    border-color: #3b82f6;
    color: #93c5fd;
}

.cart-header-action.btn-selected-check.active {
    background: #ecfeff;
    border-color: #06b6d4;
    color: #0e7490;
}

.selected-check-bar {
    position: sticky;
    top: 0;
    z-index: 4;
    margin: 0 0 8px;
    padding: 8px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.selected-check-bar__summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.selected-check-bar__count {
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 800;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-check-bar__total {
    color: #0f172a;
    font-size: 13px;
    font-weight: 800;
    margin-left: auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-check-bar__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    justify-content: flex-end;
}

.selected-check-action {
    flex: 0 0 auto;
    min-width: 38px;
    height: 36px;
    border: 1px solid #93c5fd;
    border-radius: 8px;
    background: #fff;
    color: #1d4ed8;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
}

.selected-check-action.primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.selected-check-action.icon-only {
    width: 38px;
    padding: 0;
}

.selected-check-action:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.dark-theme .selected-check-bar {
    background: rgba(14, 165, 233, 0.1);
    border-color: rgba(56, 189, 248, 0.42);
    box-shadow: none;
}

.dark-theme .selected-check-bar__count {
    color: #7dd3fc;
}

.dark-theme .selected-check-bar__total {
    color: #e2e8f0;
}

.dark-theme .selected-check-action {
    background: #252836;
    border-color: rgba(125, 211, 252, 0.45);
    color: #7dd3fc;
}

.dark-theme .selected-check-action.primary {
    background: #0284c7;
    border-color: #0284c7;
    color: #fff;
}

@container (max-width: 360px) {
    .selected-check-bar {
        padding: 6px;
        gap: 6px;
    }

    .selected-check-bar__summary {
        gap: 6px;
    }

    .selected-check-bar__count,
    .selected-check-bar__total {
        font-size: 12px;
    }

    .selected-check-bar__actions {
        gap: 5px;
    }

    .selected-check-action {
        width: 36px;
        min-width: 36px;
        height: 34px;
        padding: 0;
    }

    .selected-check-action span {
        display: none;
    }
}

@media (max-width: 1180px) {
    .selected-check-bar {
        padding: 6px;
        gap: 6px;
    }

    .selected-check-action {
        width: 36px;
        min-width: 36px;
        height: 34px;
        padding: 0;
    }

    .selected-check-action span {
        display: none;
    }
}

.cart-line-select {
    width: 24px;
    height: 24px;
    border: 2px solid #fdba74;
    border-radius: 7px;
    background: #fff;
    color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cart-line-select.checked {
    background: #f97316;
    border-color: #ea580c;
    color: #fff;
}

.cart-line-select.disabled {
    border-color: #cbd5e1;
    background: #f1f5f9;
    opacity: 0.55;
}

.dark-theme .cart-line-select {
    background: #20232f;
    border-color: #fb923c;
}

.dark-theme .cart-line-select.disabled {
    background: #252836;
    border-color: #475569;
}

.cart-item.selected-check-enabled {
    cursor: pointer;
}

.cart-item.item-selected-check {
    outline: 3px solid #f97316;
    outline-offset: -3px;
    background: #fff7ed;
}

.dark-theme .cart-item.item-selected-check {
    background: rgba(249, 115, 22, 0.2);
}

.cart-item.item-active-position {
    outline: 3px solid #f97316;
    outline-offset: -3px;
    background: #fff7ed;
    box-shadow: inset 0 0 0 1px rgba(234, 88, 12, 0.18);
}

.dark-theme .cart-item.item-active-position {
    background: rgba(249, 115, 22, 0.2);
    box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.3);
}

.cart-item.course-1 {
    border-left-color: #10b981;
}

.cart-item.course-2 {
    border-left-color: #3b82f6;
}

.cart-item.course-3 {
    border-left-color: #f59e0b;
}

.cart-item.course-4 {
    border-left-color: #8b5cf6;
}

.cart-item.current-guest {
    background: #e0f2fe;
}

.dark-theme .cart-item.current-guest {
    background: rgba(59, 130, 246, 0.13);
}

.cart-course-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    color: white;
}

.cart-course-badge.c1 {
    background: #10b981;
}

.cart-course-badge.c2 {
    background: #3b82f6;
}

.cart-course-badge.c3 {
    background: #f59e0b;
}

.cart-course-badge.c4 {
    background: #8b5cf6;
}

/* ========== CART COURSE DIVIDER ========== */
.cart-course-divider {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin: 6px 0 2px 0;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}

.dark-theme .cart-course-divider {
    background: #20232f;
    color: #94a3b8;
}

.fire-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 6px 16px;
    cursor: pointer;
    text-transform: uppercase;
}

.fire-btn:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #d97706, #b45309);
}

/* Cart empty state */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--gray-400);
}

.cart-empty-text {
    font-size: 16px;
}

/* Cart item comment */
.cart-item-comment {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

.cart-item-meta {
    font-size: 12px;
    color: var(--gray-500);
}

/* ========== CART ITEM LIFECYCLE STATES ========== */
/* New: default styling (no printed_at) — full controls */

/* Sent: printed_at set, waiting for kitchen */
.cart-item.item-sent {
    border-left-color: #f59e0b !important;
    background: #fffbeb;
}

.cart-item.item-sent .cart-item-name {
    color: #92400e;
}

.cart-item.item-sent .cart-item-time {
    color: #d97706;
    font-weight: 600;
}

/* Ready: kitchen finished, waiting to serve */
.cart-item.item-ready {
    border-left-color: #10b981 !important;
    background: #ecfdf5;
}

.cart-item.item-ready .cart-item-name {
    color: #065f46;
}

/* Served: delivered to guest */
/* Optimistic UI: syncing state */
.cart-item.item-syncing {
    opacity: 0.6;
    animation: syncPulse 1s ease-in-out infinite;
}

@keyframes syncPulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 0.85;
    }
}

.cart-item.item-served {
    border-left-color: #94a3b8 !important;
    background: #f1f5f9;
    opacity: 0.7;
}

.cart-item.item-served .cart-item-name {
    text-decoration: line-through;
    color: #94a3b8;
}

.cart-item.item-served .cart-item-controls .qty-btn {
    pointer-events: none;
    opacity: 0.3;
}

/* Paid line in a partially-paid order — shows which items a previous bill already settled */
.cart-item.item-paid {
    border-left-color: #10b981 !important;
    background: #ecfdf5;
    opacity: 0.75;
}

.cart-item.item-paid .cart-item-name {
    color: #065f46;
}

.cart-item.item-paid .cart-item-price {
    text-decoration: line-through;
    color: #059669;
}

.cart-paid-badge {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 4px;
    border-radius: 999px;
    background: #10b981;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    vertical-align: middle;
}

/* Complimentary line — on-the-house item inside a regular paid order */
.cart-item.item-comp {
    border-left-color: #ec4899 !important;
    background: #fdf2f8;
}

.cart-comp-badge {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 4px;
    border-radius: 999px;
    background: #ec4899;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    vertical-align: middle;
}

/* Status badge inline */
.cart-status-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    background: none;
    flex-shrink: 0;
}

/* B29: Prevent Lucide SVG icons from deforming */
.cart-status-badge svg,
.cart-status-badge i {
    width: 14px !important;
    height: 14px !important;
    flex-shrink: 0;
}

.cart-status-badge.sent {
    color: #f59e0b;
}

.cart-status-badge.ready {
    color: #10b981;
}

.cart-status-badge.served {
    color: #94a3b8;
}

/* Item time display */
.cart-item-time {
    font-size: 11px;
    color: var(--gray-400);
    margin-left: 4px;
}

/* B13: live elapsed-since-sent counter on cart items (replaces absolute time once sent) */
.cart-item-elapsed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 10px;
    font-variant-numeric: tabular-nums;
    min-width: 34px;
    letter-spacing: 0.2px;
}
.cart-item-elapsed.tier-ok {
    background: rgba(100, 116, 139, 0.15);
    color: var(--gray-500, #64748b);
}
.cart-item-elapsed.tier-warn {
    background: rgba(245, 158, 11, 0.18);
    color: #b45309;
}
.cart-item-elapsed.tier-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #b91c1c;
    animation: cart-elapsed-pulse 2s ease-in-out infinite;
}
.cart-item-elapsed.tier-done {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}
.cart-item-elapsed--complete {
    gap: 4px;
    border: 1px solid rgba(16, 185, 129, 0.25);
    background: #ecfdf5;
}
.cart-item-elapsed-prefix {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.4px;
    line-height: 1;
    text-transform: uppercase;
    opacity: 0.8;
}
/* B13: живой pill-бейдж «сколько минут висит» рядом с названием блюда в модалке.
   Раньше все эти правила были инлайном в pos.js::showItemTimeline — теперь здесь.  */
.dish-elapsed {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    margin-left: 8px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.dish-elapsed-icon {
    width: 14px;
    height: 14px;
}
.dish-elapsed.tier-ok { background: rgba(100, 116, 139, 0.15); color: #475569; }
.dish-elapsed.tier-warn { background: rgba(245, 158, 11, 0.2); color: #b45309; }
.dish-elapsed.tier-danger { background: rgba(239, 68, 68, 0.2); color: #b91c1c; animation: cart-elapsed-pulse 2s ease-in-out infinite; }
.dish-elapsed.tier-done { background: rgba(16, 185, 129, 0.18); color: #047857; }
@keyframes cart-elapsed-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

.comment-btn {
    font-size: 14px !important;
}

/* Burger Menu */
.burger-menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 6px;
}

.burger-menu-btn:hover {
    background: var(--gray-700);
}

.burger-menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 1px;
}

.pos-menu-dropdown {
    display: none;
    position: absolute;
    top: 56px;
    left: 12px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

.pos-menu-dropdown.open {
    display: block;
}

.pos-menu-item {
    display: block;
    width: 100%;
    padding: 14px 18px;
    border: none;
    background: none;
    text-align: left;
    font-size: 15px;
    cursor: pointer;
    color: var(--gray-700);
}

.pos-menu-item:hover {
    background: var(--gray-50);
}

.pos-menu-item.danger {
    color: var(--danger);
}

.pos-menu-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 4px 0;
}

/* Cart panel without header */
.cart-panel.no-header {
    padding-top: 0;
}

.cart-panel.no-header .cart-items {
    padding-top: 12px;
}

/* Fix footer buttons row */
.cart-actions-compact {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

/* ========== WRITEOFF MODAL (above OSK keyboard) ========== */
.modal.writeoff-active {
    z-index: 10001 !important;
}

.modal-overlay.writeoff-active {
    z-index: 10000 !important;
    background: rgba(0, 0, 0, 0.4);
}

.writeoff-modal {
    min-width: 340px;
    max-width: 440px;
    text-align: center;
}

.writeoff-modal h3 {
    color: var(--danger, #ef4444);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.writeoff-item-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--gray-900, #0f172a);
}

.writeoff-warning {
    color: var(--warning, #f59e0b);
    font-size: 13px;
    margin-bottom: 20px;
}

.writeoff-reason {
    margin-bottom: 20px;
}

.writeoff-reason input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid var(--gray-300, #cbd5e1);
    border-radius: 12px;
    background: var(--gray-50, #f8fafc);
    text-align: center;
}

.writeoff-reason input:focus {
    border-color: var(--primary, #3b82f6);
    outline: none;
    background: white;
}

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

.writeoff-actions .btn {
    width: 100%;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.writeoff-actions .btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.writeoff-actions .btn-secondary {
    background: var(--gray-100, #f1f5f9);
    color: var(--gray-700, #334155);
    border: 2px solid var(--gray-200, #e2e8f0);
}

.writeoff-actions .btn-ghost {
    background: none;
    color: var(--gray-500, #64748b);
}

/* ========== TERMINAL NAME BADGE ========== */
.terminal-name-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    letter-spacing: 0.3px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ========== DELIVERY PANEL V2 (Sales→Orders Style) ========== */
.delivery-panel-v2 {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg);
    position: relative;
}

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

.delivery-header-v2 h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.delivery-refresh-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary, #64748b);
    transition: all 0.2s;
}

.delivery-refresh-btn:active {
    background: var(--bg);
}

/* Status Tabs */
.delivery-status-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 4px 0 8px;
    min-height: 40px;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
}


.dlv-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 20px;
    background: var(--card);
    color: var(--text-secondary, #475569);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.dlv-tab:active {
    background: var(--border);
}

.dlv-tab.active {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}

.dlv-tab-count {
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.08);
}

.dlv-tab.active .dlv-tab-count {
    background: rgba(255, 255, 255, 0.25);
}

.dlv-tab-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Order Cards Grid */
.delivery-grid-v2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px 16px 2px;
    align-content: start;
}

/* Order Card */
.dlv-order-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.dlv-order-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--card-border, linear-gradient(180deg, #f59e0b, #d97706));
}

.dlv-order-card:active {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.dlv-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-left: 8px;
}

.dlv-order-number {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.dlv-order-type-badge {
    padding: 3px 8px;
    color: #1d4ed8;
    background: #dbeafe;
    border-radius: 7px;
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
}

.dlv-status-badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
}

.dlv-customer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    padding-left: 8px;
}

.dlv-address {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary, #64748b);
    margin-bottom: 6px;
    padding-left: 8px;
}

.dlv-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 10px;
    padding-left: 8px;
}

.dlv-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.dlv-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    padding-left: 8px;
    border-top: 1px solid var(--border);
}

.dlv-total {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.dlv-time {
    font-size: 12px;
    color: #94a3b8;
}

/* Action buttons on cards */
.dlv-card-actions {
    margin-top: 10px;
    padding-left: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.dlv-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    color: white;
}

.dlv-action-confirm {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.dlv-action-ready {
    background: linear-gradient(135deg, #10b981, #059669);
}

.dlv-action-complete {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.dlv-action-cancel {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.dlv-action-btn:active {
    opacity: 0.85;
    transform: scale(0.97);
}

.dlv-label-print-action {
    flex: 0 0 36px;
    width: 36px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(13, 148, 136, 0.32);
    border-radius: 8px;
    background: rgba(13, 148, 136, 0.1);
    color: #0f766e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.dlv-label-print-action:hover {
    border-color: rgba(13, 148, 136, 0.5);
    background: rgba(13, 148, 136, 0.16);
}

.dlv-label-print-action:active {
    transform: scale(0.96);
}

.dlv-label-print-action svg,
.dlv-label-print-action i {
    width: 16px;
    height: 16px;
}

.dark-theme .dlv-label-print-action {
    border-color: rgba(94, 234, 212, 0.35);
    background: rgba(20, 184, 166, 0.14);
    color: #5eead4;
}

/* ========== DELIVERY DETAIL PANEL ========== */
.delivery-detail-panel {
    position: absolute;
    inset: 0;
    background: var(--bg);
    z-index: 50;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.delivery-detail-content {
    padding: 20px;
    flex: 1;
}

.dlv-detail-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.dlv-detail-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 10px;
    cursor: pointer;
    color: #475569;
    flex-shrink: 0;
}

.dlv-detail-back:active {
    background: var(--bg);
}

.dlv-detail-order-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.dlv-detail-section {
    margin-bottom: 20px;
}

.dlv-detail-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.dlv-detail-customer-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dlv-detail-phone {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #3b82f6;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.dlv-detail-phone:active {
    color: #1d4ed8;
}

/* Order Lines */
.dlv-detail-lines {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.dlv-detail-line {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.dlv-detail-line:last-child {
    border-bottom: none;
}

.dlv-line-qty {
    font-weight: 700;
    color: #3b82f6;
    font-size: 14px;
    min-width: 30px;
}

.dlv-line-name {
    flex: 1;
    font-size: 14px;
    color: var(--text);
}

.dlv-line-price {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

/* Totals */
.dlv-detail-totals {
    margin-top: 12px;
}

.dlv-totals-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    color: #64748b;
}

.dlv-total-final {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    padding-top: 10px;
    margin-top: 6px;
    border-top: 2px solid var(--border);
}

/* Guest info */
.dlv-guest-info {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
}

.dlv-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 4px;
}

/* Detail Actions */
.dlv-detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.dlv-detail-actions .dlv-action-btn {
    flex: 1;
    justify-content: center;
    padding: 14px;
    font-size: 14px;
    border-radius: 10px;
}

/* Spin animation for loader */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== HORIZONTAL DELIVERY MODAL (for POS terminals) ========== */
.delivery-modal-horizontal {
    width: 720px !important;
    max-width: 95vw !important;
    padding: 24px 28px !important;
}

.delivery-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
}

.delivery-modal-grid .customer-input-group {
    gap: 5px;
}

.delivery-modal-grid .customer-input-group label {
    font-size: 13px;
}

.delivery-modal-grid .customer-input-group input,
.delivery-modal-grid .customer-input-group select {
    font-size: 15px !important;
    padding: 10px 12px !important;
}

/* Delivery panel fills available height and spans full width */
.delivery-panel-v2 {
    grid-column: 1 / 3;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 16px;
}

/* ==================== SPLIT BILL OVERLAY ==================== */
.split-bill-overlay {
    --split-surface: #ffffff;
    --split-surface-raised: #f8fafc;
    --split-surface-soft: #f1f5f9;
    --split-surface-hover: #e2e8f0;
    --split-border: #dbe3ee;
    --split-text: #0f172a;
    --split-text-muted: #64748b;
    --split-footer: #f8fafc;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding:
        max(16px, env(safe-area-inset-top, 0px))
        max(16px, env(safe-area-inset-right, 0px))
        max(16px, env(safe-area-inset-bottom, 0px))
        max(16px, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
}

.dark-theme .split-bill-overlay {
    --split-surface: #1a1d27;
    --split-surface-raised: #222632;
    --split-surface-soft: #292d3a;
    --split-surface-hover: #343947;
    --split-border: rgba(255, 255, 255, 0.11);
    --split-text: #f1f5f9;
    --split-text-muted: #94a3b8;
    --split-footer: #151820;
}

.split-bill-container {
    background: var(--split-surface);
    color: var(--split-text);
    border-radius: 16px;
    width: 100%;
    max-width: 1200px;
    max-height: calc(100dvh - max(32px, env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px)));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--split-border);
}

.split-bill-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 8px;
}

.split-bill-top h2 {
    color: var(--split-text);
    font-size: 26px;
    font-weight: 700;
    margin: 0;
}

.split-bill-top-actions {
    display: flex;
    gap: 8px;
}

.split-add-bill,
.split-equal-btn {
    background: var(--split-surface-soft);
    color: var(--split-text-muted);
    border: 1px solid var(--split-border);
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.15s;
}

.split-add-bill:hover,
.split-equal-btn:hover {
    background: var(--split-surface-hover);
    color: var(--split-text);
}

.split-equal-btn {
    background: #2d1f5e;
    border-color: #8b5cf6;
    color: #c4b5fd;
}

.split-equal-btn:hover {
    background: #3b2580;
    color: #fff;
}

.split-bill-hint {
    padding: 0 24px 12px;
    color: var(--split-text-muted);
    font-size: 14px;
}

.split-bills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    padding: 0 16px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.split-bill-column {
    background: var(--split-surface-raised);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--split-border);
    min-height: 200px;
}

.split-bill-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--split-border);
}

.split-bill-title {
    color: var(--split-text);
    font-size: 15px;
    font-weight: 600;
}

.split-remove-bill {
    background: none;
    border: none;
    color: var(--split-text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.split-remove-bill:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.split-bill-items {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    min-height: 80px;
}

.split-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: var(--split-surface-soft);
    border: 1px solid transparent;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.15s;
    gap: 10px;
}

.split-item:hover {
    background: var(--split-surface-hover);
    border-color: var(--split-border);
    transform: translateX(2px);
}

.split-item:active {
    transform: scale(0.97);
}

.split-item-name {
    flex: 1;
    color: var(--split-text);
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.split-item-qty {
    color: var(--split-text-muted);
    font-size: 15px;
    min-width: 30px;
    text-align: center;
}

.split-item-price {
    color: #10b981;
    font-size: 16px;
    font-weight: 600;
    min-width: 70px;
    text-align: right;
}

.split-empty {
    color: var(--split-text-muted);
    font-size: 13px;
    text-align: center;
    padding: 24px 8px;
    font-style: italic;
}

.split-bill-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--split-border);
}

.split-bill-total {
    color: var(--split-text);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
}

.split-pay-methods {
    display: flex;
    gap: 4px;
}

.split-pay-btn {
    flex: 1;
    padding: 10px 0;
    border: 1px solid var(--split-border);
    border-radius: 6px;
    background: var(--split-surface-soft);
    color: var(--split-text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.split-pay-btn:hover {
    background: var(--split-surface-hover);
    color: var(--split-text);
}

.split-pay-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.split-bill-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--split-border);
    background: var(--split-footer);
}

.split-grand-total {
    color: var(--split-text);
    font-size: 22px;
    font-weight: 700;
}

.split-bill-actions {
    display: flex;
    gap: 10px;
}

.split-item-main {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.split-item-divide,
.split-close-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--split-border);
    background: var(--split-surface-soft);
    color: #8b5cf6;
    cursor: pointer;
}

.split-item-divide {
    width: 36px;
    height: 36px;
    border-radius: 9px;
}

.split-item-divide:hover,
.split-close-btn:hover {
    background: var(--split-surface-hover);
}

.split-adjustments,
.split-grand-summary {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.split-adjustments {
    align-items: flex-end;
}

.split-adjustment {
    font-size: 11px;
    color: var(--split-text-muted);
}

.split-adjustment.gross {
    text-decoration: line-through;
}

.split-adjustment.discount {
    color: #d97706;
}

.dark-theme .split-adjustment.discount {
    color: #fbbf24;
}

.split-adjustment.fees {
    color: #2563eb;
}

.dark-theme .split-adjustment.fees {
    color: #60a5fa;
}

.split-grand-breakdown,
.split-payment-progress-labels {
    font-size: 12px;
    color: var(--split-text-muted);
}

.split-item-popup {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding:
        max(16px, env(safe-area-inset-top, 0px))
        max(16px, env(safe-area-inset-right, 0px))
        max(16px, env(safe-area-inset-bottom, 0px))
        max(16px, env(safe-area-inset-left, 0px));
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(4px);
    box-sizing: border-box;
}

.split-item-popup__card {
    padding: 20px;
    max-width: 320px;
    width: 100%;
    background: var(--card);
    color: var(--text);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.split-item-popup__title {
    text-align: center;
    margin-bottom: 16px;
}

.split-item-popup__title strong {
    display: block;
    font-size: 16px;
}

.split-item-popup__title span,
.split-item-popup__title small {
    display: block;
    color: var(--text-secondary);
    margin-top: 4px;
}

.split-item-popup__options {
    display: grid;
    gap: 8px;
}

.split-item-popup__option,
.split-item-popup__cancel {
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
}

.split-item-popup__option {
    padding: 16px 8px;
    text-align: center;
}

.split-item-popup__option strong,
.split-item-popup__option span,
.split-item-popup__option small {
    display: block;
}

.split-item-popup__option strong {
    font-size: 20px;
}

.split-item-popup__option span,
.split-item-popup__option small {
    color: var(--text-secondary);
    margin-top: 4px;
}

.split-item-popup__cancel {
    width: 100%;
    padding: 10px;
    margin-top: 12px;
    font-size: 14px;
}

.split-payment-container {
    max-width: 820px;
}

.split-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    color: var(--split-text-muted);
}

.split-payment-progress {
    padding: 0 24px 16px;
}

.split-payment-progress-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-weight: 600;
}

.split-payment-progress-track {
    height: 6px;
    background: var(--split-surface-soft);
    border-radius: 3px;
    overflow: hidden;
}

.split-payment-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.split-payment-cards {
    padding: 0 24px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    overflow-y: auto;
    min-height: 0;
}

.split-payment-card {
    background: var(--split-surface-raised);
    border: 1px solid var(--split-border);
    border-radius: 16px;
    padding: 18px;
    color: var(--split-text);
    min-width: 0;
}

.split-payment-card.paid {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
}

.split-payment-card__header,
.split-payment-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.split-payment-card__header {
    margin-bottom: 12px;
}

.split-payment-card__title {
    font-size: 15px;
    font-weight: 700;
}

.split-payment-card__meta {
    font-size: 12px;
    color: var(--split-text-muted);
}

.split-payment-card__amount {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.split-payment-card__items {
    border-top: 1px solid var(--split-border);
    padding-top: 8px;
    margin-bottom: 12px;
    max-height: 96px;
    overflow-y: auto;
}

.split-payment-line {
    padding: 3px 0;
    font-size: 12px;
    color: var(--split-text-muted);
}

.split-payment-status {
    font-size: 11px;
    color: #047857;
    background: rgba(16, 185, 129, 0.15);
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dark-theme .split-payment-status {
    color: #6ee7b7;
}

.split-precheck-btn,
.split-payment-method-btn {
    border: 1px solid var(--split-border);
    background: var(--split-surface-soft);
    color: var(--split-text);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}

.split-precheck-btn {
    width: 100%;
    padding: 10px 8px;
    margin-bottom: 8px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.split-payment-methods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.split-payment-method-btn {
    min-height: 44px;
    padding: 10px 8px;
    font-size: 13px;
}

.split-precheck-btn:hover,
.split-payment-method-btn:hover {
    background: var(--split-surface-hover);
}

.split-done-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    font-weight: 700;
}

/* Mobile responsive */
@media (max-width: 760px) {
    .split-bills-grid {
        grid-template-columns: 1fr;
    }

    .split-bill-container {
        max-height: 95vh;
        border-radius: 12px;
    }

    .split-bill-overlay {
        padding: 8px;
    }

    .split-bill-top {
        align-items: flex-start;
        gap: 12px;
        padding: 16px 16px 8px;
    }

    .split-bill-top h2 {
        font-size: 22px;
    }

    .split-bill-top-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .split-bill-hint {
        padding: 0 16px 10px;
    }

    .split-bills-grid,
    .split-payment-cards {
        padding-left: 10px;
        padding-right: 10px;
    }

    .split-payment-progress {
        padding-left: 16px;
        padding-right: 16px;
    }

    .split-bill-bottom {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 16px max(12px, env(safe-area-inset-bottom, 0px));
    }

    .split-bill-actions {
        width: 100%;
    }

    .split-bill-actions .modal-btn {
        flex: 1;
    }

    .split-payment-progress-labels {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }
}

/* ==================== UNIFIED MODAL SYSTEM ==================== */
/* posModal() — touch-optimized, always above OSK */

.pos-modal__header {
    padding: 14px 16px;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pos-modal__header-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f1f5f9;
    border-radius: 10px;
    font-size: 18px;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pos-modal__body {
    padding: 16px;
    overflow-y: auto;
    max-height: calc(100vh - 380px);
    /* room for header + actions + OSK */
}

.pos-modal__actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
}

.pos-modal__btn {
    flex: 1;
    min-height: 48px;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, border-color 0.15s;
}

.pos-modal__btn:active {
    background: #f1f5f9;
    transform: scale(0.97);
}

.pos-modal__btn--primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    border-color: transparent;
}

.pos-modal__btn--primary:active {
    background: linear-gradient(135deg, #2563eb, #1e40af);
}

.pos-modal__btn--success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border-color: transparent;
}

.pos-modal__btn--danger {
    background: #ef4444;
    color: #fff;
    border-color: transparent;
}

.pos-modal__btn--danger:active {
    background: #dc2626;
}

.pos-modal__btn--ghost {
    background: transparent;
    border-color: #e2e8f0;
    color: #64748b;
}

.pos-modal__btn--w2 {
    flex: 2;
}

.pos-modal__btn--w3 {
    flex: 3;
}

.receipt-grouping-control {
    margin: 0 16px 12px;
    padding: 10px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    background: var(--bg, #f8fafc);
}

.receipt-grouping-label {
    margin-bottom: 8px;
    color: var(--text-secondary, #64748b);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.receipt-grouping-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.receipt-grouping-option {
    min-height: 40px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    background: var(--card, #fff);
    color: var(--text-secondary, #64748b);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.receipt-grouping-option.active {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #1d4ed8;
}

.pos-modal__input {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    font-size: 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-sizing: border-box;
    -webkit-appearance: none;
}

.pos-modal__input:focus {
    border-color: #3b82f6;
    outline: none;
}

.pos-modal__input--sm {
    min-height: 40px;
    font-size: 16px;
    padding: 8px 12px;
}

/* Stat blocks for info modals */
.pos-modal__stat {
    text-align: center;
}

.pos-modal__stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
}

.pos-modal__stat-label {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

/* Preset button grid (loyalty redeem, qty select) */
.pos-modal__presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pos-modal__preset {
    flex: 1;
    min-width: 55px;
    min-height: 48px;
    padding: 12px 4px;
    font-size: 16px;
    font-weight: 700;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.pos-modal__preset.active {
    background: #10b981;
    color: #fff;
    border-color: #059669;
}

/* Responsive: make modal body shorter when OSK is active */
body.osk-active .pos-modal__body {
    max-height: calc(45vh - 120px);
}

/* ==================== OFFLINE KDS BANNER ==================== */
.offline-kds-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: offlinePulse 2s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}

@keyframes offlinePulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.85;
    }
}

/* ==================== FIX #11: POS CUSTOM SLIM SCROLLBARS ==================== */
#posApp ::-webkit-scrollbar,
.pos-modal__body ::-webkit-scrollbar,
.split-bills-grid ::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

#posApp ::-webkit-scrollbar-track,
.pos-modal__body ::-webkit-scrollbar-track,
.split-bills-grid ::-webkit-scrollbar-track {
    background: transparent;
}

#posApp ::-webkit-scrollbar-thumb,
.pos-modal__body ::-webkit-scrollbar-thumb,
.split-bills-grid ::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 10px;
}

#posApp ::-webkit-scrollbar-thumb:hover,
.pos-modal__body ::-webkit-scrollbar-thumb:hover,
.split-bills-grid ::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* Firefox scrollbar */
#posApp *,
.pos-modal__body,
.split-bills-grid {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

/* ==================== FIX #8: DARK THEME PAYMENT BUTTONS ==================== */
body.dark-theme .payment-method-btn {
    background: var(--card, #1e293b);
    border-color: var(--border, #334155);
    color: var(--text, #e2e8f0);
}

body.dark-theme .payment-method-btn.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #93c5fd;
}

body.dark-theme .payment-method-btn span {
    filter: none;
}

/* ==================== FIX #7: CART BUTTONS ON SQUARE MONITORS ==================== */
@media (max-aspect-ratio: 5/4) {
    .cart-actions-compact {
        border-radius: 8px !important;
    }

    .cart-actions-compact > button {
        height: 40px !important;
        font-size: 16px !important;
    }
}

/* ==================== TABLE VIEW MODE TOGGLE ==================== */
.view-mode-toggle {
    display: flex;
    margin-left: auto;
    flex-shrink: 0;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    overflow: hidden;
}

.vm-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 44px;
    border: none;
    background: var(--card, #fff);
    cursor: pointer;
    color: var(--text-secondary, #94a3b8);
    transition: all 0.15s;
    border-right: 1px solid var(--border, #e2e8f0);
    padding: 0;
}

.vm-btn svg {
    width: 18px;
    height: 18px;
}

.vm-btn:last-child {
    border-right: none;
}

.vm-btn:active {
    transform: scale(0.93);
}

.vm-btn.active {
    background: #3b82f6;
    color: #fff;
}

/* ==================== TABLE CARD GRID VIEW ==================== */
.tc-card {
    position: relative;
    background: var(--card, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.15s;
    overflow: hidden;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tc-card:active {
    transform: scale(0.97);
}

.tc-card:hover {
    border-color: #94a3b8;
}

.tc-stripe {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 10px 10px 0 0;
}

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

.tc-number {
    font-size: 16px;
    font-weight: 700;
    color: var(--text, #1e293b);
}

.tc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tc-timer {
    font-size: 13px;
    font-weight: 600;
}

.tc-meta {
    font-size: 11px;
    color: var(--text-secondary, #94a3b8);
}

.tc-free {
    font-size: 13px;
    color: #10b981;
    font-weight: 500;
}

.tc-waiter {
    font-size: 11px;
    color: #3b82f6;
    font-weight: 500;
    margin-top: 2px;
}

.tc-res {
    font-size: 10px;
    color: #8b5cf6;
    font-weight: 600;
    background: rgba(139,92,246,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    width: fit-content;
}

/* ==================== BY WAITER VIEW ==================== */
.wg-section {
    background: var(--card, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    overflow: hidden;
}

.wg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    background: var(--bg, #f8fafc);
}

.wg-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text, #1e293b);
}

.wg-stats {
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
    font-weight: 500;
}

.wg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
    padding: 10px;
}

.wg-card {
    background: var(--bg, #f8fafc);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wg-card:active {
    transform: scale(0.96);
}

.wg-card:hover {
    border-color: #94a3b8;
}

.wg-card-num {
    font-size: 15px;
    font-weight: 700;
    color: var(--text, #1e293b);
}

.wg-card-info {
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
    font-weight: 500;
}

.wg-card-total {
    font-size: 12px;
    font-weight: 600;
    color: #10b981;
}
/* Legacy offline queue: reuse the standard POS modal and neutral surfaces. */
.pos-offline-activity { display: grid; gap: 12px; }
.modal.pos-offline-modal { width: min(560px, calc(100vw - 24px)); min-width: 0; max-width: calc(100vw - 24px); }
.pos-offline-activity__row { border-bottom: 1px solid var(--border); padding: 8px 0 12px; overflow-wrap: anywhere; }
.pos-offline-activity__row > span { display: block; margin-top: 4px; font-size: 13px; }
.pos-offline-activity__row p { margin: 6px 0; }
.pos-offline-activity__row small { color: var(--text-muted, #64748b); }
button.pending-orders-badge { border: 0; min-width: 44px; min-height: 44px; cursor: pointer; font: inherit; }
