/* Documentación pública de Sanapp. Sin dependencias: CSS moderno con respaldo razonable. */

@font-face { font-family: 'Techno Nue'; src: url('../fonts/Techno_Nue-Regular.otf') format('opentype'); font-display: swap; }

:root {
    --brand: #1529cf;
    --brand-2: #4f5dff;
    --brand-soft: #eef0ff;
    --bg: #fbfbfd;
    --surface: #ffffff;
    --surface-2: #f4f5f9;
    --text: #0f172a;
    --text-2: #3c4558;
    --muted: #677086;
    --border: #e5e7ef;
    --ring: rgba(21, 41, 207, .28);
    --tip: #0f8a5f; --tip-bg: #ebf8f2;
    --info: #1d5fd1; --info-bg: #edf3ff;
    --warn: #b45309; --warn-bg: #fff6e6;
    --law: #6d28d9; --law-bg: #f4efff;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
    --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .35);
    --radius: 14px;
    --header-h: 64px;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color-scheme: light;
}
:root[data-theme="dark"] {
    --brand: #8b95ff;
    --brand-2: #b1b8ff;
    --brand-soft: rgba(139, 149, 255, .12);
    --bg: #0b0d14;
    --surface: #11141d;
    --surface-2: #171b27;
    --text: #e8eaf2;
    --text-2: #c3c8d6;
    --muted: #8e97ab;
    --border: #232838;
    --ring: rgba(139, 149, 255, .35);
    --tip: #4ade9a; --tip-bg: rgba(74, 222, 154, .08);
    --info: #7cb0ff; --info-bg: rgba(124, 176, 255, .08);
    --warn: #fbbf5a; --warn-bg: rgba(251, 191, 90, .08);
    --law: #c4a5ff; --law-bg: rgba(196, 165, 255, .09);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --brand: #8b95ff; --brand-2: #b1b8ff; --brand-soft: rgba(139, 149, 255, .12);
        --bg: #0b0d14; --surface: #11141d; --surface-2: #171b27;
        --text: #e8eaf2; --text-2: #c3c8d6; --muted: #8e97ab; --border: #232838; --ring: rgba(139, 149, 255, .35);
        --tip: #4ade9a; --tip-bg: rgba(74, 222, 154, .08); --info: #7cb0ff; --info-bg: rgba(124, 176, 255, .08);
        --warn: #fbbf5a; --warn-bg: rgba(251, 191, 90, .08); --law: #c4a5ff; --law-bg: rgba(196, 165, 255, .09);
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}

/* Transiciones entre páginas (navegadores que las soportan). */
@view-transition { navigation: auto; }
.topbar { view-transition-name: topbar; }
.sidenav { view-transition-name: sidenav; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 20px); -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.65 var(--font);
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
button { font: inherit; color: inherit; }
kbd {
    font: 500 11.5px/1 var(--font); padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--surface); color: var(--muted); box-shadow: 0 1px 0 var(--border); display: inline-flex; align-items: center; gap: 2px;
}
.ico { flex-shrink: 0; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* Barra de progreso de lectura */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; pointer-events: none; }
.progress span { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--brand), var(--brand-2)); }

/* Encabezado */
.topbar {
    position: sticky; top: 0; z-index: 50; height: var(--header-h);
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1440px; margin: 0 auto; height: 100%; padding: 0 20px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none !important; flex-shrink: 0; }
.brand img { display: block; }
:root[data-theme="dark"] .brand img { filter: brightness(1.7) saturate(.9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand img { filter: brightness(1.7) saturate(.9); } }
.brand-name { font: 400 21px/1 'Techno Nue', var(--font); letter-spacing: .01em; color: var(--brand); }
.brand-tag { font-size: 13px; font-weight: 500; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--border); }
.search-trigger {
    flex: 1; max-width: 440px; margin-left: auto; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 14px;
    border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--muted); cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.search-trigger:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); box-shadow: 0 0 0 4px var(--brand-soft); }
.search-trigger-text { flex: 1; text-align: left; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
    width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 11px; border: 1px solid transparent;
    background: transparent; color: var(--text-2); cursor: pointer; transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.when-dark { display: none; }
:root[data-theme="dark"] .when-dark { display: block; }
:root[data-theme="dark"] .when-light { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .when-dark { display: block; }
    :root:not([data-theme="light"]) .when-light { display: none; }
}
.btn-primary {
    display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: 11px;
    background: var(--brand); color: #fff; font-weight: 600; font-size: 14px; text-decoration: none !important;
    box-shadow: 0 6px 16px -8px var(--brand); transition: transform .15s, box-shadow .15s;
}
:root[data-theme="dark"] .btn-primary { color: #0b0d14; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #0b0d14; } }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -10px var(--brand); }
.only-mobile { display: none; }

/* Portada */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); }
.hero::before {
    content: ''; position: absolute; inset: -40% -10% auto -10%; height: 140%; z-index: -1;
    background:
        radial-gradient(40% 50% at 20% 30%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
        radial-gradient(35% 45% at 80% 20%, color-mix(in srgb, #22c3ee 18%, transparent), transparent 70%),
        radial-gradient(30% 40% at 60% 80%, color-mix(in srgb, #a855f7 14%, transparent), transparent 70%);
    filter: blur(10px);
}
.hero::after {
    content: ''; position: absolute; inset: 0; z-index: -1; opacity: .5;
    background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 48px 48px; mask-image: radial-gradient(70% 60% at 50% 30%, #000, transparent 75%);
    -webkit-mask-image: radial-gradient(70% 60% at 50% 30%, #000, transparent 75%);
}
.hero-inner { max-width: 880px; margin: 0 auto; padding: 84px 20px 72px; text-align: center; }
.eyebrow {
    display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--brand);
    background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent); padding: 5px 12px; border-radius: 99px;
}
h1, h2, .page-lead { text-wrap: balance; }
.hero h1 { font-size: clamp(34px, 6vw, 56px); line-height: 1.08; letter-spacing: -.035em; margin: 18px 0 14px; font-weight: 700; }
.hero h1 span { background: linear-gradient(100deg, var(--brand), var(--brand-2) 50%, #22b5e6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: clamp(16px, 2.2vw, 19px); color: var(--text-2); max-width: 620px; margin: 0 auto 30px; }
.hero-search {
    display: flex; align-items: center; gap: 12px; width: 100%; max-width: 600px; margin: 0 auto; height: 58px; padding: 0 12px 0 20px;
    border-radius: 16px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: text;
    box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--brand) 8%, transparent); font-size: 16px; text-align: left;
    transition: transform .2s, box-shadow .2s;
}
.hero-search:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg), 0 0 0 5px var(--brand-soft); }
.hero-search span { flex: 1; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.chip {
    font-size: 13.5px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text-2); cursor: pointer; text-decoration: none !important; transition: border-color .15s, color .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.section { padding: 56px 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2 { font-size: 22px; letter-spacing: -.02em; margin: 0; }
.section-head p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* Ruta de inicio (3 pasos) */
.journey { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; counter-reset: j; }
.journey a {
    position: relative; display: block; padding: 20px 20px 20px 64px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface); color: var(--text); text-decoration: none !important; box-shadow: var(--shadow); transition: transform .2s, border-color .2s;
}
.journey a::before {
    counter-increment: j; content: counter(j); position: absolute; left: 18px; top: 18px; width: 32px; height: 32px; border-radius: 10px;
    display: grid; place-items: center; font-weight: 700; font-size: 15px; color: var(--brand); background: var(--brand-soft);
}
.journey a:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.journey strong { display: block; font-size: 15.5px; }
.journey span { color: var(--muted); font-size: 14px; }

/* Tarjetas de módulos */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card {
    position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none !important;
    box-shadow: var(--shadow); overflow: hidden; transition: transform .2s, border-color .2s;
    --mx: 50%; --my: 0%;
}
.card::before {
    content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .25s; pointer-events: none;
    background: radial-gradient(380px circle at var(--mx) var(--my), color-mix(in srgb, var(--brand) 12%, transparent), transparent 45%);
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.card:hover::before { opacity: 1; }
.card-icon {
    width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--brand);
    background: linear-gradient(135deg, var(--brand-soft), color-mix(in srgb, var(--brand-soft) 40%, transparent));
    border: 1px solid color-mix(in srgb, var(--brand) 14%, transparent);
}
.card h3 { margin: 4px 0 0; font-size: 16.5px; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.card .go { position: absolute; right: 18px; top: 22px; color: var(--muted); transition: transform .2s, color .2s; }
.card:hover .go { transform: translateX(3px); color: var(--brand); }

.help-band {
    margin: 64px 0 72px; padding: 28px; border-radius: 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    background: linear-gradient(120deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #22b5e6)); color: #fff;
}
.help-band h2 { margin: 0 0 4px; font-size: 21px; }
.help-band p { margin: 0; opacity: .9; }
.help-band a { background: #fff; color: #1529cf; padding: 11px 18px; border-radius: 11px; font-weight: 600; text-decoration: none !important; }

/* Página de módulo: 3 columnas */
.doc { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: 272px minmax(0, 1fr) 236px; gap: 48px; padding: 0 20px; }
.sidenav { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 28px 6px 40px 0; scrollbar-width: thin; }
.sidenav-group { margin-bottom: 22px; }
.sidenav-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px 12px; }
.sidenav a {
    display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 10px; color: var(--text-2); font-size: 14.5px; text-decoration: none !important;
    transition: background .15s, color .15s;
}
.sidenav a .ico { color: var(--muted); }
.sidenav a:hover { background: var(--surface-2); color: var(--text); }
.sidenav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sidenav a[aria-current="page"] .ico { color: var(--brand); }

.article { padding: 36px 0 80px; min-width: 0; max-width: 780px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); margin-bottom: 18px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.page-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 8px; }
.page-head .card-icon { width: 50px; height: 50px; border-radius: 14px; margin-top: 4px; }
.page-head h1 { font-size: clamp(28px, 4.5vw, 40px); line-height: 1.12; letter-spacing: -.03em; margin: 0; }
.page-lead { font-size: 18px; color: var(--text-2); margin: 10px 0 14px; }
.meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); padding-bottom: 22px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.meta span { display: inline-flex; align-items: center; gap: 6px; }

/* Contenido */
.prose { color: var(--text-2); font-size: 16.5px; }
.prose > * + * { margin-top: 1em; }
.prose h2 { color: var(--text); font-size: 25px; letter-spacing: -.02em; line-height: 1.25; margin: 2.2em 0 .6em; position: relative; }
.prose h3 { color: var(--text); font-size: 19px; letter-spacing: -.01em; margin: 1.8em 0 .5em; position: relative; }
.prose p { margin: 0 0 1em; }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul, .prose ol:not(.steps) { padding-left: 1.3em; margin: 0 0 1.1em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--muted); }
.anchor {
    position: absolute; left: -1.1em; top: 0; width: 1em; opacity: 0; color: var(--muted); text-decoration: none !important; font-weight: 400;
    transition: opacity .15s;
}
.prose h2:hover .anchor, .prose h3:hover .anchor, .anchor:focus { opacity: 1; }
.prose table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; margin: 0 0 1.4em; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose th { background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
.prose table { min-width: 0; }
.prose code { font-size: .88em; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; }

.ui {
    display: inline-block; font-size: .9em; font-weight: 600; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-bottom-width: 2px; padding: 0 7px; border-radius: 7px; line-height: 1.6; white-space: nowrap;
}
.menu-path {
    display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: .9em; font-weight: 600; color: var(--brand);
    background: var(--brand-soft); padding: 1px 9px; border-radius: 8px; vertical-align: baseline;
}
.menu-path .ico { opacity: .7; }

/* Pasos */
.steps { list-style: none; padding: 0; margin: 1.4em 0 1.8em; counter-reset: s; }
.step { position: relative; padding: 0 0 22px 52px; counter-increment: s; }
.step::before {
    content: counter(s); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
    font-weight: 700; font-size: 14.5px; color: var(--brand); background: var(--surface); border: 1.5px solid color-mix(in srgb, var(--brand) 45%, var(--border));
    box-shadow: 0 0 0 5px var(--bg);
}
.step::after { content: ''; position: absolute; left: 15.5px; top: 36px; bottom: 4px; width: 1.5px; background: linear-gradient(var(--border), transparent); }
.step:last-child { padding-bottom: 4px; }
.step:last-child::after { display: none; }
.step-title { margin: 3px 0 4px !important; color: var(--text); font-weight: 600; }
.step-text { color: var(--text-2); }
.step-text > :last-child { margin-bottom: 0; }

/* Notas */
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; margin: 1.4em 0; border: 1px solid; font-size: 15.5px; }
.callout-icon { margin-top: 3px; }
.callout-title { margin: 0 0 2px !important; font-weight: 600; font-size: 14.5px; }
.callout-text > :last-child { margin-bottom: 0; }
.callout-text { color: var(--text-2); }
.callout-tip { background: var(--tip-bg); border-color: color-mix(in srgb, var(--tip) 25%, transparent); }
.callout-tip .callout-icon, .callout-tip .callout-title { color: var(--tip); }
.callout-info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.callout-info .callout-icon, .callout-info .callout-title { color: var(--info); }
.callout-warning { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.callout-warning .callout-icon, .callout-warning .callout-title { color: var(--warn); }
.callout-law { background: var(--law-bg); border-color: color-mix(in srgb, var(--law) 25%, transparent); }
.callout-law .callout-icon, .callout-law .callout-title { color: var(--law); }

/* Capturas */
.shot { margin: 1.6em 0; }
.shot-frame {
    display: block; width: 100%; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface);
    box-shadow: var(--shadow); cursor: zoom-in; transition: transform .2s, box-shadow .2s;
}
.shot-frame:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.shot-bar { display: flex; gap: 6px; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.shot-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.shot img { display: block; width: 100%; }
.shot figcaption { font-size: 13.5px; color: var(--muted); text-align: center; margin-top: 10px; }

/* Preguntas frecuentes */
.faq { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin: 10px 0; }
.faq summary {
    list-style: none; cursor: pointer; padding: 14px 16px; font-weight: 600; color: var(--text); display: flex; justify-content: space-between; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .ico { transition: transform .2s; color: var(--muted); margin-top: 4px; }
.faq[open] summary .ico { transform: rotate(90deg); }
.faq-a { padding: 0 16px 14px; }
.faq-a > :last-child { margin-bottom: 0; }

/* Anterior / siguiente */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--border); }
.pager a {
    display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
    color: var(--text); text-decoration: none !important; transition: border-color .2s, transform .2s;
}
.pager a:hover { border-color: var(--brand); transform: translateY(-1px); }
.pager small { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.pager strong { font-size: 15.5px; }
.pager .next { text-align: right; grid-column: 2; align-items: flex-end; }

/* Tabla de contenido */
.toc { position: sticky; top: var(--header-h); max-height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 36px 0 40px; font-size: 13.5px; scrollbar-width: thin; }
.toc-title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); margin-bottom: 10px; font-size: 13.5px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none !important; line-height: 1.4; transition: color .15s, border-color .15s; }
.toc a.l3 { padding-left: 26px; font-size: 13px; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--brand); border-left-color: var(--brand); font-weight: 500; }
.toc-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); display: grid; gap: 6px; }
.toc-actions button, .toc-actions a { all: unset; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.toc-actions button:hover, .toc-actions a:hover { color: var(--text); }
.toc-mobile { display: none; }

/* Buscador */
dialog { color: var(--text); }
.search { width: min(680px, calc(100vw - 24px)); max-height: min(620px, calc(100vh - 80px)); margin: 10vh auto auto; padding: 0; border: 0; background: transparent; overflow: visible; }
.search::backdrop, .zoom::backdrop { background: rgba(8, 10, 20, .5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.search[open] .search-box { animation: pop .18s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
.search-box { display: flex; flex-direction: column; max-height: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.search-input { display: flex; align-items: center; gap: 12px; padding: 0 14px 0 18px; border-bottom: 1px solid var(--border); color: var(--muted); }
.search-input input { flex: 1; min-width: 0; height: 60px; border: 0; outline: 0; background: transparent; color: var(--text); font: 400 17px var(--font); }
.search-input input::-webkit-search-cancel-button { display: none; }
.esc { border: 1px solid var(--border); background: var(--surface-2); border-radius: 7px; padding: 3px 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.search-results { overflow-y: auto; padding: 8px; flex: 1; overscroll-behavior: contain; }
.sr-group { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 10px 10px 6px; }
.sr-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 11px; color: var(--text); text-decoration: none !important; scroll-margin: 8px; }
.sr-item .ico { margin-top: 2px; color: var(--muted); }
.sr-item[aria-selected="true"] { background: var(--brand-soft); }
.sr-item[aria-selected="true"] .ico, .sr-item[aria-selected="true"] .sr-title { color: var(--brand); }
.sr-title { font-weight: 600; font-size: 15px; display: block; }
.sr-parent { font-size: 12.5px; color: var(--muted); display: block; }
.sr-snippet { font-size: 13.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.sr-item mark { background: color-mix(in srgb, #facc15 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.sr-empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.sr-empty strong { color: var(--text); display: block; margin-bottom: 4px; }
.search-foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); background: var(--surface-2); }
.search-foot span { display: inline-flex; align-items: center; gap: 4px; }

/* Imagen ampliada */
.zoom { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 94vh; overflow: visible; }
.zoom img { display: block; max-width: 96vw; max-height: 90vh; border-radius: 12px; box-shadow: var(--shadow-lg); background: #fff; }
.zoom-close { position: fixed; top: 14px; right: 14px; background: var(--surface); }

.toast {
    position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 80;
    background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { max-width: 1440px; margin: 0 auto; padding: 26px 20px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; font-size: 14px; color: var(--muted); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); }

/* Menú lateral como panel en móvil */
.drawer { padding: 0; border: 0; margin: 0; width: min(330px, 88vw); height: 100dvh; max-height: 100dvh; background: var(--surface); box-shadow: var(--shadow-lg); }
.drawer::backdrop { background: rgba(8, 10, 20, .45); }
.drawer[open] { animation: slide .22s ease-out; }
@keyframes slide { from { transform: translateX(-100%); } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--border); }
.drawer .sidenav { position: static; height: auto; padding: 16px 12px 40px; view-transition-name: none; }

/* Adaptación a pantallas */
@media (max-width: 1180px) {
    .doc { grid-template-columns: 240px minmax(0, 1fr); gap: 36px; }
    .toc { display: none; }
    .toc-mobile { display: block; margin: 0 0 22px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
    .toc-mobile summary { list-style: none; cursor: pointer; padding: 12px 14px; font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 8px; color: var(--text); }
    .toc-mobile summary::-webkit-details-marker { display: none; }
    .toc-mobile ul { list-style: none; margin: 0; padding: 0 14px 12px; }
    .toc-mobile a { display: block; padding: 5px 0; color: var(--text-2); font-size: 14.5px; }
    .toc-mobile a.l3 { padding-left: 14px; color: var(--muted); }
}
@media (max-width: 860px) {
    :root { --header-h: 58px; }
    .doc { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
    .doc > .sidenav { display: none; }
    .only-mobile { display: inline-grid; }
    .topbar-inner { padding: 0 12px; gap: 8px; }
    .brand-tag { display: none; }
    .search-trigger { max-width: none; height: 40px; width: 40px; flex: 0 0 40px; padding: 0; justify-content: center; margin-left: auto; border-radius: 11px; }
    .search-trigger-text, .kbd-hint { display: none; }
    .btn-primary span { display: none; }
    .btn-primary { width: 40px; padding: 0; justify-content: center; }
    .journey { grid-template-columns: 1fr; }
    .hero-inner { padding: 56px 16px 48px; }
    .wrap { padding: 0 16px; }
    .article { padding-top: 24px; }
    .prose { font-size: 16px; }
    .anchor { display: none; }
    .pager { grid-template-columns: 1fr; }
    .pager .next { grid-column: 1; }
    .search { margin-top: 12px; max-height: calc(100dvh - 24px); }
    .search-foot { display: none; }
    .step { padding-left: 46px; }
    .hero-search { height: 52px; font-size: 15px; padding: 0 16px; }
    .hero-search span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .section-head { flex-direction: column; gap: 4px; }
    .page-head .card-icon { width: 42px; height: 42px; }
    .meta { gap: 6px 16px; }
}
/* En pantallas táctiles no hay atajo de teclado. */
@media (hover: none) { .hero-search kbd, .kbd-hint { display: none; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    @view-transition { navigation: none; }
}

@media print {
    .topbar, .sidenav, .toc, .toc-mobile, .pager, .site-footer, .progress, .anchor { display: none !important; }
    .doc { display: block; }
    body { background: #fff; color: #000; }
}
