/* ============================================================
   Design System — Token Definitions (AtomPOS v2)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Colors */
    --color-primary:          #f97316;
    --color-primary-hover:    #ea580c;
    --color-primary-active:   #c2410c;
    --color-primary-surface:  rgba(249, 115, 22, 0.12);
    --color-success:          #22c55e;
    --color-success-surface:  rgba(34, 197, 94, 0.12);
    --color-error:            #ef4444;
    --color-error-surface:    rgba(239, 68, 68, 0.12);
    --color-warning:          #f59e0b;
    --color-warning-surface:  rgba(245, 158, 11, 0.12);

    /* Surfaces */
    --color-bg:               #f5f6f8;
    --color-surface:          #ffffff;
    --color-surface-raised:   #ffffff;
    --color-surface-overlay:  rgba(0, 0, 0, 0.50);
    --color-border:           rgba(0, 0, 0, 0.08);
    --color-border-strong:    rgba(0, 0, 0, 0.16);

    /* Text */
    --color-text:             #111318;
    --color-text-secondary:   #6b6f76;
    --color-text-disabled:    #9ca3af;
    --color-text-inverse:     #ffffff;

    /* Typography */
    --font-sans:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --text-xs:        11px;
    --text-sm:        13px;
    --text-base:      15px;
    --text-lg:        17px;
    --text-xl:        20px;
    --text-2xl:       24px;
    --text-3xl:       32px;
    --font-normal:    400;
    --font-medium:    500;
    --font-semibold:  600;
    --font-bold:      700;
    --leading-tight:  1.25;
    --leading-base:   1.5;

    /* Spacing — 4px grid */
    --space-1:   4px;
    --space-2:   8px;
    --space-3:   12px;
    --space-4:   16px;
    --space-5:   20px;
    --space-6:   24px;
    --space-8:   32px;
    --space-10:  40px;
    --space-12:  48px;
    --space-16:  64px;
    --space-20:  80px;

    /* Shadows */
    --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.10);
    --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.14);
    --shadow-xl:  0 20px 60px rgba(0, 0, 0, 0.20);

    /* Border Radius */
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   16px;
    --radius-xl:   24px;
    --radius-full: 9999px;

    /* Touch */
    --touch-target-min: 44px;

    /* Z-index layers */
    --z-sticky:   20;
    --z-fixed:    30;
    --z-overlay:  40;
    --z-modal:    50;
    --z-dropdown: 60;
    --z-toast:    70;
    --z-offline:  80;

    /* Transitions */
    --transition-fast: 80ms ease-out;
    --transition-base: 200ms ease;
    --transition-slow: 300ms cubic-bezier(0.32, 0.72, 0, 1);
}

/* Dark mode overrides */
[data-theme="dark"] {
    --color-bg:              #111318;
    --color-surface:         #1a1d23;
    --color-surface-raised:  #22252c;
    --color-border:          rgba(255, 255, 255, 0.08);
    --color-border-strong:   rgba(255, 255, 255, 0.16);
    --color-text:            #e8eaed;
    --color-text-secondary:  #9aa0ab;
    --color-text-disabled:   #6b6f76;
}

/* Theme transition */
body {
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* Touch feedback utility */
.touch-active {
    transform: scale(0.97) !important;
    opacity: 0.85 !important;
    transition: transform var(--transition-fast) !important;
}

@media (prefers-reduced-motion: reduce) {
    .touch-active {
        transform: none !important;
        opacity: 0.85 !important;
    }
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-border) 25%,
        var(--color-surface-raised) 50%,
        var(--color-border) 75%
    );
    background-size: 400px 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
    from { background-position: -400px 0; }
    to   { background-position:  400px 0; }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
        background: var(--color-border);
    }
}

/* ============================================================
   Reset and Base Styles
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: var(--leading-base);
    transition: background-color 200ms ease, color 200ms ease;
}

html {
    height: 100%;
    /* Default (desktop / mouse): root never scrolls — keeps layout clean, no
       permanent scrollbar gutter. Real content scrolls inside .view. */
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    overflow-x: hidden;
    overscroll-behavior: none;
}

/* Anti pull-to-refresh for native Android WebView wrappers (touch devices only):
   Most wrappers gate pull-to-refresh on WebView.canScrollVertically(-1) ("is the
   page at the very top?"). We keep the root document permanently scrolled ~1px
   from the top — body is 1px taller than the viewport and JS pins scrollTop to 1
   (see pinDocumentScroll) — so the wrapper always sees "can scroll up" and never
   fires the refresh. Scoped to coarse pointers so desktop gets no scrollbar gutter.
   overscroll-behavior:none (above) also blocks Chromium's own overscroll refresh. */
@media (pointer: coarse) {
    html {
        overflow-x: hidden;
        overflow-y: auto;
    }

    body {
        min-height: calc(100% + 1px);
    }
}

/* Global box-sizing — prevents padding/border from causing overflow */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* View Management */
.view {
    /* App-shell scroll model: each active view is the single scroll container,
       so the locked root can't overscroll (kills WebView pull-to-refresh).
       overscroll-behavior-y: contain stops the scroll chain from reaching the
       root at the top/bottom boundary. 100dvh tracks the dynamic viewport so
       the address/nav bars in a WebView don't clip content. */
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

/* App-shell background scroll lock: when a modal overlay or the mobile cart
   sheet is open, lock the active view behind it so the background can't scroll.
   Under the app-shell model the scroller is .view (not body), so the old
   `document.body.style.overflow = 'hidden'` no longer locks the background.
   :has() degrades gracefully to the prior behavior on WebViews without support. */
body:has(.modal[style*="display: flex"]) .view,
body:has(#mobile-cart-sheet.active) .view {
    overflow: hidden;
}

/* Login View */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    font-size: 1rem;
    transition: all 0.2s;
    text-align: center;
}

.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: #1f2937;
}

.eye-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.form-group input:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

/* Buttons */
.btn-primary {
    width: 100%;
    max-width: 400px;
    background-color: #f97316;
    color: white;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.btn-primary:hover:not(:disabled) {
    background-color: #ea580c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.3);
}

.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.4), 0 0 0 4px rgba(249, 115, 22, 0.1);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    color: #6b7280;
    padding: 0.5rem 0.75rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    border: 1px solid rgba(107, 114, 128, 0.3);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: #f9fafb;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: rgba(107, 114, 128, 0.5);
}

.btn-secondary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #e5e7eb;
    color: #1f2937;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.btn-logout:hover {
    background-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-logout:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-payment {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-payment:not(:disabled) {
    background-color: #f97316;
    color: white;
}

.btn-payment:not(:disabled):hover {
    background-color: #ea580c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

.btn-payment:not(:disabled):active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.3);
}

.btn-payment:disabled {
    background-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Spinner */
.spinner {
    width: 1.25rem;
    height: 1.25rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spinner .opacity-25 {
    opacity: 0.25;
}

.spinner .opacity-75 {
    opacity: 0.75;
}

/* Error/Success Messages */
.error-message {
    background-color: #fef2f2;
    border-left: 4px solid #ef4444;
    padding: 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
}

.error-message p {
    color: #b91c1c;
    font-size: 0.875rem;
}

.success-message {
    background-color: #f0fdf4;
    border-left: 4px solid #22c55e;
    padding: 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
}

.success-message p {
    color: #15803d;
    font-size: 0.875rem;
}

/* Header Bar */
.header-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.5rem 1rem;
    transition: transform 0.25s ease;
    will-change: transform;
}

.header-bar.header-hidden {
    transform: translateY(-100%);
}

@media (min-width: 768px) {
    .header-bar {
        padding: 1rem 1.5rem;
    }
}

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

.header-bar h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

@media (min-width: 768px) {
    .header-bar h1 {
        font-size: 1.5rem;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .header-actions {
        gap: 1rem;
    }
}

.header-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #374151;
    text-decoration: none;
    transition: color 0.2s;
}

.header-link:hover {
    color: #111827;
}

.icon {
    width: 1.25rem;
    height: 1.25rem;
}

.header-link-text {
    display: none;
    font-weight: 500;
}

@media (min-width: 640px) {
    .header-link-text {
        display: block;
    }
}

.btn-logout-text {
    display: none;
}

@media (min-width: 640px) {
    .btn-logout-text {
        display: block;
    }
}

/* Home Layout */
.home-layout {
    display: flex;
    flex-direction: column;
}

@media (min-width: 1024px) {
    .home-layout {
        flex-direction: row;
        height: calc(100svh - 73px);
    }
}

/* Category Sidebar */
.category-sidebar {
    position: sticky;
    top: 3.5rem;
    z-index: 20;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    overflow-x: auto;
}

@media (min-width: 600px) {
    .category-sidebar {
        width: 16rem;
        border-bottom: none;
        border-right: 1px solid #e5e7eb;
        overflow-y: auto;
        overflow-x: visible;
    }
}


.search-bar-mobile {
    padding: 0.75rem;
}

@media (min-width: 599px) {
    .search-bar-mobile {
        display: none;
    }
}

.search-bar-mobile input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
}

.search-bar-mobile input:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.5);
}

.category-nav {
    display: flex;
    padding: 0 1rem 0.75rem;
    gap: 0.5rem;
    overflow-x: auto;
}

@media (min-width: 600px) {
    .category-nav {
        flex-direction: column;
        padding: 0;
        overflow-x: visible;
        gap: 0.25rem;
    }
}

.category-btn {
    white-space: nowrap;
    text-align: left;
    padding: 0.5rem 1rem;
    min-height: 44px;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    -webkit-tap-highlight-color: transparent;
}

@media (min-width: 600px) {
    .category-btn {
        width: 100%;
        white-space: normal;
        padding: 0.75rem;
    }
}

.category-btn:hover {
    background-color: #f9fafb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.category-btn:active {
    transform: translateY(0);
}

.category-btn.active {
    background-color: #f3f4f6;
    font-weight: 500;
}

/* Product Grid */
.product-grid-container {
    flex: 1;
    padding: 0.75rem;
}

@media (min-width: 768px) {
    .product-grid-container {
        padding: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .product-grid-container {
        overflow-y: auto;
        overscroll-behavior-y: contain;
    }
}

.product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.product-card {
    background: white;
    border-radius: 0.5rem;
    border: 2px solid transparent;
    padding: 0.75rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    cursor: pointer;
}

@media (min-width: 768px) {
    .product-card {
        padding: 1rem;
    }
}

.product-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.product-card.active {
    border-color: #f97316;
    box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.2), 0 8px 20px rgba(249, 115, 22, 0.15);
}

.product-card h3 {
    font-weight: 700;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    min-height: 2.5rem;
}

.product-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.product-price {
    display: flex;
    align-items: center;
}

.product-price-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
}

.product-price-unit {
    font-size: 0.875rem;
    color: #6b7280;
    margin-left: 0.25rem;
}

.product-add-btn {
    background-color: #f3f4f6;
    color: #374151;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 768px) {
    .product-add-btn {
        padding: 0.5rem 1rem;
    }
}

.product-add-btn:hover {
    background-color: #e5e7eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-add-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.product-add-btn.active {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
}

.product-add-btn.active:hover {
    background: linear-gradient(135deg, #ea580c, #c2410c);
}

/* Cart Sidebar (Desktop) */
.cart-sidebar {
    display: none;
    width: 24rem;
    background: white;
    border-left: 1px solid #e5e7eb;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .cart-sidebar {
        display: flex;
    }
}

.cart-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.cart-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.cart-clear-btn {
    font-size: 0.875rem;
    color: #4b5563;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
    min-height: 36px;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    -webkit-tap-highlight-color: transparent;
}

.cart-clear-btn:hover {
    color: #111827;
    transform: scale(1.05);
}

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

.cart-items {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    padding: 1rem;
    /*display: flex;*/
    flex-direction: column;
    gap: 1rem;
}

.cart-empty {
    text-align: center;
    color: #6b7280;
    padding: 2rem 0;
}

.cart-item {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1rem;
}

.cart-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

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

.cart-item-name {
    font-weight: 700;
    font-size: 0.875rem;
}

.cart-item-price {
    font-size: 0.875rem;
    color: #4b5563;
}

.cart-item-remove {
    color: #ef4444;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.cart-item-remove:hover {
    color: #dc2626;
    transform: scale(1.1);
}

.cart-item-remove:active {
    transform: scale(0.95);
}

.cart-item-remove svg {
    width: 1.25rem;
    height: 1.25rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: #f3f4f6;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
}

.cart-item-quantity-btn {
    color: #4b5563;
    background: none;
    border: none;
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    padding: 0.25rem;
    border-radius: 0.25rem;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.cart-item-quantity-btn:hover {
    color: #111827;
    background-color: #f3f4f6;
    transform: scale(1.1);
}

.cart-item-quantity-btn:active {
    transform: scale(0.95);
}

.cart-item-quantity-value {
    font-weight: 500;
    min-width: 1.25rem;
    text-align: center;
}

.cart-item-total {
    font-weight: 700;
    font-size: 1.125rem;
}

.cart-item-total-unit {
    font-size: 0.875rem;
    font-weight: 400;
    color: #4b5563;
}

.cart-footer {
    border-top: 1px solid #e5e7eb;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-shrink: 0;
    background: var(--color-surface, white);
    box-shadow: 0 -10px 20px rgba(15, 23, 42, 0.06);
    z-index: 1;
}

.cart-total {
    font-size: 1.5rem;
    font-weight: 700;
}

.cart-payment-note {
    font-size: 0.875rem;
    color: #4b5563;
}

/* Mobile Cart */
.mobile-cart {
    display: block;
    position: relative;
}

@media (min-width: 1024px) {
    .mobile-cart {
        display: none;
    }
}

/* Tablet optimizations */
@media (min-width: 600px) and (max-width: 1023px) {
    .mobile-cart-fab {
        bottom: 2rem;
        min-width: 240px;
        padding: 1rem 2rem;
    }

    .cart-sheet-content {
        max-height: 90vh;
    }

    .cart-sheet-body {
        padding: 1.5rem 2rem;
    }

    .cart-sheet-footer {
        padding: 2rem;
    }
}

/* Floating Action Button */
.mobile-cart-fab {
    position: fixed;
    bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    border: none;
    border-radius: 2rem;
    padding: 0.875rem 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(249, 115, 22, 0.4), 0 4px 6px -2px rgba(249, 115, 22, 0.3);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 200px;
    max-width: 90%;
}

.mobile-cart-fab:active {
    transform: translateX(-50%) scale(0.95);
}

.mobile-cart-fab:disabled {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(100px);
}

.fab-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
}

.fab-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.fab-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
}

.fab-label {
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 500;
}

.fab-price {
    font-size: 1rem;
    font-weight: 700;
}

.cart-badge-fab {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background-color: #ef4444;
    color: white;
    border-radius: 9999px;
    min-width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0 0.375rem;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cart-badge-fab:empty,
.cart-badge-fab[style*="display: none"] {
    display: none !important;
}

/* Bottom Sheet */
.mobile-cart-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    overscroll-behavior: none;
}

.mobile-cart-sheet.active {
    pointer-events: all;
    opacity: 1;
}

.cart-sheet-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.cart-sheet-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 1.5rem 1.5rem 0 0;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.mobile-cart-sheet.active .cart-sheet-content {
    transform: translateY(0);
}

.cart-sheet-handle {
    width: 3rem;
    height: 0.375rem;
    background: #d1d5db;
    border-radius: 9999px;
    margin: 0.75rem auto;
    cursor: grab;
    padding-bottom: 5px;
}

.cart-sheet-handle:active {
    cursor: grabbing;
}

.cart-sheet-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.cart-sheet-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.cart-close-btn {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #4b5563;
}

.cart-close-btn:hover {
    background: #e5e7eb;
    color: #111827;
}

.cart-close-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.cart-sheet-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: 1rem 1.5rem;
    /*display: flex;*/
    flex-direction: column;
    gap: 1rem;
    -webkit-overflow-scrolling: touch;
}

.cart-sheet-body:empty::before {
    content: 'Корзина пуста';
    display: block;
    text-align: center;
    color: #9ca3af;
    padding: 3rem 0;
    font-size: 1rem;
}

.cart-sheet-footer {
    padding: 1rem 1.5rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--color-border, #e5e7eb);
    background: var(--color-surface, white);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 -10px 20px rgba(15, 23, 42, 0.06);
}

.cart-sheet-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.75rem;
}

.total-label {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
}

.total-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f97316;
}

.cart-sheet-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-clear-cart {
    flex: 1;
    padding: 0.875rem 1rem;
    background: white;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-cart:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
}

.btn-payment-mobile {
    flex: 1;
    padding: 0.875rem 1rem;
    min-height: 52px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: var(--text-base, 1rem);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
    -webkit-tap-highlight-color: transparent;
}

.btn-payment-mobile:hover:not(:disabled) {
    background: linear-gradient(135deg, #ea580c, #c2410c);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.4);
    transform: translateY(-1px);
}

.btn-payment-mobile:active:not(:disabled) {
    transform: translateY(0);
}

.btn-payment-mobile:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

/* Enhanced Mobile Cart Items */
.mobile-cart-items .cart-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.2s;
}

.mobile-cart-items .cart-item:active {
    transform: scale(0.98);
}

.mobile-cart-items .cart-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.mobile-cart-items .cart-item-info {
    flex: 1;
    min-width: 0;
}

.mobile-cart-items .cart-item-name {
    font-weight: 700;
    font-size: 1rem;
    color: #111827;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.mobile-cart-items .cart-item-price {
    font-size: 0.875rem;
    color: #6b7280;
}

.mobile-cart-items .cart-item-remove {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    color: #ef4444;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.mobile-cart-items .cart-item-remove:hover {
    background: #fee2e2;
    color: #dc2626;
}

.mobile-cart-items .cart-item-remove svg {
    width: 1.25rem;
    height: 1.25rem;
}

.mobile-cart-items .cart-item-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
}

.mobile-cart-items .cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #f9fafb;
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
}

.mobile-cart-items .cart-item-quantity-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 1.125rem;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-cart-items .cart-item-quantity-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #111827;
}

.mobile-cart-items .cart-item-quantity-btn:active {
    transform: scale(0.95);
}

.mobile-cart-items .cart-item-quantity-value {
    font-weight: 700;
    font-size: 1rem;
    min-width: 2rem;
    text-align: center;
    color: #111827;
}

.mobile-cart-items .cart-item-total {
    font-weight: 700;
    font-size: 1.25rem;
    color: #111827;
}

.mobile-cart-items .cart-item-total-unit {
    font-size: 0.875rem;
    font-weight: 400;
    color: #6b7280;
    margin-left: 0.25rem;
}

/* Kitchen View */
.kitchen-container {
    max-width: 48rem;
    margin: 0 auto;
    padding: 2rem 1rem;
}

@media (min-width: 768px) {
    .kitchen-container {
        padding: 2rem;
    }
}

.kitchen-tabs {
    position: sticky;
    top: 3.5rem;
    z-index: 25;
    margin-bottom: 1.5rem;
    background: white;
    padding-top: 1rem;
}

.kitchen-tab-group {
    overflow: auto;
    display: flex;
    gap: 0.5rem;
    background: white;
    padding: 0.25rem;
    border: 1px solid rgba(107, 114, 128, 0.5);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.kitchen-tab-item {
    flex: 1 1 auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.kitchen-tab-radio {
    display: none;
}

.kitchen-tab-label {
    width: 100%;
    text-align: center;
    cursor: pointer;
    border-radius: 0.375rem;
    padding: 0.5rem 2rem;
    color: #6b7280;
    transition: all 0.2s;
}

.kitchen-tab-radio:checked + .kitchen-tab-label {
    background-color: #f97316;
    color: white;
}

.kitchen-orders {
    display: grid;
    gap: 1rem;
    max-width: 100%;
    margin: 0 auto;
}

.kitchen-order-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    padding: 1rem;
    border: 1px solid #e5e7eb;
}

.kitchen-order-title {
    font-weight: 600;
}

.kitchen-order-details {
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.kitchen-order-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #e5e7eb;
    color: #1f2937;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.kitchen-order-btn:hover {
    background-color: #d1d5db;
}

.kitchen-order-btn:active {
    transform: scale(0.95);
}
.kitchen-order-print-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #e5e7eb;
    color: #1f2937;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.kitchen-order-print-btn:hover {
    background-color: #d1d5db;
}

.kitchen-order-print-btn:active {
    transform: scale(0.95);
}

.kitchen-empty {
    text-align: center;
    color: #6b7280;
    padding: 2rem 0;
}

/* User View */
.user-container {
    min-height: calc(100svh - 74px);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
}

.user-card {
    width: 100%;
    max-width: 28rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    border: 1px solid #f3f4f6;
    margin: auto;
}

.user-header {
    background: linear-gradient(to right, #fb923c, #f97316);
    padding: 2.5rem 2rem;
    text-align: center;
}

.user-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
}

.user-header p {
    color: #fed7aa;
}

.user-form-container {
    padding: 2rem;
}

.user-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-section {
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.form-section-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 1rem;
}

.password-error {
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.user-footer {
    margin-top: auto;
    padding-top: 2rem;
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
    width: 100%;
}

.product-card-details {
    margin-top: 0.5rem;
}

.order-edit-btn {
    background-color: #f3f4f6 !important;
    color: #374151 !important;
}

.order-cancel-btn {
    background-color: #fef2f2 !important;
    color: #ef4444 !important;
    border: 1px solid #fee2e2 !important;
}

.order-cancel-btn:hover {
    background-color: #fee2e2 !important;
    color: #dc2626 !important;
}

.order-print-btn {
    background-color: #e5e7eb !important;
    color: #1f2937  !important;
    border: 1px solid #e5e7eb !important;
}

.order-print-btn:hover {
    background-color: #e5e7eb !important;
    color: #1f2937  !important;
}

.paginator-container {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

.paginator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.paginator-current {
    min-width: 2rem;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.paginator-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.paginator-btn:hover:not(:disabled) {
    background-color: #f9fafb;
    border-color: rgba(107, 114, 128, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.paginator-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.paginator-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.paginator-icon {
    width: 1.125rem;
    height: 1.125rem;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 50;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.2);
}

.modal-content {
    display: flex;
    flex-direction: column;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-radius: 0.75rem;
    padding: 1.5rem 1.25rem;
    width: 92.5%;
    max-width: 37.5rem;
    border: 1px solid #e5e7eb;
}

.order-details-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: visible;
    padding: 0.75rem 1rem 1rem;
}

.order-details-total-row {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 1.125rem;
}

.order-details-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.order-details-item-info {
    display: flex;
    flex-direction: column;
}

.order-details-item-name {
    font-weight: 500;
    color: #111827;
}

.order-details-item-meta {
    font-size: 0.75rem;
    color: #6b7280;
}

.order-details-item-price {
    font-weight: 600;
    color: #111827;
}

.modal-content h2 {
    color: #111827;
    font-weight: 600;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.modal-content p {
    font-size: 0.875rem;
    color: #4b5563;
    margin-top: 0.5rem;
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.25rem;
    width: 100%;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
    width: 100%;
    max-width: 300px;
    height: 2.5rem;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-actions .btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

.modal-actions .btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.3);
}

.modal-actions .btn-secondary {
    background: white;
    color: #4b5563;
    border: 1px solid #d1d5db;
}

.modal-actions .btn-secondary:hover {
    background-color: #f9fafb;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: rgba(107, 114, 128, 0.5);
}

.modal-actions .btn-secondary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Confirm Dialog */
.confirm-dialog-overlay {
    opacity: 0;
    transition: opacity 0.18s ease;
}

.confirm-dialog-overlay.confirm-dialog-visible {
    opacity: 1;
}

.confirm-dialog-overlay.confirm-dialog-visible .confirm-dialog-content {
    transform: scale(1) translateY(0);
}

.confirm-dialog-content {
    max-width: 22rem;
    padding: 1.5rem 1.25rem 1.25rem;
    transform: scale(0.92) translateY(12px);
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.confirm-dialog-message {
    font-size: 1rem;
    font-weight: 500;
    color: #1f2937;
    margin: 0 0 0.25rem;
    line-height: 1.5;
    text-align: center;
}

@media (max-width: 480px) {
    .confirm-dialog-content {
        max-width: 92%;
        padding: 1.25rem 1rem 1rem;
    }

    .confirm-dialog-message {
        font-size: 0.9375rem;
    }

    .modal-actions .btn-primary,
    .modal-actions .btn-secondary {
        height: 2.75rem;
        font-size: 0.9375rem;
    }
}

/* Toasts */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 60;
    pointer-events: none;
}

.toast {
    min-width: 240px;
    max-width: 320px;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: #111827;
    color: #f9fafb;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: auto;
    font-weight: 500;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.toast-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* Global API Loader */
.global-loader {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 9999;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.global-loader.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.global-loader__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.28);
    backdrop-filter: blur(2px);
}

.global-loader__spinner {
    position: relative;
    z-index: 1;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.35);
    border-top-color: #f97316;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

/* Payment Modal */
.payment-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.payment-label {
    font-size: 1rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
    min-width: 6.25rem;
}

.payment-value {
    font-size: 1rem;
    font-weight: 500;
    color: #374151;
    padding: 0.5rem;
}

.payment-options {
    font-size: 1rem;
    font-weight: 500;
    color: #374151;
    padding: 0 0.5rem 0.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.payment-hint {
    font-size: 0.75rem;
    margin-top: 1rem;
    color: #6b7280;
}

/* ─── Shift Open View ─────────────────────────────────────────────────── */
.shift-providers-hint {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-bottom: 0.75rem;
}

.shift-providers-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.shift-provider-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.shift-provider-label {
    flex: 1;
    font-size: 0.9rem;
    color: #d1d5db;
    min-width: 90px;
}

.shift-provider-input {
    flex: 1.5;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #374151;
    background: #111827;
    color: #f3f4f6;
    font-size: 1rem;
    text-align: right;
}

.shift-provider-input:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.shift-loading-text {
    color: #9ca3af;
    font-size: 0.875rem;
    text-align: center;
    padding: 1rem 0;
}

.shift-load-error {
    color: #f87171;
    font-size: 0.875rem;
    text-align: center;
}

/* ─── Shift Status Bar (in header) ───────────────────────────────────── */
.shift-status-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.shift-status-open {
    font-size: 0.8rem;
    color: #6ee7b7;
    white-space: nowrap;
}

.btn-close-shift {
    padding: 0.3rem 0.75rem;
    border-radius: 0.4rem;
    background: #ef4444;
    color: #fff;
    border: none;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-close-shift:hover {
    background: #dc2626;
}

/* ─── Close Shift Modal ───────────────────────────────────────────────── */
.shift-close-table,
.shift-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.shift-close-table th,
.shift-summary-table th {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid #374151;
    color: #9ca3af;
    font-weight: 500;
}

.shift-close-table td,
.shift-summary-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #374151;
    color: #d1d5db;
}

.shift-close-input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid #374151;
    background: #111827;
    color: #f3f4f6;
    font-size: 0.9rem;
    text-align: right;
}

.shift-close-input:focus {
    outline: none;
    border-color: #f97316;
}

.shift-total {
    font-size: 1rem;
    color: #d1d5db;
    margin-bottom: 0.75rem;
}

.shift-total strong {
    color: #6ee7b7;
    font-size: 1.1rem;
}

.diff-negative { color: #f87171; }
.diff-positive { color: #6ee7b7; }

.shift-done-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem;
}

/* ─── Responsive overrides ────────────────────────────────────────────── */
@media (max-width: 480px) {
    .shift-provider-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .shift-provider-label {
        min-width: unset;
    }

    .shift-provider-input {
        width: 100%;
        text-align: left;
    }

    .shift-close-table,
    .shift-summary-table {
        font-size: 0.8rem;
    }

    .shift-status-open {
        display: none;
    }

    .shift-status-bar {
        gap: 0.25rem;
    }
}

/* ============================================================
   Component Primitives — AtomPOS Design System v2
   ============================================================ */

/* ── Buttons ── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--touch-target-min);
    padding: 0 var(--space-5);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color var(--transition-base),
                color var(--transition-base),
                box-shadow var(--transition-base),
                transform var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn:active:not(:disabled) {
    transform: scale(0.96);
}

.btn-ds-primary {
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
}

.btn-ds-primary:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-ds-primary:active:not(:disabled) {
    background-color: var(--color-primary-active);
}

.btn-ds-secondary {
    background-color: var(--color-surface);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-strong);
}

.btn-ds-secondary:hover:not(:disabled) {
    background-color: var(--color-bg);
    box-shadow: var(--shadow-sm);
}

.btn-ds-danger {
    background-color: var(--color-error);
    color: var(--color-text-inverse);
}

.btn-ds-danger:hover:not(:disabled) {
    background-color: #dc2626;
    box-shadow: var(--shadow-md);
}

/* Extra-large CTA — main POS action button (80px) */
.btn-xl {
    min-height: var(--space-20);
    padding: 0 var(--space-8);
    font-size: var(--text-lg);
    border-radius: var(--radius-lg);
    width: 100%;
}

/* ── Cards ── */

.card-interactive {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
    padding: var(--space-4);
    cursor: pointer;
    transition: box-shadow var(--transition-base),
                border-color var(--transition-base),
                transform var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.card-interactive:hover {
    box-shadow: var(--shadow-md);
}

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

.card-interactive.selected {
    border-color: var(--color-primary);
    background-color: var(--color-primary-surface);
}

/* ── Input Fields ── */

.input-ds {
    width: 100%;
    height: var(--space-12);
    padding: 0 var(--space-4);
    background-color: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    outline: none;
    -webkit-appearance: none;
}

.input-ds:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-surface);
}

.input-ds::placeholder {
    color: var(--color-text-disabled);
}

/* ── Chips (selectable pills) ── */

.chip-ds {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-width: 36px;
    padding: 0 var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    border: 1px solid var(--color-border-strong);
    background-color: var(--color-surface);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: background-color var(--transition-base),
                color var(--transition-base),
                border-color var(--transition-base);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    white-space: nowrap;
}

.chip-ds:hover {
    background-color: var(--color-bg);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.chip-ds.active,
.chip-ds[aria-pressed="true"] {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text-inverse);
}

/* ── Modal Overlay + Panel ── */

.modal-overlay-ds {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-surface-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-panel-ds {
    background-color: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 92%;
    max-width: 640px;
    max-height: 90dvh;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-6);
}

.modal-fullscreen-ds {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background-color: var(--color-surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── View Enter Animation ── */

.view-enter {
    animation: view-fade-in 150ms ease-out both;
}

@keyframes view-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .view-enter {
        animation: none;
    }
}

/* ============================================================
   POS Layout — 3-Zone Tablet Grid
   ============================================================ */

/* Desktop: override flex home-layout with CSS Grid */
@media (min-width: 1024px) {
    .pos-layout {
        display: grid !important;
        grid-template-columns: 80px 1fr 360px;
        grid-template-rows: 1fr;
        height: calc(100svh - 73px);
        overflow: hidden;
        flex-direction: unset;
    }

    .pos-rail {
        width: auto !important;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        overflow-y: auto;
        overflow-x: hidden;
        border-right: 1px solid var(--color-border);
        border-bottom: none;
        background-color: var(--color-surface);
        padding: var(--space-2) 0;
    }

    .pos-products {
        flex: unset;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        padding: var(--space-4);
        background-color: var(--color-bg);
    }

    .pos-cart {
        display: flex !important;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        width: auto !important;
        border-left: 1px solid var(--color-border);
        background-color: var(--color-surface);
        overflow: hidden;
    }
}

/* Dark mode surfaces */
[data-theme="dark"] .pos-rail,
[data-theme="dark"] .pos-cart {
    background-color: var(--color-surface);
    border-color: var(--color-border);
}

[data-theme="dark"] .pos-products {
    background-color: var(--color-bg);
}

/* ============================================================
   Cart Panel v2 — fast item management
   ============================================================ */

/* Cart item row */
.cart-item-v2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--space-2);
    min-height: 0;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-surface);
    transition: transform var(--transition-base), opacity var(--transition-base);
    overflow: visible;
}

.pos-cart .cart-items {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.pos-cart .cart-item-v2 {
    margin-bottom: var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.pos-cart .cart-item-v2:last-child {
    margin-bottom: 0;
}

.pos-cart .cart-footer {
    flex-shrink: 0;
    background-color: var(--color-surface);
    border-top-color: var(--color-border);
}

.cart-item-v2:last-child {
    border-bottom: none;
}

.cart-item-v2 .cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-v2 .cart-item-name {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    /* Keep long unbroken names from overflowing the cart column. */
    overflow-wrap: anywhere;
    word-break: break-word;
}

.cart-item-v2 .cart-item-price {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.cart-item-v2 .cart-item-controls {
    display: flex;
    align-self: start;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-2);
    flex-shrink: 0;
    min-width: 86px;
}

/* Quantity stepper */
.cart-item-v2 .cart-item-quantity {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background-color: var(--color-bg);
    border-radius: var(--radius-md);
    padding: var(--space-1);
}

.cart-qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    /* 44px tap area via padding */
    padding: 6px;
    margin: -6px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
}

.cart-qty-btn:hover {
    background-color: var(--color-primary-surface);
    color: var(--color-primary);
}

.cart-qty-btn:active {
    transform: scale(0.88);
}

.cart-item-v2 .cart-item-quantity-value {
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    min-width: 20px;
    text-align: center;
    color: var(--color-text);
}

.cart-item-v2 .cart-item-total {
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    color: var(--color-text);
    min-width: 60px;
    text-align: right;
}

.cart-item-v2 .cart-item-total-unit {
    font-size: var(--text-xs);
    font-weight: var(--font-normal);
    color: var(--color-text-secondary);
}

/* Cart empty state */
.cart-empty-v2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-16) var(--space-6);
    text-align: center;
    height: 100%;
    min-height: 200px;
}

.cart-empty-icon {
    font-size: 40px;
    line-height: 1;
    opacity: 0.5;
}

.cart-empty-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text-secondary);
}

.cart-empty-hint {
    font-size: var(--text-sm);
    color: var(--color-text-disabled);
}

/* Payment CTA button (inside cart footer) */
#payment-btn {
    min-height: var(--space-20);
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    border-radius: var(--radius-lg);
    width: 100%;
    border: none;
    cursor: pointer;
    transition:
        background-color var(--transition-base),
        transform var(--transition-fast),
        box-shadow var(--transition-base);
}

#payment-btn:not(:disabled) {
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
    box-shadow: 0 4px 16px var(--color-primary-surface);
}

#payment-btn:not(:disabled):hover {
    background-color: var(--color-primary-hover);
    box-shadow: var(--shadow-lg);
}

#payment-btn:not(:disabled):active {
    transform: scale(0.97);
    background-color: var(--color-primary-active);
}

#payment-btn:disabled {
    background-color: var(--color-border);
    color: var(--color-text-disabled);
    cursor: not-allowed;
    box-shadow: none;
}

/* ============================================================
   POS Header — Redesigned 56px 3-section bar
   ============================================================ */

.pos-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: 56px;
    padding: 0 var(--space-4);
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: var(--z-fixed);
}

@media (min-width: 1024px) {
    .pos-header {
        grid-template-columns: auto 1fr auto;
        gap: var(--space-4);
    }
}

.pos-header-brand {
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    color: var(--color-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pos-header-center {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    text-align: center;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.pos-header-search {
    display: none;
}

.header-screen-title-mobile {
    display: inline;
}

@media (min-width: 1024px) {
    .pos-header-search {
        display: flex;
        align-items: center;
        position: relative;
        width: 100%;
        max-width: 400px;
    }

    .pos-header-search-icon {
        position: absolute;
        left: 10px;
        color: var(--color-text-muted);
        pointer-events: none;
        flex-shrink: 0;
    }

    .pos-header-search input {
        width: 100%;
        padding: 7px 12px 7px 34px;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        background: var(--color-surface-raised);
        color: var(--color-text);
        font-size: var(--text-sm);
        font-family: var(--font-sans);
        transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    }

    .pos-header-search input:focus {
        outline: none;
        border-color: var(--color-primary);
        box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 20%, transparent);
    }

    .pos-header-search input::placeholder {
        color: var(--color-text-muted);
    }

    .header-screen-title-mobile {
        display: none;
    }
}

.pos-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
}

/* Icon button in pos-header */
.pos-header-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    text-decoration: none;
    font-size: 18px;
    transition: background-color var(--transition-base), color var(--transition-base);
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.pos-header-icon-btn:hover {
    background-color: var(--color-primary-surface);
    color: var(--color-primary);
}

.pos-header-icon-btn:active {
    transform: scale(0.92);
}

.pos-header-icon-btn .icon {
    width: 20px;
    height: 20px;
}

/* User avatar chip */
.pos-user-avatar {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: var(--touch-target-min);
    padding: 0 var(--space-3);
    border-radius: var(--radius-full);
    text-decoration: none;
    background-color: var(--color-primary-surface);
    color: var(--color-primary);
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    transition: background-color var(--transition-base);
    -webkit-tap-highlight-color: transparent;
}

.pos-user-avatar:hover {
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
}

.pos-user-avatar .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.pos-user-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hide user name on very small screens */
@media (max-width: 480px) {
    .pos-user-name {
        display: none;
    }
}

/* Screen-reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Dark mode header */
[data-theme="dark"] .pos-header {
    background-color: var(--color-surface);
    border-bottom-color: var(--color-border);
}

/* Override old header height on home view */
#home-view .pos-header {
    padding: 0 var(--space-4);
}

/* ============================================================
   Responsive Tablet Breakpoints
   ============================================================ */

/* Portrait tablet / small landscape (768–1023px):
   Products fill full width. Category rail → horizontal bottom strip.
   Cart panel hidden (use mobile-cart FAB instead). */
/* ── Tablet portrait (768–1023px): cart always visible on right ── */
@media (min-width: 600px) and (max-width: 1023px) {

    /* ── Layout grid ── */
    .pos-layout {
        display: grid !important;
        grid-template-columns: 1fr 280px;
        grid-template-rows: auto 1fr;
        grid-template-areas:
            "category category"
            "products cart";
        height: calc(100svh - 56px);
        overflow: hidden;
    }

    /* ── Category strip ── */
    .pos-rail.category-sidebar {
        grid-area: category;
        position: static !important;   /* grid handles placement, no sticky offset */
        width: 100% !important;
        flex-direction: row !important;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        padding: 0 var(--space-2) !important;
        overflow-x: auto;
        overflow-y: hidden;
        height: 44px;
        flex-shrink: 0;
    }

    .pos-rail .category-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 0;
        gap: var(--space-1);
        -webkit-overflow-scrolling: touch;
    }

    .pos-rail .search-bar-mobile {
        display: none;
    }

    /* Compact chip style for tablet horizontal strip */
    /*.category-rail-item.active {*/
    /*    background-color: var(--color-primary);*/
    /*    color: var(--color-text-inverse);*/
    /*}*/

    /*.category-rail-item.active::before {*/
    /*    display: none;*/
    /*}*/

    /* ── Products area ── */
    .pos-products {
        grid-area: products;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        padding: var(--space-2);
        min-height: unset;
    }

    /* ── Cart sidebar ── */
    .pos-cart.cart-sidebar {
        grid-area: cart;
        display: flex !important;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        width: auto;
        overflow: hidden;
        border-left: 1px solid var(--color-border);
    }

    .mobile-cart {
        display: none !important;
    }

    /* ── Compact product cards (sizing overrides — clamp/font in post-base block below) ── */
    .product-card-v2 {
        min-height: unset;
    }

    /* ── Cart header ── */
    .pos-cart .cart-header {
        padding: var(--space-2) var(--space-3);
    }

    .pos-cart .cart-header h2 {
        font-size: var(--text-sm);
    }

    /* ── Cart items: 2-row layout (name on top, controls below) ── */
    .pos-cart .cart-items {
        /*flex: 1 1 auto;*/
        /*min-height: 0;*/
        /*overflow-y: auto;*/
        /*overscroll-behavior-y: contain;*/
        /*-webkit-overflow-scrolling: touch;*/
        padding: var(--space-1) var(--space-2);
        gap: 0;
    }

    .pos-cart .cart-item-v2 {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-1);
        padding: var(--space-2) var(--space-2);
        min-height: unset;
        overflow: visible;
    }

    .pos-cart .cart-item-v2 .cart-item-info {
        width: 100%;
    }

    .pos-cart .cart-item-v2 .cart-item-name {
        font-size: var(--text-xs);
        font-weight: var(--font-semibold);
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .pos-cart .cart-item-v2 .cart-item-price {
        font-size: 10px;
        margin-top: 0;
    }

    .pos-cart .cart-item-v2 .cart-item-controls {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-1);
    }

    .pos-cart .cart-item-v2 .cart-item-quantity {
        padding: 2px var(--space-1);
        gap: var(--space-1);
        border-radius: var(--radius-sm);
    }

    .pos-cart .cart-qty-btn {
        width: 22px;
        height: 22px;
        padding: 0;
        margin: 0;
        font-size: var(--text-base);
        min-width: unset;
        min-height: unset;
    }

    .pos-cart .cart-item-v2 .cart-item-quantity-value {
        font-size: var(--text-xs);
        min-width: 14px;
    }

    .pos-cart .cart-item-v2 .cart-item-total {
        font-size: var(--text-xs);
        font-weight: var(--font-bold);
        min-width: unset;
        text-align: right;
    }

    /* ── Cart footer ── */
    .pos-cart .cart-footer {
        flex-shrink: 0;
        padding: var(--space-2) var(--space-3);
        gap: var(--space-2);
    }

    .pos-cart .cart-total {
        font-size: var(--text-base);
    }

    .pos-cart .cart-payment-note {
        font-size: 10px;
    }

    /* ── Payment button compact ── */
    .pos-cart .btn-payment {
        padding: 10px var(--space-3) !important;
        font-size: var(--text-sm) !important;
        font-weight: var(--font-semibold);
        border-radius: var(--radius-md);
        line-height: 1.2;
    }
}

/* ── Tablet landscape (768–1023px landscape): icon rail + cart ── */
@media (min-width: 600px) and (max-width: 1023px) and (orientation: landscape) {
    .pos-layout {
        display: grid !important;
        grid-template-columns: 52px 1fr 280px;
        grid-template-rows: 1fr;
        grid-template-areas: "category products cart";
        height: calc(100svh - 56px);
        overflow: hidden;
    }

    .pos-rail.category-sidebar {
        grid-area: category;
        position: static !important;
        width: auto !important;
        height: 100%;
        flex-direction: column !important;
        align-items: center;
        border-right: 1px solid var(--color-border);
        border-bottom: none !important;
        overflow-y: auto;
        overflow-x: hidden;
        padding: var(--space-2) 0 !important;
    }

    .pos-rail .category-nav {
        flex-direction: column;
        overflow-x: hidden;
        padding: 0;
        gap: var(--space-1);
    }

    /* Icon-only pills for landscape rail */
    .pos-rail .search-bar-mobile {
        display: none;
    }

    .pos-products {
        grid-area: products;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        padding: var(--space-2);
        min-height: unset;
    }

    .pos-cart.cart-sidebar {
        grid-area: cart;
        display: flex !important;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        width: auto;
        overflow: hidden;
        border-left: 1px solid var(--color-border);
    }

    .mobile-cart {
        display: none !important;
    }

}

/* Phone (≤599px) */
@media (max-width: 599px) {

    :root {
        --mobile-header-height: 56px;
    }

    /* Main layout */
    .pos-layout {
        display: block !important;
        width: 100%;
        min-width: 0;
        overflow-x: clip;
    }

    /* Prevent horizontal scroll */
    .home-layout,
    .pos-products,
    .product-grid-container {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: clip;
    }

    /* Hide desktop cart */
    .pos-cart.cart-sidebar {
        display: none !important;
    }

    /* Sticky category rail */
    .pos-rail.category-sidebar {
        position: sticky;
        top: var(--mobile-header-height);
        z-index: var(--z-sticky);

        width: 100%;
        height: 52px;

        display: flex;
        flex-direction: row;
        align-items: center;

        padding: 0 var(--space-2);

        overflow-x: auto;
        overflow-y: hidden;

        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: none;

        background-color: var(--color-surface);

        border-bottom: 1px solid var(--color-border);
        border-right: none;

        flex-shrink: 0;
    }

    /* Hide scrollbar */
    .pos-rail.category-sidebar::-webkit-scrollbar {
        display: none;
    }

    /* Horizontal category list */
    .pos-rail .category-nav {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;

        min-width: max-content;

        gap: var(--space-1);
        padding: 0;
    }

    /* Hide mobile search inside rail */
    .pos-rail .search-bar-mobile {
        display: none;
    }

    /* Product area */
    .pos-products {
        min-width: 0;
        padding: var(--space-2);
        /* Clearance so the last product row isn't hidden behind the fixed
           mobile-cart FAB (~56px tall, sits 1.5rem + safe-area from bottom). */
        padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
        overflow-x: hidden;
    }

    /* Compact header */
    .pos-header-brand span {
        font-size: var(--text-sm);
    }

    /* Compact product cards */
    .product-card-name {
        font-size: var(--text-xs);
        line-height: 1.3;
        min-height: 2.6em;
        overflow: hidden;
    }

    .product-card-v2 .product-price-value {
        font-size: var(--text-sm);
    }

    .product-card-body {
        padding: var(--space-2);
        gap: var(--space-1);
    }

    /* Cart item text wrap */
    .cart-item-v2 .cart-item-name {
        white-space: normal;
        overflow: hidden;

        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    /* Footer spacing */
    .cart-footer {
        padding: var(--space-3);
        gap: var(--space-2);
    }

    /* Modal constraints */
    .order-details-list {
        max-height: 45vh;
        overflow-y: auto;
    }

    .order-details-panel {
        padding: var(--space-4);
        max-height: 90dvh;
        overflow-y: auto;
    }
}

/* ── Small tablet / large phone (600–767px): vertical icon rail + 224px cart ── */
@media (min-width: 600px) and (max-width: 767px) {

    /* ── Layout grid: 3-column same as desktop ── */
    .pos-layout {
        display: grid !important;
        grid-template-columns: 52px 1fr 224px;
        grid-template-rows: 1fr;
        grid-template-areas: "category products cart";
        height: calc(100svh - 56px);
        overflow: hidden;
    }

    /* ── Category: vertical icon rail (same as ≥1024px) ── */
    .pos-rail.category-sidebar {
        grid-area: category;
        position: static !important;
        width: auto !important;
        height: 100%;
        flex-direction: column !important;
        align-items: center;
        border-right: 1px solid var(--color-border);
        border-bottom: none !important;
        overflow-y: auto;
        overflow-x: hidden;
        padding: var(--space-2) 0 !important;
    }

    .pos-rail .category-nav {
        flex-direction: column;
        overflow-x: hidden;
        padding: 0;
        gap: var(--space-1);
    }

    /* Icon-only rail items */
    .pos-rail .search-bar-mobile {
        display: none;
    }

    /* ── Products area ── */
    .pos-products {
        grid-area: products;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        padding: var(--space-2);
        min-height: unset;
    }

    /* ── Cart sidebar ── */
    .pos-cart.cart-sidebar {
        grid-area: cart;
        display: flex !important;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        width: auto;
        overflow: hidden;
        border-left: 1px solid var(--color-border);
    }

    .mobile-cart {
        display: none !important;
    }

    .product-card-v2 {
        min-height: unset;
    }

    /* ── Cart header ── */
    .pos-cart .cart-header {
        padding: var(--space-2) var(--space-3);
    }

    .pos-cart .cart-header h2 {
        font-size: var(--text-sm);
    }

    /* ── Cart items: 2-row layout (name on top, controls below) ── */
    .pos-cart .cart-items {
        /*flex: 1 1 auto;*/
        /*min-height: 0;*/
        /*overflow-y: auto;*/
        /*overscroll-behavior-y: contain;*/
        /*-webkit-overflow-scrolling: touch;*/
        padding: var(--space-1) var(--space-2);
        gap: 0;
    }

    .pos-cart .cart-item-v2 {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-1);
        padding: var(--space-2) var(--space-2);
        min-height: unset;
        overflow: visible;
    }

    .pos-cart .cart-item-v2 .cart-item-info {
        width: 100%;
    }

    .pos-cart .cart-item-v2 .cart-item-name {
        font-size: var(--text-xs);
        font-weight: var(--font-semibold);
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .pos-cart .cart-item-v2 .cart-item-price {
        font-size: 10px;
        margin-top: 0;
    }

    .pos-cart .cart-item-v2 .cart-item-controls {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-1);
    }

    .pos-cart .cart-item-v2 .cart-item-quantity {
        padding: 2px var(--space-1);
        gap: var(--space-1);
        border-radius: var(--radius-sm);
    }

    .pos-cart .cart-qty-btn {
        width: 22px;
        height: 22px;
        padding: 0;
        margin: 0;
        font-size: var(--text-base);
        min-width: unset;
        min-height: unset;
    }

    .pos-cart .cart-item-v2 .cart-item-quantity-value {
        font-size: var(--text-xs);
        min-width: 14px;
    }

    .pos-cart .cart-item-v2 .cart-item-total {
        font-size: var(--text-xs);
        font-weight: var(--font-bold);
        min-width: unset;
        text-align: right;
    }

    /* ── Cart footer ── */
    .pos-cart .cart-footer {
        flex-shrink: 0;
        padding: var(--space-2) var(--space-3);
        gap: var(--space-2);
    }

    .pos-cart .cart-total {
        font-size: var(--text-base);
    }

    .pos-cart .cart-payment-note {
        font-size: 10px;
    }

    /* ── Payment button compact ── */
    .pos-cart .btn-payment {
        padding: 10px var(--space-3) !important;
        font-size: var(--text-sm) !important;
        font-weight: var(--font-semibold);
        border-radius: var(--radius-md);
        line-height: 1.2;
    }
}

/* ============================================================
   Product Card v2 — large touch targets
   ============================================================ */

.product-card-v2 {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 130px;
    padding: 0;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background-color: var(--color-surface);
    border: 2px solid transparent;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition:
        box-shadow var(--transition-base),
        border-color var(--transition-base),
        transform var(--transition-fast);
}

.product-card-v2:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-border-strong);
}

.product-card-v2.active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary-surface), var(--shadow-md);
}

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

.product-card-image {
    flex: 0 0 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--color-bg), var(--color-border));
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card-image-icon {
    font-size: 28px;
    line-height: 1;
    pointer-events: none;
}

.product-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--space-3);
    gap: var(--space-1);
}

.product-card-name {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    line-height: var(--leading-tight);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 0;
    min-height: 2.5em;
}

@media (min-width: 600px) and (max-width: 1023px) {
    .product-card-name {
        font-size: var(--text-xs);
        -webkit-line-clamp: unset;
        min-height: unset;
        line-height: 1.3;
    }

    .product-card-image {
        flex: 0 0 44px;
        height: 44px;
    }

    .product-card-image-icon {
        font-size: 18px;
    }

    .product-card-body {
        padding: var(--space-2);
        gap: 2px;
    }

    .product-card-v2 .product-price-value {
        font-size: var(--text-sm);
    }
}

.product-card-price {
    display: flex;
    align-items: baseline;
    gap: var(--space-1);
}

.product-card-v2 .product-price-value {
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    color: var(--color-primary);
}

.product-card-v2 .product-price-unit {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

/* Quantity badge overlay (top-right corner) */
.product-qty-badge {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    min-width: 22px;
    height: 22px;
    padding: 0 var(--space-1);
    border-radius: var(--radius-full);
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: var(--shadow-sm);
    animation: badge-pop 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badge-pop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

/* Products empty state */
.products-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-16) var(--space-8);
    text-align: center;
    gap: var(--space-3);
}

.products-empty-icon {
    font-size: 48px;
    line-height: 1;
}

.products-empty-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text);
}

.products-empty-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

/* Dark mode product card */
[data-theme="dark"] .product-card-v2 {
    background-color: var(--color-surface);
}

[data-theme="dark"] .product-card-image {
    background: linear-gradient(135deg, var(--color-surface-raised), var(--color-border));
}

/* ============================================================
   Category Rail Items — vertical rail (desktop) & horizontal strip (tablet)
   ============================================================ */

.category-rail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    width: 100%;
    min-height: 72px;
    padding: var(--space-2) var(--space-1);
    border: none;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    transition:
        background-color var(--transition-base),
        color var(--transition-base);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    white-space: nowrap;
    position: relative;
}

.category-rail-item:hover {
    background-color: var(--color-primary-surface);
    color: var(--color-primary);
}

.category-rail-item.active {
    color: var(--color-primary);
    background-color: var(--color-primary-surface);
}

/* Active indicator — left border on desktop rail */
/*@media (min-width: 600px) {*/
/*    .category-rail-item.active::before {*/
/*        content: '';*/
/*        position: absolute;*/
/*        left: 0;*/
/*        top: 0;*/
/*        bottom: 0;*/
/*        width: 3px;*/
/*        background-color: var(--color-primary);*/
/*        border-radius: 0 var(--radius-sm) var(--radius-sm) 0;*/
/*    }*/
/*}*/

.category-rail-icon {
    font-size: 22px;
    line-height: 1;
    display: block;
}

.category-rail-label {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    text-align: center;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Category rail responsive item modes.
   Keep this after the base category item block so scoped rail shapes win. */
@media (max-width: 599px) {
    .category-rail-item {
        flex-direction: row;
        min-height: 40px;
        width: auto;
        padding: var(--space-2) var(--space-3);
        border-radius: var(--radius-full);
    }
}

@media (min-width: 600px) and (max-width: 1023px) {
    .category-rail-item {
        min-height: 44px;
        padding: var(--space-1) var(--space-3) !important;
        font-size: var(--text-xs);
        gap: var(--space-1);
        border-radius: var(--radius-full);
        flex-direction: row;
        width: auto;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .category-rail-icon {
        font-size: 14px;
    }

    .category-rail-label {
        max-width: none;
        font-size: var(--text-xs);
    }
}

@media (min-width: 600px) and (max-width: 767px),
       (min-width: 600px) and (max-width: 1023px) and (orientation: landscape) {
    .category-rail-item {
        flex-direction: column !important;
        width: 40px;
        min-height: 44px;
        padding: var(--space-1) !important;
        font-size: 9px;
        border-radius: var(--radius-md);
        white-space: normal;
    }

    .category-rail-icon {
        font-size: 16px;
    }

    .category-rail-label {
        font-size: 8px;
        max-width: 36px;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
    }
}

/* ============================================================
   Responsive Product Grid Columns
   ============================================================ */

@media (max-width: 599px) {
    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-2);
    }
}

@media (max-width: 360px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 600px) and (max-width: 767px) {
    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-2);
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--space-2);
    }
}

@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: var(--space-3);
    }
}

@media (min-width: 1280px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* ============================================================
   Payment Modal v2 — Numpad-first, two-panel layout
   ============================================================ */

.payment-modal-v2 {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.payment-modal-inner {
    display: flex;
    flex-direction: column;
    width: min(520px, 100%);
    max-height: min(700px, 92vh);
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

/* ── Left panel ── */
.payment-amount-display {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.payment-amount-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
}

.payment-amount-value {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.payment-entered-display {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--color-primary);
    min-height: 1.5em;
}

.payment-change-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.payment-change-value {
    font-weight: 600;
    color: var(--color-success, #22c55e);
}

/* ── Numpad ── */
.payment-numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
    flex: 1;
}

.numpad-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 72px;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--text-xl);
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.numpad-btn:hover {
    background: var(--color-surface-raised);
}

.numpad-btn:active,
.numpad-btn.touch-active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    transform: scale(0.96);
}

.numpad-btn[data-action="del"] {
    background: var(--color-surface);
    color: var(--color-danger, #ef4444);
    font-size: var(--text-lg);
}

.numpad-btn[data-action="exact"] {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    font-size: var(--text-sm);
    font-weight: 700;
}

.numpad-btn[data-action="clear"] {
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

/* ── Right panel ── */
.payment-right-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: var(--space-4) var(--space-5);
    gap: var(--space-4);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.payment-header-total {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    margin-top: var(--space-1);
}

.payment-total-value {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text);
}

.payment-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
}

.payment-panel-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-text);
}

.payment-close-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--color-surface-raised);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: 1.25rem;
    line-height: 1;
}

.payment-close-btn:hover {
    background: var(--color-danger, #ef4444);
    color: #fff;
}

/* ── Payment type chips ── */
.payment-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.payment-section-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
}

.payment-type-chips,
.payment-service-chips {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Hide actual radio inputs, use chip labels instead */
.payment-type-chips input[type="radio"],
.payment-service-chips input[type="radio"],
#bank-options input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.payment-chip-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-full);
    border: 1.5px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
    min-height: 44px;
    user-select: none;
    -webkit-user-select: none;
}

.payment-chip-label:hover {
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}

input[type="radio"]:checked + .payment-chip-label {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

/* Flex containers for chip groups */
.payment-options,
#bank-options,
#service-mode-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}

/* payment-right-header alias */
.payment-right-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
}

.payment-right-header h2 {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

/* Total / entered / change display helpers */
.payment-total-value {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.payment-entered-row {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    min-height: 1.5em;
}

.payment-entered-label,
.payment-change-label {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.payment-entered-value {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--color-primary);
}

.payment-card-amount {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--color-text);
}

/* ── CTA area ── */
.payment-cta-area {
    margin-top: auto;
    padding-top: var(--space-3);
}

.payment-cta-area .btn-xl {
    width: 100%;
    font-size: var(--text-lg);
    justify-content: center;
}

/* ── Split balance section ── */
.split-balance-section {
    flex-direction: column;
    gap: var(--space-2);
}

.split-bar-track {
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--color-border);
    overflow: hidden;
}

.split-bar-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    transition: width 200ms ease;
    width: 0%;
}

.split-legend {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.split-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

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

.split-dot-cash { background: var(--color-primary); }
.split-dot-card { background: var(--color-border); }

.split-remaining--zero {
    color: var(--color-success, #22c55e) !important;
}

.split-quick-chips {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.split-quick-btn {
    font-size: var(--text-sm);
    padding: var(--space-1) var(--space-3);
    cursor: pointer;
    border: 1.5px solid var(--color-border);
    background: var(--color-surface);
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.split-quick-btn:hover {
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}

/* ── Mobile: compact payment modal ── */
@media (max-width: 600px) {
    .payment-modal-v2 {
        padding: var(--space-2);
        align-items: flex-end;
    }

    .payment-modal-inner {
        width: 100%;
        max-height: 92dvh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }

    .payment-right-panel {
        padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
    }

    /* Sticky CTA bar */
    .payment-cta-area {
        position: sticky;
        bottom: 0;
        background: var(--color-surface);
        border-top: 1px solid var(--color-border);
        padding: var(--space-3) var(--space-4);
        padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
        margin: 0;
    }
}

/* ── Phone only: bottom sheet variant ── */
@media (max-width: 767px) {
    .payment-modal-v2 {
        padding: 0;
        align-items: flex-end;
    }

    .payment-modal-inner {
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        width: 100%;
        max-height: 85dvh;
    }
}

/* Dark mode overrides */
[data-theme="dark"] .payment-modal-v2 {
    background: rgba(0, 0, 0, 0.72);
}


/* ============================================================
   Order Success Screen
   ============================================================ */

.order-success-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    padding: var(--space-8) var(--space-6);
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    width: min(480px, 94vw);
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: successSlideUp 320ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes successSlideUp {
    from { opacity: 0; transform: translateY(32px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* SVG check animation */
.order-success-icon {
    color: var(--color-success, #22c55e);
    width: 80px;
    height: 80px;
}

.order-success-check {
    width: 100%;
    height: 100%;
}

.order-success-circle {
    stroke-dasharray: 157;
    stroke-dashoffset: 157;
    animation: drawCircle 400ms ease 100ms forwards;
}

.order-success-checkmark {
    stroke-dasharray: 36;
    stroke-dashoffset: 36;
    animation: drawCheck 300ms ease 500ms forwards;
}

@keyframes drawCircle {
    to { stroke-dashoffset: 0; }
}

@keyframes drawCheck {
    to { stroke-dashoffset: 0; }
}

.order-success-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.order-success-order {
    font-size: var(--text-base);
    color: var(--color-text-muted);
    margin: 0;
}

.order-success-amounts {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-raised);
    border-radius: var(--radius-lg);
}

.order-success-amount-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-base);
}

.order-success-amount-label {
    color: var(--color-text-muted);
    font-weight: 500;
}

.order-success-amount-value {
    font-weight: 700;
    color: var(--color-text);
}

.order-success-change {
    color: var(--color-success, #22c55e);
}

.order-success-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: 100%;
}

.order-success-actions .btn-xl {
    width: 100%;
    justify-content: center;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Login Screen v2 — Tablet-centered branded design
   ============================================================ */

.login-view-ds {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh; /* fallback for WebViews without dvh support */
    min-height: 100dvh;
    background: var(--color-bg);
    position: relative;
    overflow: hidden;
}

/* Manual refresh button on the login screen (no header here). */
.login-refresh-btn {
    position: absolute;
    top: max(var(--space-4), env(safe-area-inset-top, 0px));
    right: var(--space-4);
    z-index: 2;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.login-bg-pattern {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, color-mix(in srgb, var(--color-primary) 12%, transparent), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, color-mix(in srgb, var(--color-primary) 6%, transparent), transparent);
    pointer-events: none;
}

.login-container-ds {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-6);
    width: min(420px, 92vw);
    padding: var(--space-8) 0;
    position: relative;
    z-index: 1;
}

@media (max-width: 767px) {
    .login-view-ds {
        padding: var(--space-4);
    }

    .login-container-ds {
        width: 100%;
        padding: var(--space-4) 0;
    }
}

/* Brand */
.login-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--color-primary);
}

.login-brand-logo svg {
    display: block;
    filter: drop-shadow(0 4px 12px color-mix(in srgb, var(--color-primary) 30%, transparent));
}

.login-brand-name {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--color-text);
}

/* Card */
.login-card-ds {
    width: 100%;
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-7) var(--space-6);
    border: 1px solid var(--color-border);
}

.login-card-header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.login-card-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 var(--space-1);
    letter-spacing: -0.02em;
}

.login-card-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin: 0;
}

/* Form */
.login-form-ds {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.form-field-ds {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.form-label-ds {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
}

/* Password wrapper */
.input-ds-wrapper {
    position: relative;
    display: flex;
}

.input-ds-with-addon {
    flex: 1;
    border-radius: var(--radius-md) 0 0 var(--radius-md) !important;
    border-right: none !important;
}

.input-ds-addon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    border: 1.5px solid var(--color-border);
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: var(--color-surface-raised);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
}

.input-ds-addon:hover {
    background: var(--color-border);
    color: var(--color-text);
}

/* Error */
.login-error-ds {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--color-danger, #ef4444) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-danger, #ef4444) 30%, transparent);
    color: var(--color-danger, #ef4444);
    font-size: var(--text-sm);
    font-weight: 500;
}

/* Submit */
.login-submit-btn {
    width: 100%;
    justify-content: center;
    margin-top: var(--space-2);
    height: 56px;
    font-size: var(--text-base);
}

/* Footer */
.login-footer-ds {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-align: center;
    margin: 0;
}

.login-card-ds {
    padding: var(--space-8) var(--space-8);
}

.shift-flow-form {
    padding: var(--space-8) var(--space-8);
}

/* Dark mode */
[data-theme="dark"] .login-card-ds {
    background: var(--color-surface);
    border-color: var(--color-border);
}

/* ============================================================
   Shift Open / Close Flow
   ============================================================ */

/* ── Shift-open: minimal top bar (Profile + Logout only) ── */
.shift-minimal-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    z-index: var(--z-sticky, 10);
}

.shift-minimal-brand {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.shift-minimal-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

[data-theme="dark"] .shift-minimal-header {
    background: var(--color-surface);
    border-bottom-color: var(--color-border);
}

.shift-flow-view {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* fallback for WebViews without dvh support */
    min-height: 100dvh;
    background: var(--color-bg);
}

.shift-flow-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: var(--space-6) var(--space-4);
    padding-top: calc(56px + var(--space-6));
}

.shift-flow-card {
    width: min(480px, 100%);
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
    padding: var(--space-7) var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.shift-flow-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

.shift-flow-icon--open {
    background: color-mix(in srgb, var(--color-success, #22c55e) 15%, transparent);
    color: var(--color-success, #22c55e);
}

.shift-flow-icon--close {
    background: color-mix(in srgb, var(--color-danger, #ef4444) 15%, transparent);
    color: var(--color-danger, #ef4444);
}

.shift-flow-header {
    text-align: center;
}

.shift-flow-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 var(--space-1);
}

.shift-flow-date {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin: 0 0 var(--space-1);
}

.shift-flow-cashier {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin: 0;
}

.shift-flow-cashier strong {
    color: var(--color-text);
}

.shift-flow-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.shift-flow-submit {
    width: 100%;
    justify-content: center;
    height: 56px;
}

.shift-providers-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Close shift modal */
.shift-close-panel {
    width: min(520px, 94vw);
    max-height: 90vh;
    overflow-y: auto;
}

.shift-close-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.shift-close-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    margin-top: var(--space-4);
}

.shift-close-actions .btn {
    min-width: 140px;
    justify-content: center;
}

.shift-close-summary {
    padding: var(--space-4);
    background: var(--color-surface-raised);
    border-radius: var(--radius-lg);
    margin-top: var(--space-4);
}

/* Danger button variant */
.btn-ds-danger {
    background: var(--color-danger, #ef4444);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    padding: var(--space-2) var(--space-4);
    cursor: pointer;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-ds-danger:hover {
    background: color-mix(in srgb, var(--color-danger, #ef4444) 85%, black);
}

.btn-ds-danger:active {
    transform: scale(0.97);
}

/* modal-ds-overlay — backdrop matching design tokens */
.modal-ds-overlay {
    background: rgba(0, 0, 0, 0.55) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ============================================================
   Orders History View
   ============================================================ */

.orders-view-body {
    padding: var(--space-4) var(--space-5);
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.orders-grid-ds {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-3);
}

.orders-paginator-ds {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4) 0;
}

/* Order details modal */
.order-details-panel {
    width: min(560px, 94vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.order-details-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.order-details-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.order-details-list {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-4) 0;
}

.order-details-footer {
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-4);
    flex-shrink: 0;
}

.order-details-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-base);
}

.order-details-total-label {
    color: var(--color-text-muted);
    font-weight: 500;
}

.order-details-total-value {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text);
}

/* ============================================================
   Kitchen Display — DS overrides
   ============================================================ */

.kitchen-container-ds {
    padding: var(--space-4) var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    height: calc(100vh - 56px);
    overflow: hidden;
}

.kitchen-orders-ds {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-3);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    align-content: start;
}

/* ============================================================
   Enhanced Toast & Offline Banner
   ============================================================ */

.toast-ds {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    font-weight: 500;
    max-width: 360px;
    pointer-events: none;
}

.toast-icon {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.9em;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.toast-success .toast-icon { color: var(--color-success, #22c55e); }
.toast-error   .toast-icon { color: var(--color-danger, #ef4444); }
.toast-warning .toast-icon { color: var(--color-warning, #f59e0b); }
.toast-info    .toast-icon { color: var(--color-primary); }

/* Offline banner */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: calc(var(--z-modal) + 10);
    background: var(--color-danger, #ef4444);
    color: #fff;
    text-align: center;
    font-size: var(--text-sm);
    font-weight: 600;
    padding: var(--space-2) var(--space-4);
    animation: slideDown 300ms ease;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
}

/* ============================================================
   Microinteractions & Animation Polish
   ============================================================ */

/* Product card — ping ripple on add to cart */
@keyframes cartPing {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-primary) 50%, transparent); }
    70%  { box-shadow: 0 0 0 12px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

.product-card-v2.cart-ping {
    animation: cartPing 400ms ease-out;
}

/* Qty badge bounce */
@keyframes badgeBounce {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.35); }
    65%  { transform: scale(0.92); }
    100% { transform: scale(1); }
}

.product-qty-badge.badge-bump {
    animation: badgeBounce 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Modal slide-up entrance */
@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.payment-modal-inner,
.modal-panel-ds,
.shift-flow-card,
.login-card-ds {
    animation: modalSlideUp 240ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Button press scale */
.btn:active,
.btn-ds-primary:active,
.btn-ds-secondary:active {
    transform: scale(0.97);
}

/* prefers-reduced-motion: respect user settings */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   Modifier Selection Modal (EPIC 1 — modifiers & combos)
   ============================================================ */

.modifier-panel {
    width: min(560px, 94vw);
    max-height: 88dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: var(--space-5) var(--space-5) var(--space-4);
}

.modifier-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.modifier-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.modifier-price-preview {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    margin-top: var(--space-1);
}

.modifier-price-label {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.modifier-price-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-primary);
}

.modifier-groups {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-4) 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.modifier-group-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-3);
}

.modifier-group-hint {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.modifier-group-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-primary);
    background: var(--color-primary-surface);
    border-radius: var(--radius-full);
    padding: 2px 8px;
}

.modifier-group-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.modifier-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 48px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    user-select: none;
}

.modifier-option:hover {
    border-color: var(--color-border-strong);
}

.modifier-option.selected {
    border-color: var(--color-primary);
    background: var(--color-primary-surface);
}

.modifier-option input {
    width: 20px;
    height: 20px;
    accent-color: var(--color-primary);
    flex-shrink: 0;
    pointer-events: none;
}

.modifier-option.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.modifier-option-name {
    flex: 1 1 auto;
    font-size: 0.95rem;
    color: var(--color-text);
}

.modifier-option-delta {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.modifier-option.selected .modifier-option-delta {
    color: var(--color-primary);
}

/* EPIC 1 — per-modifier ×N count stepper (multi-select groups only). */
.modifier-count-stepper {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.mod-count-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    pointer-events: auto;
}

.mod-count-btn:active {
    background: var(--color-primary-surface);
}

.mod-count-val {
    min-width: 20px;
    text-align: center;
    font-weight: 600;
    color: var(--color-text);
}

.modifier-footer {
    flex-shrink: 0;
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

.modifier-confirm-btn {
    width: 100%;
}

.modifier-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Combo cards + product option tag (EPIC 1) ── */

.combo-card .product-card-image {
    position: relative;
}

.combo-card-badge {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-inverse);
    background: var(--color-primary);
    border-radius: var(--radius-full);
    padding: 2px 8px;
}

.combo-card-components {
    margin: 2px 0 var(--space-1);
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--color-text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-tag {
    display: inline-block;
    margin-top: var(--space-1);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--color-primary);
    background: var(--color-primary-surface);
    border-radius: var(--radius-full);
    padding: 1px 7px;
}

/* ── Cart line sub-details: modifiers + combo components (EPIC 1) ── */

/* Stacked, indented sub-block so modifiers/components stay readable and never
   get squeezed onto one cramped line as more cart items are added. */
.cart-item-modifiers,
.cart-item-components {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    margin-top: var(--space-2);
    padding: var(--space-2);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    max-width: 100%;
}

/* Vertical list of modifier rows; the edit button sits below as a sibling. */
.cart-line-detail-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    max-height: 4.9em;
    overflow-y: auto;
    padding-right: var(--space-1);
}

.cart-line-detail {
    display: block;
    width: 100%;
    font-size: 0.74rem;
    line-height: 1.3;
    color: var(--color-text-secondary);
    word-break: break-word;
    overflow-wrap: anywhere;
}

.cart-line-delta {
    color: var(--color-primary);
    font-weight: 600;
}

.cart-line-edit {
    align-self: flex-start;
    margin-top: var(--space-1);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-primary);
    background: var(--color-primary-surface);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    padding: 5px 12px;
    min-height: 36px;
    cursor: pointer;
}

.pos-cart .cart-line-detail-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.cart-line-edit:hover {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

/* ── Order-details: modifiers + combo tag (EPIC 1) ── */

.order-details-item-mods {
    margin-top: 2px;
    font-size: 0.74rem;
    line-height: 1.3;
    color: var(--color-text-secondary);
}

.order-details-combo-tag {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-inverse);
    background: var(--color-primary);
    border-radius: var(--radius-full);
    padding: 1px 7px;
    vertical-align: middle;
}

/* ============================================================
   POS responsive polish: cart density + compact split payment
   ============================================================ */

html,
body {
    overflow-x: clip;
}

.pos-layout,
/*.payment-modal-inner,*/
.cart-sheet-content {
    min-width: 0;
}

.cart-items,
.cart-sheet-body {
    min-height: 0;
    scrollbar-gutter: stable;
}

.mobile-cart-items .cart-item-v2 {
    /* Re-assert the v2 grid: legacy `.mobile-cart-items .cart-item` forces
       flex-column at equal specificity, which breaks grid-based alignment. */
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    background: var(--color-surface);
}

.mobile-cart-items .cart-item-v2 .cart-item-controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border);
}

.mobile-cart-items .cart-item-v2 .cart-item-total {
    min-width: max-content;
}

@media (max-width: 599px) {
    .cart-sheet-content {
        height: min(88dvh, 680px);
        max-height: calc(100dvh - var(--space-4));
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }

    .cart-sheet-header {
        padding: var(--space-2) var(--space-4) var(--space-3);
    }

    .cart-sheet-header h2 {
        font-size: var(--text-xl);
        line-height: 1.2;
    }

    .cart-sheet-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding: var(--space-3);
        gap: var(--space-2);
        scroll-padding-bottom: var(--space-3);
    }

    .cart-sheet-footer {
        padding: var(--space-3);
        padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
        gap: var(--space-2);
        box-shadow: 0 -12px 24px rgba(15, 23, 42, 0.08);
    }

    .cart-sheet-total {
        min-width: 0;
        padding: var(--space-3);
        gap: var(--space-2);
    }

    .total-label {
        font-size: var(--text-base);
    }

    .total-amount {
        font-size: var(--text-xl);
        min-width: 0;
        overflow-wrap: anywhere;
        text-align: right;
    }

    .cart-sheet-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-2);
    }

    .btn-clear-cart,
    .btn-payment-mobile {
        min-height: 48px;
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-sm);
        min-width: 0;
        white-space: normal;
    }

    .mobile-cart-items .cart-item-v2 {
        grid-template-columns: 1fr;
        gap: var(--space-2);
        width: 100%;
        min-width: 0;
        overflow: hidden;
    }

    .mobile-cart-items .cart-item-v2 .cart-item-info {
        min-width: 0;
        width: 100%;
    }

    .mobile-cart-items .cart-item-v2 .cart-item-name {
        -webkit-line-clamp: 3;
        overflow-wrap: anywhere;
    }

    .mobile-cart-items .cart-item-v2 .cart-item-controls {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: var(--space-2);
    }

    .mobile-cart-items .cart-item-v2 .cart-item-quantity {
        justify-self: start;
        max-width: 100%;
    }

    .mobile-cart-items .cart-item-v2 .cart-item-total {
        justify-self: end;
        /* Total is always short ("660 сом"); keep it on one line so the
           "сом" unit never breaks character-by-character. */
        min-width: max-content;
        white-space: nowrap;
    }

    .mobile-cart-items .cart-item-modifiers,
    .mobile-cart-items .cart-item-components {
        width: 100%;
        padding: var(--space-2);
    }

    .mobile-cart-items .cart-line-detail-list {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .payment-modal-v2 .payment-right-panel {
        padding: var(--space-4);
        gap: var(--space-3);
    }

    .payment-right-header {
        align-items: flex-start;
        gap: var(--space-2);
    }

    .payment-total-value {
        font-size: var(--text-2xl);
    }

    .payment-chip-label {
        flex: 1 1 calc(50% - var(--space-2));
        justify-content: center;
        min-width: 0;
        padding: var(--space-2);
        text-align: center;
        white-space: nowrap;
    }

    #bank-options .payment-chip-label,
    #service-mode-options .payment-chip-label {
        flex: 1 1 100%;
    }

}

@media (min-width: 600px) and (max-width: 1023px) {
    .pos-cart .cart-item-v2 {
        grid-template-columns: 1fr;
    }

    .pos-cart .cart-item-v2 .cart-item-controls {
        grid-column: 1;
        width: 100%;
        min-width: 0;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .pos-cart .cart-line-detail-list {
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 430px) {
    .product-card-body {
        padding: var(--space-2);
    }

    .product-card-name {
        min-height: auto;
        overflow-wrap: anywhere;
    }

    .mobile-cart-fab {
        /*left: var(--space-3);*/
        right: var(--space-3);
        bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
        width: auto;
    }

    .fab-content {
        min-width: 0;
    }

    .fab-text {
        min-width: 0;
    }

    .fab-price {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-cart-items .cart-item-v2 {
        padding: var(--space-2);
        border-radius: var(--radius-md);
    }

    .mobile-cart-items .cart-item-v2 .cart-item-controls {
        gap: var(--space-2);
    }

    .cart-item-v2 .cart-item-quantity {
        gap: var(--space-1);
    }

    .cart-qty-btn,
    .mobile-cart-items .cart-item-quantity-btn {
        min-width: 40px;
        min-height: 40px;
        width: 40px;
        height: 40px;
        margin: 0;
        padding: 0;
    }

    .cart-item-v2 .cart-item-total {
        font-size: var(--text-sm);
    }

    .cart-line-detail-list {
        max-height: 3.9em;
    }

    .mobile-cart-items .cart-line-detail-list {
        max-height: none;
        overflow: visible;
    }

    .payment-modal-v2 .payment-modal-inner {
        max-height: 88dvh;
    }

    .payment-modal-v2 .payment-right-panel {
        padding: var(--space-3);
    }

    .payment-header-total {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }

}

@media (max-width: 360px) {
    .mobile-cart-fab {
        /*left: var(--space-3);*/
        right: var(--space-3);
        bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
        width: auto;
    }

    .fab-content {
        min-width: 0;
    }

    .fab-text {
        min-width: 0;
    }

    .fab-price {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .cart-sheet-content {
        height: min(90dvh, 640px);
        max-height: calc(100dvh - var(--space-2));
    }

    .cart-sheet-header,
    .cart-sheet-body,
    .cart-sheet-footer {
        padding-left: var(--space-2);
        padding-right: var(--space-2);
    }

    .cart-sheet-total {
        align-items: flex-start;
        flex-direction: column;
    }

    .total-amount {
        text-align: left;
    }

    .cart-sheet-actions {
        grid-template-columns: 1fr;
    }

    .mobile-cart-items .cart-item-v2 .cart-item-controls {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .mobile-cart-items .cart-item-v2 .cart-item-quantity,
    .mobile-cart-items .cart-item-v2 .cart-item-total {
        justify-self: stretch;
        max-width: none;
    }

    .mobile-cart-items .cart-item-v2 .cart-item-total {
        text-align: left;
    }

    .payment-chip-label {
        flex-basis: 100%;
    }

}
