/* ============================================================
   ChowHub — Global Styles
   Rules here are ONLY for things Tailwind CDN cannot express:
   - Webkit scrollbar theming
   - .pos-layout responsive grid (complex named areas)
   - Floorplan absolute positioning, resize handles
   - Computed calc() geometry for resize handles
   - Shared .modal overlay base
   - Data-selector hooks with zero visual opinion (.bill-badge etc.)
   ============================================================ */

/* ── Scrollbars ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgb(82, 82, 82) !important; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: rgb(110, 110, 110) !important; }

/* ── Global font override — Geist everywhere, Inter as fallback ── */
*, *::before, *::after { font-family: 'Geist', 'Inter', -apple-system, system-ui, sans-serif !important; }

/* ── Utility ── */
.scrollbar-none { scrollbar-width: none; }
.scrollbar-none::-webkit-scrollbar { display: none; }
.hidden { display: none !important; }

/* ── Mobile / iPad Viewport Height Fix ───────────────────────
   100vh on iOS Safari INCLUDES the browser chrome (address bar,
   tab bar) which means h-screen overflows the visible area and
   clips bottom rounded corners.
   100dvh (dynamic vh) is chrome-aware and fixes this.
   We also account for the home-indicator safe area.
   ──────────────────────────────────────────────────────────── */
body {
    /* !important needed: Tailwind's h-screen class (0,1,0 specificity)
       beats this element rule (0,0,1) without it */
    height: 100vh !important;
    height: 100dvh !important; /* chrome-aware, fixes iOS Safari viewport clipping */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
}

/* ── Modal overlay base ───────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 0.65);
    display: flex;
    justify-content: center;
    align-items: safe center;
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
}
/* Fallback for browsers that don't support 'safe center' */
@supports not (align-items: safe center) {
    .modal { align-items: flex-start; padding-top: 2rem; }
}

/* ── Desktop condition helper ─────────────────────────────────
   "Desktop" = ≥ 1024px  OR  ≥ 768px landscape
   "Tab layout" = < 768px  OR  768px–1023px portrait
   ─────────────────────────────────────────────────────────── */

/* ── Order Type Panel — hidden on tab layout, visible on desktop ── */
.order-type-panel { display: none; }
@media (min-width: 768px) and (orientation: landscape) {
    .order-type-panel { display: flex; }
}

/* ── POS Layout Grid (responsive) ────────────────────────── */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
    padding-bottom: 1rem;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* ── Scroll-container padding-bottom fix ─────────────────────
   padding-bottom is silently ignored in overflow:auto containers.
   A ::after spacer block is the reliable workaround.
   ─────────────────────────────────────────────────────────── */
#products-container::after,
#order-items::after {
    content: '';
    display: block;
    height: 1rem;
}

/* Desktop: true 3-column side-by-side */
@media (min-width: 768px) and (orientation: landscape) {
    .pos-layout {
        grid-template-columns: 20rem 1fr 1fr;
        grid-template-rows: 1fr;
        overflow: hidden;
        padding-bottom: 1.5rem;
    }
    .pos-layout > #order-type-panel {
        grid-row: 1;
        grid-column: 1;
        align-self: stretch;
    }
    .pos-layout > #tables-section {
        grid-row: 1;
        grid-column: 2;
    }
    .pos-layout > #menu-section {
        grid-row: 1;
        grid-column: 3;
    }
    .pos-layout > section#history-view,
    .pos-layout > section#accounts-view {
        grid-column: 2;
    }
}

/* Floorplan active: tables section fills full width, other panels hidden */
@media (min-width: 768px) and (orientation: landscape) {
    .pos-layout.floorplan-active {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }
    /* Hide order panel completely */
    .pos-layout.floorplan-active > #order-type-panel {
        display: none !important;
    }
    /* Tables section fills all columns */
    .pos-layout.floorplan-active > #tables-section {
        grid-column: 1;
        grid-row: 1;
    }
    /* Menu section hidden (it's already hidden via JS) */
    .pos-layout.floorplan-active > #menu-section {
        display: none !important;
    }

    /* Table opened from floor plan: order panel floats over left edge */
    .pos-layout.floorplan-active.floorplan-table-open > #order-type-panel {
        display: flex !important;
        position: fixed;
        top: 1rem;
        left: 1rem;
        bottom: 1rem;
        width: 20rem;
        z-index: 60;
        border-radius: 1rem;
        box-shadow: 0 8px 32px rgba(0,0,0,0.5);
        /* Remove glass effect — match app dark background */
        background: #0a0a0a !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    /* Menu slides in from right over the floor plan — fills space beside order panel */
    .pos-layout.floorplan-active.floorplan-table-open > #menu-section {
        display: flex !important;
        position: fixed;
        top: 1rem;
        left: 22rem;
        right: 0;
        bottom: 1rem;
        width: auto;
        z-index: 60;
        transform: translateX(calc(100% + 22rem));
        transition: transform 0.3s ease;
        box-shadow: -8px 0 24px rgba(0,0,0,0.35);
        grid-column: unset;
        grid-row: unset;
    }
    .pos-layout.floorplan-active.floorplan-table-open.menu-drawer-open > #menu-section {
        transform: translateX(0);
    }
}

/* Menu drawer tab — hidden by default outside media query */
#menu-drawer-tab { display: none; }
#menu-drawer-backdrop { display: none; position: fixed; inset: 0; }

/* ── Menu drawer (13" MacBook Air range — iPad range opted out below) ──
   Collapse to 2 columns; menu becomes an off-screen drawer with
   a vertical "Menu" tab sticking out from the right edge.
   iPad 10.86" (1024–1280px landscape) gets a real 3-panel layout instead.
   ──────────────────────────────────────────────────────────── */
@media (min-width: 1281px) and (max-width: 1700px) and (orientation: landscape) {
    .pos-layout:not(.floorplan-active):not(.takeaway-active) {
        grid-template-columns: 20rem 1fr;
    }
    /* Remove menu-section from grid flow entirely, position as fixed drawer */
    .pos-layout:not(.floorplan-active):not(.takeaway-active) > #menu-section {
        position: fixed;
        top: 1rem;
        right: 0;
        bottom: 1rem;
        width: min(480px, 58vw);
        z-index: 960;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        box-shadow: -8px 0 24px rgba(0,0,0,0.25);
        grid-column: unset;
        grid-row: unset;
    }
    .pos-layout:not(.floorplan-active):not(.takeaway-active).menu-drawer-open > #menu-section {
        transform: translateX(0);
    }

    /* Floor plan table open: menu fills space beside order panel */
    .pos-layout.floorplan-active.floorplan-table-open > #menu-section {
        display: flex !important;
        position: fixed;
        top: 1rem;
        left: 22rem;
        right: 0;
        bottom: 1rem;
        width: auto;
        z-index: 960;
        transform: translateX(calc(100% + 22rem));
        transition: transform 0.3s ease;
        box-shadow: -8px 0 24px rgba(0,0,0,0.35);
        grid-column: unset;
        grid-row: unset;
    }
    .pos-layout.floorplan-active.floorplan-table-open.menu-drawer-open > #menu-section {
        transform: translateX(0);
    }
    /* Hide the menu drawer tab in floorplan-table-open mode (menu fills full remaining width) */
    .pos-layout.floorplan-active.floorplan-table-open ~ #menu-drawer-tab,
    .pos-layout.floorplan-active.floorplan-table-open + #menu-drawer-tab {
        display: none !important;
    }

    #menu-drawer-tab {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 50%;
        right: 0;
        transform: translateY(-50%);
        z-index: 965;
        width: 2rem;
        height: 7rem;
        border-radius: 0.75rem 0 0 0.75rem;
        background: #FBBF24;
        border: 1px solid rgba(0,0,0,0.1);
        border-right: none;
        box-shadow: -4px 0 12px rgba(0,0,0,0.15);
        cursor: pointer;
        padding: 0;
        transition: right 0.3s ease, background 0.2s ease;
        pointer-events: auto;
        overflow: hidden;
    }
    #menu-drawer-tab:hover {
        background: #F59E0B;
    }
    .menu-drawer-tab-label {
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        font-size: 1rem;
        font-weight: 600;
        letter-spacing: 0.05em;
        color: #000;
        display: block;
        text-align: center;
        width: 100%;
        padding-bottom: 0.35rem;
    }

    #menu-drawer-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.25);
        z-index: 955;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    #menu-drawer-backdrop.open {
        opacity: 1;
        pointer-events: auto;
    }
    #menu-drawer-tab.force-hide,
    #menu-drawer-backdrop.force-hide {
        display: none !important;
    }
}

/* Takeaway active: hide tables, menu expands */
.pos-layout.takeaway-active > #tables-section {
    display: none !important;
}
@media (min-width: 768px) and (orientation: landscape) {
    .pos-layout.takeaway-active {
        grid-template-columns: 20rem 1fr;
        grid-template-rows: 1fr;
    }
    .pos-layout.takeaway-active > #menu-section {
        grid-column: 2 !important;
        grid-row: 1;
    }
}

/* ── Tables locked (take-out mode) ────────────────────────── */
.tables-locked {
    position: relative;
    pointer-events: none;
    user-select: none;
}
.tables-locked::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: inherit;
    z-index: 10;
    transition: opacity 0.3s;
}

/* ── Floorplan Canvas ──────────────────────────────────────── */

/* Fixed-ratio inner container — every device sees the same layout.
   16 : 10 aspect ratio, centered inside #floorplan-container with
   subtle letterboxing on mismatched screens. */
#floorplan-container {
    display: flex;
    align-items: center;
    justify-content: center;
}
#floorplan-inner {
    position: relative;
    aspect-ratio: 16 / 10;
    /* Fill the widest dimension that still fits inside the outer box */
    width: 100%;
    max-height: 100%;
    /* When height-constrained, shrink width to keep 16:10 */
    overflow: hidden;
    /* Subtle boundary so users know the "canvas" edge */
    border-radius: 0.25rem;
}
/* Dot-grid overlay — admin only, sits above the Fabric canvas (z:1) but below tables (z:500) */
#floorplan-inner.fp-admin::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background-image:
        linear-gradient(to right,  rgba(255,255,255,0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 28px 28px;
}
/* When height is the constraint, cap width via container query or
   simple JS — the aspect-ratio + max-height handles it natively. */

.floorplan-table {
    position: absolute;
    /* Default size set by JS via fpScale — no CSS fallback needed */
    background-color: rgb(38 38 38);
    border: 2px solid rgb(255 255 255 / 0.1);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.5);
    transition: box-shadow 0.2s, border-color 0.2s, background-color 0.2s;
    user-select: none;
}

.floorplan-table:hover {
    border-color: rgb(255 255 255 / 0.3);
    box-shadow: 0 15px 20px -5px rgb(0 0 0 / 0.6);
}

.floorplan-table.draggable { cursor: grab; }
.floorplan-table.draggable:active {
    cursor: grabbing;
    opacity: 0.9;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.8);
    z-index: 50;
}

.floorplan-table.selected {
    border-color: rgb(59 130 246);
    box-shadow: 0 0 15px rgb(59 130 246 / 0.5);
    background-color: rgb(23 23 23);
}
.floorplan-table.locked {
    opacity: 0.4;
    border-color: rgb(239 68 68 / 0.4);
}

.floorplan-table.edit-active {
    border-color: transparent;
    box-shadow: 0 0 0 3px #ffffff, 0 0 12px rgba(255, 255, 255, 0.2);
    z-index: 60;
}

.floorplan-table.shape-square { border-radius: 0.75rem; }

.floorplan-table-name {
    font-weight: 700;
    font-size: calc(1rem * var(--fp-scale, 1));
    text-align: center;
    pointer-events: none;
}

.floorplan-table-meta {
    font-size: calc(0.75rem * var(--fp-scale, 1));
    color: rgb(163 163 163);
    margin-top: 0.25rem;
    pointer-events: none;
}

/* ── Resize handles (floorplan edit mode) ─────────────────── */
.resize-handle {
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    background-color: white;
    border: 3px solid rgb(59 130 246);
    border-radius: 50%;
    z-index: 100;
    /* Invisible touch target — 44px min per Apple HIG */
    touch-action: none;
}
/* Expand hit area without changing visual size */
.resize-handle::after {
    content: '';
    position: absolute;
    inset: -14px;
}

.resize-handle.tl { top: -0.625rem; left: -0.625rem; cursor: nwse-resize; }
.resize-handle.tr { top: -0.625rem; right: -0.625rem; cursor: nesw-resize; }
.resize-handle.bl { bottom: -0.625rem; left: -0.625rem; cursor: nesw-resize; }
.resize-handle.br { bottom: -0.625rem; right: -0.625rem; cursor: nwse-resize; }

.resize-handle.tc { top: -0.625rem; left: calc(50% - 0.625rem); cursor: ns-resize; width: 1.5rem; border-radius: 0.375rem; }
.resize-handle.bc { bottom: -0.625rem; left: calc(50% - 0.625rem); cursor: ns-resize; width: 1.5rem; border-radius: 0.375rem; }
.resize-handle.ml { top: calc(50% - 0.625rem); left: -0.625rem; cursor: ew-resize; height: 1.5rem; border-radius: 0.375rem; }
.resize-handle.mr { top: calc(50% - 0.625rem); right: -0.625rem; cursor: ew-resize; height: 1.5rem; border-radius: 0.375rem; }

/* On touch screens, make handles even bigger */
@media (hover: none) and (pointer: coarse) {
    .resize-handle {
        width: 1.75rem;
        height: 1.75rem;
        border-width: 3px;
    }
    .resize-handle.tl { top: -0.875rem; left: -0.875rem; }
    .resize-handle.tr { top: -0.875rem; right: -0.875rem; }
    .resize-handle.bl { bottom: -0.875rem; left: -0.875rem; }
    .resize-handle.br { bottom: -0.875rem; right: -0.875rem; }
    .resize-handle.tc { top: -0.875rem; left: calc(50% - 0.875rem); width: 1.75rem; }
    .resize-handle.bc { bottom: -0.875rem; left: calc(50% - 0.875rem); width: 1.75rem; }
    .resize-handle.ml { top: calc(50% - 0.875rem); left: -0.875rem; height: 1.75rem; }
    .resize-handle.mr { top: calc(50% - 0.875rem); right: -0.875rem; height: 1.75rem; }
}

/* ── Floor-plan editor toolbar ───────────────────────────────────────────── */

/* Horizontal divider for vertical side panel */
.fp-divider-h {
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
    margin: 4px 2px;
    flex-shrink: 0;
    width: 100%;
}
html.dark .fp-divider-h { background: rgba(255, 255, 255, 0.08); }

/* Legacy horizontal divider (kept for safety) */
.fp-divider {
    width: 1px;
    background: rgba(0, 0, 0, 0.08);
    margin: 4px 2px;
    flex-shrink: 0;
}
html.dark .fp-divider { background: rgba(255, 255, 255, 0.08); }

/* Side panel: shown on landscape/desktop, hidden on portrait/mobile */
.fp-side-panel {
    display: none !important;
}
@media (min-width: 768px) and (orientation: landscape) {
    .fp-side-panel { display: flex !important; }
    #fp-fab { display: none !important; }
}
/* Collapsed toolbar — shrink to just show the toggle button */
#shape-toolbar.fp-collapsed { max-height: 2.75rem !important; overflow: hidden !important; }
/* Expand tab not needed — toggle button stays visible in collapsed state */
#fp-toolbar-expand { display: none !important; }
/* Portrait / mobile: show FAB instead (shown by JS when floorplan is active) */

/* Side panel internals: vertical-only scroll, no horizontal overflow */
#shape-toolbar {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    align-items: center;
    gap: 6px !important;
}
/* All direct children (buttons, dividers, palette) center in the panel */
#shape-toolbar > * {
    flex-shrink: 0;
}

/* Colour swatches in the side panel — circular */
#shape-toolbar .fp-swatch {
    width: 28px; height: 28px;
    border-radius: 50%;
}

/* Colour swatches in the bottom sheet — large squares (keep existing) */
#fp-bottom-sheet .fp-swatch {
    width: 100%; height: auto;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}

.fp-swatch {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: transform .1s ease, box-shadow .1s ease;
}
.fp-swatch:hover { transform: scale(1.12); }
.fp-swatch.active { box-shadow: 0 0 0 2px #3b82f6, 0 0 0 4px rgba(59,130,246,0.25); }
html.dark .fp-swatch { border-color: rgba(30,30,30,0.9); }

/* Active tool highlight — uses !important to beat Tailwind dark: utilities */
.fp-tool-btn.active {
    background: rgb(37 99 235 / .9) !important;
    color: white !important;
    border-color: rgb(96 165 250 / .3) !important;
}
.fp-tool-btn:hover {
    opacity: 0.85;
}

/* Fabric wraps #fp-scene-canvas in .canvas-container. Position + layer it behind tables. */
#floorplan-inner .canvas-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1 !important;
    /* Create a stacking context so children (upper-canvas z:2) stay below tables (z:60) */
    isolation: isolate;
}
/* When a table is being edited, disable the Fabric canvas so it can't steal
   clicks from the DOM resize handles. Safari needs the rule applied directly
   to each canvas element; inherited pointer-events: none isn't always honored. */
#floorplan-container.table-editing .canvas-container,
#floorplan-container.table-editing .canvas-container > *,
#floorplan-container.table-editing canvas.upper-canvas,
#floorplan-container.table-editing canvas.lower-canvas,
#floorplan-container.table-editing #fp-scene-canvas {
    pointer-events: none !important;
}

/* Tables always above the scene canvas.
   Using very high z-indexes so they beat the Fabric upper-canvas regardless
   of stacking context quirks. */
.floorplan-table { z-index: 500; position: absolute; }
.floorplan-table.draggable:active { z-index: 600; }
.floorplan-table.edit-active { z-index: 700; }

/* Resize handles need to win pointer events over the Fabric upper-canvas,
   which otherwise steals clicks on the outer half of each handle. */
.resize-handle {
    z-index: 999 !important;
    pointer-events: auto !important;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
}

/* Toolbar hidden — buttons remain in DOM for floor-plan-editor.js wiring;
   all tools are now surfaced in the properties panel instead. */
#shape-toolbar { display: none !important; }

/* ── Seat visualization (floor-plan-seats.js) ─────────────── */
.fp-seats-svg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
    z-index: 5;
}

/* ── Alignment guides (floor-plan-guides.js) ──────────────── */
.fp-guide {
    position: absolute;
    z-index: 450;
    pointer-events: none;
}
.fp-guide-v {
    width: 0;
    top: 0;
    bottom: 0;
    border-left: 1px dashed rgba(77, 158, 255, 0.5);
}
.fp-guide-h {
    height: 0;
    left: 0;
    right: 0;
    border-top: 1px dashed rgba(77, 158, 255, 0.5);
}

/* ── Table properties panel (floor-plan-props.js) ─────────── */
.fp-props-panel {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 110;
    width: 240px;
    max-height: calc(100% - 24px);
    overflow-y: auto;
    overflow-x: hidden;
    background: rgba(23, 23, 23, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    color: #e5e7eb;
    font-family: -apple-system, system-ui, 'Segoe UI', sans-serif;
    font-size: 13px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.fp-props-panel::-webkit-scrollbar { width: 4px; }
.fp-props-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
.fp-props-panel::-webkit-scrollbar-track { background: transparent; }
.fp-props-drag-handle {
    cursor: grab;
    text-align: center;
    margin: -10px -14px 6px -14px;
    padding: 4px 0 2px;
    border-radius: 14px 14px 0 0;
    user-select: none;
    -webkit-user-select: none;
}
.fp-props-drag-handle:active { cursor: grabbing; }
.fp-props-grip {
    color: rgba(255, 255, 255, 0.25);
    font-size: 14px;
    letter-spacing: 3px;
}
.fp-props-title {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 10px;
    letter-spacing: 0.02em;
    color: #fff;
}
.fp-props-label {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.fp-props-input {
    width: 100%;
    padding: 5px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    margin-bottom: 10px;
    outline: none;
    box-sizing: border-box;
}
.fp-props-input:focus {
    border-color: rgba(59, 130, 246, 0.5);
}
.fp-props-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    margin-bottom: 10px;
}
.fp-props-slider {
    flex: 1;
    accent-color: #3b82f6;
    height: 4px;
}
.fp-props-val {
    font-size: 13px;
    font-weight: 600;
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    flex-shrink: 0;
    text-align: center;
    color: #fff;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    padding: 1px 2px;
    -moz-appearance: textfield;
    outline: none;
}
.fp-props-val::-webkit-inner-spin-button,
.fp-props-val::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Custom chevron for category select dropdowns — keeps breathing room on the right */
#add-section-parent,
#cat-edit-parent {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 14px 14px !important;
}

.fp-props-val:focus {
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
}
.fp-props-shape-btn {
    flex: 1;
    padding: 5px 0;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.fp-props-shape-btn.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}
.fp-props-delete-btn {
    width: 100%;
    padding: 6px 0;
    margin-top: 4px;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.fp-props-reset-btn {
    width: 100%;
    padding: 6px 0;
    margin-bottom: 6px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.fp-props-reset-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.fp-props-delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
}

.fp-props-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 10px 0;
}

/* Tool icon buttons grid */
.fp-props-tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-bottom: 4px;
}
.fp-props-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    transition: all 0.15s;
}
.fp-props-tool-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.fp-props-tool-btn:active {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
}
.fp-props-tool-save {
    color: #60a5fa;
}
.fp-props-tool-save:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #93bbfc;
}

/* Inline colour palette */
.fp-props-shapes-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin-bottom: 6px;
}
.fp-props-shape-pick {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}
.fp-props-shape-pick:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.2);
}
.fp-props-palette {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    margin-bottom: 4px;
}
.fp-props-swatch {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1;
    border-radius: 6px !important;
    padding: 0 !important;
}

/* Label row with color dot aligned right */
.fp-props-label-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.fp-props-row + .fp-props-label-row {
    margin-top: 10px;
}
.fp-props-label-row .fp-props-label {
    margin-bottom: 0;
}
.fp-props-dot-spacer {
    display: block;
    width: 15px;
    min-width: 15px;
    flex-shrink: 0;
}
.fp-props-color-dot {
    cursor: pointer;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.fp-color-wheel-mini {
    display: block;
    width: 15px;
    height: 15px;
    min-width: 15px;
    min-height: 15px;
    border-radius: 50%;
    transition: transform 0.15s;
}
.fp-props-color-dot:hover .fp-color-wheel-mini {
    transform: scale(1.15);
}
.fp-props-color-dot:active .fp-color-wheel-mini {
    transform: scale(0.95);
}
.fp-props-color-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    opacity: 0.01;
}

/* Props panel: on small phones, move to bottom */
@media (max-width: 480px) {
    .fp-props-panel {
        left: 12px;
        right: 12px;
        top: auto;
        bottom: 5rem;
        width: auto;
    }
}

/* ── Cash drawer bill badge (populated by JS) ─────────────── */
.bill-badge {
    display: inline-flex;
    align-items: center;
    background: rgb(38 38 38);
    color: rgb(229 229 229);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    border: 1px solid rgb(64 64 64);
    font-size: 0.875rem;
    font-weight: 500;
}

.empty-bills {
    color: rgb(115 115 115);
    font-size: 0.875rem;
    font-style: italic;
}

/* ── Checkout calc grid ────────────────────────────────────── */
.calc-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ── Image source tabs (product modal) ───────────────────── */
.image-source-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid rgb(229 229 229);
}

.dark .image-source-tabs { border-bottom-color: rgb(38 38 38); }

.image-source-tab {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    color: rgb(115 115 115);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.image-source-tab.active {
    color: rgb(59 130 246);
    border-color: rgb(59 130 246);
}

/* ── Photo preview ────────────────────────────────────────── */
.photo-preview {
    margin-top: 0.5rem;
    width: 100%;
    max-height: 9.375rem;
    object-fit: contain;
    border-radius: 0.75rem;
}

/* ── Checkout chair row (populated by JS) ────────────────── */
.checkout-chair-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgb(23 23 23);
    border: 1px solid rgb(38 38 38);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

.checkout-chair-row:hover { background: rgb(38 38 38); }

.checkout-chair-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: rgb(59 130 246);
    cursor: pointer;
}

/* ── KDS urgency flash (20+ min orders) ──────────────────── */
@keyframes kds-urgent-flash {
    0%, 100% { background-color: rgb(127 29 29 / 0.8); }  /* red-900 */
    50% { background-color: rgb(10 10 10 / 0.9); }        /* near-black */
}

.kds-flash-urgent {
    animation: kds-urgent-flash 0.5s ease-in-out infinite;
}

/* ── KDS new order card slide-in animation ──────────────── */
.kds-card-enter {
    animation: kds-card-slide-in 0.4s ease-out;
}
@keyframes kds-card-slide-in {
    0% { opacity: 0; transform: translateY(-20px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── KDS RUSH order pulsing border ──────────────────────── */
.kds-rush-pulse {
    animation: kds-rush-border 0.9s ease-in-out infinite;
}
@keyframes kds-rush-border {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0), 0 0 0 0 rgba(239, 68, 68, 0); }
    50% { box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.9), 0 0 20px 4px rgba(239, 68, 68, 0.5); }
}

/* ── KDS alert modal flash (added/removed/cancelled) ───── */
@keyframes kds-alert-flash {
    0%, 100% { border-color: var(--alert-color, #3b82f6); box-shadow: 0 0 20px var(--alert-color, #3b82f6); }
    50% { border-color: transparent; box-shadow: none; }
}

/* ── Accounts table responsive columns ────────────────────────
   Using real media queries because .hidden has !important
   ─────────────────────────────────────────────────────────── */
.accounts-desktop-col { display: none !important; }
.accounts-mobile-controls { display: flex !important; }

@media (min-width: 768px) {
    .accounts-desktop-col { display: table-cell !important; }
    .accounts-mobile-controls { display: none !important; }
}

/* ── Inventory header responsive buttons ──────────────────────
   Same pattern as accounts — real media queries to beat .hidden !important
   640px = Tailwind's sm breakpoint
   ─────────────────────────────────────────────────────────── */
.inv-desktop-buttons { display: none !important; }
.inv-mobile-dropdown { display: block !important; }
.inv-title-full { display: none !important; }
.inv-title-short { display: inline !important; }

@media (min-width: 640px) {
    .inv-desktop-buttons { display: flex !important; }
    .inv-mobile-dropdown { display: none !important; }
    .inv-title-full { display: inline !important; }
    .inv-title-short { display: none !important; }
}

/* ── Mobile Done bar — visible on portrait tablet too ─────────
   md:hidden hides at 768px — override to keep visible in portrait
   ─────────────────────────────────────────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) and (orientation: portrait) {
    #mobile-done-bar.visible {
        display: block !important;
    }
}

/* ── Header nav — desktop only (≥ 1024px) ────────────────────
   Real media queries to beat .hidden { display:none !important }
   ─────────────────────────────────────────────────────────── */
.header-desktop-nav { display: none !important; }
.header-mobile-menu { display: block !important; }
.cash-drawer-fab { display: none !important; }
.desktop-only-btn { display: none !important; }

@media (min-width: 768px) and (orientation: landscape) {
    .header-desktop-nav { display: flex !important; }
    .header-mobile-menu { display: none !important; }
    .cash-drawer-fab { display: flex !important; }
    .desktop-only-btn { display: inline-flex !important; }
}
/* Hide the More dropdown on large desktops — items shown directly in nav */
@media (min-width: 1701px) {
    #more-dropdown-wrapper { display: none !important; }
}
/* Hide large-desktop-only items on smaller screens */
.large-desktop-only { display: none !important; }
@media (min-width: 1701px) {
    .large-desktop-only { display: flex !important; }
}

/* ── Menu header responsive elements ─────────────────────────
   Real media queries to beat .hidden { display:none !important }
   1024px = desktop breakpoint (tab layout below, grid above)
   ─────────────────────────────────────────────────────────── */
.menu-desktop-only { display: none !important; }
.menu-mobile-only  { display: flex !important; }
.menu-mobile-search { display: flex !important; }
.menu-mobile-search--hidden { display: none !important; }
#menu-header-row.menu-header-row--collapsed { height: 0 !important; min-height: 0 !important; padding: 0 !important; border: none !important; overflow: hidden !important; display: none !important; }

/* ── Mobile/Tablet Portrait Tab Navigation ────────────────────
   Applies to: phones (all) + iPad portrait (768px–1023px)
   iPad landscape and desktop use the grid layout instead.
   ─────────────────────────────────────────────────────────── */
.mobile-tab-bar { display: none; }

/* ── Editorial Design Tokens (mobile only) ─────────────────── */
:root {
    --ch-font-sans: 'Geist', -apple-system, system-ui, sans-serif;
    --ch-font-mono: 'Geist Mono', 'SF Mono', ui-monospace, monospace;
    --ch-radius: 14px;
    --ch-radius-btn: 12px;
    --ch-radius-panel: 18px;
}

/* Prevent iOS auto-zoom on input focus — all devices */
input, select, textarea { font-size: 16px !important; }

@media (max-width: 767px), (min-width: 768px) and (max-width: 1023px) and (orientation: portrait) {

    /* Prevent iOS auto-zoom on input focus */
    input, textarea, select { font-size: 16px !important; }

    /* ── Modal styling ── */
    .modal > div {
        background: var(--ch-bg-elev) !important;
        border: 1px solid var(--ch-border-strong) !important;
        border-radius: 18px !important;
        color: var(--ch-text) !important;
        padding: 20px !important;
        box-shadow: 0 8px 20px rgba(0,0,0,0.15) !important;
    }
    .modal > div h3 {
        color: var(--ch-text) !important;
        font-size: 18px !important;
        font-weight: 700 !important;
        letter-spacing: -0.3px !important;
    }
    .modal > div input,
    .modal > div textarea,
    .modal > div select {
        background: var(--ch-surface) !important;
        border: 1px solid var(--ch-border-strong) !important;
        border-radius: 12px !important;
        color: var(--ch-text) !important;
        padding: 12px 14px !important;
        outline: none !important;
    }
    .modal > div input::placeholder,
    .modal > div textarea::placeholder {
        color: var(--ch-text-subtle) !important;
    }
    .modal > div input:focus,
    .modal > div textarea:focus {
        border-color: rgba(255,107,53,0.4) !important;
    }
    .modal > div button {
        border-radius: 12px !important;
        font-weight: 600 !important;
        font-size: 14px !important;
        letter-spacing: -0.1px !important;
    }
    .modal > div label {
        color: var(--ch-text-dim) !important;
        font-size: 12px !important;
        font-weight: 500 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.3px !important;
    }

    /* ── Editorial palette — light ── */
    :root {
        --ch-bg: #FFFFFF;
        --ch-bg-elev: #FFFFFF;
        --ch-surface: #F8F8F8;
        --ch-surface2: #E7E7E3;
        --ch-border: transparent;
        --ch-border-strong: rgba(10,10,12,0.10);
        --ch-text: #0A0A0C;
        --ch-text-dim: rgba(10,10,12,0.56);
        --ch-text-subtle: rgba(10,10,12,0.38);
        --ch-accent: #FF6B35;
        --ch-accent2: #FF9466;
        --ch-success: #2F7A3F;
        --ch-success-dim: #DDEBD7;
        --ch-warn: #8A6310;
        --ch-danger: #B8362A;
        --ch-danger-dim: rgba(184,54,42,0.10);
    }

    /* ── Editorial palette — dark ── */
    .dark {
        --ch-bg: #08080B;
        --ch-bg-elev: #0F0F12;
        --ch-surface: #17171C;
        --ch-surface2: #1E1E24;
        --ch-border: rgba(255,255,255,0.06);
        --ch-border-strong: rgba(255,255,255,0.10);
        --ch-text: #F5F5F7;
        --ch-text-dim: rgba(245,245,247,0.62);
        --ch-text-subtle: rgba(245,245,247,0.38);
        --ch-accent: #FF6B35;
        --ch-accent2: #FF9466;
        --ch-success: #6BE08A;
        --ch-success-dim: rgba(107,224,138,0.14);
        --ch-warn: #F5B849;
        --ch-danger: #F06A5E;
        --ch-danger-dim: rgba(240,106,94,0.14);
    }

    /* ── Mobile font + background override ── */
    *, *::before, *::after { font-family: var(--ch-font-sans) !important; }
    body { background: var(--ch-bg) !important; color: var(--ch-text) !important; }

    /* ── Tab bar — Editorial pill style ── */
    .mobile-tab-bar {
        display: flex;
        gap: 8px;
        padding: 12px 16px;
        flex-shrink: 0;
        background: var(--ch-bg);
        border-bottom: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .dark .mobile-tab-bar {
        background: var(--ch-bg);
        border-bottom: none;
    }

    /* ── Tab bar well (light: grey pill container) ── */
    .mobile-tab-bar {
        display: flex;
        padding: 0 16px 14px;
        gap: 0;
    }
    .mobile-tab-bar-inner {
        display: flex;
        flex: 1;
        gap: 3px;
        padding: 4px;
        background: #F8F8F8;
        border-radius: 14px;
    }
    .dark .mobile-tab-bar-inner {
        gap: 6px;
        padding: 0;
        background: transparent;
        border-radius: 0;
    }

    .mobile-tab-btn {
        flex: 1;
        padding: 9px 12px;
        min-height: 38px;
        border-radius: 10px;
        font-size: 13px;
        font-weight: 500;
        letter-spacing: -0.1px;
        text-align: center;
        cursor: pointer;
        transition: all 0.15s;
        background: transparent;
        border: none;
        color: var(--ch-text-dim);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: none;
    }

    .dark .mobile-tab-btn {
        background: #17171C;
        border: 1px solid rgba(255,255,255,0.06);
        color: rgba(245,245,247,0.38);
        border-radius: 12px;
        padding: 10px 12px;
    }

    /* Active — light: white pill with shadow */
    .mobile-tab-btn.active {
        background: #FFFFFF;
        color: #0A0A0C;
        border: none;
        font-weight: 600;
        box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    }

    .dark .mobile-tab-btn.active {
        background: var(--ch-text);
        color: var(--ch-bg);
        border-color: transparent;
        box-shadow: none;
    }

    /* ── Header — Editorial style ── */
    .app-header {
        background: var(--ch-bg) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border-bottom: none !important;
        box-shadow: none !important;
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }

    /* Show SVG logo, hide text logo on mobile */
    #header-text-logo { display: none !important; }
    #header-logo { display: flex !important; }

    /* Hide logo options button on mobile */
    #logo-options-btn { display: none !important; }

    /* Hide desktop theme toggle, show mobile theme pill */
    #theme-toggle-desktop { display: none !important; }
    #mobile-theme-toggle { display: block !important; }

    /* Restyle existing hamburger to match UI-new.html iconBtn */
    #mobile-menu-btn {
        width: 36px !important;
        height: 36px !important;
        border-radius: 10px !important;
        background: transparent !important;
        border: 1px solid var(--ch-border) !important;
        color: var(--ch-text) !important;
    }
    #mobile-menu-btn svg {
        width: 18px !important;
        height: 18px !important;
    }

    /* Hide all desktop nav buttons on mobile */
    .header-desktop-nav { display: none !important; }
    #more-dropdown-wrapper { display: none !important; }
    #user-dropdown-wrapper { display: none !important; }

    /* ── pos-layout becomes a positioned shell ── */
    .pos-layout {
        display: block;
        position: relative;
        overflow: hidden;
        padding: 0;
        gap: 0;
        background: var(--ch-bg);
    }

    /* All panels hidden by default; JS adds .mobile-active to show one */
    #tables-section,
    #menu-section,
    #order-panel,
    #order-type-panel {
        display: none;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        position: absolute !important;
        inset: 0;
        width: auto;
        height: auto;
        flex-direction: column;
        transition: transform 0.3s ease, opacity 0.3s ease;
        background: var(--ch-bg) !important;
    }

    /* Active panel */
    .mobile-active {
        display: flex !important;
        transform: translateX(0) !important;
        opacity: 1 !important;
    }

    /* Slide direction classes */
    .mobile-slide-from-right {
        display: flex !important;
        transform: translateX(100%);
        opacity: 0;
    }
    .mobile-slide-from-left {
        display: flex !important;
        transform: translateX(-100%);
        opacity: 0;
    }
    .mobile-slide-out-left {
        display: flex !important;
        transform: translateX(-100%);
        opacity: 0;
    }
    .mobile-slide-out-right {
        display: flex !important;
        transform: translateX(100%);
        opacity: 0;
    }

    /* Mobile order modal slide-up — Editorial bottom-sheet */
    #mobile-order-modal {
        transform: translateY(100%);
        transition: transform 0.3s ease;
        background: var(--ch-bg-elev) !important;
        backdrop-filter: none !important;
        border-radius: var(--ch-radius-panel) var(--ch-radius-panel) 0 0 !important;
        top: 48px !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
    }
    #mobile-order-modal.mobile-modal-visible {
        transform: translateY(0);
    }
    #mobile-order-modal > header {
        border-bottom: none !important;
        padding: 16px !important;
        position: relative;
    }
    /* Drag handle */
    #mobile-order-modal > header::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--ch-border-strong);
    }
    #mobile-order-modal #mobile-order-title {
        color: var(--ch-text) !important;
        font-size: 15px !important;
        font-weight: 600 !important;
    }
    #mobile-order-modal #mobile-order-close-btn {
        background: var(--ch-surface) !important;
        border-color: var(--ch-border) !important;
        color: var(--ch-text) !important;
    }
    #mobile-order-modal #mobile-order-items {
        background: var(--ch-bg-elev) !important;
        padding: 8px 16px !important;
    }
    #mobile-order-modal > footer {
        border-top: none !important;
        background: var(--ch-bg-elev) !important;
        padding: 12px 16px !important;
    }
    /* Action toolbar Editorial style */
    #mobile-order-actions {
        border-bottom: none !important;
        background: var(--ch-bg-elev) !important;
        padding: 8px 16px !important;
    }
    .mobile-action-btn {
        border-radius: var(--ch-radius-btn) !important;
    }
    /* Footer buttons Editorial style */
    #mobile-order-add-btn {
        background: var(--ch-accent) !important;
        border-color: transparent !important;
        border-radius: var(--ch-radius-btn) !important;
        font-size: 14px !important;
        height: 44px !important;
    }
    #mobile-order-clear-btn {
        border-radius: var(--ch-radius-btn) !important;
        font-size: 14px !important;
        height: 44px !important;
        border-color: var(--ch-danger) !important;
        color: var(--ch-danger) !important;
    }
    #mobile-order-send-btn {
        border-radius: var(--ch-radius-btn) !important;
        font-size: 14px !important;
        height: 44px !important;
    }
    #mobile-order-tables-btn {
        background: var(--ch-surface2) !important;
        border-color: var(--ch-border) !important;
        border-radius: var(--ch-radius-btn) !important;
        font-size: 14px !important;
        height: 44px !important;
        color: var(--ch-text) !important;
    }

    #mobile-done-bar {
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }
    #mobile-done-bar.visible {
        display: block !important;
        transform: translateY(0);
    }

    /* ── Tables section — Editorial ── */
    #tables-section {
        background: var(--ch-bg) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    #tables-section > header {
        background: var(--ch-bg) !important;
        backdrop-filter: none !important;
        border-bottom: none !important;
        padding: 12px 16px !important;
        height: auto !important;
    }
    #tables-section > header h2 {
        font-size: 28px !important;
        font-weight: 700 !important;
        letter-spacing: -0.5px !important;
        color: var(--ch-text) !important;
    }
    /* Header action buttons — light mode */
    html:not(.dark) #tables-section > header button {
        background: var(--ch-surface) !important;
        border-color: var(--ch-border-strong) !important;
        color: var(--ch-text-dim) !important;
        box-shadow: 0 1px 2px rgba(0,0,0,0.06) !important;
    }
    #tables-container {
        padding: 12px 16px !important;
        gap: 10px !important;
        flex-direction: column !important;
        background: var(--ch-bg) !important;
    }

    /* ── Menu section — Editorial ── */
    #menu-section {
        background: var(--ch-bg) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    #menu-section > header {
        background: var(--ch-bg) !important;
        backdrop-filter: none !important;
        border-bottom: none !important;
        padding-top: 0 !important;
        color: var(--ch-text) !important;
    }
    html:not(.dark) #menu-search-mobile {
        box-shadow: 0 1px 2px rgba(0,0,0,0.06) !important;
    }
    /* Hide desktop "Menu" title and divider on mobile */
    #menu-section-title { display: none !important; }
    #menu-header-divider { display: none !important; }
    /* Mobile menu label — matches table name style from dashboard */
    #mobile-menu-chair-label {
        font-size: 22px;
        font-weight: 700;
        color: var(--ch-text);
        letter-spacing: -0.5px;
        line-height: 1;
    }
    /* Reduce header row height and search bar gap on mobile */
    #menu-section > header > .flex { height: auto !important; min-height: 40px; padding-top: 8px; padding-bottom: 4px; }
    .menu-mobile-search { padding-bottom: 8px !important; }
    #products-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding: 12px 16px !important;
        padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
        background: var(--ch-bg) !important;
        flex: 1 1 0% !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Mobile done bar — Editorial style */
    #mobile-done-bar {
        background: var(--ch-bg) !important;
        border-top: none !important;
        backdrop-filter: none !important;
    }
    #mobile-done-btn {
        background: var(--ch-surface2) !important;
        border-color: var(--ch-border-strong) !important;
        border-radius: var(--ch-radius-btn) !important;
        color: var(--ch-text) !important;
        box-shadow: 0 1px 2px rgba(0,0,0,0.06) !important;
    }
    #mobile-prev-btn, #mobile-next-btn {
        background: var(--ch-surface) !important;
        border-color: var(--ch-border-strong) !important;
        border-radius: var(--ch-radius-btn) !important;
        color: var(--ch-text) !important;
        box-shadow: 0 1px 2px rgba(0,0,0,0.06) !important;
    }
    #mobile-menu-send-btn {
        background: var(--ch-surface) !important;
        border-radius: var(--ch-radius-btn) !important;
        color: var(--ch-text) !important;
        border-color: var(--ch-success) !important;
    }

    /* Mobile search + dropdown — Editorial */
    #section-dropdown-btn-mobile {
        background: transparent !important;
        border: none !important;
        backdrop-filter: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        color: var(--ch-text) !important;
    }
    #menu-search-mobile {
        background: var(--ch-surface) !important;
        border-color: var(--ch-border) !important;
        border-radius: var(--ch-radius-btn) !important;
        color: var(--ch-text) !important;
        backdrop-filter: none !important;
    }
    #mobile-seat-label-bar {
        padding: 14px 16px 10px !important;
    }
    .chair-pills-header {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 10px;
    }
    .chair-pills-back {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 8px;
        background: var(--ch-surface2);
        border: 1px solid var(--ch-border);
        color: var(--ch-text);
        cursor: pointer;
        transition: background 0.15s ease;
    }
    .chair-pills-back:active {
        background: var(--ch-border);
    }
    .chair-pills-table-name {
        font-size: 22px;
        font-weight: 700;
        color: var(--ch-text);
        letter-spacing: -0.5px;
        line-height: 1;
    }
    .chair-pills-wrap {
        display: flex;
        gap: 6px;
    }
    .chair-pill {
        flex: 1;
        padding: 10px 14px;
        border-radius: 9999px;
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        white-space: nowrap;
        text-align: center;
        border: 1px solid var(--ch-border);
        background: var(--ch-surface2);
        color: var(--ch-text-subtle);
        cursor: pointer;
        transition: all 0.15s ease;
    }
    .chair-pill-active {
        background: rgba(255,107,53,0.09);
        border-color: rgba(255,107,53,0.21);
        color: var(--ch-accent);
    }

    /* Desktop action buttons (+ Product, ⋮) already hidden by .menu-desktop-only rule */

    /* Hide order-type panel header and dine-in/takeout toggle on mobile (handled by mobile tab bar) */
    #order-type-panel > header { display: none !important; }
    #order-type-panel > .p-4.space-y-3 > .flex.gap-2 { display: none !important; }

    /* Hide cash drawer on mobile */
    #cash-drawer-footer { display: none !important; }

    /* ── Take Out / Order panel — Editorial ── */
    #order-type-panel {
        background: var(--ch-bg) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    #order-type-panel > .p-4.space-y-3 {
        background: var(--ch-bg) !important;
    }
    #dinein-plates-list {
        background: var(--ch-bg) !important;
    }
    #takeaway-orders-list {
        background: var(--ch-bg) !important;
        padding: 12px 16px !important;
    }
    #takeout-order-btn {
        border-radius: var(--ch-radius-btn) !important;
    }
    #takeaway-search {
        background: var(--ch-surface) !important;
        border-color: var(--ch-border-strong) !important;
        border-radius: var(--ch-radius-btn) !important;
        color: var(--ch-text) !important;
    }
    html:not(.dark) #takeaway-search {
        box-shadow: 0 1px 2px rgba(0,0,0,0.06) !important;
    }
    /* Order panel (right side item list) */
    #order-panel {
        background: var(--ch-bg) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    html:not(.dark) #order-panel > header {
        background: var(--ch-bg) !important;
        border-bottom: none !important;
    }
    html:not(.dark) #item-action-bar {
        background: var(--ch-bg) !important;
        border-top: 1px solid var(--ch-border-strong) !important;
    }

    /* Hide ambient gradient on mobile */
    body > .absolute.inset-0.pointer-events-none { display: none !important; }

    /* ── Category grid tiles (menu landing) ── */
    .cat-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        grid-column: 1 / -1; /* span full width inside products-container grid */
    }
    .cat-grid-tile {
        position: relative;
        text-align: left;
        cursor: pointer;
        border: none;
        padding: 18px;
        border-radius: 16px;
        color: #fff;
        min-height: 108px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.12s ease, box-shadow 0.12s ease;
    }
    .cat-grid-tile:active {
        transform: scale(0.97);
    }
    .cat-grid-icon {
        width: 32px;
        height: 32px;
        border-radius: 10px;
        background: rgba(255,255,255,0.22);
        display: grid;
        place-items: center;
    }
    .cat-grid-label {
        font-size: 18px;
        font-weight: 700;
        letter-spacing: -0.4px;
        line-height: 1;
    }
    .cat-grid-count {
        font-size: 11px;
        opacity: 0.82;
        margin-top: 4px;
        letter-spacing: 0.1px;
    }

    /* ── Table card chair chips ── */
    .table-chair-chip {
        padding: 10px 4px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: default;
        /* light: white pill with shadow */
        background: #FFFFFF;
        border: none;
        box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    }
    .dark .table-chair-chip {
        background: var(--ch-surface2);
        border: 1px solid var(--ch-border);
        box-shadow: none;
    }
    .table-chair-chip--active {
        background: rgba(255,107,53,0.16);
        border: none;
        box-shadow: none;
    }
    .dark .table-chair-chip--active {
        background: rgba(255,107,53,0.09);
        border: 1px solid rgba(255,107,53,0.35);
        box-shadow: none;
    }
    .table-chair-chip__label {
        font-size: 10px;
        color: var(--ch-text-subtle);
        text-transform: uppercase;
        font-weight: 600;
        letter-spacing: 0.4px;
    }
    .table-chair-chip--active .table-chair-chip__label {
        color: var(--ch-accent);
    }

    /* Admin Release chip — red tint, same chip metrics */
    .table-release-chip {
        background: rgba(220,38,38,0.10) !important;
        border: none !important;
        box-shadow: none !important;
    }
    .dark .table-release-chip {
        background: rgba(220,38,38,0.10) !important;
        border: 1px solid rgba(220,38,38,0.35) !important;
        box-shadow: none !important;
    }
    .table-release-chip .table-chair-chip__label {
        color: #dc2626 !important;
    }
    .dark .table-release-chip .table-chair-chip__label {
        color: #f87171 !important;
    }

    /* Admin Transfer chip — blue tint, same chip metrics */
    .table-transfer-chip {
        background: rgba(59,130,246,0.10) !important;
        border: none !important;
        box-shadow: none !important;
    }
    .dark .table-transfer-chip {
        background: rgba(59,130,246,0.10) !important;
        border: 1px solid rgba(59,130,246,0.35) !important;
        box-shadow: none !important;
    }
    .table-transfer-chip .table-chair-chip__label {
        color: #2563eb !important;
    }
    .dark .table-transfer-chip .table-chair-chip__label {
        color: #60a5fa !important;
    }

    /* Admin "+" add-category tile */
    .cat-grid-add {
        background: transparent !important;
        border: 2px dashed var(--ch-border-strong) !important;
        box-shadow: none !important;
        color: var(--ch-text-subtle);
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
    .dark .cat-grid-add {
        border-color: rgba(255,255,255,0.15) !important;
        color: rgba(255,255,255,0.5);
    }

    /* Admin ⋮ dots button on category tiles */
    .cat-grid-dots {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 28px;
        height: 28px;
        border-radius: 8px;
        background: rgba(0,0,0,0.2);
        border: none;
        cursor: pointer;
        display: grid;
        place-items: center;
        z-index: 2;
        -webkit-tap-highlight-color: transparent;
        transition: background 0.15s;
    }
    .cat-grid-dots:active {
        background: rgba(0,0,0,0.4);
    }

    /* When showing category grid, override products-container grid layout */
    #products-container:has(.cat-grid) {
        display: block !important;
        padding: 12px 16px !important;
    }
}

/* ── Category edit modal — swatch & icon picker ────────────────── */
.cat-edit-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s;
    padding: 0;
}
.cat-edit-swatch:active { transform: scale(0.92); }
.cat-edit-swatch.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.6);
}

.cat-edit-icon-btn {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    transition: all 0.12s;
}
.cat-edit-icon-btn:active { transform: scale(0.92); }
.cat-edit-icon-btn.active {
    background: rgba(59,130,246,0.2);
    border-color: rgba(59,130,246,0.5);
    color: #60a5fa;
}
/* Light mode overrides */
:root .cat-edit-icon-btn {
    border-color: rgba(0,0,0,0.1);
    background: rgba(0,0,0,0.04);
    color: #9ca3af;
}
:root .cat-edit-icon-btn.active {
    background: rgba(59,130,246,0.12);
    border-color: rgba(59,130,246,0.4);
    color: #2563eb;
}
.dark .cat-edit-swatch.active {
    border-color: #fff;
}
@keyframes takeoutReadyPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* ── Takeout action chips (Delay / Note / Split / Move) ───── */
/* Default (dark mode via .dark on <html>): transparent chips with bordered well */
.takeout-action-chips {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 4px;
    margin: 8px 12px;
    border-radius: 14px;
    background: transparent;
}
.takeout-action-chips.takeout-mode {
    grid-template-columns: repeat(2, 1fr);
}
.takeout-chip {
    padding: 9px 6px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid var(--ch-border, rgba(255,255,255,0.06));
    box-shadow: none;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.1px;
    cursor: pointer;
    transition: background 150ms, border-color 150ms, color 150ms, opacity 150ms;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.takeout-chip:disabled {
    opacity: 0.5;
    cursor: default;
}
.takeout-chip:not(:disabled):hover { background: rgba(255,255,255,0.04); }

/* Light mode: grey well + raised white pills */
html:not(.dark) .takeout-action-chips {
    background: #E7E7E3;
}
html:not(.dark) .takeout-chip {
    background: #FFFFFF;
    border: none;
    padding: 7px 6px;
    font-size: 11px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
}
html:not(.dark) .takeout-chip:disabled {
    box-shadow: none;
    background: transparent;
}
html:not(.dark) .takeout-chip:not(:disabled):hover { background: #F3F4F6; }

.takeout-chip-warn    { color: var(--ch-warn); }
.takeout-chip-dim     { color: var(--ch-text-subtle); }
.takeout-chip-accent  { color: var(--ch-accent); }
.takeout-chip-success { color: var(--ch-success); }

/* ── Takeout + New Order button ───── */
.takeout-new-order-btn {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--ch-accent) 14%, transparent);
    color: var(--ch-accent);
    border: 1px solid color-mix(in srgb, var(--ch-accent) 55%, transparent);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.2px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 150ms;
}
.takeout-new-order-btn:hover {
    background: color-mix(in srgb, var(--ch-accent) 22%, transparent);
}

/* ── Takeout search input ───── */
.takeout-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--ch-surface, rgba(255,255,255,0.05));
    border: 1px solid var(--ch-border, rgba(255,255,255,0.10));
}
.takeout-search-icon {
    color: #a1a1aa;
    flex-shrink: 0;
}
.takeout-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: inherit;
    font-family: inherit;
    font-size: 13px;
    letter-spacing: -0.1px;
    min-width: 0;
    padding: 0;
    text-align: left;
}
.takeout-search-input::placeholder {
    color: #71717a;
}
.takeout-search-clear {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    padding: 0;
    background: color-mix(in srgb, currentColor 10%, transparent);
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: #a1a1aa;
    flex-shrink: 0;
}

/* ──────────────────────────────────────────────────────────────
   Tablet landscape (iPad / iPad Air 10.86" — 1180×820)
   Range: 1024–1280px landscape only.
   Excludes: phones, tablet portrait, iPad Pro 12.9+ (≥1366px),
   and all desktop sizes — they keep their existing styling.
   PHASE 1: palette + outer chrome only. No layout/component changes.
   ────────────────────────────────────────────────────────────── */
@media (min-width: 1024px) and (max-width: 1280px) and (orientation: landscape) {

    /* Editorial palette — light (matches UI-tablet.html palette()) */
    :root {
        --ch-bg: #FFFFFF;
        --ch-bg-elev: #FFFFFF;
        --ch-surface: #F8F8F8;
        --ch-surface2: #E7E7E3;
        --ch-border: transparent;
        --ch-border-strong: rgba(10,10,12,0.10);
        --ch-text: #0A0A0C;
        --ch-text-dim: rgba(10,10,12,0.56);
        --ch-text-subtle: rgba(10,10,12,0.38);
        --ch-accent: #FF6B35;
        --ch-accent2: #FF9466;
        --ch-success: #2F7A3F;
        --ch-success-dim: #DDEBD7;
        --ch-warn: #8A6310;
        --ch-danger: #B8362A;
        --ch-danger-dim: rgba(184,54,42,0.10);
    }

    /* Editorial palette — dark */
    .dark {
        --ch-bg: #08080B;
        --ch-bg-elev: #0F0F12;
        --ch-surface: #17171C;
        --ch-surface2: #1E1E24;
        --ch-border: rgba(255,255,255,0.06);
        --ch-border-strong: rgba(255,255,255,0.10);
        --ch-text: #F5F5F7;
        --ch-text-dim: rgba(245,245,247,0.62);
        --ch-text-subtle: rgba(245,245,247,0.38);
        --ch-accent: #FF6B35;
        --ch-accent2: #FF9466;
        --ch-success: #6BE08A;
        --ch-success-dim: rgba(107,224,138,0.14);
        --ch-warn: #F5B849;
        --ch-danger: #F06A5E;
        --ch-danger-dim: rgba(240,106,94,0.14);
    }

    /* Body background + font */
    body {
        background: var(--ch-bg) !important;
        color: var(--ch-text) !important;
    }

    /* Round the three panes (Phase 1: paint only — keep existing grid layout) */
    .pos-layout > #order-type-panel,
    .pos-layout > #tables-section,
    .pos-layout > #menu-section {
        border-radius: 16px !important;
        background: var(--ch-bg-elev) !important;
        border: 1px solid var(--ch-border) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
    }

    /* Light-mode panes get a subtle elevation shadow (matches UI-tablet.html) */
    html:not(.dark) .pos-layout > #order-type-panel,
    html:not(.dark) .pos-layout > #tables-section,
    html:not(.dark) .pos-layout > #menu-section {
        box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.03) !important;
        border-color: var(--ch-border-strong) !important;
    }

    /* Hide the ambient gradient background overlay (clutter on tablet) */
    body > .absolute.inset-0.pointer-events-none { display: none !important; }

    /* ── PHASE 2A: Chair buttons (compact pill chips) ──────────
       Matches UI-tablet.html chair chip design: small uppercase
       pill, 3 states (idle / has-items / selected).
       Targets the existing .chair-btn elements rendered in pos.js.
       ───────────────────────────────────────────────────────── */
    .chair-btn {
        /* Reset the 101px tile look from Tailwind classes */
        height: auto !important;
        min-height: 0 !important;
        padding: 7px 11px !important;
        border-radius: 8px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-direction: row !important;
        gap: 0 !important;
        font-size: 16px !important;
        font-weight: 700 !important;
        letter-spacing: 0.4px !important;
        text-transform: uppercase !important;
        line-height: 1 !important;
        /* Idle (empty chair) */
        background: var(--ch-surface2) !important;
        color: var(--ch-text-dim) !important;
        border: 1px solid var(--ch-border) !important;
        box-shadow: none !important;
    }
    html:not(.dark) .chair-btn {
        background: #FFFFFF !important;
        box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04) !important;
        border-color: transparent !important;
    }

    /* Has items (orange tint) — matches active chip in mobile too */
    .chair-btn.ring-orange-400\/60,
    .chair-btn.ring-orange-400\/70,
    .chair-btn.border-orange-400\/60,
    .chair-btn.border-orange-400\/70 {
        background: rgba(255,107,53,0.12) !important;
        color: var(--ch-accent) !important;
        border-color: rgba(255,107,53,0.35) !important;
        box-shadow: none !important;
    }

    /* Selected chair (solid accent fill) */
    .chair-btn.chair-selected,
    .chair-btn[data-selected="true"] {
        background: var(--ch-accent) !important;
        color: #FFFFFF !important;
        border-color: transparent !important;
        box-shadow: none !important;
    }

    /* Hide internal big-tile content (icons / multi-line layouts) */
    .chair-btn > svg,
    .chair-btn .chair-remove-btn,
    .chair-btn [data-chair-meta] {
        display: none !important;
    }

    /* Make chair container wrap horizontally instead of grid */
    .chair-btn-grid,
    [class*="grid-cols"]:has(> .chair-btn) {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    /* ── PHASE 2B: Header nav (pill-well, text-only) ──────────
       Matches UI-tablet.html TabletTopBar: flat pills, no icons,
       active = white pill with subtle shadow (light) / lifted bg (dark).
       ───────────────────────────────────────────────────────── */
    /* Hide icons inside nav buttons */
    .header-desktop-nav > svg,
    .header-desktop-nav svg.w-4 {
        display: none !important;
    }

    /* Reset the per-button Tailwind background/border to flat */
    .header-desktop-nav {
        padding: 8px 12px !important;
        border-radius: 8px !important;
        font-size: 15px !important;
        font-weight: 500 !important;
        letter-spacing: -0.1px !important;
        background: transparent !important;
        border: none !important;
        color: var(--ch-text-dim) !important;
        box-shadow: none !important;
        gap: 0 !important;
        white-space: nowrap !important;
    }

    /* Show all overflow nav items inline (no More dropdown needed at tablet) */
    .large-desktop-only.header-desktop-nav { display: inline-flex !important; }
    /* Hide the More dropdown — its items are now visible in the well */
    #more-dropdown-wrapper { display: none !important; }
    .header-desktop-nav:hover {
        background: var(--ch-surface) !important;
        color: var(--ch-text) !important;
    }

    /* Header layout: stretch nav-actions wrapper to fill space between logo and right controls */
    .app-header {
        justify-content: flex-start !important;
        gap: 12px !important;
    }
    .app-header > div:nth-child(2) {
        /* The "Nav & actions" wrapper — make it fill remaining horizontal space */
        flex: 1 !important;
    }

    /* Pill-well wrapper around nav buttons (matches UI-tablet.html) */
    #nav-pill-well {
        display: flex !important;
        flex: 1 !important;
        gap: 3px !important;
        padding: 4px !important;
        border-radius: 12px !important;
        background: var(--ch-surface) !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
    .dark #nav-pill-well {
        background: rgba(255,255,255,0.04) !important;
    }

    /* Active nav button — orange text + lifted pill bg */
    .header-desktop-nav.is-active {
        background: #FFFFFF !important;
        color: var(--ch-accent) !important;
        font-weight: 600 !important;
        box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04) !important;
    }
    .dark .header-desktop-nav.is-active {
        background: rgba(255,255,255,0.10) !important;
        color: var(--ch-accent) !important;
        box-shadow: none !important;
    }

    /* "More" dropdown button uses different selector */
    #more-dropdown-btn {
        padding: 11px 17px !important;
        border-radius: 10px !important;
        font-size: 17px !important;
        font-weight: 500 !important;
        background: transparent !important;
        border: none !important;
        color: var(--ch-text-dim) !important;
        box-shadow: none !important;
    }
    #more-dropdown-btn:hover {
        background: var(--ch-surface) !important;
        color: var(--ch-text) !important;
    }
    #more-dropdown-btn > svg {
        /* Keep the chevron, just shrink it */
        width: 14px !important;
        height: 14px !important;
        display: inline-block !important;
    }

    /* ── Table chair chips (match mobile editorial style) ── */
    .table-chair-chip {
        padding: 10px 4px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: default;
        background: #FFFFFF;
        border: none;
        box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    }
    .dark .table-chair-chip {
        background: var(--ch-surface2);
        border: 1px solid var(--ch-border);
        box-shadow: none;
    }
    .table-chair-chip--active {
        background: rgba(255,107,53,0.16);
        border: none;
        box-shadow: none;
    }
    .dark .table-chair-chip--active {
        background: rgba(255,107,53,0.09);
        border: 1px solid rgba(255,107,53,0.35);
        box-shadow: none;
    }
    .table-chair-chip__label {
        font-size: 12px;
        color: var(--ch-text-subtle);
        text-transform: uppercase;
        font-weight: 600;
        letter-spacing: 0.4px;
    }
    .table-chair-chip--active .table-chair-chip__label {
        color: var(--ch-accent);
    }

    /* Tablet receiving-mode chair chip — green (ChowHub logo dot) */
    .table-chair-chip {
        cursor: pointer !important;
    }
    .table-chair-chip--receiving {
        background: rgba(34,197,94,0.16) !important;
        border: none !important;
        box-shadow: none !important;
    }
    .dark .table-chair-chip--receiving {
        background: rgba(34,197,94,0.10) !important;
        border: 1px solid rgba(34,197,94,0.45) !important;
        box-shadow: none !important;
    }
    .table-chair-chip--receiving .table-chair-chip__label {
        color: #22c55e !important;
    }

    /* Admin Release chip — red tint, same chip metrics */
    .table-release-chip {
        background: rgba(220,38,38,0.10) !important;
        border: none !important;
        box-shadow: none !important;
    }
    .dark .table-release-chip {
        background: rgba(220,38,38,0.10) !important;
        border: 1px solid rgba(220,38,38,0.35) !important;
        box-shadow: none !important;
    }
    .table-release-chip .table-chair-chip__label {
        color: #dc2626 !important;
    }
    .dark .table-release-chip .table-chair-chip__label {
        color: #f87171 !important;
    }

    /* Admin Transfer chip — blue tint, same chip metrics */
    .table-transfer-chip {
        background: rgba(59,130,246,0.10) !important;
        border: none !important;
        box-shadow: none !important;
    }
    .dark .table-transfer-chip {
        background: rgba(59,130,246,0.10) !important;
        border: 1px solid rgba(59,130,246,0.35) !important;
        box-shadow: none !important;
    }
    .table-transfer-chip .table-chair-chip__label {
        color: #2563eb !important;
    }
    .dark .table-transfer-chip .table-chair-chip__label {
        color: #60a5fa !important;
    }

    /* ── Menu section header: keep mobile-style search bar on tablet ──
       Hide only the duplicate "Menu" chair label span (not the whole .menu-mobile-only back-button div).
       The mobile search bar (.menu-mobile-search) stays visible for category drill-down.
       ────────────────────────────────────────────── */
    #mobile-menu-chair-label { display: none !important; }
    #menu-section-title { display: none !important; }
    #menu-header-divider { display: none !important; }
    #mobile-seat-label-bar { display: none !important; }

    /* Order panel Send button — orange editorial style */
    #dinein-type-send-btn {
        background: var(--ch-accent) !important;
        color: #fff !important;
        border: none !important;
        border-radius: 16px !important;
        height: 56px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
    }
    /* Hide redundant Clear button on tablet — users can adjust via stepper */
    #dinein-type-clear-btn { display: none !important; }
    /* Back button: uncollapse menu-header-row when visible, render inline
       at the right side of the row. JS already toggles .hidden so it only
       shows inside a sub-category — never on the main cat-grid. */
    #menu-header-row:has(#section-dropdown-btn-mobile:not(.hidden)) {
        height: auto !important;
        min-height: 0 !important;
        padding: 8px 16px !important;
    }
    #section-dropdown-btn-mobile:not(.hidden) {
        margin-left: auto !important;
        padding: 6px 10px !important;
        background: var(--ch-surface) !important;
        border-radius: 10px !important;
    }
    #menu-header-row {
        height: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        border: none !important;
    }
    .menu-mobile-search {
        padding-top: 16px !important;
        padding-bottom: 16px !important;
    }

    /* products-container: switch to flex column so cat-grid can fill full width */
    #products-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        padding: 12px 16px !important;
        overflow-y: auto !important;
    }
    /* Cat-grid fills the full products-container width */
    .cat-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        width: 100% !important;
        flex-shrink: 0 !important;
    }
    .cat-grid-tile {
        position: relative;
        text-align: left;
        cursor: pointer;
        border: none;
        padding: 18px;
        border-radius: 16px;
        color: #fff;
        min-height: 108px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.12s ease, box-shadow 0.12s ease;
    }
    .cat-grid-tile:active {
        transform: scale(0.97);
    }
    .cat-grid-icon {
        width: 32px;
        height: 32px;
        border-radius: 10px;
        background: rgba(255,255,255,0.22);
        display: grid;
        place-items: center;
    }
    .cat-grid-label {
        font-size: 18px;
        font-weight: 700;
        letter-spacing: -0.4px;
        line-height: 1;
    }
    .cat-grid-count {
        font-size: 11px;
        opacity: 0.82;
        margin-top: 4px;
        letter-spacing: 0.1px;
    }
    .cat-grid-add {
        background: transparent !important;
        border: 2px dashed var(--ch-border-strong) !important;
        box-shadow: none !important;
        color: var(--ch-text-subtle);
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
    .dark .cat-grid-add {
        border-color: rgba(255,255,255,0.15) !important;
        color: rgba(255,255,255,0.5);
    }
    .cat-grid-dots {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 28px;
        height: 28px;
        border-radius: 8px;
        background: rgba(0,0,0,0.2);
        border: none;
        cursor: pointer;
        display: grid;
        place-items: center;
        z-index: 2;
        -webkit-tap-highlight-color: transparent;
    }

    /* ── 3-panel layout (Order | Tables | Menu) ──
       Replaces the menu-drawer pattern. Menu sits beside Tables instead of
       hiding behind a yellow tab.
       ────────────────────────────────────────────── */
    .pos-layout:not(.floorplan-active):not(.takeaway-active) {
        grid-template-columns: 1fr 1.4fr 1fr !important;
    }
    /* Restore #menu-section into the grid flow (override drawer-mode positioning) */
    .pos-layout:not(.floorplan-active):not(.takeaway-active) > #menu-section {
        position: static !important;
        transform: none !important;
        width: auto !important;
        box-shadow: none !important;
        z-index: auto !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        grid-column: auto !important;
        grid-row: auto !important;
        display: flex !important;
    }
    /* Hide drawer-related UI (yellow tab + backdrop) */
    #menu-drawer-tab,
    #menu-drawer-backdrop {
        display: none !important;
    }

    /* ── Dine In / Take Out toggle — mobile pill style ── */
    #order-tab-dinein,
    #order-tab-takeaway {
        flex: 1 !important;
        padding: 9px 12px !important;
        min-height: 38px !important;
        border-radius: 10px !important;
        font-size: 13px !important;
        font-weight: 500 !important;
        letter-spacing: -0.1px !important;
        text-align: center !important;
        background: transparent !important;
        border: none !important;
        color: var(--ch-text-dim) !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        transition: all 0.15s !important;
    }
    .dark #order-tab-dinein,
    .dark #order-tab-takeaway {
        background: #17171C !important;
        border: 1px solid rgba(255,255,255,0.06) !important;
        color: rgba(245,245,247,0.38) !important;
        border-radius: 12px !important;
        padding: 10px 12px !important;
    }
    /* Active styles — light: white pill with shadow */
    #order-tab-dinein.bg-green-500\/20,
    #order-tab-takeaway.bg-green-500\/20,
    #order-tab-dinein.bg-amber-500\/20,
    #order-tab-takeaway.bg-amber-500\/20 {
        background: #FFFFFF !important;
        color: #0A0A0C !important;
        border: none !important;
        font-weight: 600 !important;
        box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04) !important;
    }
    .dark #order-tab-dinein.bg-green-500\/20,
    .dark #order-tab-takeaway.bg-green-500\/20,
    .dark #order-tab-dinein.bg-amber-500\/20,
    .dark #order-tab-takeaway.bg-amber-500\/20 {
        background: var(--ch-text) !important;
        color: var(--ch-bg) !important;
        border-color: transparent !important;
        box-shadow: none !important;
    }
    /* Wrap toggle in a tab-bar well — light gray pill container */
    #order-type-panel > header:first-child {
        gap: 3px !important;
        padding: 4px !important;
        background: #F8F8F8 !important;
        border-radius: 14px !important;
        margin: 12px 16px !important;
        height: auto !important;
        border: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    .dark #order-type-panel > header:first-child {
        gap: 6px !important;
        padding: 0 !important;
        background: transparent !important;
        border-radius: 0 !important;
        margin: 12px 16px !important;
    }

    /* Tablet table-panel header icon group (edit / pay / move / reset) */
    #tab-table-header-icons { display: inline-flex !important; }
    .tab-header-icon-btn {
        width: 36px;
        height: 36px;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        background: var(--ch-surface);
        color: var(--ch-text);
        border: 1px solid var(--ch-border-strong);
        transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
    }
    .dark .tab-header-icon-btn {
        background: #1F1F24;
        color: var(--ch-text);
        border: 1px solid rgba(255,255,255,0.06);
    }
    .tab-header-icon-btn:hover { background: var(--ch-surface2); }
    .dark .tab-header-icon-btn:hover { background: #2A2A30; }
    .tab-header-icon-btn:active { transform: scale(0.95); }
    .tab-header-icon-btn[disabled],
    .tab-header-icon-btn.is-disabled {
        opacity: 0.35;
        cursor: not-allowed;
        pointer-events: none;
    }

    /* Floor Plan toggle: show icon, hide text on tablet; circular dark style */
    #toggle-floorplan-btn {
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        border-radius: 999px !important;
        background: #1F1F24 !important;
        color: var(--ch-text) !important;
        border: 1px solid rgba(255,255,255,0.06) !important;
        box-shadow: none !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
    #toggle-floorplan-btn:hover { background: #2A2A30 !important; }
    #toggle-floorplan-btn .tab-fp-btn-text { display: none !important; }
    #toggle-floorplan-btn .tab-fp-btn-icon { display: inline-block !important; }
}

/* Outside the tablet media query: hide tablet-only icons + icon-only floor plan glyph */
#tab-table-header-icons { display: none; }
#toggle-floorplan-btn .tab-fp-btn-icon { display: none; }
