/* ============================================================
   BASE DE CONHECIMENTO — main.css
   Design: Command Palette search + Documentation Layout
   ============================================================ */

/* ── Reset & Custom Properties ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Critical: author [hidden] rule must beat class-level display overrides */
[hidden] { display: none !important; }

:root {
  --primary:        #4F46E5;
  --primary-dark:   #4338CA;
  --primary-light:  #EEF2FF;
  --secondary:      #0F172A;
  --text:           #1E293B;
  --text-muted:     #64748B;
  --text-light:     #94A3B8;
  --border:         #E2E8F0;
  --border-light:   #F1F5F9;
  --bg:             #FFFFFF;
  --bg-subtle:      #F8FAFC;
  --bg-card:        #FFFFFF;
  --success:        #059669;
  --warning:        #D97706;
  --danger:         #DC2626;
  --info:           #0EA5E9;
  --radius:         12px;
  --radius-sm:      8px;
  --radius-xs:      6px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:         0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:      0 20px 40px rgba(0,0,0,.15);
  --shadow-modal:   0 24px 64px rgba(0,0,0,.20);
  --transition:     .2s cubic-bezier(.4,0,.2,1);
  --font:           ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --header-h:       64px;
  --sidebar-w:      288px;
  --toc-w:          220px;
}

html { scroll-behavior: smooth; }
body { font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
img  { max-width: 100%; height: auto; }
a    { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── Layout ── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.section-py { padding: 20px 0; }

/* ── Header ── */
.site-header {
  position: sticky; top: 0; z-index: 500;
  height: var(--header-h);
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

/* Layout de 3 colunas: esquerda | centro | direita */
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  height: 100%;
}

/* Esquerda */
.header-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

/* Centro — busca */
.header-search-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Direita */
.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--secondary); text-decoration: none; flex-shrink: 0; }
.logo:hover { text-decoration: none; }
.logo-text { letter-spacing: -0.02em; }
.header-nav { display: flex; align-items: center; gap: 2px; margin-left: 4px; }
.nav-link { padding: 6px 11px; border-radius: var(--radius-xs); color: var(--text-muted); font-size: 13.5px; font-weight: 500; transition: all var(--transition); }
.nav-link:hover { color: var(--text); background: var(--bg-subtle); text-decoration: none; }

/* ── Busca no header (centro) ── */
.header-search-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 999px;
  color: #9CA3AF;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .18s ease;
  width: 320px;
  max-width: 100%;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.header-search-btn:hover {
  background: #fff;
  border-color: var(--primary);
  color: #6B7280;
  box-shadow: 0 0 0 3px rgba(79,70,229,.08);
}
.header-search-btn span:not(.header-search-login-hint):not(.cmd-trigger-kbd) {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-search-btn svg { flex-shrink: 0; color: #9CA3AF; }
.header-search-login-hint {
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  white-space: nowrap;
}

/* cmd-trigger (home hero + header) */
.cmd-trigger {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--bg-subtle);
  color: var(--text-muted); font-size: 13px; cursor: pointer;
  transition: all var(--transition);
}
.cmd-trigger:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.cmd-trigger span { flex: 1; text-align: left; }
.cmd-trigger-kbd {
  font-size: 10.5px; padding: 1px 6px;
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 4px; background: #fff; color: var(--text-muted);
  font-family: var(--font); white-space: nowrap; line-height: 1.6;
  flex-shrink: 0;
}

.header-user { position: relative; flex-shrink: 0; }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--bg); transition: all var(--transition); }
.user-btn:hover { background: var(--bg-subtle); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.user-name { font-size: 13.5px; font-weight: 500; }
.user-dropdown { position: absolute; top: calc(100% + 8px); right: 0; min-width: 200px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 200; }
.dropdown-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius-xs); font-size: 13.5px; color: var(--text); transition: background var(--transition); }
.dropdown-item:hover { background: var(--bg-subtle); text-decoration: none; }
.dropdown-item--danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.header-actions { display: flex; align-items: center; }
.hamburger { display: none; flex-direction: column; gap: 5px; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: var(--radius-xs); }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: all var(--transition); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius-xs); font-size: 14px; font-weight: 500; transition: all var(--transition); white-space: nowrap; border: 1px solid transparent; text-decoration: none !important; }
.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,.3); }
.btn-outline   { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg-subtle); border-color: var(--primary); color: var(--primary); }
.btn-ghost     { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text); }
.btn-danger    { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label  { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-control { width: 100%; padding: 9px 13px; border: 1px solid var(--border); border-radius: var(--radius-xs); font-size: 14px; color: var(--text); background: #fff; outline: none; transition: all var(--transition); font-family: inherit; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-control::placeholder { color: var(--text-light); }
.form-control-lg { font-size: 16px; padding: 11px 14px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: block; }
.form-label-optional { font-size: 12px; font-weight: 400; color: var(--text-muted); margin-left: 4px; }
.form-required { color: #dc2626; font-weight: 600; margin-left: 2px; }
.form-error  { color: var(--danger); font-size: 13px; padding: 8px 12px; background: #fef2f2; border-radius: var(--radius-xs); border: 1px solid #fecaca; }
.form-success{ color: var(--success); font-size: 13px; padding: 8px 12px; background: #f0fdf4; border-radius: var(--radius-xs); border: 1px solid #bbf7d0; }
.form-row { display: flex; gap: 12px; }
.form-group--grow { flex: 1; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* ── Hero ── */
.hero {
  position: relative;
  padding: 100px 0 140px;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 45%, #7c3aed 100%);
}
.hero-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 75% 55%, rgba(196,181,253,.32) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 20%, rgba(99,102,241,.25) 0%, transparent 50%);
}
.hero-inner { position: relative; z-index: 1; }

/* Badge pill */
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 18px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 100px;
  color: rgba(255,255,255,.92);
  font-size: 13px; font-weight: 500;
  margin-bottom: 28px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.hero-title {
  font-size: clamp(36px, 5.5vw, 64px);
  font-weight: 800; letter-spacing: -0.03em; line-height: 1.1;
  color: #fff; margin-bottom: 20px;
}
.hero-subtitle {
  font-size: clamp(15px, 2vw, 18px);
  color: rgba(255,255,255,.78);
  max-width: 560px; margin: 0 auto 44px; line-height: 1.65;
}
.hero-search { max-width: 600px; margin: 0 auto; }

/* Onda inferior */
.hero-wave {
  position: absolute; bottom: -1px; left: 0; right: 0;
  line-height: 0; z-index: 2;
}
.hero-wave svg { display: block; width: 100%; height: 72px; }

/* Command Palette trigger — hero version */
.cmd-trigger-hero {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px 16px 24px;
  background: rgba(255,255,255,.96);
  border: none;
  border-radius: 100px;
  font-size: 15px; color: var(--text-muted); cursor: pointer;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.12);
  transition: all var(--transition); font-family: var(--font);
}
.cmd-trigger-hero:hover {
  background: #fff;
  box-shadow: 0 12px 40px rgba(0,0,0,.28), 0 4px 12px rgba(0,0,0,.14);
  color: var(--text);
  transform: translateY(-1px);
}
.cmd-trigger-hero .search-icon {
  flex-shrink: 0; color: var(--text-muted);
  position: static; transform: none; /* reset do .search-icon absoluto */
}
.cmd-trigger-hero span { flex: 1; text-align: left; }
.cmd-trigger-hero kbd {
  font-size: 12px; padding: 3px 9px;
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 7px; background: var(--bg-subtle);
  color: var(--text-muted); font-family: var(--font); flex-shrink: 0;
}

/* Guest hint inside hero trigger */
.cmd-trigger-login-hint {
  font-size: 12px; color: var(--primary); font-weight: 500;
  flex-shrink: 0; opacity: .85;
}

/* Legacy search (kept for /busca page) */
.search-form { display: flex; gap: 10px; align-items: center; }
.search-box { position: relative; flex: 1; }
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; z-index: 1; }
.search-input { width: 100%; padding: 14px 16px 14px 50px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 15px; font-family: inherit; outline: none; background: #fff; transition: all var(--transition); box-shadow: var(--shadow-sm); }
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light), var(--shadow); }
.search-btn { padding: 14px 28px; font-size: 15px; flex-shrink: 0; border-radius: var(--radius); }

/* Search autocomplete (kept for /busca page) */
.search-autocomplete { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 100; overflow: hidden; }
.autocomplete-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 14px; cursor: pointer; transition: background var(--transition); color: var(--text); text-decoration: none; }
.autocomplete-item:hover { background: var(--bg-subtle); text-decoration: none; }
.autocomplete-item mark { background: rgba(79,70,229,.15); color: var(--primary-dark); border-radius: 2px; }
.autocomplete-item-content { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.autocomplete-item-title { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.autocomplete-item-meta { font-size: 11.5px; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Search overlay (kept but not active in new flow) */
.search-overlay { display: none; }

/* ── Command Palette ── */
/* Spotlight/⌘K style — same pattern as VS Code, Linear, Raycast */
.cmd-palette {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: clamp(48px, 8vh, 100px);
}
.cmd-backdrop {
  position: absolute; inset: 0;
  background: rgba(15,23,42,.58);
  backdrop-filter: blur(6px) saturate(160%);
  -webkit-backdrop-filter: blur(6px) saturate(160%);
}
.cmd-modal {
  position: relative; width: calc(100% - 32px); max-width: 620px;
  background: #fff; border-radius: 16px;
  box-shadow: 0 40px 100px rgba(0,0,0,.28), 0 0 0 1px rgba(0,0,0,.07);
  overflow: hidden;
  animation: cmdDrop .16s cubic-bezier(.22,1,.36,1);
}
.cmd-search-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.cmd-search-row svg { color: var(--text-muted); flex-shrink: 0; }
.cmd-input {
  flex: 1; font-size: 16px; font-family: var(--font);
  border: none; outline: none; background: transparent; color: var(--text);
}
.cmd-input::placeholder { color: var(--text-light); }
.cmd-close-hint {
  font-size: 11px; padding: 2px 7px;
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 4px; color: var(--text-muted); background: var(--bg-subtle);
  font-family: var(--font); cursor: pointer; flex-shrink: 0;
}
.cmd-body { max-height: min(58vh, 420px); overflow-y: auto; }
.cmd-group-label {
  padding: 10px 16px 4px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-light);
}
.cmd-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; text-decoration: none;
  transition: background var(--transition); cursor: pointer;
}
.cmd-item:hover, .cmd-item[aria-selected="true"] { background: var(--primary-light); text-decoration: none; }
.cmd-item-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--bg-subtle); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--text-muted);
}
.cmd-item[aria-selected="true"] .cmd-item-icon {
  background: rgba(79,70,229,.1); border-color: rgba(79,70,229,.2); color: var(--primary);
}
.cmd-item-content { min-width: 0; flex: 1; }
.cmd-item-title {
  font-size: 14px; font-weight: 500; color: var(--secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmd-item[aria-selected="true"] .cmd-item-title { color: var(--primary-dark); }
.cmd-item-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.cmd-item-title mark {
  background: rgba(79,70,229,.15); color: var(--primary-dark);
  border-radius: 2px; padding: 0 1px; font-style: normal;
}
.cmd-item-arrow { color: var(--text-light); flex-shrink: 0; }
.cmd-item[aria-selected="true"] .cmd-item-arrow { color: var(--primary); }
.cmd-empty { display: flex; flex-direction: column; align-items: center; padding: 48px 20px; }
.cmd-empty-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--bg-subtle); display: flex; align-items: center;
  justify-content: center; margin-bottom: 12px; color: var(--text-light);
}
.cmd-empty p { font-size: 14px; color: var(--text-muted); }
.cmd-hint {
  padding: 32px 20px 20px; text-align: center;
  font-size: 13px; color: var(--text-muted);
}
.cmd-hint strong { color: var(--text); }
.cmd-footer {
  display: flex; align-items: center; gap: 20px;
  padding: 10px 16px; background: var(--bg-subtle);
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.cmd-footer span { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); }
.cmd-footer kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; padding: 1px 5px; font-size: 10.5px;
  border: 1px solid #d1d5db; border-bottom-width: 2px;
  border-radius: 4px; background: #fff; font-family: var(--font); color: var(--text);
}
@keyframes cmdDrop { from { opacity: 0; transform: translateY(-10px) scale(.99); } to { opacity: 1; transform: none; } }

/* ── Section Cards ── */
.section-heading { font-size: 20px; font-weight: 700; margin-bottom: 32px; color: var(--secondary); }
.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { display: flex; align-items: flex-start; gap: 16px; padding: 24px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); transition: all var(--transition); color: var(--text); text-decoration: none; position: relative; overflow: hidden; }
.card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--card-color, var(--primary)); opacity: 0; transition: opacity var(--transition); }
.card:hover { border-color: transparent; box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.card:hover::before { opacity: 1; }
.card-icon { width: 48px; height: 48px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.card-body { flex: 1; min-width: 0; }
.card-title { font-size: 15px; font-weight: 600; color: var(--secondary); margin-bottom: 6px; }
.card-desc  { font-size: 13.5px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }
.card-meta  { font-size: 12px; color: var(--text-light); font-weight: 500; }
.card-arrow { color: var(--text-light); flex-shrink: 0; margin-top: 4px; transition: transform var(--transition); }
.card:hover .card-arrow { transform: translateX(3px); color: var(--primary); }

/* ── Breadcrumb ── */
.breadcrumb { margin-bottom: 20px; }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; list-style: none; font-size: 13px; }
.breadcrumb li { display: flex; align-items: center; }
.breadcrumb a { color: var(--text-muted); transition: color var(--transition); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb-home { display: flex; align-items: center; padding: 3px 5px; border-radius: 4px; color: var(--text-muted); transition: all var(--transition); }
.breadcrumb-home:hover { color: var(--primary); background: var(--primary-light); }
.bc-sep { color: var(--text-light); margin: 0 2px; display: flex; align-items: center; }
.breadcrumb a:not(.breadcrumb-home) { padding: 2px 5px; border-radius: 4px; }
.breadcrumb a:not(.breadcrumb-home):hover { background: var(--primary-light); color: var(--primary); }
.breadcrumb [aria-current] span { color: var(--text); font-weight: 500; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: bottom; padding: 2px 5px; }

/* ════════════════════════════════════════════════════════════
   DOCUMENTATION LAYOUT — Card-based 2-column (sidebar | content)
   Inspired by Stripe Docs, GitHub Docs, Tailwind CSS Docs
   ════════════════════════════════════════════════════════════ */

/* Full-width gray page background wrapper */
.article-page {
  background: var(--bg-subtle);
  min-height: calc(100vh - var(--header-h));
  padding: 28px 0 60px;
}

.article-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 28px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  align-items: start;
}

/* ── Left Sidebar — Card ── */
.article-sidebar {
  /* no border-right; sidebar is its own card */
}
.sidebar-inner {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  max-height: calc(100vh - var(--header-h) - 40px);
  overflow-y: auto;
  padding: 20px 14px 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-inner::-webkit-scrollbar { width: 4px; }
.sidebar-inner::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Sidebar header: nav label + collapse/expand button */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px 0 10px;
}
.sidebar-nav-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .09em; color: var(--text-light);
  padding: 0; margin: 0;
}
.sidebar-collapse-btn {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: transparent; color: var(--text-light);
  cursor: pointer; transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.sidebar-collapse-btn:hover {
  background: var(--bg-subtle); color: var(--text); border-color: var(--text-light);
}

/* Section rows in sidebar */
.tree-section { margin-bottom: 2px; }
.tree-section + .tree-section { border-top: 1px solid var(--border-light); padding-top: 4px; margin-top: 2px; }

.tree-section-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-xs);
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  transition: all var(--transition); text-decoration: none;
}
.tree-section-link:hover { color: var(--primary); background: var(--primary-light); text-decoration: none; }
.tree-section-link .tree-section-icon {
  flex-shrink: 0; color: var(--text-muted);
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 6px;
  transition: all var(--transition);
}
.tree-section-link:hover .tree-section-icon { color: var(--primary); background: var(--primary-light); border-color: var(--primary); }

/* Active (current) section */
.tree-section-link--active {
  color: var(--primary); font-weight: 700;
  background: var(--primary-light);
}
.tree-section-link--active .tree-section-icon {
  color: var(--primary); background: var(--primary-light); border-color: var(--primary);
}
.tree-section-link--active:hover { color: var(--primary); background: var(--primary-light); }

/* Children area (categories of current section) */
.tree-section-children {
  padding-left: 10px;
  padding-top: 2px;
  padding-bottom: 4px;
  border-left: 2px solid var(--primary-light);
  margin-left: 12px;
  margin-bottom: 2px;
}

/* Category rows */
.tree-category { margin-bottom: 1px; }
.tree-cat-toggle {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 6px 10px; border-radius: var(--radius-xs);
  font-size: 13px; font-weight: 500; color: var(--text);
  cursor: pointer; transition: background var(--transition);
}
.tree-cat-toggle:hover { background: var(--bg-subtle); }
.tree-cat-toggle a { color: inherit; text-decoration: none; flex: 1; text-align: left; }

/* Subcategory rows */
.tree-chevron { transition: transform var(--transition); color: var(--text-light); flex-shrink: 0; }
.is-open > .tree-cat-toggle > .tree-chevron,
.is-open > .tree-sub-toggle > .tree-chevron { transform: rotate(90deg); color: var(--primary); }

/* Tree icon (folder / doc) */
.tree-item-icon { flex-shrink: 0; color: var(--text-muted); }
.tree-cat-toggle:hover .tree-item-icon { color: var(--primary); }
.is-open > .tree-cat-toggle .tree-item-icon { color: var(--primary); }
.is-open > .tree-sub-toggle .tree-item-icon { color: var(--primary); }

.tree-children { padding-left: 16px; overflow: hidden; display: none; }
.is-open > .tree-children { display: block; }

.tree-subcategory { margin-bottom: 1px; }
.tree-sub-toggle {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 5px 10px; border-radius: var(--radius-xs);
  font-size: 12.5px; color: var(--text-muted);
  cursor: pointer; transition: background var(--transition);
}
.tree-sub-toggle:hover { background: var(--bg-subtle); color: var(--text); }

/* Article list */
.tree-articles { list-style: none; padding-left: 16px; display: none; }
.is-open > .tree-articles { display: block; }
/* Artigos diretos na seção (sem categoria) — sempre visíveis */
.tree-articles--direct { display: block; padding-left: 8px; }
.tree-articles li { border-radius: var(--radius-xs); }

/* Article link row */
.tree-article-link {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-muted);
  padding: 5px 8px; border-radius: var(--radius-xs);
  transition: all var(--transition); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tree-article-link:hover { color: var(--primary); background: var(--primary-light); text-decoration: none; }
.tree-article-link .tree-item-icon { opacity: .5; flex-shrink: 0; }
.tree-article-link:hover .tree-item-icon { opacity: .8; color: var(--primary); }

/* Current article highlight */
.tree-articles li.is-current .tree-article-link {
  color: var(--primary); font-weight: 600;
  background: var(--primary-light);
}
.tree-articles li.is-current .tree-article-link .tree-item-icon { opacity: 1; color: var(--primary); }

.sidebar-toggle-mobile { display: none; }

/* ── Right column: stacked cards ── */
.article-col-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* ── Article Content Card ── */
.article-main {
  padding: 36px 48px 48px;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.article-top { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border-light); }
.article-title    { font-size: clamp(22px, 2.8vw, 32px); font-weight: 800; letter-spacing: -0.025em; line-height: 1.2; margin-bottom: 8px; color: var(--secondary); }
.article-subtitle { font-size: 16px; color: var(--text-muted); line-height: 1.6; margin-bottom: 14px; }

/* Inline meta row: author · date · reading-time */
.article-meta-top {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 0; margin-top: 14px;
}
.article-meta-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--text-muted);
  padding-right: 12px; margin-right: 12px;
  border-right: 1px solid var(--border);
}
.article-meta-item:last-child { border-right: none; padding-right: 0; margin-right: 0; }
.article-meta-item .badge { margin-left: 0; }

/* Keep these for backwards compat if referenced elsewhere */
.article-date, .article-reading-time { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-muted); }
.article-author   { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.author-avatar    { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.author-name      { font-size: 13px; font-weight: 500; }
.article-cover    { margin: 24px 0; border-radius: var(--radius); overflow: hidden; }
.article-cover img { width: 100%; }

/* ── Inline Table of Contents (card in article body) ── */
.article-toc {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 0 0 32px;
  box-shadow: var(--shadow-sm);
}
.toc-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted); margin-bottom: 10px;
}
#toc-nav a {
  display: block; font-size: 13px; color: var(--primary);
  padding: 4px 0; opacity: .75;
  transition: opacity var(--transition); line-height: 1.5; text-decoration: none;
}
#toc-nav a:hover { opacity: 1; text-decoration: none; }
#toc-nav a.is-active { opacity: 1; font-weight: 500; }
#toc-nav a[data-level="3"] { padding-left: 14px; font-size: 12.5px; }

/* ── Prose (Article Body) ── */
.prose {
  font-size: 15.5px; line-height: 1.8; color: var(--text);
  /* Rhythm similar to Tailwind Typography */
}
.prose h2 { font-size: 21px; font-weight: 700; margin: 40px 0 14px; color: var(--secondary); letter-spacing: -0.01em; padding-top: 8px; }
.prose h3 { font-size: 17px; font-weight: 600; margin: 30px 0 10px; color: var(--secondary); }
.prose h4 { font-size: 15px; font-weight: 600; margin: 24px 0 8px; color: var(--secondary); }
.prose p  { margin-bottom: 18px; }
.prose ul, .prose ol { margin: 0 0 18px 22px; }
.prose li { margin-bottom: 6px; }
.prose strong { font-weight: 600; color: var(--secondary); }
.prose em { font-style: italic; }
.prose a  { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.prose code {
  font-size: 13px; background: #f1f5f9; border: 1px solid #e2e8f0;
  padding: 2px 6px; border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
}
.prose pre {
  background: var(--secondary); color: #e2e8f0;
  padding: 20px 24px; border-radius: var(--radius);
  overflow-x: auto; margin-bottom: 20px; line-height: 1.7;
}
.prose pre code { background: none; border: none; padding: 0; color: inherit; font-size: 13.5px; }
.prose blockquote {
  border-left: 3px solid var(--primary); padding: 14px 20px;
  background: var(--primary-light); border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  margin: 24px 0; font-style: normal;
}
.prose blockquote p { margin: 0; color: var(--primary-dark); font-size: 15px; }
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 14px; }
.prose th { background: var(--bg-subtle); font-weight: 600; text-align: left; padding: 10px 14px; border-bottom: 2px solid var(--border); font-size: 13px; }
.prose td { padding: 9px 14px; border-bottom: 1px solid var(--border-light); }
.prose img {
  display: block; margin: 24px auto;
  max-width: 100%; height: auto;
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.prose img.is-zoomable { cursor: zoom-in; }
.prose img.is-zoomable:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 36px 0; }

/* ── Image Lightbox ── */
#img-lightbox {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(0, 0, 0, 0.84);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; cursor: zoom-out;
  opacity: 0; transition: opacity .25s ease;
}
#img-lightbox.is-open { opacity: 1; }
#img-lightbox img {
  max-width: min(92vw, 1400px); max-height: 90vh;
  width: auto; height: auto;
  border-radius: 10px;
  box-shadow: 0 32px 100px rgba(0, 0, 0, .65);
  transform: scale(.88);
  transition: transform .35s cubic-bezier(.34, 1.45, .64, 1);
  user-select: none; pointer-events: none;
}
#img-lightbox.is-open img { transform: scale(1); }
#img-lightbox-close {
  position: absolute; top: 16px; right: 16px;
  width: 40px; height: 40px; flex-shrink: 0;
  background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .2s; z-index: 1;
}
#img-lightbox-close:hover { background: rgba(255,255,255,.26); transform: scale(1.1); }
#img-lightbox-caption {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,.7); font-size: 13px; text-align: center;
  max-width: 80vw; pointer-events: none;
}
.prose mark { background: #fef9c3; padding: 1px 3px; border-radius: 3px; }

/* ── Article Tags ── */
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 32px 0; }
.tag { display: inline-flex; align-items: center; padding: 4px 12px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; color: var(--text-muted); transition: all var(--transition); }
.tag:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); text-decoration: none; }

/* ── Feedback Card (standalone sibling in col-right) ── */
.article-feedback {
  padding: 24px 28px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-align: center;
  margin: 0; /* gap from .article-col-right handles spacing */
}
.feedback-question { font-size: 14.5px; font-weight: 600; margin-bottom: 14px; }
.feedback-actions  { display: flex; gap: 12px; justify-content: center; }
.feedback-btn  { display: flex; align-items: center; gap: 8px; }
.feedback-count { font-size: 12px; color: var(--text-muted); }
.feedback-thanks { color: var(--success); font-weight: 500; }

/* ── Related Articles Card (standalone sibling in col-right) ── */
.article-related {
  padding: 24px 28px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 0;
}
.related-title   { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--secondary); text-transform: uppercase; letter-spacing: .06em; }
.related-grid    { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.related-card    { display: block; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); transition: all var(--transition); }
.related-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-2px); text-decoration: none; }
.related-card h3  { font-size: 13.5px; font-weight: 600; color: var(--secondary); margin-bottom: 6px; line-height: 1.4; }
.related-card p   { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; }
.related-meta     { font-size: 11.5px; color: var(--text-light); display: flex; align-items: center; gap: 4px; }

/* Admin bar in article */
.article-admin-bar { padding: 12px 0; margin-top: 24px; border-top: 1px solid var(--border); }

/* ── Search Results ── */
.search-results-page { max-width: 780px; }
.search-results-header { margin-bottom: 24px; }
.page-title { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.page-title em { color: var(--primary); font-style: normal; }
.results-count { font-size: 14px; color: var(--text-muted); }
.search-bar-top { display: flex; gap: 10px; margin-bottom: 32px; }
.search-box--inline { flex: 1; }
.results-list { display: flex; flex-direction: column; gap: 2px; }
.result-card { display: block; padding: 20px; border-radius: var(--radius); transition: all var(--transition); border: 1px solid transparent; }
.result-card:hover { background: var(--bg-subtle); border-color: var(--border); text-decoration: none; }
.result-breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-light); margin-bottom: 5px; flex-wrap: wrap; }
.result-breadcrumb svg { flex-shrink: 0; }
.result-title   { font-size: 17px; font-weight: 600; color: var(--secondary); margin-bottom: 6px; }
.result-excerpt { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 10px; }
.result-meta    { display: flex; align-items: center; gap: 16px; font-size: 12.5px; color: var(--text-light); }
mark { background: #fef9c3; padding: 0 2px; border-radius: 2px; }

/* ── Profile Page ── */
.profile-page { max-width: 760px; margin: 0 auto; }
.profile-header { display: flex; align-items: center; gap: 20px; margin-bottom: 28px; }
.profile-avatar-lg {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
}
.profile-title  { font-size: 22px; font-weight: 700; color: var(--secondary); margin-bottom: 3px; }
.profile-email  { font-size: 14px; color: var(--text-muted); }
.profile-alert  { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.profile-cards  { display: flex; flex-direction: column; gap: 20px; }
.profile-card   {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 32px;
  box-shadow: var(--shadow-sm);
}
.profile-card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 22px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}
.profile-card-header svg { color: var(--primary); flex-shrink: 0; }
.profile-card-header h2 { font-size: 15px; font-weight: 700; color: var(--secondary); }
.profile-form { display: flex; flex-direction: column; gap: 0; }
.profile-form-footer { margin-top: 20px; }

/* ── Profile Modal ── */
.modal-profile-head {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 18px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}
.modal-profile-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.modal-profile-info strong { font-size: 15px; font-weight: 700; color: var(--secondary); }
.modal-profile-info span   { font-size: 13px; color: var(--text-muted); }

/* Feedback bar (success / error) */
.profile-feedback-bar {
  padding: 9px 13px; border-radius: var(--radius-xs);
  font-size: 13px; font-weight: 500; margin-bottom: 14px;
}
.profile-feedback-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.profile-feedback-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* Tabs */
.modal-tabs {
  display: flex; gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.modal-tab {
  padding: 8px 14px; font-size: 13.5px; font-weight: 500;
  color: var(--text-muted); border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  border: none; background: none; cursor: pointer;
  position: relative; bottom: -2px;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.modal-tab:hover { color: var(--text); }
.modal-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Ensure dropdown-item works as button */
button.dropdown-item { width: 100%; text-align: left; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 40px; }
.page-btn  { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius-xs); font-size: 13.5px; color: var(--text); transition: all var(--transition); }
.page-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); text-decoration: none; }
.page-info { font-size: 13.5px; color: var(--text-muted); padding: 0 8px; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge-published { background: #dcfce7; color: #15803d; }
.badge-draft     { background: #f1f5f9; color: #475569; }
.badge-review    { background: #fef9c3; color: #854d0e; }
.badge-archived  { background: #fee2e2; color: #991b1b; }
.badge-pending   { background: #ffedd5; color: #c2410c; }
.badge-featured  { background: #fef3c7; color: #92400e; }
.badge-warning   { background: #fef9c3; color: #854d0e; }
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-xs { font-size: 10px; padding: 1px 6px; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
.modal-overlay:not([hidden]) { display: flex; animation: fadeIn .2s ease; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-modal); width: 100%; max-width: 440px; position: relative; animation: slideUp .25s cubic-bezier(.34,1.56,.64,1); }
.modal-sm { max-width: 360px; }
.modal-body { padding: 32px; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: all var(--transition); }
.modal-close:hover { background: var(--bg-subtle); color: var(--text); }
.modal-icon { width: 56px; height: 56px; background: var(--primary-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--primary); margin: 0 auto 20px; }
.modal-icon--success { background: #dcfce7; color: #15803d; }
.modal-title    { font-size: 20px; font-weight: 700; text-align: center; margin-bottom: 8px; }
.modal-subtitle { font-size: 14px; color: var(--text-muted); text-align: center; margin-bottom: 24px; line-height: 1.5; }
.modal-links    { display: flex; justify-content: center; gap: 12px; margin-top: 16px; font-size: 13px; }
.modal-links a  { color: var(--primary); }
.modal-back     { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); margin-bottom: 20px; padding: 4px 0; }
.modal-back:hover { color: var(--primary); }

/* ── Magic Login Toggle ───────────────────────────────── */
.login-method-toggle {
  display: flex; gap: 6px;
  background: var(--bg-secondary, #f3f4f6);
  border-radius: 10px; padding: 4px; margin-bottom: 20px;
}
.login-method-btn {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 9px 12px; border-radius: 7px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted, #6b7280);
  background: transparent; border: none; cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.login-method-btn.is-active {
  background: #fff; color: var(--primary, #2563eb);
  font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.10);
}
.login-method-btn:not(.is-active):hover { color: var(--text, #111827); }
.modal-actions  { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.input-password-wrap { position: relative; }
.toggle-password { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); padding: 4px; }
.spinner { animation: spin .8s linear infinite; }

/* ── Empty State / Error ── */
.empty-state { text-align: center; padding: 64px 20px; }
.empty-state svg { color: var(--text-light); margin-bottom: 16px; }
.empty-state h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.empty-state p  { color: var(--text-muted); margin-bottom: 20px; }
.search-tips    { list-style: disc; display: inline-block; text-align: left; margin: 12px 0 20px; color: var(--text-muted); font-size: 14px; }
.error-page     { display: flex; justify-content: center; }
.error-inner    { text-align: center; max-width: 440px; }
.error-code     { font-size: 96px; font-weight: 800; color: var(--primary-light); line-height: 1; margin-bottom: -16px; }
.error-title    { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.error-desc     { color: var(--text-muted); margin-bottom: 28px; }
.error-actions  { display: flex; gap: 12px; justify-content: center; }

/* ── Footer ── */
.site-footer {
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 45%, #7c3aed 100%);
  padding: 40px 0;
  margin-top: 60px;
}
.footer-inner {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; text-align: center;
}
.footer-copy { font-size: 13.5px; color: rgba(255,255,255,.75); }
.footer-panel-link {
  color: rgba(255,255,255,.92);
  font-size: 14px; font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.35);
  padding-bottom: 2px;
  transition: color .15s, border-color .15s;
}
.footer-panel-link:hover { color: #fff; border-color: rgba(255,255,255,.8); }
.footer-contact a { color: rgba(255,255,255,.65); font-size: 13px; text-decoration: none; }
.footer-contact a:hover { color: #fff; }

/* ── Section/Category/Subcategory listing pages ── */
.content-listing { max-width: 900px; margin: 0 auto; padding: 40px 24px; }

/* Two-column listing layout (re-uses .article-page + .article-layout from article pages) */
.listing-col { min-width: 0; }
.listing-card {
  padding: 32px 40px 48px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.listing-section-heading {
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--text-light);
	margin-bottom: 14px;
	margin-top: 20px;
}

.listing-header  { margin-bottom: 32px; }
.listing-header h1 { font-size: 28px; font-weight: 700; margin-bottom: 10px; }
.listing-header p  { color: var(--text-muted); font-size: 15px; }
.listing-grid { display: flex; flex-direction: column; gap: 12px; }
.listing-item { display: flex; align-items: center; gap: 14px; padding: 18px 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); transition: all var(--transition); text-decoration: none; color: var(--text); }
.listing-item:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateX(4px); text-decoration: none; }
.listing-item-info { flex: 1; min-width: 0; }
.listing-item-info h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.listing-item-info p  { font-size: 13px; color: var(--text-muted); }
.listing-item-meta    { margin-left: auto; font-size: 12.5px; color: var(--text-light); white-space: nowrap; }

/* ── Animations ── */
@keyframes fadeIn   { from { opacity: 0; }          to { opacity: 1; } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin     { to { transform: rotate(360deg); } }
.animate-up { opacity: 0; transform: translateY(24px); animation: revealUp .55s cubic-bezier(.4,0,.2,1) forwards; }
.animate-delay-1 { animation-delay: .1s; }
.animate-delay-2 { animation-delay: .2s; }
.animate-delay-3 { animation-delay: .3s; }
.animate-delay-4 { animation-delay: .4s; }
@keyframes revealUp { to { opacity: 1; transform: translateY(0); } }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .article-main { padding: 32px 36px 44px; }
  .listing-card  { padding: 28px 32px 44px; }
}

/* Tablet: sidebar collapses */
@media (max-width: 900px) {
  .article-page { padding: 16px 0 48px; }
  .article-layout { grid-template-columns: 1fr; gap: 16px; padding: 0 16px; }
  .article-sidebar { /* becomes its own block */ }
  .sidebar-inner {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 14px 14px 16px;
  }
  .sidebar-toggle-mobile {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; background: var(--bg-subtle);
    border: 1px solid var(--border); border-radius: var(--radius-xs);
    font-size: 14px; font-weight: 500; width: 100%; margin-bottom: 10px;
  }
  #sidebar-tree { display: none; }
  #sidebar-tree.is-open { display: block; }
  .article-main { padding: 24px 20px 36px; }
  .listing-card  { padding: 24px 20px 36px; }
}

@media (max-width: 768px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .search-form { flex-direction: column; }
  .search-btn  { width: 100%; }
  .header-nav, .topbar-username { display: none; }
  .hamburger { display: flex; }
  .header-actions { display: none; }
  /* Mobile: header vira flex de 2 colunas, busca some */
  .header-inner {
    grid-template-columns: 1fr auto;
  }
  .header-search-center { display: none; }
  .header-right .user-name { display: none; }
  .hero { padding: 60px 0 100px; }
  .section-py { padding: 48px 0; }
  .form-row { flex-direction: column; }
  .cmd-trigger { display: none; } /* header has hamburger only */
}

@media (max-width: 480px) {
  .cards-grid { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
  .article-page { padding: 12px 0 40px; }
  .article-layout { padding: 0 12px; }
  .article-main { padding: 18px 16px 32px; }
  .listing-card  { padding: 18px 16px 32px; }
  .sidebar-inner { padding: 12px 12px 14px; }
  .modal-body { padding: 24px; }
  .cmd-modal { border-radius: 12px; }
}

/* ============================================================
   DOCUMENTAÇÃO INTERNA — Bloco exclusivo para admins (home)
   ============================================================ */

.internal-docs-section {
  background: #F0F4FF;
  border-bottom: 1px solid #E0E7FF;
  padding-top: 40px;
  padding-bottom: 40px;
}

.internal-docs-header {
  margin-bottom: 28px;
}

.internal-docs-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1E293B;
  color: #E2E8F0;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.internal-docs-subtitle {
  font-size: 14.5px;
  color: var(--text-muted, #6B7280);
  margin-top: 4px;
}

/* Grid das seções internas */
.internal-docs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

/* Card individual */
.internal-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-left: 3px solid #1E293B;
  border-radius: 10px;
  padding: 16px 18px;
  text-decoration: none;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
  position: relative;
}

.internal-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  transform: translateY(-2px);
  border-left-color: #4338CA;
  text-decoration: none;
}

.internal-card-icon {
  width: 42px; height: 42px;
  border-radius: 8px;
  background: #F1F5F9;
  color: #475569;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.internal-card-icon svg { width: 20px; height: 20px; }

.internal-card-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}

.internal-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.internal-card-desc {
  font-size: 12.5px;
  color: #6B7280;
  line-height: 1.4;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.internal-card-meta {
  font-size: 11.5px;
  color: #9CA3AF;
  margin-top: 4px;
}

.internal-card-arrow {
  color: #CBD5E1;
  flex-shrink: 0;
  transition: color .18s, transform .18s;
}

.internal-card:hover .internal-card-arrow {
  color: #4338CA;
  transform: translateX(3px);
}

/* ── Toggle switch (usado no admin) ── */
.toggle-switch-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  padding: 12px 14px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  background: #F9FAFB;
  transition: background .15s, border-color .15s;
}
.toggle-switch-label:hover {
  background: #F3F4F6;
  border-color: #D1D5DB;
}
.toggle-switch-input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-switch-track {
  position: relative;
  width: 38px; height: 22px;
  background: #D1D5DB;
  border-radius: 999px;
  flex-shrink: 0;
  margin-top: 2px;
  transition: background .2s;
}
.toggle-switch-input:checked + .toggle-switch-track { background: #4338CA; }
.toggle-switch-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s;
}
.toggle-switch-input:checked + .toggle-switch-track .toggle-switch-thumb {
  transform: translateX(16px);
}
.toggle-switch-text strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 2px;
}
.toggle-switch-text small {
  font-size: 12px;
  color: #6B7280;
}

/* ── Badge interna na tabela admin ── */
.badge-internal-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: #1E293B;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  border-radius: 999px;
  padding: 2px 8px;
}

/* =========================================================
   BOTÃO VOLTAR AO TOPO
   ========================================================= */
.back-to-top {
  position: fixed;
  bottom: 36px;
  right: 32px;
  z-index: 900;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(79, 70, 229, .35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .28s ease, visibility .28s ease, transform .28s ease, background .18s ease, box-shadow .18s ease;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #4338CA;
  box-shadow: 0 6px 22px rgba(79, 70, 229, .45);
}

.back-to-top:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(79, 70, 229, .3);
}

@media (max-width: 640px) {
  .back-to-top {
    bottom: 20px;
    right: 18px;
    width: 40px;
    height: 40px;
  }
}
