:root {
  --bg: #080A0F;
  --surface: #181D28;
  --surface2: #12161F;
  --border: rgba(255, 255, 255, 0.1);
  --text: #E8EAF0;
  --muted: #7A8099;
  --gold: #C9A84C;
  --sapphire: #4A8FE7;
  --emerald: #2ECC8A;
  --danger: #E85D5D;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background:
    radial-gradient(120% 80% at 10% -10%, rgba(201, 168, 76, 0.12), transparent 55%),
    radial-gradient(90% 60% at 100% 0%, rgba(74, 143, 231, 0.07), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--sapphire); }

.hidden { display: none !important; }

/* —— Login —— */
#screen-login {
  min-height: 100dvh;
  padding: 48px 24px calc(32px + var(--safe-b));
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 300;
  letter-spacing: 0.02em;
}
.brand span { color: var(--gold); }

.eyebrow {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.login-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(30px, 8vw, 40px);
  line-height: 1.08;
  margin: 16px 0 10px;
}

.login-lead {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  margin-bottom: 28px;
}

.field-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.field {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
}
.field:focus {
  outline: none;
  border-color: var(--gold);
}

.btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 15px 18px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
.btn-gold {
  background: linear-gradient(180deg, #E8C97A, var(--gold));
  color: #0D0A04;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  margin-top: 10px;
}
.btn:disabled { opacity: 0.55; cursor: wait; }

.login-error {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(232, 93, 93, 0.12);
  border: 1px solid rgba(232, 93, 93, 0.35);
  color: #ffb4b4;
  font-size: 13px;
  line-height: 1.45;
}

.login-foot {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.login-foot a { color: var(--muted); text-decoration: none; }

/* —— App shell —— */
#screen-app {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  max-width: 480px;
  margin: 0 auto;
}

.app-header {
  padding: 18px 20px 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.app-header .negocio {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.app-header .hola {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  margin-top: 2px;
}
.notif-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(201, 168, 76, 0.4);
  background: linear-gradient(160deg, rgba(232, 201, 122, 0.22), rgba(24, 29, 40, 0.95));
  color: var(--gold);
  font-size: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 180, 0.22),
    0 2px 8px rgba(201, 168, 76, 0.18);
}
.notif-btn:active {
  transform: scale(0.96);
}
.notif-btn .ico-bell {
  width: 22px;
  height: 22px;
  display: block;
  filter:
    drop-shadow(0 1px 0 rgba(255, 241, 194, 0.55))
    drop-shadow(0 2px 3px rgba(90, 60, 10, 0.55))
    drop-shadow(0 0 6px rgba(201, 168, 76, 0.4));
}
.notif-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  display: none;
}
.notif-dot.on { display: block; }

.panel {
  padding: 8px 20px 24px;
  display: none;
}
.panel.active { display: block; }

.points-hero {
  position: relative;
  background: linear-gradient(160deg, rgba(201, 168, 76, 0.18), rgba(24, 29, 40, 0.9));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 16px;
}
.card-logo-wrap {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(8, 10, 15, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.points-big {
  font-size: 52px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.points-big span {
  font-size: 16px;
  font-weight: 500;
  color: var(--muted);
}
.points-tier {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
}
.points-canje {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}

.qr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
}
.qr-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
.qr-reveal {
  margin-top: 14px;
  padding-top: 8px;
}
.qr-reveal.hidden { display: none !important; }
.qr-card canvas,
.qr-card img {
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}
.qr-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.qr-card .btn-gold { margin-top: 12px; }

.fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 70;
}
.points-hero.celebrating {
  animation: hero-pulse 0.55s ease;
}
@keyframes hero-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
.stamps-track.on-fire .stamp-dot.filled {
  box-shadow: 0 0 10px rgba(255, 120, 40, 0.55), 0 0 0 3px rgba(255, 140, 50, 0.18);
  border-color: #ff8a3d;
  background: radial-gradient(circle at 35% 30%, #ffe08a, #ff7a2e);
}

.section-title {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 10px;
}

.list-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.list-card .title {
  font-weight: 600;
  font-size: 15px;
}
.list-card .meta {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.list-card .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(201, 168, 76, 0.15);
  color: var(--gold);
}
.badge.ok { background: rgba(46, 204, 138, 0.15); color: var(--emerald); }
.badge.warn { background: rgba(232, 93, 93, 0.15); color: var(--danger); }
.badge.pending { background: rgba(74, 143, 231, 0.15); color: var(--sapphire); }

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 28px 12px;
  line-height: 1.5;
}

.form-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
}

.status-msg {
  margin-top: 10px;
  font-size: 13px;
  color: var(--gold);
  text-align: center;
  min-height: 1.2em;
}

.profile-rows {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
}
.profile-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.profile-row:last-child { border-bottom: none; }
.profile-row .k { color: var(--muted); }
.profile-row .v { text-align: right; font-weight: 500; }

/* Bottom nav */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(8, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  z-index: 40;
  max-width: 480px;
  margin: 0 auto;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.nav-item .ico { font-size: 18px; line-height: 1; }
.nav-item.active { color: var(--gold); }

/* Overlay sheets */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  overflow: auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--border);
  padding: 20px 20px calc(20px + var(--safe-b));
}
.sheet h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  margin-bottom: 8px;
}
.sheet .sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* —— Toast —— */
.club-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-b) + 18px);
  transform: translateX(-50%) translateY(16px);
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(24, 29, 40, 0.96);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  transition: opacity 0.22s ease, transform 0.22s ease;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
.club-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#screen-login ~ .club-toast,
body:has(#screen-login:not(.hidden)) .club-toast {
  bottom: calc(28px + var(--safe-b));
}

/* —— Login remember / saved profiles —— */
.remember-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 2px 0 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
}
.remember-row input {
  margin-top: 2px;
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.saved-profiles {
  margin-bottom: 18px;
}
.saved-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.saved-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.saved-card:active {
  border-color: rgba(201, 168, 76, 0.45);
  background: var(--surface2);
}
.saved-main { flex: 1; min-width: 0; }
.saved-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-del {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}
.saved-del:hover { color: var(--danger); background: rgba(232, 93, 93, 0.1); }

/* —— Home alerts —— */
.home-alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.home-alert {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(74, 143, 231, 0.1);
  border: 1px solid rgba(74, 143, 231, 0.28);
  font-size: 13px;
  line-height: 1.4;
  position: relative;
  padding-right: 36px;
}
.home-alert strong { font-size: 13px; font-weight: 600; }
.home-alert span { color: var(--muted); }
.home-alert.tipo-promo,
.home-alert.tipo-canje {
  background: rgba(201, 168, 76, 0.1);
  border-color: rgba(201, 168, 76, 0.3);
}
.home-alert.tipo-turno {
  background: rgba(46, 204, 138, 0.1);
  border-color: rgba(46, 204, 138, 0.28);
}
.home-alert.tipo-puntos {
  background: rgba(74, 143, 231, 0.1);
  border-color: rgba(74, 143, 231, 0.28);
}
.home-alert-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 16px;
}

/* —— Stamps (contador) —— */
.stamps-track {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 4px;
}
.stamp-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(201, 168, 76, 0.35);
  background: transparent;
  position: relative;
  transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}
.stamp-dot.filled {
  background: radial-gradient(circle at 35% 30%, #E8C97A, var(--gold));
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
}
.stamp-dot.filled.pop {
  animation: stamp-pop 0.45s ease;
}
@keyframes stamp-pop {
  0% { transform: scale(0.6); }
  55% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.stamp-feedback {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  min-height: 1.2em;
}
.stamp-feedback.hidden { display: none; }
.ig-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 14px auto 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(201, 168, 76, 0.4);
  background: linear-gradient(160deg, rgba(232, 201, 122, 0.18), rgba(24, 29, 40, 0.85));
  color: #F0D78C;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 236, 180, 0.15);
}
.ig-chip.hidden { display: none; }
.ig-chip .ig-ico { opacity: 0.85; font-size: 14px; }
.onboard-card {
  margin: 0 20px 14px;
  padding: 16px 16px 14px;
  border-radius: 16px;
  border: 1px solid rgba(201, 168, 76, 0.35);
  background: rgba(201, 168, 76, 0.08);
}
.onboard-card.hidden { display: none; }
.onboard-title {
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--gold);
}
.onboard-steps {
  margin: 0 0 12px 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.near-prize {
  margin: 8px 0 0;
  font-size: 12px;
  color: #E8C97A;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.quick-actions .btn { margin-top: 10px; }
.quick-actions .btn:first-child { margin-top: 0; }

/* —— Notif badge count —— */
.notif-count {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--gold);
  color: #0D0A04;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  display: none;
}
.notif-count.on { display: block; }
.notif-dot.on + .notif-count { display: none; }
.notif-btn.has-count .notif-dot { display: none; }

.list-card.unread {
  border-color: rgba(201, 168, 76, 0.4);
  background: rgba(201, 168, 76, 0.06);
}
.list-card .estado-label {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.badge.usado { background: rgba(122, 128, 153, 0.2); color: var(--muted); }

.sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.sheet-actions .btn { flex: 1; margin-top: 0; }
.sheet-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
}
.sheet-link:last-of-type { border-bottom: none; }
.sheet-link .chev { color: var(--muted); }
.sheet-link.hidden { display: none !important; }

.nav-item .ico-svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bottom-nav { max-width: 480px; }
.nav-item { font-size: 11px; }
.nav-item.hidden-nav { display: none !important; }

.historial-delta {
  font-weight: 600;
  color: var(--emerald);
}
.historial-delta.neg { color: var(--danger); }

.share-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.share-row .btn { flex: 1; margin-top: 0; padding: 12px; font-size: 13px; }

.offline-banner {
  margin: 0 20px 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(232, 93, 93, 0.12);
  border: 1px solid rgba(232, 93, 93, 0.3);
  color: #ffb4b4;
  font-size: 12px;
  text-align: center;
}

.profile-actions { margin-top: 4px; }
