/* ═══════════════════════════════════════════════════════════════════════════
   Cashier POS — Restaurant‑grade touch‑first design
   ═══════════════════════════════════════════════════════════════════════════ */

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

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

/* ── Theme presets: synced with admin site via localStorage zf_theme ── */
/* Default (:root) is neutral — no warm/orange fallback */
[data-theme="sage"] {
  --pos-primary: oklch(0.50 0.12 160);
  --pos-primary-hover: oklch(0.45 0.13 160);
  --pos-primary-dim: oklch(0.38 0.10 160);
  --pos-primary-glow: oklch(0.50 0.12 160 / 0.2);
  --pos-accent: oklch(0.60 0.14 80);
  --pos-accent-hover: oklch(0.54 0.14 80);
}
[data-theme="ocean"] {
  --pos-primary: oklch(0.48 0.14 250);
  --pos-primary-hover: oklch(0.43 0.15 250);
  --pos-primary-dim: oklch(0.36 0.12 250);
  --pos-primary-glow: oklch(0.48 0.14 250 / 0.2);
  --pos-accent: oklch(0.58 0.12 210);
  --pos-accent-hover: oklch(0.50 0.12 210);
}
[data-theme="warm"] {
  --pos-primary: oklch(0.55 0.18 50);
  --pos-primary-hover: oklch(0.50 0.19 50);
  --pos-primary-dim: oklch(0.42 0.15 50);
  --pos-primary-glow: oklch(0.55 0.18 50 / 0.2);
  --pos-accent: oklch(0.62 0.16 30);
  --pos-accent-hover: oklch(0.55 0.16 30);
}

:root {
  --pos-bg: oklch(0.14 0.02 265);
  --pos-surface: oklch(0.18 0.025 265);
  --pos-surface-hover: oklch(0.22 0.03 265);
  --pos-card: oklch(0.97 0.005 85);
  --pos-card-hover: oklch(0.94 0.01 85);
  --pos-border: oklch(0.28 0.03 265);
  --pos-border-light: oklch(0.85 0.01 85);
  --pos-text: oklch(0.97 0.01 85);
  --pos-text-muted: oklch(0.65 0.03 265);
  --pos-text-dark: oklch(0.15 0.02 265);
  --pos-primary: oklch(0.45 0.02 280);
  --pos-primary-hover: oklch(0.40 0.02 280);
  --pos-primary-dim: oklch(0.38 0.015 280);
  --pos-primary-glow: oklch(0.45 0.02 280 / 0.2);
  --pos-accent: oklch(0.55 0.02 280);
  --pos-accent-hover: oklch(0.50 0.02 280);
  --pos-green: oklch(0.60 0.20 145);
  --pos-green-hover: oklch(0.52 0.22 145);
  --pos-red: oklch(0.55 0.22 25);
  --pos-red-hover: oklch(0.48 0.24 25);
  --pos-gold: oklch(0.72 0.18 75);
  --pos-gold-hover: oklch(0.65 0.20 75);
  --pos-blue: oklch(0.55 0.15 250);
  --pos-blue-hover: oklch(0.48 0.17 250);
  --pos-radius: 12px;
  --pos-radius-sm: 8px;
  --pos-radius-xs: 4px;
  --pos-shadow: 0 2px 12px rgba(0,0,0,.3);
  --pos-shadow-lg: 0 8px 40px rgba(0,0,0,.5);
  --pos-transition: 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  --pos-touch: 52px;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--pos-bg);
  color: var(--pos-text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ──────────────────────────────────────────────────────────────────────────
   LAYOUT
   ──────────────────────────────────────────────────────────────────────── */

.pos-app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ── LEFT: Menu Panel ── */
.pos-menu-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--pos-card);
  color: var(--pos-text-dark);
}

.pos-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--pos-card);
  border-bottom: 1px solid var(--pos-border-light);
  flex-shrink: 0;
}

.pos-header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.pos-header .store-name {
  color: var(--pos-primary);
}

.pos-header-spacer {
  flex: 1;
}

.pos-search {
  position: relative;
  flex: 0 1 280px;
}

.pos-search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1.5px solid var(--pos-border-light);
  border-radius: var(--pos-radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  background: white;
  color: var(--pos-text-dark);
  outline: none;
  transition: border-color var(--pos-transition);
}

.pos-search input:focus {
  border-color: var(--pos-primary);
  box-shadow: 0 0 0 3px var(--pos-primary-glow);
}

.pos-search::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  opacity: 0.4;
}

/* ── Category Tabs ── */
.pos-categories {
  display: flex;
  gap: 6px;
  padding: 12px 20px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-bottom: 1px solid var(--pos-border-light);
}

.pos-categories::-webkit-scrollbar { display: none; }

.pos-cat-btn {
  flex-shrink: 0;
  padding: 8px 18px;
  border: 1.5px solid var(--pos-border-light);
  border-radius: 100px;
  background: transparent;
  color: var(--pos-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--pos-transition);
  white-space: nowrap;
  line-height: 1.3;
}

.pos-cat-btn:hover {
  background: var(--pos-primary-glow);
  color: var(--pos-primary);
  border-color: var(--pos-primary);
}

.pos-cat-btn.active {
  background: var(--pos-primary);
  color: white;
  border-color: var(--pos-primary);
}

/* ── Menu Grid ── */
.pos-menu-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  align-content: start;
}

.pos-menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 10px 10px 14px;
  background: white;
  border: 1.5px solid var(--pos-border-light);
  border-radius: var(--pos-radius);
  cursor: pointer;
  transition: all var(--pos-transition);
  min-height: 120px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  text-align: center;
}

.pos-menu-item .item-img {
  width: 100%;
  height: 70px;
  object-fit: cover;
  border-radius: var(--pos-radius-xs);
  margin-bottom: 4px;
  background: var(--pos-card-hover);
}

.pos-menu-item:hover {
  border-color: var(--pos-primary);
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  transform: translateY(-2px);
}

.pos-menu-item:active {
  transform: translateY(0);
  background: var(--pos-card-hover);
}

.pos-menu-item .item-icon {
  font-size: 2rem;
  line-height: 1;
  padding: 12px 0 4px;
}

.pos-menu-item .item-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--pos-text-dark);
  line-height: 1.2;
}

.pos-menu-item .item-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--pos-primary);
}

.pos-menu-item .item-price::before {
  content: '₱';
}

/* ── RIGHT: Cart Panel ── */
.pos-cart-panel {
  flex: 0 0 40%;
  min-width: 340px;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  background: var(--pos-surface);
  border-left: 1px solid var(--pos-border);
}

.pos-cart-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--pos-border);
  flex-shrink: 0;
}

.pos-cart-header h2 {
  font-size: 1rem;
  font-weight: 700;
  flex: 1;
}

.pos-cart-count {
  background: var(--pos-primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 100px;
  line-height: 1.6;
}

.pos-cart-header .order-type-group {
  display: flex;
  gap: 4px;
}

.pos-order-type-btn {
  padding: 5px 12px;
  border: 1px solid var(--pos-border);
  border-radius: 6px;
  background: transparent;
  color: var(--pos-text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--pos-transition);
}

.pos-order-type-btn:hover {
  border-color: var(--pos-primary);
  color: var(--pos-primary);
}

.pos-order-type-btn.active {
  background: var(--pos-primary);
  border-color: var(--pos-primary);
  color: white;
}

/* ── Cart Items ── */
.pos-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
}

.pos-cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--pos-text-muted);
  font-size: 0.9rem;
  text-align: center;
  gap: 8px;
  opacity: 0.6;
}

.pos-cart-empty::before {
  content: '';
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 002 1.61h9.72a2 2 0 002-1.61L23 6H6'/%3E%3C/svg%3E") no-repeat center / contain;
  opacity: 0.3;
}

.pos-cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--pos-surface-hover);
  border: 2px solid transparent;
  border-radius: var(--pos-radius-sm);
  margin-bottom: 6px;
  transition: border-color var(--pos-transition);
  min-height: 68px;
}

.pos-cart-item:focus-within,
.pos-cart-item:hover {
  border-color: var(--pos-primary);
  outline: none;
}

.pos-cart-item .item-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--pos-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  overflow: hidden;
}

.pos-cart-item .item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pos-cart-item .item-info {
  flex: 1;
  min-width: 0;
}

.pos-cart-item .item-info .name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.pos-cart-item .item-info .subtotal {
  font-size: 0.78rem;
  color: var(--pos-text-muted);
  margin-top: 2px;
}

.pos-cart-item .item-qty {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pos-cart-item .item-qty button {
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--pos-border);
  border-radius: 8px;
  background: transparent;
  color: var(--pos-text);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--pos-transition);
  font-family: inherit;
  line-height: 1;
  touch-action: manipulation;
}

.pos-cart-item .item-qty button:hover {
  background: var(--pos-primary);
  border-color: var(--pos-primary);
  color: white;
}

.pos-cart-item .item-qty button:active {
  transform: scale(0.92);
}

.pos-cart-item .item-qty .qty {
  font-size: 1rem;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

.pos-cart-item .item-line-total {
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 70px;
  text-align: right;
  color: var(--pos-accent);
}

/* ── Senior Discount ── */
.pos-senior-section {
  padding: 10px 14px;
  border-top: 1px solid var(--pos-border);
  border-bottom: 1px solid var(--pos-border);
  flex-shrink: 0;
}

.pos-senior-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 4px 0;
}

.pos-senior-toggle input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--pos-gold);
  cursor: pointer;
}

.pos-senior-toggle .sc-badge {
  background: var(--pos-gold);
  color: var(--pos-text-dark);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.pos-senior-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding: 10px;
  background: var(--pos-surface-hover);
  border-radius: var(--pos-radius-sm);
}

.pos-senior-fields input {
  padding: 8px 12px;
  border: 1px solid var(--pos-border);
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: inherit;
  background: var(--pos-bg);
  color: var(--pos-text);
  outline: none;
  transition: border-color var(--pos-transition);
}

.pos-senior-fields input:focus {
  border-color: var(--pos-gold);
  box-shadow: 0 0 0 2px var(--pos-gold);
}

/* ── Cart Totals ── */
.pos-cart-totals {
  padding: 16px 14px;
  border-top: 1px solid var(--pos-border);
  flex-shrink: 0;
}

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

.pos-total-row.total {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--pos-text);
  padding: 10px 0 4px;
  border-top: 1px solid var(--pos-border);
  margin-top: 6px;
}

.pos-total-row.total .amount {
  color: var(--pos-accent);
  font-size: 1.5rem;
}

.pos-total-row.discount-row {
  color: var(--pos-gold);
}

.pos-total-row.discount-row .amount {
  font-weight: 700;
}

/* ── Payment Section ── */
.pos-payment {
  padding: 0 14px 14px;
  border-top: 1px solid var(--pos-border);
  flex-shrink: 0;
}

.pos-payment-methods {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.pos-pay-btn {
  flex: 1;
  padding: 12px 8px;
  border: 1.5px solid var(--pos-border);
  border-radius: var(--pos-radius-sm);
  background: transparent;
  color: var(--pos-text);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: all var(--pos-transition);
  line-height: 1.2;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  touch-action: manipulation;
}

.pos-pay-btn .pay-icon-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.pos-pay-btn:hover {
  border-color: var(--pos-primary);
  background: var(--pos-primary-glow);
}

.pos-pay-btn.active {
  border-color: var(--pos-primary);
  background: var(--pos-primary);
  color: white;
}

.pos-pay-btn.method-cash.active { background: var(--pos-green); border-color: var(--pos-green); }
.pos-pay-btn.method-gcash.active { background: var(--pos-blue); border-color: var(--pos-blue); }
.pos-pay-btn.method-paymaya.active { background: var(--pos-red); border-color: var(--pos-red); }
.pos-pay-btn.method-split.active { background: var(--pos-gold); border-color: var(--pos-gold); color: var(--pos-text-dark); }

/* ── Cash Input ── */
.pos-cash-input-area {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pos-cash-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pos-cash-input span {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--pos-text-muted);
}

.pos-cash-input input {
  flex: 1;
  padding: 14px 16px;
  border: 1.5px solid var(--pos-border);
  border-radius: var(--pos-radius-sm);
  font-size: 1.3rem;
  font-weight: 700;
  font-family: inherit;
  background: var(--pos-bg);
  color: var(--pos-text);
  outline: none;
  transition: border-color var(--pos-transition);
  min-height: 52px;
}

.pos-cash-input input:focus {
  border-color: var(--pos-green);
  box-shadow: 0 0 0 3px var(--pos-green);
}

.pos-change-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--pos-surface-hover);
  border-radius: var(--pos-radius-sm);
  font-size: 1rem;
  min-height: 52px;
}

.pos-change-display .change-amount {
  font-size: 1.4rem;
  font-weight: 800;
}

/* ── QR Area (GCash / PayMaya) ── */
.pos-qr-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin-top: 10px;
  background: var(--pos-surface-hover);
  border-radius: var(--pos-radius-sm);
  border: 1px solid var(--pos-border);
}

.pos-qr-image {
  width: 180px;
  height: 180px;
  border-radius: 8px;
  overflow: hidden;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}

.pos-qr-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pos-qr-account {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--pos-text);
  text-align: center;
  letter-spacing: 0.02em;
}

.pos-change-display .change-amount.positive {
  color: var(--pos-green);
}

.pos-change-display .change-amount.negative {
  color: var(--pos-red);
}

/* ── Quick Cash Grid ── */
.pos-quick-cash {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 8px;
}

.pos-quick-cash button {
  padding: 10px 6px;
  border: 1.5px solid var(--pos-border);
  border-radius: 8px;
  background: var(--pos-surface-hover);
  color: var(--pos-text);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--pos-transition);
  min-height: 46px;
  touch-action: manipulation;
}

.pos-quick-cash button:hover {
  background: var(--pos-green);
  border-color: var(--pos-green);
  color: white;
}

/* ── Charge Button ── */
.pos-charge-btn {
  width: 100%;
  margin-top: 12px;
  padding: 18px;
  border: none;
  border-radius: var(--pos-radius-sm);
  background: var(--pos-green);
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--pos-transition);
  min-height: 58px;
  touch-action: manipulation;
}

.pos-charge-btn:hover {
  background: var(--pos-green-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(46, 204, 113, 0.3);
}

.pos-charge-btn:active {
  transform: translateY(0);
}

.pos-charge-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.pos-charge-btn.paying {
  background: var(--pos-primary);
}

.pos-charge-btn.paying:hover {
  background: var(--pos-primary-hover);
}

/* ──────────────────────────────────────────────────────────────────────────
   RECEIPT OVERLAY
   ──────────────────────────────────────────────────────────────────────── */

.pos-receipt-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.pos-receipt-overlay.open {
  display: flex;
}

.pos-receipt-box {
  background: white;
  color: #222;
  border-radius: var(--pos-radius);
  padding: 28px 32px;
  max-width: 380px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--pos-shadow-lg);
  font-size: 0.78rem;
  line-height: 1.5;
}

.pos-receipt-box .receipt-header {
  text-align: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed #ccc;
}

.pos-receipt-box .receipt-header h3 {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.pos-receipt-box .receipt-header p {
  color: #666;
  font-size: 0.72rem;
}

.pos-receipt-box .receipt-items {
  margin-bottom: 12px;
}

.pos-receipt-box .receipt-item {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 0.75rem;
}

.pos-receipt-box .receipt-totals {
  border-top: 1px dashed #ccc;
  padding-top: 8px;
  margin-bottom: 12px;
}

.pos-receipt-box .receipt-totals .r-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.pos-receipt-box .receipt-totals .r-row.total {
  font-weight: 800;
  font-size: 0.95rem;
  border-top: 1px solid #ccc;
  padding-top: 6px;
  margin-top: 4px;
}

.pos-receipt-box .receipt-senior {
  background: #fef9e7;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 0.72rem;
  border: 1px solid #f9e79f;
}

.pos-receipt-box .receipt-senior strong {
  color: #b7950b;
}

.pos-receipt-box .receipt-payment {
  border-top: 1px dashed #ccc;
  padding-top: 8px;
  margin-bottom: 10px;
  font-size: 0.72rem;
}

.pos-receipt-box .receipt-payment .rp-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.pos-receipt-box .receipt-footer {
  text-align: center;
  border-top: 1px dashed #ccc;
  padding-top: 10px;
  color: #888;
  font-size: 0.68rem;
}

.pos-receipt-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.pos-receipt-actions button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: var(--pos-radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--pos-transition);
}

.pos-receipt-actions .btn-print {
  background: var(--pos-primary);
  color: white;
}

.pos-receipt-actions .btn-print:hover {
  background: var(--pos-primary-hover);
}

.pos-receipt-actions .btn-close {
  background: #eee;
  color: #555;
}

.pos-receipt-actions .btn-close:hover {
  background: #ddd;
}

/* ──────────────────────────────────────────────────────────────────────────
   HISTORY OVERLAY
   ──────────────────────────────────────────────────────────────────────── */

.pos-history-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 9998;
  align-items: center;
  justify-content: center;
}

.pos-history-overlay.open {
  display: flex;
}

.pos-history-box {
  background: var(--pos-surface);
  border-radius: var(--pos-radius);
  padding: 20px 24px;
  max-width: 520px;
  width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--pos-shadow-lg);
}

.pos-history-box h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--pos-border);
}

.pos-history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--pos-surface-hover);
  border-radius: var(--pos-radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: background var(--pos-transition);
}

.pos-history-item:hover {
  background: var(--pos-card);
}

.pos-history-item .h-info {
  flex: 1;
  min-width: 0;
}

.pos-history-item .h-info .h-order-num {
  font-size: 0.82rem;
  font-weight: 700;
}

.pos-history-item .h-info .h-meta {
  font-size: 0.72rem;
  color: var(--pos-text-muted);
  margin-top: 2px;
}

.pos-history-item .h-total {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--pos-accent);
}

.pos-history-item .h-reopen {
  padding: 6px 14px;
  border: 1px solid var(--pos-primary);
  border-radius: 6px;
  background: transparent;
  color: var(--pos-primary);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--pos-transition);
}

.pos-history-item .h-reopen:hover {
  background: var(--pos-primary);
  color: white;
}

.pos-history-close {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--pos-border);
  border-radius: var(--pos-radius-sm);
  background: transparent;
  color: var(--pos-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.pos-history-close:hover {
  background: var(--pos-surface-hover);
}

/* ──────────────────────────────────────────────────────────────────────────
   TOAST
   ──────────────────────────────────────────────────────────────────────── */

.pos-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--pos-text-dark);
  color: white;
  padding: 12px 24px;
  border-radius: var(--pos-radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 99999;
  box-shadow: var(--pos-shadow-lg);
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* ──────────────────────────────────────────────────────────────────────────
   LOGIN PAGE (separate)
   ──────────────────────────────────────────────────────────────────────── */

.login-page {
  display: flex;
  height: 100vh;
  width: 100vw;
  background: var(--pos-bg);
  align-items: center;
  justify-content: center;
}

.login-box {
  background: var(--pos-surface);
  border-radius: var(--pos-radius);
  padding: 40px 36px;
  width: 380px;
  max-width: 90vw;
  box-shadow: var(--pos-shadow-lg);
  text-align: center;
}

.login-box .login-logo {
  font-size: 2.5rem;
  margin-bottom: 4px;
}

.login-box h1 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.login-box .login-sub {
  color: var(--pos-text-muted);
  font-size: 0.82rem;
  margin-bottom: 28px;
}

.login-box .login-field {
  margin-bottom: 14px;
  text-align: left;
}

.login-box .login-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pos-text-muted);
  margin-bottom: 4px;
}

.login-box .login-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--pos-border);
  border-radius: var(--pos-radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--pos-bg);
  color: var(--pos-text);
  outline: none;
  transition: border-color var(--pos-transition);
}

.login-box .login-field input:focus {
  border-color: var(--pos-primary);
  box-shadow: 0 0 0 3px var(--pos-primary-glow);
}

.login-box .login-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--pos-radius-sm);
  background: var(--pos-primary);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--pos-transition);
  margin-top: 6px;
}

.login-box .login-btn:hover {
  background: var(--pos-primary-hover);
}

.login-box .login-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-box .login-error {
  color: var(--pos-red);
  font-size: 0.78rem;
  margin-top: 10px;
  min-height: 1.2em;
}

/* ──────────────────────────────────────────────────────────────────────────
   RESPONSIVE
   ──────────────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .pos-app {
    flex-direction: column;
  }
  .pos-cart-panel {
    flex: none;
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: 50vh;
    border-left: none;
    border-top: 1px solid var(--pos-border);
  }
  .pos-menu-items {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .pos-cart-item .item-thumb {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 600px) {
  .pos-menu-items {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px;
  }
  .pos-menu-item {
    min-height: 80px;
    padding: 12px 8px;
  }
  .pos-cart-panel {
    max-height: 45vh;
  }
  .pos-cart-item {
    padding: 10px 10px;
    min-height: 60px;
  }
  .pos-cart-item .item-thumb {
    width: 36px;
    height: 36px;
  }
  .pos-cart-item .item-qty button {
    width: 34px;
    height: 34px;
  }
}
