/* A PALETA NAO MORA MAIS AQUI (T2, 2026-08-27).
   Ela e gerada em `public/marca.css` a partir de `config/marca.json`, e o
   <link> dele vem ANTES deste arquivo no index.html. Os nomes de variavel sao
   os mesmos (`--bg`, `--accent`, `--teal`...), entao nada abaixo mudou.

   O motivo de tirar daqui esta no comentario que estava neste lugar: a paleta
   do DIAGRAMA foi corrigida em 2026-08-07 e a da TELA ficou para tras, com um
   `--teal: #17a99b` que era exatamente o hex que fizera o logo antigo ser
   descartado por estar fora da marca. Uma paleta so, dois consumidores — agora
   por construcao, e nao por disciplina. */

* {
  box-sizing: border-box;
}

/* O atributo `hidden` deve sempre vencer os display: grid/flex das secoes. */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family:
    'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
}

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo {
  height: 34px;
  width: auto;
  display: block;
}
.brand-sep {
  width: 1px;
  height: 30px;
  background: var(--line);
  flex: 0 0 auto;
}
.topbar h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 650;
}
.topbar p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

button.ghost {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
button.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---- Badge de custo: acompanha o gasto da key da empresa em toda tela ---- */
.cost-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.cost-badge:hover {
  border-color: var(--accent);
}
.cost-badge .cost-k {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.7;
}
.cost-badge .cost-v {
  font-weight: 650;
  /* Numeros de mesma largura: o total nao "pula" ao atualizar. */
  font-variant-numeric: tabular-nums;
}
/* Algum modelo usado nao esta na tabela de precos: o total esta SUBESTIMADO. */
.cost-badge.incomplete {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: var(--amber);
}

/* ---- Log "como foi gerado" ---- */
.pipeline-log {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 18px;
  background: var(--bg);
}
.pipeline-log summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
}
.pipeline-log summary::-webkit-details-marker {
  display: none;
}
.pipeline-log summary::before {
  content: '▸ ';
  color: var(--muted);
}
.pipeline-log[open] summary::before {
  content: '▾ ';
}
.pipeline-log ol {
  list-style: none;
  margin: 12px 0 8px;
  padding: 0;
}
.pipeline-log li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.pl-stage {
  font-size: 12.5px;
  font-weight: 550;
}
.pl-time {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pl-detail {
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: var(--muted);
}
.log-note {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 6px 0 0;
}

main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

/* ---- Portas de entrada (home) ---- */
.entry-card {
  background: var(--panel);
  border: 2px dashed #cdd5e0;
  border-radius: 16px;
  padding: 36px 28px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: border-color 0.15s, background 0.15s;
}
.entry-card.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.entry-icon {
  font-size: 34px;
  color: var(--accent);
  line-height: 1;
}
.entry-card h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 14px 0 6px;
}
.entry-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 18px;
  max-width: 34ch;
}
/* Empurra botao + rodape para baixo: as descricoes tem alturas diferentes e
   sem isto os dois "Escolher arquivo" nao se alinham lado a lado. */
.entry-card .file-btn {
  margin-top: auto;
}
.entry-hint {
  color: var(--muted);
  font-size: 12px;
  margin: 14px 0 0;
}
.entry-cost {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  margin: 12px 0 0;
}
.file-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
}
.file-btn:hover {
  filter: brightness(1.05);
}
/* ---- Workspace ---- */
.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
}
.inspector {
  width: 360px;
  flex: 0 0 360px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 20px;
}
.proc-head h2 {
  font-size: 17px;
  margin: 0 0 4px;
}
.proc-desc {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}
.metric {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
}
.metric .v {
  font-size: 18px;
  font-weight: 650;
}
.metric .k {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.inspector h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 10px;
}

.questions {
  background: var(--amber-soft);
  border: 1px solid #f0e0b8;
  border-radius: 11px;
  padding: 14px;
  margin-bottom: 20px;
}
.questions h3 {
  color: var(--amber);
}
.q-hint {
  font-size: 11.5px;
  color: var(--amber);
  margin: -4px 0 12px;
  line-height: 1.5;
}
.questions ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.questions li {
  margin-bottom: 14px;
}
.q-text {
  font-size: 13px;
  font-weight: 550;
  line-height: 1.45;
}
.questions .why {
  color: var(--muted);
  font-size: 11.5px;
  margin: 4px 0 7px;
  line-height: 1.45;
}
.q-answer {
  width: 100%;
  border: 1px solid #ecdcb0;
  border-radius: 7px;
  padding: 7px 9px;
  font: inherit;
  font-size: 12.5px;
  resize: vertical;
  background: #fff;
  box-sizing: border-box;
}
.q-answer:focus {
  outline: none;
  border-color: var(--amber);
}
.apply-btn {
  width: 100%;
  margin-top: 4px;
  background: var(--amber);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.apply-btn:hover {
  filter: brightness(1.06);
}

.nodes-hint {
  font-size: 11.5px;
  color: var(--muted);
  margin: -4px 0 10px;
}
.nodes ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.node-item {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.node-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.node-item.active {
  border-color: var(--highlight);
  background: #fff3ea;
}
.node-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.node-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--muted);
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}
/* Mesmas familias de cor do diagrama (ver src/bpmnColor.ts): eventos em teal,
   gateways em amber, tarefas em azul. */
.node-type.start_event,
.node-type.end_event,
.node-type.timer_event,
.node-type.message_event {
  background: var(--teal);
}
.node-type.exclusive_gateway,
.node-type.parallel_gateway,
.node-type.inclusive_gateway,
.node-type.event_based_gateway {
  background: var(--amber);
}
.node-type.user_task,
.node-type.service_task,
.node-type.agent_task,
.node-type.business_rule_task {
  background: var(--accent);
}
.node-name {
  font-size: 13.5px;
  font-weight: 550;
}
/* A tarefa por extenso. O diagrama so tem o rotulo curto; o texto completo
   vive aqui, entao ele e prosa normal — nao citacao. */
.node-detail {
  font-size: 12.5px;
  color: var(--ink);
  margin-top: 6px;
  line-height: 1.5;
}
.node-ev {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  font-style: italic;
  line-height: 1.45;
  border-left: 2px solid var(--line);
  padding-left: 8px;
}
.node-conf {
  font-size: 10.5px;
  color: var(--muted);
  margin-left: auto;
}

/* ---- Task S(a): edicao estrutural ---- */

/* A marca de procedencia humana. Discreta de proposito: ela informa, nao alerta
   — um no escrito pelo especialista nao e um defeito. */
.node-human {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  padding: 1px 6px;
  border-radius: 20px;
  white-space: nowrap;
}
/* A AUSENCIA de citacao dita em voz alta: sem isto, "a IA nao citou" (defeito a
   conferir) e "eu escrevi isto" (trabalho da pessoa) ficam iguais em branco. */
.node-ev-none {
  font-style: normal;
  font-size: 11.5px;
  border-left-style: dashed;
}
.node-edit {
  margin-left: auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 6px;
  width: 26px;
  height: 24px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  flex: none;
}
.node-conf + .node-edit {
  margin-left: 6px;
}
.node-edit:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.node-add {
  margin-left: auto;
  font-size: 11.5px;
  padding: 3px 9px;
}
.nodes h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.node-item.is-new,
.flow-item.is-new {
  border-color: var(--accent);
  background: var(--accent-soft);
  cursor: default;
}

.edit-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: default;
}
.edit-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.edit-form input,
.edit-form select,
.edit-form textarea {
  font: inherit;
  font-size: 12.5px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}
.edit-form textarea {
  resize: vertical;
  line-height: 1.45;
}
.edit-form input:focus,
.edit-form select:focus,
.edit-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.ef-note {
  font-size: 11.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}
.ef-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ef-actions button {
  font-size: 12px;
  padding: 6px 11px;
  border-radius: 7px;
  cursor: pointer;
}
.ef-remove {
  margin-left: auto;
  color: #b3261e;
  border-color: #f0c9c6;
}

/* A caixa de pendencias. Ela e o "veja antes de aplicar" da Task S — e aqui ele
   sai de graca, porque quem descreveu a mudanca foi quem a pediu. */
.edits {
  border: 1px solid var(--amber);
  background: var(--amber-soft);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
}
.edits h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--amber);
}
.edits ul {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}
.edit-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  padding: 4px 0;
  border-bottom: 1px solid rgba(183, 121, 31, 0.18);
}
.edit-item:last-child {
  border-bottom: none;
}
.edit-desc {
  flex: 1;
}
.edit-undo {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 2px 4px;
}
.edit-undo:hover {
  color: #b3261e;
}
.edits-actions {
  display: flex;
  gap: 6px;
}
.edits-actions button {
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 7px;
  cursor: pointer;
}
.edits-hint {
  font-size: 11.5px;
  color: var(--muted);
  margin: 8px 0 0;
}

/* ---- Lista de setas ---- */
.flows-panel {
  margin-top: 18px;
}
.flow-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 6px;
  font-size: 12.5px;
  cursor: pointer;
}
.flow-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.flow-item.active {
  border-color: var(--highlight);
  background: #fff3ea;
}
.flow-path {
  flex: 1;
  min-width: 0;
}
.flow-label {
  font-size: 10.5px;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 20px;
  padding: 1px 7px;
  white-space: nowrap;
}
.flow-del {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 2px 4px;
  flex: none;
}
.flow-del:hover {
  color: #b3261e;
}
.flow-item.is-new {
  display: block;
}

/* ---- Canvas ---- */
.canvas-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
  background: #fbfcfd;
  background-image: radial-gradient(#e1e6ee 1px, transparent 1px);
  background-size: 22px 22px;
}
#canvas {
  position: absolute;
  inset: 0;
}
.canvas-toolbar {
  position: absolute;
  right: 16px;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.canvas-toolbar button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  font-size: 16px;
  box-shadow: var(--shadow);
}
.canvas-toolbar button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* elemento destacado no diagrama */
.highlight .djs-visual > :nth-child(1) {
  stroke: var(--highlight) !important;
  stroke-width: 3px !important;
  fill: #fff3ea !important;
}

/* ---- Loading / progresso por etapa ---- */
/* ---- Confirmação antes de gastar ---- */

.confirm {
  position: fixed;
  inset: 0;
  z-index: 60; /* acima do overlay de progresso */
  display: grid;
  place-items: center;
  padding: 20px;
}
.confirm[hidden] {
  display: none;
}
.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 36, 48, 0.42);
  backdrop-filter: blur(2px);
}
.confirm-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  width: min(560px, 100%);
  max-height: min(88vh, 760px);
  overflow-y: auto;
  padding: 22px 24px 18px;
}
.confirm-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}
.confirm-head h3 {
  margin: 0;
  font-size: 17px;
  flex: 1;
}
.confirm-x {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  flex: none;
}
.confirm-x:hover {
  color: var(--ink);
}
/* O fato que mais importa, dito primeiro e em prosa — não como um item de lista
   com o mesmo peso do nome do arquivo, que era o defeito do `confirm()`. */
.confirm-lead {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.confirm-alert {
  border: 1px solid var(--amber);
  background: var(--amber-soft);
  color: var(--amber);
  border-radius: 9px;
  padding: 11px 13px;
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.confirm-alert.is-danger {
  border-color: #e8b4b0;
  background: #fdf2f1;
  color: #a8332a;
}
.confirm-alert code {
  font-size: 11.5px;
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 4px;
  border-radius: 4px;
}

.confirm-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0 0 16px;
  font-size: 12.5px;
  align-items: baseline;
}
.confirm-facts dt {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.confirm-facts dd {
  margin: 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
/* O fato que muda o mundo fora do app (gravar na instancia do cliente) nao pode
   ter o mesmo peso visual do nome do arquivo. */
.confirm-facts dd.aviso {
  color: var(--danger, #c0392b);
  font-weight: 600;
}
.confirm-facts dd.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

/* A barra: "cabe / não cabe" se lê antes de qualquer número. */
.confirm-gauge {
  margin-bottom: 16px;
}
.gauge-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.gauge-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.gauge-value {
  font-size: 12px;
  color: var(--ink);
}
.gauge-track {
  height: 7px;
  border-radius: 20px;
  background: var(--line);
  overflow: hidden;
}
.gauge-fill {
  height: 100%;
  border-radius: 20px;
  background: var(--teal);
  transition: width 0.2s;
}
.gauge-fill.is-tight {
  background: var(--amber);
}
.gauge-fill.is-over {
  background: #c0392b;
}
.gauge-hint {
  margin: 5px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.confirm-preview {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 18px;
  font-size: 12.5px;
}
.confirm-preview summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 12.5px;
}
.preview-block {
  margin-top: 10px;
}
.preview-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.confirm-preview pre {
  margin: 4px 0 0;
  padding: 8px 10px;
  background: #f7f8fa;
  border-radius: 7px;
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.preview-hint {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.confirm-actions button {
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
}
/* A AÇÃO PRINCIPAL da tela, no acento da marca.
   
   Esta classe era referenciada em dois lugares e NUNCA existiu no CSS (achado em
   27/08): o `abrirConfirmacao` põe `className = 'primary'` em toda confirmação
   não-perigosa, e o botão do relatório em PDF nasceu sem classe nenhuma com o
   comentário "não é ghost porque é a ação principal". Os dois saíam com o
   estilo cru do navegador — o botão da ENTREGA FINAL do produto entre eles.

   Por que ele NÃO é igual aos `.ghost` ao lado: "Baixar .bpmn", "SVG" e "PNG"
   são saídas técnicas, e o relatório é o que o cliente recebe. Se os quatro
   tivessem o mesmo peso, o principal ficaria escondido no meio dos acessórios —
   e a hierarquia é justamente o que diz por onde começar. */
.primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--panel);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.primary:hover:not(:disabled) {
  /* Escurece o próprio acento: assim o hover acompanha a marca sozinho, sem um
     segundo hex para envelhecer quando o cliente mudar. */
  filter: brightness(0.92);
}
.primary:disabled {
  opacity: 0.6;
  cursor: default;
}

/* O único vermelho da tela. Ele diz o que custa: o rótulo é "Enviar e gastar
   1 chamada", não "OK" — o botão do `confirm()` não sabia dizer isso. */
.danger {
  border: 1px solid #a8332a;
  background: #b8392e;
  color: #fff;
}
.danger:hover {
  filter: brightness(1.08);
}

.loading {
  position: fixed;
  inset: 0;
  background: rgba(245, 246, 248, 0.82);
  display: grid;
  place-items: center;
  z-index: 50;
  backdrop-filter: blur(2px);
}
.progress-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 24px 26px;
  width: min(430px, 90%);
}
.progress-card h3 {
  margin: 0 0 16px;
  font-size: 15px;
}
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
}
.steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  color: var(--muted);
  font-size: 13.5px;
  transition: color 0.15s;
}
.steps .lbl {
  flex: 1;
}
.steps .lbl em {
  font-style: normal;
  color: #9aa4b2;
  font-size: 11.5px;
}
.steps .t {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.steps .dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex: 0 0 auto;
  position: relative;
}
.steps li.active {
  color: var(--ink);
}
.steps li.active .dot {
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.steps li.done {
  color: var(--ink);
}
.steps li.done .dot {
  border-color: var(--teal);
  background: var(--teal);
}
.steps li.done .dot::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #33241f;
  color: #ffd9c7;
  border: 1px solid #6b3b2c;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  max-width: 520px;
  z-index: 60;
  box-shadow: var(--shadow);
}

/* ---- Validação BPMN (bpmnlint) ---- */
.lint {
  margin-bottom: 20px;
}
.lint h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lint ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.lint-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  align-items: start;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 12.5px;
  line-height: 1.4;
}
.lint-item[data-id] {
  cursor: pointer;
}
.lint-item[data-id]:hover {
  border-color: var(--accent);
}
.lint-item.error {
  background: #fdecea;
  border-color: #f3c6bf;
}
.lint-item.warn {
  background: var(--amber-soft);
  border-color: #f0e0b8;
}
.lint-cat {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 5px;
  align-self: center;
}
.lint-cat.error {
  background: #c0392b;
  color: #fff;
}
.lint-cat.warn {
  background: var(--amber);
  color: #fff;
}
.lint-msg {
  color: var(--ink);
}
.lint-rule {
  grid-column: 2;
  color: var(--muted);
  font-size: 10.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---- Gaveta de histórico ---- */
.history-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
/* Tres tracinhos desenhados com gradiente: sem dependencia de icone/fonte. */
.hamburger {
  width: 13px;
  height: 9px;
  background: linear-gradient(currentColor 0 0) 0 0 / 100% 1.5px no-repeat,
    linear-gradient(currentColor 0 0) 0 50% / 100% 1.5px no-repeat,
    linear-gradient(currentColor 0 0) 0 100% / 100% 1.5px no-repeat;
  opacity: 0.75;
}
.history-btn .pill {
  background: var(--accent-soft);
  color: var(--accent);
}

.history {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(360px, 88vw);
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: 0 0 40px rgba(20, 30, 45, 0.14);
  transform: translateX(-100%);
  transition: transform 0.18s ease;
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.history.open {
  transform: none;
}
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.history-head h2 {
  font-size: 15px;
  margin: 0;
}
.icon-btn {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
}
.icon-btn:hover {
  background: var(--bg);
  color: var(--ink);
}
.history-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 18px 24px;
}
.history-section + .history-section {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
/* O bloco de uso e custo lidera a gaveta e nao e uma lista — e um resumo. O
   fundo suave o separa das duas listas abaixo sem precisar de mais um titulo,
   e a borda no acento da marca diz "este e o numero que importa" sem gritar.
   Ver o comentario no index.html para o porque de ele ter subido. */
.history-section--destaque {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 14px 14px 10px;
  margin-bottom: 22px;
}
/* Ele e o primeiro, entao nao leva o separador que divide as secoes seguintes. */
.history-section--destaque + .history-section {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.history-section h3 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 650;
}
.history-empty {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}
.history-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 45, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 45;
}
.history-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

#projects-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.project-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.project-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.project-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-meta {
  font-size: 11.5px;
  color: var(--muted);
}
.project-del {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.project-del:hover {
  border-color: #c0392b;
  color: #c0392b;
  background: #fdecea;
}

/* ---- Badge de versão ---- */
.version-badge {
  display: inline-block;
  margin: 4px 0 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 9px;
  border-radius: 20px;
}

/* ---- Uso & custo (dentro da gaveta) ---- */
/* Falha ao carregar o histórico: precisa parecer problema, não estado vazio. */
.history-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--amber);
  border-left-width: 3px;
  border-radius: 8px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
  line-height: 1.45;
}

.minutes-saved {
  font-size: 11.5px;
  color: var(--teal);
  font-weight: 600;
}

.usage-hint {
  font-size: 10.5px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
.usage-totals {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.usage-cell {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.usage-cell .uv {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}
.usage-cell .uk {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}
.usage-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  font-size: 11.5px;
  display: block;
  overflow-x: auto;
}
.usage-table th,
.usage-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap; /* gaveta estreita: melhor rolar que quebrar "Custo est." */
}
.usage-table thead th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
}
.usage-table tbody tr:last-child td {
  border-bottom: none;
}
.usage-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}


/* ---- Home: as duas portas de entrada, lado a lado ---- */
.home {
  flex: 1;
  min-width: 0; /* sem isto os cards vazam por baixo dos paineis da direita */
  display: grid;
  place-items: center;
  padding: 40px;
  container-type: inline-size;
}
.entry-cards {
  display: grid;
  /* `auto-fit` em vez de um numero fixo: o cartao do ServiceNow so aparece quando
     a integracao esta configurada (ver `GET /api/servicenow`), entao a home tem
     2 ou 3 portas dependendo do ambiente. Com `repeat(2, ...)` o terceiro caia
     sozinho para a linha de baixo, centralizado e torto. */
  grid-template-columns: repeat(auto-fit, minmax(260px, 340px));
  gap: 18px;
  justify-content: center;
}

/* ---- Porta do ServiceNow ---- */
.sn-input {
  margin-top: auto;
  width: 100%;
  max-width: 300px;
  font: inherit;
  font-size: 13px;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: inherit;
}
.sn-input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}
.sn-input.invalido {
  border-color: var(--danger, #c0392b);
}
.sn-lista {
  /* `text-overflow` num <select> nao funciona em todo navegador; o que resolve de
     verdade e nao deixar o texto da opcao crescer — ver `rotuloDaDemanda`. */
  cursor: pointer;
}
.sn-lista:disabled {
  opacity: 0.6;
  cursor: progress;
}
.sn-manual {
  margin: 10px 0 0;
  width: 100%;
  max-width: 300px;
  text-align: left;
}
.sn-manual > summary {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.sn-manual .sn-input {
  margin-top: 8px;
}
/* Quem chega de um clique dentro do ServiceNow precisa ver, em um piscar, QUAL
   cartao e o dele — a home tem tres portas e o navegador abriu uma aba nova. */
.entry-card.destacado {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.sn-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  margin: 12px 0 0;
  text-align: left;
  max-width: 300px;
}
.sn-run {
  margin-top: 14px;
}
.sn-run[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Ata estruturada (passo intermediario do modo transcricao) ---- */
.minutes-view {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.minutes-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.minutes-head h2 {
  font-size: 16px;
  margin: 0 0 4px;
}
.minutes-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 620px;
}
.minutes-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.minutes-usage {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.minutes-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 16px;
  padding: 16px 22px 22px;
}
.minutes-md {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  background: var(--panel);
  color: var(--ink);
  font-family: 'Cascadia Mono', Consolas, 'SF Mono', Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  tab-size: 2;
}
.minutes-md:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.minutes-side {
  width: 320px;
  flex: 0 0 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.minutes-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.minutes-card h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 8px;
}
.minutes-card .card-hint {
  font-size: 11.5px;
  color: var(--muted);
  margin: -4px 0 10px;
  line-height: 1.45;
}
.minutes-card .metrics {
  margin-bottom: 0;
}
.minutes-card .empty {
  font-size: 12.5px;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0;
  line-height: 1.5;
}
.flow-steps {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
}
.flow-steps .step-actor {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
  font-weight: 650;
}
.flow-steps .step-action {
  line-height: 1.45;
}
.flow-steps .branches {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.flow-steps .branch {
  font-size: 11.5px;
  color: var(--teal-ink);
  background: var(--teal-soft);
  border-radius: 6px;
  padding: 4px 8px;
  line-height: 1.4;
}
.open-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
  line-height: 1.45;
}
.open-list .why {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
}

/* Oferta opcional do diagrama, na lateral da ata. */
.minutes-offer button {
  width: 100%;
  margin-top: 2px;
}
.minutes-offer .card-cost {
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  margin: 8px 0 0;
}

/* Os cards empilham quando falta espaco NA HOME — nao na janela. Com
   "Processos salvos" e "Uso & custo" dividindo a linha, a home fica bem mais
   estreita que a tela, e uma media query de viewport nao enxergaria isso. */
@container (max-width: 620px) {
  .entry-cards {
    grid-template-columns: minmax(260px, 400px);
  }
}

@media (max-width: 900px) {
  .minutes-body {
    flex-direction: column;
  }
  .minutes-side {
    width: auto;
    flex: 0 0 auto;
  }
}

/* --- Task I: navegacao entre os processos de um mesmo documento --- */
.process-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #d8dee6);
  background: var(--surface, #fff);
}
.process-tab {
  padding: 5px 12px;
  border: 1px solid var(--border, #d8dee6);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  max-width: 26ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.process-tab:hover { border-color: var(--accent); }
/* A aba ativa usa o acento da marca. Estava com o hex cravado aqui, fora do
   :root — foi o teste da T2 (`test/marca.test.ts`) que achou, em 27/08. */
.process-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--panel);
}
.questions-outras {
  margin: 8px 0 0;
  font-size: 12px;
  opacity: 0.75;
}

/* --- Conferência da ata contra a transcrição -------------------------------
   O ANTES/DEPOIS é o conteúdo desta caixa, não enfeite: o especialista precisa
   ver o que a IA citou e o que o código pôs no lugar. Monoespaçado porque a
   diferença costuma ser de uma palavra ("UAT" -> "UHC") e fonte proporcional
   esconde exatamente esse tipo de troca. */
.audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.audit-item {
  background: var(--amber-soft);
  border: 1px solid #f0e0b8;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.5;
}
.audit-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--amber);
  color: #fff;
  margin-bottom: 6px;
}
.audit-msg {
  color: var(--ink);
  white-space: pre-line;
}
.audit-antes,
.audit-depois {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  margin-top: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  border-left: 3px solid;
  overflow-wrap: anywhere;
}
.audit-antes {
  background: #fdecea;
  border-left-color: #c0392b;
  color: #7a2a20;
}
.audit-depois {
  background: var(--teal-soft);
  border-left-color: var(--teal);
  color: var(--teal-ink);
}
.audit-ok {
  font-size: 12.5px;
  color: var(--teal-ink);
  background: var(--teal-soft);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0;
  line-height: 1.5;
}

/* Cancelar, dentro do cartão de progresso. Só nas execuções que gravam fora. */
.progress-cancel {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.progress-cancel button {
  margin-bottom: 6px;
}

/* Escolha de destino dentro do diálogo de confirmação. Radio, e não checkbox: os
   destinos são exclusivos, e a forma tem de dizer isso antes de alguém ler. */
.confirm-destinos {
  display: grid;
  gap: 6px;
}
.confirm-destinos label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}
.confirm-destinos em {
  display: block;
  font-style: normal;
  font-size: 12px;
  color: var(--muted, #667085);
}

/* ---- Tela de login (A1) ---- */
/* Cobre a aplicacao inteira em vez de escondê-la item a item: enquanto nao ha
   sessao, nao existe "meio app". */
.login {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px 30px 28px;
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
}
/* O logo vem da marca ativa (`npm run marca` copia para o nome fixo), entao a
   tela de entrada ja nasce com a identidade do cliente — que e a primeira coisa
   que ele ve do produto. */
.login-logo {
  height: 34px;
  width: auto;
  align-self: flex-start;
  margin-bottom: 22px;
}
.login-card h1 {
  font-size: 21px;
  margin: 0;
  color: var(--ink);
}
.login-sub {
  margin: 4px 0 22px;
  font-size: 13px;
  color: var(--muted);
}
.login-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 5px;
}
.login-label + .login-input {
  margin-bottom: 16px;
}
.login-input {
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
}
.login-input:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  border-color: var(--teal);
}
/* O botao de entrar.
   Ele NAO usa `.primary` porque essa classe nunca existiu no CSS — o botao saia
   com o estilo cru do navegador. Aqui ele e escrito de verdade, e a cor vem do
   acento da marca ativa: na Afya, o magenta oficial.
   Branco sobre #ce0058 rende 5,14:1, acima do minimo AA para texto — conferido
   pelo teste de contraste em test/marca.test.ts, que vale para toda marca. */
/* O de entrar usa a mesma base `.primary` (ver o HTML) e so acrescenta o que e
   dele: largura cheia e um corpo maior, porque e o unico botao da tela. */
.login-btn {
  margin-top: 8px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 9px;
  font-size: 14.5px;
  letter-spacing: 0.01em;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.login-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.login-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
/* Erro em vermelho de SISTEMA e nao no magenta da marca: erro precisa ler como
   erro, e no tema da Afya o acento e magenta — os dois virariam a mesma coisa. */
.login-erro {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--erro, #b4232a);
  background: #fdecec;
  border: 1px solid #f5c6c6;
  border-radius: 8px;
  padding: 8px 10px;
}

/* ---- Ver a senha ---- */
/* O campo vira o container: o olho e posicionado em relacao a ELE, e nao ao
   cartao, senao qualquer mudanca de espacamento o desalinha. */
.login-campo {
  position: relative;
  display: flex;
  margin-bottom: 16px;
}
.login-campo .login-input {
  flex: 1;
  /* Espaco a direita para o texto nunca passar por baixo do olho. */
  padding-right: 42px;
  margin-bottom: 0;
}
.login-olho {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.login-olho:hover {
  color: var(--accent);
}
.login-olho:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
  color: var(--accent);
}
/* Ligado = a senha esta VISIVEL. Fica no acento da marca porque e um estado que
   convem notar: ha uma senha em texto claro na tela. */
.login-olho[aria-pressed='true'] {
  color: var(--accent);
}
