/* AF CRM — baixa de parcela em atraso + inadimplente em vermelho (23/09/2026) */
.afb-linha { align-items: center; }
.afb-linha > strong { margin-left: auto; }
.afb-bt {
  flex: 0 0 auto; border: 1px solid #fca5a5; background: #fff; color: #b91c1c;
  border-radius: .5rem; padding: .2rem .6rem; font: inherit; font-size: .72rem; font-weight: 600;
  cursor: pointer; transition: background-color .15s, border-color .15s;
}
.afb-bt:hover { background: #fee2e2; border-color: #f87171; }
:is(.dark *) .afb-bt { background: transparent; color: #fca5a5; border-color: rgba(248, 113, 113, .5); }
:is(.dark *) .afb-bt:hover { background: rgba(248, 113, 113, .12); }

.afb-form {
  margin: .4rem 0 .6rem; padding: .85rem; border-radius: .75rem;
  border: 1px solid #fecaca; background: #fff; color: hsl(var(--foreground));
  font-size: .8125rem; box-shadow: 0 4px 14px rgba(185, 28, 28, .08);
}
:is(.dark *) .afb-form { background: hsl(var(--card)); border-color: rgba(248, 113, 113, .35); }
.afb-tit { font-weight: 700; font-size: .85rem; margin-bottom: .55rem; color: #991b1b; }
:is(.dark *) .afb-tit { color: #fca5a5; }
.afb-tipos { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: .65rem; }
.afb-op { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; font-weight: 500; }
.afb-op input { accent-color: #b91c1c; width: 1rem; height: 1rem; margin: 0; }
.afb-grade { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.afb-campo { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.afb-largo { grid-column: 1 / -1; }
.afb-rot { font-size: .7rem; font-weight: 600; color: hsl(var(--muted-foreground)); }
.afb-in {
  height: 2.25rem; border: 1px solid hsl(var(--border)); border-radius: .5rem; padding: 0 .6rem;
  background: hsl(var(--background)); color: hsl(var(--foreground)); font: inherit; font-size: .8125rem;
  box-sizing: border-box; width: 100%; min-width: 0;
}
.afb-in:focus { outline: none; border-color: #ea580c; box-shadow: 0 0 0 3px rgba(234, 88, 12, .18); }
.afb-off { opacity: .55; }
.afb-rodape { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.afb-aviso { flex: 1 1 200px; font-size: .75rem; }
.afb-erro { color: #b91c1c; }
.afb-ok { color: #15803d; }
:is(.dark *) .afb-erro { color: #fca5a5; }
:is(.dark *) .afb-ok { color: #86efac; }
.afb-sec, .afb-pri {
  height: 2.1rem; padding: 0 .9rem; border-radius: .5rem; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
}
.afb-sec { border: 1px solid hsl(var(--border)); background: transparent; color: hsl(var(--foreground)); }
.afb-pri { border: 0; background: #b91c1c; color: #fff; }
.afb-pri:hover { background: #991b1b; }
.afb-sec:disabled, .afb-pri:disabled { opacity: .6; cursor: default; }

/* Rentabilidade por Cliente: quem está em atraso */
td.afb-inadimplente { color: #dc2626 !important; font-weight: 700; cursor: help; }
td.afb-inadimplente::after {
  content: "em atraso"; margin-left: .5rem; padding: .05rem .4rem; border-radius: 999px;
  font-size: .65rem; font-weight: 700; letter-spacing: .02em; vertical-align: middle;
  background: #fee2e2; color: #b91c1c;
}
:is(.dark *) td.afb-inadimplente { color: #f87171 !important; }
:is(.dark *) td.afb-inadimplente::after { background: rgba(248, 113, 113, .15); color: #fca5a5; }

@media (max-width: 640px) {
  .afb-grade { grid-template-columns: 1fr; }
  .afb-linha { flex-wrap: wrap; }
  .afb-bt { width: 100%; padding: .45rem; }
}
