* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-bg: #0a0e1a;
    --color-surface: #1a1f35;
    --color-surface-hover: #252b45;
    --color-text: #e4e7eb;
    --color-text-muted: #9ca3af;
    --color-border: #2d3548;

    --color-green: #10b981;
    --color-green-bg: #064e3b;
    --color-yellow: #f59e0b;
    --color-yellow-bg: #78350f;
    --color-red: #ef4444;
    --color-red-bg: #7f1d1d;

    --color-p0: #dc2626;
    --color-p1: #f97316;

    --spacing: 16px;
    --border-radius: 12px;
    --transition: all 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 40px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing);
}

/* Header */
.header {
    text-align: center;
    margin-bottom: calc(var(--spacing) * 2);
    padding: calc(var(--spacing) * 1.5);
    background: linear-gradient(135deg, #1e3a8a 0%, #06b6d4 100%);
    border-radius: var(--border-radius);
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
}

.last-updated {
    margin-top: 12px;
    font-size: 0.75rem;
    opacity: 0.8;
}

/* System Health */
.system-health {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    padding: calc(var(--spacing) * 1.5);
    margin-bottom: var(--spacing);
    text-align: center;
    border: 2px solid var(--color-border);
}

.health-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.health-badge.green {
    background: var(--color-green-bg);
    color: var(--color-green);
}

.health-badge.yellow {
    background: var(--color-yellow-bg);
    color: var(--color-yellow);
}

.health-badge.red {
    background: var(--color-red-bg);
    color: var(--color-red);
}

.status-icon {
    font-size: 1.25rem;
}

.health-score {
    margin-top: 12px;
}

.score-value {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, #06b6d4, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing);
    margin-bottom: var(--spacing);
}

.stat-card {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing);
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 8px;
}

/* Sections */
section {
    margin-bottom: calc(var(--spacing) * 1.5);
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--spacing);
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-count,
.agent-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--color-border);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Scheduler Controls */
.controls-section {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing);
    margin-bottom: var(--spacing);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.toggle-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.toggle-btn:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.toggle-btn.enabled {
    background: linear-gradient(135deg, #10b981, #059669);
}

.toggle-btn.enabled:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.run-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.run-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.scheduler-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 0.875rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-text-muted);
    animation: pulse 2s infinite;
}

.status-dot.enabled {
    background: var(--color-green);
}

.status-dot.disabled {
    background: var(--color-yellow);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Alerts */
.alerts-section {
    margin-bottom: calc(var(--spacing) * 2);
}

.alert-card {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    padding: var(--spacing);
    margin-bottom: 12px;
    border-left: 4px solid;
}

.alert-card.p0 {
    border-left-color: var(--color-p0);
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.1) 0%, var(--color-surface) 30%);
}

.alert-card.p1 {
    border-left-color: var(--color-p1);
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.1) 0%, var(--color-surface) 30%);
}

.alert-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.alert-priority {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
}

.alert-priority.p0 {
    background: var(--color-p0);
    color: white;
}

.alert-priority.p1 {
    background: var(--color-p1);
    color: white;
}

.alert-type {
    font-weight: 600;
    font-size: 0.875rem;
}

.alert-agent {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.alert-reason {
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.alert-action {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 8px;
}

.alert-action::before {
    content: "→ ";
}

.alert-time {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Agents */
.agents-list {
    display: grid;
    gap: 12px;
}

.agent-card {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing);
    transition: var(--transition);
}

.agent-card:hover {
    border-color: #3b82f6;
}

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

.agent-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.health-indicator {
    font-size: 1.5rem;
    line-height: 1;
}

.agent-name {
    font-size: 1rem;
    font-weight: 600;
}

.agent-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agent-status.active {
    background: var(--color-green-bg);
    color: var(--color-green);
}

.agent-status.idle {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
}

.agent-status.error {
    background: var(--color-red-bg);
    color: var(--color-red);
}

.agent-status.paused {
    background: var(--color-yellow-bg);
    color: var(--color-yellow);
}

.agent-type {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    text-transform: capitalize;
}

.agent-action {
    font-size: 0.875rem;
    color: var(--color-text);
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-style: italic;
}

.agent-metrics {
    display: flex;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    flex-wrap: wrap;
}

.metric {
    display: flex;
    align-items: center;
    gap: 4px;
}

.agent-health {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.health-score-value {
    font-weight: 700;
    font-size: 1rem;
}

/* Activity Log */
.activity-list {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    border: 2px solid var(--color-border);
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    gap: 12px;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.activity-content {
    flex: 1;
}

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

.activity-agent {
    font-weight: 600;
    font-size: 0.875rem;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.activity-action {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.activity-duration {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Responsive */
@media (min-width: 768px) {
    .quick-stats {
        grid-template-columns: repeat(4, 1fr);
    }

    .agents-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .agents-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--color-text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}