/* Plan de estudios: temario, lecciones de lectura, cuestionarios y base de conocimiento.
   Usa los tokens definidos en app.css. */

[hidden] { display: none !important; }

/* Tira segmentada: lecciones, examen de módulo (más ancho) y examen final */
.strip > .strip-group { display: flex; gap: 2px; }
.strip > .strip-group + .strip-group, .strip > .seg.final { margin-left: 6px; }
.strip .seg { flex: 1 1 0; }
.strip .seg.exam { flex: 1.5 1 0; background: #B8C3D3; }
.strip .seg.final { flex: 2.5 1 0; background: #A9B5C7; }
.strip .seg.partial { background: #9CCBB6; }
.strip .seg.done { background: var(--done); }
.strip .seg.exam.done, .strip .seg.final.done { background: #145C40; }

.lead { font-size: 1.08rem; color: var(--ink-2); }
.score { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 2px 7px; border-radius: 10px; vertical-align: middle; }
.score.ok { background: var(--done-soft); color: var(--done); }
.score.ko { background: #FDF0D5; color: #8A5A00; }

/* ---------- Temario del curso ---------- */
.syllabus-full { list-style: none; margin: 8px 0 56px; padding: 0; display: grid; gap: 20px; }
.module-block { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-m); overflow: hidden; }
.module-block.locked { background: #F6F8FA; }
.module-head { padding: 18px 24px 14px; border-bottom: 1px solid var(--rule-soft); display: grid; gap: 4px; }
.module-head h2 { font-size: 1.3rem; }
.module-num { font-size: 0.85rem; color: var(--ink-3); font-weight: 600; }
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-list li > a, .lesson-list li > .locked-row {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 13px 24px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--rule-soft);
}
.lesson-list li:last-child > a, .lesson-list li:last-child > .locked-row { border-bottom: 0; }
.lesson-list li > a:hover { background: var(--paper); }
.lesson-list .locked-row { color: var(--ink-3); cursor: not-allowed; }
.lesson-list .mark, .syllabus .mark {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem;
  border: 1.5px solid var(--rule); color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums;
}
.lesson-list li.done .mark { background: var(--done); border-color: var(--done); color: #fff; }
.lesson-list li.locked .mark { border-style: dashed; color: var(--locked); }
.lesson-list .l-main { display: grid; gap: 2px; min-width: 0; }
.lesson-list .l-title { font-weight: 600; }
.l-sub { display: block; font-size: 0.85rem; color: var(--ink-3); font-weight: 400; }
.lesson-list .l-meta { display: flex; gap: 10px; align-items: center; font-size: 0.85rem; }
.lesson-list .exam-row > a, .lesson-list .exam-row > .locked-row { background: #F3F6FA; }
.lesson-list .exam-row .mark { border-radius: 6px; }
.lesson-list .exam-row.final > a, .lesson-list .exam-row.final > .locked-row { background: var(--action-soft); }
.lesson-list .exam-row.done .mark { background: #145C40; border-color: #145C40; color: #fff; }

/* ---------- Lección ---------- */
.lesson-head { display: grid; gap: 8px; margin-bottom: 20px; }
.annex { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 18px 20px; margin-bottom: 24px; display: grid; gap: 14px; }
.annex-head { display: grid; gap: 2px; }
.annex-head h2 { font-size: 1.1rem; }
.annex-head h2 i { color: #C4302B; }
.annex .meta a { color: var(--ink-2); }
.video-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.video-item {
  width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  text-align: left; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid transparent;
  border-radius: var(--radius-s); padding: 10px 12px; cursor: pointer;
}
.video-item:hover { border-color: var(--rule); }
.video-item.playing { border-color: var(--action); background: var(--action-soft); }
.v-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; font-size: 0.8rem; }
.video-item.done .v-icon { background: var(--done); }
.v-title { font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
.annex .l-dur { font-size: 0.85rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.prose-es { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: clamp(20px, 4vw, 40px); max-width: 100%; overflow-wrap: anywhere; }
.prose-es > h1 { margin-bottom: 10px; }
.prose-es h2 { font-size: 1.35rem; margin: 1.8em 0 0.5em; padding-top: 0.6em; border-top: 1px solid var(--rule-soft); scroll-margin-top: 16px; }
.prose-es > h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.prose-es h3 { font-size: 1.1rem; margin: 1.4em 0 0.4em; scroll-margin-top: 16px; }
.prose-es img { display: block; max-width: 100%; height: auto; margin: 1.2em auto; border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--sheet); }
.prose-es p, .prose-es ul, .prose-es ol { margin: 0 0 0.9em; max-width: 72ch; }
.prose-es li { margin-bottom: 0.3em; }
.prose-es code { background: var(--paper); padding: 1px 5px; border-radius: 3px; font-size: 0.9em; }
.prose-es pre { background: var(--ink); color: #E6ECF5; padding: 14px 16px; border-radius: var(--radius-s); overflow-x: auto; font-size: 0.88rem; }
.prose-es pre code { background: none; padding: 0; }
.prose-es table { border-collapse: collapse; margin: 0 0 1.2em; font-size: 0.93rem; display: block; max-width: 100%; overflow-x: auto; }
.prose-es th, .prose-es td { border: 1px solid var(--rule); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose-es th { background: var(--paper); font-weight: 600; }
.prose-es blockquote { margin: 0 0 1em; padding: 10px 16px; border-left: 3px solid var(--action); background: var(--action-soft); color: var(--ink); }
.prose-es blockquote p:last-child { margin-bottom: 0; }
.prose-es :target { background: #FFF6D6; box-shadow: 0 0 0 6px #FFF6D6; border-radius: 2px; }
.sources { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 0.85rem; color: var(--ink-3); }
.sources a { color: var(--ink-2); margin-left: 4px; }

.quiz-cta {
  margin-top: 24px; background: var(--ink); color: #fff; border-radius: var(--radius-m); padding: 22px 24px;
  display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap;
}
.quiz-cta h2 { font-size: 1.25rem; }
.quiz-cta .muted { color: #C5D2E6; max-width: 56ch; }
.quiz-cta.done { background: var(--done-soft); color: var(--ink); }
.quiz-cta.done .muted { color: var(--ink-2); }
.quiz-cta.done h2 i { color: var(--done); }
.quiz-cta .btn-quiet { color: inherit; border-color: currentColor; }
.quiz-cta .btn-quiet:hover { background: rgba(255,255,255,0.08); }
.cta-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 20px 0 56px; }
.lesson-nav .btn { white-space: normal; text-align: left; }
.syllabus-head strong { font-family: var(--font-head); font-stretch: 87.5%; font-size: 1.1rem; }

/* ---------- Cuestionario ---------- */
.quiz-wrap { max-width: 860px; }
.quiz-form { display: grid; gap: 16px; padding-bottom: 56px; }
.question { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 20px 22px; margin: 0; display: grid; gap: 8px; min-width: 0; }
.question legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; font-weight: 600; font-size: 1.05rem; line-height: 1.4; }
.q-num { color: var(--ink-3); margin-right: 4px; }
.option { display: grid; grid-template-columns: auto 28px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--rule-soft); border-radius: var(--radius-s); cursor: pointer; }
.option:hover { border-color: var(--rule); background: var(--paper); }
.option input { width: 18px; height: 18px; accent-color: var(--action); margin: 0; }
.option:has(input:checked) { border-color: var(--action); background: var(--action-soft); }
.opt-letter { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); font-weight: 700; font-size: 0.8rem; color: var(--ink-2); }
.quiz-submit {
  position: sticky; bottom: 0; background: var(--paper); border-top: 1px solid var(--rule);
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}

.result-head { margin: 28px 0 24px; padding: 24px; border-radius: var(--radius-m); background: var(--sheet); border: 1px solid var(--rule); border-left: 6px solid var(--done); display: grid; gap: 10px; }
.result-head.ko { border-left-color: #D99A1E; }
.result-score { font-family: var(--font-head); font-size: 3rem; font-weight: 800; line-height: 1; }
.result-head.ok .result-score { color: var(--done); }
.result-head.ko .result-score { color: #8A5A00; }
.review-title { margin-bottom: 12px; }
.review { list-style: none; margin: 0 0 56px; padding: 0; display: grid; gap: 14px; }
.review > li { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 18px 20px; display: grid; gap: 10px; }
.r-q { font-weight: 600; }
.review li.ok .r-q i { color: var(--done); }
.review li.ko .r-q i { color: var(--danger); }
.r-options { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.r-options li { padding: 8px 12px; border-radius: var(--radius-s); background: var(--paper); font-size: 0.95rem; display: flex; justify-content: space-between; gap: 12px; }
.r-options li.answer { background: var(--done-soft); color: #134D37; font-weight: 600; }
.r-options li.wrong { background: var(--danger-soft); color: var(--danger); }
.r-options .tag { font-size: 0.78rem; white-space: nowrap; }
.r-expl { font-size: 0.93rem; color: var(--ink-2); }
.r-expl a { margin-left: 4px; }

/* ---------- Base de conocimiento ---------- */
.kb-search { display: flex; gap: 10px; max-width: 680px; margin-top: 6px; flex-wrap: wrap; }
.kb-search input { flex: 1 1 240px; min-width: 0; font: inherit; padding: 11px 14px; border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--sheet); color: var(--ink); }
.kb-search input:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 3px var(--action-soft); }
.kb-areas { columns: 3 300px; column-gap: 24px; padding-bottom: 56px; }
.kb-area { break-inside: avoid; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 16px 20px; margin-bottom: 20px; display: inline-block; width: 100%; }
.kb-area h2 { font-size: 1.15rem; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 8px; }
.kb-area ul { list-style: none; margin: 0; padding: 0; }
.kb-area li { padding: 5px 0; border-bottom: 1px solid var(--rule-soft); font-size: 0.93rem; }
.kb-area li:last-child { border-bottom: 0; }
.kb-area a { color: var(--ink); text-decoration: none; }
.kb-area a:hover { color: var(--action); text-decoration: underline; }
.kb-hit { padding: 16px 24px; border-bottom: 1px solid var(--rule-soft); display: grid; gap: 4px; }
.kb-hit:last-child { border-bottom: 0; }
.kb-hit h3 a { color: var(--ink); }
.kb-hit mark { background: #FFE89A; color: inherit; padding: 0 1px; }
.kb-empty { padding: 20px 24px; color: var(--ink-2); }

@media (max-width: 760px) {
  .lesson-list li > a, .lesson-list li > .locked-row { padding: 12px 16px; grid-template-columns: 28px minmax(0, 1fr); }
  .lesson-list .l-meta { grid-column: 2; }
  .module-head { padding: 16px; }
  .question { padding: 16px; }
  .kb-hit { padding: 14px 16px; }
  .totals .total b { font-size: 1.6rem; }
}

/* Destino de un enlace desde la Videoteca: resalta la lección en el plan */
.lesson-list li[id^="l-"] { scroll-margin-top: 90px; }
.lesson-list li:target { background: var(--action-soft); box-shadow: inset 4px 0 0 var(--action); animation: target-flash 1.6s ease-out 1; }
@keyframes target-flash { from { background: #fff3c4; } to { background: var(--action-soft); } }

/* ---------- Tesis final de graduación ---------- */
.th-banner { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-radius: var(--radius-m); margin-bottom: 22px; border: 1px solid var(--rule); background: var(--sheet); }
.th-banner i { font-size: 1.5rem; }
.th-banner.ok { background: var(--done-soft); border-color: var(--done); }
.th-banner.ok i { color: var(--done); }
.th-banner.lock i { color: var(--ink-3); }
.th-how { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 28px; }
.th-how > div { display: grid; grid-template-columns: 32px 1fr; column-gap: 12px; align-items: start; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 12px 14px; }
.th-how .num { grid-row: span 2; width: 32px; height: 32px; border-radius: 50%; background: var(--action); color: #fff; display: grid; place-items: center; font-weight: 700; }
.th-how small { color: var(--ink-3); line-height: 1.35; }
.th-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; padding-bottom: 56px; }
.th-card { background: var(--sheet); border: 1px solid var(--rule); border-top: 5px solid var(--action); border-radius: var(--radius-m); padding: 22px; display: grid; gap: 10px; align-content: start; }
.th-card.th-industrial { border-top-color: #B45309; }
.th-card.th-agroalimentaria { border-top-color: #1E7A57; }
.th-card.th-retail-distribucion { border-top-color: #7C3AED; }
.th-icon { width: 52px; height: 52px; border-radius: 12px; background: var(--action-soft); color: var(--action); display: grid; place-items: center; font-size: 1.5rem; }
.th-industrial .th-icon { background: #FDEBD3; color: #B45309; }
.th-agroalimentaria .th-icon { background: var(--done-soft); color: var(--done); }
.th-retail-distribucion .th-icon { background: #EDE5FD; color: #7C3AED; }
.th-kicker { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; margin: 0; }
.th-card h2 { font-size: 1.3rem; }
.th-company { font-size: 0.92rem; background: var(--paper); border-radius: var(--radius-s); padding: 10px 12px; }
.th-aud { font-size: 0.85rem; }
.th-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--rule-soft); }
.th-foot .faint { flex: 1; font-size: 0.85rem; }
.btn.disabled { opacity: .6; cursor: not-allowed; }
.th-wrap { max-width: 1240px; }
.th-case { background: var(--sheet); border: 1px solid var(--rule); border-left: 5px solid var(--action); border-radius: var(--radius-m); padding: 20px 24px; margin-bottom: 24px; display: grid; gap: 10px; }
.th-case h2 { font-size: 1.3rem; }
.th-case h2 i { color: var(--action); margin-right: 6px; }
.th-facts { margin: 0; padding-left: 20px; columns: 2 320px; font-size: 0.93rem; color: var(--ink-2); }
.th-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
.th-steps { position: sticky; top: 12px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 12px 6px; font-size: 0.88rem; }
.th-steps ol { list-style: none; margin: 0 0 8px; padding: 0; }
.th-steps a { display: flex; gap: 8px; padding: 6px 10px; color: var(--ink-2); text-decoration: none; border-radius: var(--radius-s); line-height: 1.3; }
.th-steps a:hover { background: var(--paper); color: var(--ink); }
.th-steps a .num { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--rule-soft); display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; }
.th-steps p { padding: 0 12px; }
.th-stage { display: grid; gap: 14px; margin-bottom: 40px; scroll-margin-top: 16px; }
.th-stage > header { display: grid; gap: 4px; border-bottom: 2px solid var(--ink); padding-bottom: 8px; }
.th-stage-n { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--action); font-weight: 700; }
.th-course { font-size: 0.88rem; text-decoration: none; }
.th-scenario { background: var(--action-soft); border-radius: var(--radius-m); padding: 14px 18px; line-height: 1.55; max-width: none; }
.th-practice { background: #FFF8E6; border: 1px solid #EBD38B; border-radius: var(--radius-m); padding: 16px 20px; display: grid; gap: 8px; }
.th-practice h3 { font-size: 1.05rem; }
.th-task { white-space: pre-line; max-width: none; }
.th-check { display: flex; gap: 10px; align-items: center; font-weight: 600; cursor: pointer; margin-top: 4px; }
.th-check input { width: 18px; height: 18px; accent-color: var(--done); }
.th-scores { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 6px; }
.th-scores a { display: grid; grid-template-columns: 28px 1fr auto 20px; gap: 10px; align-items: center; padding: 8px 12px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-s); text-decoration: none; color: var(--ink); }
.th-scores li.ok a { border-left: 4px solid var(--done); }
.th-scores li.ko a { border-left: 4px solid var(--danger); }
.th-scores .fa-hammer { color: var(--done); }
.th-scores .fa-circle-exclamation { color: var(--danger); }
.th-review { margin-bottom: 28px; scroll-margin-top: 16px; }
.th-review h3 { margin-bottom: 10px; }
@media (max-width: 980px) { .th-layout { grid-template-columns: 1fr; } .th-steps { position: static; } }
