/* ============================================================
   Upload Audit dashboard styles.
   Scoped under .auditDash so they never collide with the
   existing site framework classes (.card, .pill, etc.).
   ============================================================ */

.auditDash {
    --au-primary: #2b5c8a;
    --au-line: #e2e8f0;
    --au-muted: #6b7785;
    --au-ink: #27313b;
    height: calc(100vh - 100px);
    width: 100%
}

    .auditDash h1 {
        font-size: 1.4rem;
        margin: 0;
    }

    .auditDash .au-muted {
        color: var(--au-muted);
    }

    .auditDash .au-mono {
        font-family: ui-monospace,Consolas,"Courier New",monospace;
        font-size: 0.85em;
    }

    /* Cards */
    .auditDash .au-card {
        background: #fff;
        border: 1px solid var(--au-line);
        border-radius: 0.5em;
    }

    .auditDash .au-card-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.8em 1em;
        border-bottom: 1px solid var(--au-line);
    }

    .auditDash .au-card-body {
        padding: 1em;
    }

        .auditDash .au-card-body.tight {
            padding: 0;
        }

    /* Stat row */
    .auditDash .au-stats {
        display: grid;
        grid-template-columns: repeat(auto-fit,minmax(150px,1fr));
        gap: 0.75em;
        margin: 1em 0;
    }

    .auditDash .au-stat {
        background: #fff;
        border: 1px solid var(--au-line);
        border-left: 4px solid var(--au-primary);
        padding: 0.1em 1em;
    }

        .auditDash .au-stat .label {
            font-size: 0.78em;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--au-muted);
        }

        .auditDash .au-stat .value {
            font-size: 1.6rem;
            font-weight: 700;
            color: var(--au-ink);
        }

        .auditDash .au-stat.uploaded {
            border-left-color: #6b7785;
        }

        .auditDash .au-stat.review {
            border-left-color: #2b5c8a;
        }

        .auditDash .au-stat.approved {
            border-left-color: #2c7a37;
        }

        .auditDash .au-stat.declined {
            border-left-color: #b3261e;
        }

        /* Actionable backlog — items awaiting a reviewer decision. */
        .auditDash .au-stat.pending {
            border-left-color: #c07a00;
        }

    /* Status pills */
    .auditDash .au-pill {
        display: inline-block;
        font-size: 0.72em;
        font-weight: 700;
        padding: 0.18em 0.6em;
        border-radius: 1em;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

        .auditDash .au-pill.uploaded {
            background: #eef1f4;
            color: #48515b;
        }

        .auditDash .au-pill.review {
            background: #e4eef7;
            color: #1f4a73;
            width: 9em;
        }

        .auditDash .au-pill.edits {
            background: #fff7d6;
            color: #8a5a05;
        }

        .auditDash .au-pill.approved {
            background: #d9efdb;
            color: #1f5b29;
        }

        .auditDash .au-pill.declined {
            background: #fbe0de;
            color: #8a1c16;
        }

        /* Failure pills (Parse Failed / Partial Parse / Request Failed) share the declined red. */
        .auditDash .au-pill.failed {
            background: #fbe0de;
            color: #8a1c16;
        }

    /* Kind badge */
    .auditDash .au-ext {
        display: inline-block;
        font-size: 0.66em;
        font-weight: 700;
        padding: 0.2em 0.5em;
        border-radius: 0.3em;
        color: #fff;
    }

        .auditDash .au-ext.html {
            background: #2b5c8a;
        }

        .auditDash .au-ext.fields {
            background: #6b3fa0;
        }

        .auditDash .au-ext.pdf {
            background: #b3261e;
        }

        .auditDash .au-ext.json {
            background: #5a7a9a;
        }

    /* Audit-state filter tabs */
    .auditDash .au-filter {
        display: flex;
        gap: 0.4em;
        align-items: center;
    }

    .auditDash .au-filter-tab {
        font: inherit;
        cursor: pointer;
        background: #fff;
        color: var(--au-muted);
        border: 1px solid var(--au-line);
        border-radius: 1em;
        padding: 0.3em 0.9em;
    }

        .auditDash .au-filter-tab.selected {
            background: var(--au-primary);
            border-color: var(--au-primary);
            color: #fff;
            font-weight: 600;
        }

    /* Data table */
    .auditDash table.au-data {
        width: 100%;
        border-collapse: collapse;
    }

        .auditDash table.au-data th {
            text-align: left;
            font-size: 0.75em;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--au-muted);
            padding: 0.6em 0.8em;
            border-bottom: 1px solid var(--au-line);
        }

        .auditDash table.au-data td {
            padding: 0.6em 0.8em;
            border-bottom: 1px solid var(--au-line);
            font-size: 0.9em;
        }

        .auditDash table.au-data tr:hover td {
            background: #f7f9fb;
        }

    .auditDash .au-filename-inner {
        display: flex;
        align-items: center;
        gap: 0.5em;
    }
    .auditDash .au-case {
        white-space:nowrap;
    }

    /* Stepper */
    .auditDash .au-stepper {
        display: flex;
        align-items: center;
        gap: 0.4em;
        flex-wrap: wrap;
        font-size: 0.82em;
        color: var(--au-muted);
    }

        .auditDash .au-stepper .step {
            display: inline-flex;
            align-items: center;
            gap: 0.35em;
        }

        .auditDash .au-stepper .dot {
            width: 1.5em;
            height: 1.5em;
            border-radius: 50%;
            background: #eef1f4;
            color: #48515b;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 0.8em;
            font-weight: 700;
        }

        .auditDash .au-stepper .step.done .dot {
            background: #2c7a37;
            color: #fff;
        }

        .auditDash .au-stepper .step.current .dot {
            background: var(--au-primary);
            color: #fff;
        }

        .auditDash .au-stepper .step.current {
            color: var(--au-ink);
            font-weight: 600;
        }

    /* Detail two-pane */
    .auditDash .au-detail {
        display: grid;
        grid-template-columns: minmax(0,1fr) 340px;
        gap: 1.25em;
        align-items: start;
    }

@media (max-width:1000px) {
    .auditDash .au-detail {
        grid-template-columns: 1fr;
    }
}

/* Rendered preview surface */
.auditDash .au-surface {
    background: #fff;
    border: 1px solid var(--au-line);
    border-radius: 0.4em;
    padding: 1.5em 1.75em;
    min-height: 300px;
    line-height: 1.5;
    color: #1f2933;
}

    .auditDash .au-surface[contenteditable="true"] {
        outline: 2px dashed #c79100;
        outline-offset: 4px;
        background: #fffdf5;
    }

    /* Field-swap mode: only the marked fields in the rendered letter are editable.
   The surface itself is locked; each data-field span is highlighted and the
   matching input lives in the side "Editable fields" panel. */
    .auditDash .au-surface.locked {
        outline: none;
        background: #fff;
    }

    .auditDash .au-surface [data-field] {
        background: #f3eefb;
        border-bottom: 1px dashed #9a7cc9;
        border-radius: 2px;
        padding: 0 1px;
        cursor: default;
        transition: background 0.15s;
    }

        .auditDash .au-surface [data-field].changed {
            background: #fff4d6;
            border-bottom-color: #c79100;
        }

        .auditDash .au-surface [data-field].focused {
            background: #e6dcfa;
            box-shadow: 0 0 0 2px #b9a3e0;
        }

        .auditDash .au-surface [data-field].empty::after {
            content: "(empty)";
            color: #aab2bb;
            font-style: italic;
        }

.auditDash .au-swap-list {
    display: flex;
    flex-direction: column;
    gap: 0.7em;
    max-height: 460px;
    overflow: auto;
}

.auditDash .au-swap-item {
    display: flex;
    flex-direction: column;
    gap: 0.2em;
}

    .auditDash .au-swap-item label {
        font-size: 0.72em;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--au-muted);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

        .auditDash .au-swap-item label .tag {
            display: none;
            font-size: 0.85em;
            text-transform: none;
            letter-spacing: 0;
            color: #8a5a05;
            font-weight: 700;
        }

    .auditDash .au-swap-item.changed label .tag {
        display: inline;
    }

    .auditDash .au-swap-item input {
        width: 100%;
        box-sizing: border-box;
        padding: 0.35em 0.5em;
        border: 1px solid var(--au-line);
        border-radius: 0.3em;
        font-size: 0.9em;
    }

    .auditDash .au-swap-item.changed input {
        border-color: #c79100;
        background: #fffdf5;
    }

.auditDash .au-swap-empty {
    font-size: 0.85em;
}

/* Field groups (JSON detail) */
.auditDash .au-fieldgroup {
    border: 1px solid var(--au-line);
    border-radius: 0.5em;
    margin-bottom: 1em;
    overflow: hidden;
}

    .auditDash .au-fieldgroup > header {
        background: #f5f7f9;
        padding: 0.5em 0.9em;
        font-weight: 600;
        font-size: 0.9em;
    }

.auditDash .au-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(240px,1fr));
}

.auditDash .au-f {
    display: flex;
    flex-direction: column;
    padding: 0.5em 0.9em;
    border-top: 1px solid var(--au-line);
}

    .auditDash .au-f .k {
        font-size: 0.72em;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--au-muted);
    }

    .auditDash .au-f .v {
        font-size: 0.92em;
        color: var(--au-ink);
        word-break: break-word;
    }

        .auditDash .au-f .v.empty {
            color: #aab2bb;
            font-style: italic;
        }

/* Reference field list (HTML editor side panel) */
.auditDash .au-field-list {
    display: flex;
    flex-direction: column;
    gap: 0.55em;
    max-height: 420px;
    overflow: auto;
}

    .auditDash .au-field-list .row {
        display: flex;
        flex-direction: column;
        gap: 0.15em;
    }

    .auditDash .au-field-list .k {
        font-size: 0.72em;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--au-muted);
    }

    .auditDash .au-field-list .v {
        font-size: 0.9em;
        color: var(--au-ink);
    }

/* Raw JSON */
.auditDash .au-raw {
    background: #1f2128;
    color: #e6e6e6;
    padding: 0.9em;
    border-radius: 0.4em;
    overflow: auto;
    font-size: 0.8em;
    max-height: 360px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Timeline / history */
.auditDash .au-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.8em;
}

.auditDash .au-entry {
    border-left: 2px solid var(--au-line);
    padding: 0 0 0 0.8em;
}

    .auditDash .au-entry .what {
        font-size: 0.9em;
        color: var(--au-ink);
    }

    .auditDash .au-entry .who {
        font-size: 0.78em;
        color: var(--au-muted);
    }

    .auditDash .au-entry.approved {
        border-left-color: #2c7a37;
    }

    .auditDash .au-entry.declined {
        border-left-color: #b3261e;
    }

/* PDF frame */
.auditDash .au-pdf {
    width: 100%;
    height: 75vh;
    border: 1px solid var(--au-line);
    border-radius: 0.4em;
}

/* Per-row "open PDF" icon in queue/history tables. */
.auditDash .au-pdf-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #b3261e;
    line-height: 0;
    padding: 0.15em;
    border-radius: 0.3em;
}

    .auditDash .au-pdf-icon:hover {
        color: #7f160f;
        background: #f6e3e1;
    }

/* Generic content tabs (e.g. the Letter-edit / PDF-preview toggle on HTML review views). */
.auditDash .au-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3em;
}

.auditDash .au-tab {
    font: inherit;
    font-size: 0.82em;
    cursor: pointer;
    background: #fff;
    color: var(--au-muted);
    border: 1px solid var(--au-line);
    border-radius: 0.4em;
    padding: 0.35em 0.85em;
}

    .auditDash .au-tab.selected {
        background: var(--au-primary);
        border-color: var(--au-primary);
        color: #fff;
        font-weight: 600;
    }

/* Only the selected tab's panel is shown; the rest stay in the DOM so their state
   (an initialized editor, a loaded PDF iframe) is preserved across switches. */
.auditDash .au-tabpanel {
    display: none;
}

    .auditDash .au-tabpanel.selected {
        display: block;
    }

/* Verification-of-coverage tabs (one per uploaded coverage set) */
.auditDash .au-voc-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3em;
    margin-bottom: 0.9em;
    border-bottom: 1px solid var(--au-line);
    padding-bottom: 0.5em;
}

.auditDash .au-voc-tab {
    font: inherit;
    font-size: 0.82em;
    cursor: pointer;
    background: #fff;
    color: var(--au-muted);
    border: 1px solid var(--au-line);
    border-radius: 0.4em 0.4em 0 0;
    padding: 0.35em 0.85em;
}

    .auditDash .au-voc-tab.selected {
        background: var(--au-primary);
        border-color: var(--au-primary);
        color: #fff;
        font-weight: 600;
    }

/* Only the selected coverage panel is shown; the rest stay in the DOM so all sets save together. */
.auditDash .au-voc-panel {
    display: none;
}

    .auditDash .au-voc-panel.selected {
        display: block;
    }

/* Misc */
.auditDash .au-notice {
    background: #fff7d6;
    border: 1px solid #ecd9a0;
    color: #7a5a12;
    padding: 0.7em 1em;
    border-radius: 0.4em;
    font-size: 0.9em;
    margin-bottom: 1em;
}

.auditDash .au-meta {
    display: flex;
    gap: 1.25em;
    flex-wrap: wrap;
    font-size: 0.85em;
    color: var(--au-muted);
    margin-top: 0.5em;
}

    .auditDash .au-meta strong {
        color: var(--au-ink);
    }
