:root {
    /* Paleta de Colores Dark Mode */
    --bg-dark: #0f172a;       /* Fondo principal (Slate 900) */
    --card-bg: #1e293b;       /* Fondo de tarjetas (Slate 800) */
    --text-main: #e2e8f0;     /* Texto principal (Slate 200) */
    --text-muted: #94a3b8;    /* Texto secundario (Slate 400) */
    --border-color: #334155;  /* Bordes sutiles */
    
    /* Colores de Acento (Coherentes con las gráficas) */
    --accent-temp: #38bdf8;   /* Cyan para temp */
    --accent-hum: #22c55e;    /* Verde para humedad */
    --accent-pres: #f472b6;   /* Rosa para presión */
    --accent-bat: #facc15;    /* Amarillo para batería */
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

/* Contenedor Principal */
.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

h1 {
    margin: 0;
    font-weight: 300;
    font-size: 1.8rem;
    letter-spacing: 0.5px;
}

header small {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

.status-badge {
    background-color: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    border: 1px solid rgba(34, 197, 94, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Grid de KPIs (Tarjetas Superiores) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 
                0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--text-muted);
}

.card h3 {
    margin: 0 0 15px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.value-container {
    display: flex;
    align-items: baseline;
}

.value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-main);
}

.unit {
    margin-left: 8px;
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Colores específicos para los valores */
.val-temp { color: var(--accent-temp); }
.val-hum { color: var(--accent-hum); }
.val-pres { color: var(--accent-pres); }
.val-bat { color: var(--accent-bat); }

/* Grid de Gráficas */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 1024px) {
    .charts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    /* La gráfica de presión ocupa todo el ancho abajo */
    .full-width {
        grid-column: 1 / -1;
    }
}

.chart-container {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    height: 350px; /* Altura fija para evitar saltos */
    position: relative;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--accent-temp);
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Scrollbar personalizada para Webkit */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark); 
}
::-webkit-scrollbar-thumb {
    background: var(--border-color); 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted); 
}