/* Tracehold — site (todas las páginas excepto la portada, que usa home-ds/home.css).
   Parte de v2/base.css de la portada: mismos tokens, cabecera, pie, botones, badges, foco, reduced-motion y forced-colors.
   Quita lo exclusivo de la portada (héroe y cola de triaje) y añade el kit de contenido (prefijo s-).
   Documentación de cada componente, con su HTML: site/COMPONENTS.md. Solo tokens: ningún hex nuevo fuera de :root. */

@font-face {
  font-family: 'Geist';
  src: url('/assets/home-ds/geist-variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b0d1a;
  --surface: #141625;
  --surface-2: #1a1d2c;
  --surface-sunken: #0f111f;
  --border: #272938;
  --border-strong: #37394a;
  --text: #bcbdc7;
  --text-strong: #fcfcfe;
  --text-muted: #91939f;
  --accent: #a692fb;
  --accent-hover: #b8a9fe;
  --accent-strong: #beb3fa;
  --accent-soft: rgba(166, 146, 251, .16);
  --accent-fg: #0b0d1a;
  --danger: #f69c91;
  --warn: #e8bc78;
  --ok: #86d29b;
  --danger-soft: rgba(246, 156, 145, .14);
  --warn-soft: rgba(232, 188, 120, .16);
  --ok-soft: rgba(134, 210, 155, .14);
  --muted-soft: rgba(138, 138, 158, .16);
  --r-sm: 4px;
  --r-lg: 8px;
  --r-xl: 10px;
  --focus: 0 0 0 3px rgba(166, 146, 251, .45);
  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --wrap: 1200px;
  --gutter: 24px;
  --sec-y: 112px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body.h {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: 'ss01', 'cv01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.h img { display: block; max-width: 100%; height: auto; }
:where(.h) a { color: var(--accent-strong); text-decoration: underline; text-decoration-color: rgba(166, 146, 251, .45); text-underline-offset: 3px; }
:where(.h) a:hover { color: var(--text-strong); text-decoration-color: currentColor; }
.h :focus { outline: none; }
.h :focus-visible { outline: none; box-shadow: var(--focus); }
:where(.h) a:not(.h-btn):focus-visible { border-radius: var(--r-sm); }
:where(.h) :is(h1, h2, h3) { color: var(--text-strong); margin: 0; font-weight: 500; }
:where(.h) p { margin: 0; }
.h code { font-family: inherit; font-size: .9375em; color: var(--text-strong); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 1px 6px; white-space: nowrap; }

.h-wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.h-skip { position: absolute; left: 16px; top: -48px; z-index: 100; background: var(--accent); color: var(--accent-fg) !important; padding: 8px 14px; border-radius: var(--r-lg); text-decoration: none !important; font-weight: 600; }
.h-skip:focus { top: 12px; }

/* ---------- Botones (medidas de la consola, escaladas a lectura web) ---------- */
.h-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; padding: 0 16px;
  border-radius: var(--r-lg); border: 1px solid transparent;
  font: 500 14px/1 var(--font);
  text-decoration: none !important; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.h-btn--lg { min-height: 46px; padding: 0 22px; font-size: 15px; }
.h-btn--primary { background: var(--accent); color: var(--accent-fg) !important; font-weight: 600; }
.h-btn--primary:hover { background: var(--accent-hover); }
.h-btn--line { background: transparent; border-color: var(--border-strong); color: var(--text-strong) !important; }
.h-btn--line:hover { background: var(--surface-2); }
.h-btn--ghost { background: transparent; color: var(--text) !important; }
.h-btn--ghost:hover { background: var(--surface-2); color: var(--text-strong) !important; }
.h-btn:disabled { opacity: .6; cursor: progress; }

.h-textlink { font-size: 14px; font-weight: 500; }

/* ---------- Cabecera ---------- */
.h-header { position: sticky; top: 0; z-index: 50; background: rgba(11, 13, 26, .92); border-bottom: 1px solid var(--border); -webkit-backdrop-filter: saturate(140%) blur(8px); backdrop-filter: saturate(140%) blur(8px); }
.h-header__row { display: flex; align-items: center; gap: 28px; min-height: 64px; }
.h-logo { flex: none; text-decoration: none !important; }
.h-logo img { width: 150px; height: auto; }
.h-nav { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.h-nav__main { display: flex; align-items: center; gap: 2px; }
.h-header .h-wrap { max-width: 1320px; }
.h-nav__aside { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-left: auto; }
.h-dd { position: relative; }
.h-dd__btn, .h-nav__link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  background: none; border: 0; border-radius: var(--r-lg);
  font: 500 14px/1 var(--font); color: var(--text) !important; text-decoration: none !important; cursor: pointer;
}
.h-dd__btn::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: .7; transition: transform .15s; }
.h-dd__btn[aria-expanded="true"]::after { transform: translateY(1px) rotate(-135deg); }
.h-dd__btn:hover, .h-nav__link:hover, .h-dd__btn[aria-expanded="true"] { background: var(--surface-2); color: var(--text-strong) !important; }
.h-dd__panel {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 60;
  width: 340px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-xl);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}
.h-dd__panel { display: none; }
.h-dd.is-open .h-dd__panel, html:not(.js) .h-dd:focus-within .h-dd__panel { display: block; }
.h-dd__panel a { display: block; padding: 9px 12px; border-radius: var(--r-lg); text-decoration: none !important; }
.h-dd__panel a:hover { background: var(--surface-2); }
.h-dd__panel b { display: block; font-weight: 500; font-size: 14px; color: var(--text-strong); line-height: 1.35; }
.h-dd__panel span { display: block; font-size: 13px; color: var(--text-muted); line-height: 1.45; margin-top: 2px; }
.h-lang { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 2px; background: var(--surface-sunken); margin-right: 0; }
.h-lang a { display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--text-muted) !important; text-decoration: none !important; }
.h-lang a[aria-current="true"] { background: var(--surface-2); color: var(--text-strong) !important; }
.h-menu-btn { display: none; }

/* Acciones y nota (compartidas con la banda CTA) */
.h-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.h-note { margin-top: 12px; font-size: 13px; color: var(--text-muted); }

/* Réplica del Centro de operaciones (componentes de la consola, datos de muestra) */
.h-console { margin: 0; }
.h-console__frame { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); overflow: hidden; }
.h-console__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 18px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.h-console__crumb b { color: var(--text-strong); font-weight: 600; }
.h-console__crumb span { margin: 0 4px; }
.h-seg { display: inline-flex; padding: 2px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r-lg); font-size: 12px; font-weight: 500; }
.h-seg span { padding: 4px 10px; border-radius: 6px; }
.h-seg .is-on { background: var(--surface-2); color: var(--text-strong); }
.h-console__body { padding: 22px 22px 18px; }
.h-console__eyebrow { font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.h-console__title { margin-top: 6px; font-size: 20px; line-height: 1.3; letter-spacing: -.01em; font-weight: 500; color: var(--text-strong); }
.h-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin: 20px 0 0; }
.h-kpis div { margin: 0; display: flex; flex-direction: column; }
.h-kpis dt { flex: 1; display: flex; align-items: baseline; gap: 6px; font-size: 12px; line-height: 1.35; font-weight: 500; color: var(--text-muted); }
.h-kpis .dot { transform: translateY(-1px); }
.h-kpis dd { margin: 4px 0 0; font-size: 30px; line-height: 1.05; font-weight: 600; letter-spacing: -.02em; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex: none; }
.dot--muted { background: var(--text-muted); }
.dot--danger { background: var(--danger); }
.dot--accent { background: var(--accent); }
.dot--warn { background: var(--warn); }
.h-console figcaption { margin-top: 12px; font-size: 13px; color: var(--text-muted); }

/* Badges (texto de color sobre fondo -soft, como en la consola) */
.badge { display: inline-block; padding: 2px 8px; border-radius: var(--r-sm); font-size: 12px; font-weight: 500; line-height: 1.5; white-space: nowrap; }
.badge--danger { color: var(--danger); background: var(--danger-soft); }
.badge--warn { color: var(--warn); background: var(--warn-soft); }
.badge--ok { color: var(--ok); background: var(--ok-soft); }
.badge--accent { color: var(--accent-strong); background: var(--accent-soft); }
.badge--muted { color: var(--text); background: var(--muted-soft); }

/* ---------- Secciones: cabecera a la izquierda, contenido a la derecha ---------- */
.h-sec { padding: var(--sec-y) 0; border-top: 1px solid var(--border); }
.h-sec__grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 64px; align-items: start; }
.h-sec__head { position: sticky; top: 104px; }
.h-sec__head h2 { font-size: clamp(32px, 3.2vw, 44px); line-height: 1.08; letter-spacing: -.025em; max-width: 18ch; text-wrap: balance; overflow-wrap: break-word; }
.h-sec__head p { margin-top: 16px; font-size: 17px; color: var(--text-muted); max-width: 40ch; }
.h-sec__head .h-textlink { display: inline-block; margin-top: 18px; }
.h-after { margin-top: 24px; max-width: 64ch; }
.h-sec .h-note { max-width: 64ch; }

/* Pasos (secuencia real: el orden en que corre el pipeline) */
.h-steps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.h-steps li { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px; padding: 28px 0; border-bottom: 1px solid var(--border); }
.h-steps__n { font-size: 15px; font-weight: 500; color: var(--accent); font-variant-numeric: tabular-nums; padding-top: 2px; }
.h-steps h3 { font-size: 20px; line-height: 1.3; letter-spacing: -.015em; }
.h-steps p { margin-top: 8px; max-width: 62ch; }

/* Tablas (estilo consola: sin cebra, cabecera discreta, separadores de 1px) */
.h-table { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); }
.h-table table { width: 100%; border-collapse: collapse; font-size: 15px; }
.h-table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--text-muted); padding: 12px 18px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.h-table td { padding: 16px 18px; border-bottom: 1px solid var(--border); vertical-align: top; }
.h-table tr:last-child td { border-bottom: 0; }
.h-table td:first-child { white-space: nowrap; }
.h-table--stack td:last-child { width: 34%; }
.h-table--stack code { white-space: normal; overflow-wrap: anywhere; }
.h-table--nums td:last-child, .h-table--nums th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.h-table--nums td:last-child { color: var(--text-strong); font-weight: 600; }
.h-table--nums td:first-child { color: var(--text-strong); }

/* Listas de definición */
.h-list { margin: 0; border-top: 1px solid var(--border); }
.h-list div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 5fr); gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--border); }
.h-list dt { color: var(--text-strong); font-weight: 500; }
.h-list dd { margin: 0; }
.h-cols { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; }
.h-cols div { padding: 24px 0; border-top: 1px solid var(--border); }
.h-cols dt { color: var(--text-strong); font-weight: 500; font-size: 17px; letter-spacing: -.01em; }
.h-cols dd { margin: 8px 0 0; }

/* Planes */
.h-plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.h-plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 24px; }
.h-plan h3 { font-size: 20px; letter-spacing: -.015em; }
.h-plan__sub { margin-top: 6px !important; color: var(--text-muted); font-size: 15px; }
.h-plan ul { list-style: none; margin: 18px 0 0; padding: 0; }
.h-plan li { padding: 9px 0; border-top: 1px solid var(--border); font-size: 15px; }
.h-freebox { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--border); scroll-margin-top: 96px; }
.h-freebox h3 { font-size: 20px; letter-spacing: -.015em; }
.h-freebox > p:not(.h-note) { margin-top: 10px; max-width: 64ch; }

/* Planes en 3 tarjetas (pricing #plans): Insight, Governance (destacada) y extensión gratuita. Ver COMPONENTS.md §14.
   Se añade a las clases h-plans/h-plan existentes; sin precios. */
.h-plans-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; margin-bottom: 40px; }
.h-plans-head .s-sec__top { margin-bottom: 0; }
.h-plans-head .h-textlink { flex: none; }
.h-plans--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: stretch; }
.h-plans--3 .h-plan { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 18px; padding: 28px 26px 24px; scroll-margin-top: 96px; }
.h-plans--3 .h-plan::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--text-muted); }
.h-plan__tag { align-self: flex-start; padding: 2px 8px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; line-height: 1.5; color: var(--text); background: var(--muted-soft); }
.h-plans--3 .h-plan h3 { margin: 6px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.015em; color: var(--text-strong); }
.h-plans--3 .h-plan__sub { margin: 0 !important; font-size: 14px; color: var(--text-muted); }
.h-plans--3 .h-plan ul { flex: 1; margin: 0; }
.h-plans--3 .h-plan li { display: flex; gap: 10px; padding: 10px 0; font-size: 14px; color: var(--text); }
.h-plans--3 .h-plan li::before { content: '\2022'; flex: none; color: var(--text-muted); }
.h-plans--3 .h-plan > p:not(.h-plan__sub):not(.h-note) { margin: 0; font-size: 14px; color: var(--text); }
.h-plans--3 .h-plan > p.h-note { margin: 0; font-size: 12px; }
.h-plans--3 .h-plan .h-btn { width: 100%; }
.h-plans--3 .h-plan .h-actions { margin-top: 0; }
.h-plans--3 .h-plan .h-actions .h-btn { width: auto; flex: 1 1 auto; }
.h-plan--featured { background: var(--surface-2); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.h-plans--3 .h-plan--featured::before { background: var(--accent); }
.h-plan--featured .h-plan__tag { color: var(--accent-strong); background: var(--accent-soft); }
.h-plans--3 .h-plan--featured .h-plan__sub { color: var(--accent-strong); }
.h-plans--3 .h-plan--featured li::before { content: '+'; color: var(--accent); }
.h-plans--3 .h-plan--free::before { background: var(--ok); }
.h-plan--free .h-plan__tag { color: var(--ok); background: var(--ok-soft); }

/* FAQ */
.h-faq { border-top: 1px solid var(--border); }
.h-faq details { border-bottom: 1px solid var(--border); }
.h-faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 22px 0; font-size: 17px; font-weight: 500; color: var(--text-strong); letter-spacing: -.01em; }
.h-faq summary::-webkit-details-marker { display: none; }
.h-faq summary::after { content: ''; flex: none; width: 8px; height: 8px; border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted); transform: translateY(-3px) rotate(45deg); transition: transform .15s; }
.h-faq details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.h-faq details p { padding: 0 0 22px; max-width: 66ch; }

/* CTA y formulario rápido (lo envía home.js a /api/contact, igual que app.js) */
.h-form label { display: block; font-size: 14px; font-weight: 500; color: var(--text-strong); margin-bottom: 8px; }
.h-form__row { display: flex; gap: 10px; max-width: 560px; }
.h-form input[type="email"] {
  flex: 1; min-width: 0; min-height: 46px; padding: 0 14px;
  background: var(--surface-sunken); color: var(--text-strong);
  border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  font: 400 15px/1 var(--font);
}
.h-form input[type="email"]::placeholder { color: var(--text-muted); }
.h-form input[type="email"]:focus-visible { border-color: var(--accent); box-shadow: var(--focus); }
.h-form input[aria-invalid="true"] { border-color: var(--danger); }
.h-form .h-btn { min-height: 46px; }
.h-form__msg { margin-top: 10px !important; font-size: 13px; color: var(--text-muted); }
.h-form__msg.is-ok { color: var(--ok); }
.h-form__msg.is-err { color: var(--danger); }
.h-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.h-cta .h-actions { margin-top: 24px; }
/* Contacto final: tarjeta con barra de acento (modelo Claude Design). No lleva id: #contact ya existe en contacto y en legales. */
.h-cta { padding: 96px 0; }
.h-cta__card { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 32px 64px; padding: 40px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); }
.h-cta__card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent); }
.h-cta__text { flex: 1 1 320px; min-width: 0; }
.h-cta__text h2 { font-size: clamp(28px, 2.8vw, 38px); line-height: 1.1; letter-spacing: -.025em; font-weight: 500; text-wrap: balance; overflow-wrap: break-word; }
.h-cta__text p { margin-top: 16px; font-size: 16px; color: var(--text-muted); max-width: 40ch; }
.h-cta__actions { flex: 1.6 1 460px; min-width: 0; }

/* ---------- Pie ---------- */
.h-footer { border-top: 1px solid var(--border); padding: 64px 0 40px; font-size: 14px; }
.h-footer__top { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 64px; }
.h-footer__brand p { margin-top: 14px; color: var(--text-muted); max-width: 34ch; }
.h-footer__cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.h-footer__h { color: var(--text-strong); font-weight: 500; margin-bottom: 12px !important; }
.h-footer ul { list-style: none; margin: 0; padding: 0; }
.h-footer li { margin: 0 0 8px; }
.h-footer__cols a, .h-footer__brand a { color: var(--text-muted); text-decoration: none; }
.h-footer__cols a:hover, .h-footer__brand a:hover { color: var(--text-strong); text-decoration: underline; }
.h-footer__legal { margin-top: 48px !important; padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 13px; }

/* Aviso de idioma de lang-pref.js (compartido): se reestiliza aquí porque la portada no carga landing-purple.css */
.lp-lang-banner { position: fixed; left: 50%; bottom: 20px; z-index: 80; display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px); padding: 10px 10px 10px 16px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-xl); box-shadow: 0 12px 32px rgba(0, 0, 0, .35); color: var(--text); font-size: 14px; transform: translate(-50%, 16px); opacity: 0; transition: opacity .3s, transform .3s; }
.lp-lang-banner.is-visible { opacity: 1; transform: translate(-50%, 0); }
.lp-lang-banner .lp-btn { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: var(--r-lg); background: var(--accent); color: var(--accent-fg) !important; font-weight: 600; font-size: 13px; text-decoration: none !important; white-space: nowrap; }
.lp-lang-banner__close { background: none; border: 0; color: var(--text-muted); font-size: 22px; line-height: 1; width: 32px; height: 32px; border-radius: var(--r-lg); cursor: pointer; }
.lp-lang-banner__close:hover { background: var(--surface-2); color: var(--text-strong); }

/* ---------- Responsive ---------- */
@media (max-width: 1140px) {
  .h-console { max-width: 720px; }
}

/* Menú plegado hasta 1279 px: con el botón «Free extension» la cabecera completa (ES: «Extensión gratuita») no cabe por debajo de ~1255 px (igual que v2/base.css). */
@media (max-width: 1279px) {
  .h-menu-btn {
    display: inline-flex; align-items: center; margin-left: auto; min-height: 38px; padding: 0 14px;
    background: transparent; color: var(--text-strong); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
    font: 500 14px/1 var(--font); cursor: pointer;
  }
  .h-header__row { flex-wrap: wrap; align-content: flex-start; }
  .h-logo { display: flex; align-items: center; min-height: 64px; }
  .js .h-nav { display: none; }
  .h-nav { flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 16px; padding: 4px 0 20px; }
  .js .h-header.is-open .h-nav { display: flex; max-height: calc(100vh - 64px); overflow-y: auto; }
  .h-nav__main { flex-direction: column; align-items: stretch; gap: 0; }
  .h-dd__btn, .h-nav__link { width: 100%; justify-content: space-between; min-height: 48px; padding: 0 4px; border-bottom: 1px solid var(--border); border-radius: 0; font-size: 16px; }
  .h-dd__btn:hover, .h-nav__link:hover, .h-dd__btn[aria-expanded="true"] { background: none; }
  .h-dd__panel { position: static; width: auto; padding: 4px 0 8px; border: 0; box-shadow: none; background: none; }
  .h-dd__panel a { padding: 8px 4px; }
  .h-nav__aside { flex-wrap: wrap; justify-content: flex-start; margin-left: 0; }
}

@media (max-width: 980px) {
  :root { --sec-y: 80px; }
  .h-cta { padding: 72px 0; }
  .h-sec__grid, .h-footer__top { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .h-sec__head { position: static; }
  .h-sec__head h2 { max-width: 22ch; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; --sec-y: 64px; }
  .h-cta { padding: 56px 0; }
  .h-cta__card { padding: 28px 20px; gap: 24px; }
  .h-logo img { width: 128px; }
  .h-actions .h-btn { flex: 1 1 auto; max-width: 100%; white-space: normal; text-align: center; line-height: 1.25; padding-top: 10px; padding-bottom: 10px; }
  .h-console__bar { padding: 0 14px; }
  .h-console__crumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .h-seg { display: none; }
  .h-console__body { padding: 18px 14px 12px; }
  .h-console__title { font-size: 17px; }
  .h-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .h-kpis dd { font-size: 26px; }
  .h-steps li { grid-template-columns: 32px minmax(0, 1fr); padding: 22px 0; }
  .h-steps h3 { font-size: 18px; }
  .h-list div { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 18px 0; }
  .h-cols { grid-template-columns: minmax(0, 1fr); }
  .h-plans { grid-template-columns: minmax(0, 1fr); }
  .h-form__row { flex-direction: column; }
  .h-table table { font-size: 14px; }
  .h-table th, .h-table td { padding: 12px 12px; }
  .h-table code { white-space: normal; }
  .h-table--stack thead { display: none; }
  .h-table--stack tr { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 6px 12px; padding: 14px 14px; border-bottom: 1px solid var(--border); }
  .h-table--stack tr:last-child { border-bottom: 0; }
  .h-table--stack td { display: block; padding: 0; border: 0; }
  .h-table--stack td:first-child { grid-row: 1 / span 2; }
  .h-table--stack td:last-child { color: var(--text-muted); font-size: 13px; }
  .h-footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
  .h-faq summary { font-size: 16px; }
}

@media (forced-colors: active) {
  .h-btn, .badge, .h-lang a { border: 1px solid CanvasText; }
}


/* =====================================================================================================
   KIT DE CONTENIDO (prefijo s-). Solo tokens de :root. Documentado en site/COMPONENTS.md.
   ===================================================================================================== */

/* Utilidades */
.s-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.s-muted { color: var(--text-muted); }
.s-stack > * + * { margin-top: 24px; }
.s-mt { margin-top: 32px; }
main [id] { scroll-margin-top: 88px; }

/* Estado "página actual" en cabecera y pie (lo pone build.py con aria-current="page") */
.h-nav__link[aria-current="page"], .h-dd__btn.has-current { color: var(--text-strong) !important; background: var(--surface-2); }
.h-dd__panel a[aria-current="page"] b { color: var(--accent-strong); }
.h-dd__panel a[aria-current="page"] { background: var(--surface-2); }
.h-footer__cols a[aria-current="page"] { color: var(--text-strong); }

/* ---------- Héroe de página ---------- */
.s-hero { padding: 64px 0 80px; }
.s-hero__inner { max-width: 820px; }
.s-crumbs { margin: 0 0 28px; font-size: 13px; color: var(--text-muted); }
.s-crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.s-crumbs li + li::before { content: '/'; margin-right: 8px; color: var(--border-strong); }
.s-crumbs a { color: var(--text-muted); text-decoration: none; }
.s-crumbs a:hover { color: var(--text-strong); text-decoration: underline; }
.s-crumbs [aria-current="page"] { color: var(--text); }
.s-hero h1 { font-size: clamp(34px, 3.6vw, 52px); line-height: 1.08; letter-spacing: -.03em; font-weight: 500; max-width: 22ch; text-wrap: balance; overflow-wrap: break-word; }
.s-hero__lead { margin-top: 22px; font-size: 18px; line-height: 1.6; max-width: 62ch; }
.s-hero .h-actions { margin-top: 28px; }
.s-meta { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 13px; color: var(--text-muted); }

/* ---------- Secciones ---------- */
/* Variante sin cabecera lateral: título arriba, contenido a todo el ancho */
.s-sec__top { max-width: 720px; margin-bottom: 40px; }
.s-sec__top h2 { font-size: clamp(32px, 3.2vw, 44px); line-height: 1.08; letter-spacing: -.025em; text-wrap: balance; overflow-wrap: break-word; }
.s-sec__top p { margin-top: 16px; font-size: 17px; color: var(--text-muted); max-width: 62ch; }
.s-lead { font-size: 18px; line-height: 1.6; max-width: 62ch; }
.h-sec--tight { padding: 72px 0; }

/* ---------- Prosa larga (legales y textos largos) ---------- */
.s-prose { max-width: 70ch; font-size: 16px; line-height: 1.7; }
.s-prose > * + * { margin-top: 1em; }
.s-prose h2 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; margin-top: 2.2em; }
.s-prose h3 { font-size: 19px; line-height: 1.3; letter-spacing: -.015em; margin-top: 1.8em; }
.s-prose h4 { font-size: 16px; font-weight: 500; color: var(--text-strong); margin-top: 1.6em; }
.s-prose > :first-child, .s-prose h2:first-child, .s-prose h3:first-child { margin-top: 0; }
.s-prose ul, .s-prose ol { padding-left: 1.4em; }
.s-prose li + li { margin-top: .45em; }
.s-prose li::marker { color: var(--text-muted); }
.s-prose strong { color: var(--text-strong); font-weight: 500; }
.s-prose blockquote { margin-left: 0; padding: 2px 0 2px 16px; border-left: 2px solid var(--border-strong); color: var(--text-muted); }
.s-prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.4em 0; }
.s-prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.s-prose th { text-align: left; font-weight: 500; color: var(--text-muted); font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--border-strong); }
.s-prose td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.s-prose .s-tablewrap { max-width: none; }

/* Maquetación legal: índice lateral opcional + prosa */
.s-legal { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 8fr); gap: 64px; align-items: start; }
.s-legal--solo { grid-template-columns: minmax(0, 1fr); }
.s-toc { position: sticky; top: 104px; font-size: 14px; }
.s-toc__h { color: var(--text-strong); font-weight: 500; margin: 0 0 12px; }
.s-toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.s-toc li { margin: 0; }
.s-toc a { display: block; padding: 6px 0 6px 14px; margin-left: -1px; border-left: 1px solid transparent; color: var(--text-muted); text-decoration: none; }
.s-toc a:hover { color: var(--text-strong); border-left-color: var(--border-strong); }
.s-toc a[aria-current="true"] { color: var(--text-strong); border-left-color: var(--accent); }

/* ---------- Rejilla de características ---------- */
.s-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.s-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.s-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* QA F3: el `margin: 0` de .s-grid/.s-cards (reset de <ul>) pisaba a .s-mt (misma especificidad, declarada antes): las tarjetas quedaban pegadas a la demo o al lead de arriba */
.s-grid.s-mt, .s-cards.s-mt { margin-top: 32px; }
.s-lead + .s-grid, .s-lead + .s-cards, .s-lead + .s-tablewrap { margin-top: 32px; }
.s-sec__top:has(+ .s-lead) { margin-bottom: 24px; }
/* QA F3: sin celdas huérfanas. Un último elemento impar ocupa la fila entera en las rejillas de 2 columnas; 5 tarjetas en 3 columnas = 3 + 2 anchas */
.s-grid--2 > :last-child:nth-child(odd):not(:first-child), .s-cards:not(.s-cards--3) > :last-child:nth-child(odd):not(:first-child), .s-choices > :last-child:nth-child(odd):not(:first-child) { grid-column: 1 / -1; }
@media (min-width: 981px) {
  .s-grid:not(.s-grid--2):not(.s-grid--4):has(> :nth-child(5):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .s-grid:not(.s-grid--2):not(.s-grid--4):has(> :nth-child(5):last-child) > * { grid-column: span 2; }
  .s-grid:not(.s-grid--2):not(.s-grid--4):has(> :nth-child(5):last-child) > :nth-child(n+4) { grid-column: span 3; }
}
.s-feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 24px; min-width: 0; }
.s-feature__kicker { margin: 0 0 10px; font-size: 13px; font-weight: 500; color: var(--accent); font-variant-numeric: tabular-nums; }
.s-feature h3 { font-size: 18px; line-height: 1.3; letter-spacing: -.015em; }
.s-feature p { margin-top: 8px; }
.s-feature p + p { margin-top: 10px; }
.s-feature ul { list-style: none; margin: 16px 0 0; padding: 0; }
.s-feature li { padding: 9px 0; border-top: 1px solid var(--border); font-size: 15px; }
.s-feature--plain { background: none; border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: 24px 0 0; }

/* ---------- Tabla comparativa responsive ---------- */
.s-tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); -webkit-overflow-scrolling: touch; }
.s-tablewrap:focus-visible { box-shadow: var(--focus); }
.s-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 15px; }
.s-table caption { text-align: left; padding: 14px 18px; font-size: 13px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.s-table th, .s-table td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: top; text-align: left; }
.s-table thead th { font-size: 13px; font-weight: 500; color: var(--text-muted); white-space: nowrap; background: var(--surface); }
.s-table tbody th { font-weight: 500; color: var(--text-strong); }
.s-table tbody tr:last-child > * { border-bottom: 0; }
.s-table .is-hl { background: var(--surface-2); }
.s-table--sticky tbody th, .s-table--sticky thead th:first-child { position: sticky; left: 0; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
.s-table--sticky .is-hl { background: var(--surface-2); }
.s-table--num td { font-variant-numeric: tabular-nums; }

/* ---------- Aviso / callout ---------- */
.s-callout { padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-left-width: 2px; border-radius: var(--r-lg); }
.s-callout > :first-child { margin-top: 0; }
.s-callout__t { display: block; color: var(--text-strong); font-weight: 500; margin-bottom: 4px; }
.s-callout p + p { margin-top: 8px; }
.s-callout--info { border-left-color: var(--accent); background: var(--accent-soft); }
.s-callout--ok { border-left-color: var(--ok); background: var(--ok-soft); }
.s-callout--warn { border-left-color: var(--warn); background: var(--warn-soft); }
.s-callout--danger { border-left-color: var(--danger); background: var(--danger-soft); }

/* ---------- FAQ: varios párrafos o listas dentro de una respuesta ---------- */
.h-faq details > p:not(:last-child) { padding-bottom: 12px; }
.h-faq details ul, .h-faq details ol { margin: 0; padding: 0 0 22px 1.3em; max-width: 66ch; }
.h-faq summary:focus-visible { border-radius: var(--r-sm); }

/* ---------- Formulario ---------- */
.s-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.s-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.s-field { min-width: 0; }
.s-field > label, .s-field > legend, .s-label { display: block; font-size: 14px; font-weight: 500; color: var(--text-strong); margin-bottom: 8px; padding: 0; }
.s-field fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.s-req { color: var(--accent-strong); }
.s-hint { color: var(--text-muted); font-weight: 400; }
.s-input, .s-select, .s-textarea {
  display: block; width: 100%; min-height: 46px; padding: 0 14px;
  background: var(--surface-sunken); color: var(--text-strong);
  border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  font: 400 15px/1.4 var(--font);
}
.s-textarea { min-height: 132px; padding: 12px 14px; line-height: 1.55; resize: vertical; }
.s-input::placeholder, .s-textarea::placeholder { color: var(--text-muted); }
.s-input:focus-visible, .s-select:focus-visible, .s-textarea:focus-visible { border-color: var(--accent); box-shadow: var(--focus); outline: none; }
.s-input[aria-invalid="true"], .s-select[aria-invalid="true"], .s-textarea[aria-invalid="true"] { border-color: var(--danger); }
.s-input:disabled, .s-select:disabled, .s-textarea:disabled { opacity: .6; cursor: not-allowed; }
.s-select-wrap { position: relative; }
.s-select-wrap::after { content: ''; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px; border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.s-select { -webkit-appearance: none; appearance: none; padding-right: 40px; cursor: pointer; }
.s-select option { background: var(--surface); color: var(--text-strong); }
.s-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.s-check { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); font-size: 15px; font-weight: 400; color: var(--text); cursor: pointer; }
.s-check input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.s-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--text-strong); }
.s-check:has(input:focus-visible) { box-shadow: var(--focus); }
.s-check--plain { padding: 0; background: none; border: 0; }
.s-check--plain:has(input:checked) { background: none; }
.s-error { color: var(--danger); font-size: 14px; }
.s-error:empty { display: none; }
.s-turnstile { min-height: 65px; max-width: 100%; overflow: hidden; }
/* El widget de Cloudflare mide 300 px fijos; en 320 px el panel solo deja 246 px. */
@media (max-width: 380px) { .s-turnstile { zoom: .8; } }
.s-form .h-btn--block, .h-btn--block { width: 100%; }
.s-success { padding: 28px; background: var(--ok-soft); border: 1px solid var(--border); border-left: 2px solid var(--ok); border-radius: var(--r-xl); }
.s-success[hidden], .s-form[hidden] { display: none; }
.s-success:focus { outline: none; }
.s-success h3 { font-size: 20px; letter-spacing: -.015em; }
.s-success p { margin-top: 10px; }

/* ---------- Tarjetas de sector / caso de uso (enlazables) ---------- */
.s-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.s-cards--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.s-card { display: flex; flex-direction: column; min-width: 0; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); color: var(--text); text-decoration: none !important; transition: border-color .15s, background-color .15s; }
a.s-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
a.s-card:focus-visible { border-color: var(--accent); }
.s-card h3 { font-size: 18px; line-height: 1.3; letter-spacing: -.015em; }
.s-card p { margin-top: 8px; }
.s-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.s-card__more { margin-top: auto; padding-top: 18px; font-size: 14px; font-weight: 500; color: var(--accent-strong); }
a.s-card:hover .s-card__more { color: var(--text-strong); }

/* ---------- Responsive del kit ---------- */
@media (max-width: 1279px) {
  .h-dd__btn.has-current, .h-nav__link[aria-current="page"] { background: none; }
}
@media (max-width: 980px) {
  .s-hero { padding: 48px 0 64px; }
  .s-legal { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .s-toc { position: static; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); }
  .s-grid, .s-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .s-cards--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .s-grid:not(.s-grid--2):not(.s-grid--4) > :last-child:nth-child(odd):not(:first-child), .s-cards--3 > :last-child:nth-child(odd):not(:first-child) { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .s-hero { padding: 36px 0 48px; }
  .s-hero h1 { font-size: 34px; letter-spacing: -.03em; }
  .s-hero__lead { font-size: 17px; }
  .s-hero .h-actions .h-btn { flex: 1 1 auto; }
  .s-grid, .s-grid--2, .s-grid--4, .s-cards, .s-cards--3 { grid-template-columns: minmax(0, 1fr); }
  .s-row, .s-choices { grid-template-columns: minmax(0, 1fr); }
  .s-prose h2 { font-size: 23px; }
  .s-table th, .s-table td { padding: 12px 14px; }
  .s-success { padding: 20px; }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- Colores forzados ---------- */
@media (forced-colors: active) {
  .s-card, .s-feature, .s-callout, .s-input, .s-select, .s-textarea, .s-check, .s-success, .s-tablewrap { border: 1px solid CanvasText; }
  .s-toc a[aria-current="true"] { text-decoration: underline; }
}

/* El atributo hidden debe ganar a los display: flex/grid de los componentes (p. ej. .h-form__row, .s-success) */
.h [hidden] { display: none !important; }

/* ---------- Dos columnas (formulario + lateral) y panel ---------- */
.s-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 28px; min-width: 0; }
.s-panel h3 { font-size: 18px; line-height: 1.3; letter-spacing: -.015em; }
.s-panel ul { list-style: none; margin: 14px 0 0; padding: 0; }
.s-panel li { padding: 10px 0; border-top: 1px solid var(--border); font-size: 15px; }
.s-split { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 48px; align-items: start; }
.s-split__aside { display: grid; gap: 16px; position: sticky; top: 104px; }
@media (max-width: 980px) {
  .s-split { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .s-split__aside { position: static; }
}
@media (max-width: 640px) { .s-panel { padding: 20px; } }
@media (forced-colors: active) { .s-panel { border: 1px solid CanvasText; } }

/* Tarjetas de una misma fila a la misma altura */
.s-cards > li, .s-grid > li { display: flex; flex-direction: column; min-width: 0; }
.s-cards > li > .s-card, .s-grid > li.s-feature { flex: 1 1 auto; }

/* fieldset como campo: sin borde del navegador */
fieldset.s-field { margin: 0; padding: 0; border: 0; min-width: 0; }
fieldset.s-field > legend { display: block; padding: 0; margin-bottom: 8px; font-size: 14px; font-weight: 500; color: var(--text-strong); }
.s-field > label.s-check { margin: 0; font-size: 15px; font-weight: 400; color: var(--text); }
.s-field > label.s-check--plain:has(input:checked) { color: var(--text); }
