/* APD 3.3.0 — compact OAuth and marketplace account experience */
.homey-google-login.is-apd-auth-loading,
.homey-facebook-login.is-apd-auth-loading {
    opacity: .72;
    pointer-events: none;
}

.apd-auth-language-hidden,
body.apd-user-authenticated .apd-auth-language-hidden {
    display: none !important;
}

.apd-auth-account-controls {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
}

#apd-auth-profile-button.apd-auth-account-profile {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    display: inline-grid !important;
    place-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #f7e3f4 !important;
    color: #a61b8f !important;
    text-decoration: none !important;
    font-family: Inter, Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    box-shadow: none !important;
    transition: transform .18s ease, box-shadow .18s ease !important;
}

#apd-auth-profile-button.apd-auth-account-profile:hover,
#apd-auth-profile-button.apd-auth-account-profile:focus-visible {
    color: #8b1478 !important;
    box-shadow: 0 5px 16px rgba(166, 27, 143, .16) !important;
    transform: translateY(-1px) !important;
    outline: none !important;
}

#apd5-account-button.apd-auth-account-button {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline-grid !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #f2f2f2 !important;
    box-shadow: none !important;
    transition: box-shadow .18s ease, background-color .18s ease, transform .18s ease !important;
}

#apd5-account-button.apd-auth-account-button:hover,
#apd5-account-button.apd-auth-account-button[aria-expanded="true"],
#apd5-account-button.apd-auth-account-button:focus-visible {
    background: #e9e9e9 !important;
    box-shadow: 0 5px 16px rgba(13, 43, 108, .12) !important;
    transform: translateY(-1px) !important;
    outline: none !important;
}

#apd5-account-button.apd-auth-account-button > img {
    display: none !important;
}

#apd5-account-button.apd-auth-account-button > svg,
#apd5-account-button.apd-auth-account-button > .apd5-icon {
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #222 !important;
}

#apd5-account-button.apd-auth-account-button > .apd5-icon {
    display: grid !important;
    place-items: center !important;
}

#apd5-account-button.apd-auth-account-button > .apd5-icon svg {
    width: 18px !important;
    height: 18px !important;
}

#apd5-account-menu.apd-auth-account-menu {
    right: 0;
    width: 284px;
    max-height: min(720px, calc(100vh - 92px));
    padding: 9px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid #e4e8ed;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(22, 34, 53, .18);
}

#apd5-account-menu .apd-auth-account-user {
    margin: 0;
    padding: 10px 10px 8px;
}

#apd5-account-menu .apd-auth-account-user img {
    width: 42px;
    height: 42px;
}

#apd5-account-menu .apd-auth-account-user strong {
    color: #17243a;
    font-size: 14px;
}

#apd5-account-menu .apd-auth-account-user span {
    max-width: 185px;
    color: #758297;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#apd5-account-menu .apd-auth-menu-link {
    width: 100%;
    min-height: 42px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #26364e;
    text-align: left;
    text-decoration: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 520;
    cursor: pointer;
}

#apd5-account-menu .apd-auth-menu-link:hover,
#apd5-account-menu .apd-auth-menu-link:focus-visible {
    background: #f4f6f8;
    color: #0d2b6c;
    outline: none;
}

#apd5-account-menu .apd-auth-menu-link.is-host-mode {
    font-weight: 750;
}

#apd5-account-menu .apd-auth-menu-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    display: grid;
    place-items: center;
}

#apd5-account-menu .apd-auth-menu-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#apd5-account-menu .apd-auth-menu-divider {
    margin: 7px 0;
    border: 0;
    border-top: 1px solid #e7ebef;
}

@media (max-width: 767px) {
    #apd-auth-profile-button.apd-auth-account-profile,
    #apd5-account-button.apd-auth-account-button {
        width: 40px !important;
        min-width: 40px !important;
        height: 40px !important;
    }

    #apd5-account-menu.apd-auth-account-menu {
        position: fixed;
        top: calc(62px + env(safe-area-inset-top));
        right: 12px;
        left: 12px;
        width: auto;
        max-height: calc(100dvh - 82px - env(safe-area-inset-top));
        border-radius: 18px;
        padding: 10px;
    }

    #apd5-account-menu .apd-auth-menu-link {
        min-height: 48px;
        font-size: 14px;
    }
}

/* APD 3.8.0 — controles de perfil y menú compactos, separados y alineados. */
.apd5-header-actions.apd-auth-account-controls {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    width: auto !important;
    min-width: 0 !important;
}

.apd5-header-actions.apd-auth-account-controls #apd5-host-trigger {
    margin: 0 3px 0 0 !important;
    padding: 9px 5px !important;
    white-space: nowrap !important;
}

.apd5-header-actions.apd-auth-account-controls #apd-auth-profile-button,
.apd5-header-actions.apd-auth-account-controls #apd5-account-button {
    flex: 0 0 40px !important;
}


/* APD 3.8.4 — foto de perfil real en la portada y controles alineados. */
#apd-auth-profile-button.apd-auth-account-profile {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    overflow: hidden !important;
    vertical-align: middle !important;
    transform: none !important;
}

#apd-auth-profile-button.apd-auth-account-profile.has-photo {
    background: #fff !important;
    color: transparent !important;
    border: 1px solid #e6e6e6 !important;
}

#apd-auth-profile-button.apd-auth-account-profile > img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    object-fit: cover !important;
    object-position: center !important;
}

.apd5-header-actions.apd-auth-account-controls {
    min-height: 44px !important;
    height: 44px !important;
    line-height: 1 !important;
}

.apd5-header-actions.apd-auth-account-controls #apd-auth-profile-button,
.apd5-header-actions.apd-auth-account-controls #apd5-account-button {
    position: relative !important;
    inset: auto !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    align-self: center !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    transform: none !important;
}

.apd5-header-actions.apd-auth-account-controls #apd5-account-button > .apd5-icon,
.apd5-header-actions.apd-auth-account-controls #apd5-account-button > svg {
    position: static !important;
    inset: auto !important;
    display: grid !important;
    place-items: center !important;
    margin: 0 !important;
    transform: none !important;
}

.apd5-header-actions.apd-auth-account-controls #apd5-account-button > .apd5-icon svg {
    display: block !important;
    margin: 0 auto !important;
}

/* APD 3.8.7 — centrar con precisión las tres rayitas dentro de su botón. */
.apd5-header-actions.apd-auth-account-controls #apd5-account-button.apd-auth-account-button {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1 !important;
}

.apd5-header-actions.apd-auth-account-controls #apd5-account-button.apd-auth-account-button > .apd5-icon,
.apd5-header-actions.apd-auth-account-controls #apd5-account-button.apd-auth-account-button > svg {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    width: 18px !important;
    min-width: 18px !important;
    height: 18px !important;
    min-height: 18px !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: translate(-50%, -50%) !important;
    transform-origin: 50% 50% !important;
    overflow: visible !important;
}

.apd5-header-actions.apd-auth-account-controls #apd5-account-button.apd-auth-account-button > .apd5-icon path,
.apd5-header-actions.apd-auth-account-controls #apd5-account-button.apd-auth-account-button > svg path {
    transform: none !important;
    transform-origin: center !important;
}
