/* ==========================================================================
   AdFlow — telas

   Tudo aqui usa os tokens de base.css e os componentes de components.css.
   Valor de cor, raio, fio ou sombra solto no meio do arquivo é erro.
   ========================================================================== */

/* ==========================================================================
   Entrar
   ========================================================================== */

.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--sp-6);
  background: var(--s0);
}

.auth__panel { width: 100%; max-width: 380px; }

.auth__brand { display: flex; align-items: center; gap: 10px; margin-bottom: var(--sp-6); }

.auth__card {
  padding: var(--sp-8);
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-xs);
}

.auth__title { font-size: 20px; font-weight: 600; letter-spacing: -0.017em; }
.auth__subtitle { margin-top: 4px; margin-bottom: var(--sp-5); font-size: 14px; color: var(--fg-3); }
.auth__form { display: flex; flex-direction: column; gap: var(--sp-4); }

.auth__error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: var(--sp-4);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-left: 3px solid var(--down);
  border-radius: var(--r-sm);
  background: var(--st-dead-bg);
  font-size: 13px;
  color: var(--down-ink);
  line-height: 1.4;
}

.auth__error svg { flex: 0 0 auto; }
.auth__foot { margin-top: var(--sp-5); font-size: 12px; color: var(--fg-3); }

/* Fora da navegação escura a marca usa o verde escuro. */
/* O ladrilho da marca fora da navegação escura: fundo suave, verde escuro. */
.auth__brand .brand-mark { background: var(--accent-soft); color: var(--accent); width: 34px; height: 34px; }
.auth__brand .brand-name { color: var(--fg); font-size: 18px; }

/* ==========================================================================
   Gerador de vídeos IA (Google Flow)
   ========================================================================== */

.flow-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--s2-hover);
  color: var(--fg-3);
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 600;
}

.flow-state__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.flow-state--ok { background: var(--st-winner-bg); color: var(--st-winner-ink); }
.flow-state--busy { background: var(--st-running-bg); color: var(--st-running-ink); }
.flow-state--warn { background: var(--st-saturating-bg); color: var(--st-saturating-ink); }
.flow-state--error { background: var(--st-dead-bg); color: var(--st-dead-ink); }

.flow-token {
  display: grid;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
}

.flow-token code {
  display: block;
  overflow-wrap: anywhere;
  padding: 8px;
  border-radius: var(--r-sm);
  background: var(--s2);
  font-family: var(--font-num);
  font-size: 12px;
}

.flow-token .btn { justify-self: start; }
.flow-error { max-width: 280px; white-space: normal; color: var(--down-ink); }

.flow-gens {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
  padding: var(--sp-4);
}

.flow-gen {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--s2);
}

.flow-gen__video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  background: #000;
}

.flow-gen__body { display: grid; gap: var(--sp-2); padding: var(--sp-3); }

.flow-gen__prompt {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-size: 13px;
  line-height: 1.4;
}

.flow-gen__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--fg-3); font-size: 11px; }
.flow-scenes { display: grid; gap: var(--sp-3); padding: var(--sp-4); }

.flow-scene {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--s1, transparent);
}

.flow-scene--new { margin: 0 var(--sp-4) var(--sp-4); border-style: dashed; }
.flow-scene--new > summary, .flow-scene__edit > summary { list-style: none; cursor: pointer; justify-self: start; }
.flow-scene--new > summary::-webkit-details-marker, .flow-scene__edit > summary::-webkit-details-marker { display: none; }
.flow-scene--new[open] > summary, .flow-scene__edit[open] > summary { margin-bottom: var(--sp-3); }

.flow-scene__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.flow-scene__num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--fg);
  font-weight: 700;
  font-size: 13px;
}
.flow-scene__title { display: grid; flex: 1 1 180px; min-width: 0; }
.flow-scene__tools { display: flex; gap: 4px; margin-left: auto; }
.flow-scene__speech { margin: 0; font-size: 15px; font-style: italic; }
.flow-scene__summary { margin: 0; font-size: 13px; }
.flow-scene__retry { margin: 0; }
.flow-scene__full > summary { cursor: pointer; }
.flow-scene__prompt {
  margin: var(--sp-2) 0 0;
  max-height: 320px;
  overflow: auto;
  padding: var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--s2);
  color: var(--fg-3);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.flow-refs > summary { list-style: none; cursor: pointer; }
.flow-refs > summary::-webkit-details-marker { display: none; }
.flow-scene__checks { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin: var(--sp-3) 0; }
.flow-scene__actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-2) var(--sp-3); }
.flow-scene__edit { flex: 1 1 100%; }
.flow-scene__edit:not([open]) { flex: 0 0 auto; }
.flow-scene__queue { display: flex; gap: var(--sp-2); }
.flow-scene__queue .select { width: auto; height: 34px; }

.flow-gens--scene { grid-template-columns: repeat(auto-fill, minmax(140px, 180px)); padding: 0; }
.flow-gen__ai { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.flow-gen__pick { color: var(--fg-3); font-size: 11px; font-weight: 600; }
.flow-gen__summary { margin: 0; font-size: 12px; line-height: 1.4; }
.flow-gen__issues { margin: 0; padding-left: 16px; color: var(--down-ink); font-size: 11px; line-height: 1.4; }
.flow-render__pending { display: grid; place-content: center; justify-items: center; gap: var(--sp-2); padding: var(--sp-3); text-align: center; background: var(--s2-hover); }
.flow-gen.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.flow-suggest { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.flow-suggest .input { flex: 1 1 260px; }
.flow-overlays { display: grid; gap: var(--sp-2); margin-top: var(--sp-4); }
.flow-overlay {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: var(--sp-3);
  align-items: start;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.flow-overlay__thumb {
  display: grid;
  place-items: center;
  width: 64px;
  height: 96px;
  border-radius: var(--r-sm);
  background: var(--s2-hover);
  object-fit: cover;
}
.flow-overlay__body { display: grid; gap: 4px; min-width: 0; }
.flow-media__preview { aspect-ratio: 9 / 16; object-fit: contain; background: #000; }
.flow-media__audio { display: grid; place-content: center; justify-items: center; gap: var(--sp-3); padding: var(--sp-3); color: #fff; }
.flow-media__audio audio { width: 100%; }

.flow-options { display: grid; grid-template-columns: repeat(2, minmax(0, 200px)); gap: var(--sp-3); margin-top: var(--sp-3); }
.flow-gen__letter { color: var(--fg); font-family: var(--font-num); }
.flow-gen__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }

@media (max-width: 520px) {
  .flow-gens { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); padding: var(--sp-3); }
  .flow-gen__foot { flex-direction: column; align-items: flex-start; }
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-2);
  font-size: 13px;
  cursor: pointer;
}

.check-row input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ==========================================================================
   Gráfico
   ========================================================================== */

.chart { position: relative; height: 288px; padding: var(--sp-4) var(--sp-4) var(--sp-2); }
.chart--sm { height: 200px; }
.chart--xs { height: 148px; }

.legend { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-3);
  white-space: nowrap;
}

.legend__line { width: 14px; height: 2px; flex: 0 0 auto; border-radius: 1px; background: currentColor; }
.legend__line--dashed {
  background: none;
  border-top: 2px dashed currentColor;
  height: 0;
  opacity: 0.65;
}

/* ==========================================================================
   Sinais de fadiga
   ========================================================================== */

/* Cada criativo é um bloco independente, separado por um fio muito sutil:
   a coluna precisa ser escaneável de relance. */
.fatigue { padding: 6px; }

.fatigue__item {
  position: relative;
  display: block;
  padding: var(--sp-3) var(--sp-3) var(--sp-3) 14px;
  border-radius: var(--r-sm);
  transition: background var(--t) var(--ease);
}

.fatigue__item + .fatigue__item { border-top: 1px solid var(--line-soft); border-radius: 0; }
.fatigue__item:hover { background: var(--row-hover); }

/* O traço de severidade acompanha o bloco, com folga em cima e embaixo:
   encostando nas bordas viraria divisória entre um item e outro. */
.fatigue__item .perf-edge { left: 4px; top: 10px; bottom: 10px; border-radius: var(--r-pill); }

.fatigue__head { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }

.fatigue__name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.fatigue__item:hover .fatigue__name { color: var(--accent); }

.fatigue__age {
  font-family: var(--font-num);
  font-size: 12px;
  color: var(--fg-3);
  flex: 0 0 auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.fatigue__signals {
  display: flex;
  gap: var(--sp-5);
  margin-top: var(--sp-2);
  flex-wrap: wrap;
}

.fatigue__signal { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fatigue__signal-label { font-size: 11px; color: var(--fg-4); line-height: 1.2; }

.fatigue__signal-value {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}

.wear {
  display: flex;
  gap: 2px;
  margin-top: var(--sp-2);
  height: 4px;
}

.wear__unit { flex: 1 1 0; background: var(--line-soft); border-radius: var(--r-pill); }
.wear__unit.is-on { background: currentColor; }
.wear--watch { color: var(--perf-watch); }
.wear--drop { color: var(--perf-drop); }

/* ==========================================================================
   Biblioteca — galeria

   A imagem do criativo tem o maior peso visual. O card guarda no máximo três
   números; o resto abre na gaveta.
   ========================================================================== */

.creative-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: var(--t-ui);
}

.creative-card:hover { border-color: var(--line-2); box-shadow: var(--pop); }

/* Retrato 4:5 — a proporção em que o criativo realmente roda. */
.creative-card__media {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--s2-hover);
  overflow: hidden;
}

.creative-card__media img,
.creative-card__media video { width: 100%; height: 100%; object-fit: cover; display: block; }

.creative-card__fallback {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 100%; height: 100%;
  color: var(--fg-4);
  font-size: 12px;
}

/* Faixa superior sobre a imagem: código à esquerda, status à direita. */
.creative-card__top {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 10px;
  background: linear-gradient(to bottom, rgba(16, 24, 40, 0.5), transparent);
  pointer-events: none;
}

.creative-card__top > * { pointer-events: auto; }

.creative-card__code {
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

/* Pílula de status sobre a imagem: fundo branco para ler em cima de
   qualquer criativo, mantendo a cor do estado no ponto e no texto. */
.creative-card__status { display: inline-flex; border-radius: var(--r-pill); }
.creative-card__status .status { background: rgba(255, 255, 255, 0.95); box-shadow: var(--shadow-xs); }
.creative-card__status .status--draft      { color: var(--st-draft-ink); }
.creative-card__status .status--rejected   { color: var(--st-rejected-ink); }
.creative-card__status .status--ready      { color: var(--st-ready-ink); }
.creative-card__status .status--testing    { color: var(--st-testing-ink); }
.creative-card__status .status--running    { color: var(--st-running-ink); }
.creative-card__status .status--winner     { color: var(--st-winner-ink); }
.creative-card__status .status--scaling    { color: var(--st-scaling-ink); }
.creative-card__status .status--saturating { color: var(--st-saturating-ink); }
.creative-card__status .status--dead       { color: var(--st-dead-ink); }
.creative-card__status .status--archived   { color: var(--st-archived-ink); }

.creative-card__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: transparent;
  transition: background var(--t) var(--ease);
}

.creative-card__play:hover { background: rgba(16, 24, 40, 0.18); }

.creative-card__play-btn {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--fg);
  padding-left: 2px;
  opacity: 0;
  box-shadow: var(--pop);
  transition: opacity var(--t) var(--ease);
}

.creative-card:hover .creative-card__play-btn { opacity: 1; }

.creative-card__actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--t) var(--ease);
}

.creative-card:hover .creative-card__actions,
.creative-card:focus-within .creative-card__actions { opacity: 1; }

.creative-card__action {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: var(--r-xs);
  background: rgba(255, 255, 255, 0.95);
  color: var(--fg-2);
  box-shadow: var(--shadow-xs);
  transition: var(--t-ui);
}

.creative-card__action:hover { background: #fff; color: var(--fg); }

.creative-card__flag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-xs);
}

.creative-card__body { padding: var(--sp-3) var(--sp-3) 10px; }

.creative-card__name {
  display: block;
  max-width: 100%;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.creative-card__meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--fg-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Rodapé do card: três números em colunas. O ROAS decide — vai por último
   e com mais peso. */
.creative-card__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
}

.creative-card__stat {
  padding: 8px 10px 10px;
  border-right: 1px solid var(--line-soft);
  min-width: 0;
  text-align: right;
}

.creative-card__stat:first-child { text-align: left; }
.creative-card__stat:last-child { border-right: 0; }

.creative-card__stat-label { font-size: 11px; color: var(--fg-4); line-height: 1.2; }

.creative-card__stat-value {
  margin-top: 2px;
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.creative-card__stat-value--key { font-weight: 700; }

/* ==========================================================================
   Biblioteca — célula de criativo na tabela

   É a coluna mais importante da tela: miniatura 48px, nome em peso 600 e
   uma linha de metadado com o código e, quando houver, o aviso.
   ========================================================================== */

.creative-cell { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }

.creative-cell__name {
  display: block;
  max-width: 320px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--t) var(--ease);
}

.creative-cell__name:hover { color: var(--accent); }

.creative-cell__sub { display: flex; align-items: center; gap: 8px; margin-top: 2px; min-width: 0; }

.creative-cell__code {
  font-family: var(--font-num);
  font-size: 12px;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.creative-cell__sep { color: var(--line-2); flex: 0 0 auto; }
.creative-cell__product { display: block; max-width: 200px; }

/* Produto na tabela: ícone + nome em duas linhas no máximo. */
.product-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.product-cell__icon { color: var(--fg-3); flex: 0 0 auto; }
.product-cell__name { font-size: 13px; color: var(--fg-2); line-height: 1.3; min-width: 0; }

/* --------------------------------------------------------------------------
   Largura das colunas da biblioteca

   Doze colunas em uma tela de 1440px não se distribuem sozinhas: sem isso o
   navegador dá espaço a quem tem texto longo (Produto) e espreme a coluna de
   ações até ela sumir. As medidas abaixo são pisos — a coluna Criativo fica
   com toda a sobra, que é onde ela deve ficar.
   -------------------------------------------------------------------------- */

/* `table-layout: fixed` porque a distribuição automática não serve aqui: o
   navegador daria espaço a quem tem texto longo (Produto, Criativo) e
   espremeria a coluna de ações até ela sumir — foi exatamente o que
   aconteceu antes destas medidas existirem.

   Com layout fixo a tabela cabe sempre na largura disponível, o texto que
   sobra vira reticências e a coluna Criativo, a única sem largura, fica com
   toda a sobra. Abaixo de `min-width` o wrapper devolve a rolagem lateral.

   Cada largura é a maior entre o rótulo do cabeçalho (com o ícone de
   ordenação) e o maior valor que a coluna mostra: "R$ 14.946,00",
   "16/09/2026" e "Biblioteca das Escrituras" em duas linhas é o que manda.
   As onze somam 1092px; com a coluna Criativo (mínimo 200px) dá o
   `min-width` abaixo.

   Mexer nelas pede revisar esse `min-width` e o breakpoint de
   .table-wrap--docked em components.css — os três andam juntos. */
.table--creatives { table-layout: fixed; min-width: 1324px; }

.table--creatives th.col-check     { width: 40px; }
.table--creatives th:nth-child(3)  { width: 144px; }  /* Produto */
.table--creatives th:nth-child(4)  { width: 112px; }  /* Quem fez */
.table--creatives th:nth-child(5)  { width: 150px; }  /* Status ("Pronto para subir" é o mais longo) */
.table--creatives th:nth-child(6)  { width: 104px; }  /* Início */
.table--creatives th:nth-child(7)  { width: 116px; }  /* Investido */
.table--creatives th:nth-child(8)  { width: 86px; }   /* Vendas */
.table--creatives th:nth-child(9)  { width: 132px; }  /* Faturamento */
.table--creatives th:nth-child(10) { width: 98px; }   /* CPA */
.table--creatives th:nth-child(11) { width: 86px; }   /* ROAS */
.table--creatives th.col-actions   { width: 56px; text-align: center; }

/* As dicas dos cabeçalhos numéricos ficam nas últimas colunas: centradas,
   elas passariam da borda da janela. Ancoradas à direita, não passam. */
.table--creatives th.is-numeric .tip::after { left: auto; right: 0; transform: none; }

/* Com largura fixa, o que não couber corta com reticências em vez de
   empurrar a coluna vizinha.

   O corte mora no CONTEÚDO da célula, nunca no <td>: `overflow: hidden` no
   td recorta também o que sobe de dentro dele, e a dica com o nome completo
   aparecia cortada na metade. */
.table--creatives tbody td > * { max-width: 100%; }
.table--creatives .creative-cell__name { max-width: 100%; }

@media (max-width: 860px) {
  /* Em cartão a tabela deixa de ser tabela: largura fixa atrapalharia. */
  .table--creatives { table-layout: auto; min-width: 0; }
  .table--creatives tbody td { overflow: visible; }
}

/* ==========================================================================
   Barra de ações em massa

   Faixa escura flutuante que sobe quando há seleção. Não empurra o conteúdo
   nem rouba espaço da toolbar.
   ========================================================================== */

.selection-bar {
  position: fixed;
  left: 50%;
  bottom: var(--sp-6);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  max-width: calc(100vw - 32px);
  padding: 10px 10px 10px var(--sp-4);
  border-radius: var(--r);
  background: var(--nav);
  color: #fff;
  box-shadow: var(--pop-lg);
  transform: translate(-50%, calc(100% + var(--sp-6)));
  opacity: 0;
  pointer-events: none;
  flex-wrap: wrap;
  transition: transform var(--t-slow) var(--ease), opacity var(--t-slow) var(--ease);
}

.selection-bar.is-visible { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.selection-bar__count { font-size: 14px; color: var(--nav-fg); white-space: nowrap; }
.selection-bar__count .num { color: #fff; font-weight: 600; }

.selection-bar__div {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.14);
  flex: 0 0 auto;
}

.selection-bar .btn--secondary {
  background: var(--nav-3);
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: none;
}

.selection-bar .btn--secondary:hover { background: #26333f; border-color: rgba(255, 255, 255, 0.26); }
.selection-bar .btn--ghost { color: var(--nav-fg); }
.selection-bar .btn--ghost:hover { background: var(--nav-2); color: #fff; }
.selection-bar .dropdown__menu { background: var(--s3); color: var(--fg); }

/* ==========================================================================
   Detalhe do criativo — gaveta e página
   ========================================================================== */

.detail-media {
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: #101417;
  aspect-ratio: 4 / 5;
}

.detail-media img,
.detail-media video { width: 100%; height: 100%; object-fit: contain; background: #101417; }

.detail-media__fallback {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 100%; height: 100%;
  background: var(--s2-hover);
  color: var(--fg-4);
  font-size: 13px;
}

.detail-hero { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: var(--sp-6); align-items: start; }

/* Código acima do nome, no cabeçalho da página. */
.detail-head__code {
  display: block;
  margin-bottom: 2px;
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.detail-head__title {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.021em;
  line-height: 1.2;
}

.detail-head__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: var(--sp-3); }
.detail-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: var(--sp-4); }

.drawer-hero { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.drawer-hero .detail-media { aspect-ratio: 4 / 5; }

/* Lista chave/valor: rótulo à esquerda, valor à direita, fio entre. */
.info-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}

.info-row:last-child { border-bottom: 0; }
.info-row__label { color: var(--fg-3); flex: 0 0 auto; font-size: 13px; }
.info-row__value { text-align: right; min-width: 0; }

.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4) var(--sp-6); }
.kv-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kv-item__label { font-size: 12px; color: var(--fg-3); }
.kv-item__value { font-size: 14px; margin-top: 2px; }

.lineage {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: var(--t-ui);
}

.lineage:hover { border-color: var(--line-2); background: var(--s2-hover); }
.lineage__icon { color: var(--fg-3); flex: 0 0 auto; }
.lineage__code {
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Ranking
   ========================================================================== */

.leaders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

/* Fora do .pad: precisa da mesma margem lateral das seções, senão encosta
   na sidebar e o raio das quinas não tem onde aparecer. */
.content > .leaders { margin: var(--sp-5) var(--gutter) 0; }

.leader {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--s2);
  transition: background var(--t) var(--ease);
  min-width: 0;
}

.leader:hover { background: var(--row-hover); }

.leader__rank {
  font-family: var(--font-num);
  font-size: 12px;
  color: var(--fg-4);
  flex: 0 0 auto;
  width: 14px;
  font-variant-numeric: tabular-nums;
}

.leader--first .leader__rank { color: var(--accent); font-weight: 700; }
.leader__main { min-width: 0; flex: 1 1 auto; }

.leader__name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader:hover .leader__name { color: var(--accent); }
.leader__stats { display: flex; gap: var(--sp-3); margin-top: 3px; min-width: 0; }

/* Não quebra: "Fat. R$ 5.076,00" partido entre o R$ e o número não é um
   número, são dois pedaços de texto. */
.leader__stat { font-size: 12px; color: var(--fg-3); white-space: nowrap; }

.leader__stat .num {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-left: 4px;
}

/* Cinco recortes, cinco cartões. Antes os painéis dividiam uma moldura só e
   se separavam por fios de 1px — o que lia como uma tabela grande partida ao
   meio, não como cinco respostas independentes. Cada recorte agora tem
   contorno próprio e é o espaço entre eles que faz a separação. */
.boards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
  align-items: start;
}

.board {
  background: var(--s2);
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  /* Recorta a tabela nas quinas do cartão: sem isso o cabeçalho pinta um
     retângulo reto por cima do raio e o canto parece quebrado. */
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.board__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
}

.board__icon { color: var(--fg-3); flex: 0 0 auto; }
.board--wide { grid-column: 1 / -1; }

/* ==========================================================================
   Laboratório
   ========================================================================== */

.grid--lab {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--sp-4);
}

.lab-card { cursor: pointer; user-select: none; }
.lab-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.lab-card__check {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  border-radius: var(--r-xs);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: transparent;
  transition: var(--t-ui);
}

.lab-card.is-selected .lab-card__check { background: var(--accent); box-shadow: none; color: #fff; }

.lab-bar {
  position: fixed;
  left: 50%;
  bottom: var(--sp-6);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  max-width: calc(100vw - 32px);
  padding: 10px var(--sp-4);
  border-radius: var(--r);
  background: var(--nav);
  color: #fff;
  box-shadow: var(--pop-lg);
  flex-wrap: wrap;
  transform: translate(-50%, calc(100% + var(--sp-6)));
  opacity: 0;
  pointer-events: none;
  transition: transform var(--t-slow) var(--ease), opacity var(--t-slow) var(--ease);
}

.lab-bar.is-visible { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }

.lab-card .creative-card__top { padding-left: 38px; }
.lab-bar__count { font-size: 14px; white-space: nowrap; color: var(--nav-fg); }
.lab-bar__count .num { color: #fff; font-weight: 600; }
.lab-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.lab-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--r-xs);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  cursor: not-allowed;
}

.lab-action svg { color: rgba(255, 255, 255, 0.32); }

.soon-tag {
  font-family: var(--font-num);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   Configurações
   ========================================================================== */

.settings-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 960px);
  gap: var(--sp-8);
  align-items: start;
}

.settings-nav { position: sticky; top: calc(var(--topbar-h) + var(--sp-5)); display: flex; flex-direction: column; gap: 2px; }

.settings-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-2);
  transition: var(--t-ui);
}

.settings-nav__item svg { color: var(--fg-3); }
.settings-nav__item:hover { background: var(--s2-hover); color: var(--fg); }
.settings-nav__item.is-active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.settings-nav__item.is-active svg { color: var(--accent); }

.settings-panel + .settings-panel { margin-top: var(--sp-5); }
.settings-form { max-width: 460px; display: flex; flex-direction: column; gap: var(--sp-4); }

.settings-split { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: var(--sp-8); align-items: start; }

.dot-ok, .dot-off, .dot-warn, .dot-err { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; vertical-align: middle; }
.dot-ok { background: var(--up); }
.dot-off { background: var(--fg-4); }
.dot-warn { background: var(--warn); }
.dot-err { background: var(--down); }

/* ==========================================================================
   Ideias

   A ideia costuma nascer de um print, então o cartão põe a imagem primeiro e
   o texto depois. Em tabela a referência viraria uma miniatura de 40px e
   deixaria de informar — que é justamente o que ela tem de melhor.
   ========================================================================== */

.idea-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-4);
}

.idea-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: var(--t-ui);
}

.idea-card:hover { border-color: var(--line-2); }

/* Descartada não some da tela — ela é o registro de "já avaliamos isso".
   Mas também não pode competir com a fila do que ainda vai ser feito. */
.idea-card--discarded { opacity: 0.62; }
.idea-card--discarded:hover { opacity: 1; }

.idea-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--s2-sunk);
  overflow: hidden;
}

.idea-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.idea-card__blank {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  color: var(--fg-4);
  font-size: 12px;
}

.idea-card__count {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: var(--r-pill);
  background: rgba(16, 24, 40, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.idea-status {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  background: var(--s2);
  border: 1px solid var(--line);
  color: var(--fg-2);
}

.idea-status--new       { background: var(--accent-wash); border-color: var(--accent); color: var(--accent); }
.idea-status--done      { background: rgba(22, 163, 74, 0.10); border-color: rgba(22, 163, 74, 0.35); color: var(--up-ink); }
.idea-status--discarded { background: var(--s2-sunk); border-color: var(--line); color: var(--fg-3); }

.idea-card__body { flex: 1 1 auto; padding: var(--sp-3) var(--sp-4); min-width: 0; }

.idea-card__title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
}

/* Duas linhas de anotação: o suficiente para lembrar do que se trata, sem
   deixar um cartão três vezes mais alto que o vizinho. */
.idea-card__notes {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--fg-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.idea-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px var(--sp-3);
  margin-top: var(--sp-3);
}

.idea-card__who,
.idea-card__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--fg-3);
  min-width: 0;
}

.idea-card__who svg,
.idea-card__link svg { flex: 0 0 auto; }
.idea-card__link { color: var(--accent); font-weight: 500; }
.idea-card__link:hover { text-decoration: underline; }

.idea-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--line);
  background: var(--s2-sunk);
}

/* --------------------------------------------------------------------------
   Área de colagem

   O caminho principal é o Ctrl+V: a pessoa copia o print do anúncio e cola
   direto. O seletor de arquivo fica como alternativa, não como protagonista.
   -------------------------------------------------------------------------- */

.paste-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--sp-5) var(--sp-4);
  border: 1px dashed var(--line-2);
  border-radius: var(--r);
  background: var(--s2-sunk);
  color: var(--fg-3);
  text-align: center;
  cursor: pointer;
  transition: var(--t-ui);
}

.paste-zone:hover { border-color: var(--accent); background: var(--accent-wash); }

/* O foco precisa ser visível de verdade: é ele que diz onde o Ctrl+V vai
   cair, e a área só recebe a colagem quando está focada. */
.paste-zone:focus-visible,
.paste-zone.is-armed {
  outline: none;
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-wash);
  box-shadow: var(--focus);
}

.paste-zone__icon { color: var(--fg-4); }
.paste-zone__title { font-size: 13px; font-weight: 600; color: var(--fg-2); }
.paste-zone__hint { font-size: 12px; color: var(--fg-3); }

.paste-zone kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--s2);
  font-family: var(--font-num);
  font-size: 11px;
  color: var(--fg-2);
}

.paste-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

.paste-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--s2-sunk);
}

.paste-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Enquanto sobe, a imagem fica esmaecida — o print já aparece, mas dá para
   ver que ele ainda não está seguro no servidor. */
.paste-item.is-uploading img { opacity: 0.45; }

.paste-item__spinner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.paste-item__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(16, 24, 40, 0.72);
  color: #fff;
  cursor: pointer;
  transition: var(--t-ui);
}

.paste-item__remove:hover { background: var(--down); }

/* Faixa de mutirão de miniaturas, acima da lista de criativos.

   Fica discreta de propósito: é um aviso de manutenção, não um alerta. Some
   sozinha quando não há vídeo sem capa — que é o estado normal. */
.sweep-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
  padding: 10px var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s2-sunk);
}

.sweep-bar__text { font-size: 13px; color: var(--fg-2); min-width: 0; }

/* Botão que se lê como link, dentro de uma frase. */
.linklike {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.linklike:hover { color: var(--fg); }

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

@media (max-width: 1280px) {
  .detail-hero { grid-template-columns: 240px minmax(0, 1fr); }
  .settings-split { grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); }
}

@media (max-width: 1100px) {
  .boards { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1023px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: var(--sp-1); }
  .settings-nav__item { white-space: nowrap; }
}

@media (max-width: 860px) {
  .detail-hero { grid-template-columns: minmax(0, 1fr); }
  .detail-media { max-width: 320px; }
  .drawer-hero { grid-template-columns: 120px minmax(0, 1fr); }
  .fatigue__signals { gap: var(--sp-4); }
}

/* ==========================================================================
   Tabela larga vira lista de cartões no celular

   Comprimir onze colunas em 360px não funciona: cada linha vira um cartão
   com miniatura, nome, status e os três números que decidem.
   ========================================================================== */

@media (max-width: 860px) {
  .table-wrap--cards { border: 0; background: none; box-shadow: none; overflow: visible; }
  .table--cards { background: none; }
  .table--cards thead { display: none; }
  .table--cards,
  .table--cards tbody,
  .table--cards tr,
  .table--cards td { display: block; width: 100%; }

  .table--cards tbody tr {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-2) var(--sp-3);
    padding: var(--sp-4);
    margin-bottom: var(--sp-3);
    background: var(--s2);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-xs);
  }

  .table--cards tbody tr:hover { background: var(--s2); }
  .table--cards tbody tr.is-selected { background: var(--accent-wash); border-color: rgba(7, 154, 120, 0.3); }

  .table--cards tbody td {
    height: auto;
    padding: 0;
    border-bottom: 0;
  }

  /* Identificação ocupa a linha inteira, com folga à esquerda para a caixa
     de seleção e à direita para as ações — as duas ficam ancoradas nos
     cantos do cartão. */
  .table--cards tbody td:nth-child(2) {
    grid-column: 1 / -1;
    padding-left: 30px;
    padding-right: 76px;
    padding-bottom: var(--sp-3);
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: var(--sp-1);
  }

  /* Status ao lado da identificação, também em linha cheia. */
  .table--cards tbody td[data-label="Status"] { grid-column: 1 / -1; }

  /* O cartão fica com o que decide: status, investido, vendas e ROAS.
     Produto, autor, data, faturamento e CPA continuam na gaveta de detalhe —
     espremer onze colunas em 360px não ajudaria ninguém. */
  .table--cards tbody td[data-label="Produto"],
  .table--cards tbody td[data-label="Quem fez"],
  .table--cards tbody td[data-label="Início"],
  .table--cards tbody td[data-label="CPA"],
  .table--cards tbody td[data-label="Faturamento"] { display: none; }

  .table--cards tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 400;
    color: var(--fg-3);
    margin-bottom: 2px;
  }

  .table--cards tbody td[data-label="Status"]::before,
  .table--cards tbody td[data-label="Criativo"]::before { display: none; }
  .table--cards tbody td.is-numeric { text-align: left; font-size: 15px; font-weight: 600; }

  .table--cards td.col-check {
    position: absolute;
    top: 20px;
    left: var(--sp-4);
    width: auto;
    padding: 0;
  }

  .table--cards td.col-check::before { display: none; }

  .table--cards td:last-child {
    position: absolute;
    top: var(--sp-3);
    right: var(--sp-3);
    width: auto;
  }

  .table--cards .creative-cell { width: 100%; }
  .table--cards .creative-cell__name { max-width: none; white-space: normal; }
  .table--cards .pagination { border-radius: var(--r); border: 1px solid var(--line); }
}

@media (max-width: 720px) {
  .detail-head__title { font-size: 20px; }
  .detail-media { max-width: none; }
  .grid--lab { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv-grid { grid-template-columns: minmax(0, 1fr); }
  .chart { height: 240px; padding: var(--sp-3) var(--sp-2) var(--sp-2); }
  .selection-bar { left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); max-width: none; transform: translate(0, calc(100% + var(--sp-6))); }
  .selection-bar.is-visible { transform: translate(0, 0); }
  .lab-bar { left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); max-width: none; transform: translate(0, calc(100% + var(--sp-6))); }
  .lab-bar.is-visible { transform: translate(0, 0); }
}

/* ==========================================================================
   Gerador de vídeos IA: hub, novo projeto, projeto por etapas
   ========================================================================== */

/* Estado do worker: uma pílula discreta com menu. */
.flow-worker { position: relative; }
.flow-worker > summary { list-style: none; }
.flow-worker > summary::-webkit-details-marker { display: none; }
.flow-worker__pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--s2); color: var(--fg-2);
  font-size: 13px; font-weight: 500; cursor: pointer; user-select: none;
}
.flow-worker__pill:hover { border-color: var(--line-2); color: var(--fg); }
.flow-worker__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-3); }
.flow-worker__pill--on .flow-worker__dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.flow-worker__pill--off .flow-worker__dot { background: var(--st-dead-ink); }
.flow-worker__menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  display: grid; gap: 2px; width: 250px; padding: 6px;
  background: var(--s3); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--pop-lg);
}
.flow-worker__menu form { margin: 0; }
.flow-worker__menu .hint { margin: 0; padding: 6px 8px; }
.flow-worker__info { display: grid; gap: 2px; padding: 8px 8px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.flow-worker__info .hint { padding: 0; }
.flow-worker__item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--fg); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.flow-worker__item:hover { background: var(--s2-hover); text-decoration: none; }

/* Projetos em cartões. */
.flow-projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--sp-4); }
.flow-card {
  display: grid; grid-template-rows: auto 1fr; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--s2); color: var(--fg); text-decoration: none;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), transform var(--t) var(--ease);
}
.flow-card:hover { border-color: var(--line-2); box-shadow: var(--pop); transform: translateY(-2px); text-decoration: none; }
.flow-card__cover {
  position: relative; display: grid; place-items: center;
  aspect-ratio: 4 / 5; overflow: hidden;
  background: linear-gradient(160deg, var(--s2-hover), var(--s0)); color: var(--fg-3);
}
.flow-card__cover img { width: 100%; height: 100%; object-fit: cover; }
.flow-card__stage {
  position: absolute; left: 10px; top: 10px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--st-draft-bg); color: var(--st-draft-ink);
}
.flow-card__stage--generating { background: var(--st-running-bg); color: var(--st-running-ink); }
.flow-card__stage--scenes { background: var(--st-saturating-bg); color: var(--st-saturating-ink); }
.flow-card__stage--edit, .flow-card__stage--rendered { background: var(--st-testing-bg); color: var(--st-testing-ink); }
.flow-card__stage--exported { background: var(--st-winner-bg); color: var(--st-winner-ink); }
.flow-card__body { display: grid; align-content: start; gap: 6px; padding: var(--sp-3) var(--sp-4) var(--sp-4); }
.flow-card__body .hint { margin: 0; font-size: 12px; }
.flow-card__title { font-size: 14.5px; line-height: 1.3; overflow-wrap: anywhere; }
.flow-card__progress { display: block; height: 4px; overflow: hidden; border-radius: 999px; background: var(--s2-hover); }
.flow-card__progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.flow-card--new {
  grid-template-rows: none; place-content: center; justify-items: center; gap: var(--sp-2);
  min-height: 260px; padding: var(--sp-5); text-align: center;
  border-style: dashed; background: transparent;
}
.flow-card--new .hint { max-width: 180px; margin: 0; }
.flow-card__plus {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
}

/* Etapas (novo projeto e projeto). */
.flow-steps { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); margin: 0 0 var(--sp-4); padding: 0; list-style: none; }
.flow-steps li { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-3); font-size: 13.5px; font-weight: 500; }
.flow-steps li[data-step-label] { cursor: pointer; }
.flow-steps li > span {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--s2); font-size: 12px; font-weight: 600;
}
.flow-steps li.is-active { color: var(--fg); }
.flow-steps li.is-active > span { border-color: var(--accent); background: var(--accent); color: #fff; }
.flow-steps li.is-done > span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.flow-steps--project { margin: var(--sp-4) 0 0; }

/* Novo projeto. */
.flow-wizard { max-width: 820px; }
.flow-wizard__step[hidden] { display: none; }
.flow-wizard__body { display: grid; gap: var(--sp-4); }
.flow-wizard__nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-2); margin-top: var(--sp-2); }
.flow-wizard__small { max-width: 260px; }
.input--lg { height: 48px; font-size: 17px; }

.flow-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-2); }
.flow-preset {
  display: grid; gap: 4px; padding: var(--sp-3);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--s2); color: var(--fg); font: inherit; text-align: left; cursor: pointer;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.flow-preset:hover { border-color: var(--line-2); background: var(--s2-hover); }
.flow-preset strong { font-size: 13.5px; }
.flow-preset span { color: var(--fg-3); font-size: 12px; line-height: 1.4; }
.flow-preset.is-selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.flow-preset--blank { border-style: dashed; }
.flow-presets--compact { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--sp-2); }
.flow-presets--compact .flow-preset { padding: 6px 10px; border-radius: 999px; }
.flow-presets--compact .flow-preset strong { font-size: 12.5px; font-weight: 500; }

/* Configurações. */
.flow-settings-form { display: grid; gap: var(--sp-4); }
.flow-inline-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.flow-inline-actions form { margin: 0; }

/* Projeto por etapas. */
.flow-project { display: grid; gap: var(--sp-4); }
.flow-hero { overflow: hidden; }
.flow-progress { display: grid; gap: var(--sp-3); padding: var(--sp-5); }
.flow-progress__main { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.flow-progress__main .hint { margin: 4px 0 0; max-width: 620px; }
.flow-progress__main form { margin: 0; }
.flow-progress__bar { height: 8px; overflow: hidden; border-radius: 999px; background: var(--s2-hover); }
.flow-progress__bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.4s var(--ease); }
.flow-progress > .hint { margin: 0; }

.flow-final { display: grid; grid-template-columns: auto minmax(0, 1fr); }
.flow-final__player { display: grid; place-items: center; width: min(340px, calc(68vh * 9 / 16)); aspect-ratio: 9 / 16; background: #0b0f17; }
.flow-final__player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.flow-final__empty { display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-5); color: #c9d1dd; text-align: center; }
.flow-final__empty .hint { color: #98a2b3; }
.flow-final__side { display: grid; align-content: start; gap: var(--sp-4); padding: var(--sp-5); }
.flow-final__side .hint { margin: 4px 0 0; }
.flow-final__export { display: grid; gap: var(--sp-2); max-width: 340px; }
.flow-final__export form { margin: 0; }
.flow-final__export .btn { justify-content: center; }
.flow-final__actions { display: grid; gap: var(--sp-3); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.flow-final__actions > .btn { justify-self: start; }
.flow-render-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); margin: 0; }
.flow-older { display: grid; gap: 6px; margin: var(--sp-2) 0 0; padding: 0; list-style: none; font-size: 13px; }
.flow-older li { display: flex; flex-wrap: wrap; gap: 6px; }

/* Blocos recolhíveis (storyboard, mídias, roteiro). */
.flow-fold { border: 1px solid var(--line); border-radius: var(--r); background: var(--s2); }
.flow-fold > summary {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5); list-style: none; cursor: pointer; user-select: none;
}
.flow-fold > summary::-webkit-details-marker { display: none; }
.flow-fold > summary > span:first-child { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.flow-fold > summary > span:first-child::after {
  content: ""; width: 7px; height: 7px; margin-left: 4px;
  border-right: 1.5px solid var(--fg-3); border-bottom: 1.5px solid var(--fg-3);
  transform: rotate(-45deg); transition: transform var(--t) var(--ease);
}
.flow-fold[open] > summary > span:first-child::after { transform: rotate(45deg); }
.flow-fold > summary .hint { margin: 0; }
.flow-fold[open] > summary { border-bottom: 1px solid var(--line); }
.flow-fold__body { display: grid; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5) var(--sp-5); }
.flow-fold__body > .hint { margin: 0; }
.flow-fold--inline { border: 0; background: none; }
.flow-fold--inline > summary { justify-content: flex-start; padding: 0; color: var(--fg-2); font-size: 13px; }
.flow-fold--inline > summary > span:first-child::after { display: none; }
.flow-fold--inline[open] > summary { border: 0; }

@media (max-width: 760px) {
  .flow-final { grid-template-columns: minmax(0, 1fr); }
  .flow-final__player { width: 100%; max-height: 70vh; aspect-ratio: auto; }
  .flow-final__player video { max-height: 70vh; }
  .flow-projects { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
  .flow-worker__menu { right: auto; left: 0; }
}
.flow-worker__pill { white-space: nowrap; }
.flow-hub-actions { flex-wrap: wrap; }
@media (max-width: 760px) {
  .flow-hub-actions { justify-content: flex-start; }
  .flow-hub-actions .btn--secondary { padding-inline: 10px; }
}
.flow-danger-link { color: var(--down-ink); }
.flow-finish-summary { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; color: var(--fg-2); font-size: 13px; }
.flow-finish-summary span { display: inline-flex; align-items: center; gap: 5px; }

/* Biblioteca de mídias por categoria */
.flow-library { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.flow-media__cat { justify-self: start; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 600; }
.flow-media--music .flow-media__cat { background: var(--st-testing-bg); color: var(--st-testing-ink); }
.flow-media--sfx .flow-media__cat { background: var(--st-saturating-bg); color: var(--st-saturating-ink); }
.flow-media--music .flow-media__audio, .flow-media--sfx .flow-media__audio {
  display: grid; gap: var(--sp-2); justify-items: center; padding: var(--sp-4) var(--sp-3);
  background: linear-gradient(160deg, #1d2430, #0f141c); color: #fff;
}
.flow-media__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.08); }
.flow-media__audio audio { width: 100%; height: 34px; }
.flow-media__mood { margin: 0; color: var(--fg-2); font-size: 12px; }
.flow-media__desc > summary { cursor: pointer; }
.flow-media__desc p { margin-top: var(--sp-2); max-height: 220px; overflow-y: auto; }
.flow-media__tags { display: flex; flex-wrap: wrap; gap: 4px; }
.flow-media__tags span { padding: 1px 7px; border-radius: 999px; background: var(--s2-hover); color: var(--fg-3); font-size: 11px; }
.flow-media__form { display: grid; gap: var(--sp-2); }

/* ==========================================================================
   Laboratório de IA (Comparações) e ficha do criativo
   ========================================================================== */
.lab-action--on { background: transparent; color: #fff; cursor: pointer; font: inherit; font-size: 13px; }
.lab-action--on svg { color: #7ee2b8; }
.lab-action--on:hover { border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.08); }

.lab-card__chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.lab-verdict, .lab-ficha {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.lab-verdict--win  { background: var(--st-winner-bg); color: var(--st-winner-ink); }
.lab-verdict--up   { background: var(--st-scaling-bg); color: var(--st-scaling-ink); }
.lab-verdict--mid  { background: var(--st-testing-bg); color: var(--st-testing-ink); }
.lab-verdict--loss { background: var(--st-dead-bg); color: var(--st-dead-ink); }
.lab-verdict--none { background: var(--st-draft-bg); color: var(--st-draft-ink); }
.lab-ficha { background: var(--accent-soft); color: var(--accent); }
.lab-ficha--busy { background: var(--st-running-bg); color: var(--st-running-ink); }
.lab-ficha--busy .spinner { width: 10px; height: 10px; border-width: 1.5px; }
.lab-ficha--fail { background: var(--st-dead-bg); color: var(--st-dead-ink); }

.lab-results { display: grid; gap: var(--sp-5); margin-top: var(--sp-5); }
.lab-results:empty { display: none; }
.lab-page { padding-bottom: 96px; }
.lab-loading { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-5); border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--s2); }
.lab-loading .hint { margin: 2px 0 0; }

.lab-compose { display: grid; gap: var(--sp-4); }
.lab-compose__selected { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-compose__selected span { padding: 3px 9px; border-radius: 999px; background: var(--s2-hover); font-size: 12px; font-weight: 600; }
.lab-compose__count { max-width: 160px; }

.lab-run { display: grid; gap: var(--sp-4); padding: var(--sp-5); border: 1px solid var(--line); border-radius: var(--r); background: var(--s2); box-shadow: var(--pop); }
.lab-run__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.lab-run__kind { margin-right: 8px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.lab-run__codes { color: var(--fg-3); font-size: 13px; }
.lab-run__headline { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.4; }
.lab-run__title { margin: var(--sp-2) 0 0; font-size: 14px; }
.lab-run__warning { display: flex; gap: 8px; align-items: flex-start; }

.lab-verdicts { display: grid; gap: var(--sp-2); }
.lab-verdict-row { display: grid; grid-template-columns: auto auto 1fr; gap: 6px 10px; align-items: baseline; }
.lab-verdict-row p { grid-column: 1 / -1; margin: 0; color: var(--fg-2); font-size: 13.5px; line-height: 1.5; }
.lab-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-3); }
.lab-box { padding: var(--sp-4); border-radius: var(--r-sm); background: var(--s0); }
.lab-box h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 var(--sp-2); font-size: 13.5px; }
.lab-box--win h3 { color: var(--st-winner-ink); }
.lab-box--loss h3 { color: var(--st-dead-ink); }
.lab-box p, .lab-box li { margin: 0 0 6px; font-size: 13.5px; line-height: 1.5; }
.lab-box ul { margin: 0; padding-left: 18px; }
.lab-diff td { font-size: 13px; line-height: 1.45; vertical-align: top; }
.lab-hypotheses { display: grid; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.lab-hypotheses li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.lab-hypotheses p { margin: 2px 0 0; }
.lab-tests { display: grid; gap: var(--sp-3); }
.lab-test { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-sm); }
.lab-test__n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; }
.lab-test p { margin: 4px 0; }
.lab-test__example { font-style: italic; color: var(--fg-2); font-size: 13.5px; }

.lab-dna { padding: var(--sp-3); border-radius: var(--r-sm); background: var(--accent-soft); font-size: 13px; line-height: 1.5; }
.lab-dna strong { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); }
.lab-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--sp-3); }
.lab-item { display: grid; align-content: start; gap: var(--sp-2); padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--s0); }
.lab-item__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.lab-item__head strong { font-size: 14.5px; }
.lab-item__var { padding: 2px 8px; border-radius: 999px; background: var(--st-scaling-bg); color: var(--st-scaling-ink); font-size: 11px; font-weight: 700; }
.lab-item__change { margin: 0; color: var(--fg-2); font-size: 13px; }
.lab-item__hook { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
.lab-item__script > summary { cursor: pointer; color: var(--fg-3); font-size: 12.5px; }
.lab-item__script pre { margin: 6px 0 0; padding: var(--sp-3); border-radius: var(--r-sm); background: var(--s2); white-space: pre-wrap; font-family: inherit; font-size: 13.5px; line-height: 1.55; max-height: 380px; overflow-y: auto; }
.lab-item__meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; font-size: 12.5px; line-height: 1.45; }
.lab-item__meta dt { color: var(--fg-3); font-weight: 600; }
.lab-item__meta dd { margin: 0; color: var(--fg-2); }
.lab-item__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-1); }
.lab-item__actions form { margin: 0; }
.lab-item__actions .is-done { color: var(--st-winner-ink); }

.lab-history { margin-top: var(--sp-6); }
.lab-history__list { margin: 0; padding: 0; list-style: none; }
.lab-history__list li + li { border-top: 1px solid var(--line); }
.lab-history__list a { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 12px var(--sp-5); color: var(--fg); text-decoration: none; }
.lab-history__list a:hover { background: var(--s2-hover); }
.lab-history__kind { font-weight: 600; }
.lab-history__codes { color: var(--fg-2); font-size: 13px; }
.lab-history__meta { margin-left: auto; }

/* Ficha da IA na página do criativo */
.ficha { display: grid; gap: var(--sp-4); }
.ficha__summary { margin: 0; font-size: 14.5px; line-height: 1.55; }
.ficha__hook { padding: var(--sp-3) var(--sp-4); border-left: 3px solid var(--accent); border-radius: var(--r-sm); background: var(--s0); }
.ficha__hook q { display: block; font-size: 15px; font-weight: 600; line-height: 1.45; }
.ficha__hook p { margin: 4px 0 0; }
.ficha__timeline { display: flex; height: 30px; overflow: hidden; border-radius: var(--r-sm); }
.ficha__timeline span { display: grid; place-items: center; min-width: 0; padding: 0 4px; overflow: hidden; color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.ficha__blocks { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ficha__blocks li { display: grid; grid-template-columns: 90px 1fr; gap: 10px; font-size: 13px; line-height: 1.45; }
.ficha__blocks b { color: var(--fg-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.ficha__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-3); }
.ficha__cell { padding: var(--sp-3); border-radius: var(--r-sm); background: var(--s0); }
.ficha__cell h4 { margin: 0 0 4px; color: var(--fg-3); font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.ficha__cell p, .ficha__cell li { margin: 0; font-size: 13.5px; line-height: 1.5; }
.ficha__cell ul { margin: 0; padding-left: 18px; }
.ficha__swap { display: grid; gap: var(--sp-2); }
.ficha__swap div { font-size: 13px; line-height: 1.5; }
.ficha__swap span { color: var(--fg-3); }
.ficha__transcript { white-space: pre-wrap; font-family: inherit; font-size: 13px; line-height: 1.6; margin: 0; max-height: 320px; overflow-y: auto; }
.ficha__state { display: flex; align-items: center; gap: 10px; padding: var(--sp-5); color: var(--fg-2); }
.ficha-b--hook { background: #d97706; }
.ficha-b--dor { background: #b91c1c; }
.ficha-b--passagem { background: #7c3aed; }
.ficha-b--historia { background: #6d28d9; }
.ficha-b--ensino, .ficha-b--contexto { background: #2563eb; }
.ficha-b--prova { background: #0891b2; }
.ficha-b--solucao { background: #059669; }
.ficha-b--oferta, .ficha-b--bonus { background: #047857; }
.ficha-b--urgencia { background: #be185d; }
.ficha-b--cta { background: #111827; }
.ficha-b--outro { background: #64748b; }
@media (max-width: 760px) {
  .lab-items { grid-template-columns: minmax(0, 1fr); }
  .ficha__blocks li { grid-template-columns: 70px 1fr; }
}
.idea-card__ai { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.idea-card__hook { margin: 0 0 6px; font-weight: 600; font-size: 13.5px; line-height: 1.4; }
.idea-card__project { margin: 8px 0 0; }
.idea-card .lab-item__script pre { max-height: 220px; }
.system-actions { display: grid; gap: var(--sp-3); margin-top: var(--sp-5); }
.system-action { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-sm); }
.system-action .hint { margin: 4px 0 0; }
.system-action form { margin: 0; }
/* Aviso da IA no canto (mesmo visual do envio de criativos) */
.ai-tray { z-index: 181; }
body.has-upload-tray .ai-tray { bottom: calc(var(--sp-5) + 320px); }
.ai-task { color: inherit; text-decoration: none; }
a.ai-task:hover { background: var(--s2-hover); text-decoration: none; }
.ai-task .spinner { width: 14px; height: 14px; }
.ai-task.is-done:not(.is-error) .upload-item__meta { color: var(--up-ink); }
.ai-task .upload-item__name { white-space: normal; }
.ai-tray__actions { display: inline-flex; gap: 2px; }
.ai-tray .upload-tray__title { cursor: default; }
.ai-tray.is-min .upload-tray__list { display: none; }
.ai-tray.is-min .upload-tray__head { border-bottom: 0; }
.ai-tray.is-min .upload-tray__title { cursor: pointer; }
.ai-task__detail { display: block; overflow: hidden; color: var(--fg-3); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.ai-tray .upload-item__bar { display: block; height: 3px; margin-top: 6px; overflow: hidden; border-radius: 999px; background: var(--s2-hover); }
.ai-tray .upload-item__fill { display: block; height: 100%; background: var(--accent); transition: width .4s var(--ease); }
/* Conhecimento da IA do produto */
.knowledge-grid { display: grid; gap: var(--sp-4); }
.knowledge-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.knowledge-form { display: grid; gap: var(--sp-3); }
.knowledge-text { min-height: 540px; font-size: 13.5px; line-height: 1.55; }
.knowledge-form__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.knowledge-form__foot .hint { margin: 0; max-width: 520px; }
.knowledge-draft__text { margin: 0; max-height: 640px; overflow-y: auto; white-space: pre-wrap; font-family: inherit; font-size: 13.5px; line-height: 1.55; }
@media (max-width: 1100px) { .knowledge-grid--two { grid-template-columns: minmax(0, 1fr); } }
.product-knowledge-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; color: var(--warn-ink, #b45309); font-size: 12px; font-weight: 600; text-decoration: none; }
.product-knowledge-link.is-set { color: var(--accent); }
.product-knowledge-link:hover { text-decoration: underline; }
.flow-final__player[data-aspect="4:5"] { width: min(420px, calc(68vh * 4 / 5)); aspect-ratio: 4 / 5; }

/* Gerador · personagens */
.flow-characters { display: grid; gap: var(--sp-4); }
.flow-character { padding: var(--sp-4); border: 1px solid var(--line); border-radius: 10px; }
.flow-character__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4); }
.flow-character__foot .btn { margin-left: auto; }

/* Gerador · formato do vídeo (novo projeto) */
.flow-format-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-3); }
.flow-format-option { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.flow-format-option:has(input:checked) { border-color: var(--primary, #2563eb); box-shadow: 0 0 0 1px var(--primary, #2563eb); }
.flow-format-option input { margin-top: 3px; }
.flow-format-option span { display: grid; gap: 4px; }
.flow-format-option small { color: var(--muted, #6b7280); line-height: 1.4; }
.flow-scene--background { margin-left: var(--sp-6); border-left: 3px solid var(--line); }
.flow-scene__layer { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; background: #0f5132; color: #d1fae5; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.flow-final__player[data-aspect="3:4"] { width: min(400px, calc(68vh * 3 / 4)); aspect-ratio: 3 / 4; }

/* ==========================================================================
   Integração Meta Ads e tela Performance
   Mesmos tokens e componentes do resto (painel, kpis, tabela, segmented).
   ========================================================================== */

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
  background: var(--s2-sunk);
  color: var(--fg-3);
  border: 1px solid var(--line);
}
.meta-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--fg-4); }
.meta-badge--ok { color: var(--up-ink); }
.meta-badge--ok::before { background: var(--up); }
.meta-badge--warn { color: var(--warn-ink); }
.meta-badge--warn::before { background: var(--warn); }
.meta-badge--bad { color: var(--down-ink); }
.meta-badge--bad::before { background: var(--down); }

.meta-connect {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  flex-wrap: wrap;
}
.meta-connect .hint { margin-top: 4px; }
.meta-connect__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-strong);
  flex: none;
}

.meta-error { margin-top: 2px; font-size: 11.5px; color: var(--down-ink); display: flex; align-items: center; gap: 4px; }
.meta-code { font-family: var(--font-mono); font-size: 11.5px; word-break: break-all; }
.meta-progress {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12.5px;
  font-weight: 500;
}
.meta-progress.hidden { display: none; }
tr.is-muted td { color: var(--fg-4); }

.meta-client-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px 180px 90px;
  gap: var(--sp-3);
  align-items: center;
  padding: 8px var(--sp-4);
}
.meta-client-row .num { text-align: right; }

/* --- Performance ---------------------------------------------------------- */

.perf-toolbar { align-items: flex-end; }
.perf-field { display: flex; flex-direction: column; gap: 4px; }
.perf-field__label { font-size: 11.5px; color: var(--fg-3); font-weight: 500; }
.perf-field .select { min-width: 170px; }
.perf-field .segmented { position: relative; }
.perf-field .segmented__item { cursor: pointer; position: relative; }
.perf-custom.hidden { display: none; }
.perf-custom .input { width: 150px; }

.perf-sync { display: inline-flex; align-items: center; font-size: 12.5px; color: var(--fg-3); margin-right: var(--sp-2); white-space: nowrap; cursor: help; }
.perf-sync--stale { color: var(--warn-ink); }
.perf-sync--error { color: var(--down-ink); }
.perf-sync--quota { color: var(--warn-ink); }

.perf-crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; color: var(--fg-3); }
.perf-crumbs a { color: var(--fg-2); }
.perf-crumbs a:hover { color: var(--accent-strong); }

.perf-kpis { gap: 1px; background: var(--line); }
.perf-kpis .kpi { background: var(--s2); border: 0; }
.perf-kpis .kpi__foot { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.perf-table-wrap {
  overflow: auto;
  max-height: calc(100vh - var(--topbar-h) - 120px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--s2);
}
.perf-table { min-width: 1900px; font-size: 13px; }
.perf-table thead th { position: sticky; top: 0; z-index: 2; white-space: nowrap; }
.perf-table td { white-space: nowrap; }
.perf-table .perf-sticky {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--s2);
  min-width: 280px;
  max-width: 360px;
  box-shadow: 1px 0 0 var(--line);
}
.perf-table thead .perf-sticky { z-index: 3; }
.perf-table tbody tr:hover .perf-sticky { background: var(--row-hover); }
.perf-name { overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.perf-name a { color: var(--fg); }
.perf-name a:hover { color: var(--accent-strong); text-decoration: underline; }
.perf-sub { font-size: 11px; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.perf-sort { color: inherit; }
.perf-sort:hover { color: var(--fg); }
.perf-sort.is-desc::after { content: ' ↓'; }
.perf-sort.is-asc::after { content: ' ↑'; }

/* --- Modal de vínculo ------------------------------------------------------ */

.meta-picker__filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.meta-picker__filters .input { grid-column: 1 / -1; }
.meta-picker__list {
  margin-top: var(--sp-3);
  max-height: 46vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.meta-picker__item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: var(--sp-3);
  align-items: center;
  padding: 10px var(--sp-3);
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.meta-picker__item:last-child { border-bottom: 0; }
.meta-picker__item:hover { background: var(--row-hover); }
.meta-picker__item.is-linked { cursor: default; opacity: 0.6; }
.meta-picker__main { display: flex; flex-direction: column; min-width: 0; }
.meta-picker__name { font-weight: 550; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-picker__sub { font-size: 11.5px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-picker__side { font-size: 12px; color: var(--fg-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.meta-picker__state { display: flex; align-items: center; gap: 8px; padding: var(--sp-5); color: var(--fg-3); font-size: 13px; justify-content: center; }

@media (max-width: 1100px) {
  .perf-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .perf-field, .perf-field .select { width: 100%; }
  .perf-field .segmented { overflow-x: auto; max-width: 100%; }
  .perf-table-wrap { max-height: none; }
  .meta-client-row { grid-template-columns: minmax(0, 1fr) 90px; }
  .meta-client-row .num { display: none; }
  .meta-picker__filters { grid-template-columns: minmax(0, 1fr); }
  .meta-picker__item { grid-template-columns: 20px minmax(0, 1fr); }
  .meta-picker__side { grid-column: 2; }
}
.meta-client-head { padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--fg-3); font-weight: 500; }
.meta-client-list > form + form { border-top: 1px solid var(--line-soft); }
.meta-source-note { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.meta-urls { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--sp-4); margin-top: var(--sp-2); font-size: 12.5px; }
.meta-urls dt { color: var(--fg-3); }
.meta-urls dd { margin: 0; }
@media (max-width: 720px) { .meta-urls { grid-template-columns: minmax(0, 1fr); } }

/* Divisórias verticais bem leves: ajudam a seguir a coluna numa tabela larga. */
.perf-table th + th,
.perf-table td + td { border-left: 1px solid var(--line-soft); }
.perf-levels { margin-bottom: 0; }
.perf-creative { display: flex; align-items: center; gap: 10px; min-width: 0; }
.perf-creative .thumb { flex: none; border-radius: var(--r-xs); }
.perf-creative .thumb img { width: 100%; height: 100%; object-fit: cover; }
.perf-creative__text { min-width: 0; }
.perf-table td.up { color: var(--up-ink); font-weight: 550; }
.perf-table td.down { color: var(--down-ink); font-weight: 550; }

/* Aba de níveis + seleção (Performance) */
.perf-levelbar { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.perf-levelbar .tabs { border-bottom: 0; }
.perf-levels .tab { gap: 6px; }
.perf-levels__count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; }
.perf-levels__count.hidden { display: none; }
.perf-group { margin-bottom: 6px; }
.perf-group .segmented__item { text-decoration: none; }
.perf-selection { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.perf-selection .chip { max-width: 420px; }
.perf-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.perf-cell .check { flex: none; }
.perf-cell .thumb { flex: none; border-radius: var(--r-xs); }
.perf-cell .thumb img { width: 100%; height: 100%; object-fit: cover; }
.perf-cell__text { display: flex; flex-direction: column; min-width: 0; }
.perf-head { display: inline-flex; align-items: center; gap: 10px; }
.perf-table tbody tr.is-selected td { background: var(--accent-soft); }
.perf-table tbody tr.is-selected .perf-sticky { background: var(--accent-soft); }
.perf-actions-col { width: 40px; padding-left: 4px !important; padding-right: 4px !important; }
.perf-actions-note { max-width: 260px; white-space: normal; line-height: 1.4; font-size: 11.5px; color: var(--warn-ink); }
.perf-table .dropdown__menu { min-width: 220px; }
.dropdown__item[disabled] { opacity: 0.45; cursor: not-allowed; }

/* --- Performance v3: caixa, chave, lápis, totais, celular ------------------- */

.perf-check {
  width: 14px;
  height: 14px;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}
.perf-head__toggle { font-size: 11px; color: var(--fg-3); font-weight: 500; width: 30px; }
.perf-switch { flex: none; }
.perf-switch .switch__track { width: 30px; height: 17px; }
.perf-switch .switch__track::after { width: 13px; height: 13px; }
.perf-switch input:checked + .switch__track::after { transform: translateX(13px); }
.perf-switch input:disabled + .switch__track { opacity: 0.45; cursor: not-allowed; }

.perf-budget__view { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.perf-budget__view.hidden { display: none; }
.perf-pencil {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--fg-4);
  cursor: pointer;
}
.perf-pencil:hover:not([disabled]) { background: var(--accent-soft); color: var(--accent-strong); }
.perf-pencil[disabled] { opacity: 0.4; cursor: not-allowed; }
.perf-budget__edit { display: inline-flex; align-items: center; gap: 4px; }
.perf-budget__edit .input { width: 96px; height: 30px; padding: 0 8px; text-align: right; }
.perf-budget__edit.is-busy { opacity: 0.6; }
.perf-budget__btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  background: var(--s2);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.perf-budget__btn--ok { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Rodapé de totais: fixo na base da área da tabela, como no Gerenciador. */
.perf-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--s2-sunk);
  border-top: 1px solid var(--line-2);
  font-weight: 600;
  white-space: nowrap;
}
.perf-table tfoot .perf-sticky { z-index: 4; background: var(--s2-sunk); }
.perf-table tfoot.is-loading td { opacity: 0.55; }
.perf-total__label { display: flex; flex-direction: column; line-height: 1.25; }
.perf-total__label .muted { font-size: 11.5px; font-weight: 500; }
.perf-table tfoot td.up { color: var(--up-ink); }
.perf-table tfoot td.down { color: var(--down-ink); }

@media (max-width: 720px) {
  /* Filtros não ficam presos no topo: no celular ocupariam meia tela. */
  .perf-toolbar { position: static; padding-top: 0; }
  .perf-toolbar .perf-field { flex: 1 1 100%; }
  .perf-custom .input { width: auto; flex: 1; }
  .pagehead__actions .perf-sync { margin-right: auto; }

  .perf-levelbar { align-items: stretch; }
  .perf-levelbar .tabs { overflow-x: auto; flex-wrap: nowrap; width: 100%; }
  .perf-group { width: 100%; display: flex; }
  .perf-group .segmented__item { flex: 1; justify-content: center; }

  .perf-table-wrap { max-height: calc(100vh - 120px); }
  .perf-table { font-size: 12.5px; min-width: 1500px; }
  .perf-table .perf-sticky { min-width: 180px; max-width: 200px; }
  .perf-cell { gap: 8px; }
  .perf-cell .thumb { width: 30px; height: 30px; }
  .perf-sub { max-width: 150px; }
  .perf-check { width: 16px; height: 16px; }
  .perf-pencil { width: 30px; height: 30px; }
  .perf-budget__edit .input { width: 84px; height: 32px; font-size: 16px; }
  .perf-budget__btn { width: 32px; height: 32px; }
  .perf-selection .chip { max-width: 100%; }
}
@media (max-width: 720px) {
  .perf-table .perf-sticky { min-width: 215px; max-width: 230px; white-space: normal; }
  .perf-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.25; }
  .perf-sub { white-space: nowrap; }
  .perf-head__toggle { display: none; }
}

/* Rodapé de totais com a MESMA grade das linhas: espaçamento, alinhamento à
   direita dos números e algarismos tabulares. */
.perf-table tfoot td {
  height: 52px;
  padding: var(--sp-2) var(--sp-3);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.perf-table tfoot td:first-child { padding-left: var(--sp-4); }
.perf-table tfoot td:last-child { padding-right: var(--sp-4); }
.perf-table tfoot td.is-numeric { text-align: right; }
.perf-table tfoot .perf-sub { font-weight: 500; }

/* Espaço do lápis reservado em toda célula de orçamento de campanha (com ou
   sem lápis, e no total): os valores terminam todos na mesma linha vertical. */
.perf-pencil-spacer { display: inline-block; width: 22px; flex: none; }
[data-perf-table="campaigns"] .perf-budget__view + .perf-sub,
[data-perf-table="campaigns"] .perf-budget-total .perf-sub { padding-right: 28px; }

/* ==========================================================================
   Análise IA (agente diário)
   ========================================================================== */
.ai-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: var(--sp-6); align-items: start; }
.ai-reportline { font-size: 13px; color: var(--fg-2); }
.ai-kpis .kpi__value { white-space: nowrap; }
.ai-summary__text { margin-top: var(--sp-2); line-height: 1.6; font-size: 14px; }
.ai-summary__pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-top: var(--sp-3); }
.ai-summary__item { padding: var(--sp-3); border-radius: var(--r-sm); font-size: 13px; line-height: 1.5; border: 1px solid var(--line); }
.ai-summary__item span { display: block; font-size: 11.5px; font-weight: 600; margin-bottom: 2px; }
.ai-summary__item--up { background: var(--accent-soft); }
.ai-summary__item--up span { color: var(--up-ink); }
.ai-summary__item--down { background: #fef3f2; }
.ai-summary__item--down span { color: var(--down-ink); }
.ai-section-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 650; }
.ai-count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--s2-sunk); border: 1px solid var(--line); font-size: 11.5px; color: var(--fg-3); }
.ai-none { margin-top: var(--sp-2); }
.ai-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-top: var(--sp-3); }
.ai-card { background: var(--s2); border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: var(--r); padding: var(--sp-4); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ai-card--action { border-left-color: var(--down); }
.ai-card--watch { border-left-color: var(--warn); }
.ai-card--opportunity { border-left-color: var(--up); }
.ai-card__head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.ai-card__who { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ai-card__code { font-weight: 700; color: var(--fg); }
.ai-card__code:hover { color: var(--accent-strong); }
.ai-card__name { color: var(--fg-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-card__tags { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-type { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); white-space: nowrap; }
.ai-type--action { background: #fef3f2; color: var(--down-ink); }
.ai-type--watch { background: #fffaeb; color: var(--warn-ink); }
.ai-type--opportunity { background: var(--accent-soft); color: var(--up-ink); }
.ai-conf { font-size: 11.5px; padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--fg-2); }
.ai-conf--high { border-color: var(--fg-3); font-weight: 600; }
.ai-card__title { font-size: 14.5px; font-weight: 650; line-height: 1.35; }
.ai-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.ai-metrics div { background: var(--s2-sunk); padding: 6px 8px; }
.ai-metrics dt { font-size: 10.5px; color: var(--fg-3); }
.ai-metrics dd { margin: 0; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ai-card__meta { font-size: 11.5px; color: var(--fg-3); }
.ai-card__reason { font-size: 13.5px; line-height: 1.55; }
.ai-block__label { display: block; font-size: 11.5px; font-weight: 600; color: var(--fg-3); margin-bottom: 2px; }
.ai-block p { font-size: 13px; line-height: 1.55; }
.ai-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.55; }
.ai-card__foot { display: flex; align-items: center; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line-soft); margin-top: auto; flex-wrap: wrap; }
.ai-thumb { width: 32px; height: 30px; border: 1px solid var(--line); border-radius: var(--r-xs); background: var(--s2); cursor: pointer; font-size: 14px; filter: grayscale(1); opacity: 0.7; }
.ai-thumb.is-on { filter: none; opacity: 1; border-color: var(--accent); background: var(--accent-soft); }
.ai-decision { height: 30px; font-size: 12.5px; margin-left: auto; max-width: 190px; }
.ai-rows { display: grid; gap: var(--sp-2); margin-top: var(--sp-3); }
.ai-row { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--s2); }
.ai-tests { margin: var(--sp-3) 0 0; padding-left: 20px; display: grid; gap: var(--sp-3); font-size: 13.5px; }
.ai-history { position: sticky; top: calc(var(--topbar-h) + 16px); background: var(--s2); border: 1px solid var(--line); border-radius: var(--r); padding: var(--sp-4); margin-top: var(--sp-5); }
.ai-history ul { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: grid; gap: 2px; max-height: 60vh; overflow: auto; }
.ai-history a { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; border-radius: var(--r-xs); font-size: 13px; color: var(--fg-2); }
.ai-history a:hover, .ai-history a.is-active { background: var(--accent-soft); color: var(--fg); }
.ai-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-4); }
.ai-dot--success { background: var(--up); }
.ai-dot--error { background: var(--down); }
.ai-dot--skipped, .ai-dot--running { background: var(--warn); }
.ai-dot--superseded { background: var(--line-2); }

@media (max-width: 1100px) {
  .ai-layout { grid-template-columns: minmax(0, 1fr); }
  .ai-history { position: static; order: -1; margin-top: var(--sp-4); }
  .ai-history ul { display: flex; overflow-x: auto; max-height: none; }
  .ai-history a { white-space: nowrap; gap: 6px; }
  .ai-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .ai-summary__pair { grid-template-columns: minmax(0, 1fr); }
  .ai-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-decision { margin-left: 0; max-width: none; flex: 1; }
}
.meta-client-row { grid-template-columns: minmax(0, 1fr) 60px 130px 110px 100px 80px; }
@media (max-width: 720px) {
  .meta-client-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meta-client-row > .input:first-of-type { grid-column: 1 / -1; }
}
/* Card da Análise IA: capa clicável e 10 números (5 × 2). */
.ai-card__head { flex-wrap: nowrap; align-items: flex-start; }
.ai-card__thumb { flex: none; width: 52px; height: 52px; border-radius: var(--r-sm); overflow: hidden; }
.ai-card__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t) var(--ease); }
.ai-card__thumb:hover img { transform: scale(1.06); }
.ai-card__head .ai-card__who { flex: 1; flex-direction: column; align-items: flex-start; gap: 2px; padding-top: 2px; }
.ai-card__head .ai-card__tags { justify-content: flex-end; }
.ai-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ai-metrics dd.up { color: var(--up-ink); }
.ai-metrics dd.down { color: var(--down-ink); }
@media (max-width: 720px) {
  .ai-card__head { flex-wrap: wrap; }
  .ai-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Escolha das contas após o Facebook: abre na hora e carrega a lista. */
.meta-loading { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-5); border: 1px dashed var(--line-2); border-radius: var(--r-sm); background: var(--s2-sunk); }
.meta-loading.hidden { display: none; }
.meta-loading .hint { margin-top: 2px; }
.meta-accounts-name { font-weight: 550; }
.meta-accounts-sub { font-size: 11.5px; }
.meta-accounts-status { display: inline; }
.meta-accounts-more { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-2); }

/* Contas vinculadas: sem rolagem fantasma (o menu "…" escondido contava como conteúdo). */
@media (min-width: 721px) {
  .meta-linked-wrap { overflow: visible; }
}

/* Popup de escolha das contas */
.meta-accounts-modal { width: min(720px, calc(100vw - 32px)); }
.meta-accounts-search { margin-bottom: var(--sp-3); }
.meta-accounts-search .input { width: 100%; }
.meta-accounts-list { max-height: min(52vh, 460px); overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.meta-accounts-list .meta-loading { border: 0; border-radius: 0; }
.meta-accounts-list > .notice { margin: var(--sp-3); }
.meta-account { display: grid; grid-template-columns: 18px 40px minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center; padding: 10px var(--sp-3); border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.meta-account:last-child { border-bottom: 0; }
.meta-account:hover { background: var(--row-hover); }
.meta-account.is-picked { background: var(--accent-soft); }
.meta-account__main { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.meta-account__name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-account__sub { font-size: 11.5px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.meta-account__tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.meta-account__client { width: 200px; height: 34px; }
.meta-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: hsl(var(--avatar-hue, 160) 45% 92%);
  color: hsl(var(--avatar-hue, 160) 45% 32%);
  font-size: 13px;
  font-weight: 700;
}
.meta-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 720px) {
  .meta-account { grid-template-columns: 18px 36px minmax(0, 1fr); }
  .meta-avatar { width: 36px; height: 36px; }
  .meta-account__client { grid-column: 3; width: 100%; }
}
.meta-accounts-modal .meta-accounts-more { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; margin-top: var(--sp-2); }
.meta-accounts-modal .meta-accounts-more .btn { white-space: normal; text-align: left; height: auto; min-height: 30px; }
@media (max-width: 720px) {
  .meta-accounts-modal .meta-accounts-more .btn { padding-left: 0; padding-right: 0; }
}
.meta-accounts-actions { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; }

/* Links legais no rodapé do login */
.auth__legal { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12px; }
.auth__legal a { color: var(--fg-3); text-decoration: none; }
.auth__legal a:hover { color: var(--fg); text-decoration: underline; }

/* Páginas públicas: Privacidade, Termos, Exclusão de dados */
.legal { max-width: 760px; margin: 0 auto; padding: var(--sp-6) var(--sp-4) var(--sp-8); }
.legal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-6); }
.legal__brand { margin-bottom: 0; text-decoration: none; }
.legal__nav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; }
.legal__nav a { color: var(--fg-3); text-decoration: none; }
.legal__nav a:hover, .legal__nav a[aria-current="page"] { color: var(--fg); }
.legal__nav a[aria-current="page"] { font-weight: 600; }
.legal__doc { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-md, 12px); padding: var(--sp-6) var(--sp-6) var(--sp-5); font-size: 14.5px; line-height: 1.7; color: var(--fg-2); }
.legal__doc h1 { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; color: var(--fg); line-height: 1.25; }
.legal__doc h2 { margin-top: var(--sp-6); margin-bottom: 6px; font-size: 16px; font-weight: 600; color: var(--fg); }
.legal__doc p, .legal__doc ul, .legal__doc ol { margin-top: 8px; }
.legal__doc ul, .legal__doc ol { padding-left: 1.3em; }
.legal__doc ul { list-style: disc; }
.legal__doc ol { list-style: decimal; }
.legal__doc li + li { margin-top: 4px; }
.legal__doc strong { color: var(--fg); font-weight: 600; }
.legal__doc a { color: var(--accent); }
.legal__doc code { font-size: 12.5px; padding: 1px 5px; border-radius: 4px; background: var(--s2-sunk); color: var(--fg); }
.legal__meta { margin-top: 4px !important; font-size: 12.5px; color: var(--fg-3); }
.legal__en { margin-top: var(--sp-6); padding-top: var(--sp-4); border-top: 1px solid var(--line); font-size: 13.5px; }
.legal__foot { margin-top: var(--sp-5); font-size: 12px; color: var(--fg-3); text-align: center; }
.legal__foot a { color: var(--fg-3); }
@media (max-width: 720px) {
  .legal__doc { padding: var(--sp-5) var(--sp-4); font-size: 14px; }
  .legal__doc h1 { font-size: 22px; }
}
.ai-stage { display: block; margin-top: 2px; font-weight: 400; opacity: .85; }
.ai-cancel { margin-left: auto; flex: 0 0 auto; }

/* ==========================================================================
   Aulas / treinamentos (vídeos 16:9). Regras novas; nada acima muda.
   ========================================================================== */
.lesson-course { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.lesson-course__head { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.lesson-course__head .section-title { display: inline-flex; align-items: center; gap: var(--sp-2); }
.lesson-course__head .btn { margin-left: auto; }
.lesson-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.lesson-card__cover { aspect-ratio: 16 / 9; }
.lesson-form { max-width: 1100px; }
/* Vídeo final horizontal: o player ocupa a largura e o painel vai para baixo. */
.flow-final--wide { grid-template-columns: minmax(0, 1fr); }
.flow-final__player[data-aspect="16:9"] { width: 100%; max-width: 1100px; aspect-ratio: 16 / 9; justify-self: center; }
