/* ═══════════════════════════════════════════════════
   B60 POS — Point of Sale Styles
    ═══════════════════════════════════════════════════ */

:root {
    /* B60 OS rgb helpers -- kept in sync with main.css. pos.css loads
       after components.css, so a stale value here would win globally. */
    --gold-rgb: 79, 70, 229;
    --red-rgb: 244, 63, 94;
    --blue-rgb: 79, 70, 229;
    /* Fluid order panel — scales with viewport, capped for ultrawide tills */
    --pos-order-panel-width: clamp(280px, 32vw, 480px);
    --pos-grid-min: 132px;
}

.pos-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    gap: 0;
    overflow: hidden;
}

/* ════════════════════ ORDER TABS BAR ════════════════ */

.order-tabs-bar {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 4px;
    height: 56px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
}

.order-tabs-bar::-webkit-scrollbar { height: 0; }

.order-tabs-scroll {
    display: flex;
    gap: 4px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    align-items: center;
    height: 100%;
}
.order-tabs-scroll::-webkit-scrollbar { height: 0; }

.pos-order-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px 0 10px;
    height: 44px;
    margin: auto 3px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    transition: background 140ms, border-color 140ms, color 140ms, box-shadow 200ms;
    position: relative;
    overflow: hidden;
}
.pos-order-tab:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}
/* Wave 4D: pending guest QR orders - blue highlight until cashier opens/confirms */
.pos-order-tab.qr-pending {
    border-color: var(--ds-blue-500, #0066FF);
    box-shadow: inset 3px 0 0 var(--ds-blue-500, #0066FF), 0 0 0 1px rgba(0, 102, 255, 0.2);
    color: var(--ds-blue-600, #0052CC);
}
/* C5: active tab = elevated glass card with a subtle inline-start notch.
   Blue notch (interactive cue); gold stays reserved for the money amount.
   Scoped under .order-tabs-scroll to out-rank the equal-specificity calm
   override in refinements.css (not editable from this track). */
.order-tabs-scroll .pos-order-tab.active {
    color: var(--ds-text-primary, var(--text-primary));
    background: var(--ds-surface, var(--bg-elevated));
    border-color: var(--ds-border-strong, var(--border-strong));
    box-shadow: var(--ds-shadow-card, var(--shadow-md));
}
.order-tabs-scroll .pos-order-tab.active::after {
    content: '';
    position: absolute;
    inset-block: 12%;
    inset-inline-start: 0;
    width: 3px;
    background: var(--ds-primary, var(--blue));
    border-radius: 0 2px 2px 0;
    box-shadow: none;
}

.pos-order-tab .tab-icon {
    width: 22px; height: 22px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    transition: background-color 140ms, color 140ms, box-shadow 140ms;
}
.pos-order-tab .tab-icon.quick-icon {
    background: rgba(var(--gold-rgb), 0.16);
    color: var(--gold);
    box-shadow: inset 0 0 0 1px rgba(var(--gold-rgb), 0.25);
}
.pos-order-tab.active .tab-icon {
    background: rgba(var(--gold-rgb), 0.22);
    color: var(--gold);
    box-shadow: inset 0 0 0 1px rgba(var(--gold-rgb), 0.4), 0 0 8px rgba(var(--gold-rgb), 0.25);
}
.pos-order-tab .tab-info { display: flex; align-items: center; gap: 6px; }
.pos-order-tab .tab-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.pos-order-tab .tab-meta { display: none; }
.pos-order-tab .tab-amount {
    font-size: 11px;
    font-weight: 600;
    color: var(--gold);
    margin-inline-start: 4px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    padding: 2px 6px;
    background: rgba(var(--gold-rgb), 0.1);
    border-radius: 5px;
}
.pos-order-tab .tab-badge {
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #4a90c8;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    box-shadow: 0 0 8px rgba(74,144,200,0.45);
}
.pos-order-tab .tab-close {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    color: var(--ds-text-tertiary, var(--text-hint));
    margin-inline-start: 2px;
    flex-shrink: 0;
    transition: opacity 140ms, background-color 140ms, color 140ms;
    opacity: 0.55;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
}
/* any-pointer, not pointer -- see the note in main.css. */
@media (any-pointer: coarse) {
    .pos-order-tab .tab-close { width: 32px; height: 32px; min-width: 32px; min-height: 32px; }
}
/* Was `.pos-order-tab:hover .tab-close { opacity: 1 }`. The close cross is
   legible at rest, so this only ever sharpened it for a mouse -- and on a
   touch till it meant the control the cashier is about to tap is the dimmer
   version of itself. It sits at full strength for everyone now. */
.pos-order-tab .tab-close { opacity: 0.8; }
.pos-order-tab .tab-close:hover {
    background: rgba(var(--red-rgb), 0.18);
    color: #C81E4A;
    box-shadow: inset 0 0 0 1px rgba(var(--red-rgb), 0.4);
}
.pos-order-tab .tab-close svg { width: 11px; height: 11px; }

.tab-actions {
    display: flex; gap: 6px; margin-left: auto; flex-shrink: 0; align-items: center;
}
.tab-actions .btn {
    height: 32px; padding: 0 12px; border-radius: var(--r-md);
    font-size: 12px; font-weight: 500;
    background: var(--bg-elevated); color: var(--text-secondary);
    border: 1px solid var(--border-default);
}
.tab-actions .btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.tab-actions .btn.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); }

/* ════════════════════ MAIN TERMINAL ════════════════ */

.pos-terminal {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--pos-order-panel-width);
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ════════════════════ LEFT: PRODUCTS ════════════════ */

.pos-products-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid var(--border-default);
    padding: 0;
}

/* ── Search bar ── */
.pos-products-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 0;
    background: var(--bg-void);
    flex-shrink: 0;
}
.pos-products-toolbar .search-bar {
    flex: 1;
    position: relative;
}
.pos-products-toolbar .search-bar .input {
    height: 44px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    padding: 0 40px 0 36px;
    width: 100%;
}
.pos-products-toolbar .search-bar .input {
    outline: none;
}
/* C6: the global rule in components.css now scopes the focus ring to
   :focus-visible, so the local override here was removed -- one source
   of truth. */
.pos-products-toolbar .search-bar .input::placeholder {
    color: var(--text-hint);
}
.pos-products-toolbar .search-bar svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: var(--text-hint);
}

.search-clear {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--bg-surface); border: 1px solid var(--border-default);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-hint); z-index: 2;
    transition: background 0.15s ease, color 0.15s ease;
}
.search-clear:hover { background: var(--red-tint); color: var(--red); border-color: var(--red); }

.pos-toolbar-btn {
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md); background: var(--bg-surface);
    border: 1px solid var(--border-default); color: var(--text-secondary);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
}
.pos-toolbar-btn:hover { background: var(--bg-elevated); border-color: var(--border-strong); color: var(--text-primary); }
.pos-toolbar-btn svg { width: 18px; height: 18px; }

/* ── Category tabs ── */
/* Wraps rather than scrolling sideways.

   This was `overflow-x: auto` with `scrollbar-width: none` and the webkit
   scrollbar height zeroed -- so categories past the right edge existed, were
   reachable only by a swipe or a shift-wheel, and nothing on screen said so.
   On a till that is the worst pair: content you cannot see and no hint it is
   there. A cashier should not have to discover a hidden gesture to reach a
   category; the row costs a little height when it wraps, which is cheaper than
   a category nobody finds. */
.pos-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 16px 8px;
    flex-shrink: 0;
    background: var(--bg-void);
}

.pos-cat-btn {
    padding: 8px 14px;
    height: auto;
    min-height: 32px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ds-text-secondary, var(--text-secondary));
    background: var(--ds-surface, #fff);
    border: 1px solid var(--ds-border, var(--border-default));
    border-radius: var(--ds-radius-pill, 999px);
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.pos-cat-btn:hover {
    color: var(--ds-text-primary, var(--text-primary));
    border-color: var(--ds-border-strong, var(--border-strong));
}
.pos-cat-btn.active {
    background: var(--ds-primary-tint);
    color: var(--ds-primary);
    border-color: var(--ds-primary-tint);
    font-weight: 600;
    box-shadow: none;
}
.pos-cat-btn .cat-count {
    font-size: 11px;
    opacity: 0.6;
    margin-left: 2px;
}

/* ── Product grid ── */
.pos-product-grid {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-content: start;
    background: var(--ds-canvas, var(--bg-void));
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.pos-product-grid:not(:has(.pos-menu-section)) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 12px;
}
.pos-product-grid::-webkit-scrollbar { width: 4px; }
.pos-product-grid::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

/* ── Section header divider (Favorites / All) ── */
.pos-section-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px 4px;
    margin: 4px 0 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}
.pos-section-header .pos-section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(var(--gold-rgb), 0.12);
    color: var(--gold);
}
.pos-all-header .pos-section-icon {
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-secondary);
}
.pos-section-header .pos-section-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    letter-spacing: 0;
}
.pos-section-header .pos-section-divider {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--border-default), transparent);
    margin-left: 4px;
}
.pos-favorites-header { color: var(--gold); }

/* ── Product card — recognizable, image-forward ── */
.pos-product-card {
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-lg, 16px);
    box-shadow: var(--ds-shadow-card);
    cursor: pointer;
    transition: transform 120ms var(--ease-out), border-color 120ms, box-shadow 150ms;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    content-visibility: auto;
    contain-intrinsic-size: auto 196px;
}
.pos-product-card::before,
.pos-product-card::after { display: none !important; }

.pos-product-card:hover {
    border-color: var(--ds-border-strong);
    transform: translateY(-2px);
    box-shadow: var(--ds-shadow-pop);
}
.pos-product-card:hover .product-img { transform: scale(1.04); }
.pos-product-card:active { transform: translateY(0) scale(0.98); transition-duration: 60ms; }

.pos-product-card .product-img-well {
    width: 100%;
    aspect-ratio: 1;
    background: var(--ds-surface-alt);
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pos-product-card .product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 280ms var(--ease-out);
}

.pos-product-card .product-monogram,
.product-img-well.show-initials {
    width: 100%;
    aspect-ratio: 1;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ds-surface-alt);
    color: var(--ds-text-secondary);
    letter-spacing: 0.04em;
    user-select: none;
}
.product-img-well.show-initials::before {
    content: attr(data-initials);
}

.pos-product-card .product-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ds-text-primary);
    padding: 10px 12px 2px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    flex: 0 0 auto;
    letter-spacing: -0.01em;
}

.pos-product-card .product-price {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--ds-primary);
    /* The right inset clears the absolutely-positioned add button (36px + its
       10px offset). Without it a five-digit price -- 12,000 IQD, ordinary in
       IQD -- runs under the button. */
    padding: 2px 54px 12px 12px;
    text-align: left;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.pos-product-card .product-price-was {
    text-decoration: line-through;
    opacity: 0.55;
    font-size: 11px;
    font-weight: 500;
    color: var(--ds-text-secondary);
}

/* 36px, not 30. This is the add-to-cart target on a touch till; 30px is under
   every touch minimum and it is the control the cashier hits most often.
   The coarse-pointer block further down takes it to the full 44px. */
.pos-product-card .product-add {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    color: var(--ds-text-on-accent);
    background: var(--ds-primary);
    border: none;
    border-radius: 50%;
    box-shadow: var(--ds-shadow-card);
    cursor: pointer;
    pointer-events: none;
    z-index: 2;
}

.pos-product-card .product-stock {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 11px;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bg-void);
    color: var(--text-hint);
    opacity: 1;
}
/* `.pos-product-card:hover .product-stock { opacity: 1 }` was here. The stock
   badge already sits at opacity 1, so the rule did nothing -- it is the
   leftover of a hover-reveal that was half-undone. Removed rather than left
   to imply the badge is a hover affordance. */
.pos-product-card .product-stock.low-stock {
    background: var(--red-tint);
    color: var(--red);
    border: 1px solid rgba(var(--red-rgb), 0.3);
}

.pos-product-card .fav-star {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--ds-text-tertiary);
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    box-shadow: var(--ds-shadow-card);
    transition: color 0.15s, transform 0.15s, background 0.15s;
}
.pos-product-card .fav-star.favorited {
    color: var(--ds-warning);
    background: var(--ds-warning-tint);
    border-color: var(--ds-warning-tint);
}
.pos-product-card .fav-star:hover { transform: scale(1.1); color: var(--ds-warning); }

.pos-product-card .product-86-btn { display: none; }

.pos-product-card.sold-out { opacity: 0.72; pointer-events: auto; }

.pos-product-card .product-sold-out-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--ds-surface) 55%, transparent);
    pointer-events: none;
    border-radius: var(--ds-radius-lg, 16px);
}
.pos-product-card .product-sold-out-restore {
    pointer-events: auto;
    border: 1px solid var(--ds-border-strong);
    background: var(--ds-surface);
    color: var(--ds-text-secondary);
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: var(--ds-radius-sm);
    cursor: pointer;
}

/* Phase 8c: combo/bundle badge -- placed just below the fav-star (top-right)
   so it doesn't collide with the stock badge / 86-toggle sharing the
   top-left corner. */
.pos-product-card .product-combo-badge {
    position: absolute;
    top: 36px;
    right: 8px;
    z-index: 3;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: var(--ds-radius-sm);
    background: var(--ds-primary);
    color: var(--ds-text-on-accent);
}
body[dir="rtl"] .pos-product-card .product-combo-badge { right: auto; left: 6px; }

.pos-product-card:has(.fav-star.favorited) {
    border-color: var(--ds-warning-tint);
}
.pos-product-card:has(.fav-star.favorited)::after {
    display: none !important;
}

.pos-product-card.out-of-stock {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(0.5);
}

.pos-product-card.added {
    animation: productPulse 0.3s ease;
}
@keyframes productPulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); border-color: var(--green-light); }
    100% { transform: scale(1); }
}

/* ════════════════════ ORDER PANEL TOKENS ════════════════ */
/* The floating cart card -- LUMINA light. This is the money surface
   (totals live here), so the accent is genuine gold per Law 4. */
:root {
    --op-bg-panel:       #FFFFFF;
    --op-bg-row:         #FBFCFE;
    --op-bg-row-hover:   #F0F2F7;
    --op-bg-header:      #F8F9FC;
    --op-accent:         var(--gold);
    --op-accent-dim:     var(--gold-dark);
    --op-btn-debt-bg:    rgba(244, 63, 94, 0.10);
    --op-btn-debt-text:  #C81E4A;
    --op-btn-print-bg:   #F0F2F7;
    --op-btn-print-text: #475569;
    --op-border-panel:   rgba(var(--gold-rgb), 0.30);
    --op-border-row:     rgba(15, 23, 42, 0.06);
}

/* ════════════════════ RIGHT: ORDER PANEL ════════════════ */

.pos-order-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 180px;
    padding: 24px 16px;
    text-align: center;
    color: var(--text-secondary);
}
.pos-empty-icon {
    opacity: 0.45;
    color: var(--text-muted, #94A3B8);
}
.pos-empty-title {
    margin: 0;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}
.pos-empty-hint {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.pos-loading-state,
.pos-grid-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 160px;
    padding: 32px 16px;
    text-align: center;
    color: var(--text-secondary);
}
.pos-loading-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border, rgba(148,163,184,0.35));
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: pos-spin 0.7s linear infinite;
}
@keyframes pos-spin {
    to { transform: rotate(360deg); }
}
.pos-loading-text {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.item-seat-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    background: rgba(var(--gold-rgb), 0.12);
}

/* Parked tab cue */
.pos-order-tab.is-parked {
    opacity: 0.85;
    border-style: dashed;
}

.pos-order-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-void);
    overflow: hidden;
    padding: 12px;
}

.pos-order-panel > #orderPanel,
.pos-order-panel > #orderPanel * {
    user-select: none !important;
    -webkit-user-select: none !important;
}
.pos-order-panel > #orderPanel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    border-radius: 30px;
    background: var(--op-bg-panel);
    border: 1px solid rgba(var(--gold-rgb), 0.28);
    border-top: 1px solid rgba(255, 255, 255, 0.8);
    /* One Sun floating shadow (down-right) + inner top-left highlight -- the
       signature money card; gold rim is on-doctrine (totals live here). */
    box-shadow:
        var(--shadow-lg),
        4px 8px 32px rgba(31, 38, 135, 0.06),
        var(--rim-light);
    overflow: hidden;
}

/* ── Panel header ── */
.pos-order-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--op-border-panel);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: var(--op-bg-header);
    border-radius: 24px 24px 0 0;
}

.pos-order-header .order-type-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: opacity 0.15s ease;
    flex: 1;
    min-width: 0;
}
.pos-order-header .order-type-info:hover { opacity: 0.8; }

.pos-order-header .order-type-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    background: rgba(var(--gold-rgb), 0.15);
    color: var(--op-accent);
    border: 1px solid var(--op-accent-dim);
    flex-shrink: 0;
}

.pos-order-header .order-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.pos-order-header .order-subtitle {
    font-size: 12px;
    color: #b8a590;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.pos-order-header .header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.pos-order-header .header-actions .btn {
    border-radius: 8px;
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.10);
    color: var(--text-secondary);
    min-height: unset;
}
.pos-order-header .header-actions .btn:hover {
    background: rgba(15, 23, 42, 0.10);
    color: var(--text-primary);
}

/* ── Order items scroll area ── */
.pos-order-items {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 0;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--gold-rgb), 0.2) transparent;
}

.pos-order-items::-webkit-scrollbar { width: 4px; }
.pos-order-items::-webkit-scrollbar-thumb { background: rgba(var(--gold-rgb), 0.2); border-radius: 2px; }

/* ── Empty cart ── */
.pos-empty-cart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 160px;
    padding: 28px 20px;
    color: var(--text-secondary);
    text-align: center;
}
.pos-empty-cart svg {
    width: 40px;
    height: 40px;
    opacity: 0.35;
    margin-bottom: 12px;
    color: var(--text-secondary);
}
.pos-empty-cart .empty-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.pos-empty-cart .empty-hint {
    font-size: 12px;
    color: var(--text-hint);
}

/* ── Order item row -- 56px compact lines ── */
/*
 * Two-line cart row: name across the top, controls beneath.
 *
 * This was one line -- image, name, quantity stepper, line total, edit and
 * remove all side by side. Measured on real product names at every POS
 * resolution the cafe will actually use, the name column came out at 70-88px
 * and ellipsized: "Passion Fruit Lemonade" rendered as "Passion F...".
 * A cashier who cannot read the cart cannot check the order before taking
 * money, which is the one thing this panel exists for.
 *
 * The arithmetic does not work on one line. At 1366x768, the widest common POS
 * PC, the row is 392px: the stepper needs ~70, the line total ~70, the two
 * icon buttons ~48, the thumbnail 36, plus gaps -- leaving under 90px for the
 * name no matter how the fixed columns are tuned. Widening the panel steals
 * from the product grid and still does not fit a long name.
 *
 * So the name gets its own full-width line and the controls sit under it. Row
 * height goes 56px -> ~72px, which costs about one visible row on a short
 * screen; a cafe order is a handful of items, and a readable name is worth
 * more than a sixth row. Every control is kept, and this is CSS only -- the
 * markup and event handlers in renderOrderItem() are untouched.
 *
 * Track 1 is `auto`, not a fixed 36px, because renderOrderItem() only emits
 * the image/emoji element when the product has one. A fixed track left a 36px
 * hole on every product without a photo -- and, when this row was one line,
 * pushed the name into that hole and squeezed it to 36px.
 */
.pos-order-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 2px 10px;
    padding: 8px 14px;
    margin: 2px 10px;
    min-height: 56px;
    height: auto;
    background: var(--ds-surface);
    border-radius: var(--ds-radius-md);
    border: 1px solid var(--ds-border);
    cursor: pointer;
    position: relative;
    transition: background 0.15s ease;
}
/*
 * Explicit placement, so the row is correct whether or not the optional
 * image/emoji cell was rendered. Relying on document order alone is what
 * caused the original bug: one missing element shifted every later child a
 * track to the left.
 */
.pos-order-item > .item-image,
.pos-order-item > .item-glyph {
    grid-column: 1;
    grid-row: 1 / span 2;
}
.pos-order-item > .item-details {
    grid-column: 2 / -1;
    grid-row: 1;
    min-width: 0;
}
.pos-order-item > .item-qty-control {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
}
.pos-order-item > .item-total {
    grid-column: 3;
    grid-row: 2;
}
.pos-order-item > .item-edit-btn {
    grid-column: 4;
    grid-row: 2;
}
.pos-order-item > .item-remove {
    grid-column: 5;
    grid-row: 2;
}

/*
 * An add-on ordered with the line above it.
 *
 * It stays a real row -- its own product, its own price, its own quantity and
 * remove button -- because it is a real product that gets sold and taken off
 * the shelf. What changes is only where the eye puts it: indented, hugging the
 * drink above with no gap, and carrying a rule down its leading edge so a
 * table that ordered two lattes with different syrups reads as two drinks
 * rather than five unattached rows.
 *
 * The image cell is deliberately not rendered for these (see renderOrderItem),
 * which the explicit grid placement above already tolerates. The indent is
 * logical, not left, so it lands on the correct side in Arabic.
 */
.pos-order-item.is-addon {
    margin-top: -2px;
    margin-inline-start: 26px;
    min-height: 44px;
    padding-top: 6px;
    padding-bottom: 6px;
    border-start-start-radius: 0;
    border-start-end-radius: 0;
}
.pos-order-item.is-addon::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--ds-border);
}
.pos-order-item.is-addon .item-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--ds-text-secondary);
}

.pos-order-item .item-remove {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}
.pos-order-item .item-remove:hover { color: var(--danger); background: rgba(255,0,0,0.08); }
.pos-order-item .item-remove svg { width: 14px; height: 14px; }
.pos-order-item .item-total {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--op-accent);
    text-align: right;
    white-space: nowrap;
}
.pos-order-item:hover { background: var(--ds-surface-alt); }
.pos-order-item.selected {
    background: var(--ds-primary-tint);
    border-color: var(--ds-primary-tint);
    outline: none;
}
.pos-order-item:focus-visible {
    outline: 2px solid var(--ds-primary);
    outline-offset: -2px;
}

.pos-order-item .item-image,
.pos-order-item .item-glyph {
    width: 32px;
    height: 32px;
    border-radius: var(--ds-radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--ds-surface-alt);
}
.pos-order-item .item-glyph {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pos-order-item .item-details { min-width: 0; overflow: hidden; }
.pos-order-item .item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ds-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}
.pos-order-item .item-modifiers,
.pos-order-item .item-notes {
    font-size: 11px;
    color: var(--ds-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.pos-order-item .item-unit-price { display: none; }

.pos-order-item .item-qty-control {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
}
.pos-order-item .qty-btn {
    width: 22px; height: 22px; min-width: 22px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--ds-radius-sm);
    background: var(--ds-surface-alt);
    border: 1px solid var(--ds-border);
    color: var(--ds-text-primary);
    font-size: 13px;
    transition: background 0.12s ease, transform 0.1s ease;
    cursor: pointer;
    padding: 0;
}
.pos-order-item .qty-btn:hover { background: var(--ds-primary-tint); border-color: var(--ds-primary-tint); }
.pos-order-item .qty-btn:active { transform: scale(0.92); }
.pos-order-item .qty-btn svg { width: 10px; height: 10px; }

.pos-order-item .qty-value {
    min-width: 18px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--ds-text-primary);
}

.pos-order-item .item-total {
    font-size: 13px;
    font-weight: 700;
    color: var(--ds-text-primary);
    text-align: right;
    white-space: nowrap;
    min-width: 56px;
}

/*
 * NO HOVER-REVEAL ON THE ORDER LINE.
 *
 * Edit and Remove were opacity:0 until .pos-order-item was hovered. On the
 * touch tills this POS actually runs on there is no hover, so both buttons
 * were invisible and untappable -- a cashier could not remove a wrongly-rung
 * item from an order at all, only zero its quantity. This is the single worst
 * case of the hover-reveal pattern in the app, because it hides the correction
 * a busy cashier needs most.
 *
 * They are visible at rest now. Tertiary colour keeps them quiet next to the
 * line total without hiding them, and the :hover rules below are decoration
 * for the mouse case only -- nothing is gated behind them.
 */
.pos-order-item .item-edit-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--ds-text-tertiary);
    border-radius: var(--ds-radius-sm);
    cursor: pointer;
    opacity: 1;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}
.pos-order-item .item-edit-btn:hover {
    background: var(--ds-surface-alt);
    color: var(--ds-primary);
}

.pos-order-item .item-remove {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--ds-text-tertiary);
    border-radius: var(--ds-radius-sm);
    cursor: pointer;
    opacity: 1;
    transition: background 0.15s, color 0.15s;
    padding: 0;
    position: static;
    transform: none;
}
.pos-order-item .item-remove:hover {
    background: var(--ds-danger-tint);
    color: var(--ds-danger);
}
.pos-order-item .item-remove svg { width: 14px; height: 14px; }

/*
 * Finger-sized, unconditionally.
 *
 * 24px is a mouse target, and these two sit right beside the qty stepper, so
 * on glass a cashier reaching for Remove hits Edit. The obvious fix is to
 * grow them under `@media (pointer: coarse)` -- and there was already a
 * coarse-pointer block at the foot of this file doing exactly that for
 * opacity. It never fired. A POS terminal is a Windows touch screen with a
 * mouse plugged in, so the primary pointer reports `fine` and every
 * touch-only media query in this stylesheet silently does nothing on the
 * hardware it was written for.
 *
 * So this is not behind a query. 32px is bigger than a mouse needs and small
 * enough not to grow the order row, which is the scarce direction on a
 * 1520x730 till.
 */
.pos-order-item .item-edit-btn,
.pos-order-item .item-remove {
    width: 32px;
    height: 32px;
}

/* ── View-only items ── */
.pos-order-item.view-only {
    opacity: 0.72;
    pointer-events: none;
    filter: grayscale(0.15);
}

/* ════════════════════ ORDER FOOTER ════════════════════ */

.pos-order-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--op-border-panel);
    background: transparent;
}

/* ── Discount button — dashed amber pill ── */
.order-discount-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    font-size: 12px;
    font-weight: 500;
    color: var(--op-accent-dim);
    padding: 0 14px;
    border: 1.5px dashed var(--op-accent-dim);
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.order-discount-btn:hover {
    background: rgba(160,120,40,0.1);
    border-color: var(--op-accent);
    color: var(--op-accent);
}
.order-discount-btn:active { transform: scale(0.97); transition: transform 0.1s ease; }

/* wrapper to center the pill */
.order-discount-wrapper {
    display: flex;
    justify-content: center;
    padding: 8px 18px 0;
}

.order-divider {
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        rgba(var(--gold-rgb), 0.25) 30%,
        rgba(var(--gold-rgb), 0.25) 70%,
        transparent
    );
    margin: 10px 16px;
}

/* ── Summary / Totals ── */
.pos-order-summary {
    padding: 10px 18px 8px;
}

.pos-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 13px;
    color: #b09580;
}
.pos-summary-row .label {
    display: flex;
    align-items: center;
    gap: 6px;
}
.pos-summary-row .value { font-weight: 600; }

.pos-summary-row.total-row {
    padding: 10px 0 6px;
    margin-top: 4px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    align-items: flex-start;
}

.pos-summary-row.total-row .label {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.pos-summary-row.total-row .label .total-item-count {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0;
    text-transform: none;
}

.pos-summary-row.total-row .value {
    color: var(--op-accent);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    padding-top: 2px;
}

/* ════════════════════ ACTION BUTTONS ════════════════ */

.pos-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px 14px;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: linear-gradient(180deg, transparent 0%, var(--op-bg-panel) 28%);
    backdrop-filter: blur(8px);
}

.pos-action-row {
    display: grid;
    gap: 8px;
}
.pos-action-row-ops {
    grid-template-columns: 1fr 1fr 1fr;
}
.pos-action-row-settle {
    grid-template-columns: minmax(72px, 0.85fr) 1.6fr;
}

.pos-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 13px;
    padding: 12px 8px;
    height: auto;
    min-height: 44px;
    transition: filter 0.15s ease, transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
    border: 1px solid transparent;
    cursor: pointer;
}
.pos-action-btn svg { width: 15px; height: 15px; }

.pos-action-btn.hold-btn {
    background: rgba(var(--blue-rgb), 0.04);
    color: var(--text-secondary);
    border-color: rgba(0, 0, 0, 0.08);
}
.pos-action-btn.hold-btn:hover:not(:disabled) {
    background: rgba(var(--blue-rgb), 0.08);
    color: var(--text-primary);
}

.pos-action-btn.send-btn {
    background: rgba(var(--blue-rgb), 0.12);
    color: var(--blue);
    border-color: rgba(var(--blue-rgb), 0.28);
    font-weight: 700;
}
.pos-action-btn.send-btn:hover:not(:disabled) {
    background: rgba(var(--blue-rgb), 0.18);
    filter: none;
}

.pos-action-btn.debt-btn {
    background: var(--op-btn-debt-bg);
    color: var(--op-btn-debt-text);
    border-color: rgba(224,96,96,0.2);
}
.pos-action-btn.debt-btn:hover:not(:disabled) { filter: brightness(1.15); }

.pos-action-btn.print-btn {
    background: var(--op-btn-print-bg);
    color: var(--op-btn-print-text);
    border-color: rgba(0, 0, 0, 0.08);
}
.pos-action-btn.print-btn:hover:not(:disabled) { filter: brightness(1.08); }

/* C4: the settle button IS The Ingot -- all skin comes from .ds-btn-ingot
   in design-system.css (champagne bar + glint/success states); this rule
   only carries the grid-cell layout. */
.pos-action-btn.pay-btn {
    width: 100%;
    min-height: 48px;
    font-size: 14px;
}

.pos-action-btn:active:not(:disabled) { transform: scale(0.97); transition: transform 0.1s ease; }
.pos-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ════════════════════ EDIT / VIEW MODE ════════════════ */

.pos-action-buttons.edit-actions,
.pos-action-buttons.view-actions {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    gap: 8px;
}

.pos-action-btn.view-paid-btn {
    background: transparent;
    color: var(--green);
    border: 1px solid var(--green);
    height: 34px;
}
.pos-action-btn.view-paid-btn:hover { background: rgba(60,185,122,0.1); }

.pos-action-btn.view-print-btn {
    background: transparent;
    color: var(--blue);
    border: 1px solid var(--blue);
    height: 34px;
}
.pos-action-btn.view-print-btn:hover { background: var(--blue-tint); }

.pos-action-btn.view-close-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
    height: 34px;
}
.pos-action-btn.view-close-btn:hover { background: var(--red-tint); color: var(--red); border-color: var(--red); }

.pos-action-btn.view-edit-btn {
    background: var(--gold);
    color: var(--bg-void);
    height: 44px;
    border: none;
}
.pos-action-btn.view-edit-btn:hover { background: var(--gold-dark); }

/* ════════════════════ EDIT / VIEW BANNERS ════════════════ */

.pos-edit-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--red-tint);
    border-bottom: 1px solid rgba(var(--red-rgb), 0.2);
}
.pos-edit-banner-title {
    font-size: 11px; font-weight: 500; letter-spacing: 0.03em;
    color: var(--red); text-transform: uppercase;
}
.pos-edit-banner-sub {
    font-size: 11px; color: var(--text-hint); margin-top: 1px;
}
.pos-edit-banner-badge {
    background: rgba(var(--red-rgb), 0.2); color: var(--red);
    font-size: 11px; font-weight: 500; letter-spacing: 0.03em;
    padding: 2px 8px; border-radius: 4px;
    border: 1px solid rgba(var(--red-rgb), 0.3);
}

.pos-view-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--gold-tint);
    border-bottom: 1px solid rgba(201,168,76,0.15);
}
.pos-view-banner-title {
    font-size: 11px; font-weight: 500; letter-spacing: 0.03em;
    color: var(--gold); text-transform: uppercase;
}
.pos-view-banner-sub {
    font-size: 11px; color: var(--text-hint); margin-top: 1px;
}
.pos-view-banner-badge {
    background: rgba(201,168,76,0.2); color: var(--gold);
    font-size: 11px; font-weight: 500; letter-spacing: 0.03em;
    padding: 2px 8px; border-radius: 4px;
    border: 1px solid rgba(201,168,76,0.25);
}

.pos-order-header.editing { border-left: 2px solid var(--red); }
.pos-order-header.viewing { border-left: 2px solid var(--gold); }

/* ════════════════════ SHORTCUTS BAR ════════════════════ */

.pos-shortcuts-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px 18px;
    min-height: 36px;
    padding: 6px 16px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.72);
    border-top: 1px solid var(--border-default);
    flex-shrink: 0;
}

.pos-shortcut {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* C6: key hints are .ds-kbd chips (design-system.css) -- no local override */

/* ════════════════════ STATUS BAR ════════════════════ */

.pos-status-bar { display: none; }

/* ════════════════════ ORDER TAB VIEWING/EDITING STATES ════════════════ */

.pos-order-tab.viewing {
    border-color: rgba(var(--blue-rgb), 0.5);
    background: linear-gradient(180deg, rgba(var(--blue-rgb), 0.1), rgba(var(--blue-rgb), 0.02));
}
.pos-order-tab.viewing .tab-icon { background: rgba(var(--blue-rgb), 0.2); color: #8cc4f0; box-shadow: inset 0 0 0 1px rgba(var(--blue-rgb), 0.4); }
.pos-order-tab.viewing.active {
    border-color: rgba(var(--blue-rgb), 0.8);
    box-shadow: 0 0 0 1px rgba(var(--blue-rgb), 0.35), 0 0 14px rgba(var(--blue-rgb), 0.2);
}
.pos-order-tab.viewing.active::after { background: linear-gradient(90deg, transparent, #6b9bc3, transparent); box-shadow: 0 0 8px rgba(var(--blue-rgb), 0.6); }

.pos-order-tab.editing {
    border-color: rgba(var(--red-rgb), 0.55);
    background: linear-gradient(180deg, rgba(var(--red-rgb), 0.12), rgba(var(--red-rgb), 0.03));
}
.pos-order-tab.editing .tab-icon { background: rgba(var(--red-rgb), 0.2); color: #C81E4A; box-shadow: inset 0 0 0 1px rgba(var(--red-rgb), 0.4); }
.pos-order-tab.editing.active {
    box-shadow: 0 0 0 1px rgba(var(--red-rgb), 0.4), 0 0 14px rgba(var(--red-rgb), 0.22);
}
.pos-order-tab.editing.active::after { background: linear-gradient(90deg, transparent, #e25c4a, transparent); }

/* ════════════════════ COLLECT BUTTON ════════════════════ */
.pos-toolbar-btn.collect-btn {
    width: auto;
    height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    background: var(--ds-primary-tint);
    border: 1px solid var(--ds-primary);
    color: var(--ds-primary);
    letter-spacing: 0.02em;
    text-transform: none;
    transition: background 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out), transform 0.15s var(--ease-out);
    position: relative;
}
.pos-toolbar-btn.collect-btn:hover {
    background: var(--ds-primary);
    border-color: var(--ds-primary);
    color: var(--ds-text-on-accent);
    transform: translateY(-1px);
}

.collect-btn .collect-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--ds-danger);
    color: var(--ds-text-on-accent);
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1;
}

/* An add-on group's heading: its type icon, then its name. */
.mod-group-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-block-end: 8px;
}

/* One per add-on, not just per group. A sheet with four groups open used to be
   one icon and a dozen identical rows of text; on a touch screen the icon is
   what the eye lands on before the label resolves. Dimmed, because it is a
   cue and not the answer -- the option name is still what is being read. */
.mod-option-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    color: var(--ds-text-secondary);
    flex: 0 0 auto;
}

.mod-option-row:hover .mod-option-icon,
.mod-option-row:has(input:checked) .mod-option-icon {
    color: var(--ds-primary);
}

/* ════════════════════ DEBT COLLECT MODAL ════════════════════ */
.debt-collect-header {
    margin-bottom: 12px;
}
.debt-collect-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-default);
    border-radius: 10px;
    padding: 8px 12px;
    transition: border-color 0.15s;
}
.debt-collect-search:focus-within { border-color: var(--gold); }
.debt-collect-search svg { color: var(--text-secondary); flex-shrink: 0; }
.debt-collect-search input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    min-width: 0;
}
.debt-collect-search input::placeholder { color: var(--text-muted); }
.debt-total-count {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.debt-client-list {
    max-height: 240px;
    overflow-y: auto;
    margin: 0 -4px 12px;
    padding: 0 4px;
}
.debt-client-list::-webkit-scrollbar { width: 4px; }
.debt-client-list::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

.debt-client-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1.5px solid transparent;
    margin-bottom: 4px;
    cursor: pointer;
    transition: background-color 0.12s var(--ease-out), border-color 0.12s var(--ease-out), transform 0.12s var(--ease-out), box-shadow 0.12s var(--ease-out);
}
.debt-client-row:hover {
    background: var(--bg-elevated);
    border-color: rgba(var(--gold-rgb), 0.3);
    transform: translateX(2px);
}
.debt-client-row.selected {
    background: rgba(var(--gold-rgb), 0.1);
    border-color: var(--gold);
    box-shadow: 0 0 0 1px rgba(var(--gold-rgb), 0.2);
}
.debt-client-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), #b07e2a);
    color: #1a1410;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}
.debt-client-info { flex: 1; min-width: 0; }
.debt-client-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.debt-client-phone {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
    font-family: var(--font-mono);
}
.debt-client-amount {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--danger);
    white-space: nowrap;
}

@keyframes reorder-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--blue-rgb), 0.55); }
    50%      { box-shadow: 0 0 0 4px rgba(var(--blue-rgb), 0); }
}
.pos-order-tab.reorder-mode {
    border-bottom-color: var(--info) !important;
    background: rgba(var(--blue-rgb), 0.14) !important;
    cursor: grab;
    outline: 1.5px dashed rgba(var(--blue-rgb), 0.7);
    outline-offset: -2px;
    animation: reorder-pulse 1.4s ease-out infinite;
    transform: translateY(-1px);
}
.pos-order-tab.reorder-mode::after {
    content: '⋮⋮';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 11px;
    color: var(--info);
    letter-spacing: -1px;
    opacity: 0.8;
    pointer-events: none;
}
.pos-order-tab.dragging {
    opacity: 0.35;
    cursor: grabbing;
    transform: scale(0.96);
    transition: opacity 120ms, transform 120ms;
}

/* Insertion line — animated reveal */
@keyframes drop-line-in {
    from { transform: scaleY(0); opacity: 0; }
    to   { transform: scaleY(1); opacity: 1; }
}
.pos-order-tab.drop-before::before,
.pos-order-tab.drop-after::after {
    content: '';
    position: absolute;
    top: 10%;
    height: 80%;
    width: 3px;
    background: var(--info);
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(var(--blue-rgb), 0.85), 0 0 16px rgba(var(--blue-rgb), 0.4);
    z-index: 10;
    pointer-events: none;
    transform-origin: center;
    animation: drop-line-in 140ms ease-out;
}
.pos-order-tab.drop-before::before { left: -2px; }
.pos-order-tab.drop-after::after  { right: -2px; }

.order-tab-color-dot {
    width: 10px; height: 10px; border-radius: 50%;
    flex-shrink: 0; border: 1.5px solid rgba(255,255,255,0.15);
    cursor: pointer; background: var(--border);
    transition: transform 0.13s; padding: 0;
}
.order-tab-color-dot:hover { transform: scale(1.5); }

/* ════════════════════ CLIENT PICKER ════════════════════ */

.pos-client-picker-header {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-bottom: 1px solid var(--border-default);
}
.pos-client-card {
    background: var(--bg-surface); border: 1px solid var(--border-default);
    border-radius: var(--radius-md); padding: 14px; cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    text-align: center;
}
.pos-client-card:hover { background: var(--bg-elevated); border-color: var(--border-strong); }
.pos-client-card.selected {
    border-color: var(--gold);
    background: var(--gold-tint);
    color: var(--gold);
}

/* ════════════════════ TABLES FAB ════════════════════ */

.pos-tables-fab {
    position: fixed;
    bottom: calc(48px + env(safe-area-inset-bottom, 0px));
    right: calc(16px + env(safe-area-inset-right, 0px));
    z-index: var(--z-overlay);
}
.fab-btn {
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--bg-elevated); color: var(--text-primary);
    border: 1px solid var(--border-strong); box-shadow: var(--shadow-md);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s ease, transform 0.1s ease;
}
.fab-btn:hover { background: var(--bg-surface); }
.fab-btn:active { transform: scale(0.95); }
.fab-btn svg { width: 22px; height: 22px; }

/* ════════════════════ PAYMENT MODAL ════════════════════ */

/*
 * Five methods across one row, not three across two.
 *
 * The second row cost 44px of a modal that did not fit the till, to show two
 * buttons. auto-fit with a floor rather than repeat(5): at 480px of modal the
 * five fit, and on anything narrower they wrap themselves instead of being
 * squeezed until "Transfer" breaks across two lines.
 */
.payment-method-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
    gap: 4px;
    margin-bottom: 10px;
}
.payment-method-btn {
    display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px;
    /* 6px sides, down from 8: the label is what needs the width. */
    padding: 10px 6px; border-radius: 10px;
    /* A wrapped label is what makes the row grow back to two rows high. */
    white-space: nowrap;
    background: var(--bg-tertiary); border: 1.5px solid var(--border-default);
    color: var(--text-secondary); cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    font-size: 12px; font-weight: 600;
}
.payment-method-btn svg { width: 16px; height: 16px; opacity: 0.85; }
.payment-method-btn:hover { border-color: var(--gold); background: var(--bg-surface); color: var(--text-primary); }
.payment-method-btn.selected {
    border-color: var(--gold);
    background: linear-gradient(135deg, rgba(var(--gold-rgb), 0.18), rgba(var(--gold-rgb), 0.08));
    color: var(--gold);
    box-shadow: 0 0 0 3px rgba(var(--gold-rgb), 0.12);
}
.payment-method-btn.selected svg { opacity: 1; }

.quick-cash-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px;
}
.quick-cash-btn {
    padding: 8px 6px; border-radius: 8px;
    background: var(--bg-tertiary); border: 1px solid var(--border-default);
    color: var(--text-primary); font-size: 12px; font-weight: 600; cursor: pointer;
    font-family: var(--font-mono);
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.quick-cash-btn:hover { border-color: var(--gold); background: rgba(var(--gold-rgb), 0.1); color: var(--gold); transform: translateY(-1px); }
.quick-cash-btn.exact {
    background: linear-gradient(135deg, rgba(124,179,66,0.18), rgba(124,179,66,0.06));
    border-color: var(--green);
    color: var(--green-light);
}

/* Compact payment modal — no inner scroll */
.modal-overlay.active .modal:has(.payment-total-display) {
    max-width: 480px;
}
.modal:has(.payment-total-display) .modal-header { padding: 12px 18px; }
/*
 * overflow-y:auto, not visible.
 *
 * This said `overflow: visible`, which is a promise that the content will
 * always fit. It did not: on the 730px till the body was 512px tall holding
 * 594px of content, so the overflow simply painted over the footer and the
 * Complete Payment button underneath it. Nothing scrolled, because nothing
 * was allowed to.
 *
 * The content is trimmed below to fit without scrolling at all. This is the
 * guarantee for when it cannot -- a long bill, a second currency, a client
 * with credit -- so the button is always reachable rather than painted over.
 */
.modal:has(.payment-total-display) .modal-body {
    padding: 14px 18px;
    overflow-y: auto;
}
.modal:has(.payment-total-display) .modal-footer { padding: 12px 18px; }
.modal:has(.payment-total-display) .input-group { margin-bottom: 10px; }
.modal:has(.payment-total-display) .input-label { margin-bottom: 4px; }

.payment-total-display {
    background: linear-gradient(135deg, rgba(var(--gold-rgb), 0.12), rgba(var(--gold-rgb), 0.03));
    border: 1.5px solid rgba(var(--gold-rgb), 0.4);
    border-radius: 12px;
    /* Trimmed from 12px/12px. Pure display: shrinking it costs nobody a touch
       target, and it buys rows for the controls under it. */
    padding: 8px 14px;
    text-align: center;
    margin-bottom: 4px;
    position: relative;
    overflow: hidden;
}
.payment-total-display::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(var(--gold-rgb), 0.15), transparent 60%);
    pointer-events: none;
}
.payment-total-display .payment-total-label {
    font-size: 11px; color: var(--text-hint);
    text-transform: uppercase; letter-spacing: 0.12em;
    font-weight: 600;
}
.payment-total-display .payment-total-amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--gold);
    margin-top: 4px;
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
    line-height: 1;
}

.payment-change-display {
    background: linear-gradient(135deg, rgba(124,179,66,0.15), rgba(124,179,66,0.04));
    border: 1.5px solid rgba(124,179,66,0.5);
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    transition: opacity 0.2s ease;
}
.payment-change-display.zero { opacity: 0.5; }
.payment-change-display .change-label {
    font-size: 11px;
    color: var(--green-light);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
}
.payment-change-display .change-amount {
    font-size: 18px;
    font-weight: 700;
    color: var(--green-light);
    font-family: var(--font-mono);
    line-height: 1;
}

/* Action button row in modal — bigger primary */
.modal-footer .btn-success {
    font-size: 15px;
    font-weight: 700;
    padding: 12px 20px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--green), var(--green-light));
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(124,179,66,0.3);
}
.modal-footer .btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(124,179,66,0.4);
}

/* Inline discount button on action row */
.order-discount-btn-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 6px;
    padding: 8px 12px;
    background: transparent;
    border: 1px dashed rgba(var(--gold-rgb), 0.4);
    border-radius: 10px;
    color: var(--op-accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.order-discount-btn-inline:hover:not(:disabled) {
    background: rgba(var(--gold-rgb), 0.08);
    border-color: var(--op-accent);
    border-style: solid;
}
.order-discount-btn-inline:disabled { opacity: 0.4; cursor: not-allowed; }
.order-discount-btn-inline svg { flex-shrink: 0; }

/* ════════════════════ NG / MODAL ════════════════════ */

.pos-numberpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 260px; margin: 0 auto; }
.pos-numpad-btn {
    height: 48px; border-radius: var(--radius-md);
    background: var(--bg-surface); border: 1px solid var(--border-default);
    color: var(--text-primary); font-size: 18px; font-weight: 500; cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.pos-numpad-btn:hover { background: var(--bg-elevated); border-color: var(--border-strong); }
.pos-numpad-btn.key-del { background: var(--red-tint); color: var(--red); border-color: rgba(var(--red-rgb), 0.3); }

/* ════════════════════ RESPONSIVE — POS terminal sizes ════════════════════ */

/* Short viewports (768px-tall POS, 600px embedded) */
@media (max-height: 800px) {
    .order-tabs-bar { height: 44px; }
    .pos-order-tab { height: 38px; margin: auto 2px; }
    .pos-products-toolbar { padding: 8px 12px 0; }
    .pos-categories { padding: 8px 12px 4px; }
    .pos-product-grid { padding: 12px; gap: 16px; }
    .pos-status-strip { padding: 4px 12px; font-size: 11px; gap: 12px; }
    .pos-shortcuts-bar { min-height: 30px; padding: 4px 12px; gap: 8px 12px; font-size: 11px; }
}

@media (max-height: 640px) {
    .pos-shortcuts-bar { display: none; }
    .pos-status-strip .pos-status-branch { display: none; }
}

/* Square / near-square screens (4:3, 5:4 — typical POS touch screens) */
@media (max-aspect-ratio: 16/10) {
    :root {
        --pos-order-panel-width: clamp(260px, 34vw, 360px);
        --pos-grid-min: 112px;
    }

    .order-tabs-bar { height: 40px; }
    .pos-order-tab { height: 32px; }

    .pos-menu-section-grid,
    .pos-product-grid:not(:has(.pos-menu-section)) {
        grid-template-columns: repeat(auto-fill, minmax(var(--pos-grid-min), 1fr));
        gap: 8px;
    }

    .pos-product-grid { padding: 10px 12px; gap: 14px; }

    .pos-product-card .product-name { font-size: 12px; padding: 8px 10px 2px; }
    .pos-product-card .product-price { font-size: 13px; padding: 0 10px 10px; }

    .pos-products-toolbar { padding: 8px 12px 0; }
    .pos-products-toolbar .search-bar .input { height: 38px; font-size: 12px; }

    .pos-categories { padding: 8px 12px 6px; gap: 5px; }
    .pos-cat-btn { min-height: 28px; font-size: 11px; padding: 4px 11px; }

    .pos-order-panel { padding: 8px; }
    .pos-order-panel > #orderPanel { border-radius: 18px; }
    .pos-order-header { padding: 10px 14px; }
    .pos-order-header .order-type-icon { width: 30px; height: 30px; font-size: 13px; }
    .pos-order-header .order-title { font-size: 13px; }
    .pos-order-header .order-subtitle { font-size: 11px; }

    .pos-order-item {
        padding: 6px 10px;
        margin: 3px 8px;
        /* Same two-line structure as the base rule; only the spacing tightens.
           This used to declare a single-row 5-track template, which was also
           one track short of the six children a row with an image has. */
        grid-template-columns: auto minmax(0, 1fr) auto auto auto;
        gap: 2px 6px;
    }
    .pos-order-item .item-image,
    .pos-order-item .item-glyph { width: 30px; height: 30px; }
    .pos-order-item .item-name { font-size: 12px; }
    .pos-order-item .item-unit-price { font-size: 10px; }
    .pos-order-item .item-total { font-size: 12px; }
    .pos-order-item .qty-btn { width: 20px; height: 20px; min-width: 20px; }
    .pos-order-item .qty-value { font-size: 12px; }

    .pos-order-summary { padding: 6px 14px 4px; }
    .pos-summary-row { font-size: 12px; padding: 2px 0; }
    .pos-summary-row.total-row .value { font-size: 22px; }
    .order-divider { margin: 7px 12px; }
    .order-discount-wrapper { padding: 6px 14px 0; }

    .pos-action-buttons { padding: 7px 10px 10px; gap: 6px; }
    .pos-action-btn { padding: 9px 4px; min-height: 38px; font-size: 12px; border-radius: 12px; }
    .pos-action-btn svg { width: 13px; height: 13px; }
}

/* True square / very tight (1:1 kiosks) */
@media (max-aspect-ratio: 11/10) and (max-width: 1100px) {
    :root {
        --pos-order-panel-width: clamp(240px, 36vw, 300px);
        --pos-grid-min: 100px;
    }

    .pos-menu-section-grid,
    .pos-product-grid:not(:has(.pos-menu-section)) {
        gap: 6px;
    }

    .pos-product-grid { padding: 8px; gap: 12px; }

    .pos-product-card .product-name { font-size: 11px; padding: 6px 8px 2px; }
    .pos-product-card .product-price { font-size: 12px; padding: 0 8px 8px; }

    .pos-order-item {
        grid-template-columns: auto minmax(0, 1fr) auto auto auto;
        gap: 2px 5px;
        padding: 6px 8px;
        margin: 2px 6px;
    }
    .pos-summary-row.total-row .value { font-size: 20px; }
    .pos-action-btn { min-height: 34px; font-size: 11px; }
}

/* Narrow landscape (small tablets) — keep side-by-side until phone width */
@media (max-width: 900px) and (orientation: landscape) {
    :root {
        --pos-order-panel-width: clamp(240px, 38vw, 320px);
        --pos-grid-min: 100px;
    }
}

/* Portrait / phone — stack panels */
@media (max-width: 768px), (max-width: 900px) and (orientation: portrait) {
    .pos-terminal {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
    }
    .pos-products-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-default);
        min-height: 0;
    }
    .pos-order-panel {
        min-height: min(280px, 42vh);
        max-height: 45vh;
        flex-shrink: 0;
    }
    .pos-shortcuts-bar { display: none; }
}

@media (max-width: 600px) {
    .pos-menu-section-grid,
    .pos-product-grid:not(:has(.pos-menu-section)) {
        grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
        gap: 6px;
        padding: 10px;
    }
    .pos-action-row-ops { grid-template-columns: 1fr 1fr 1fr; }
    .pos-action-row-settle { grid-template-columns: 1fr 2fr; }
}

/* ════════════════════ PRINTED DOT ════════════════════ */

.order-tab-printed { color: var(--blue); }

/* ════════════════════ COLLECT DEBT BUTTON ════════════════════ */

#collectDebtBtn { white-space: nowrap; }

/* POS focus: slightly tighter chrome so the product canvas dominates */
body.pos-focus .page-header .page-subtitle { display: none; }
body.pos-focus .pos-page {
    background:
        radial-gradient(80% 50% at 30% 0%, rgba(var(--blue-rgb), 0.035), transparent 60%),
        transparent;
}

/* ════════════════════ RTL ════════════════════ */

body[dir="rtl"] .pos-order-item { direction: rtl; }

body[dir="rtl"] .pos-terminal { direction: rtl; }
body[dir="rtl"] .pos-products-panel { border-right: none; border-left: 1px solid var(--border-default); }
body[dir="rtl"] .pos-product-card .fav-star { right: auto; left: 6px; }
body[dir="rtl"] .pos-product-card .product-stock { left: auto; right: 4px; }
body[dir="rtl"] .pos-order-item .item-remove { right: auto; left: -4px; }
body[dir="rtl"] .pos-order-panel > #orderPanel { direction: rtl; }
body[dir="rtl"] .pos-shortcuts-bar { direction: rtl; }
body[dir="rtl"] .pos-products-toolbar .search-bar svg { left: auto; right: 12px; }
body[dir="rtl"] .pos-products-toolbar .search-bar .input { padding: 0 36px 0 40px; }
body[dir="rtl"] .search-clear { right: auto; left: 10px; }
body[dir="rtl"] .pos-tables-fab { right: auto; left: calc(16px + env(safe-area-inset-left, 0px)); }
body[dir="rtl"] .modal-overlay .modal-header { direction: rtl; }
body[dir="rtl"] .modal-footer { justify-content: flex-start; }

@media (max-width: 600px) { .modal-overlay { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); } }

/* Removed fixed 520px breakpoint — order panel uses --pos-order-panel-width clamp */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Order Switcher List ── */
.osr-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    cursor: default;
    transition: background 0.12s;
    user-select: none;
}
.osr-row.active {
    background: rgba(var(--gold-rgb), 0.08);
    border-color: rgba(var(--gold-rgb), 0.4);
}
.osr-row:hover { background: var(--bg-elevated); }
.osr-handle {
    font-size: 18px;
    color: var(--text-secondary);
    cursor: grab;
    padding: 4px;
    line-height: 1;
}
.osr-handle:active { cursor: grabbing; }
.osr-info:hover { opacity: 0.8; }

/* ---- B60 OS POS mockup (Track 2 visual layer) ---- */

.order-tabs-bar.is-hidden { display: none; }

.pos-cat-icon { display: none; }

.pos-cat-btn.active {
    background: var(--ds-primary-tint);
    color: var(--ds-primary);
    /* A tint fill alone is a weak selected state next to white chips; give it a
       defined edge. Was --ds-primary-tint, i.e. the same colour as the fill. */
    border-color: var(--ds-primary);
}

.pos-cat-more-wrap { position: relative; }

.pos-cat-more-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-md);
    box-shadow: var(--ds-shadow-pop);
    min-width: 160px;
}

.pos-menu-section {
    width: 100%;
    min-width: 0;
    margin-bottom: 0;
}

.pos-menu-section.is-favorites .pos-menu-section-title {
    color: var(--ds-primary);
}

.pos-menu-section.is-favorites .pos-menu-section-head::before {
    content: '';
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpolygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/%3E%3C/svg%3E") center / contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpolygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/%3E%3C/svg%3E") center / contain no-repeat;
    color: var(--ds-warning);
}

.pos-menu-section.is-flat .pos-menu-section-head {
    display: none;
}

/* flex-start, not space-between. The Favorites head has no "View all" button
   but it DOES have a ::before star, so space-between pushed the star to the
   far left and the word "Favorites" to the far right -- the one section title
   in the grid that did not sit above its own products. The button pushes
   itself to the end instead, so every head reads title-left / action-right. */
.pos-menu-section-head {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--ds-space-2);
    margin: 0 4px 10px;
}

.pos-menu-section-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--ds-text-primary);
}

.pos-menu-view-all {
    /* pushes itself to the end of the head, so the title can stay at the start
       whether or not this button is present (see .pos-menu-section-head) */
    margin-inline-start: auto;
    border: none;
    background: transparent;
    color: var(--ds-primary);
    font-size: 13px;
    font-weight: 600;
    min-height: 32px;
    padding-inline: var(--ds-space-2);
    cursor: pointer;
}

.pos-menu-section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--pos-grid-min), 1fr));
    gap: 12px;
    width: 100%;
}

@media (min-width: 1600px) {
    :root { --pos-grid-min: 148px; }
    :root { --pos-order-panel-width: clamp(380px, 28vw, 520px); }
}

@media (min-width: 1920px) {
    :root { --pos-grid-min: 156px; }
}

@media (min-width: 1400px) {
    .pos-menu-section-grid,
    .pos-product-grid:not(:has(.pos-menu-section)) {
        grid-template-columns: repeat(auto-fill, minmax(var(--pos-grid-min), 1fr));
    }
}

.pos-order-header {
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--ds-border);
    background: var(--ds-surface);
    border-radius: 0;
    display: block;
}

.pos-order-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pos-order-panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ds-text-primary);
    margin: 0;
}

.pos-order-header-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.pos-service-segment {
    display: inline-flex;
    padding: 3px;
    border-radius: var(--ds-radius-pill);
    background: var(--ds-surface-alt);
    border: 1px solid var(--ds-border);
    gap: 2px;
}

.pos-service-segment-btn {
    border: none;
    background: transparent;
    color: var(--ds-text-secondary);
    font-size: 11px;
    font-weight: 600;
    /* 23px tall was well under a usable touch target for the dine-in /
       takeaway / delivery switch, which changes what the order IS. */
    min-height: 32px;
    padding: 7px 12px;
    border-radius: var(--ds-radius-pill);
    cursor: pointer;
    white-space: nowrap;
}

.pos-service-segment-btn.is-active {
    background: var(--ds-surface);
    color: var(--ds-primary);
    box-shadow: var(--ds-shadow-card);
}

.pos-context-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--ds-radius-pill);
    background: var(--ds-primary-tint);
    color: var(--ds-primary);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--ds-primary-tint);
    cursor: default;
}

button.pos-context-pill {
    cursor: pointer;
}

.pos-table-open-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: var(--ds-radius-pill);
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    color: var(--ds-text-tertiary);
    font-size: 11px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    line-height: 1;
}

.pos-table-open-meta .table-open-dot {
    opacity: 0.4;
}

.pos-panel-overflow-wrap {
    position: relative;
}

.pos-panel-overflow-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    background: var(--ds-surface);
    color: var(--ds-text-secondary);
    cursor: pointer;
    padding: 0;
}

.pos-panel-overflow-btn:hover {
    background: var(--ds-surface-alt);
    color: var(--ds-text-primary);
}

.pos-panel-overflow-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 30;
    min-width: 180px;
    padding: 6px;
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-md);
    box-shadow: var(--ds-shadow-pop);
}

.pos-panel-overflow-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border: none;
    border-radius: var(--ds-radius-sm);
    background: transparent;
    color: var(--ds-text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
}

.pos-panel-overflow-item:hover {
    background: var(--ds-surface-alt);
}

.pos-panel-overflow-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pos-printed-badge {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}

.pos-order-panel > #orderPanel {
    border-radius: var(--ds-radius-lg);
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    box-shadow: var(--ds-shadow-card);
}

.pos-charge-btn {
    width: calc(100% - 28px);
    margin: 12px 14px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 16px;
    border: none;
    border-radius: var(--ds-radius-md);
    background: var(--ds-primary-gradient);
    color: var(--ds-text-on-accent);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.pos-charge-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pos-utility-grid {
    display: grid;
    /* Three: Hold, Debt, Print. Discount and Note left for the Charge modal,
       where the cashier already settles the money. auto-fit rather than a
       hardcoded count so the next tile added or removed does not leave a hole
       in the row -- repeat(5) with three tiles left two dead columns and the
       buttons stranded at 60% width. */
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    grid-auto-flow: column;
    gap: 8px;
    margin: 12px 14px 0;
}

.pos-utility-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 64px;
    padding: 8px 4px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-md);
    background: var(--ds-primary-tint);
    color: var(--ds-primary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.pos-utility-tile svg {
    flex-shrink: 0;
}

.pos-utility-tile:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Nothing until there is something. An empty block that still reserves
   padding is exactly what this change was about. */
.pos-order-notes {
    padding: 0 14px;
    /* The markup is indented, so the whitespace between its children forms a
       line box and the "empty" wrap still measured 10px. */
    line-height: 0;
}

/* Only .has-note now: the editable field moved to the Charge modal, so the
   wrap is either a note to read or nothing at all. */
.pos-order-notes.has-note {
    padding: 10px 14px 14px;
    line-height: normal;
}

.pos-order-note-preview {
    margin: 0 0 8px;
    padding: 8px 10px;
    border-radius: var(--ds-radius-sm);
    background: var(--ds-surface-alt);
    color: var(--ds-text-secondary);
    font-size: 12px;
}

.pos-summary-row.total-row .value {
    color: var(--ds-text-primary);
    font-size: 24px;
    font-weight: 700;
}

.pos-status-strip {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    padding: 8px 16px;
    border-top: 1px solid var(--ds-border);
    background: var(--ds-surface);
    font-size: 12px;
    color: var(--ds-text-secondary);
    flex-shrink: 0;
}

.pos-status-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pos-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ds-success);
}

.pos-status-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: var(--ds-surface-alt);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}

.pos-status-branch {
    margin-left: auto;
    font-weight: 600;
}

.pos-shortcuts-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px 16px;
    min-height: 36px;
    padding: 6px 16px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--ds-surface);
    border-top: 1px solid var(--ds-border);
    flex-shrink: 0;
}

.pos-shortcut {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ds-text-secondary);
}

.pos-summary-row.is-discount .value {
    color: var(--ds-success);
    font-weight: 700;
}

.pos-order-item.flash-highlight {
    animation: pos-flash 0.6s ease-out;
}
@keyframes pos-flash {
    0%   { background: var(--ds-primary-tint); box-shadow: 0 0 0 2px var(--ds-primary-tint); }
    100% { background: var(--ds-surface); box-shadow: none; }
}

body[dir="rtl"] .pos-panel-overflow-menu { right: auto; left: 0; }
body[dir="rtl"] .pos-status-branch { margin-left: 0; margin-right: auto; }

/*
 * This block used to force `opacity: 1` on the order-line Edit and Remove
 * buttons, to undo the hover-reveal that hid them. It was the right intent
 * behind the wrong guard: `pointer: coarse` does not match a POS terminal,
 * which is a touch screen with a mouse attached and therefore reports
 * `fine`. The buttons stayed invisible on exactly the hardware this was
 * written to rescue.
 *
 * The hover-reveal is gone at the source now (see .item-edit-btn above), so
 * there is nothing left for this to correct.
 *
 * Movement-based hover, though, is worth suppressing where there is genuinely
 * no pointer: a tap on a touch screen leaves :hover latched until you tap
 * something else, so a card that lifts or scales on hover stays lifted after
 * it has been used. `hover: none` is the honest test for that -- unlike
 * `pointer: coarse`, it asks whether hovering is possible at all.
 */
@media (hover: none) {
    .pos-product-card:hover .product-img,
    .pos-product-card .fav-star:hover,
    .order-tab-color-dot:hover,
    .quick-cash-btn:hover {
        transform: none;
    }
}

/* ── Table picker (Order Type & Table modal) ───────────────────────────────
 *
 * These are .btn, which is inline-flex, centred and white-space:nowrap. That
 * is right for a button with a label and an icon and wrong for one carrying
 * three stacked lines: the <br>s that used to separate the number, the name
 * and the status did nothing inside a flex row, so all three became flex items
 * side by side and collided in a fifth of the modal's width.
 *
 * Column direction, and nowrap lifted so a long table name can use two lines
 * instead of pushing the button wider than its grid cell.
 */
.pos-table-pick {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 10px 8px;
    min-height: 56px;
    line-height: 1.2;
    white-space: normal;
    text-align: center;
    overflow-wrap: anywhere;
}

.pos-table-pick-num {
    font-size: 16px;
    font-weight: 700;
}

.pos-table-pick-name {
    font-size: 11px;
    font-weight: 500;
    opacity: .85;
}

.pos-table-pick-sub {
    font-size: 11px;
    /* Tabular so a clock subtitle does not jitter the row as the minutes
       tick over on a wall of open tables. */
    font-variant-numeric: tabular-nums;
}

/* ── Charge modal: the two bill adjustments ────────────────────────────────
 *
 * Discount and Service Charge are the same control twice, and stacking them
 * spent a whole row of a modal that did not fit the till. Side by side they
 * cost one row instead of two.
 *
 * minmax(0, 1fr), not 1fr: a grid column defaults to min-content width, and
 * each of these holds its own grid of toggle + number + clear. Left at 1fr the
 * pair refused to narrow and pushed itself wider than the modal.
 */
.pay-adjust-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

/* The blocks brought their own top margin from when they were stacked; the
   row owns the spacing now. */
.pay-adjust-row > .input-group {
    margin-top: 0;
}

/* Under about 420px of modal the pair is narrower than the controls are
   usable, so it goes back to stacking. */
@media (max-width: 460px) {
    .pay-adjust-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ── New Order modal: the tables, up front ─────────────────────────────────
 *
 * The + button opens straight onto the destinations (js/pages/pos.js,
 * showNewOrderModal). Cell 0 is Quick Sale; the rest are the tables, in
 * number order.
 *
 * auto-fill with a 84px floor rather than a fixed column count: the modal is
 * 520px at most and the till is 1520x730, so twelve tables have to wrap
 * without any single cell dropping below a thumb. .pos-table-pick supplies
 * the three stacked lines and the 56px height -- the same cell the table
 * reassignment picker uses, so the two never diverge.
 */
.pos-new-order-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 8px;
}

.pos-new-order-empty {
    margin: 12px 0 0 0;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* The named tab, demoted. It was a full third of the old modal for something
   most shifts never use; here it is one labelled row under the grid. */
.pos-new-order-tab {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.pos-new-order-tab .input-label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

.pos-new-order-tab-row {
    display: grid;
    /* minmax(0, ...) on the name: a grid column is min-content wide by
       default, and an <input> refuses to go below its size attribute, which
       pushed this row wider than the modal. */
    grid-template-columns: minmax(0, 1fr) 116px auto;
    gap: 8px;
}

@media (max-width: 560px) {
    .pos-new-order-tab-row {
        grid-template-columns: 1fr;
    }
}
