:root {
    --azul-oscuro: #5c1130;   /* guinda oscuro */
    --azul: #8c1d40;          /* guinda */
    --azul-claro: #f7e8ed;    /* guinda claro (tinte) */
    --dorado: #c9a227;
    --dorado-claro: #f8f0da;
    --gris-borde: #ddd2d6;
    --gris-texto: #362a2e;
    --rojo: #b3261e;
    --verde: #1e7d32;
    --amarillo: #8a6d00;
    --fondo: #f6f4f1;
}

* { box-sizing: border-box; }

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

a { color: var(--azul); }

/* ---------- Login ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--azul-oscuro), var(--azul));
}

.login-card {
    background: #fff;
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.login-card h1 {
    font-size: 1.3rem;
    margin: 0 0 .25rem;
    color: var(--azul-oscuro);
}

.login-card p.subtitulo {
    margin: 0 0 1.5rem;
    color: #667;
    font-size: .9rem;
}

.campo { margin-bottom: 1.1rem; }

.campo label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .35rem;
    color: var(--azul-oscuro);
}

.campo input[type=text],
.campo input[type=password],
.campo select,
.campo textarea {
    width: 100%;
    padding: .6rem .7rem;
    border: 1px solid var(--gris-borde);
    border-radius: 6px;
    font-size: .95rem;
}

.campo-error {
    color: var(--rojo);
    font-size: .8rem;
    margin-top: .3rem;
}

.select-ejercicio {
    display: flex;
    gap: .75rem;
}

.select-ejercicio label {
    flex: 1;
    border: 2px solid var(--gris-borde);
    border-radius: 8px;
    padding: .8rem;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--azul-oscuro);
}

.select-ejercicio input { display: none; }

.select-ejercicio input:checked + span,
.select-ejercicio label:has(input:checked) {
    background: var(--azul-claro);
    border-color: var(--azul);
}

.btn {
    display: inline-block;
    padding: .65rem 1.3rem;
    background: var(--azul);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { background: var(--azul-oscuro); }

.btn-block { width: 100%; text-align: center; }

.btn-secundario { background: #6b7a86; }
.btn-secundario:hover { background: #55626c; }

.btn-peligro { background: var(--rojo); }
.btn-peligro:hover { background: #8f1d17; }

/* Botones "Guardar" que todavia no se pueden usar porque falta validar:
   se ven apagados (en vez de "disabled" del navegador) para que al hacerles
   clic siempre salga el mensaje explicando que hace falta validar primero. */
.btn[data-validado="0"] {
    background: #a98a95;
    cursor: not-allowed;
}
.btn[data-validado="0"]:hover { background: #a98a95; }

/* ---------- Layout autenticado ---------- */
.topbar {
    background: var(--azul-oscuro);
    color: #fff;
    padding: .7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}

.topbar .marca { font-weight: 700; font-size: 1.05rem; }

.badge-ejercicio {
    background: var(--dorado);
    color: var(--azul-oscuro);
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: .5px;
    padding: .3rem 1.1rem;
    border-radius: 999px;
}

.topbar .usuario-info {
    display: flex;
    align-items: center;
    gap: .9rem;
    font-size: .9rem;
}

.navbar {
    background: var(--azul);
    padding: 0 1.5rem;
    display: flex;
    gap: 1.25rem;
}

.navbar a {
    color: #f3d9e2;
    text-decoration: none;
    padding: .65rem 0;
    font-size: .9rem;
    font-weight: 600;
    border-bottom: 3px solid transparent;
}

.navbar a:hover, .navbar a.activo {
    border-bottom-color: #fff;
}

.contenido {
    max-width: 1100px;
    margin: 1.75rem auto;
    padding: 0 1.5rem;
}

.card {
    background: #fff;
    border: 1px solid var(--gris-borde);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.alerta {
    padding: .8rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: .9rem;
}

.alerta-exito { background: #e6f4ea; color: var(--verde); border: 1px solid #b7dfc2; }
.alerta-error { background: #fbeaea; color: var(--rojo); border: 1px solid #f0bcb9; }

.botones-grandes {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.boton-grande {
    flex: 1;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--gris-borde);
    border-radius: 10px;
    padding: 2rem 1.5rem;
    text-align: center;
    text-decoration: none;
    color: var(--azul-oscuro);
    box-shadow: 0 2px 6px rgba(0,0,0,.05);
}

.boton-grande:hover { border-color: var(--azul); box-shadow: 0 4px 14px rgba(0,0,0,.1); }

.boton-grande .icono { font-size: 2.2rem; display: block; margin-bottom: .5rem; }
.boton-grande .titulo { font-size: 1.15rem; font-weight: 700; }
.boton-grande .descripcion { font-size: .85rem; color: #667; margin-top: .35rem; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

table th, table td {
    padding: .6rem .7rem;
    border-bottom: 1px solid var(--gris-borde);
    text-align: left;
}

table th {
    background: var(--azul-claro);
    color: var(--azul-oscuro);
    font-weight: 700;
}

.estado-pill {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
}

.estado-pendiente_financieros { background: #fff3cd; color: var(--amarillo); }
.estado-pendiente_materiales { background: #ffe4cc; color: #a04b00; }
.estado-completo { background: #e6f4ea; color: var(--verde); }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.5rem;
}

@media (max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
    .botones-grandes { flex-direction: column; }
}
