:root {
    --bg: #0c0d10;
    --bg-alt: #151821;
    --bg-alt2: #1e2230;
    --accent: #3f83f8;
    --accent-soft: #243b6b;
    --border: #2a2f3d;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --danger: #f97373;
    --success: #4ade80;
}
* { box-sizing: border-box; }
body {
    margin:0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: inherit; text-decoration: none; }

.layout { min-height:100vh; display:flex; flex-direction:column; }

.topbar {
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:12px 24px;
    background: linear-gradient(90deg,#020617,#111827);
    border-bottom:1px solid var(--border);
    position:sticky;
    top:0;
    z-index:10;
}
.topbar-title {
    font-weight:600;
    letter-spacing:.03em;
}
.topbar-title span {
    font-size:.82rem;
    color:var(--text-muted);
    margin-left:.5rem;
}
.topbar-nav {
    display:flex;
    gap:8px;
    font-size:.8rem;
}
.topbar-nav a {
    padding:6px 10px;
    border-radius:999px;
    border:1px solid transparent;
    background:transparent;
    color:var(--text-muted);
}
.topbar-nav a:hover {
    border-color:var(--border);
    background:#020617;
    color:var(--text);
}
.topbar-nav a.active {
    background:var(--accent-soft);
    border-color:var(--accent);
    color:#e5edff;
}

.logout-form {
    margin: 0;
}

.logout-button {
    padding:6px 10px;
    border-radius:999px;
    border:1px solid transparent;
    background:transparent;
    color:var(--text-muted);
    cursor:pointer;
    font-size:.8rem;
}

.logout-button:hover {
    border-color:var(--border);
    background:#020617;
    color:var(--text);
}

.main {
    padding:20px;
    margin:0 auto 40px auto;
    width:100%;
}

.page-header {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:16px;
    margin-bottom:16px;
}
.page-title {
    font-size:1.1rem;
    font-weight:600;
}
.page-sub {
    font-size:.85rem;
    color:var(--text-muted);
    margin-top:2px;
}

.info-grid {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:4px 16px;
    font-size:.78rem;
    background:var(--bg-alt);
    border-radius:10px;
    padding:8px 12px;
    border:1px solid var(--border);
    min-width:280px;
}
.info-grid div {
    display:flex;
    flex-direction:column;
    gap:2px;
}
.info-label {
    color:var(--text-muted);
    font-size:.72rem;
    text-transform:uppercase;
    letter-spacing:.06em;
}
.info-value {
    font-weight:600;
}

.card {
    background: var(--bg-alt);
    border-radius:12px;
    padding:14px 16px 12px 16px;
    border:1px solid rgba(148,163,184,.35);
    box-shadow:0 18px 40px rgba(15,23,42,.65);
}

.controls {
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:10px;
    margin-bottom:10px;
}
.controls-group {
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    align-items:center;
}

input[type="date"] {
    background:var(--bg-alt2);
    border-radius:8px;
    border:1px solid var(--border);
    padding:4px 8px;
    color:var(--text);
    font-size:.85rem;
}
button {
    padding:6px 10px;
    border-radius:8px;
    border:1px solid var(--border);
    background:var(--bg-alt2);
    color:var(--text);
    cursor:pointer;
    font-size:.85rem;
}
button:hover { background:#1f2937; }

.checkbox-inline {
    display:flex;
    align-items:center;
    gap:5px;
    font-size:.8rem;
    color:var(--text-muted);
}

canvas { max-width:100%; background:#090c10; border-radius:10px; }

.info-bottom {
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:20px;
    margin-top:8px;
    font-size:.78rem;
    color:var(--text-muted);
}

.info-bottom span strong {
    color:var(--text);
}

.badge {
    display:inline-flex;
    align-items:center;
    gap:4px;
    padding:2px 7px;
    border-radius:999px;
    font-size:.7rem;
    border:1px solid var(--border);
    background:#020617;
}
.dot {
    width:7px;
    height:7px;
    border-radius:999px;
}

/* Estilos para formularios en alerts.php e import_csv.php */
.form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 28px;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid.one-col {
    grid-template-columns: 1fr;
}

.form-grid.two-col {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.field label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--text);
    font-weight: 500;
}

.field input[type="number"],
.field input[type="email"],
.field input[type="text"],
.field input[type="password"] {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-alt2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
}

.field input[type="number"]:focus,
.field input[type="email"]:focus,
.field input[type="text"]:focus,
.field input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
}

.hint {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.alert-success {
    background: var(--success) !important;
    color: white !important;
}

.alert-error {
    background: var(--danger) !important;
    color: white !important;
}
/* Estilos para formularios en alerts.php */
.form-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.field-group {
    margin-bottom: 24px;
}

.field-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 500;
}

.field-group input[type="number"],
.field-group input[type="email"],
.field-group input[type="text"],
.field-group input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-alt2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.field-group input[type="number"]:focus,
.field-group input[type="email"]:focus,
.field-group input[type="text"]:focus,
.field-group input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: var(--text);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.hint {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.hint code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--accent);
}

.alert-success {
    background: var(--success) !important;
    color: white !important;
}


/* Responsive */
@media (max-width: 768px) {
    .form-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .form-grid.two-col {
        grid-template-columns: 1fr;
    }
     .field-group {
        margin-bottom: 20px;
    }
}

@media (max-width: 720px) {
    .page-header {
        flex-direction:column;
        align-items:stretch;
    }
    .info-grid {
        width:100%;
    }
}


/*Estilos para el overview dashboard*/

/* Estilos específicos para overview.php */

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    margin-left: 10px;
    font-weight: 600;
}

.status-ok { background: var(--success); }
.status-warning { background: #ff9800; }
.status-alert { background: var(--danger); }

.flow-diagram {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: center;
    padding: 30px;
    position: relative;
}

.solar-panel, .inverter, .battery, .home, .grid {
    text-align: center;
    padding: 20px;
    background: var(--bg-alt2);
    border-radius: 10px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--border);
}

.icon { 
    font-size: 2.5em; 
    margin-bottom: 10px; 
}

.power-value { 
    font-size: 1.4em; 
    font-weight: bold; 
    margin: 5px 0;
}

.solar-power { color: #ffeb3b; }
.battery-power { color: #ff9800; }
.load-power { color: #e91e63; }
.grid-power { color: #9c27b0; }

.flow-arrow {
    font-size: 2em;
    text-align: center;
    color: var(--accent);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stats-grid .card {
    text-align: center;
    padding: 20px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    margin: 10px 0;
    color: var(--accent);
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.8;
}

.battery-gauge {
    width: 100%;
    height: 25px;
    background: var(--bg);
    border-radius: 12px;
    overflow: hidden;
    margin: 10px 0;
    position: relative;
    border: 1px solid var(--border);
}

.battery-fill {
    height: 100%;
    background: linear-gradient(90deg, #f44336, #ff9800, #4caf50);
    transition: width 0.5s ease;
}

.battery-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    font-size: 0.8em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.last-update {
    text-align: center;
    opacity: 0.7;
    font-size: 0.9em;
    margin-top: 20px;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .flow-diagram {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 15px;
    }
    
    .flow-arrow { 
        transform: rotate(90deg); 
        font-size: 1.5em;
    }
    
    .solar-panel, .inverter, .battery, .home, .grid {
        min-height: 120px;
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
