:root {
  --primary: #FFD200;
  --primary-hover: #D9AE00;
  --primary-light: #FFF3C4;
  --bg-main: #1B1E21;
  --bg-panel: #23272B;
  --bg-surface: #2C3136;
  --border: #3A4045;
  --text-main: #FFFFFF;
  --text-muted: #C9CDD0;
  --success: #FFD200;
  --success-hover: #D9AE00;
  --danger: #EF4444;
  --danger-hover: #DC2626;
  --key-bg: #2C3136;
  --key-active: #3A4045;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* POS Frame (Optimized for One-Handed Mobile or Counter Tablet) */
.pos-wrapper {
  width: 100%;
  max-width: 450px;
  min-height: 100vh;
  background-color: var(--bg-panel);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.6);
}

@media (min-width: 640px) {
  .pos-wrapper {
    min-height: 840px;
    height: 92vh;
    border-radius: 32px;
    border: 2px solid #3A4045;
  }
}

/* POS Header */
.pos-header {
  padding: 16px 20px;
  background: #23272B;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pos-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pos-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #FFD200, #D9AE00);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.pos-title-box h1 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #FFFFFF;
}

.pos-title-box p {
  font-size: 0.72rem;
  color: var(--text-muted);
}

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

.inactivity-pill {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #F87171;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

.lock-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Screen Management */
.screen {
  flex: 1;
  display: none;
  flex-direction: column;
  padding: 20px;
}

.screen.active {
  display: flex;
}

/* SCREEN 1: PIN UNLOCK KEYPAD */
.pin-screen {
  justify-content: space-between;
  align-items: center;
  padding-bottom: 24px;
}

.pin-header {
  text-align: center;
  margin-top: 15px;
}

.pin-avatar {
  width: 64px;
  height: 64px;
  background: rgba(255, 210, 0, 0.15);
  border: 2px solid rgba(255, 210, 0, 0.4);
  color: #FFD200;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin: 0 auto 12px auto;
}

.pin-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #FFFFFF;
}

.pin-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* PIN Dots Display */
.pin-dots {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 24px 0 10px 0;
}

.pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pin-dot.filled {
  background: var(--primary);
  border-color: #FFD200;
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(255, 210, 0, 0.6);
}

.pin-error-msg {
  color: #F87171;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  height: 20px;
}

/* High Velocity Numeric Keypad */
.keypad {
  width: 100%;
  max-width: 320px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 auto;
}

.key-btn {
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  aspect-ratio: 1.25;
  background: var(--key-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: #FFFFFF;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.1s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.key-btn:active {
  background: var(--key-active);
  transform: scale(0.94);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.key-btn.action-key {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.key-subtext {
  pointer-events: none;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-top: -2px;
}

.pin-quick-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

/* SCREEN 2: MAIN COUNTER SCANNER & CONFIRMATION */
.counter-screen {
  overflow-y: auto;
}

/* Staff Info Strip */
.cashier-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 16px;
}

.cashier-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cashier-avatar-small {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.cashier-name-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: #FFFFFF;
}

/* Scanner Tabs */
.scan-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.scan-tab {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.scan-tab.active {
  background: rgba(255, 210, 0, 0.2);
  border-color: var(--primary);
  color: #FFD200;
}

/* Camera Video Box */
.camera-box {
  width: 100%;
  height: 210px;
  background: #000000;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  border: 2px dashed rgba(255, 210, 0, 0.5);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Reticle / Viewfinder Overlay */
.reticle-frame {
  position: absolute;
  width: 140px;
  height: 140px;
  border: 2px solid #FFD200;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.reticle-laser {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #EF4444;
  box-shadow: 0 0 8px #EF4444;
  animation: scanLaser 2s infinite ease-in-out;
}

@keyframes scanLaser {
  0%, 100% { top: 10%; }
  50% { top: 90%; }
}

/* Quick Sim Test Buttons */
.quick-sim-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 16px;
}

.quick-sim-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.sim-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sim-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  transition: all 0.15s ease;
}

.sim-btn:hover {
  border-color: var(--primary);
  background: #3A4045;
}

.sim-btn .sim-name {
  color: #FFFFFF;
  font-weight: 700;
}

.sim-btn .sim-stamps {
  color: #FFD200;
}

/* Phone Manual Lookup */
.phone-lookup-box {
  display: none;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
}

.phone-lookup-box.active {
  display: block;
}

.input-group {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.input-field {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #FFFFFF;
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
}

.input-field:focus {
  border-color: var(--primary);
}

.btn-lookup {
  background: var(--primary);
  border: none;
  color: #23272B;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

/* Customer Detected Profile Card */
.customer-card-detected {
  background: linear-gradient(145deg, #2C3136, #23272B);
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 18px;
  transition: all 0.3s ease;
}

.customer-card-detected.active {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(255, 210, 0, 0.25);
}

.customer-card-detected.reward-ready {
  border-color: var(--success);
  box-shadow: 0 0 25px rgba(255, 210, 0, 0.35);
}

.detected-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.detected-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFFFFF;
}

.detected-phone {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: monospace;
}

.detected-badge {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 800;
}

.detected-badge.active-badge {
  background: rgba(255, 210, 0, 0.2);
  border: 1px solid var(--primary);
  color: #FFD200;
}

.detected-badge.reward-badge {
  background: rgba(255, 210, 0, 0.2);
  border: 1px solid var(--success);
  color: #FFD200;
}

/* Stamps Bar & Mini Indicator */
.mini-stamps-bar {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.mini-stamp-dot {
  flex: 1;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mini-stamp-dot.filled {
  background: rgba(255, 210, 0, 0.25);
  border: 1.5px solid #FFD200;
}

.mini-stamp-dot.reward-slot.filled {
  background: linear-gradient(135deg, #FFD200, #D9AE00);
  border: 1.5px solid #FFD200;
}

/* Big Action Trigger Buttons (Under 5 Seconds Ergonomics) */
.action-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
}

.btn-big-stamp {
  width: 100%;
  height: 64px;
  background: linear-gradient(135deg, #FFD200, #D9AE00);
  border: none;
  border-radius: 18px;
  color: #23272B;
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 210, 0, 0.4);
  transition: all 0.15s ease;
}

.btn-big-stamp:active {
  transform: scale(0.97);
  box-shadow: 0 2px 10px rgba(255, 210, 0, 0.5);
}

.btn-big-stamp:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-big-redeem {
  width: 100%;
  height: 64px;
  background: linear-gradient(135deg, #FFD200, #D9AE00);
  border: none;
  border-radius: 18px;
  color: #23272B;
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 210, 0, 0.4);
  transition: all 0.15s ease;
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0%, 100% { box-shadow: 0 0 15px rgba(255, 210, 0, 0.4); }
  50% { box-shadow: 0 0 28px rgba(255, 210, 0, 0.7); }
}

.btn-big-redeem:active {
  transform: scale(0.97);
}

.btn-big-redeem:disabled {
  display: none;
}

/* Feedback Alert Modal/Banner */
.pos-alert {
  display: none;
  border-radius: 14px;
  padding: 12px 16px;
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  animation: slideDown 0.3s ease;
}

.pos-alert.success {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 210, 0, 0.15);
  border: 1px solid var(--success);
  color: #FFD200;
}

.pos-alert.error {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: #F87171;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Identidad rekompra (Manual v1.0): base gris carbón, amarillo para acción y recompensa */
:root {
  --primary: var(--rk-yellow);
  --primary-hover: var(--rk-yellow-dark);
  --primary-light: var(--rk-yellow-soft);
  --bg-main: #1B1E21;
  --bg-panel: var(--rk-ink);
  --bg-surface: #2C3136;
  --border: var(--rk-gray-700);
  --text-main: var(--rk-white);
  --text-muted: var(--rk-gray-300);
  --success: var(--rk-yellow);
  --success-hover: var(--rk-yellow-dark);
  --key-bg: #2C3136;
  --key-active: var(--rk-gray-700);
  --font-family: var(--rk-font-body);
}
h1, h2, h3, h4 { font-family: var(--rk-font-display); }
