:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2332;
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    --accent-green: #10b981;
    --border: #1f2937;
    --shadow: rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, #0c1929 0%, #1a2744 100%);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 2rem;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-cyan);
    letter-spacing: -0.02em;
}

.header h1 span {
    color: var(--text-primary);
    font-weight: 400;
}

.header-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
}

/* Main layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

/* Headline metrics */
.headline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    transition: border-color 0.2s;
}

.metric-card:hover {
    border-color: var(--accent-blue);
}

.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.metric-value.negative {
    color: var(--accent-red);
}

.metric-value.warning {
    color: var(--accent-orange);
}

.metric-value.positive {
    color: var(--accent-green);
}

.metric-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Chart sections */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-card h2 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.chart-card h2 .subtitle {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

/* State table */
.state-table {
    width: 100%;
    border-collapse: collapse;
}

.state-table th {
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.state-table td {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.state-table tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

.stress-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stress-badge.severe {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.stress-badge.moderate {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.stress-badge.stable {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

/* Loading state */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Footer */
.footer {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.8;
}

.footer a {
    color: var(--accent-cyan);
    text-decoration: none;
}

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

    .chart-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 1rem;
    }

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