/* =========================
   Light Mode Variables
   ========================= */
:root {
    --bg: linear-gradient(135deg, #f6fdf7, #e9f7ec); /* soft mint gradient */
    --surface: #ffffff;
    --primary: #3b7d4f;       /* natural green accent */
    --primary-soft: #d9f2e3;  /* pale mint highlight */
    --text-main: #1c2b21;     /* deep forest text */
    --text-muted: #6b7a70;    /* muted gray-green */
    --border: #dce5dc;        /* soft border */
    --ok: #2e8b57;            /* healthy green */
    --ok-soft: #e6f4ea;       /* light green background */
    --warn: #d97706;          /* earthy orange */
    --warn-soft: #fff3e0;     /* soft orange background */
}

/* =========================
   Dark Mode Variables
   ========================= */
body.dark-mode {
    --bg: linear-gradient(135deg, #121a14, #1a2420); /* deep forest gradient */
    --surface: #1f2a22;
    --primary: #6fbf73;       /* lighter green accent */
    --primary-soft: #2a3b2f;  /* muted green highlight */
    --text-main: #eaf3ea;     /* soft light text */
    --text-muted: #9cae9f;    /* muted sage */
    --border: #3a4a3a;
    --ok: #4ade80;            /* bright green success */
    --ok-soft: #1e3f2f;
    --warn: #f59e0b;          /* amber warning */
    --warn-soft: #3f2d25;
}

/* =========================
   Reset
   ========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text-main);
    line-height: 1.6;
}

/* =========================
   Topbar
   ========================= */
.topbar {
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.logo {
    font-weight: 600;
    color: var(--primary);
}

.nav a {
    margin-left: 1rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.nav a.active,
.nav a:hover {
    color: var(--primary);
}

/* =========================
   Layout
   ========================= */
.layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 60px);
}

.container {
    padding: 1.5rem;
    max-width: 1200px;
    margin: auto;
}

/* =========================
   Sidebar
   ========================= */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
}

.sidebar h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.sidebar ul {
    list-style: none;
}

.station {
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

.station.active,
.station:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

/* =========================
   Cards grid
   ========================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--surface);
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 1rem;
}

.card h3 {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.card .value {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.card .status {
    font-size: 0.85rem;
}

/* State colors */
.card.ok {
    border-color: var(--ok-soft);
    background: var(--ok-soft);
}

.card.ok .status {
    color: var(--ok);
}

.card.warn {
    border-color: var(--warn-soft);
    background: var(--warn-soft);
}

.card.warn .status {
    color: var(--warn);
}

/* =========================
   Chart card
   ========================= */
.chart-card {
    margin-top: 1.5rem;
    background: var(--surface);
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 1rem;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.chart-header h3 {
    font-size: 1rem;
}

.chart-header select {
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
}

.chart-placeholder {
    height: 220px;
    border-radius: 8px;
    border: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* =========================
   Footer
   ========================= */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
}

body.dark-mode footer {
    color: var(--text-main);
}

/* =========================
   Responsiveness
   ========================= */
@media (max-width: 800px) {
    .layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}
