/* kzvideo: visual da Kaizen sem build.
   Tokens copiados de client-web/src/index.css (:root e .dark), em HSL, usados como hsl(var(--x)).
   Componentes só usam tokens semânticos; o tema escuro segue o sistema (prefers-color-scheme). */

@font-face {
  font-family: "Inter Tight";
  src: url("marca/inter-tight-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --primary: 54 97% 63%;
  --primary-foreground: 0 0% 0%;
  --secondary: 0 0% 7%;
  --secondary-foreground: 0 0% 100%;
  --background: 0 0% 100%;
  --foreground: 0 0% 7%;
  --card: 0 0% 100%;
  --card-foreground: 0 0% 7%;
  --popover: 0 0% 100%;
  --popover-foreground: 0 0% 7%;
  --muted: 0 0% 96%;
  --muted-foreground: 0 0% 43%;
  --accent: 0 0% 96%;
  --accent-foreground: 0 0% 7%;
  --destructive: 0 84% 60%;
  --destructive-foreground: 0 0% 100%;
  --destructive-solid: 0 72% 42%;
  --destructive-solid-foreground: 0 0% 100%;
  --success: 142 76% 36%;
  --success-foreground: 0 0% 100%;
  --warning: 38 92% 50%;
  --warning-foreground: 0 0% 0%;
  --info: 217 91% 60%;
  --primary-ink: 0 0% 7%;
  --primary-graphic: 45 100% 34%;
  --success-ink: 142 76% 23%;
  --warning-ink: 32 95% 30%;
  --destructive-ink: 0 74% 38%;
  --info-ink: 217 85% 41%;
  --primary-wash: 54 97% 90%;
  --scrim: 0 0% 0%;
  --scrim-foreground: 0 0% 100%;
  --border: 0 0% 90%;
  --input: 0 0% 90%;
  --ring: 0 0% 20%;
  --radius: 0.5rem;
  --chat-user: 0 0% 93%;
  --chat-user-foreground: 0 0% 7%;
  --chat-ai: 54 97% 63%;
  --chat-ai-foreground: 0 0% 0%;
  --shadow-sm: 0 1px 2px 0 hsl(0 0% 0% / 0.05);
  --shadow-md: 0 4px 6px -1px hsl(0 0% 0% / 0.1), 0 2px 4px -2px hsl(0 0% 0% / 0.1);
  --shadow-lg: 0 10px 15px -3px hsl(0 0% 0% / 0.1), 0 4px 6px -4px hsl(0 0% 0% / 0.1);

  /* Papéis da barra lateral: fundo atenuado no claro, card no escuro; destino atual em cartão branco. */
  --lateral-fundo: color-mix(in srgb, hsl(var(--muted)) 70%, hsl(var(--background)));
  --lateral-tinta: hsl(var(--foreground) / 0.8);
  --lateral-hover: hsl(var(--foreground) / 0.06);
  --lateral-ativo: hsl(var(--background));
  --lateral-ativo-sombra: var(--shadow-sm);
  --lateral-conversa-atual: hsl(var(--primary-wash));
  --avatar-fundo: #17161d;
  --avatar-tinta: hsl(var(--primary));
  --marca-tinta: hsl(var(--foreground));
  --marca-fundo: #17161d;
  --marca-pad: 3px;
  --lateral: 264px;
  --lateral-trilho: 64px;
  /* Borda de campo com 3:1 sobre o fundo (WCAG 1.4.11); a hairline --input fica para divisórias. */
  --campo-borda: hsl(var(--muted-foreground) / 0.75);
  /* Altura do cabeçalho do celular (no computador não há barra no topo). */
  --topo-altura: 0px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --secondary: 0 0% 100%;
    --secondary-foreground: 0 0% 7%;
    --background: 0 0% 7%;
    --foreground: 0 0% 98%;
    --card: 0 0% 10%;
    --card-foreground: 0 0% 98%;
    --popover: 0 0% 10%;
    --popover-foreground: 0 0% 98%;
    --muted: 0 0% 15%;
    --muted-foreground: 0 0% 60%;
    --accent: 0 0% 15%;
    --accent-foreground: 0 0% 98%;
    --destructive-foreground: 0 0% 98%;
    --primary-ink: 54 97% 63%;
    --primary-graphic: 54 97% 63%;
    --success-ink: 142 76% 48%;
    --warning-ink: 38 92% 63%;
    --destructive-ink: 0 84% 78%;
    --info-ink: 217 91% 76%;
    --primary-wash: 54 40% 16%;
    --border: 0 0% 20%;
    --input: 0 0% 20%;
    --ring: 54 97% 63%;
    --chat-user: 0 0% 24%;
    --chat-user-foreground: 0 0% 98%;
    --shadow-sm: 0 1px 2px 0 hsl(0 0% 0% / 0.2);
    --shadow-md: 0 4px 6px -1px hsl(0 0% 0% / 0.3), 0 2px 4px -2px hsl(0 0% 0% / 0.2);
    --shadow-lg: 0 10px 15px -3px hsl(0 0% 0% / 0.3), 0 4px 6px -4px hsl(0 0% 0% / 0.2);

    --lateral-fundo: hsl(var(--card));
    --lateral-tinta: hsl(var(--foreground) / 0.78);
    --lateral-hover: hsl(var(--foreground) / 0.07);
    /* Mais claro que o hover (0,07), para o destino atual não se confundir com o item sob o mouse. */
    --lateral-ativo: hsl(var(--foreground) / 0.14);
    --lateral-ativo-sombra: none;
    --avatar-fundo: hsl(var(--primary));
    --avatar-tinta: hsl(var(--primary-foreground));
    --marca-fundo: transparent;
    --marca-pad: 0px;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
img, video, svg { display: block; }
a { color: inherit; }
hr { border: 0; border-top: 1px solid hsl(var(--border)); margin: 6px 0; }

:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

.so-leitor {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.pular {
  position: absolute; left: 12px; top: -64px; z-index: 100;
  padding: 10px 16px; border-radius: var(--radius);
  background: hsl(var(--background)); color: hsl(var(--foreground));
  box-shadow: var(--shadow-lg); font-weight: 600; text-decoration: none;
}
.pular:focus { top: 12px; }

.icone { flex-shrink: 0; }

/* ---------- Barra lateral ---------- */

body[data-pagina="app"] { padding-left: var(--lateral); }
.topo-movel, .lateral-fundo, .lateral .lateral-fechar { display: none; }

.lateral {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
  display: flex; flex-direction: column; gap: 2px;
  width: var(--lateral); padding: 16px 12px 12px;
  background: var(--lateral-fundo); color: hsl(var(--foreground));
  border-right: 1px solid hsl(var(--border));
}
.lateral-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 14px 6px; }
.lateral .botao-icone { width: 36px; height: 36px; border-radius: 8px; }
.lateral .botao-icone:hover { background: var(--lateral-hover); }

.marca {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px; min-width: 0;
  color: var(--marca-tinta); text-decoration: none;
  border-radius: var(--radius);
}
.marca img { flex-shrink: 0; width: 32px; height: 32px; border-radius: 9px; background: var(--marca-fundo); padding: var(--marca-pad); box-sizing: border-box; }
.marca-nome { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
.marca-ask { font-weight: 500; color: hsl(var(--muted-foreground)); }

.lateral-nova {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 14px; margin-bottom: 10px;
  border-radius: 12px; background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font-size: 15px; font-weight: 700; text-decoration: none;
  transition: background-color 150ms ease;
}
.lateral-nova:hover { background: hsl(var(--primary) / 0.88); }

.navegacao { display: grid; gap: 2px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 12px;
  border-radius: 10px; color: var(--lateral-tinta);
  font-size: 15px; font-weight: 500; text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease;
}
.nav-item:hover { background: var(--lateral-hover); color: hsl(var(--foreground)); }
.nav-item[aria-current="page"] { background: var(--lateral-ativo); box-shadow: var(--lateral-ativo-sombra); color: hsl(var(--foreground)); font-weight: 600; }
.nav-rotulo { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contador {
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.contador[hidden] { display: none; }

.lateral-conversas { display: flex; flex-direction: column; flex: 1; min-height: 0; margin-top: 16px; }
.lateral-secao { padding: 0 12px 6px; color: hsl(var(--muted-foreground)); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

/* Conta: avatar, nome e o menu com Custos, Pedidos sem tutorial, avisos e Sair. */
.conta { position: relative; margin-top: 8px; padding-top: 10px; border-top: 1px solid hsl(var(--border)); }
.conta-botao {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 6px; border: 0; border-radius: 10px;
  background: transparent; text-align: left; cursor: pointer;
}
.conta-botao:hover, .conta-botao[aria-expanded="true"], .conta-botao.ativo { background: var(--lateral-hover); }
.avatar {
  display: grid; place-items: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 999px;
  background: var(--avatar-fundo); color: var(--avatar-tinta);
  font-size: 14px; font-weight: 700; letter-spacing: 0.02em;
}
.conta-texto { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.conta-nome { overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.conta-sub { overflow: hidden; color: hsl(var(--muted-foreground)); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.conta-sub:empty { display: none; }
.conta-mais { display: inline-flex; color: hsl(var(--muted-foreground)); }

.painel-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 40;
  padding: 6px;
  background: hsl(var(--popover)); color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border)); border-radius: 10px;
  box-shadow: var(--shadow-lg);
}
.painel-menu[hidden] { display: none; }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: 6px; background: transparent;
  color: hsl(var(--foreground)); font-size: 14px; font-weight: 500; text-align: left; text-decoration: none;
  cursor: pointer;
}
.menu-item:hover { background: hsl(var(--accent)); }
.menu-item[aria-current="page"] { background: hsl(var(--accent)); font-weight: 600; }
.menu-item .icone { color: hsl(var(--muted-foreground)); }
.menu-item[aria-pressed="true"] .icone { color: hsl(var(--success-ink)); }

/* Trilho (barra recolhida, só no computador): ícones com o nome em dica ao passar o mouse ou focar. */
@media (min-width: 761px) {
  body.lateral-recolhida { --lateral: var(--lateral-trilho); }
  .lateral-recolhida .lateral { align-items: center; padding: 16px 0 12px; }
  .lateral-recolhida .lateral-topo { flex-direction: column; gap: 8px; padding: 0 0 10px; }
  .lateral-recolhida .marca-nome, .lateral-recolhida .lateral-conversas, .lateral-recolhida .conta-texto, .lateral-recolhida .conta-mais { display: none; }
  .lateral-recolhida .nav-rotulo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lateral-recolhida .lateral-nova, .lateral-recolhida .nav-item { justify-content: center; width: 44px; height: 44px; padding: 0; }
  .lateral-recolhida .lateral-nova { margin-bottom: 8px; }
  .lateral-recolhida .contador {
    position: absolute; top: 1px; right: -2px;
    min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; line-height: 18px;
    box-shadow: 0 0 0 2px var(--lateral-fundo);
  }
  .lateral-recolhida .conta { margin-top: auto; padding-top: 8px; border-top: 0; }
  .lateral-recolhida .conta-botao { justify-content: center; width: 46px; padding: 6px; border-radius: 999px; }
  .lateral-recolhida .painel-menu { left: calc(100% + 8px); right: auto; bottom: 0; width: 264px; }
  .lateral-recolhida [data-dica]:is(:hover, :focus-visible):not([aria-expanded="true"])::after {
    content: attr(data-dica);
    position: absolute; left: calc(100% + 12px); top: 50%; z-index: 45; transform: translateY(-50%);
    padding: 6px 10px; border-radius: 6px;
    background: hsl(var(--foreground)); color: hsl(var(--background)); box-shadow: var(--shadow-md);
    font-size: 13px; font-weight: 500; line-height: 1.3; white-space: nowrap; pointer-events: none;
  }
  .lateral-recolhida .lateral-recolher { position: relative; }
}

/* ---------- Página ---------- */

main { display: block; }
.pagina { max-width: 1120px; margin: 0 auto; padding: 32px 32px 72px; }
.pagina-estreita { max-width: 760px; }

.cabeca-pagina { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.titulo { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.subtitulo { margin-top: 6px; color: hsl(var(--muted-foreground)); font-size: 14px; }
.secao-cabeca { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.secao-titulo { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; }
.secao-titulo .icone { color: hsl(var(--primary-graphic)); }
.ajuda { color: hsl(var(--muted-foreground)); font-size: 13px; }
.rotulo { display: block; font-size: 13px; font-weight: 600; }
.link-discreto { color: hsl(var(--foreground)); font-size: 13px; font-weight: 500; text-underline-offset: 3px; border-radius: 4px; }
.link-discreto:hover { text-decoration-thickness: 2px; }

.cartao {
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ---------- Botões ---------- */

.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap; text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.botao.pequeno { height: 36px; padding: 0 12px; }
.botao.grande { height: 44px; padding: 0 24px; }
.botao.largo { width: 100%; }
.botao:disabled { opacity: 0.5; cursor: not-allowed; }
.botao[aria-busy="true"] { cursor: progress; }
.botao[aria-busy="true"]::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: girar 700ms linear infinite;
}

.botao.primario { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.botao.primario:hover:not(:disabled) { background: hsl(var(--primary) / 0.9); }
.botao.contorno { background: hsl(var(--background)); border-color: hsl(var(--border)); color: hsl(var(--foreground)); }
.botao.contorno:hover:not(:disabled) { background: hsl(var(--accent)); }
.botao.fantasma { background: transparent; color: hsl(var(--foreground)); }
.botao.fantasma:hover:not(:disabled) { background: hsl(var(--accent)); }
.botao.perigo { background: hsl(var(--background)); border-color: hsl(var(--border)); color: hsl(var(--destructive-ink)); }
.botao.perigo:hover:not(:disabled) { background: hsl(var(--destructive) / 0.1); border-color: hsl(var(--destructive) / 0.4); }
.botao.perigo-cheio { background: hsl(var(--destructive-solid)); color: hsl(var(--destructive-solid-foreground)); }
.botao.perigo-cheio:hover:not(:disabled) { background: hsl(var(--destructive-solid) / 0.9); }
.botao.copiado .icone { display: none; }

.botao-icone {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: hsl(var(--muted-foreground));
  cursor: pointer;
}
.botao-icone:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }

.acoes { display: flex; flex-wrap: wrap; gap: 8px; }
.acoes-coluna { display: grid; gap: 10px; }
.acoes-linha { display: flex; gap: 8px; }
.acoes-linha > .botao { flex: 1; }
.acoes-linha.centro { justify-content: center; }
.acoes-linha.centro > .botao { flex: 0 1 auto; }

/* ---------- Campos ---------- */

.campo {
  display: block; width: 100%;
  min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--campo-borda); border-radius: var(--radius);
  background: hsl(var(--background)); color: hsl(var(--foreground));
  font-size: 16px; line-height: 1.5;
}
.campo::placeholder { color: hsl(var(--muted-foreground)); opacity: 1; }
textarea.campo { resize: vertical; }
.campo[aria-invalid="true"] { border-color: hsl(var(--destructive)); }
.campo-com-rotulo { display: grid; gap: 6px; }
.erro-campo { margin-top: 8px; color: hsl(var(--destructive-ink)); font-size: 13px; font-weight: 500; }
.erro-campo[hidden] { display: none; }

/* ---------- Selo (ponto + rótulo) e barra de etapas ---------- */

.selo {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border: 1px solid transparent; border-radius: 999px;
  background: hsl(var(--muted)); color: hsl(var(--foreground) / 0.8);
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.selo .ponto { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--muted-foreground)); flex-shrink: 0; }
.selo-andamento { background: hsl(var(--primary-wash)); color: hsl(var(--foreground)); }
.selo-andamento .ponto { background: hsl(var(--primary-graphic)); animation: pulsar 1.6s ease-in-out infinite; }
.selo-pronto, .selo-sucesso { background: hsl(var(--success) / 0.12); color: hsl(var(--foreground)); }
.selo-pronto .ponto, .selo-sucesso .ponto { background: hsl(var(--success)); }
.selo-atencao { background: hsl(var(--destructive) / 0.1); border-color: hsl(var(--destructive) / 0.4); color: hsl(var(--foreground)); }
.selo-atencao .ponto { background: hsl(var(--destructive)); }

.etapas { display: grid; gap: 6px; }
.etapas-trilho, .etapas-rotulos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.segmento { height: 6px; border-radius: 999px; background: hsl(var(--foreground) / 0.1); }
.segmento.feito { background: hsl(var(--primary-ink)); }
.segmento.atual { background: hsl(var(--primary-graphic)); animation: pulsar 1.6s ease-in-out infinite; }
.segmento.espera { background: hsl(var(--primary-ink) / 0.35); }
.segmento.falhou { background: hsl(var(--destructive)); }
.tom-pronto .segmento.feito { background: hsl(var(--success)); }
.etapas-rotulos span { color: hsl(var(--muted-foreground)); font-size: 11px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.etapas-rotulos span.atual { color: hsl(var(--foreground)); font-weight: 600; }

/* ---------- Seletor de modelo e tema da galeria ---------- */

.modelo-ia { display: flex; align-items: center; gap: 8px; }
.modelo-ia-rotulo { color: hsl(var(--muted-foreground)); font-size: 13px; font-weight: 500; white-space: nowrap; }
.segmentado-pequeno { padding: 3px; }
.segmentado-pequeno button { height: 30px; padding: 0 12px; }
.cv-tema {
  color: hsl(var(--muted-foreground));
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}

/* ---------- Andamento ---------- */

.segmentado { display: inline-flex; gap: 4px; padding: 4px; border-radius: 10px; background: hsl(var(--muted)); }
.segmentado button {
  height: 32px; padding: 0 16px;
  border: 0; border-radius: 7px; background: transparent;
  color: hsl(var(--foreground) / 0.75); font-size: 13px; font-weight: 500; cursor: pointer;
}
.segmentado button:hover { color: hsl(var(--foreground)); }
.segmentado button[aria-pressed="true"] { background: hsl(var(--background)); color: hsl(var(--foreground)); box-shadow: var(--shadow-sm); }

.lista-pedidos { display: grid; gap: 12px; }
.cartao-pedido { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px 20px; transition: box-shadow 150ms ease; }
.cartao-pedido:hover { box-shadow: var(--shadow-md); }
.cartao-pedido:has(.esticado:focus-visible) { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.cp-linha { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cp-tempo { color: hsl(var(--muted-foreground)); font-size: 12px; font-variant-numeric: tabular-nums; }
.cp-modelo { margin-left: auto; color: hsl(var(--muted-foreground)); font-size: 12px; }
.cp-aviso { margin: 0; font-size: 13px; color: hsl(var(--muted-foreground)); }
.cp-pergunta {
  font-size: 16px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.esticado { text-decoration: none; }
.esticado::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.esticado:focus-visible { outline: none; }
.cp-rodape { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cp-quem { color: hsl(var(--muted-foreground)); font-size: 12px; }
.cp-explica { font-size: 12px; }
.cp-rodape .botao { position: relative; z-index: 1; margin-left: auto; }

/* ---------- Revisar e detalhe da Galeria ---------- */

.voltar {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; margin-bottom: 12px; padding: 0 8px 0 4px; margin-left: -4px;
  color: hsl(var(--muted-foreground)); font-size: 13px; font-weight: 500; text-decoration: none;
  border-radius: 6px;
}
.voltar:hover { color: hsl(var(--foreground)); background: hsl(var(--accent)); }

.cabeca-revisar { margin-bottom: 20px; }
.cabeca-revisar .titulo { max-width: 60ch; overflow-wrap: anywhere; }
.sobre { margin-bottom: 6px; color: hsl(var(--muted-foreground)); font-size: 13px; font-weight: 500; }

.revisar { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.palco { min-width: 0; }
.painel { grid-template-columns: minmax(0, 1fr); position: sticky; top: calc(var(--topo-altura) + 24px); display: grid; gap: 16px; padding: 20px; }
.painel-topo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.video {
  width: 100%; aspect-ratio: 16 / 9;
  border-radius: var(--radius); border: 1px solid hsl(var(--border));
  background: hsl(var(--scrim));
}

.resposta { font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.meta-forte { font-size: 14px; font-weight: 500; }
.nota { padding: 10px 12px; border-radius: var(--radius); background: hsl(var(--muted)); color: hsl(var(--foreground) / 0.75); }
.form-ajuste { display: grid; gap: 8px; padding-top: 4px; }

.campo-link-linha { display: grid; gap: 8px; }
.campo-link { min-height: 40px; padding: 8px 12px; font-size: 13px; color: hsl(var(--muted-foreground)); background: hsl(var(--muted) / 0.5); }

.custo { padding-top: 12px; border-top: 1px solid hsl(var(--border)); }
.custo-gatilho {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 6px; margin-left: -6px;
  border: 0; border-radius: 6px; background: transparent;
  color: hsl(var(--muted-foreground)); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; cursor: pointer;
}
.custo-gatilho:hover { color: hsl(var(--foreground)); background: hsl(var(--accent)); }
.custo-gatilho .icone { transition: transform 150ms ease; }
.custo-gatilho[aria-expanded="true"] .icone { transform: rotate(180deg); }
.custo-detalhe { display: grid; gap: 6px; margin: 8px 0 0; font-size: 13px; }
.custo-detalhe[hidden] { display: none; }
.custo-detalhe div { display: flex; justify-content: space-between; gap: 12px; }
.custo-detalhe dt { color: hsl(var(--muted-foreground)); }
.custo-detalhe dd { margin: 0; font-variant-numeric: tabular-nums; }
.custo-total { padding-top: 6px; border-top: 1px solid hsl(var(--border)); font-weight: 600; }
.custo-total dt { color: hsl(var(--foreground)); }
.custo-aprender { padding-top: 6px; border-top: 1px dashed hsl(var(--border)); }

.pergunta-origem { display: grid; gap: 6px; }
.pergunta-origem blockquote { margin: 0; padding: 10px 14px; border-radius: var(--radius); background: hsl(var(--muted)); overflow-wrap: anywhere; }

.recolhido { margin-top: 28px; border-top: 1px solid hsl(var(--border)); }
.recolhido > summary {
  display: flex; align-items: center; gap: 8px;
  min-height: 48px; font-size: 14px; font-weight: 600; cursor: pointer; list-style: none;
  border-radius: 6px;
}
.recolhido > summary::-webkit-details-marker { display: none; }
.recolhido > summary .icone { color: hsl(var(--muted-foreground)); transition: transform 150ms ease; }
.recolhido[open] > summary .icone { transform: rotate(90deg); }
.recolhido-pequeno { margin-top: 4px; border-top: 0; }
.recolhido-pequeno > summary { min-height: 36px; font-size: 13px; font-weight: 500; }

.conversa { display: grid; gap: 10px; padding: 4px 0 8px; }
.bolha {
  max-width: min(75%, 560px); padding: 10px 14px;
  border-radius: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.bolha-pessoa { justify-self: end; background: hsl(var(--chat-user)); color: hsl(var(--chat-user-foreground)); border-bottom-right-radius: 4px; }
.bolha-kz { justify-self: start; background: hsl(var(--chat-ai)); color: hsl(var(--chat-ai-foreground)); border-bottom-left-radius: 4px; }


/* ---------- Assistente (layout A) ---------- */

/* clip, não hidden: scrollIntoView não consegue rolar o main e esconder o topo da conversa. */
body[data-tela="assistente"] main { height: calc(100dvh - var(--topo-altura)); overflow: clip; }
.assistente { display: grid; grid-template-columns: minmax(0, 1fr) 340px; height: 100%; overflow: clip; }
.assistente.artefatos-recolhidos { grid-template-columns: minmax(0, 1fr) 56px; }
.abas-assistente { display: none; }
/* Âncora dos textos .so-leitor (position: absolute): sem ela, ficam fora das colunas e esticam a página. */
.assistente, .conversa-rolagem, .artefatos, .historico { position: relative; }

/* Histórico (na barra lateral) */
.historico { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px 12px; }
.historico-corpo { display: grid; align-content: start; gap: 2px; }
.historico-dia { padding: 8px 12px 4px; color: hsl(var(--muted-foreground)); font-size: 12px; font-weight: 600; }
.historico-grupo:first-child .historico-dia { padding-top: 2px; }
.historico-lista { display: grid; gap: 2px; }
.historico-item {
  display: flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 7px 10px 7px 12px;
  border-radius: 10px; color: var(--lateral-tinta); font-size: 14px; text-decoration: none;
}
.historico-item:hover { background: var(--lateral-hover); color: hsl(var(--foreground)); }
.historico-item:focus-visible { outline-offset: -2px; }
.historico-item[aria-current="page"] { background: var(--lateral-conversa-atual); color: hsl(var(--foreground)); font-weight: 600; }
.historico-texto { display: grid; flex: 1; min-width: 0; }
.historico-titulo { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.historico-quem { color: hsl(var(--muted-foreground)); font-size: 12px; font-weight: 400; }
.historico-marca { display: inline-flex; color: hsl(var(--muted-foreground)); }
.historico-pensando { flex-shrink: 0; }
.historico-videos {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: hsl(var(--primary-wash)); color: hsl(var(--foreground));
  font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums;
}
.historico-item[aria-current="page"] .historico-videos { background: hsl(var(--background)); }
.historico-vazio { padding: 4px 12px; }
.historico-time { margin-top: 8px; }
.historico-time > summary {
  display: flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 12px; border-radius: 10px;
  color: hsl(var(--muted-foreground)); font-size: 14px; font-weight: 500; list-style: none; cursor: pointer;
}
.historico-time > summary::-webkit-details-marker { display: none; }
.historico-time > summary:focus-visible { outline-offset: -2px; }
.historico-time > summary:hover { background: var(--lateral-hover); color: hsl(var(--foreground)); }
.historico-time > summary .icone { transition: transform 150ms ease; }
.historico-time[open] > summary .icone { transform: rotate(90deg); }

/* Conversa */
.conversa-coluna { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: hsl(var(--background)); }
.conversa-cabeca { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 28px; border-bottom: 1px solid hsl(var(--border)); }
.conversa-cabeca[hidden] { display: none; }
.conversa-cabeca-texto { min-width: 0; }
.conversa-titulo { font-size: 17px; font-weight: 650; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversa-sobre { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 2px; color: hsl(var(--muted-foreground)); font-size: 12.5px; }
.conversa-sobre .selo { height: 22px; }
.conversa-cabeca > .botao { flex-shrink: 0; }
.conversa-rolagem { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 28px 16px; }
.mensagens { display: flex; flex-direction: column; gap: 20px; max-width: 760px; min-height: 100%; margin: 0 auto; }
.mensagens .bolha { max-width: min(80%, 560px); }
.mensagens .bolha-pessoa { align-self: flex-end; }
.mensagens .bolha-kz { align-self: flex-start; background: hsl(var(--muted)); color: hsl(var(--foreground)); }

.inicio { display: grid; justify-items: center; gap: 10px; margin: auto 0; padding: 32px 0 16px; text-align: center; }
.inicio-icone { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.inicio-titulo { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.inicio-texto { max-width: 52ch; color: hsl(var(--muted-foreground)); font-size: 15px; }

/* Resposta do assistente */
.resposta-ia { display: grid; gap: 12px; max-width: 72ch; }
.resposta-autor { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.resposta-marca { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.resposta-selos { display: flex; flex-wrap: wrap; gap: 6px; }
.resposta-selos .selo { height: auto; min-height: 24px; padding: 3px 10px; white-space: normal; line-height: 1.35; }
.explicacao, .sugestao-cliente-texto { display: grid; gap: 10px; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.explicacao ul, .explicacao ol, .sugestao-cliente-texto ul, .sugestao-cliente-texto ol { display: grid; gap: 4px; padding-left: 22px; }
.explicacao ul, .sugestao-cliente-texto ul { list-style: disc; }
.explicacao ol, .sugestao-cliente-texto ol { list-style: decimal; }
.explicacao li > ul, .explicacao li > ol { margin-top: 4px; list-style: circle; }
.explicacao code, .sugestao-cliente-texto code { padding: 1px 5px; border-radius: 4px; background: hsl(var(--muted)); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; }
.resposta-erro .explicacao { padding: 10px 14px; border-radius: var(--radius); border-left: 3px solid hsl(var(--destructive)); background: hsl(var(--destructive) / 0.06); }

.fontes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fontes-rotulo { margin-right: 2px; color: hsl(var(--muted-foreground)); font-size: 12px; font-weight: 600; }
.fonte {
  display: inline-flex; align-items: center; gap: 5px;
  max-width: 100%; height: 28px; padding: 0 10px;
  border: 1px solid hsl(var(--border)); border-radius: 999px;
  background: hsl(var(--muted) / 0.6); color: hsl(var(--foreground));
  font-size: 12.5px; cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.fonte:hover { background: hsl(var(--accent)); border-color: hsl(var(--foreground) / 0.3); }
.fonte .icone { color: hsl(var(--muted-foreground)); }
.fonte-tipo { color: hsl(var(--muted-foreground)); font-weight: 600; }
.fonte-nome { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fonte-qtd { flex-shrink: 0; color: hsl(var(--muted-foreground)); white-space: nowrap; }
.fonte-trecho { display: grid; gap: 6px; }
.fonte-trecho-titulo { color: hsl(var(--muted-foreground)); font-size: 12.5px; font-weight: 600; }

.sugestao-cliente {
  display: grid; gap: 10px; padding: 14px 16px;
  border: 1px solid hsl(var(--success) / 0.3); border-left: 4px solid hsl(var(--success)); border-radius: 10px;
  background: hsl(var(--success) / 0.07);
}
.sugestao-cliente-titulo { display: inline-flex; align-items: center; gap: 6px; color: hsl(var(--success-ink)); font-size: 13px; font-weight: 700; }
.resposta-meta { color: hsl(var(--muted-foreground)); font-size: 12px; font-variant-numeric: tabular-nums; }

.aviso-resposta {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  padding: 8px 12px; border: 1px solid hsl(var(--destructive) / 0.4); border-radius: var(--radius);
  background: hsl(var(--destructive) / 0.08); color: hsl(var(--foreground)); font-size: 13.5px;
}
.aviso-resposta .icone { color: hsl(var(--destructive-ink)); }
.andamento-resposta { display: inline-flex; align-items: center; gap: 10px; color: hsl(var(--muted-foreground)); font-size: 13.5px; }

/* Cartão de vídeo */
.mensagem-video { align-self: stretch; }
.video-cartao { display: grid; gap: 12px; max-width: 560px; padding: 14px 16px; }
.vc-topo { display: flex; align-items: flex-start; gap: 12px; }
.vc-icone { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: 8px; background: hsl(var(--primary-wash)); color: hsl(var(--primary-ink)); }
.vc-cabeca { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.vc-titulo { flex: 1 1 200px; min-width: 0; font-size: 15px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.vc-link { color: inherit; text-decoration: none; border-radius: 4px; }
.vc-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.vc-progresso { display: grid; gap: 8px; }
.vc-tempo { color: hsl(var(--muted-foreground)); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.vc-tempo:empty { display: none; }
.vc-acoes { display: grid; gap: 10px; }
.vc-acoes > .botao.primario { justify-self: start; }
.vc-versao { margin-top: -4px; }
.vc-explica { font-size: 14px; }
.video-cartao .custo { padding-top: 10px; }
.video-cartao .campo-link-linha { grid-template-columns: minmax(0, 1fr) auto; }
.video-cartao.compacto { gap: 10px; max-width: none; padding: 12px 14px; }
.compacto .vc-titulo { flex-basis: 100%; font-size: 14px; }
.vc-revisar:empty { display: none; }
.vc-embutido { display: grid; gap: 10px; }

/* Caixa de mensagem */
.compositor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; width: 100%; max-width: 816px; margin: 0 auto; padding: 10px 28px 16px; }
.compositor:empty { display: none; }
.prontas { display: flex; flex-wrap: wrap; gap: 6px; }
.pronta { max-width: 100%; height: 30px; overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.compositor-caixa { display: grid; border: 1px solid var(--campo-borda); border-radius: 14px; background: hsl(var(--background)); box-shadow: var(--shadow-sm); }
.compositor-caixa:focus-within { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.compositor-campo {
  display: block; width: 100%; min-height: 48px; max-height: 200px; padding: 12px 14px 4px;
  border: 0; border-radius: 14px 14px 0 0; background: transparent;
  font-size: 15px; line-height: 1.5; resize: none; field-sizing: content;
}
.compositor-campo::placeholder { color: hsl(var(--muted-foreground)); opacity: 1; }
.compositor-campo:focus-visible { outline: none; }
.compositor-campo:disabled { cursor: not-allowed; }
.compositor-rodape { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 8px 12px; }
.compositor-enviar { width: 40px; padding: 0; border-radius: 10px; }
.compositor-caixa.em-conversa { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.compositor-caixa.em-conversa .compositor-campo { padding: 12px 4px 12px 14px; border-radius: 14px 0 0 14px; }
.compositor-caixa.em-conversa .compositor-rodape { padding: 6px; }
.compositor-caixa.desabilitada { background: hsl(var(--muted) / 0.5); box-shadow: none; }
.compositor-dica { padding-left: 4px; font-size: 12px; }
.compositor-so-leitura { font-size: 13px; }
.compositor-leitura { display: grid; justify-items: start; gap: 10px; padding: 14px 16px; border-radius: 12px; background: hsl(var(--muted) / 0.6); }

/* Artefatos */
.artefatos { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; border-left: 1px solid hsl(var(--border)); background: hsl(var(--muted) / 0.3); }
.artefatos-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 2px 16px; }
.artefatos-nome { color: hsl(var(--muted-foreground)); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.artefatos-corpo { display: grid; align-content: start; gap: 22px; padding: 4px 16px 28px; }
.artefatos-corpo[hidden] { display: none; }
.artefatos-secao { display: grid; gap: 10px; }
.artefatos-secao-cabeca { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 8px; }
.artefatos-titulo { font-size: 15px; font-weight: 600; }
.artefatos-cartoes { display: grid; gap: 10px; }
.artefatos-vazio { padding: 12px; border: 1px dashed hsl(var(--border)); border-radius: var(--radius); }
.artefatos-faixa { display: none; }
.artefatos.faixa { overflow: hidden; }
.artefatos.faixa .artefatos-topo { justify-content: center; padding: 10px 0 4px; }
.artefatos.faixa .artefatos-nome { display: none; }
.artefatos.faixa .artefatos-faixa { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 6px; }
.artefatos-faixa-texto { color: hsl(var(--muted-foreground)); font-size: 12px; font-weight: 600; writing-mode: vertical-rl; transform: rotate(180deg); }
.artefatos-contador {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; font-variant-numeric: tabular-nums;
}
.artefatos-contador[hidden] { display: none; }

.galeria-mini { display: grid; gap: 2px; }
.galeria-mini-item { display: grid; grid-template-columns: 80px minmax(0, 1fr); align-items: center; gap: 10px; padding: 6px; border-radius: 8px; color: inherit; text-decoration: none; }
.galeria-mini-item:hover { background: hsl(var(--accent)); }
.galeria-mini-capa { display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid hsl(var(--border)); border-radius: 6px; background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.galeria-mini-capa img { width: 100%; height: 100%; object-fit: cover; }
.galeria-mini-texto { display: grid; gap: 2px; min-width: 0; }
.galeria-mini-tema { color: hsl(var(--muted-foreground)); font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.galeria-mini-titulo { font-size: 13px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Trecho da fonte */
.dialogo.dialogo-fonte { width: min(760px, calc(100vw - 32px)); max-height: min(84dvh, 760px); }
.dialogo-fonte[open] { display: flex; flex-direction: column; }
.fonte-cabeca { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fonte-cabeca .dialogo-titulo { font-size: 16px; overflow-wrap: break-word; min-width: 0; }
.fonte-sobre { margin: 4px 0 14px; }
.fonte-corpo { display: grid; gap: 10px; min-height: 0; overflow: auto; }
.fonte-aviso {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px;
  border: 1px solid hsl(var(--warning) / 0.45); border-radius: 8px; background: hsl(var(--warning) / 0.12);
  font-size: 13.5px;
}
.fonte-aviso .icone { margin-top: 2px; color: hsl(var(--warning-ink)); }
.trecho {
  margin: 0; padding: 10px 0; overflow: auto;
  border: 1px solid hsl(var(--border)); border-radius: 8px; background: hsl(var(--muted) / 0.6);
  font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.trecho code { display: grid; min-width: max-content; font: inherit; }
.trecho-linha { display: grid; grid-template-columns: 3.5em auto; }
.trecho-n { padding: 0 12px 0 8px; color: hsl(var(--muted-foreground)); text-align: right; user-select: none; }
.trecho-texto { padding-right: 16px; white-space: pre; }
.trecho-texto-livre code { display: block; min-width: 0; padding: 0 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (prefers-color-scheme: dark) {
  .compositor-caixa { background: hsl(var(--card)); }
  /* No escuro, o destino atual se distingue do hover pelo ícone amarelo. */
  .nav-item[aria-current="page"] .icone { color: hsl(var(--primary)); }
}

@media (min-width: 761px) and (max-width: 1100px) {
  :root { --lateral: 232px; }
  .assistente { grid-template-columns: minmax(0, 1fr) 280px; }
  .assistente.artefatos-recolhidos { grid-template-columns: minmax(0, 1fr) 56px; }
  .conversa-cabeca, .conversa-rolagem { padding-left: 20px; padding-right: 20px; }
  .compositor { padding-left: 20px; padding-right: 20px; }
}

/* Celular: conversa e vídeos viram duas abas; o histórico fica na gaveta da barra lateral. */
@media (max-width: 760px) {
  body[data-tela="assistente"] main { height: calc(100dvh - var(--topo-altura)); }
  .assistente, .assistente.artefatos-recolhidos { display: flex; flex-direction: column; }
  .abas-assistente {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px;
    margin: 8px 16px 0; padding: 4px; border-radius: 10px; background: hsl(var(--muted));
  }
  .abas-assistente button {
    height: 34px; border: 0; border-radius: 7px; background: transparent;
    color: hsl(var(--foreground) / 0.75); font-size: 13px; font-weight: 500; cursor: pointer;
  }
  .abas-assistente button[aria-selected="true"] { background: hsl(var(--background)); color: hsl(var(--foreground)); box-shadow: var(--shadow-sm); }
  .conversa-coluna, .artefatos { display: none; flex: 1; min-height: 0; border: 0; }
  .assistente[data-aba="conversa"] .conversa-coluna { display: flex; }
  .assistente[data-aba="videos"] .artefatos { display: flex; overflow-y: auto; background: hsl(var(--background)); }
  .artefatos-alternar, .artefatos.faixa .artefatos-faixa { display: none; }
  .artefatos.faixa .artefatos-topo { justify-content: space-between; padding: 10px 16px 2px; }
  .artefatos.faixa .artefatos-nome { display: block; }
  .artefatos .artefatos-corpo[hidden] { display: grid; }
  .artefatos-topo { padding: 10px 16px 2px; }
  .conversa-cabeca { align-items: flex-start; padding: 10px 16px; }
  .botao-compartilhar { width: 36px; padding: 0; }
  .botao-compartilhar .rotulo-largo { display: none; }
  .conversa-titulo { font-size: 15px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
  .conversa-rolagem { padding: 16px 16px 8px; }
  .compositor { padding: 8px 16px max(10px, env(safe-area-inset-bottom)); }
  .compositor-dica.ajuda { display: none; }
  /* Conversa nova no celular: só 3 perguntas prontas, para a caixa caber na tela. */
  .prontas:not(.prontas-conversa) .pronta:nth-child(n+4) { display: none; }
  /* Seguintes da conversa: uma linha só, que rola sozinha na horizontal (a página não rola). */
  .prontas-conversa {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    margin: 0 -16px; padding: 2px 16px; scroll-padding: 0 16px;
  }
  .prontas-conversa::-webkit-scrollbar { display: none; }
  .prontas-conversa .pronta { flex-shrink: 0; max-width: none; }
  .inicio { padding-top: 12px; }
  .inicio-titulo { font-size: 24px; }
  .inicio-texto { font-size: 14px; }
  .mensagens .bolha { max-width: 88%; }
  .video-cartao { max-width: none; }
  .dialogo.dialogo-fonte { padding: 16px; max-height: 88dvh; }
}

/* ---------- Galeria ---------- */

.busca { display: grid; gap: 6px; max-width: 640px; }
.busca-caixa { position: relative; }
.busca-caixa .icone { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: hsl(var(--muted-foreground)); pointer-events: none; }
.campo-busca { padding-left: 42px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
  height: 32px; padding: 0 14px;
  border: 1px solid hsl(var(--border)); border-radius: 999px;
  background: hsl(var(--background)); color: hsl(var(--foreground));
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip:hover { background: hsl(var(--accent)); }
.chip[aria-pressed="true"] { background: hsl(var(--secondary)); border-color: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.estado-busca { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 20px; margin: 16px 0; color: hsl(var(--muted-foreground)); font-size: 13px; }
.estado-busca[data-fonte="ia"] { color: hsl(var(--foreground)); font-weight: 500; }
.estado-busca[data-fonte="ia"] .icone { color: hsl(var(--primary-graphic)); }

.grade-videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.cartao-video { display: flex; flex-direction: column; height: 100%; overflow: hidden; text-decoration: none; transition: box-shadow 150ms ease, border-color 150ms ease; }
.cartao-video:hover { box-shadow: var(--shadow-md); border-color: hsl(var(--foreground) / 0.2); }
.miniatura { position: relative; aspect-ratio: 16 / 9; background: hsl(var(--muted)); border-bottom: 1px solid hsl(var(--border)); }
.miniatura img { width: 100%; height: 100%; object-fit: cover; }
.miniatura-vazia { display: grid; place-items: center; height: 100%; color: hsl(var(--muted-foreground)); }
.duracao {
  position: absolute; right: 8px; bottom: 8px;
  padding: 2px 6px; border-radius: 4px;
  background: hsl(var(--scrim) / 0.75); color: hsl(var(--scrim-foreground));
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.cv-corpo { display: grid; gap: 4px; padding: 12px 14px 14px; }
.cv-titulo { font-size: 15px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cv-meta { color: hsl(var(--muted-foreground)); font-size: 12px; }

/* ---------- Custos e Pedidos sem tutorial ---------- */

.campo-mes { width: auto; min-height: 40px; padding: 6px 10px; font-size: 14px; }
.total-mes { display: grid; gap: 4px; padding: 20px; margin-bottom: 16px; }
.numero { font-size: 36px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tabela li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid hsl(var(--border)); }
.tabela li:last-child { border-bottom: 0; }
.tabela-nome { font-weight: 600; }
.tabela-valor { font-weight: 600; font-variant-numeric: tabular-nums; }
.lista-grupos { display: grid; gap: 12px; }
.grupo { display: grid; gap: 4px; padding: 16px 20px; }
.grupo-topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.grupo-tema { font-weight: 600; overflow-wrap: anywhere; }
.grupo-pedidos { display: grid; gap: 10px; padding: 4px 0 4px 24px; }

/* ---------- Estados de tela ---------- */

.estado-vazio {
  display: grid; justify-items: center; gap: 8px;
  padding: 48px 24px; text-align: center;
  border: 1px dashed hsl(var(--border)); border-radius: 12px;
}
.estado-icone { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 4px; border-radius: 50%; background: hsl(var(--primary-wash)); color: hsl(var(--primary-ink)); }
.estado-titulo { font-size: 16px; font-weight: 600; }
.estado-texto { max-width: 44ch; color: hsl(var(--muted-foreground)); }
.estado-vazio > .botao, .estado-vazio > .acoes-linha { margin-top: 12px; }

.estado-erro {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid hsl(var(--destructive) / 0.4); background: hsl(var(--destructive) / 0.08);
}
.estado-erro-icone { color: hsl(var(--destructive-ink)); }
.estado-erro p { flex: 1; min-width: 200px; }

.esqueleto { display: grid; gap: 12px; }
.esqueleto-bloco { display: grid; gap: 10px; padding: 16px 20px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); }
.osso { display: block; height: 12px; border-radius: 4px; background: hsl(var(--muted)); animation: piscar 1.4s ease-in-out infinite; }
.osso-a { width: 30%; }
.osso-b { width: 85%; height: 16px; }
.osso-c { width: 100%; height: 6px; }
.esqueleto-miniatura { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.esqueleto-miniatura .esqueleto-bloco { padding: 0 0 14px; overflow: hidden; }
.esqueleto-miniatura .osso-c { order: -1; height: auto; aspect-ratio: 16 / 9; border-radius: 0; }
.esqueleto-miniatura .osso-a, .esqueleto-miniatura .osso-b { margin: 0 14px; }
.esqueleto-linha .esqueleto-bloco { padding: 14px 16px; }
.esqueleto-linha .osso-c { display: none; }

/* ---------- Avisos e diálogo ---------- */

.avisos {
  position: fixed; top: calc(var(--topo-altura) + 12px); right: 24px; z-index: 50;
  display: grid; gap: 10px; width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.aviso {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start;
  padding: 14px 10px 14px 14px;
  background: hsl(var(--popover)); color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border)); border-radius: 10px; box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: entrar 200ms cubic-bezier(.22, 1, .36, 1);
  transition: opacity 180ms ease, transform 180ms ease;
}
.aviso.saindo { opacity: 0; transform: translateY(-6px); }
.aviso-icone { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: hsl(var(--muted)); }
.aviso-pronto .aviso-icone { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.aviso-sucesso .aviso-icone { background: hsl(var(--success) / 0.12); color: hsl(var(--success-ink)); }
.aviso-erro .aviso-icone { background: hsl(var(--destructive) / 0.1); color: hsl(var(--destructive-ink)); }
.aviso-corpo { padding-top: 5px; min-width: 0; }
.aviso-titulo { font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.aviso-titulo a { text-underline-offset: 3px; }
.aviso-texto { margin-top: 2px; color: hsl(var(--muted-foreground)); }
.aviso-sucesso .aviso-texto, .aviso-erro .aviso-texto { color: hsl(var(--foreground)); }
.aviso-acoes { margin-top: 10px; }

.dialogo {
  width: min(440px, calc(100vw - 32px)); padding: 24px;
  border: 1px solid hsl(var(--border)); border-radius: 12px;
  background: hsl(var(--popover)); color: hsl(var(--popover-foreground));
  box-shadow: var(--shadow-lg);
  animation: entrar 150ms ease;
}
.dialogo::backdrop { background: hsl(var(--scrim) / 0.7); }
.dialogo-titulo { font-size: 18px; font-weight: 600; }
.dialogo-texto { margin: 8px 0 24px; font-size: 14px; line-height: 1.55; }
.dialogo-acoes { display: flex; justify-content: flex-end; gap: 8px; }
.dialogo .rotulo { margin-bottom: 6px; }
.dialogo textarea { width: 100%; margin-bottom: 20px; resize: vertical; }

.girando {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid hsl(var(--border)); border-top-color: hsl(var(--foreground));
  animation: girar 800ms linear infinite;
}

/* ---------- Entrar ---------- */

.pagina-entrar { display: grid; place-items: center; padding: 24px 16px; background: hsl(var(--muted) / 0.5); }
.entrar { display: grid; gap: 24px; width: min(400px, 100%); }
.entrar-marca { display: flex; align-items: center; justify-content: center; gap: 12px; color: hsl(var(--foreground)); }
.entrar-marca img { width: 48px; height: 48px; border-radius: 12px; background: var(--marca-fundo); padding: calc(var(--marca-pad) * 1.5); box-sizing: border-box; }
.entrar-marca .marca-nome { font-size: 24px; }
.entrar-cartao { padding: 28px; }
.entrar-cartao .erro-campo { margin: 16px 0 0; }
.entrar-cartao .botao { margin-top: 24px; }
.entrar-nota { margin: 12px 0 0; text-align: center; color: hsl(var(--muted-foreground)); font-size: 13px; }

/* ---------- Movimento ---------- */

@keyframes pulsar { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes piscar { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes girar { to { transform: rotate(360deg); } }
@keyframes entrar { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Celular: cabeçalho compacto e a barra lateral como gaveta ---------- */

@media (max-width: 760px) {
  :root { --topo-altura: 56px; }
  body[data-pagina="app"] { padding-left: 0; }
  body.gaveta-aberta { overflow: hidden; }
  .topo-movel {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 6px;
    height: var(--topo-altura); padding: 0 8px;
    background: hsl(var(--background)); border-bottom: 1px solid hsl(var(--border));
  }
  .topo-movel .botao-icone { width: 44px; height: 44px; border-radius: 10px; color: hsl(var(--foreground)); }
  .topo-movel .marca { flex: 1; }
  .topo-movel .marca img { width: 30px; height: 30px; border-radius: 8px; }
  .topo-movel .marca-nome { font-size: 18px; }

  .lateral {
    z-index: 60; width: min(304px, calc(100vw - 56px));
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%); visibility: hidden;
    transition: transform 200ms cubic-bezier(.22, 1, .36, 1), visibility 0s linear 200ms;
  }
  .gaveta-aberta .lateral { transform: none; visibility: visible; transition: transform 200ms cubic-bezier(.22, 1, .36, 1); }
  .lateral-fundo { display: block; position: fixed; inset: 0; z-index: 55; background: hsl(var(--scrim) / 0.5); }
  .lateral-fundo[hidden] { display: none; }
  .lateral-topo { padding-bottom: 12px; }
  .lateral .lateral-recolher { display: none; }
  .lateral .lateral-fechar { display: inline-flex; }
  .lateral .botao-icone { width: 44px; height: 44px; }
  .nav-item, .historico-item, .historico-time > summary { min-height: 44px; }
  .menu-item { min-height: 48px; }

  .pagina { padding: 20px 16px 40px; }
  .titulo { font-size: 22px; }
  .cabeca-pagina { margin-bottom: 20px; }
  .cartao-pedido { padding: 14px 16px; }
  .grade-videos, .esqueleto-miniatura { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .bolha { max-width: 88%; }
  .revisar { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .painel { position: static; padding: 16px; }
  .avisos { top: auto; right: 12px; left: 12px; width: auto; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .dialogo { padding: 20px; }
  .dialogo-acoes > .botao { flex: 1; }
}

@media (min-width: 761px) and (max-width: 1000px) {
  .revisar { grid-template-columns: minmax(0, 1fr) 300px; }
}

/* ---------- Uso (painel) ---------- */

.menu-item[hidden] { display: none; }
.uso-corpo { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.uso-indicadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 12px; }
.uso-indicador { display: grid; gap: 4px; padding: 16px; align-content: start; }
.uso-numero { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.uso-pequenos { margin-top: 12px; }
.uso-pequenos .uso-indicador { box-shadow: none; }
.uso-bloco { padding: 20px; min-width: 0; }
.uso-bloco > .secao-titulo { margin-bottom: 12px; }
.uso-rolagem { overflow-x: auto; }
.uso-tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.uso-tabela th, .uso-tabela td { padding: 8px 10px; border-bottom: 1px solid hsl(var(--border)); text-align: left; white-space: nowrap; }
.uso-tabela th[scope="row"] { font-weight: 600; white-space: normal; min-width: 120px; }
.uso-tabela thead th { color: hsl(var(--muted-foreground)); font-size: 12px; font-weight: 600; }
.uso-tabela .num { text-align: right; font-variant-numeric: tabular-nums; }
.uso-tabela tbody tr:last-child > * { border-bottom: 0; }
.uso-grafico { display: block; width: 100%; height: 140px; border-bottom: 1px solid hsl(var(--border)); }
.uso-barra { fill: hsl(var(--primary-graphic)); }
.uso-barra-ajuste { fill: hsl(var(--info)); }
.uso-eixo { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; color: hsl(var(--muted-foreground)); font-size: 12px; }
.uso-legenda { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.uso-chave { width: 10px; height: 10px; border-radius: 2px; background: hsl(var(--primary-graphic)); }
.uso-chave.ajuste { margin-left: 8px; background: hsl(var(--info)); }
@media (max-width: 640px) {
  .uso-bloco { padding: 14px; }
}
