:root {
    /* Paleta de Colores Solicitada (Sin Gradientes) */
    --color-primary-dark: #0A2B3A;   /* Muy oscuro - para fondos/sidebar/barras */
    --color-primary-teal: #117A8B;   /* Turquesa - para acentos, botones primarios */
    
    /* Colores estáticos y feedback */
    --color-background: #F4F7F6;
    --color-surface: #FFFFFF;
    --color-text-primary: #1F2937;
    --color-text-secondary: #4B5563;
    --color-text-light: #FFFFFF;
    
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-danger: #EF4444;

    --font-family: 'Inter', 'Roboto', sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--color-background);
    color: var(--color-text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout General - Mobile First */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 70px; /* Space for bottom nav on mobile */
}

/* Header Móvil */
.mobile-header {
    background-color: var(--color-primary-dark);
    color: var(--color-text-light);
    padding: 1rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--color-primary-dark);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 10;
}

/* Items de navegación móvil (Icono arriba, texto abajo) */
.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.7rem;
    transition: all 0.2s ease;
}

.nav-link i {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.nav-link.active {
    color: var(--color-primary-teal);
    font-weight: 700;
}

/* Ocultar Sidebar en Móvil */
.sidebar-nav {
    display: none;
}

/* Contenido Principal */
.main-content {
    flex: 1;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Tarjetas (Cards) */
.card {
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--box-shadow);
}

.card-title {
    font-size: 1.2rem;
    color: var(--color-primary-dark);
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Tarjetas Consolidadas (Historial Premium) */
.form-group-mini {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group-mini label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.2;
    min-height: 32px;
    display: flex;
    align-items: flex-end;
}

.form-group-mini input {
    padding: 8px;
    font-size: 0.9rem;
    text-align: center;
}

.card-consolidada {
    margin-bottom: 1.2rem;
    padding: 0;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-consolidada:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.2rem;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.header-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-date { font-weight: 700; color: var(--color-primary-dark); }
.header-time { color: #64748b; font-size: 0.9rem; }
.header-slot {
    background: var(--color-primary-teal);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 1.2rem;
    gap: 15px;
    background: white;
}

.metric-item {
    text-align: center;
    padding: 10px;
    border-right: 1px solid #f1f5f9;
}

.metric-item:last-child { border-right: none; }

.metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-primary-dark);
}

.metric-value small {
    font-size: 0.7rem;
    font-weight: 400;
    color: #64748b;
}

.metric-empty { opacity: 0.3; filter: grayscale(1); }

.metric-alerts {
    margin-top: 6px;
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}

.card-footer-consolidada {
    padding: 1rem 1.2rem;
    background-color: #ffffff;
    border-top: 1px dashed #e2e8f0;
}

.footer-meta {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 8px;
}

.footer-notes {
    font-size: 0.9rem;
    color: #1e293b;
    font-style: italic;
    background: #f1f5f9;
    padding: 8px 12px;
    border-radius: 6px;
}

.btn-icon-del {
    background: transparent;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.btn-icon-del:hover { color: #ef4444; }

@media (max-width: 650px) {
    .metrics-grid { 
        grid-template-columns: repeat(3, 1fr); 
        gap: 8px; 
        padding: 0.8rem;
    }
    .metric-item { 
        border-right: 1px solid #f1f5f9; 
        border-bottom: none; 
        padding-bottom: 0px; 
        padding-top: 5px;
    }
    .metric-item:last-child { border-right: none; }
    
    .metric-label { font-size: 0.6rem; margin-bottom: 2px; }
    .metric-value { font-size: 0.95rem; }
    .metric-value small { display: block; font-size: 0.6rem; margin-top: -2px; }
    
    .card-header-flex { padding: 0.6rem 1rem; flex-wrap: wrap; gap: 8px; }
    .header-info { gap: 8px; }
    .header-date, .header-time { font-size: 0.8rem; }

    .card-footer-consolidada { padding: 0.8rem 1rem; }
}

/* Dashboard Grid - Mobile (Stack) */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}

/* Resumen (Stat cards) */
.stat-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid var(--color-primary-teal);
    padding: 1.2rem;
    transition: transform 0.2s ease;
}

.stat-card:hover { transform: translateY(-3px); }

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--color-primary-dark);
}

.stat-unit {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    font-weight: 600;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

/* Botones */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s ease;
    width: 100%;
}

.btn-primary {
    background-color: var(--color-primary-teal);
    color: var(--color-text-light);
}

.btn-primary:hover {
    background-color: #0c5f6d; /* Un tono un poco más oscuro que el teal */
}

/* Fab button (Floating Action Button para agregar) */
.fab {
    position: fixed;
    bottom: 80px; /* Above the bottom nav */
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--color-primary-teal);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(17, 122, 139, 0.4);
    font-size: 30px;
    text-decoration: none;
    z-index: 100;
}

/* Alertan de colores (Pills) */
.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.pill.ok { background: #dcfce7; color: #166534; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.bad { background: #fee2e2; color: #991b1b; }

.content-section {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header de Contenido (PC) */
.main-header {
    display: none; /* Oculto en móvil */
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.main-header h2 {
    color: var(--color-primary-dark);
    font-size: 1.8rem;
    font-weight: 700;
}

.pc-only-btn {
    display: none;
}

/* ==== RESPONSIVE PARA PC ==== */
@media (min-width: 1024px) {
    .app-container {
        flex-direction: row; /* Sidebar a la izquierda, contenido a la derecha */
        padding-bottom: 0;
    }

    .mobile-header, .bottom-nav, .fab {
        display: none; /* Ocultar elementos móviles */
    }

    /* Mostrar y estilizar el Sidebar */
    .sidebar-nav {
        display: flex;
        flex-direction: column;
        width: 250px;
        background-color: var(--color-primary-dark);
        color: var(--color-text-light);
        min-height: 100vh;
        position: fixed;
        left: 0;
        top: 0;
    }

    .sidebar-brand {
        padding: 2rem 1.5rem;
        font-size: 1.5rem;
        font-weight: 700;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        color: var(--color-primary-teal);
    }

    .sidebar-menu {
        flex: 1;
        padding: 1rem 0;
    }

    /* Links del Sidebar (Icono a la izquierda, texto a la derecha) */
    .sidebar-menu a {
        display: flex;
        align-items: center;
        padding: 0.8rem 1.5rem;
        color: rgba(255, 255, 255, 0.7);
        text-decoration: none;
        transition: all 0.2s ease;
        font-size: 1rem;
        border-left: 4px solid transparent;
    }

    .sidebar-menu a i {
        font-size: 1.3rem;
        margin-right: 12px;
        width: 24px;
        text-align: center;
    }

    .sidebar-menu a:hover, .sidebar-menu a.active {
        color: var(--color-primary-teal);
        background-color: rgba(255, 255, 255, 0.05);
        border-left-color: var(--color-primary-teal);
    }

    /* Ajustar el contenedor principal por la sidebar */
    .main-content {
        margin-left: 250px;
        padding: 2rem 3rem;
    }

    .main-header {
        display: flex; /* Mostrar en PC */
    }

    .btn.pc-only-btn {
        display: inline-flex;
        width: auto;
        align-items: center;
        gap: 8px;
    }

    /* Grid para PC */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .charts-container {
        grid-column: span 2; /* Los gráficos ocupan todo el ancho en PC */
    }
}
