/* ============================================================
   Scheduler — Job views
   ============================================================ */

/* ── Scheduler View ────────────────────────────────────────── */

.scheduler-view {
    padding: 20px 24px;
    overflow-y: auto;
    height: 100%;
}

.sched-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.sched-view-header h2 {
    margin: 0;
    font-size: var(--type-page-size);
}

/* ── Schedule picker ───────────────────────────────────────── */

.sched-picker {
    margin-bottom: 8px;
}

.sched-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.sched-preset {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: var(--fs-md);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sched-preset:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.sched-preset.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
}

.sched-custom-row {
    margin-bottom: 6px;
}

.sched-cron-input {
    width: 100%;
    font-family: var(--font-mono);
}

.sched-picker-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sched-preview {
    font-size: var(--fs-base);
    color: var(--text-secondary);
    min-height: 18px;
}

.sched-tz-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.sched-tz-input {
    width: 80px;
    font-size: var(--fs-md);
}

/* ── Job type toggle ───────────────────────────────────────── */

.job-type-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 3px;
    margin-bottom: 8px;
}

.job-type-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.job-type-btn:hover {
    color: var(--text-primary);
}

.job-type-btn.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(var(--black-rgb), 0.2);
}

.sched-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.sched-header h2 {
    margin: 0;
    font-size: var(--type-page-size);
}

.sched-actions {
    display: flex;
    gap: 6px;
}

.sched-desc {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin-bottom: 12px;
}

.sched-prompt {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    font-size: 0.8125rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
}

.sched-runs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    margin-top: 8px;
}

.sched-runs-table th,
.sched-runs-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.sched-runs-table th {
    font-size: var(--fs-base);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.sched-status {
    display: inline-block;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-base);
    font-weight: 600;
}

.status-ok      { color: var(--success); }
.status-err     { color: var(--error); }
.status-running { color: var(--accent); }

.run-session-link {
    color: var(--accent);
    font-size: var(--fs-md);
    margin-left: 6px;
}

.sched-runs-section,
.sched-prompt-section {
    margin-top: 16px;
}

.sched-runs-section h3,
.sched-prompt-section h3 {
    font-size: var(--fs-xl);
    margin-bottom: 8px;
}

.sched-dot {
    font-size: 0.625rem;
    margin-right: 4px;
}

.sched-cron {
    font-family: var(--font-mono);
}

/* ── Failing job indicators ────────────────────────────────────────────── */

/* A job that fires on schedule and fails every run looks healthy in the list:
   enabled, with a next fire time. These two make the failure visible without
   opening the run history. */
.sched-fail-badge {
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: var(--radius-lg);
    font-size: 0.625rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--error, var(--error));
    background: rgba(var(--fx-red-rgb), 0.14);
    border: 1px solid rgba(var(--fx-red-rgb), 0.3);
}

.sched-fail-banner {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--error, var(--error));
    background: rgba(var(--fx-red-rgb), 0.12);
    border: 1px solid rgba(var(--fx-red-rgb), 0.3);
}

.sched-fail-banner strong {
    display: block;
    margin-bottom: 2px;
}

.sched-fail-error {
    margin-top: 6px;
    overflow-x: auto;
}

.sched-fail-error code {
    font-size: 0.7188rem;
    color: var(--text-secondary);
    white-space: pre;
}

/* A run that failed because the agent's CLI is not signed in (#5471): the words, what to do, and a tag after the status in a table */
.run-failure-text { font-weight: 600; }
.run-failure-hint { color: var(--text-secondary); }
.run-failure-tag { color: var(--error); font-size: 0.8125rem; }
