/* Quick approvals: one table of the suggestions waiting for the signed-in person. */
.ci-saa {
    --saa-ink: #18302b;
    --saa-muted: #5e706b;
    --saa-line: #c9d8d3;
    --saa-accent: #0b6b57;
    --saa-danger: #8a2e27;
    display: block;
    box-sizing: border-box;
    margin: 0 0 14px;
    padding: 14px;
    border: 1px solid var(--saa-line);
    border-radius: 8px;
    background: #fff;
    color: var(--saa-ink);
    font: 13px/1.4 Arial, Helvetica, sans-serif;
}
.ci-saa[hidden] { display: none !important; }
.ci-saa *, .ci-saa *::before, .ci-saa *::after { box-sizing: border-box; }
.ci-saa-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px; }
.ci-saa-heading-title { margin: 0; font-size: 19px; }
.ci-saa-summary { margin: 3px 0 0; color: var(--saa-muted); }
.ci-saa-header-controls, .ci-saa-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ci-saa-toolbar { margin-top: 12px; }
.ci-saa-filter { display: inline-flex; align-items: center; gap: 5px; color: var(--saa-muted); font-weight: 700; }
.ci-saa-filter[hidden] { display: none; }
.ci-saa-filter select { max-width: 340px; min-height: 30px; font: inherit; color: var(--saa-ink); }
.ci-saa-button {
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid var(--saa-line);
    border-radius: 5px;
    background: #fff;
    color: var(--saa-ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.ci-saa-button:hover { background: #edf3f0; }
.ci-saa-button:focus-visible, .ci-saa a:focus-visible, .ci-saa summary:focus-visible { outline: 2px solid var(--saa-accent); outline-offset: 2px; }
.ci-saa-button.is-primary { border-color: var(--saa-accent); background: var(--saa-accent); color: #fff; }
.ci-saa-button.is-danger { border-color: #cfa8a4; color: var(--saa-danger); }
.ci-saa-button[disabled] { cursor: not-allowed; opacity: .55; }
.ci-saa-approve-selected { margin-left: auto; }
.ci-saa-status { min-height: 18px; margin: 8px 0 0; color: var(--saa-muted); font-weight: 700; }
.ci-saa-status.is-error, .ci-saa-error { color: var(--saa-danger); }
.ci-saa-table-wrap { margin-top: 6px; overflow-x: auto; }
.ci-saa-table { width: 100%; border-collapse: collapse; }
.ci-saa-table th {
    padding: 6px 8px;
    border-bottom: 2px solid var(--saa-line);
    color: var(--saa-muted);
    font-size: 12px;
    text-align: left;
    white-space: nowrap;
}
.ci-saa-table td { padding: 7px 8px; border-bottom: 1px solid #e3ebe8; vertical-align: top; }
.ci-saa-table tr[hidden] { display: none; }
.ci-saa-select { width: 28px; }
.ci-saa-select input { width: 16px; height: 16px; margin: 2px 0 0; }
.ci-saa-ticket { min-width: 120px; }
.ci-saa-ref { font-weight: 700; color: var(--saa-accent); }
.ci-saa-customer { display: block; color: var(--saa-muted); font-size: 12px; }
.ci-saa-suggestion { min-width: 240px; }
.ci-saa-details summary { cursor: pointer; font-weight: 700; }
.ci-saa-details-body { margin-top: 6px; }
.ci-saa-intent { margin: 0 0 6px; color: var(--saa-muted); }
.ci-saa-fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 10px; margin: 0 0 6px; }
.ci-saa-fields dt { color: var(--saa-muted); font-weight: 700; }
.ci-saa-fields dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ci-saa-label { margin-top: 6px; color: var(--saa-muted); font-weight: 700; }
.ci-saa-draft { white-space: pre-wrap; overflow-wrap: anywhere; }
.ci-saa-type-cell, .ci-saa-age { white-space: nowrap; }
.ci-saa-risk { white-space: nowrap; font-weight: 700; }
.risk-high .ci-saa-risk, .risk-unknown .ci-saa-risk { color: var(--saa-danger); }
.ci-saa-decision { white-space: nowrap; }
.ci-saa-decision .ci-saa-button { margin: 0 4px 4px 0; }
.ci-saa-on-ticket { display: inline-block; margin: 0 6px 4px 0; }
.ci-saa-error { margin-top: 4px; max-width: 280px; white-space: normal; font-weight: 700; }
.ci-saa-outcome { font-weight: 700; }
.ci-saa-row.is-busy { opacity: .6; }
.ci-saa-row.is-done { background: #f6f8f7; }
.ci-saa-row.is-approved .ci-saa-outcome { color: var(--saa-accent); }
.ci-saa-editor td { background: #f8faf9; }
.ci-saa-editor label { display: block; margin: 0 0 6px; font-weight: 600; }
.ci-saa-editor textarea { display: block; width: 100%; max-width: 640px; margin-top: 3px; font: inherit; }
.ci-saa-editor .ci-saa-button { margin-right: 6px; }
.ci-saa-empty { margin: 12px 0 0; padding: 14px; border: 1px dashed var(--saa-line); border-radius: 6px; color: var(--saa-muted); text-align: center; }
.ci-saa-empty[hidden] { display: none; }
.ci-saa-foot { margin: 10px 0 0; color: var(--saa-muted); font-size: 12px; }

/* Inside the Agent Backlog Dashboard tab the list replaces the older view, which stays one click away. */
.ciAgentBacklog.ci-saa-ready:not(.ci-saa-show-old) > :not(.ci-saa) { display: none !important; }

/* Standalone page. */
body.ci-saa-standalone { margin: 0; padding: 16px; background: #f3f6f5; }
body.ci-saa-standalone .ci-saa { max-width: 1400px; margin: 0 auto; }

@media (max-width: 700px) {
    body.ci-saa-standalone { padding: 8px; }
    .ci-saa { padding: 10px; }
    .ci-saa-approve-selected { margin-left: 0; }
    .ci-saa-filter { display: flex; width: 100%; }
    .ci-saa-filter select { flex: 1 1 auto; min-width: 0; max-width: none; }
}

/* Current worker activity is separate from decisions and includes tickets with no proposal yet. */
.ci-saa-work { margin: 8px 0 14px; padding: 10px 12px; border: 1px solid var(--saa-line); border-radius: 6px; background: #f4f9f7; }
.ci-saa-work-heading { margin: 0; font-size: 14px; }
.ci-saa-work-summary { margin: 3px 0 0; color: var(--saa-muted); }
.ci-saa-work-list { display: flex; flex-wrap: wrap; gap: 7px 18px; margin: 8px 0 0; padding: 0; list-style: none; }
.ci-saa-work-list:empty { display: none; }
.ci-saa-work-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ci-saa-work-customer, .ci-saa-work-age { color: var(--saa-muted); font-size: 12px; }
.ci-saa-working-badge { display: inline-block; margin-top: 3px; padding: 2px 6px; border-radius: 10px; background: #dceee6; color: #145d43; font-size: 11px; font-weight: 700; white-space: nowrap; }
.ci-saa-ticket > .ci-saa-working-badge { display: block; width: fit-content; }
