/* ============================================================================
 * CU-868mmfm3a — borrower AI Results cell (public/backoffice/uploadLMRDocs.php)
 *
 * One block per uploaded file: name + status pill, a plain-language line, the
 * fix (issue + tip + "Upload a corrected file") when it needs attention, live
 * stage progress while it is being checked, and a native <details> "How we
 * checked" list. Status colour stays on small elements (the .lw-pill, the check
 * icons, the 3px progress bar) — never on the cell. Tokens only; dark mode flips
 * through them, so there is no body.dark-mode rule in this file.
 * ========================================================================= */

td[id^="aiResults_"] .lw-bai {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--lw-sp-2);
    min-width: 220px;
    max-width: 440px;
    text-align: left;
    font-size: var(--lw-fs-sm);
    line-height: var(--lw-lh-snug);
    color: var(--lw-text);
}

.lw-bai__summary {
    color: var(--lw-text-muted);
    font-size: var(--lw-fs-xs);
}

.lw-bai__file {
    display: flex;
    flex-direction: column;
    gap: var(--lw-sp-1);
    padding: var(--lw-sp-2) var(--lw-sp-3);
    border: var(--lw-border-width) solid var(--lw-border-light);
    border-radius: var(--lw-radius);
    background: var(--lw-surface);
}

.lw-bai__file--older {
    border-style: dashed;
}

.lw-bai__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--lw-sp-2);
    min-width: 0;
}

.lw-bai__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: var(--lw-fw-medium);
    color: var(--lw-text-secondary);
}

.lw-bai__name .fas {
    margin-right: var(--lw-sp-1);
    color: var(--lw-text-muted);
}

.lw-bai__head .lw-pill {
    flex: none;
}

.lw-bai__msg {
    color: var(--lw-text);
}

.lw-bai__muted {
    color: var(--lw-text-muted);
    font-size: var(--lw-fs-xs);
}

.lw-bai__issue {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lw-bai__issue-title {
    font-weight: var(--lw-fw-semibold);
    color: var(--lw-text);
}

.lw-bai__issue-title .fas {
    margin-right: var(--lw-sp-1);
    color: var(--lw-status-fail-ink);
}

.lw-bai__tip {
    color: var(--lw-text-secondary);
}

.lw-bai__fields {
    color: var(--lw-text-secondary);
    font-size: var(--lw-fs-xs);
}

.lw-bai__action {
    align-self: flex-start;
    margin-top: var(--lw-sp-1);
}

/* in progress */
.lw-bai__stage {
    display: flex;
    align-items: center;
    gap: var(--lw-sp-2);
    color: var(--lw-primary-ink);
}

.lw-bai__stage .fas {
    flex: none;
}

.lw-bai__bar {
    height: 3px;
    border-radius: 2px;
    background: var(--lw-border-light);
    overflow: hidden;
}

.lw-bai__bar > span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--lw-primary);
    transition: width 0.3s ease-in-out;
}

/* How we checked */
.lw-bai__checks > summary {
    cursor: pointer;
    color: var(--lw-primary-ink);
    font-size: var(--lw-fs-xs);
    font-weight: var(--lw-fw-medium);
    list-style: none;
}

.lw-bai__checks > summary::-webkit-details-marker {
    display: none;
}

.lw-bai__checks > summary::before {
    content: "\25B8";
    display: inline-block;
    width: 1em;
    transition: transform var(--lw-transition-fast);
}

.lw-bai__checks[open] > summary::before {
    transform: rotate(90deg);
}

.lw-bai__checks > summary:focus-visible {
    outline: none;
    box-shadow: var(--lw-shadow-focus);
    border-radius: var(--lw-radius-sm);
}

.lw-bai__checks ul {
    margin: var(--lw-sp-1) 0 0;
    padding: 0;
    list-style: none;
}

.lw-bai__checks li {
    display: flex;
    align-items: baseline;
    gap: var(--lw-sp-2);
    padding: 2px 0;
    color: var(--lw-text-secondary);
    font-size: var(--lw-fs-xs);
}

.lw-bai__checks li .fas {
    flex: none;
    width: 1em;
    text-align: center;
}

.lw-bai__check--pass .fas   { color: var(--lw-status-pass-ink); }
.lw-bai__check--fail .fas   { color: var(--lw-status-fail-ink); }
.lw-bai__check--review .fas { color: var(--lw-status-pending-ink); }

.lw-bai__checks-note {
    margin-top: var(--lw-sp-1);
    color: var(--lw-text-muted);
    font-size: var(--lw-fs-xs);
}

@media (prefers-reduced-motion: reduce) {
    .lw-bai .fa-spin { animation: none; }
    .lw-bai__bar > span,
    .lw-bai__checks > summary::before { transition: none; }
}
