:root {
    --azul-principal: #0647A6;
    --azul-profundo: #04377F;
    --azul-claro: #EAF2FF;
    --blanco: #FFFFFF;
    --negro: #111111;
    --texto-secundario: #53647B;
    --borde: #D7E4F7;
    --sombra: 0 12px 32px rgba(6, 71, 166, 0.08);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--negro);
    background: var(--azul-claro);
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--azul-claro);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--negro);
    background:
        radial-gradient(circle at 8% 0%, rgba(255, 255, 255, 0.95), transparent 30rem),
        var(--azul-claro);
}

.layout {
    width: min(100% - 40px, 1160px);
    margin: 0 auto;
    padding: 28px 0 52px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 34px;
    padding: 16px 20px;
    border: 1px solid rgba(215, 228, 247, 0.9);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 5px 18px rgba(6, 71, 166, 0.04);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand img {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    object-fit: contain;
}

.brand h1 {
    margin: 0;
    color: var(--azul-principal);
    text-align: left;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.4px;
}

.brand p {
    margin: 5px 0 0;
    color: var(--texto-secundario);
    font-size: 13px;
}

button {
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: var(--azul-principal);
    color: var(--blanco);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

button:hover {
    background: var(--azul-profundo);
    box-shadow: 0 5px 14px rgba(6, 71, 166, 0.18);
}

button:active {
    transform: translateY(1px);
}

button:focus-visible {
    outline: 3px solid rgba(6, 71, 166, 0.25);
    outline-offset: 3px;
}

.logout {
    width: auto;
    flex: 0 0 auto;
    margin: 0;
    border-color: var(--borde);
    background: var(--blanco);
    color: var(--azul-principal);
}

.logout:hover {
    border-color: var(--azul-principal);
    background: var(--azul-claro);
    box-shadow: none;
}

.welcome {
    margin: 0 0 24px;
    padding: 4px 2px;
}

.welcome h2 {
    margin: 0 0 8px;
    color: var(--negro);
    font-size: clamp(25px, 4vw, 34px);
    font-weight: 800;
    letter-spacing: -0.8px;
    line-height: 1.2;
}

.welcome h2 span {
    color: var(--azul-principal);
}

.welcome p {
    margin: 0;
    color: var(--texto-secundario);
    line-height: 1.6;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.panel {
    min-width: 0;
    margin-bottom: 20px;
    padding: 24px;
    border: 1px solid var(--borde);
    border-radius: 18px;
    background: var(--blanco);
    box-shadow: var(--sombra);
}

.grid .panel {
    position: relative;
    overflow: hidden;
    min-height: 142px;
    margin-bottom: 0;
}

.grid .panel::before {
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: var(--azul-principal);
    content: "";
}

.metric-label {
    display: block;
    color: var(--texto-secundario);
    font-size: 13px;
    font-weight: 650;
    letter-spacing: 0.1px;
}

.metric {
    display: block;
    margin-top: 13px;
    color: var(--azul-principal);
    font-size: clamp(25px, 3vw, 32px);
    font-weight: 800;
    letter-spacing: -0.5px;
    overflow-wrap: anywhere;
}

#child-status {
    color: var(--negro);
    font-size: clamp(21px, 2.4vw, 28px);
    text-transform: capitalize;
}

.panel h3 {
    margin: 0 0 22px;
    color: var(--negro);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.2px;
}

.details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.details > div {
    min-width: 0;
    padding: 15px;
    border: 1px solid #E5EDFA;
    border-radius: 12px;
    background: #F8FAFF;
}

.detail-label {
    margin-bottom: 7px;
    color: var(--texto-secundario);
    font-size: 12px;
    font-weight: 650;
}

.detail-value {
    color: var(--negro);
    font-size: 15px;
    font-weight: 750;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #E5EDFA;
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 15px 14px;
    border-bottom: 1px solid #E8EFFA;
    text-align: left;
    white-space: nowrap;
}

th {
    background: #F3F7FF;
    color: #405573;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.55px;
    text-transform: uppercase;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover {
    background: #F8FAFF;
}

.status {
    display: inline-flex;
    align-items: center;
    border: 1px solid #D7E4F7;
    border-radius: 999px;
    padding: 5px 10px;
    background: var(--azul-claro);
    color: var(--azul-principal);
    font-size: 12px;
    font-weight: 750;
}

.status.vencido {
    border-color: #F2C9C9;
    background: #FFF0F0;
    color: #A52828;
}

.status.aprobado {
    border-color: #B8D7F7;
    background: #EAF2FF;
    color: #0647A6;
}

.muted {
    color: var(--texto-secundario);
    line-height: 1.6;
}

.error {
    color: #A52828;
}

.hidden {
    display: none !important;
}

.retry {
    max-width: 220px;
}

#loading {
    color: var(--texto-secundario);
}

#failure {
    border-color: #F2C9C9;
}

#failure h2 {
    margin-top: 0;
    font-size: 21px;
}

@media (max-width: 800px) {
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid .panel:last-child {
        grid-column: 1 / -1;
    }

    .details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .details > div:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .layout {
        width: min(100% - 24px, 1160px);
        padding: 12px 0 30px;
    }

    .topbar {
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 25px;
        padding: 13px;
        border-radius: 15px;
    }

    .brand {
        gap: 10px;
    }

    .brand img {
        width: 45px;
        height: 45px;
    }

    .brand h1 {
        font-size: 16px;
    }

    .brand p {
        font-size: 12px;
    }

    .logout {
        min-height: 39px;
        padding: 0 11px;
        font-size: 12px;
    }

    .welcome {
        margin-bottom: 20px;
    }

    .welcome h2 {
        font-size: 26px;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .grid .panel,
    .grid .panel:last-child {
        grid-column: auto;
        min-height: 115px;
        padding: 20px;
    }

    .metric {
        margin-top: 9px;
        font-size: 27px;
    }

    .panel {
        margin-bottom: 14px;
        padding: 19px;
        border-radius: 15px;
    }

    .panel h3 {
        margin-bottom: 17px;
        font-size: 17px;
    }

    .details {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .details > div:last-child {
        grid-column: auto;
    }

    .details > div {
        padding: 13px;
    }

    th,
    td {
        padding: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
