/* EdPack AI Packaging Advisor v1.0.19 - launcher positions + viewport-safe detached panel */
:root {
    --epai-visual-height: 100dvh;
    --epai-visual-top: 0px;
    --epai-visual-left: 0px;
}

.epai-launcher-shell {
    --epai-collision-y: 0px;
    position: fixed;
    z-index: 2147482000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    max-width: min(540px, calc(100vw - 24px));
    font-family: inherit;
    pointer-events: none;
}
.epai-launcher-shell > * { pointer-events: auto; }

.epai-launcher-button {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: min(500px, calc(100vw - 24px));
    padding: 12px 17px;
    border: 0;
    border-radius: 999px;
    background: #0f5132;
    color: #fff;
    box-shadow: 0 12px 34px rgba(0,0,0,.2);
    font: 600 14px/1.35 inherit;
    text-align: left;
    cursor: pointer;
}
.epai-launcher-button:hover { filter: brightness(1.05); }
.epai-launcher-button:focus-visible,
.epai-launcher-teaser__close:focus-visible,
.epai-panel-host__close:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}
.epai-launcher-button__icon {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 31px;
    height: 31px;
    border-radius: 50%;
    background: rgba(255,255,255,.16);
    font-size: 11px;
    letter-spacing: .04em;
}
.epai-launcher-button__text { min-width: 0; }
.epai-launcher-button__text--compact { display: none; }

.epai-launcher-teaser {
    position: relative;
    width: min(430px, calc(100vw - 24px));
    padding: 14px 38px 14px 15px;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 14px;
    background: #fff;
    color: #1d2327;
    box-shadow: 0 14px 38px rgba(0,0,0,.18);
}
.epai-launcher-teaser p { margin: 0; font: 500 14px/1.5 inherit; }
.epai-launcher-teaser__close {
    position: absolute;
    top: 5px;
    right: 7px;
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    color: #50575e;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

/* Panel/backdrop are intentionally viewport-level, never positioned by launcher placement. */
.epai-panel-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483600 !important;
    background: rgba(0,0,0,.18);
    touch-action: none;
}
.epai-panel-host {
    position: fixed !important;
    z-index: 2147483610 !important;
    right: max(18px, env(safe-area-inset-right));
    top: 50%;
    width: min(470px, calc(100vw - 36px));
    height: min(78dvh, 760px);
    max-width: calc(100vw - 36px);
    max-height: calc(100dvh - 36px);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-width: 0;
    margin: 0;
    transform: translateY(-50%);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0,0,0,.28);
    font-family: inherit;
    isolation: isolate;
}
.epai-panel-host *, .epai-panel-host *::before, .epai-panel-host *::after { box-sizing: border-box; }
.epai-panel-host[hidden],
.epai-panel-backdrop[hidden],
.epai-launcher-teaser[hidden] { display: none !important; }

.epai-panel-host__header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 12px 14px;
    border-bottom: 1px solid #e4e4e4;
    background: #fff;
}
.epai-panel-host__header > div {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.epai-panel-host__header strong {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    color: #1d2327;
    font: 700 15px/1.25 inherit;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.epai-panel-host__badge {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    min-width: 29px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: #0f5132;
    color: #fff;
    font: 700 10px/1 inherit;
}
.epai-panel-host__close {
    flex: 0 0 auto;
    appearance: none;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #1d2327;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}
.epai-panel-host__close:hover { background: #f0f0f1; }
.epai-panel-host__loading {
    margin: auto;
    padding: 24px;
    color: #50575e;
    font: 600 14px/1.4 inherit;
    text-align: center;
}
.epai-panel-host__content {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: #fff;
}
.epai-shell--panel-open > .epai-launcher-button,
.epai-shell--panel-open > .epai-launcher-teaser {
    visibility: hidden;
    pointer-events: none;
}
.epai-launcher-shell--hide-desktop { display: none !important; }

@media (min-width: 1025px) {
    .epai-launcher-shell { transform: translateY(var(--epai-collision-y)); }
    .epai-pos-desktop--bottom-right { right: max(20px,env(safe-area-inset-right)); bottom: max(20px,env(safe-area-inset-bottom)); }
    .epai-pos-desktop--bottom-left { left: max(20px,env(safe-area-inset-left)); bottom: max(20px,env(safe-area-inset-bottom)); align-items: flex-start; }
    .epai-pos-desktop--bottom-center,.epai-pos-desktop--bottom-bar { left: 50%; bottom: max(20px,env(safe-area-inset-bottom)); align-items: center; transform: translate(-50%,var(--epai-collision-y)); }
    .epai-pos-desktop--right-middle,.epai-pos-desktop--edge-right { right: max(14px,env(safe-area-inset-right)); top: 62%; transform: translateY(calc(-50% + var(--epai-collision-y))); }
    .epai-pos-desktop--left-middle,.epai-pos-desktop--edge-left { left: max(14px,env(safe-area-inset-left)); top: 62%; align-items: flex-start; transform: translateY(calc(-50% + var(--epai-collision-y))); }
    .epai-pos-desktop--top-right { right: max(20px,env(safe-area-inset-right)); top: 90px; flex-direction: column-reverse; }
    .epai-pos-desktop--top-left { left: max(20px,env(safe-area-inset-left)); top: 90px; align-items: flex-start; flex-direction: column-reverse; }
    .epai-pos-desktop--right-middle .epai-launcher-button__text--full,.epai-pos-desktop--left-middle .epai-launcher-button__text--full,.epai-pos-desktop--edge-right .epai-launcher-button__text--full,.epai-pos-desktop--edge-left .epai-launcher-button__text--full { display: none; }
    .epai-pos-desktop--right-middle .epai-launcher-button__text--compact,.epai-pos-desktop--left-middle .epai-launcher-button__text--compact,.epai-pos-desktop--edge-right .epai-launcher-button__text--compact,.epai-pos-desktop--edge-left .epai-launcher-button__text--compact { display: inline; }
    .epai-pos-desktop--edge-right { right: 0; }
    .epai-pos-desktop--edge-left { left: 0; }
    .epai-pos-desktop--edge-right .epai-launcher-button { border-radius: 999px 0 0 999px; padding-right: 13px; }
    .epai-pos-desktop--edge-left .epai-launcher-button { border-radius: 0 999px 999px 0; padding-left: 13px; }
    .epai-pos-desktop--bottom-bar .epai-launcher-button { min-width: min(520px,calc(100vw - 48px)); justify-content: center; }
    .epai-pos-desktop--bottom-left ~ .epai-panel-host,
    .epai-pos-desktop--left-middle ~ .epai-panel-host,
    .epai-pos-desktop--edge-left ~ .epai-panel-host,
    .epai-pos-desktop--top-left ~ .epai-panel-host { right: auto; left: max(18px,env(safe-area-inset-left)); }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .epai-launcher-shell--hide-desktop { display: flex !important; }
    .epai-launcher-shell--hide-tablet { display: none !important; }
    .epai-launcher-shell { transform: translateY(var(--epai-collision-y)); }
    .epai-pos-tablet--bottom-right { right: 16px; bottom: 16px; }
    .epai-pos-tablet--bottom-left { left: 16px; bottom: 16px; align-items: flex-start; }
    .epai-pos-tablet--bottom-center,.epai-pos-tablet--bottom-bar { left: 50%; bottom: 16px; align-items: center; transform: translate(-50%,var(--epai-collision-y)); }
    .epai-pos-tablet--right-middle,.epai-pos-tablet--edge-right { right: 10px; top: 62%; transform: translateY(calc(-50% + var(--epai-collision-y))); }
    .epai-pos-tablet--left-middle,.epai-pos-tablet--edge-left { left: 10px; top: 62%; align-items: flex-start; transform: translateY(calc(-50% + var(--epai-collision-y))); }
    .epai-pos-tablet--top-right { right: 16px; top: 78px; flex-direction: column-reverse; }
    .epai-pos-tablet--top-left { left: 16px; top: 78px; align-items: flex-start; flex-direction: column-reverse; }
    .epai-pos-tablet--right-middle .epai-launcher-button__text--full,.epai-pos-tablet--left-middle .epai-launcher-button__text--full,.epai-pos-tablet--edge-right .epai-launcher-button__text--full,.epai-pos-tablet--edge-left .epai-launcher-button__text--full { display: none; }
    .epai-pos-tablet--right-middle .epai-launcher-button__text--compact,.epai-pos-tablet--left-middle .epai-launcher-button__text--compact,.epai-pos-tablet--edge-right .epai-launcher-button__text--compact,.epai-pos-tablet--edge-left .epai-launcher-button__text--compact { display: inline; }
    .epai-pos-tablet--edge-right { right: 0; }
    .epai-pos-tablet--edge-left { left: 0; }
    .epai-pos-tablet--edge-right .epai-launcher-button { border-radius: 999px 0 0 999px; }
    .epai-pos-tablet--edge-left .epai-launcher-button { border-radius: 0 999px 999px 0; }
    .epai-pos-tablet--bottom-bar .epai-launcher-button { min-width: min(520px,calc(100vw - 32px)); justify-content: center; }
}

@media (max-width: 768px) {
    html.epai-panel-open, body.epai-panel-open {
        overflow: hidden !important;
        overscroll-behavior: none;
    }
    .epai-launcher-shell--hide-desktop { display: flex !important; }
    .epai-launcher-shell--hide-mobile { display: none !important; }
    .epai-launcher-shell { max-width: calc(100vw - 12px); transform: translateY(var(--epai-collision-y)); }
    .epai-shell--panel-open { transform: none !important; }
    .epai-launcher-button { max-width: min(94vw,430px); padding: 10px 13px; font-size: 12.5px; }
    .epai-launcher-teaser { width: min(92vw,430px); }
    .epai-pos-mobile--bottom-right { right: 10px; bottom: max(12px,env(safe-area-inset-bottom)); }
    .epai-pos-mobile--bottom-left { left: 10px; bottom: max(12px,env(safe-area-inset-bottom)); align-items: flex-start; }
    .epai-pos-mobile--bottom-center,.epai-pos-mobile--bottom-bar { left: 50%; bottom: max(12px,env(safe-area-inset-bottom)); align-items: center; transform: translate(-50%,var(--epai-collision-y)); }
    .epai-pos-mobile--right-middle,.epai-pos-mobile--edge-right { right: 6px; top: 64%; transform: translateY(calc(-50% + var(--epai-collision-y))); }
    .epai-pos-mobile--left-middle,.epai-pos-mobile--edge-left { left: 6px; top: 64%; align-items: flex-start; transform: translateY(calc(-50% + var(--epai-collision-y))); }
    .epai-pos-mobile--top-right { right: 10px; top: max(74px,calc(env(safe-area-inset-top) + 58px)); flex-direction: column-reverse; }
    .epai-pos-mobile--top-left { left: 10px; top: max(74px,calc(env(safe-area-inset-top) + 58px)); align-items: flex-start; flex-direction: column-reverse; }
    .epai-pos-mobile--right-middle .epai-launcher-button__text--full,.epai-pos-mobile--left-middle .epai-launcher-button__text--full,.epai-pos-mobile--edge-right .epai-launcher-button__text--full,.epai-pos-mobile--edge-left .epai-launcher-button__text--full { display: none; }
    .epai-pos-mobile--right-middle .epai-launcher-button__text--compact,.epai-pos-mobile--left-middle .epai-launcher-button__text--compact,.epai-pos-mobile--edge-right .epai-launcher-button__text--compact,.epai-pos-mobile--edge-left .epai-launcher-button__text--compact { display: inline; }
    .epai-pos-mobile--edge-right { right: 0; }
    .epai-pos-mobile--edge-left { left: 0; }
    .epai-pos-mobile--edge-right .epai-launcher-button { border-radius: 999px 0 0 999px; padding-right: 11px; }
    .epai-pos-mobile--edge-left .epai-launcher-button { border-radius: 0 999px 999px 0; padding-left: 11px; }
    .epai-pos-mobile--bottom-bar { left: 8px; right: 8px; bottom: max(8px,env(safe-area-inset-bottom)); max-width: none; transform: translateY(var(--epai-collision-y)); }
    .epai-pos-mobile--bottom-bar .epai-launcher-button { width: 100%; max-width: none; justify-content: center; }

    .epai-panel-backdrop {
        inset: 0 !important;
        background: rgba(0,0,0,.42);
    }
    .epai-panel-host {
        left: max(0px, env(safe-area-inset-left)) !important;
        right: max(0px, env(safe-area-inset-right)) !important;
        top: calc(var(--epai-visual-top, 0px) + 6px) !important;
        bottom: auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        height: calc(var(--epai-visual-height, 100dvh) - 6px - env(safe-area-inset-bottom)) !important;
        max-height: calc(var(--epai-visual-height, 100dvh) - 6px - env(safe-area-inset-bottom)) !important;
        margin: 0 !important;
        transform: none !important;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
        border-radius: 18px 18px 0 0;
    }
    .epai-panel-host__header {
        min-height: 56px;
        padding: 9px max(12px,env(safe-area-inset-right)) 9px max(12px,env(safe-area-inset-left));
    }
    .epai-panel-host__header strong {
        display: -webkit-box;
        overflow: hidden;
        font-size: 14px;
        line-height: 1.25;
        text-overflow: ellipsis;
        white-space: normal;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }
    .epai-panel-host__close { width: 44px; height: 44px; }
    .epai-panel-host__content {
        width: 100%;
        max-width: 100%;
        padding-bottom: env(safe-area-inset-bottom);
    }
}

@media (max-width: 420px) {
    .epai-panel-host { border-radius: 16px 16px 0 0; }
    .epai-panel-host__header { gap: 8px; }
    .epai-panel-host__badge { min-width: 28px; }
}

@media (prefers-reduced-motion: no-preference) {
    .epai-launcher-button,.epai-launcher-teaser,.epai-panel-host { transition: transform .18s ease,opacity .18s ease,box-shadow .18s ease; }
}
