/* Agent Orchestrator page — form, streaming timeline, results */

/* Info box paragraph spacing — ensure the two lines have visible
   breathing room when the box contains multiple <p> blocks. */
.rec-info-box p { margin: 0; }
.rec-info-box p + p { margin-top: 0.6rem; }

/* Preset pill — appears when the page is loaded with ?client=<id>.
   Sits on the dark navy form background in both themes, so the text
   stays white for readable contrast regardless of the page theme. */
.agent-preset-pill {
    padding: 0.5rem 0.75rem;
    margin: 0 0 0.75rem;
    background: rgba(206, 186, 76, 0.18);
    border: 1px solid rgba(206, 186, 76, 0.55);
    border-radius: 0.3rem;
    font-size: 0.9rem;
    color: #FFFFFF;
    font-weight: 500;
    text-align: center;
}
.agent-preset-pill strong { color: #FFFFFF; font-weight: 700; }
.agent-preset-pill a { color: #CEBA4C; text-decoration: underline; }
.agent-preset-pill a:hover { color: #E6D06B; }


/* Side-by-side dropzones for bank + CC statements. */
.agent-dropzones {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.agent-dropzones .dropzone {
    flex: 1 1 16rem;
    min-width: 14rem;
    padding: 1rem;
    min-height: 5rem;
}
.agent-dropzones .dropzone p {
    margin: 0.2rem 0;
    font-size: 0.9rem;
}
.agent-dropzones .dropzone-hint {
    font-size: 0.78rem;
    color: rgba(242, 242, 242, 0.6);
}
.agent-dropzones-note {
    font-size: 0.85rem;
    color: #CEBA4C;
    margin: 0.75rem 0 0.25rem;
    line-height: 1.5;
}
.agent-dropzones-note kbd {
    padding: 0.1rem 0.35rem;
    background: rgba(206, 186, 76, 0.2);
    border: 1px solid rgba(206, 186, 76, 0.5);
    border-radius: 0.2rem;
    font-family: inherit;
    font-size: 0.78rem;
    color: #CEBA4C;
    font-weight: 600;
}
/* On gold theme we keep the text gold — bolder weight + text-shadow
   for readability against the gold gradient background. */
body.theme-gold .agent-dropzones-note {
    color: #CEBA4C;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
body.theme-gold .agent-dropzones-note kbd {
    background: rgba(0, 0, 0, 0.15);
    border-color: #CEBA4C;
    color: #CEBA4C;
}
body.theme-gold .agent-dropzones .dropzone-hint { color: rgba(13, 40, 73, 0.65); }

.file-list {
    background: rgba(13, 40, 73, 0.4);
    border: 1px solid rgba(206, 186, 76, 0.2);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-size: 0.88rem;
    color: rgba(242, 242, 242, 0.92);
}
.file-list .file-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
}
.file-list .file-row + .file-row { border-top: 1px solid rgba(255, 255, 255, 0.05); }
.file-list .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .file-size { color: rgba(242, 242, 242, 0.55); margin-left: 1rem; font-size: 0.8rem; }
.file-list .file-remove {
    background: none; border: none; color: rgba(242, 242, 242, 0.6);
    cursor: pointer; font-size: 1.2rem; padding: 0 0.5rem;
}
.file-list .file-remove:hover { color: #CEBA4C; }

/* Form grid */
.agent-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1.25rem 0;
}
.agent-field label {
    display: block;
    color: #CEBA4C;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    font-weight: 500;
}
.agent-field input[type="text"],
.agent-field input[type="number"],
.agent-field input[type="date"],
.agent-field select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: rgba(13, 40, 73, 0.6);
    border: 1px solid rgba(206, 186, 76, 0.3);
    border-radius: 4px;
    color: #F2F2F2;
    font-size: 0.9rem;
    font-family: inherit;
    box-sizing: border-box;
}
.agent-field-toggle {
    grid-column: 1 / -1;
    padding: 0.5rem 0;
}
.agent-field-toggle label {
    color: rgba(242, 242, 242, 0.92);
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Collapsible section groups (HTML <details>/<summary>) — used to tuck
   away optional uploads + labeling rules so the first-time form isn't a
   wall of inputs. */
.agent-group {
    margin-top: 1.25rem;
    border: 1px solid rgba(206, 186, 76, 0.2);
    border-radius: 6px;
    background: rgba(13, 40, 73, 0.3);
    overflow: hidden;
}
.agent-group > summary {
    list-style: none;  /* hide default marker in modern browsers */
    cursor: pointer;
    padding: 0.85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    color: #CEBA4C;
    font-weight: 600;
    font-size: 0.95rem;
    user-select: none;
    transition: background 0.15s ease;
}
.agent-group > summary::-webkit-details-marker { display: none; }
.agent-group > summary::after {
    content: "\25BC";  /* ▼ */
    font-size: 0.7rem;
    color: rgba(206, 186, 76, 0.7);
    transition: transform 0.2s ease;
    margin-left: auto;
}
.agent-group[open] > summary::after { transform: rotate(180deg); }
.agent-group > summary:hover {
    background: rgba(206, 186, 76, 0.08);
}
.agent-group-title {
    color: #CEBA4C;
}
.agent-group-sub {
    color: rgba(242, 242, 242, 0.55);
    font-size: 0.78rem;
    font-weight: normal;
    letter-spacing: 0.02em;
    margin-left: 0.5rem;
}
.agent-group-body {
    padding: 0.25rem 1rem 1rem;
    border-top: 1px solid rgba(206, 186, 76, 0.12);
}
/* Kill the top margin on the first child inside the collapsible so the
   open state doesn't double-pad. */
.agent-group-body > *:first-child {
    margin-top: 0.75rem;
}

/* Optional extra uploads (PY file, check images) */
.agent-extra-upload {
    margin-top: 1.25rem;
    padding: 1rem;
    background: rgba(13, 40, 73, 0.3);
    border: 1px solid rgba(206, 186, 76, 0.15);
    border-radius: 6px;
}
.agent-extra-title {
    margin: 0 0 0.25rem;
    color: #CEBA4C;
    font-size: 0.95rem;
    font-weight: 600;
}
.agent-optional {
    font-size: 0.7rem;
    color: rgba(242, 242, 242, 0.55);
    font-weight: normal;
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.agent-extra-hint {
    font-size: 0.82rem;
    color: rgba(242, 242, 242, 0.65);
    margin: 0.3rem 0 0.75rem;
    line-height: 1.4;
}
.dropzone-compact {
    padding: 1rem;
    min-height: 80px;
}
.dropzone-compact .dropzone-content p {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(242, 242, 242, 0.75);
}

/* Streaming timeline */
.agent-stream {
    padding: 1.25rem 0;
}
.agent-stream-title {
    font-size: 1.1rem;
    color: #CEBA4C;
    margin: 0 0 0.5rem;
}
.agent-stream-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.25rem;
}
.agent-stream-title-row .agent-stream-title {
    margin-bottom: 0;
}
.btn-cancel {
    padding: 0.4rem 0.9rem;
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.5);
    border-radius: 4px;
    color: #E74C3C;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}
.btn-cancel:hover:not(:disabled) {
    background: rgba(231, 76, 60, 0.25);
}
.btn-cancel:disabled {
    opacity: 0.5;
    cursor: wait;
}
body.theme-gold .btn-cancel {
    color: #c0392b;
    background: rgba(192, 57, 43, 0.12);
    border-color: rgba(192, 57, 43, 0.5);
}
body.theme-gold .btn-cancel:hover:not(:disabled) {
    background: rgba(192, 57, 43, 0.2);
}
.agent-stream-sub {
    font-size: 0.85rem;
    color: rgba(242, 242, 242, 0.65);
    margin-bottom: 1rem;
}
.agent-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 2px solid rgba(206, 186, 76, 0.25);
}
.agent-timeline li {
    position: relative;
    padding: 0.75rem 0 0.75rem 1.5rem;
    margin-left: 0.5rem;
}
.agent-timeline li::before {
    content: "";
    position: absolute;
    left: -0.5rem;
    top: 1rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: rgba(206, 186, 76, 0.25);
    border: 2px solid rgba(206, 186, 76, 0.6);
}
.agent-timeline li.step-running::before {
    background: #CEBA4C;
    animation: agent-pulse 1.2s infinite;
}
.agent-timeline li.step-complete::before {
    background: #4CAF50;
    border-color: #4CAF50;
}
.agent-timeline li.step-failed::before {
    background: #E74C3C;
    border-color: #E74C3C;
}
@keyframes agent-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(206, 186, 76, 0.7); }
    50% { box-shadow: 0 0 0 6px rgba(206, 186, 76, 0); }
}
.agent-timeline .step-label {
    font-weight: 600;
    color: #F2F2F2;
}
.agent-timeline .step-detail {
    display: block;
    color: rgba(242, 242, 242, 0.65);
    font-size: 0.8rem;
    margin-top: 0.2rem;
}
.agent-timeline li.step-complete .step-label,
.agent-timeline li.step-failed .step-detail { color: rgba(242, 242, 242, 0.9); }

/* Results */
.agent-results { padding: 1.25rem 0; }
.agent-results-header {
    font-size: 1rem;
    color: #CEBA4C;
    margin-bottom: 1rem;
}
.agent-downloads-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0 0.5rem;
    flex-wrap: wrap;
}
.agent-downloads-title {
    font-size: 0.95rem;
    color: #CEBA4C;
    margin: 0;
}
.agent-download-all {
    padding: 0.4rem 0.9rem !important;
    font-size: 0.82rem !important;
}
.agent-download-all:disabled {
    opacity: 0.5;
    cursor: wait;
}
.agent-downloads {
    list-style: none;
    margin: 0;
    padding: 0;
}
.agent-downloads li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: rgba(13, 40, 73, 0.4);
    border: 1px solid rgba(206, 186, 76, 0.2);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}
.agent-downloads .step-name {
    color: rgba(242, 242, 242, 0.92);
    font-size: 0.9rem;
}
.agent-downloads a {
    color: #CEBA4C;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid #CEBA4C;
    border-radius: 3px;
}
.agent-downloads a:hover {
    background: rgba(206, 186, 76, 0.15);
}

/* ===== Gold theme (Whale VIP) — gold headings + white body text =====
   Matches the labeler's gold palette: gold accents for titles/labels,
   near-white text for body content, translucent gold card backgrounds. */
body.theme-gold .agent-stream-title,
body.theme-gold .agent-results-header,
body.theme-gold .agent-downloads-title,
body.theme-gold .agent-group-title,
body.theme-gold .agent-extra-title {
    color: #CEBA4C;
}
body.theme-gold .agent-stream-sub,
body.theme-gold .agent-extra-hint,
body.theme-gold .agent-group-sub {
    color: rgba(242, 242, 242, 0.85);
}
body.theme-gold .agent-timeline {
    border-left-color: rgba(206, 186, 76, 0.4);
}
body.theme-gold .agent-timeline .step-label,
body.theme-gold .agent-timeline li.step-complete .step-label {
    color: #f2f2f2;
}
body.theme-gold .agent-timeline .step-detail,
body.theme-gold .agent-timeline li.step-failed .step-detail {
    color: rgba(242, 242, 242, 0.8);
}
body.theme-gold .agent-timeline li::before {
    background: rgba(206, 186, 76, 0.3);
    border-color: rgba(206, 186, 76, 0.7);
}
body.theme-gold .agent-timeline li.step-running::before {
    background: #CEBA4C;
}
body.theme-gold .agent-downloads li {
    background: rgba(13, 40, 73, 0.28);
    border-color: rgba(206, 186, 76, 0.4);
}
body.theme-gold .agent-downloads .step-name {
    color: #f2f2f2;
}
body.theme-gold .agent-downloads a {
    color: #CEBA4C;
    border-color: #CEBA4C;
}
body.theme-gold .agent-downloads a:hover {
    background: rgba(206, 186, 76, 0.2);
}
body.theme-gold .agent-group {
    background: rgba(206, 186, 76, 0.08);
    border-color: rgba(206, 186, 76, 0.3);
}
body.theme-gold .agent-group > summary {
    color: #CEBA4C;
}
body.theme-gold .agent-group > summary::after {
    color: rgba(206, 186, 76, 0.7);
}
body.theme-gold .agent-group > summary:hover {
    background: rgba(206, 186, 76, 0.12);
}
body.theme-gold .agent-group-body {
    border-top-color: rgba(206, 186, 76, 0.2);
}
body.theme-gold .agent-extra-upload {
    background: rgba(206, 186, 76, 0.08);
    border-color: rgba(206, 186, 76, 0.3);
}
body.theme-gold .agent-field label {
    color: #CEBA4C;
}
body.theme-gold .agent-field input[type="text"],
body.theme-gold .agent-field input[type="number"],
body.theme-gold .agent-field input[type="date"],
body.theme-gold .agent-field select {
    background: rgba(206, 186, 76, 0.15);
    border-color: rgba(206, 186, 76, 0.4);
    color: #f2f2f2;
}

/* Invert the native date-picker calendar icon so it reads against the
   dark navy input background (default browser icon is light gray and
   gets lost). Gold theme: leave default, it reads fine on gold. */
.agent-field input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.75) sepia(0.8) saturate(2) hue-rotate(10deg);
    opacity: 0.85;
    cursor: pointer;
}
.agent-field input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}
body.theme-gold .agent-field input[type="date"]::-webkit-calendar-picker-indicator {
    filter: none;
}

/* Raw threshold inputs inside Preset rules (not wrapped in agent-field) —
   match the chip styling so they visually belong to the group. */
.agent-group-body input[type="number"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: rgba(13, 40, 73, 0.6);
    border: 1px solid rgba(206, 186, 76, 0.3);
    border-radius: 4px;
    color: #F2F2F2;
    font-size: 0.9rem;
    font-family: inherit;
    box-sizing: border-box;
}
body.theme-gold .agent-group-body input[type="number"] {
    background: rgba(206, 186, 76, 0.15);
    border-color: rgba(13, 40, 73, 0.3);
    color: #0D2849;
}

/* Checkbox-with-label rows inside Advanced options get proper spacing
   + themed accent color. Consent-label is borrowed from the consent
   block but works here too. */
.agent-group-body .consent-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #F2F2F2;
    cursor: pointer;
    font-size: 0.88rem;
    line-height: 1.4;
}
.agent-group-body .consent-label input[type="checkbox"] {
    accent-color: #CEBA4C;
    flex-shrink: 0;
}
body.theme-gold .agent-group-body .consent-label {
    color: #ffffff;
}
/* Force all option-group paragraph hints to white in gold theme so
   they stay legible on the gold panel background. Scoped to agent
   page only via .agent-group-body so /labeler and /tis aren't affected. */
body.theme-gold .agent-group-body .vendor-hint,
body.theme-gold .agent-group-body .vendor-hint-text,
body.theme-gold .agent-group-body .agent-extra-hint {
    color: #ffffff;
}
body.theme-gold .agent-group-body .consent-label input[type="checkbox"] {
    accent-color: #0D2849;
}

/* Tighten the gap between sub-sections inside advanced options so they
   don't feel like disconnected floating cards. */
#advancedGroup .agent-group-body .agent-extra-upload + .agent-extra-upload {
    margin-top: 0.75rem;
}
#advancedGroup .agent-extra-title {
    margin-bottom: 0.4rem;
}
body.theme-gold .agent-field-toggle label {
    color: #f2f2f2;
}
body.theme-gold .file-list {
    background: rgba(206, 186, 76, 0.08);
    border-color: rgba(206, 186, 76, 0.3);
    color: #f2f2f2;
}
body.theme-gold .file-list .file-size {
    color: rgba(242, 242, 242, 0.6);
}
/* Heads-Up warnings panel on the results page (uses rec-action-* classes from reconcile.ts output) */
body.theme-gold .rec-action-title {
    color: #CEBA4C;
}
body.theme-gold .rec-action-items,
body.theme-gold .rec-action-items li,
body.theme-gold .rec-action-list li {
    color: #f2f2f2;
}
/* "One shot, five tools" info box — same gold/white treatment */
body.theme-gold .rec-info-box {
    color: #f2f2f2;
}
body.theme-gold .rec-info-box strong {
    color: #f2f2f2;
    font-style: italic;
}
