/* ─────────────────────────────────────────────────────────────
   Editor Canva de certificados — Academia Liderman
   Sigue el tema de la plataforma (variables de lms.css),
   light/dark por `data-theme` en <html>.
   ───────────────────────────────────────────────────────────── */
.cert-shell {
  position: relative;
  height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: Inter, 'Segoe UI', system-ui, sans-serif;
  margin: -24px -28px 0;
  background: var(--bg-alt, #eef1f6);
  color: var(--fg, #111827);
}

/* ── Toolbar ── */
.cert-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--card, #fff);
  border-bottom: 1px solid var(--border, #e3e7ef);
  z-index: 30;
  overflow-x: auto;
  flex-wrap: nowrap;
}
.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--border, #e3e7ef);
  background: var(--card, #fff);
  color: var(--fg, #27364a);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.tb-btn:hover { background: var(--card-hover, #f3f6fb); border-color: var(--border, #c9d3e3); }
.tb-btn-primary { background: #024571; border-color: #024571; color: #fff; }
.tb-btn-primary:hover { background: #01355a; }
.tb-btn-danger { color: #b23028; border-color: #ecc7c4; }
.tb-btn-danger:hover { background: #fdf1f0; }
.tb-btn-active { background: #e8f0fa; border-color: #024571; color: #024571; }
.tb-btn:disabled { opacity: .5; cursor: not-allowed; }
.cert-toolbar-divider { width: 1px; height: 22px; background: var(--border, #e3e7ef); margin: 0 2px; flex-shrink: 0; }
.tb-select {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border, #e3e7ef);
  background: var(--card, #fff);
  color: var(--fg, #27364a);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  max-width: 220px;
  flex-shrink: 0;
}
.tb-select:hover { border-color: var(--border, #c9d3e3); }
.tb-title { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--fg, #111827); font-size: 1rem; flex-shrink: 0; }
.tb-title i { color: #b23028; }
.tb-subtitle { color: var(--muted, #6b7280); font-size: .82rem; font-weight: 500; flex-shrink: 0; }
.tb-spacer { flex: 1; }

/* ── Cuerpo 3 columnas ── */
.cert-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ── Panel izquierdo ── */
.cert-panel {
  flex: 0 0 318px;
  overflow-y: auto;
  background: var(--bg-alt, #f7f9fc);
  border-right: 1px solid var(--border, #e3e7ef);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  scrollbar-width: thin;
}
.cert-card {
  background: var(--card, #fff);
  border: 1px solid var(--border, #e3e7ef);
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}
.cc-head {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border, #eef1f6);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #024571;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-alt, #fbfcfe);
}
.cc-body { padding: 12px; }
.cc-body .field { margin-bottom: 10px; }
.cc-body .field:last-child { margin-bottom: 0; }
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted, #64748b);
  margin-bottom: 5px;
}
.cert-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border, #d7dee9);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--fg, #27364a);
  background: var(--card, #fff);
}
.cert-input:focus { outline: 2px solid #02457133; border-color: #024571; }

.switch-label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; margin-bottom: 8px; }
.switch-label input { accent-color: #024571; }
.cert-hint { font-size: 11.5px; color: var(--muted, #6b7280); line-height: 1.45; margin: 0 0 8px; }

.cert-campo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border, #f1f4f9);
  font-size: 12.5px;
}
.cert-campo:last-child { border-bottom: 0; }
.cert-campo input[type=checkbox] { flex: 0 0 auto; accent-color: #024571; }
.cert-campo-label { flex: 1; min-width: 0; }
.cert-campo-add {
  flex: 0 0 auto;
  border: 0;
  background: #e8f0fa;
  color: #024571;
  width: 24px; height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.cert-campo-add:hover { background: #d2e4f7; }

.color-row { display: flex; gap: 10px; }
.color-input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--border, #d7dee9);
  border-radius: 8px;
  padding: 2px;
  background: var(--card, #fff);
  cursor: pointer;
}
.color-item { flex: 1; }
.color-item .field-label { margin-bottom: 3px; }

/* Assets */
.cert-assets-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cert-assets-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--border, #eef1f6);
  border-radius: 8px;
  background: var(--bg-alt, #fbfcfe);
  cursor: grab;
}
.cert-assets-list li:hover { border-color: var(--border, #c9d3e3); }
.cert-assets-list li:active { cursor: grabbing; }
.cert-asset-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border, #e3e7f0); background: var(--card, #fff); }
.cert-asset-name { flex: 1; font-size: 11px; color: var(--muted, #54616e); word-break: break-all; }
.cert-asset-drag { color: var(--muted, #94a3b8); font-size: 11px; }
.assets-empty { font-size: 11.5px; color: var(--muted, #94a3b8); padding: 4px 0; margin: 0; }
.btn-upload {
  width: 100%;
  border: 1px dashed #b8c4d6;
  background: var(--card, #fff);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  color: #024571;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}
.btn-upload:hover { background: var(--card-hover, #f3f6fb); }

/* ── Zona del lienzo ── */
.cert-canvas-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.cert-canvas-host {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 30px;
  min-height: 0;
}
.cert-canvas-outer {
  align-self: center;
  position: relative;
}
.cert-canvas-scale {
  position: relative;
  transform-origin: top left;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .18);
}
#cert-canvas {
  position: relative;
  background: #ffffff;
  overflow: hidden;
}
#cert-canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(2, 69, 113, .25);
  z-index: 999;
}
.cert-canvas-label {
  display: block;
  text-align: center;
  color: var(--muted, #64748b);
  font-size: 12px;
  padding: 8px 0 4px;
}
.cert-canvas-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted, #9aa6b5);
  font-size: 14px;
  line-height: 1.6;
  pointer-events: none;
}
.cert-canvas-empty i { font-size: 3rem; color: var(--muted, #c8d2de); margin-bottom: 8px; }

/* Contenedor de capa */
.cert-box {
  position: absolute;
  overflow: hidden;
  box-sizing: border-box;
}
.cert-box--sel { outline: 2px dashed #024571; }
.cert-box--img { background: transparent; border: 1px dashed #c9d3e3; }
.cert-toolbar-box {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
  background: rgba(2, 69, 113, .92);
  color: #fff;
  border-radius: 6px 6px 0 0;
  font-size: 11px;
  z-index: 5;
}
.cert-box--sel .cert-toolbar-box { display: flex; }
.cert-dim-label { font-family: monospace; font-size: 10px; margin-right: auto; opacity: .9; }
.box-act-btn {
  border: 0;
  width: 20px; height: 20px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  cursor: pointer;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.box-act-btn:hover { background: rgba(255, 255, 255, .32); }
.box-act-btn.del:hover { background: #b23028; }

.cert-content { position: absolute; inset: 0; overflow: hidden; }
.cert-texto {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  word-break: break-word;
  white-space: pre-wrap;
}
.cert-token-mark {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-family: monospace;
  font-size: 9px;
  background: rgba(178, 48, 40, .85);
  color: #fff;
  padding: 1px 5px;
  border-radius: 4px;
  z-index: 6;
  pointer-events: none;
}
.cert-img { width: 100%; height: 100%; display: block; }

/* ── Panel de capas ── */
.cert-layers {
  flex: 0 0 248px;
  overflow-y: auto;
  background: var(--bg-alt, #f7f9fc);
  border-left: 1px solid var(--border, #e3e7ef);
  padding: 10px;
  min-height: 0;
  scrollbar-width: thin;
}
.layers-title {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #024571;
  margin: 0 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.layers-empty {
  font-size: 12px;
  color: var(--muted, #94a3b8);
  text-align: center;
  line-height: 1.5;
  padding: 18px 6px;
  margin: 0;
}
.layer-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 7px;
  border: 1px solid var(--border, #eef1f6);
  border-radius: 8px;
  background: var(--card, #fff);
  margin-bottom: 5px;
  font-size: 11.5px;
  color: var(--fg, #27364a);
}
.layer-item.layer-sel { border-color: #024571; box-shadow: 0 0 0 2px #02457122; }
.layer-thumb {
  width: 26px; height: 26px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--border, #e3e7f0);
  background: var(--card, #fff);
  flex: 0 0 auto;
}
.layer-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-ico { width: 26px; text-align: center; color: var(--muted, #94a3b8); flex: 0 0 auto; }
.layer-actions { display: flex; gap: 3px; flex: 0 0 auto; }
.layer-btn {
  border: 0;
  background: #eef3fb;
  color: #024571;
  width: 22px; height: 22px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.layer-btn:hover { background: #d9e8f9; }
.layer-btn-del { color: #b23028; background: #fbeeee; }
.layer-btn-del:hover { background: #f6d9d6; }

/* ── Drop overlay ── */
.drop-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(2, 69, 113, .12);
  border: 3px dashed #024571;
  border-radius: 8px;
  text-align: center;
  color: #024571;
  font-size: 15px;
  z-index: 60;
  pointer-events: none;
}
.drop-overlay.show { display: flex; }
.drop-overlay i { font-size: 2.6rem; margin-bottom: 8px; }
.drop-overlay small { color: #49607c; }

/* ── Popover edición ── */
.cert-popover {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 23, 42, .4);
  z-index: 400;
  backdrop-filter: blur(2px);
}
.cert-popover.show { display: flex; }
.cert-popover-box {
  width: 480px;
  max-width: calc(100vw - 32px);
  background: var(--card, #fff);
  color: var(--fg, #111827);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .25);
  padding: 16px 18px 14px;
}
.pop-title { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--fg, #111827); font-size: 15px; margin-bottom: 12px; }
.pop-title i { color: #024571; }
.pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pop-field { display: flex; flex-direction: column; gap: 4px; }
.pop-field .field-label { margin: 0; }
.pop-field--full { grid-column: 1 / -1; }
.pop-input, .pop-select {
  border: 1px solid var(--border, #d7dee9);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 13px;
  color: var(--fg, #27364a);
  background: var(--card, #fff);
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
}
.pop-input:focus, .pop-select:focus { outline: 2px solid #02457133; border-color: #024571; }
textarea.pop-input { resize: vertical; min-height: 46px; }
.pop-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.quick-colors { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.qc-swatch {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,.12);
  cursor: pointer;
  padding: 0;
}
.qc-swatch:hover { transform: scale(1.12); }

/* ── Modal preview ── */
.cert-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .55);
  z-index: 500;
}
.cert-modal.show { display: flex; }
.cert-modal-box {
  width: min(1200px, calc(100vw - 40px));
  height: 92vh;
  background: var(--card, #fff);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.cert-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #e3e7ef);
  background: var(--card, #fff);
  font-weight: 800;
  color: var(--fg, #111827);
  font-size: 14px;
}
.cert-modal-head .spacer { flex: 1; }
.cert-modal-frame { flex: 1; border: 0; width: 100%; background: var(--bg-alt, #eef1f6); }

/* toast */
.cert-toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #fff;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 900;
}
.cert-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.cert-toast.err { background: #b23028; }

@media (max-width: 1180px) {
  .cert-panel { flex-basis: 280px; }
  .cert-layers { flex-basis: 200px; }
}
/* ==========================================================================
   ACADEMIA LIDERMAN — Hoja de estilos del LMS
   Replica de https del prototipo Next.js/Tailwind (mockup) con CSS nativo:
   - Paleta: red-600 primario, gray-900 texto, dark mode por data-theme
   - Tarjetas rounded-2xl, botones red-600/white, inputs focus red.
   ========================================================================== */

:root {
  --primary: #dc2626;          /* red-600 */
  --primary-hover: #b91c1c;    /* red-700 */
  --primary-soft: #fef2f2;     /* red-50 */
  --bg: #ffffff;
  --bg-alt: #f9fafb;           /* gray-50 */
  --fg: #111827;               /* gray-900 */
  --muted: #6b7280;            /* gray-500 */
  --border: #e5e7eb;           /* gray-200 */
  --card: #ffffff;
  --card-hover: #ffffff;
  --code-bg: #f3f4f6;
  --success: #22c55e;
  --warning: #eab308;
  --shadow: 0 1px 2px rgba(17, 24, 39, .06), 0 4px 12px rgba(17, 24, 39, .06);
  --radius: 1rem;
  --font-sans: "Chiron Sung HK", "Segoe UI", Arial, Helvetica, sans-serif;
}

[data-theme="dark"] {
  --primary: #ef4444;          /* red-500 */
  --primary-hover: #dc2626;
  --primary-soft: #450a0a;     /* red-950 */
  --bg: #030712;               /* gray-950 */
  --bg-alt: #111827;           /* gray-900 */
  --fg: #f3f4f6;               /* gray-100 */
  --muted: #9ca3af;            /* gray-400 */
  --border: #374151;           /* gray-700 */
  --card: #111827;             /* gray-900 */
  --card-hover: #1f2937;
  --code-bg: #1f2937;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 6px 16px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg-alt);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.5;
  transition: background .25s ease, color .25s ease;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--code-bg); padding: 2px 6px; border-radius: 6px; font-size: 13px; }
h1, h2, h3, h4 { margin: 0 0 .4rem; color: var(--fg); }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }

/* ------------------------------- Topbar    ------------------------------- */
.topbar {
  height: 64px; position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 36px; width: auto; }
.brand-name { font-size: 20px; font-weight: 700; color: var(--primary); }
.topbar-search {
  flex: 1; max-width: 640px; margin: 0 auto; position: relative;
}
.topbar-search input[type="search"] {
  width: 100%; padding: 10px 16px 10px 40px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-alt); color: var(--fg);
  outline: none; transition: border .2s, box-shadow .2s;
}
.topbar-search input[type="search"]:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(220, 38, 38, .18);
}
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  background: transparent; border: none; cursor: pointer; color: var(--muted);
  width: 40px; height: 40px; border-radius: 10px; font-size: 18px; position: relative;
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--bg-alt); color: var(--fg); }
.notif-badge {
  position: absolute; top: 6px; right: 6px; width: 18px; height: 18px;
  background: var(--primary); color: #fff; border-radius: 50%;
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.profile-chip { display: flex; align-items: center; gap: 8px; padding-left: 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #991b1b);
  color: #fff; font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.avatar-xl { width: 72px; height: 72px; font-size: 28px; }
.profile-name { color: var(--fg); font-weight: 500; }

/* ------------------------------- Layout   ------------------------------- */
.layout { display: flex; min-height: calc(100vh - 64px); }

.sidebar {
  width: 256px; flex-shrink: 0; position: sticky; top: 64px; height: calc(100vh - 64px);
  background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 12px;
  transition: width .3s ease;
}
.sidebar-collapse {
  align-self: flex-end; margin-bottom: 8px;
}
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border-radius: 12px; color: var(--muted); font-weight: 500; font-size: 14px;
  transition: all .2s; text-decoration: none;
}
.nav-item:hover { background: var(--bg-alt); color: var(--fg); text-decoration: none; }
.nav-item.active {
  background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(220, 38, 38, .3);
}
.nav-ico { font-size: 18px; width: 22px; text-align: center; }

.sidebar-help {
  margin-top: auto; padding: 16px;
  background: linear-gradient(135deg, var(--primary), #991b1b);
  border-radius: 14px; color: #fff; margin-bottom: 12px;
}
.help-title { font-size: 12px; font-weight: 600; opacity: .95; }
.help-sub { font-size: 11px; opacity: .75; margin: 4px 0 10px; }
.btn-white { background: rgba(255, 255, 255, .18); color: #fff; }
.btn-white:hover { background: rgba(255, 255, 255, .28); }

.sidebar-roles { border-top: 1px solid var(--border); padding-top: 12px; }
.roles-caption { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; }
.role-chip {
  display: inline-block; font-size: 12px; padding: 4px 10px; margin: 2px;
  border-radius: 999px; border: 1px solid var(--border); color: var(--muted);
  transition: all .2s; text-decoration: none;
}
.role-chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.role-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.content { flex: 1; padding: 24px 28px 60px; min-width: 0; }

/* collapse (desktop) */
body.collapsed .sidebar { width: 76px; }
body.collapsed .nav-txt, body.collapsed .sidebar-help, body.collapsed .roles-caption,
body.collapsed .role-chip, body.collapsed .profile-name { display: none; }
body.collapsed .nav-item { justify-content: center; }
body.collapsed .sidebar-roles { display: none; }
body.collapsed .sidebar-help { display: none; }

/* ------------------------------- Página    ------------------------------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 26px; font-weight: 700; }
.page-sub { color: var(--muted); margin: 0; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.block { margin-bottom: 28px; }
.block-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.block-title h2 { font-size: 18px; }

/* Fondo de la página de Inicio + transición de entrada */
.home-wrap {
  position: relative; isolation: isolate;
  min-height: calc(100vh - 128px);
  display: flex; flex-direction: column; justify-content: center;
}
.home-wrap::before {
  content: ""; position: absolute; inset: -24px -28px -60px; z-index: -1;
  background:
    linear-gradient(rgba(246, 248, 252, .9), rgba(246, 248, 252, .94)),
    url("../img/fondo.8418c80dae53.png") center/cover no-repeat;
}
/* Modo oscuro: el velo pasa a azul-noche para no brillar ni distraer. */
[data-theme="dark"] .home-wrap::before {
  background:
    linear-gradient(rgba(3, 7, 18, .82), rgba(15, 23, 42, .92)),
    url("../img/fondo.8418c80dae53.png") center/cover no-repeat;
}
@keyframes home-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------- Ruleta (destacados) --------------------- */
.ruleta { position: relative; }
.ruleta-viewport { overflow: hidden; border-radius: var(--radius); }
.ruleta-track { display: flex; transition: transform .6s ease; will-change: transform; }
.ruleta-track.ruleta-sin-transicion { transition: none; }
.ruleta-slide { min-width: calc(100% / 4); display: flex; justify-content: center; padding: 6px; box-sizing: border-box; }
.ruleta-card { width: 100%; padding: 22px 20px; text-align: center; }
.ruleta-card .ruleta-titulo { font-size: 24px; margin: 10px 0 8px; }
.ruleta-head { display: flex; gap: 8px; justify-content: center; }
.ruleta-meta { color: var(--muted); font-size: 13px; }
.ruleta-dots { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.ruleta-dot {
  width: 10px; height: 10px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-alt); cursor: pointer; padding: 0; transition: all .25s;
}
.ruleta-dot.activo { background: var(--primary); border-color: var(--primary); width: 22px; }

/* ------------------------------- Mi Ruta -------------------------------- */
.ruta-head { align-items: flex-start; }
.ruta-title { display: inline-flex; align-items: center; gap: 12px; }
.ruta-badge {
  font-size: 12px; font-weight: 700; color: var(--primary);
  background: var(--primary-soft); border-radius: 999px; padding: 3px 12px;
}
.ruta-stats { margin-top: 4px; }
.ruta-list { display: flex; flex-direction: column; gap: 16px; }
.ruta-card {
  display: flex; gap: 20px; align-items: center;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.ruta-avance { flex-shrink: 0; }
.ruta-ring {
  --p: 0;
  width: 84px; height: 84px; border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--bg-alt) 0);
  display: flex; align-items: center; justify-content: center;
}
.ruta-ring > span {
  width: 66px; height: 66px; border-radius: 50%; background: var(--card);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: var(--fg);
}
.ruta-main { flex: 1; min-width: 0; }
.ruta-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.ruta-main .ruta-title { font-size: 18px; margin: 0; display: inline; }
.ruta-meta { color: var(--muted); font-size: 13px; margin: 6px 0 8px; }
.ruta-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* Batería de avance: se llena con el % y cambia de color (rojo→ámbar→verde). */
.bateria-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 2px; }
.bateria {
  --bc: var(--primary); --p: 0;
  position: relative; width: 220px; max-width: 100%; height: 20px;
  border: 2px solid var(--bc); border-radius: 6px; padding: 3px;
  display: flex; align-items: center;
}
.bateria::after {
  /* contacto (borna) de la batería, a la derecha */
  content: ""; position: absolute; right: -7px; top: 5px; bottom: 5px;
  width: 5px; border-radius: 0 3px 3px 0; background: var(--bc);
}
.bateria-fill {
  height: 100%; width: calc(var(--p) * 1%); min-width: 0;
  border-radius: 3px; background: var(--bc);
  transition: width .6s ease, background .4s ease;
}
.bateria-low  { --bc: #dc2626; }
.bateria-warn { --bc: #f59e0b; }
.bateria-ok   { --bc: #22c55e; }
.bateria-pct { font-size: 15px; font-weight: 800; color: var(--fg); font-variant-numeric: tabular-nums; }
.ruta-empty {
  border: 1px dashed var(--border); border-radius: var(--radius); padding: 48px 24px;
  text-align: center; background: var(--card);
}
@media (max-width: 640px) {
  .ruta-card { flex-direction: column; align-items: flex-start; }
  .ruleta-card { text-align: left; }
  .ruleta-slide { min-width: 100%; }
}

/* ------------------------------- Botones   ------------------------------- */
.btn {
  display: inline-block; border: none; cursor: pointer; text-align: center;
  font-size: 14px; font-weight: 600; padding: 11px 18px; border-radius: 12px;
  text-decoration: none; transition: all .2s;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(220, 38, 38, .3); }
.btn-primary:hover { background: var(--primary-hover); color: #fff; text-decoration: none; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--fg); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; display: block; }
.btn-sm { padding: 8px 12px; font-size: 12px; }

/* El atributo `hidden` debe prevalecer sobre `display` de .btn (evita que
   botones ocultos como "Ir a evaluación"/"Siguiente módulo" sigan visibles). */
[hidden] { display: none !important; }

/* Estado "generando" del botón de descarga de certificado (spinner). */
.btn[disabled], .btn.is-loading { opacity: .7; cursor: progress; }
.btn.is-loading::before {
  content: ""; display: inline-block; width: 12px; height: 12px;
  margin-right: 8px; vertical-align: -1px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: btn-spin .7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ------------------------------- Tarjetas  ------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
}
.card:hover { box-shadow: 0 10px 24px rgba(17, 24, 39, .12); }
.card h4 { font-size: 15px; margin-bottom: 6px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ------------------------------- Badges    ------------------------------- */
.badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .4px;
  padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--muted); background: var(--bg-alt); text-transform: uppercase; margin-bottom: 8px;
}
.badge-mandatory { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge-ok { background: rgba(34, 197, 94, .14); color: var(--success); border-color: transparent; }

/* ------------------------------- Progresso  ------------------------------- */
.progress { height: 8px; border-radius: 999px; background: var(--bg-alt); overflow: hidden; margin: 8px 0 6px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), #ef4444); border-radius: 999px; }
.progress-label { font-size: 12px; color: var(--muted); }
.avance-indicador { display: inline-block; margin-left: 10px; font-size: 12px; color: var(--primary); font-weight: 600; }
.w-32 { width: 130px; }
.stat-row { display: flex; gap: 18px; margin-bottom: 6px; }
.stat { font-size: 13px; color: var(--muted); }
.stat strong { color: var(--fg); }

/* ------------------------------- Panel DS44 (banda de métricas) ---------- */
.ds44-panel {
  display: flex; align-items: stretch; margin-bottom: 28px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.ds44-item { flex: 1; padding: 20px 24px 18px; position: relative; }
.ds44-item + .ds44-item { border-left: 1px solid var(--border); }
.ds44-value {
  display: block; font-size: 30px; line-height: 1.1; font-weight: 800;
  letter-spacing: -.5px; color: var(--fg); font-variant-numeric: tabular-nums;
}
.ds44-value.ds44-ok { color: var(--success); }
.ds44-value.ds44-warn { color: var(--warning); }
.ds44-label {
  display: block; margin-top: 6px; font-size: 11px; font-weight: 600;
  letter-spacing: .6px; text-transform: uppercase; color: var(--muted);
}
/* Acento editorial: una pequeña regla bajo el número, con el color del estado. */
.ds44-item::after {
  content: ""; display: block; width: 26px; height: 3px; border-radius: 999px;
  background: var(--primary); margin-top: 10px; opacity: .9;
}
.ds44-item:has(.ds44-value.ds44-ok)::after { background: var(--success); }
.ds44-item:has(.ds44-value.ds44-warn)::after { background: var(--warning); }
@media (max-width: 768px) {
  .ds44-panel { flex-direction: column; }
  .ds44-item + .ds44-item { border-left: none; border-top: 1px solid var(--border); }
}

/* ------------------------------- Hero / au--------------------------------- */
.hero {
  display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; align-items: center;
  margin-bottom: 28px;
}
.hero-copy { max-width: 720px; }
.hero-logo { height: 52px; width: auto; display: block; margin-bottom: 12px; }
.hero-eyebrow {
  font-size: 12px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase;
  color: var(--primary); margin-bottom: 10px;
}
.hero-title { font-size: 30px; line-height: 1.25; color: var(--fg); margin-bottom: 12px; }
.hero-sub { color: var(--muted); font-size: 15px; line-height: 1.6; margin-bottom: 18px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, var(--card), var(--bg-alt));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow); text-align: center;
}
.hero-card .hero-stat { font-size: 44px; font-weight: 800; color: var(--primary); line-height: 1; }
.hero-card .hero-stat.sub { font-size: 30px; margin-top: 14px; }
.hero-stat-label { font-size: 13px; color: var(--muted); }
.hero-art { font-size: 64px; opacity: .9; }

/* ------------------------------- Rutas (Mis rutas) ------------------------ */
.route-card { margin-bottom: 16px; }
.route-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.route-title { margin: 0; font-size: 17px; }
.route-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.tappable { text-decoration: none; color: inherit; display: block; }
.tappable h3 { color: var(--fg); margin-bottom: 4px; }
.tappable:hover { transform: translateY(-2px); }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }

/* ------------------------------- Tablas    ------------------------------- */
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { background: var(--bg-alt); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.table tr:last-child td { border-bottom: none; }

/* Acciones en una fila de tabla: alineadas, misma altura y sin apilar */
.table-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; flex-wrap: wrap;
}
.table-actions form { margin: 0; display: inline-flex; }
.table-actions .btn {
  white-space: nowrap; padding: 7px 12px; font-size: 12px; line-height: 1.1;
  display: inline-flex; align-items: center; justify-content: center;
}
.table-actions .btn-sm { padding: 7px 12px; font-size: 12px; }
@media (max-width: 720px) {
  .table-actions { justify-content: flex-start; }
}

/* ------------------------------- Gestión de usuarios --------------------- */
.gu-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.gu-toolbar input[type="search"] { flex: 1 1 260px; min-width: 200px; }
.gu-toolbar .select { min-width: 140px; }
.gu-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.gu-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--card);
  color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .2s;
}
.gu-chip:hover { border-color: var(--primary); color: var(--primary); }
.gu-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.gu-chip .gu-chip-n {
  font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--bg-alt); color: var(--fg); border-radius: 999px;
  padding: 0 7px; line-height: 18px;
}
.gu-chip.active .gu-chip-n { background: rgba(255, 255, 255, .22); color: #fff; }
.gu-table-wrap { overflow-x: auto; border-radius: var(--radius); }
.gu-table-wrap .table { box-shadow: var(--shadow); min-width: 720px; }
.gu-name { font-weight: 600; }
.gu-truncate { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gu-empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.gu-empty strong { display: block; color: var(--fg); font-size: 15px; margin-bottom: 4px; }
.gu-count { color: var(--muted); font-size: 12px; font-weight: 600; }
.gu-form { max-width: 720px; }
.gu-form .card { padding: 22px 24px; }

/* ------------------------------- Formularios ------------------------------- */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="search"], select {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); color: var(--fg); outline: none; transition: border .2s, box-shadow .2s;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(220, 38, 38, .18); }
.inline-form .select, .inline-form select { width: auto; min-width: 220px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form .field-label { margin-bottom: 0; }
.select { width: auto; }
.sence-validado-fields { flex-basis: 100%; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sence-validado-fields .field-label { margin-bottom: 0; }
.sence-validado-fields .muted { flex-basis: 100%; margin: 0; }

/* ------------------------------- Alertas   ------------------------------- */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; border: 1px solid transparent; }
.alert-danger { background: rgba(220, 38, 38, .1); color: var(--primary); border-color: rgba(220, 38, 38, .3); }
.alert-success { background: rgba(34, 197, 94, .12); color: var(--success); border-color: rgba(34, 197, 94, .3); }
.alert-info { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.alert-warning { background: rgba(245, 158, 11, .12); color: var(--warning, #b45309); border-color: rgba(245, 158, 11, .4); }
/* Avisos flotantes: NO empujan el contenido y se autodescartan (ver lms.js). */
.toasts {
  position: fixed; top: 76px; right: 20px; z-index: 110;
  display: flex; flex-direction: column; gap: 10px;
  width: min(420px, calc(100vw - 40px));
  pointer-events: none;
}
.toasts .alert {
  margin: 0; pointer-events: auto;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
  transition: opacity .35s ease, transform .35s ease;
}
.toasts .alert.toast-out { opacity: 0; transform: translateX(16px); }
@media (max-width: 546px) {
  .toasts { top: 72px; right: 12px; left: 12px; width: auto; }
}

/* ------------------------------- Catálogo  ------------------------------- */
.filter-bar { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.filter-search { display: flex; gap: 8px; flex: 1; max-width: 420px; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); color: var(--muted); transition: all .2s;
}
.chip:hover { color: var(--primary); border-color: var(--primary); text-decoration: none; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.course-card .meta-row { display: flex; gap: 14px; margin-bottom: 10px; }
.course-card-img { margin: -14px -14px 12px -14px; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; max-height: 180px; }
.course-card-img img { width: 100%; height: 180px; object-fit: cover; display: block; }
.card-actions { margin-top: 14px; }

/* ------------------------------- Aula      ------------------------------- */
.aula-progress { margin-bottom: 20px; }
.aula-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.aula-player { min-width: 0; }
.player-frame {
  aspect-ratio: 16 / 9; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 14px; gap: 10px;
}
.sco-frame {
  width: 100%; height: clamp(300px, 60vh, 580px);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; box-shadow: var(--shadow); margin-bottom: 14px;
}
@media (max-width: 640px) {
  .sco-frame { height: clamp(260px, 55vh, 400px); }
}
.player-icon { font-size: 44px; color: var(--primary); }
.player-hint { color: var(--muted); text-align: center; max-width: 420px; font-size: 13px; }
.player-tools { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 24px; }
.evaluacion-form { margin-top: 10px; }
.aula-side .side-title { font-size: 15px; margin-bottom: 12px; }
.module {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 10px; overflow: hidden;
}
.module summary {
  display: flex; gap: 10px; align-items: center; padding: 13px 14px; cursor: pointer;
  font-weight: 500; font-size: 14px; list-style: none;
}
.module summary::-webkit-details-marker { display: none; }
.module > p { padding: 0 14px 14px; }
.module.done summary { color: var(--success); }
.module.current summary { color: var(--primary); }
.mod-icon { width: 22px; text-align: center; }
.envio-sence { margin-top: 16px; }

/* ------------------------------- Perfil    ------------------------------- */
.profile-card { text-align: center; padding: 28px; }
.grid-badges { display: flex; gap: 12px; flex-wrap: wrap; }
.badge-medal {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 18px; min-width: 110px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border); font-size: 26px; box-shadow: var(--shadow);
}
.badge-medal span { font-size: 12px; color: var(--muted); }
.badge-medal.dim { opacity: .45; }

/* ------------------------------- Auth      ------------------------------- */
.auth-body { background: radial-gradient(1200px 500px at 50% -10%, #450a0a, var(--bg-alt) 60%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-shell { width: 100%; max-width: 400px; padding: 20px; }
.auth-card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 32px; box-shadow: 0 20px 50px rgba(0, 0, 0, .2); }
.auth-card-new { position: relative; overflow: hidden; background: var(--card); }
.auth-card-new > .auth-brand { padding-top: 6px; }
.auth-topline { position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--primary), transparent); box-shadow: 0 0 10px 2px rgba(220, 38, 38, .45); }
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-logo { height: 48px; margin-bottom: 8px; }
.auth-title { font-size: 24px; font-weight: 800; color: var(--fg); }
.auth-title span { color: var(--primary); }
.auth-sub { color: var(--muted); font-size: 13px; margin: 0; }
.auth-shield { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11px; letter-spacing: .4px; color: var(--muted); }
.auth-form { margin-top: 6px; }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 40px; }
.pass-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: transparent; border: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; display: flex; }
.pass-toggle:hover { color: var(--fg); }
.consent-box { margin-top: 18px; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--bg-alt); }
.consent-item { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; color: var(--muted); padding: 6px 0; cursor: pointer; }
.consent-item input { margin-top: 2px; accent-color: var(--primary); }
.consent-item strong { color: var(--fg); }
.consent-link { color: var(--primary); font-weight: 600; text-decoration: underline; }
.consent-divider { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin: 8px 0 2px; padding-top: 6px; border-top: 1px dashed var(--border); }
.consent-note { font-size: 11px; color: var(--muted); margin: 8px 0 0; }
.auth-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: 14px; }
.auth-footer { font-size: 11px; color: var(--muted); text-align: center; margin-top: 12px; opacity: .7; }

/* ------------------------------- Responsivo ------------------------------- */
.lg-hidden { display: none; }
@media (max-width: 1024px) {
  .lg-hidden { display: inline-flex; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .aula-layout { grid-template-columns: 1fr; }
  .ds44-panel { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 64px; z-index: 40; transform: translateX(-100%); transition: transform .3s ease; box-shadow: 0 20px 40px rgba(0,0,0,.3); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.collapsed .sidebar { width: 256px; }
  body.collapsed .nav-txt, body.collapsed .sidebar-help { display: block; }
  .profile-name { display: none; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .content { padding: 16px; }
  .topbar-search { display: none; }
  .page-head { flex-direction: column; align-items: flex-start; }
}

/* ------------------------------- Utilidades ------------------------------- */
.mt-2 { margin-top: 12px; }
.mb-2 { margin-bottom: 12px; }
.w-100 { width: 100%; }
.btn-danger { background: var(--danger, #dc2626); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.badge-muted { background: var(--bg-alt); color: var(--muted); opacity: .8; }

/* ------------------------------- Campana ------------------------------- */
.notif-badge {
  position: absolute; top: -4px; right: -4px; background: var(--primary); color: #fff;
  font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; line-height: 16px;
  border-radius: 999px; padding: 0 4px; text-align: center;
}
.bell-wrap { position: relative; display: inline-flex; }
.notif-dropdown {
  position: absolute; right: 10px; top: 58px; z-index: 90; width: 340px; max-height: 420px;
  overflow-y: auto; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 18px 44px rgba(0,0,0,.25);
}
.notif-dropdown[hidden] { display: none; }
.notif-dropdown-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--card);
}
.notif-item {
  display: flex; gap: 8px; align-items: flex-start; padding: 10px 14px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.notif-link {
  display: flex; gap: 8px; align-items: flex-start; flex: 1;
  text-decoration: none; color: var(--fg);
}
.notif-del {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 2px; flex: 0 0 auto;
}
.notif-del:hover { color: var(--danger, #dc2626); }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-alt); }
.notif-no-leida { background: var(--primary-soft); }
.notif-txt { flex: 1; }
@media (max-width: 640px) { .notif-dropdown { width: 92vw; right: 4vw; } }

/* ------------------------------- Gestión de Cursos (tarjetas + modal) ---- */
.grid-cursos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; margin-bottom: 28px; }
.curso-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); cursor: pointer; outline: none;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  min-width: 0; overflow-wrap: anywhere;
}
.curso-card:hover, .curso-card:focus-visible { transform: translateY(-2px); border-color: var(--primary); }
.curso-oculto { opacity: .72; }
.curso-card-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.curso-card-top .badge { margin-bottom: 0; text-transform: none; }
.curso-badges { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; flex: 1 1 auto; }
.curso-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.curso-actions form { margin: 0; }
.curso-actions .btn { padding: 5px 9px; font-size: 11px; }

/* Panel "Cursos destacados" (C&C) */
.destacados-list { display: flex; flex-direction: column; gap: 8px;
  list-style: none; padding: 0; margin: 0; }
.destacados-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px; cursor: grab;
}
.destacados-row.dragging { opacity: .5; }
.drag-handle { cursor: grab; color: var(--muted); font-weight: 700; letter-spacing: -2px; }
.destacados-row code { font-size: 12px; }
.destacados-actions { display: flex; gap: 6px; margin-left: auto; }
.destacados-actions form { margin: 0; }
.curso-card-titulo { font-size: 16px; font-weight: 700; margin: 2px 0 4px; line-height: 1.3; }
.curso-card-meta { font-size: 12px; margin-bottom: 10px; }
.curso-card-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px;
}
.curso-stat { text-align: center; padding: 8px 2px; }
.curso-stat + .curso-stat { border-left: 1px solid var(--border); }
.curso-stat strong { display: block; font-size: 15px; color: var(--fg); }
.curso-stat strong.st-ok { color: var(--success); }
.curso-stat span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.curso-card-facs { display: flex; flex-wrap: wrap; gap: 5px; }
.curso-card-nofac { font-size: 11px; margin: 0; }
.badge-fac { background: var(--bg-alt); color: var(--fg); text-transform: none; letter-spacing: 0; }

.modal-adminbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(8, 10, 16, .6);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px;
  animation: modal-fade .15s ease;
}
.modal-backdrop[hidden] { display: none; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35); width: 100%; max-width: 880px;
  max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--card); z-index: 2;
}
.modal-title { font-size: 18px; font-weight: 700; margin: 0; }
.modal-close {
  background: transparent; border: none; cursor: pointer; color: var(--muted);
  font-size: 18px; line-height: 1; padding: 6px; border-radius: 8px;
}
.modal-close:hover { color: var(--fg); background: var(--bg-alt); }
.modal-body { padding: 18px 20px 22px; overflow-y: auto; }

@media (max-width: 640px) {
  .grid-cursos { grid-template-columns: 1fr; }
  .destacados-actions { margin-left: 0; }
  .destacados-row { align-items: flex-start; }
  .modal-backdrop { padding: 4vh 10px 10px; }
  .modal { max-height: 92vh; }
  .modal-body { padding: 14px; }
}

/* ============================== INICIO (home) ==============================
   Rediseño del módulo de inicio. Todo scopeado a .home-* / .home-block para
   no alterar otras vistas que reutilizan .hero / .hero-card / .card.
   Paleta intacta (rojo #dc2626 / azul #024571) con variaciones de opacidad. */

/* Entrada en dos tiempos con un breve freno a mitad (mismo lenguaje que el
   login de SENCE). */
@keyframes homeRise {
  0%   { opacity: 0; transform: translateY(18px); }
  55%  { opacity: .80; transform: translateY(7px); }
  70%  { opacity: .90; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes homeDraw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.home-hero {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 34px; align-items: center; margin-bottom: 36px;
}

.home-copy { max-width: 720px; animation: homeRise .7s .05s cubic-bezier(.4, 0, .2, 1) both; }
.home-logo { height: 54px; width: auto; display: block; margin-bottom: 14px; }
/* Logo según tema: variante oscura (letras rojas + figura/bajada clara) en dark. */
.logo-on-dark { display: none; }
[data-theme="dark"] .logo-on-light { display: none; }
[data-theme="dark"] .logo-on-dark { display: block; }

.home-eyebrow {
  font-size: 12px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase;
  color: var(--primary); margin-bottom: 12px;
}
.home-title {
  font-size: clamp(26px, 3.4vw, 34px); line-height: 1.22; letter-spacing: -.3px;
  color: var(--fg); margin-bottom: 14px;
}
.home-sub { color: var(--muted); font-size: 15px; line-height: 1.65; margin-bottom: 22px; max-width: 620px; }
.home-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Métricas: solo texto, alineadas a la derecha y juntas (sin card). */
.home-stat {
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  animation: homeRise .7s .18s cubic-bezier(.4, 0, .2, 1) both;
}
.home-stat-item { display: flex; align-items: baseline; gap: 8px; }
.home-stat-value {
  font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -.5px;
  color: var(--primary); font-variant-numeric: tabular-nums;
}
.home-stat-value.sub { color: #024571; }
[data-theme="dark"] .home-stat-value.sub { color: #7fb2dd; }
.home-stat-label {
  font-size: 12px; font-weight: 600; letter-spacing: .4px;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
}

/* Bloque de destacados */
.home-block .block-title { animation: homeRise .7s .3s cubic-bezier(.4, 0, .2, 1) both; }
.home-block .block-title h2 { font-size: 20px; letter-spacing: -.2px; }
.home-block .ruleta { animation: homeRise .7s .4s cubic-bezier(.4, 0, .2, 1) both; }

/* ---- Cards de curso (estilo Santander Open Academy) ---------------------
   Imagen + nombre + qué es + competencia (categoría). Sin botón: toda la
   tarjeta es clickeable. Línea superior roja (paleta de la empresa). */
.course-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; width: 100%;
  padding: 0; border-radius: 14px; color: inherit; text-decoration: none;
  transition: transform .22s, box-shadow .22s, border-color .22s;
}
.course-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--primary); z-index: 3;
}
.course-card:hover {
  transform: translateY(-3px); border-color: rgba(2, 69, 113, .35);
  box-shadow: 0 14px 30px rgba(17, 24, 39, .15);
}
.course-cover {
  position: relative; aspect-ratio: 2.2 / 1; overflow: hidden;
  background: linear-gradient(135deg, #dc2626, #024571);
}
.course-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .45s ease; }
.course-card:hover .course-cover img { transform: scale(1.05); }
.course-cover-overlay { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.course-cover-title {
  position: absolute; left: 10px; bottom: 10px; z-index: 2; max-width: 82%;
  color: #fff; font-weight: 700; font-size: 13px; line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .6); pointer-events: none;
}
.course-cover-ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
.course-cover-ph img { width: 56px; height: 56px; opacity: .95; }
.course-tag {
  position: absolute; left: 9px; top: 9px; z-index: 2;
  font-size: 9px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  color: #fff; background: rgba(220, 38, 38, .95);
  padding: 3px 8px; border-radius: 999px;
}
.course-tag-alt { left: auto; right: 9px; background: rgba(2, 69, 113, .92); }
.course-body { display: flex; flex-direction: column; gap: 5px; padding: 10px 12px 12px; flex: 1; }
.course-title { font-size: 14px; line-height: 1.3; margin: 0; color: var(--fg); }
.course-desc {
  font-size: 12px; line-height: 1.45; color: var(--muted); margin: 0; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.course-foot { display: flex; gap: 8px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
/* A1: badge "Recién agregado" (amarillo, estilo etiqueta Ubits). */
.course-badge-nuevo {
  align-self: flex-start; font-size: 9px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; color: #7c2d12; background: #fde68a;
  padding: 2px 7px; border-radius: 999px;
}
/* A2: barra de avance compacta dentro de la tarjeta. */
.course-progress { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 0; }
.course-progress .progress { height: 6px; margin: 0; }
.course-progress .progress-label { font-size: 10.5px; }

/* Grilla del catálogo: más tarjetas por fila. */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(198px, 1fr)); gap: 14px; }
@media (max-width: 640px) {
  .course-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 10px; }
  .course-cover { aspect-ratio: 16 / 10; }
}

/* Puntos de navegación */
.ruleta-dot { width: 8px; height: 8px; }
.ruleta-dot.activo { width: 24px; }
.ruleta-dot:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@media (max-width: 1024px) {
  .home-hero { grid-template-columns: 1fr; gap: 22px; }
  .home-copy { max-width: none; }
  .home-stat { flex-direction: row; align-items: baseline; gap: 20px; align-self: flex-start; }
}
@media (max-width: 640px) {
  .home-stat { flex-direction: column; align-items: flex-start; gap: 8px; }
  .home-actions { width: 100%; }
  .home-actions .btn { flex: 1 1 auto; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .home-wrap, .home-wrap * { animation: none !important; }
}

/* ---- Rutas de aprendizaje (curso compuesto por cursos) ------------------- */
.course-badge-ruta {
  position: absolute; left: 9px; top: 9px; z-index: 2;
  font-size: 9px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  color: #024571; background: #bae6fd; padding: 3px 8px; border-radius: 999px;
}
.ruta-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ruta-card-actions form { margin: 0; }
.ruta-mini-list { margin: 8px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
.ruta-mini-list li { margin: 2px 0; }

/* Formularios de ruta */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.mt-2 { margin-top: 12px; }

/* Selector de cursos (drag & drop) */
.ruta-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ruta-picker-col h3 { font-size: 13px; margin: 0 0 8px; }
.ruta-picker-col input[type=search] { width: 100%; margin-bottom: 8px; }
.ruta-picker-lista {
  list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 10px;
}
.ruta-picker-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.ruta-picker-item:last-child { border-bottom: 0; }
.ruta-picker-titulo { flex: 1; }
.ruta-sel-row { cursor: grab; background: var(--bg-alt); }
.ruta-sel-row.dragging { opacity: .5; }
.drag-handle { cursor: grab; color: var(--muted); letter-spacing: -2px; }

/* Detalle de la ruta (alumno) */
.ruta-hero {
  display: grid; grid-template-columns: 320px 1fr; gap: 22px;
  align-items: start; margin-bottom: 22px;
}
.ruta-hero-cover {
  position: relative; aspect-ratio: 16 / 10; border-radius: 14px; overflow: hidden;
  background: linear-gradient(135deg, #dc2626, #024571);
}
.ruta-hero-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ruta-hero-info { display: flex; flex-direction: column; gap: 10px; }
.ruta-meta { display: flex; gap: 12px; align-items: center; font-size: 13px; color: var(--muted); }
.ruta-desc { margin: 0; color: var(--fg); }
.ruta-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ruta-progreso { max-width: 420px; }
.ruta-contenidos { list-style: none; margin: 0; padding: 0; }
.ruta-contenido {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.ruta-contenido:last-child { border-bottom: 0; }
.ruta-contenido-info { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.ruta-contenido-tipo { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.ruta-contenido-titulo { font-weight: 600; color: var(--fg); text-decoration: none; }
.ruta-contenido-titulo:hover { text-decoration: underline; }
.ruta-contenido-prog { width: 160px; }
@media (max-width: 760px) {
  .form-grid, .ruta-picker { grid-template-columns: 1fr; }
  .ruta-hero { grid-template-columns: 1fr; }
}

/* ---- Catálogo: grilla y tarjetas (inspirado en Ubits) --------------------
   Tarjetas más grandes y aireadas, portada 16:9, título a 2 líneas y hover
   con elevación. Se limita a `.course-grid` (catálogo) para no alterar la
   ruleta de inicio, que reutiliza `.course-card`. */
.course-grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  align-items: start;
}
.course-grid .course-card {
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(17, 24, 39, .05);
  overflow: hidden;
}
.course-grid .course-card:hover {
  transform: translateY(-4px);
  border-color: rgba(2, 69, 113, .35);
  box-shadow: 0 16px 34px rgba(17, 24, 39, .16);
}
.course-grid .course-cover { aspect-ratio: 16 / 9; }
.course-grid .course-body { padding: 14px 16px 16px; gap: 7px; }
.course-grid .course-title {
  font-size: 16px; font-weight: 700; line-height: 1.28;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-grid .course-desc { font-size: 13px; -webkit-line-clamp: 2; }
.course-grid .course-foot { font-size: 11px; margin-top: 4px; }
.course-grid .course-tag { font-size: 9.5px; padding: 4px 9px; }

/* Badge de tipo "Ruta" (portada). */
.course-badge-ruta {
  left: 10px; top: 10px;
  background: #024571; color: #fff; font-size: 10px; padding: 4px 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
/* Nivel de la ruta (arriba a la derecha, como la etiqueta de Ubits). */
.course-level-tag {
  position: absolute; right: 10px; top: 10px; z-index: 2;
  font-size: 9.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  color: #024571; background: #e0f2fe; padding: 4px 9px; border-radius: 999px;
}

/* ---- Catálogo amigable: hero, áreas, control, tips, FAQ ------------------ */
.catalog-hero {
  background: linear-gradient(135deg, rgba(220, 38, 38, .06), rgba(2, 69, 113, .09));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 28px;
  margin-bottom: 22px;
}
.catalog-hero .page-title { font-size: 26px; margin: 0 0 6px; }
.catalog-hero .page-sub { margin: 0 0 14px; color: var(--muted); max-width: 660px; }
.catalog-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.catalog-pill {
  font-size: 12px; font-weight: 600; color: #024571;
  background: #e0f2fe; padding: 5px 12px; border-radius: 999px;
}

.categoria-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.categoria-tile {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg); text-decoration: none; color: inherit;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.categoria-tile:hover {
  transform: translateY(-2px); border-color: rgba(2, 69, 113, .35);
  box-shadow: 0 10px 24px rgba(17, 24, 39, .10);
}
.categoria-tile.active { border-color: var(--primary); background: var(--bg-alt); }
.categoria-tile-nombre { font-weight: 700; font-size: 14px; color: var(--fg); }
.categoria-tile-meta { font-size: 12px; color: var(--muted); }

.filter-order { margin-left: auto; display: flex; align-items: center; }
.filter-order select {
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--fg);
}
.results-count { margin: -6px 0 16px; font-size: 13px; }

.catalog-tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.catalog-tips .tip {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-alt);
}
.catalog-tips .tip strong { font-size: 14px; }
.catalog-tips .tip span { font-size: 13px; color: var(--muted); }

.faq {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px;
  margin-bottom: 8px; background: var(--bg);
}
.faq summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.faq summary::marker { color: var(--primary); }
.faq p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

/* Etiquetas de tipo y categoría en las tarjetas. */
.course-badge-ruta, .course-badge-curso {
  position: absolute; left: 10px; top: 10px; z-index: 2;
  font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  color: #fff; padding: 4px 10px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
.course-badge-ruta { background: #024571; }
.course-badge-curso { background: #dc2626; }
.course-eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--primary); margin-bottom: 2px;
}
/* ---- Editor de portada (C&C): preview tipo card + encuadre libre ---------- */
.portada-card-wrap { grid-template-columns: 1fr; max-width: 320px; }
.portada-preview .course-cover { cursor: grab; touch-action: none; overflow: hidden; }
.portada-preview .course-cover:active { cursor: grabbing; }
.portada-preview .course-cover img { transform-origin: var(--pos, 50% 50%); }

/* Chips de categorías del catálogo (fila propia, debajo de los filtros). */
.filter-cats { width: 100%; }
.filter-cats-label { font-size: 12px; align-self: center; }
.filter-cats .chip small { opacity: .65; }

/* Chip "Eliminar filtros" (rojo suave). */
.chip-clear { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.chip-clear:hover { background: #fecaca; }

/* ---- Login: layout partido (estilo Ubits) -------------------------------- */
.auth-body-login { display: block; background: #fff; min-height: 100vh; overflow-x: hidden; }
.auth-body-login .auth-shell { max-width: none; padding: 0; }

.al-login {
  position: relative;
  display: flex; min-height: 100vh; width: 100%;
  /* Gradiente rojo vibrante sobre negro: el borde diagonal del panel visual
     revela este mismo rojo (no negro), evitando la línea de anti-aliasing. */
  background: linear-gradient(180deg, rgba(255, 26, 26, .5) 0%, rgba(255, 26, 26, .18) 30%, transparent 55%), #000000;
  font-family: var(--font-sans);
}
/* Panel del formulario (izquierda). */
.al-login-form {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 3rem 2.5rem; width: 42%; min-height: 100vh; background: #000000;
}
/* Gradiente rojo vibrante desde arriba (mismo que el triángulo). */
.al-login-form::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255, 26, 26, .5) 0%, rgba(255, 26, 26, .18) 30%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}
.al-login-form-inner { position: relative; z-index: 1; width: 100%; max-width: 460px; }
.al-login-logo { margin-bottom: 2rem; }
.al-login-logo img { max-height: 84px; width: auto; display: block; }
.al-login-form-header { margin-bottom: 2rem; }
.al-login-form-title { font-size: 1.9rem; font-weight: 700; color: #fff; margin-bottom: .5rem; letter-spacing: -.02em; }
.al-login-form-subtitle { font-size: 1.05rem; color: rgba(255,255,255,.8); margin: 0; }
.al-field { margin-bottom: 1.35rem; }
.al-field label { display: block; font-size: .95rem; font-weight: 600; color: rgba(255,255,255,.95); margin-bottom: .45rem; }
.al-field input {
  width: 100%; height: 54px; border-radius: 12px; border: 1px solid #fff;
  background: #fff; font-size: 1.05rem; color: #1A1A2E; padding: .75rem 1rem;
  transition: border-color .2s, box-shadow .2s;
}
.al-field input::placeholder { color: #9CA3AF; }
.al-field input:focus { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.35); outline: none; }
.al-pass-wrap { position: relative; }
.al-pass-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: #6B7280; cursor: pointer; padding: 6px;
  display: flex; align-items: center;
}
.al-pass-toggle:hover { color: #1A1A2E; }
.al-btn {
  width: 100%; min-height: 54px; border-radius: 12px; border: 1px solid #e6282e;
  background: #e6282e; color: #fff; font-weight: 700; font-size: 1.05rem;
  cursor: pointer; transition: background-color .2s, box-shadow .2s;
}
.al-btn:hover { background: #c81e24; border-color: #c81e24; }
.al-btn:focus { box-shadow: 0 0 0 3px rgba(255,255,255,.35); outline: none; }
.al-note { font-size: .95rem; color: rgba(255,255,255,.8); line-height: 1.55; margin-top: 1.35rem; }
.al-login-links { font-size: .95rem; color: rgba(255,255,255,.8); margin-top: .85rem; }
.al-login-links a { color: #fff; text-decoration: none; }
.al-login-links a:hover { text-decoration: underline; }
.al-dot { margin: 0 .4rem; }

.al-footer {
  position: fixed; left: 18px; bottom: 12px; z-index: 50;
  margin: 0; font-size: .8rem; color: rgba(255,255,255,.55);
  font-family: var(--font-sans);
}

/* Panel visual (imagen) a la DERECHA, con CORTE DIAGONAL y fondo. */
.al-login-visual {
  position: relative; width: 58%; min-height: 100vh; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-end;
  padding: 3rem 3.5rem; color: #fff;
  background: transparent;
  /* Corte DIAGONAL invertido: mantiene el borde recto, sin escalones. */
  clip-path: polygon(0 0, 100% 0, 100% 100%, 144px 100%);
}
.al-login-visual::before {
  content: ""; position: absolute; inset: 0;
  background: url("../img/intranet_wallpaper.d230f33c646a.jpeg") center/100% 100% no-repeat;
  z-index: 0;
}
.al-login-visual::after { display: none; }
.al-login-visual-content { position: relative; z-index: 2; max-width: 480px; text-align: right; margin-left: auto; margin-top: 3.5rem; }
.al-login-brand { font-size: .9375rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 1.25rem; color: #F6D2CE; }
.al-login-tagline { font-size: 2rem; font-weight: 700; line-height: 1.25; margin-bottom: 1rem; color: #fff; letter-spacing: -.02em; }
.al-login-description { font-size: .9375rem; line-height: 1.7; color: rgba(255,255,255,.75); margin: 0 0 0 auto; max-width: 420px; text-align: right; }

@media (max-width: 860px) {
  .al-login { position: relative; flex-direction: column; justify-content: center; }
  /* En móvil la imagen se oculta: el formulario ocupa toda la pantalla. */
  .al-login-visual { display: none; }
  .al-login-form {
    position: relative; z-index: 1; width: 100%; min-height: 100vh; margin-top: 0;
    padding: 2.5rem 1.75rem;
    background: #000000;
    border-radius: 0;
    box-shadow: none;
  }
  .al-login-form-inner { max-width: 460px; margin: 0 auto; }
}

/* ---- Animación de aparición (retro / escalonada) -------------------------- */
@keyframes alRevealVisual {
  from { opacity: 0; transform: translateX(70px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes alRevealForm {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes alRevealItem {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.al-login { animation: alRevealVisual .62s cubic-bezier(.24,.62,.34,.99) both; }
/* La entrada se aplica al contenido interno (no al panel de 100vh) para que el
   desplazamiento no genere barras de scroll mientras anima. */
.al-login-form-inner { animation: alRevealForm .55s cubic-bezier(.24,.62,.34,.99) .10s both; }
.al-login-logo,
.al-login-form-header,
.al-login-form form,
.al-login-note,
.al-login-links { animation: alRevealItem .5s cubic-bezier(.24,.62,.34,.99) both; }
.al-login-logo { animation-delay: .22s; }
.al-login-form-header { animation-delay: .30s; }
.al-login-form form { animation-delay: .38s; }
.al-login-note { animation-delay: .48s; }
.al-login-links { animation-delay: .56s; }

/* Con /prefers-reduced-motion/ se omite la animación. */
@media (prefers-reduced-motion: reduce) {
  .al-login,
  .al-login-form-inner,
  .al-login-logo,
  .al-login-form-header,
  .al-login-form form,
  .al-login-note,
  .al-login-links { animation: none; }
}

/* ---- Gate de Términos y Condiciones (Ley 21.719) ------------------------- */
.auth-body-gate {
  display: block; min-height: 100vh;
  /* Misma portada del login (imagen + filtro rojo leve) para que el gate no se
     vea vacío; la tarjeta blanca flota sobre el fondo. */
  background:
    radial-gradient(120% 120% at 80% 92%, rgba(200,105,90,.50) 0%, rgba(200,105,90,.14) 52%, rgba(178,60,45,.30) 100%),
    url("../img/fondo.8418c80dae53.png") center/cover no-repeat fixed;
  background-color: #8F2520;
}
.auth-body-gate .auth-shell { max-width: none; padding: 0; }
.tc-gate { display: flex; justify-content: center; padding: 32px 16px; min-height: 100vh; }
.tc-gate-card {
  width: 100%; max-width: 760px; background: #fff; border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,.12); padding: 28px;
  display: flex; flex-direction: column;
  font-family: var(--font-sans);
}
.tc-gate-logo { max-height: 42px; display: block; margin-bottom: 12px; }
.tc-gate-title { font-size: 1.5rem; margin: 0 0 6px; color: #1A1A2E; }
.tc-gate-sub { color: #6B7280; font-size: .9rem; margin: 0 0 16px; }
.tc-scroll-wrap { position: relative; }
.tc-scroll {
  height: 52vh; overflow-y: auto; border: 1px solid #E5E7EB; border-radius: 12px;
  padding: 20px 22px; background: #FBFCFE; scroll-behavior: smooth;
}
.tc-doc h2 { font-size: 1.1rem; color: #B23028; margin: 0 0 10px; }
.tc-doc h3 { font-size: .95rem; margin: 14px 0 4px; color: #1A1A2E; }
.tc-doc p, .tc-doc li { font-size: .875rem; color: #374151; line-height: 1.6; }
.tc-doc ul { padding-left: 20px; }
.tc-doc + .tc-doc { margin-top: 22px; border-top: 1px solid #E5E7EB; padding-top: 18px; }
.tc-irfinal {
  position: absolute; right: 12px; bottom: 12px;
  border: 1px solid #B23028; background: #fff; color: #B23028;
  border-radius: 999px; padding: 8px 14px; font-size: .8rem; cursor: pointer;
  box-shadow: 0 6px 16px rgba(178,48,40,.18);
}
.tc-irfinal:hover { background: #FDF2F1; }
.tc-form { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.tc-check { display: flex; gap: 10px; align-items: flex-start; font-size: .875rem; color: #374151; }
.tc-check input { margin-top: 3px; accent-color: #B23028; }
.tc-check input:disabled + span { color: #9CA3AF; }
#btn-aceptar { align-self: flex-end; min-width: 220px; }
@media (max-width: 640px) { #btn-aceptar { align-self: stretch; } .tc-scroll { height: 46vh; } }

/* Comprobante de aceptación */
.comprobante {
  width: 100%; max-width: 680px; background: #fff; border: 2px solid #B23028;
  border-radius: 16px; padding: 32px;
  font-family: var(--font-sans);
  box-shadow: 0 20px 50px rgba(0,0,0,.12);
}
.comprobante-head { text-align: center; border-bottom: 1px solid #E5E7EB; padding-bottom: 16px; margin-bottom: 18px; }
.comprobante-head h1 { font-size: 1.35rem; color: #B23028; margin: 10px 0 4px; }
.comprobante-head p { color: #6B7280; font-size: .85rem; margin: 0; }
.comprobante-tabla { width: 100%; border-collapse: collapse; }
.comprobante-tabla th, .comprobante-tabla td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #EEF1F5; font-size: .9rem; vertical-align: top; }
.comprobante-tabla th { width: 190px; color: #6B7280; font-weight: 600; }
.comprobante-tabla td { color: #1A1A2E; }
.comprobante-tabla .ua { word-break: break-all; }
.comprobante-note { font-size: .82rem; color: #6B7280; margin: 18px 0; line-height: 1.6; }
.comprobante-actions { display: flex; gap: 10px; justify-content: flex-end; }
.comprobante-redirect { margin: 14px 0 0; text-align: right; font-size: .8rem; color: #6B7280; }
@media print {
  .auth-body-gate { background: #fff; }
  .tc-gate { padding: 0; }
  .comprobante { box-shadow: none; border-radius: 0; }
  .comprobante-actions, .comprobante-redirect { display: none; }
}