/* Tokens alinhados ao dashboard NouVy */
:root {
  --background: #f9f9fb;
  --foreground: #141221;
  --card: #ffffff;
  --card-foreground: #141221;
  --primary: #6828f0;
  --primary-foreground: #ffffff;
  --secondary: #f3f2f7;
  --muted: #eeedf2;
  --muted-foreground: #6b677e;
  --accent: #efe9fb;
  --accent-foreground: #490ec8;
  --border: #e3e2e9;
  --input: #e3e2e9;
  --ring: #6828f0;
  --nouvy-purple: #6828f0;
  --nouvy-purple-light: #9770eb;
  --nouvy-gradient-end: #ab51ec;
  --code-bg: #f3f2f7;
  --code-fg: #141221;
  --nav-active-bg: rgba(104, 40, 240, 0.1);
  --radius: 0.75rem;
  --sidebar-w: 16rem;
  --topbar-h: 4rem;
  --font-body: "CameraPlainVariable", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
  color-scheme: light;
}

html.dark {
  --background: #0c0b14;
  --foreground: #f1f1f4;
  --card: #151320;
  --card-foreground: #f1f1f4;
  --primary: #7f4af2;
  --primary-foreground: #ffffff;
  --secondary: #211f2e;
  --muted: #282537;
  --muted-foreground: #928fa3;
  --accent: #2a1a4d;
  --accent-foreground: #bea6f2;
  --border: #282537;
  --input: #282537;
  --ring: #7f4af2;
  --nouvy-purple: #6828f0;
  --nouvy-purple-light: #9770eb;
  --nouvy-gradient-end: #ab51ec;
  --code-bg: #0a0912;
  --code-fg: #e2e0ea;
  --nav-active-bg: rgba(127, 74, 242, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.24);
  color-scheme: dark;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.app {
  min-height: 100vh;
  display: flex;
  background: var(--background);
}

/* —— Sidebar (dashboard: bg-card border-r) —— */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 30;
}

.sidebar-header {
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 22%;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--foreground);
}

.brand-tag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.menu-close {
  display: none;
  border: 1px solid var(--border);
  background: var(--secondary);
  color: var(--foreground);
  border-radius: 0.5rem;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
}

.sidebar-nav {
  flex: 1;
  overflow: auto;
  padding: 0.75rem;
}

.sidebar-label {
  margin: 0.85rem 0.65rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.sidebar-label:first-child {
  margin-top: 0.25rem;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 0.85rem 0.35rem;
}

.nav-item {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  font-size: 0.875rem;
  text-decoration: none;
  margin-bottom: 0.15rem;
}

.nav-item:hover {
  background: var(--muted);
  color: var(--foreground);
  text-decoration: none;
}

.nav-item.is-active {
  background: var(--nav-active-bg);
  color: var(--primary);
  font-weight: 500;
}

.sidebar-foot {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 0.35rem;
}

.sidebar-foot .text-link {
  text-align: left;
  font-size: 0.8rem;
  color: var(--muted-foreground);
  text-decoration: none;
}

.sidebar-foot .text-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.top-link[aria-current="page"] {
  cursor: default;
}

/* —— Main column —— */
.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem 0 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.top-link {
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.top-link:hover {
  background: var(--muted);
  color: var(--foreground);
  text-decoration: none;
}

.top-link.is-active {
  background: var(--nav-active-bg);
  color: var(--primary);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-wrap input {
  width: min(280px, 36vw);
  border: 1px solid var(--border);
  background: var(--background);
  border-radius: var(--radius);
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--foreground);
}

.search-wrap input::placeholder {
  color: var(--muted-foreground);
}

.search-wrap input:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent);
  border-color: var(--primary);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--nouvy-purple) 0%, var(--nouvy-gradient-end) 100%);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  border: 0;
  box-shadow: 0 0 0 1px rgba(127, 74, 242, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.08);
  text-decoration: none;
}

.btn-block {
  width: 100%;
}

.menu-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--secondary);
  color: var(--foreground);
  border-radius: 0.5rem;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1rem;
  cursor: pointer;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  background: var(--secondary);
  color: var(--foreground);
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.theme-toggle:hover {
  background: var(--muted);
  color: var(--primary);
}

.theme-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
  display: none;
}

html.dark .theme-toggle .icon-sun {
  display: block;
}

html:not(.dark) .theme-toggle .icon-moon {
  display: block;
}

.main {
  flex: 1;
  padding: 1.5rem 2rem 3rem;
  width: 100%;
}

.content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: 2rem 2.5rem 2.75rem;
  width: 100%;
  max-width: none;
}

.content .loading {
  color: var(--muted-foreground);
}

.content h1 {
  font-size: clamp(1.65rem, 2.4vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 1rem;
  color: var(--foreground);
}

.content h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.85rem 0 0.7rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--foreground);
}

.content h2:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.content h3 {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 1.25rem 0 0.45rem;
  color: var(--foreground);
}

.content p,
.content li {
  color: var(--muted-foreground);
}

.content strong {
  color: var(--foreground);
  font-weight: 600;
}

.content ul,
.content ol {
  padding-left: 1.25rem;
}

.content code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  padding: 0.1em 0.35em;
  color: var(--accent-foreground);
}

.content pre {
  position: relative;
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--border);
}

html:not(.dark) .content pre,
html:not(.dark) .content .code-wrap pre,
html[data-theme="light"] .content pre,
html[data-theme="light"] .content .code-wrap pre,
.content .code-wrap.is-light pre {
  background: #f3f2f7 !important;
  color: #141221 !important;
  border-color: #e3e2e9 !important;
}

html.dark .content pre,
html.dark .content .code-wrap pre,
html[data-theme="dark"] .content pre,
html[data-theme="dark"] .content .code-wrap pre {
  background: #0a0912 !important;
  color: #e2e0ea !important;
}

html:not(.dark) .content pre code,
html[data-theme="light"] .content pre code,
.content .code-wrap.is-light pre code {
  background: transparent !important;
  color: inherit !important;
}

.content pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: 0.84rem;
}

.content .code-wrap {
  position: relative;
  margin: 1rem 0;
}

.content .copy-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 2;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--secondary);
  color: var(--foreground);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
}

.content .copy-btn:hover {
  background: var(--muted);
  color: var(--primary);
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.25rem;
  font-size: 0.9rem;
}

.content th,
.content td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

.content th {
  background: var(--secondary);
  color: var(--foreground);
  font-weight: 600;
}

.content .table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1rem 0 1.25rem;
}

.content .table-wrap table {
  margin: 0;
  min-width: 32rem;
}

.content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.1rem 0 0.4rem;
  color: var(--foreground);
}

.content .callout {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: calc(var(--radius) - 4px);
  background: var(--accent);
  color: var(--foreground);
  font-size: 0.92rem;
}

.content .endpoint-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.content .endpoint-heading .endpoint-path {
  font-size: 0.92em;
  color: var(--foreground);
  overflow-wrap: anywhere;
}

.content .endpoint-heading .endpoint-title {
  color: var(--muted-foreground);
  font-weight: 500;
  font-size: 0.9em;
}

.content .method {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 0.35rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid currentColor;
}

.content .method-get { color: #0f7b4f; }
.content .method-post { color: #1d5fd6; }
.content .method-patch,
.content .method-put { color: #a15c00; }
.content .method-delete { color: #c0262d; }

html.dark .content .method-get { color: #4fd39a; }
html.dark .content .method-post { color: #7aa8ff; }
html.dark .content .method-patch,
html.dark .content .method-put { color: #f0b45a; }
html.dark .content .method-delete { color: #ff7a7f; }

.content .page-toc {
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--secondary);
}

.content .page-toc-title {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}

.content .page-toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.2rem 1.5rem;
}

.content .page-toc li {
  margin: 0;
}

.content .page-toc a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
}

.content .page-toc a:hover {
  text-decoration: underline;
}

.search-results {
  margin-bottom: 1rem;
  width: 100%;
  max-width: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
}

.search-results a {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: calc(var(--radius) - 2px);
  color: var(--foreground);
  text-decoration: none;
}

.search-results a:hover {
  background: var(--nav-active-bg);
}

.search-results .hit-title {
  font-weight: 600;
  color: var(--primary);
}

.search-results .hit-snippet {
  display: block;
  color: var(--muted-foreground);
  font-size: 0.82rem;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 25;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .top-nav {
    display: none;
  }

  .topbar .btn-primary {
    display: none;
  }

  .main {
    padding: 1rem;
  }

  .content {
    padding: 1.25rem 1.1rem 1.75rem;
  }
}
