/* NEXORA Learning — sistema de diseño (según el informe de diseño y la maqueta). */

:root {
  --verde: #1a3331;
  --texto: #1f2e2c;
  --fondo: #f8f1e5;
  --tarjeta: #fffbf4;
  --barra: #f2e2cc;
  --texto-2: #5e5448;
  --borde: #e3d3bb;
  --borde-campo: #8f7f66;
  --tinte-verde: #dde7df;
  --exito: #2f6b4f;
  --exito-fondo: #e2efe6;
  --error: #9b2c1d;
  --error-fondo: #f7e1dc;
  --ambar-fondo: #fbebc8;
  --radio: 8px;
  --radio-tarjeta: 12px;
  --fuente: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

body {
  margin: 0;
  font-family: var(--fuente);
  font-size: 14px;
  line-height: 1.5;
  color: var(--texto);
  background: var(--fondo);
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; font-weight: 700; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 600; }
a { color: var(--verde); }
:focus-visible { outline: 3px solid var(--verde); outline-offset: 2px; }

[hidden] { display: none !important; }
.muted { color: var(--texto-2); }
.small { font-size: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Marca ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-name { font-size: 18px; letter-spacing: 0; }
.brand-name strong { font-weight: 700; letter-spacing: 0.06em; }
.brand-name span { font-weight: 400; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  font: 600 14px/1 var(--fuente);
  border-radius: var(--radio); border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--verde); color: #fff; }
.btn-primary:hover { background: #12251f; }
.btn-secondary { background: var(--tarjeta); color: var(--texto); border-color: var(--borde-campo); }
.btn-secondary:hover { background: var(--barra); }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-link {
  background: none; border: 0; padding: 0; min-height: 0;
  font: inherit; color: inherit; text-decoration: underline; cursor: pointer;
}

/* ---------- Formularios ---------- */
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.field input[type="email"], .field input[type="password"], .field input[type="text"],
.field input[type="number"], .field input[type="date"], .field input[type="search"],
.field select, .field textarea {
  width: 100%; min-height: 44px; padding: 0 12px;
  font: 400 15px var(--fuente); color: var(--texto);
  background: #fff; border: 1px solid var(--borde-campo); border-radius: var(--radio);
}
.field textarea { padding: 10px 12px; min-height: 84px; resize: vertical; line-height: 1.4; }
.field input::placeholder { color: #8a7f70; }
.field .help { font-size: 12px; color: var(--texto-2); }
.field .errorlist { list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--error); }
.form-stack { display: grid; gap: 14px; }
.table input[type="date"] {
  min-height: 40px; padding: 0 10px; font: 400 14px var(--fuente); color: var(--texto);
  background: #fff; border: 1px solid var(--borde-campo); border-radius: var(--radio);
}

/* ---------- Tarjetas y avisos ---------- */
.card {
  background: var(--tarjeta); border: 1px solid var(--borde);
  border-radius: var(--radio-tarjeta); padding: 20px; display: grid; gap: 14px;
}
.alert { padding: 10px 12px; border-radius: var(--radio); font-size: 13px; }
.alert-error { background: var(--error-fondo); color: var(--error); border: 1px solid #e3b6ad; }
.alert-success { background: var(--exito-fondo); color: var(--exito); }
.alert-warning { background: var(--ambar-fondo); color: var(--texto); }

.empty-state { text-align: center; padding: 40px 20px; justify-items: center; }
.empty-state h2 { font-size: 18px; }

/* ---------- Selector de idioma (mundo + menú) ---------- */
.lang-menu { position: relative; display: inline-block; }
.lang-menu summary {
  display: inline-flex; align-items: center; gap: 8px; list-style: none;
  min-height: 36px; padding: 0 10px; cursor: pointer; user-select: none;
  font: 600 13px/1 var(--fuente); color: var(--texto);
  background: var(--tarjeta); border: 1px solid var(--borde-campo); border-radius: var(--radio);
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover { background: var(--tinte-verde); }
.lang-menu[open] summary { border-color: var(--verde); }
.lang-menu svg { width: 18px; height: 18px; flex: none; }
.lang-menu .lang-chevron { width: 14px; height: 14px; transition: transform 0.15s; }
.lang-menu[open] .lang-chevron { transform: rotate(180deg); }
.lang-menu-list {
  position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; min-width: 168px;
  display: grid; gap: 2px; padding: 6px;
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio-tarjeta);
  box-shadow: 0 8px 24px rgba(26, 51, 49, 0.14);
}
.lang-menu--up .lang-menu-list { top: auto; bottom: calc(100% + 6px); right: auto; left: 0; }
.lang-menu-list button {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 40px; padding: 0 10px; text-align: left; cursor: pointer;
  font: 500 14px var(--fuente); color: var(--texto);
  background: transparent; border: 0; border-radius: 6px;
}
.lang-menu-list button:hover { background: var(--tinte-verde); }
.lang-menu-list button svg { width: 16px; height: 16px; visibility: hidden; }
.lang-menu-list button[aria-current="true"] { font-weight: 700; color: var(--verde); }
.lang-menu-list button[aria-current="true"] svg { visibility: visible; }

/* ---------- Acceso (login, recuperar y crear contraseña) ----------
   Reglas para que nada se mueva entre pantallas ni al aparecer avisos o errores:
   - el panel verde queda fijo (sticky) y a pantalla completa;
   - la tarjeta se centra en horizontal (width 100% + max-width + margin auto);
   - la tarjeta queda anclada a una altura fija: si crece, crece hacia abajo;
   - el selector de idioma va en posición absoluta y no empuja la tarjeta;
   - el espacio de la barra de desplazamiento se reserva siempre. */
@media (min-width: 701px) { html:has(.auth) { scrollbar-gutter: stable; } }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-panel {
  background: var(--verde); color: #f2e2cc;
  display: flex; flex-direction: column; justify-content: center; gap: 18px;
  padding: clamp(32px, 5vw, 64px); position: sticky; top: 0; height: 100vh; align-self: start;
}
.auth-panel svg { align-self: flex-start; }
.auth-panel .brand-name { font-size: 16px; }
.auth-panel h1 { font-size: clamp(28px, 3vw, 38px); color: #f8f1e5; max-width: 14ch; line-height: 1.15; }
.auth-panel p { max-width: 34ch; color: #d9c8ae; font-size: 15px; }
.auth-main {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: max(72px, calc(50vh - 210px)) 32px 32px;
}
.auth-card { width: 100%; max-width: 420px; margin-inline: auto; }
.auth-card h2 { font-size: 22px; font-weight: 700; line-height: 1.25; }
.auth-card .brand { color: var(--verde); }
.auth-lang { position: absolute; top: 20px; right: 24px; }

/* ---------- Barra superior del empleado ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 10px 32px; background: var(--barra); border-bottom: 1px solid var(--borde);
}
.topbar .brand { color: var(--verde); }
.topbar nav { display: flex; gap: 20px; flex: 1; }
.topbar nav a { font-weight: 600; text-decoration: none; padding: 6px 0; border-bottom: 3px solid transparent; }
.topbar nav a[aria-current="page"] { border-bottom-color: var(--verde); }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.page > * { min-width: 0; }
.page { max-width: 1000px; margin: 0 auto; padding: 32px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }

/* ---------- Panel del administrador ---------- */
.admin { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar {
  background: var(--barra); border-right: 1px solid var(--borde);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 20px;
}
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a, .sidebar nav span {
  display: block; padding: 10px 12px; border-radius: var(--radio);
  text-decoration: none; font-weight: 500;
}
.sidebar nav a[aria-current="page"] { background: var(--verde); color: #fff; font-weight: 600; }
.sidebar nav span[aria-disabled="true"] { color: var(--texto-2); cursor: default; }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; font-size: 12px; color: var(--texto-2); }
.sidebar-foot .lang-menu { justify-self: start; }
.admin-main { padding: 28px 32px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.crumb { font-size: 13px; color: var(--texto-2); }

/* ---------- Formularios largos (cursos, empleados) ---------- */
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field legend { font-size: 13px; font-weight: 600; padding: 0; margin-bottom: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.assign-grid { grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr); }
.stack-lg { display: grid; gap: 20px; }
.narrow { max-width: 520px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions form { display: contents; }
.page-head > div:first-child { min-width: 0; flex: 1; }
.page-head > .actions { flex-wrap: nowrap; flex-shrink: 0; }
.radio-row { display: flex; gap: 20px; flex-wrap: wrap; }
.radio-line { display: flex; align-items: center; gap: 10px; min-height: 44px; flex-wrap: wrap; }
.radio-line input[type="number"] { width: 84px; }
.radio-line input[type="date"] { width: auto; min-width: 160px; }
.radio, .check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; cursor: pointer; }
.radio input, .check input { width: 18px; height: 18px; accent-color: var(--verde); margin: 0; }
.checks { display: grid; gap: 10px; }
.inline-number { grid-template-columns: 1fr 84px; align-items: center; }
.inline-number .errorlist { grid-column: 1 / -1; }
.subsection { display: grid; gap: 12px; padding-top: 6px; border-top: 1px solid var(--borde); }
.subsection h3 { font-size: 14px; font-weight: 600; margin-top: 8px; }

/* ---------- Filtros, chips y tablas ---------- */
.filters { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.search-field { width: min(360px, 100%); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 2px; }
.chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  font-size: 13px; font-weight: 600; text-decoration: none; color: var(--texto);
  background: var(--tarjeta); border: 1px solid var(--borde-campo); border-radius: 999px;
}
.chip:hover { background: var(--tinte-verde); }
.chip[aria-current="true"] { background: var(--verde); color: #fff; border-color: var(--verde); }
.table-card { padding: 8px 20px; overflow-x: auto; }
/* Tabla dentro de una tarjeta normal: en pantallas angostas se desplaza sin ensanchar la página. */
.table-scroll { overflow-x: auto; max-width: 100%; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--texto-2); padding: 14px 10px 10px; }
.table td { padding: 12px 10px; border-top: 1px solid var(--borde); vertical-align: middle; }
.table .check-col { width: 36px; }
.table .nowrap, .table td strong { white-space: nowrap; }
.table .check-col input { width: 18px; height: 18px; accent-color: var(--verde); }
.table .right { text-align: right; }
.course-link { font-weight: 600; color: var(--texto); }
.btn-sm { min-height: 36px; padding: 0 16px; font-size: 13px; }
.btn-dashed { background: var(--tarjeta); color: var(--texto); border: 1px dashed var(--borde-campo); list-style: none; }
.btn-dashed:hover { background: var(--barra); }
.btn-danger { background: var(--tarjeta); color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: var(--error-fondo); }

.tag {
  display: inline-block; padding: 2px 10px; font-size: 12px; font-weight: 600;
  background: var(--barra); color: var(--texto); border-radius: 999px;
}
.badge {
  display: inline-block; padding: 2px 10px; font-size: 12px; font-weight: 600; vertical-align: middle;
  border-radius: 999px; border: 1px solid var(--borde-campo); background: transparent; color: var(--texto);
}
.badge-published { background: var(--tinte-verde); border-color: transparent; color: var(--verde); }
.badge-archived { background: var(--barra); border-color: transparent; color: var(--texto-2); }
.badge-editing { background: var(--verde); border-color: var(--verde); color: #fff; }
.badge-overdue { background: var(--error-fondo); border-color: transparent; color: var(--error); }
h1 .badge { font-size: 12px; margin-left: 8px; }

/* ---------- Módulos del curso ---------- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.add-module summary { cursor: pointer; display: inline-flex; align-items: center; }
.add-module summary::-webkit-details-marker { display: none; }
.add-module[open] { width: 100%; }
.add-module[open] summary { display: none; }
.add-module-form { display: flex; gap: 8px; align-items: center; }
.add-module-form input { min-height: 36px; padding: 0 10px; border: 1px solid var(--borde-campo); border-radius: var(--radio); font: 400 14px var(--fuente); width: 240px; max-width: 100%; }
.card-head:has(.add-module[open]) h2 { display: none; }
.module-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.module-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio-tarjeta);
}
.module-item.is-selected { background: var(--tinte-verde); border: 2px solid var(--verde); padding: 11px 13px; }
.module-main { flex: 1; display: grid; gap: 2px; text-decoration: none; color: var(--texto); }
.module-tools { display: inline-flex; gap: 4px; }
.icon-btn {
  width: 32px; height: 32px; font: 600 15px var(--fuente); cursor: pointer;
  background: var(--tarjeta); color: var(--texto); border: 1px solid var(--borde-campo); border-radius: var(--radio);
}
.icon-btn:hover:not([disabled]) { background: var(--barra); }
.icon-btn[disabled] { opacity: .4; cursor: not-allowed; }
.empty-inline { padding: 24px 8px; text-align: center; }
.danger-zone { margin-top: 4px; }

/* ---------- Mis cursos (tarjetas) ---------- */
.course-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.course-card { align-content: start; gap: 12px; }
.course-card h2 { font-size: 17px; }
.course-card .tags { display: flex; gap: 8px; flex-wrap: wrap; }
.progress { height: 6px; background: var(--barra); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--verde); border-radius: 999px; }

/* ---------- Pantallas estrechas ---------- */
@media (max-width: 800px) {
  .admin { grid-template-columns: 1fr; }
  .form-grid, .assign-grid { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar-foot { margin-top: 0; }
  .topbar, .page, .admin-main { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 560px) {
  .page-head { flex-wrap: wrap; align-items: flex-start; }
  .page-head > .actions { flex-wrap: wrap; flex-shrink: 1; }
}

/* ---------- Buzón de correos (solo desarrollo) ---------- */
.dev-mailbox-link {
  position: fixed; right: 12px; bottom: 12px; z-index: 50;
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  font-size: 16px; background: var(--tarjeta); color: var(--verde);
  border: 1px solid var(--borde-campo); text-decoration: none;
  box-shadow: 0 1px 4px rgba(26, 51, 49, 0.15);
}
.dev-mailbox-link:hover { background: var(--tinte-verde); }
.mailbox-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.mailbox-head h1 { margin-bottom: 4px; }
.mailbox-actions { display: flex; gap: 8px; }
.mailbox-item { gap: 10px; }
.mailbox-meta { display: grid; gap: 2px; }
.mailbox-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; }

/* Acceso en móvil: el panel verde pasa arriba como una franja fija. */
@media (max-width: 700px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-panel svg { width: 36px; height: 36px; }
  .auth-panel { position: static; height: auto; padding: 20px 24px; gap: 10px; }
  .auth-panel h1 { font-size: 22px; max-width: none; }
  .auth-panel p { display: none; }
  .auth-main { padding: 72px 16px 32px; }
  .auth-lang { top: 16px; right: 16px; }
}

/* ---------- Presentación (PDF a diapositivas) ---------- */
.deck-panel { display: grid; gap: 14px; padding-top: 14px; border-top: 1px solid var(--borde); }
.deck-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.deck-head h3 { font-size: 15px; font-weight: 600; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 12px; }
.slide-thumb { display: grid; gap: 6px; align-content: start; }
.slide-open {
  display: block; padding: 0; border: 1px solid var(--borde); border-radius: 6px; background: #fff;
  overflow: hidden; cursor: zoom-in; line-height: 0;
}
.slide-open:hover { border-color: var(--verde); box-shadow: 0 2px 10px rgba(26, 51, 49, 0.18); }
.slide-open img { width: 100%; height: auto; display: block; }
.slide-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; }
.slide-meta strong { font-weight: 700; }
.slide-thumb label, .deck-all label { font-size: 12px; font-weight: 600; }
.slide-thumb input, .deck-all input {
  min-height: 36px; padding: 0 8px; border: 1px solid var(--borde-campo); border-radius: var(--radio);
  font: 400 14px var(--fuente); width: 100%; max-width: 160px; background: #fff;
}
.btn-text {
  min-height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent;
  font: 600 12px var(--fuente); color: var(--texto-2); cursor: pointer;
}
.btn-text:hover { background: var(--barra); color: var(--texto); }
.btn-text-danger { color: var(--error); }
.btn-text-danger:hover { background: var(--error-fondo); color: var(--error); }
.deck-all { display: grid; gap: 4px; margin-bottom: 12px; }
.deck-timings .btn { margin-top: 0; }
.deck-removed { border: 1px dashed var(--borde-campo); border-radius: var(--radio); padding: 12px 14px; background: #fff; }
.deck-removed summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.deck-removed-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.deck-removed .slide-open { opacity: 0.7; filter: grayscale(0.6); }
.deck-upload { display: grid; gap: 10px; }
.deck-upload form { margin-top: 10px; }

/* ---------- Subir PDF (arrastrar o elegir) ---------- */
.pdf-upload { position: relative; display: grid; gap: 12px; }
.pdf-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.pdf-drop {
  display: grid; justify-items: center; gap: 4px; text-align: center; padding: 26px 16px; cursor: pointer;
  background: #fff; border: 2px dashed var(--borde-campo); border-radius: var(--radio-tarjeta);
  transition: background 0.15s, border-color 0.15s;
}
.pdf-drop:hover, .pdf-drop.is-over { background: var(--tinte-verde); border-color: var(--verde); }
.pdf-input:focus-visible + .pdf-drop { outline: 3px solid var(--verde); outline-offset: 2px; }
.pdf-drop-icon { width: 40px; height: 40px; color: var(--verde); margin-bottom: 4px; }
.pdf-drop-title { font-size: 15px; font-weight: 700; }
.pdf-drop-sub { font-size: 13px; color: var(--texto-2); }
.pdf-drop-sub u { color: var(--verde); font-weight: 600; }
.pdf-drop-hint { font-size: 12px; color: var(--texto-2); margin-top: 6px; }
.pdf-chosen {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--borde); border-radius: var(--radio);
}
.pdf-chosen-badge {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 8px;
  background: var(--error-fondo); color: var(--error); font-size: 12px; font-weight: 700;
}
.pdf-chosen-info { flex: 1; min-width: 160px; display: grid; gap: 2px; }
.pdf-chosen-name { font-weight: 600; font-size: 14px; word-break: break-all; }
.pdf-upload .btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Ventanas flotantes (confirmar y ver diapositiva) ---------- */
dialog { color: var(--texto); font-family: var(--fuente); }
dialog::backdrop { background: rgba(26, 51, 49, 0.6); }
html:has(dialog[open]) { overflow: hidden; }

.confirm {
  width: min(440px, calc(100vw - 32px)); padding: 0; background: var(--tarjeta);
  border: 1px solid var(--borde); border-radius: var(--radio-tarjeta);
  box-shadow: 0 24px 60px rgba(26, 51, 49, 0.35);
}
.confirm-box { display: grid; gap: 10px; padding: 24px; }
.confirm-icon {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--error-fondo); color: var(--error); font-size: 20px; font-weight: 700;
}
.confirm-box h2 { margin: 4px 0 0; font-size: 18px; font-weight: 700; }
.confirm-box p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--texto-2); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.btn-danger-solid { background: var(--error); color: #fff; border-color: var(--error); }
.btn-danger-solid:hover { background: #7f2216; border-color: #7f2216; }

.viewer {
  width: 100vw; height: 100vh; max-width: none; max-height: none; padding: 0; margin: 0;
  border: 0; background: transparent;
}
.viewer[open] { display: grid; place-items: center; }
.viewer-frame { position: relative; display: grid; gap: 10px; justify-items: stretch; max-width: 96vw; }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #fff; }
.viewer-caption { font-size: 14px; font-weight: 600; }
.viewer-close {
  display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: var(--tarjeta); color: var(--texto); font: 700 18px var(--fuente); cursor: pointer;
}
.viewer-close:hover { background: var(--barra); }
.viewer-image {
  display: block; width: auto; height: auto; max-width: min(94vw, 1500px); max-height: calc(100vh - 110px);
  margin: 0 auto; background: #fff; border-radius: 8px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.viewer-nav {
  position: absolute; top: 50%; width: 44px; height: 44px; margin-top: 16px; transform: translateY(-50%);
  display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 251, 244, 0.92); color: var(--texto); font: 600 26px/1 var(--fuente);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.viewer-nav:hover { background: #fff; }
.viewer-prev { left: 10px; }
.viewer-next { right: 10px; }

/* ---------- Curso del empleado y reproductor de diapositivas ---------- */
.badge-done { background: var(--exito-fondo); border-color: transparent; color: var(--exito); }
.badge-progress { background: var(--ambar-fondo); border-color: transparent; color: var(--texto); }
.badge-locked { background: var(--barra); border-color: transparent; color: var(--texto-2); }
.progress-line { display: flex; align-items: center; gap: 12px; }
.progress-line .progress { flex: 1; }
.steps { display: grid; gap: 12px; }
.step { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; }
.step-locked { opacity: .7; }
.step-num {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--tinte-verde); color: var(--verde); font-weight: 700;
}
.step-body { display: grid; gap: 4px; min-width: 0; }
.step-body h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-actions { display: flex; gap: 8px; }

.player { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.player-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.player-position { font-weight: 600; }
.player-hint { color: var(--texto-2); font-size: 13px; }
.player-stage {
  background: #fff; border: 1px solid var(--borde); border-radius: var(--radio-tarjeta);
  overflow: hidden; line-height: 0; user-select: none; -webkit-user-select: none;
}
.player-stage img { width: 100%; height: auto; display: block; -webkit-user-drag: none; }
.player-nav { display: flex; justify-content: space-between; gap: 12px; }
.player-nav .btn { min-width: 140px; }
@media print { .player-stage { display: none; } }
@media (max-width: 560px) {
  .step { grid-template-columns: auto minmax(0, 1fr); }
  .step-actions { grid-column: 1 / -1; }
  .step-actions .btn { width: 100%; }
}

/* ---------- Quiz ---------- */
.question-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.question-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--borde); border-radius: var(--radio); flex-wrap: wrap; }
.question-main { display: grid; gap: 2px; min-width: 0; flex: 1 1 260px; }
.question-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.question-tools form { display: flex; gap: 4px; }
.question-form { max-width: 720px; }
.question-options { border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px; display: grid; gap: 10px; margin: 0; min-width: 0; }
.question-options legend { font-weight: 600; padding: 0 6px; }
.option-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.check-line { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.check-line input { width: 18px; height: 18px; }
.answer-text { margin: 0; padding: 12px 14px; background: var(--barra); border-radius: var(--radio); white-space: normal; overflow-wrap: anywhere; }
.similar-card { border-color: #e3b6ad; }
.rules { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.attempt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.attempt-list li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.quiz-form { display: grid; gap: 16px; }
.quiz-timer { display: flex; align-items: baseline; gap: 8px; font-size: 20px; }
.quiz-timer .is-low { color: var(--error); }
.question-card { margin: 0; min-width: 0; gap: 10px; }
.question-text { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.question-num { color: var(--texto-2); }
.choice-list { display: grid; gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--borde-campo); border-radius: var(--radio); background: var(--tarjeta); cursor: pointer; }
.choice:has(input:checked) { background: var(--tinte-verde); border-color: var(--verde); }
.choice input { width: 20px; height: 20px; flex: none; }
.choice-result { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.choice-result .is-correct { color: var(--exito); font-weight: 600; }
.choice-result .is-chosen:not(.is-correct) { color: var(--texto); }
.results { display: grid; gap: 12px; }
.result-card .score { font-size: 44px; font-weight: 700; line-height: 1; }
.score-pass { color: var(--exito); }
.score-fail { color: var(--error); }
.question-card textarea { width: 100%; }
.quiz-panel { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--borde); }
.quiz-panel .btn { justify-self: start; }

/* ---------- Certificados y verificación pública ---------- */
.page-narrow { max-width: 640px; }
.cert-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.verify-card { gap: 14px; }
.verify-ok { border-left: 4px solid var(--exito); }
.verify-expired, .verify-missing { border-left: 4px solid var(--error); }
.verify-status { margin: 0; }
.verify-data { display: grid; gap: 10px; margin: 0; }
.verify-data > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; }
.verify-data dt { color: var(--texto-2); font-size: 13px; }
.verify-data dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.verify-form { gap: 14px; }
@media (max-width: 560px) {
  .verify-data > div { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- Paneles de administración: progreso, alertas, configuración ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; }
.settings-grid { display: grid; gap: 20px; }
.rule-list { display: grid; gap: 10px; margin: 0; }
.rule-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: baseline; }
.rule-list dt { font-weight: 600; }
.rule-list dt span { display: block; font-weight: 400; color: var(--texto-2); font-size: 13px; }
.rule-list dd { margin: 0; font-weight: 700; white-space: nowrap; }
.filters > * { min-width: 0; max-width: 100%; }
.filters > select, .filters > input[type="search"] {
  min-height: 44px; padding: 0 12px; font: 400 15px var(--fuente); color: var(--texto);
  background: #fff; border: 1px solid var(--borde-campo); border-radius: var(--radio);
}
.filters > input[type="search"] { width: 240px; }
.filters > select { text-overflow: ellipsis; }
.table .badge { white-space: nowrap; }
@media (max-width: 560px) {
  .filters select, .filters input[type="search"] { flex: 1 1 100%; }
}

/* Zonas táctiles de al menos 44 px en pantallas táctiles y en pantallas angostas. */
@media (pointer: coarse), (max-width: 800px) {
  .btn-sm, .lang-menu summary, .add-module-form input { min-height: 44px; }
  .lang-menu-list button { min-height: 44px; }
  .table .check-col { width: 44px; }
  .table .check-col input[type="checkbox"] { width: 24px; height: 24px; }
}

/* Portada del curso (tarjeta de «Mis cursos» y vista previa en el editor). */
.course-cover { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radio); background: var(--tinte-verde); }
.cover-preview { display: block; max-width: 100%; height: auto; border-radius: var(--radio); border: 1px solid var(--borde); margin-top: 8px; }

.quiz-warning:empty { display: none; }
.quiz-warning { margin: 0 0 16px; font-weight: 600; }
.field-error { color: var(--error); }

.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.inline-form input[type="number"] { width: 84px; min-height: 36px; padding: 0 8px; border: 1px solid var(--borde-campo); border-radius: var(--radio); font: 400 14px var(--fuente); }
@media (pointer: coarse), (max-width: 800px) { .inline-form input[type="number"] { min-height: 44px; } }
