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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

header h1 {
    font-size: 2rem;
    color: #667eea;
}

.header-info {
    display: flex;
    gap: 20px;
    color: #666;
    font-size: 0.9rem;
}

.header-info .notification-status.active {
    color: #10b981;
}

.header-info .notification-status.blocked {
    color: #ef4444;
}

.keyboard-hint {
    font-size: 0.75rem;
    color: #999;
    font-weight: normal;
    margin-left: 10px;
}

/* Overview Cards */
.overview-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.overview-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
}

.overview-card:hover {
    transform: translateY(-5px);
}

.card-icon {
    font-size: 2.5rem;
}

.card-content h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.big-number {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

.status-indicator {
    font-size: 1.5rem;
    font-weight: bold;
}

.status-green {
    color: #10b981;
}

.status-yellow {
    color: #f59e0b;
}

.status-red {
    color: #ef4444;
}

/* Agents Grid */
.agents-section {
    margin-bottom: 30px;
}

.agents-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.agent-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #667eea;
    transition: all 0.2s;
}

.agent-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.agent-card.working {
    border-left-color: #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
}

.agent-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #333;
}

.agent-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.agent-status.idle {
    background: #dbeafe;
    color: #1e40af;
}

.agent-status.working {
    background: #dcfce7;
    color: #166534;
}

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

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

.agent-details {
    font-size: 0.85rem;
    color: #666;
    margin-top: 10px;
}

/* Performance Metrics Section */
.metrics-section {
    margin-bottom: 30px;
}

.metrics-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.metric-card {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.metric-card h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #333;
}

.metric-stats {
    display: flex;
    justify-content: space-between;
}

.metric-item {
    text-align: center;
}

.metric-value {
    display: block;
    font-size: 1.4rem;
    font-weight: bold;
    color: #667eea;
}

.metric-value.good {
    color: #10b981;
}

.metric-value.ok {
    color: #f59e0b;
}

.metric-value.bad {
    color: #ef4444;
}

.metric-label {
    font-size: 0.75rem;
    color: #666;
}

/* Two Column Layout */
.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .two-column {
        grid-template-columns: 1fr;
    }
}

/* Heartbeat Section */
.heartbeat-section, .cron-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
}

.heartbeat-section h2, .cron-section h2 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.3rem;
}

.heartbeat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e5e7eb;
}

.heartbeat-item .label {
    font-weight: 500;
    color: #666;
}

.heartbeat-item .value {
    color: #333;
    font-family: monospace;
}

.heartbeat-history {
    list-style: none;
    margin-top: 15px;
}

.heartbeat-history li {
    padding: 8px 12px;
    background: white;
    margin-bottom: 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
}

/* Cron Jobs */
.cron-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cron-job {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.cron-job h4 {
    margin-bottom: 8px;
    color: #333;
}

.cron-details {
    font-size: 0.85rem;
    color: #666;
    display: grid;
    gap: 5px;
}

.cron-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.cron-status.success {
    background: #dcfce7;
    color: #166534;
}

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

/* Handoffs Section */
.handoffs-section {
    margin-bottom: 30px;
}

.handoffs-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.handoffs-container {
    display: grid;
    gap: 20px;
}

.handoff-card {
    background: #fef3c7;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #f59e0b;
}

.handoff-card h3 {
    margin-bottom: 15px;
    color: #92400e;
}

.handoff-task {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.handoff-task h4 {
    color: #333;
    margin-bottom: 8px;
}

.handoff-task p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.handoff-meta {
    display: flex;
    gap: 15px;
    font-size: 0.8rem;
    color: #888;
}

.priority-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.priority-badge.high {
    background: #fee2e2;
    color: #991b1b;
}

.priority-badge.medium {
    background: #fef3c7;
    color: #92400e;
}

.priority-badge.low {
    background: #dbeafe;
    color: #1e40af;
}

/* Logs Section */
.logs-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.logs-container {
    max-height: 400px;
    overflow-y: auto;
    background: #1e293b;
    border-radius: 12px;
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.log-entry {
    padding: 10px;
    border-bottom: 1px solid #334155;
    color: #e2e8f0;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-timestamp {
    color: #94a3b8;
    margin-right: 10px;
}

.log-agent {
    color: #60a5fa;
    font-weight: bold;
    margin-right: 10px;
}

.log-action {
    color: #34d399;
    margin-right: 10px;
}

.log-details {
    color: #fbbf24;
}

.log-entry.spawn-event {
    background: #0f172a;
    border-left: 3px solid #10b981;
}

.log-entry.spawn-event .log-action {
    color: #10b981;
}

/* Quick Actions Section */
.quick-actions-section {
    margin-bottom: 30px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #0ea5e9;
}

.quick-actions-section h2 {
    margin-bottom: 5px;
    color: #0c4a6e;
}

.section-desc {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.spawn-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.spawn-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.spawn-input-group label {
    font-weight: 500;
    color: #334155;
}

.spawn-input-group input {
    padding: 12px 16px;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s;
}

.spawn-input-group input:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.spawn-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.spawn-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
    position: relative;
}

.spawn-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.spawn-btn:active:not(:disabled) {
    transform: translateY(0);
}

.spawn-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spawn-btn .btn-icon {
    font-size: 1.2rem;
}

.spawn-btn .btn-key {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.7rem;
    background: rgba(0,0,0,0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

.spawn-content {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
    color: white;
}

.spawn-content:hover:not(:disabled) {
    background: linear-gradient(135deg, #db2777 0%, #9d174d 100%);
}

.spawn-dev {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
}

.spawn-dev:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
}

.spawn-research {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
}

.spawn-research:hover:not(:disabled) {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
}

.spawn-ops {
    background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);
    color: white;
}

.spawn-ops:hover:not(:disabled) {
    background: linear-gradient(135deg, #ea580c 0%, #9a3412 100%);
}

.spawn-analytics {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    color: white;
}

.spawn-analytics:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669 0%, #065f46 100%);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 300px;
    max-width: 400px;
    padding: 15px 20px;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.toast-exit {
    animation: slideOut 0.3s ease forwards;
}

.toast-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.toast-error {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
}

.toast-info {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.85rem;
    opacity: 0.9;
}

.toast-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
    padding: 5px;
}

.toast-close:hover {
    opacity: 1;
}

/* Loading spinner */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

/* =====================================================
   PHASE 3: TASK QUEUE STYLES
   ===================================================== */

.task-queue-section {
    margin-bottom: 30px;
}

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

.section-header h2 {
    margin: 0;
    color: #333;
}

.btn-add-task {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-task:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.task-queue-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin-top: 15px;
}

@media (max-width: 1200px) {
    .task-queue-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .task-queue-container {
        grid-template-columns: 1fr;
    }
}

.task-column {
    background: #f8fafc;
    border-radius: 12px;
    padding: 15px;
    min-height: 200px;
}

.task-column h3 {
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

.task-list {
    min-height: 150px;
    transition: all 0.2s;
}

.task-list.drag-over {
    background: #e0f2fe;
    border-radius: 8px;
}

.empty-tasks {
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
    padding: 20px;
}

.task-card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: grab;
    transition: all 0.2s;
    border-left: 3px solid #667eea;
}

.task-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.task-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.task-card.priority-high {
    border-left-color: #ef4444;
}

.task-card.priority-medium {
    border-left-color: #f59e0b;
}

.task-card.priority-low {
    border-left-color: #10b981;
}

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

.task-priority {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.task-priority.high {
    background: #fee2e2;
    color: #991b1b;
}

.task-priority.medium {
    background: #fef3c7;
    color: #92400e;
}

.task-priority.low {
    background: #dcfce7;
    color: #166534;
}

.task-actions {
    display: flex;
    gap: 5px;
}

.task-btn {
    background: none;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.task-btn.complete {
    color: #10b981;
}

.task-btn.complete:hover {
    background: #dcfce7;
}

.task-btn.delete {
    color: #ef4444;
}

.task-btn.delete:hover {
    background: #fee2e2;
}

.task-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: #1e293b;
    margin-bottom: 4px;
}

.task-desc {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* =====================================================
   PHASE 3: MODAL STYLES
   ===================================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    font-size: 1.25rem;
    color: #1e293b;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 5px;
}

.modal-close:hover {
    color: #1e293b;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e2e8f0;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #475569;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

/* Help Modal Shortcuts List */
.shortcuts-list h3 {
    font-size: 0.9rem;
    color: #667eea;
    margin: 15px 0 10px;
}

.shortcuts-list h3:first-child {
    margin-top: 0;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 0;
    font-size: 0.9rem;
}

.shortcut-item kbd {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.85rem;
    font-family: monospace;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    min-width: 35px;
    text-align: center;
    color: #1e293b;
    box-shadow: 0 2px 0 #cbd5e1;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-info {
        flex-direction: column;
        gap: 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .container {
        padding: 20px;
    }
    
    .task-queue-container {
        grid-template-columns: 1fr;
    }
}
