/* Deploy Agent: Typeform layout in almost full-page panel */
.deploy-agent {
    --da-ink: var(--lumina-black, #262626);
    --da-muted: var(--lumina-darkergrey, #616161);
    --da-line: #e8e8e6;
    --da-blue: #6464ff;
    --da-paper: #fcfafa;

    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 3.5vh, 40px) clamp(12px, 3vw, 32px);
    background: rgba(38, 38, 38, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    box-sizing: border-box;
}

.deploy-agent.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.deploy-agent__panel {
    position: relative;
    width: min(1180px, 100%);
    height: min(900px, 100%);
    background: var(--da-paper);
    border-radius: 2px;
    box-shadow: 0 28px 100px rgba(38, 38, 38, 0.28), 0 8px 24px rgba(38, 38, 38, 0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
}

.deploy-agent__panel::-webkit-scrollbar,
.deploy-agent__stage::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.deploy-agent__bar {
    height: 3px;
    background: var(--da-line);
    flex-shrink: 0;
}

.deploy-agent__bar-fill {
    height: 100%;
    width: 20%;
    background: var(--da-blue);
    transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.deploy-agent__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 5;
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--da-muted);
    font-size: 30px;
    line-height: 1;
    width: 40px;
    height: 40px;
    cursor: pointer;
}

.deploy-agent__close:hover {
    color: var(--da-ink);
}

/* Full clean ack frame (not overlay) */
.deploy-agent__ack-frame {
    display: none;
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--da-paper);
    z-index: 2;
}

.deploy-agent__ack-frame.is-visible {
    display: flex;
    animation: da-enter 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.deploy-agent__ack-frame p {
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 520;
    letter-spacing: -0.03em;
    color: var(--da-blue);
    text-align: center;
}

.deploy-agent__stage {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: clamp(36px, 5vh, 64px) clamp(24px, 5vw, 64px) clamp(24px, 3.5vh, 40px);
    display: flex;
    flex-direction: column;
}

.deploy-agent__stage.is-hidden {
    display: none;
}

.deploy-agent__step {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    width: 100%;
    max-width: 640px;
    margin: auto;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    text-align: center;
}

.deploy-agent__step.is-active {
    display: flex;
    animation: da-enter 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.deploy-agent__step[data-deploy-step="models"] {
    max-width: 920px;
    justify-content: flex-start;
    padding-top: 8px;
    overflow: hidden;
    gap: 12px;
}

.deploy-agent__step[data-deploy-step="models"] .deploy-agent__question {
    font-size: clamp(22px, 3vw, 32px);
}

.deploy-agent__step[data-deploy-step="workflow"] {
    max-width: 520px;
    justify-content: flex-start;
    padding-top: clamp(12px, 4vh, 40px);
}

@keyframes da-enter {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.deploy-agent__kicker {
    margin: 0;
    font-size: 12px;
    font-weight: 520;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--da-blue);
}

.deploy-agent__question {
    margin: 0;
    font-size: clamp(26px, 3.6vw, 38px);
    font-weight: 520;
    line-height: 1.18;
    letter-spacing: -0.03em;
    color: var(--da-ink);
    text-align: center;
    max-width: 16em;
}

.deploy-agent__sub {
    margin: -6px 0 0;
    font-size: 15px;
    font-weight: 520;
    color: var(--da-blue);
    text-align: center;
}

.deploy-agent__field {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

/* Scope: ChatGPT-like composer, still Typeform-centered */
.deploy-agent__composer {
    width: 100%;
    max-width: 560px;
    border: 1px solid var(--da-line);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(38, 38, 38, 0.06);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.deploy-agent__composer-input {
    width: 100%;
    border: 0;
    outline: none;
    resize: none;
    min-height: 72px;
    max-height: 160px;
    font-family: "Bagoss", sans-serif;
    font-size: 16px;
    line-height: 1.45;
    color: var(--da-ink);
    background: transparent;
    padding: 0;
}

.deploy-agent__composer-input::placeholder {
    color: #a3a3a1;
    font-size: 14px;
    line-height: 1.4;
}

.deploy-agent__ok {
    appearance: none;
    border: 0;
    background: var(--da-blue);
    color: #fff;
    border-radius: 999px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.deploy-agent__ok:hover:not(:disabled) {
    transform: translateY(-1px);
}

.deploy-agent__ok:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

.deploy-agent__ok--label {
    width: auto;
    border-radius: 2px;
    padding: 12px 22px;
    font-family: "Bagoss", sans-serif;
    font-size: 15px;
    font-weight: 520;
}

.deploy-agent__enter {
    margin: 0;
    font-size: 14px;
    color: #b7b7b7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.deploy-agent__enter strong {
    font-weight: 620;
    color: inherit;
}

.deploy-agent__enter-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border: 1px solid #e0e0de;
    border-bottom-width: 2px;
    border-radius: 4px;
    background: #f7f7f5;
    color: inherit;
    font-size: 13px;
    font-weight: 520;
    line-height: 1;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.deploy-agent__enter.is-ready {
    color: var(--da-muted);
}

.deploy-agent__enter.is-ready strong {
    color: var(--da-ink);
}

.deploy-agent__enter.is-ready .deploy-agent__enter-key {
    border-color: #d4d4d2;
    background: #fff;
    color: var(--da-ink);
}

/* Model grid */
.deploy-agent__models {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 4px;
    text-align: left;
    min-height: 0;
    overflow: hidden;
}

.deploy-agent__model {
    appearance: none;
    text-align: left;
    border: 1px solid var(--da-line);
    border-radius: 2px;
    background: #fff;
    padding: 12px 14px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.deploy-agent__model:hover {
    border-color: #cfcfe8;
}

.deploy-agent__model.is-selected {
    border: 2px solid var(--da-blue);
    background: #f7f7ff;
    padding: 11px 13px 11px;
}

.deploy-agent__model-top {
    display: flex;
    align-items: center;
}

.deploy-agent__model-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f0f0ff;
    color: var(--da-blue);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.deploy-agent__model h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 520;
    color: var(--da-ink);
    text-align: left;
    letter-spacing: -0.02em;
}

.deploy-agent__model p {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
    color: var(--da-muted);
    text-align: left;
}

.deploy-agent__step-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 16px;
}

.deploy-agent__continue {
    display: none;
}

/* Vertical workflow */
.deploy-agent__workflow {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-top: 12px;
    text-align: left;
}

.deploy-agent__flow {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

.deploy-agent__flow-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.deploy-agent__flow-step {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--da-line);
    background: #fff;
    border-radius: 2px;
    padding: 14px 16px;
    min-height: 56px;
    box-shadow: 0 6px 18px rgba(38, 38, 38, 0.05);
    position: relative;
}

.deploy-agent__flow-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f4f4f2;
    color: var(--da-muted);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.deploy-agent__flow-copy {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    flex: 1;
    font-size: 15px;
    color: var(--da-muted);
}

.deploy-agent__flow-copy strong {
    font-weight: 520;
    color: var(--da-ink);
}

.deploy-agent__flow-copy span {
    font-size: 13px;
    color: var(--da-muted);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deploy-agent__flow-remove {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--da-muted);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 2px;
    margin-left: auto;
}

.deploy-agent__flow-remove:hover {
    color: var(--da-ink);
}

.deploy-agent__flow-connector {
    width: 1px;
    height: 28px;
    background: #d9d9d6;
    flex-shrink: 0;
}

.deploy-agent__add-step {
    appearance: none;
    width: 100%;
    border: 1.5px dashed var(--da-blue);
    background: transparent;
    color: var(--da-blue);
    border-radius: 2px;
    padding: 16px 18px;
    font-family: "Bagoss", sans-serif;
    font-size: 15px;
    font-weight: 520;
    cursor: pointer;
    min-height: 56px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.deploy-agent__add-step:hover:not(:disabled) {
    background: #f7f7ff;
}

.deploy-agent__add-step:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.deploy-agent__picker {
    display: none;
    width: 100%;
    margin-top: 12px;
    border: 1px solid var(--da-line);
    border-radius: 2px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(38, 38, 38, 0.08);
    overflow: hidden;
}

.deploy-agent__picker.is-open {
    display: block;
    animation: da-enter 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.deploy-agent__picker button {
    appearance: none;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--da-line);
    background: #fff;
    text-align: left;
    padding: 14px 16px;
    font-family: "Bagoss", sans-serif;
    font-size: 15px;
    color: var(--da-ink);
    cursor: pointer;
}

.deploy-agent__picker button:last-child {
    border-bottom: 0;
}

.deploy-agent__picker button:hover {
    background: #f7f7ff;
    color: var(--da-blue);
}

.deploy-agent__instruction {
    display: none;
    width: 100%;
    margin-top: 12px;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.deploy-agent__instruction.is-open {
    display: flex;
}

.deploy-agent__instruction label {
    font-size: 14px;
    color: var(--da-muted);
}

.deploy-agent__instruction textarea {
    width: 100%;
    min-height: 88px;
    border: 1px solid var(--da-line);
    border-radius: 2px;
    padding: 12px 14px;
    font-family: "Bagoss", sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: var(--da-ink);
    resize: vertical;
    box-sizing: border-box;
}

.deploy-agent__instruction textarea:focus {
    outline: none;
    border-color: var(--da-blue);
}

.deploy-agent__form {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-top: 8px;
    text-align: left;
}

.deploy-agent__form input {
    width: 100%;
    border: 0;
    border-bottom: 2px solid var(--da-ink);
    border-radius: 0;
    background: transparent;
    padding: 14px 0;
    font-family: "Bagoss", sans-serif;
    font-size: 18px;
    color: var(--da-ink);
    outline: none;
    box-sizing: border-box;
}

.deploy-agent__form input:focus {
    border-bottom-color: var(--da-blue);
}

.deploy-agent__form input::placeholder {
    color: #b7b7b7;
}

.deploy-agent__hint {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--da-muted);
    text-align: center;
    max-width: 28em;
}

.deploy-agent__form .deploy-agent__hint {
    text-align: left;
}

.deploy-agent__done-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
}

.deploy-agent__done-actions .button-hero-outline {
    appearance: none;
    cursor: pointer;
    font: inherit;
}

body.deploy-agent-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    .deploy-agent__models {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .deploy-agent {
        padding: 0;
        align-items: stretch;
    }

    .deploy-agent__panel {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
    }

    .deploy-agent__stage {
        padding: 56px 16px 24px;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .deploy-agent__stage::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }

    .deploy-agent__step {
        justify-content: flex-start;
        flex: 0 0 auto;
        min-height: auto;
        overflow: visible;
        max-width: 100%;
        margin: 0;
        gap: 14px;
        padding-bottom: 88px;
    }

    .deploy-agent__step[data-deploy-step="models"],
    .deploy-agent__step[data-deploy-step="workflow"] {
        max-width: 100%;
        padding-top: 0;
        overflow: visible;
    }

    .deploy-agent__question {
        font-size: clamp(22px, 7vw, 28px);
        max-width: none;
    }

    .deploy-agent__field {
        align-items: stretch;
    }

    .deploy-agent__composer {
        max-width: none;
    }

    .deploy-agent__models {
        grid-template-columns: 1fr;
        gap: 8px;
        overflow: visible;
    }

    .deploy-agent__model {
        flex-shrink: 0;
        min-height: auto;
        height: auto;
        padding: 14px;
        gap: 8px;
        box-sizing: border-box;
    }

    .deploy-agent__model.is-selected {
        padding: 13px;
    }

    .deploy-agent__model h3 {
        font-size: 16px;
    }

    .deploy-agent__model p {
        font-size: 13px;
        line-height: 1.4;
    }

    .deploy-agent__enter {
        display: none;
    }

    .deploy-agent__composer-input::placeholder {
        font-size: 13px;
    }

    .deploy-agent__step-actions {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 16px;
        z-index: 6;
        margin: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0 16px;
        background: transparent;
        pointer-events: none;
    }

    .deploy-agent__step-actions .deploy-agent__continue {
        pointer-events: auto;
        display: inline-flex;
        width: 100%;
        max-width: 360px;
        justify-content: center;
        align-items: center;
        min-height: 48px;
        margin: 0 auto;
        background: #6464ff !important;
        color: #fff !important;
        opacity: 1 !important;
        border: 0;
        border-radius: 2px;
        box-shadow: 0 10px 28px rgba(38, 38, 38, 0.18);
    }

    .deploy-agent__step-actions .deploy-agent__continue:disabled {
        background: #b8b8ff !important;
        color: #fff !important;
        opacity: 1 !important;
        cursor: not-allowed;
    }

    .deploy-agent__form .deploy-agent__enter {
        display: none;
    }

    .deploy-agent__submit {
        width: 100%;
        justify-content: center;
    }

    .deploy-agent__workflow {
        max-width: none;
    }

    .deploy-agent__form {
        max-width: none;
    }

    .deploy-agent__ack-frame p {
        font-size: clamp(24px, 7vw, 34px);
        padding: 0 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .deploy-agent,
    .deploy-agent__step.is-active,
    .deploy-agent__ack-frame.is-visible,
    .deploy-agent__bar-fill {
        transition: none;
        animation: none;
    }
}
