/* ════════════════════════════════════════════════════════════
   POS — Modern Clean Design  (vars live in app.css :root)
   ════════════════════════════════════════════════════════════ */

/* ── Root wrapper ── */
.pos-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: var(--pos-bg);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ════════════════════════════════════════
   MOBILE TOP BAR
════════════════════════════════════════ */
.pos-mobile-topbar {
    display: none;
    align-items: center;
    padding: 0.45rem 0.9rem;
    background: #fff;
    border-bottom: 1px solid var(--pos-border);
    gap: 0.5rem;
    flex-shrink: 0;
    z-index: 20;
    box-shadow: 0 1px 6px rgba(108,92,231,.07);
}

.pmtb-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--pos-muted);
    cursor: pointer;
    padding: 0.3rem 0.75rem;
    border-radius: var(--pos-radius-sm);
    transition: color 0.2s, background 0.2s;
    line-height: 1;
}

.pmtb-tab i { font-size: 1.05rem; margin-bottom: 1px; }

.pmtb-tab.pmtb-active {
    color: var(--pos-primary);
    background: var(--pos-primary-light);
}

.pmtb-center { flex: 1; text-align: center; }

.pmtb-order-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--pos-primary-light);
    color: var(--pos-primary);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.22rem 0.8rem;
    border-radius: 999px;
    letter-spacing: 0.01em;
}

.pmtb-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 999px;
    background: var(--pos-danger);
    color: #fff;
    font-size: 0.52rem;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
    pointer-events: none;
}

/* ════════════════════════════════════════
   MAIN BODY
════════════════════════════════════════ */
.pos-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ════════════════════════════════════════
   LEFT — PRODUCTS PANEL
════════════════════════════════════════ */
.pos-products-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    background: var(--pos-bg);
}

.salesperson-dashboard-host { flex-shrink: 0; }

/* ── Controls Row (search + category combo + warehouse) ── */
.ppp-controls {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    background: #fff;
    border-bottom: 1px solid #e2dffe;
    flex-wrap: nowrap;
}

.ppp-search {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    background: var(--pos-primary-xlight);
    border: 1.5px solid var(--pos-border);
    border-radius: 999px;
    padding: 0 0.7rem;
    gap: 0.45rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    height: 36px;
}

.ppp-search:focus-within {
    border-color: var(--pos-primary);
    box-shadow: 0 0 0 3px rgba(108,92,231,.11);
}

.ppp-search-icon {
    color: var(--pos-muted);
    font-size: 0.78rem;
    flex-shrink: 0;
}

.ppp-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 0.82rem;
    color: var(--pos-text);
    outline: none;
    height: 100%;
}

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

.ppp-search-action {
    background: none;
    border: none;
    color: var(--pos-primary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    opacity: 0.75;
}

.ppp-warehouse-select {
    flex-shrink: 0;
    background: #fff;
    border: 1.5px solid var(--pos-border);
    border-radius: var(--pos-radius-sm);
    font-size: 0.78rem;
    color: var(--pos-text);
    padding: 0 0.55rem;
    height: 36px;
    outline: none;
    cursor: pointer;
    max-width: 145px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ppp-warehouse-select:focus {
    border-color: var(--pos-primary);
    box-shadow: 0 0 0 3px rgba(108,92,231,.11);
}

/* ── Stats row (slim info bar) ── */
.ppp-stats {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    height: 30px;
    background: #faf9ff;
    border-bottom: 1px solid #e2dffe;
    overflow: hidden;
}

.ppp-stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--pos-primary-light);
    color: var(--pos-primary);
    font-size: 0.68rem;
    padding: 0.18rem 0.6rem;
    border-radius: 999px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.ppp-stat-chip i { font-size: 0.65rem; }
.ppp-stat-chip strong { font-weight: 700; }

.ppp-receive-banner {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.35rem 0.55rem 0;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.3;
}
.ppp-receive-banner:hover {
    background: #ffedd5;
    color: #7c2d12;
    text-decoration: none;
}
.ppp-receive-banner span { flex: 1; }
.ppp-receive-banner i:last-child { opacity: .7; }

/* .ppp-categories and .ppp-cat-pill removed — replaced by .ppp-cat-select combo in controls row */

/* ── Category combo (select in controls row) ── */
.ppp-cat-select {
    flex-shrink: 0;
    height: 36px;
    background: #fff;
    border: 1.5px solid #c9c3f7;
    border-radius: var(--pos-radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    color: #5a4bd1;
    padding: 0 0.55rem;
    outline: none;
    cursor: pointer;
    max-width: 148px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 1px 4px rgba(108,92,231,.08);
}

.ppp-cat-select:focus {
    border-color: #6C5CE7;
    box-shadow: 0 0 0 3px rgba(108,92,231,.12);
}

/* ── Products Grid ── */
.ppp-grid {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.4rem;
    align-content: start;
    background: #f8fafc;
}

.ppp-grid::-webkit-scrollbar { width: 4px; }
.ppp-grid::-webkit-scrollbar-track { background: transparent; }
.ppp-grid::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

/* ── Product Card ── */
.ppp-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s;
    position: relative;
    display: flex;
    flex-direction: column;
    user-select: none;
    min-height: 122px !important;
}

.ppp-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.1);
    border-color: #93c5fd;
}

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

.ppp-card.ppp-card-oos {
    opacity: 1;
    cursor: default;
    border-color: #e5e7eb;
    background: #ffffff;
}

/* Image area — clean soft background with icon */
.ppp-card-img {
    width: 100%;
    height: 62px;
    background: #ffffff;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Shopping icon placeholder */
.ppp-card-img::before {
    content: "\f291"; /* fa-shopping-basket */
    font-family: "Font Awesome 5 Free", "Font Awesome 6 Free", FontAwesome;
    font-weight: 900;
    font-size: 1.5rem;
    color: #60a5fa;
    pointer-events: none;
    z-index: 0;
}

.ppp-card-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.22s;
    z-index: 1;
    /* Hide alt text when image URL is broken */
    color: transparent;
    font-size: 0;
    line-height: 0;
}

.ppp-card:hover .ppp-card-img img { transform: scale(1.05); }

.ppp-stock-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    font-size: 0.56rem;
    font-weight: 700;
    line-height: 1.5;
    pointer-events: none;
    z-index: 2;
}

.ppp-stock-out { background: #ef4444; color: #fff; }
.ppp-stock-low { background: #f59e0b; color: #fff; }

/* Card body */
.ppp-card-body {
    padding: 0.4rem 0.45rem 0.38rem;
    padding-right: 1.9rem; /* keep text clear of + button */
    flex: 1;
    display: flex !important;
    flex-direction: column;
    gap: 0.22rem;
    background: #ffffff;
}

.ppp-card-name {
    font-size: 0.68rem;
    font-weight: 400;
    color: #0b1220 !important;
    text-shadow: none;
    margin: 0;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: normal;
    min-height: 2.2em;
    letter-spacing: 0;
    opacity: 1 !important;
}

.ppp-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.2rem;
    border-top: 1px solid #f1f5f9;
}

.ppp-card-price {
    font-size: 0.62rem;
    font-weight: 800;
    color: #1e40af;
    line-height: 1;
}

.ppp-card-stock {
    font-size: 0.56rem;
    font-weight: 600;
    color: #065f46;
    line-height: 1;
    background: #ecfdf5;
    padding: 0.08rem 0.24rem;
    border-radius: 999px;
    border: 1px solid #a7f3d0;
}

.ppp-oos-text { color: #ef4444 !important; background: #fef2f2 !important; border-color: #fecaca !important; }

/* Add button — bottom-right corner, clearly visible */
.ppp-card-add {
    position: absolute;
    bottom: 0.38rem;
    right: 0.38rem;
    width: 24px;
    height: 24px;
    background: #2563eb;
    border: 1px solid #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.6rem;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
    pointer-events: none;
    transition: transform 0.15s, background 0.15s;
    z-index: 2;
}

.ppp-card:hover .ppp-card-add {
    transform: scale(1.18);
    background: #1d4ed8;
}

/* ── Pagination Bar ── */
.ppp-pager {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 0.38rem 0.7rem;
    background: #fff;
    border-top: 1px solid #e2dffe;
    overflow-x: auto;
}

.ppp-page-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border: 1.5px solid #d4cffa;
    border-radius: 6px;
    background: #faf9ff;
    color: #5a4bd1;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

.ppp-page-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.ppp-page-btn:not(:disabled):hover {
    background: #ede9fe;
    border-color: #9b8ef5;
}

.ppp-page-btn.ppp-page-active {
    background: #6C5CE7;
    border-color: #6C5CE7;
    color: #fff;
}

.ppp-page-info {
    margin-left: auto;
    font-size: 0.68rem;
    color: #7b7a9b;
    white-space: nowrap;
    flex-shrink: 0;
}


/* ════════════════════════════════════════
   RIGHT — ORDER PANEL
════════════════════════════════════════ */
.pos-order-panel {
    flex: 0 0 360px;
    width: 360px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;          /* prevent sections from spilling below viewport */
    background: #fff;
    border-left: 1.5px solid var(--pos-border);
}

/* ── Header ── */
.pop-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.38rem 0.62rem;
    background: linear-gradient(135deg, var(--pos-primary) 0%, var(--pos-primary-dark) 100%);
    color: #fff;
}

.pop-header-left {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.pop-order-icon {
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    flex-shrink: 0;
}

.pop-order-title {
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.2;
}

.pop-order-time {
    font-size: 0.52rem;
    opacity: 0.8;
    margin-top: 0;
}

.pop-icon-btn {
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,.15);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 0.68rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s;
    flex-shrink: 0;
}

.pop-icon-btn:hover { background: rgba(255,255,255,.28); }

/* ── Customer / Meta ── */
.pop-meta {
    flex-shrink: 0;
    padding: 0.42rem 0.62rem 0.38rem;
    background: #fff;
    border-bottom: 1px solid var(--pos-border);
}

.pop-meta-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 30px;
}

.pop-meta-icon {
    width: 26px;
    height: 26px;
    border-radius: var(--pos-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
    background: var(--pos-primary-light);
    color: var(--pos-primary);
}

.pop-meta-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pop-meta-label {
    font-size: 0.6rem;
    color: var(--pos-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
}

.pop-customer-select { flex: 1; min-width: 0; }

/* Customer input override */
.pop-customer-select .form-select,
.pop-customer-select input[type="text"],
.pop-customer-select input:not([type="checkbox"]):not([type="radio"]) {
    border: 1.5px solid var(--pos-border) !important;
    border-radius: var(--pos-radius-sm) !important;
    font-size: 0.79rem !important;
    padding: 0.28rem 0.6rem !important;
    background: var(--pos-primary-xlight) !important;
    color: var(--pos-text) !important;
    box-shadow: none !important;
    height: auto !important;
    min-height: 0 !important;
    outline: none !important;
}

.pop-customer-select .form-select:focus,
.pop-customer-select input:focus {
    border-color: var(--pos-primary) !important;
    box-shadow: 0 0 0 3px rgba(108,92,231,.10) !important;
}

/* Dropdown inside customer select */
.pop-customer-select .dropdown-menu {
    font-size: 0.78rem;
    border: 1.5px solid var(--pos-border);
    border-radius: var(--pos-radius-sm);
    box-shadow: var(--pos-shadow-md);
    z-index: 100;
}

.pop-customer-select .dropdown-item { padding: 0.35rem 0.75rem; }
.pop-customer-select .dropdown-item:hover,
.pop-customer-select .active-item { background: var(--pos-primary-light); color: var(--pos-primary); }

/* ── Items Label ── */
.pop-items-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0.9rem 0.2rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--pos-text);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    background: #fff;
}

.pop-items-count {
    background: var(--pos-primary);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    padding: 0.08rem 0.42rem;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
}

/* ── Cart area ── */
.pop-cart {
    flex: 1 1 0;          /* allow it to shrink so fixed sections always show */
    min-height: 60px;     /* always show at least a sliver so empty state is visible */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--pos-primary-xlight);
}

.pop-cart-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.pop-cart-scroll::-webkit-scrollbar { width: 3px; }
.pop-cart-scroll::-webkit-scrollbar-track { background: transparent; }
.pop-cart-scroll::-webkit-scrollbar-thumb { background: #bdb6f0; border-radius: 2px; }

/* ── Empty cart ── */
.pop-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    text-align: center;
}

.pop-empty-icon {
    width: 56px;
    height: 56px;
    background: var(--pos-primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    color: var(--pos-primary);
    margin-bottom: 0.65rem;
}

.pop-empty-title {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--pos-text);
    margin: 0 0 0.2rem;
}

.pop-empty-sub {
    font-size: 0.7rem;
    color: var(--pos-muted);
    margin: 0;
}

/* ── Cart Item ── */
.pop-cart-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: #fff;
    border-radius: var(--pos-radius);
    padding: 0.34rem 0.48rem;
    box-shadow: 0 1px 5px rgba(108,92,231,.07);
    border: 1px solid var(--pos-border);
    transition: box-shadow 0.15s;
    min-width: 0;
}

.pop-cart-item:hover { box-shadow: 0 3px 10px rgba(108,92,231,.12); }

.pci-thumb {
    display: none !important;
}

.pci-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.pci-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    padding-left: 0.1rem;
}

.pci-name {
    font-size: 0.62rem;
    font-weight: 500;
    color: var(--pos-text);
    margin: 0 0 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pci-rate {
    font-size: 0.56rem;
    color: var(--pos-muted);
    white-space: nowrap;
}

/* Qty controls */
.pci-controls {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.pci-qty-btn {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1.5px solid var(--pos-border);
    background: #fff;
    color: var(--pos-primary);
    font-size: 0.52rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.14s;
    flex-shrink: 0;
}

.pci-qty-btn:hover {
    background: var(--pos-primary-light);
    border-color: var(--pos-primary);
}

.pci-qty-btn.pci-qty-add {
    background: var(--pos-primary);
    border-color: var(--pos-primary);
    color: #fff;
}

.pci-qty-btn.pci-qty-add:hover { background: var(--pos-primary-dark); }

.pci-qty-input {
    width: 26px;
    height: 20px;
    text-align: center;
    border: 1.5px solid var(--pos-border);
    border-radius: 6px;
    font-size: 0.64rem;
    font-weight: 700;
    color: var(--pos-text);
    background: #fff;
    padding: 0;
    outline: none;
    -moz-appearance: textfield;
    flex-shrink: 0;
}

.pci-qty-input:focus {
    border-color: var(--pos-primary);
    box-shadow: 0 0 0 2px rgba(108,92,231,.10);
}

.pci-qty-input::-webkit-outer-spin-button,
.pci-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.pci-total {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--pos-primary);
    flex-shrink: 0;
    min-width: 44px;
    text-align: right;
    white-space: nowrap;
}

.pci-del {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1.5px solid #fdd;
    background: #fff7f7;
    color: var(--pos-danger);
    font-size: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: all 0.14s;
}

.pci-del:hover {
    background: var(--pos-danger);
    border-color: var(--pos-danger);
    color: #fff;
}

/* ── Summary ── */
.pop-summary {
    flex-shrink: 0;
    padding: 0.35rem 0.75rem;
    background: #fff;
    border-top: 1.5px solid var(--pos-border);
}

.pop-sum-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.71rem;
    color: var(--pos-muted);
    padding: 0.08rem 0;
}

.pop-sum-tax { color: var(--pos-danger); }

.pop-sum-discount {
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

.pop-discount-inputs {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.pop-disc-group {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--pos-border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--pos-primary-xlight);
    height: 26px;
}

.pop-disc-unit {
    padding: 0 0.3rem;
    font-size: 0.66rem;
    color: var(--pos-muted);
    background: var(--pos-border);
    line-height: 26px;
    flex-shrink: 0;
    white-space: nowrap;
}

.pop-disc-input {
    width: 46px;
    border: none;
    background: transparent;
    font-size: 0.72rem;
    color: var(--pos-text);
    padding: 0 0.3rem;
    outline: none;
    text-align: right;
    -moz-appearance: textfield;
}

.pop-disc-input::-webkit-outer-spin-button,
.pop-disc-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.pop-sum-delivery {
    color: #0d9488;
}
.pop-sum-delivery .pop-disc-group {
    border-color: #99f6e4;
    background: #f0fdfb;
}
.pop-sum-delivery .pop-disc-input {
    width: 68px;
    color: #0d9488;
    font-weight: 600;
}

.pop-sum-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.3rem;
    margin-top: 0.15rem;
    border-top: 1.5px dashed var(--pos-border);
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--pos-text);
}

.pop-sum-total-amount {
    font-size: 1rem;
    color: #1d4ed8;
    font-weight: 800;
}

/* ── Payment Methods ── */
.pop-payment {
    flex-shrink: 0;
    padding: 0.28rem 0.75rem 0.28rem;
    background: #fff;
    border-top: 1.5px solid var(--pos-border);
}

.pop-payment-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--pos-muted);
    margin-bottom: 0.22rem;
    line-height: 1;
}

.pop-payment-selected {
    color: var(--pos-primary);
    text-transform: none;
    font-weight: 700;
    letter-spacing: 0;
}

.pop-payment-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.18rem;
}

.pop-pay-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0.2rem 0.12rem;
    border-radius: var(--pos-radius-sm);
    border: 1px solid transparent;
    background: var(--pay-bg, #ccc);
    color: var(--pay-fg, #fff);
    font-size: 0.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.17s, box-shadow 0.17s, filter 0.17s;
    box-shadow: 0 1px 4px rgba(0,0,0,.13);
    min-height: 30px;
    line-height: 1.2;
}

.pop-pay-btn i { font-size: 0.62rem; }

.pop-pay-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 9px rgba(0,0,0,.18);
    filter: brightness(1.07);
}

.pop-pay-btn.pop-pay-active {
    border-color: rgba(255,255,255,.9);
    box-shadow: 0 0 0 2.5px var(--pos-primary), 0 3px 9px rgba(0,0,0,.18);
    transform: scale(1.03);
}

/* ── Action Buttons ── */
.pop-actions {
    flex-shrink: 0;
    display: flex;
    gap: 0.35rem;
    padding: 0.22rem 0.65rem 0.28rem;
    background: #fff;
    border-top: 1.5px solid var(--pos-border);
    position: sticky;
    bottom: 0;
    z-index: 10;
    box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.08);
}

.pop-btn-cancel {
    flex: 1;
    padding: 0.48rem 0.6rem;
    border-radius: var(--pos-radius);
    border: 1.5px solid #fcc;
    background: #fff7f7;
    color: var(--pos-danger);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

.pop-btn-cancel:hover {
    background: var(--pos-danger);
    border-color: var(--pos-danger);
    color: #fff;
}

.pop-btn-pay {
    flex: 2;
    padding: 0.48rem 0.6rem;
    border-radius: var(--pos-radius);
    border: none;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(22, 163, 74, 0.28);
    transition: all 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
}

.pop-btn-pay:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(22, 163, 74, 0.34);
}

.pop-btn-pay:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Mobile Proceed Bar ── */
.pop-proceed {
    display: none;
    flex-shrink: 0;
    align-items: center;
    gap: 0.45rem;
    padding: 0.38rem 0.75rem;
    padding-bottom: calc(0.38rem + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1.5px solid var(--pos-border);
}

.pop-proceed-btn {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(22, 163, 74, 0.25);
    transition: all 0.18s;
    gap: 0.5rem;
}

.pop-proceed-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(22, 163, 74, 0.32);
}

.pop-proceed-btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.pop-proceed-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    opacity: 0.9;
    white-space: nowrap;
}

.pop-proceed-meta strong { font-size: 0.88rem; font-weight: 800; }

.pop-proceed-cancel {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid #fcc;
    background: #fff7f7;
    color: var(--pos-danger);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.18s;
}

.pop-proceed-cancel:hover {
    background: var(--pos-danger);
    border-color: var(--pos-danger);
    color: #fff;
}

/* ════════════════════════════════════════
   RESPONSIVE ≤ 1100px
════════════════════════════════════════ */
@media (max-width: 1100px) {
    .pos-order-panel { flex: 0 0 320px; width: 320px; }
    .ppp-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ════════════════════════════════════════
   RESPONSIVE ≤ 992px  (tablet + mobile)
════════════════════════════════════════ */
@media (max-width: 992px) {

    .pos-mobile-topbar { display: flex; }

    .pos-body { display: block; overflow: visible; height: auto; }

    /* hide dashboard on small screens */
    .salesperson-dashboard-host { display: none !important; }

    /* Both panels: full width, flex col */
    .pos-products-panel,
    .pos-order-panel {
        flex: none;
        width: 100%;
        max-width: 100%;
        border: none;
        box-shadow: none;
    }

    /* Height: fill viewport minus mobile top bar (~52px) */
    .pos-products-panel.ppp-show,
    .pos-order-panel.pop-show {
        display: flex;
        flex-direction: column;
        height: calc(100dvh - 106px); /* dynamic viewport for mobile browsers */
    }

    /* Reserve space for fixed proceed bar (tight; FAB removed) */
    .pos-order-panel.pop-show {
        padding-bottom: calc(54px + env(safe-area-inset-bottom, 0px));
    }

    .ppp-hide { display: none !important; }
    .pop-hide { display: none !important; }

    /* Show mobile proceed, hide desktop actions */
    .pop-proceed {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 12;
        border-top: 1.5px solid var(--pos-border);
        background: #fff;
        box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.12);
    }
    .pop-actions { display: none !important; }

    /* Let cart body shrink first so summary/payment/save stay visible */
    .pop-cart {
        min-height: 0;
    }
}

/* ════════════════════════════════════════
   RESPONSIVE ≤ 576px  (phone)
════════════════════════════════════════ */
@media (max-width: 576px) {

    .ppp-controls { padding: 0.42rem 0.55rem; gap: 0.3rem; }
    .ppp-search, .ppp-cat-select, .ppp-warehouse-select { height: 32px; }
    .ppp-cat-select, .ppp-warehouse-select { max-width: 104px; font-size: 0.7rem; padding: 0 0.4rem; }

    .ppp-stats { padding: 0 0.65rem; }
    .ppp-categories { padding: 0.45rem 0.65rem; }

    .ppp-grid {
        padding: 0.42rem;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }

    .ppp-card-img { height: 62px; }
    .ppp-card-body { padding: 0.34rem 0.38rem 0.32rem; }
    .ppp-card-name {
        font-size: 0.62rem;
        font-weight: 400;
        -webkit-line-clamp: 2;
        min-height: 2em;
        color: #0b1220 !important;
        opacity: 1 !important;
    }
    .ppp-card-price { font-size: 0.58rem; }
    .ppp-card-stock { font-size: 0.5rem; padding: 0.06rem 0.2rem; }
    .ppp-card-add { width: 20px; height: 20px; font-size: 0.52rem; }

    .pop-header { padding: 0.45rem 0.65rem; }
    .pop-order-icon, .pop-icon-btn { width: 26px; height: 26px; font-size: 0.72rem; }
    .pop-order-title { font-size: 0.78rem; }
    .pop-order-time { font-size: 0.56rem; }

    .pop-meta { padding: 0.3rem 0.6rem; }
    .pop-items-header { padding: 0.24rem 0.6rem 0.18rem; font-size: 0.6rem; }

    /* Empty cart state must not eat vertical space on small screens */
    .pop-empty {
        padding: 0.45rem 0.5rem;
        min-height: 58px;
        justify-content: center;
    }
    .pop-empty-icon {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
        margin-bottom: 0.2rem;
    }
    .pop-empty-title { font-size: 0.68rem; margin-bottom: 0.1rem; }
    .pop-empty-sub { font-size: 0.58rem; }

    .pop-summary { padding: 0.26rem 0.55rem; }
    .pop-sum-row { font-size: 0.66rem; padding: 0.04rem 0; }
    .pop-disc-group { height: 22px; }
    .pop-disc-unit { line-height: 22px; font-size: 0.6rem; padding: 0 0.2rem; }
    .pop-disc-input { width: 36px; font-size: 0.66rem; padding: 0 0.2rem; }
    .pop-sum-total { padding-top: 0.2rem; font-size: 0.76rem; }
    .pop-sum-total-amount { font-size: 0.9rem; }

    .pop-payment { padding: 0.18rem 0.42rem 0.2rem; }
    .pop-payment-label { margin-bottom: 0.12rem; font-size: 0.52rem; }
    .pop-payment-grid { grid-template-columns: repeat(3, 1fr); gap: 0.14rem; }
    .pop-pay-btn { min-height: 28px; font-size: 0.46rem; padding: 0.14rem 0.08rem; }
    .pop-pay-btn i { font-size: 0.58rem; }

    .pop-cart-scroll { padding: 0.3rem 0.38rem; }
    .pci-thumb { display: none !important; }
    .pop-cart-item { padding: 0.26rem 0.34rem; gap: 0.25rem; }
    .pci-name { font-size: 0.56rem; font-weight: 500; }
    .pci-rate { font-size: 0.5rem; }
    .pci-qty-btn { width: 18px; height: 18px; font-size: 0.48rem; }
    .pci-qty-input { width: 22px; height: 18px; font-size: 0.56rem; }
    .pci-total { min-width: 36px; font-size: 0.6rem; }
    .pci-del { width: 18px; height: 18px; font-size: 0.44rem; }

    .pop-proceed {
        padding: 0.32rem 0.42rem;
        padding-bottom: calc(0.32rem + env(safe-area-inset-bottom));
    }

    .pop-proceed-btn {
        font-size: 0.64rem;
        padding: 0.44rem 0.56rem;
    }

    .pop-proceed-meta {
        font-size: 0.58rem;
        gap: 3px;
    }

    .pop-proceed-meta strong { font-size: 0.72rem; }

    .pop-proceed-cancel {
        width: 30px;
        height: 30px;
        font-size: 0.66rem;
    }
}

/* Extra small screens: force save bar visibility and compact everything */
@media (max-width: 380px), (max-height: 740px) {
    .pop-summary { padding: 0.2rem 0.45rem; }
    .pop-sum-row { font-size: 0.62rem; }
    .pop-payment { padding: 0.14rem 0.34rem 0.16rem; }
    .pop-pay-btn { min-height: 24px; font-size: 0.42rem; padding: 0.1rem 0.06rem; }
    .pop-pay-btn i { font-size: 0.52rem; }
    .pop-proceed {
        padding: 0.26rem 0.36rem;
        padding-bottom: calc(0.26rem + env(safe-area-inset-bottom));
    }
    .pop-proceed-btn {
        font-size: 0.6rem;
        padding: 0.4rem 0.48rem;
    }
    .pop-proceed-meta { font-size: 0.54rem; }
}

/* ════════════════════════════════════════
   DESKTOP ≥ 993px — always show both panels
════════════════════════════════════════ */
@media (min-width: 993px) {
    .pos-products-panel { display: flex !important; }
    .pos-order-panel { display: flex !important; }
}
