:root {
    --color-primary: #3569BF;
    --color-secondary: #585858;
    --color-bg: #F7F8FA;
    --login-bg-color: #3569BF;
    --login-secondary-color: #585858;
    --login-bg-image: url('/assets/images/login-background.png');
    --footer-h: 52px;
    --bs-primary: var(--color-primary);
    --bs-secondary: var(--color-secondary);
    --bs-body-bg: var(--color-bg);
    --bs-light: var(--color-bg);
    --bs-link-color: var(--color-primary);
    --bs-link-hover-color: var(--color-primary);
}

body {
    background-color: var(--color-bg);
}

body.auth-pending {
    display: none;
}

body.nav-open {
    overflow: hidden;
}

body.login-page {
    min-height: 100vh;
    background-color: var(--login-bg-color);
    background-image: var(--login-bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
}

.login-shell {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
}

.login-card {
    width: min(100%, 420px);
    border: 1px solid color-mix(in srgb, var(--login-secondary-color), #ffffff 70%);
}

.login-secondary {
    color: var(--login-secondary-color);
}

.app-shell {
    min-height: 100vh;
}

.app-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    height: var(--footer-h);
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bs-body-bg);
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.app-main {
    padding-bottom: calc(var(--footer-h) + 1.5rem) !important;
}

.sidebar {
    padding-bottom: calc(var(--footer-h) + 1rem);
}

.mobile-header {
    display: none;
}

.mobile-brand {
    color: var(--color-primary);
    letter-spacing: 0.06em;
    max-width: 180px;
}

.mobile-nav-toggle {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0;
}

.mobile-nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--color-primary);
    border-radius: 999px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-nav-overlay,
.mobile-nav-drawer {
    display: none;
}

.mobile-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1040;
}

.mobile-nav-drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(80vw, 320px);
    background: #fff;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
    padding: 1.5rem;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1041;
}

body.nav-open .mobile-nav-overlay {
    opacity: 1;
    pointer-events: auto;
}

body.nav-open .mobile-nav-drawer {
    transform: translateX(0);
}

body.nav-open .mobile-nav-toggle span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

body.nav-open .mobile-nav-toggle span:nth-child(2) {
    opacity: 0;
}

body.nav-open .mobile-nav-toggle span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(53, 105, 191, 0.1);
    color: var(--bs-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-avatar--sm {
    width: 32px;
    height: 32px;
}

.app-topbar {
    margin-bottom: 1.5rem;
}

.app-user-toggle {
    color: inherit;
}

.app-user-toggle::after {
    margin-left: 0.35rem;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    font-size: 1.25rem;
}

.responsive-table tbody td::before {
    color: var(--color-secondary);
}

.action-menu {
    display: none;
    position: relative;
}

.action-menu summary {
    list-style: none;
}

.action-menu summary::-webkit-details-marker {
    display: none;
}

.action-menu .action-menu-list {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 0.75rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.75rem;
}

.app-modal {
    border: none;
    border-radius: 16px;
    padding: 0;
    width: min(720px, 94vw);
    max-width: 100%;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}

.app-modal--wide {
    width: min(1100px, 96vw);
}

.app-modal::backdrop {
    background: rgba(15, 23, 42, 0.45);
}

.app-modal form {
    margin: 0;
}

.app-modal .modal-header,
.app-modal .modal-footer {
    padding: 1rem 1.5rem;
}

.app-modal .modal-header {
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.app-modal .modal-body {
    padding: 1.5rem;
}

.app-modal .modal-footer {
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.kf-switch {
    align-items: center;
    padding-left: 0;
}

.kf-switch .form-check-input {
    cursor: pointer;
    height: 1.9rem;
    margin-left: 0;
    margin-top: 0.1rem;
    width: 3.2rem;
    background-image: var(--bs-form-switch-bg);
    background-position: left center;
    background-size: contain;
}

.kf-switch .form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    background-image: var(--bs-form-switch-bg);
    background-position: right center;
}

.kf-switch .form-check-label {
    cursor: pointer;
    line-height: 1.9rem;
    user-select: none;
}

.table-nowrap th,
.table-nowrap td {
    white-space: nowrap;
}

.sidebar .sidebar-brand {
    background-color: #3569bf;
    font-size: 1.6rem;
    padding: 0.5rem 1rem;
    text-align: left;
}

.sidebar .sidebar-brand span {
    color: #fff;
}

@media (max-width: 991.98px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        display: none !important;
        width: 100% !important;
        min-height: auto !important;
        border-right: 0 !important;
        border-bottom: 1px solid rgba(15, 23, 42, 0.1);
    }

    .sidebar .nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .sidebar .nav .nav-link {
        padding: 0.4rem 0.75rem;
    }

    .sidebar .nav .nav-item {
        flex: 0 0 auto;
    }
}

@media (max-width: 767.98px) {
    .sidebar {
        display: none;
    }

    .mobile-header,
    .mobile-nav-overlay,
    .mobile-nav-drawer {
        display: block;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody tr {
        background: #fff;
        border: 1px solid rgba(15, 23, 42, 0.08);
        border-radius: 12px;
        display: block;
        margin-bottom: 0.75rem;
        padding: 0.75rem;
    }

    .responsive-table tbody td {
        border: 0;
        display: flex;
        gap: 1rem;
        justify-content: space-between;
        padding: 0.35rem 0;
    }

    .responsive-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
    }

    .responsive-table tbody td[colspan] {
        display: block;
    }

    .responsive-table tbody td[colspan]::before {
        content: none;
    }

    .responsive-table tbody td:last-child {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 575.98px) {
    .row-actions {
        display: none !important;
    }

    .action-menu {
        display: block;
    }

    .app-modal {
        border-radius: 0;
        height: 100dvh;
        margin: 0;
        max-width: 100%;
        width: 100%;
    }

    .app-modal form {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .app-modal .modal-header {
        background: #fff;
        position: sticky;
        top: 0;
        z-index: 2;
    }

    .app-modal .modal-body {
        flex: 1;
        overflow-y: auto;
    }

    .app-modal .modal-footer {
        background: #fff;
    }
}
