.c-popup {
    position: fixed;
    inset: 0;
    z-index: 110;
}

.c-popup[hidden] {
    display: none;
}

.c-popup__backdrop {
    position: absolute;
    inset: 0;
    background: var(--color-overlay-backdrop);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity linear 0.2s;
}

.c-popup__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.c-popup__surface {
    width: 90%;
    max-width: 1200px;
    height: 90%;
    max-height: 700px;
    border: 1px solid var(--color-border-primary);
    border-radius: 12px;
    background: var(--color-surface-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity linear 0.2s, transform linear 0.2s;
}

.c-popup[data-popup-state="opening"] .c-popup__backdrop,
.c-popup[data-popup-state="opened"] .c-popup__backdrop {
    opacity: 1;
}

.c-popup[data-popup-state="opening"] .c-popup__surface,
.c-popup[data-popup-state="opened"] .c-popup__surface {
    opacity: 1;
    transform: translateY(0);
}

.c-popup__header {
    width: 100%;
    height: 48px;
    min-height: 48px;
    padding: 0 16px;
    border-bottom: 1px solid var(--color-border-primary);
    background: var(--color-surface-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.c-popup__title {
    margin: 0;
    color: var(--color-text-primary);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.2;
}

.c-popup__close {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: var(--color-surface-primary);
    color: var(--color-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background linear 0.2s, color linear 0.2s;
}

.c-popup__close:hover {
    background: var(--color-surface-secondary);
    color: var(--color-text-primary);
}

.c-popup__close:focus-visible {
    outline: 2px solid var(--color-brand-primary);
    outline-offset: 2px;
}

.c-popup__close-icon {
    width: 10px;
    height: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
}

.c-popup__close-icon svg {
    width: 10px;
    height: 10px;
    display: block;
}

.c-popup__close-icon path {
    fill: currentColor;
}

.c-popup__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: auto;
    background: var(--color-surface-primary);
}

html.is-popup-scroll-locked,
body.is-popup-scroll-locked {
    height: 100%;
    overflow: hidden;
}

@media (max-width: 768px) {
    .c-popup__dialog {
        padding: 0;
        align-items: flex-end;
    }

    .c-popup__surface {
        width: 100%;
        max-width: none;
        height: 0;
        max-height: none;
        border: 0;
        outline: 1px solid var(--color-border-primary);
        outline-offset: -1px;
        border-radius: 12px 12px 0 0;
        transform: translateY(0);
        transition: opacity linear 0.2s, height linear 0.2s;
    }

    .c-popup[data-popup-state="opening"] .c-popup__surface,
    .c-popup[data-popup-state="opened"] .c-popup__surface {
        height: 90%;
    }
}

@media (min-width: 769px) {
    .app-shell.is-popup-scroll-locked {
        height: 100vh;
        min-height: 100vh;
        overflow: hidden;
    }

    .app-shell__body.is-popup-scroll-locked,
    .app-shell__main.is-popup-scroll-locked,
    .app-shell__content.is-popup-scroll-locked {
        min-height: 0;
        overflow: hidden;
    }
}
