:root {
    --bg-color: #0d1117;
    --card-bg: #161b22;
    --border-color: #30363d;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --accent-color: #58a6ff;
    --success-color: #238636;
    --danger-color: #da3633;
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-heading);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

h2 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge.connected {
    background-color: rgba(35, 134, 54, 0.2);
    color: #3fb950;
    border: 1px solid rgba(35, 134, 54, 0.4);
}

.status-badge.disconnected {
    background-color: rgba(218, 54, 51, 0.2);
    color: #f85149;
    border: 1px solid rgba(218, 54, 51, 0.4);
}

/* Charts Section */
.charts-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.charts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.time-controls {
    display: flex;
    background: var(--card-bg);
    border-radius: 0.5rem;
    padding: 2px;
    border: 1px solid var(--border-color);
}

.time-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: 0.3rem;
    transition: all 0.2s;
}

.time-btn:hover {
    color: var(--text-primary);
}

.time-btn.active {
    background-color: var(--accent-color);
    color: white;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.value-group {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.diff-group {
    display: flex;
    gap: 0.8rem;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

.diff-item {
    font-family: var(--font-mono);
}

.diff-positive {
    color: var(--success-color);
}

.diff-negative {
    color: var(--danger-color);
}

.subtitle {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: -0.2rem;
}

/* Logs Section */
.logs-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.log-viewer {
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: #e6edf3;
    overflow-y: auto;
    /* Constant size requested */
    height: 300px;
    scroll-behavior: auto;
    /* Smoother scrolling interferes with "pause" logic sometimes if appending fast */
    white-space: pre-wrap;
    word-break: break-all;
}

.log-entry {
    margin-bottom: 0.2rem;
    line-height: 1.4;
    border-bottom: 1px solid rgba(48, 54, 61, 0.4);
    padding-bottom: 0.1rem;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--text-secondary);
    font-size: 0.8em;
    margin-right: 0.5em;
    user-select: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
        height: auto;
    }

    .charts-grid {
        grid-template-columns: 1fr;
        height: auto;
    }

    .chart-container {
        height: 250px;
    }

    .log-viewer {
        height: 400px;
    }
}