.bookshelf-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .55rem;
    position: relative;

    justify-content: center;
    width: 100%;
}

.bookshelf-actions .rm-button {
    width: auto;
}

.bookshelf-actions__add {
    min-height: 40px;

    padding: .55rem 1rem;

    border-radius: 999px;

    font-size: .9rem;
    font-weight: 600;
    letter-spacing: .01em;
}

.bookshelf-actions__add::before {
    content: '\2661';

    margin-right: .35rem;

    font-size: 1rem;
    line-height: 1;
}

.bookshelf-after-add {
    display: flex;
    flex-direction: row;
    align-items: center;

    gap: 0;

    width: 100%;

    justify-content: center;
}

.bookshelf-after-add[hidden] {
    display: none !important;
}

.bookshelf-status-link {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-height: 40px;

    padding:
        .5rem
        1rem;

    border-radius: 999px;

    border: 1px solid
        color-mix(
            in srgb,
            var(--color-accent) 28%,
            #fff
        );

    background:
        color-mix(
            in srgb,
            var(--color-accent-soft) 78%,
            #fff
        );

    color:
        color-mix(
            in srgb,
            var(--color-accent) 74%,
            var(--color-text)
        );

    font-size: .875rem;
    font-weight: 600;

    text-decoration: none;

    transition:
        border-color .2s ease,
        background-color .2s ease,
        transform .2s ease;
}

.bookshelf-status-link::before {
    content: '\2665';

    margin-right: .35rem;

    font-size: .75rem;
}

.bookshelf-status-link:hover {
    background:
        color-mix(
            in srgb,
            var(--color-accent-soft) 90%,
            #fff
        );

    border-color:
        color-mix(
            in srgb,
            var(--color-accent) 36%,
            #fff
        );

    transform: translateY(-1px);
}

.bookshelf-status-link:focus-visible {
    outline: 2px solid
        color-mix(
            in srgb,
            var(--color-accent) 45%,
            #fff
        );

    outline-offset: 2px;
}

.bookshelf-login-panel {
    width: min(22rem, 100%);

    padding: .85rem .9rem;

    border: 1px solid rgba(141, 95, 60, 0.2);
    border-radius: 14px;

    background: rgba(255, 255, 255, 0.96);

    box-shadow: 0 12px 26px rgba(77, 50, 30, 0.1);
}

.bookshelf-login-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .55rem;

    margin-bottom: .45rem;
}

.bookshelf-login-panel__title {
    margin: 0;

    font-size: .86rem;
    font-weight: 700;
    color: var(--color-text);
}

.bookshelf-login-panel__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;

    border: 1px solid rgba(141, 95, 60, 0.2);
    border-radius: 999px;

    background: #fff;
    color: var(--color-muted);

    font-size: 1.1rem;
    line-height: 1;

    cursor: pointer;
}

.bookshelf-login-panel__close:hover,
.bookshelf-login-panel__close:focus-visible {
    color: var(--color-accent);
    border-color: rgba(141, 95, 60, 0.35);
}

.bookshelf-login-form {
    display: grid;
    gap: .45rem;
}

.bookshelf-login-form label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--color-muted);
}

.bookshelf-login-form input[type="text"],
.bookshelf-login-form input[type="password"] {
    width: 100%;
    min-height: 38px;

    padding: .45rem .6rem;

    border: 1px solid var(--color-border);
    border-radius: 10px;

    background: #fff;
    color: var(--color-text);
}

.bookshelf-login-form__remember {
    display: inline-flex;
    align-items: center;
    gap: .35rem;

    margin-top: .2rem;

    font-size: .76rem;
}

.bookshelf-login-form__submit {
    margin-top: .2rem;
    width: 100%;
}

.bookshelf-login-form__register-link {
    margin: .25rem 0 0;

    text-align: center;
}

.bookshelf-login-form__register-link a {
    font-size: .72rem;
    color: var(--color-accent);
    text-decoration: none;
}

.bookshelf-login-form__register-link a:hover,
.bookshelf-login-form__register-link a:focus-visible {
    text-decoration: underline;
}

.bookshelf-login-panel__links {
    display: flex;
    justify-content: space-between;
    gap: .6rem;

    margin-top: .55rem;
}

.bookshelf-login-panel__links a {
    font-size: .76rem;
    color: var(--color-accent);
    text-decoration: none;
}

.bookshelf-login-panel__links a:hover,
.bookshelf-login-panel__links a:focus-visible {
    text-decoration: underline;
}

.bookshelf-login-form__status {
    margin: .2rem 0 0;

    font-size: .76rem;
    line-height: 1.35;
}

.bookshelf-login-form__status.is-error {
    color: #8d2f2f;
}

.bookshelf-login-form__status.is-success {
    color: #2f6b3b;
}

.product-card .bookshelf-actions {
    overflow: visible;
}

.product-card .bookshelf-login-panel {
    position: absolute;
    top: calc(100% + .45rem);
    left: 50%;
    transform: translateX(-50%);

    width: min(21rem, calc(100vw - 2rem));

    z-index: 80;
}

.product-hero .bookshelf-actions {
    overflow: visible;

    z-index: 120;
}

.product-hero .bookshelf-login-panel {
    position: absolute;
    top: calc(100% + .45rem);
    left: 50%;
    transform: translateX(-50%);

    width: min(22rem, calc(100vw - 2rem));

    z-index: 160;
}

@media (max-width: 640px) {

    .bookshelf-login-panel--detached {
        --rm-login-header-offset: 72px;
        --rm-login-adminbar-offset: 0px;
    }

    body.admin-bar .bookshelf-login-panel--detached {
        --rm-login-adminbar-offset: 46px;
    }

    .bookshelf-login-panel--detached {
        position: fixed;
        top: calc(
            env(safe-area-inset-top)
            + var(--rm-login-header-offset)
            + var(--rm-login-adminbar-offset)
            + .35rem
        );
        left: 50%;

        transform: translateX(-50%);

        width: min(22rem, calc(100vw - 1rem));
        max-height: calc(
            100dvh
            - env(safe-area-inset-top)
            - env(safe-area-inset-bottom)
            - var(--rm-login-header-offset)
            - var(--rm-login-adminbar-offset)
            - .9rem
        );

        overflow-y: auto;
        overscroll-behavior: contain;

        padding-bottom: calc(.95rem + env(safe-area-inset-bottom));

        z-index: 10020;
    }

    .product-card .bookshelf-login-panel--detached,
    .product-hero .bookshelf-login-panel--detached {
        position: fixed;
        top: calc(
            env(safe-area-inset-top)
            + var(--rm-login-header-offset)
            + var(--rm-login-adminbar-offset)
            + .35rem
        );
        left: 50%;
        transform: translateX(-50%);

        z-index: 1600;
    }

    .bookshelf-login-panel__links {
        margin-top: .7rem;
        padding-top: .15rem;
    }
}