/* ╔══════════════════════════════════════════════════════╗
   ║  Kurzo — Design System                              ║
   ║  Tipografía: Playfair Display (títulos) + DM Sans   ║
   ║  Paleta: Navy profundo + Naranja cálido             ║
   ╚══════════════════════════════════════════════════════╝ */

:root {
  --navy: #0f2240;
  --navy-mid: #1e3a8a;
  --navy-lt: #2563eb;
  --orange: #ea580c;
  --orange-2: #f97316;
  --orange-lt: #fed7aa;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-400: #94a3b8;
  --slate-600: #475569;
  --slate-800: #1e293b;
  --green: #16a34a;
  --green-lt: #dcfce7;
  --red: #dc2626;
  --red-lt: #fee2e2;
  --white: #ffffff;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(15, 34, 64, 0.08);
  --shadow-lg: 0 8px 40px rgba(15, 34, 64, 0.14);
  --font-serif: "Playfair Display", Georgia, serif;
  --font-sans: "DM Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
}
body {
  font-family: var(--font-sans);
  color: var(--slate-800);
  background: var(--slate-100);
}
a {
  color: var(--navy-lt);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
img {
  max-width: 100%;
}

/* ── ANIMATIONS ────────────────────────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.fade-up {
  animation: fadeUp 0.5s ease both;
}

/* ── BUTTONS ────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border: none;
  border-radius: var(--radius);
  background: var(--navy);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease;
  text-decoration: none;
  box-shadow: 0 4px 12px -4px rgba(15, 34, 64, 0.3);
}
.btn-primary:hover {
  background: var(--navy-mid);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -6px rgba(15, 34, 64, 0.45);
  text-decoration: none;
  color: #fff;
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-primary.btn-full {
  width: 100%;
  justify-content: center;
}
.btn-primary.btn-cta {
  background: var(--orange);
  box-shadow: 0 6px 16px -4px rgba(234, 88, 12, 0.4);
}
.btn-primary.btn-cta:hover {
  background: var(--orange-2);
  box-shadow: 0 10px 22px -6px rgba(234, 88, 12, 0.55);
}
.btn-primary.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border: 2px solid var(--slate-200);
  border-radius: var(--radius);
  background: transparent;
  color: var(--slate-600);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-ghost:hover {
  border-color: var(--navy-lt);
  color: var(--navy-lt);
  text-decoration: none;
}
.btn-ghost.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

/* ── FORMS ──────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-group input,
.form-group select {
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--slate-200);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--slate-800);
  background: var(--white);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--navy-lt);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.req {
  color: var(--orange);
}
.opt {
  color: var(--slate-400);
  font-weight: 400;
  font-size: 0.75rem;
}

/* ── ALERTS ─────────────────────────────────────────────── */
.alert {
  padding: 0.875rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.alert-error {
  background: var(--red-lt);
  color: var(--red);
  border: 1px solid #fca5a5;
}
.alert-ok {
  background: var(--green-lt);
  color: var(--green);
  border: 1px solid #86efac;
}

/* ── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-ok {
  background: var(--green-lt);
  color: var(--green);
}
.badge-fail {
  background: var(--red-lt);
  color: var(--red);
}

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════════════════ */
body:has(> .login-page) {
  background: linear-gradient(
    135deg,
    var(--navy) 0%,
    var(--navy-mid) 60%,
    #1d4ed8 100%
  );
}
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    135deg,
    var(--navy) 0%,
    var(--navy-mid) 60%,
    #1d4ed8 100%
  );
}
.login-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.login-bg-shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.07;
  background: var(--white);
}
.login-bg-shape.s1 {
  width: 600px;
  height: 600px;
  top: -200px;
  right: -150px;
}
.login-bg-shape.s2 {
  width: 400px;
  height: 400px;
  bottom: -100px;
  left: -100px;
}
.login-bg-shape.s3 {
  width: 200px;
  height: 200px;
  top: 40%;
  left: 30%;
  opacity: 0.04;
}

.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.login-header {
  text-align: center;
  margin-bottom: 2rem;
}
.login-icon {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
}
.login-title {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  color: var(--navy);
  line-height: 1.1;
  margin-bottom: 0.5rem;
}
.login-title em {
  color: var(--orange);
  font-style: normal;
}
.login-subtitle {
  color: var(--slate-400);
  font-size: 0.875rem;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--slate-400);
}

/* ══════════════════════════════════════════════════════════
   TOPBAR / MODULE / QUIZ
══════════════════════════════════════════════════════════ */
.module-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.topbar-brand {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}
.topbar-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  justify-content: flex-end;
}
.progress-label {
  font-size: 0.8rem;
  opacity: 0.8;
  white-space: nowrap;
}
.progress-track {
  width: 120px;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 3px;
  transition: width 0.4s;
}
.progress-pct {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}
.quiz-badge {
  font-size: 0.8rem;
  opacity: 0.8;
  /* Nombres de capacitación largos: truncar con ellipsis en una línea
     (el title del span muestra el texto completo al pasar el mouse). */
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

/* Barra de progreso del quiz (sticky bajo el topbar) */
.quiz-progress-bar {
  height: 4px;
  background: rgba(15, 34, 64, .12);
  overflow: hidden;
  position: relative;
}
.quiz-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ea580c 0%, #f97316 100%);
  transition: width .35s cubic-bezier(.4, 0, .2, 1);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(234, 88, 12, .35);
}
.quiz-progress-bar.is-complete .quiz-progress-fill {
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
  box-shadow: 0 0 10px rgba(16, 185, 129, .45);
}

/* ── MODULE PAGE ─── */
.module-page {
  min-height: 100vh;
  background: var(--slate-100);
}
.module-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.module-card {
  background: var(--white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.module-card-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: var(--white);
  padding: 1.75rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.module-icon-badge {
  font-size: 2.5rem;
}
.module-num {
  font-size: 0.8rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.2rem;
}
.module-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
}

.module-content {
  padding: 2rem 2rem 1.5rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--slate-800);
}
.module-content p {
  margin: 0 0 0.5rem 0;
}
.module-content p:last-child {
  margin-bottom: 0;
}
.module-content strong {
  color: var(--navy);
}
.module-content ul,
.module-content ol {
  margin: 0.5rem 0 0.875rem 1.25rem;
}
.module-content li {
  margin-bottom: 0.3rem;
}
.module-content .highlight {
  background: #eff6ff;
  border-left: 4px solid var(--navy-lt);
  padding: 0.875rem 1rem;
  border-radius: 0 8px 8px 0;
  margin: 0.875rem 0;
}
.module-content .warning {
  background: #fff7ed;
  border-left: 4px solid var(--orange);
  padding: 0.875rem 1rem;
  border-radius: 0 8px 8px 0;
  margin: 0.875rem 0;
}
.module-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.875rem 0;
  font-size: 0.875rem;
}
.module-content th,
.module-content td {
  border: 1px solid var(--slate-200);
  padding: 0.5rem 0.75rem;
}
.module-content th {
  background: var(--slate-50);
  font-weight: 600;
}
/* Wrapper responsive 16:9 para iframes (videos embebidos).
   El JS de modulo.php envuelve automáticamente cualquier iframe huérfano. */
.module-content .module-video-wrap {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 1rem auto;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 12px rgba(15, 34, 64, 0.12);
}
.module-content .module-video-wrap iframe {
  position: absolute !important;
  top: 0; left: 0;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  border: 0;
  background: #000;
}

/* Botón "Pantalla completa" debajo de cada video embebido */
.video-fs-btn {
  display: block;
  margin: .35rem auto 1rem;
  max-width: 720px;
  width: 100%;
  padding: .55rem .8rem;
  background: #f1f5f9;
  color: var(--navy);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s ease;
}
.video-fs-btn:hover { background: #e2e8f0; }

.video-fallback-link {
  display: block;
  margin: -.6rem auto 1rem;
  max-width: 720px;
  width: 100%;
  text-align: center;
  font-size: .78rem;
  color: #64748b;
  text-decoration: underline dotted;
}
.video-fallback-link:hover { color: var(--navy); }

/* Fallback de "fullscreen" para móviles (la API nativa de requestFullscreen
   no funciona bien en iframes en iOS Safari ni en muchos browsers móviles).
   Cubre todo el viewport con position:fixed. Usa 100dvh (dynamic viewport)
   para que la barra de URL de móvil no recorte el área. */
.iframe-fake-fullscreen {
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 999999 !important;
  background: #000 !important;
  border-radius: 0 !important;
  display: flex !important;
}
.iframe-fake-fullscreen iframe {
  position: static !important;
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
  border-radius: 0 !important;
  margin: 0 !important;
  flex: 1;
}
.fake-fullscreen-exit {
  position: fixed;
  top: 12px; right: 12px;
  z-index: 1000000;
  background: rgba(0,0,0,.75);
  color: #fff;
  border: none;
  border-radius: 999px;
  width: 44px; height: 44px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.module-actions {
  padding: 1.25rem 2rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--slate-100);
}

/* ── QUIZ PAGE ─── */
.quiz-page {
  min-height: 100vh;
  background: var(--slate-100);
}
.quiz-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 9rem;
}
.quiz-header {
  margin-bottom: 2rem;
}
.quiz-header h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--navy);
  margin-bottom: 0.5rem;
}
.quiz-header p {
  color: var(--slate-400);
}

.question-card {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--slate-200);
  transition: border-color 0.2s;
}
.question-card.answered {
  border-left-color: var(--green);
}
.question-num {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--slate-400);
  margin-bottom: 0.5rem;
}
.question-text {
  font-weight: 600;
  color: var(--navy);
  font-size: 1rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.question-hint {
  font-size: .8rem;
  color: #2563eb;
  background: #eff6ff;
  border-radius: 6px;
  padding: .35rem .75rem;
  margin: -.5rem 0 .75rem;
  display: inline-block;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.option-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1.5px solid var(--slate-200);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.option-label:hover {
  border-color: var(--navy-lt);
  background: #eff6ff;
}
.option-label input[type="radio"] {
  accent-color: var(--navy-mid);
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}
.option-label:has(input:checked) {
  border-color: var(--navy-mid);
  background: #eff6ff;
  font-weight: 600;
  color: var(--navy);
}
.option-content {
  flex: 1;
  font-size: 0.9rem;
}
.option-check {
  color: var(--green);
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s;
}
.option-label:has(input:checked) .option-check {
  opacity: 1;
}

.quiz-submit-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--white);
  border-top: 1px solid var(--slate-200);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  z-index: 50;
}
.quiz-progress-text {
  font-size: 0.9rem;
  color: var(--slate-400);
  font-weight: 500;
}

/* ── STEP CARDS (foto, firma) ─── */
.centered-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--slate-100);
}
.step-card {
  background: var(--white);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
}
.step-header {
  text-align: center;
  margin-bottom: 1.75rem;
}
.step-header h2 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--navy);
  margin-bottom: 0.5rem;
}
.step-header p {
  color: var(--slate-400);
  font-size: 0.9rem;
}
.step-num {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.step-num.approved {
  background: var(--green-lt);
  color: var(--green);
}

/* Cámara */
.cam-container {
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 4/3;
  margin-bottom: 1rem;
}
.cam-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Espejo: la cámara frontal se siente natural solo si el preview refleja
     como un espejo (levantás la derecha y sube del mismo lado). La captura
     en foto.php también se espeja para que coincida con lo que se ve. */
  transform: scaleX(-1);
}
.cam-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--slate-400);
  text-align: center;
  padding: 2rem;
  font-size: 0.9rem;
  line-height: 1.6;
}
.cam-buttons {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.cam-buttons > * {
  flex: 1;
  justify-content: center;
}

.photo-preview-wrap {
  position: relative;
  margin-bottom: 1rem;
}
.photo-preview-wrap img {
  width: 100%;
  border-radius: 12px;
  aspect-ratio: 4/3;
  object-fit: cover;
}
.photo-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.preview-msg {
  text-align: center;
  color: var(--green);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

/* Firma */
.signature-wrap {
  background: var(--slate-50);
  border: 2px dashed var(--slate-200);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.signature-wrap canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 480 / 200;
  cursor: crosshair;
  touch-action: none;
}
.sig-hint {
  text-align: center;
  color: var(--slate-400);
  font-size: 0.8rem;
  margin-bottom: 1rem;
}
.btn-sm {
  font-size: 0.8rem;
  padding: 0.35rem 0.875rem;
}

/* ══════════════════════════════════════════════════════════
   RESULTADO
══════════════════════════════════════════════════════════ */
.resultado-page {
  min-height: 100vh;
  background: var(--slate-100);
}

.resultado-hero {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--white);
}
.resultado-hero.approved {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
}
.resultado-hero.failed {
  background: linear-gradient(135deg, #7f1d1d 0%, var(--red) 100%);
}
.hero-icon {
  font-size: 4rem;
  margin-bottom: 0.5rem;
}
.hero-name {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}
.hero-score {
  font-family: var(--font-serif);
  font-size: 5rem;
  line-height: 1;
}
.hero-score span {
  font-size: 2rem;
  opacity: 0.7;
}
.hero-sub {
  opacity: 0.8;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}
.resultado-hero h1 {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  margin-bottom: 0.25rem;
}

/* TABS */
.docs-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.doc-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  border: 1.5px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-600);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}
.tab-btn:hover:not(.active) {
  border-color: var(--navy-lt);
  color: var(--navy-lt);
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 400px;
  margin: 1rem auto 0;
  padding: 0.875rem;
  border: none;
  border-radius: var(--radius);
  background: var(--navy);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-download:hover {
  background: var(--navy-mid);
}
.btn-download:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ACCIONES */
.resultado-actions {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}
.btn-wa {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  background: #16a34a;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.btn-wa:hover {
  background: #15803d;
  text-decoration: none;
  color: #fff;
}
.btn-mail {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  background: var(--navy-lt);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.btn-mail:hover {
  background: var(--navy-mid);
  text-decoration: none;
  color: #fff;
}

/* ══════════════════════════════════════════════════════════
   PDF DOCUMENTS STYLES
══════════════════════════════════════════════════════════ */
.pdf-doc {
  background: var(--white);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  color: #1a1a1a;
}

/* Marca de agua en documentos generados con plan Demo */
.pdf-doc.is-demo,
#diploma-pdf.is-demo,
#diploma2-pdf.is-demo {
  position: relative;
}
.pdf-doc.is-demo::after,
#diploma-pdf.is-demo::after,
#diploma2-pdf.is-demo::after {
  content: 'Generado con Kurzo · Plan Demo';
  display: block;
  margin-top: 1.2rem;
  padding-top: .6rem;
  border-top: 1px dashed rgba(15, 34, 64, .2);
  text-align: center;
  font-size: .68rem;
  font-style: italic;
  color: rgba(15, 34, 64, .55);
  letter-spacing: .03em;
}
#diploma-pdf.is-demo::after,
#diploma2-pdf.is-demo::after {
  position: absolute;
  bottom: 12px; left: 24px; right: 24px;
  margin-top: 0;
}

.pdf-header-table {
  display: flex;
  border: 1px solid #999;
  margin-bottom: 1.25rem;
  text-align: center;
  font-size: 0.75rem;
}
.pdf-logo-cell {
  width: 18%;
  min-width: 90px;
  border-right: 1px solid #999;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #666;
}
.pdf-logo-cell img {
  max-height: 55px;
  max-width: 85px;
  object-fit: contain;
}
.pdf-title-cell {
  flex: 1;
  border-right: 1px solid #999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}
.pdf-title-cell:last-child {
  border-right: none;
}
.pdf-main-title {
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.5rem 0.75rem;
  line-height: 1.3;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pdf-sub-title {
  font-size: 0.72rem;
  color: #555;
  padding: 0 0.75rem 0.4rem;
}
.pdf-meta-cell {
  width: 18%;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  font-size: 0.72rem;
}
.pdf-doc-control {
  display: flex;
  border-top: 1px solid #999;
  font-size: 0.7rem;
  background: #fff;
  margin: 0;
  width: 100%;
  align-self: stretch;
  margin-top: auto;
}
.pdf-doc-control span {
  flex: 1;
  padding: 0.3rem 0.5rem;
  border-right: 1px solid #999;
  text-align: center;
  color: #222;
  font-weight: 500;
  white-space: nowrap;
}
.pdf-doc-control span:last-child {
  border-right: none;
}

.pdf-info-block {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 0.875rem;
  background: #f8f9fa;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  align-items: flex-start;
}
.pdf-info-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 0.875rem;
  font-size: 0.8rem;
}
.pdf-foto {
  width: 80px;
  height: 96px;
  object-fit: cover;
  border: 1px solid #ccc;
  flex-shrink: 0;
}

.badge-ok {
  background: #dcfce7;
  color: #166534;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.pdf-section-title {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  background: #f1f5f9;
  padding: 0.4rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-bottom: none;
}
.pdf-checklist {
  border: 1px solid #cbd5e1;
  padding: 0.75rem 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  margin-bottom: 1.25rem;
  font-size: 0.78rem;
}
.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.check-box {
  border: 1px solid #000;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  flex-shrink: 0;
}

.pdf-declaration {
  font-style: italic;
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.6;
  padding: 0.875rem;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #f8fafc;
  margin-bottom: 2rem;
}

.pdf-signatures {
  display: flex;
  gap: 3rem;
  margin-top: 1rem;
}
.sig-block {
  flex: 1;
  text-align: center;
}
.sig-line {
  border-bottom: 1px solid #000;
  min-height: 60px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
  margin-bottom: 4px;
}
.sig-img {
  max-height: 52px;
  object-fit: contain;
}
.sig-name {
  font-weight: 700;
  font-size: 0.8rem;
}
.sig-cargo {
  font-size: 0.72rem;
  color: #64748b;
}

/* TABLA EVALUACIÓN */
.eval-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  margin-bottom: 1rem;
}
.eval-table th,
.eval-table td {
  border: 1px solid #cbd5e1;
  padding: 0.28rem 0.45rem;
}
.eval-table th {
  background: #f1f5f9;
  font-weight: 600;
  text-align: left;
}
.eval-table .correct {
  color: #16a34a;
  font-weight: 700;
  background: #f0fdf4;
}
.eval-table .wrong {
  color: #dc2626;
  font-weight: 700;
  background: #fef2f2;
}
.eval-table .italic {
  font-style: italic;
  color: #475569;
}
.eval-total {
  text-align: right;
  font-size: 0.875rem;
  padding: 0.5rem 0;
  border-top: 2px solid #000;
}

/* DIPLOMA */
.diploma-doc {
  background: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.diploma-outer {
  padding: 16px;
  background: #fff;
}
.diploma-border {
  border: 10px solid var(--navy);
  padding: 4px;
}
.diploma-inner {
    border: 2px solid var(--orange);
    padding: 1.5rem 2rem;
    position: relative;
    min-height: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
}
.diploma-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
    width: 200px;
    height: 200px;
}
.diploma-top,
.diploma-body,
.diploma-bottom {
  position: relative;
  z-index: 1;
}
.diploma-fecha {
  font-size: 0.85rem;
  color: var(--navy);
  font-weight: 600;
  position: absolute;
  top: 1rem;
  right: 1.5rem;
}
.diploma-icon-large {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}
.diploma-main-title {
  font-family: var(--font-serif);
  font-size: 3.5rem;
  color: var(--navy);
  letter-spacing: 0.05em;
}
.diploma-subtitle {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  color: var(--slate-400);
  margin-bottom: 1.5rem;
}
.diploma-intro {
  color: var(--slate-400);
  font-style: italic;
  margin-bottom: 0.75rem;
}
.diploma-name-wrap {
  display: inline-block;
}
.diploma-name {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 3.5vw, 2.2rem);
  color: var(--slate-800);
  margin-bottom: 0;
  white-space: nowrap;
}
.diploma-name-line {
  height: 3px;
  background: var(--orange);
  width: 100%;
  margin: 0.1rem auto 0;
  border-radius: 2px;
}
.diploma-cedula {
  color: var(--slate-400);
  font-size: 0.875rem;
  margin-top: 0.75rem;
  margin-bottom: 1.5rem;
}
.diploma-desc {
  color: var(--slate-600);
  margin-bottom: 0.5rem;
}
.diploma-course {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--navy);
  line-height: 1.3;
  margin-bottom: 0.5rem;
}
.diploma-score {
  color: var(--slate-600);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}
.diploma-bottom .sig-block {
  max-width: 240px;
  margin: 0 auto;
}

/* ══════════════════════════════════════════════════════════
   RESULT CARD (reprobado)
══════════════════════════════════════════════════════════ */
.result-card {
  text-align: center;
  background: var(--white);
  border-radius: 20px;
  padding: 3rem 2.5rem;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.result-card.fail .result-icon {
  background: var(--red-lt);
  color: var(--red);
}
.result-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  margin: 0 auto 1.25rem;
}
.result-card h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--red);
  margin-bottom: 0.5rem;
}
.result-score {
  font-size: 4rem;
  font-weight: 800;
  color: var(--slate-800);
}
.result-score span {
  font-size: 1.5rem;
  color: var(--slate-400);
}
.result-msg {
  margin: 1rem 0 0.5rem;
  color: var(--slate-600);
  line-height: 1.6;
}
.result-hint {
  color: var(--slate-400);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .login-card {
    padding: 1.75rem 1.25rem;
  }
  .login-title {
    font-size: 1.9rem;
  }

  /* Topbar */
  .topbar-progress {
    display: none;
  }
  .topbar-inner {
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }
  .topbar-brand {
    font-size: 0.85rem;
  }
  .quiz-badge {
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 50vw;
  }

  /* Module card */
  .module-card-header {
    padding: 1.25rem;
    gap: 0.75rem;
  }
  .module-icon-badge {
    font-size: 1.75rem;
  }
  .module-title {
    font-size: 1.2rem;
  }
  .module-content {
    padding: 1.25rem;
  }
  .module-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .module-actions {
    padding: 1rem 1.25rem 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  /* Materials */
  .material-card-row {
    padding: 1rem;
    gap: 0.75rem;
  }

  /* Quiz */
  .quiz-header h1 {
    font-size: 1.6rem;
  }
  .quiz-submit-bar {
    padding: 0.875rem 1rem;
    gap: 0.75rem;
  }

  /* Step cards (foto, firma) */
  .step-card {
    padding: 1.75rem 1.25rem;
  }

  /* Resultado hero */
  .hero-score {
    font-size: 3.5rem;
  }
  .hero-score span {
    font-size: 1.5rem;
  }
  .resultado-hero h1 {
    font-size: 2rem;
  }
  .result-score {
    font-size: 3rem;
  }
  .result-score span {
    font-size: 1.25rem;
  }

  /* PDF / documents */
  .pdf-info-grid {
    grid-template-columns: 1fr;
  }
  .pdf-checklist {
    grid-template-columns: 1fr;
  }
  .pdf-signatures {
    gap: 1.5rem;
  }
  .pdf-header-table {
    font-size: 0.65rem;
  }
  .pdf-main-title {
    font-size: 0.78rem;
  }
  .pdf-logo-cell {
    width: 18%;
    padding: 0.5rem;
  }
  .pdf-meta-cell {
    width: 22%;
  }
  .pdf-doc-control {
    font-size: 0.55rem;
    flex-wrap: wrap;
  }
  .pdf-doc-control span {
    padding: 0.2rem 0.2rem;
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
  }
  .pdf-logo-cell img {
    max-height: 40px;
    max-width: 60px;
  }
  .pdf-logo-cell {
    min-width: 65px;
    width: 15%;
  }

  /* Diploma */
  .diploma-border {
    border-width: 5px;
  }
  .diploma-outer {
    padding: 8px;
  }
  .diploma-main-title {
    font-size: 2rem;
  }
  .diploma-name {
    font-size: 1.4rem;
  }
  .diploma-inner {
    padding: 1.25rem 1rem;
  }
  .diploma-course {
    font-size: 1rem;
  }
  .diploma-fecha {
    position: static;
    display: block;
    text-align: right;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
  }

  /* Resultado actions */
  .resultado-actions {
    flex-direction: column;
    align-items: center;
  }
  .doc-tabs {
    gap: 0.35rem;
  }
  .tab-btn {
    font-size: 0.8rem;
    padding: 0.5rem 0.875rem;
  }
}

/* ── Tablet/phone (≤640px): docs preview + pdf-doc padding ─── */
@media (max-width: 640px) {
  .docs-container {
    padding: 1.25rem 1rem;
  }
  .pdf-doc {
    padding: 1.25rem 1rem;
  }
  /* Tabla de evaluación: anchos fijos por columna en móvil */
  .eval-table { table-layout: fixed; width: 100%; }
  .eval-table th,
  .eval-table td {
    padding: 0.3rem 0.25rem;
    font-size: 0.68rem;
    word-break: break-word;
    white-space: normal;
  }
  .eval-table th:nth-child(1),
  .eval-table td:nth-child(1) { width: 9%;  text-align: center; }
  .eval-table th:nth-child(2),
  .eval-table td:nth-child(2) { width: 36%; }
  .eval-table th:nth-child(3),
  .eval-table td:nth-child(3) { width: 28%; }
  .eval-table th:nth-child(4),
  .eval-table td:nth-child(4) { width: 27%; text-align: center; }
}

/* ── Small phones (≤480px): topbar wrap + tighter step cards ─── */
@media (max-width: 480px) {
  .topbar-inner {
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    padding: 0.65rem 0.875rem;
  }
  .topbar-brand {
    font-size: 0.8rem;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-brand img {
    height: 22px !important;
  }
  .quiz-badge {
    flex: 0 0 auto;
    font-size: 0.7rem;
    max-width: 55vw;
  }
  .centered-page {
    padding: 1rem;
  }
  .step-card {
    padding: 1.25rem 1rem;
  }
  .step-header h2 {
    font-size: 1.4rem;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }
  .print-target,
  .print-target * {
    visibility: visible !important;
  }
  .print-target {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
  }
  @page {
    margin: 8mm;
  }
}

.module-content pre {
  background: #fff7ed;
  color: #1e293b;
  border-left: 4px solid #ea580c;
  padding: 0.75rem 1rem;
  border-radius: 0 8px 8px 0;
  font-family: inherit;
  font-size: 0.95rem;
  white-space: pre-wrap;
  margin: 0.5rem 0;
}

.module-content blockquote {
  background: #eff6ff;
  color: #1e40af;
  border-left: 4px solid #2563eb;
  padding: 0.75rem 1rem;
  border-radius: 0 8px 8px 0;
  font-style: normal;
  margin: 0.5rem 0;
}

/* Footer público (login trabajador, login admin) */
.public-footer {
    text-align: center;
    padding: 1.25rem 1rem;
    font-size: 0.78rem;
    color: #94a3b8;
    background: transparent;
}
.public-footer a { color: #64748b; text-decoration: none; margin: 0 .15rem; }
.public-footer a:hover { color: #fff; text-decoration: underline; }
