/* Signal-Foundry Dashboard Styles */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --border: #334155;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-green: #22c55e;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header h1 {
    font-size: 2.5rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Task Cards */
.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.task-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient);
}

.task-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
.task-card-link:hover .task-card {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.25);
    border-color: var(--accent-blue);
}
.task-card-link:hover { color: inherit; }

.task-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.15);
}

.task-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.task-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.card-bullets {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0.5rem 0 1rem 0;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-left: 2px solid var(--accent-blue);
    border-radius: 4px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
}

.quick-actions {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
}

.action-link {
    display: inline-block;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    padding: 0.5rem 0.85rem;
    margin: 0.25rem 0.5rem 0.25rem 0;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background 0.2s, border-color 0.2s;
}
.action-link:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

/* Quick Launchpad — rich mini-cards */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0.75rem;
}
.quick-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.quick-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.55);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.12);
    color: inherit;
}
.quick-icon {
    font-size: 1.35rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 0.1rem;
}
.quick-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.quick-body strong {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}
.quick-desc {
    font-size: 0.77rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.trace-info {
    display: inline-flex;
    gap: 0.75rem;
    margin-left: 1rem;
    align-items: center;
}

.trace-id-pill {
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    color: var(--text-secondary);
}

.trace-link {
    font-size: 0.8rem;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 999px;
    padding: 0.15rem 0.65rem;
    color: var(--accent-purple);
    text-decoration: none;
}
.trace-link:hover {
    background: rgba(139, 92, 246, 0.22);
    color: #c4b5fd;
}

/* Copy-trace-id micro-interaction */
.trace-id-pill {
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.trace-id-pill:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}
.trace-id-pill.copied {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
    border-color: var(--accent-green);
}

/* Smooth scroll to results when run completes */
html {
    scroll-behavior: smooth;
}

/* Loading dots animation while running */
.status-text-running::after {
    content: '';
    display: inline-block;
    width: 1em;
    text-align: left;
    animation: ellipsis 1.5s infinite;
}
@keyframes ellipsis {
    0% { content: ''; }
    33% { content: '.'; }
    66% { content: '..'; }
    100% { content: '...'; }
}

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}
.hero-stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.45rem 0.95rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: transform 0.2s;
}
.hero-stat strong {
    color: var(--accent-blue);
    font-weight: 700;
    margin-right: 0.3rem;
}
.hero-stat:hover {
    transform: translateY(-1px);
    border-color: var(--accent-blue);
}

/* Live SSE progress trace (Task 2) */
.live-trace {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-top: 1rem;
}
.live-trace h4 {
    margin: 0 0 0.5rem 0;
    color: var(--accent-blue);
    font-size: 0.95rem;
}
.live-events {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.65;
}
.live-event {
    padding: 0.1rem 0;
    color: var(--text-secondary);
    border-bottom: 1px dotted rgba(255, 255, 255, 0.04);
    word-break: break-word;
}
.live-event-step_done { color: var(--text-primary); }
.live-event-agent_complete {
    color: var(--accent-green);
    font-weight: 600;
    background: rgba(34, 197, 94, 0.08);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}
.live-event-error {
    color: var(--accent-red);
    font-weight: 600;
}

/* LLM error banner */
.error-banner {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-top: 1rem;
    color: #fecaca;
}
.error-banner strong { display: block; color: #fff; margin-bottom: 0.35rem; font-size: 0.95rem; }
.error-banner .hint { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 0.4rem; }
.error-banner details { margin-top: 0.5rem; font-size: 0.78rem; }
.error-banner pre {
    background: rgba(0, 0, 0, 0.35);
    padding: 0.5rem;
    border-radius: 4px;
    overflow-x: auto;
    color: var(--text-secondary);
    font-size: 0.75rem;
    white-space: pre-wrap;
}
.error-rate_limit { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.4); color: #fde68a; }
.error-rate_limit strong { color: #fff; }
.error-invalid_key { background: rgba(239, 68, 68, 0.18); }
.error-insufficient_credit { background: rgba(139, 92, 246, 0.12); border-color: rgba(139, 92, 246, 0.4); color: #ddd6fe; }
.error-insufficient_credit strong { color: #fff; }

/* Example chip buttons (used on Task 1, 2, 3 forms) */
.examples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}
.example-btn {
    background: #1e293b;
    border: 1px solid #334155;
    color: #94a3b8;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}
.example-btn:hover {
    border-color: #475569;
    color: #e2e8f0;
    background: #243046;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-skills { background: rgba(59, 130, 246, 0.2); color: var(--accent-blue); }
.badge-agent { background: rgba(139, 92, 246, 0.2); color: var(--accent-purple); }
.badge-pipeline { background: rgba(34, 197, 94, 0.2); color: var(--accent-green); }

/* Status */
.status {
    font-size: 0.875rem;
    color: var(--accent-green);
}

.status::before {
    content: '●';
    margin-right: 4px;
}

/* Links */
a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover { color: #93c5fd; }

/* Model Selector */
.model-selector {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.model-selector label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.model-selector select {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
}

.model-selector input {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Reviewer-friendly system pages */
.back-link {
    color: #64748b;
    font-size: 0.85rem;
    text-decoration: none;
}

.system-header {
    text-align: left;
}

.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.system-card,
.system-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.system-card {
    padding: 1rem 1.1rem;
}

.system-label {
    display: block;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.system-value {
    color: var(--text-primary);
    font-size: 1.25rem;
}

.system-value.good {
    color: var(--accent-green);
}

.system-panel {
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.system-panel h2 {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 0.9rem;
}

.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.readiness-list {
    display: grid;
    gap: 0.65rem;
}

.readiness-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 6px;
    padding: 0.75rem 0.9rem;
    color: var(--text-secondary);
}

.readiness-pill,
.provider-pill {
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.readiness-pill {
    background: rgba(34, 197, 94, 0.13);
    color: var(--accent-green);
}

.provider-openrouter {
    background: rgba(139, 92, 246, 0.16);
    color: #c4b5fd;
}

.provider-nvidia {
    background: rgba(34, 197, 94, 0.14);
    color: #86efac;
}

.system-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.system-table th,
.system-table td {
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    padding: 0.65rem 0.7rem;
    text-align: left;
    vertical-align: top;
}

.system-table th {
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(15, 23, 42, 0.55);
}

.system-table code {
    font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
    font-size: 0.78rem;
    color: #cbd5e1;
}

.empty-state {
    color: #64748b;
    font-size: 0.9rem;
}

.panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.system-raw {
    margin-top: 0.8rem;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    margin-top: 3rem;
    padding-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 1rem; }
    .task-grid { grid-template-columns: 1fr; }
    .header h1 { font-size: 1.75rem; }
}
