/* Airlend Flow v20 — Document Review + Checklist Intelligence
   Load after /css/airlend-flow.css and v19 document CSS. */

.af-terms-readiness-card,
.af-document-timeline-card {
  grid-column: 1 / -1;
}

.af-readiness-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.af-readiness-output,
.af-health-panel {
  min-width: 0;
}

.af-readiness-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.82fr);
  gap: 16px;
  align-items: stretch;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 16px;
}

.af-readiness-main {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
}

.af-readiness-main h3 {
  margin: 0;
  color: #0f2344;
  font-size: 1.08rem;
  line-height: 1.24;
}

.af-readiness-main p {
  margin: 0;
  color: #475569;
  font-size: 0.88rem;
  line-height: 1.45;
}

.af-readiness-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.af-readiness-metrics > div {
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 14px;
  background: #fff;
  padding: 11px 12px;
}

.af-readiness-metrics span {
  display: block;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.af-readiness-metrics strong {
  display: block;
  margin-top: 3px;
  color: #0f2344;
  font-size: 1.08rem;
}

.af-readiness-blockers {
  display: grid;
  gap: 8px;
  margin: 3px 0 0;
  padding: 0;
  list-style: none;
}

.af-readiness-blockers li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: #fff;
  padding: 9px 10px;
}

.af-readiness-blockers strong {
  min-width: 0;
  color: #0f2344;
  font-size: 0.84rem;
  line-height: 1.25;
}

.af-readiness-blockers span {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.af-readiness-ready {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(16, 185, 129, 0.18);
  border-radius: 13px;
  background: #ecfdf5;
  color: #047857;
  padding: 10px 11px;
  font-size: 0.84rem;
  font-weight: 800;
}

.af-readiness-ready.is-muted {
  border-color: rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  color: #475569;
}

.af-status-chip.is-readiness-ready {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid rgba(4, 120, 87, 0.16);
}

.af-status-chip.is-readiness-review_pending,
.af-status-chip.is-readiness-review,
.af-status-chip.is-readiness-uploaded {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid rgba(29, 78, 216, 0.16);
}

.af-status-chip.is-readiness-blocked,
.af-status-chip.is-readiness-rejected {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid rgba(194, 65, 12, 0.16);
}

.af-status-chip.is-readiness-docs_needed,
.af-status-chip.is-readiness-missing,
.af-status-chip.is-readiness-requested {
  background: #f8fafc;
  color: #475569;
  border: 1px solid rgba(71, 85, 105, 0.14);
}

.af-checklist-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.af-health-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  background: #fff;
  padding: 11px;
}

.af-health-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #94a3b8;
  margin-top: 5px;
}

.af-health-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.af-health-main strong {
  color: #0f2344;
  font-size: 0.86rem;
  line-height: 1.25;
}

.af-health-main small {
  color: #64748b;
  font-size: 0.73rem;
  line-height: 1.28;
}

.af-health-row.is-readiness-approved .af-health-dot,
.af-health-row.is-readiness-waived .af-health-dot {
  background: #10b981;
}

.af-health-row.is-readiness-review .af-health-dot,
.af-health-row.is-readiness-uploaded .af-health-dot {
  background: #2563eb;
}

.af-health-row.is-readiness-rejected .af-health-dot {
  background: #f97316;
}

.af-health-row.is-readiness-missing .af-health-dot,
.af-health-row.is-readiness-requested .af-health-dot {
  background: #94a3b8;
}

.af-health-row.is-readiness-rejected {
  border-color: rgba(249, 115, 22, 0.22);
  background: #fff7ed;
}

.af-health-reason {
  color: #c2410c !important;
}

.af-document-timeline-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}

.af-timeline-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 15px;
  background: #fff;
  padding: 11px;
}

.af-timeline-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #eff6ff;
  color: #2563eb;
}

.af-timeline-row.is-readiness-approved .af-timeline-icon {
  background: #ecfdf5;
  color: #047857;
}

.af-timeline-row.is-readiness-rejected .af-timeline-icon,
.af-timeline-row.is-readiness-requested_again .af-timeline-icon {
  background: #fff7ed;
  color: #c2410c;
}

.af-timeline-row.is-readiness-deleted .af-timeline-icon {
  background: #f8fafc;
  color: #475569;
}

.af-timeline-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.af-timeline-main strong {
  color: #0f2344;
  font-size: 0.88rem;
  line-height: 1.28;
}

.af-timeline-main small {
  color: #64748b;
  font-size: 0.73rem;
  line-height: 1.3;
}

.af-timeline-main p {
  margin: 0;
  color: #475569;
  font-size: 0.8rem;
  line-height: 1.34;
}

.af-card-actions--tight {
  gap: 6px;
  flex-wrap: wrap;
}

.af-borrower-doc-hint {
  margin: -4px 0 12px;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.4;
}

.af-borrower-check-row--upload.is-doc-rejected {
  border-color: rgba(249, 115, 22, 0.24);
  background: linear-gradient(180deg, #fff 0%, #fff7ed 100%);
}

.af-borrower-check-row--upload.is-doc-rejected .af-borrower-check-icon {
  background: #fff7ed;
  color: #c2410c;
}

.af-borrower-check-row--upload.is-doc-rejected .af-btn {
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.16);
}

.af-doc-summary.is-doc-rejected small strong {
  color: #c2410c;
}

.af-document-review-card .af-document-review-list {
  max-height: 440px;
}

@media (max-width: 1180px) {
  .af-readiness-wrap,
  .af-readiness-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .af-readiness-metrics,
  .af-document-timeline-list,
  .af-checklist-health-grid {
    grid-template-columns: 1fr;
  }

  .af-readiness-blockers li {
    align-items: flex-start;
    flex-direction: column;
  }
}
