* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; background: #f4f7fb; color: #1f2937; }

.login-page {
    min-height: 100vh;
    background: url('../img/fondo_login.jpg') center center / cover no-repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}
.login-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8, 28, 54, 0.65);
}
.login-card {
    position: relative;
    z-index: 2;
    width: 430px;
    background: rgba(255,255,255,0.96);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}
.login-logo {
    width: 120px;
    display: block;
    margin: 0 auto 12px;
}
.login-card h1 {
    margin: 0;
    color: #0d3b78;
    text-align: center;
}
.login-card p {
    text-align: center;
    color: #475569;
    margin-bottom: 20px;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    margin-top: 6px;
    margin-bottom: 14px;
}
label {
    display: block;
    font-weight: 700;
    color: #1e293b;
}

.btn-primary {
    width: 100%;
    border: none;
    background: linear-gradient(135deg, #0d3b78, #2563eb);
    color: white;
    padding: 13px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
}
.btn-primary:hover { opacity: 0.95; }

.alert {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-weight: 700;
}
.alert-error {
    background: #fee2e2;
    color: #991b1b;
}
.alert-ok {
    background: #dcfce7;
    color: #166534;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0f172a, #0d3b78);
    color: white;
    padding: 24px 18px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}
.brand-logo {
    width: 58px;
    background: white;
    border-radius: 10px;
    padding: 4px;
}
.brand h2 {
    margin: 0;
    font-size: 22px;
}
.brand span {
    color: #cbd5e1;
    font-size: 13px;
}
.nav-menu a {
    display: block;
    color: #e2e8f0;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
}
.nav-menu a:hover {
    background: #1e293b;
}
.logout-link {
    background: #7f1d1d;
}

.main-content {
    flex: 1;
    padding: 24px;
}
.topbar {
    background: white;
    padding: 20px 24px;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
    margin-bottom: 24px;
    border-left: 8px solid #2563eb;
}
.topbar h1 {
    margin: 0 0 6px;
    color: #0d3b78;
}
.topbar p {
    margin: 0;
    color: #64748b;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}
.stat-card {
    background: linear-gradient(135deg, #ffffff, #f8fbff);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.07);
    border-left: 6px solid #2563eb;
}
.critico-card {
    border-left: 6px solid #dc2626;
}
.stat-card h3 {
    margin: 0 0 10px;
    color: #475569;
    font-size: 15px;
}
.stat-card p {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.panel {
    background: white;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}
.panel h2 {
    margin-top: 0;
    color: #0d3b78;
}
.form-panel {
    max-width: 1000px;
}
.formulario-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}
.full-width {
    grid-column: 1 / -1;
}

.semaforo-panel {
    border-left: 6px solid #0d3b78;
}
.semaforo-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}
.semaforo-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0,0,0,0.2);
}
.semaforo-dot.verde { background: #16a34a; }
.semaforo-dot.amarillo { background: #eab308; }
.semaforo-dot.rojo { background: #dc2626; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    color: white;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-alta { background: #dc2626; }
.badge-media { background: #f59e0b; }
.badge-baja { background: #16a34a; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
}
table thead {
    background: #0d3b78;
    color: white;
}
table th, table td {
    border: 1px solid #dbe3ee;
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

@media (max-width: 900px) {
    .sidebar { width: 100%; }
    .app-layout { flex-direction: column; }
    .formulario-grid { grid-template-columns: 1fr; }
}

.acciones-filtros {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-exportar {
    display: inline-block;
    background: #198754;
    color: #ffffff;
    text-decoration: none;
    padding: 12px 22px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
}

.btn-exportar:hover {
    background: #157347;
}