:root {
    --azul: #1a3a5c;
    --azul-claro: #2e5c8a;
    --rojo: #c0392b;
    --naranja: #d68910;
    --verde: #1e8449;
    --gris: #f4f6f8;
    --gris-borde: #dfe4ea;
    --texto: #2c3e50;
}
* { box-sizing: border-box; }
body {
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--gris);
    color: var(--texto);
    margin: 0;
}
.topbar {
    background: var(--azul);
    color: #fff;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar a { color: #fff; text-decoration: none; margin-left: 18px; font-size: 14px; }
.topbar .brand { font-weight: 600; font-size: 17px; }
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
.card {
    background: #fff;
    border: 1px solid var(--gris-borde);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}
h1 { font-size: 22px; margin-top: 0; }
h2 { font-size: 17px; color: var(--azul); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--gris-borde); }
th { background: var(--gris); font-weight: 600; }
tr:hover { background: #fafbfc; }
.btn {
    display: inline-block;
    background: var(--azul-claro);
    color: #fff;
    padding: 9px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    border: none;
    cursor: pointer;
}
.btn:hover { background: var(--azul); }
.btn-secundario { background: #7f8c8d; }
.btn-rojo { background: var(--rojo); }
input, select, textarea {
    width: 100%;
    padding: 9px;
    border: 1px solid var(--gris-borde);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 12px;
}
label { font-size: 13px; font-weight: 600; color: #555; display: block; margin-bottom: 4px; }
.badge { padding: 3px 9px; border-radius: 12px; font-size: 12px; font-weight: 600; color: #fff; }
.badge-pendiente { background: #7f8c8d; }
.badge-parcial { background: var(--naranja); }
.badge-pagada { background: var(--verde); }
.badge-vencida { background: var(--rojo); }
.alerta { padding: 12px 16px; border-radius: 6px; margin-bottom: 10px; font-size: 14px; }
.alerta-vencida { background: #fdecea; border-left: 4px solid var(--rojo); }
.alerta-proxima { background: #fef5e7; border-left: 4px solid var(--naranja); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--gris-borde); border-radius: 8px; padding: 16px; }
.stat .valor { font-size: 24px; font-weight: 700; color: var(--azul); }
.stat .etiqueta { font-size: 13px; color: #7f8c8d; }
.login-box { max-width: 360px; margin: 80px auto; }
.error { color: var(--rojo); font-size: 14px; margin-bottom: 10px; }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.modal-fondo {
    display: none;
    position: fixed; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.45);
    z-index: 100;
    align-items: center; justify-content: center;
}
.modal-fondo.activo { display: flex; }
.modal-caja {
    background: #fff;
    border-radius: 8px;
    padding: 22px;
    width: 90%;
    max-width: 400px;
}
.modal-caja h3 { margin-top: 0; }
.link-accion { color: var(--azul-claro); text-decoration: none; font-size: 13px; cursor: pointer; }
.link-accion:hover { text-decoration: underline; }
