/* BT Fidelis — Design System (Systemas IT · claro, Poppins) para las pantallas del comercio. */
:root {
  --azul: #0D47A1;
  --azul2: #1568C0;
  --naranja: #E9965A;
  --naranja2: #C9733D;
  --oscuro: #212929;
  --bg: #F2F4F7;
  --card: #FFFFFF;
  --line: #E2E8F0;
  --muted: #64748B;
  --ok: #10B981;
  --err: #EF4444;
  /* alias que usan el JS/HTML existentes */
  --texto: #212929;
  --tenue: #64748B;
  --acento: #1568C0;
  --acento2: #E9965A;
  /* Naranja suave metalizado: botones principales y destacados */
  --naranja-metal: linear-gradient(160deg, #F7C29A 0%, #EA9A60 38%, #F2AD7B 58%, #CF7A42 100%);
  --naranja-metal-hover: linear-gradient(160deg, #F2B486 0%, #E08B4F 40%, #EBA06B 60%, #BF6B35 100%);
  --naranja-brillo: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -1px 0 rgba(120,55,15,.25), 0 6px 16px -8px rgba(201,115,61,.65);
  --card-radius: 16px;
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--oscuro);
  min-height: 100dvh;
  padding: 22px 16px 44px;
  display: flex; flex-direction: column; align-items: center;
  line-height: 1.5;
}
.wrap { width: 100%; max-width: 460px; }

/* Marca */
.brand { text-align: center; margin: 6px 0 20px; }
.brand .logo { font-weight: 800; font-size: 34px; color: var(--azul); line-height: 1.05; letter-spacing: -.5px; }
.brand .sub { color: var(--azul2); font-weight: 600; font-size: 15px; margin-top: 2px; }
.brand .dir { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* Tarjetas */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  padding: 22px 20px;
  box-shadow: 0 4px 16px rgba(13,71,161,.06);
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 4px; font-size: 15px; letter-spacing: .3px; color: var(--azul); font-weight: 700; }
.muted { color: var(--muted); font-size: 13px; }

/* Sellos */
.sellos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0 6px; }
.sello {
  aspect-ratio: 1; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px;
  border: 2px dashed var(--line); color: #b7c0cf; background: #f7f9fc;
  transition: transform .3s, background .3s;
}
.sello.on {
  background: var(--azul2); color: #fff; border-style: solid; border-color: var(--azul2);
  box-shadow: 0 6px 14px rgba(21,104,192,.28);
}
.sello.premio {
  border-color: var(--naranja); color: var(--naranja2);
  font-size: 13px; text-transform: uppercase; line-height: 1; text-align: center;
}
.sello.premio.on { background: var(--naranja); color: #3B1D08; border-color: var(--naranja); }
.pop { transform: scale(1.15); }

.progreso { text-align: center; margin-top: 14px; font-size: 15px; color: var(--oscuro); }
.progreso b { color: var(--azul); }

.puntos-box {
  margin-top: 16px; text-align: center; font-size: 15px; font-weight: 600; color: var(--oscuro);
  background: #fff7e6; border: 1px solid rgba(233,150,90,.4); border-radius: 12px; padding: 12px;
}
.puntos-box b { color: var(--naranja2); font-size: 22px; }

.premio-banner {
  background: linear-gradient(90deg, var(--naranja), #F4B98C);
  color: #3B1D08; border-radius: 12px; padding: 14px; text-align: center; font-weight: 700;
  margin-top: 12px; animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.02); } }

/* Botones / inputs */
.btn {
  display: block; width: 100%; border: 0; border-radius: 12px;
  padding: 14px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: var(--font);
  background: var(--naranja); background-image: var(--naranja-metal); box-shadow: var(--naranja-brillo); color: #3B1D08; margin-top: 10px; transition: background .2s, transform .1s;
}
.btn:hover { background: var(--naranja2); background-image: var(--naranja-metal-hover); }
.btn.sec { background: #fff; color: var(--oscuro); border: 1px solid var(--line); }
.btn.sec:hover { background: #f7f9fc; border-color: var(--azul2); }
.btn:active { transform: scale(.98); }
label { display: block; font-size: 13px; color: var(--oscuro); font-weight: 500; margin: 12px 0 6px; }
input, textarea {
  width: 100%; padding: 13px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--oscuro); font-size: 16px; font-family: var(--font);
}
input:focus, textarea:focus { outline: none; border-color: var(--azul2); box-shadow: 0 0 0 3px rgba(21,104,192,.15); }

.stat-row { display: flex; gap: 10px; }
.stat { flex: 1; background: var(--bg); border-radius: 12px; padding: 12px; text-align: center; }
.stat .n { font-size: 22px; font-weight: 800; color: var(--azul); }
.stat .l { font-size: 11px; color: var(--muted); }

.qr-box { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; justify-content: center; margin: 14px 0; }
.qr-box canvas, .qr-box img { display: block; }
.timer { text-align: center; font-weight: 700; color: var(--naranja2); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--oscuro); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; box-shadow: 0 10px 25px rgba(0,0,0,.25); opacity: 0; pointer-events: none;
  transition: opacity .25s; z-index: 50; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

.center { text-align: center; }
.big-emoji { font-size: 64px; margin: 10px 0; }
a.link { color: var(--azul2); }
.foot { text-align: center; color: var(--muted); font-size: 11px; margin-top: 18px; }
.foot b { color: var(--azul); }

/* Spinner */
.spinner {
  width: 42px; height: 42px; margin: 8px auto 14px;
  border: 4px solid rgba(21,104,192,.2); border-top-color: var(--azul2);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ¿Cómo funciona? */
details.comofunc { padding: 0; overflow: hidden; }
details.comofunc summary { list-style: none; cursor: pointer; padding: 16px 20px; font-weight: 700; color: var(--azul); font-size: 14px; }
details.comofunc summary::-webkit-details-marker { display: none; }
details.comofunc[open] summary { border-bottom: 1px solid var(--line); }
details.comofunc ol { margin: 8px 0 6px; padding: 0 20px 14px 38px; color: var(--muted); font-size: 14px; line-height: 1.5; }
details.comofunc li { margin: 6px 0; }
details.comofunc b { color: var(--oscuro); }

/* Overlay de escaneo */
.scan { position: fixed; inset: 0; background: #000; z-index: 100; display: flex; align-items: center; justify-content: center; }
.scan video { width: 100%; height: 100%; object-fit: cover; }
.scan-marco { position: absolute; width: 66vw; max-width: 300px; aspect-ratio: 1; border: 3px solid var(--naranja); border-radius: 22px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.55); }
.scan-hint { position: absolute; bottom: 92px; left: 0; right: 0; text-align: center; color: #fff; font-weight: 600; text-shadow: 0 1px 4px #000; }
.scan-close { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); width: auto; padding: 12px 26px; background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.3); }

/* Contexto del cliente en la caja */
.ctel-info { font-size: 13px; min-height: 18px; margin: 6px 2px 0; }
.ctel-info.ok { color: var(--ok); }
.ctel-info.premio { color: var(--naranja2); font-weight: 700; }
.ctel-info.nuevo { color: var(--muted); }
