/*
 * Lock the admin chrome to the viewport while POS is open.
 */
body:has(.pos-page) {
    overflow: hidden !important;
    height: 100dvh;
    max-height: 100dvh;
    background-color: #f4f7fa; /* Premium soft background */
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
body:has(.pos-page) .page {
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0 !important;
    overflow: hidden;
    justify-content: flex-start;
}
/* Hide admin chrome footer only — never the cart totals block */
body:has(.pos-page) .footer:not(.pos-cart-foot) {
    display: none !important;
}
body:has(.pos-page) .main-content.app-content {
    flex: none !important;
    height: calc(100dvh - 4.25rem) !important;
    max-height: calc(100dvh - 4.25rem) !important;
    min-height: 0 !important;
    margin-block-start: 4.25rem !important;
    margin-block-end: 0 !important;
    padding-block: 0 !important;
    display: flex !important;
    flex-direction: column;
    overflow: hidden !important;
    box-sizing: border-box;
}
body:has(.pos-page) .main-content.app-content > .container-fluid {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-block: 0 !important;
}
body:has(.pos-page) .admin-page {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-block: 0.5rem !important;
    padding-inline: 0.85rem;
    box-sizing: border-box;
    background: #f4f7fa;
}
body:has(.pos-page) .admin-page > * {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-page.admin-page-shell {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    margin-bottom: 0;
}
.pos-page .admin-page-header {
    flex-shrink: 0;
    margin-bottom: 0.35rem;
    background: transparent;
}
.pos-page .admin-breadcrumb {
    flex-shrink: 0;
    margin-bottom: 0.1rem;
}
.pos-page .admin-page-title { margin-bottom: 0; font-size: 1.25rem; font-weight: 800; color: #1e293b; letter-spacing: -0.02em; }
.pos-page .admin-page-subtitle { margin-bottom: 0; font-size: 0.8rem; color: #64748b; font-weight: 500; }

.pos-shell {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* Custom Scrollbar for POS */
.pos-product-grid::-webkit-scrollbar,
.pos-lines::-webkit-scrollbar {
    width: 8px; /* Slightly wider to be more prominent */
}
.pos-product-grid::-webkit-scrollbar-track,
.pos-lines::-webkit-scrollbar-track {
    background: rgba(226, 232, 240, 0.6); /* Visible track */
    border-radius: 10px;
}
.pos-product-grid::-webkit-scrollbar-thumb,
.pos-lines::-webkit-scrollbar-thumb {
    background-color: rgba(100, 116, 139, 0.7); /* More opaque thumb */
    border-radius: 10px;
    border: 2px solid rgba(226, 232, 240, 0.6); /* Creates a padded effect */
}
.pos-product-grid::-webkit-scrollbar-thumb:hover,
.pos-lines::-webkit-scrollbar-thumb:hover {
    background-color: rgba(71, 85, 105, 0.9);
}

/* Toasts */
.pos-toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    animation: slideInDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
.pos-toast-success { background: linear-gradient(135deg, #059669 0%, #10b981 100%); }
.pos-toast-error { background: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%); }
.pos-toast-icon {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: grid; place-items: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

/* Checkout Bar — Guest/Customer + lookup/card on ONE row */
.pos-checkout-bar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 10px 15px -3px rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    min-width: 0;
}

.pos-checkout-bar-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    min-width: 0;
}

.pos-checkout-bar-right {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    position: relative;
}

.pos-mode-label {
    display: none; /* keep a single visual row with mode + lookup */
}
.pos-mode-toggle {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.35rem;
    align-items: stretch;
}
.pos-mode-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0 0.55rem;
    height: 36px;
    border-radius: 10px;
    border: 1.5px solid transparent;
    background: #f8fafc;
    text-align: left;
    transition: all .2s ease;
    cursor: pointer;
    margin-bottom: 0;
    flex: 0 0 auto;
    white-space: nowrap;
}
.pos-mode-btn:hover { background: #f1f5f9; }
.pos-mode-btn.is-active {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.12);
}
.pos-mode-btn input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.pos-mode-radio {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .2s ease;
    background: #fff;
}
.pos-mode-radio::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: transparent;
    transition: all .2s ease;
}
.pos-mode-btn.is-active .pos-mode-radio {
    border-color: #3b82f6;
    background: #3b82f6;
    box-shadow: none;
}
.pos-mode-btn.is-active .pos-mode-radio::after {
    background: #fff;
}
.pos-mode-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.1;
    min-width: 0;
}
.pos-mode-text strong { font-size: 0.8rem; font-weight: 700; color: #0f172a; }
.pos-mode-text small { display: none; } /* keep mode buttons same height as Find input */

/* Guest Banner */
.pos-guest-banner {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.65rem;
    border-radius: 10px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    color: #334155;
    min-width: 0;
}
.pos-guest-banner > i { color: #64748b; font-size: 1.1rem; flex-shrink: 0; }
.pos-guest-banner > div { min-width: 0; }
.pos-guest-banner .fw-semibold { font-size: 0.85rem; }
.pos-guest-banner .small { font-size: 0.7rem; }

/* Lookup */
.pos-lookup { width: 100%; position: relative; }
.pos-lookup-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
}
.pos-lookup-row .btn {
    border-radius: 10px;
    height: 36px;
    min-width: 4.25rem;
    flex: 0 0 auto;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
    transition: all .2s ease;
}
.pos-lookup-row .btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.25);
}
.pos-lookup-error {
    margin-top: 0.35rem;
    color: #e11d48;
    font-size: 0.8rem;
    font-weight: 500;
}
.pos-lookup-search {
    flex: 1 1 auto;
    min-width: 0;
}
.pos-lookup-search .form-control {
    height: 36px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1.5px solid transparent;
    padding-left: 2.35rem;
    font-size: 0.85rem;
    transition: all .2s ease;
    width: 100%;
}
.pos-lookup-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.95rem;
    pointer-events: none;
}
.pos-lookup-search .form-control:focus {
    background: #fff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.pos-lookup-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.5rem);
    max-height: min(300px, 40vh);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.15);
    z-index: 20;
}
.pos-lookup-item {
    text-align: left;
    border: 1px solid transparent;
    background: #fff;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all .15s ease;
}
.pos-lookup-item:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
}
.pos-lookup-item-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: #0f172a;
    font-weight: 600;
}
.pos-lookup-item-meta {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.2rem;
}

/* Customer Card — fixed 3 lines */
.pos-customer-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.7rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #bfdbfe;
    min-width: 0;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.7);
}
.pos-customer-avatar {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 800; font-size: 0.8rem;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.28);
}
.pos-customer-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.pos-customer-line {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    flex-wrap: nowrap;
    overflow: hidden;
}
.pos-customer-line1 .pos-customer-name {
    font-weight: 800;
    color: #0f172a;
    font-size: 0.9rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 0 1 auto;
    max-width: 100%;
}
.pos-type-badge {
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.62rem;
    font-weight: 800;
    padding: 0.15rem 0.4rem;
    flex-shrink: 0;
}
.pos-price-chip {
    flex-shrink: 0;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 0.65rem;
    font-weight: 700;
    white-space: nowrap;
}
.pos-customer-line2 {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 500;
}
.pos-customer-line2 .pos-sponsor {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto;
}
.pos-meta-sep { color: #cbd5e1; flex-shrink: 0; }
.pos-customer-line3 {
    gap: 0.3rem;
}
.pos-wallet {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #1d4ed8;
    font-weight: 700;
    font-size: 0.72rem;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1.2;
    flex-shrink: 0;
}
.pos-wallet i { font-size: 0.68rem; opacity: 0.9; }
.pos-wallet-label {
    font-weight: 800;
    opacity: 0.9;
}
.pos-wallet-label::after {
    content: ":";
}
.pos-wallet.pos-ecash {
    color: #b45309;
    background: #fef3c7;
    border-color: #fcd34d;
}
.pos-customer-change {
    padding: 0.2rem 0.65rem;
    font-size: 0.75rem;
    align-self: center;
}

/* Layout: left = checkout + products; right = full-height cart */
.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
}

.pos-main {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.pos-main .pos-products {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
}

.pos-layout > .pos-cart.pos-panel {
    min-height: 0;
    height: 100%;
    max-height: 100%;
    align-self: stretch;
    overflow: hidden;
    /* header | scrollable lines | totals+payment pinned */
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.pos-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 20px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.05), 0 8px 10px -6px rgba(15, 23, 42, 0.02);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    height: 100%;
}

.pos-panel-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
    flex-shrink: 0;
}

/* Search */
.pos-search {
    position: relative;
    flex: 1;
    min-width: 0;
}
.pos-search > i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 0.95rem;
}
.pos-search .form-control {
    padding-left: 2.35rem;
    border-radius: 10px;
    border: 1.5px solid transparent;
    background: #f8fafc;
    height: 36px;
    font-size: 0.85rem;
    transition: all .2s ease;
}
.pos-search .form-control:focus {
    background: #fff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Product Grid */
.pos-product-grid {
    padding: 0.65rem 0.75rem;
    overflow-y: scroll;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}

.product-tile {
    width: 100%;
    height: 100%;
    text-align: left;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all .25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.product-tile:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.01);
    border-color: #93c5fd;
    box-shadow: 0 15px 30px -5px rgba(37, 99, 235, 0.15), 0 8px 10px -6px rgba(37, 99, 235, 0.1);
}
.product-tile:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}
.product-tile:disabled,
.product-tile.is-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(100%);
}
.product-tile-img {
    position: relative;
    height: 120px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    color: #cbd5e1;
    font-size: 2rem;
    border-bottom: 1px solid #f1f5f9;
}
.product-tile-img img {
    max-height: 100px;
    max-width: 85%;
    object-fit: contain;
    transition: transform .3s ease;
}
.product-tile:hover:not(:disabled) .product-tile-img img {
    transform: scale(1.05);
}
.product-tile-body { padding: 1rem; }
.product-tile-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #0f172a;
    line-height: 1.3;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 2.6em; /* 2 lines */
}
.product-tile-extension {
    font-size: 0.68rem;
    color: #64748b;
    font-weight: 500;
    line-height: 1.25;
    margin-bottom: 0.1rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.product-tile-sku {
    font-size: 0.72rem;
    color: #64748b;
    margin-bottom: 0.1rem;
    font-weight: 500;
}
.product-tile-variant {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 0.1rem;
}
.product-tile-options-badge {
    position: absolute;
    left: 0.5rem;
    bottom: 0.5rem;
    z-index: 1;
    background: rgba(15, 23, 42, 0.82);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0.2rem 0.45rem;
    border-radius: 0.35rem;
}
.product-tile-flash-badge {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.22rem 0.5rem;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.35);
    line-height: 1.2;
}
.product-tile-flash-badge i {
    font-size: 0.58rem;
}
.product-tile-ids {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.55rem;
    margin-bottom: 0.55rem;
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 500;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.product-tile-spu,
.product-tile-exsku {
    font-size: inherit;
    color: inherit;
    font-weight: inherit;
    font-family: inherit;
    margin: 0;
}
.product-tile-sku + .product-tile-prices {
    margin-top: 0.45rem;
}
.product-tile-prices {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}
.price-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.4rem 0.2rem;
    transition: all .2s ease;
}
.price-item.is-active {
    background: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}
.price-item.is-flash {
    background: #fff7ed;
    border-color: #fb923c;
}
.price-item.is-flash .price-label {
    color: #c2410c;
}
.price-item.is-flash .price-val {
    color: #9a3412;
}
.price-item.is-flash.is-active {
    background: #ffedd5;
    border-color: #ea580c;
    box-shadow: 0 4px 10px rgba(234, 88, 12, 0.2);
}
.price-item.is-flash.is-active .price-label { color: #9a3412; }
.price-item.is-flash.is-active .price-val { color: #7c2d12; }
.price-item.is-flash.is-active .price-val small { color: #ea580c; }
.price-label { 
    font-weight: 800; 
    font-size: 0.65rem; 
    color: #94a3b8; 
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    margin-bottom: 0.15rem;
}
.price-item.is-active .price-label { color: #1d4ed8; }
.price-val { 
    font-weight: 700; 
    font-size: 0.8rem; 
    color: #475569; 
    text-align: center;
}
.price-val small {
    font-size: 0.6rem;
    color: #94a3b8;
    font-weight: 600;
}
.price-item.is-active .price-val { 
    color: #1e3a8a; 
    font-weight: 800;
}
.price-item.is-active .price-val small { color: #3b82f6; }

.product-tile-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: auto;
    border-top: 1px solid #f1f5f9;
    padding-top: 0.75rem;
}
.product-tile-pv {
    font-size: 0.8rem;
    font-weight: 800;
    color: #059669;
    display: flex;
    align-items: center;
}
.stock-pill {
    min-width: 2.5rem;
    text-align: center;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 0.75rem;
    font-weight: 800;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
.stock-pill.is-low { background: #fef3c7; color: #b45309; }

/* Cart */
.pos-cart {
    background: #fff;
    min-height: 0;
    overflow: hidden;
}
.pos-cart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 0.75rem;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    grid-row: 1;
}
.pos-cart-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.01em;
}
.pos-cart-sub {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

.pos-lines {
    grid-row: 2;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 0;
    background: #f8fafc;
}
.pos-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    text-align: center;
    color: #94a3b8;
    min-height: 8rem;
    height: auto;
}
.pos-empty i { font-size: 3rem; margin-bottom: 1rem; color: #cbd5e1; }
.pos-empty-cart { min-height: 8rem; }

.pos-line-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.pos-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    transition: background .2s ease;
}
.pos-line:hover { background: #f8fafc; }
.pos-line-info { min-width: 0; }
.pos-line-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: #0f172a;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.4rem;
    min-width: 0;
}
.pos-line-flash-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fdba74;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    line-height: 1.2;
    white-space: nowrap;
    flex: 0 0 auto;
}
.pos-line-flash-badge i {
    font-size: 0.58rem;
}
.pos-line-extension {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 500;
    margin-top: 0.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pos-line-sku { font-size: 0.75rem; color: #64748b; font-weight: 500; margin-top: 0.1rem; }
.pos-line-variant {
    font-size: 0.78rem;
    color: #334155;
    font-weight: 600;
    margin-top: 0.1rem;
}

/* Variant picker modal */
.pos-variant-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.pos-variant-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    text-align: left;
    border: 1px solid #e2e8f0;
    border-radius: 0.65rem;
    background: #fff;
    padding: 0.75rem 0.9rem;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.pos-variant-option:hover:not(:disabled) {
    border-color: #94a3b8;
    background: #f8fafc;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.pos-variant-option.is-disabled,
.pos-variant-option:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.pos-variant-option-name {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.95rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.4rem;
}
.pos-variant-flash-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fdba74;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    line-height: 1.2;
    white-space: nowrap;
}
.pos-variant-flash-badge i {
    font-size: 0.58rem;
}
.pos-variant-option-sku {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 0.15rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.pos-variant-option-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    flex-shrink: 0;
}
.pos-variant-option-price {
    font-weight: 800;
    color: #0f172a;
    font-size: 0.9rem;
}
.pos-variant-option-price small {
    font-weight: 600;
    color: #64748b;
    margin-left: 0.2rem;
}
.pos-line-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
    min-width: 0;
}
.pos-line-total {
    font-weight: 800;
    font-size: 0.9rem;
    color: #0f172a;
    min-width: 4rem;
    text-align: right;
    white-space: nowrap;
}
.pos-line-remove {
    border: 0;
    background: #e2e8f0;
    color: #475569;
    width: 32px; height: 32px;
    border-radius: 8px;
    display: grid; place-items: center;
    cursor: pointer;
    transition: all .2s ease;
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
}
.pos-line-remove i {
    color: inherit;
    opacity: 1;
    pointer-events: none;
    font-size: 1.05rem;
    line-height: 1;
}
.pos-line-remove:hover { background: #fee2e2; color: #e11d48; }

.pos-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    flex-shrink: 0;
}
.pos-qty button {
    width: 28px; height: 30px;
    border: 0; background: #f8fafc;
    color: #475569; font-weight: 800;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background .2s ease;
}
.pos-qty button:hover { background: #e2e8f0; color: #0f172a; }
.pos-qty input {
    width: 32px; height: 30px;
    border: 0; border-left: 1px solid #e2e8f0; border-right: 1px solid #e2e8f0;
    text-align: center; font-size: 0.85rem; font-weight: 700; color: #0f172a;
    outline: none;
}
.pos-qty input:focus { background: #eff6ff; }

.pos-cart-foot {
    grid-row: 3;
    padding: 0.85rem 1rem;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.02);
    position: relative;
    z-index: 2;
    display: flex !important;
    flex-direction: column;
    gap: 0.55rem;
    min-height: 0;
    max-height: min(52vh, 100%);
    overflow: hidden;
    visibility: visible !important;
}
.pos-cart-foot-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 0.15rem;
}
.pos-totals-refresh-btn {
    border: 0;
    background: #f1f5f9;
    color: #475569;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
    padding: 0;
    font-size: 0.95rem;
    line-height: 1;
    flex-shrink: 0;
    vertical-align: middle;
}
.pos-totals-refresh-btn i {
    display: block;
    font-size: 0.95rem;
    line-height: 1;
}
.pos-totals-refresh-btn:hover:not(:disabled) {
    background: #e2e8f0;
    color: #0f172a;
}
.pos-totals-refresh-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.pos-totals-refresh-btn.is-spinning {
    opacity: 1;
    cursor: wait;
    pointer-events: none;
}
.pos-totals-refresh-btn.is-spinning i {
    display: inline-block;
    animation: pos-totals-spin 0.65s linear infinite;
}
@keyframes pos-totals-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.pos-total-pv-value,
.pos-total-main-value {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.pos-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
    color: #475569;
    font-size: 0.9rem;
    font-weight: 600;
}
.pos-total-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #0f172a;
    font-size: 1.25rem;
    font-weight: 900;
    margin-bottom: 0.65rem;
    padding-top: 0.35rem;
    border-top: 1px dashed #cbd5e1;
}
.pos-total-main small {
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
}

.pos-pay { margin-bottom: 0.35rem; }
.pos-pay-label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.35rem;
}
.pos-pay-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
}
.pos-pay-toggle.is-member {
    /* Never squeeze 5 into one row — labels get clipped */
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.pos-pay-toggle .pos-pay-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid #cbd5e1 !important;
    background: #ffffff !important;
    border-radius: 10px;
    padding: 0.4rem 0.35rem;
    font-weight: 700;
    font-size: 0.78rem;
    line-height: 1.15;
    color: #0f172a !important;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    box-shadow: none !important;
    min-height: 2.6rem;
    min-width: 0;
    overflow: visible;
}
.pos-pay-toggle .pos-pay-btn .pos-pay-btn-label {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
    text-align: center;
    font-size: 0.72rem;
    line-height: 1.1;
    color: inherit !important;
}
.pos-pay-toggle .pos-pay-btn i {
    display: inline-block !important;
    color: inherit !important;
    opacity: 1 !important;
    font-size: 0.9rem;
    flex-shrink: 0;
    line-height: 1;
}
.pos-pay-toggle .pos-pay-btn:hover:not(:disabled):not(.is-active) {
    border-color: #94a3b8 !important;
    background: #f1f5f9 !important;
    color: #0f172a !important;
}
.pos-pay-toggle .pos-pay-btn:disabled,
.pos-pay-toggle .pos-pay-btn.is-disabled {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #94a3b8 !important;
    cursor: not-allowed;
    opacity: 1;
}
.pos-pay-toggle .pos-pay-btn.is-active,
.pos-pay-toggle .pos-pay-btn.is-active:hover:not(:disabled) {
    background: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: #ffffff !important;
    box-shadow: 0 3px 8px rgba(29, 78, 216, 0.25) !important;
}
.pos-pay-toggle .pos-pay-btn.is-active i,
.pos-pay-toggle .pos-pay-btn.is-active .pos-pay-btn-label {
    color: #ffffff !important;
}
.pos-pay-hint {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: #64748b;
    line-height: 1.3;
}
.pos-pay-hint.is-warn { color: #b45309; }
.pos-pay-extra { margin-top: 0.4rem; }
.pos-pay-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}
.pos-pay-row > .form-label,
.pos-pay-row > label {
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 0;
    white-space: nowrap;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.2;
}
.pos-pay-row > .form-select,
.pos-pay-row > select {
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important;
    max-width: 100%;
}
.pos-gift-input {
    margin-top: 0.35rem;
}
.pos-gift-input .form-control,
.pos-gift-input .form-select,
.pos-pay-row .form-select {
    border-radius: 8px;
    height: 34px;
    border-color: #e2e8f0;
    font-size: 0.85rem;
}
.pos-split-btn {
    margin-top: 0.45rem;
    padding: 0.4rem 0.5rem;
    font-weight: 700;
    border: 0;
    color: #78350f;
    background: #f59e0b;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
}
.pos-split-btn:hover:not(:disabled) {
    color: #78350f;
    background: #d97706;
    box-shadow: 0 4px 10px rgba(217, 119, 6, 0.4);
}
.pos-split-btn:disabled {
    opacity: 0.55;
    box-shadow: none;
}

.pos-checkout-btn {
    width: 100%;
    flex-shrink: 0;
    border: 0;
    border-radius: 12px;
    padding: 0.8rem 0.85rem;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.01em;
    color: #fff;
    /* Distinct from blue payment toggles — dark primary action */
    background: #0f172a;
    box-shadow: 0 8px 18px -4px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(15, 23, 42, 0.35);
    cursor: pointer;
    transition: all .2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.pos-checkout-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    background: #020617;
    box-shadow: 0 14px 24px -5px rgba(2, 6, 23, 0.55), 0 0 0 1px rgba(2, 6, 23, 0.4);
}
.pos-checkout-btn:active:not(:disabled) {
    transform: translateY(1px);
    background: #1e293b;
    box-shadow: 0 5px 10px -5px rgba(15, 23, 42, 0.4);
}
.pos-checkout-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    background: #94a3b8;
    color: #f8fafc;
}

/* Narrow cart column: two-row line items */
@media (max-width: 1366px) {
    .pos-layout {
        grid-template-columns: minmax(0, 1fr) 340px;
        gap: 1rem;
    }

    .pos-line {
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
        gap: 0.55rem;
        padding: 0.75rem 0.9rem;
    }
    .pos-line-actions {
        width: 100%;
        justify-content: space-between;
    }
    .pos-line-total {
        margin-left: auto;
        min-width: 0;
    }

    .pos-cart-head {
        padding: 0.9rem 0.9rem 0.6rem;
    }
    .pos-cart-title { font-size: 1.1rem; }
    .pos-cart-foot {
        padding: 0.7rem 0.75rem;
        gap: 0.45rem;
        max-height: min(58vh, 100%);
    }
    .pos-total-row {
        margin-bottom: 0.25rem;
        font-size: 0.85rem;
    }
    .pos-total-main {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
        padding-top: 0.25rem;
    }
    .pos-total-main small { font-size: 0.75rem; }
    .pos-pay { margin-bottom: 0.25rem; }
    .pos-pay-label { margin-bottom: 0.25rem; }
    .pos-pay-toggle { gap: 0.3rem; }
    .pos-pay-toggle.is-member {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .pos-pay-toggle .pos-pay-btn {
        padding: 0.35rem 0.2rem;
        font-size: 0.72rem;
        border-radius: 8px;
        gap: 0.1rem;
        min-height: 2.4rem;
    }
    .pos-pay-toggle .pos-pay-btn .pos-pay-btn-label { font-size: 0.68rem; }
    .pos-gift-input .form-control,
    .pos-gift-input .form-select,
    .pos-pay-row .form-select { height: 32px; font-size: 0.8rem; }
    .pos-checkout-btn {
        padding: 0.65rem;
        font-size: 0.9rem;
        border-radius: 10px;
    }
}

/* Short desktop height: reclaim space for product grid */
@media (max-height: 900px) {
    .pos-page .admin-page-subtitle { display: none; }
    .pos-mode-text small { display: none; }
    .pos-guest-banner .small { display: none; }
    .pos-mode-label { display: none; }
    .pos-checkout-bar {
        padding: 0.4rem 0.55rem;
        gap: 0.4rem;
    }
    .pos-mode-btn,
    .pos-lookup-search .form-control,
    .pos-lookup-row .btn {
        height: 32px;
    }
    .pos-mode-btn { padding: 0 0.45rem; }
    .pos-customer-card { padding: 0.35rem 0.5rem; }
    .pos-customer-avatar { width: 30px; height: 30px; font-size: 0.68rem; border-radius: 8px; }
    .pos-customer-line2 { display: none; } /* hide # / sponsor on short screens */
    .pos-panel-head { padding: 0.4rem 0.55rem; }
    .pos-search .form-control,
    .pos-lookup-search .form-control,
    .pos-lookup-row .btn { height: 32px; }
    .pos-product-grid { padding: 0.45rem 0.55rem; }
    .pos-shell { gap: 0.4rem; }
    .pos-main { gap: 0.4rem; }
}

@media (max-height: 820px) {
    .pos-main { gap: 0.35rem; }
    .pos-checkout-bar {
        padding: 0.35rem 0.5rem;
        gap: 0.35rem;
    }
    .pos-mode-btn { padding: 0 0.4rem; }
    .pos-customer-card { padding: 0.3rem 0.45rem; }
    .pos-customer-avatar { width: 28px; height: 28px; font-size: 0.65rem; }
    .pos-cart-head {
        padding: 0.65rem 0.75rem 0.4rem;
    }
    .pos-cart-title { font-size: 1rem; }
    .pos-line {
        padding: 0.55rem 0.75rem;
        gap: 0.4rem;
    }
    .pos-cart-foot {
        padding: 0.55rem 0.7rem;
        gap: 0.4rem;
        max-height: min(48vh, 100%);
    }
    .pos-total-main {
        font-size: 1.05rem;
        margin-bottom: 0.4rem;
        padding-top: 0.2rem;
    }
    .pos-pay { margin-bottom: 0.2rem; }
    .pos-pay-toggle.is-member {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .pos-pay-toggle .pos-pay-btn {
        padding: 0.3rem 0.15rem;
        font-size: 0.7rem;
        min-height: 2.25rem;
    }
    .pos-pay-toggle .pos-pay-btn i { font-size: 0.8rem; }
    .pos-pay-toggle .pos-pay-btn .pos-pay-btn-label { font-size: 0.65rem; }
    .pos-gift-input .form-control,
    .pos-gift-input .form-select,
    .pos-pay-row .form-select { height: 30px; }
    .pos-checkout-btn {
        padding: 0.55rem;
        font-size: 0.85rem;
    }
}

@media (max-height: 700px) {
    .pos-cart-foot {
        max-height: min(42vh, 100%);
    }
    .pos-pay-toggle.is-member {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .pos-pay-toggle .pos-pay-btn {
        min-height: 2.2rem;
        padding: 0.3rem 0.15rem;
    }
    .pos-pay-toggle .pos-pay-btn .pos-pay-btn-label {
        display: block !important;
        font-size: 0.65rem;
    }
    .product-tile-img { height: 72px; }
    .product-tile-img img { max-height: 60px; }
    .product-tile-body { padding: 0.55rem; }
    .product-tile-name { font-size: 0.8rem; height: 2.2em; }
    .product-tile-prices { margin-bottom: 0.4rem; }
    .product-tile-meta { padding-top: 0.4rem; }
}

/* Keep Guest/Customer + lookup on one row; only stack on very narrow viewports */
@media (max-width: 900px) {
    .pos-checkout-bar {
        flex-wrap: wrap;
    }
    .pos-checkout-bar-left {
        flex: 1 1 100%;
    }
    .pos-mode-toggle {
        width: 100%;
    }
    .pos-mode-btn {
        flex: 1 1 0;
        justify-content: center;
    }
}

/* Stacked: main (checkout + products) above cart */
@media (max-width: 1180px) {
    .pos-layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
        gap: 0.85rem;
    }
    .pos-layout > .pos-cart.pos-panel {
        min-height: 0;
        max-height: 100%;
        height: auto;
        overflow: hidden;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto;
    }
    .pos-line {
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
        gap: 0.5rem;
    }
    .pos-line-actions {
        width: 100%;
        justify-content: space-between;
    }
}
