/* ══════════════════════════════════════════════════════════════════════════
   QuickCheckout POS — Professional Stylesheet
   Inspired by Square POS / Toast / Clover UI
   ══════════════════════════════════════════════════════════════════════════ */

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

/* ── CSS Variables ───────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --green:            #1DAA61;
  --green-dark:       #17894e;
  --green-light:      #e8f8f0;
  --green-mid:        #d1f0e1;

  /* Header */
  --header-bg:        #1a1a2e;
  --header-accent:    #16213e;

  /* Neutrals */
  --bg:               #f0f2f5;
  --bg-secondary:     #e8eaed;
  --white:            #ffffff;
  --border:           #e2e5ea;
  --border-strong:    #cdd0d7;

  /* Text */
  --text:             #111827;
  --text-secondary:   #4b5563;
  --muted:            #9ca3af;

  /* Status */
  --red:              #dc2626;
  --red-light:        #fee2e2;
  --amber:            #d97706;

  /* Dimensions */
  --header-h:         60px;
  --cart-w:           360px;

  /* Effects */
  --shadow-sm:        0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:           0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:        0 10px 30px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-green:     0 4px 20px rgba(29,170,97,0.30);

  /* Radius */
  --radius-sm:        6px;
  --radius:           10px;
  --radius-lg:        14px;
  --radius-xl:        20px;

  /* Transitions */
  --transition:       0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast:  0.12s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

button { font-family: inherit; }
input  { font-family: inherit; }

/* ══════════════════════════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════════════════════════ */
.app-header {
  height: var(--header-h);
  background: var(--header-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--green);
  border-radius: 8px;
  font-size: 1rem;
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.employee-select {
  padding: 0 12px;
  height: 38px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  min-width: 180px;
  min-height: 44px;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(255,255,255,0.6)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.employee-select:focus {
  outline: none;
  border-color: var(--green);
  background-color: rgba(255,255,255,0.12);
}

.employee-select option {
  background: var(--header-bg);
  color: #fff;
}

.report-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.85);
  font-size: 0.825rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 0 14px;
  height: 36px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
  min-height: 44px;
}

.report-link:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}

.report-link::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.85)' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
}

/* ══════════════════════════════════════════════════════════════════════════
   SCREEN SYSTEM
   ══════════════════════════════════════════════════════════════════════════ */
.screen {
  display: none;
  animation: screenIn var(--transition) both;
}

.screen.active {
  display: block;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════════════════
   SCREEN 1 — CHECKOUT
   ══════════════════════════════════════════════════════════════════════════ */
.checkout-layout {
  display: grid;
  grid-template-columns: 1fr var(--cart-w);
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

/* ── Products Panel ──────────────────────────────────────────────────────── */
.products-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.panel-top {
  padding: 16px 20px 0;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.category-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 14px;
  scrollbar-width: none;
  margin-top: 12px;
}

.category-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
  white-space: nowrap;
  padding: 0 18px;
  height: 36px;
  border: 1.5px solid var(--border-strong);
  border-radius: 100px;
  background: var(--white);
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  min-height: 44px;
  transition: all var(--transition-fast);
  letter-spacing: 0.1px;
}

.cat-tab:hover:not(.active) {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-light);
}

.cat-tab.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  box-shadow: 0 2px 8px rgba(29,170,97,0.3);
}

/* ── Product Grid ────────────────────────────────────────────────────────── */
.product-grid {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  align-content: start;
  position: relative;
}

/* Subtle scroll-shadow at the bottom of the grid container */
.products-panel::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to top, rgba(240,242,245,0.85) 0%, rgba(240,242,245,0) 100%);
  pointer-events: none;
  z-index: 10;
}

.product-grid::-webkit-scrollbar { width: 6px; }
.product-grid::-webkit-scrollbar-track { background: transparent; }
.product-grid::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.product-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
  text-align: center;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  user-select: none;
  position: relative;
}

.product-card:hover {
  border-color: var(--green);
  box-shadow: 0 8px 24px rgba(29,170,97,0.18), 0 2px 6px rgba(0,0,0,0.08);
  transform: translateY(-3px);
}

.product-card:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-sm);
  border-color: var(--green-dark);
}

/* Product image — shown when imageUrl is present */
.product-card-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 12px 12px 0 0;
  display: block;
  flex-shrink: 0;
}

/* Placeholder zone — shown when no imageUrl */
.product-card-placeholder {
  width: 100%;
  height: 120px;
  background: linear-gradient(135deg, #f0f2f5, #e8eaed);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px 12px 0 0;
  flex-shrink: 0;
}

/* When onerror fires, .no-image is added — hide broken img, show placeholder instead */
.product-card.no-image .product-card-img {
  display: none;
}

.product-card.no-image .product-card-placeholder {
  display: flex;
}

/* Legacy icon support (kept for backward-compat, unused in new template) */
.product-card-icon {
  height: 72px;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.product-card-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(29,170,97,0.08) 0%, rgba(29,170,97,0.02) 100%);
}

.product-card-icon-inner {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(29,170,97,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.product-card-icon-inner svg {
  width: 22px;
  height: 22px;
  stroke: var(--green);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.product-card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 60px;
  justify-content: center;
}

.product-name {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-price {
  font-size: 0.975rem;
  color: var(--green);
  font-weight: 700;
}

/* ── Cart Panel ──────────────────────────────────────────────────────────── */
.cart-panel {
  background: var(--white);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -2px 0 12px rgba(0,0,0,0.06);
}

.cart-title {
  padding: 18px 20px 14px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cart-title-icon {
  width: 28px;
  height: 28px;
  background: var(--green-light);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-title-icon svg {
  width: 15px;
  height: 15px;
  stroke: var(--green);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cart-count-badge {
  margin-left: auto;
  background: var(--green);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  min-width: 22px;
  text-align: center;
  display: none;
}

.cart-count-badge.visible { display: inline-flex; align-items: center; justify-content: center; }

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.cart-items::-webkit-scrollbar { width: 4px; }
.cart-items::-webkit-scrollbar-track { background: transparent; }
.cart-items::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
  height: 100%;
  min-height: 120px;
}

.cart-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-empty-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cart-row {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: background var(--transition-fast), border-left-color var(--transition-fast);
}

.cart-row:last-child { border-bottom: none; }
.cart-row:hover {
  background: #fafbfc;
  border-left-color: var(--green);
}

.cart-item-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 8px;
}

.cart-item-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  flex: 1;
}

.cart-item-line {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  line-height: 1;
}

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

.qty-btn:active {
  transform: scale(0.92);
  background: var(--green-mid);
}

.qty-num {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: all var(--transition-fast);
}

.remove-btn:hover {
  background: var(--red-light);
  color: var(--red);
}

.remove-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ── Order Summary ───────────────────────────────────────────────────────── */
.order-summary {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--white);
  flex-shrink: 0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.summary-row span:last-child {
  font-weight: 600;
  color: var(--text);
}

.total-row {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text) !important;
  margin-top: 6px;
  padding-top: 10px !important;
  border-top: 2px solid var(--border);
}

.total-row span:first-child { color: var(--text) !important; font-weight: 800 !important; font-size: 1.05rem !important; }
.total-row span:last-child  { color: var(--green) !important; font-weight: 800 !important; font-size: 1.05rem !important; }

/* ── Cart Actions ────────────────────────────────────────────────────────── */
.cart-actions {
  display: flex;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   BUTTONS — Universal
   ══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 20px;
  height: 46px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  min-height: 44px;
  transition: all var(--transition-fast);
  letter-spacing: 0.1px;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition-fast);
}

.btn:active::after {
  background: rgba(0,0,0,0.08);
}

/* Primary — Green */
.btn-primary {
  background: var(--green);
  color: #fff;
  flex: 1;
  box-shadow: 0 2px 8px rgba(29,170,97,0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--green-dark);
  box-shadow: var(--shadow-green);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 1px 4px rgba(29,170,97,0.2);
}

.btn-primary:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Secondary */
.btn-secondary {
  background: var(--white);
  color: var(--text-secondary);
  border: 1.5px solid var(--border-strong);
  flex: none;
}

.btn-secondary:hover {
  background: var(--bg);
  border-color: var(--text-secondary);
  color: var(--text);
}

/* Back */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: var(--radius);
  min-height: 44px;
  transition: all var(--transition-fast);
}

.btn-back:hover {
  background: var(--bg);
  color: var(--text);
}

.btn-back::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234b5563' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M15 19l-7-7 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  flex-shrink: 0;
}

/* Large variant */
.btn-large {
  width: 100%;
  height: 54px;
  font-size: 1rem;
  font-weight: 800;
  border-radius: var(--radius-lg);
  letter-spacing: 0.2px;
  flex: none;
}

/* Charge button — special */
#charge-btn.btn-primary {
  font-size: 0.95rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   SCREEN 2 — PAYMENT
   ══════════════════════════════════════════════════════════════════════════ */
#screen-payment {
  background: var(--bg);
  min-height: calc(100vh - var(--header-h));
}

.payment-layout {
  max-width: 520px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.payment-employee-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green);
  background: var(--green-light);
  border: 1px solid var(--green-mid);
  padding: 4px 12px;
  border-radius: 100px;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.payment-title {
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.5px;
  color: var(--text);
}

/* Total card */
.payment-total-box {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow-green);
  position: relative;
  overflow: hidden;
}

.payment-total-box::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
}

.payment-total-box::after {
  content: '';
  position: absolute;
  bottom: -30px;
  left: -20px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}

.payment-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.payment-amount {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  position: relative;
  z-index: 1;
}

/* Tip Section */
.tip-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.tip-section h3 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
}

.tip-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tip-btn {
  padding: 0 12px;
  height: 52px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--white);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  min-height: 44px;
  transition: all var(--transition-fast);
  letter-spacing: 0.1px;
}

.tip-btn:hover:not(.active) {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-light);
}

.tip-btn:active {
  transform: scale(0.96);
}

.tip-btn.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  box-shadow: 0 2px 8px rgba(29,170,97,0.25), inset 0 1px 4px rgba(255,255,255,0.2);
}

.custom-tip-container {
  margin-top: 12px;
}

.custom-tip-input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 2px solid var(--green);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  background: var(--white);
  min-height: 44px;
  transition: box-shadow var(--transition-fast);
}

.custom-tip-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29,170,97,0.18);
}

/* Payment breakdown */
.payment-breakdown {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.payment-breakdown .summary-row {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.payment-breakdown .summary-row:last-child {
  border-bottom: none;
}

.payment-breakdown .total-row {
  border-top: 2px solid var(--border) !important;
  margin-top: 4px;
  padding-top: 12px !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   SCREEN 3 — CONFIRMATION
   ══════════════════════════════════════════════════════════════════════════ */
#screen-complete {
  background: var(--bg);
  min-height: calc(100vh - var(--header-h));
}

.complete-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-h));
  padding: 40px 20px;
  gap: 24px;
  text-align: center;
}

/* Animated checkmark */
.checkmark {
  width: 88px;
  height: 88px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkmark-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 8px 32px rgba(29,170,97,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: checkmarkPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes checkmarkPop {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.checkmark-circle svg {
  width: 44px;
  height: 44px;
  stroke: #fff;
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: checkmarkDraw 0.4s 0.3s ease forwards;
}

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

.complete-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1.1;
}

.complete-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: -12px;
}

/* Receipt card */
.receipt-summary {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  text-align: left;
}

.receipt-header {
  text-align: center;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px dashed var(--border-strong);
}

.receipt-store {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
}

.receipt-date {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.receipt-row:last-child { border-bottom: none; }
.receipt-row span:first-child { color: var(--text-secondary); font-weight: 500; }
.receipt-row span:last-child { font-weight: 600; color: var(--text); text-align: right; max-width: 60%; word-break: break-word; }

.receipt-total {
  font-size: 1rem !important;
  padding-top: 10px !important;
  border-top: 2px solid var(--border-strong) !important;
  margin-top: 4px;
}

.receipt-total span:first-child { color: var(--text) !important; font-weight: 800 !important; }
.receipt-total span:last-child  { color: var(--green) !important; font-weight: 900 !important; font-size: 1.1rem !important; }

/* New sale button area */
.complete-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 380px;
}

.auto-reset-msg {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

#countdown {
  font-weight: 800;
  color: var(--green);
}

/* ══════════════════════════════════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 0.9rem;
}

.loading::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.error-msg {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.875rem;
  font-weight: 500;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
  flex-shrink: 0;
}

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

/* ── Charge button pulse when cart has items ─────────────────────────────── */
@keyframes btnPulse {
  0%   { box-shadow: 0 2px 8px rgba(29,170,97,0.25); transform: scale(1); }
  50%  { box-shadow: 0 4px 20px rgba(29,170,97,0.45); transform: scale(1.02); }
  100% { box-shadow: 0 2px 8px rgba(29,170,97,0.25); transform: scale(1); }
}

.btn-pulse {
  animation: btnPulse 2s ease-in-out infinite;
}

.btn-pulse:hover,
.btn-pulse:active {
  animation: none;
}

/* ── Cart count badge bounce on update ───────────────────────────────────── */
@keyframes badgeBump {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.35); }
  65%  { transform: scale(0.9); }
  85%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.badge-bump {
  animation: badgeBump 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --cart-w: 100%;
    --header-h: 56px;
  }

  .checkout-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    height: auto;
    min-height: calc(100vh - var(--header-h));
    overflow: visible;
  }

  .products-panel {
    height: 55vh;
    border-right: none;
    border-bottom: 2px solid var(--border);
  }

  .cart-panel {
    border-top: none;
    max-height: 45vh;
    box-shadow: none;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    padding: 14px;
    gap: 10px;
  }

  .product-card-img,
  .product-card-placeholder { height: 90px; }
  .product-card-icon { height: 60px; }

  .employee-select {
    min-width: 140px;
    font-size: 0.8rem;
  }

  .report-link { display: none; }

  .payment-amount { font-size: 2.4rem; }
  .complete-title { font-size: 1.8rem; }
}

@media (max-width: 480px) {
  .app-header { padding: 0 16px; }

  .tip-buttons {
    grid-template-columns: repeat(2, 1fr);
  }

  .payment-layout { padding: 20px 16px 32px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PRINT
   ══════════════════════════════════════════════════════════════════════════ */
@media print {
  .app-header,
  .cart-actions,
  .btn-back,
  .report-actions { display: none !important; }
}
