/* ==========================================================================
   FuncionarioTest - hoja de estilos principal
   ========================================================================== */

:root {
  --g-950: #052e16;
  --g-900: #14532d;
  --g-800: #166534;
  --g-700: #15803d;
  --g-600: #16a34a;
  --g-500: #22c55e;
  --g-200: #bbf7d0;
  --g-100: #dcfce7;
  --g-50: #f0fdf4;

  --ink: #0b1f16;
  --text: #1f2d27;
  --muted: #64746d;
  --line: #e2eae5;
  --line-strong: #cfdad4;
  --bg: #f3f7f4;
  --surface: #ffffff;
  --surface-2: #f8fbf9;

  --amber-600: #d97706;
  --amber-100: #fef3c7;
  --red-600: #dc2626;
  --red-100: #fee2e2;
  --blue-600: #2563eb;
  --blue-100: #dbeafe;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(11, 31, 22, 0.06), 0 1px 3px rgba(11, 31, 22, 0.04);
  --shadow: 0 6px 20px rgba(11, 31, 22, 0.08);
  --shadow-lg: 0 18px 44px rgba(11, 31, 22, 0.14);
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --header-h: 68px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
  display: block;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--g-700);
  text-decoration: none;
}

a:hover {
  color: var(--g-800);
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.35em;
  color: var(--ink);
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 700;
}

h1 { font-size: 1.85rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

p {
  margin: 0 0 1em;
}

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: 0.75rem; }
.mt-3 { margin-top: 1.25rem; }
.mb-3 { margin-bottom: 1.25rem; }
.mt-4 { margin-top: 2rem; }
.flex { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-inline: 20px;
}

.container--narrow {
  max-width: 820px;
}

/* --------------------------------------------------------------------------
   Header / navegación
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--ink);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
  color: var(--ink);
}

.brand__logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--g-700), var(--g-500));
  color: #fff;
  font-size: 1rem;
  box-shadow: 0 6px 14px rgba(22, 163, 74, 0.3);
}

.brand__tag {
  color: var(--g-700);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: background 140ms ease, color 140ms ease;
}

.nav-link i {
  color: var(--muted);
  font-size: 0.85em;
}

.nav-link:hover {
  background: var(--g-50);
  color: var(--g-800);
  text-decoration: none;
}

.nav-link.is-active {
  background: var(--g-100);
  color: var(--g-900);
}

.nav-link.is-active i {
  color: var(--g-700);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  width: 42px;
  height: 42px;
  font-size: 1.05rem;
  color: var(--ink);
  cursor: pointer;
}

/* Menú de usuario (details nativo) */
.dropdown {
  position: relative;
}

.dropdown > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.6rem 0.35rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  transition: box-shadow 140ms ease, border-color 140ms ease;
}

.dropdown > summary::-webkit-details-marker {
  display: none;
}

.dropdown > summary:hover,
.dropdown[open] > summary {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--g-800), var(--g-600));
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  flex-shrink: 0;
}

.avatar--lg {
  width: 56px;
  height: 56px;
  font-size: 1.3rem;
}

.dropdown__label {
  font-weight: 600;
  font-size: 0.9rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 230px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
  z-index: 60;
  animation: pop 140ms ease;
}

.dropdown__head {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.35rem;
}

.dropdown__head strong {
  display: block;
  font-size: 0.9rem;
}

.dropdown__head span {
  font-size: 0.8rem;
  color: var(--muted);
}

.dropdown__item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.dropdown__item i {
  width: 1.1em;
  color: var(--muted);
}

.dropdown__item:hover {
  background: var(--g-50);
  color: var(--g-900);
  text-decoration: none;
}

.dropdown__item--danger:hover {
  background: var(--red-100);
  color: var(--red-600);
}

/* Navegación móvil */
@media (max-width: 1024px) {
  .nav-toggle {
    display: inline-grid;
    place-items: center;
  }

  .nav-links {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: var(--header-h);
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    padding: 0.75rem 16px 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }

  .nav-links.is-open {
    display: flex;
  }

  .dropdown__label {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Estructura de página
   -------------------------------------------------------------------------- */

.site-main {
  flex: 1 0 auto;
  padding-block: 2rem 3.5rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface);
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--muted);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.page-header__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--g-700);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

.page-header h1 {
  margin-bottom: 0.2rem;
}

.page-header p {
  margin: 0;
  color: var(--muted);
}

.page-header__actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Botones
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: 11px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.93rem;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 3px solid rgba(34, 197, 94, 0.35);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(145deg, var(--g-700), var(--g-600));
  color: #fff;
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(145deg, var(--g-800), var(--g-700));
  color: #fff;
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.34);
}

.btn-secondary {
  background: var(--surface);
  color: var(--g-800);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  background: var(--g-50);
  border-color: var(--g-200);
  color: var(--g-900);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--g-50);
  color: var(--g-900);
}

.btn-danger {
  background: var(--red-600);
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
  color: #fff;
}

.btn-outline-danger {
  background: var(--surface);
  color: var(--red-600);
  border-color: #f3c4c4;
}

.btn-outline-danger:hover {
  background: var(--red-100);
}

.btn-premium {
  background: linear-gradient(145deg, #b45309, #f59e0b);
  color: #fff;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.3);
}

.btn-premium:hover {
  color: #fff;
  filter: brightness(1.05);
}

.btn-google {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-google:hover {
  background: var(--surface-2);
}

.btn-apple {
  background: #000;
  color: #fff;
  border-color: #000;
  margin-top: 0.6rem;
}

.btn-apple:hover {
  background: #222;
  color: #fff;
}

.btn-sm {
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 9px;
}

.btn-lg {
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  border-radius: 13px;
}

.btn-block {
  width: 100%;
}

.btn[disabled],
.btn.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Tarjetas, badges, alertas
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card + .card {
  margin-top: 1.25rem;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--line);
}

.card__header h2,
.card__header h3 {
  margin: 0;
}

.card__body {
  padding: 1.4rem;
}

.card--pad {
  padding: 1.4rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.badge--success {
  background: var(--g-100);
  color: var(--g-900);
  border-color: var(--g-200);
}

.badge--warning {
  background: var(--amber-100);
  color: #92400e;
  border-color: #fde68a;
}

.badge--danger {
  background: var(--red-100);
  color: #991b1b;
  border-color: #fecaca;
}

.badge--info {
  background: var(--blue-100);
  color: #1e40af;
  border-color: #bfdbfe;
}

.badge--premium {
  background: linear-gradient(145deg, #fbbf24, #f59e0b);
  color: #451a03;
  border-color: transparent;
}

.alert {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 1.25rem;
  font-size: 0.93rem;
}

.alert i {
  margin-top: 0.15rem;
}

.alert--success {
  background: var(--g-50);
  border-color: var(--g-200);
  color: var(--g-900);
}

.alert--error {
  background: #fff5f5;
  border-color: #fecaca;
  color: #991b1b;
}

.alert--info {
  background: #f0f6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

.alert--warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #78350f;
}

.alert p {
  margin: 0;
}

.alert a {
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Estadísticas (inicio)
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  background: linear-gradient(135deg, var(--g-900) 0%, var(--g-700) 60%, var(--g-600) 100%);
  color: #fff;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.hero::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.hero::before {
  content: "";
  position: absolute;
  right: 60px;
  bottom: -120px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero h1 {
  color: #fff;
  font-size: 1.6rem;
  margin-bottom: 0.25rem;
}

.hero p {
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  max-width: 560px;
}

.hero__row {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.hero__actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.hero .btn-secondary {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.hero .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}

.hero .btn-primary {
  background: #fff;
  color: var(--g-900);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.hero .btn-primary:hover {
  background: var(--g-50);
  color: var(--g-900);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}

.stat {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stat__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  background: var(--g-100);
  color: var(--g-800);
  flex-shrink: 0;
}

.stat__icon--amber {
  background: var(--amber-100);
  color: var(--amber-600);
}

.stat__icon--blue {
  background: var(--blue-100);
  color: var(--blue-600);
}

.stat__value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}

.stat__label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Temas y cuestionarios (inicio)
   -------------------------------------------------------------------------- */

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.75rem 0 0.9rem;
}

.section-title h2 {
  margin: 0;
  font-size: 1.2rem;
}

.tema {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.9rem;
  overflow: hidden;
}

.tema > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.25rem;
  user-select: none;
  transition: background 140ms ease;
}

.tema > summary::-webkit-details-marker {
  display: none;
}

.tema > summary:hover {
  background: var(--surface-2);
}

.tema[open] > summary {
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.tema__icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--g-100);
  color: var(--g-800);
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.tema__title {
  flex: 1 1 auto;
  font-weight: 700;
  color: var(--ink);
  font-size: 1rem;
}

.tema__meta {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.tema__chevron {
  color: var(--muted);
  transition: transform 180ms ease;
}

.tema[open] .tema__chevron {
  transform: rotate(180deg);
}

.tema__body {
  padding: 1.1rem 1.25rem 1.25rem;
}

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.9rem;
}

.quiz-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.05rem 1.1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  color: inherit;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.quiz-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--g-200);
  color: inherit;
  text-decoration: none;
}

.quiz-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.quiz-card__title {
  font-weight: 700;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.3;
}

.quiz-card__desc {
  font-size: 0.86rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quiz-card__footer {
  margin-top: auto;
  padding-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.quiz-card__cta {
  font-weight: 700;
  color: var(--g-700);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.quiz-card:hover .quiz-card__cta {
  color: var(--g-900);
}

.quiz-card--locked {
  opacity: 0.65;
  cursor: default;
}

.quiz-card--locked:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--line);
}

.quiz-card--locked .quiz-card__title {
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Cuestionario (realización)
   -------------------------------------------------------------------------- */

.quiz-topbar {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 1.1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.quiz-topbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.quiz-topbar__progress {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.quiz-topbar__progress strong {
  color: var(--ink);
}

.timer {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--g-100);
  color: var(--g-900);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}

.timer.is-warning {
  background: var(--amber-100);
  color: #92400e;
}

.timer.is-danger {
  background: var(--red-100);
  color: #991b1b;
  animation: pulse 1s ease infinite;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-top: 0.7rem;
}

.progress__bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--g-600), var(--g-500));
  transition: width 220ms ease;
}

.question {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1rem;
  transition: border-color 140ms ease;
}

.question.is-answered {
  border-color: var(--g-200);
}

.question__head {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}

.question__num {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--g-100);
  color: var(--g-900);
  font-weight: 800;
  font-size: 0.85rem;
}

.question.is-answered .question__num {
  background: var(--g-700);
  color: #fff;
}

.question__text {
  font-weight: 600;
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.45;
  padding-top: 0.3rem;
}

.options {
  display: grid;
  gap: 0.55rem;
}

.option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 120ms ease, background 120ms ease;
}

.option:hover {
  border-color: var(--g-200);
  background: var(--g-50);
}

.option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.option__mark {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: grid;
  place-items: center;
  margin-top: 0.1rem;
  transition: border-color 120ms ease, background 120ms ease;
}

.option__mark::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  transform: scale(0);
  transition: transform 120ms ease;
}

.option input:checked ~ .option__mark {
  border-color: var(--g-700);
  background: var(--g-700);
}

.option input:checked ~ .option__mark::after {
  transform: scale(1);
}

.option input:checked ~ .option__text {
  color: var(--g-900);
  font-weight: 600;
}

.option:has(input:checked) {
  border-color: var(--g-600);
  background: var(--g-50);
}

.option input:focus-visible ~ .option__mark {
  outline: 3px solid rgba(34, 197, 94, 0.35);
  outline-offset: 2px;
}

.option__text {
  flex: 1 1 auto;
  line-height: 1.45;
}

.quiz-footer {
  position: sticky;
  bottom: 0;
  z-index: 30;
  margin-top: 1.5rem;
  padding: 0.9rem 1.1rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.quiz-footer__hint {
  font-size: 0.88rem;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Resultados
   -------------------------------------------------------------------------- */

.score-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.75rem;
  align-items: center;
  padding: 1.6rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.ring {
  --pct: 0;
  --ring-color: var(--g-600);
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), var(--line) 0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ring--low {
  --ring-color: var(--red-600);
}

.ring--mid {
  --ring-color: var(--amber-600);
}

.ring__inner {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
  text-align: center;
}

.ring__value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

.ring__label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 0.25rem;
}

.score-hero__title {
  margin-bottom: 0.2rem;
}

.score-hero__sub {
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.chips {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.chip--ok {
  background: var(--g-100);
  color: var(--g-900);
  border-color: var(--g-200);
}

.chip--bad {
  background: var(--red-100);
  color: #991b1b;
  border-color: #fecaca;
}

.chip--blank {
  background: #f1f5f9;
  color: #334155;
  border-color: #e2e8f0;
}

.review {
  margin-bottom: 1rem;
}

.review__status {
  margin-left: auto;
  flex-shrink: 0;
}

.review-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0.95rem;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-size: 0.95rem;
}

.review-option i {
  margin-top: 0.2rem;
  width: 1.1em;
  text-align: center;
}

.review-option.is-correct {
  background: var(--g-50);
  border-color: var(--g-500);
  color: var(--g-900);
  font-weight: 600;
}

.review-option.is-wrong {
  background: #fff5f5;
  border-color: #fca5a5;
  color: #991b1b;
  font-weight: 600;
}

.review-option.is-neutral {
  color: var(--muted);
}

.explanation {
  margin-top: 0.9rem;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--g-600);
  background: var(--surface-2);
  border-radius: 0 10px 10px 0;
  font-size: 0.92rem;
}

.explanation strong {
  color: var(--g-900);
}

/* --------------------------------------------------------------------------
   Tablas y paginación
   -------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

.table th,
.table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--surface-2);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: var(--g-50);
}

.table__title {
  font-weight: 700;
  color: var(--ink);
}

.table__sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  list-style: none;
  padding: 1.25rem 0 0;
  margin: 0;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.88rem;
}

.pagination a:hover {
  border-color: var(--g-200);
  background: var(--g-50);
  text-decoration: none;
}

.pagination .is-active span {
  background: var(--g-700);
  border-color: var(--g-700);
  color: #fff;
}

.pagination .is-disabled span {
  color: var(--muted);
  opacity: 0.6;
}

/* --------------------------------------------------------------------------
   Formularios
   -------------------------------------------------------------------------- */

.field {
  margin-bottom: 1.1rem;
}

.field label,
.field__label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 0.4rem;
  color: var(--ink);
}

.form-control,
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field select,
.field textarea {
  display: block;
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.form-control:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--g-600);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}

.form-control::placeholder {
  color: #9aa8a1;
}

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364746d' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.4rem;
}

.field .help {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

.field .help ul {
  margin: 0.2rem 0 0;
  padding-left: 1.1rem;
}

.field .errorlist,
.errorlist {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  font-size: 0.83rem;
  color: var(--red-600);
  font-weight: 600;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  margin-bottom: 0.7rem;
}

.check input,
.form-check-input {
  width: 18px;
  height: 18px;
  accent-color: var(--g-700);
  cursor: pointer;
  margin: 0;
}

.form-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}

/* Editor HTML (novedades / ofertas) */
.editor-toolbar {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  margin-bottom: 0.5rem;
}

.editor-toolbar button {
  border: 0;
  background: transparent;
  width: 34px;
  height: 32px;
  border-radius: 7px;
  color: var(--text);
  cursor: pointer;
}

.editor-toolbar button:hover {
  background: var(--g-100);
  color: var(--g-900);
}

.editor-surface {
  min-height: 220px;
  white-space: pre-wrap;
  line-height: 1.6;
}

.editor-surface:empty::before {
  content: "Escribe aquí el contenido...";
  color: #9aa8a1;
}

/* Contenido HTML libre (novedades, ofertas) */
.prose {
  line-height: 1.65;
}

.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose ul,
.prose ol { padding-left: 1.3rem; }
.prose a { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Novedades / ofertas
   -------------------------------------------------------------------------- */

.news {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}

.news__item {
  display: flex;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.news__item--featured {
  border-color: #fde68a;
  background: linear-gradient(135deg, #fffbeb, #ffffff 60%);
}

.news__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--g-100);
  color: var(--g-800);
}

.news__item--featured .news__icon {
  background: var(--amber-100);
  color: var(--amber-600);
}

.news__title {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-list {
  display: grid;
  gap: 1rem;
}

.admin-item__meta {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.35rem;
}

.admin-item__date {
  font-size: 0.8rem;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Estados vacíos y planes
   -------------------------------------------------------------------------- */

.empty {
  text-align: center;
  padding: 3rem 1.5rem;
}

.empty__icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--g-100);
  color: var(--g-800);
  font-size: 1.7rem;
}

.empty h2 {
  margin-bottom: 0.4rem;
}

.empty p {
  color: var(--muted);
  max-width: 460px;
  margin: 0 auto 1.25rem;
}

.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.1rem;
}

.plan {
  position: relative;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.plan--premium {
  border-color: #fbbf24;
  background: linear-gradient(160deg, #fffbeb 0%, #ffffff 55%);
  box-shadow: var(--shadow);
}

.plan--current {
  border-color: var(--g-500);
}

.plan__name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.plan__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  font-size: 0.93rem;
}

.plan__list li {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.plan__list i {
  margin-top: 0.25rem;
  color: var(--g-700);
}

.plan__list .is-off i {
  color: #cbd5d0;
}

.plan__list .is-off {
  color: var(--muted);
}

.plan__cta {
  margin-top: auto;
  padding-top: 0.5rem;
}

/* --------------------------------------------------------------------------
   Páginas de acceso (login, registro, contraseña)
   -------------------------------------------------------------------------- */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
}

.auth__side {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem;
  color: #fff;
  background: linear-gradient(160deg, var(--g-950) 0%, var(--g-800) 55%, var(--g-600) 100%);
}

.auth__side::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  right: -160px;
  bottom: -160px;
  background: rgba(255, 255, 255, 0.07);
}

.auth__side > * {
  position: relative;
  z-index: 1;
}

.auth__side .brand,
.auth__side .brand:hover {
  color: #fff;
}

.auth__side .brand__logo {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

.auth__side .brand__tag {
  color: var(--g-200);
}

.auth__side h2 {
  color: #fff;
  font-size: 1.9rem;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.auth__side p {
  color: rgba(255, 255, 255, 0.82);
  max-width: 420px;
}

.auth__features {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.8rem;
}

.auth__features li {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  font-weight: 600;
  font-size: 0.95rem;
}

.auth__features i {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  flex-shrink: 0;
}

.auth__foot {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.65);
}

.auth__foot a {
  color: rgba(255, 255, 255, 0.85);
}

.auth__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  background: var(--bg);
}

.auth__box {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2.25rem 2rem;
}

.auth__box h1 {
  font-size: 1.5rem;
  margin-bottom: 0.3rem;
}

.auth__box > p {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.auth__divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1.25rem 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth__divider::before,
.auth__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth__links {
  margin-top: 1.4rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  display: grid;
  gap: 0.4rem;
}

.auth__links a {
  font-weight: 600;
}

.auth__brand-mobile {
  display: none;
}

@media (max-width: 860px) {
  .auth {
    grid-template-columns: 1fr;
  }

  .auth__side {
    display: none;
  }

  .auth__brand-mobile {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
  }

  .auth__panel {
    padding: 2rem 1rem;
    align-items: flex-start;
  }

  .auth__box {
    padding: 1.75rem 1.4rem;
  }
}

/* --------------------------------------------------------------------------
   Página legal
   -------------------------------------------------------------------------- */

.legal h2 {
  font-size: 1.15rem;
  margin-top: 1.8rem;
}

.legal ul {
  padding-left: 1.2rem;
}

/* --------------------------------------------------------------------------
   Animaciones y responsive
   -------------------------------------------------------------------------- */

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .container {
    padding-inline: 16px;
  }

  .site-main {
    padding-block: 1.25rem 2.5rem;
  }

  .hero {
    padding: 1.4rem;
  }

  .hero h1 {
    font-size: 1.35rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .stat {
    padding: 0.85rem 0.9rem;
    gap: 0.7rem;
  }

  .stat__value {
    font-size: 1.2rem;
  }

  .card__body,
  .card--pad {
    padding: 1.1rem;
  }

  .question {
    padding: 1rem 1.05rem;
  }

  .score-hero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .chips {
    justify-content: center;
  }

  .quiz-footer {
    border-radius: var(--radius) var(--radius) 0 0;
    margin-inline: -16px;
  }
}
