/* ==========================================================================
   Legal y cookies del portal del cliente.
   - Enlaces legales del pie de página y nota de aceptación bajo los formularios.
   - Aviso de cookies (primera visita), ventana «Configuración de cookies» y aviso breve al guardar.
   - Páginas /terminos, /privacidad y /cookies (body.legal-page).
   ========================================================================== */
:root {
    --lg-ink: #0f172a;
    --lg-ink-2: #334155;
    --lg-muted: #64748b;
    --lg-line: #e5e7eb;
    --lg-soft: #f8fafc;
    --lg-accent: #e9573f;
    --lg-accent-soft: #fff1ed;
    --lg-navy: #111c33;
    --lg-ok: #0f9d6b;
}

/* ---------- Pie de página del portal ---------- */
.lg-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; width: 100%; font-size: 12.5px; }
.lg-links a, .lg-links button {
    padding: 4px 0;
    border: 0;
    background: none;
    color: rgba(226, 232, 240, .78);
    font: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(226, 232, 240, .3);
    text-underline-offset: 3px;
    cursor: pointer;
}
.lg-links a:hover, .lg-links button:hover { color: #fff; text-decoration-color: currentColor; }
.lg-links a:focus-visible, .lg-links button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 3px; }

/* Nota bajo el botón de los formularios: «Al continuar aceptas…». */
.lg-accept { margin: 10px 0 0 !important; color: var(--lg-muted) !important; font-size: 12px !important; line-height: 1.5; text-align: center; }
.lg-accept a { color: var(--lg-ink-2); font-weight: 600; text-underline-offset: 2px; }
.lg-accept a:hover { color: var(--lg-accent); }

/* ---------- Botones del aviso y la ventana ---------- */
.ck-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font: 700 13.5px 'DM Sans', system-ui, sans-serif;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.ck-btn-primary { background: var(--lg-accent); color: #fff; }
.ck-btn-primary:hover { background: #d84c35; }
.ck-btn-ghost { border-color: #d6dbe3; background: #fff; color: var(--lg-ink); }
.ck-btn-ghost:hover { border-color: #94a3b8; }
.ck-btn-link { padding: 0 6px; background: none; color: var(--lg-ink-2); text-decoration: underline; text-underline-offset: 3px; }
.ck-btn-link:hover { color: var(--lg-accent); }
.ck-btn:focus-visible, .ck-x:focus-visible, .ck-switch input:focus-visible + span { outline: 3px solid rgba(233, 87, 63, .45); outline-offset: 2px; }

/* ---------- Aviso de cookies ---------- */
.ck-banner {
    position: fixed;
    z-index: 900;
    left: 18px;
    bottom: 18px;
    display: grid;
    gap: 14px;
    width: min(440px, calc(100% - 36px));
    padding: 18px 18px 16px;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 16px;
    background: #fff;
    color: var(--lg-ink);
    box-shadow: 0 24px 60px -12px rgba(2, 6, 23, .45);
    font-family: 'DM Sans', system-ui, sans-serif;
    text-align: left;
    animation: ck-in .35s cubic-bezier(.2, .7, .2, 1) both;
}
.ck-banner[hidden] { display: none; }
.ck-banner strong { display: block; margin-bottom: 4px; font: 700 15.5px 'Space Grotesk', system-ui, sans-serif; }
.ck-banner p { margin: 0; color: var(--lg-ink-2); font-size: 13.5px; line-height: 1.55; }
.ck-banner p a { color: var(--lg-accent); font-weight: 700; }
.ck-banner-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.ck-banner-actions .ck-btn-link { margin-right: auto; }
@keyframes ck-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Ventana «Configuración de cookies» ---------- */
html.ck-lock { overflow: hidden; }
.ck-dialog {
    width: min(560px, calc(100% - 24px));
    max-height: calc(100% - 24px);
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: #fff;
    color: var(--lg-ink);
    box-shadow: 0 40px 90px -20px rgba(2, 6, 23, .6);
    font-family: 'DM Sans', system-ui, sans-serif;
    text-align: left;
}
.ck-dialog[open] { animation: ck-in .3s cubic-bezier(.2, .7, .2, 1) both; }
.ck-dialog::backdrop { background: rgba(2, 6, 23, .6); backdrop-filter: blur(3px); }
.ck-dialog:not([open]) { display: none; }
.ck-card { display: grid; gap: 0; margin: 0; }
.ck-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 22px 6px; }
.ck-kicker { color: var(--lg-accent); font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.ck-head h2 { margin: 4px 0 0; font: 700 21px/1.2 'Space Grotesk', system-ui, sans-serif; }
.ck-x { display: grid; flex: none; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--lg-soft); color: var(--lg-ink-2); font-size: 22px; line-height: 1; cursor: pointer; }
.ck-x:hover { background: #eef2f6; }
.ck-intro { margin: 0; padding: 4px 22px 14px; color: var(--lg-muted); font-size: 13.5px; line-height: 1.55; }
.ck-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 22px; padding: 14px 0; border-top: 1px solid var(--lg-line); }
.ck-row-text b { display: block; font-size: 14.5px; }
.ck-row-text p { margin: 3px 0 0; color: var(--lg-muted); font-size: 13px; line-height: 1.5; }
.ck-always { flex: none; padding: 5px 10px; border-radius: 999px; background: #e6f6ef; color: #0b7a53; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.ck-switch { position: relative; flex: none; width: 46px; height: 26px; cursor: pointer; }
.ck-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ck-switch span { position: absolute; inset: 0; border-radius: 999px; background: #cbd5e1; transition: background .18s; pointer-events: none; }
.ck-switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s; }
.ck-switch input:checked + span { background: var(--lg-ok); }
.ck-switch input:checked + span::after { transform: translateX(20px); }
.ck-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ck-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; padding: 16px 22px 20px; border-top: 1px solid var(--lg-line); background: var(--lg-soft); border-radius: 0 0 18px 18px; }
.ck-foot > a { color: var(--lg-ink-2); font-size: 13px; font-weight: 600; text-underline-offset: 3px; }
.ck-foot-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Aviso breve al guardar. */
.ck-toast {
    position: fixed;
    z-index: 950;
    left: 50%;
    bottom: 22px;
    padding: 11px 18px;
    border-radius: 999px;
    background: #0f172a;
    color: #fff;
    font: 600 13.5px 'DM Sans', system-ui, sans-serif;
    box-shadow: 0 14px 30px -8px rgba(0, 0, 0, .5);
    opacity: 0;
    transform: translate(-50%, 12px);
    transition: opacity .2s, transform .2s;
    pointer-events: none;
}
.ck-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
    .ck-banner { left: 10px; right: 10px; bottom: 10px; width: auto; padding: 16px 14px 14px; }
    .ck-banner-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .ck-banner-actions .ck-btn-link { grid-column: 1 / -1; order: 3; margin: 0; }
    .ck-head { padding: 18px 16px 4px; }
    .ck-intro { padding: 4px 16px 12px; }
    .ck-row { margin: 0 16px; }
    .ck-foot { padding: 14px 16px 16px; }
    .ck-foot > a { order: 2; width: 100%; text-align: center; }
    .ck-foot-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
    .ck-foot-actions .ck-btn-primary { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
    .ck-banner, .ck-dialog[open] { animation: none; }
    .ck-toast, .ck-switch span, .ck-switch span::after { transition: none; }
}
@media print { .ck-banner, .ck-dialog, .ck-toast { display: none !important; } }

/* ==========================================================================
   Páginas legales
   ========================================================================== */
body.legal-page {
    display: block;
    min-height: 100vh;
    margin: 0;
    background: #f4f5f8;
    color: var(--lg-ink);
    font-family: 'DM Sans', system-ui, sans-serif;
}
.lg-skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 14px; border-radius: 10px; background: #fff; color: var(--lg-ink); font-weight: 700; }
.lg-skip:focus { top: 12px; }

/* Cabecera oscura, igual que el portal. */
.lg-hero {
    position: relative;
    padding: 22px 18px 92px;
    overflow: hidden;
    background:
        radial-gradient(700px 380px at 100% -20%, rgba(233, 87, 63, .32), transparent 60%),
        radial-gradient(600px 420px at -10% 120%, rgba(56, 97, 186, .42), transparent 60%),
        linear-gradient(180deg, #0b1324, #111c33);
    color: #e2e8f0;
}
.lg-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px);
    background-size: 18px 18px;
    mask-image: linear-gradient(180deg, #000, transparent);
    pointer-events: none;
}
.lg-hero > * { position: relative; z-index: 1; }
.lg-bar, .lg-hero-text, .lg-wrap { width: min(1080px, 100%); margin: 0 auto; }
.lg-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.lg-bar .brand { color: #fff; }
.lg-bar .brand-logo { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.lg-back { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid rgba(226, 232, 240, .22); border-radius: 999px; background: rgba(255, 255, 255, .06); color: #e2e8f0; font-size: 13px; font-weight: 600; text-decoration: none; }
.lg-back:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.lg-hero-text { padding-top: 42px; }
.lg-kicker { display: inline-block; margin-bottom: 12px; padding: 5px 11px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px; background: rgba(255, 255, 255, .06); color: #fbd5cb; font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.lg-hero h1 { margin: 0 0 10px; color: #fff; font: 700 clamp(28px, 5vw, 40px)/1.1 'Space Grotesk', system-ui, sans-serif; letter-spacing: -.6px; }
.lg-hero p { max-width: 640px; margin: 0; color: #b6c2d6; font-size: 15px; line-height: 1.6; }
.lg-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; color: #a3b1c6; font-size: 13px; }
.lg-meta b { color: #e2e8f0; font-weight: 600; }

/* Pestañas entre los tres documentos. */
.lg-tabs { display: flex; gap: 6px; margin: -64px auto 0; padding: 0 18px; width: min(1116px, 100%); position: relative; z-index: 2; overflow-x: auto; scrollbar-width: none; }
.lg-tabs::-webkit-scrollbar { display: none; }
.lg-tabs a { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px 12px 0 0; background: rgba(255, 255, 255, .1); color: #dbe3ef; font-size: 14px; font-weight: 700; text-decoration: none; }
.lg-tabs a:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.lg-tabs a[aria-current="page"] { background: #fff; color: var(--lg-ink); }
.lg-tabs svg { opacity: .8; }

/* Contenido: índice a la izquierda (computadora) + documento. */
.lg-wrap { position: relative; z-index: 2; padding: 0 18px 40px; width: min(1116px, 100%); }
.lg-card { display: grid; grid-template-columns: 250px minmax(0, 1fr); border-radius: 0 16px 16px 16px; background: #fff; box-shadow: 0 20px 50px -24px rgba(15, 23, 42, .25), 0 0 0 1px rgba(15, 23, 42, .05); }
.lg-toc { padding: 28px 10px 28px 26px; border-right: 1px solid var(--lg-line); }
.lg-toc-inner { position: sticky; top: 18px; }
.lg-toc summary { display: none; }
.lg-toc h2 { margin: 0 0 10px; color: var(--lg-muted); font-size: 11px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; }
.lg-toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }
.lg-toc li { counter-increment: toc; }
.lg-toc a { display: flex; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--lg-ink-2); font-size: 13.5px; line-height: 1.35; text-decoration: none; }
.lg-toc a::before { content: counter(toc) '.'; min-width: 18px; color: #94a3b8; font-weight: 700; }
.lg-toc a:hover, .lg-toc a.is-active { background: var(--lg-accent-soft); color: var(--lg-ink); }
.lg-toc a.is-active::before { color: var(--lg-accent); }

.lg-doc { min-width: 0; padding: 34px clamp(20px, 4vw, 52px) 40px; color: var(--lg-ink-2); font-size: 15px; line-height: 1.7; }
.lg-doc > section { scroll-margin-top: 18px; padding-bottom: 6px; }
.lg-doc > section + section { margin-top: 26px; padding-top: 26px; border-top: 1px solid var(--lg-line); }
.lg-doc h2 { display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px; color: var(--lg-ink); font: 700 20px/1.3 'Space Grotesk', system-ui, sans-serif; }
.lg-doc h2 .lg-n { color: var(--lg-accent); font-size: 15px; }
.lg-doc h3 { margin: 18px 0 6px; color: var(--lg-ink); font-size: 15.5px; }
.lg-doc p { margin: 0 0 12px; }
.lg-doc ul, .lg-doc ol { margin: 0 0 14px; padding-left: 22px; }
.lg-doc li { margin-bottom: 6px; }
.lg-doc li::marker { color: var(--lg-accent); }
.lg-doc a { color: #c2410c; font-weight: 600; text-underline-offset: 3px; }
.lg-doc strong { color: var(--lg-ink); }
.lg-summary { margin: 0 0 28px; padding: 16px 18px; border: 1px solid #fde1d8; border-radius: 14px; background: linear-gradient(180deg, #fff7f4, #fff); }
.lg-summary b { display: block; margin-bottom: 6px; color: var(--lg-ink); font-size: 14px; }
.lg-summary ul { margin: 0; }
.lg-summary li { margin-bottom: 3px; font-size: 14px; }
.lg-id { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 4px 0 14px; padding: 14px 16px; border-radius: 12px; background: var(--lg-soft); font-size: 14px; }
.lg-id dt { color: var(--lg-muted); font-weight: 600; }
.lg-id dd { margin: 0; color: var(--lg-ink); }
.lg-note { margin: 10px 0 14px; padding: 12px 14px; border-left: 3px solid var(--lg-accent); border-radius: 0 10px 10px 0; background: var(--lg-soft); font-size: 14px; }

/* Tabla de cookies (en celular, una tarjeta por fila). */
.lg-table-wrap { margin: 6px 0 16px; overflow-x: auto; border: 1px solid var(--lg-line); border-radius: 12px; }
.lg-table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.5; }
.lg-table th { padding: 11px 12px; background: var(--lg-soft); color: var(--lg-muted); font-size: 11.5px; font-weight: 700; letter-spacing: .6px; text-align: left; text-transform: uppercase; }
.lg-table td { padding: 12px; border-top: 1px solid var(--lg-line); vertical-align: top; }
.lg-table code { padding: 2px 6px; border-radius: 6px; background: #eef2f6; color: var(--lg-ink); font-size: 12.5px; white-space: nowrap; }
.lg-tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.lg-tag-need { background: #e6f6ef; color: #0b7a53; }
.lg-tag-pref { background: #eaf1ff; color: #2856b6; }
.lg-tag-ext { background: #fff4e0; color: #9a5b00; }

/* Panel «Tu elección actual» (página Cookies). */
.lg-consent { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 28px; padding: 18px; border: 1px solid var(--lg-line); border-radius: 14px; background: var(--lg-soft); }
.lg-consent b { display: block; color: var(--lg-ink); font-size: 15px; }
.lg-consent small { display: block; margin-top: 2px; color: var(--lg-muted); font-size: 13px; }
.lg-consent-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lg-consent-tags .is-off { background: #eef0f2; color: #667085; text-decoration: line-through; }

.lg-docfoot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--lg-line); color: var(--lg-muted); font-size: 13px; }
.lg-print { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid #d6dbe3; border-radius: 10px; background: #fff; color: var(--lg-ink); font: 600 13px 'DM Sans', system-ui, sans-serif; cursor: pointer; }
.lg-print:hover { border-color: #94a3b8; }

.lg-foot { display: grid; gap: 8px; padding: 0 18px 32px; color: var(--lg-muted); font-size: 12.5px; text-align: center; }
.lg-foot .lg-links a, .lg-foot .lg-links button { color: var(--lg-ink-2); text-decoration-color: rgba(51, 65, 85, .3); }
.lg-foot .lg-links a:hover, .lg-foot .lg-links button:hover { color: var(--lg-accent); }
.lg-foot .lg-links a:focus-visible, .lg-foot .lg-links button:focus-visible { outline-color: var(--lg-accent); }
body.has-ck-banner .lg-foot { padding-bottom: 210px; }

@media (max-width: 860px) {
    .lg-card { grid-template-columns: 1fr; border-radius: 0 0 16px 16px; }
    .lg-tabs a { border-radius: 12px 12px 0 0; }
    .lg-toc { padding: 0; border-right: 0; border-bottom: 1px solid var(--lg-line); }
    .lg-toc-inner { position: static; }
    .lg-toc details { padding: 0; }
    .lg-toc summary { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; color: var(--lg-ink); font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; }
    .lg-toc summary::-webkit-details-marker { display: none; }
    .lg-toc summary::after { content: '▾'; color: var(--lg-muted); transition: transform .15s; }
    .lg-toc details[open] summary::after { transform: rotate(180deg); }
    .lg-toc h2 { display: none; }
    .lg-toc ol { padding: 0 10px 12px; }
}
@media (max-width: 560px) {
    .lg-hero { padding: 16px 16px 84px; }
    .lg-hero-text { padding-top: 28px; }
    .lg-back span { display: none; }
    .lg-tabs { padding: 0 16px; margin-top: -58px; }
    .lg-tabs a { min-height: 42px; padding: 0 13px; font-size: 13px; }
    .lg-wrap { padding: 0 16px 28px; }
    .lg-doc { padding: 24px 18px 28px; font-size: 14.5px; }
    .lg-id { grid-template-columns: 1fr; gap: 2px; }
    .lg-id dd { margin-bottom: 8px; }
    .lg-table thead { display: none; }
    .lg-table, .lg-table tbody, .lg-table tr, .lg-table td { display: block; width: 100%; }
    .lg-table tr { padding: 10px 12px; border-top: 1px solid var(--lg-line); }
    .lg-table tr:first-child { border-top: 0; }
    .lg-table td { padding: 3px 0; border: 0; }
    .lg-table td::before { content: attr(data-th); display: block; color: var(--lg-muted); font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
    .lg-consent .ck-btn { width: 100%; }
}
@media print {
    body.legal-page { background: #fff; }
    .lg-hero { padding: 0 0 12px; background: none; color: #000; }
    .lg-hero::after, .lg-back, .lg-tabs, .lg-toc, .lg-print, .lg-foot .lg-links, .lg-consent, .lg-skip { display: none !important; }
    .lg-hero h1, .lg-bar .brand { color: #000; }
    .lg-hero p, .lg-meta, .lg-meta b { color: #333; }
    .lg-card { display: block; box-shadow: none; }
    .lg-doc { padding: 0; }
}
