  :root {
    --bg: #F3F4FA; --surface: #FFFFFF; --surface-2: #E8EAF3;
    --text: #2B2E52; --text-muted: #62658A; --border: #D7DAEA;
    --primary: #3D4178; --primary-dark: #2B2E52; --primary-tint: #E8EAF3;
    --accent: #E2694F; --accent-dark: #C8543C; --accent-tint: #FBE7E1; --accent-text: #B3442A;
    --shadow: 0 1px 2px rgba(20, 30, 27, 0.06);
    --radius: 10px;
    --serif: 'Inter Tight', -apple-system, BlinkMacSystemFont, sans-serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  }
  html[data-theme="dark"] {
    --bg: #23253F; --surface: #2E3050; --surface-2: #383A5E;
    --text: #EDEEF9; --text-muted: #B3B6D6; --border: #454877;
    --primary: #A0A5DD; --primary-dark: #A6AAE0; --primary-tint: #282A4D;
    --accent: #F08468; --accent-dark: #F6A088; --accent-tint: #2E2036; --accent-text: #F08468;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  body { font-family: var(--sans); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
  a { color: var(--primary); }
  .skip-link { position: absolute; left: -9999px; top: 0; background: var(--primary); color: #fff; padding: 10px 16px; z-index: 200; border-radius: 0 0 8px 0; }
  .skip-link:focus { left: 0; }

  .topbar { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; row-gap: 8px; }
  .brand-mark { font-family: var(--serif); font-weight: 700; font-size: 1.02rem; color: var(--primary); text-decoration: none; }
  .nav-tools { display: flex; align-items: center; gap: 6px; }
  .nav-link { font-family: var(--sans); font-size: 0.85rem; font-weight: 600; padding: 8px 13px; border-radius: 8px; text-decoration: none; color: var(--text-muted); border: 1px solid transparent; }
  .nav-link:hover { background: var(--surface-2); }
  .nav-link.is-active { color: var(--primary); background: var(--primary-tint); border-color: var(--border); }
  .topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: 6px; }
  .icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 1rem; }
  .icon-btn:hover { background: var(--surface-2); }
  .icon-btn:focus-visible, a:focus-visible, .nav-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

  .container { max-width: 780px; margin: 0 auto; padding: 40px 24px 80px; }
  h1 { font-family: var(--serif); font-weight: 600; font-size: 1.9rem; margin: 0 0 6px; }
  .subtitle { color: var(--text-muted); font-size: 0.92rem; margin: 0 0 32px; }
  h2 { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; color: var(--primary); margin: 34px 0 12px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
  p, li { font-size: 0.93rem; color: var(--text); }
  ul { padding-left: 22px; }
  li { margin-bottom: 8px; }
  .callout {
    background: var(--accent-tint); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 20px; margin: 18px 0; font-size: 0.9rem;
  }
  .callout strong { color: var(--accent-text); }
  .callout-primary {
    background: var(--primary-tint); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 20px; margin: 18px 0; font-size: 0.9rem;
  }
  .callout-primary strong { color: var(--primary); }
  .toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 22px; margin-bottom: 10px; }
  .toc p { margin: 0 0 8px; font-weight: 600; font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
  .toc ol { margin: 0; padding-left: 20px; font-size: 0.88rem; }
  .toc li { margin-bottom: 4px; }
  code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 0.85em; }
  table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 0.87rem; }
  th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
  th { background: var(--surface-2); color: var(--text-muted); font-weight: 600; }
  footer { border-top: 1px solid var(--border); padding: 22px 24px 40px; }
  footer .container { padding-top: 18px; padding-bottom: 0; }
  footer p { font-size: 0.78rem; color: var(--text-muted); margin: 0 0 8px; }
  .updated { font-size: 0.8rem; color: var(--text-muted); margin-top: 40px; border-top: 1px dashed var(--border); padding-top: 14px; }

  /* Menú en móvil: se desplaza en horizontal en lugar de salirse de la pantalla */
  @media (max-width: 760px) {
    .topbar > div:last-child { width: 100%; min-width: 0; }
    .nav-tools { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .nav-tools::-webkit-scrollbar { display: none; }
    .nav-link { white-space: nowrap; }
  }

  /* Accesibilidad: contraste AA de textos sobre el color primario en modo oscuro */
  html[data-theme="dark"] .btn-primary, html[data-theme="dark"] .btn-fill, html[data-theme="dark"] .annual-banner__cell,
  html[data-theme="dark"] .category-tab.is-active, html[data-theme="dark"] .skip-link, html[data-theme="dark"] .chip[aria-pressed="true"] { color: #14152A; }
