:root {
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: #f4f5f7;
  color: #1c1c1e;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  background: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 360px;
}

.auth-title {
  margin: 0 0 6px;
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 24px;
}

.auth-subtitle { margin: 0; color: #8c8073; font-size: 14px; }

label { display: block; font-size: 13px; font-weight: 600; margin: 16px 0 6px; color: #444; }

input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #d8d8dc;
  font-size: 15px;
}

button, .btn {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  background: #1c1c1e;
  color: white;
}

.btn-secondary { background: #eceef1; color: #1c1c1e; }
.btn-green { background: #1f9d55; }
.btn-danger { background: #e74c3c; }

.error-banner {
  background: #fdecea;
  color: #b3261e;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 16px;
}

.warning-banner {
  background: #fff4e5;
  color: #8a5a00;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 20px;
}

.success-banner {
  background: #e7f7ee;
  color: #157a41;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  background: white;
  border-bottom: 1px solid #eaeaea;
}

.topbar h1 { font-family: "Fraunces", serif; font-weight: 700; font-size: 19px; margin: 0; }
.topbar .meta { font-size: 13px; color: #777; }

.page { max-width: 960px; margin: 0 auto; padding: 32px; }

.panel {
  background: white;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
  margin-bottom: 24px;
}

.panel h2 { margin-top: 0; font-size: 16px; }

.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 180px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #f0f0f0; }
th { color: #888; font-weight: 600; font-size: 12px; text-transform: uppercase; }

.stamp-row { display: flex; gap: 4px; }
.stamp-dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #ddd;
}
.stamp-dot.filled { background: #1f9d55; border-color: #16803f; }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions form { display: inline; }
.actions button { padding: 6px 10px; font-size: 12px; }

.scan-hint { font-size: 13px; color: #777; margin: 0 0 14px; line-height: 1.5; }

.scanner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
}

.btn-close-fixed {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: #111;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 1001;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.scanner-box {
  background: #111;
  border-radius: 18px;
  padding: 16px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: auto;
}

.btn-activate-camera {
  background: #1f9d55;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.scanner-box video {
  width: 100%;
  max-height: 50vh;
  border-radius: 12px;
  background: #000;
  aspect-ratio: 1;
  object-fit: cover;
}

.scanner-status {
  color: #f4f4f4;
  font-size: 14px;
  text-align: center;
  min-height: 20px;
}

.scanner-status.scanner-success { color: #4ade80; font-weight: 600; }
.scanner-status.scanner-error { color: #f87171; font-weight: 600; }

/* ===== Tarjeta pública: tarjeta de fidelidad estilo "impresa" (fondo oscuro + color de marca) ===== */

.card-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #e9e9ec;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --dark-bg: #111013;
  --muted: #9d9891;
  --hairline: rgba(255,255,255,0.14);
}

.ticket {
  --brand-color: #f5b400;
  width: 100%;
  max-width: 380px;
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 28px 60px -20px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.15);
  background: var(--dark-bg);
  border: 1px solid rgba(255,255,255,0.06);
}

.ticket-header {
  background: var(--brand-color);
  color: var(--header-text, white);
  padding: 22px 24px 18px;
}

.header-top { display: flex; flex-direction: column; gap: 12px; }

.brand-row { display: flex; align-items: center; gap: 12px; }

.brand-row-wordmark { flex-direction: column; align-items: flex-start; gap: 4px; }

.brand-wordmark {
  max-width: 100%;
  max-height: 64px;
  width: auto;
  object-fit: contain;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.85);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.brand-name {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  opacity: 0.85;
  margin-top: 2px;
}

.header-divider {
  height: 1px;
  background: color-mix(in srgb, currentColor 30%, transparent);
}

.tagline-lines {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.ticket-body {
  padding: 26px 24px 28px;
  color: white;
}

.fidelidad-title {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.fidelidad-title strong { font-weight: 800; }

.fidelidad-sub {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.fidelidad-sub .dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--brand-color);
  display: inline-block;
}

.member-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
}

.member-name { font-weight: 600; font-size: 14px; color: white; }

.member-code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

.stamp-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px 10px;
  margin: 4px 0 24px;
}

.stamp-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; }

.stamp-hole {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2.5px solid var(--brand-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.25s ease;
}

.stamp-hole.filled {
  background: var(--brand-color);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--brand-color) 45%, transparent);
}

.stamp-hole img { width: 82%; height: 82%; object-fit: cover; border-radius: 50%; }

.stamp-number {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--muted);
}

@media (prefers-reduced-motion: no-preference) {
  .stamp-hole.filled { animation: stamp-pop 0.35s ease; }
}

@keyframes stamp-pop {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.qr-block {
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 16px;
  padding: 14px;
  width: fit-content;
  margin: 4px auto 22px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

.qr-block img { display: block; }

.progress-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 22px;
}

.progress-count {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 15px;
  color: white;
  flex-shrink: 0;
}

.progress-reward {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.wallet-btn-group { display: flex; flex-direction: column; gap: 10px; }

.wallet-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wallet-btn-dark { background: var(--brand-color); color: var(--header-text, #111013); }
.wallet-btn-outline { background: transparent; color: white; border: 1.5px solid rgba(255,255,255,0.5); }

.wallet-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 16px rgba(0,0,0,0.3); }
.wallet-btn:focus-visible { outline: 2px solid var(--brand-color); outline-offset: 2px; }

.wallet-pending {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255,255,255,0.06);
  border: 1px dashed var(--hairline);
  border-radius: 12px;
  padding: 12px;
}

.ticket-footer {
  background: var(--brand-color);
  color: var(--header-text, white);
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.social-row { display: flex; align-items: center; gap: 8px; }

.social-icon {
  width: 26px; height: 26px; border-radius: 50%;
  background: color-mix(in srgb, currentColor 20%, transparent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.social-handle {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.footer-slogan {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.9;
}

.ticket.not-found .ticket-body { text-align: center; padding: 40px 30px; }
.ticket.not-found h1 { font-size: 20px; margin: 0 0 8px; color: white; }
.ticket.not-found p { color: var(--muted); margin: 0; font-size: 14px; }
