/* AhiVa UX Prototype — mobile-first ~390px */
:root {
  --maiz: #F9C74F;
  --salsa: #D62828;
  --elote: #4CAF50;
  --gris: #2F2F2F;
  --crema: #FFF4D6;
  --white: #ffffff;
  --muted: #6b6b6b;
  --shadow: 0 8px 24px rgba(47, 47, 47, 0.12);
  --radius: 16px;
  --tap: 48px;
  --nav-h: 64px;
  --status-h: 28px;
  --font-title: "Poppins", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: #1a1a1a;
  color: var(--gris);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }

/* Phone frame (desktop); full-bleed on narrow */
.phone-frame {
  position: relative;
  width: 100%;
  max-width: 390px;
  height: 100dvh;
  max-height: 844px;
  margin: 0 auto;
  background: var(--crema);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), var(--shadow);
}

@media (min-width: 420px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    min-height: 100vh;
  }
  .phone-frame {
    border-radius: 28px;
    border: 3px solid #111;
    height: min(844px, 100dvh - 48px);
  }
}

.status-bar {
  flex: 0 0 var(--status-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 18px 0;
  font-size: 12px;
  font-weight: 600;
  z-index: 5;
}

.screens {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateX(12px);
  pointer-events: none;
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--crema);
  padding-bottom: 8px;
}

.screen.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  z-index: 1;
}

.screen.has-nav { padding-bottom: calc(var(--nav-h) + 12px); }

.screen.vendor-theme {
  background: linear-gradient(180deg, #2a1212 0%, #1a0e0e 40%, #241010 100%);
  color: var(--white);
}

.screen.vendor-theme .muted { color: rgba(255,255,255,.65); }
.screen.vendor-theme .hint { color: rgba(255,255,255,.55); }

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 12px;
  min-height: 56px;
}

.top-bar.soft { justify-content: space-between; }
.top-bar.vendor { color: var(--white); }

.top-bar h2 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 2px;
}
.eyebrow.light { color: rgba(255,255,255,.7); }

.pad { padding: 0 16px 20px; }

.lead {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 12px;
  text-align: center;
}
.hint.quiet { opacity: 0.85; }
.hint.light { color: rgba(255,255,255,.6); }
.muted { color: var(--muted); font-size: 0.875rem; }
.muted.light { color: rgba(255,255,255,.65); }

/* Buttons */
.btn {
  border: none;
  border-radius: 999px;
  min-height: var(--tap);
  padding: 0 22px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s, opacity 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--salsa);
  color: var(--white);
  box-shadow: 0 6px 16px rgba(214, 40, 40, 0.35);
}
.btn-salsa { background: var(--salsa); color: var(--white); }
.btn-maiz {
  background: var(--maiz);
  color: var(--gris);
  font-weight: 800;
}
.btn-cream {
  background: var(--crema);
  color: var(--gris);
  border: 2px solid rgba(47,47,47,.12);
}
.btn-ghost {
  background: transparent;
  color: var(--salsa);
  border: 2px solid var(--salsa);
}
.btn-outline-light {
  background: transparent;
  color: var(--white);
  border: 2px solid rgba(255,255,255,.45);
}
.btn-lg { min-height: 54px; font-size: 1.05rem; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 0.875rem; }
.btn-block { width: 100%; }

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  border: none;
  background: rgba(47,47,47,.08);
  border-radius: 14px;
  font-size: 1.25rem;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn.light { background: rgba(255,255,255,.12); color: var(--white); }

.chip {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
}
.chip-balance {
  background: var(--maiz);
  color: var(--gris);
  box-shadow: var(--shadow);
}

/* Splash */
#screen-splash {
  background: linear-gradient(165deg, var(--maiz) 0%, #f5b82e 45%, var(--crema) 100%);
}
.splash-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.splash-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
  animation: float 8s ease-in-out infinite;
}
.splash-blob.b1 { width: 180px; height: 180px; background: var(--salsa); top: -40px; right: -30px; }
.splash-blob.b2 { width: 140px; height: 140px; background: var(--elote); bottom: 80px; left: -40px; animation-delay: -2s; }
.splash-blob.b3 { width: 100px; height: 100px; background: #fff; bottom: 20%; right: 10%; animation-delay: -4s; opacity: 0.35; }

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(12px, -16px); }
}

.splash-content {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  gap: 8px;
}
.logo-mark { font-size: 3.5rem; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0,0,0,.15)); }
.brand {
  font-family: var(--font-title);
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--gris);
}
.tagline {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 8px 0 4px;
}
.splash-sub { font-size: 0.8rem; color: var(--muted); margin-bottom: 28px; }
.splash-content .btn { margin-top: 8px; min-width: 220px; }

/* Mode pick */
.mode-pick { display: flex; flex-direction: column; gap: 12px; }
.mode-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  align-items: center;
  text-align: left;
  padding: 18px 16px;
  min-height: 88px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.mode-card:active { transform: scale(0.98); }
.mode-card.vecino { border-color: rgba(76, 175, 80, 0.35); }
.mode-card.vendedor { border-color: rgba(214, 40, 40, 0.35); background: #fff8f8; }
.mode-card.ambos { border-color: rgba(249, 199, 79, 0.6); }
.mode-emoji {
  grid-row: 1 / 3;
  font-size: 2rem;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  background: var(--crema);
  border-radius: 14px;
}
.mode-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.1rem;
}
.mode-desc { font-size: 0.8rem; color: var(--muted); }

/* Antojo grid */
.antojo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.antojo-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 110px;
  padding: 16px;
  background: var(--white);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s var(--ease);
}
.antojo-card:active { transform: scale(0.96); }
.antojo-emoji { font-size: 2.25rem; line-height: 1; }

/* Mapa */
.mapa-wrap { display: flex; flex-direction: column; gap: 12px; }
.mapa-canvas {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--crema);
}
.mapa-svg { width: 100%; height: auto; display: block; }
.glow {
  opacity: 0.55;
  filter: blur(2px);
  animation: pulse-glow 3s ease-in-out infinite;
}
.glow.elote { fill: var(--elote); }
.glow.salsa { fill: var(--salsa); animation-delay: -1s; }
.glow.maiz { fill: var(--maiz); animation-delay: -2s; }

@keyframes pulse-glow {
  0%, 100% { opacity: 0.4; r: inherit; }
  50% { opacity: 0.7; }
}

.legend {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
}
.legend .dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}
.legend .dot.elote { background: var(--elote); }
.legend .dot.salsa { background: var(--salsa); }
.legend .dot.maiz { background: var(--maiz); }

/* Confirmar */
.confirm-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--white);
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.confirm-emoji { font-size: 2.75rem; }
.confirm-card h3 {
  font-family: var(--font-title);
  font-size: 1.25rem;
}

.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.tip-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.tip-row input[type="range"] {
  flex: 1;
  accent-color: var(--salsa);
  height: 8px;
  cursor: pointer;
}
.tip-row strong {
  min-width: 40px;
  font-family: var(--font-title);
  font-size: 1.15rem;
  color: var(--salsa);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 4px 20px;
  font-size: 0.95rem;
}
.summary-line strong {
  font-family: var(--font-title);
  font-size: 1.35rem;
}

/* Esperando */
.center-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding-top: 12px;
}
.pulse-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--white);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 0 rgba(214, 40, 40, 0.35);
  animation: ring 2s ease-out infinite;
  margin-bottom: 8px;
}
.pulse-emoji { font-size: 3rem; }

@keyframes ring {
  0% { box-shadow: 0 0 0 0 rgba(214, 40, 40, 0.4); }
  70% { box-shadow: 0 0 0 24px rgba(214, 40, 40, 0); }
  100% { box-shadow: 0 0 0 0 rgba(214, 40, 40, 0); }
}

.eta {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--salsa);
}

.settle-box {
  width: 100%;
  margin-top: 20px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  text-align: center;
}
.settle-label {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.pin-inputs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}
.pin-digit {
  width: 48px;
  height: 56px;
  text-align: center;
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  border: 2px solid #e0d5b8;
  border-radius: 12px;
  background: var(--crema);
  outline: none;
}
.pin-digit:focus { border-color: var(--salsa); }

/* Monedero */
.wallet-card {
  background: linear-gradient(135deg, var(--salsa), #b81f1f);
  color: var(--white);
  border-radius: 20px;
  padding: 24px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.wallet-amount {
  font-family: var(--font-title);
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 4px 0 16px;
}
.oxxo-stub {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.oxxo-stub.hidden { display: none; }
.oxxo-stub h3 {
  font-family: var(--font-title);
  font-size: 1rem;
  margin-bottom: 10px;
}
.oxxo-stub ol {
  padding-left: 20px;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 12px;
}
.oxxo-stub li { margin-bottom: 6px; }

.section-title {
  font-family: var(--font-title);
  font-size: 1rem;
  margin: 8px 0 10px;
}
.history {
  list-style: none;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.history li {
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f0e8d0;
  font-size: 0.9rem;
}
.history li:last-child { border-bottom: none; }
.neg { color: var(--salsa); font-weight: 700; }
.pos { color: var(--elote); font-weight: 700; }

/* Perfil */
.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.avatar {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--maiz);
  display: grid;
  place-items: center;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.25rem;
}
.list-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.list-card.dark {
  background: rgba(255,255,255,.08);
  box-shadow: none;
  margin-top: 16px;
}
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  border-bottom: 1px solid #f0e8d0;
  text-align: left;
  font-size: 0.95rem;
}
.list-card.dark .list-row { border-bottom-color: rgba(255,255,255,.1); color: var(--white); }
.list-row:last-child { border-bottom: none; }
.list-row.action { cursor: pointer; }
.list-row.action:active { background: rgba(47,47,47,.04); }
.chev { font-weight: 700; color: var(--salsa); }
.list-card.dark .chev { color: var(--maiz); }

.toggle-row { cursor: pointer; position: relative; }
.toggle-row input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch {
  width: 48px;
  height: 28px;
  background: #ccc;
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}
.switch::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.toggle-row input:checked + .switch { background: var(--elote); }
.toggle-row input:checked + .switch::after { transform: translateX(20px); }

.trust-mini {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

/* Vendedor trust bar */
.trust-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}
.trust-bar.compact { padding-bottom: 8px; }
.badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(249, 199, 79, 0.2);
  color: var(--maiz);
  border: 1px solid rgba(249, 199, 79, 0.35);
}
.badge.loud {
  background: var(--maiz);
  color: var(--gris);
  border-color: var(--maiz);
}

/* Routes */
.route-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.route-card {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  padding: 14px 12px;
}
.route-rank {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--salsa);
  display: grid;
  place-items: center;
  font-family: var(--font-title);
  font-weight: 800;
}
.route-body h3 {
  font-family: var(--font-title);
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.route-body p { font-size: 0.75rem; margin-bottom: 2px; }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.7rem;
  margin-right: 4px;
}
.tag.demand { background: rgba(214,40,40,.35); color: #ffb4b4; }
.tag.demand.mid { background: rgba(249,199,79,.25); color: var(--maiz); }
.tag.demand.low { background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); }
.tag.tip { background: rgba(76,175,80,.25); color: #9ae6a0; }

/* En ruta */
.sales-counter {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 16px 0;
}
.counter-btn {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.08);
  color: var(--white);
  font-size: 1.75rem;
  font-weight: 700;
  cursor: pointer;
}
.counter-btn:active { background: rgba(255,255,255,.18); }
.counter-num {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}
.counter-num span {
  font-family: var(--font-title);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}
.counter-num small { font-size: 0.8rem; opacity: 0.7; }

.code-show {
  background: rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 16px 24px;
  margin: 8px 0 16px;
  width: 100%;
}
.big-code {
  font-family: var(--font-title);
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--maiz);
  margin: 4px 0;
}
.loc-note {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-bottom: 20px;
  max-width: 280px;
}

/* Cobros */
.earnings-card {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  padding: 24px 20px;
  margin-bottom: 16px;
  text-align: center;
}
.earnings-card .wallet-amount { color: var(--maiz); }
.cashout-msg {
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,.7);
  margin: 12px 0 8px;
}

/* Bottom nav */
.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--nav-h);
  display: flex;
  background: var(--white);
  border-top: 1px solid rgba(47,47,47,.08);
  z-index: 10;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav[hidden] { display: none; }
.bottom-nav.vendor-nav {
  background: #1a0e0e;
  border-top-color: rgba(255,255,255,.1);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  min-height: var(--tap);
}
.vendor-nav .nav-item { color: rgba(255,255,255,.5); }
.nav-item.active { color: var(--salsa); }
.vendor-nav .nav-item.active { color: var(--maiz); }
.nav-ico { font-size: 1.25rem; line-height: 1; }

/* Toast */
.toast {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(var(--nav-h) + 16px);
  background: var(--gris);
  color: var(--white);
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  z-index: 20;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s var(--ease);
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast[hidden] { display: none; }
.toast.show[hidden] { display: block; }

/* Screens without bottom nav on splash/mode */
#screen-splash .status-bar,
.phone-frame > .status-bar { /* status is outside screens */ }


/* App theme for status bar when vendor screens active */
.phone-frame.theme-vendor {
  background: #1a0e0e;
}
.phone-frame.theme-vendor .status-bar {
  color: rgba(255,255,255,.85);
}
.phone-frame.theme-vendor .status-icons {
  opacity: 0.8;
}
