/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg:          #080911;
  --surface:     #0c0c1c;
  --card:        #10101e;
  --card-hover:  #141428;
  --border:      rgba(255,255,255,0.07);
  --border-hi:   rgba(255,255,255,0.13);

  --amber:       #f59e0b;
  --amber-dim:   rgba(245,158,11,0.12);
  --amber-glow:  rgba(245,158,11,0.06);

  --violet:      #a78bfa;
  --violet-dim:  rgba(167,139,250,0.14);

  --green:       #34d399;
  --green-dim:   rgba(52,211,153,0.12);

  --red:         #f87171;
  --red-dim:     rgba(248,113,113,0.12);

  --text:        #ddddf0;
  --text-muted:  #6b7280;
  --text-faint:  #3f4155;

  --radius:      14px;
  --radius-sm:   8px;
}

/* ── Reset & base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Un único tono para todo el documento: sin capas ni degradados que puedan
   percibirse como bloques al cruzar entre el banner, las cards y el footer. */
html {
  min-height: 100%;
  background: var(--bg);
}

body {
  font-family: 'DM Sans', sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  color: var(--text);
  padding: 0;
  background: transparent;
}

/* ── Layout ──────────────────────────────────────────────── */
.app {
  flex: 1 0 auto;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 24px;
  position: relative;
  z-index: 1;
}

/* ── Hero section ────────────────────────────────────────── */
.hero-section {
  position: relative;
  margin-bottom: 20px;
}

.hero-banner {
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.hero-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* fade inferior para que la card se integre al fondo */
.hero-banner::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 80px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}

.hero-card-wrap {
  max-width: 480px;
  margin: -36px auto 0;
  padding: 0 16px;
  position: relative;
  z-index: 2;
}

.hero-card {
  background: rgba(16, 16, 30, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 18px 22px 16px;
  text-align: center;
}

.hero-card h1 {
  font-family: 'PT Sans', sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hero-card h1 span { color: #6db21a; }

.hero-emoji {
  font-size: 1.8rem;
  line-height: 1;
}

.hero-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: 'PT Sans', sans-serif;
  font-weight: 600;
}

.header-line {
  width: 32px;
  height: 2px;
  background: var(--amber);
  margin: 10px auto 0;
  border-radius: 2px;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 22px;
  transition: border-color 0.2s, background 0.2s;
  opacity: 0;
  transform: translateY(24px);
}

.card.animate {
  animation: fadeUp 0.5s cubic-bezier(.22,.68,0,1.2) forwards;
}

.card:hover {
  border-color: var(--border-hi);
  background: var(--card-hover);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Section label ───────────────────────────────────────── */
.lbl {
  font-family: 'PT Sans', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 10px 0;
  padding: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Date card ───────────────────────────────────────────── */
.today-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-faint);
  text-transform: capitalize;
  text-align: center;
  margin-top: 10px;
}

/* ── Next birthday card ──────────────────────────────────── */
.next-layout {
  display: flex;
  align-items: stretch;
  gap: 14px;
  margin-top: 14px;
  position: relative;
}

/* ambient glow behind name */
.next-layout::before {
  content: '';
  position: absolute;
  top: -20px; left: -22px; right: -22px; bottom: -20px;
  background: radial-gradient(ellipse at 30% 50%, rgba(245,158,11,0.05) 0%, transparent 70%);
  pointer-events: none;
  border-radius: var(--radius);
}

.next-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.next-name {
  font-family: 'PT Sans', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--amber);
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.next-date-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  margin-top: 5px;
  text-transform: capitalize;
}

/* Today is birthday! */
.next-name.is-today {
  color: var(--green);
}

/* Days badge */
.days-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(61, 107, 10, 0.35);
  border: 1px solid rgba(61, 107, 10, 0.5);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-width: 72px;
  flex-shrink: 0;
}

.days-badge.is-today {
  background: var(--green-dim);
  border-color: rgba(52,211,153,0.3);
}

.days-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: #6db21a;
}

.days-badge.is-today .days-num {
  color: var(--green);
  font-size: 1.4rem;
}

.days-txt {
  font-family: 'PT Sans', sans-serif;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Border glow ─────────────────────────────────────────── */
@property --border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.card-glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius) + 1px);
  padding: 1px;
  background: conic-gradient(
    from var(--border-angle),
    transparent 0%,
    transparent 64%,
    rgba(245,158,11,0.0)  70%,
    rgba(245,158,11,0.6)  78%,
    rgba(245,158,11,0.0)  86%,
    transparent 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  animation: border-rotate 14s linear infinite;
  pointer-events: none;
}

@keyframes border-rotate {
  to { --border-angle: 360deg; }
}

/* ── Wishlist ────────────────────────────────────────────── */
.wishlist-btn {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  color: var(--amber);
  font-family: 'PT Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.wishlist-btn:hover { opacity: 1; }

.wishlist-icon {
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.85;
  transition: opacity 0.15s;
}

.wishlist-icon:hover { opacity: 1; }

.wishlist-note {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
}

/* ── Siguientes list ─────────────────────────────────────── */
.all-list {
  margin-top: 18px;
  padding-top: 14px;
}

.all-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  gap: 10px;
}

.all-row:last-child { border-bottom: none; }

.fin-ciclo {
  margin-top: 10px;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.04em;
}

.all-row-name {
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.all-row-right {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Resumen deudores ────────────────────────────────────── */
.deudor-row {
  display: flex;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  gap: 10px;
}

.deudor-row:last-child { border-bottom: none; }

.deudor-rank {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-faint);
  width: 18px;
  flex-shrink: 0;
}

.deudor-name {
  font-size: 0.88rem;
  font-weight: 500;
  flex: 1;
}

.deudor-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--red);
  background: var(--red-dim);
  border-radius: 6px;
  padding: 3px 9px;
}

.no-deudores {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.84rem;
  padding: 20px 0;
  font-family: 'PT Sans', sans-serif;
}

/* ── Select ──────────────────────────────────────────────── */
.select-wrap {
  position: relative;
  margin-top: 12px;
}

.select-wrap::after {
  content: '↓';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.85rem;
}

select {
  width: 100%;
  padding: 12px 38px 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hi);
  background: var(--surface);
  color: var(--text);
  font-size: 0.93rem;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s;
}

select:focus {
  outline: none;
  border-color: var(--amber);
}

select option { background: #111120; }

/* ── Debt panel ──────────────────────────────────────────── */
#debt-panel { margin-top: 16px; }

.debt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.debt-person-name {
  font-family: 'PT Sans', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--amber);
}

/* Debt table */
.debt-year-header {
  font-family: 'PT Sans', sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-top: 4px;
}

.debt-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.debt-item:last-child { border-bottom: none; }

.debt-item-name {
  flex: 1;
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--red);
}

.debt-item-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.debt-item-icon { font-size: 0.9rem; }

/* Total */
.debt-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-hi);
}

.debt-total-lbl {
  font-family: 'PT Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.debt-total-amt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--red);
}

/* ── Perfil ──────────────────────────────────────────────── */
.profile-header {
  margin-top: 16px;
  margin-bottom: 16px;
  position: relative;
}

.profile-header::before {
  content: '';
  position: absolute;
  top: -20px; left: -22px; right: -22px; bottom: -20px;
  background: radial-gradient(ellipse at 30% 50%, rgba(245,158,11,0.05) 0%, transparent 70%);
  pointer-events: none;
  border-radius: var(--radius);
}

.profile-bday {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.profile-wishlist { margin-bottom: 5px; }
.profile-wishlist .wishlist-btn,
.profile-wishlist .wishlist-note { margin-top: 0; }

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.profile-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.profile-stat-lbl {
  font-family: 'PT Sans', sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 5px;
}

.profile-stat-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.profile-stat-val.ok  { color: var(--green); }
.profile-stat-val.ko  { color: var(--red); }

.profile-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

/* ── Empty / placeholder ─────────────────────────────────── */
.empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 14px 0 10px;
}

.clean-state {
  text-align: center;
  padding: 20px 0 8px;
}

.clean-state p {
  color: var(--green);
  font-family: 'PT Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 8px;
}

/* ── Loading ─────────────────────────────────────────────── */
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 60px 0;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border-hi);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading p {
  font-family: 'PT Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Main content (hidden until loaded) ──────────────────── */
#main-content { display: none; }
#main-content .card:last-child { margin-bottom: 0; }

/* La portada PHP se entrega con los datos ya disponibles; conserva el estado
   visual final del sitio original sin mostrar una carga artificial. */
#main-content { display: block; }

/* Equivalentes de los únicos estilos inline de la portada original. */
.all-list .lbl { margin-bottom: 10px; }
.profile-stat-val .stat-sub { font-size: 0.7rem; color: var(--text-muted); }
#main-content .card:nth-child(2) { animation-delay: 0.1s; }
#main-content .card:nth-child(3) { animation-delay: 0.2s; }

/* ── Error banner ────────────────────────────────────────── */
.error-banner {
  background: var(--red-dim);
  border: 1px solid rgba(248,113,113,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.8rem;
  color: var(--red);
  text-align: center;
  margin-bottom: 16px;
  display: none;
}

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  flex: 0 0 auto;
  text-align: center;
  padding: 16px 16px 32px;
  background: transparent;
  position: relative;
}



.site-footer p {
  font-family: 'PT Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.25);
}

.site-footer a {
  color: var(--amber);
  text-decoration: none;
  transition: opacity 0.2s;
  opacity: 0.7;
}

.site-footer a:hover { opacity: 1; }

@media (min-width: 760px) {
  /* La columna de contenido termina exactamente en los bordes de la tarjeta
     de cabecera: amplia en escritorio, pero sin romper la composición. */
  .app { width: 100%; max-width: 760px; padding-right: 16px; padding-left: 16px; }
  .hero-card-wrap { max-width: 760px; }
}
