:root {
  --color-burgundy: #8b4049;
  --color-burgundy-dark: #6d323a;
  --color-cream: #f5f1ea;
  --color-beige: #e8dfd3;
  --color-charcoal: #3a3a3a;
  --pos-bottom-bar: 140px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--color-cream);
  color: var(--color-charcoal);
  font: 16px/1.4 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* ── PIN Lock Screen ────────────────────────────────────── */

.pos-lock {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-burgundy);
}

.pos-lock[hidden] { display: none; }

.pos-lock-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 300px;
  padding: 24px;
}

.pos-lock-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.pos-lock-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.5);
  margin-bottom: 8px;
}

.pos-pin-dots {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}

.pos-pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}

.pos-pin-dot--filled {
  background: #fff;
  border-color: #fff;
}

.pos-pin-error {
  font-size: 0.85rem;
  color: #ffaaaa;
  font-weight: 600;
  min-height: 1.2em;
}

.pos-pin-error[hidden] { visibility: hidden; }

.pos-pin-shake {
  animation: pos-shake 0.4s ease;
}

@keyframes pos-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.pos-pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 260px;
}

.pos-pin-key {
  height: 60px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-user-select: none;
  user-select: none;
}

.pos-pin-key:active {
  background: rgba(255,255,255,0.25);
  transform: scale(0.92);
}

.pos-pin-key--blank {
  background: transparent;
  cursor: default;
}

.pos-pin-key--del {
  font-size: 1.3rem;
  background: rgba(255,255,255,0.06);
}

/* ── App wrapper ────────────────────────────────────────── */

.pos-app[hidden] { display: none; }

/* ── Bluetooth-only elements (hidden unless BT available) ─ */

.pos-bt-only { display: none !important; }
.pos-app--bt .pos-bt-only { display: inline-flex !important; }

/* ── Header ─────────────────────────────────────────────── */

.pos-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--color-burgundy);
  color: #fff;
}

.pos-logo {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

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

.pos-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

/* ── Printer Button (header) ──────────────────────────── */

.pos-printer-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
  font-family: inherit;
}

.pos-printer-btn:active {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.5);
}

.pos-printer-btn.pos-printer-btn--connected {
  border-color: #7ddf7d;
  color: #fff;
}

.pos-printer-icon {
  width: 20px;
  height: 20px;
}

.pos-printer-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #888;
  border: 2px solid var(--color-burgundy);
  transition: background 0.2s;
}

.pos-printer-btn--connected .pos-printer-dot {
  background: #7ddf7d;
}

/* ── Main / Product Grid ────────────────────────────────── */

.pos-main {
  padding: 12px 12px calc(var(--pos-bottom-bar) + 12px);
}

.pos-category-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-burgundy);
  margin: 12px 0 8px;
  padding-left: 4px;
}

.pos-category:first-child .pos-category-title {
  margin-top: 0;
}

.pos-product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.pos-product-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 72px;
  padding: 12px 14px;
  background: #fff;
  border: 2px solid var(--color-beige);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  -webkit-user-select: none;
  user-select: none;
  text-align: left;
  font-family: inherit;
}

.pos-product-btn:active {
  transform: scale(0.96);
  border-color: var(--color-burgundy);
}

.pos-product-name {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-charcoal);
}

.pos-product-price {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--color-burgundy);
  margin-top: 2px;
}

.pos-product-mult {
  font-size: 0.65rem;
  color: #999;
  margin-top: 1px;
}

/* quantity badge on product buttons */
.pos-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 24px;
  height: 24px;
  line-height: 24px;
  background: var(--color-burgundy);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  border-radius: 12px;
  padding: 0 6px;
  pointer-events: none;
}

/* ── Order Bar (fixed bottom) ───────────────────────────── */

.pos-order-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: #fff;
  border-top: 1px solid var(--color-beige);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  transition: transform 0.2s;
}

.pos-order-bar--empty {
  transform: translateY(100%);
  pointer-events: none;
}

.pos-order-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  padding: 0 16px;
}

.pos-order-bar--expanded .pos-order-items {
  max-height: 50vh;
  overflow-y: auto;
  padding-top: 12px;
  padding-bottom: 4px;
}

.pos-order-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--color-beige);
  font-size: 0.875rem;
}

.pos-order-name { flex: 1; font-weight: 500; }
.pos-order-qty { color: #999; min-width: 30px; }
.pos-order-price { font-weight: 600; min-width: 55px; text-align: right; }

.pos-order-remove {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: #c44;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pos-order-remove:active { background: rgba(204,68,68,0.1); }

.pos-order-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 12px;
  cursor: pointer;
}

.pos-order-info {
  display: flex;
  flex-direction: column;
}

.pos-item-count {
  font-size: 0.8rem;
  color: #999;
}

.pos-total {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-charcoal);
}

.pos-charge-btn {
  flex-shrink: 0;
  padding: 14px 28px;
  background: var(--color-burgundy);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.pos-charge-btn:active { background: var(--color-burgundy-dark); }
.pos-charge-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Shared Modal ───────────────────────────────────────── */

.pos-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.85);
}

.pos-modal[hidden] { display: none; }

.pos-modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
}

.pos-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  background: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.5rem;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
}

.pos-modal-close:active {
  color: #fff;
  border-color: rgba(255,255,255,0.5);
}

.pos-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

/* ── Payment Method Picker ─────────────────────────────── */

.pos-method-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
}

.pos-method-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.pos-method-btn:active {
  transform: scale(0.96);
  background: rgba(255,255,255,0.15);
  border-color: #fff;
}

.pos-method-icon {
  width: 40px;
  height: 40px;
}

.pos-method-label {
  font-size: 1rem;
  font-weight: 700;
}

.pos-method-desc {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
}

.pos-cancel-btn {
  padding: 12px 32px;
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: 4px;
}

.pos-cancel-btn:active { color: #fff; border-color: rgba(255,255,255,0.5); }

/* ── QR Code Modal ──────────────────────────────────────── */

.pos-qr-amount {
  font-size: 2.5rem;
  font-weight: 700;
  color: #fff;
}

.pos-qr-order-num {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
}

.pos-qr-instruction {
  font-size: 1rem;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.pos-qr-canvas {
  border-radius: 16px;
  background: #fff;
  padding: 0;
}

.pos-qr-wallet-hint {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
}

.pos-new-order-btn {
  margin-top: 12px;
  padding: 14px 40px;
  background: #fff;
  color: var(--color-charcoal);
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s;
}

.pos-new-order-btn:active { transform: scale(0.96); }

/* ── Print Receipt Button (modals) ───────────────────── */

.pos-print-btn {
  margin-top: 4px;
  padding: 12px 36px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pos-print-btn:active {
  background: rgba(255,255,255,0.25);
  transform: scale(0.96);
}

.pos-print-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ── PNC Payment Screen ────────────────────────────────── */

.pos-pnc-header {
  font-size: 1.1rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pos-pnc-order-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 8px;
}

.pos-pnc-order-num {
  font-size: 3.5rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.pos-pnc-amount-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 8px;
}

.pos-pnc-amount {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
}

.pos-pnc-copy-btn {
  padding: 10px 28px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.pos-pnc-copy-btn:active { background: rgba(255,255,255,0.25); }

.pos-pnc-copied {
  font-size: 0.85rem;
  color: #7ddf7d;
  font-weight: 600;
}

.pos-pnc-instructions {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.7;
  text-align: left;
  padding: 16px 20px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  width: 100%;
}

.pos-pnc-instructions strong { color: rgba(255,255,255,0.8); }

/* ── Cash Payment Screen ──────────────────────────────── */

.pos-cash-amount {
  font-size: 2.5rem;
  font-weight: 700;
  color: #fff;
}

.pos-cash-order-num {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
}

.pos-cash-instruction {
  font-size: 1rem;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.pos-cash-confirm-btn {
  margin-top: 8px;
  padding: 16px 44px;
  background: #3a9a5c;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.pos-cash-confirm-btn:active {
  background: #2e7d4a;
  transform: scale(0.96);
}

/* ── Venmo Payment Screen ────────────────────────────────── */

.pos-venmo-amount {
  font-size: 2.5rem;
  font-weight: 700;
  color: #fff;
}

.pos-venmo-order-num {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
}

.pos-venmo-instruction {
  font-size: 1rem;
  color: #008CFF;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.pos-venmo-confirm-btn {
  margin-top: 8px;
  padding: 16px 44px;
  background: #008CFF;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.pos-venmo-confirm-btn:active {
  background: #006fcc;
  transform: scale(0.96);
}

/* ── Loading spinner ────────────────────────────────────── */

.pos-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: rgba(255,255,255,0.8);
  font-size: 1rem;
}

.pos-loading-overlay[hidden] { display: none; }

.pos-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pos-spin 0.8s linear infinite;
}

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

/* ── Responsive: larger phones / tablets ─────────────────── */

@media (min-width: 480px) {
  .pos-product-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
  .pos-main { max-width: 720px; margin: 0 auto; }
  .pos-product-grid { grid-template-columns: repeat(4, 1fr); }
}
