.studio-chatpanel {
    position: relative;
    isolation: isolate;
    container-type: inline-size;
    container-name: agent-panel;
    background: color-mix(in srgb, var(--t-surface) 96%, #0b0d10) !important;
}

.agent-chat-nav {
    min-height: 3.75rem;
    display: grid !important;
    grid-template-columns: 2.75rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem !important;
    border-bottom: 1px solid color-mix(in srgb, var(--t-border) 58%, transparent);
    background: color-mix(in srgb, var(--t-surface) 94%, transparent);
}

.agent-nav-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--t-text-muted);
    cursor: pointer;
    transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.agent-nav-icon:hover {
    color: var(--t-text);
    background: color-mix(in srgb, var(--t-text) 7%, transparent);
}

.agent-nav-icon:active { transform: scale(0.94); }
.agent-nav-icon svg { width: 1.35rem; height: 1.35rem; }

.agent-chat-tabs {
    height: 100%;
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 1.35rem;
    min-width: 0;
}

.agent-chat-tab {
    position: relative;
    min-width: 4.5rem;
    border: 0;
    background: transparent;
    color: var(--t-text-muted);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 650;
    cursor: pointer;
    transition: color 180ms ease;
}

.agent-chat-tab::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 1.75rem;
    height: 0.16rem;
    border-radius: 999px;
    background: var(--t-text);
    opacity: 0;
    transform: translateX(-50%) scaleX(0.55);
    transition: opacity 180ms ease, transform 180ms ease;
}

.agent-chat-tab:hover,
.agent-chat-tab.is-active { color: var(--t-text); }
.agent-chat-tab.is-active::after { opacity: 1; transform: translateX(-50%) scaleX(1); }

.agent-chat-nav__actions {
    display: flex;
    align-items: center;
    gap: 0.1rem;
}

.studio-token-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.tokens-studio-card {
    min-width: 6.35rem;
    height: 2.55rem;
    display: inline-flex;
    align-items: center;
    gap: 0.52rem;
    padding: 0.3rem 0.7rem 0.3rem 0.4rem;
    border: 1px solid color-mix(in srgb, var(--t-border) 76%, transparent);
    border-radius: 999px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--t-surface) 96%, #fff), color-mix(in srgb, var(--t-surface-2) 92%, #000)),
        var(--t-surface);
    color: var(--t-text);
    text-decoration: none;
    box-shadow: 0 0.75rem 2rem color-mix(in srgb, #000 14%, transparent);
    transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.tokens-studio-card:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--t-accent) 46%, var(--t-border));
}

.tokens-studio-card.is-low {
    border-color: color-mix(in srgb, #f59e0b 55%, var(--t-border));
}

.tokens-studio-ring {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--t-accent) var(--pct), color-mix(in srgb, var(--t-surface-3) 88%, transparent) 0);
    position: relative;
}

.tokens-studio-ring::before {
    content: '';
    position: absolute;
    inset: 0.28rem;
    border-radius: inherit;
    background: var(--t-surface);
}

.tokens-studio-ring span {
    position: relative;
    z-index: 1;
    font-size: 0.52rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.tokens-studio-copy {
    min-width: 0;
    display: flex;
    align-items: center;
    line-height: 1;
}

.tokens-studio-copy b {
    max-width: 5.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--t-text);
    font-size: 0.86rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .tokens-studio-card {
        min-width: 5.35rem;
        height: 2.4rem;
        width: auto;
        padding: 0.28rem 0.58rem 0.28rem 0.35rem;
        justify-content: center;
    }
    .tokens-studio-ring {
        width: 1.7rem;
        height: 1.7rem;
    }
    .tokens-studio-ring span { font-size: 0.48rem; }
    .tokens-studio-copy b {
        max-width: 2.9rem;
        font-size: 0.78rem;
    }
}

.agent-mode-view {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

.agent-mode-view.is-active { display: flex; }
.agent-mode-view[hidden] { display: none !important; }

.studio-chatpanel > .studio-composer-bar {
    padding: 0.4rem 0.85rem !important;
    min-height: 2.35rem;
    border-bottom: 1px solid color-mix(in srgb, var(--t-border) 45%, transparent);
    background: transparent;
}

.studio-chatpanel.is-imagine > .studio-composer-bar { display: none; }
.studio-chatpanel .studio-composer-picker { display: none !important; }
.studio-chatpanel .studio-composer-bar__top { min-height: 0; }
.studio-chatpanel .studio-composer-bar__status { font-size: 0.6875rem; }
.studio-chatpanel .studio-completion-notify { margin-left: auto; }
.studio-chatpanel .studio-completion-notify__button {
    width: 1.8rem;
    height: 1.8rem;
    padding: 0;
    border: 0;
    background: transparent;
}
.studio-chatpanel .studio-completion-notify__button span,
.studio-chatpanel .studio-completion-notify__note { display: none; }
.studio-chatpanel .studio-completion-notify__button svg { width: 0.95rem; height: 0.95rem; }

.studio-chatpanel .studio-msg-list {
    padding: 1.25rem 1rem 7.5rem !important;
    scroll-padding-bottom: 7.5rem;
    overscroll-behavior: contain;
    overflow-x: hidden !important;
}

.studio-chatpanel .studio-msg {
    gap: 0.55rem !important;
    margin: 0 0 1.25rem !important;
    padding: 0 !important;
    align-items: flex-start;
}

.studio-chatpanel .studio-msg--user {
    justify-content: flex-end;
    padding-left: 2.5rem !important;
}

.studio-chatpanel .studio-msg--user .studio-msg__body {
    max-width: 88%;
    padding: 0.58rem 0.78rem !important;
    border: 1px solid color-mix(in srgb, var(--t-border) 48%, transparent) !important;
    border-radius: 0.75rem !important;
    background: color-mix(in srgb, var(--t-surface-3) 90%, var(--t-text) 3%) !important;
    color: var(--t-text) !important;
    font-size: 0.8125rem !important;
    line-height: 1.5 !important;
}

.studio-chatpanel .studio-msg--agent {
    padding-right: 0.25rem !important;
}

.studio-chatpanel .studio-msg--agent .agent-avatar-wrap {
    width: 1.65rem !important;
    height: 1.65rem !important;
    margin-top: 0.05rem;
    border-radius: 0.42rem !important;
    background: #111519;
}

.studio-chatpanel .studio-msg--agent .agent-avatar {
    transform: none !important;
    object-fit: contain;
    padding: 0.18rem;
    border-radius: 0.35rem !important;
}

.studio-chatpanel .studio-msg--agent .studio-msg__body,
.studio-chatpanel .studio-msg--agent .chat-agent,
.studio-chatpanel #chatMessages .chat-agent {
    width: 100%;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--t-text) !important;
    font-size: 0.8125rem !important;
    line-height: 1.58 !important;
}

.studio-chatpanel .studio-msg--status .studio-msg__body {
    font-size: 0.75rem !important;
    color: var(--t-text-muted) !important;
}

.studio-chatpanel .studio-answer-stream {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.studio-chatpanel .studio-mind-rail,
.studio-chatpanel .studio-run-reasoning {
    margin: 0 0 0.75rem !important;
    border: 0 !important;
    border-left: 1px solid color-mix(in srgb, #4fd1b5 45%, var(--t-border)) !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 0.15rem 0 0.15rem 0.7rem !important;
}

.studio-chatpanel .studio-live-steps {
    margin-top: 0.7rem !important;
    padding-top: 0.55rem !important;
    border-top: 1px solid color-mix(in srgb, var(--t-border) 42%, transparent);
}

.studio-chatpanel .studio-live-step {
    min-height: 1.65rem;
    padding: 0.2rem 0 !important;
    border: 0 !important;
    background: transparent !important;
    font-size: 0.71875rem !important;
}

.studio-chatpanel .studio-live-step__icon {
    color: color-mix(in srgb, #4fd1b5 72%, var(--t-text-muted));
}

.studio-chat-input-dock {
    position: absolute;
    z-index: 12;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.5rem 0.7rem 0.7rem !important;
    border: 0 !important;
    background: linear-gradient(to bottom, transparent, var(--t-surface) 24%, var(--t-surface));
}

.studio-next-actions {
    display: flex;
    gap: 0.42rem;
    margin: 0 0.2rem 0.48rem;
    padding: 0.08rem 0.05rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.studio-next-actions[hidden] { display: none !important; }
.studio-next-actions::-webkit-scrollbar { display: none; }

.studio-next-action {
    flex: 0 0 auto;
    max-width: min(18rem, 82vw);
    min-height: 2rem;
    padding: 0.42rem 0.7rem;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--t-border) 72%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--t-surface-2) 94%, transparent);
    color: var(--t-text);
    font: inherit;
    font-size: 0.72rem;
    line-height: 1.25;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.studio-next-action:hover {
    border-color: color-mix(in srgb, #4fd1b5 55%, var(--t-border));
    background: color-mix(in srgb, var(--t-surface-2) 82%, #4fd1b5 18%);
    transform: translateY(-1px);
}

.studio-chatpanel .studio-chat-link {
    color: #67d7bf;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.16em;
    overflow-wrap: anywhere;
}

.studio-chatpanel .chat-attachments-preview {
    margin: 0 0.25rem 0.45rem;
    padding: 0.45rem !important;
    border: 1px solid color-mix(in srgb, var(--t-border) 55%, transparent);
    border-radius: 0.65rem;
    background: color-mix(in srgb, var(--t-surface-2) 96%, transparent) !important;
}

.studio-chatpanel .chat-attachments-preview.hidden,
.studio-chatpanel .chat-attachments-preview:empty {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

.studio-chatpanel .chat-input-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.35rem !important;
    min-height: 5.5rem;
    padding: 0.65rem !important;
    border: 1px solid color-mix(in srgb, var(--t-border) 72%, transparent);
    border-radius: 1rem !important;
    background: color-mix(in srgb, var(--t-surface-2) 96%, #14181d) !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18), inset 0 1px rgba(255, 255, 255, 0.025);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.studio-chatpanel .chat-input-bar:focus-within {
    border-color: color-mix(in srgb, #4fd1b5 38%, var(--t-border));
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22), 0 0 0 1px color-mix(in srgb, #4fd1b5 10%, transparent);
}

.studio-chatpanel .chat-input-field {
    width: 100% !important;
    min-height: 2.25rem !important;
    max-height: 9rem !important;
    padding: 0.1rem 0.15rem !important;
    font-size: 0.8125rem !important;
    line-height: 1.45 !important;
}

.studio-chatpanel .chat-input-field::placeholder { font-size: 0.8125rem !important; }

.chat-input-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

.chat-send-steering-label { display: none; }
.studio-chatpanel .chat-send-btn.is-steering {
    width: auto !important;
    min-width: 8.7rem;
    padding: 0 0.72rem;
    gap: 0.38rem;
}
.studio-chatpanel .chat-send-btn.is-steering .chat-send-steering-label {
    display: inline;
    font-size: 0.68rem;
    font-weight: 750;
    white-space: nowrap;
}

.studio-chatpanel .chat-tool-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
}

.studio-chatpanel .chat-send-btn {
    width: 2.15rem;
    height: 2.15rem;
    margin-left: auto;
    border-radius: 0.65rem;
    color: #07110f;
    background: #e8f7f3 !important;
}

.studio-chatpanel .chat-send-btn.is-stop,
.studio-chatpanel .chat-send-btn.is-stop.is-steering {
    width: 2.15rem !important;
    min-width: 2.15rem !important;
    max-width: 2.15rem !important;
    padding: 0 !important;
    gap: 0 !important;
    border-radius: 0.65rem !important;
}

.studio-chatpanel .chat-send-btn.is-stop svg {
    width: 0.78rem;
    height: 0.78rem;
}

.studio-chatpanel .chat-send-btn:hover { transform: translateY(-1px); background: #fff !important; }
.studio-chatpanel .chat-send-btn svg { width: 1rem; height: 1rem; }

.agent-profile-picker { position: relative; }

.agent-profile-toggle {
    height: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 8rem;
    padding: 0 0.55rem;
    border: 0;
    border-radius: 0.5rem;
    color: var(--t-text);
    background: color-mix(in srgb, var(--t-text) 6%, transparent);
    font-size: 0.71875rem;
    font-weight: 650;
    cursor: pointer;
}

.agent-profile-toggle > svg:first-child { width: 0.9rem; height: 0.9rem; color: #4fd1b5; }
.agent-profile-chevron { width: 0.75rem; height: 0.75rem; color: var(--t-text-muted); }

.agent-profile-menu {
    position: fixed;
    z-index: 10020;
    left: var(--agent-menu-left, 1rem);
    top: var(--agent-menu-top, auto);
    right: auto;
    bottom: auto;
    width: min(17rem, calc(100vw - 2rem));
    display: grid;
    gap: 0.2rem;
    padding: 0.5rem;
    border: 1px solid var(--t-border);
    border-radius: 0.95rem;
    background: color-mix(in srgb, var(--t-dropdown) 94%, #050505);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.52), inset 0 1px rgba(255,255,255,0.04);
    opacity: 0;
    visibility: hidden;
    transform: translateY(0.35rem) scale(0.98);
    transform-origin: var(--agent-menu-origin, bottom center);
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
    max-height: var(--agent-menu-max-height, min(22rem, calc(100vh - 2rem)));
    overflow-y: auto;
    overscroll-behavior: contain;
    pointer-events: none;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, #4fd1b5 34%, transparent) transparent;
}

.agent-profile-menu::-webkit-scrollbar { width: 0.45rem; }
.agent-profile-menu::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: color-mix(in srgb, #4fd1b5 34%, transparent);
}

.agent-profile-picker.is-open .agent-profile-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.agent-profile-menu button {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) 1rem;
    align-items: center;
    gap: 0.55rem;
    padding: 0.72rem;
    border: 1px solid transparent;
    border-radius: 0.65rem;
    background: transparent;
    color: var(--t-text);
    text-align: left;
    cursor: pointer;
}

.agent-profile-menu[data-product-menu] {
    width: min(23rem, calc(100vw - 1.5rem));
    grid-template-columns: 1fr;
    gap: 0.32rem;
}

.agent-profile-menu[data-product-menu] button {
    align-items: center;
    min-height: 3.6rem;
    padding: 0.64rem;
    border: 1px solid color-mix(in srgb, var(--t-border) 66%, transparent);
    background: color-mix(in srgb, var(--t-surface) 68%, transparent);
}

.agent-profile-menu[data-product-menu] button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.agent-profile-menu button:hover,
.agent-profile-menu button.is-active { background: var(--t-dropdown-hover); }

.agent-profile-menu[data-product-menu] button:hover,
.agent-profile-menu[data-product-menu] button.is-active {
    border-color: color-mix(in srgb, #4fd1b5 58%, var(--t-border));
    background: color-mix(in srgb, #4fd1b5 10%, var(--t-dropdown));
}

.agent-profile-menu[data-product-menu] button:disabled:hover {
    border-color: color-mix(in srgb, var(--t-border) 66%, transparent);
    background: color-mix(in srgb, var(--t-surface) 68%, transparent);
}
.agent-profile-menu__icon {
    width: 1.85rem;
    height: 1.85rem;
    display: grid;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--t-border) 70%, transparent);
    border-radius: 0.4rem;
    color: #4fd1b5;
    font-size: 0.6875rem;
    font-weight: 800;
}
.agent-profile-menu strong { display: block; font-size: 0.75rem; }
.agent-profile-menu small { display: block; margin-top: 0.12rem; color: var(--t-text-muted); font-size: 0.65rem; line-height: 1.3; }
.agent-profile-check { opacity: 0; color: #4fd1b5; }
.agent-profile-menu button.is-active .agent-profile-check { opacity: 1; }
.agent-profile-release {
    justify-self: end;
    align-self: center;
    white-space: nowrap;
    padding: 0.18rem 0.38rem;
    border-radius: 999px;
    color: #4fd1b5;
    background: color-mix(in srgb, #4fd1b5 12%, transparent);
    font-size: 0.58rem;
    font-weight: 800;
}

@media (max-width: 760px) {
    .agent-profile-picker.is-open::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: 10010;
        background: rgba(0, 0, 0, 0.28);
        backdrop-filter: blur(2px);
    }

    .agent-profile-menu {
        position: fixed;
        left: max(0.75rem, env(safe-area-inset-left)) !important;
        right: max(0.75rem, env(safe-area-inset-right)) !important;
        top: auto !important;
        bottom: max(0.75rem, env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-height: min(74vh, 28rem) !important;
        border-radius: 1.15rem 1.15rem 0.8rem 0.8rem;
        transform: translateY(0.9rem) scale(0.98);
        transform-origin: bottom center;
    }

    .agent-profile-picker.is-open .agent-profile-menu {
        transform: translateY(0) scale(1);
    }

    .agent-profile-menu[data-product-menu] {
        grid-template-columns: 1fr;
    }

    .agent-profile-menu[data-product-menu] button {
        min-height: 3.35rem;
        padding: 0.58rem;
    }

    .agent-profile-menu button {
        grid-template-columns: 1.85rem minmax(0, 1fr) auto;
    }

    .agent-profile-menu small {
        font-size: 0.62rem;
    }
}

.agent-history-backdrop {
    position: absolute;
    z-index: 49;
    inset: 0;
    background: rgba(2, 4, 6, 0.52);
    opacity: 0;
    transition: opacity 180ms ease;
}

.agent-history-backdrop.is-open { opacity: 1; }

.agent-history-drawer {
    position: absolute;
    z-index: 50;
    inset: 0 auto 0 0;
    width: min(20rem, 92%);
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    border-right: 1px solid var(--t-border);
    background: color-mix(in srgb, var(--t-surface) 97%, #0b0e11);
    box-shadow: 18px 0 44px rgba(0, 0, 0, 0.3);
    transform: translateX(-102%);
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.agent-history-drawer.is-open { transform: translateX(0); }
.agent-history-head { display: flex; align-items: center; justify-content: space-between; min-height: 2.75rem; }
.agent-history-brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--t-text); font-size: 0.8rem; font-weight: 750; text-decoration: none; }
.agent-history-brand img { object-fit: contain; }
.agent-history-new,
.agent-history-action {
    width: 100%;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.6rem;
    padding: 0 0.75rem;
    border: 1px solid color-mix(in srgb, var(--t-border) 65%, transparent);
    border-radius: 0.5rem;
    background: transparent;
    color: var(--t-text);
    font-size: 0.75rem;
    cursor: pointer;
}
.agent-history-new:hover,
.agent-history-action:hover { background: var(--t-dropdown-hover); }
.agent-history-new svg { width: 1rem; height: 1rem; }
.agent-history-label { margin: 1.15rem 0 0.45rem; padding: 0 0.5rem; color: var(--t-text-muted); font-size: 0.65rem; font-weight: 650; }
.agent-history-list { flex: 1; min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 0.15rem; }
.agent-history-item {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
    padding: 0.65rem 0.7rem;
    border: 0;
    border-radius: 0.45rem;
    background: transparent;
    color: var(--t-text);
    text-align: left;
    cursor: pointer;
}
.agent-history-item:hover,
.agent-history-item.is-active { background: var(--t-dropdown-hover); }
.agent-history-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; font-weight: 600; }
.agent-history-item small { display: block; margin-top: 0.15rem; color: var(--t-text-muted); font-size: 0.625rem; }
.agent-history-status { width: 0.42rem; height: 0.42rem; margin-top: 0.35rem; border-radius: 50%; background: #6b7280; }
.agent-history-item.is-live .agent-history-status { background: #4fd1b5; box-shadow: 0 0 0 0.2rem color-mix(in srgb, #4fd1b5 12%, transparent); }
.agent-history-footer { padding-top: 0.5rem; border-top: 1px solid color-mix(in srgb, var(--t-border) 45%, transparent); }
.agent-history-action { justify-content: center; margin: 0; color: var(--t-text-muted); }

.agent-imagine-view {
    position: relative;
    padding-bottom: 7.6rem;
}
.agent-imagine-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 1.1rem 0.85rem 1.5rem; }
.agent-imagine-intro { display: flex; align-items: center; margin-bottom: 1.1rem; }
.agent-imagine-intro h2 { margin: 0; font-size: 1rem; line-height: 1.2; }
.agent-imagine-intro p { margin: 0.22rem 0 0; color: var(--t-text-muted); font-size: 0.6875rem; line-height: 1.35; }
.agent-imagine-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
.agent-imagine-empty { grid-column: 1 / -1; padding: 2rem 0.75rem; color: var(--t-text-muted); font-size: 0.75rem; text-align: center; }
.agent-imagine-card {
    position: relative;
    overflow: hidden;
    min-width: 0;
    aspect-ratio: var(--image-aspect, 1 / 1);
    border: 1px solid color-mix(in srgb, var(--t-border) 55%, transparent);
    border-radius: 0.5rem;
    background: var(--t-surface-2);
}
.agent-imagine-card img { width: 100%; height: 100%; display: block; object-fit: cover; }
.agent-imagine-card__actions {
    position: absolute;
    left: 0.35rem;
    right: 0.35rem;
    bottom: 0.35rem;
    display: flex;
    gap: 0.3rem;
    opacity: 0;
    transform: translateY(0.3rem);
    transition: opacity 160ms ease, transform 160ms ease;
}
.agent-imagine-card:hover .agent-imagine-card__actions,
.agent-imagine-card:focus-within .agent-imagine-card__actions { opacity: 1; transform: translateY(0); }
.agent-imagine-card__actions button,
.agent-imagine-card__actions a {
    min-height: 1.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 0 0.45rem;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 0.4rem;
    background: rgba(11, 14, 17, 0.88);
    color: #f8fafc;
    font-size: 0.625rem;
    text-decoration: none;
    cursor: pointer;
    backdrop-filter: blur(10px);
}
.agent-imagine-card__actions .agent-imagine-card__delete {
    width: 1.8rem;
    flex: 0 0 1.8rem;
    padding: 0;
    color: #fecaca;
}
.agent-imagine-card__delete svg { width: 0.88rem; height: 0.88rem; }
.agent-imagine-card.is-loading { display: grid; place-items: center; }
.agent-imagine-card.is-loading::after {
    content: '';
    width: 1.4rem;
    height: 1.4rem;
    border: 2px solid color-mix(in srgb, var(--t-text-muted) 28%, transparent);
    border-top-color: #4fd1b5;
    border-radius: 50%;
    animation: agentSpin 0.8s linear infinite;
}
@keyframes agentSpin { to { transform: rotate(360deg); } }

.agent-imagine-composer {
    position: absolute;
    z-index: 10;
    left: 0.7rem;
    right: 0.7rem;
    bottom: 0.7rem;
    padding: 0.65rem;
    border: 1px solid color-mix(in srgb, var(--t-border) 72%, transparent);
    border-radius: 1rem;
    background: color-mix(in srgb, var(--t-surface-2) 97%, #14181d);
    box-shadow: 0 14px 34px rgba(0,0,0,0.22);
}
.agent-imagine-composer textarea {
    width: 100%;
    min-height: 2.75rem;
    max-height: 7rem;
    resize: vertical;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--t-text);
    font: inherit;
    font-size: 0.8125rem;
    line-height: 1.45;
}
.agent-imagine-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    margin-top: 0.45rem;
    min-width: 0;
}

.agent-imagine-quality {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.12rem;
    padding: 0.16rem;
    border: 1px solid color-mix(in srgb, var(--t-border) 70%, transparent);
    border-radius: 0.62rem;
    background: color-mix(in srgb, var(--t-surface-3) 74%, transparent);
}

.agent-imagine-quality button {
    height: 1.82rem;
    min-width: 3.05rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.54rem;
    border: 0;
    border-radius: 0.46rem;
    background: transparent;
    color: var(--t-text-muted);
    font-size: 0.66rem;
    font-weight: 780;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.agent-imagine-quality button:hover { color: var(--t-text); background: color-mix(in srgb, var(--t-text) 6%, transparent); }
.agent-imagine-quality button.is-active {
    background: color-mix(in srgb, #e8f7f3 92%, #4fd1b5);
    color: #07110f;
    box-shadow: 0 6px 16px rgba(0,0,0,0.14);
}

.agent-imagine-format-picker {
    position: relative;
    flex: 0 1 8.5rem;
    min-width: 6.9rem;
}

.agent-imagine-format-toggle {
    width: 100%;
    height: 2.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    padding: 0 0.58rem 0 0.68rem;
    border: 1px solid color-mix(in srgb, var(--t-border) 72%, transparent);
    border-radius: 0.62rem;
    background: color-mix(in srgb, var(--t-surface-3) 86%, transparent);
    color: var(--t-text);
    font-size: 0.68rem;
    font-weight: 720;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.agent-imagine-format-toggle:hover,
.agent-imagine-format-picker.is-open .agent-imagine-format-toggle {
    border-color: color-mix(in srgb, #4fd1b5 42%, var(--t-border));
    background: color-mix(in srgb, var(--t-surface-3) 96%, #4fd1b5 5%);
    box-shadow: 0 0 0 1px color-mix(in srgb, #4fd1b5 10%, transparent);
}

.agent-imagine-format-toggle span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-imagine-format-toggle svg {
    width: 0.82rem;
    height: 0.82rem;
    flex: 0 0 auto;
    color: var(--t-text-muted);
    transition: transform 160ms ease;
}

.agent-imagine-format-picker.is-open .agent-imagine-format-toggle svg { transform: rotate(180deg); }

.agent-imagine-format-menu {
    position: absolute;
    z-index: 50;
    left: 0;
    bottom: calc(100% + 0.45rem);
    width: min(12.5rem, calc(100vw - 2rem));
    display: grid;
    gap: 0.16rem;
    padding: 0.36rem;
    border: 1px solid color-mix(in srgb, var(--t-border) 78%, transparent);
    border-radius: 0.74rem;
    background: color-mix(in srgb, var(--t-dropdown) 96%, #111827);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
    opacity: 0;
    visibility: hidden;
    transform: translateY(0.35rem) scale(0.985);
    transform-origin: bottom left;
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
}

.agent-imagine-format-picker.is-open .agent-imagine-format-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.agent-imagine-format-menu button {
    min-height: 2.15rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.7rem;
    padding: 0 0.62rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--t-text);
    font-size: 0.7rem;
    font-weight: 720;
    text-align: left;
    cursor: pointer;
}

.agent-imagine-format-menu button:hover,
.agent-imagine-format-menu button.is-active {
    background: var(--t-dropdown-hover);
}

.agent-imagine-format-menu small {
    color: var(--t-text-muted);
    font-size: 0.62rem;
    font-weight: 760;
}

.agent-imagine-controls > button[type="submit"] {
    height: 2.15rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.75rem;
    border: 0;
    border-radius: 0.55rem;
    background: #e8f7f3;
    color: #07110f;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
}
.agent-imagine-controls > button[type="submit"] svg { width: 0.9rem; height: 0.9rem; }
.agent-imagine-controls > button[type="submit"]:disabled { opacity: 0.55; cursor: wait; }

@media (max-width: 760px) {
    .agent-chat-nav {
        min-height: 3.5rem;
        grid-template-columns: 2.5rem minmax(0, 1fr) auto;
        padding: 0 0.45rem !important;
    }
    .agent-chat-tabs { gap: 0.65rem; }
    .agent-chat-tab { min-width: 3.9rem; font-size: 0.8125rem; }
    .agent-preview-shortcut { display: inline-grid; }
    .studio-chatpanel .studio-msg-list { padding: 1rem 0.75rem 7.8rem !important; }
    .studio-chat-input-dock { padding: 0.4rem 0.45rem max(0.55rem, env(safe-area-inset-bottom)) !important; }
    .studio-chatpanel .chat-input-bar { min-height: 5.35rem; border-radius: 0.9rem !important; }
    .agent-profile-toggle { max-width: 7.2rem; }
    .agent-history-drawer { width: min(19rem, 92vw); }
    .agent-imagine-gallery { grid-template-columns: 1fr; }
    .agent-imagine-card__actions { opacity: 1; transform: none; }
    .agent-imagine-controls { flex-wrap: wrap; }
    .agent-imagine-quality { flex: 1 1 7.2rem; }
    .agent-imagine-quality button { flex: 1 1 0; min-width: 0; }
    .agent-imagine-format-picker { flex: 1 1 7.2rem; }
    .agent-imagine-controls > button[type="submit"] { flex: 0 0 auto; }
}

@container agent-panel (max-width: 340px) {
    .agent-chat-nav {
        grid-template-columns: 2.25rem minmax(0, 1fr) auto;
        gap: 0.2rem;
        padding: 0 0.35rem !important;
    }
    .agent-nav-icon { width: 2.25rem; height: 2.25rem; }
    .agent-chat-tabs {
        width: 100%;
        gap: 0.15rem;
    }
    .agent-chat-tab {
        flex: 1 1 0;
        min-width: 0;
        padding: 0 0.2rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }
    .agent-chat-nav__actions { gap: 0; }
    .studio-chatpanel .studio-msg-list { padding-inline: 0.65rem !important; }
}

@container agent-panel (max-width: 292px) {
    .agent-preview-shortcut { display: none !important; }
    .agent-chat-tab { font-size: 0.7rem; }
    .studio-chat-input-dock { padding-inline: 0.35rem !important; }
    .studio-chatpanel .chat-input-bar { padding: 0.55rem !important; }
    .agent-profile-toggle { max-width: 6.25rem; padding-inline: 0.42rem; }
    .agent-imagine-controls > button[type="submit"] span { display: none; }
    .agent-imagine-controls > button[type="submit"] { width: 2.15rem; padding: 0; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .agent-history-drawer,
    .agent-history-backdrop,
    .agent-chat-tab::after,
    .agent-imagine-card__actions { transition: none; }
    .agent-imagine-card.is-loading::after { animation-duration: 1.8s; }
}
.studio-copy-confirmation {
    position: fixed;
    z-index: 2147483600;
    top: max(1rem, env(safe-area-inset-top));
    left: 50%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: min(25rem, calc(100vw - 1.5rem));
    padding: 0.85rem 1rem;
    border: 1px solid rgba(52, 211, 153, 0.35);
    border-radius: 0.85rem;
    background: color-mix(in srgb, var(--t-surface) 94%, #064e3b 6%);
    color: var(--t-text);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -0.75rem);
    transition: opacity 180ms ease, transform 180ms ease;
}

.studio-copy-confirmation.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.studio-copy-confirmation__icon {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 2.25rem;
    border-radius: 50%;
    background: #10b981;
    color: #fff;
}

.studio-copy-confirmation__icon svg { width: 1.15rem; height: 1.15rem; }
.studio-copy-confirmation__copy { min-width: 0; }
.studio-copy-confirmation__copy strong { display: block; font-size: 0.84rem; line-height: 1.25; }
.studio-copy-confirmation__copy small { display: block; margin-top: 0.15rem; color: var(--t-text-muted); font-size: 0.72rem; line-height: 1.3; }

@media (max-width: 640px) {
    .studio-copy-confirmation {
        top: max(0.65rem, env(safe-area-inset-top));
        width: calc(100vw - 1rem);
        padding: 0.75rem 0.85rem;
    }
}

/* Final dropdown guards: keep menus visible, contained and above floating widgets. */
.agent-profile-menu[data-open="true"],
.landing-quality-menu[data-open="true"],
.agent-profile-picker.is-open > .agent-profile-menu,
.landing-quality-picker.is-open > .landing-quality-menu {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.agent-profile-menu:not([data-open="true"]),
.landing-quality-menu:not([data-open="true"]) {
    pointer-events: none;
}

.agent-profile-menu[data-open="true"][data-agent-placement="above"],
.agent-profile-menu[data-open="true"][data-agent-placement="below"],
.landing-quality-menu[data-open="true"][data-agent-placement="above"],
.landing-quality-menu[data-open="true"][data-agent-placement="below"] {
    transform: translateY(0) scale(1) !important;
}

html.agent-menu-open .pwa-offer.is-visible,
html:has(.agent-profile-menu[data-open="true"]) .pwa-offer.is-visible,
html:has(.landing-quality-menu[data-open="true"]) .pwa-offer.is-visible {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(calc(100% + 1rem)) !important;
}

html.agent-menu-open .sup-widget-fab,
html.agent-menu-open .sup-widget-panel,
html:has(.agent-profile-menu[data-open="true"]) .sup-widget-fab,
html:has(.agent-profile-menu[data-open="true"]) .sup-widget-panel,
html:has(.landing-quality-menu[data-open="true"]) .sup-widget-fab,
html:has(.landing-quality-menu[data-open="true"]) .sup-widget-panel {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(12px) scale(0.97) !important;
}

@media (max-width: 760px) {
    html.agent-menu-open body::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: 10010;
        pointer-events: none;
        background: rgba(0, 0, 0, 0.28);
        backdrop-filter: blur(2px);
    }

    .agent-profile-menu[data-open="true"],
    .landing-quality-menu[data-open="true"] {
        transform: translateY(0) scale(1) !important;
    }
}
