/* ════════════════════════════════════════════════════════════
   FluencIA — Hoja de estilos unificada
   Fluency English School · 2026
   Orden: tokens → reset → layout → componentes → vistas →
          estados → animaciones → media queries
   ════════════════════════════════════════════════════════════ */

/* ══ 1. TOKENS (design tokens) ══ */
:root {
  /* Marca principal */
  --purple:       #6B46C1;
  --purple-light: #8B5CF6;
  --purple-pale:  #EDE9FE;
  --purple-mid:   #DDD6FE;

  /* Acento energético */
  --amber:        #F59E0B;
  --amber-light:  #FEF3C7;
  --amber-pale:   #FFFBEB;

  /* Neutrales */
  --bg:        #F7F6FB;
  --surface:   #FFFFFF;
  --surface2:  #F3F0FA;
  --border:    #E8E3F4;

  /* Tipografía */
  --text:       #1A1025;
  --text-mid:   #5B4E7A;
  --text-muted: #9588B0;

  /* Estados positivos */
  --green:      #10B981;
  --green-pale: #D1FAE5;
  --green-mid:  #6EE7B7;

  /* Estados de error */
  --red:      #EF4444;
  --red-pale: #FEF2F2;

  /* Información */
  --blue-pale: #EFF6FF;

  /* Radios */
  --r:    18px;
  --rsm:  12px;

  /* Medidas fijas */
  --navh:   78px;
  --headh:  68px;

  /* Fuentes */
  --font-display: 'Outfit', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  /* Sombras */
  --shadow-shell:  0 32px 80px rgba(107,70,193,.25), 0 0 0 1px rgba(107,70,193,.1);
  --shadow-btn:    0 4px 16px rgba(107,70,193,.35);
  --shadow-btn-hv: 0 6px 20px rgba(107,70,193,.45);
  --shadow-card:   0 1px 4px rgba(107,70,193,.05);

  /* Gradientes */
  --grad-primary: linear-gradient(135deg, #6B46C1, #8B5CF6);
  --grad-hero:    linear-gradient(135deg, #4C1D95, #6B46C1, #7C3AED);
  --grad-hero-v:  linear-gradient(160deg, #3B0764, #6B46C1, #7C3AED);
  --grad-amber:   linear-gradient(135deg, #FFFBEB, #FFF5D6);
  --grad-bar:     linear-gradient(90deg, #6B46C1, #8B5CF6);

  /* Easing estándar */
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ══ 2. RESET Y BASE ══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--border);
  font-family: var(--font-body);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
a { color: var(--purple); text-decoration: none; }
input, textarea { font-family: inherit; }

/* Scrollbars finos del sistema */
.scroll-y {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.scroll-y::-webkit-scrollbar { width: 3px; }
.scroll-y::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ══ 3. LAYOUT — shell y sistema de vistas ══ */
.shell {
  width: 100%;
  max-width: 390px;
  height: 100vh;
  max-height: 844px;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-shell);
}

/* Cada vista ocupa todo el shell; sólo una está activa */
.view { display: none; flex: 1; min-height: 0; flex-direction: column; overflow: hidden; }
.view.is-active { display: flex; animation: viewIn .22s var(--ease) both; }

/* Área scrolleable estándar dentro de una vista */
.view-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.view-scroll::-webkit-scrollbar { width: 3px; }
.view-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* Los hijos directos de las áreas scrolleables conservan su altura natural.
   Sin esto, flexbox comprime los ítems con overflow:hidden (hero, tarjetas)
   y recorta su contenido en lugar de dejar scrollear el contenedor. */
.view-scroll > *,
.ts-scroll > *,
.ch-area > *,
.pf-settings-scroll > *,
.pf-upgrade-body > * {
  flex-shrink: 0;
}

/* Overlay de carga global */
.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.loading-overlay.is-active { display: flex; }
.loading-overlay__logo { font-family: var(--font-display); font-weight: 800; font-size: 2rem; color: var(--purple); }
.loading-overlay__logo span { color: var(--amber); }
.loading-overlay__text { font-size: .8rem; color: var(--text-muted); }

/* ══ 4. COMPONENTES GLOBALES ══ */

/* — 4.1 Header estándar — */
.header {
  height: var(--headh);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 10;
}
.header__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  flex: 1;
}
.header__title span { color: var(--purple); }
.header__logo { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: var(--text); }
.header__logo span { color: var(--amber); }

/* — 4.2 Bottom navigation — */
.bottom-nav {
  height: var(--navh);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px 12px;
  flex-shrink: 0;
}
.bottom-nav[hidden] { display: none; }
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: 12px;
  border: none;
  background: transparent;
  min-width: 64px;
  transition: background .15s;
}
.nav-item:hover { background: var(--surface2); }
.nav-item__icon { font-size: 1.25rem; line-height: 1; position: relative; }
.nav-item__badge {
  position: absolute;
  top: -3px; right: -5px;
  width: 14px; height: 14px;
  background: var(--amber);
  border: 2px solid var(--surface);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: .55rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-item__label {
  font-family: var(--font-display);
  font-size: .65rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: .3px;
}
.nav-item__dot {
  display: none;
  width: 4px; height: 4px;
  background: var(--purple);
  border-radius: 50%;
  margin-top: -2px;
}
.nav-item.is-active .nav-item__label { color: var(--purple); font-weight: 700; }
.nav-item.is-active .nav-item__dot { display: block; }

/* — 4.3 Botones — */
.btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .3px;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn--primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn--primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-btn-hv); }
.btn--primary:active { transform: translateY(0); }
.btn--secondary {
  background: var(--surface);
  border: 1.5px solid var(--border);
  padding: 14px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-mid);
}
.btn--secondary:hover { border-color: var(--purple-mid); background: var(--purple-pale); color: var(--purple); }
.btn--amber {
  background: linear-gradient(135deg, #F59E0B, #FBBF24);
  color: #fff;
  box-shadow: 0 4px 14px rgba(245,158,11,.35);
}
.btn--amber:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.is-loading { pointer-events: none; opacity: .8; }
.btn__spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* — 4.4 Tarjetas — */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
}
.hero-card {
  background: var(--grad-hero);
  border-radius: 22px;
  padding: 22px;
  position: relative;
  overflow: hidden;
  color: #fff;
}
.hero-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
}
.amber-card {
  background: linear-gradient(135deg, var(--amber-pale), #FFF8E7);
  border: 1.5px solid #FDE68A;
  border-radius: var(--r);
  padding: 16px;
}

/* — 4.5 Barras de progreso / métricas — */
.bar-track {
  height: 8px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--grad-bar);
  transition: width 1.2s var(--ease);
}

/* — 4.6 Step dots — */
.step-dots { display: flex; gap: 5px; }
.step-dots__dot {
  height: 4px;
  flex: 1;
  border-radius: 99px;
  background: var(--border);
  transition: all .3s;
}
.step-dots__dot.is-done { background: var(--purple-light); opacity: .5; }
.step-dots__dot.is-active { background: var(--purple); }

/* — 4.7 Streak pill — */
.streak-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--amber-light);
  border: 1px solid #FDE68A;
  border-radius: 99px;
  padding: 5px 11px;
  font-family: var(--font-display);
  font-size: .72rem;
  font-weight: 700;
  color: #92400E;
  flex-shrink: 0;
}

/* — 4.8 Toast — */
.toast {
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  background: #1A1025;
  color: #fff;
  padding: 10px 18px;
  border-radius: 99px;
  font-size: .8rem;
  font-family: var(--font-body);
  white-space: nowrap;
  max-width: 90%;
  text-align: center;
  z-index: 300;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: toastIn .3s both;
}
.toast.is-hiding { opacity: 0; transition: opacity .3s; }

/* — 4.9 Modal / bottom-sheet — */
.modal {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 100;
  display: none;
  align-items: flex-end;
}
.modal.is-active { display: flex; animation: fadeIn .2s both; }
.modal__sheet {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 28px 24px 40px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slideUp .25s var(--ease) both;
}
.modal__handle { width: 36px; height: 4px; background: var(--border); border-radius: 99px; margin: 0 auto -4px; }
.modal__icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  background: var(--purple-pale);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto;
}
.modal__title { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: var(--text); text-align: center; line-height: 1.3; }
.modal__text { font-size: .82rem; color: var(--text-muted); text-align: center; line-height: 1.6; }
.modal__text--left { text-align: left; font-size: .78rem; line-height: 1.65; }
.modal__text strong { color: var(--text-mid); }

/* — 4.10 Tarjeta de palabra (word card) — */
.word-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.word-card__top { display: flex; align-items: flex-start; gap: 10px; }
.word-card__num {
  width: 26px; height: 26px; min-width: 26px;
  border-radius: 8px;
  background: var(--purple-pale);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: .72rem; font-weight: 800;
  color: var(--purple);
  flex-shrink: 0;
  margin-top: 2px;
}
.word-card__main { flex: 1; min-width: 0; }
.word-card__en { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: var(--text); line-height: 1.2; }
.word-card__pron { font-size: .68rem; color: var(--text-muted); font-style: italic; margin-top: 3px; }
.word-card__es {
  font-family: var(--font-display);
  font-size: .78rem; font-weight: 600;
  color: var(--purple);
  background: var(--purple-pale);
  padding: 4px 10px;
  border-radius: 8px;
  flex-shrink: 0;
  align-self: flex-start;
}
.word-card__divider { height: 1px; background: var(--border); }
.word-card__phrase { display: flex; align-items: flex-start; gap: 8px; }
.word-card__phrase-icon { font-size: .75rem; margin-top: 2px; flex-shrink: 0; }
.word-card__phrase-text { font-size: .82rem; color: var(--text-mid); line-height: 1.5; font-style: italic; }
.word-card__phrase-text strong { color: var(--purple); font-style: normal; font-weight: 700; }

/* — 4.11 Tarjeta de expresión (viernes / ámbar) — */
.expr-card {
  background: linear-gradient(135deg, var(--amber-pale), #FFF8E7);
  border: 1.5px solid #FDE68A;
  border-radius: var(--r);
  padding: 14px;
}
.expr-card__top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.expr-card__num {
  width: 26px; height: 26px; min-width: 26px;
  border-radius: 8px;
  background: var(--amber-light);
  border: 1px solid #FDE68A;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: .72rem; font-weight: 800;
  color: #92400E;
  flex-shrink: 0;
}
.expr-card__en { font-family: var(--font-display); font-weight: 800; font-size: .95rem; color: #78350F; flex: 1; }
.expr-card__pron { font-size: .65rem; color: #92400E; font-style: italic; opacity: .7; }
.expr-card__es { font-size: .8rem; color: #92400E; font-weight: 600; margin-bottom: 6px; }
.expr-card__use { display: flex; gap: 6px; align-items: flex-start; }
.expr-card__use-label {
  font-family: var(--font-display);
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: #92400E; opacity: .6;
  white-space: nowrap; margin-top: 1px;
}
.expr-card__use-text { font-size: .78rem; color: #78350F; line-height: 1.45; }

/* — 4.12 Campo de texto — */
.field {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  font-family: var(--font-body);
  font-size: .9rem;
  color: var(--text);
  outline: none;
  transition: all .2s;
}
.field::placeholder { color: var(--text-muted); }
.field:focus { border-color: var(--purple-light); background: #fff; box-shadow: 0 0 0 3px rgba(107,70,193,.08); }
.field.has-error { border-color: var(--red); background: var(--red-pale); box-shadow: 0 0 0 3px rgba(239,68,68,.08); }

/* — 4.13 Sección con título — */
.section-label {
  font-family: var(--font-display);
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted);
}
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display);
  font-weight: 700; font-size: .9rem;
  color: var(--text);
}
.section-title__icon {
  width: 28px; height: 28px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
}

/* ════════════════════════════════════════════════════════════
   5. VISTAS
   ════════════════════════════════════════════════════════════ */

/* ══ 5.1 VISTA LOGIN ══ */
.view--login .lg-hero {
  background: var(--grad-hero-v);
  padding: 52px 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.view--login .lg-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
}
.view--login .lg-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.2rem;
  color: #fff;
  letter-spacing: -.5px;
  animation: logoIn .6s var(--ease) both;
}
.view--login .lg-logo span { color: var(--amber); }
.view--login .lg-tagline {
  font-size: .85rem;
  color: rgba(255,255,255,.7);
  text-align: center;
  line-height: 1.5;
  max-width: 240px;
  animation: logoIn .6s .1s var(--ease) both;
}
.view--login .lg-welcome-pill {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 99px;
  padding: 7px 16px;
  animation: logoIn .6s .2s var(--ease) both;
}
.view--login .lg-welcome-dot {
  width: 7px; height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s ease-in-out infinite;
}
.view--login .lg-welcome-text {
  font-family: var(--font-display);
  font-size: .75rem; font-weight: 600;
  color: rgba(255,255,255,.9);
}

/* Estados del login */
.lg-state { display: none; }
.lg-state.is-active { display: flex; }

.lg-state--form {
  flex: 1;
  flex-direction: column;
  padding: 28px 24px 32px;
  gap: 20px;
  overflow-y: auto;
}
.lg-section-head { animation: up .5s .25s var(--ease) both; }
.lg-section-title {
  font-family: var(--font-display);
  font-weight: 800; font-size: 1.3rem;
  color: var(--text);
  margin-bottom: 5px;
  line-height: 1.2;
}
.lg-section-sub { font-size: .82rem; color: var(--text-muted); line-height: 1.55; }
.lg-form { display: flex; flex-direction: column; gap: 14px; animation: up .5s .35s var(--ease) both; }
.lg-input-group { display: flex; flex-direction: column; gap: 6px; }
.lg-input-label {
  font-family: var(--font-display);
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted);
}
.lg-input-wrap { position: relative; display: flex; align-items: center; }
.lg-input-wrap .field { padding-right: 46px; }
.lg-input-icon {
  position: absolute; right: 14px;
  font-size: 1rem; color: var(--text-muted);
  pointer-events: none;
}
.lg-error-msg {
  display: none;
  font-size: .72rem; color: var(--red);
  font-weight: 500; padding-left: 4px;
}
.lg-error-msg.is-visible { display: block; animation: up .3s var(--ease) both; }
.lg-info-box {
  background: var(--purple-pale);
  border: 1px solid var(--purple-mid);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; gap: 10px; align-items: flex-start;
}
.lg-info-box__icon { font-size: .85rem; flex-shrink: 0; margin-top: 1px; }
.lg-info-box__text { font-size: .75rem; color: var(--text-mid); line-height: 1.5; }
.lg-info-box__text strong { color: var(--purple); font-weight: 600; }
.lg-divider { display: flex; align-items: center; gap: 12px; animation: up .5s .5s var(--ease) both; }
.lg-divider__line { flex: 1; height: 1px; background: var(--border); }
.lg-divider__text { font-size: .72rem; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.lg-trust { display: flex; gap: 8px; animation: up .5s .55s var(--ease) both; }
.lg-trust__item {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center;
}
.lg-trust__icon { font-size: 1.1rem; }
.lg-trust__text { font-size: .62rem; color: var(--text-muted); font-weight: 500; line-height: 1.3; }
.lg-footer { text-align: center; font-size: .72rem; color: var(--text-muted); animation: up .5s .6s var(--ease) both; padding-top: 4px; }
.lg-footer a { font-weight: 500; }

/* Estados alternativos del login (formulario pendiente / éxito) */
.lg-state--alt {
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 24px;
  gap: 20px;
  text-align: center;
}
.lg-alt-circle {
  width: 80px; height: 80px;
  border-radius: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  animation: popIn .5s var(--ease) both;
}
.lg-alt-circle--purple { background: var(--grad-primary); box-shadow: 0 8px 24px rgba(107,70,193,.3); }
.lg-alt-circle--amber { background: linear-gradient(135deg, #F59E0B, #FBBF24); box-shadow: 0 8px 24px rgba(245,158,11,.3); }
.lg-alt-title { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; color: var(--text); line-height: 1.2; }
.lg-alt-sub { font-size: .85rem; color: var(--text-muted); line-height: 1.6; max-width: 270px; }
.lg-alt-badge {
  border-radius: 12px;
  padding: 10px 18px;
  font-family: var(--font-display);
  font-size: .85rem; font-weight: 700;
  background: var(--purple-pale);
  border: 1px solid var(--purple-mid);
  color: var(--purple);
}
.lg-steps { width: 100%; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.lg-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 12px;
  animation: up .4s var(--ease) both;
}
.lg-step:nth-child(1) { animation-delay: .1s; }
.lg-step:nth-child(2) { animation-delay: .2s; }
.lg-step:nth-child(3) { animation-delay: .3s; }
.lg-step__num {
  width: 24px; height: 24px;
  border-radius: 8px;
  background: var(--purple-pale);
  border: 1px solid var(--purple-mid);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: .7rem; font-weight: 800;
  color: var(--purple);
  flex-shrink: 0;
}
.lg-step__text { font-size: .78rem; color: var(--text-mid); line-height: 1.45; }
.lg-step__text strong { color: var(--text); font-weight: 600; }
.lg-progress-track { width: 100%; background: var(--border); border-radius: 99px; height: 4px; overflow: hidden; }
.lg-progress-fill { height: 100%; width: 0; background: var(--grad-bar); border-radius: 99px; transition: width 1.8s var(--ease); }
.lg-actions { width: 100%; display: flex; flex-direction: column; gap: 12px; }

/* El estado "formulario pendiente" tiene más contenido que el espacio
   disponible: se hace scrolleable. "safe center" mantiene el contenido
   centrado cuando entra, y cae a "start" (scroll desde arriba) cuando no. */
#lgStateFormulario {
  justify-content: safe center;
  overflow-y: auto;
  padding-bottom: 32px;
}

/* ══ 5.2 VISTA TEST ══ */
.view--test .ts-screen { display: none; flex: 1; min-height: 0; flex-direction: column; overflow: hidden; }
.view--test .ts-screen.is-active { display: flex; animation: viewIn .3s var(--ease) both; }
.ts-progress {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
}
.ts-back {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; color: var(--text-mid);
  flex-shrink: 0;
  transition: background .15s;
}
.ts-back:hover { background: var(--purple-pale); color: var(--purple); }
.ts-back.is-disabled { opacity: .3; pointer-events: none; }
.ts-dots { display: flex; gap: 5px; flex: 1; }
.ts-dot { height: 4px; border-radius: 99px; flex: 1; background: var(--border); transition: all .4s; }
.ts-dot.is-done { background: var(--purple-light); opacity: .5; }
.ts-dot.is-active { background: var(--purple); }
.ts-badge { font-family: var(--font-display); font-size: .72rem; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.ts-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 20px; display: flex; flex-direction: column; gap: 16px; }

.ts-tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--purple-pale);
  border: 1px solid var(--purple-mid);
  border-radius: 99px;
  padding: 4px 12px;
  font-family: var(--font-display);
  font-size: .7rem; font-weight: 700;
  color: var(--purple);
  margin-bottom: 10px;
}
.ts-tag--green { background: linear-gradient(135deg,#F0FDF4,var(--green-pale)); border-color: var(--green-mid); color: #059669; }
.ts-title { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; color: var(--text); margin-bottom: 6px; line-height: 1.2; }
.ts-sub { font-size: .82rem; color: var(--text-muted); line-height: 1.55; }
.ts-sub strong { color: var(--text-mid); }
.ts-center { text-align: center; }

.ts-whero {
  background: var(--grad-hero-v);
  border-radius: 22px;
  padding: 28px 24px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  position: relative; overflow: hidden;
  color: #fff;
}
.ts-whero::before {
  content: ''; position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
}
.ts-whero__logo { font-family: var(--font-display); font-weight: 800; font-size: 2rem; }
.ts-whero__logo span { color: var(--amber); }
.ts-whero__sub { font-size: .85rem; color: rgba(255,255,255,.75); line-height: 1.5; max-width: 260px; }
.ts-whero__pill {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 99px;
  padding: 6px 14px;
  font-family: var(--font-display);
  font-size: .75rem; font-weight: 600;
  color: rgba(255,255,255,.9);
}

.ts-metrics-row { display: flex; gap: 8px; }
.ts-metric-prev {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  padding: 12px 8px;
  text-align: center;
}
.ts-metric-prev__icon { font-size: 1.1rem; margin-bottom: 4px; }
.ts-metric-prev__name { font-family: var(--font-display); font-size: .7rem; font-weight: 700; color: var(--text-mid); }
.ts-metric-prev__sub { font-size: .62rem; color: var(--text-muted); margin-top: 2px; line-height: 1.3; }

.ts-icard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  display: flex; gap: 12px; align-items: flex-start;
}
.ts-icard__icon {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.ts-icard__title { font-family: var(--font-display); font-weight: 700; font-size: .88rem; color: var(--text); margin-bottom: 3px; }
.ts-icard__text { font-size: .78rem; color: var(--text-muted); line-height: 1.5; }
.ts-icard__text strong { color: var(--text-mid); }

.ts-qcard {
  background: linear-gradient(135deg, var(--purple-pale), #F5F0FF);
  border: 1.5px solid var(--purple-mid);
  border-radius: var(--r);
  padding: 18px;
  text-align: center;
}
.ts-qcard--green { background: linear-gradient(135deg,#F0FDF4,var(--green-pale)); border-color: var(--green-mid); }
.ts-qcard__label {
  font-family: var(--font-display);
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--purple);
  margin-bottom: 10px;
}
.ts-qcard--green .ts-qcard__label { color: #059669; }
.ts-qcard__loading { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--text-muted); font-size: .82rem; }
.ts-qcard__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--purple-mid); animation: typingBounce 1.2s ease-in-out infinite; }
.ts-qcard__dot:nth-child(2) { animation-delay: .2s; }
.ts-qcard__dot:nth-child(3) { animation-delay: .4s; }
.ts-qcard__text { font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--text); line-height: 1.4; }
.ts-qcard--green .ts-qcard__text { color: #065F46; }

/* Timer block */
.ts-timer-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.ts-timer-steps { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.ts-tstep {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--rsm);
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: .78rem; color: var(--text-muted);
  line-height: 1.35;
  transition: all .3s;
}
.ts-tstep.is-active { background: var(--purple-pale); border-color: var(--purple-mid); color: var(--text-mid); }
.ts-tstep.is-done { background: var(--green-pale); border-color: var(--green-mid); color: #065F46; }
.ts-tstep__icon { font-size: .9rem; flex-shrink: 0; margin-top: 1px; }
.ts-tstep__text strong { font-weight: 600; color: inherit; }

.ts-ring { position: relative; width: 110px; height: 110px; }
.ts-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ts-ring__track { fill: none; stroke: var(--purple-pale); stroke-width: 6; }
.ts-ring__fill {
  fill: none;
  stroke: var(--purple);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 238;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke .5s;
}
.ts-ring__fill.is-done { stroke: var(--green); }
.ts-ring__fill.is-counting { stroke: var(--amber); transition: stroke-dashoffset .4s ease, stroke .3s; }
.ts-ring__num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ts-ring__big { font-family: var(--font-display); font-weight: 800; font-size: 1.8rem; color: var(--text); line-height: 1; }
.ts-ring__label { font-family: var(--font-display); font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); }

.ts-start-btn {
  width: 100%;
  background: var(--grad-primary);
  border: none;
  border-radius: 14px;
  padding: 15px 20px;
  font-family: var(--font-display);
  font-size: .95rem; font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 14px rgba(107,70,193,.35);
  transition: all .15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  letter-spacing: .3px;
}
.ts-start-btn:hover { transform: translateY(-1px); }
.ts-start-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.ts-start-btn.is-running { background: linear-gradient(135deg,#EF4444,#F87171); box-shadow: 0 4px 14px rgba(239,68,68,.3); }
.ts-start-btn.is-finished { background: linear-gradient(135deg,var(--green),#059669); box-shadow: 0 4px 14px rgba(16,185,129,.3); }

.ts-textarea {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.ts-textarea.is-active { border-color: var(--purple-light); box-shadow: 0 0 0 3px rgba(107,70,193,.08); }
.ts-textarea__label {
  font-family: var(--font-display);
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted);
}
.ts-textarea__field {
  width: 100%;
  border: none; background: transparent;
  font-family: var(--font-body);
  font-size: .875rem; color: var(--text);
  resize: none; outline: none;
  line-height: 1.55;
  min-height: 80px; max-height: 160px;
  overflow-y: auto; word-break: break-word; white-space: pre-wrap;
}
.ts-textarea__field::placeholder { color: var(--text-muted); font-style: italic; }
.ts-textarea__footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.ts-textarea__count { font-size: .68rem; color: var(--text-muted); font-weight: 500; }
.ts-textarea__count strong { color: var(--purple); font-family: var(--font-display); }
.ts-textarea__hint { font-size: .65rem; color: var(--text-muted); font-style: italic; }

.ts-hint {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  padding: 12px 14px;
  display: flex; gap: 8px; align-items: flex-start;
}
.ts-hint__icon { font-size: .9rem; flex-shrink: 0; margin-top: 1px; }
.ts-hint__text { font-size: .75rem; color: var(--text-muted); line-height: 1.45; }
.ts-hint__text strong { color: var(--purple); font-weight: 600; }

.ts-ptcard {
  background: linear-gradient(135deg, #F8F6FF, var(--purple-pale));
  border: 1.5px solid var(--purple-mid);
  border-radius: var(--r);
  padding: 16px;
}
.ts-ptcard__label {
  font-family: var(--font-display);
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--purple);
  margin-bottom: 10px;
}
.ts-ptcard__text { font-size: .875rem; color: var(--text); line-height: 1.7; font-style: italic; }
.ts-ptcard__text .hl { color: var(--purple); font-weight: 600; font-style: normal; }

/* Tarjeta de resultados (gráfico) — compartida con test-resultado */
.result-card { background: #fff; border-radius: 18px; border: 1px solid var(--border); }
.result-card__hdr {
  background: var(--grad-hero);
  border-radius: 18px 18px 0 0;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.result-card__hdr::before {
  content: ''; position: absolute;
  top: -20px; right: -20px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
}
.result-card__hdr-inner { display: flex; align-items: flex-start; justify-content: space-between; position: relative; z-index: 1; }
.result-card__label {
  font-family: var(--font-display);
  font-size: .65rem; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: rgba(255,255,255,.6);
  margin-bottom: 3px;
}
.result-card__name { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: #fff; }
.result-card__date { font-size: .68rem; color: rgba(255,255,255,.5); margin-top: 2px; }
.result-card__badge {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 99px;
  padding: 4px 10px;
  font-family: var(--font-display);
  font-size: .65rem; font-weight: 600;
  color: rgba(255,255,255,.85);
  white-space: nowrap; flex-shrink: 0;
}
.result-card__body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* Métrica con barra */
.metric { display: flex; flex-direction: column; gap: 8px; }
.metric__hdr { display: flex; align-items: center; justify-content: space-between; }
.metric__label { display: flex; align-items: center; gap: 8px; }
.metric__icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; flex-shrink: 0;
}
.metric__name { font-family: var(--font-display); font-weight: 700; font-size: .82rem; color: var(--text); }
.metric__name-sub { font-size: .65rem; color: var(--text-muted); margin-top: 1px; }
.metric__value { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; line-height: 1; }
.metric__divider { height: 1px; background: var(--border); }
.metric--fl .metric__icon { background: var(--green-pale); }
.metric--fl .metric__value { color: var(--green); }
.metric--fl .bar-fill { background: linear-gradient(90deg, rgba(16,185,129,.4), var(--green)); }
.metric--im .metric__icon { background: var(--amber-light); }
.metric--im .metric__value { color: var(--amber); }
.metric--im .bar-fill { background: linear-gradient(90deg, rgba(245,158,11,.4), var(--amber)); }
.metric--pr .metric__icon { background: var(--purple-pale); }
.metric--pr .metric__value { color: var(--purple); }
.metric--pr .bar-fill { background: linear-gradient(90deg, rgba(107,70,193,.4), var(--purple)); }
.metric.is-locked { opacity: .45; }
.metric__lockbox {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--font-display);
  font-size: .68rem; font-weight: 700;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
}
.bar-locked {
  height: 8px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.bar-locked__fill {
  height: 100%;
  background: repeating-linear-gradient(90deg, transparent, transparent 8px, var(--border) 8px, var(--border) 12px);
  border-radius: 99px;
}

.ts-fbcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; }
.ts-fbcard__title { font-family: var(--font-display); font-weight: 700; font-size: .8rem; color: var(--text); margin-bottom: 10px; }
.ts-fb-item { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.ts-fb-item:last-child { margin-bottom: 0; }
.ts-fb-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.ts-fb-text { font-size: .8rem; color: var(--text-muted); line-height: 1.45; }
.ts-fb-text em { font-style: italic; color: var(--text-mid); font-weight: 500; }

.ts-n48 {
  background: linear-gradient(135deg, var(--amber-pale), #FFF9ED);
  border: 1.5px solid #FDE68A;
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex; gap: 10px; align-items: center;
}
.ts-n48__icon {
  width: 36px; height: 36px;
  background: var(--amber);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(245,158,11,.3);
}
.ts-n48__text { font-size: .78rem; color: #92400E; line-height: 1.45; }
.ts-n48__text strong { color: #78350F; font-weight: 700; }

.ts-nscard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex; gap: 12px; align-items: flex-start;
}
.ts-nscard__num {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--purple-pale);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800; font-size: .78rem;
  color: var(--purple);
  flex-shrink: 0; margin-top: 1px;
}
.ts-nscard__title { font-family: var(--font-display); font-weight: 700; font-size: .85rem; color: var(--text); margin-bottom: 3px; }
.ts-nscard__text { font-size: .75rem; color: var(--text-muted); line-height: 1.45; }
.ts-nscard__text strong { color: var(--text-mid); font-weight: 600; }

.ts-goal-card {
  background: linear-gradient(135deg, var(--amber-pale), #FFF9ED);
  border: 1.5px solid #FDE68A;
  border-radius: var(--r);
  padding: 16px;
  display: flex; gap: 12px; align-items: center;
}
.ts-goal-card__emoji { font-size: 1.8rem; flex-shrink: 0; }
.ts-goal-card__title { font-family: var(--font-display); font-weight: 700; font-size: .85rem; color: #78350F; margin-bottom: 3px; }
.ts-goal-card__text { font-size: .78rem; color: #92400E; line-height: 1.45; }
.ts-goal-card__text strong { font-weight: 700; }

.ts-section-head { font-family: var(--font-display); font-weight: 700; font-size: .88rem; color: var(--text); }

.btn-result {
  width: 100%;
  background: #fff;
  border: 1.5px solid var(--purple-mid);
  border-radius: 18px;
  padding: 14px;
  font-family: var(--font-display);
  font-size: .85rem; font-weight: 600;
  color: var(--purple);
  transition: all .15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-result:hover { background: var(--purple-pale); }
.btn-result:disabled { opacity: .5; cursor: not-allowed; border-color: var(--border); color: var(--text-muted); }
.btn-result.is-active {
  background: var(--grad-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(107,70,193,.3);
}

/* ══ 5.3 VISTA TEST-RESULTADO ══ */
.view--test-resultado .tr-header-sub { flex: 1; font-size: .75rem; color: var(--text-muted); }
.tr-spill {
  display: flex; align-items: center; gap: 6px;
  background: var(--amber-light);
  border: 1px solid #FDE68A;
  border-radius: 99px;
  padding: 5px 12px;
  font-family: var(--font-display);
  font-size: .72rem; font-weight: 600;
  color: #92400E;
}
.tr-spill__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); animation: pulse 2s ease-in-out infinite; }
.tr-spill__dot.is-ok { background: var(--green); animation: none; }

.tr-student-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.tr-avatar {
  width: 42px; height: 42px;
  border-radius: 14px;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800; font-size: 1.1rem;
  color: #fff; flex-shrink: 0;
}
.tr-student-info { flex: 1; }
.tr-student-name { font-family: var(--font-display); font-weight: 700; font-size: .9rem; color: var(--text); margin-bottom: 2px; }
.tr-student-meta { font-size: .72rem; color: var(--text-muted); }
.tr-student-badge {
  background: var(--purple-pale);
  border: 1px solid var(--purple-mid);
  border-radius: 8px;
  padding: 4px 10px;
  font-family: var(--font-display);
  font-size: .68rem; font-weight: 700;
  color: var(--purple);
}

.tr-feedback-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; }
.tr-feedback-card__title {
  font-family: var(--font-display);
  font-weight: 700; font-size: .72rem;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.tr-fb-item { display: flex; align-items: flex-start; gap: 8px; font-size: .78rem; color: var(--text-muted); line-height: 1.45; margin-bottom: 8px; }
.tr-fb-item:last-child { margin-bottom: 0; }
.tr-fb-dot { width: 5px; height: 5px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.tr-fb-item em { font-style: italic; }

.tr-link-row { text-align: center; padding: 4px 0 8px; }
.tr-link {
  font-family: var(--font-display);
  font-size: .78rem; font-weight: 600;
  color: var(--purple);
  border-bottom: 1px solid var(--purple-mid);
  padding-bottom: 2px;
}

/* Barra demo (sólo visible en DEMO_MODE) */
.demo-bar {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.demo-bar[hidden] { display: none; }
.demo-bar__label {
  font-family: var(--font-display);
  font-size: .68rem; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  flex-shrink: 0;
}
.demo-bar__btn {
  background: var(--purple-pale);
  border: 1px solid var(--purple-mid);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--font-display);
  font-size: .72rem; font-weight: 600;
  color: var(--purple);
  transition: background .15s;
}
.demo-bar__btn:hover { background: var(--purple); color: #fff; }

/* ══ 5.4 VISTA CHAT ══ */
.ch-header { gap: 12px; padding: 0 16px; }
.ch-avatar {
  width: 42px; height: 42px;
  border-radius: 14px;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800; font-size: 1.05rem;
  color: #fff; flex-shrink: 0;
  position: relative;
}
.ch-avatar::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 12px; height: 12px;
  background: var(--green);
  border: 2.5px solid var(--surface);
  border-radius: 50%;
}
.ch-header__info { flex: 1; min-width: 0; }
.ch-header__name { font-family: var(--font-display); font-weight: 700; font-size: .95rem; color: var(--text); line-height: 1.2; }
.ch-header__sub { font-size: .72rem; color: var(--text-muted); }
.ch-header__btn {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: background .15s;
  flex-shrink: 0;
}
.ch-header__btn:hover { background: var(--purple-pale); }

.ch-step-bar {
  background: var(--surface);
  padding: 10px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ch-step-bar__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ch-step-bar__label {
  font-family: var(--font-display);
  font-size: .7rem; font-weight: 700;
  color: var(--purple);
  text-transform: uppercase; letter-spacing: .8px;
}
.ch-step-bar__count { font-size: .7rem; color: var(--text-muted); font-weight: 500; }

.ch-tokens-bar {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 7px 20px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.ch-tokens-bar__label { font-size: .68rem; color: var(--text-muted); font-weight: 500; }
.ch-tokens-bar__right { display: flex; align-items: center; gap: 8px; }
.ch-tokens-bar__track { width: 80px; height: 3px; background: var(--border); border-radius: 99px; overflow: hidden; }
.ch-tokens-bar__fill { height: 100%; background: var(--grad-bar); border-radius: 99px; transition: width .5s; }
.ch-tokens-bar__fill.is-warning { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.ch-tokens-bar__fill.is-danger { background: linear-gradient(90deg, #EF4444, #F87171); }
.ch-tokens-bar__count { font-family: var(--font-display); font-size: .72rem; font-weight: 700; color: var(--text-mid); }
.ch-tokens-bar__count.is-warning { color: #F59E0B; }
.ch-tokens-bar__count.is-danger { color: #EF4444; }

.ch-area {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.ch-area::-webkit-scrollbar { width: 3px; }
.ch-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.ch-date-sep { display: flex; align-items: center; gap: 10px; margin: 4px 0; }
.ch-date-sep__line { flex: 1; height: 1px; background: var(--border); }
.ch-date-sep__text { font-size: .67rem; color: var(--text-muted); font-weight: 500; white-space: nowrap; }

.ch-msg { display: flex; gap: 8px; align-items: flex-end; animation: msgIn .3s var(--ease) both; }
.ch-msg--user { flex-direction: row-reverse; }
.ch-msg__avatar {
  width: 28px; height: 28px;
  border-radius: 9px;
  flex-shrink: 0;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: .7rem; font-weight: 700;
  color: #fff;
}
.ch-msg__bubble {
  max-width: 75%;
  padding: 11px 14px;
  border-radius: var(--r);
  font-size: .875rem;
  line-height: 1.55;
}
.ch-msg--ai .ch-msg__bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(107,70,193,.06);
}
.ch-msg--user .ch-msg__bubble {
  background: var(--grad-primary);
  border-bottom-right-radius: 5px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(107,70,193,.3);
}
.ch-msg__time { font-size: .6rem; color: var(--text-muted); margin-top: 3px; padding: 0 4px; }
.ch-msg--user .ch-msg__time { text-align: right; }

/* Tarjeta de palabras dentro del chat */
.ch-wcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(107,70,193,.06);
  max-width: 85%;
}
.ch-wcard__hdr {
  background: var(--grad-primary);
  padding: 11px 14px;
  display: flex; align-items: center; gap: 8px;
}
.ch-wcard__hdr-icon {
  width: 26px; height: 26px;
  background: rgba(255,255,255,.2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem;
}
.ch-wcard__title { font-family: var(--font-display); font-weight: 700; font-size: .8rem; color: #fff; }
.ch-wcard__body { padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
.ch-wli {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: var(--bg);
  border-radius: var(--rsm);
  border: 1px solid var(--border);
}
.ch-wli__num {
  width: 22px; height: 22px; min-width: 22px;
  background: var(--purple-pale);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: .62rem; font-weight: 700;
  color: var(--purple);
  flex-shrink: 0;
}
.ch-wli__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ch-wli__en { font-family: var(--font-display); font-weight: 800; font-size: .9rem; color: var(--text); line-height: 1; }
.ch-wli__pron { font-size: .65rem; color: var(--text-muted); font-style: italic; letter-spacing: .3px; }
.ch-wli__es {
  font-family: var(--font-display);
  font-size: .72rem; font-weight: 600;
  color: var(--purple);
  background: var(--purple-pale);
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap; flex-shrink: 0;
}
.ch-wcard__ctx { padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface2); }
.ch-wcard__ctx-label {
  font-family: var(--font-display);
  font-size: .62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--amber);
  margin-bottom: 6px;
}
.ch-wli--ctx {
  background: linear-gradient(135deg, var(--amber-pale), #FFF9ED);
  border: 1px solid #FDE68A;
  margin-bottom: 5px;
}
.ch-wli--ctx:last-child { margin-bottom: 0; }
.ch-wli--ctx .ch-wli__num { background: var(--amber-light); color: #92400E; }
.ch-wli--ctx .ch-wli__en { color: #78350F; }
.ch-wli--ctx .ch-wli__pron { color: #92400E; opacity: .7; }
.ch-wli--ctx .ch-wli__es { background: var(--amber-light); color: #92400E; border: 1px solid #FDE68A; }

/* Typing indicator */
.ch-typing { display: flex; align-items: flex-end; gap: 8px; }
.ch-typing__bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  border-bottom-left-radius: 5px;
  padding: 12px 16px;
  display: flex; gap: 4px; align-items: center;
  box-shadow: 0 1px 3px rgba(107,70,193,.06);
}
.ch-typing__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: typingBounce 1.2s ease-in-out infinite; }
.ch-typing__dot:nth-child(2) { animation-delay: .2s; }
.ch-typing__dot:nth-child(3) { animation-delay: .4s; }

/* Quick replies */
.ch-quick-replies { display: flex; gap: 7px; flex-wrap: wrap; padding: 0 4px; }
.ch-qr-btn {
  background: var(--surface);
  border: 1.5px solid var(--purple-mid);
  border-radius: 99px;
  padding: 7px 14px;
  font-family: var(--font-body);
  font-size: .78rem; font-weight: 500;
  color: var(--purple);
  transition: all .15s;
}
.ch-qr-btn:hover { background: var(--purple); color: #fff; border-color: var(--purple); }

/* Banner de límite alcanzado */
.ch-limit-banner {
  background: linear-gradient(135deg, #FEF2F2, #FFF5F5);
  border: 1.5px solid #FECACA;
  border-radius: 14px;
  padding: 12px 16px;
  display: flex; gap: 10px; align-items: center;
}
.ch-limit-banner__icon { font-size: 1.2rem; flex-shrink: 0; }
.ch-limit-banner__text { font-size: .78rem; color: #7F1D1D; line-height: 1.45; }
.ch-limit-banner__text strong { color: #991B1B; font-weight: 700; }

/* Barra de input del chat */
.ch-input-bar {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 16px 16px;
  flex-shrink: 0;
}
.ch-finish-bar {
  display: flex;
  margin-bottom: 10px;
}
.ch-finish-bar[hidden] { display: none; }
.ch-finish-btn {
  flex: 1;
  background: var(--green-pale);
  color: var(--green);
  border: 1px solid var(--green-mid);
  border-radius: 14px;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s, transform .1s;
}
.ch-finish-btn:hover { filter: brightness(.97); }
.ch-finish-btn:active { transform: scale(.99); }
.ch-input-row { display: flex; align-items: flex-end; gap: 10px; }
.ch-input-wrap {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  display: flex; align-items: flex-end; gap: 6px;
  padding: 10px 12px;
  transition: border-color .2s;
}
.ch-input-wrap:focus-within { border-color: var(--purple-light); background: #fff; box-shadow: 0 0 0 3px rgba(107,70,193,.06); }
.ch-input-field {
  flex: 1;
  border: none; background: transparent;
  font-family: var(--font-body);
  font-size: .9rem; color: var(--text);
  resize: none; outline: none;
  max-height: 100px; min-height: 22px;
  line-height: 1.4;
}
.ch-input-field::placeholder { color: var(--text-muted); }
.ch-input-field:disabled { color: var(--text-muted); }
.ch-paste-btn {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: transparent; border: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 1rem;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.ch-paste-btn:hover { color: var(--purple); background: var(--purple-pale); }
.ch-send-btn {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--purple);
  border: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem;
  transition: all .15s;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(107,70,193,.35);
}
.ch-send-btn:hover { background: var(--purple-light); transform: scale(1.05); }
.ch-send-btn:active { transform: scale(.97); }
.ch-send-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ══ 5.5 VISTA PALABRAS ══ */
.pw-week-badge {
  background: var(--purple-pale);
  border: 1px solid var(--purple-mid);
  border-radius: 99px;
  padding: 5px 12px;
  font-family: var(--font-display);
  font-size: .75rem; font-weight: 600;
  color: var(--purple);
}
.pw-weeks-bar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 16px; flex-shrink: 0; }
.pw-tabs { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.pw-tabs::-webkit-scrollbar { display: none; }
.pw-tab {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 99px;
  font-family: var(--font-display);
  font-size: .75rem; font-weight: 600;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  transition: all .15s;
  white-space: nowrap;
}
.pw-tab.is-active { background: var(--purple); border-color: var(--purple); color: #fff; box-shadow: 0 2px 8px rgba(107,70,193,.3); }
.pw-tab.is-locked { opacity: .4; cursor: not-allowed; }

.pw-progress-row { background: var(--surface); padding: 10px 20px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.pw-progress-info { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pw-progress-label { font-size: .78rem; color: var(--text-mid); font-weight: 500; }
.pw-progress-label strong { color: var(--purple); font-family: var(--font-display); font-weight: 700; }
.pw-progress-pct { font-family: var(--font-display); font-size: .78rem; font-weight: 700; color: var(--purple); }
.pw-progress-track { height: 5px; background: var(--purple-pale); border-radius: 99px; overflow: hidden; }
.pw-progress-fill { height: 100%; background: var(--grad-bar); border-radius: 99px; transition: width .6s var(--ease); }

.pw-day-chips { display: flex; gap: 6px; padding: 12px 16px 8px; flex-shrink: 0; overflow-x: auto; scrollbar-width: none; }
.pw-day-chips::-webkit-scrollbar { display: none; }
.pw-day-chip {
  flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  transition: all .15s;
  min-width: 52px;
}
.pw-day-chip.is-active { background: var(--purple); border-color: var(--purple); box-shadow: 0 4px 12px rgba(107,70,193,.3); }
.pw-day-chip.is-completed { background: var(--green-pale); border-color: var(--green-mid); }
.pw-day-chip.is-locked { opacity: .4; cursor: not-allowed; }
.pw-day-chip__icon { font-size: 1rem; }
.pw-day-chip__name {
  font-family: var(--font-display);
  font-size: .62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted);
}
.pw-day-chip.is-active .pw-day-chip__name { color: rgba(255,255,255,.8); }
.pw-day-chip.is-completed .pw-day-chip__name { color: #065F46; }
.pw-day-chip__type { font-size: .58rem; color: var(--text-muted); font-weight: 500; text-align: center; line-height: 1.2; }
.pw-day-chip.is-active .pw-day-chip__type { color: rgba(255,255,255,.7); }
.pw-day-chip.is-completed .pw-day-chip__type { color: #065F46; opacity: .7; }

.pw-scroll { padding: 12px 16px 16px; gap: 10px; }
.pw-day-header { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.pw-day-header__icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
}
.pw-day-header__title { font-family: var(--font-display); font-weight: 700; font-size: .88rem; color: var(--text); }
.pw-day-header__sub { font-size: .7rem; color: var(--text-muted); }

.pw-completed-banner {
  background: linear-gradient(135deg, var(--green-pale), #ECFDF5);
  border: 1.5px solid var(--green-mid);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.pw-completed-banner__icon {
  width: 36px; height: 36px;
  background: var(--green);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.pw-completed-banner__title { font-family: var(--font-display); font-weight: 700; font-size: .85rem; color: #065F46; margin-bottom: 2px; }
.pw-completed-banner__text { font-size: .72rem; color: #059669; }

.pw-locked-day {
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--r);
  padding: 28px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
}
.pw-locked-day__icon {
  width: 48px; height: 48px;
  background: var(--surface2);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.pw-locked-day__title { font-family: var(--font-display); font-weight: 700; font-size: .9rem; color: var(--text-mid); }
.pw-locked-day__text { font-size: .78rem; color: var(--text-muted); line-height: 1.45; max-width: 220px; }
.pw-locked-day__btn {
  background: var(--purple-pale);
  border: 1px solid var(--purple-mid);
  border-radius: 99px;
  padding: 5px 14px;
  font-family: var(--font-display);
  font-size: .72rem; font-weight: 600;
  color: var(--purple);
}

/* ══ 5.6 VISTA PROGRESO ══ */
.pg-test-btn {
  background: var(--grad-primary);
  border: none;
  border-radius: 99px;
  padding: 8px 14px;
  font-family: var(--font-display);
  font-size: .73rem; font-weight: 700;
  color: #fff;
  box-shadow: 0 3px 8px rgba(107,70,193,.3);
  transition: all .15s;
  white-space: nowrap;
}
.pg-test-btn:hover { transform: translateY(-1px); }

.pg-hero-card { background: #fff; border-radius: 18px; border: 1px solid var(--border); }
.pg-hero-metrics { display: flex; gap: 10px; padding: 16px; }
.pg-hero-metric {
  flex: 1;
  background: rgba(107,70,193,.08);
  border: 1px solid rgba(107,70,193,.12);
  border-radius: 14px;
  padding: 12px 10px;
  text-align: center;
}
.pg-hero-metric__icon { font-size: 1rem; margin-bottom: 4px; }
.pg-hero-metric__pct { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; line-height: 1; margin-bottom: 2px; }
.pg-hero-metric__name { font-size: .62rem; color: var(--text-muted); font-weight: 500; line-height: 1.2; }
.pg-hero-metric__delta {
  display: inline-flex; align-items: center; gap: 2px;
  font-family: var(--font-display);
  font-size: .6rem; font-weight: 700;
  margin-top: 4px;
  padding: 1px 5px;
  border-radius: 99px;
  background: var(--green-pale);
  color: #065F46;
}

.pg-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pg-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  padding: 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.pg-stat-card__icon { font-size: 1.2rem; line-height: 1; }
.pg-stat-card__value { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; color: var(--text); line-height: 1; }
.pg-stat-card__value span { font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.pg-stat-card__label { font-size: .72rem; color: var(--text-muted); font-weight: 400; line-height: 1.3; }
.pg-stat-card__delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--font-display);
  font-size: .68rem; font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
}
.pg-stat-card__delta.is-green { background: var(--green-pale); color: #065F46; }
.pg-stat-card__delta.is-amber { background: var(--amber-light); color: #92400E; }
.pg-stat-card__delta.is-purple { background: var(--purple-pale); color: var(--purple); }

.pg-chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; }
.pg-calendar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pg-cal-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.pg-cal-day.is-done { background: var(--green-pale); border-color: var(--green-mid); }
.pg-cal-day.is-today { background: var(--purple-pale); border-color: var(--purple-mid); border-width: 1.5px; }
.pg-cal-day__name {
  font-family: var(--font-display);
  font-size: .6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted);
}
.pg-cal-day.is-done .pg-cal-day__name { color: #065F46; }
.pg-cal-day.is-today .pg-cal-day__name { color: var(--purple); }
.pg-cal-day__icon { font-size: 1rem; }
.pg-cal-day__meta { font-size: .58rem; color: var(--text-muted); font-weight: 500; text-align: center; }
.pg-cal-day.is-done .pg-cal-day__meta { color: #059669; }
.pg-cal-day.is-today .pg-cal-day__meta { color: var(--purple); font-weight: 600; }

.pg-chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pg-chart-header__title { font-family: var(--font-display); font-weight: 700; font-size: .85rem; color: var(--text); }
.pg-chart-header__sub { font-size: .7rem; color: var(--text-muted); margin-top: 1px; }
.pg-chart-legend { display: flex; gap: 10px; }
.pg-chart-legend__item { display: flex; align-items: center; gap: 4px; font-size: .65rem; color: var(--text-muted); font-weight: 500; }
.pg-chart-legend__dot { width: 7px; height: 7px; border-radius: 50%; }
.pg-chart-legend__dot--real { background: var(--purple); }
.pg-chart-legend__dot--meta { background: var(--border); }
.pg-bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 100px; padding: 0 2px; }
.pg-bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.pg-bar-wrap { flex: 1; position: relative; width: 100%; height: 80px; display: flex; align-items: flex-end; }
.pg-bar-meta { height: 80px; background: var(--border); position: absolute; width: 100%; bottom: 0; left: 0; border-radius: 6px 6px 0 0; }
.pg-bar-real { height: 0; position: relative; z-index: 1; width: 100%; border-radius: 6px 6px 0 0; transition: height 1.2s var(--ease); }
.pg-bar-label { font-family: var(--font-display); font-size: .6rem; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.pg-bar-label.is-current { color: var(--purple); font-weight: 700; }

.pg-errors-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; }
.pg-error-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.pg-error-item:first-child { padding-top: 0; }
.pg-error-item:last-child { border-bottom: none; padding-bottom: 0; }
.pg-error-freq {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: #FFF1F2;
  border: 1px solid #FECDD3;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: .68rem; font-weight: 800;
  color: #BE123C;
  flex-shrink: 0;
}
.pg-error-wrong { font-size: .78rem; color: #BE123C; font-weight: 600; text-decoration: line-through; margin-bottom: 2px; }
.pg-error-right { font-size: .78rem; color: var(--green); font-weight: 600; }
.pg-error-note { font-size: .68rem; color: var(--text-muted); margin-top: 2px; line-height: 1.35; }

/* Historial de tests */
.pg-test-history { display: flex; flex-direction: column; gap: 8px; }
.pg-test-row-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.pg-test-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; transition: background .1s; }
.pg-test-row:hover { background: var(--surface2); }
.pg-test-row.is-pending { opacity: .45; cursor: default; }
.pg-test-row.is-pending:hover { background: transparent; }
.pg-test-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pg-test-info { flex: 1; min-width: 0; }
.pg-test-date { font-family: var(--font-display); font-weight: 700; font-size: .82rem; color: var(--text); margin-bottom: 3px; }
.pg-test-date.is-muted { color: var(--text-muted); }
.pg-test-mets { display: flex; gap: 10px; }
.pg-test-met { font-size: .72rem; color: var(--text-muted); font-weight: 500; }
.pg-test-met strong { color: var(--text-mid); font-weight: 700; }
.pg-test-met.is-italic { font-style: italic; }
.pg-test-arrow { font-size: 1.1rem; color: var(--text-muted); transition: transform .2s; flex-shrink: 0; }
.pg-test-arrow.is-open { transform: rotate(90deg); color: var(--purple); }
.pg-test-detail { padding: 0 16px 14px; display: none; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); }
.pg-test-detail.is-open { display: flex; }
.pg-test-bars { display: flex; flex-direction: column; gap: 7px; padding-top: 14px; }
.pg-test-bar-row { display: flex; align-items: center; gap: 8px; }
.pg-test-bar-label { font-size: .68rem; color: var(--text-muted); width: 96px; flex-shrink: 0; }
.pg-test-bar-track { flex: 1; height: 6px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.pg-test-bar-fill { height: 100%; width: 0; border-radius: 99px; transition: width 1s var(--ease); }
.pg-test-bar-fill.is-fl { background: linear-gradient(90deg, #6EE7B7, #10B981); }
.pg-test-bar-fill.is-im { background: linear-gradient(90deg, #FDE68A, #F59E0B); }
.pg-test-bar-fill.is-pr { background: linear-gradient(90deg, #C4B5FD, #6B46C1); }
.pg-test-bar-pct { font-family: var(--font-display); font-size: .68rem; font-weight: 700; color: var(--text-mid); width: 28px; text-align: right; flex-shrink: 0; }
.pg-test-actions { display: flex; gap: 8px; }
.pg-test-act-btn {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 9px;
  font-family: var(--font-display);
  font-size: .75rem; font-weight: 600;
  transition: opacity .15s;
}
.pg-test-act-btn:hover { opacity: .8; }
.pg-test-act-btn.is-dl { background: var(--purple-pale); color: var(--purple); }
.pg-test-act-btn.is-sk { background: var(--surface2); color: var(--text-mid); }

.pg-goal-card {
  background: linear-gradient(135deg, var(--amber-pale), #FFF9ED);
  border: 1.5px solid #FDE68A;
  border-radius: var(--r);
  padding: 16px;
  display: flex; gap: 12px; align-items: center;
}
.pg-goal-card__emoji { font-size: 1.8rem; flex-shrink: 0; }
.pg-goal-card__title { font-family: var(--font-display); font-weight: 700; font-size: .88rem; color: #78350F; margin-bottom: 4px; }
.pg-goal-card__text { font-size: .8rem; color: #92400E; line-height: 1.45; }
.pg-goal-card__text strong { font-weight: 700; }

/* ══ 5.7 VISTA PERFIL ══ */
.pf-hero {
  background: var(--grad-hero-v);
  padding: 48px 24px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  position: relative; overflow: hidden;
}
.pf-hero::before {
  content: ''; position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
}
.pf-settings-btn {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; z-index: 2;
}
.pf-avatar-wrap { position: relative; z-index: 1; }
.pf-avatar {
  width: 72px; height: 72px;
  border-radius: 22px;
  background: rgba(255,255,255,.2);
  border: 2px solid rgba(255,255,255,.3);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800; font-size: 1.8rem;
  color: #fff;
}
.pf-avatar-status {
  position: absolute; bottom: -2px; right: -2px;
  width: 16px; height: 16px;
  background: var(--green);
  border: 3px solid rgba(107,70,193,.8);
  border-radius: 50%;
}
.pf-name { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; color: #fff; text-align: center; position: relative; z-index: 1; }
.pf-sub { font-size: .78rem; color: rgba(255,255,255,.7); text-align: center; position: relative; z-index: 1; }
.pf-plan-badge {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 99px;
  padding: 6px 14px;
  position: relative; z-index: 1;
}
.pf-plan-dot { width: 7px; height: 7px; background: var(--amber); border-radius: 50%; box-shadow: 0 0 6px var(--amber); }
.pf-plan-text { font-family: var(--font-display); font-size: .75rem; font-weight: 600; color: rgba(255,255,255,.9); }
.pf-plan-link { font-family: var(--font-display); font-size: .72rem; font-weight: 700; color: var(--amber); }

.pf-qstats { display: flex; background: var(--surface); border-bottom: 1px solid var(--border); }
.pf-qstat { flex: 1; padding: 14px 8px; text-align: center; border-right: 1px solid var(--border); }
.pf-qstat:last-child { border-right: none; }
.pf-qstat__value { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; color: var(--text); margin-bottom: 3px; }
.pf-qstat__label { font-size: .65rem; color: var(--text-muted); font-weight: 500; line-height: 1.3; }

.pf-padded { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.pf-info-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.pf-info-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.pf-info-row:last-child { border-bottom: none; }
.pf-info-row:hover { background: var(--surface2); }
.pf-info-row.is-locked:hover { background: transparent; }
.pf-info-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; flex-shrink: 0;
}
.pf-info-body { flex: 1; min-width: 0; }
.pf-info-label { font-size: .68rem; color: var(--text-muted); font-weight: 500; margin-bottom: 2px; }
.pf-info-value { font-size: .85rem; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-info-arrow { font-size: 1rem; color: var(--text-muted); }
.pf-info-arrow.is-lock { font-size: .8rem; }

.pf-upgrade-card {
  background: linear-gradient(135deg, var(--amber-pale), #FFF8E7);
  border: 1.5px solid #FDE68A;
  border-radius: var(--r);
  padding: 16px;
  display: flex; gap: 14px; align-items: flex-start;
}
.pf-upgrade-card__icon {
  width: 42px; height: 42px;
  background: var(--amber);
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(245,158,11,.3);
}
.pf-upgrade-card__title { font-family: var(--font-display); font-weight: 800; font-size: .9rem; color: #78350F; margin-bottom: 4px; }
.pf-upgrade-card__text { font-size: .75rem; color: #92400E; line-height: 1.5; margin-bottom: 10px; }
.pf-upgrade-card__btn {
  background: var(--amber);
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-family: var(--font-display);
  font-size: .75rem; font-weight: 700;
  color: #fff;
}

.pf-drive-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  transition: background .1s;
}
.pf-drive-card:hover { background: var(--surface2); }
.pf-drive-icon {
  width: 38px; height: 38px;
  background: var(--green-pale);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.pf-drive-body { flex: 1; }
.pf-drive-title { font-family: var(--font-display); font-weight: 700; font-size: .85rem; color: var(--text); margin-bottom: 2px; }
.pf-drive-sub { font-size: .72rem; color: var(--text-muted); }
.pf-drive-status { display: flex; align-items: center; gap: 5px; font-family: var(--font-display); font-size: .68rem; font-weight: 600; color: var(--green); }
.pf-drive-status__dot { width: 6px; height: 6px; background: var(--green); border-radius: 50%; }

.pf-menu-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.pf-menu-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.pf-menu-row:last-child { border-bottom: none; }
.pf-menu-row:hover { background: var(--surface2); }
.pf-menu-row.is-danger:hover { background: var(--red-pale); }
.pf-menu-icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; flex-shrink: 0;
}
.pf-menu-label { flex: 1; font-size: .85rem; color: var(--text); font-weight: 500; }
.pf-menu-label.is-danger { color: var(--red); }
.pf-menu-arrow { font-size: .9rem; color: var(--text-muted); }
.pf-version { text-align: center; font-size: .68rem; color: var(--text-muted); padding: 8px 0 4px; }

/* Subpantallas de perfil (upgrade / settings) */
.pf-subscreen {
  position: absolute; inset: 0;
  background: var(--bg);
  z-index: 50;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.pf-subscreen.is-active { display: flex; }

.pf-upgrade-hero {
  background: linear-gradient(160deg, #78350F, #F59E0B, #FBBF24);
  padding: 48px 24px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  position: relative; overflow: hidden;
  flex-shrink: 0;
}
.pf-upgrade-hero::before {
  content: ''; position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}
.pf-subscreen-back {
  position: absolute; top: 16px; left: 16px;
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; color: #fff; z-index: 2;
}
/* Botón de volver del header de Configuración — header claro, necesita
   contraste propio (la flecha blanca de .pf-subscreen-back es para el hero oscuro) */
.pf-settings-back {
  width: 36px; height: 36px;
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  color: var(--text-mid);
  transition: background .15s, color .15s;
}
.pf-settings-back:hover { background: var(--purple-pale); color: var(--purple); }

.pf-upgrade-hero__icon {
  width: 64px; height: 64px;
  background: rgba(255,255,255,.2);
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  position: relative; z-index: 1;
}
.pf-upgrade-hero__title { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; color: #fff; text-align: center; position: relative; z-index: 1; }
.pf-upgrade-hero__sub { font-size: .8rem; color: rgba(255,255,255,.8); text-align: center; line-height: 1.5; position: relative; z-index: 1; }
.pf-upgrade-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.pf-upgrade-price { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px; text-align: center; }
.pf-upgrade-price__label { font-size: .72rem; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; }
.pf-upgrade-price__value { font-family: var(--font-display); font-weight: 800; font-size: 2rem; color: var(--text); }
.pf-upgrade-price__value span { font-size: 1rem; color: var(--text-muted); font-weight: 500; }
.pf-upgrade-price__note { font-size: .72rem; color: var(--text-muted); margin-top: 4px; }
.pf-benefits-title { font-family: var(--font-display); font-weight: 700; font-size: .85rem; color: var(--text); }
.pf-benefit {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  padding: 13px 14px;
  display: flex; gap: 12px; align-items: flex-start;
}
.pf-benefit__icon {
  width: 34px; height: 34px; min-width: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
}
.pf-benefit__title { font-family: var(--font-display); font-weight: 700; font-size: .82rem; color: var(--text); margin-bottom: 2px; }
.pf-benefit__sub { font-size: .72rem; color: var(--text-muted); line-height: 1.4; }
.pf-current-plan {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 8px;
}
.pf-current-plan__label { font-size: .72rem; color: var(--text-muted); flex: 1; }
.pf-current-plan__badge {
  background: var(--purple-pale);
  border: 1px solid var(--purple-mid);
  border-radius: 99px;
  padding: 3px 10px;
  font-family: var(--font-display);
  font-size: .68rem; font-weight: 700;
  color: var(--purple);
}
.pf-upgrade-note { font-size: .72rem; color: var(--text-muted); text-align: center; }

/* Subpantalla de configuración */
.pf-settings-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px 32px; display: flex; flex-direction: column; gap: 14px; }
.pf-toggle-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.pf-toggle-row:last-child { border-bottom: none; }
.pf-toggle-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; flex-shrink: 0;
}
.pf-toggle-info { flex: 1; min-width: 0; }
.pf-toggle-label { font-size: .85rem; color: var(--text); font-weight: 500; margin-bottom: 2px; }
.pf-toggle-label.is-danger { color: var(--red); }
.pf-toggle-sub { font-size: .7rem; color: var(--text-muted); line-height: 1.3; }
.pf-toggle-switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.pf-toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.pf-toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: background .2s;
}
.pf-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.pf-toggle-switch input:checked + .pf-toggle-slider { background: var(--purple); }
.pf-toggle-switch input:checked + .pf-toggle-slider::before { transform: translateX(20px); }
.pf-locked-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  opacity: .5;
}
.pf-locked-row:last-child { border-bottom: none; }
.pf-locked-badge {
  font-family: var(--font-display);
  font-size: .65rem; font-weight: 700;
  background: var(--border);
  color: var(--text-muted);
  border-radius: 99px;
  padding: 2px 8px;
  white-space: nowrap;
}
.pf-sinfo-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.pf-sinfo-row:last-child { border-bottom: none; }
.pf-sinfo-row:hover { background: var(--surface2); }
.pf-sinfo-row.is-static { cursor: default; }
.pf-sinfo-row.is-static:hover { background: transparent; }
.pf-sinfo-label { flex: 1; font-size: .85rem; color: var(--text); font-weight: 500; }
.pf-sinfo-value { font-size: .78rem; color: var(--text-muted); }
.pf-sinfo-arrow { font-size: .9rem; color: var(--text-muted); margin-left: 4px; }

/* ══ 6. ESTADOS Y UTILIDADES ══ */
.is-hidden { display: none; }

/* Fondos de iconos — reemplazan estilos inline */
.ic-purple { background: var(--purple-pale); }
.ic-green  { background: var(--green-pale); }
.ic-amber  { background: var(--amber-light); }
.ic-blue   { background: var(--blue-pale); }
.ic-grey   { background: var(--surface2); }
.ic-red    { background: var(--red-pale); }
.ic-rose   { background: #FFF1F2; }

/* Colores de texto utilitarios */
.txt-green  { color: var(--green); }
.txt-amber  { color: var(--amber); }
.txt-purple { color: var(--purple); }

/* Espaciadores */
.spacer    { height: 8px; flex-shrink: 0; }
.spacer-sm { height: 4px; flex-shrink: 0; }

/* Variante de área scrolleable sin padding (vista perfil) */
.view-scroll--flush { padding: 0; gap: 0; }

/* Estado de exportación para html2canvas — única excepción de !important */
.exporting,
.exporting *,
.exporting *::before,
.exporting *::after {
  animation: none !important;
  transition: none !important;
  opacity: 1 !important;
}

/* ══ 7. ANIMACIONES ══ */
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes msgIn  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes up     { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes logoIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn  { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulse  { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.8); } }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes unlockPop { 0% { transform: scale(.96); opacity: .6; } 60% { transform: scale(1.01); } 100% { transform: scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* Tarjetas con entrada escalonada */
.card-in { animation: cardIn .4s var(--ease) both; }
.result-card { animation: cardIn .4s var(--ease) both; }

/* ══ 8. MEDIA QUERIES ══ */
@media (min-height: 900px) {
  body { display: flex; align-items: flex-start; justify-content: center; min-height: 100vh; }
  .shell { margin: 28px auto; border-radius: 44px; }
}
