/* AF — fases do processo — 14/08/2026
   Etiqueta de fase na lista, seletor inline e o bloco de campos próprios
   de cada fase dentro do processo. */

/* ---------- etiqueta ---------- */
.aff-etiqueta {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .125rem .625rem;
  border-radius: 9999px;
  border-width: 1px;
  border-style: solid;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  white-space: nowrap;
}

.aff-bolinha {
  width: .375rem;
  height: .375rem;
  border-radius: 9999px;
  flex: 0 0 auto;
}

/* ---------- seletor na lista ---------- */
.aff-celula {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .125rem 1.25rem .125rem .5rem;
  border-radius: 9999px;
  border-width: 1px;
  border-style: solid;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  white-space: nowrap;
  cursor: pointer;
  transition: filter .12s, box-shadow .12s;
}
.aff-celula:hover { filter: brightness(0.96); }
.dark .aff-celula:hover { filter: brightness(1.18); }
.aff-celula[data-salvando="true"] { opacity: .6; cursor: progress; }
.aff-celula:focus-within { box-shadow: 0 0 0 2px hsl(var(--ring) / .35); }

.aff-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0; margin: 0; padding: 0;
  font: inherit; color: inherit;
  cursor: pointer; outline: none;
}
.aff-seta {
  position: absolute;
  right: .45rem;
  font-size: .6rem;
  line-height: 1;
  opacity: .55;
  pointer-events: none;
}
.aff-select option { color: #111827; background: #ffffff; }
.dark .aff-select option { color: #e5e7eb; background: #111827; }

/* ---------- bloco dentro do processo ---------- */
.aff-bloco {
  border: 1px solid hsl(var(--border));
  border-radius: .75rem;
  background: hsl(var(--card));
  padding: 1rem 1.125rem 1.125rem;
  margin-bottom: 1.25rem;
}

.aff-topo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .875rem;
}
.aff-titulo { font-size: .9375rem; font-weight: 600; color: hsl(var(--foreground)); margin: 0; }
.aff-sub { font-size: .75rem; color: hsl(var(--muted-foreground)); margin: .1875rem 0 0; }
.aff-topo-acoes { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.aff-fase-select { min-width: 13rem; font-weight: 500; }

.aff-btn, .aff-btn-sec {
  border-radius: 9999px;
  font-size: .8125rem;
  font-weight: 500;
  padding: .4375rem 1rem;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  white-space: nowrap;
  transition: opacity .15s, background-color .15s;
}
.aff-btn { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.aff-btn:hover:not(:disabled) { opacity: .9; }
.aff-btn:disabled { opacity: .45; cursor: default; }
.aff-btn-sec {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}
.aff-btn-sec:hover { background: hsl(var(--muted)); }

/* ---------- campos ---------- */
.aff-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem 1rem;
}
.aff-campo { display: flex; flex-direction: column; gap: .3125rem; min-width: 0; }
.aff-col-2 { grid-column: 1 / -1; }

.aff-label { font-size: .8125rem; font-weight: 500; color: hsl(var(--foreground)); }
.aff-dica { font-size: .6875rem; color: hsl(var(--muted-foreground)); margin: 0; line-height: 1.35; }

.aff-input {
  width: 100%;
  border-radius: .5rem;
  padding: .5rem .625rem;
  font-size: .875rem;
  font-family: inherit;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}
.aff-input:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / .25);
}
.aff-textarea { resize: vertical; line-height: 1.5; }

/* ---------- histórico das fases anteriores ---------- */
.aff-historico { margin-top: .875rem; font-size: .8125rem; }
.aff-historico summary {
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  font-size: .75rem;
}
.aff-historico summary:hover { color: hsl(var(--foreground)); }
.aff-historico-corpo {
  margin-top: .5rem;
  display: flex;
  flex-direction: column;
  gap: .625rem;
}
.aff-historico-fase strong { font-size: .75rem; color: hsl(var(--foreground)); }
.aff-historico-fase ul {
  margin: .25rem 0 0;
  padding-left: 1.125rem;
  color: hsl(var(--muted-foreground));
  font-size: .75rem;
  line-height: 1.5;
}

/* ---------- aviso de fora da execução ---------- */
.aff-aviso {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border: 1px dashed hsl(var(--border));
  border-radius: .75rem;
  background: hsl(var(--muted) / .4);
  padding: 1rem 1.125rem;
  margin-bottom: 1rem;
}
.aff-aviso-texto strong { font-size: .875rem; color: hsl(var(--foreground)); }
.aff-aviso-texto p {
  margin: .25rem 0 0;
  font-size: .8125rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
  max-width: 52rem;
}

@media (max-width: 900px) {
  .aff-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .aff-grid { grid-template-columns: 1fr; }
  .aff-topo { flex-direction: column; align-items: stretch; }
  .aff-topo-acoes { justify-content: space-between; }
  .aff-fase-select { min-width: 0; flex: 1; }
  .aff-celula { font-size: 10px; }
}

/* ---------- campo repetível (vários inquéritos, por exemplo) ---------- */
.aff-lista { gap: .5rem; }
.aff-lista-vazia { font-size: .8125rem; color: hsl(var(--muted-foreground)); margin: 0; }

.aff-lista-itens { display: flex; flex-direction: column; gap: .625rem; }

.aff-lista-item {
  border: 1px solid hsl(var(--border));
  border-radius: .625rem;
  background: hsl(var(--background));
  padding: .625rem .75rem .75rem;
}
.aff-lista-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .375rem;
}
.aff-lista-num {
  font-size: .6875rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  letter-spacing: .04em;
}
.aff-lista-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem .75rem;
}
.aff-label-mini { font-size: .6875rem; font-weight: 500; color: hsl(var(--muted-foreground)); }

.aff-x {
  background: none; border: 0; cursor: pointer;
  font-size: 1.125rem; line-height: 1;
  color: hsl(var(--muted-foreground));
  padding: 0 .125rem;
}
.aff-x:hover { color: hsl(var(--destructive)); }

.aff-add { align-self: flex-start; font-size: .75rem; padding: .3125rem .75rem; }

@media (max-width: 900px) {
  .aff-lista-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .aff-lista-grid { grid-template-columns: 1fr; }
}

/* ---------- linha do tempo do processo ---------- */
.aff-linha-vazia {
  margin: .875rem 0 0;
  font-size: .75rem;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
  max-width: 56rem;
}

.aff-linha { margin-top: .875rem; }
.aff-linha > summary {
  cursor: pointer;
  font-size: .8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  display: flex;
  align-items: center;
  gap: .5rem;
}
.aff-linha > summary:hover { color: hsl(var(--primary)); }
.aff-linha-conta {
  font-size: .6875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: 9999px;
  padding: .0625rem .5rem;
}

.aff-linha-corpo {
  margin: .75rem 0 0 .3125rem;
  padding-left: 1rem;
  border-left: 1px solid hsl(var(--border));
  display: flex;
  flex-direction: column;
  gap: .875rem;
}

.aff-linha-item { position: relative; }
.aff-linha-ponto {
  position: absolute;
  left: -1.3125rem;
  top: .3125rem;
  width: .5rem;
  height: .5rem;
  border-radius: 9999px;
  background: hsl(var(--border));
  border: 2px solid hsl(var(--card));
}
.aff-linha-agora .aff-linha-ponto { background: hsl(var(--primary)); }

.aff-linha-texto { display: flex; flex-direction: column; gap: .125rem; min-width: 0; }
.aff-linha-texto strong { font-size: .8125rem; font-weight: 600; color: hsl(var(--foreground)); }
.aff-linha-quando { font-size: .6875rem; color: hsl(var(--muted-foreground)); }

.aff-linha-dados {
  margin: .25rem 0 0;
  padding-left: 1.125rem;
  font-size: .75rem;
  line-height: 1.55;
  color: hsl(var(--muted-foreground));
}
.aff-linha-dados li { overflow-wrap: anywhere; }
