/* ==========================================================================
   Cell Vitae — PWA de suscripción
   Estética: editorial de longevidad. Cormorant Garamond (display) + DM Sans.
   Paleta de marca navy / oro / teal / ivory. Claro + oscuro.
   ========================================================================== */

/* ---------- Tokens de marca ---------- */
:root {
  /* Marca (constantes en ambos temas) */
  --gold:       #D4AF37;
  --gold-dark:  #B8912B;
  --teal:       #1E6E6E;
  --navy:       #0A2239;
  --ivory:      #F7F4EC;

  /* Semáforo — verde/ámbar/rojo son constantes; gris depende del tema */
  --verde: #22c55e;
  --ambar: #f59e0b;
  --rojo:  #ef4444;
  --gris:  #cbd5e1;

  /* Superficie (tema claro por defecto) */
  --bg:          #F7F4EC;
  --bg-elev:     #FBF8F0;
  --surface:     #FFFDF7;
  --surface-2:   #F1ECDF;
  --text:        #0A2239;
  --text-muted:  #56687A;
  --text-soft:   #8B98A5;
  --border:      rgba(10, 34, 57, 0.10);
  --border-strong: rgba(10, 34, 57, 0.18);
  --gold-tint:   rgba(212, 175, 55, 0.12);
  --teal-tint:   rgba(30, 110, 110, 0.10);
  --shadow-sm:   0 1px 2px rgba(10, 34, 57, 0.05);
  --shadow-md:   0 6px 24px -12px rgba(10, 34, 57, 0.28);
  --shadow-lg:   0 18px 48px -20px rgba(10, 34, 57, 0.36);

  /* Tipografía */
  --font-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-body:    "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Métrica */
  --col:      520px;
  --radius:   16px;
  --radius-sm: 11px;
  --radius-lg: 22px;
  --nav-h:    66px;
  --header-h: 58px;
  --ease:     cubic-bezier(0.22, 0.61, 0.36, 1);
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #08192B;
    --bg-elev:     #0B2036;
    --surface:     #0E2439;
    --surface-2:   #0A1D30;
    --text:        #F3EEE2;
    --text-muted:  #9EB0C1;
    --text-soft:   #6C7E90;
    --border:      rgba(247, 244, 236, 0.10);
    --border-strong: rgba(247, 244, 236, 0.20);
    --gold-tint:   rgba(212, 175, 55, 0.14);
    --teal-tint:   rgba(62, 154, 154, 0.16);
    --teal:        #4FA6A6;
    --gris:        #40536A;
    --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow-md:   0 8px 28px -14px rgba(0, 0, 0, 0.65);
    --shadow-lg:   0 22px 54px -22px rgba(0, 0, 0, 0.75);
  }
}

/* Overrides manuales por si el usuario fuerza tema desde Ajustes */
:root[data-theme="light"] {
  --bg:#F7F4EC; --bg-elev:#FBF8F0; --surface:#FFFDF7; --surface-2:#F1ECDF;
  --text:#0A2239; --text-muted:#56687A; --text-soft:#8B98A5;
  --border:rgba(10,34,57,0.10); --border-strong:rgba(10,34,57,0.18);
  --gold-tint:rgba(212,175,55,0.12); --teal-tint:rgba(30,110,110,0.10);
  --teal:#1E6E6E; --gris:#cbd5e1;
  --shadow-md:0 6px 24px -12px rgba(10,34,57,0.28); --shadow-lg:0 18px 48px -20px rgba(10,34,57,0.36);
}
:root[data-theme="dark"] {
  --bg:#08192B; --bg-elev:#0B2036; --surface:#0E2439; --surface-2:#0A1D30;
  --text:#F3EEE2; --text-muted:#9EB0C1; --text-soft:#6C7E90;
  --border:rgba(247,244,236,0.10); --border-strong:rgba(247,244,236,0.20);
  --gold-tint:rgba(212,175,55,0.14); --teal-tint:rgba(62,154,154,0.16);
  --teal:#4FA6A6; --gris:#40536A;
  --shadow-md:0 8px 28px -14px rgba(0,0,0,0.65); --shadow-lg:0 22px 54px -22px rgba(0,0,0,0.75);
}

/* ---------- Reset ligero ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* Textura de papel muy sutil, no molesta, se desactiva en reduce-motion no aplica (es estática) */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--gold-tint), transparent 60%);
  opacity: 0.7;
}
img, svg { max-width: 100%; }
button { font-family: inherit; color: inherit; }
h1,h2,h3,h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: var(--teal); }

/* ---------- Tipografía utilitaria ---------- */
.display { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.01em; line-height: 1.05; }
.eyebrow {
  font-family: var(--font-body);
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold-dark);
}
.muted { color: var(--text-muted); }
.soft  { color: var(--text-soft); }

/* ==========================================================================
   Splash + spinner
   ========================================================================== */
.splash {
  position: fixed; inset: 0; z-index: 5;
  display: grid; place-items: center;
  background: var(--bg);
}
.splash__mark { animation: breathe 2.4s var(--ease) infinite; }
@keyframes breathe { 0%,100%{ transform: scale(1); opacity: .9 } 50%{ transform: scale(1.06); opacity: 1 } }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--gold);
  animation: spin 0.7s linear infinite;
}
.spinner--lg { width: 34px; height: 34px; border-width: 3px; }
.spinner--center { margin: 3rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Layout general de la app
   ========================================================================== */
.app-shell { position: relative; z-index: 1; min-height: 100dvh; }

.app-header {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-top) + 10px) 20px 10px;
  display: flex; align-items: center; gap: 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.2) blur(14px);
  -webkit-backdrop-filter: saturate(1.2) blur(14px);
  border-bottom: 1px solid var(--border);
}
.app-header__brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.app-header__mark { width: 30px; height: 30px; flex: none; }
.app-header__word {
  font-family: var(--font-display); font-weight: 600; font-size: 1.32rem;
  letter-spacing: 0.02em; color: var(--text); line-height: 1;
}
.app-header__word small {
  display: block; font-family: var(--font-body); font-weight: 500;
  font-size: 0.56rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-soft); margin-top: 2px;
}

.icon-btn {
  flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; color: var(--text);
  transition: border-color .2s var(--ease), transform .12s var(--ease);
}
.icon-btn:hover { border-color: var(--border-strong); }
.icon-btn:active { transform: scale(0.94); }

.app-main {
  max-width: var(--col); margin: 0 auto;
  padding: 22px 20px calc(var(--nav-h) + var(--safe-bottom) + 30px);
}

/* Reveal de entrada escalonado */
.reveal > * { animation: rise .5s var(--ease) both; }
.reveal > *:nth-child(1){ animation-delay: .02s }
.reveal > *:nth-child(2){ animation-delay: .07s }
.reveal > *:nth-child(3){ animation-delay: .12s }
.reveal > *:nth-child(4){ animation-delay: .17s }
.reveal > *:nth-child(5){ animation-delay: .22s }
.reveal > *:nth-child(6){ animation-delay: .27s }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Encabezado de sección (editorial) ---------- */
.section-head { margin: 4px 2px 14px; }
.section-head h2 { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; color: var(--text); }
.section-head p { margin-top: 4px; color: var(--text-muted); font-size: 0.92rem; }
.rule { height: 1px; background: var(--border); margin: 22px 0; border: 0; }
.rule--gold { background: linear-gradient(90deg, var(--gold), transparent 70%); height: 2px; }

/* ==========================================================================
   Bottom nav (estilo app)
   ========================================================================== */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center;
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(16px);
  -webkit-backdrop-filter: saturate(1.2) blur(16px);
  border-top: 1px solid var(--border);
}
.bottom-nav__inner { display: flex; width: 100%; max-width: var(--col); }
.tab {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px 8px; height: var(--nav-h);
  background: none; border: 0; cursor: pointer;
  color: var(--text-soft);
  position: relative;
  transition: color .2s var(--ease);
}
.tab svg { width: 23px; height: 23px; }
.tab__label { font-size: clamp(0.55rem, 2.4vw, 0.63rem); font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.tab__lock { position: absolute; top: 8px; right: calc(50% - 20px); color: var(--gold-dark); opacity: .8; }
.tab__lock svg { width: 11px; height: 11px; }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"] svg { color: var(--gold-dark); }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; top: 6px; width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold);
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 14px; }
.card__eyebrow { margin-bottom: 8px; }
.card--flush { padding: 0; overflow: hidden; }

/* ==========================================================================
   Pulso — gauge + pilares + recomendación
   ========================================================================== */
.pulso-hero {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0 4px;
}
.gauge { position: relative; width: min(72vw, 268px); aspect-ratio: 1; }
.gauge svg { width: 100%; height: 100%; overflow: visible; }
.gauge__track { stroke: var(--surface-2); }
.gauge__value { transition: stroke-dasharray 1s var(--ease), stroke .4s var(--ease); }
.gauge__center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.gauge__num {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(3.6rem, 22vw, 5.6rem); line-height: 0.9; color: var(--text);
  font-variant-numeric: lining-nums;
}
.gauge__label {
  margin-top: 6px; font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-soft);
}
.gauge__state { margin-top: 2px; font-size: 0.82rem; font-weight: 600; }

.pulso-meta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 0.82rem; font-weight: 500; color: var(--text-muted);
}
.chip--streak { background: var(--gold-tint); border-color: transparent; color: var(--gold-dark); font-weight: 600; }
.chip--closed { color: var(--teal); border-color: color-mix(in srgb, var(--teal) 40%, transparent); }
.flame { width: 15px; height: 15px; }

/* Semáforo — 4 pilares */
.pillars { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pillar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
  display: flex; flex-direction: column; gap: 9px;
  position: relative; overflow: hidden;
}
.pillar::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--luz, var(--gris));
}
.pillar__top { display: flex; align-items: center; gap: 9px; }
.pillar__icon { width: 22px; height: 22px; color: var(--text-muted); flex: none; }
.pillar__name { font-size: 0.82rem; font-weight: 600; letter-spacing: 0.01em; }
.pillar__dot {
  margin-left: auto; width: 11px; height: 11px; border-radius: 50%;
  background: var(--luz, var(--gris));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--luz, var(--gris)) 22%, transparent);
}
.pillar__val { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; line-height: 1; }
.pillar__val small { font-family: var(--font-body); font-size: 0.72rem; font-weight: 500; color: var(--text-soft); }
.pillar__obj { font-size: 0.72rem; color: var(--text-soft); }
.pillar--gris .pillar__val { color: var(--text-soft); }
.pillar--gris .pillar__icon { opacity: .5; }

/* Recomendación del día */
.reco {
  background: linear-gradient(135deg, var(--teal-tint), transparent 80%);
  border: 1px solid var(--border);
  border-left: 3px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
}
.reco__eyebrow { color: var(--teal); }
.reco__text { font-family: var(--font-display); font-size: 1.28rem; font-weight: 500; line-height: 1.28; margin-top: 6px; color: var(--text); }

/* ==========================================================================
   Formularios / inputs / botones
   ========================================================================== */
.field { margin-bottom: 15px; }
.field > label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.01em; }
.input {
  width: 100%; padding: 13px 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 1rem;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.input::placeholder { color: var(--text-soft); }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }
.input[aria-invalid="true"] { border-color: var(--rojo); }

.check {
  display: flex; gap: 11px; align-items: flex-start;
  font-size: 0.88rem; color: var(--text-muted); cursor: pointer; line-height: 1.4;
}
.check input { margin-top: 2px; width: 20px; height: 20px; accent-color: var(--teal); flex: none; }

.btn {
  --btn-bg: var(--navy); --btn-fg: var(--ivory);
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; padding: 14px 18px;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 1rem; font-weight: 600; letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform .12s var(--ease), filter .2s var(--ease), box-shadow .2s var(--ease);
  box-shadow: var(--shadow-md);
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px) scale(0.995); }
.btn:disabled { opacity: 0.55; cursor: default; box-shadow: none; }
.btn--gold  { --btn-bg: var(--gold); --btn-fg: #2A1E00; }
.btn--teal  { --btn-bg: var(--teal); --btn-fg: #ffffff; }
.btn--ghost {
  --btn-bg: transparent; --btn-fg: var(--text);
  border-color: var(--border-strong); box-shadow: none;
}
.btn--ghost:hover { background: var(--surface-2); filter: none; }
.btn--sm { width: auto; padding: 10px 16px; font-size: 0.9rem; }
.btn--danger { --btn-bg: transparent; --btn-fg: var(--rojo); border-color: color-mix(in srgb, var(--rojo) 35%, transparent); box-shadow: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { width: auto; flex: 1; }

/* ==========================================================================
   Auth (bienvenida)
   ========================================================================== */
.auth {
  min-height: 100dvh; max-width: 440px; margin: 0 auto;
  padding: calc(var(--safe-top) + 40px) 24px calc(var(--safe-bottom) + 40px);
  display: flex; flex-direction: column;
}
.auth__brand { text-align: center; margin-bottom: 26px; }
.auth__mark { width: 78px; height: 78px; margin: 0 auto 14px; display: block; }
.auth__title { font-family: var(--font-display); font-size: 2.6rem; font-weight: 600; line-height: 1; color: var(--text); }
.auth__tagline { margin-top: 10px; font-family: var(--font-display); font-style: italic; font-size: 1.15rem; color: var(--gold-dark); }
.auth__card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-lg); }
.segmented {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 20px;
  background: var(--surface-2); border-radius: 999px;
}
.segmented button {
  flex: 1; padding: 9px; border: 0; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--text-muted); font-weight: 600; font-size: 0.9rem;
  transition: all .2s var(--ease);
}
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth__foot { margin-top: 22px; text-align: center; font-size: 0.8rem; color: var(--text-soft); }
.auth__foot a { color: var(--teal); cursor: pointer; }

.form-error {
  background: color-mix(in srgb, var(--rojo) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--rojo) 35%, transparent);
  color: color-mix(in srgb, var(--rojo) 88%, var(--text));
  border-radius: var(--radius-sm); padding: 11px 14px; font-size: 0.88rem;
  margin-bottom: 15px;
}
.form-note {
  background: var(--teal-tint); border: 1px solid color-mix(in srgb, var(--teal) 30%, transparent);
  color: var(--text); border-radius: var(--radius-sm); padding: 11px 14px; font-size: 0.88rem; margin-bottom: 15px;
}

/* ==========================================================================
   Mi día — controles
   ========================================================================== */
.mood-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mood {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 8px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: all .18s var(--ease); color: var(--text-muted);
}
.mood svg { width: 26px; height: 26px; }
.mood span { font-size: 0.78rem; font-weight: 600; }
.mood:hover { border-color: var(--text-soft); }
.mood[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-tint); color: var(--text); }

.stepper-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0;
}
.stepper-row__label { display: flex; flex-direction: column; gap: 2px; }
.stepper-row__label b { font-size: 0.95rem; font-weight: 600; }
.stepper-row__label small { color: var(--text-soft); font-size: 0.76rem; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer;
  font-size: 1.35rem; color: var(--text); display: grid; place-items: center; line-height: 1;
  transition: transform .1s var(--ease), border-color .2s var(--ease);
}
.stepper button:hover { border-color: var(--border-strong); }
.stepper button:active { transform: scale(0.9); }
.stepper button:disabled { opacity: .4; cursor: default; }
.stepper__val { min-width: 62px; text-align: center; font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; }
.stepper__val small { font-family: var(--font-body); font-size: 0.72rem; font-weight: 500; color: var(--text-soft); }

.field-inline { display: flex; align-items: center; gap: 12px; }
.field-inline .input { text-align: center; font-family: var(--font-display); font-size: 1.4rem; padding: 8px; }

/* ==========================================================================
   Estado bloqueado / upgrade (Premium)
   ========================================================================== */
.locked {
  text-align: center; padding: 30px 22px;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--gold-tint), transparent 70%),
    var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.locked__badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px; border-radius: 999px; margin-bottom: 16px;
  background: var(--navy); color: var(--gold);
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
}
.locked__icon { width: 48px; height: 48px; color: var(--gold-dark); margin: 4px auto 14px; }
.locked h2 { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; margin-bottom: 8px; }
.locked p { color: var(--text-muted); max-width: 34ch; margin: 0 auto 20px; }
.locked .btn { max-width: 320px; margin: 0 auto; }
.locked__note { margin-top: 12px; font-size: 0.74rem; color: var(--text-soft); }
.perk-list { text-align: left; max-width: 320px; margin: 0 auto 22px; display: grid; gap: 10px; }
.perk { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; color: var(--text); }
.perk svg { width: 18px; height: 18px; color: var(--teal); flex: none; margin-top: 2px; }

/* ==========================================================================
   Evolución — sparkline
   ========================================================================== */
.spark { width: 100%; height: 140px; display: block; overflow: visible; }
.spark__line { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.spark__area { fill: url(#sparkfill); opacity: 0.9; }
.spark__dot { fill: var(--surface); stroke: var(--gold-dark); stroke-width: 2.5; }
.spark__grid { stroke: var(--border); stroke-width: 1; }
.spark-stats { display: flex; gap: 12px; margin-top: 14px; }
.stat { flex: 1; }
.stat__num { font-family: var(--font-display); font-size: 1.8rem; font-weight: 600; line-height: 1; }
.stat__lbl { font-size: 0.72rem; color: var(--text-soft); margin-top: 3px; }

/* Tendencia de pilares (mini barras de luces) */
.trend-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.trend-row + .trend-row { border-top: 1px solid var(--border); }
.trend-row__name { display: flex; align-items: center; gap: 8px; width: 130px; flex: none; font-size: 0.84rem; font-weight: 600; }
.trend-row__name svg { width: 18px; height: 18px; color: var(--text-muted); }
.trend-strip { display: flex; gap: 2px; flex: 1; height: 22px; }
.trend-cell { flex: 1; border-radius: 2px; background: var(--luz, var(--gris)); min-width: 2px; }

/* ==========================================================================
   Botiquín / protocolos
   ========================================================================== */
.draft-banner {
  display: flex; gap: 10px; align-items: center;
  background: var(--gold-tint); border: 1px dashed var(--gold-dark);
  border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 16px;
  font-size: 0.82rem; color: var(--text); line-height: 1.35;
}
.draft-banner svg { width: 20px; height: 20px; color: var(--gold-dark); flex: none; }

.kit-list { display: grid; gap: 0; }
.kit-item { display: flex; gap: 12px; padding: 12px 2px; align-items: flex-start; }
.kit-item + .kit-item { border-top: 1px solid var(--border); }
.kit-item__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-top: 8px; flex: none; }
.kit-item b { font-size: 0.92rem; }
.kit-item small { display: block; color: var(--text-muted); font-size: 0.82rem; margin-top: 1px; }

.proto-item {
  width: 100%; text-align: left; cursor: pointer;
  display: flex; gap: 12px; align-items: center;
  padding: 15px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .2s var(--ease), transform .1s var(--ease);
}
.proto-item + .proto-item { margin-top: 10px; }
.proto-item:hover { border-color: var(--border-strong); }
.proto-item:active { transform: scale(0.995); }
.proto-item__body { flex: 1; min-width: 0; }
.proto-item__body b { font-family: var(--font-display); font-size: 1.18rem; font-weight: 600; display: block; }
.proto-item__body small { color: var(--text-muted); font-size: 0.84rem; }
.proto-item__chev { color: var(--text-soft); flex: none; }

/* Vista detalle protocolo */
.proto-detail__title { font-family: var(--font-display); font-size: 2rem; font-weight: 600; line-height: 1.05; }
.proto-when { display: inline-block; margin-top: 8px; font-size: 0.8rem; color: var(--teal); font-weight: 600; }
.alert-112 {
  display: flex; gap: 11px; align-items: center;
  background: color-mix(in srgb, var(--rojo) 14%, var(--surface));
  border: 1px solid var(--rojo); border-left-width: 4px;
  border-radius: var(--radius-sm); padding: 13px 15px; margin: 16px 0;
  color: color-mix(in srgb, var(--rojo) 90%, var(--text)); font-weight: 600; font-size: 0.92rem;
}
.alert-112 svg { width: 22px; height: 22px; flex: none; }
.steps { list-style: none; padding: 0; margin: 6px 0 0; counter-reset: step; }
.steps li {
  position: relative; padding: 12px 2px 12px 44px; counter-increment: step;
  border-top: 1px solid var(--border); font-size: 0.96rem; line-height: 1.4;
}
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 11px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy); color: var(--ivory);
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 1rem;
}
.speak-bar { display: flex; gap: 10px; margin-top: 20px; }
.aviso-med { margin-top: 18px; font-size: 0.8rem; color: var(--text-muted); font-style: italic; border-top: 1px solid var(--border); padding-top: 14px; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: none; border: 0; color: var(--text-muted); font-weight: 600; font-size: 0.9rem;
  padding: 4px 0; margin-bottom: 8px;
}
.back-link svg { width: 16px; height: 16px; }

/* ==========================================================================
   Ajustes
   ========================================================================== */
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 2px; }
.list-row + .list-row { border-top: 1px solid var(--border); }
.list-row__k { font-size: 0.8rem; color: var(--text-soft); }
.list-row__v { font-weight: 600; }
.plan-pills { display: flex; gap: 8px; }
.plan-pill {
  padding: 8px 15px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.85rem;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
  transition: all .18s var(--ease);
}
.plan-pill[aria-pressed="true"] { background: var(--navy); color: var(--gold); border-color: transparent; }
.badge-plan {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.badge-plan[data-plan="premium"] { background: var(--navy); color: var(--gold); }
.badge-plan[data-plan="basic"]   { background: var(--teal-tint); color: var(--teal); }
.badge-plan[data-plan="none"]    { background: var(--surface-2); color: var(--text-soft); }

/* ==========================================================================
   Estados vacíos / confirmación
   ========================================================================== */
.empty { text-align: center; padding: 34px 20px; color: var(--text-muted); }
.empty svg { width: 40px; height: 40px; color: var(--text-soft); margin-bottom: 12px; }
.confirm {
  text-align: center; padding: 30px 22px;
  background: var(--teal-tint); border: 1px solid color-mix(in srgb, var(--teal) 30%, transparent);
  border-radius: var(--radius-lg);
}
.confirm svg { width: 46px; height: 46px; color: var(--teal); margin-bottom: 12px; }
.confirm h3 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; margin-bottom: 6px; }

/* Celebración al cerrar el día */
.celebrate { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; pointer-events: none; }
.celebrate__card {
  background: var(--surface); border: 1px solid var(--gold);
  border-radius: var(--radius-lg); padding: 30px 34px; text-align: center;
  box-shadow: var(--shadow-lg); animation: pop .5s var(--ease) both;
  pointer-events: auto;
}
.celebrate__num { font-family: var(--font-display); font-size: 4rem; font-weight: 700; color: var(--gold-dark); line-height: 1; }
.celebrate__lbl { font-size: 0.9rem; color: var(--text-muted); margin-top: 4px; }
@keyframes pop { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }

/* ==========================================================================
   Toasts
   ========================================================================== */
.toasts {
  position: fixed; left: 0; right: 0; top: calc(var(--safe-top) + 12px); z-index: 80;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px;
  pointer-events: none;
}
.toast {
  pointer-events: auto; max-width: var(--col); width: fit-content;
  padding: 12px 18px; border-radius: 999px;
  background: var(--navy); color: var(--ivory);
  font-size: 0.88rem; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toast-in .3s var(--ease) both;
  display: flex; align-items: center; gap: 9px;
}
.toast--err { background: var(--rojo); }
.toast--ok { background: var(--teal); }
.toast.out { animation: toast-out .3s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px); } }

/* Offline pill */
.offline-pill {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px); z-index: 40;
  background: var(--gold-dark); color: #fff; padding: 7px 16px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600; box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Perfil — tarjetas de cuestionario, wizard, barras de terreno, teaser
   ========================================================================== */
.cuest-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
}
.cuest-card + .cuest-card { margin-top: 12px; }
.cuest-card h3 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; margin-bottom: 4px; }
.cuest-card p { color: var(--text-muted); font-size: 0.88rem; }
.cuest-card--hero {
  background: radial-gradient(120% 90% at 100% 0%, var(--gold-tint), transparent 70%), var(--surface);
  border-color: var(--border-strong); padding: 22px; margin-bottom: 14px;
}
.cuest-card--hero h3 { font-size: 1.7rem; margin-top: 6px; }
.cuest-card__mini {
  margin: 12px 0 2px; font-size: 0.86rem; color: var(--text);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cuest-card__actions { display: flex; gap: 10px; margin-top: 14px; }
.cuest-card__actions .btn { width: auto; flex: 1; }
.cuest-mini-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--tc, var(--gold)); color: #fff; font-size: 0.72rem; font-weight: 700; flex: none;
}

/* Wizard: progreso, preguntas, pills de opciones */
.wizard-progressbar { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 16px 0 6px; }
.wizard-progressbar__fill { height: 100%; background: var(--gold); border-radius: 4px; transition: width .25s var(--ease); }
.wizard-progress-label { font-size: 0.74rem; color: var(--text-soft); text-align: right; margin-bottom: 14px; }

.wizard-item { padding: 14px 0; border-top: 1px solid var(--border); }
.wizard-item:first-child { border-top: 0; padding-top: 4px; }
.wizard-item__text { font-size: 0.92rem; margin-bottom: 10px; line-height: 1.4; }

.wizard-q { padding: 13px 0; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.wizard-q:first-child { border-top: 0; }
.wizard-q__text { font-size: 0.9rem; line-height: 1.4; flex: 1; }

.opt-row { display: flex; gap: 5px; }
.opt-row--wrap { flex-wrap: wrap; }
.opt-row--wrap .opt-pill { flex: 1 1 calc(50% - 5px); min-width: 120px; }
.opt-pill { flex: 1; min-width: 0; cursor: pointer; }
.opt-pill input { position: absolute; opacity: 0; pointer-events: none; }
.opt-pill span {
  display: block; text-align: center; padding: 8px 3px; font-size: 0.68rem; line-height: 1.25;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text-muted);
  transition: all .15s var(--ease);
}
.opt-pill:has(input:checked) span { background: var(--gold-tint); border-color: var(--gold); color: var(--text); font-weight: 600; }

.yn-row { display: flex; gap: 10px; flex: none; }
.yn-opt { position: relative; cursor: pointer; }
.yn-opt input { position: absolute; opacity: 0; pointer-events: none; }
.yn-opt span {
  display: flex; align-items: center; justify-content: center; width: 56px; height: 38px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 0.86rem; font-weight: 600; color: var(--text-muted); transition: all .15s var(--ease);
}
.yn-opt:has(input:checked) span { background: var(--teal-tint); border-color: var(--teal); color: var(--teal); }

.wizard-cat { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; background: var(--surface); }
.wizard-cat summary {
  padding: 13px 16px; cursor: pointer; font-weight: 600; font-size: 0.92rem;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
.wizard-cat summary::-webkit-details-marker { display: none; }
.wizard-cat summary::after { content: "▾"; color: var(--text-soft); transition: transform .2s var(--ease); }
.wizard-cat[open] summary::after { transform: rotate(180deg); }
.wizard-cat__body { padding: 4px 16px 10px; }

.sexo-pick { display: flex; gap: 12px; margin-top: 20px; }
.sexo-btn {
  flex: 1; padding: 20px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); font-weight: 600; font-size: 1rem; cursor: pointer;
  transition: all .15s var(--ease); color: var(--text);
}
.sexo-btn.is-sel { background: var(--gold-tint); border-color: var(--gold); }

/* Barras de terreno (perfil metabólico) */
.terrain-list { display: grid; gap: 18px; }
.terrain-row { display: flex; gap: 12px; }
.terrain-medal {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  background: var(--tc, var(--gold)); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 0.78rem; font-family: var(--font-display);
}
.terrain-row__body { flex: 1; min-width: 0; }
.terrain-row__head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.terrain-row__name { font-weight: 600; font-size: 0.96rem; }
.terrain-row__tag {
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gold-dark); background: var(--gold-tint); padding: 2px 8px; border-radius: 999px;
}
.terrain-row__val { margin-left: auto; font-family: var(--font-display); font-weight: 600; }
.terrain-track { height: 8px; background: var(--surface-2); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.terrain-fill { height: 100%; border-radius: 4px; transition: width .6s var(--ease); }
.terrain-row__exp { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; }
/* Terreno dominante: realce visual de la fila (además de la etiqueta «Dominante»). */
.terrain-row--dom { background: var(--gold-tint); border: 1px solid var(--gold); border-radius: 12px; padding: 12px; margin: -2px -6px; }

/* Teaser unidimensional (síntomas / estrés / sueño) */
.teaser-card { padding: 24px 18px; }
.score-teaser { text-align: center; padding: 6px 0 2px; }
.score-teaser__num { font-family: var(--font-display); font-size: 4.2rem; font-weight: 700; line-height: 1; color: var(--text); }
.score-teaser__label { margin-top: 6px; font-weight: 600; color: var(--gold-dark); }
.score-teaser__hallazgo { margin: 12px auto 0; color: var(--text-muted); font-size: 0.92rem; max-width: 36ch; }

/* CTA de muro inline (más ligero que .locked de página completa) */
.paywall-cta {
  text-align: center; background: var(--gold-tint);
  border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  border-radius: var(--radius-sm); padding: 18px; margin-top: 16px;
}
.paywall-cta p { color: var(--text); font-size: 0.92rem; margin-bottom: 12px; }
.paywall-cta .btn { max-width: 280px; margin: 0 auto; }

.desglose-details { margin-top: 16px; }
.desglose-details summary {
  cursor: pointer; font-weight: 600; color: var(--teal); font-size: 0.9rem;
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
}
.desglose-details summary::-webkit-details-marker { display: none; }
.desglose-details[open] summary svg { transform: rotate(90deg); }

/* ==========================================================================
   Accesibilidad
   ========================================================================== */
:focus-visible { outline: 2.5px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.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;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
}

/* Pantallas muy pequeñas: pilares en una columna si no caben */
@media (max-width: 340px) {
  .pillars { grid-template-columns: 1fr; }
  .tab__label { font-size: 0.58rem; }
}
