/* =============================================================================
   SAP data checks — "Detected" tab of the SAP Issue Tracker
   (js/views/sap-checks.js). Run bar, findings list, finding modal actions and
   the Check settings modal. Reuses the tracker's buttons, table, filters,
   badges and modal (css/sap-issues.css); only what is new lives here.
   ============================================================================= */

.sap-checks {
    --checks-review: #E8710A;
    --checks-promoted: #1E8E3E;
    --checks-dismissed: #5F6B85;
    --checks-bad: #D93025;
}

/* ---- Run bar: last run + buttons ---- */
.sap-checks__runbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--light-silver, #E3E4E9);
    border-radius: 8px;
    background: var(--off-white, #F7F7F8);
}

.sap-checks__runline {
    margin: 0;
    font-size: 0.8rem;
    color: var(--secondary-blue, #1F3D7C);
    flex: 1 1 18rem;
}

.sap-checks__note {
    margin: 0 0 0.6rem;
    font-size: 0.78rem;
    color: var(--slate, #808FAD);
    flex-basis: 100%;
}

.sap-checks__bad {
    color: var(--checks-bad, #D93025);
    font-weight: 600;
}

/* ---- List ---- */
.sap-checks__row--cleared {
    opacity: 0.65;
}

.sap-checks__status {
    display: inline-block;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid currentColor;
}

.sap-checks__status--review { color: var(--checks-review, #E8710A); background: #FEEFE3; }
.sap-checks__status--promoted { color: var(--checks-promoted, #1E8E3E); background: #E6F4EA; }
.sap-checks__status--dismissed { color: var(--checks-dismissed, #5F6B85); background: #F1F3F6; }

/* What the last run did to the finding: New / Changed / Cleared. */
.sap-checks__flag {
    display: inline-block;
    margin-left: 0.3rem;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--primary-blue, #0F9FC4);
}

.sap-checks__flag--cleared {
    color: var(--checks-promoted, #1E8E3E);
}

/* ---- Finding modal ---- */
.sap-checks__dates {
    margin: -0.4rem 0 0.9rem;
    font-size: 0.75rem;
    color: var(--slate, #808FAD);
}

.sap-checks__actions {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    font-size: 0.82rem;
}

.sap-checks__actions p {
    margin: 0 0 0.4rem;
}

.sap-checks__action label {
    display: block;
    margin-bottom: 0.35rem;
}

.sap-checks__inline {
    display: flex;
    gap: 0.5rem;
}

.sap-checks__inline select,
.sap-checks__inline input {
    flex: 1 1 auto;
    min-width: 0;
}

.sap-checks__inline .sap-issues__btn {
    flex: none;
    white-space: nowrap;
}

/* ---- Settings modal ---- */
.sap-check-modal--wide {
    max-width: 920px;
}

.sap-checks__setting {
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--light-silver, #E3E4E9);
}

.sap-checks__setting-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}

.sap-checks__switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.sap-checks__setting-text {
    margin: 0.2rem 0 0.5rem;
    font-size: 0.76rem;
    color: var(--slate, #808FAD);
}

.sap-checks__outcome {
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

.sap-checks__outcome--pass { color: var(--checks-promoted, #1E8E3E); }
.sap-checks__outcome--problems { color: var(--checks-review, #E8710A); }
.sap-checks__outcome--error { color: var(--checks-bad, #D93025); }
.sap-checks__outcome--skipped { color: var(--checks-dismissed, #5F6B85); }

.sap-checks__group-head {
    margin-top: 1.25rem;
}

/* Two rows per check: severity + threshold, then the bands + Save. */
.sap-checks__fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem 0.75rem;
    align-items: end;
}

.sap-checks__field--wide {
    grid-column: span 3;
}

.sap-checks__fields .sap-issues__btn {
    justify-self: start;
}

.sap-checks__bands-label {
    margin: 0.6rem 0 0.25rem;
    font-size: 0.72rem;
    color: var(--slate, #808FAD);
}

@media (max-width: 575px) {
    .sap-checks__fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sap-checks__field--wide {
        grid-column: 1 / -1;
    }

    .sap-checks__inline {
        flex-direction: column;
    }
}
