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

:root {
    --bg: #0f1117;
    --surface: #1a1d29;
    --surface-hover: #222638;
    --border: #2a2e3d;
    --text: #e4e6f0;
    --text-muted: #8b8fa3;
    --green: #00c853;
    --yellow: #ffc107;
    --red: #ff5252;
    --accent: #448aff;
}

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

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px;
}

header {
    text-align: center;
    margin-bottom: 32px;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* Tab Navigation */
.tab-bar {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.tab-btn.active {
    color: var(--text);
    background: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Hero: Current Price */
.hero {
    margin-bottom: 32px;
}

.current-price-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    margin-bottom: 16px;
    transition: border-color 0.3s;
}

.current-price-card.cheap { border-color: var(--green); }
.current-price-card.medium { border-color: var(--yellow); }
.current-price-card.expensive { border-color: var(--red); }

.price-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.price-value {
    font-size: 3.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.cheap .price-value { color: var(--green); }
.medium .price-value { color: var(--yellow); }
.expensive .price-value { color: var(--red); }

.price-unit {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 4px;
}

.price-breakdown {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 8px;
    display: flex;
    justify-content: center;
    gap: 24px;
}

.price-breakdown strong {
    color: var(--text);
}

.price-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 12px;
}

.cheap .price-badge { background: rgba(0, 200, 83, 0.15); color: var(--green); }
.medium .price-badge { background: rgba(255, 193, 7, 0.15); color: var(--yellow); }
.expensive .price-badge { background: rgba(255, 82, 82, 0.15); color: var(--red); }

.period-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    margin-top: 8px;
    margin-left: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
}

.price-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 16px;
}

/* Stats */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Charts */
.chart-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.chart-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Info Cards */
.info-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.info-card h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.info-card div {
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Update status footer */
.update-status {
    display: flex;
    justify-content: center;
    gap: 32px;
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.update-status strong {
    color: var(--text);
    font-weight: 600;
}

/* Connection indicator */
.connection-status {
    position: fixed;
    bottom: 16px;
    right: 16px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    z-index: 100;
    transition: all 0.3s;
}

.connection-status.connected {
    border-color: var(--green);
    color: var(--green);
}

.connection-status.disconnected {
    border-color: var(--red);
    color: var(--red);
}

/* Consumption table */
.consumption-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.consumption-table th,
.consumption-table td {
    padding: 10px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.consumption-table th {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.consumption-table th:first-child,
.consumption-table td:first-child {
    text-align: left;
}

.consumption-table td {
    font-variant-numeric: tabular-nums;
}

.consumption-table tbody tr:hover {
    background: var(--surface-hover);
}

.consumption-summary {
    margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .info-cards {
        grid-template-columns: 1fr;
    }
    .price-value {
        font-size: 2.5rem;
    }
}
