/* ============================================================
   BRAIN — Design System Dark Premium
   Vercel / Linear / Supabase / Raycast inspired
   Accent: Red (use SOMENTE em elementos interativos/focais)
   ============================================================ */

:root {
  /* Superficies */
  --bg: #09090B;
  --bg-2: #0B0C0E;
  --surface: #121316;
  --surface-2: #18181B;

  /* Bordas / divisores (baixo contraste) */
  --border: #3A3A3F;          /* divisor de painel: 2,1:1, perceptivel */
  --border-sutil: #27272A;    /* divisor interno: sutileza intencional */
  --border-soft: rgba(255, 255, 255, 0.08);

  /* Texto */
  --text: #FAFAFA;
  --text-2: #D4D4D8;
  --text-3: #A1A1AA;
  --muted: #83838C;          /* 5:1 sobre a superficie — abaixo disso a legenda some */

  /* Accent vermelho — uso restrito */
  --accent: #EF4444;         /* texto/borda sobre fundo escuro */
  --accent-claro: #F87171;   /* numero e icone pequeno sobre veu vermelho */
  --accent-cheio: #C81E1E;   /* fundo de botao: branco em cima da 5,2:1 */
  --accent-cheio-hover: #A81919;
  --accent-hover: #DC2626;
  --accent-active: #E11D48;
  --accent-soft: rgba(239, 68, 68, 0.12);
  --accent-ring: rgba(239, 68, 68, 0.45);

  /* Semantic */
  --danger: #EF4444;
  --ok: #22C55E;

  /* Shape */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 150ms;
  --t-med: 200ms;


  /* Escala tipografica modular — razao 1.200 sobre base 16px.
     Antes eram 16 tamanhos avulsos em px (ate um 13.5px), zero em rem.
     rem faz a interface respeitar quem aumentou a fonte no navegador. */
  --fs-1: 0.579rem;   /*  9.3px  microetiquetas   */
  --fs-2: 0.694rem;   /* 11.1px  etiquetas, meta  */
  --fs-3: 0.833rem;   /* 13.3px  UI, botoes, chat */
  --fs-4: 1rem;       /* 16.0px  corpo            */
  --fs-5: 1.2rem;     /* 19.2px  titulo de secao  */
  --fs-6: 1.44rem;    /* 23.0px  titulo           */
  --fs-7: 1.728rem;   /* 27.6px  destaque         */

  --font: "Inter", "Geist", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  font-size: var(--fs-4);
}

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

/* ============================================================
   NAVBAR
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

/*
  O cabeçalho é o mesmo em toda página: largura cheia e a MESMA margem lateral
  das colunas (16px). Antes ele era um bloco centrado de 1200px em duas telas e
  cheio na terceira — a marca pulava de lugar ao navegar, e no escritório o ☰
  ficava no meio da tela, longe da coluna que ele abre.
*/
.nav-inner {
  max-width: none;
  margin: 0;
  padding: 0 16px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: var(--fs-4);
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand:hover { color: var(--text); }

.brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.nav-link {
  color: var(--text-3);
  font-size: var(--fs-3);
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--text); }

.nav-spacer { flex: 1; }

/* Busca compacta no nav (desktop) */
.nav-search {
  position: relative;
  width: 220px;
}

.nav-search svg {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.nav-search input {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-3);
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.nav-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-3);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.btn:hover { border-color: var(--text-3); }

/* Botão cheio usa um vermelho mais fundo que o --accent: branco sobre #EF4444
   dá 3,7:1 e não passa em texto normal. Com #C81E1E vai a 5,2:1. */
.btn.primary {
  background: var(--accent-cheio);
  border-color: var(--accent-cheio);
  color: #fff;
  font-weight: 600;
}

.btn.primary:hover { background: var(--accent-cheio-hover); border-color: var(--accent-cheio-hover); }
.btn.primary:active { background: var(--accent-cheio-hover); }

.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }

.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: rgba(239, 68, 68, 0.12); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

.btn-sm { padding: 8px 12px; font-size: var(--fs-3); }

/* Botões secos (flat/ghost) no laboratório */
.lab-body .btn {
  background: transparent;
  border: none;
  color: var(--text-2);
  border-radius: var(--radius-sm);
}
.lab-body .btn:hover { background: var(--surface-2); color: var(--text); }
.lab-body .btn.primary {
  background: var(--accent-cheio);
  border-color: var(--accent-cheio);
  color: #fff;
  font-weight: 600;
}
.lab-body .btn.primary:hover {
  background: var(--accent-cheio-hover);
  border-color: var(--accent-cheio-hover);
  color: #fff;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 72px 24px 40px;
  text-align: center;
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-3);
  font-weight: 500;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 16px;
  margin-bottom: 20px;
  background: var(--surface);
}

.hero .eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--text);
}

.hero h1 .accent { color: var(--accent); }

.hero p.sub {
  margin: 16px auto 0;
  max-width: 520px;
  font-size: var(--fs-4);
  color: var(--text-3);
}

/* Barra de busca grande no hero */
.hero-search {
  position: relative;
  max-width: 600px;
  margin: 32px auto 0;
}

.hero-search svg {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.hero-search input {
  width: 100%;
  padding: 16px 48px 16px 16px;
  font-size: var(--fs-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease), background var(--t-med) var(--ease);
}

.hero-search input::placeholder { color: var(--muted); }
.hero-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* ============================================================
   FILTROS (pills / tabs)
   ============================================================ */
.filtros {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 24px 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.pill {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-3);
  font-size: var(--fs-3);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}

.pill:hover { color: var(--text); border-color: var(--text-3); }

.pill.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ============================================================
   GRADE DE CARDS
   ============================================================ */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 72px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-head h2 { margin: 0; font-size: var(--fs-5); letter-spacing: -0.02em; }
.section-head .count { color: var(--muted); font-size: var(--fs-3); }

.grade {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}

.card:hover { border-color: var(--accent); transform: translateY(-2px); }

.card .card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.card .nome { margin: 0; font-size: var(--fs-4); font-weight: 600; letter-spacing: -0.01em; color: var(--text); }

.card .icone {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-weight: 700;
  font-size: var(--fs-4);
}

.card .resumo {
  margin: 0;
  color: var(--text-3);
  font-size: var(--fs-3);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card .tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.tag {
  font-size: var(--fs-2);
  font-weight: 500;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 999px;
}

.tag.skill { color: var(--ok); border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.08); }
.tag.modelo { color: var(--accent); border-color: rgba(239, 68, 68, 0.3); background: var(--accent-soft); }

.card .cta {
  margin-top: 8px;
  color: var(--text-3);
  font-size: var(--fs-3);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color var(--t-fast) var(--ease);
}

.card:hover .cta { color: var(--accent); }

/* Estado vazio */
.vazio {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-3);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

.vazio strong { color: var(--text); }

/* ============================================================
   PÁGINA DETALHADA
   ============================================================ */
.page-head {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 8px;
}

.page-head .voltar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: var(--fs-3);
  margin-bottom: 24px;
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: color var(--t-fast) var(--ease);
}

.page-head .voltar:hover { color: var(--text); }

.agente-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.agente-hero .topo { display: flex; align-items: center; gap: 16px; }

.agente-hero .icone-grande {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: var(--fs-6);
  font-weight: 700;
  color: var(--text);
}

.agente-hero h1 { margin: 0; font-size: var(--fs-7); letter-spacing: -0.02em; }
.agente-hero .tags { margin-top: 12px; }
.agente-hero .resumo { color: var(--text-3); margin: 8px 0 0; }

/* Layout do corpo da página de detalhe */
.page-body {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 24px 72px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.panel h3 { margin: 0 0 16px; font-size: var(--fs-4); font-weight: 600; letter-spacing: -0.01em; }

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.form-group { margin-bottom: 16px; }

label { display: block; font-weight: 500; font-size: var(--fs-3); color: var(--text-2); margin-bottom: 8px; }

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text);
  font-size: var(--fs-3);
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

select option { background: var(--surface); color: var(--text); }

textarea { resize: vertical; min-height: 90px; }
textarea.code { font-family: "Consolas", ui-monospace, monospace; font-size: var(--fs-3); min-height: 170px; line-height: 1.55; }

.hint { font-size: var(--fs-3); color: var(--muted); margin-top: 8px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* Skill / markdown */
.skill-box { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-2); overflow: hidden; }
.skill-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 16px; flex-wrap: wrap; }
.skill-preview { padding: 16px; max-height: 320px; overflow: auto; font-size: var(--fs-3); line-height: 1.55; color: var(--text-2); border-top: 1px solid var(--border); }
.skill-preview h1, .skill-preview h2, .skill-preview h3 { line-height: 1.2; color: var(--text); }
.skill-preview code { background: rgba(255, 255, 255, 0.08); padding: 1px 4px; border-radius: 4px; }
.skill-preview pre { background: var(--bg); padding: 8px; border-radius: 6px; overflow: auto; }

/* ============================================================
   CHAT / PREVIEW (modal)
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-backdrop.aberta { display: flex; }

.chat-janela {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.chat-topo h3 { margin: 0; font-size: var(--fs-4); }
.chat-topo .fechar { background: none; border: none; color: var(--muted); font-size: var(--fs-6); cursor: pointer; line-height: 1; }
.chat-topo .fechar:hover { color: var(--text); }

.chat-corpo {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-2);
}

.msg {
  max-width: 78%;
  padding: 8px 16px;
  border-radius: 14px;
  font-size: var(--fs-3);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.usuario { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; max-width: 70%; }
.msg.assistente { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.sistema {
  align-self: center;
  max-width: 68ch;              /* largura de leitura: linha cheia de ponta a ponta cansa */
  background: transparent;
  color: var(--text-3);
  font-size: var(--fs-3);
  text-align: center;
  border-radius: 999px;
  padding: 8px 16px;
}

.msg.assistente table { border-collapse: collapse; margin: 8px 0; }
.msg.assistente table td, .msg.assistente table th { border: 1px solid var(--border); padding: 4px 8px; }
.msg.assistente code { background: rgba(255,255,255,0.08); padding: 1px 4px; border-radius: 4px; }
.msg.assistente pre { background: var(--bg); padding: 8px; border-radius: 6px; overflow: auto; }

.chat-entrada {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  background: transparent;
  flex-shrink: 0;
}

.chat-entrada input { flex: 1; }

/* pílula do agente ativo */
.agente-ativo {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: var(--fs-3);
  font-weight: 600;
}
.agente-ativo-nome {
  color: var(--text);
}
.agente-ativo-fechar {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: var(--fs-4);
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 50%;
}
.agente-ativo-fechar:hover { color: var(--text); background: var(--border-soft); }

/* botão parar */
.btn-parar {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
}
.btn-parar:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.6);
}
/* Parar fica sempre na barra: quando nao ha nada rodando, apaga em vez de sumir. */
.btn-parar:disabled {
  color: var(--text-3);
  border-color: var(--border);
}
.btn-parar:disabled:hover {
  background: transparent;
  border-color: var(--border);
}

/* input ultra-minimalista (laboratório) */
.lab-body .chat-entrada input {
  background: rgba(255,255,255,0.05);
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
}
.lab-body .chat-entrada input:focus {
  border: none;
  box-shadow: 0 0 0 2px var(--accent-ring);
}

/* Tipografia discreta do chat (laboratório) */
.lab-body .chat-corpo .msg,
.lab-body .zmsg { font-size: var(--fs-3); }

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: giro 0.7s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes giro { to { transform: rotate(360deg); } }

.erro { color: var(--danger); font-size: var(--fs-3); }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ok);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  display: none;
  z-index: 200;
  font-weight: 500;
  font-size: var(--fs-3);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* ============================================================
   LABORATÓRIO — faixa de ambiente + chat
   ============================================================ */
body.lab-body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; padding: 12px 16px 16px; box-sizing: border-box; }

/* wrapper central: painel integrado/transparente com cena + chat */
.lab-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  overflow: hidden;
}

.ambiente {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.ambiente-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  overflow-x: auto;
}

.ambiente-titulo {
  font-size: var(--fs-3);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}

.ambiente-agentes { display: flex; gap: 8px; align-items: center; }

.amb-agente {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--fs-3);
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  flex-shrink: 0;
}

.amb-agente:hover { border-color: var(--text-3); color: var(--text); }

.amb-agente.comando { border-color: var(--accent); color: var(--text); }

.amb-agente.chamado {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  animation: chamadoPulso 0.5s var(--ease);
}

.amb-agente .amb-icone {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-2);
  font-weight: 700;
  flex-shrink: 0;
}

.amb-agente.chamado .amb-icone { background: var(--accent); color: #fff; }

.amb-agente.em-chat {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.amb-agente.em-chat .amb-icone { background: var(--accent); color: #fff; }
.amb-agente.em-chat .amb-status { display: inline-block; }

.amb-status {
  display: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 2px;
}

@keyframes chamadoPulso {
  0% { box-shadow: 0 0 0 0 var(--accent-ring); }
  100% { box-shadow: 0 0 0 12px transparent; }
}

/* Mensagem de agente delegado no chat */
.msg.agente {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-left: 3px solid var(--accent);
  border-bottom-left-radius: 4px;
}

.msg.agente .msg-agente-nome {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-3);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

.msg.consolidacao {
  align-self: flex-start;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-left: 3px solid var(--ok);
}

.msg.consolidacao .msg-titulo {
  font-size: var(--fs-3);
  font-weight: 700;
  color: var(--ok);
  margin-bottom: 8px;
}

/* Resultado de edicao de arquivo (aprovada pelo Comando) */
.msg.edicao {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--ok);
  border-left: 3px solid var(--ok);
  border-bottom-left-radius: 4px;
}

.msg.edicao.erro {
  border: 1px solid var(--danger);
  border-left: 3px solid var(--danger);
}

.msg.edicao .msg-titulo {
  font-size: var(--fs-3);
  font-weight: 700;
  color: var(--ok);
}

.msg.edicao.erro .msg-titulo {
  color: var(--danger);
}

.msg.edicao .edicao-detalhe {
  font-size: var(--fs-3);
  color: var(--text-3);
  margin-top: 4px;
  word-break: break-all;
}

.provedor-tag {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: var(--fs-2);
  font-weight: 600;
}

/* Chat em altura total */
/*
  A largura da sala manda na coluna do meio (--sala-larg é escrita pelo
  escritorio.js a cada mudança de escala). Assim o título da conversa, as falas
  e a barra de envio ficam alinhados com as bordas do canvas em vez de cada um
  começar num lugar.
*/
.lab-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: var(--sala-larg, 900px);
  margin: 0 auto;
}
.lab-chat .chat-corpo { flex: 1; }

/* Coluna central do chat (estilo Zed) */
.chat-coluna {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}
.lab-chat .chat-coluna .chat-corpo { flex: 1; padding: 20px; gap: 8px; overflow-y: auto; }

/* Cabeçalho do laboratório (estilo Zed) */
.chat-topo-lab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: transparent;
  flex-shrink: 0;
}
.chat-topo-lab-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-3);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}
.chat-topo-lab-titulo .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.chat-topo-lab-sub {
  font-size: var(--fs-3);
  font-weight: 400;
  color: var(--muted);
  margin-left: 4px;
}
.chat-topo-lab-controles { display: flex; align-items: center; gap: 8px; }

/* Blocos de mensagem estilo Zed (flat, sem caixa, nomes coloridos) */
.zmsg {
  padding: 2px 0;
}
.zmsg + .zmsg {
  margin-top: 2px;
}
.zmsg-cab {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: var(--text);
}
.zmsg-cab:hover { background: transparent; }
.zmsg-titulo {
  font-size: var(--fs-3);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.zmsg-sub { font-size: var(--fs-2); color: var(--muted); flex-shrink: 0; }
.zmsg-caret {
  margin-left: auto;
  font-size: var(--fs-2);
  color: var(--muted);
  transition: transform var(--t-fast) var(--ease);
}
.zmsg.minimizado .zmsg-caret { transform: rotate(-90deg); }
.zmsg.minimizado .zmsg-corpo {
  max-width: 68ch;   /* 50-75 caracteres por linha; antes era ilimitado */ display: none; }
.zmsg-corpo {
  max-width: 68ch;   /* 50-75 caracteres por linha; antes era ilimitado */
  padding: 2px 0 8px;
  font-size: var(--fs-3);
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.zmsg-corpo pre { background: var(--bg); padding: 8px; border-radius: 6px; overflow: auto; }
.zmsg-corpo code { background: rgba(255,255,255,0.08); padding: 1px 4px; border-radius: 4px; }

/* variantes — sem moldura, só cor no titulo (aplicada via JS com corAgente) */
.zmsg.usuario-pedido .zmsg-cab { cursor: default; }
.zmsg.usuario-pedido .zmsg-titulo { color: var(--danger); }
.zmsg.usuario-pedido .zmsg-corpo {
  max-width: 68ch;   /* 50-75 caracteres por linha; antes era ilimitado */ color: var(--danger); }
.zmsg.edicao .zmsg-cab { cursor: default; }
.zmsg.edicao .edicao-detalhe { font-size: var(--fs-3); color: var(--text-3); word-break: break-all; }

/* Marcação de agente chamado no texto */
.ag-marcacao {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--accent);
  font-weight: 600;
  padding: 0 8px;
  border-radius: 999px;
  font-size: var(--fs-3);
  cursor: pointer;
}

.ag-marcacao:hover { background: var(--accent); color: #fff; }

/* Card de agente (modal) */
.card-janela {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-corpo { padding: 20px; overflow-y: auto; }

.card-corpo .card-icone {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-5);
  font-weight: 700;
  color: var(--text);
}

.card-corpo .card-detalhe { color: var(--text-3); font-size: var(--fs-3); margin: 4px 0 0; }
.card-corpo .card-resumo { color: var(--text-2); font-size: var(--fs-3); margin: 8px 0 0; line-height: 1.5; }
.card-corpo .card-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.card-corpo .card-acoes { margin-top: 16px; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-3);
}

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */
@media (max-width: 768px) {
  .nav-inner { padding: 0 16px; gap: 16px; }
  .nav-links { display: none; }
  .nav-search { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .hero { padding-top: 48px; }
  .card { padding: 16px; }
}

@media (max-width: 480px) {
  .grade { grid-template-columns: 1fr; }
  .agente-hero { padding: 20px; }
}

.escritorio {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 16px;
  z-index: 5;
}

/* botão do escritório, agora na barra de entrada do chat */
.escritorio-toggle {
  position: relative;
  z-index: 6;
  width: 44px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.escritorio-toggle:hover { background: var(--surface-2); }
.escritorio-toggle-linha { font-size: var(--fs-1); font-weight: 700; letter-spacing: 0.02em; color: var(--text-2); }
.escritorio-toggle-seta { font-size: var(--fs-1); color: var(--accent); }

.escritorio-cena {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 0;
  padding: 8px;
  transition: height 0.2s var(--ease), opacity 0.2s var(--ease);
}
.escritorio.colapsado .escritorio-cena { display: none; }
.escritorio.colapsado { flex: 0 0 auto; }

/* ============ A SALA (canvas top-down) ============ */
/*
  A cena virou um canvas: os agentes andam de verdade, com caminho no grid.
  O tamanho é definido pelo JS em escala INTEIRA (2x ou 3x) — pixel art só
  fica nítida em múltiplo exato, por isso nada de width:100% aqui.
*/
.sala-canvas {
  display: block;
  image-rendering: pixelated;
  border-radius: 10px;
  border: 1px solid var(--border-sutil);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  background: #1A1A20;
}

/* ============ REAÇÕES ============ */
/* Pedido de ajuda do usuário */
.msg.usuario-pedido {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--danger);
  border-left: 3px solid var(--danger);
  border-bottom-left-radius: 4px;
}
.msg.usuario-pedido .msg-titulo {
  font-size: var(--fs-3);
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 8px;
}

@media (max-width: 600px) {
  .escritorio { padding: 8px 12px 0; }
}


/* ============================================================
   LABORATÓRIO — layout de 3 colunas
   Esquerda: projetos e conversas · Centro: escritório e chat
   Direita: plano ao vivo
   ============================================================ */

.lab-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 292px;
  gap: 16px;
  width: 100%;
}

/* dentro da grade a coluna central ocupa o espaço dela, sem centralizar */
.lab-grid .lab-wrap { max-width: none; margin: 0; }

/*
  A tela do escritório tem padding no <body> (as colunas respiram 16px da
  borda). O cabeçalho vive dentro desse padding, então aqui ele zera o próprio
  para a marca cair no MESMO x das outras páginas — e na mesma linha vertical
  da coluna de projetos.
*/
.lab-body .nav-inner { padding: 0; }

/* ---------- laterais ---------- */
.lab-lateral {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  overflow: hidden;
}
.lab-lateral.oculta { display: none; }

.lateral-bloco { display: flex; flex-direction: column; min-height: 0; gap: 8px; }
.lateral-bloco.cresce { flex: 1; min-height: 0; }

.lateral-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 8px 8px;
}
.lateral-titulo {
  font-size: var(--fs-2);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.lateral-add {
  /* 28x28: alvo de clique confortável. A 22px o acerto no mouse já falhava. */
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: var(--fs-3); line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.lateral-add:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-ring); }

.lateral-lista { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 2px; padding-right: 2px; }
.lateral-lista::-webkit-scrollbar { width: 6px; }
.lateral-lista::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---------- item da lista (projeto ou conversa) ---------- */
.lateral-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text-2);
  font-size: var(--fs-3);
  line-height: 1.3;
  border: 1px solid transparent;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.lateral-item:hover { background: var(--surface-2); color: var(--text); }
.lateral-item.ativo { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.lateral-item .rotulo {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lateral-item .contagem { font-size: var(--fs-2); color: var(--muted); flex-shrink: 0; }
.lateral-item .ponto { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.item-acoes { display: none; gap: 2px; flex-shrink: 0; }
.lateral-item:hover .item-acoes { display: flex; }
.item-acao {
  /* 28px: alvo de clique de verdade. A 20px o "⋯" era mais decoração que botão. */
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 5px;
  color: var(--muted); cursor: pointer; font-size: var(--fs-3); font-family: inherit;
}
.item-acao:hover { background: var(--bg); color: var(--text); }
.item-acao.perigo:hover { color: var(--danger); }

.lateral-vazio { padding: 8px 8px; font-size: var(--fs-3); color: var(--muted); line-height: 1.5; }

/* ---------- painel do plano ---------- */
.plano-modo {
  font-size: var(--fs-2);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-3);
}
/* sem modo definido não existe pílula: vazia ela vira um traço solto na tela */
.plano-modo:empty { display: none; }

.plano-modo.equipe { color: var(--accent); border-color: var(--accent-ring); }
.plano-modo.conversa { color: var(--text-3); }
.plano-modo.direto { color: var(--ok); border-color: rgba(34, 197, 94, 0.4); }

.painel-plano { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 2px 8px; }
.painel-plano::-webkit-scrollbar { width: 6px; }
.painel-plano::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.plano-vazio { font-size: var(--fs-3); color: var(--muted); line-height: 1.6; margin: 8px 0 0; }

.plano-missao {
  font-size: var(--fs-3);
  color: var(--text);
  line-height: 1.5;
  padding: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.plano-missao .rot {
  display: block;
  font-size: var(--fs-2);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.plano-razao { font-size: var(--fs-3); color: var(--text-3); line-height: 1.5; padding: 0 2px; }

/* etapas com status ao vivo */
.plano-etapa {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.plano-etapa.pensando { border-color: var(--accent-ring); background: var(--accent-soft); }
.plano-etapa.pronto { opacity: 0.62; }

.plano-avatar {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-3);
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.plano-info { flex: 1; min-width: 0; }
.plano-nome { font-size: var(--fs-3); font-weight: 600; color: var(--text); }
.plano-especialidade { font-size: var(--fs-2); color: var(--muted); margin-top: 1px; line-height: 1.35; }
.plano-estado { font-size: var(--fs-2); color: var(--text-3); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.plano-estado .bolinha { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.plano-etapa.pensando .plano-estado { color: var(--accent); }
.plano-etapa.pensando .bolinha { background: var(--accent); animation: pulsa 1s infinite; }
.plano-etapa.pronto .bolinha { background: var(--ok); }
.plano-etapa.pronto .plano-estado { color: var(--ok); }

@keyframes pulsa {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

/* ---------- barra de título da conversa ---------- */
.lab-titulo-barra {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px 8px;
  flex-shrink: 0;
  min-width: 0;
}
.lab-titulo {
  font-size: var(--fs-3);
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lab-projeto { font-size: var(--fs-2); color: var(--muted); flex-shrink: 0; }

/* ---------- botões de colapso na nav ---------- */
.nav-lateral-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-3);
  border-radius: 7px;
  min-height: 32px;
  padding: 6px 10px;
  font-size: var(--fs-3);
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-lateral-btn:hover { background: var(--surface-2); color: var(--text); }
.nav-lateral-btn.desligado { color: var(--muted); border-color: var(--border-sutil); }

/* os dois interruptores de painel andam juntos, como um par */
.nav-paineis { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- menção a agente dentro do texto ---------- */
.ag-marcacao {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
  padding: 0 4px;
  border-radius: 4px;
}

/* ---------- responsivo ---------- */
@media (max-width: 1280px) {
  .lab-grid { grid-template-columns: 220px minmax(0, 1fr) 260px; gap: 8px; }
}
@media (max-width: 1080px) {
  .lab-grid { grid-template-columns: minmax(0, 1fr) 260px; }
  .lab-lateral.lateral-esq { display: none; }
  .lab-lateral.lateral-esq.aberta {
    display: flex;
    position: fixed;
    top: 64px; left: 12px; bottom: 12px;
    width: 250px;
    z-index: 40;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  }
}
@media (max-width: 820px) {
  .lab-grid { grid-template-columns: minmax(0, 1fr); }
  .lab-lateral.lateral-dir { display: none; }
  .lab-lateral.lateral-dir.aberta {
    display: flex;
    position: fixed;
    top: 64px; right: 12px; bottom: 12px;
    width: 260px;
    z-index: 40;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  }
}

/* fim de rodada: deixa claro que a conversa terminou e ninguém mais vai falar */
.fim-rodada {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 4px 2px;
  font-size: var(--fs-2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.6;
}
.fim-rodada::before,
.fim-rodada::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============================================================
   CATÁLOGO DE SKILLS (tela do agente)
   ============================================================ */
.catalogo-topo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.catalogo-topo input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-3);
  outline: none;
}
.catalogo-topo input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.catalogo-orcamento {
  font-size: var(--fs-3);
  color: var(--muted);
  white-space: nowrap;
}
.catalogo-orcamento.cheio { color: var(--danger); font-weight: 600; }

.catalogo-lista {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}
.catalogo-lista::-webkit-scrollbar { width: 6px; }
.catalogo-lista::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.catalogo-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.catalogo-item:hover { border-color: var(--text-3); }
.catalogo-item.ativa { border-color: var(--accent); background: var(--accent-soft); }
.catalogo-item input[type="checkbox"] { margin-top: 4px; accent-color: var(--accent); cursor: pointer; }

.catalogo-info { flex: 1; min-width: 0; }
.catalogo-nome { font-size: var(--fs-3); font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.catalogo-desc {
  font-size: var(--fs-3);
  color: var(--text-3);
  line-height: 1.45;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.catalogo-origem {
  font-size: var(--fs-2);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.catalogo-origem.catalogo { color: #4169E1; border-color: rgba(65, 105, 225, 0.4); }
.catalogo-origem.projeto { color: var(--ok); border-color: rgba(34, 197, 94, 0.4); }
.catalogo-origem.upload { color: var(--text-3); }
.catalogo-tamanho { font-size: var(--fs-2); color: var(--muted); font-weight: 400; }
.catalogo-tamanho.grande { color: #FFD700; }


/* a sala fica centrada e a altura vem da arte, nao da viewport */
.escritorio-cena {
  gap: 0;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
}


/* ============================================================
   ARVORE DE PROJETOS — conversas dentro da pasta
   ============================================================ */
.cab-acoes { display: flex; gap: 4px; }

.arvore { gap: 0; }

.arv-projeto {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text-2);
  font-size: var(--fs-3);
  line-height: 1.3;
  border: 1px solid transparent;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.arv-projeto:hover { background: var(--surface-2); color: var(--text); }
.arv-projeto.ativo { background: var(--surface-2); color: var(--text); font-weight: 600; }
/* destino do arrastar: precisa ser inconfundivel no meio de uma lista */
.arv-projeto.alvo {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

.arv-caret {
  width: 12px;
  flex-shrink: 0;
  font-size: var(--fs-1);
  color: var(--muted);
  transition: transform var(--t-fast) var(--ease);
}
.arv-caret.aberto { transform: rotate(90deg); }

/* as conversas ficam recuadas e ligadas por um fio ao projeto */
.arv-filhos {
  position: relative;
  margin: 0 0 4px 15px;
  padding-left: 10px;
  border-left: 1px solid var(--border-sutil);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.arv-conversa {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-3);
  font-size: var(--fs-2);
  line-height: 1.35;
  border: 1px solid transparent;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.arv-conversa:hover { background: var(--surface-2); color: var(--text); }
.arv-conversa.ativo { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.arv-conversa.arrastando { opacity: 0.4; }
.arv-conversa .rotulo {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arv-projeto .item-acoes,
.arv-conversa .item-acoes { display: none; gap: 2px; flex-shrink: 0; }
/* aparece no hover, no foco por teclado e na linha aberta — e fica sempre
   visível em tela de toque, que não tem hover nenhum */
.arv-projeto:hover .item-acoes,
.arv-conversa:hover .item-acoes,
.arv-projeto:focus-within .item-acoes,
.arv-conversa:focus-within .item-acoes,
.arv-projeto.ativo .item-acoes,
.arv-conversa.ativo .item-acoes { display: flex; }
@media (hover: none) {
  .arv-projeto .item-acoes,
  .arv-conversa .item-acoes { display: flex; }
}
/* a contagem some quando as acoes aparecem, para nao empurrar o nome */
.arv-projeto:hover .contagem { display: none; }

.arv-vazio {
  padding: 6px 8px;
  font-size: var(--fs-1);
  color: var(--muted);
  line-height: 1.5;
}

/* o ponto/rotulo/contagem viviam sob .lateral-item; a arvore usa classes proprias */
.arv-projeto .ponto { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.arv-projeto .rotulo {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.arv-projeto .contagem { font-size: var(--fs-2); color: var(--muted); flex-shrink: 0; }

/* selo com o numero de arquivos de contexto subidos pro projeto */
.arv-projeto .arquivos-selo {
  font-size: var(--fs-1);
  color: var(--muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}
.arv-projeto:hover .arquivos-selo { display: none; }

/* ============================================================
   ARQUIVOS DO PROJETO — lista dentro do card modal
   ============================================================ */
.arqs-lista { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.arqs-vazio { padding: 10px 4px; color: var(--muted); font-size: var(--fs-2); }
.arqs-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: var(--fs-2);
}
.arqs-item:hover { background: var(--surface-2); }
.arqs-item .arqs-nome {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono, monospace);
}
.arqs-item.nao-legivel .arqs-nome { color: var(--muted); }
.arqs-item .arqs-tam { font-size: var(--fs-1); color: var(--muted); flex-shrink: 0; }
.arqs-item .arqs-apagar {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-3);
  line-height: 1;
  padding: 2px 6px;
  border-radius: 5px;
}
.arqs-item .arqs-apagar:hover { background: var(--danger-soft, #ef444422); color: var(--danger, #ef4444); }
.arqs-resumo { padding: 4px 4px 8px; font-size: var(--fs-1); color: var(--muted); }

/* ============================================================
   AVISO DE CÓDIGO DESATUALIZADO
   Faixa discreta: é um lembrete operacional, não um erro do usuário.
   Âmbar em vez de vermelho — nada quebrou, só falta reiniciar.
   ============================================================ */
.aviso-reinicio {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(226, 202, 131, 0.1);
  border-bottom: 1px solid rgba(226, 202, 131, 0.35);
  color: #E2CA83;
  font-size: var(--fs-2);
  line-height: 1.4;
  backdrop-filter: blur(8px);
}
.aviso-icone { font-size: var(--fs-3); flex-shrink: 0; }
.aviso-texto { flex: 1; min-width: 0; }
.aviso-texto strong { color: #F0DFB4; font-weight: 600; }
.aviso-detalhe { display: block; color: rgba(226, 202, 131, 0.75); margin-top: 1px; }
.aviso-comando {
  flex-shrink: 0;
  font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
  font-size: var(--fs-2);
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(226, 202, 131, 0.3);
  cursor: pointer;
  user-select: all;
}
.aviso-comando:hover { border-color: rgba(226, 202, 131, 0.6); }
.aviso-fechar {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: inherit;
  font-size: var(--fs-5);
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  padding: 0 4px;
}
.aviso-fechar:hover { opacity: 1; }

/* o laboratório ocupa a altura toda: a faixa precisa caber sem cortar o rodapé */
body.lab-body.com-aviso { height: 100vh; }
body.lab-body.com-aviso .lab-grid { min-height: 0; }

@media (max-width: 900px) {
  .aviso-comando { display: none; }
}


/* ============================================================
   SOBRE NÓS
   Página de conteúdo: ritmo de leitura primeiro, decoração depois.
   Tudo em cima dos tokens — nenhum valor de cor solto aqui.
   ============================================================ */
.sobre-hero { padding-bottom: 24px; }
.sobre-hero .sub { max-width: 60ch; }

.sobre {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 24px;
}
/* dentro de "sobre" quem manda na margem é o container: seção com padding
   próprio deixava cada bloco começando num x diferente */
.sobre .section {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

/* ---- passos da rodada ---- */
.passos {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.passo {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border-sutil);
  border-radius: var(--radius);
  transition: border-color var(--t-med) var(--ease);
}
.passo:hover { border-color: var(--border); }
.passo-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-claro);
  font-size: var(--fs-3);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.passo h3 {
  margin: 2px 0 4px;
  font-size: var(--fs-4);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.passo p {
  margin: 0;
  color: var(--text-3);
  font-size: var(--fs-3);
  max-width: 68ch;
}

/* ---- cartões de pilar ---- */
.cartoes {
  display: grid;
  align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.cartoes .panel { margin: 0; }
.cartoes .panel p {
  margin: 0 0 12px;
  color: var(--text-3);
  font-size: var(--fs-3);
  max-width: 68ch;
}
.cartoes .panel p:last-child { margin-bottom: 0; }
.cartoes .panel strong { color: var(--text-2); font-weight: 600; }

/* ---- cartão de agente na equipe ---- */
.card-equipe { position: relative; overflow: hidden; }
.card-equipe .especialidade {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: var(--fs-2);
}
.card-equipe .faixa-cor {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  opacity: 0.85;
}

/* ---- fichas de bastidor ---- */
.fichas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.ficha {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border-sutil);
  border-radius: var(--radius);
}
.ficha-rotulo {
  font-size: var(--fs-1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.ficha-valor { font-size: var(--fs-4); font-weight: 600; letter-spacing: -0.01em; }
.ficha-nota { font-size: var(--fs-2); color: var(--text-3); }

.creditos {
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border-sutil);
  color: var(--text-3);
  font-size: var(--fs-3);
  max-width: 68ch;
}

.aviso-vazio {
  grid-column: 1 / -1;
  margin: 0;
  padding: 24px;
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-3);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---- chamada final ---- */
.chamada {
  margin: 8px 0 48px;
  padding: 40px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border-sutil);
  border-radius: var(--radius-lg);
}
.chamada h2 {
  margin: 0 0 8px;
  font-size: var(--fs-6);
  letter-spacing: -0.02em;
}
.chamada p {
  margin: 0 0 20px;
  color: var(--text-3);
  font-size: var(--fs-3);
}

.sobre code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border-sutil);
  color: var(--text-2);
  font-size: 0.92em;
}

@media (max-width: 600px) {
  .sobre { padding: 0 16px 16px; }
  .passo { padding: 16px; }
}


/* ============================================================
   FOCO PELO TECLADO
   Botão tinha anel, link e árvore não: quem navega por Tab ficava sem saber
   onde está. Um anel só, igual em todo lugar.
   ============================================================ */
a:focus-visible,
.nav-link:focus-visible,
.lateral-add:focus-visible,
.nav-lateral-btn:focus-visible,
.arvore-item:focus-visible,
.escritorio-toggle:focus-visible,
canvas:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Quem pediu menos movimento no sistema recebe menos movimento aqui. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ============================================================
   MENU DE AÇÕES (⋯) — renomear e apagar

   Fica sobre a página, ancorado no botão que o abriu. Cada ação tem nome por
   extenso: ícone sozinho não conta o que faz, e apagar é irreversível demais
   para depender de adivinhação.
   ============================================================ */
.menu-flutuante {
  position: fixed;
  z-index: 120;
  min-width: 232px;
  max-width: 300px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-titulo {
  margin: 4px 8px 6px;
  font-size: var(--fs-2);
  font-weight: 600;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-aviso {
  margin: 0 8px 6px;
  font-size: var(--fs-2);
  color: var(--text-3);
  line-height: 1.45;
}

.menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--border-sutil);
}

.menu-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--fs-3);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.menu-item:hover { background: var(--surface-2); color: var(--text); }
.menu-item.perigo { color: var(--accent); }
.menu-item.perigo:hover { background: var(--accent-soft); color: var(--accent-claro); }
.menu-dica { font-size: var(--fs-2); color: var(--muted); }
.menu-item.perigo .menu-dica { color: var(--text-3); }

/* o ⋯ da conversa aberta, ao lado do título */
.titulo-acoes {
  margin-left: auto;
  color: var(--text-3);
}
.titulo-acoes:hover { background: var(--surface-2); color: var(--text); }
.titulo-acoes[hidden] { display: none; }


/* ============================================================
   ENTREGA — o cartão do documento

   Resposta longa não ocupa o chat: vira documento. O cartão mostra de quem é,
   o título, duas linhas e o botão. Nada de muro de texto na conversa.
   ============================================================ */
.zmsg.entrega {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border-sutil);
  border-left: 3px solid var(--cor-entrega, var(--accent));
  border-radius: var(--radius);
}

.entrega-topo {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.entrega-autor { font-size: var(--fs-3); font-weight: 600; }

.entrega-titulo {
  margin: 0;
  font-size: var(--fs-4);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.entrega-resumo {
  margin: 0;
  max-width: 68ch;
  font-size: var(--fs-3);
  color: var(--text-3);
  line-height: 1.5;
}

.entrega-acoes {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.entrega-tamanho { font-size: var(--fs-2); color: var(--muted); }

.video-status {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-3);
  color: var(--text-3);
}

/* ---- o documento aberto ---- */
.modal-backdrop.documento .card-janela {
  width: min(860px, 92vw);
  max-height: 86vh;
}
.doc-corpo {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 8px;
  font-size: var(--fs-3);
  line-height: 1.6;
  color: var(--text-2);
}
.doc-corpo h3, .doc-corpo h4, .doc-corpo h5, .doc-corpo h6 {
  margin: 20px 0 8px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.doc-corpo h3 { font-size: var(--fs-5); }
.doc-corpo h4 { font-size: var(--fs-4); }
.doc-corpo p { margin: 0 0 12px; max-width: 72ch; }
.doc-corpo ul { margin: 0 0 12px; padding-left: 20px; }
.doc-corpo li { margin-bottom: 6px; }
.doc-corpo code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border-sutil);
  font-size: 0.92em;
}
.doc-corpo table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: var(--fs-2);
}
.doc-corpo th, .doc-corpo td {
  border: 1px solid var(--border-sutil);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.doc-corpo th { background: var(--surface-2); color: var(--text); font-weight: 600; }
