.portal-avatar-crop {
    width: 100%;
}

.portal-avatar-crop__stage {
    width: 100%;
    max-height: min(60vh, 22rem);
    overflow: hidden;
    border-radius: 0.5rem;
    background: #0f172a;
}

.portal-avatar-crop__stage .cropper-container {
    max-height: min(60vh, 22rem);
}

.portal-avatar-crop__stage img {
    display: block;
    max-width: 100%;
}

.portal-avatar-crop__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.75rem;
}

.portal-avatar-crop__actions--modal {
    flex-direction: column;
    align-items: stretch;
}

.portal-avatar-crop__actions--modal .portal-avatar-crop__btn {
    width: 100%;
    justify-content: center;
}

.portal-avatar-crop__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.portal-avatar-crop__btn--primary {
    background-color: var(--portal-primary, #2563eb);
    color: #fff;
}

.portal-avatar-crop__btn--primary:hover {
    background-color: var(--portal-primary-hover, #1d4ed8);
}

.portal-avatar-crop__btn--ghost {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
}

.portal-avatar-crop__btn--ghost:hover {
    background: #f9fafb;
}

/* Inputs de arquivo: invisíveis mas acionáveis via <label for> no mobile */
.portal-avatar-widget__file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.portal-avatar-widget__pickers {
    position: relative;
}

.portal-avatar-widget__picker-btn {
    display: inline-flex;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.portal-avatar-widget__picker-btn--camera {
    background-color: var(--portal-primary, #2563eb);
    color: #fff;
}

.portal-avatar-widget__picker-btn--camera:hover {
    background-color: var(--portal-primary-hover, #1d4ed8);
}

.portal-avatar-widget__picker-btn--gallery {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #1f2937;
}

.portal-avatar-widget__picker-btn--gallery:hover {
    background: #f9fafb;
}

/* —— Foto de perfil (portal) —— */
.portal-avatar-settings__header {
    text-align: center;
}

.portal-avatar-settings__body {
    margin-top: 1.25rem;
}

.portal-avatar-form--page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.portal-avatar-form--modal {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.portal-avatar-widget--stacked {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    text-align: center;
}

.portal-avatar-widget--stacked .portal-avatar-widget__preview {
    width: 6.5rem;
    height: 6.5rem;
    font-size: 1.75rem;
}

@media (min-width: 640px) {
    .portal-avatar-widget--stacked .portal-avatar-widget__preview {
        width: 7.5rem;
        height: 7.5rem;
        font-size: 2rem;
    }
}

.portal-avatar-widget--stacked .portal-avatar-widget__body {
    width: 100%;
    max-width: 20rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.875rem;
}

.portal-avatar-widget--stacked .portal-avatar-widget__pickers {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.625rem;
}

.portal-avatar-widget--stacked .portal-avatar-widget__picker-btn {
    width: 100%;
    min-height: 2.75rem;
    justify-content: center;
    padding: 0.625rem 1rem;
}

.portal-avatar-form__actions--stacked {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.625rem;
    width: 100%;
    max-width: 20rem;
    margin-inline: auto;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.portal-avatar-form__actions--stacked .portal-avatar-form__submit,
.portal-avatar-form__actions--stacked .portal-avatar-form__secondary {
    width: 100%;
    justify-content: center;
    min-height: 2.75rem;
}

.portal-avatar-form__actions--stacked .portal-avatar-form__dismiss {
    width: 100%;
    padding: 0.5rem;
    text-align: center;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.portal-avatar-modal__header {
    margin-bottom: 1.25rem;
    text-align: center;
}

/* Meu perfil: foto + dados (mobile empilhado, desktop lado a lado) */
.portal-profile-edit__grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.portal-profile-edit__grid--details-only .portal-profile-edit__details {
    max-width: 36rem;
}

.portal-profile-details__form {
    width: 100%;
}

@media (max-width: 1023px) {
    .portal-profile-edit__grid:not(.portal-profile-edit__grid--details-only) .portal-profile-edit__avatar {
        padding-bottom: 2rem;
        border-bottom: 1px solid #e5e7eb;
    }
}

@media (min-width: 1024px) {
    .portal-profile-edit__grid:not(.portal-profile-edit__grid--details-only) {
        display: grid;
        grid-template-columns: minmax(15rem, 22rem) minmax(0, 1fr);
        column-gap: 3rem;
        row-gap: 0;
        align-items: stretch;
    }

    .portal-profile-edit__avatar,
    .portal-profile-edit__details {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    .portal-profile-edit__avatar {
        padding-right: 3rem;
        border-right: 1px solid #e5e7eb;
    }

    .portal-profile-edit__avatar .portal-avatar-settings {
        display: flex;
        flex-direction: column;
        flex: 1;
        height: 100%;
    }

    .portal-profile-edit__avatar .portal-avatar-settings__header,
    .portal-profile-edit__details .portal-profile-details__header {
        min-height: 3.75rem;
    }

    .portal-profile-edit__avatar .portal-avatar-settings__body {
        margin-top: 1rem;
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .portal-profile-edit__avatar .portal-avatar-form--page {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .portal-profile-edit__avatar .portal-avatar-settings__header {
        text-align: left;
    }

    .portal-profile-edit__avatar .portal-avatar-widget--stacked {
        align-items: stretch;
        text-align: left;
        gap: 1rem;
    }

    .portal-profile-edit__avatar .portal-avatar-widget--stacked .portal-avatar-widget__preview {
        align-self: center;
        width: 7rem;
        height: 7rem;
    }

    .portal-profile-edit__avatar .portal-avatar-widget--stacked .portal-avatar-widget__body {
        align-items: stretch;
        max-width: none;
        width: 100%;
        gap: 0.75rem;
    }

    .portal-profile-edit__avatar .portal-avatar-widget--stacked .portal-avatar-widget__hint {
        text-align: center;
    }

    .portal-profile-edit__avatar .portal-avatar-form__actions--stacked {
        margin-inline: 0;
        margin-top: auto;
        max-width: none;
        width: 100%;
        padding-top: 0.75rem;
    }

    .portal-profile-edit__details .portal-profile-details {
        display: flex;
        flex-direction: column;
        flex: 1;
        height: 100%;
    }

    .portal-profile-edit__details .portal-profile-details__form {
        flex: 1;
        display: flex;
        flex-direction: column;
        max-width: 26rem;
    }

    .portal-profile-edit__details .portal-profile-details__actions {
        margin-top: auto;
        padding-top: 0.5rem;
    }
}

.portal-avatar-widget--inline {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

@media (min-width: 640px) {
    .portal-avatar-widget--inline {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
    }

    .portal-avatar-widget--inline .portal-avatar-widget__preview {
        width: 6rem;
        height: 6rem;
        font-size: 1.5rem;
    }

    .portal-avatar-widget--inline .portal-avatar-widget__body {
        flex: 1;
        text-align: left;
    }

    .portal-avatar-widget--inline .portal-avatar-widget__pickers {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .portal-avatar-widget--inline .portal-avatar-widget__picker-btn {
        width: auto;
        min-height: 0;
    }
}
