/* Profile page layout — prevent horizontal overflow inside tab workspace. */
.profile-page {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.profile-page .row {
    --bs-gutter-x: 1rem;
    max-width: 100%;
}

.profile-page > .row {
    margin-left: calc(var(--bs-gutter-x) * -0.5);
    margin-right: calc(var(--bs-gutter-x) * -0.5);
}

.profile-page .row > [class*="col-"] {
    min-width: 0;
}

/* Employee information — grid wraps by available card width */
.profile-employee-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem 1.25rem;
    width: 100%;
}

.profile-employee-fields .profile-field-span-all {
    grid-column: 1 / -1;
}

.profile-employee-field .form-label {
    margin-bottom: 0.35rem;
}

.profile-employee-field .form-control {
    width: 100%;
}

.profile-page .card {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.profile-page .card-body {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.profile-page .app-field,
.profile-page .form-label,
.profile-page .form-control,
.profile-page .form-select,
.profile-page .password-toggle-wrap {
    max-width: 100%;
    box-sizing: border-box;
}

.profile-page .app-field {
    min-width: 0;
}

.profile-page .form-control,
.profile-page .form-select {
    width: 100%;
    min-width: 0;
}

.profile-page .password-toggle-wrap.input-group {
    width: 100%;
    max-width: 100%;
    flex-wrap: nowrap;
}

.profile-page .password-toggle-wrap .password-toggle-input {
    flex: 1 1 0;
    min-width: 0;
    width: 1%;
}

.profile-page .password-toggle-wrap .password-toggle-btn {
    flex-shrink: 0;
}

.profile-page .form-actions {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-right: 0;
    padding-right: 0;
}

.profile-page input[type="file"].form-control {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Avatar */
.profile-photo-frame {
    width: 8rem;
    height: 8rem;
    max-width: 100%;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f3f5;
    border: 2px solid #dee2e6;
    margin: 0 auto 1rem;
}

.profile-photo-frame img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.profile-photo-placeholder {
    font-size: 4.5rem;
    color: #adb5bd;
    line-height: 1;
}

.profile-readonly-field {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* Navbar user avatar (same photo as Profile page) */
.navbar-user-menu-btn {
    gap: 0.5rem;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    max-width: 100%;
}

.navbar-user-menu-btn:hover,
.navbar-user-menu-btn:focus {
    color: #fff;
    text-decoration: none;
}

.navbar-user-avatar {
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.15);
}

.navbar-user-avatar--placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.95);
}

.navbar-user-name {
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .navbar-user-name {
        max-width: 6rem;
    }
}

@media (max-width: 399.98px) {
    .navbar-user-name {
        display: none;
    }
}

@media (max-width: 991.98px) {
    .profile-page .profile-photo-card {
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    .profile-page .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .profile-page .form-actions .btn {
        width: 100%;
    }
}
