/* ============================================================================
   Manual Rabi — Design System v2.0 (2026-05-17)
   Modernizado: Inter + JetBrains Mono, dark mode, escala tipográfica
   perfect-fourth, paleta refinada, componentes acessíveis (WCAG AA).
   Mantém variáveis antigas como aliases para não quebrar páginas existentes.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ----------------------------------------------------------------------------
   1. RESET + BASE
   ---------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
body { font-family: var(--font-sans); font-size: var(--fs-base); line-height: 1.6; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

/* Focus visible (acessibilidade) */
*:focus { outline: none; }
*:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }

/* Skip-to-content link (acessibilidade) */
.skip-link { position: absolute; top: -40px; left: var(--sp-4); background: var(--primary); color: #fff; padding: var(--sp-2) var(--sp-4); border-radius: var(--r-md); font-weight: 600; z-index: 1000; transition: top var(--t-base); }
.skip-link:focus { top: var(--sp-4); text-decoration: none; }

/* ----------------------------------------------------------------------------
   2. VARIÁVEIS — LIGHT THEME (default)
   ---------------------------------------------------------------------------- */

:root {
  /* Fontes */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  /* Paleta light */
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #e4e4e7;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #71717a;
  --primary: #0070f3;
  --primary-lt: #e6f0ff;
  --primary-dk: #0052cc;
  --primary-text: #ffffff;
  --accent: #10b981;
  --accent-lt: #d1fae5;
  --warn: #f59e0b;
  --warn-lt: #fef3c7;
  --danger: #ef4444;
  --danger-lt: #fee2e2;
  --info: #3b82f6;
  --info-lt: #dbeafe;

  /* Escala tipográfica (perfect fourth ratio 1.333) */
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.333rem;
  --fs-2xl: 1.777rem;
  --fs-3xl: 2.369rem;
  --fs-4xl: 3.157rem;

  /* Espaçamento (escala 4px) */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;

  /* Raios */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-2xl: 24px;
  --r-full: 9999px;

  /* Sombras */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.06);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.08);

  /* Transições */
  --t-fast: 150ms ease;
  --t-base: 200ms ease;
  --t-slow: 300ms ease;

  /* Layout */
  --sidebar-w: 280px;
  --topbar-h: 64px;
  --content-max: 880px;

  /* ALIASES para variáveis antigas (não quebrar páginas existentes) */
  --color-primary: var(--primary);
  --color-primary-lt: var(--primary-lt);
  --color-primary-dk: var(--primary-dk);
  --color-text: var(--text);
  --color-text-muted: var(--text-2);
  --color-surface: var(--surface);
  --color-border: var(--border);
  --color-accent: var(--accent);
  --color-warn: var(--warn);
  --color-danger: var(--danger);
  --radius: var(--r-md);
  --transition: var(--t-base);
}

/* ----------------------------------------------------------------------------
   3. VARIÁVEIS — DARK THEME
   ---------------------------------------------------------------------------- */

[data-theme="dark"] {
  --bg: #09090b;
  --surface: #18181b;
  --surface-2: #27272a;
  --surface-3: #3f3f46;
  --border: #27272a;
  --border-strong: #3f3f46;
  --text: #fafafa;
  --text-2: #d4d4d8;
  --text-3: #a1a1aa;
  --primary: #3b9eff;
  --primary-lt: rgba(59,158,255,.15);
  --primary-dk: #1e88e5;
  --accent: #34d399;
  --accent-lt: rgba(52,211,153,.15);
  --warn: #fbbf24;
  --warn-lt: rgba(251,191,36,.15);
  --danger: #f87171;
  --danger-lt: rgba(248,113,113,.15);
  --info: #60a5fa;
  --info-lt: rgba(96,165,250,.15);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.5), 0 2px 4px -2px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.5), 0 4px 6px -4px rgba(0,0,0,.4);
}

/* Auto dark mode (se usuário não setou nada) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090b;
    --surface: #18181b;
    --surface-2: #27272a;
    --surface-3: #3f3f46;
    --border: #27272a;
    --border-strong: #3f3f46;
    --text: #fafafa;
    --text-2: #d4d4d8;
    --text-3: #a1a1aa;
    --primary: #3b9eff;
    --primary-lt: rgba(59,158,255,.15);
    --primary-dk: #1e88e5;
    --primary-text: #ffffff;
    --accent: #34d399;
    --accent-lt: rgba(52,211,153,.15);
    --warn: #fbbf24;
    --warn-lt: rgba(251,191,36,.15);
    --danger: #f87171;
    --danger-lt: rgba(248,113,113,.15);
    --info: #60a5fa;
    --info-lt: rgba(96,165,250,.15);
  }
}

/* ----------------------------------------------------------------------------
   4. TOPBAR
   ---------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-4);
  gap: var(--sp-4);
  backdrop-filter: saturate(180%) blur(12px);
}
.topbar .menu-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  display: none;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast);
}
.topbar .menu-toggle:hover { background: var(--surface-2); }
.topbar .logo {
  font-weight: 800;
  font-size: var(--fs-lg);
  color: var(--primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.topbar .logo span {
  font-weight: 500;
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-left: var(--sp-2);
}
.topbar .search-bar {
  flex: 1;
  max-width: 560px;
  position: relative;
}
.topbar .search-bar input {
  width: 100%;
  height: 40px;
  padding: 0 var(--sp-4) 0 var(--sp-10);
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--text);
  transition: border var(--t-fast), background var(--t-fast);
}
.topbar .search-bar input::placeholder { color: var(--text-3); }
.topbar .search-bar input:focus { border-color: var(--primary); background: var(--surface); outline: none; }
.topbar .search-icon {
  position: absolute;
  left: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  font-size: 1rem;
}
.topbar .search-shortcut {
  position: absolute;
  right: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  pointer-events: none;
  font-family: var(--font-mono);
}

.topbar .topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}
.theme-toggle, .icon-btn {
  background: none;
  border: 1px solid var(--border);
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.theme-toggle:hover, .icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { width: 18px; height: 18px; }
[data-theme="dark"] .theme-toggle .icon-sun, html:not([data-theme]) .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
html:not([data-theme="dark"]) .theme-toggle .icon-moon { display: none; }
html:not([data-theme="dark"]) .theme-toggle .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .theme-toggle .icon-moon { display: block; }
  html:not([data-theme]) .theme-toggle .icon-sun { display: none; }
}

.version-badge {
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
  padding: 4px var(--sp-2);
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* Resultados de busca */
#search-results {
  position: absolute;
  top: calc(100% + var(--sp-2));
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-height: 480px;
  overflow-y: auto;
  display: none;
  z-index: 200;
}
#search-results.active { display: block; }
#search-results .result-item {
  display: block;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background var(--t-fast);
}
#search-results .result-item:last-child { border-bottom: none; }
#search-results .result-item:hover, #search-results .result-item.active { background: var(--surface-2); text-decoration: none; }
#search-results .result-item .result-title { font-weight: 600; font-size: var(--fs-sm); margin-bottom: 2px; }
#search-results .result-item .result-section { font-size: var(--fs-xs); color: var(--text-3); }
#search-results .result-item mark { background: var(--primary-lt); color: var(--primary-dk); padding: 0 2px; border-radius: 2px; }
[data-theme="dark"] #search-results .result-item mark { color: var(--primary); }
#search-results .empty { padding: var(--sp-6); text-align: center; color: var(--text-3); font-size: var(--fs-sm); }

/* ----------------------------------------------------------------------------
   5. SIDEBAR
   ---------------------------------------------------------------------------- */

.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: var(--sp-6) var(--sp-4);
  z-index: 90;
  transition: transform var(--t-base);
}
.sidebar-section { margin-bottom: var(--sp-6); }
.sidebar-section-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding: 0 var(--sp-3) var(--sp-2);
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar a {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: all var(--t-fast);
}
.sidebar a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar a.active { background: var(--primary-lt); color: var(--primary); font-weight: 600; }
.sidebar a .icon, .sidebar a svg { width: 18px; height: 18px; flex-shrink: 0; color: currentColor; opacity: .8; }
.sidebar a.active .icon, .sidebar a.active svg { opacity: 1; }

#sidebar-overlay { transition: opacity var(--t-base); }

/* ----------------------------------------------------------------------------
   6. MAIN CONTENT
   ---------------------------------------------------------------------------- */

.main-content {
  margin-left: var(--sidebar-w);
  padding: var(--sp-8) var(--sp-6);
  max-width: calc(var(--sidebar-w) + var(--content-max) + var(--sp-12));
}
.main-content > * { max-width: var(--content-max); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--text-3); opacity: .5; }
.breadcrumb span:last-child { color: var(--text); font-weight: 500; }

.page-title { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -0.025em; color: var(--text); margin-bottom: var(--sp-3); line-height: 1.15; }
.page-subtitle { font-size: var(--fs-lg); color: var(--text-2); margin-bottom: var(--sp-8); line-height: 1.5; }

/* TOC */
.toc {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-8);
}
.toc-title { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: var(--sp-3); }
.toc ol, .toc ul { list-style: none; padding-left: 0; }
.toc li { margin: 4px 0; }
.toc a { font-size: var(--fs-sm); color: var(--text-2); display: block; padding: 4px 0; }
.toc a:hover { color: var(--primary); text-decoration: none; }
.toc a.toc-h3 { padding-left: var(--sp-4); font-size: var(--fs-sm); color: var(--text-3); }
.toc a.active { color: var(--primary); font-weight: 600; }

/* ----------------------------------------------------------------------------
   7. TIPOGRAFIA DE CONTEÚDO
   ---------------------------------------------------------------------------- */

.main-content h1, .main-content h2, .main-content h3, .main-content h4 {
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin-top: var(--sp-10);
  margin-bottom: var(--sp-4);
  scroll-margin-top: calc(var(--topbar-h) + var(--sp-4));
  position: relative;
}
.main-content h2 { font-size: var(--fs-2xl); padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border); }
.main-content h3 { font-size: var(--fs-xl); }
.main-content h4 { font-size: var(--fs-lg); }
.main-content > h2:first-of-type { margin-top: 0; }
.main-content p { margin-bottom: var(--sp-4); color: var(--text); }
.main-content ul, .main-content ol { margin-left: var(--sp-6); margin-bottom: var(--sp-4); }
.main-content li { margin-bottom: var(--sp-2); }
.main-content strong { font-weight: 600; color: var(--text); }
.main-content em { font-style: italic; }
.main-content hr { border: none; border-top: 1px solid var(--border); margin: var(--sp-8) 0; }

/* Copy-link em títulos */
.main-content h2 .anchor-link, .main-content h3 .anchor-link {
  position: absolute;
  left: -28px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  color: var(--text-3);
  font-weight: normal;
  transition: opacity var(--t-fast);
  text-decoration: none;
  font-size: 1rem;
}
.main-content h2:hover .anchor-link, .main-content h3:hover .anchor-link { opacity: 1; }
.main-content .anchor-link:hover { color: var(--primary); }

/* Código */
.main-content code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  color: var(--primary-dk);
  border: 1px solid var(--border);
}
[data-theme="dark"] .main-content code:not(pre code) { color: var(--primary); }
.main-content pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin: var(--sp-4) 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.main-content pre code { background: none; padding: 0; border: none; color: var(--text); font-size: inherit; }

/* Tabelas */
.main-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--sp-4) 0;
  font-size: var(--fs-sm);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.main-content th, .main-content td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.main-content th { background: var(--surface-2); font-weight: 600; color: var(--text); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; }
.main-content tr:last-child td { border-bottom: none; }
.main-content tr:nth-child(even) td { background: var(--surface-2); }
.main-content tr:hover td { background: var(--primary-lt); }

/* Blockquote */
.main-content blockquote {
  border-left: 4px solid var(--primary);
  background: var(--surface-2);
  padding: var(--sp-4) var(--sp-5);
  margin: var(--sp-4) 0;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--text-2);
  font-style: italic;
}

/* Details/Summary (interativo nativo) */
.main-content details {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  margin: var(--sp-3) 0;
  transition: border var(--t-fast);
}
.main-content details[open] { border-color: var(--primary); }
.main-content details summary { cursor: pointer; font-weight: 600; color: var(--text); user-select: none; padding: var(--sp-1) 0; }
.main-content details summary:hover { color: var(--primary); }
.main-content details > *:not(summary) { margin-top: var(--sp-3); }

/* ----------------------------------------------------------------------------
   8. COMPONENTES
   ---------------------------------------------------------------------------- */

/* Callouts (5 tipos) */
.callout {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  border-left: 4px solid;
  margin: var(--sp-4) 0;
  background: var(--surface-2);
  align-items: flex-start;
}
.callout-title { font-weight: 700; margin-bottom: var(--sp-1); display: flex; align-items: center; gap: var(--sp-2); }
.callout-body { flex: 1; }
.callout-body p:last-child { margin-bottom: 0; }
.callout-info { background: var(--info-lt); border-left-color: var(--info); }
.callout-info .callout-title { color: var(--info); }
.callout-tip, .callout-success { background: var(--accent-lt); border-left-color: var(--accent); }
.callout-tip .callout-title, .callout-success .callout-title { color: var(--accent); }
.callout-warn, .callout-warning { background: var(--warn-lt); border-left-color: var(--warn); }
.callout-warn .callout-title, .callout-warning .callout-title { color: var(--warn); }
.callout-danger, .callout-error { background: var(--danger-lt); border-left-color: var(--danger); }
.callout-danger .callout-title, .callout-error .callout-title { color: var(--danger); }
.callout-note { background: var(--surface-2); border-left-color: var(--text-3); }
.callout-note .callout-title { color: var(--text-2); }

/* Cards */
.card, .card-module {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  transition: all var(--t-base);
  display: block;
  color: var(--text);
}
.card-module:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}
.card-icon { font-size: 1.75rem; margin-bottom: var(--sp-3); display: block; }
.card-title { font-size: var(--fs-lg); font-weight: 700; color: var(--text); margin-bottom: var(--sp-2); }
.card-desc { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.5; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

/* Steps */
.steps {
  list-style: none;
  margin: var(--sp-4) 0;
  padding-left: 0;
  counter-reset: step;
}
.steps > li {
  position: relative;
  padding-left: 52px;
  padding-bottom: var(--sp-6);
  border-left: 2px solid var(--border);
  margin-left: 18px;
  counter-increment: step;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: -19px;
  top: 0;
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 700;
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px var(--bg);
}
.step-title { font-weight: 700; font-size: var(--fs-lg); margin-bottom: var(--sp-2); color: var(--text); }
.step-content { padding-top: 6px; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.badge-primary { background: var(--primary-lt); color: var(--primary-dk); border-color: transparent; }
[data-theme="dark"] .badge-primary { color: var(--primary); }
.badge-success { background: var(--accent-lt); color: var(--accent); border-color: transparent; }
.badge-warn { background: var(--warn-lt); color: var(--warn); border-color: transparent; }
.badge-danger { background: var(--danger-lt); color: var(--danger); border-color: transparent; }

/* Botoes */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: var(--fs-sm);
  border: 1px solid transparent;
  transition: all var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-dk); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-white { background: #fff; color: var(--primary); }
.btn-white:hover { background: #f5f5f5; box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
.btn-outline:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.7); }
.btn-sm { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); }
.btn-lg { padding: var(--sp-4) var(--sp-6); font-size: var(--fs-base); }

/* Screenshots (preservar layout antigo) */
.screenshot-wrap, figure.screenshot {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  margin: var(--sp-4) 0;
  text-align: center;
}
.screenshot-wrap img, figure.screenshot img {
  max-width: 100%;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
}
.screenshot-caption, figure.screenshot figcaption {
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--text-2);
  text-align: left;
}
figure.screenshot figcaption ol { margin-top: var(--sp-2); }

/* Footer */
.footer {
  margin-top: var(--sp-16);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-3);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.footer a { color: var(--text-2); }
.footer a:hover { color: var(--primary); }

/* Back-to-top */
.back-to-top {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  width: 44px; height: 44px;
  background: var(--primary);
  color: var(--primary-text);
  border: none;
  border-radius: var(--r-full);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: all var(--t-fast);
  z-index: 50;
}
.back-to-top.visible { display: flex; }
.back-to-top:hover { background: var(--primary-dk); transform: translateY(-2px); }

/* ----------------------------------------------------------------------------
   9. RESPONSIVO (mobile-first overrides para tablet/desktop)
   ---------------------------------------------------------------------------- */

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-xl); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; max-width: 100%; }
  .topbar .menu-toggle { display: flex; }
  .version-badge { display: none; }
}
@media (max-width: 640px) {
  .topbar { gap: var(--sp-2); padding: 0 var(--sp-3); }
  .topbar .logo span { display: none; }
  .topbar .search-shortcut { display: none; }
  .main-content { padding: var(--sp-6) var(--sp-4); }
  .page-title { font-size: var(--fs-2xl); }
  .page-subtitle { font-size: var(--fs-base); }
  .card-grid { grid-template-columns: 1fr; }
  .main-content h2 { font-size: var(--fs-xl); }
  .main-content h3 { font-size: var(--fs-lg); }
  .steps > li { padding-left: 44px; margin-left: 16px; }
  .steps > li::before { width: 32px; height: 32px; left: -17px; font-size: var(--fs-xs); }
  .footer { flex-direction: column; align-items: flex-start; }
}

/* ----------------------------------------------------------------------------
   10. PRINT
   ---------------------------------------------------------------------------- */

@media print {
  .topbar, .sidebar, .back-to-top, .toc, #sidebar-overlay { display: none !important; }
  .main-content { margin: 0; max-width: 100%; padding: 0; }
  body { background: white; color: black; }
  a { color: black; text-decoration: underline; }
  .card, .card-module { break-inside: avoid; }
  .callout { break-inside: avoid; }
  pre, table { break-inside: avoid; }
  h1, h2, h3, h4 { page-break-after: avoid; }
}
