/* ===== POS LAYOUT ===== */
.pos-app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.pos-header {
  display: flex; align-items: center; justify-content: space-between;
  height: 58px; padding: 0 20px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  flex-shrink: 0; gap: 12px;
  position: relative;
}
.pos-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 60%);
  opacity: 0.5;
}
.pos-header-left  { display: flex; align-items: center; gap: 10px; }
.pos-header-right { display: flex; align-items: center; gap: 8px; }

.header-signout-btn { transition: color 0.18s, border-color 0.18s, background 0.18s; }
.theme-toggle svg { width: 19px; height: 19px; display: block; }
.header-sync-btn svg { width: 17.5px; height: 17.5px; display: block; }

/* Override circular theme-toggle from main.css to match POS ghost button style */
.pos-header .theme-toggle {
  width: auto; height: auto;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border-strong);
  padding: 0.35rem 0.7rem;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-2);
  transition: background var(--transition), color var(--transition);
}
.pos-header .theme-toggle:hover { background: var(--bg-subtle); color: var(--text); }
.header-signout-btn:hover { color: var(--danger) !important; border-color: var(--danger) !important; background: rgba(239,68,68,0.08) !important; }

.header-admin-btn { transition: color 0.18s, border-color 0.18s, background 0.18s; }
.header-admin-btn:hover { color: var(--accent) !important; border-color: var(--accent) !important; background: rgba(245,158,11,0.08) !important; }

.pos-clock { font-size: 0.8rem; color: var(--text-3); font-variant-numeric: tabular-nums; }

.pos-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent) 0%, #d97706 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cashier-info { display: flex; align-items: center; gap: 8px; }
.cashier-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; flex-shrink: 0;
}
.cashier-details { display: flex; flex-direction: column; }
.cashier-name { font-size: 0.85rem; font-weight: 600; line-height: 1.2; }
.cashier-role { font-size: 0.72rem; color: var(--text-3); }

/* ===== MAIN LAYOUT ===== */
.pos-layout { display: flex; flex: 1; overflow: hidden; }

.pos-sidebar {
  width: 210px; background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden;
}

.pos-search-wrap { padding: 14px; border-bottom: 1px solid var(--border); }
.pos-mobile-cat-wrap { display: none; }

.category-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-pill);
  border: none; background: transparent; color: var(--text-2);
  font-family: var(--font); font-size: 0.925rem; font-weight: 500;
  cursor: pointer; text-align: left; width: 100%;
  transition: background var(--transition), color var(--transition);
  user-select: none;
}
.category-btn:hover { background: var(--bg-subtle); color: var(--text); box-shadow: var(--shadow-sm); }
.category-btn.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; box-shadow: var(--shadow-sm); }

.cat-emoji { font-size: 1.1rem; width: 24px; text-align: center; flex-shrink: 0; }
.cat-name  { flex: 1; }
.cat-count { font-size: 0.72rem; color: var(--text-3); background: var(--bg-subtle); padding: 1px 6px; border-radius: var(--radius); }
.category-btn.active .cat-count { background: var(--accent-dim); color: var(--accent); }

/* Cat track — vertical list on desktop, pill nav on mobile */
.cat-track-wrap {
  display: flex;
  flex: 1;
  overflow: hidden;
}
#cat-track {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 10px 8px;
  gap: 6px;
  width: 100%;
  scrollbar-width: thin;
}
#cat-track::-webkit-scrollbar { width: 4px; }
#cat-track::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.cat-slider { display: none; }

/* ===== MENU GRID ===== */
.pos-main { flex: 1; overflow-y: auto; padding: 18px; background: var(--bg); }

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.menu-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px;
  cursor: pointer; user-select: none; position: relative;
  transition: border-color var(--transition), transform 0.12s ease, box-shadow var(--transition);
  display: flex; flex-direction: column; gap: 5px;
}
[data-theme="light"] .menu-card { box-shadow: var(--shadow-sm); }
.menu-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.menu-card:active { transform: scale(0.97); }
.menu-card.out-of-stock { opacity: 0.45; pointer-events: none; }

/* Image wrapper holds the blur placeholder as background */
.menu-card-img-wrap {
  width: 100%; height: 95px;
  border-radius: var(--radius-sm); margin-bottom: 4px;
  overflow: hidden;
  background: var(--bg-subtle); /* fallback for items without blur */
  position: relative;
}
/* Image starts invisible, fades in once loaded */
.menu-card-img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.menu-card-img.loaded { opacity: 1; }
.menu-card-emoji { font-size: 2.5rem; text-align: center; height: 100px; display: flex; align-items: center; justify-content: center; }
.menu-card-name  { font-size: 0.95rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; }
.menu-card-price { font-size: 1.05rem; font-weight: 800; color: var(--accent); letter-spacing: -0.01em; }
.menu-card-stock { font-size: 0.75rem; color: var(--text-3); }
.menu-card-badge {
  position: absolute; top: 8px; right: 8px;
  font-size: 0.65rem; padding: 3px 6px;
  background: var(--warning-dim); color: var(--warning);
  border-radius: var(--radius-sm); font-weight: 700; text-transform: uppercase;
}
.menu-card-footer {
  display: flex; align-items: center; justify-content: space-between;
}
.cart-qty-badge {
  min-width: 24px; height: 24px;
  background: var(--accent); color: #fff;
  border-radius: 50%; font-size: 0.8rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

/* ===== CART ===== */
.pos-cart {
  width: 340px;
  background: var(--bg-raised);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

/* Cart header */
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  cursor: default;
}
.cart-header-left { display: flex; align-items: center; gap: 10px; }
.cart-title { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; }
.cart-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.cart-badge.visible { opacity: 1; transform: scale(1); }
.cart-clear-btn {
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.25);
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.cart-clear-btn:hover { color: #fff; background: var(--danger); border-color: var(--danger); }

/* Buyer section */
.cart-buyer-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

.cart-buyer-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 14px;
  transition: border-color var(--transition), background var(--transition);
}
.cart-buyer-search-wrap:focus-within {
  border-color: var(--accent);
  background: var(--bg-raised);
}
.cart-search-icon { font-size: 1rem; flex-shrink: 0; opacity: 0.6; }
.cart-search-icon:empty { display: none; }
.cart-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.925rem;
  padding: 0;
  width: 100%;
}
.cart-search-input::placeholder { color: var(--text-3); }

/* Buyer card */
/* buyer-card is now an inner flex row inside .cart-buyer-search-wrap — no box model of its own */
.buyer-card {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.buyer-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}
.buyer-card-info { flex: 1; min-width: 0; line-height: 1.3; }
.buyer-card-name    { font-size: 0.875rem; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buyer-card-meta    { display: none; }
.buyer-card-balance { font-size: 0.75rem; color: var(--text-2); margin-top: 1px; }
.buyer-card-clear {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; padding: 4px; border-radius: 50%;
  font-size: 0.75rem; line-height: 1;
  transition: color var(--transition), background var(--transition);
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.buyer-card-clear:hover { color: var(--text); background: var(--bg-overlay); }

/* Add Cash category tab */
.cat-divider { height: 1px; background: var(--border); margin: 6px 8px; }
.category-btn-addcash { color: var(--success) !important; font-weight: 600 !important; }
.category-btn-addcash:hover { background: rgba(34,197,94,0.1) !important; color: var(--success) !important; }

/* Cash deposit modal */
/* Dropdown */
.camper-dropdown {
  position: absolute;
  left: 16px; right: 16px;
  top: calc(100% - 4px);
  background: var(--bg-overlay);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
}
.camper-option {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; cursor: pointer; gap: 10px;
  font-size: 0.9rem; transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.camper-option:last-child { border-bottom: none; }
.camper-option:hover { background: var(--bg-subtle); }
.camper-option.no-results { color: var(--text-3); cursor: default; justify-content: center; font-size: 0.875rem; }
.camper-balance-chip {
  font-size: 0.78rem; font-weight: 600; color: var(--success);
  background: var(--success-dim); padding: 3px 8px; border-radius: var(--radius);
  flex-shrink: 0;
}

/* Cart items */
.cart-items { flex: 1; overflow-y: auto; padding: 6px 16px; display: flex; flex-direction: column; }

.cart-empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--text-3); font-size: 0.875rem;
}
.cart-empty-icon { font-size: 2rem; opacity: 0.4; }

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name  { font-size: 0.925rem; font-weight: 600; letter-spacing: -0.01em; }
.cart-item-price { font-size: 0.8rem; color: var(--text-2); margin-top: 2px; }

.cart-qty-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cart-qty-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-subtle); color: var(--text);
  font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), border-color var(--transition);
  font-weight: 400; line-height: 1;
  flex-shrink: 0;
}
.cart-qty-btn:hover { background: var(--bg-overlay); border-color: var(--text-3); }
.cart-qty {
  font-size: 1rem; font-weight: 700;
  min-width: 24px; text-align: center;
  letter-spacing: -0.02em;
}

/* Bottom section */
.cart-bottom {
  flex-shrink: 0;
  padding: 16px 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Payment toggle */
.cart-pay-label {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3);
}
.cart-pay-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  padding: 4px;
  position: relative;
}
.pay-slider {
  position: absolute;
  top: 4px; bottom: 4px;
  width: calc(50% - 4px);
  left: 4px;
  background: var(--bg-raised);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
  pointer-events: none;
  z-index: 0;
}

.pay-opt {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 9px 4px;
  border-radius: var(--radius); border: none;
  background: transparent; color: var(--text-2);
  font-family: var(--font); font-size: 0.78rem; font-weight: 600;
  cursor: pointer;
  transition: color var(--transition);
  user-select: none;
  position: relative; z-index: 1;
}
.pay-opt:hover { color: var(--text); }
.pay-opt.active { color: var(--text); }
.pay-opt-icon { display: flex; align-items: center; justify-content: center; color: var(--text-3); transition: color var(--transition); }
.pay-opt:hover .pay-opt-icon { color: var(--accent); }
.pay-opt.active .pay-opt-icon { color: var(--accent); }

/* Total */
.cart-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 2px 0;
}
.cart-total-label { font-size: 0.875rem; color: var(--text-2); font-weight: 500; }
.cart-total-value {
  font-size: 1.35rem; font-weight: 800;
  color: var(--text); letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

/* Place order button */
.place-order-btn {
  width: 100%;
  min-height: 54px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
  flex: 1; /* allows shrinking inside flex row */
}
.place-order-btn:hover:not(:disabled)  { background: var(--accent-hover); }
.place-order-btn:active:not(:disabled) { transform: scale(0.98); }
.place-order-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== SUCCESS MODAL ===== */
.order-success-modal { border-color: var(--border); }
.order-success {
  text-align: center;
  padding: 2rem 1.5rem 1.5rem;
}
.order-success-check {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--success-dim);
  color: var(--success);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.1rem;
}
.order-success-label {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 4px;
}
.order-number {
  font-size: 0.8rem;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.success-balance {
  font-size: 0.82rem;
  color: var(--success);
  margin-top: 10px;
  font-weight: 600;
  background: var(--success-dim);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  display: inline-block;
}

/* ===== PIN PAD ===== */
.pin-display { font-size: 1.5rem; text-align: center; letter-spacing: 0.4em; min-height: 2.5rem; margin-bottom: 16px; color: var(--accent); font-variant-numeric: tabular-nums; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-key {
  padding: 14px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--bg-overlay); color: var(--text); font-family: var(--font);
  font-size: 1.1rem; font-weight: 600; cursor: pointer; text-align: center;
  transition: background var(--transition), transform var(--transition);
  user-select: none;
}
.pin-key:hover  { background: var(--bg-subtle); }
.pin-key:active { transform: scale(0.94); }

/* ===== MOBILE POS ===== */
@media (max-width: 768px) {

  /* ── Mobile: fixed header + catbar (same pattern as admin), page body free to scroll for native PTR ── */
  html, body { overflow-x: hidden; }
  .pos-app { height: auto; min-height: 100dvh; overflow: visible; }

  /* ── Header ── */
  .pos-header { height: 54px; padding: 0 14px; box-shadow: none; flex-shrink: 0; }
  .pos-header::after { display: none; }
  .pos-clock  { display: none; }
  .cashier-details { display: none; }
  .pos-title { font-size: 0.95rem; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
  .pos-logo { font-size: 1.1rem; }
  .cashier-avatar { width: 28px; height: 28px; font-size: 0.75rem; }
  .header-sync-btn { display: none; }
  .header-admin-btn { padding: 4px 10px; font-size: 1rem; }
  .header-signout-btn { padding: 4px 10px; font-size: 1rem; }
  .pos-header-right { gap: 6px; }
  .pos-header { border-bottom: none; }

  /* ── Layout: stack sidebar on top ── */
  .pos-layout { flex-direction: column; }

  /* ── Pull to refresh indicator ── */
  .pull-refresh-indicator { display: none !important; } /* native PTR used instead */
  .pull-refresh-indicator svg {
    transition: transform 0.2s;
    color: var(--accent);
  }
  .pull-refresh-indicator.spinning svg {
    animation: spin 0.7s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ── Sidebar: full-width horizontal category bar ── */
  .pos-sidebar { display: none !important; }

  /* Mobile pill category bar — same system as admin mobile nav */
  .pos-mobile-cat-wrap {
    display: block;
    width: 100%;
    background: var(--bg-raised);
    padding: 4px 12px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    flex-shrink: 0;
  }
  [data-theme="dark"] .pos-mobile-cat-wrap {
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  }
  #cat-track-mobile {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px;
    gap: 0;
    position: relative;
    background: var(--bg-subtle);
    border-radius: var(--radius-pill);
    width: 100%;
  }
  #cat-track-mobile::-webkit-scrollbar { display: none; }
  #cat-slider-mobile {
    display: block;
    position: absolute;
    top: 4px; bottom: 4px; left: 0;
    background: var(--bg-raised);
    border-radius: var(--radius-pill);
    box-shadow: 0 2px 8px rgba(0,0,0,0.14), 0 1px 2px rgba(0,0,0,0.08);
    transition: transform 0.32s cubic-bezier(0.34, 1.08, 0.64, 1),
                width    0.32s cubic-bezier(0.34, 1.08, 0.64, 1);
    pointer-events: none;
    z-index: 0;
    will-change: transform, width;
  }
  .cat-track-wrap {
    display: block;
    width: 100%;
    padding: 0 12px 6px;
    background: var(--bg-raised);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  }
  [data-theme="dark"] .cat-track-wrap {
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  }
  #cat-track {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px;
    gap: 0;
    position: relative;
    background: var(--bg-subtle);
    border-radius: var(--radius-pill);
    width: 100%;
  }
  .cat-track::-webkit-scrollbar { display: none; }
  .cat-slider {
    display: block;
    position: absolute;
    top: 4px; bottom: 4px; left: 0;
    background: var(--bg-raised);
    border-radius: var(--radius-pill);
    box-shadow: 0 2px 8px rgba(0,0,0,0.14), 0 1px 2px rgba(0,0,0,0.08);
    transition: transform 0.32s cubic-bezier(0.34, 1.08, 0.64, 1),
                width    0.32s cubic-bezier(0.34, 1.08, 0.64, 1);
    pointer-events: none;
    z-index: 0;
    will-change: transform, width;
  }
  .pos-search-wrap { display: none; }

  .category-btn {
    flex-shrink: 0 !important;
    width: auto !important;
    padding: 7px 13px;
    font-size: 0.78rem;
    white-space: nowrap;
    border-radius: var(--radius-pill);
    min-height: 36px;
    gap: 5px;
    position: relative;
    z-index: 1;
    background: transparent !important;
    color: var(--text-3);
    transition: color 0.25s ease;
  }
  .category-btn.active { color: var(--text) !important; font-weight: 600; background: transparent !important; }
  .category-btn:not(.active) { color: var(--text-3); }
  .category-btn:hover  { background: transparent !important; color: var(--text); }
  .cat-count { display: none; }
  .cat-name { flex: none; }
  .cat-divider { display: none; }
  .category-btn-addcash { display: none !important; }

  /* ── Main menu area ── */
  .pos-main { overflow-y: auto; height: calc(100dvh - 108px); margin-top: 108px; padding: 10px; padding-bottom: 90px; }
  .menu-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .menu-card { cursor: pointer; }
  .menu-card-name  { font-size: 0.88rem; }
  .menu-card-price { font-size: 1rem; }

  /* ── Keep header and categories above backdrop ── */
  .pos-header { position: fixed; top: 0; left: 0; right: 0; z-index: 160; }
  .pos-mobile-cat-wrap { position: fixed; top: 54px; left: 0; right: 0; z-index: 155; }

  .pos-main {
    position: relative;
    transition: filter 0.25s ease;
  }
  .pos-main.cart-open {
    filter: blur(2px);
    pointer-events: none;
  }

  /* ── Cart backdrop overlay — sits above header+catbar so everything dims ── */
  .cart-backdrop {
    display: none;
    position: fixed; inset: 0; z-index: 163;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
  }
  .cart-backdrop.visible { display: block; }

  /* ── Cart: fixed bottom drawer with smooth slide ── */
  .pos-cart {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 165;
    border-left: none; border-top: 1px solid var(--border);
    height: 85vh;
    width: 100%; box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(0);
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
    display: flex; flex-direction: column;
  }
  .pos-cart.cart-collapsed {
    transform: translateY(calc(100% - 64px));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .cart-header {
    cursor: pointer; padding: 0 20px;
    min-height: 64px; display: flex; align-items: center;
    position: relative;
  }
  /* Drag handle */
  .cart-header::before {
    content: '';
    position: absolute;
    top: 10px; left: 50%; transform: translateX(-50%);
    width: 36px; height: 4px;
    background: var(--border);
    border-radius: 2px;
  }
  .cart-header::after {
    display: none;
  }
  .cart-items { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  /* ── Cart bottom ── */
  .cart-bottom { gap: 8px; padding: 10px 14px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .cart-pay-toggle { gap: 4px; padding: 3px; border-radius: var(--radius); }
  .pay-opt { padding: 7px 4px; font-size: 0.78rem; min-height: 40px; }
  .pay-opt-icon { font-size: 0.95rem; }
  .place-order-btn { min-height: 50px; font-size: 1rem; border-radius: var(--radius); }
  .cart-total-label { font-size: 0.8rem; }
  .cart-total-value { font-size: 1.2rem; }
  .cart-pay-label { font-size: 0.65rem; text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--text-2); }

  /* ── Cart header ── */
  .cart-title { font-size: 0.95rem; }
  .cart-clear-btn { font-size: 0.75rem; color: var(--text-3); padding: 3px 6px; }

  /* ── Search bar ── */
  .cart-buyer-section { padding: 10px 12px; }
  .cart-buyer-search-wrap { padding: 8px 12px; border-radius: var(--radius); }
  .cart-search-input { font-size: 0.85rem; }
  .cart-search-icon { font-size: 0.85rem; }

  /* ── Empty state ── */
  .cart-empty { padding: 16px 0; gap: 6px; font-size: 0.8rem; }
  .cart-empty-icon { font-size: 1.4rem; }

  /* ── Cart items ── */
  .cart-items { padding: 4px 12px; }
  .cart-item { padding: 9px 0; }
  .cart-item-name { font-size: 0.875rem; }
  .cart-item-price { font-size: 0.75rem; }
  .cart-qty-btn { width: 26px; height: 26px; font-size: 0.9rem; }
  .cart-qty { font-size: 0.9rem; min-width: 20px; }

  /* ── Buyer card — same size/padding as search wrap ── */
  .buyer-card { gap: 10px; }
  .buyer-card-avatar { width: 26px; height: 26px; font-size: 0.78rem; }
  .buyer-card-name { font-size: 0.82rem; }
  .buyer-card-balance { font-size: 0.72rem; }
  .buyer-card-clear { min-width: 36px; min-height: 36px; }

  /* ── Buyer search ── */
  .camper-dropdown { max-height: 180px; }
  .cart-buyer-search-wrap { padding: 8px 12px; min-height: 54px; }
  .cart-search-input { font-size: 0.9rem; }

  /* ── Login ── */
  .login-card { padding: 32px 20px; margin: 16px; max-width: 100%; }
  .login-logo  { font-size: 2.5rem; }

  /* ── Recent Orders FAB: above cart ── */
  .recent-orders-fab { bottom: 76px; left: 14px; }
}

@media (max-width: 480px) {
  .menu-grid { grid-template-columns: 1fr 1fr; }
  .pos-search-wrap { width: 110px; }
  .pos-search-wrap .input-field { font-size: 0.8rem; padding: 7px 8px; }
  .menu-card-emoji { font-size: 2rem; height: 80px; }
  .login-card { padding: 28px 16px; margin: 12px; border-radius: var(--radius-lg); }
}

/* ===== RECENT ORDERS PANEL ===== */
.recent-orders-panel {
  position: fixed;
  bottom: 24px;
  left: 0;
  width: 210px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Pill trigger button */
.rop-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-raised);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(0,0,0,0.13);
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  user-select: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 2;
}
.rop-pill:hover {
  background: var(--bg-overlay);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.16);
}
.rop-pill-badge {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
}

/* Drawer — slides up above the pill */
.rop-drawer {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 16px;
  width: 300px;
  margin-left: 0;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.1, 0.64, 1);
}
.rop-drawer-open .rop-drawer {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.rop-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.rop-drawer-title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.rop-drawer-close {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-2);
  font-size: 0.75rem;
  font-family: var(--font);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.rop-drawer-close:hover { background: rgba(239,68,68,0.1); color: var(--danger); border-color: var(--danger); }

.rop-body {
  max-height: 300px;
  overflow-y: auto;
}

.rop-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 16px;
  color: var(--text-3);
  font-size: 0.82rem;
  font-weight: 500;
}

.rop-order {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.rop-order:last-child { border-bottom: none; }
.rop-order:hover { background: var(--bg-subtle); }
.rop-order-cancelled { opacity: 0.5; }

.rop-order-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rop-order-cancelled .rop-order-avatar {
  background: var(--bg-subtle);
  color: var(--text-3);
}

.rop-order-info { flex: 1; min-width: 0; }
.rop-order-name {
  font-weight: 600;
  font-size: 0.83rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.rop-order-meta {
  font-size: 0.69rem;
  color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rop-order-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.rop-order-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.rop-order-total { font-weight: 800; font-size: 0.85rem; }
.rop-total-paid  { color: var(--success); }
.rop-total-cancelled { color: var(--danger); font-size: 0.72rem; font-weight: 600; }
.rop-order-time  { font-size: 0.68rem; color: var(--text-3); }

.rop-order-actions { display: flex; gap: 4px; }
.rop-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  cursor: pointer;
  font-size: 0.72rem;
  font-family: var(--font);
  color: var(--text-2);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1;
}
.rop-btn:hover { background: var(--bg-overlay); color: var(--text); }
.rop-btn-cancel:hover { background: rgba(239,68,68,0.1); border-color: var(--danger); color: var(--danger); }
.rop-btn-edit:hover   { background: rgba(245,158,11,0.1); border-color: var(--accent); color: var(--accent); }

@media (max-width: 768px) {
  .recent-orders-panel {
    bottom: 80px;
    left: 14px;
    right: 14px;
    width: auto;
    align-items: flex-start;
  }
  .rop-drawer {
    width: 100%;
    left: 0;
    margin-left: 0;
  }
}
/* ===== ORDER SUCCESS MODAL — always centered ===== */
#order-modal {
  align-items: center !important;
  justify-content: center !important;
  z-index: 500 !important;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom, 0px)) 24px !important;
}

@media (max-width: 768px) {
  #order-modal {
    padding-top: 116px !important;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 16px)) !important;
  }
}
#order-modal .modal-content {
  margin: auto !important;
  position: relative !important;
  bottom: auto !important;
  top: auto !important;
  max-width: 340px !important;
  width: 100% !important;
  border-radius: var(--radius-lg) !important; /* all 4 corners — overrides mobile sheet rule in main.css */
}

/* ── CASH MODAL REDESIGN ── */
.cash-modal-redesign {
  padding: 0 !important;
  overflow: hidden;
  border-radius: var(--radius-pill) !important;
}
.cash-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 0;
  position: relative;
}
.cash-header-sm { padding: 20px 20px 0; min-height: 48px; }
.cash-close-btn {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: none;
  color: var(--text-2);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.cash-close-btn:hover { background: var(--bg-overlay); }
.cash-buyer-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--success), #2d9e6b);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
  box-shadow: 0 4px 16px rgba(74,170,122,0.35);
}
.cash-buyer-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}
.cash-buyer-balance-label {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-bottom: 0;
}
.cash-amount-display {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 20px 20px 4px;
}
.cash-amount-currency {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--success);
  padding-top: 8px;
  line-height: 1;
}
.cash-amount-big {
  font-size: 4rem;
  font-weight: 800;
  color: var(--success);
  line-height: 1;
  letter-spacing: -0.03em;
  transition: color 0.2s;
}
.cash-new-balance {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-3);
  min-height: 20px;
  margin-bottom: 4px;
}
.cash-quick-amounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 20px;
}
.cash-quick-btn {
  padding: 12px 4px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}
.cash-quick-btn:hover { border-color: var(--success); color: var(--success); background: rgba(74,170,122,0.08); }
.cash-quick-btn.active { border-color: var(--success); background: rgba(74,170,122,0.15); color: var(--success); box-shadow: 0 0 0 3px rgba(74,170,122,0.15); }
.cash-custom-wrap {
  position: relative;
  padding: 0 20px;
  margin-bottom: 8px;
}
.cash-dollar-sign {
  position: absolute;
  left: 34px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-2);
  pointer-events: none;
}
.cash-amount-input {
  padding-left: 28px !important;
  font-size: 1rem !important;
  font-weight: 600;
  border-radius: var(--radius) !important;
}
.cash-deposit-error {
  margin: 0 20px 8px;
  background: rgba(229,83,75,0.1);
  color: var(--danger);
  border: 1px solid rgba(229,83,75,0.25);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.83rem;
}
.cash-footer {
  padding: 12px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cash-next-btn {
  width: 100% !important;
  height: 52px;
  font-size: 1rem !important;
  font-weight: 700 !important;
  border-radius: var(--radius) !important;
  letter-spacing: 0.01em;
}
.cash-limit-note {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-3);
}

/* ── SLIDE-TO-CONFIRM CARD ── */
.cash-slide-card {
  position: relative;
  margin: 16px 20px 0;
  height: 160px;
  border-radius: var(--radius-lg);
  background: rgba(74,170,122,0.08);
  border: 1.5px solid rgba(74,170,122,0.25);
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
}
.cash-slide-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, rgba(74,170,122,0.3), rgba(74,170,122,0.5));
  pointer-events: none;
  transition: none;
}
.cash-slide-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
  padding: 0 60px;
}
.cash-slide-amount {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--success);
  letter-spacing: -0.03em;
  line-height: 1;
}
.cash-slide-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-2);
}
.cash-slide-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--success);
  opacity: 0.7;
  margin-top: 6px;
  transition: opacity 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cash-slide-handle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(74,170,122,0.5);
  cursor: grab;
  will-change: right;
  transition: box-shadow 0.2s;
}
.cash-slide-handle:active { cursor: grabbing; }
.cash-slide-card.done .cash-slide-handle {
  box-shadow: 0 0 0 10px rgba(74,170,122,0.2);
}

/* ===== BULK QUANTITY MODAL ===== */
.bulk-qty-display {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  padding: 14px 12px 12px;
  margin-bottom: 14px;
}
.bulk-qty-display span {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  display: block;
  min-height: 2.8rem;
  line-height: 1;
}
.bulk-qty-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.bqn-btn {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 600;
  padding: 15px 0;
  cursor: pointer;
  transition: background 0.1s, transform 0.08s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.bqn-btn:hover { background: var(--bg-subtle); }
.bqn-btn:active { transform: scale(0.94); background: var(--accent-dim); }
.bqn-clear {
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 1rem;
}
.bqn-back {
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 1.1rem;
}
