/* Manual del usuario de ContabIA. Usa los tokens de app.css (tema oscuro y claro).
   La impresión y el PDF salen sobre blanco, con tapa, índice y número de página. */
html { scroll-behavior: smooth; scroll-padding-top: 4.6rem; }
.m-barra { position: sticky; top: 0; z-index: 15; display: flex; gap: .8rem; align-items: center; padding: .55rem 1.3rem; border-bottom: 1px solid var(--borde); background: color-mix(in srgb, var(--fondo) 90%, transparent); backdrop-filter: blur(10px); }
.m-marca { display: flex; align-items: center; gap: .65rem; color: var(--tinta); text-decoration: none; white-space: nowrap; }
.m-marca b { font-family: var(--titulos); font-size: 1.25rem; letter-spacing: -.03em; }
.m-marca b i { color: var(--acento); font-style: normal; }
.m-marca small { color: var(--gris); font-size: .8rem; border-left: 1px solid var(--borde); padding-left: .65rem; }
.m-arbol { flex: none; width: 30px; height: 34px; background: url(logo-natural.png) -6px 0 / 135px 34px no-repeat; }
.m-buscar { flex: 1; max-width: 360px; margin-left: auto; }
.m-buscar input { padding: .4rem .75rem; border-radius: 8px; }
.m-ops { display: flex; gap: .5rem; align-items: center; white-space: nowrap; }

.m-cuerpo { display: grid; grid-template-columns: 290px minmax(0, 1fr); align-items: start; }
.m-indice { position: sticky; top: 3.4rem; max-height: calc(100vh - 3.4rem); overflow-y: auto; padding: 1.1rem .7rem 2rem 1.1rem; border-right: 1px solid var(--borde); font-size: .88rem; scrollbar-width: thin; }
.m-indice ol { list-style: none; margin: 0; padding: 0; counter-reset: cap; }
.m-indice > ol > li { counter-increment: cap; margin-bottom: .15rem; }
.m-indice a { display: block; padding: .28rem .6rem; border-radius: 7px; color: var(--tinta); text-decoration: none; }
.m-indice > ol > li > a::before { content: counter(cap) ". "; color: var(--gris); }
.m-indice a:hover { background: var(--tinte); }
.m-indice a.activo { background: var(--tinte); color: var(--acento); font-weight: 600; }
.m-indice ol ol a { padding: .18rem .6rem .18rem 1.7rem; font-size: .82rem; color: var(--gris); }
.m-indice ol ol { display: none; }
.m-indice li.abierto > ol { display: block; }
.m-sin { color: var(--gris); padding: .4rem .6rem; }

.m-doc { max-width: 900px; padding: 1.6rem 2.2rem 4rem; counter-reset: cap; }
.m-doc h2 { font-size: 1.55rem; letter-spacing: -.02em; margin: 0 0 .9rem; padding-top: .4rem; }
.m-doc h3 { font-size: 1.12rem; margin: 1.7rem 0 .5rem; }
.m-doc h4 { font-size: .95rem; margin: 1.2rem 0 .35rem; color: var(--gris); text-transform: uppercase; letter-spacing: .06em; }
.m-doc p, .m-doc li { line-height: 1.6; }
.m-doc p { margin: 0 0 .8rem; }
.m-doc ul, .m-doc ol { margin: 0 0 .9rem; padding-left: 1.4rem; }
.m-doc li { margin-bottom: .25rem; }
.cap { counter-increment: cap; padding: 1.6rem 0 1.2rem; border-top: 1px solid var(--borde); }
.cap > h2::before { content: counter(cap) ". "; color: var(--acento); }
.m-doc table { margin: 0; }
.m-doc .tabla-wrap { margin: 0 0 1rem; }
.m-doc td, .m-doc th { vertical-align: top; }
.m-doc td { padding: .45rem .6rem; line-height: 1.45; }
.m-doc td:first-child { font-weight: 600; white-space: nowrap; }
.m-doc table.libre td:first-child { white-space: normal; }
.m-doc kbd { font: .8rem ui-monospace, Consolas, monospace; border: 1px solid var(--borde-f); border-bottom-width: 2px; border-radius: 5px; padding: .05rem .4rem; background: var(--sup); white-space: nowrap; }
.ruta { font-weight: 600; color: var(--acento); white-space: nowrap; }
.nota, .ojo { border: 1px solid var(--borde); border-left: 4px solid var(--verde); background: var(--sup); border-radius: 8px; padding: .65rem .9rem; margin: 0 0 1rem; line-height: 1.55; }
.ojo { border-left-color: var(--aviso); }
.nota b:first-child, .ojo b:first-child { display: block; font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; color: var(--verde); margin-bottom: .15rem; }
.ojo b:first-child { color: var(--aviso); }
.pasos-m { counter-reset: paso; list-style: none; padding-left: 0 !important; }
.pasos-m > li { counter-increment: paso; position: relative; padding-left: 2.5rem; margin-bottom: .6rem; min-height: 1.8rem; }
.pasos-m > li::before { content: counter(paso); position: absolute; left: 0; top: .05rem; width: 1.75rem; height: 1.75rem; border-radius: 50%; display: grid; place-items: center; background: var(--tinte); color: var(--acento); border: 1px solid var(--borde-f); font-weight: 700; font-size: .85rem; }
.m-fig { margin: .4rem 0 1.3rem; }
.m-fig img { display: block; max-width: 100%; height: auto; border: 1px solid var(--borde); border-radius: 10px; }
.m-fig figcaption { font-size: .8rem; color: var(--gris); margin-top: .35rem; }
.m-fig.cel img { max-width: 280px; }

.m-tapa { display: flex; flex-direction: column; gap: .9rem; padding: 2.2rem 2.2rem 2rem; margin-bottom: 1.4rem; border-radius: 14px; color: #dfe9e3; background-color: #090d0a; border: 1px solid #1f2b23;
  background-image: radial-gradient(640px 360px at 12% 0%, rgba(177, 229, 4, .16), transparent 70%), linear-gradient(rgba(124, 183, 65, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(124, 183, 65, .07) 1px, transparent 1px);
  background-size: auto, 100% 36px, 36px 100%; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.m-tapa .logo-ns { width: 206px; height: 52px; background: url(logo-natural.png) 0 0 / 206px 52px no-repeat; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.m-tapa h1 { font-size: clamp(2.6rem, 6vw, 4rem); color: #fff; margin: 1rem 0 0; letter-spacing: -.04em; line-height: 1; font-weight: 700; }
.m-tapa h1 i { color: #b1e504; font-style: normal; }
.m-tapa .sub { font-size: 1.5rem; color: #fff; margin: 0; font-family: var(--titulos); }
.m-tapa p { margin: 0; color: #8c9d92; }
.m-tapa .pie { margin-top: 1.2rem; display: flex; gap: 1.4rem; flex-wrap: wrap; font-size: .88rem; }
.m-tapa .pie b { color: #b1e504; font-weight: 600; }
.m-toc { display: none; }
.m-pie { border-top: 1px solid var(--borde); margin-top: 1rem; padding-top: 1rem; color: var(--gris); font-size: .85rem; }

@media (max-width: 900px) {
  .m-cuerpo { grid-template-columns: minmax(0, 1fr); }
  .m-indice { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--borde); padding: .8rem 1rem; }
  .m-indice ol ol { display: none !important; }
  .m-indice > ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
  .m-doc { padding: 1rem 1rem 3rem; }
  .m-barra { flex-wrap: wrap; padding: .5rem 1rem; }
  .m-marca small, .m-ops .solo-ancho { display: none; }
  .m-buscar { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
  .m-ops { margin-left: auto; }
  .m-tapa { padding: 1.4rem 1.2rem; }
  .m-doc td:first-child { white-space: normal; }
}

@page { size: A4; margin: 17mm 15mm 19mm; @bottom-left { content: "ContabIA · Manual del usuario"; font: 8pt "Segoe UI", Arial, sans-serif; color: #666; } @bottom-right { content: "Página " counter(page); font: 8pt "Segoe UI", Arial, sans-serif; color: #666; } }
@page tapa { margin: 0; @bottom-left { content: none; } @bottom-right { content: none; } }
@media print {
  html { font-size: 10.5pt; scroll-behavior: auto; }
  .m-barra, .m-indice { display: none !important; }
  .m-cuerpo { display: block; }
  .m-doc { max-width: none; padding: 0; }
  .m-tapa { page: tapa; height: 297mm; border: 0; border-radius: 0; margin: 0; padding: 32mm 24mm; justify-content: flex-start; break-after: page; }
  .m-tapa h1 { font-size: 64pt; margin-top: 55mm; }
  .m-tapa .sub { font-size: 24pt; }
  .m-tapa .pie { margin-top: auto; font-size: 10pt; }
  .m-toc { display: block; break-after: page; }
  .m-toc h2 { font-size: 18pt; margin: 0 0 6mm; }
  .m-toc ol { list-style: none; padding: 0; margin: 0; counter-reset: cap; columns: 2; column-gap: 10mm; }
  .m-toc > ol > li { counter-increment: cap; break-inside: avoid; margin-bottom: 2.5mm; }
  .m-toc > ol > li > a { font-weight: 600; }
  .m-toc > ol > li > a::before { content: counter(cap) ". "; }
  .m-toc ol ol { columns: 1; padding-left: 5mm; font-size: 9pt; }
  .m-toc a { color: #000; text-decoration: none; }
  /* Los capítulos van seguidos: uno por página dejaba hojas casi vacías */
  .cap { border-top: 0; padding: 0; margin-top: 11mm; }
  .m-toc + .cap { margin-top: 0; }
  .cap > h2 { font-size: 19pt; border-bottom: 2px solid #7cb741; padding-bottom: 2mm; margin-bottom: 5mm; break-after: avoid; }
  .cap > h2 + p, .m-doc h3 + p, .m-doc h4 + .tabla-wrap { break-before: avoid; }
  .cap > h2::before { color: #4f8f1f; }
  .m-doc h3 { font-size: 12.5pt; break-after: avoid; }
  .m-doc h4 { break-after: avoid; color: #444; }
  .m-doc .tabla-wrap { border: 1px solid #ccc; border-radius: 0; overflow: visible; }
  .m-doc th { background: #eef2ea !important; border-bottom: 1px solid #999; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .m-doc td { border-bottom: 1px solid #ddd; }
  .m-doc td:first-child { white-space: normal; }
  .ruta { color: #2f6a0c; }
  .nota, .ojo { background: #f6f8f3; border-color: #ccc; border-left-color: #7cb741; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ojo { border-left-color: #c9952a; }
  .nota b:first-child { color: #2f6a0c; }
  .ojo b:first-child { color: #8a6100; }
  .pasos-m > li { break-inside: avoid; }
  .pasos-m > li::before { background: #eef2ea; color: #2f6a0c; border-color: #9db88a; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .m-fig { break-inside: avoid; }
  .m-fig img { max-height: 92mm; width: auto; max-width: 100%; border-color: #bbb; border-radius: 6px; }
  .m-fig.cel img { max-height: 100mm; }
  .m-doc td:first-child:has(kbd) { white-space: nowrap; }
  .m-doc kbd { background: #fff; border-color: #999; }
  .m-doc a { color: #2f6a0c; }
  .m-pie { break-inside: avoid; }
}
