/* ==========================================================================
   Otto Docs — docs.ottoseg.com.br
   Identidade Otto v4: preto verdadeiro + grafite + prata no escuro;
   branco limpo + cinza sutil no claro. Azul Otto apenas como sinal.
   ========================================================================== */

:root {
  --bg: #000000;
  --bg-elev: rgba(0, 0, 0, 0.82);
  --surface: #111113;
  --surface-2: #19191c;
  --surface-hover: #1e1e22;
  --border: #26262a;
  --border-2: #36363c;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #7c7c82;
  --primary: #ffffff;
  --on-primary: #000000;
  --accent: #0a84ff;
  --link: #4da3ff;
  --accent-soft: rgba(10, 132, 255, 0.14);
  --ok: #4fd69c;
  --ok-soft: rgba(79, 214, 156, 0.11);
  --ok-border: rgba(79, 214, 156, 0.28);
  --warn: #ffc457;
  --warn-soft: rgba(255, 196, 87, 0.11);
  --warn-border: rgba(255, 196, 87, 0.28);
  --bad: #ff8589;
  --bad-soft: rgba(255, 133, 137, 0.11);
  --bad-border: rgba(255, 133, 137, 0.28);

  --font: "Geist", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", monospace;

  --topbar-h: 58px;
  --sidebar-w: 272px;
  --toc-w: 232px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-elev: rgba(255, 255, 255, 0.86);
  --surface: #f5f5f7;
  --surface-2: #ffffff;
  --surface-hover: #ececf0;
  --border: #e3e3e8;
  --border-2: #cfcdd6;
  --text: #1d1d1f;
  --text-2: #58585e;
  --text-3: #6e6e73;
  --primary: #000000;
  --on-primary: #ffffff;
  --accent: #0a84ff;
  --link: #0066cc;
  --accent-soft: #e8f2ff;
  --ok: #0e7a4e;
  --ok-soft: #e6f6ee;
  --ok-border: #bce6d1;
  --warn: #8a5a00;
  --warn-soft: #fff4dd;
  --warn-border: #f2d59b;
  --bad: #c4262e;
  --bad-soft: #fdebed;
  --bad-border: #f5c2c5;

  color-scheme: light;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 24px);
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

button, input {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--accent);
  color: #ffffff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 200;
  background: var(--primary);
  color: var(--on-primary);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  top: 12px;
}

/* ==========================================================================
   Topbar
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-h);
  background: var(--bg-elev);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar-in {
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  padding: 4px 2px;
}

.logo {
  height: 19px;
  width: auto;
}
.logo .logo-mark {
  fill: url(#otto-prata);
}
[data-theme="light"] .logo .logo-mark {
  fill: var(--text);
}

.brand-sep {
  color: var(--border-2);
  font-weight: 300;
  font-size: 18px;
  line-height: 1;
}

.brand-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.4;
}

.search-trigger {
  flex: 1;
  max-width: 400px;
  height: 36px;
  padding: 0 10px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  text-align: left;
}
.search-trigger:hover {
  border-color: var(--border-2);
  background: var(--surface-hover);
}
.search-placeholder {
  flex: 1;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kbd-hint {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-3);
  flex-shrink: 0;
}

.top-link {
  font-size: 13.5px;
  color: var(--text-2);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.top-link:hover {
  color: var(--text);
  background: var(--surface);
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

/* Alternância de ícone do tema */
.ico-sun { display: block; }
.ico-moon { display: none; }
[data-theme="light"] .ico-sun { display: none; }
[data-theme="light"] .ico-moon { display: block; }

.btn-app {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.btn-app:hover {
  opacity: 0.88;
}

.mobile-only {
  display: none;
}

/* ==========================================================================
   Shell 3 colunas
   ========================================================================== */

.shell {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  align-items: start;
}

/* Sidebar esquerda */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 20px 14px 28px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  scrollbar-width: thin;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-group-title {
  margin: 0 0 6px 10px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.8px;
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
  position: relative;
}
.nav-item:hover {
  background: var(--surface);
  color: var(--text);
}
.nav-item[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}
.nav-item[aria-current="page"]::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.sidebar-foot {
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-3);
}
.sidebar-foot a {
  text-decoration: none;
}
.sidebar-foot a:hover {
  color: var(--text);
}

/* Conteúdo principal */
.main {
  min-width: 0;
  padding: 36px clamp(20px, 4vw, 56px) 56px;
}
.main:focus {
  outline: none;
}

.article {
  max-width: 760px;
  margin: 0 auto;
}

/* Sumário à direita */
.toc {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 36px 20px 28px 16px;
}

.toc-title {
  margin: 0 0 12px;
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-link {
  display: block;
  padding: 4px 0 4px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.toc-link:hover {
  color: var(--text);
}
.toc-link.is-sub {
  padding-left: 24px;
  font-size: 12.5px;
}
.toc-link.is-active {
  color: var(--text);
  border-left-color: var(--accent);
  font-weight: 500;
}

/* ==========================================================================
   Home da documentação
   ========================================================================== */

.home-hero {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.home-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.home-lede {
  margin: 0 0 22px;
  font-size: 16.5px;
  color: var(--text-2);
  max-width: 620px;
}

.home-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  height: 44px;
  padding: 0 12px 0 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.home-search-btn:hover {
  border-color: var(--border-2);
  background: var(--surface-hover);
}
.home-search-btn span {
  flex: 1;
  text-align: left;
  font-size: 14px;
}

.home-section-title {
  margin: 32px 0 14px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.card-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s var(--ease), background 0.15s ease;
}
.doc-card:hover {
  border-color: var(--border-2);
  background: var(--surface-hover);
  transform: translateY(-1px);
}
.doc-card-kicker {
  font-size: 11.5px;
  color: var(--text-3);
}
.doc-card h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.doc-card p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-2);
}

/* ==========================================================================
   Tipografia e elementos de artigo
   ========================================================================== */

.article-head {
  padding-bottom: 22px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: var(--text-3);
}
.breadcrumb a {
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--text);
}

.article-head h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 3.6vw, 34px);
  line-height: 1.18;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.article-summary {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--text-2);
}

.article-meta {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.prose h2 {
  margin: 36px 0 12px;
  padding-top: 8px;
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.prose h3 {
  margin: 24px 0 8px;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.015em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.heading-anchor {
  opacity: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--text-3);
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
}
.heading-anchor:hover {
  background: var(--surface);
  color: var(--text);
}

.prose p {
  margin: 0 0 14px;
  color: var(--text);
}

.prose a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.prose a:hover {
  opacity: 0.85;
}

.prose ul,
.prose ol {
  margin: 0 0 16px;
  padding-left: 22px;
}

.prose li {
  margin-bottom: 7px;
}
.prose li strong {
  color: var(--text);
}

.prose code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.prose kbd {
  font-family: var(--mono);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  box-shadow: inset 0 -1px 0 var(--border);
}

/* Callouts */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  margin: 18px 0 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.callout-ico {
  width: 19px;
  height: 19px;
  margin-top: 2px;
  flex-shrink: 0;
  color: var(--accent);
}
.callout-body {
  min-width: 0;
  font-size: 14.5px;
}
.callout-body strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}
.callout-body p:last-child {
  margin-bottom: 0;
}

.callout-tip {
  background: var(--ok-soft);
  border-color: var(--ok-border);
}
.callout-tip .callout-ico {
  color: var(--ok);
}

.callout-warn {
  background: var(--warn-soft);
  border-color: var(--warn-border);
}
.callout-warn .callout-ico {
  color: var(--warn);
}

.callout-info {
  background: var(--accent-soft);
  border-color: rgba(10, 132, 255, 0.28);
}

/* Passos numerados (Stepper) */
.steps {
  list-style: none;
  padding: 0 !important;
  margin: 18px 0 24px !important;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding: 14px 16px 14px 52px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  margin: 0;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.steps li strong {
  display: block;
  margin-bottom: 3px;
  font-size: 15px;
}
.steps li p {
  margin: 0;
  font-size: 14.2px;
  color: var(--text-2);
}

/* Diagrama de fluxo */
.flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 18px 0 24px;
}
.flow-step {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.flow-num {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 6px;
}
.flow-step strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}
.flow-step span {
  display: block;
  font-size: 12.8px;
  line-height: 1.45;
  color: var(--text-2);
}

/* Tabelas */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 18px 0 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.prose th,
.prose td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.prose thead th {
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}
.prose tbody tr:last-child td {
  border-bottom: 0;
}
.cell-center {
  text-align: center !important;
}

.badge-ok {
  color: var(--ok);
  font-weight: 600;
}
.badge-warn {
  color: var(--warn);
  font-weight: 600;
}
.badge-bad {
  color: var(--bad);
  font-weight: 600;
}
.badge-muted {
  color: var(--text-3);
}

/* FAQ / Details */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 24px;
}
.faq-list details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 16px;
}
.faq-list summary {
  padding: 14px 0;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.faq-list summary::-webkit-details-marker {
  display: none;
}
.faq-list summary::after {
  content: "+";
  font-family: var(--mono);
  font-size: 18px;
  color: var(--text-3);
  flex-shrink: 0;
}
.faq-list details[open] summary::after {
  content: "−";
  color: var(--text);
}
.faq-list details p {
  padding: 0 0 15px;
  margin: 0;
  font-size: 14.5px;
  color: var(--text-2);
}

/* Feedback + Anterior/Próximo */
.article-feedback {
  margin-top: 40px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.article-feedback p {
  margin: 0;
  font-size: 13.8px;
  color: var(--text-2);
}
.feedback-actions {
  display: flex;
  gap: 8px;
}
.feedback-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--bg);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.feedback-btn:hover {
  border-color: var(--text-2);
}
.feedback-btn.is-selected {
  border-color: var(--ok);
  color: var(--ok);
}

.pager {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.pager-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pager-card:hover {
  border-color: var(--border-2);
  background: var(--surface-hover);
}
.pager-card.is-next {
  text-align: right;
  align-items: flex-end;
}
.pager-dir {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-3);
}
.pager-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}

/* Footer */
.doc-footer {
  max-width: 760px;
  margin: 48px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.doc-footer-in {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--text-3);
}
.doc-footer-in p {
  margin: 0;
}
.doc-footer-in a {
  color: var(--text-2);
  text-decoration: none;
}
.doc-footer-in a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ==========================================================================
   Modal de Busca (Ctrl+K)
   ========================================================================== */

.search-modal[hidden] {
  display: none;
}
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(12vh, 96px) 16px 24px;
}
.search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
}
.search-dialog {
  position: relative;
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-2);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.48);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: min(72vh, 560px);
}
.search-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.search-input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 15.5px;
  color: var(--text);
  outline: none;
}
.search-input::placeholder {
  color: var(--text-3);
}
.search-esc {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-3);
  cursor: pointer;
}
.search-results {
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.search-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  border: 1px solid transparent;
}
.search-item:hover,
.search-item.is-active {
  background: var(--surface-hover);
  border-color: var(--border);
}
.search-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.search-item-title {
  font-size: 14.5px;
  font-weight: 600;
}
.search-item-cat {
  font-size: 11.5px;
  color: var(--text-3);
  flex-shrink: 0;
}
.search-item-snippet {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-item mark {
  background: var(--accent-soft);
  color: var(--link);
  padding: 0 2px;
  border-radius: 3px;
}
.search-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-2);
  font-size: 14px;
}
.search-foot {
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  gap: 16px;
  font-size: 11.5px;
  color: var(--text-3);
}
.search-foot kbd {
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 150;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

/* Backdrop mobile */
.backdrop[hidden] {
  display: none;
}
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(4px);
}

/* ==========================================================================
   Responsivo
   ========================================================================== */

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .mobile-only {
    display: inline-flex;
  }
  .desktop-only {
    display: none;
  }
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    width: min(300px, 86vw);
    z-index: 80;
    background: var(--bg);
    padding: 14px 14px 24px;
    transform: translateX(-100%);
    transition: transform 0.22s var(--ease);
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .sidebar-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .search-trigger {
    max-width: none;
  }
  .kbd-hint {
    display: none;
  }
  .card-grid,
  .card-grid-3,
  .pager {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .topbar-in {
    padding: 0 12px;
    gap: 8px;
  }
  .search-placeholder {
    display: none;
  }
  .search-trigger {
    flex: 0 0 auto;
    width: 36px;
    padding: 0;
    justify-content: center;
  }
  .btn-app span {
    display: none;
  }
  .btn-app {
    width: 34px;
    padding: 0;
    justify-content: center;
  }
}
