/* ============================================================================
   panel/fx-chrome.css — CHROME do "Jabuti HUD": sidebar DROPDOWN + header glass
   ----------------------------------------------------------------------------
   O QUE É ESTE ARQUIVO
     A moldura de navegação do painel, no estilo Linear:
       1. Sidebar em DROPDOWN (decisão do usuário 2026-11-24): fora da tela por
          padrão, entra por cima do conteúdo quando o JS grava
          data-open="true" no #fxSidebar. Fechada = data-open="false".
          O colapso opcional (data-collapsed) reduz 248px → 64px no desktop.
       2. Header de vidro (.fx-header-glass) com blur/saturate e um spotlight
          radial que segue o cursor via --mx / --my.
       3. Deslocamento do conteúdo quando a sidebar está ABERTA (:root.fx-hud):
          248px aberta, 0 fechada. Quando recolhida, 64px.
       4. Botão .fx-toggle abre; .fx-overlay (escuro) fecha.

   VOCABULÁRIO CANÔNICO (fonte da verdade = panel/index.html + fx-motion.js)
     .fx-sidebar  .fx-brand  .fx-brand-mark  .fx-brand-text  .fx-brand-title
     .fx-brand-sub  .fx-collapse  .fx-nav  .fx-group  .fx-group-toggle
     .fx-group-body  .fx-group-caret  .fx-item  .fx-item-ico  .fx-item-label
     .fx-badge  .fx-badge-accent  .fx-stat  .fx-stat-label  .fx-stat-value
     .fx-sidebar-foot  .fx-sidebar-hint  .fx-toggle  .fx-overlay
     .fx-header-glass  .fx-reveal  .fx-in  .fx-spot-on
     Estados por atributo: #fxSidebar[data-open] / [data-collapsed],
     .fx-group-toggle[aria-expanded].

   O QUE ESTE ARQUIVO NÃO É
     NÃO altera style.css, theme.css, ui.css, ui-modern.css, menu-dashboard.css,
     login.css, command-search.css nem destructive-warning.css. É puramente
     ADITIVO: tudo vive sob as classes .fx-* e sob o escopo :root.fx-hud.

   DEPENDÊNCIAS
     Tokens --fx-* de panel/fx-aurora.css. Todos os var() têm fallback, então
     este arquivo funciona mesmo se carregar ANTES do fx-aurora.css.

   ACESSIBILIDADE (critério de aceite)
     - :focus-visible com anel visível em TODO item/botão da sidebar.
     - prefers-reduced-motion: reduce  → desliga TODAS as animações/transições.
     - prefers-contrast: more          → reforça bordas e texto secundário.
     - :root[data-theme="light"]       → versões claras legíveis da sidebar/header.
     - Texto sempre sobre painel/glass (nunca sobre gradiente cru); contraste AA.

   MEDIDAS (fonte única da verdade — não repita números soltos pelo arquivo)
     --fx-sidebar-w: 248px   (aberta)
     --fx-sidebar-mini: 64px (recolhida)
   ========================================================================== */

/* ── 0. TOKENS LOCAIS DO CHROME ──────────────────────────────────────────── */

:root {
  --fx-sidebar-w: 248px;
  --fx-sidebar-mini: 64px;

  /* Superfície da sidebar: card sólido (não translúcido) p/ texto AA */
  --fx-sidebar-bg: var(--fx-card, #11151c);
  --fx-sidebar-border: var(--fx-border, rgba(230, 232, 235, 0.10));
  --fx-sidebar-text: var(--fx-text, #e6e8eb);
  --fx-sidebar-muted: var(--fx-muted, #9aa3ae);

  /* Item ativo: acento dessaturado (não neon puro) */
  --fx-sidebar-active: var(--fx-indigo, #6366f1);
  --fx-sidebar-active-text: var(--fx-indigo-soft, #a5b4fc);
  --fx-sidebar-glow: rgba(99, 102, 241, 0.30);

  /* Header glass */
  --fx-header-bg: rgba(17, 21, 28, 0.62);
  --fx-header-border: rgba(255, 255, 255, 0.09);
  --fx-header-spot: rgba(99, 102, 241, 0.16);

  /* Anel de foco — visível sobre qualquer superfície */
  --fx-ring: color-mix(in srgb, var(--fx-indigo, #6366f1) 78%, #ffffff 22%);
  --fx-ring-halo: rgba(99, 102, 241, 0.35);

  /* Duração das transições do chrome */
  --fx-chrome-dur: 220ms;
  --fx-chrome-ease: cubic-bezier(0.32, 0.72, 0, 1);
}

/* Fallback para navegador sem color-mix(): anel indigo claro fixo. */
@supports not (color: color-mix(in srgb, #000 50%, #fff)) {
  :root {
    --fx-ring: #a5b4fc;
  }
}

/* ── 1. SIDEBAR EM DROPDOWN (fechada por padrão) ─────────────────────────── */

/*
 * Dropdown = painel que entra POR CIMA do conteúdo, ancorado à esquerda.
 * Fechada: translateX(-100%) (fora da tela, sem capturar clique).
 * Aberta:  #fxSidebar[data-open="true"] → translateX(0).
 * O JS (fx-motion.js) é quem grava data-open; o CSS só reage ao atributo.
 */
.fx-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 60;

  display: flex;
  flex-direction: column;
  gap: 6px;

  width: var(--fx-sidebar-w);
  padding: 14px 10px 12px;

  /* Superfície sólida: garante AA do texto, mesmo sobre a aurora */
  background-color: var(--fx-sidebar-bg);
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.035) 0%,
    rgba(255, 255, 255, 0) 34%
  );
  border-right: 1px solid var(--fx-sidebar-border);
  border-top: 1px solid var(--fx-sidebar-border);
  border-top-left-radius: 0;

  color: var(--fx-sidebar-text);
  font-size: 13.5px;
  line-height: 1.35;

  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;

  /* DROPDOWN: começa fora da tela */
  transform: translateX(-100%);
  box-shadow: none;

  transition:
    width var(--fx-chrome-dur) var(--fx-chrome-ease),
    padding var(--fx-chrome-dur) var(--fx-chrome-ease),
    transform var(--fx-chrome-dur) var(--fx-chrome-ease),
    box-shadow var(--fx-chrome-dur) var(--fx-chrome-ease);
}

/* ABERTA: data-open="true" (única fonte de verdade do dropdown) */
.fx-sidebar[data-open="true"] {
  transform: translateX(0);
  box-shadow:
    24px 0 60px -30px rgba(0, 0, 0, 0.85),
    1px 0 0 var(--fx-sidebar-border);
}

/* Barra de rolagem discreta dentro da sidebar */
.fx-sidebar::-webkit-scrollbar { width: 8px; }
.fx-sidebar::-webkit-scrollbar-track { background: transparent; }
.fx-sidebar::-webkit-scrollbar-thumb {
  background: rgba(230, 232, 235, 0.14);
  border-radius: 999px;
}
.fx-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(230, 232, 235, 0.24);
}

/* Recolhida: só ícones (64px) — estado por ATRIBUTO, não por classe */
.fx-sidebar[data-collapsed="true"] {
  width: var(--fx-sidebar-mini);
  padding-left: 8px;
  padding-right: 8px;
}

.fx-sidebar[data-collapsed="true"] .fx-item-label,
.fx-sidebar[data-collapsed="true"] .fx-badge,
.fx-sidebar[data-collapsed="true"] .fx-group-caret,
.fx-sidebar[data-collapsed="true"] .fx-group-toggle > span:not(.fx-group-caret),
.fx-sidebar[data-collapsed="true"] .fx-brand-text,
.fx-sidebar[data-collapsed="true"] .fx-sidebar-hint,
.fx-sidebar[data-collapsed="true"] .fx-stat-label {
  /* Esconde o texto mantendo o layout estável e sem "pular" o ícone */
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
}

.fx-sidebar[data-collapsed="true"] .fx-item,
.fx-sidebar[data-collapsed="true"] .fx-group-toggle,
.fx-sidebar[data-collapsed="true"] .fx-brand,
.fx-sidebar[data-collapsed="true"] .fx-stat {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

/* ── 1.1 Marca (.fx-brand / .fx-brand-mark / .fx-brand-text) ─────────────── */

.fx-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 8px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--fx-sidebar-border);
  color: var(--fx-sidebar-text);
  font-weight: 650;
  letter-spacing: 0.01em;
  text-decoration: none;
  border-radius: 10px;
}

.fx-brand:hover {
  background-color: var(--fx-hover, #171c24);
}

/* Selo da marca: glow indigo + halo (showcase) */
.fx-brand-mark {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 18px;
  line-height: 1;
  color: var(--fx-sidebar-active-text);
  background:
    radial-gradient(120% 120% at 30% 20%, rgba(99, 102, 241, 0.42), rgba(99, 102, 241, 0.08) 70%);
  border: 1px solid rgba(99, 102, 241, 0.38);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 18px -4px rgba(99, 102, 241, 0.55);
}

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

.fx-brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--fx-sidebar-text);
}

.fx-brand-sub {
  color: var(--fx-sidebar-muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Botão de recolher/expandir (fica à direita da marca) */
.fx-collapse {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: auto;
  padding: 0;

  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--fx-sidebar-muted);

  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;

  transition:
    background-color var(--fx-chrome-dur) var(--fx-chrome-ease),
    border-color var(--fx-chrome-dur) var(--fx-chrome-ease),
    color var(--fx-chrome-dur) var(--fx-chrome-ease);
}

.fx-collapse:hover {
  background-color: var(--fx-hover, #171c24);
  border-color: var(--fx-sidebar-border);
  color: var(--fx-sidebar-text);
}

.fx-sidebar[data-collapsed="true"] .fx-brand { justify-content: center; padding-left: 0; padding-right: 0; }
.fx-sidebar[data-collapsed="true"] .fx-collapse { margin-left: 0; }

/* ── 1.2 Navegação e grupos (.fx-nav / .fx-group / .fx-group-body) ───────── */

.fx-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-height: 0;
  padding-top: 4px;
}

.fx-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}

.fx-group:first-child { margin-top: 0; }

/* Cabeçalho de grupo = botão (aria-expanded / aria-controls no markup) */
.fx-group-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 30px;
  padding: 4px 8px;

  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--fx-sidebar-muted);

  font: inherit;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;

  transition:
    color var(--fx-chrome-dur) var(--fx-chrome-ease),
    background-color var(--fx-chrome-dur) var(--fx-chrome-ease);
}

.fx-group-toggle:hover {
  color: var(--fx-sidebar-text);
  background-color: var(--fx-hover, #171c24);
}

/* Caret: girado quando o grupo está aberto (aria-expanded no botão) */
.fx-group-caret {
  flex: 0 0 auto;
  display: inline-block;
  margin-left: auto;
  font-size: 10px;
  line-height: 1;
  transform: rotate(0deg);
  transform-origin: 50% 50%;
  transition: transform var(--fx-chrome-dur) var(--fx-chrome-ease);
}

.fx-group-toggle[aria-expanded="true"] .fx-group-caret {
  transform: rotate(180deg);
}

/* Grupo fechado: esconde a lista (o JS alterna aria-expanded) */
.fx-group-toggle[aria-expanded="false"] + .fx-group-body {
  display: none;
}

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

/* ── 1.3 Itens (.fx-item / .fx-item-ico / .fx-item-label / .fx-badge) ────── */

.fx-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 7px 10px 7px 12px;

  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 10px;

  color: var(--fx-sidebar-text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;

  transition:
    background-color var(--fx-chrome-dur) var(--fx-chrome-ease),
    border-color var(--fx-chrome-dur) var(--fx-chrome-ease),
    color var(--fx-chrome-dur) var(--fx-chrome-ease);
}

.fx-item:hover {
  background-color: var(--fx-hover, #171c24);
  color: var(--fx-sidebar-text);
}

.fx-item:active {
  transform: translateY(1px);
}

.fx-item-ico {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  font-size: 15px;
  line-height: 1;
  color: var(--fx-sidebar-muted);
  transition: color var(--fx-chrome-dur) var(--fx-chrome-ease);
}

.fx-item:hover .fx-item-ico {
  color: var(--fx-sidebar-text);
}

.fx-item-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: opacity var(--fx-chrome-dur) var(--fx-chrome-ease);
}

/* Contador pulsante */
.fx-badge {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;

  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.42);
  background-color: rgba(99, 102, 241, 0.18);

  color: var(--fx-sidebar-active-text);
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1;

  animation: fx-badge-pulse 2.4s ease-in-out infinite;
}

/* Badge de acento (memória): tom teal para diferenciar de contador comum */
.fx-badge-accent {
  border-color: rgba(45, 212, 191, 0.42);
  background-color: rgba(45, 212, 191, 0.16);
  color: var(--fx-teal, #2dd4bf);
}

/* Rodapé da sidebar: estatísticas + dica de somente-leitura */
.fx-sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
  padding: 10px 8px 2px;
  border-top: 1px solid var(--fx-sidebar-border);
  color: var(--fx-sidebar-muted);
  font-size: 11.5px;
}

.fx-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 20px;
}

.fx-stat-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fx-sidebar-muted);
}

.fx-stat-value {
  flex: 0 0 auto;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: var(--fx-num, tabular-nums);
  font-feature-settings: "tnum" 1;
  color: var(--fx-sidebar-text);
}

.fx-sidebar-hint {
  font-size: 11px;
  color: var(--fx-sidebar-muted);
  opacity: 0.9;
}

.fx-sidebar[data-collapsed="true"] .fx-sidebar-foot {
  align-items: center;
  padding-left: 0;
  padding-right: 0;
}

/* ── 2. ITEM ATIVO: glow + barra neon + entrada com mola ─────────────────── */

.fx-item.is-active {
  color: var(--fx-sidebar-active-text);
  background-color: var(--fx-hover, #171c24);
  border-color: rgba(99, 102, 241, 0.26);
  font-weight: 600;
  animation: fx-indicador-entra 420ms cubic-bezier(0.22, 1.4, 0.36, 1) both;
}

/* Glow radial animado atrás do item (não captura clique) */
.fx-item.is-active::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    120% 140% at 0% 50%,
    var(--fx-sidebar-glow) 0%,
    rgba(99, 102, 241, 0) 62%
  );
  animation: fx-glow-pulso 3.6s ease-in-out infinite;
}

/* Barra neon 3px na borda esquerda */
.fx-item.is-active::after {
  content: "";
  position: absolute;
  top: 50%;
  left: -1px;
  width: 3px;
  height: 60%;
  border-radius: 0 3px 3px 0;
  transform: translateY(-50%);
  pointer-events: none;
  background: linear-gradient(
    180deg,
    var(--fx-indigo, #6366f1) 0%,
    var(--fx-violet, #8b5cf6) 100%
  );
  box-shadow:
    0 0 6px rgba(99, 102, 241, 0.75),
    0 0 14px rgba(99, 102, 241, 0.45);
}

.fx-item.is-active .fx-item-ico {
  color: var(--fx-sidebar-active-text);
}

/* ── 3. HEADER GLASS + SPOTLIGHT NO CURSOR ───────────────────────────────── */

.fx-header-glass {
  position: relative;
  isolation: isolate;

  /* SHOWCASE: glass mais profundo + fio de luz na borda inferior */
  background-color: var(--fx-header-bg);
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0) 68%
  );
  border-bottom: 1px solid var(--fx-header-border);
  color: var(--fx-text, #e6e8eb);

  -webkit-backdrop-filter: blur(22px) saturate(165%);
  backdrop-filter: blur(22px) saturate(165%);

  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 18px 40px -28px rgba(0, 0, 0, 0.85);
}

/*
 * Spotlight: camada própria, atrás do conteúdo, segue --mx/--my (JS).
 * Acende só com .fx-spot-on (mouseenter) — evita halo parado no canto.
 */
.fx-header-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(
    620px circle at var(--mx, 50%) var(--my, 50%),
    var(--fx-header-spot),
    transparent 62%
  );
  opacity: 0;
  transition: opacity var(--fx-chrome-dur) var(--fx-chrome-ease);
}

.fx-header-glass.fx-spot-on::before { opacity: 1; }

/* Fallback: navegador sem backdrop-filter → fundo sólido (texto continua AA) */
@supports not ((backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px))) {
  .fx-header-glass {
    background-color: var(--fx-card, #11151c);
  }
}

/* ── 4. LAYOUT: conteúdo desloca SÓ com a sidebar aberta (:root.fx-hud) ──── */

/*
 * Sidebar = DROPDOWN: fechada, o conteúdo ocupa a largura toda (margin 0).
 * Aberta, o conteúdo desloca 248px para não ficar embaixo do painel.
 * O JS liga/desliga :root.fx-hud junto com data-open; o seletor
 * #fxSidebar[data-open="true"] ~ … funciona mesmo se a classe atrasar.
 *
 * Sem !important — :root.fx-hud tem especificidade maior que o seletor
 * simples (.header, .footer, ...) das folhas existentes.
 */
:root.fx-hud .header,
:root.fx-hud .brain-panel,
:root.fx-hud .chat-panel,
:root.fx-hud .footer {
  margin-left: var(--fx-sidebar-w);
  transition: margin-left var(--fx-chrome-dur) var(--fx-chrome-ease);
}

/*
 * Recolhida (data-collapsed): 248px → 64px.
 * O <aside> é irmão anterior de .header/.brain-panel/.chat-panel/.footer,
 * então o combinador ~ alcança os quatro.
 */
:root.fx-hud .fx-sidebar[data-collapsed="true"] ~ .header,
:root.fx-hud .fx-sidebar[data-collapsed="true"] ~ .brain-panel,
:root.fx-hud .fx-sidebar[data-collapsed="true"] ~ .chat-panel,
:root.fx-hud .fx-sidebar[data-collapsed="true"] ~ .footer {
  margin-left: var(--fx-sidebar-mini);
}

/* ── 5. BOTÃO QUE ABRE (.fx-toggle) + OVERLAY QUE FECHA (.fx-overlay) ────── */

/* Botão ☰: fica no canto superior esquerdo, acima do header */
.fx-toggle {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 90;

  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;

  background-color: var(--fx-glass, rgba(17, 21, 28, 0.72));
  border: 1px solid var(--fx-sidebar-border);
  border-radius: 11px;
  color: var(--fx-sidebar-text);

  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;

  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 10px 26px -18px rgba(0, 0, 0, 0.9);

  transition:
    background-color var(--fx-chrome-dur) var(--fx-chrome-ease),
    border-color var(--fx-chrome-dur) var(--fx-chrome-ease),
    transform var(--fx-chrome-dur) var(--fx-chrome-ease);
}

.fx-toggle:hover {
  background-color: var(--fx-hover, #171c24);
  border-color: rgba(99, 102, 241, 0.42);
}

.fx-toggle[aria-expanded="true"] {
  border-color: rgba(99, 102, 241, 0.52);
  color: var(--fx-sidebar-active-text);
}

/* Overlay escuro: o JS alterna o atributo hidden (clique fecha) */
.fx-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;

  background-color: rgba(5, 1, 15, 0.62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);

  cursor: pointer;
  transition: opacity var(--fx-chrome-dur) var(--fx-chrome-ease);
}

.fx-overlay[hidden] { display: none; }

/* ── 5.1 RESPONSIVO: abaixo de 900px o conteúdo nunca desloca ────────────── */

@media (max-width: 900px) {
  /* A gaveta fica POR CIMA: nada de margin-left no conteúdo */
  :root.fx-hud .header,
  :root.fx-hud .brain-panel,
  :root.fx-hud .chat-panel,
  :root.fx-hud .footer,
  :root.fx-hud .fx-sidebar[data-collapsed="true"] ~ .header,
  :root.fx-hud .fx-sidebar[data-collapsed="true"] ~ .brain-panel,
  :root.fx-hud .fx-sidebar[data-collapsed="true"] ~ .chat-panel,
  :root.fx-hud .fx-sidebar[data-collapsed="true"] ~ .footer {
    margin-left: 0;
  }

  /* No drawer o recolhimento não faz sentido: mostra rótulos */
  .fx-sidebar[data-collapsed="true"] {
    width: var(--fx-sidebar-w);
    padding-left: 10px;
    padding-right: 10px;
  }
  .fx-sidebar[data-collapsed="true"] .fx-item-label,
  .fx-sidebar[data-collapsed="true"] .fx-badge,
  .fx-sidebar[data-collapsed="true"] .fx-group-caret,
  .fx-sidebar[data-collapsed="true"] .fx-group-toggle > span:not(.fx-group-caret),
  .fx-sidebar[data-collapsed="true"] .fx-brand-text,
  .fx-sidebar[data-collapsed="true"] .fx-sidebar-hint,
  .fx-sidebar[data-collapsed="true"] .fx-stat-label {
    opacity: 1;
    width: auto;
    pointer-events: auto;
  }
  .fx-sidebar[data-collapsed="true"] .fx-item,
  .fx-sidebar[data-collapsed="true"] .fx-group-toggle,
  .fx-sidebar[data-collapsed="true"] .fx-brand,
  .fx-sidebar[data-collapsed="true"] .fx-stat {
    justify-content: flex-start;
    padding-left: 12px;
    padding-right: 10px;
  }
}

/* ── 6. FOCO VISÍVEL (todo item/botão da sidebar) ────────────────────────── */

.fx-sidebar a:focus-visible,
.fx-sidebar button:focus-visible,
.fx-sidebar [tabindex]:focus-visible,
.fx-item:focus-visible,
.fx-group-toggle:focus-visible,
.fx-brand:focus-visible,
.fx-collapse:focus-visible,
.fx-toggle:focus-visible,
.fx-overlay:focus-visible,
.fx-header-glass a:focus-visible,
.fx-header-glass button:focus-visible {
  outline: 2px solid var(--fx-ring);
  outline-offset: 2px;
  border-radius: 10px;
  box-shadow: 0 0 0 4px var(--fx-ring-halo);
}

/* Nunca remover o anel do teclado */
.fx-sidebar :focus:not(:focus-visible) {
  outline: none;
}

/* ── 7. KEYFRAMES ────────────────────────────────────────────────────────── */

/* Badge respira (opacidade + halo), sem mover layout */
@keyframes fx-badge-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.42);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 0 5px rgba(99, 102, 241, 0);
    opacity: 0.86;
  }
}

/* Glow do item ativo pulsa em intensidade */
@keyframes fx-glow-pulso {
  0%,
  100% { opacity: 0.55; }
  50%  { opacity: 1; }
}

/* Entrada do indicador/item ativo com mola (GPU: transform + opacity) */
@keyframes fx-indicador-entra {
  0% {
    opacity: 0;
    transform: translate3d(-8px, 0, 0) scale(0.985);
  }
  60% {
    opacity: 1;
    transform: translate3d(2px, 0, 0) scale(1.008);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* ── 8. prefers-reduced-motion: desliga TUDO que este arquivo anima ─────── */

@media (prefers-reduced-motion: reduce) {
  .fx-sidebar,
  .fx-item,
  .fx-group-toggle,
  .fx-group-caret,
  .fx-item-ico,
  .fx-item-label,
  .fx-collapse,
  .fx-toggle,
  .fx-overlay,
  .fx-header-glass::before,
  :root.fx-hud .header,
  :root.fx-hud .brain-panel,
  :root.fx-hud .chat-panel,
  :root.fx-hud .footer {
    transition: none;
  }

  .fx-item.is-active,
  .fx-item.is-active::before,
  .fx-badge {
    animation: none;
  }

  .fx-item.is-active::before { opacity: 0.8; }
  .fx-item:active { transform: none; }
}

/* ── 9. prefers-contrast: more — reforça bordas e texto ─────────────────── */

@media (prefers-contrast: more) {
  :root {
    --fx-sidebar-border: rgba(230, 232, 235, 0.34);
    --fx-sidebar-muted: #c3cad3;
    --fx-header-border: rgba(255, 255, 255, 0.28);
    --fx-header-bg: rgba(17, 21, 28, 0.92);
    --fx-ring: #ffffff;
    --fx-ring-halo: rgba(255, 255, 255, 0.45);
  }

  .fx-sidebar {
    border-right-width: 2px;
    border-top-width: 2px;
  }

  .fx-item,
  .fx-group-toggle,
  .fx-brand {
    border-color: rgba(230, 232, 235, 0.18);
  }

  .fx-item.is-active {
    border-color: var(--fx-sidebar-active-text);
    background-color: rgba(99, 102, 241, 0.22);
    color: #ffffff;
  }

  .fx-item.is-active .fx-item-ico { color: #ffffff; }

  .fx-badge {
    background-color: rgba(99, 102, 241, 0.34);
    border-color: #ffffff;
    color: #ffffff;
  }

  .fx-group-toggle { color: #e6e8eb; }

  .fx-header-glass {
    border-bottom-width: 2px;
    background-color: rgba(17, 21, 28, 0.92);
  }

  /* Spotlight decorativo atrapalha leitura em alto contraste */
  .fx-header-glass::before { display: none; }

  .fx-sidebar a:focus-visible,
  .fx-sidebar button:focus-visible,
  .fx-item:focus-visible,
  .fx-group-toggle:focus-visible,
  .fx-brand:focus-visible,
  .fx-collapse:focus-visible,
  .fx-toggle:focus-visible {
    outline-width: 3px;
  }
}

/* ── 10. TEMA CLARO: versões legíveis da sidebar/header ─────────────────── */

:root[data-theme="light"] {
  --fx-sidebar-bg: #ffffff;
  --fx-sidebar-border: rgba(15, 23, 42, 0.12);
  --fx-sidebar-text: #14181f;   /* AA sobre #ffffff */
  --fx-sidebar-muted: #4b5563;  /* AA sobre #ffffff */

  --fx-sidebar-active: #4f46e5;
  --fx-sidebar-active-text: #4338ca;
  --fx-sidebar-glow: rgba(79, 70, 229, 0.16);

  --fx-header-bg: rgba(255, 255, 255, 0.78);
  --fx-header-border: rgba(15, 23, 42, 0.10);
  --fx-header-spot: rgba(79, 70, 229, 0.10);

  --fx-ring: #4f46e5;
  --fx-ring-halo: rgba(79, 70, 229, 0.25);
}

:root[data-theme="light"] .fx-sidebar {
  background-image: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.03) 0%,
    rgba(15, 23, 42, 0) 34%
  );
  box-shadow: 1px 0 0 rgba(15, 23, 42, 0.05);
}

:root[data-theme="light"] .fx-sidebar::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.16);
}

:root[data-theme="light"] .fx-brand-mark {
  color: #4338ca;
  background: radial-gradient(
    120% 120% at 30% 20%,
    rgba(79, 70, 229, 0.18),
    rgba(79, 70, 229, 0.04) 70%
  );
  border-color: rgba(79, 70, 229, 0.30);
  box-shadow: 0 0 14px -6px rgba(79, 70, 229, 0.45);
}

:root[data-theme="light"] .fx-item.is-active {
  background-color: var(--fx-hover, #eef2f8);
  border-color: rgba(79, 70, 229, 0.26);
  color: #4338ca;
}

:root[data-theme="light"] .fx-item.is-active::before {
  background: radial-gradient(
    120% 140% at 0% 50%,
    rgba(79, 70, 229, 0.14) 0%,
    rgba(79, 70, 229, 0) 62%
  );
}

:root[data-theme="light"] .fx-item.is-active::after {
  background: linear-gradient(180deg, #4f46e5 0%, #6d28d9 100%);
  box-shadow:
    0 0 5px rgba(79, 70, 229, 0.55),
    0 0 12px rgba(79, 70, 229, 0.30);
}

:root[data-theme="light"] .fx-badge {
  border-color: rgba(79, 70, 229, 0.40);
  background-color: rgba(79, 70, 229, 0.12);
  color: #4338ca;
}

:root[data-theme="light"] .fx-badge-accent {
  border-color: rgba(15, 118, 110, 0.40);
  background-color: rgba(15, 118, 110, 0.12);
  color: #0f766e;
}

:root[data-theme="light"] .fx-overlay {
  background-color: rgba(15, 23, 42, 0.38);
}

:root[data-theme="light"] .fx-toggle {
  background-color: rgba(255, 255, 255, 0.82);
}

/* ── 11. IMPRESSÃO: sem chrome fixo ─────────────────────────────────────── */

@media print {
  .fx-sidebar,
  .fx-overlay,
  .fx-toggle {
    display: none !important;
  }

  .fx-header-glass {
    position: static;
    background: #fff;
    border-bottom: 1px solid #ccc;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .fx-header-glass::before { display: none; }

  :root.fx-hud .header,
  :root.fx-hud .brain-panel,
  :root.fx-hud .chat-panel,
  :root.fx-hud .footer,
  :root.fx-hud .fx-sidebar[data-collapsed="true"] ~ .header,
  :root.fx-hud .fx-sidebar[data-collapsed="true"] ~ .brain-panel,
  :root.fx-hud .fx-sidebar[data-collapsed="true"] ~ .chat-panel,
  :root.fx-hud .fx-sidebar[data-collapsed="true"] ~ .footer {
    margin-left: 0;
  }
}

/* ── 12. SHOWCASE: reveal dos cards e header de vidro ───────────────────── */

/*
 * .fx-reveal → o JS adiciona .fx-in quando o elemento entra na viewport.
 * Só transform/opacity (GPU). Sem JS (ou reduced-motion) o conteúdo aparece.
 */
.fx-reveal {
  opacity: 0;
  transform: translate3d(0, 18px, 0) scale(0.992);
  transition:
    opacity 520ms var(--fx-chrome-ease),
    transform 520ms var(--fx-chrome-ease);
  will-change: opacity, transform;
}

.fx-reveal.fx-in {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* Header com o HUD ligado: vidro por cima, sem empurrar o conteúdo */
:root.fx-hud .fx-header-glass {
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Sem backdrop-filter: superfície sólida (texto continua AA) */
@supports not ((backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px))) {
  .fx-header-glass {
    background-color: var(--fx-card, #11151c);
  }
}

/* reduced-motion: reveal aparece direto, sem deslizar */
@media (prefers-reduced-motion: reduce) {
  .fx-reveal {
    opacity: 1;
    transform: none;
    transition: none;
    will-change: auto;
  }
}

/* Alto contraste: reveal aparece direto (sem depender do observer) */
@media (prefers-contrast: more) {
  .fx-reveal {
    opacity: 1;
    transform: none;
  }
}
