/* =====================================================
   DUKAN MANAGER — UI Components
   ===================================================== */

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--touch);
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  touch-action: manipulation;
  transition: opacity .15s, transform .1s;
  user-select: none;
  white-space: nowrap;
}
.btn:active { opacity: .8; transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-info    { background: var(--info);    color: #fff; }
.btn-ghost   { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }

.btn-lg { height: 64px; font-size: 18px; border-radius: var(--radius-lg); }
.btn-sm { height: 36px; font-size: 13px; padding: 0 12px; border-radius: var(--radius-sm); }
.btn-full { width: 100%; }

/* ============ FORMS ============ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  height: var(--touch);
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .2s;
  outline: none;
}
.form-textarea { height: auto; padding: 12px 14px; resize: vertical; min-height: 80px; }
.form-select   { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236B7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 24px; padding-right: 40px; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); }

/* Search input */
.search-box {
  position: relative;
}
.search-box .search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 18px; pointer-events: none;
}
.search-box .form-input { padding-left: 44px; }

/* ============ TOAST ============ */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-height) + 12px);
  left: 50%; transform: translateX(-50%);
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  width: min(340px, 90vw);
}
.toast {
  background: var(--text);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: toastIn .25s ease;
  pointer-events: all;
}
.toast.toast-success { background: var(--success); }
.toast.toast-error   { background: var(--danger);  }
.toast.toast-warning { background: var(--warning); }
@keyframes toastIn { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 500;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
@media (min-width: 600px) {
  .modal-overlay { align-items: center; padding: 24px; }
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp .25s ease;
}
@media (min-width: 600px) {
  .modal { border-radius: var(--radius-xl); max-width: 480px; animation: fadeIn .2s ease; }
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fadeIn  { from { opacity:0; transform: scale(.96); } to { opacity:1; transform: scale(1); } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; font-weight: 800; }
.modal-close {
  width: 36px; height: 36px; border-radius: var(--radius-full);
  background: var(--bg); color: var(--muted);
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.modal-body   { padding: 16px 20px; }
.modal-footer { padding: 12px 20px 20px; display: flex; gap: 10px; }
.modal-footer .btn { flex: 1; }

/* ============ PRODUCT GRID (POS) ============ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px;
}
@media (min-width: 480px)  { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }

.product-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .1s, box-shadow .1s;
  position: relative;
  user-select: none;
}
.product-card:active { transform: scale(.96); box-shadow: var(--shadow); }
.product-card.out-of-stock { opacity: .5; pointer-events: none; }

.product-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg);
}
.product-card-no-img {
  width: 100%; aspect-ratio: 1;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
}
.product-card-body { padding: 8px 10px 10px; }
.product-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 4px;
}
.product-card-stock {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.badge-low  { color: var(--warning); font-weight: 700; }
.badge-out  { color: var(--danger);  font-weight: 700; }

/* Category filter */
.cat-filter {
  display: flex; gap: 8px;
  padding: 10px 12px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-filter::-webkit-scrollbar { display: none; }
.cat-chip {
  flex-shrink: 0;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  background: var(--bg);
  color: var(--muted);
  border: 1.5px solid var(--border);
  touch-action: manipulation;
  white-space: nowrap;
}
.cat-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ============ CART ============ */
.cart-bar {
  position: fixed;
  bottom: var(--nav-height);
  left: 0; right: 0;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  z-index: 90;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .2s;
}
.cart-bar.hidden-bar { transform: translateY(100%); pointer-events: none; }
.cart-bar-count { font-size: 14px; font-weight: 700; }
.cart-bar-total { font-size: 20px; font-weight: 800; }

.cart-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-height: 85dvh;
  display: flex; flex-direction: column;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.cart-sheet.open { transform: translateY(0); }
.cart-sheet-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--border);
  margin: 12px auto 0;
}
.cart-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.cart-sheet-header h3 { font-size: 18px; font-weight: 800; }
.cart-items { overflow-y: auto; flex: 1; }
.cart-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.cart-item-name  { flex: 1; font-size: 14px; font-weight: 700; }
.cart-item-price { font-size: 13px; color: var(--muted); }
.cart-qty-controls { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg);
  font-size: 18px; font-weight: 700;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
.qty-btn:active { background: var(--primary-light); }
.qty-num { font-size: 16px; font-weight: 800; min-width: 24px; text-align: center; }

.cart-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.cart-line {
  display: flex; justify-content: space-between;
  font-size: 14px; color: var(--muted);
  margin-bottom: 6px;
}
.cart-line.total {
  font-size: 20px; font-weight: 800; color: var(--text);
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Discount row */
.discount-row {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 8px;
}
.discount-row .form-select { height: 38px; font-size: 14px; }
.discount-row .form-input  { height: 38px; font-size: 14px; }

/* Payment selector */
.payment-methods {
  display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
}
.pay-btn {
  flex: 1; min-width: 70px;
  height: 44px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 700;
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
  touch-action: manipulation;
}
.pay-btn.active {
  background: var(--info);
  color: #fff;
  border-color: var(--info);
}

/* ============ STOCK LIST ============ */
.stock-list { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.stock-item {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  touch-action: manipulation;
}
.stock-item-img {
  width: 56px; height: 56px; border-radius: var(--radius-md);
  object-fit: cover; background: var(--bg);
  flex-shrink: 0;
}
.stock-item-no-img {
  width: 56px; height: 56px; border-radius: var(--radius-md);
  background: var(--bg); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.stock-item-info { flex: 1; min-width: 0; }
.stock-item-name  { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock-item-cat   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stock-item-price { font-size: 14px; font-weight: 700; color: var(--primary); }
.stock-item-right { text-align: right; flex-shrink: 0; }
.stock-qty-badge  {
  font-size: 18px; font-weight: 800;
  color: var(--text);
}
.stock-qty-badge.low  { color: var(--warning); }
.stock-qty-badge.out  { color: var(--danger);  }
.stock-unit { font-size: 11px; color: var(--muted); }

/* ============ REPORT TABLES ============ */
.report-table-wrap { overflow-x: auto; padding: 0 16px 16px; }
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 320px;
}
.report-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--bg);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 1.5px solid var(--border);
}
.report-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.report-table tr:last-child td { border-bottom: none; }

/* Date range selector */
.date-tabs {
  display: flex; gap: 6px;
  padding: 12px 16px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.date-tabs::-webkit-scrollbar { display: none; }
.date-tab {
  flex-shrink: 0;
  height: 36px; padding: 0 14px;
  border-radius: var(--radius-full);
  font-size: 13px; font-weight: 700;
  background: var(--bg);
  color: var(--muted);
  border: 1.5px solid var(--border);
  touch-action: manipulation;
}
.date-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============ FAB ============ */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  right: 16px;
  width: 56px; height: 56px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  z-index: 80;
  touch-action: manipulation;
}
.fab:active { transform: scale(.93); }

/* Bill receipt */
.receipt {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}
.receipt-store   { font-size: 20px; font-weight: 800; }
.receipt-num     { font-size: 13px; color: var(--muted); margin-top: 4px; }
.receipt-divider { border: none; border-top: 1px dashed var(--border); margin: 12px 0; }
.receipt-items   { text-align: left; margin: 12px 0; }
.receipt-item    { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.receipt-total   { font-size: 22px; font-weight: 800; color: var(--success); margin-top: 8px; }

/* ============ SETTINGS ============ */
.settings-group {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin: 12px 16px;
  overflow: hidden;
}
.settings-group-title {
  padding: 12px 16px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-size: 15px; font-weight: 600; color: var(--text); }
.settings-row-input { max-width: 180px; text-align: right; }

/* Image preview in product form */
.img-preview-wrap {
  width: 100%; aspect-ratio: 1;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background: var(--bg);
  cursor: pointer;
  margin-bottom: 8px;
}
.img-preview-wrap img { width: 100%; height: 100%; object-fit: cover; }
.img-preview-placeholder { text-align: center; color: var(--muted); padding: 24px; }
.img-preview-placeholder span { font-size: 40px; display: block; margin-bottom: 6px; }
.img-preview-placeholder p { font-size: 13px; }

/* ============ POS TABS ============ */
.pos-tab-bar {
  display: flex; background: var(--surface);
  border-bottom: 1.5px solid var(--border);
}
.pos-tab {
  flex: 1; height: 46px;
  font-size: 14px; font-weight: 700;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  touch-action: manipulation;
  transition: color .15s, border-color .15s;
}
.pos-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ============ ADD ITEM POPUP ============ */
.add-item-popup {
  position: fixed;
  bottom: var(--nav-height);
  left: 0; right: 0;
  z-index: 160;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,.22);
  animation: slideUp .2s ease;
}
.add-item-popup::before {
  content: ''; display: block;
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--border); margin: 10px auto 0;
}
.add-item-popup.hidden { display: none !important; }
.add-item-backdrop {
  position: fixed; inset: 0; z-index: 155;
  background: rgba(0,0,0,.3);
}
.add-item-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.add-item-img {
  width: 56px; height: 56px; border-radius: var(--radius-md);
  object-fit: cover; flex-shrink: 0;
}
.add-item-no-img {
  width: 56px; height: 56px; border-radius: var(--radius-md);
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  font-size: 26px; flex-shrink: 0;
}
.add-item-name { font-size: 16px; font-weight: 800; }
.add-item-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 14px 16px;
}
.add-item-field { display: flex; flex-direction: column; gap: 4px; }
.add-item-field label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* ============ IMPROVED CART ITEM ============ */
.cart-item-v2 {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.cart-item-v2-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.cart-item-del {
  width: 26px; height: 26px; border-radius: var(--radius-full);
  background: #FEE2E2; color: var(--danger);
  font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; touch-action: manipulation;
}
.cart-item-v2-bottom {
  display: flex; align-items: flex-end; gap: 8px;
}
.cart-price-wrap { flex: 0 0 108px; display: flex; flex-direction: column; gap: 3px; }
.cart-qty-wrap   { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.cart-line-total { flex: 0 0 72px; text-align: right; padding-bottom: 2px; }
.cart-price-input, .qty-edit-input {
  width: 100%; height: 40px;
  text-align: center; font-size: 15px; font-weight: 700;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); outline: none; padding: 0 6px;
}
.cart-price-input:focus, .qty-edit-input:focus { border-color: var(--primary); background: #fff; }
.cart-field-label { font-size: 11px; color: var(--muted); font-weight: 600; }

/* In-cart badge on product card */
.product-card-in-cart {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px; border-radius: var(--radius-full);
  background: var(--primary); color: #fff;
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}

/* ============ BILL ROW (Recent Bills) ============ */
.bill-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border-radius: var(--radius-md);
  padding: 14px 16px; margin-bottom: 8px;
  box-shadow: var(--shadow); cursor: pointer; touch-action: manipulation;
}
.bill-row:active { opacity: .75; }
.bill-row-num  { font-size: 14px; font-weight: 800; }
.bill-row-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.bill-row-total { font-size: 18px; font-weight: 800; color: var(--success); white-space: nowrap; }

/* ============ MODULE TABS (Stock/Purchase) ============ */
.module-tab-bar {
  display: flex; background: var(--surface);
  border-bottom: 1.5px solid var(--border);
}
.module-tab {
  flex: 1; height: 46px;
  font-size: 14px; font-weight: 700;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  touch-action: manipulation;
}
.module-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ============ PURCHASE PANEL ============ */
.purchase-item-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.purchase-item-name { flex: 1; font-size: 14px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.purchase-qty-input, .purchase-cost-input {
  width: 70px; height: 40px;
  text-align: center; font-size: 14px; font-weight: 700;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); outline: none; padding: 0 4px;
}
.purchase-qty-input:focus  { border-color: var(--success); background: #fff; }
.purchase-cost-input:focus { border-color: var(--primary); background: #fff; }
.purchase-item-del {
  width: 28px; height: 28px; border-radius: var(--radius-full);
  background: #FEE2E2; color: var(--danger);
  font-size: 14px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; touch-action: manipulation;
}

/* Product search results */
.psr-list {
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); max-height: 200px; overflow-y: auto;
  margin-top: 4px; border: 1px solid var(--border);
}
.psr-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; touch-action: manipulation;
}
.psr-item:last-child { border-bottom: none; }
.psr-item:active { background: var(--bg); }
.psr-item-name  { font-size: 14px; font-weight: 700; flex: 1; }
.psr-item-stock { font-size: 12px; color: var(--muted); }

/* History rows */
.hist-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.hist-badge {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.hist-badge.purchase   { background: #DCFCE7; }
.hist-badge.sale       { background: #FEE2E2; }
.hist-badge.adjustment { background: #DBEAFE; }
.hist-badge.return     { background: #FEF9C3; }
.hist-badge.damage     { background: #FEE2E2; }

/* ============ POS SPLIT LAYOUT ============ */
.pos-split {
  display: flex;
  align-items: flex-start;
  min-height: calc(100dvh - var(--header-h) - var(--nav-height) - 48px);
}

/* Left: scrollable product area */
.pos-left {
  flex: 1;
  min-width: 0;
  padding-bottom: 80px; /* space for mobile cart btn */
}

/* Right: sticky cart panel */
.pos-right {
  width: 340px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: calc(100dvh - var(--header-h) - var(--nav-height) - 48px);
  overflow-y: auto;
  background: var(--surface);
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
}

.pos-cart-header {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
  padding: 12px 14px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
}

.pos-cart-items { flex: 1; }
.pos-cart-footer { border-top: 2px solid var(--border); }

/* ============ CART PANEL ITEMS (pcp) ============ */
.cart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  text-align: center;
}

.pcp-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transition: background .1s;
}
.pcp-item:hover { background: #FAFAFA; }

.pcp-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.pcp-item-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pcp-del {
  width: 26px; height: 26px;
  border-radius: var(--radius-full);
  background: #FEE2E2; color: var(--danger);
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; touch-action: manipulation;
}
.pcp-del:active { background: var(--danger); color: #fff; }

.pcp-item-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.pcp-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 3px;
}

.pcp-price-wrap { display: flex; flex-direction: column; flex: 0 0 88px; }
.pcp-price-input {
  width: 88px; height: 38px;
  text-align: center; font-size: 15px; font-weight: 800;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); outline: none; padding: 0 4px;
}
.pcp-price-input:focus { border-color: var(--primary); background: #fff; }
.pcp-orig-price { font-size: 10px; color: var(--muted); text-decoration: line-through; margin-top: 2px; }

.pcp-qty-wrap { display: flex; flex-direction: column; flex: 1; }
.pcp-qty-row  { display: flex; align-items: center; gap: 4px; }
.pcp-qty-btn  {
  width: 32px; height: 38px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 18px; font-weight: 700;
  color: var(--text); touch-action: manipulation;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pcp-qty-btn:active { background: var(--primary-light); }
.pcp-qty-input {
  flex: 1; height: 38px;
  text-align: center; font-size: 14px; font-weight: 800;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); outline: none; padding: 0 2px;
  min-width: 0;
}
.pcp-qty-input:focus { border-color: var(--success); background: #fff; }

.pcp-total-cell { display: flex; flex-direction: column; align-items: flex-end; flex: 0 0 auto; }
.pcp-line-total { font-size: 14px; font-weight: 800; color: var(--text); line-height: 38px; }

/* Cart summary footer */
.pcp-summary {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.pcp-sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding: 3px 0;
}
.pcp-grand-total {
  font-size: 18px;
  font-weight: 900;
  color: var(--text);
  padding: 8px 0 4px;
  border-top: 2px solid var(--border);
  margin-top: 4px;
}
.pcp-disc-row {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 0;
}
.pcp-section {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.pcp-section:last-child { border-bottom: none; }

/* ============ MOBILE CART TOGGLE ============ */
.mobile-cart-btn {
  position: fixed;
  bottom: calc(var(--nav-height) + 10px);
  left: 16px; right: 16px;
  height: 54px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 15px; font-weight: 800;
  box-shadow: var(--shadow-lg);
  z-index: 190;
  touch-action: manipulation;
  transition: transform .1s;
}
.mobile-cart-btn:active { transform: scale(.97); }
.mobile-cart-btn.hidden-bar { transform: translateY(150%); pointer-events: none; opacity: 0; }

/* On desktop: hide mobile toggle, show right panel normally */
@media (min-width: 768px) {
  .mobile-cart-btn  { display: none !important; }
  .pos-left { padding-bottom: 16px; }
}

/* On mobile: hide right panel by default, slide in when open */
@media (max-width: 767px) {
  .pos-right {
    position: fixed;
    top: var(--header-h);
    right: -100%;
    bottom: var(--nav-height);
    width: min(360px, 96%);
    height: auto;
    z-index: 210;
    transition: right .28s ease;
    box-shadow: var(--shadow-lg);
  }
  .pos-right.mobile-open { right: 0; }
}
