/* ============================================================================
   base.css — Sitio estatico TEL-420 Sistemas Paralelos
   Diseno de alta fidelidad, estetico, sobrio y completamente offline.
   Sin tipografias remotas, sin frameworks, sin CDNs.
   ============================================================================ */

/* ---------------------------------------------------------------- variables */
:root {
  --prim: #3b52b2;
  --prim-fuerte: #24357c;
  --prim-suave: #4f6bd6;
  --prim-claro: #edf2fc;
  --prim-borde: #c7d6f5;

  --acento: #d97706;
  --acento-claro: #fef3c7;
  --acento-borde: #fde68a;

  --ok: #15803d;
  --ok-claro: #dcfce7;
  --ok-borde: #bbf7d0;

  --aviso: #b45309;
  --aviso-claro: #fef3c7;

  --error: #dc2626;
  --error-claro: #fee2e2;

  --fondo: #f6f8fc;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-3: #f1f5f9;

  --texto: #0f172a;
  --texto-suave: #475569;
  --texto-tenue: #94a3b8;

  --borde: #e2e8f0;
  --borde-fuerte: #cbd5e1;

  --sombra-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --sombra: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --sombra-alta: 0 14px 28px -4px rgba(15, 23, 42, 0.12), 0 6px 12px -3px rgba(15, 23, 42, 0.08);

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --barra: 62px;
  --cajon: 290px;

  --fuente: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

[data-tema="oscuro"] {
  --prim: #818cf8;
  --prim-fuerte: #a5b4fc;
  --prim-suave: #6366f1;
  --prim-claro: #1e2238;
  --prim-borde: #31385c;

  --acento: #fbbf24;
  --acento-claro: #362911;
  --acento-borde: #59441a;

  --ok: #4ade80;
  --ok-claro: #143320;
  --ok-borde: #1e5233;

  --fondo: #0c0f17;
  --panel: #131722;
  --panel-2: #181d2a;
  --panel-3: #1f2537;

  --texto: #f8fafc;
  --texto-suave: #cbd5e1;
  --texto-tenue: #64748b;

  --borde: #232a3d;
  --borde-fuerte: #323b54;

  --sombra-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --sombra: 0 4px 6px -1px rgba(0, 0, 0, 0.35), 0 2px 4px -2px rgba(0, 0, 0, 0.25);
  --sombra-alta: 0 16px 32px -4px rgba(0, 0, 0, 0.6), 0 8px 16px -4px rgba(0, 0, 0, 0.4);
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--barra) + 20px);
}

body {
  font-family: var(--fuente);
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--prim);
  text-decoration: none;
  transition: color .15s ease;
}
a:hover {
  text-decoration: underline;
  color: var(--prim-suave);
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

:focus-visible {
  outline: 2px solid var(--prim);
  outline-offset: 2px;
  border-radius: 4px;
}

.visualmente-oculto {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ barra */
.barra {
  position: sticky; top: 0; z-index: 60;
  height: var(--barra);
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  background: rgba(30, 41, 68, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

[data-tema="oscuro"] .barra {
  background: rgba(12, 15, 23, 0.92);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.barra__marca {
  display: flex; align-items: center; gap: 10px;
  color: #fff; font-weight: 700; font-size: .95rem;
  min-width: 0;
}
.barra__marca:hover { text-decoration: none; }

.barra__sigla {
  background: linear-gradient(135deg, rgba(255, 255, 255, .25), rgba(255, 255, 255, .1));
  border: 1px solid rgba(255, 255, 255, .3);
  padding: 3px 9px; border-radius: 6px;
  font-size: .76rem; font-weight: 800; letter-spacing: .05em;
  white-space: nowrap;
}

.barra__titulo {
  font-weight: 600; font-size: .92rem; opacity: .95;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.barra__espacio { flex: 1; }

.barra__ruta {
  font-size: .82rem; opacity: .8; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  max-width: 320px;
}

.btn-icono {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; flex: 0 0 38px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
  color: #fff; border-radius: 8px;
  transition: all .15s ease;
}
.btn-icono:hover {
  background: rgba(255, 255, 255, .2);
  border-color: rgba(255, 255, 255, .3);
  transform: translateY(-1px);
}
.btn-icono svg {
  width: 19px; height: 19px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ------------------------------------------------------------------ cajon */
.cajon-fondo {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(10, 13, 22, .6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.cajon-fondo.activo { opacity: 1; pointer-events: auto; }

.cajon {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 80;
  width: var(--cajon);
  background: var(--panel);
  border-right: 1px solid var(--borde);
  transform: translateX(-100%);
  transition: transform .24s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; flex-direction: column;
  box-shadow: var(--sombra-alta);
}
.cajon.abierto { transform: translateX(0); }

.cajon__cabecera {
  padding: 16px 18px;
  border-bottom: 1px solid var(--borde);
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2);
}
.cajon__cabecera strong { font-size: .95rem; color: var(--texto); font-weight: 700; }

.cajon__cuerpo {
  flex: 1; overflow-y: auto; padding: 8px 0 24px;
  overscroll-behavior: contain;
}

/* grupos plegables */
.grupo { border-bottom: 1px solid var(--borde); }
.grupo:last-child { border-bottom: 0; }

.grupo__cabecera {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: none; border: 0;
  color: var(--texto-suave);
  font-size: .75rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
  text-align: left;
  transition: background .15s ease, color .15s ease;
}
.grupo__cabecera:hover { background: var(--panel-2); color: var(--texto); }

.grupo__flecha {
  width: 8px; height: 8px; flex: 0 0 8px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .2s ease; margin-right: 2px;
}
.grupo.abierto .grupo__flecha { transform: rotate(45deg); }

.grupo__conteo {
  margin-left: auto; font-size: .72rem; font-weight: 700;
  background: var(--panel-3); color: var(--texto-tenue);
  padding: 2px 7px; border-radius: 99px;
}

.grupo__lista {
  list-style: none; overflow: hidden;
  max-height: 0; transition: max-height .25s ease-in-out;
}
.grupo.abierto .grupo__lista { max-height: 1800px; }

.grupo__lista a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px 8px 28px;
  color: var(--texto-suave); font-size: .88rem;
  border-left: 3px solid transparent;
  transition: all .15s ease;
}
.grupo__lista a:hover {
  background: var(--prim-claro); color: var(--prim);
  text-decoration: none; border-left-color: var(--prim);
}
.grupo__lista a.activo {
  background: var(--prim-claro); color: var(--prim);
  font-weight: 700; border-left-color: var(--prim);
}
.grupo__lista .ec {
  font-family: var(--mono); font-size: .7rem; font-weight: 800;
  color: var(--texto-tenue); flex: 0 0 26px;
}

/* ------------------------------------------------------------- disposicion */
.lienzo { display: flex; align-items: flex-start; flex: 1; }

.contenido {
  flex: 1; min-width: 0;
  padding: 24px 28px 96px;
  max-width: 1200px; margin: 0 auto;
}

.migas {
  font-size: .84rem; color: var(--texto-tenue);
  margin-bottom: 18px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
}
.migas a {
  color: var(--texto-suave);
  padding: 2px 6px; border-radius: 4px;
}
.migas a:hover { background: var(--panel-3); text-decoration: none; color: var(--texto); }
.migas span { color: var(--borde-fuerte); margin: 0 2px; }

/* ------------------------------------------------------------- portadilla */
.portadilla {
  background: linear-gradient(135deg, var(--prim-fuerte), var(--prim));
  color: #fff;
  border-radius: var(--r-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--sombra);
  position: relative;
  overflow: hidden;
}
.portadilla::after {
  content: "";
  position: absolute; right: -40px; top: -40px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 70%);
  border-radius: 50%; pointer-events: none;
}
[data-tema="oscuro"] .portadilla {
  background: linear-gradient(135deg, #1e2538, #161b29);
  border: 1px solid var(--borde);
}

.portadilla h1 { font-size: 1.75rem; line-height: 1.22; margin-bottom: 10px; font-weight: 800; }
.portadilla p { opacity: .92; font-size: .98rem; max-width: 68ch; line-height: 1.6; }

.portadilla__meta {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px;
}
.etiqueta {
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .25);
  padding: 4px 12px; border-radius: 999px;
  font-size: .78rem; font-weight: 600;
}

/* ---------------------------------------------------------------- tarjetas */
.rejilla {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.tarjeta {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--sombra);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  display: flex; flex-direction: column;
}
.tarjeta:hover {
  transform: translateY(-3px);
  box-shadow: var(--sombra-alta);
  border-color: var(--prim-borde);
}

.tarjeta__cima {
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px;
}
.tarjeta__sigla {
  flex: 0 0 auto;
  background: var(--prim-claro); color: var(--prim);
  border: 1px solid var(--prim-borde);
  border-radius: 8px; padding: 6px 12px;
  font-size: .84rem; font-weight: 800; letter-spacing: .02em;
}

.tarjeta h3 { font-size: 1.05rem; line-height: 1.35; margin-bottom: 6px; font-weight: 700; }
.tarjeta p { font-size: .88rem; color: var(--texto-suave); flex: 1; }

.tarjeta__datos {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--borde);
}
.dato {
  font-size: .75rem; color: var(--texto-suave);
  background: var(--panel-2); border: 1px solid var(--borde);
  padding: 3px 8px; border-radius: 6px;
}
.dato b { color: var(--texto); font-weight: 700; }

.tarjeta__enlaces {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px;
}
.enlace-chip {
  font-size: .8rem; font-weight: 600;
  padding: 6px 13px; border-radius: 8px;
  background: var(--prim-claro); color: var(--prim);
  border: 1px solid var(--prim-borde);
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s ease;
}
.enlace-chip:hover {
  background: var(--prim); color: #fff;
  border-color: var(--prim); text-decoration: none;
  transform: translateY(-1px);
}
.enlace-chip--ext {
  background: var(--panel-2); color: var(--texto-suave);
  border-color: var(--borde);
}
.enlace-chip--ext:hover {
  background: var(--panel-3); color: var(--texto);
  border-color: var(--borde-fuerte);
}

/* --------------------------------------------------------------- estados */
.estado {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .75rem; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
}
.estado--listo { background: var(--ok-claro); color: var(--ok); border: 1px solid var(--ok-borde); }
.estado--curso { background: var(--aviso-claro); color: var(--aviso); }
.estado--plan { background: var(--panel-2); color: var(--texto-tenue); border: 1px solid var(--borde); }
.estado::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ----------------------------------------------------------------- pestanas */
.pestanas {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 2px solid var(--borde);
  margin-bottom: 24px;
}
.pestana {
  padding: 11px 18px; border: 0; background: none;
  color: var(--texto-suave); font-size: .92rem; font-weight: 600;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all .15s ease;
}
.pestana:hover { color: var(--texto); background: var(--panel-2); border-radius: 6px 6px 0 0; }
.pestana.activa {
  color: var(--prim); border-bottom-color: var(--prim);
  font-weight: 700;
}
.pestana .cuenta {
  display: inline-block; margin-left: 6px;
  background: var(--panel-3); border: 1px solid var(--borde);
  border-radius: 999px; padding: 1px 7px;
  font-size: .73rem; color: var(--texto-tenue); font-weight: 700;
}
.pestana.activa .cuenta {
  background: var(--prim-claro); color: var(--prim);
  border-color: var(--prim-borde);
}

.panel-pestana { display: none; }
.panel-pestana.activo { display: block; animation: aparecer .2s ease; }
@keyframes aparecer { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; } }

/* -------------------------------------------------- toolbar del documento */
.doc-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding: 12px 18px; margin-bottom: 20px;
  background: var(--panel-2); border: 1px solid var(--borde);
  border-radius: var(--r);
}
.doc-toolbar__tipo {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .84rem; font-weight: 700; color: var(--prim);
}
.doc-toolbar__acciones {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* ----------------------------------------------------------------- articulo */
.articulo {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: var(--r-lg);
  padding: 34px 40px;
  box-shadow: var(--sombra);
  line-height: 1.7;
}

.articulo h1 { font-size: 1.65rem; margin: 32px 0 16px; line-height: 1.25; font-weight: 800; }
.articulo h2 {
  font-size: 1.32rem; margin: 38px 0 16px; line-height: 1.3;
  padding-bottom: 8px; border-bottom: 1px solid var(--borde);
  font-weight: 700; color: var(--texto);
}
.articulo h3 { font-size: 1.12rem; margin: 28px 0 12px; font-weight: 700; color: var(--texto); }
.articulo h4 { font-size: 1rem; margin: 22px 0 10px; color: var(--texto-suave); font-weight: 600; }
.articulo > h2:first-child, .articulo > h1:first-child { margin-top: 0; }

.articulo p { margin: 14px 0; }
.articulo ul, .articulo ol { margin: 14px 0 14px 28px; }
.articulo li { margin: 6px 0; }

.articulo a { text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }

.articulo code {
  font-family: var(--mono); font-size: .88em;
  background: var(--panel-3); border: 1px solid var(--borde);
  padding: 2px 6px; border-radius: 5px; color: var(--prim);
}
[data-tema="oscuro"] .articulo code { color: #a5b4fc; }

.articulo pre {
  position: relative;
  background: #0f1422; color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--prim);
  border-radius: var(--r); padding: 18px 20px;
  overflow-x: auto; margin: 18px 0;
  font-size: .88rem; line-height: 1.6;
}
.articulo pre code {
  background: none; border: 0; padding: 0;
  color: inherit; font-size: inherit;
}

/* Boton de copiar codigo */
.btn-copiar {
  position: absolute; top: 10px; right: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #cbd5e1; border-radius: 6px;
  padding: 4px 10px; font-size: .74rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; transition: all .15s ease;
  backdrop-filter: blur(4px);
}
.btn-copiar:hover {
  background: rgba(255, 255, 255, 0.24); color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}
.btn-copiar.copiado {
  background: var(--ok); border-color: var(--ok); color: #fff;
}
.btn-copiar svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

.articulo blockquote {
  margin: 18px 0; padding: 14px 20px;
  background: var(--acento-claro);
  border-left: 4px solid var(--acento);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: .95rem;
}
.articulo blockquote p { margin: 6px 0; }

/* Contenedor de tablas para scroll horizontal */
.articulo table {
  width: 100%; border-collapse: collapse; margin: 18px 0;
  font-size: .9rem;
}
.articulo th, .articulo td {
  border: 1px solid var(--borde); padding: 10px 14px; text-align: left;
}
.articulo th {
  background: var(--prim-claro); font-weight: 700; color: var(--texto);
}
.articulo tbody tr:nth-child(even) { background: var(--panel-2); }
.articulo tbody tr:hover { background: var(--panel-3); }

.articulo figure { margin: 24px 0; text-align: center; }
.articulo figure img {
  max-width: 100%; height: auto;
  border: 1px solid var(--borde); border-radius: var(--r-sm);
  background: #fff; padding: 8px;
}
.articulo figcaption {
  font-size: .84rem; color: var(--texto-suave);
  margin-top: 10px; font-style: italic; text-align: center;
  max-width: 76ch; margin-inline: auto;
}

/* formulas SVG generadas por el pipeline */
.articulo img.formula,
.articulo img.formula-inline { border: 0; background: transparent; padding: 0; }
.articulo img.formula { display: block; margin: 18px auto; max-width: 15cm; }
.articulo img.formula-inline {
  display: inline; vertical-align: middle;
  height: 1.2em; width: auto; margin: 0 3px;
}
[data-tema="oscuro"] .articulo img.formula,
[data-tema="oscuro"] .articulo img.formula-inline {
  filter: invert(1) hue-rotate(180deg);
}

/* ------------------------------------------------------------------ avisos */
.aviso {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 18px; border-radius: var(--r);
  margin: 18px 0; font-size: .92rem;
  border: 1px solid;
}
.aviso svg { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 2px;
  fill: none; stroke: currentColor; stroke-width: 2; }
.aviso--info {
  background: var(--prim-claro); border-color: var(--prim-borde); color: var(--prim-fuerte);
}
[data-tema="oscuro"] .aviso--info { color: var(--prim); }
.aviso--alerta {
  background: var(--acento-claro); border-color: var(--acento-borde); color: #7c4a08;
}
[data-tema="oscuro"] .aviso--alerta { color: #f0b45e; border-color: #5a4416; }
.aviso b { display: block; margin-bottom: 2px; }

/* -------------------------------------------------------------- busqueda */
.buscador {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--borde);
  border-radius: var(--r); padding: 12px 16px;
  margin-bottom: 18px;
  box-shadow: var(--sombra);
  transition: border-color .15s ease;
}
.buscador:focus-within { border-color: var(--prim); }
.buscador svg { width: 19px; height: 19px; flex: 0 0 19px; color: var(--texto-tenue);
  fill: none; stroke: currentColor; stroke-width: 2; }
.buscador input {
  flex: 1; border: 0; outline: 0; background: none;
  font-size: .98rem; color: var(--texto);
}
.buscador kbd {
  font-family: var(--mono); font-size: .74rem;
  background: var(--panel-3); border: 1px solid var(--borde);
  border-radius: 5px; padding: 2px 7px; color: var(--texto-tenue);
}

.resultados { display: flex; flex-direction: column; gap: 10px; }
.resultado {
  display: block; padding: 14px 18px;
  background: var(--panel); border: 1px solid var(--borde);
  border-radius: var(--r); color: var(--texto);
  transition: all .15s ease;
}
.resultado:hover {
  border-color: var(--prim); text-decoration: none;
  box-shadow: var(--sombra); transform: translateY(-1px);
}
.resultado__tipo {
  font-size: .72rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--prim);
}
.resultado h4 { font-size: 1rem; margin: 4px 0 5px; font-weight: 700; }
.resultado p { font-size: .88rem; color: var(--texto-suave); }
.resultado mark { background: #fde68a; color: inherit; padding: 0 3px; border-radius: 3px; }
[data-tema="oscuro"] .resultado mark { background: #6b5a12; color: #fff8dc; }

/* --------------------------------------------------------- boton flotante */
.acciones-flotantes {
  position: fixed; right: 22px; bottom: 22px; z-index: 55;
  display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 12px;
}

.fab {
  width: 56px; height: 56px; border-radius: 50%;
  border: 0; background: var(--prim); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 6px 20px rgba(59, 82, 178, 0.4);
  transition: transform .18s ease, background .18s ease;
}
.fab:hover { background: var(--prim-suave); transform: scale(1.06); }
.fab svg { width: 24px; height: 24px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fab .icono-cerrar { display: none; }
.fab.abierto .icono-menu { display: none; }
.fab.abierto .icono-cerrar { display: block; }
.fab.abierto { transform: rotate(90deg); }

.fab-lateral {
  display: flex; align-items: center; gap: 10px;
  padding: 0; border: 0; background: none;
  opacity: 0; transform: translateY(14px) scale(.85);
  pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.acciones-flotantes.abierto .fab-lateral {
  opacity: 1; transform: translateY(0) scale(1); pointer-events: auto;
}
.acciones-flotantes.abierto .fab-lateral:nth-child(2) { transition-delay: .04s; }
.acciones-flotantes.abierto .fab-lateral:nth-child(3) { transition-delay: .08s; }
.acciones-flotantes.abierto .fab-lateral:nth-child(4) { transition-delay: .12s; }
.acciones-flotantes.abierto .fab-lateral:nth-child(5) { transition-delay: .16s; }

.fab-lateral__etiqueta {
  background: #1e293b; color: #fff;
  padding: 8px 14px; border-radius: 8px;
  font-size: .84rem; font-weight: 600; white-space: nowrap;
  box-shadow: var(--sombra-alta);
}
.fab-lateral__boton {
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--borde); background: var(--panel); color: var(--prim);
  display: grid; place-items: center;
  box-shadow: var(--sombra-alta);
  transition: all .15s ease;
}
.fab-lateral__boton:hover { background: var(--prim-claro); transform: scale(1.08); }
.fab-lateral__boton svg { width: 20px; height: 20px; fill: none;
  stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.saltar-arriba {
  position: fixed; right: 22px; bottom: 90px; z-index: 54;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--borde); background: var(--panel);
  color: var(--prim); display: grid; place-items: center;
  box-shadow: var(--sombra); opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.saltar-arriba.visible { opacity: 1; pointer-events: auto; }
.saltar-arriba svg { width: 19px; height: 19px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ tablas */
.tabla {
  width: 100%; border-collapse: collapse;
  background: var(--panel); font-size: .9rem;
  border-radius: var(--r); overflow: hidden;
  box-shadow: var(--sombra);
}
.tabla th, .tabla td {
  padding: 11px 14px; text-align: left;
  border-bottom: 1px solid var(--borde);
}
.tabla th { background: var(--prim-claro); font-weight: 700; font-size: .84rem;
  text-transform: uppercase; letter-spacing: .04em; color: var(--texto-suave); }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover { background: var(--panel-2); }

/* ------------------------------------------------------------------ varios */
.vacio {
  text-align: center; padding: 54px 20px; color: var(--texto-tenue);
}
.vacio svg { width: 48px; height: 48px; margin-bottom: 14px;
  fill: none; stroke: currentColor; stroke-width: 1.5; opacity: .5; }
.vacio p { font-size: .95rem; }

.pie {
  border-top: 1px solid var(--borde);
  margin-top: 50px; padding: 24px 0 10px;
  font-size: .84rem; color: var(--texto-tenue);
  text-align: center; line-height: 1.6;
}

/* ---------------------------------------------------------------- adaptable */
@media (max-width: 860px) {
  .contenido { padding: 18px 16px 96px; }
  .articulo { padding: 24px 20px; border-radius: var(--r); }
  .portadilla { padding: 22px 20px; border-radius: var(--r); }
  .portadilla h1 { font-size: 1.4rem; }
  .barra__titulo, .barra__ruta { display: none; }
  .cajon { width: min(88vw, var(--cajon)); }
  .rejilla { grid-template-columns: 1fr; }
  .acciones-flotantes { right: 16px; bottom: 16px; }
  .saltar-arriba { right: 16px; bottom: 82px; }
  .articulo p { text-align: left; }
}

/* Barra de desplazamiento */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--borde-fuerte); border-radius: 6px;
  border: 2px solid var(--fondo);
}
::-webkit-scrollbar-thumb:hover { background: var(--texto-tenue); }

/* ---------------------------------------------------------------- impresion */
@media print {
  .barra, .cajon, .cajon-fondo, .acciones-flotantes, .saltar-arriba,
  .pestanas, .buscador, .fab, .btn-copiar, .doc-toolbar__acciones { display: none !important; }

  body { background: #fff; color: #000; font-size: 11pt; }
  .contenido { padding: 0; max-width: none; }
  .portadilla {
    background: none !important; color: #000;
    border: 0; border-bottom: 2px solid #000;
    padding: 0 0 12px; box-shadow: none; margin-bottom: 18px;
  }
  .portadilla .etiqueta { border-color: #999; color: #000; }
  .articulo, .tarjeta, .tabla {
    box-shadow: none; border-color: #ccc; break-inside: avoid;
  }
  .articulo { padding: 0; border: 0; }
  .articulo h2, .articulo h3 { break-after: avoid; }
  .articulo pre { background: #f8fafc; color: #000; border: 1px solid #ccc; border-left: 3px solid #000; }
  .articulo figure { break-inside: avoid; }
  .panel-pestana { display: block !important; }
  a { text-decoration: none; color: #000; }
}

/* ------------------------------------------------- indice lateral de la pagina */
.indice {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: var(--r);
  padding: 16px 20px;
  margin-bottom: 22px;
  box-shadow: var(--sombra);
}
.indice::before {
  content: "Índice de esta página";
  display: block;
  font-size: .74rem; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--texto-tenue);
  margin-bottom: 10px;
}
.indice-lista { list-style: none; columns: 2; column-gap: 24px; }
.indice-lista li { break-inside: avoid; margin: 4px 0; }
.indice-lista a {
  display: block; padding: 4px 10px;
  font-size: .88rem; color: var(--texto-suave);
  border-left: 3px solid transparent; border-radius: 0 6px 6px 0;
  transition: all .15s ease;
}
.indice-lista a:hover {
  background: var(--prim-claro); color: var(--prim); text-decoration: none;
}
.indice-lista a.activo {
  border-left-color: var(--prim); background: var(--prim-claro);
  color: var(--prim); font-weight: 700;
}
.indice-lista .idx-h3 a { padding-left: 24px; font-size: .84rem; }

@media (max-width: 700px) {
  .indice-lista { columns: 1; }
}
