:root {
    --institutional-blue: #0f4c81;
    --deep-blue: #0a355d;
    --sky-blue: #38bdf8;
    --soft-blue: #e8f6ff;
    --line-blue: #d9e9f5;
    --sidebar-width: 270px;
}

* {
    letter-spacing: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background: #f5f9fd;
    color: #1f2937;
    overflow-x: hidden;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        linear-gradient(135deg, rgba(6, 42, 75, .88), rgba(14, 116, 144, .78)),
        url('https://images.unsplash.com/photo-1524995997946-a1c2e315a42f?auto=format&fit=crop&w=1600&q=80') center/cover;
}

.login-card {
    width: min(100%, 560px);
    border: 0;
    border-radius: 8px;
    box-shadow: 0 28px 80px rgba(4, 25, 44, .34);
    overflow: hidden;
}

.login-card .card-body {
    padding: 44px 48px;
}

.login-brand {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

.login-logo {
    width: 128px;
    height: 128px;
    object-fit: contain;
    display: inline-block;
    filter: drop-shadow(0 12px 24px rgba(15, 76, 129, .22));
}

.login-title {
    color: #102033;
    font-size: 1.72rem;
    font-weight: 900;
    line-height: 1.14;
}

.login-title span {
    display: block;
}

.login-card .form-label {
    font-weight: 700;
    color: #17243a;
}

.login-card .input-group {
    border: 1px solid var(--line-blue);
    border-radius: 8px;
    overflow: hidden;
    background: #f8fbff;
}

.login-card .input-group-text,
.login-card .form-control {
    border: 0;
    min-height: 54px;
    background: transparent;
}

.login-card .input-group-text {
    color: var(--institutional-blue);
    padding-left: 18px;
    padding-right: 18px;
}

.login-card .form-control:focus {
    box-shadow: none;
    background: #fff;
}

.login-card .input-group:focus-within {
    border-color: var(--sky-blue);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, .16);
}

.login-card .btn-primary {
    min-height: 56px;
    font-weight: 800;
    border-radius: 8px;
    box-shadow: 0 12px 24px rgba(15, 76, 129, .22);
}

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

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--deep-blue), #0e7490);
    color: #fff;
    padding: 20px 16px;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    transition: transform .2s ease;
}

.sidebar-close {
    display: none;
    margin-left: auto;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: rgba(255,255,255,.14);
    color: #fff;
}

.sidebar-backdrop {
    display: none;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 28px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex: 0 0 auto;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .2));
}

.sidebar .nav-link {
    color: rgba(255,255,255,.86);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: rgba(255,255,255,.14);
    color: #fff;
}

.content {
    flex: 1;
    margin-left: var(--sidebar-width);
}

.topbar {
    min-height: 72px;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid #e5edf5;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 1020;
    backdrop-filter: blur(10px);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.user-name {
    max-width: min(520px, 44vw);
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: left;
    line-height: 1.25;
}

.page {
    padding: 24px;
    max-width: 100%;
}

.period-form {
    min-width: 136px;
}

.stat-card,
.panel {
    background: #fff;
    border: 1px solid #e5edf5;
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(15, 76, 129, .07);
}

.stat-card {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--soft-blue);
    color: var(--institutional-blue);
    font-size: 24px;
}

.table thead th {
    background: #eef8ff;
    color: #0f4c81;
    white-space: nowrap;
}

.badge-status {
    text-transform: capitalize;
}

.btn-primary {
    background: var(--institutional-blue);
    border-color: var(--institutional-blue);
}

.btn-primary:hover {
    background: #0c3f6d;
    border-color: #0c3f6d;
}

@media (max-width: 991.98px) {
    body.sidebar-open {
        overflow: hidden;
    }

    .sidebar {
        width: min(84vw, var(--sidebar-width));
        transform: translateX(-100%);
        box-shadow: 18px 0 40px rgba(15, 76, 129, .28);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-close {
        display: grid;
        place-items: center;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        display: block;
        background: rgba(15, 23, 42, .46);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
        z-index: 1030;
    }

    .sidebar-backdrop.show {
        opacity: 1;
        pointer-events: auto;
    }

    .content {
        margin-left: 0;
        min-width: 0;
        width: 100%;
    }

    .page,
    .topbar {
        padding-left: 16px;
        padding-right: 16px;
    }

    .topbar {
        gap: 10px;
    }

    .user-actions {
        gap: 6px;
    }

    .user-name {
        max-width: min(360px, 52vw);
    }
}

@media (max-width: 767.98px) {
    .login-page {
        padding: 16px;
    }

    .login-card .card-body {
        padding: 30px 22px;
    }

    .login-logo {
        width: 108px;
        height: 108px;
    }

    .login-title {
        font-size: 1.35rem;
    }

    .topbar {
        align-items: flex-start;
        flex-wrap: wrap;
        min-height: auto;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .topbar > div:nth-child(2) {
        flex: 1 1 calc(100% - 56px);
        min-width: 0;
    }

    .topbar strong {
        display: block;
        font-size: .92rem;
        line-height: 1.25;
    }

    .user-actions {
        width: 100%;
        justify-content: space-between;
    }

    .user-name {
        max-width: calc(100vw - 126px);
        font-size: .92rem;
    }

    .page {
        padding: 16px 12px;
    }

    .page h1 {
        font-size: 1.65rem;
    }

    .page-heading,
    .period-form {
        width: 100%;
    }

    .stat-card {
        padding: 16px;
    }

    .panel {
        border-radius: 8px;
    }

    .mobile-card-table {
        display: block;
        overflow: visible;
    }

    .mobile-card-table table,
    .mobile-card-table thead,
    .mobile-card-table tbody,
    .mobile-card-table tr,
    .mobile-card-table th,
    .mobile-card-table td {
        display: block;
        width: 100%;
    }

    .mobile-card-table thead {
        display: none;
    }

    .mobile-card-table tr {
        background: #fff;
        border: 1px solid #e5edf5;
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 12px;
    }

    .mobile-card-table td {
        border: 0;
        padding: 7px 0;
        display: flex;
        justify-content: space-between;
        gap: 16px;
        text-align: right;
    }

    .mobile-card-table td::before {
        content: attr(data-label);
        color: #0f4c81;
        font-weight: 700;
        text-align: left;
        flex: 0 0 42%;
    }

    .mobile-card-table td:first-child {
        display: block;
        text-align: left;
        padding-top: 0;
    }

    .mobile-card-table td:first-child::before {
        display: none;
    }
}
