/* AF — Ficha de Atendimento (aba na ficha do assistido) — 13/08/2026
   Usa as variáveis de tema do próprio app, então acompanha claro/escuro. */

.afa-wrap { display: flex; flex-direction: column; gap: 1rem; }

.afa-cabecalho {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.afa-titulo { font-size: 1.125rem; font-weight: 600; color: hsl(var(--foreground)); margin: 0; }
.afa-sub { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); margin: 0.25rem 0 0; }

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

.afa-filtros { display: flex; gap: .5rem; flex-wrap: wrap; }
.afa-filtros .afa-input { flex: 1 1 240px; }
.afa-select-curto { flex: 0 0 200px; }

.afa-erro {
  border: 1px solid hsl(var(--destructive) / .35);
  background: hsl(var(--destructive) / .08);
  color: hsl(var(--destructive));
  border-radius: .5rem; padding: .75rem 1rem; font-size: .875rem;
}

.afa-lista { display: flex; flex-direction: column; gap: .75rem; }

/* ---------- cartão ---------- */
.afa-card {
  border: 1px solid hsl(var(--border)); border-radius: .75rem;
  background: hsl(var(--card)); padding: 1rem 1.125rem;
  display: flex; flex-direction: column; gap: .625rem;
}
.afa-card-topo {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap;
}
.afa-card-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.afa-data { font-size: .875rem; font-weight: 600; color: hsl(var(--foreground)); }

.afa-tag {
  font-size: .6875rem; font-weight: 500; padding: .125rem .5rem;
  border-radius: 9999px; border: 1px solid hsl(var(--border));
  background: hsl(var(--muted)); color: hsl(var(--muted-foreground));
  white-space: nowrap;
}
.afa-tag-neutra { background: transparent; }
.afa-tag-portal {
  background: hsl(142 70% 45% / .12); color: hsl(142 70% 32%);
  border-color: hsl(142 70% 45% / .35);
}
.dark .afa-tag-portal { color: hsl(142 70% 60%); }

.afa-card-acoes { display: flex; align-items: center; gap: .75rem; }
.afa-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-size: .75rem; color: hsl(var(--muted-foreground)); text-decoration: none;
}
.afa-link:hover { color: hsl(var(--foreground)); text-decoration: underline; }
.afa-link-perigo:hover { color: hsl(var(--destructive)); }

.afa-assunto { font-size: .9375rem; font-weight: 600; color: hsl(var(--foreground)); margin: 0; }
.afa-resumo {
  font-size: .875rem; line-height: 1.55; color: hsl(var(--foreground));
  margin: 0; white-space: pre-wrap;
}

.afa-bloco { font-size: .8125rem; }
.afa-bloco-titulo {
  display: block; font-size: .6875rem; text-transform: uppercase;
  letter-spacing: .04em; color: hsl(var(--muted-foreground)); margin-bottom: .125rem;
}
.afa-bloco p { margin: 0; white-space: pre-wrap; color: hsl(var(--foreground)); }

.afa-prazo {
  display: flex; align-items: center; gap: .5rem;
  font-size: .8125rem; border-radius: .5rem; padding: .5rem .75rem;
  background: hsl(38 92% 50% / .1); border: 1px solid hsl(38 92% 50% / .3);
  color: hsl(var(--foreground));
}
.afa-prazo-data { font-weight: 600; white-space: nowrap; }

.afa-docs { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; font-size: .8125rem; }
.afa-docs p { margin: 0; white-space: pre-wrap; color: hsl(var(--foreground)); }

.afa-card-anexos { display: flex; flex-wrap: wrap; gap: .375rem; }
.afa-chip {
  font-size: .75rem; padding: .1875rem .625rem; border-radius: 9999px;
  border: 1px solid hsl(var(--border)); background: hsl(var(--muted));
  color: hsl(var(--foreground)); text-decoration: none; max-width: 22rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
a.afa-chip:hover { background: hsl(var(--accent)); }

.afa-card-rodape { font-size: .75rem; color: hsl(var(--muted-foreground)); }

/* ---------- vazio ---------- */
.afa-vazio { font-size: .875rem; color: hsl(var(--muted-foreground)); margin: 0; }
.afa-vazio-mini { font-size: .75rem; color: hsl(var(--muted-foreground)); margin: .25rem 0 0; }
.afa-vazio-box {
  border: 1px dashed hsl(var(--border)); border-radius: .75rem;
  padding: 2rem 1rem; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
}

/* ---------- modal ---------- */
.afa-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: hsl(0 0% 0% / .55);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  overflow-y: auto;
}
.afa-modal {
  background: hsl(var(--background)); color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border)); border-radius: .875rem;
  width: 100%; max-width: 46rem; max-height: 92vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px hsl(0 0% 0% / .35);
}
.afa-modal-topo {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; padding: 1.125rem 1.25rem; border-bottom: 1px solid hsl(var(--border));
}
.afa-modal-titulo { font-size: 1.0625rem; font-weight: 600; margin: 0; }
.afa-modal-sub { font-size: .8125rem; color: hsl(var(--muted-foreground)); margin: .125rem 0 0; }
.afa-x {
  background: none; border: 0; cursor: pointer; line-height: 1;
  font-size: 1.5rem; color: hsl(var(--muted-foreground)); padding: 0 .25rem;
}
.afa-x:hover { color: hsl(var(--foreground)); }

.afa-modal-corpo { padding: 1rem 1.25rem 1.25rem; overflow-y: auto; }
.afa-modal-rodape {
  display: flex; justify-content: flex-end; gap: .5rem;
  padding: .875rem 1.25rem; border-top: 1px solid hsl(var(--border));
}

.afa-secao {
  font-size: .6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: hsl(var(--muted-foreground));
  margin: 1.125rem 0 .5rem;
}
.afa-modal-corpo > .afa-secao:first-child { margin-top: 0; }

.afa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }
.afa-campo { display: flex; flex-direction: column; gap: .3125rem; min-width: 0; }
.afa-col-2 { grid-column: 1 / -1; }

.afa-label { font-size: .8125rem; font-weight: 500; color: hsl(var(--foreground)); }
.afa-hint { font-size: .6875rem; color: hsl(var(--muted-foreground)); margin: 0; }

.afa-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));
}
.afa-input:focus {
  outline: none; border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / .25);
}
.afa-textarea { resize: vertical; line-height: 1.5; }
.afa-file { display: none; }

.afa-anexos {
  margin-top: 1.125rem; border: 1px solid hsl(var(--border));
  border-radius: .625rem; padding: .75rem .875rem;
}
.afa-anexos-topo { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.afa-lista-anexos { list-style: none; margin: .625rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .3125rem; }
.afa-lista-anexos li {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  font-size: .8125rem;
}
.afa-lista-anexos a { color: hsl(var(--primary)); text-decoration: none; }
.afa-lista-anexos a:hover { text-decoration: underline; }
.afa-x-mini {
  background: none; border: 0; cursor: pointer; font-size: 1rem; line-height: 1;
  color: hsl(var(--muted-foreground)); padding: 0 .25rem;
}
.afa-x-mini:hover { color: hsl(var(--destructive)); }

.afa-portal {
  margin-top: 1.125rem; border: 1px solid hsl(var(--border));
  border-radius: .625rem; padding: .875rem;
  background: hsl(var(--muted) / .4);
}
.afa-check { display: flex; align-items: flex-start; gap: .625rem; cursor: pointer; font-size: .875rem; }
.afa-check input { margin-top: .1875rem; width: 1rem; height: 1rem; cursor: pointer; }
.afa-check > span { display: flex; flex-direction: column; gap: .125rem; }
.afa-portal .afa-campo { margin-top: .75rem; }

@media (max-width: 640px) {
  .afa-grid, .afa-docs { grid-template-columns: 1fr; }
  .afa-select-curto { flex: 1 1 100%; }
  .afa-card-topo { flex-direction: column; }
}
