/* Orchestrator Dashboard Styles */
.orchestrator-dashboard {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin: 20px 0;
}

.orch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.orch-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #1f2937;
}

.orch-controls {
    display: flex;
    gap: 10px;
}

.btn-control {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-control:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Overview Stats */
.orch-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.orch-stat-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
}

.orch-stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.orch-stat-value {
    font-size: 1.8rem;
    font-weight: 600;
    color: #1f2937;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-running {
    background: #d1fae5;
    color: #065f46;
}

.status-paused {
    background: #fef3c7;
    color: #92400e;
}

.status-ok {
    background: #d1fae5;
    color: #065f46;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Tabs */
.orch-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.orch-tab {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    color: #6b7280;
    transition: all 0.2s;
}

.orch-tab:hover {
    color: #1f2937;
    background: #f9fafb;
}

.orch-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.orch-tab-content {
    min-height: 300px;
}

/* Lists */
.orch-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.orch-empty {
    text-align: center;
    color: #9ca3af;
    padding: 40px;
    font-style: italic;
}

/* Job Cards */
.orch-job-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 15px;
    transition: box-shadow 0.2s;
}

.orch-job-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.orch-job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.orch-job-type {
    display: inline-block;
    padding: 3px 8px;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.orch-job-status {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.orch-status-queued {
    background: #e5e7eb;
    color: #374151;
}

.orch-status-processing {
    background: #dbeafe;
    color: #1e40af;
}

.orch-status-complete {
    background: #d1fae5;
    color: #065f46;
}

.orch-status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.orch-job-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 5px;
}

.orch-job-stage {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.orch-job-meta {
    display: flex;
    gap: 15px;
    color: #9ca3af;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.orch-job-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    padding: 8px;
    color: #991b1b;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.orch-job-actions {
    display: flex;
    gap: 8px;
}

/* Activity Items */
.orch-activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 0.9rem;
}

.orch-activity-status {
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 70px;
    text-align: center;
}

.orch-activity-stage {
    color: #6b7280;
    min-width: 120px;
}

.orch-activity-item-name {
    flex: 1;
    color: #1f2937;
}

.orch-activity-time {
    color: #9ca3af;
    font-size: 0.8rem;
}

.orch-activity-duration {
    color: #059669;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Cron Cards */
.orch-cron-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 15px;
}

.orch-cron-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.orch-cron-name {
    font-weight: 600;
    color: #1f2937;
}

.orch-cron-status {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.orch-cron-status.enabled {
    background: #d1fae5;
    color: #065f46;
}

.orch-cron-status.disabled {
    background: #e5e7eb;
    color: #6b7280;
}

.orch-cron-schedule {
    font-family: 'Courier New', monospace;
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.orch-cron-description {
    color: #9ca3af;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.orch-cron-meta {
    color: #6b7280;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.orch-cron-actions {
    display: flex;
    gap: 8px;
}

/* Small Button */
.btn-small {
    padding: 5px 12px;
    font-size: 0.8rem;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Responsive */
@media (max-width: 768px) {
    .orch-overview {
        grid-template-columns: repeat(2, 1fr);
    }

    .orch-job-meta {
        flex-direction: column;
        gap: 5px;
    }

    .orch-activity-item {
        flex-wrap: wrap;
    }
}

/* ============================================================
   Dark-mode overrides for orchestrator surfaces.
   orchestrator-styles.css ships with light-mode hardcoded values.
   These overrides flip the dashboard chrome to dark equivalents
   while preserving status badges (Running green, Failed red,
   Pending amber) and brand accents (the active blue) as semantic.
   ============================================================ */
[data-theme="dark"] .orchestrator-dashboard {
    background-color: #1e293b;
    color: #f1f5f9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .orch-header {
    border-bottom-color: #334155;
}

[data-theme="dark"] .orch-header h2,
[data-theme="dark"] .orch-section h3,
[data-theme="dark"] .orch-card-title,
[data-theme="dark"] .orch-stat-label {
    color: #f1f5f9;
}

[data-theme="dark"] .orch-stat-value,
[data-theme="dark"] .orch-stat,
[data-theme="dark"] .orch-card,
[data-theme="dark"] .orch-section {
    background-color: #0f172a;
    color: #f1f5f9;
    border-color: #334155;
}

[data-theme="dark"] .btn-control {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

[data-theme="dark"] .btn-control:hover {
    background-color: #243549;
    border-color: #475569;
}

[data-theme="dark"] .orch-tabs {
    border-bottom-color: #334155;
}

[data-theme="dark"] .orch-tab {
    color: #94a3b8;
}

[data-theme="dark"] .orch-tab:hover {
    color: #f1f5f9;
}

/* .orch-tab.active uses the brand blue (#2563eb) — semantic, preserved */

[data-theme="dark"] .orch-table {
    background-color: #1e293b;
    color: #f1f5f9;
}

[data-theme="dark"] .orch-table th {
    background-color: #0f172a;
    color: #94a3b8;
    border-color: #334155;
}

[data-theme="dark"] .orch-table td {
    border-color: #334155;
}

[data-theme="dark"] .orch-table tr:hover {
    background-color: #243549;
}

[data-theme="dark"] .orch-empty,
[data-theme="dark"] .orch-loading {
    color: #94a3b8;
}

[data-theme="dark"] .orch-activity-item {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

/* ============================================================
   Dark-mode overrides — corrected selectors for actual classes
   used by the orchestrator markup (.orch-stat-card, .orch-job-card,
   .orch-cron-card, .orch-overview, .orch-tab-content, .orch-list).
   ============================================================ */
[data-theme="dark"] .orch-overview,
[data-theme="dark"] .orch-list,
[data-theme="dark"] .orch-tab-content {
    background-color: transparent;
    color: #f1f5f9;
}

[data-theme="dark"] .orch-stat-card,
[data-theme="dark"] .orch-job-card,
[data-theme="dark"] .orch-cron-card {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

[data-theme="dark"] .orch-stat-card:hover,
[data-theme="dark"] .orch-job-card:hover,
[data-theme="dark"] .orch-cron-card:hover {
    background-color: #243549;
    border-color: #475569;
}

[data-theme="dark"] .orch-stat-label,
[data-theme="dark"] .orch-job-stage,
[data-theme="dark"] .orch-job-meta,
[data-theme="dark"] .orch-activity-stage,
[data-theme="dark"] .orch-activity-time,
[data-theme="dark"] .orch-activity-duration,
[data-theme="dark"] .orch-cron-status {
    color: #94a3b8;
}

[data-theme="dark"] .orch-stat-value,
[data-theme="dark"] .orch-job-name,
[data-theme="dark"] .orch-job-type,
[data-theme="dark"] .orch-cron-name,
[data-theme="dark"] .orch-job-header,
[data-theme="dark"] .orch-cron-header,
[data-theme="dark"] .orch-activity-item-name {
    color: #f1f5f9;
}

[data-theme="dark"] .orch-job-error {
    background-color: #1e293b;
    color: #fca5a5;
    border-color: #7f1d1d;
}

[data-theme="dark"] .orch-empty {
    color: #94a3b8;
    background-color: transparent;
}

/* Status pills (.status-running, .status-paused, .status-ok, .status-error,
   .orch-status-queued, .orch-status-processing, .orch-status-complete,
   .orch-status-failed) keep their semantic colors in both themes. */