/* ==========================================================================
   Telas 11/12 — conteúdo do dashboard do PROJETO (projects/[id], view geral).
   Blocos na ordem da página real: ProjectOverviewHeader → ProjectHero →
   InsightsBlock → TopicRankingsBlock. O chrome (rail/topbar) fica em app.css.
   ========================================================================== */

/* --- cabeçalho da Visão Geral (project-overview-header.tsx) --- */
.poh {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px;
  padding: 20px 24px;
}
.poh-main { min-width: 0; flex: 1; }
.poh-titlerow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.poh-titlerow h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.015em; }
/* Pílula de status do monitoramento — o ponto é indicador FUNCIONAL de estado.
   Ativo = success (recipe tinta 10% + texto -strong, como no app real). */
.poh-status {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  border: 1px solid color-mix(in oklch, var(--success) 40%, transparent);
  background: color-mix(in oklch, var(--success) 10%, transparent);
  color: var(--success-strong);
  border-radius: 999px; padding: 2px 8px; font-size: 0.75rem; font-weight: 500;
}
.poh-status::before { content: ''; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.poh-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
  margin-top: 8px; font-size: 0.75rem; color: var(--muted-foreground);
}
.poh-meta > span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.poh-meta svg { width: 14px; height: 14px; flex: none; }
/* Sem flex:none: com shrink 0 a fileira de botões estoura a borda em 390px —
   aqui ela encolhe e os botões quebram linha dentro dela. */
.poh-actions { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 8px; }

/* --- hero de visibilidade (project-hero.tsx) --- */
/* Estado vazio (tela 11): anel sem número à esquerda, headline à direita. */
.hero-empty { display: grid; grid-template-columns: 300px 1fr; }
@media (max-width: 767px) { .hero-empty { grid-template-columns: 1fr; } }
.hero-empty-ring {
  display: flex; align-items: center; justify-content: center;
  border-right: 1px solid var(--border); padding: 34px 20px;
}
@media (max-width: 767px) { .hero-empty-ring { border-right: 0; border-bottom: 1px solid var(--border); } }
.hero-empty-ring > span {
  display: flex; width: 216px; height: 216px; align-items: center; justify-content: center;
  border: 14px solid var(--muted); border-radius: 999px;
  font-size: 3rem; font-weight: 700; color: var(--muted-foreground);
}
.hero-empty-body { padding: 34px 36px; }
@media (max-width: 767px) { .hero-empty-body { padding: 28px 20px; } }
.hero-empty-body h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.015em; }
.hero-empty-body p { margin-top: 16px; max-width: 600px; font-size: 0.875rem; color: var(--muted-foreground); }

/* Estado com dados (tela 12): cabeçalho com abas + painéis 300px/1fr. */
.hero-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px; }
.hero-head-main { min-width: 0; }
.hero-head-main h2 { font-size: 1rem; line-height: 22px; font-weight: 700; letter-spacing: -0.015em; }
.hero-head-main > p { font-size: 0.875rem; color: var(--muted-foreground); }
.hero-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Abas — skin do Tabs canônico shadcn (trilho muted, gatilho ativo = card). */
.tabs {
  display: inline-flex; align-items: center; gap: 2px; margin-top: 12px;
  border-radius: var(--radius-lg); background: var(--muted); padding: 3px;
}
.tabs button {
  display: inline-flex; height: 26px; align-items: center; border-radius: var(--radius-md);
  padding: 0 10px; font-size: 0.8125rem; font-weight: 500; color: var(--muted-foreground);
  cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
.tabs button[aria-selected='true'] {
  background: var(--background); color: var(--foreground);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.hero-panel { display: grid; grid-template-columns: minmax(220px, 30%) 1fr; border-top: 1px solid var(--border); }
@media (max-width: 767px) { .hero-panel { grid-template-columns: 1fr; } }
.hero-panel[hidden] { display: none; }
.hero-side { border-right: 1px solid var(--border); padding: 20px; min-width: 0; }
@media (max-width: 767px) { .hero-side { border-right: 0; border-bottom: 1px solid var(--border); } }
.hero-mainpanel { padding: 20px; min-width: 0; }

/* Modelos monitorados — uma linha por engine: logo · nome + barra · score · delta. */
.eng-row { display: grid; grid-template-columns: auto 1fr auto 58px; align-items: center; column-gap: 12px; padding: 10px 0; }
.eng-row > svg { width: 22px; height: 22px; flex: none; }
.eng-main { min-width: 0; }
.eng-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.875rem; font-weight: 500; }
.eng-bar { display: block; height: 4px; margin-top: 6px; overflow: hidden; border-radius: 999px; background: var(--muted); }
.eng-bar i { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.eng-score { font-size: 0.875rem; font-weight: 600; }
.eng-row > :last-child { text-align: right; }
/* Fora do plano: logo dessaturado, score oculto, teaser de barra neutro. */
.eng-locked > svg { filter: grayscale(1); opacity: 0.5; }
.eng-locked .eng-name, .eng-locked .eng-score { color: var(--muted-foreground); }
.eng-locked .eng-bar i { background: color-mix(in oklch, var(--muted-foreground) 30%, transparent); }
.eng-subscribe {
  display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px;
  font-size: 0.75rem; color: var(--muted-foreground); white-space: nowrap;
}
.eng-subscribe svg { width: 12px; height: 12px; flex: none; }

/* Faixa de métricas — Mono/Overline 10px + valor Geist Bold 16/22. */
.metric-strip { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-bottom: 20px; }
.metric .overline { margin: 0 0 2px; }
.metric b { display: block; font-size: 1rem; line-height: 22px; font-weight: 700; letter-spacing: -0.015em; }
.metric .delta-strong { font-family: var(--font-sans); font-size: 1rem; line-height: 22px; font-weight: 700; }
.metric .delta-strong.up { color: var(--success-strong); }
.metric .delta-strong.down { color: var(--destructive-strong); }

/* Gráfico de linhas (svg[data-chart], desenhado por js/dashboard.js). */
.dchart { display: block; width: 100%; }
.dchart text { font-family: var(--font-mono); font-size: 10px; fill: var(--muted-foreground); }
.chart-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.chart-title-row .overline { margin: 0; }
.delta-chip { display: inline-flex; border-radius: 999px; background: var(--muted); padding: 2px 6px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; }
.chart-legend > span { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--muted-foreground); }
.chart-legend i { width: 13px; height: 3px; flex: none; border-radius: 2px; }

/* Ranking de concorrentes (aba Concorrentes): nº · swatch · marca · delta · score. */
.rank-row { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--border); padding: 11px 4px; }
.rank-row.is-you { background: color-mix(in oklch, var(--primary) 10%, transparent); }
.rank-i { width: 16px; flex: none; font-size: 0.75rem; color: var(--muted-foreground); }
.rank-swatch { width: 13px; height: 3px; flex: none; border-radius: 2px; }
.rank-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.875rem; font-weight: 500; }
.rank-row.is-you .rank-name { font-weight: 700; }
.rank-row .delta { width: 58px; flex: none; text-align: right; }
.rank-val { width: 40px; flex: none; text-align: right; font-size: 13px; font-weight: 600; }

/* --- cartão de bloco (Card canônico: header px-6, moldura de tabela dentro) --- */
.dcard { display: flex; flex-direction: column; gap: 20px; padding: 24px 0; }
.dcard-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; padding: 0 24px; }
.dcard-head h2 { font-size: 1rem; line-height: 22px; font-weight: 700; letter-spacing: -0.015em; }
.dcard-desc { margin-top: 2px; font-size: 0.875rem; color: var(--muted-foreground); }
.dcard-action { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 8px; }
.dcard-body { padding: 0 24px; }
.dcard-foot { padding: 0 24px; }
.dcard-empty { padding: 32px 24px; text-align: center; }
.dcard-empty p { margin-inline: auto; max-width: 448px; font-size: 0.875rem; color: var(--muted-foreground); }
/* Chip de estatística do header ("6 de 8 tópicos monitorados"). */
.stat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--radius-md); background: var(--muted); padding: 4px 10px;
}
.stat-chip b { font-family: var(--font-mono); font-size: 0.875rem; font-weight: 600; }
.stat-chip span { font-size: 0.75rem; color: var(--muted-foreground); }

/* Moldura de tabela DENTRO do card — as duas bordas concêntricas são o padrão
   da casa (TableFrame do insights-block.tsx / data-table.tsx). */
.tframe { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.tframe-scroll { overflow-x: auto; }
.ihead {
  display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--border);
  padding: 12px 16px; font-family: var(--font-mono); font-size: 10px; line-height: 14px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-foreground);
}
/* Os rótulos reaproveitam as classes de coluna (largura), mas a tipografia é a
   do cabeçalho — sem isso .c-topic/.c-pos impõem os 14px das células. */
.ihead > span { font-size: inherit; font-weight: inherit; }
.irow { display: flex; height: 52px; align-items: center; gap: 24px; border-bottom: 1px solid var(--border); padding: 0 16px; }
.irow:last-child { border-bottom: 0; }
.irow:hover { background: color-mix(in oklch, var(--muted) 40%, transparent); }
/* Colunas compartilhadas das 3 tabelas de insight. */
.c-eng { display: flex; width: 40px; flex: none; justify-content: center; }
.c-eng svg { width: 22px; height: 22px; }
.c-idx { width: 16px; flex: none; font-family: var(--font-mono); font-size: 10px; color: var(--muted-foreground); }
.c-topic { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.875rem; }
.c-pts { width: 150px; flex: none; }
.c-pts > span { display: flex; align-items: center; gap: 8px; }
.c-pts .bar { height: 6px; flex: 1; overflow: hidden; border-radius: 999px; background: var(--muted); }
.c-pts .bar i { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.c-pts b { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.c-brand { display: flex; width: 150px; flex: none; align-items: center; gap: 6px; min-width: 0; }
.c-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; }
.c-cat { width: 150px; flex: none; }
.c-pos { width: 60px; flex: none; text-align: center; font-family: var(--font-mono); font-size: 0.875rem; font-weight: 600; }
@media (max-width: 639px) { .c-cat, .c-pos { display: none; } }

/* Monograma de marca (fallback do BrandMark/FaviconMark — file:// fica offline). */
.rmark {
  display: grid; place-items: center; width: 20px; height: 20px; flex: none;
  border: 1px solid var(--border); border-radius: 7px; background: var(--muted);
  font-family: var(--font-mono); font-size: 9px; font-weight: 600; font-style: normal;
  color: var(--muted-foreground);
}
/* A marca própria leva o anel primário (mesma regra do RankCell real). */
.rmark.is-you { border: 1.5px solid var(--primary); color: var(--foreground); }
.rmark-empty { border-style: dashed; background: color-mix(in oklch, var(--muted) 30%, transparent); }

/* --- matriz de rankings por tópico (topic-rankings-block.tsx) --- */
.mx { min-width: fit-content; }
.mx-head {
  display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border);
  padding: 10px 16px; font-family: var(--font-mono); font-size: 10px; line-height: 14px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-foreground); white-space: nowrap;
}
.mx-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); padding: 10px 16px; }
.mx-row:last-child, .mx-sub:last-child { border-bottom: 0; }
.mx-row .chev { display: flex; width: 14px; flex: none; color: var(--muted-foreground); }
.mx-row .chev svg { width: 14px; height: 14px; }
.mx-topic { display: flex; width: 300px; flex: none; align-items: center; gap: 8px; min-width: 0; }
.mx-topic > span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.875rem; font-weight: 500; }
.mx-pos { display: flex; width: 36px; flex: none; justify-content: center; }
.mx-prompts { width: 70px; flex: none; text-align: center; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted-foreground); }
.mx-delta { width: 110px; flex: none; text-align: center; }
/* Sub-linha de prompt (tópico expandido) — indentada, sobre muted/40.
   pl de 38px = padding(16) + chevron(14) + gap(8) da linha-mãe, para as
   colunas de posição continuarem alinhadas. */
.mx-sub {
  display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 40%, transparent); padding: 10px 16px 10px 38px;
}
.mx-sub .mx-topic > span { font-size: 13px; font-weight: 400; color: var(--muted-foreground); }
