:root {
  --canvas: #f1f0e9;
  --paper: #fbfaf6;
  --ink: #24313a;
  --muted: #5d6763;
  --green: #3f5c48;
  --green-2: #58745e;
  --green-soft: #e7eee5;
  --nav: #26353a;
  --nav-text: #e1e7e0;
  --nav-muted: #aebbb2;
  --line: #d4d6cf;
  --orange: #e8590c;
  --amber-bg: #f7efdc;
  --amber-line: #e3cb92;
  --blue-bg: #eaf1f4;
  --blue-line: #b9cdd8;
  --red: #9a493d;
  --shadow: 0 1px 2px rgba(36, 49, 58, .06), 0 6px 18px rgba(36, 49, 58, .06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 146px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 17px/1.62 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
img { max-width: 100%; height: auto; }
a { color: var(--green); }
a:hover { color: var(--ink); }
b, strong { font-weight: 650; }
.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; }

.cabecera { position: sticky; top: 0; z-index: 30; background: var(--nav); color: var(--nav-text); box-shadow: 0 2px 10px rgba(0, 0, 0, .18); }
.cabecera-fila { display: flex; align-items: center; gap: 14px; max-width: 1320px; margin: 0 auto; padding: 10px 20px; }
.marca { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.marca img { width: 46px; height: 36px; border-radius: 50%; object-fit: cover; background: #fff; flex: none; }
.marca strong { display: block; font-size: 17px; line-height: 1.2; color: #f7f7f1; }
.marca small { display: block; font-size: 13px; color: var(--nav-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marca span { min-width: 0; }
.acciones { margin-left: auto; display: flex; gap: 8px; flex: none; }
.boton { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 8px; border: 1px solid #6f8f78; background: var(--green-2); color: #fff; font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.boton:hover { background: var(--green); color: #fff; }
.boton-claro { background: transparent; border-color: #5c6f73; color: var(--nav-text); }
.boton-claro:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.boton svg { width: 18px; height: 18px; flex: none; }
.boton-indice { display: none; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; border: 1px solid #5c6f73; background: transparent; color: var(--nav-text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; flex: none; }
.boton-indice svg { width: 20px; height: 20px; }

.herramientas { border-top: 1px solid rgba(255, 255, 255, .08); }
.herramientas-fila { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; max-width: 1320px; margin: 0 auto; padding: 10px 20px 12px; }
.buscador { position: relative; flex: 1 1 320px; max-width: 560px; }
.buscador svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.buscador input { width: 100%; padding: 10px 12px 10px 40px; border: 1px solid #c7cbc3; border-radius: 9px; background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; }
.buscador input:focus { outline: 3px solid rgba(232, 89, 12, .35); border-color: var(--orange); }
.filtro { display: inline-flex; border: 1px solid #5c6f73; border-radius: 9px; overflow: hidden; flex: none; }
.filtro button { padding: 8px 14px; border: 0; background: transparent; color: var(--nav-text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.filtro button + button { border-left: 1px solid #5c6f73; }
.filtro button[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.resultado-busqueda { margin: 0; font-size: 14px; color: var(--nav-muted); flex-basis: 100%; }

.pagina { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 28px; max-width: 1320px; margin: 0 auto; padding: 24px 20px 80px; }
.indice { position: sticky; top: 132px; align-self: start; max-height: calc(100vh - 150px); overflow-y: auto; padding: 16px 14px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); font-size: 15px; scrollbar-width: thin; }
.indice h2 { margin: 0 0 8px; padding: 0 6px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.indice ol { list-style: none; margin: 0; padding: 0; }
.indice > ol > li { margin: 2px 0; }
.indice a { display: block; padding: 5px 8px; border-radius: 7px; color: var(--ink); text-decoration: none; line-height: 1.35; }
.indice a:hover { background: var(--green-soft); }
.indice a.activo { background: var(--green); color: #fff; }
.indice > ol > li > a { font-weight: 650; }
.indice ol ol { margin: 2px 0 6px 14px; padding-left: 8px; border-left: 2px solid var(--line); }
.indice ol ol a { font-size: 14px; color: var(--muted); }
.indice ol ol a.activo { color: #fff; }
.indice .numero { display: inline-block; min-width: 1.6em; color: var(--green-2); }
.indice a.activo .numero { color: #fff; }
.indice [hidden] { display: none; }
.cerrar-indice { display: none; }

.contenido { min-width: 0; }
.portada, .indice-titulo-impreso { display: none; }
.bienvenida { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; padding: 26px 28px; margin-bottom: 26px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.bienvenida img { width: 132px; height: 102px; border-radius: 50%; object-fit: cover; }
.bienvenida h1 { margin: 0 0 6px; font-size: 32px; line-height: 1.15; letter-spacing: -.01em; }
.bienvenida p { margin: 0 0 8px; color: var(--muted); }
.bienvenida .version { font-size: 14px; }
.atajos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.atajos a { padding: 6px 12px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 14px; font-weight: 600; text-decoration: none; }
.atajos a:hover { background: var(--green); color: #fff; }

.capitulo { margin-bottom: 26px; padding: 26px 30px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.capitulo > h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; font-size: 27px; line-height: 1.2; letter-spacing: -.01em; }
.capitulo > h2 .num { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: var(--green); color: #fff; font-size: 20px; flex: none; }
.capitulo > .resumen { margin: 0 0 8px; color: var(--muted); font-size: 18px; }
.tema { padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--line); }
.tema:first-of-type { border-top: 0; margin-top: 6px; padding-top: 6px; }
.tema h3 { margin: 0 0 10px; font-size: 21px; line-height: 1.3; }
.tema h4 { margin: 18px 0 6px; font-size: 17px; }
.tema p, .tema li { max-width: 72ch; }
.tema ol, .tema ul { padding-left: 1.4em; }
.tema li { margin: 4px 0; }
.pasos { counter-reset: paso; list-style: none; padding-left: 0 !important; }
.pasos > li { position: relative; padding-left: 42px; margin: 10px 0; }
.pasos > li::before { counter-increment: paso; content: counter(paso); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 8px; background: var(--green-soft); color: var(--green); font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; }

.etiqueta { display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .03em; vertical-align: middle; text-transform: uppercase; }
.etiqueta.admin { background: #f3e3df; color: var(--red); }
.etiqueta.socio { background: var(--green-soft); color: var(--green); }

.n { display: inline-flex; align-items: center; justify-content: center; width: 23px; height: 23px; margin: 0 3px; border-radius: 50%; background: var(--orange); color: #fff; font-size: 13px; font-weight: 700; line-height: 1; vertical-align: 1px; font-style: normal; }

.captura { margin: 18px 0 22px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.captura img { display: block; margin: 0 auto; border-radius: 6px; border: 1px solid #e3e4df; cursor: zoom-in; }
.captura.movil img { max-width: 330px; width: 100%; }
.captura.media img { max-width: 560px; width: 100%; }
.captura.angosta img { max-width: 380px; width: 100%; }
.captura figcaption { margin-top: 10px; font-size: 15px; color: var(--muted); }
.captura figcaption > p { margin: 0 0 6px; }
.leyenda { list-style: none; margin: 6px 0 0; padding: 0 !important; display: grid; gap: 6px; }
.leyenda li { display: grid; grid-template-columns: 30px 1fr; align-items: start; margin: 0; max-width: none; color: var(--ink); }
.leyenda .n { margin: 1px 0 0; }
.par { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.par .captura { margin: 18px 0 8px; }

.nota { margin: 16px 0; padding: 12px 16px 12px 46px; border-radius: 10px; border: 1px solid var(--blue-line); background: var(--blue-bg); position: relative; }
.nota::before { content: "i"; position: absolute; left: 14px; top: 13px; width: 22px; height: 22px; border-radius: 50%; background: #4a7088; color: #fff; font: 700 14px/22px Georgia, serif; text-align: center; }
.nota.importante { border-color: var(--amber-line); background: var(--amber-bg); }
.nota.importante::before { content: "!"; background: #b7791f; font-family: inherit; }
.nota.consejo { border-color: #bfd0bd; background: var(--green-soft); }
.nota.consejo::before { content: "✓"; background: var(--green-2); font-family: inherit; }
.nota p { margin: 0; }
.nota p + p { margin-top: 6px; }
.nota strong:first-child { display: block; margin-bottom: 2px; }

.tabla { width: 100%; margin: 14px 0 18px; border-collapse: collapse; font-size: 15.5px; background: #fff; border: 1px solid var(--line); }
.tabla th, .tabla td { padding: 9px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.tabla thead th { background: #e9e9e4; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.tabla td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabla-scroll { overflow-x: auto; }

.preguntas details { margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.preguntas summary { padding: 12px 16px; font-weight: 650; cursor: pointer; list-style: none; }
.preguntas summary::-webkit-details-marker { display: none; }
.preguntas summary::before { content: "+"; display: inline-block; width: 1.3em; color: var(--green-2); font-weight: 800; }
.preguntas details[open] summary::before { content: "−"; }
.preguntas details > div { padding: 0 16px 12px 36px; }
.preguntas details p { margin: 0 0 6px; }

mark { background: #ffe08a; color: inherit; padding: 0 1px; border-radius: 2px; }
.sin-resultados { padding: 28px; text-align: center; background: var(--paper); border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); }
.oculto-filtro, .oculto-busqueda { display: none !important; }

.subir { position: fixed; right: 18px; bottom: 18px; z-index: 25; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--green); color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.subir svg { width: 22px; height: 22px; }
.subir[hidden] { display: none; }

.visor { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 56px 14px 14px; background: rgba(16, 22, 25, .96); }
.visor[hidden] { display: none; }
.visor img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #fff; }
.visor button { position: absolute; top: 10px; right: 12px; padding: 8px 14px; border: 1px solid rgba(255, 255, 255, .4); border-radius: 8px; background: transparent; color: #fff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.visor p { position: absolute; top: 14px; left: 16px; right: 120px; margin: 0; color: #e1e7e0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pie { margin-top: 10px; text-align: center; font-size: 14px; color: var(--muted); }

@media (max-width: 980px) {
  html { scroll-padding-top: 150px; }
  .pagina { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 80px; gap: 0; }
  .boton-indice { display: inline-flex; }
  .indice { position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: min(340px, 88vw); max-height: none; border-radius: 0 14px 14px 0; transform: translateX(-105%); transition: transform .2s ease; padding-top: 18px; }
  .indice.abierto { transform: none; box-shadow: 0 0 0 100vmax rgba(20, 28, 32, .45); }
  .cerrar-indice { display: block; width: 100%; margin: 0 0 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
}

@media (max-width: 720px) {
  html { scroll-padding-top: 84px; }
  body { font-size: 16.5px; }
  .herramientas { position: absolute; top: 100%; left: 0; right: 0; background: var(--nav); box-shadow: 0 8px 12px rgba(0, 0, 0, .18); }
  .cabecera.compacta .herramientas { display: none; }
  .pagina { padding-top: calc(16px + var(--alto-herramientas, 118px)); }
  .cabecera-fila { padding: 8px 14px; gap: 10px; }
  .marca img { width: 38px; height: 30px; }
  .marca strong { font-size: 15.5px; }
  .marca small { display: none; }
  .acciones .boton-claro { display: none; }
  .boton { padding: 8px 11px; font-size: 14px; }
  .herramientas-fila { padding: 8px 14px 10px; }
  .filtro { width: 100%; }
  .filtro button { flex: 1; }
  .bienvenida { grid-template-columns: 1fr; text-align: center; padding: 22px 18px; }
  .bienvenida img { margin: 0 auto; width: 110px; height: 85px; }
  .bienvenida h1 { font-size: 26px; }
  .atajos { justify-content: center; }
  .capitulo { padding: 20px 16px 6px; border-radius: 12px; }
  .capitulo > h2 { font-size: 22px; }
  .capitulo > h2 .num { width: 34px; height: 34px; font-size: 17px; }
  .tema h3 { font-size: 19px; }
  .captura { padding: 8px; }
  .par { grid-template-columns: minmax(0, 1fr); }
  .tabla { font-size: 14.5px; }
  .tabla th, .tabla td { padding: 7px 9px; }
}

@media print {
  @page { size: A4; }
  html { scroll-behavior: auto; }
  body { background: #fff; font-size: 11pt; line-height: 1.5; }
  .cabecera, .subir, .visor, .bienvenida, .boton-indice, .cerrar-indice, .sin-resultados { display: none !important; }
  .oculto-filtro, .oculto-busqueda { display: block !important; }
  .pagina { display: block; max-width: none; padding: 0; }
  .portada { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 250mm; text-align: center; break-after: page; }
  .portada img { width: 70mm; height: auto; border-radius: 50%; margin-bottom: 14mm; }
  .portada .titulo { font-size: 34pt; font-weight: 750; line-height: 1.1; margin: 0 0 6mm; color: var(--ink); }
  .portada .sistema { font-size: 16pt; margin: 0 0 3mm; color: var(--green); font-weight: 650; }
  .portada .lugar { font-size: 12pt; color: var(--muted); margin: 0; }
  .portada .version { margin-top: 24mm; font-size: 10.5pt; color: var(--muted); }
  .indice { position: static; display: block; max-height: none; overflow: visible; padding: 0; border: 0; box-shadow: none; background: none; font-size: 11pt; transform: none; break-after: page; }
  .indice h2 { font-size: 20pt; letter-spacing: 0; text-transform: none; color: var(--ink); padding: 0; margin: 0 0 6mm; }
  .indice a, .indice a.activo { padding: .45mm 0; color: var(--ink); background: none; line-height: 1.3; }
  .indice .numero, .indice a.activo .numero { color: var(--green); }
  .indice ol ol a, .indice ol ol a.activo { color: #3f4846; font-size: 10pt; }
  .indice ol ol { border-left-color: #cfd2cb; }
  .indice { width: auto; }
  .indice > ol { column-count: 2; column-gap: 12mm; }
  .indice > ol > li { break-inside: avoid; margin: 0 0 2.5mm; }
  .indice ol ol { margin: .5mm 0 0 4mm; }
  .capitulo { break-before: page; padding: 0; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: none; }
  .capitulo > h2 { font-size: 21pt; margin-bottom: 3mm; }
  .capitulo > h2 .num { width: 11mm; height: 11mm; font-size: 15pt; border-radius: 2.5mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .capitulo > .resumen { font-size: 12pt; }
  .tema { break-inside: auto; padding-top: 5mm; margin-top: 5mm; }
  .tema h3 { font-size: 14.5pt; break-after: avoid; }
  .tema h4 { break-after: avoid; }
  .tema p, .tema li { max-width: none; }
  .captura { break-inside: avoid; padding: 2.5mm; border-radius: 2mm; margin: 4mm 0 5mm; }
  .captura img { cursor: default; max-height: 168mm; width: auto; max-width: 100%; }
  .captura.movil img { max-width: 66mm; max-height: 142mm; }
  .captura.media img { max-width: 120mm; }
  .captura.angosta img { max-width: 85mm; max-height: 150mm; }
  .captura figcaption { font-size: 9.5pt; }
  .par { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5mm; break-inside: avoid; }
  .tabla { font-size: 9.5pt; margin: 3mm 0 4mm; }
  .tabla th, .tabla td { padding: 1.5mm 2.5mm; }
  .nota, .preguntas details { break-inside: avoid; }
  .tabla tr { break-inside: avoid; }
  .nota, .etiqueta, .n, .pasos > li::before, .tabla thead th, .indice a { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .preguntas details > div { display: block; }
  .preguntas summary::before, .preguntas details[open] summary::before { content: none; }
  a { color: inherit; text-decoration: none; }
  .pie { display: none; }
}
