:root {
    --azul: #2547a3;
    --azul-claro: #eef2fc;
    --verde: #1a9c6b;
    --rojo: #c0392b;
    --naranja: #d68910;
    --gris-texto: #333;
    --gris-borde: #dde3ee;
    --fondo: #f5f7fb;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--fondo);
    color: var(--gris-texto);
    margin: 0;
}

a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }

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

nav.menu {
    width: 220px;
    background: #1c2b4a;
    color: #fff;
    padding: 20px 0;
    flex-shrink: 0;
}
nav.menu h2 { padding: 0 20px; font-size: 18px; margin-bottom: 25px; }
nav.menu a {
    display: block;
    color: #cdd6ea;
    padding: 10px 20px;
    font-size: 14px;
}
nav.menu a:hover, nav.menu a.activo {
    background: #2a3f68;
    color: #fff;
    text-decoration: none;
}
nav.menu .grupo-titulo {
    padding: 15px 20px 5px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #7f8fb3;
}

main { flex: 1; padding: 25px 35px; max-width: 1100px; }

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 25px;
}
.topbar h1 { font-size: 22px; margin: 0; }

.tarjetas { display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 25px; }
.tarjeta {
    background: #fff; border: 1px solid var(--gris-borde); border-radius: 10px;
    padding: 18px 20px; flex: 1; min-width: 180px;
}
.tarjeta .etiqueta { font-size: 12px; color: #888; text-transform: uppercase; }
.tarjeta .valor { font-size: 24px; font-weight: 600; margin-top: 5px; }
.tarjeta.positivo .valor { color: var(--verde); }
.tarjeta.negativo .valor { color: var(--rojo); }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--gris-borde); text-align: left; font-size: 14px; }
th { background: var(--azul-claro); color: var(--azul); }
tr:hover td { background: #fafbfe; }

.caja {
    background: #fff; border: 1px solid var(--gris-borde); border-radius: 10px;
    padding: 20px; margin-bottom: 20px;
}
.caja h3 { margin-top: 0; }

form.form-linea { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; }
.campo { display: flex; flex-direction: column; gap: 4px; }
.campo label { font-size: 12px; color: #666; }
input, select, textarea, button {
    font-family: inherit; font-size: 14px;
    padding: 8px 10px; border: 1px solid var(--gris-borde); border-radius: 6px;
}
button, .boton {
    background: var(--azul); color: #fff; border: none; cursor: pointer;
    padding: 9px 16px; font-weight: 500;
}
button:hover, .boton:hover { background: #1c3579; text-decoration: none; }
button.secundario { background: #6b7280; }
button.peligro { background: var(--rojo); }

.badge { padding: 3px 9px; border-radius: 20px; font-size: 12px; color: #fff; }
.badge.info { background: #3b82f6; }
.badge.advertencia { background: var(--naranja); }
.badge.critica { background: var(--rojo); }

.msj-ok { background: #e3f7ee; color: #146c43; padding: 10px 15px; border-radius: 6px; margin-bottom: 15px; }
.msj-error { background: #fdeaea; color: #a12622; padding: 10px 15px; border-radius: 6px; margin-bottom: 15px; }

.auth-box {
    max-width: 380px; margin: 80px auto; background: #fff;
    padding: 30px; border-radius: 10px; border: 1px solid var(--gris-borde);
}
.auth-box h1 { font-size: 20px; text-align: center; }
.auth-box .campo { margin-bottom: 12px; }
.auth-box button { width: 100%; padding: 10px; }

.barra-progreso { background: var(--azul-claro); border-radius: 10px; height: 10px; overflow: hidden; }
.barra-progreso .relleno { height: 100%; background: var(--verde); }
.barra-progreso .relleno.excedido { background: var(--rojo); }
