/* =========================================================
   CAPES · Área privada (acceso, alumno, administrador)
   Se carga DESPUÉS de capes.css y reutiliza sus tokens.
   ========================================================= */

/* ---------- Acceso: pantalla dividida ---------- */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; background: var(--bg-soft); }
.auth__panel { flex: 1 1 460px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 40px clamp(24px, 5vw, 64px); }
.auth__panel .footer__logo { align-self: flex-start; }
.auth__pitch { display: flex; flex-direction: column; gap: 22px; max-width: 480px; }
.auth__pitch h1 { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.12; letter-spacing: -0.02em; }
.auth__quote { padding: 20px; border-radius: 14px; max-width: 460px; display: flex; flex-direction: column; gap: 12px; color: #E3ECEC; font-size: 15px; line-height: 1.55; }
.auth__quote figcaption { display: flex; gap: 10px; align-items: center; font-size: 13px; color: #9FB0B3; }
.auth__quote .avatar { width: 40px; height: 40px; }
.auth__main { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth__card { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: clamp(24px, 4vw, 40px); box-shadow: 0 24px 60px rgba(15,32,39,.08); display: flex; flex-direction: column; gap: 18px; }
.auth__card h2 { font-size: 26px; letter-spacing: -0.01em; }
.auth__sub { color: var(--muted); font-size: 15px; }
.auth__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.check { display: inline-flex; gap: 10px; align-items: center; font-size: 14px; color: var(--muted); cursor: pointer; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--teal); flex: none; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted-2); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.pass { position: relative; display: block; }
.pass input { width: 100%; padding-right: 76px; }
.pass button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; font: inherit; font-size: 13px; font-weight: 700; color: var(--teal); cursor: pointer; padding: 10px; }
.rules { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 13px; color: var(--muted); }
.rules li::before { content: '○ '; color: var(--muted-2); }
.rules li.is-ok { color: var(--teal); }
.rules li.is-ok::before { content: '✓ '; color: var(--teal); }
.big-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); display: flex; align-items: center; justify-content: center; align-self: center; }
@media (max-width: 860px) {
  .auth__panel { flex-basis: 100%; padding: 24px; gap: 20px; }
  .auth__pitch h1 { font-size: 26px; }
  .auth__pitch .checklist, .auth__quote { display: none; }
}

/* ---------- Estructura de la app: menú lateral + contenido ---------- */
.app { display: flex; min-height: 100vh; background: var(--bg-soft); }
.side { width: 264px; flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 20px 14px; color: #E3ECEC; }
.side .footer__logo { margin: 0 8px 18px; }
.side__label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #8FA3A6; margin: 14px 12px 6px; }
.side a.side__link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #D5E0E1; text-decoration: none; font-weight: 500; font-size: 15px; min-height: 44px; }
.side a.side__link:hover { background: rgba(255,255,255,.07); color: #fff; }
.side a.side__link[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; font-weight: 700; box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.side a.side__link[aria-current="page"] svg { color: var(--accent-soft, #7FD3DA); }
.side__count { margin-left: auto; background: var(--orange); color: var(--ink); font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.side__user { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); font-size: 14px; }
.side__user .avatar { width: 40px; height: 40px; }
.side__user small { display: block; color: #9FB0B3; }
.side__user a { margin-left: auto; color: #9FB0B3; font-size: 13px; }
.side.is-premium::after { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topnav { position: sticky; top: 0; z-index: 15; background: rgba(244,247,247,.92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topnav__inner { display: flex; align-items: center; gap: 14px; padding: 12px clamp(16px, 3vw, 32px); }
.topnav__title { font-weight: 700; font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { position: relative; width: 44px; height: 44px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); border: 2px solid #fff; }
.side-toggle { display: none; }
.content { padding: clamp(16px, 3vw, 32px); display: flex; flex-direction: column; gap: 24px; max-width: 1280px; width: 100%; box-sizing: border-box; }
.page-title { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; justify-content: space-between; }
.page-title h1 { font-size: clamp(24px, 2.6vw, 30px); letter-spacing: -0.015em; }
.page-title p { color: var(--muted); margin-top: 4px; }
.scrim { display: none; }
@media (max-width: 960px) {
  .side { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility 0s .2s; }
  .app.is-open .side { transform: none; visibility: visible; transition: transform .2s; box-shadow: 20px 0 50px rgba(0,0,0,.35); }
  .app.is-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(15,32,39,.5); }
  .side-toggle { display: inline-flex; }
  .hide-md { display: none; }
}

/* ---------- Piezas de la app ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel__head h2 { font-size: 18px; }
.panel__head a { font-weight: 600; font-size: 14px; text-decoration: none; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 20px; }
.split-main { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split-main > :first-child { flex: 2 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.split-main > :last-child { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi__label { font-size: 14px; color: var(--muted-2); display: flex; align-items: center; gap: 8px; }
.kpi__value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.delta { font-size: 13px; font-weight: 700; }
.delta--up { color: #1E7A43; }
.delta--down { color: #B3261E; }
.bar { height: 8px; background: var(--teal-soft); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--teal); border-radius: 999px; }
.bar--orange > span { background: var(--orange); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--ok { background: #E3F4EA; color: #1E6B3A; }
.badge--warn { background: var(--orange-soft); color: #8A4206; }
.badge--off { background: #ECEFF0; color: #4A5A5E; }
.badge--bad { background: #FBE4E2; color: #9B2C24; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); padding: 12px 16px; background: var(--bg-soft); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #FAFCFC; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-main { display: flex; gap: 12px; align-items: center; }
.cell-main strong { display: block; }
.cell-main small { color: var(--muted-2); }
.thumb { flex: none; width: 64px; height: 40px; border-radius: 6px; padding: 2px; font-size: 9px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 8px; cursor: pointer; min-height: 36px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); }
.btn-ghost--danger:hover { border-color: #B3261E; color: #B3261E; }
.toolbar-app { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar-app .search { flex: 1 1 260px; max-width: 420px; }
.toolbar-app .search input { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; font: inherit; font-size: 15px; font-weight: 600; color: var(--muted-2); padding: 12px 14px; cursor: pointer; white-space: nowrap; min-height: 44px; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--teal); }
[role="tabpanel"][hidden] { display: none; }
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-size: 15px; min-height: 44px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__ui { position: relative; flex: none; width: 44px; height: 26px; border-radius: 999px; background: #C5D0D1; transition: background .15s; }
.switch__ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .switch__ui { background: var(--teal); }
.switch input:checked + .switch__ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__ui { outline: 3px solid var(--teal); outline-offset: 2px; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.list li:last-child { border-bottom: 0; }
.list__grow { flex: 1; min-width: 0; }
.list__grow strong { display: block; font-size: 15px; }
.list__grow small { color: var(--muted-2); }
.alert { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 16px 18px; border-radius: 12px; border: 1px solid; }
.alert > div { flex: 1 1 260px; }
.alert strong { display: block; }
.alert--warn { background: #FFF7F0; border-color: #F5D3B6; }
.alert--info { background: var(--teal-soft); border-color: #BFDAD8; }
.course-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.course-card .photo-slot { height: 150px; border-radius: 0; }
.course-card__body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.course-card__body h3 { font-size: 17px; line-height: 1.3; }
.course-card__meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted-2); }
.course-card__body .btn { margin-top: auto; }
.resume { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; padding: 22px; border-radius: 16px; color: #fff; }
.resume .photo-slot { flex: 1 1 260px; max-width: 360px; aspect-ratio: 16 / 9; }
.resume__copy { flex: 2 1 320px; display: flex; flex-direction: column; gap: 12px; }
.resume__copy h2 { font-size: 24px; }
.resume .bar { background: rgba(255,255,255,.15); }
.resume .bar > span { background: var(--accent-soft, #7FD3DA); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.upload { border: 2px dashed #C5D0D1; border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--bg-soft); }
.upload strong { color: var(--ink); }
.save-bar { position: sticky; bottom: 0; z-index: 10; background: #fff; border-top: 1px solid var(--line); padding: 12px clamp(16px, 3vw, 32px); display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; box-shadow: 0 -10px 24px rgba(15,32,39,.06); }
.save-bar span { margin-right: auto; color: var(--muted-2); font-size: 14px; }

/* ---------- Reproductor de clase ---------- */
.player { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.player__main { flex: 3 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.player__video { aspect-ratio: 16 / 9; border-radius: 14px; background: #0B1114; color: #C9D3D5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 20px; font-size: 14px; font-weight: 600; }
.player__nav { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.player__side { flex: 1 1 320px; min-width: 0; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
.syllabus details { border-bottom: 1px solid var(--line-2); }
.syllabus summary { list-style: none; cursor: pointer; padding: 14px 4px; display: flex; justify-content: space-between; gap: 10px; font-weight: 700; font-size: 15px; min-height: 44px; }
.syllabus summary::-webkit-details-marker { display: none; }
.syllabus summary small { font-weight: 500; color: var(--muted-2); }
.syllabus a { display: flex; gap: 10px; align-items: center; padding: 10px 8px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 14px; min-height: 40px; }
.syllabus a:hover { background: var(--bg-soft); }
.syllabus a[aria-current] { background: var(--teal-soft); color: var(--ink); font-weight: 700; }
.syllabus a span { margin-left: auto; color: var(--muted-2); font-size: 13px; font-weight: 400; }
.st { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #A9B7B9; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; }
.st--done { background: var(--teal); border-color: var(--teal); }
.st--now { border-color: var(--orange); border-width: 6px; }

/* ---------- Evaluación ---------- */
.quiz { max-width: 760px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.answers { display: flex; flex-direction: column; gap: 10px; border: 0; padding: 0; margin: 0; }
.answer { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font-size: 16px; min-height: 56px; }
.answer input { position: absolute; opacity: 0; }
.answer b { flex: none; width: 32px; height: 32px; border-radius: 8px; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.answer:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.answer:has(input:checked) b { background: var(--teal); color: #fff; }
.answer:has(input:focus-visible) { outline: 3px solid var(--teal); outline-offset: 2px; }
.qmap { display: grid; grid-template-columns: repeat(auto-fill, 40px); gap: 8px; }
.qmap span { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; background: #fff; }
.qmap .is-done { background: var(--teal); color: #fff; border-color: var(--teal); }
.qmap .is-now { border: 2px solid var(--orange); }

/* ---------- Certificados ---------- */
.cert-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.cert-card .photo-slot { aspect-ratio: 4 / 3; border-radius: 0; }
.cert-card__body { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.cert-card__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* ---------- Gráfica de ingresos (una serie) ---------- */
.chart { position: relative; }
.chart svg { width: 100%; height: 240px; display: block; overflow: visible; }
.chart .grid line { stroke: #E3E9EA; stroke-width: 1; }
.chart .axis text { font-size: 12px; fill: #5A6D72; font-family: var(--font); }
.chart .bar-m { fill: var(--teal); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .bar-m, .chart .hit:focus + .bar-m { fill: #045A5C; }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 13px; padding: 8px 10px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .1s; }
.chart-tip.is-on { opacity: 1; }
.chart-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted-2); }
.chart-foot button { background: none; border: 0; padding: 6px 0; font: inherit; color: var(--teal); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* ---------- Editor de curso ---------- */
.module { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.module__head { display: flex; gap: 10px; align-items: center; padding: 12px 14px; background: var(--bg-soft); }
.module__head input { flex: 1; min-width: 0; font: inherit; font-weight: 700; border: 1px solid transparent; background: transparent; padding: 8px; border-radius: 6px; min-height: 40px; }
.module__head input:focus { border-color: var(--teal); background: #fff; outline: none; }
.lesson { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line-2); font-size: 14px; flex-wrap: wrap; }
.lesson__name { flex: 1 1 200px; min-width: 0; }
.drag { color: #A9B7B9; cursor: grab; flex: none; }
.add-row { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line-2); }

/* ---------- Reseñas ---------- */
.review-admin { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.review-admin__top { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.review-admin__top .avatar { width: 44px; height: 44px; }
.review-admin__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line-2); padding-top: 12px; }

/* Contenido por encima de la retícula decorativa */
.is-premium > *:not(.scrim) { position: relative; z-index: 1; }
.panel.is-premium { background: radial-gradient(500px 260px at 100% 0%, rgba(10,156,170,.45), transparent 65%), linear-gradient(135deg, #111417 0%, #1A1F23 55%, #06454A 100%); }
.panel.is-premium .eyebrow { color: #7FD3DA; }
