/* ==========================================================
   Estilos base de la plataforma de fidelización
   --brand y --accent se definen por negocio en el layout
   ========================================================== */

:root {
  --brand: #1F3D2B;
  --accent: #C9A227;
  --ink: #14161A;
  --ink-2: #5B606B;
  --line: #E3E5EA;
  --line-2: #DADDE3;
  --ground: #F4F5F7;
  --surface: #FFFFFF;
  --ok: #2F6B45;
  --ok-bg: #E3F1E8;
  --warn: #8A5A00;
  --danger: #8A2E2E;
  --danger-bg: #FBE9E9;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}

[x-cloak] { display: none !important; }

.num { font-family: 'Space Grotesk', 'DM Sans', sans-serif; }

/* ---------- Botones e inputs ---------- */

.btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: transform .05s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex: 0 0 auto; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-dark    { background: var(--ink); color: #fff; }
.btn-ghost   { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-link    { background: transparent; color: var(--danger); min-height: 44px; font-weight: 500; }
.btn-block   { width: 100%; }
.btn-lg      { min-height: 56px; font-size: 16px; border-radius: 16px; }
.btn-sm      { min-height: 40px; padding: 0 14px; font-size: 14px; }

.label { font-size: 13px; font-weight: 700; color: var(--ink-2); }

.input {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  padding: 0 16px;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
}
.input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.input-code { font-family: 'Space Grotesk', sans-serif; font-size: 22px; letter-spacing: 3px; text-transform: uppercase; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-error { font-size: 13px; color: var(--danger); }

/* ---------- Estructura ---------- */

.stack { display: flex; flex-direction: column; gap: 14px; }
.row   { display: flex; gap: 10px; align-items: center; }
.row > .input { flex: 1; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.muted { color: var(--ink-2); font-size: 14px; }

/* ---------- Login ---------- */

.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card { width: 100%; max-width: 400px; padding: 28px 24px; }
.auth-head { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; margin-bottom: 8px; }
.auth-head h1 { margin: 0; font-size: 22px; }

.logo {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 18px;
}

.check { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

.alert { border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }

/* ---------- Caja ---------- */

.caja {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 18px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.caja-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.h-title { font-size: 18px; font-weight: 700; }
.h-sub { font-size: 13px; color: var(--ink-2); }

.tabs {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px; padding: 4px; border-radius: 14px; background: #E6E8EC;
}
.tabs button {
  min-height: 44px; border: none; border-radius: 11px; background: transparent;
  font: inherit; font-weight: 700; font-size: 14px; color: var(--ink); cursor: pointer;
}
.tabs button.active { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.06); }

.cliente { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: #E6ECE8; color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto;
}
.cliente-info { flex: 1; min-width: 0; }
.cliente-nombre { font-weight: 700; font-size: 16px; }
.pill { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }

.progress { height: 6px; border-radius: 999px; background: #E6E8EC; overflow: hidden; margin-top: 12px; }
.progress > div { height: 6px; background: var(--accent); }

.pendientes { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.pendientes b { color: var(--ink); }

.monto { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; }
.monto-valor { font-family: 'Space Grotesk', sans-serif; font-size: 44px; font-weight: 700; }
.monto-hint { font-size: 14px; font-weight: 700; }
.hint-ok { color: var(--ok); }
.hint-warn { color: var(--warn); }

.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.keypad button {
  height: 58px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); font-family: 'Space Grotesk', sans-serif;
  font-size: 22px; font-weight: 500; color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.keypad button:active { background: var(--ground); }
.keypad svg { width: 24px; height: 24px; }

.exito { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.card.exito { padding: 22px 18px; }
.exito-icono {
  width: 72px; height: 72px; border-radius: 50%; background: var(--ok-bg);
  display: flex; align-items: center; justify-content: center;
}
.exito-icono svg { width: 36px; height: 36px; color: var(--ok); }
.exito h2 { margin: 0; font-size: 22px; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 428px;
  border-radius: 14px; padding: 14px 16px; font-size: 15px; font-weight: 500;
  box-shadow: 0 6px 24px rgba(0,0,0,.15); z-index: 50;
}
.toast-error { background: var(--ink); color: #fff; }
.toast-ok { background: var(--ok); color: #fff; }

/* ---------- Escáner ---------- */

.scanner {
  position: fixed; inset: 0; background: rgba(20,22,26,.92); z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 16px;
}
.scanner-box { width: 100%; max-width: 380px; border-radius: 18px; overflow: hidden; background: #000; }
.scanner p { color: #fff; margin: 0; text-align: center; }

/* ---------- Página de QR de prueba ---------- */

.dev { max-width: 960px; margin: 0 auto; padding: 28px 16px; }
.dev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.dev-grid .card { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }

/* Logo subido por el negocio (en lugar de las iniciales) */
.logo-img { object-fit: contain; background: #fff; padding: 4px; }
