/* ============================================================================
   crescer-gateway.css — composições de feature do gateway_saude.

   Carregado DEPOIS de crescer-ui.css. Nunca edite o kit para acrescentar coisa
   daqui: o kit é base compartilhada e precisa poder ser atualizado por cima.
   Regra: só tokens --crescer-*. Nenhuma cor literal.
   ========================================================================== */

/* --- Cabeçalho de página ---------------------------------------------------
   A topbar do shell já mostra título/subtítulo; isto serve para os blocos
   internos (ex.: "Histórico de status" dentro de um show). */
.crescer-secao-titulo {
  margin: 26px 0 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--crescer-text);
}

/* --- Callout de atenção + segredo copiável ------------------------------
   O client secret é exibido uma única vez; precisa de destaque e de fonte
   monoespaçada com quebra, porque é uma string longa sem espaços. */
.crescer-callout--warn {
  border-left-color: var(--crescer-warn);
  background: var(--crescer-warn-bg);
  color: var(--crescer-warn);
}
.crescer-segredo {
  display: inline-block; margin-left: 6px; padding: 2px 6px;
  border-radius: 4px; background: var(--crescer-surface);
  border: 1px solid var(--crescer-border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  color: var(--crescer-text); overflow-wrap: anywhere; user-select: all;
}

/* --- Card de filtros ------------------------------------------------------
   O .crescer-toolbar do kit é a barra de dentro de um card de tabela; para a
   barra de filtros autônoma sobre o canvas usamos um card próprio, com margem
   para não encostar no bloco seguinte. */
.crescer-filtros-card { margin-bottom: 20px; }
.crescer-filtros__acoes { display: flex; align-items: center; gap: 8px; margin-left: auto; }
@media (max-width: 720px) { .crescer-filtros__acoes { margin-left: 0; width: 100%; } }

/* --- Alerta destacado (mais forte que o callout) -------------------------
   Usado no bloco de erros de validação dos formulários. */
.crescer-alerta {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 14px 16px; margin-bottom: 18px;
  border: 1px solid var(--crescer-border); border-left-width: 3px;
  border-radius: var(--crescer-radius);
  background: var(--crescer-surface); font-size: 13px;
}
.crescer-alerta__ico { flex: none; margin-top: 1px; }
.crescer-alerta__corpo b { display: block; margin-bottom: 4px; }
.crescer-alerta__corpo ul { margin: 0; padding-left: 18px; }
.crescer-alerta--danger { border-left-color: var(--crescer-danger); background: var(--crescer-danger-bg); }
.crescer-alerta--danger .crescer-alerta__ico,
.crescer-alerta--danger .crescer-alerta__corpo b { color: var(--crescer-danger); }
.crescer-alerta--warn { border-left-color: var(--crescer-warn); background: var(--crescer-warn-bg); }
.crescer-alerta--warn .crescer-alerta__ico,
.crescer-alerta--warn .crescer-alerta__corpo b { color: var(--crescer-warn); }

/* --- Código curto inline (URL base, uid, token…) ------------------------- */
.crescer-code {
  padding: 2px 6px; border-radius: 4px;
  background: var(--crescer-surface-2); border: 1px solid var(--crescer-border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  color: var(--crescer-text); overflow-wrap: anywhere;
}

/* --- Degraus dos KPIs: 4 -> 2 -> 1 (pula o 3, que deixa tile órfão) ------- */
@media (max-width: 1240px) { .crescer-kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px)  { .crescer-kpis { grid-template-columns: 1fr; } }

/* --- Linha de cards de altura uniforme ----------------------------------- */
.crescer-grid-2:has(> .crescer-card) { align-items: stretch; }
.crescer-grid-2 > .crescer-card { display: flex; flex-direction: column; min-width: 0; }
.crescer-grid-2 > .crescer-card > .crescer-card__body { flex: 1 1 auto; }

/* --- Ações no fim da linha da tabela -------------------------------------
   Vários são button_to, que gera um <form>; sem reset eles quebram a linha. */
.crescer-acoes {
  display: inline-flex; align-items: center; justify-content: flex-end;
  gap: 12px; white-space: nowrap;
}
.crescer-acoes form { display: inline; margin: 0; }
.crescer-acoes a,
.crescer-acoes button {
  padding: 0; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12px; color: var(--crescer-brand-dark);
}
.crescer-acoes .is-neutra { color: var(--crescer-text-faint); }
.crescer-acoes .is-perigo { color: var(--crescer-danger); }

/* --- Números por bucket de status na tabela do dashboard ----------------- */
.crescer-num--ok   { color: var(--crescer-ok);     font-weight: 600; }
.crescer-num--fail { color: var(--crescer-danger); font-weight: 600; }
.crescer-num--pend { color: var(--crescer-warn);   font-weight: 600; }

/* --- Donut de distribuição ----------------------------------------------
   Cor vem por classe, não por atributo `stroke=`: var() não é suportado em
   atributo de apresentação de SVG, só na propriedade CSS. */
.crescer-donut { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.crescer-donut__svg { flex: none; }
.crescer-donut__trilho { stroke: var(--crescer-border); }
.crescer-donut__arco--ok   { stroke: var(--crescer-ok); }
.crescer-donut__arco--fail { stroke: var(--crescer-danger); }
.crescer-donut__arco--pend { stroke: var(--crescer-warn); }
.crescer-donut__total { fill: var(--crescer-text); }
.crescer-donut__unidade { fill: var(--crescer-text-faint); }

.crescer-legenda { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.crescer-legenda li { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.crescer-legenda b { font-variant-numeric: tabular-nums; }
.crescer-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.crescer-swatch--ok   { background: var(--crescer-ok); }
.crescer-swatch--fail { background: var(--crescer-danger); }
.crescer-swatch--pend { background: var(--crescer-warn); }

/* --- Barra proporcional (ok/fail/pend numa linha da tabela) -------------- */
.crescer-stack {
  display: flex; height: 8px; min-width: 120px;
  border-radius: 4px; overflow: hidden; background: var(--crescer-surface-2);
}
.crescer-stack > span { display: block; height: 100%; }
.crescer-stack__ok   { background: var(--crescer-ok); }
.crescer-stack__fail { background: var(--crescer-danger); }
.crescer-stack__pend { background: var(--crescer-warn); }

/* --- Conversa (bolhas de mensagem) --------------------------------------
   Leitura de app de mensagem, mas na paleta do kit: canvas sutil, bolha de
   saída no verde suave semântico, bolha de entrada na superfície branca. */
.crescer-conversa__topo { display: flex; align-items: center; gap: 14px; }
.crescer-conversa__quem { line-height: 1.35; min-width: 0; }
.crescer-conversa__quem b { display: block; font-size: 15px; }
.crescer-conversa__quem span { font-size: 12px; color: var(--crescer-text-faint); }

.crescer-chat {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px; border-radius: var(--crescer-radius);
  background: var(--crescer-surface-2);
  border: 1px solid var(--crescer-border);
}
.crescer-chat__dia {
  align-self: center; margin: 10px 0 6px;
  padding: 3px 12px; border-radius: 999px;
  background: var(--crescer-surface); border: 1px solid var(--crescer-border);
  font-size: 11.5px; font-weight: 600; color: var(--crescer-text-faint);
}
.crescer-chat__linha { display: flex; }
.crescer-chat__linha--out { justify-content: flex-end; }
.crescer-chat__linha--in  { justify-content: flex-start; }

.crescer-bolha {
  position: relative; max-width: 72%;
  padding: 8px 12px 6px; border-radius: 10px;
  font-size: 13.5px; line-height: 1.45;
  box-shadow: var(--crescer-shadow-card);
}
.crescer-bolha--out {
  background: var(--crescer-ok-bg); color: var(--crescer-text);
  border-top-right-radius: 2px;
}
.crescer-bolha--in {
  background: var(--crescer-surface); color: var(--crescer-text);
  border-top-left-radius: 2px;
}
.crescer-bolha--out::after {
  content: ""; position: absolute; top: 0; right: -6px;
  border: 6px solid transparent; border-right: 0;
  border-top-color: var(--crescer-ok-bg);
}
.crescer-bolha--in::after {
  content: ""; position: absolute; top: 0; left: -6px;
  border: 6px solid transparent; border-left: 0;
  border-top-color: var(--crescer-surface);
}
.crescer-bolha__meta {
  display: block; margin-top: 3px; text-align: right;
  font-size: 11px; color: var(--crescer-text-faint);
}
.crescer-tick { letter-spacing: -2px; margin-left: 4px; }
.crescer-tick--lido { color: var(--crescer-brand); }

/* Dias anteriores dobrados atrás de um botão (details/summary), sem JS. */
.crescer-chat__anteriores { display: flex; flex-direction: column; gap: 6px; border: 0; }
.crescer-chat__anteriores > summary {
  align-self: center; margin: 10px 0; cursor: pointer; list-style: none;
  padding: 5px 14px; border-radius: 999px;
  background: var(--crescer-surface); border: 1px solid var(--crescer-border);
  font-size: 12px; font-weight: 600; color: var(--crescer-brand-dark);
}
.crescer-chat__anteriores > summary:hover { background: var(--crescer-info-bg); border-color: var(--crescer-brand-light); }
.crescer-chat__anteriores > summary::-webkit-details-marker { display: none; }
.crescer-chat__anteriores > summary::marker { content: ""; }

/* Mensagem de template dentro da bolha: não temos o texto real do template, então o
   que se mostra é o ID e os parâmetros — daí o tratamento de ficha, não de frase. */
.crescer-tmpl { font-size: 13px; }
.crescer-tmpl__head {
  display: flex; align-items: center; gap: 5px;
  font-weight: 600; margin-bottom: 3px; color: var(--crescer-text);
}
.crescer-tmpl__id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px; color: var(--crescer-text-faint);
  overflow-wrap: anywhere; margin-bottom: 5px;
}
.crescer-tmpl__campos {
  margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px;
}
.crescer-tmpl__campos dt { font-weight: 600; color: var(--crescer-text-soft); }
.crescer-tmpl__campos dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 640px) { .crescer-bolha { max-width: 88%; } }
