/* Generated from the exact pre-restore Composer A snapshot. */

@media (min-width: 769px) {

    body.workspace-mode-chat #uploadBtn,
    body.workspace-mode-chat .role-entry-btn,
    body.workspace-mode-chat #thinkingBtn,
    body.workspace-mode-chat #webSearchBtn {
        height: 32px;
        min-height: 32px;
        border: 0;
        border-radius: 7px;
        color: #adb3bf;
        background: transparent;
        box-shadow: none;
        font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
        font-size: 14px;
        font-weight: 400;
        line-height: normal;
        letter-spacing: 0;
    }

    body.theme-light.workspace-mode-chat #uploadBtn,
    body.theme-light.workspace-mode-chat .role-entry-btn,
    body.theme-light.workspace-mode-chat #thinkingBtn,
    body.theme-light.workspace-mode-chat #webSearchBtn {
        color: #686d77;
        background: transparent;
    }

    body.workspace-mode-chat .role-entry-btn,
    body.workspace-mode-chat #thinkingBtn,
    body.workspace-mode-chat #webSearchBtn {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 6px;
        width: auto;
        padding: 0 9px;
    }

    body.workspace-mode-chat .role-entry-btn .asset-entry-label,
    body.workspace-mode-chat #thinkingBtn > span,
    body.workspace-mode-chat #webSearchBtn > span {
        color: inherit;
        font: inherit;
        line-height: normal;
        letter-spacing: 0;
    }

    body.workspace-mode-chat #thinkingBtn strong {
        color: #f2f4f7;
        font-size: inherit;
        font-weight: 600;
    }

    body.theme-light.workspace-mode-chat #thinkingBtn strong {
        color: #17191d;
    }

    body.workspace-mode-chat #thinkingBtn.active,
    body.workspace-mode-chat #thinkingBtn.thinking-mode,
    body.theme-light.workspace-mode-chat #thinkingBtn.active,
    body.theme-light.workspace-mode-chat #thinkingBtn.thinking-mode {
        color: inherit;
        background: transparent;
    }

    body.workspace-mode-chat #uploadBtn:hover,
    body.workspace-mode-chat .role-entry-btn:hover,
    body.workspace-mode-chat #thinkingBtn:hover,
    body.workspace-mode-chat #webSearchBtn:hover {
        color: #f2f4f7;
        background: #2d323d;
    }

    body.theme-light.workspace-mode-chat #uploadBtn:hover,
    body.theme-light.workspace-mode-chat .role-entry-btn:hover,
    body.theme-light.workspace-mode-chat #thinkingBtn:hover,
    body.theme-light.workspace-mode-chat #webSearchBtn:hover {
        color: #17191d;
        background: #eceff4;
    }
}

body.workspace-mode-chat .role-entry-btn {
    width: auto;
    padding: 0 9px;
    gap: 6px;
}

body.workspace-mode-chat .asset-entry-label {
    display: inline;
    font-size: 12px;
    font-weight: 500;
}

.thinking-level-picker {
    position: relative;
    flex: 0 0 auto;
}

.thinking-level-picker.open .thinking-level-chevron {
    transform: rotate(180deg);
}

.thinking-level-chevron {
    transition: transform 0.18s ease;
}

/* Image/video option menus use the same compact chevron affordance as reasoning. */
.image-option-btn {
    position: relative;
}

.image-option-chevron {
    flex: 0 0 auto;
    opacity: 0.58;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.image-option-btn.popup-open .image-option-chevron {
    transform: rotate(180deg);
    opacity: 0.95;
}

#thinkingBtn strong {
    color: currentColor;
    font-weight: 650;
}

#thinkingBtn.is-locked .thinking-level-chevron {
    display: none;
}

.thinking-level-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    width: 224px;
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 10px;
    background: rgba(14, 15, 19, 0.98);
    box-shadow: 0 22px 58px rgba(0, 0, 0, 0.46);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    z-index: 420;
}

.thinking-level-title {
    padding: 6px 8px 8px;
    color: rgba(226, 232, 240, 0.46);
    font-size: 10px;
    font-weight: 650;
}

.thinking-level-option {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 8px;
    border: 0;
    border-radius: 7px;
    color: rgba(248, 250, 252, 0.84);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.thinking-level-option:hover,
.thinking-level-option.active {
    background: rgba(255, 255, 255, 0.075);
}

.thinking-level-option > span {
    display: grid;
    gap: 3px;
}

.thinking-level-option strong { font-size: 12px; font-weight: 650; }
.thinking-level-option small { color: rgba(226, 232, 240, 0.42); font-size: 10px; }
.thinking-level-option > svg { opacity: 0; color: #67e8f9; }
.thinking-level-option.active > svg { opacity: 1; }

body.theme-light .thinking-level-menu {
    border-color: rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 22px 58px rgba(15, 23, 42, 0.16);
}

body.theme-light .thinking-level-title,
body.theme-light .thinking-level-option small { color: rgba(30, 41, 59, 0.46); }
body.theme-light .thinking-level-option { color: #172033; }
body.theme-light .thinking-level-option:hover,
body.theme-light .thinking-level-option.active { background: rgba(15, 23, 42, 0.055); }
body.theme-light .thinking-level-option > svg { color: #2563eb; }

@media (max-width: 768px) {
    body.workspace-mode-chat .asset-entry-label,
    body.workspace-mode-chat #webSearchBtn > span { display: none; }
    body.workspace-mode-chat .role-entry-btn { width: 32px; padding: 0; justify-content: center; }
    .thinking-level-menu {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(96px + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-height: calc(100vh - 124px);
        overflow-y: auto;
    }
}
body.theme-light .role-entry-btn .asset-entry-icon {
    color: rgba(99, 102, 241, 0.85);
}
body.theme-light .role-entry-btn:hover .asset-entry-icon {
    color: #6366f1;
}
body.theme-light .role-entry-btn.is-active .asset-entry-icon {
    color: #6366f1;
}


/* Compact model navigator. */
@media (min-width: 769px) {
    .sidebar {
        width: 276px;
        box-shadow: 14px 0 42px rgba(0, 0, 0, 0.2);
        transition: width 220ms ease, box-shadow 220ms ease;
    }

    .sidebar-header {
        min-height: 72px;
        box-sizing: border-box;
        padding: 14px 14px 12px 18px;
    }

    .toggle-sidebar {
        display: inline-grid;
        place-items: center;
        width: 32px;
        height: 32px;
        flex: 0 0 32px;
        padding: 0;
        border-radius: 7px;
        cursor: pointer;
    }

    .toggle-sidebar:hover {
        color: var(--text-primary);
        background: rgba(255, 255, 255, 0.075);
        border-color: rgba(255, 255, 255, 0.13);
    }

    .sidebar .model-tabs {
        margin: 12px 12px 8px;
        padding: 4px;
        border-radius: 8px;
    }

    .sidebar .tab-item {
        min-width: 0;
        padding: 6px 7px;
        border-radius: 6px;
        font-size: 11px;
    }

    .sidebar .model-search-wrap {
        margin: 0 12px 7px;
    }

    .sidebar .model-search-input {
        height: 34px;
        border-radius: 7px;
        padding-left: 33px;
    }

    .sidebar .model-list {
        padding: 7px 7px 12px;
    }

    .sidebar .model-item {
        min-height: 72px;
        box-sizing: border-box;
        gap: 11px;
        margin: 0 0 3px;
        padding: 8px 9px;
        border-radius: 8px;
        overflow: visible;
    }

    .sidebar .model-item::before {
        width: 2px;
        height: 34px;
        border-radius: 0 2px 2px 0;
    }

    .sidebar .model-item:hover {
        transform: none;
    }

    .sidebar .model-icon-small {
        position: relative;
        width: 42px;
        height: 42px;
        box-sizing: border-box;
        padding: 6px;
        overflow: visible;
        border: 1px solid rgba(255, 255, 255, 0.09);
        border-radius: 10px;
        background: #17191f;
        box-shadow: 0 5px 12px rgba(0, 0, 0, 0.16);
    }

    .sidebar .model-icon-img {
        width: 30px;
        height: 30px;
        border-radius: 6px;
    }

    .sidebar .model-item:hover .model-icon-small {
        transform: none;
    }

    .sidebar .model-info {
        gap: 4px;
    }

    .sidebar .model-title-row {
        display: flex;
        align-items: center;
        min-width: 0;
        gap: 6px;
    }

    .sidebar .model-name {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 13px;
        font-weight: 700;
        line-height: 17px;
    }

    .sidebar .model-desc {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        white-space: normal;
        margin: 0;
        font-size: 10.5px;
        line-height: 14px;
        color: rgba(255, 255, 255, 0.42);
    }

    .sidebar .model-type-badge {
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: center;
        min-height: 19px;
        box-sizing: border-box;
        padding: 1px 5px;
        border: 1px solid;
        border-radius: 4px;
        font-size: 9px;
        font-weight: 650;
        line-height: 14px;
        white-space: nowrap;
    }

    .sidebar .model-type-chat {
        color: #62d4e8;
        border-color: rgba(98, 212, 232, 0.38);
        background: rgba(32, 155, 180, 0.11);
    }

    .sidebar .model-type-image {
        color: #c6a0ff;
        border-color: rgba(166, 110, 255, 0.38);
        background: rgba(128, 76, 220, 0.11);
    }

    .sidebar .model-type-video {
        color: #ffb276;
        border-color: rgba(255, 145, 76, 0.38);
        background: rgba(232, 101, 35, 0.1);
    }

    .sidebar .model-badge-compact {
        position: absolute;
        top: -5px;
        right: -5px;
        min-width: 14px;
        height: 14px;
        box-sizing: border-box;
        justify-content: center;
        padding: 0 3px;
        border-radius: 4px;
        font-size: 0;
        letter-spacing: 0;
        box-shadow: none;
    }

    .sidebar .model-badge-compact .badge-icon {
        width: 8px;
        height: 8px;
    }

    body.theme-light .sidebar .model-icon-small {
        border-color: rgba(15, 23, 42, 0.1);
        background: #17191f;
        box-shadow: 0 5px 13px rgba(25, 31, 45, 0.13);
    }

    /* Keep HOT / NEW / PICK badges visible outside the 36px icon box. */
    .sidebar .model-icon-small {
        position: relative;
        overflow: visible;
    }

    body.theme-light .sidebar {
        background: #eef2f7;
        border-right-color: rgba(35, 49, 72, 0.1);
    }

    body.theme-light .sidebar-header {
        background: rgba(255, 255, 255, 0.28);
        border-bottom-color: rgba(35, 49, 72, 0.08);
    }

    body.theme-light .sidebar .model-tabs {
        background: rgba(255, 255, 255, 0.52);
        border-color: rgba(35, 49, 72, 0.08);
    }

    body.theme-light .sidebar .model-search-input {
        background: rgba(255, 255, 255, 0.64);
        border-color: rgba(35, 49, 72, 0.1);
    }

    body.theme-light .sidebar .model-icon-img.is-openai-white {
        filter: brightness(0) invert(1);
    }

    body.theme-light .sidebar .model-desc {
        color: rgba(30, 41, 59, 0.5);
    }

    body.theme-light .sidebar .model-type-chat {
        color: #087d98;
        border-color: rgba(8, 157, 190, 0.32);
        background: rgba(39, 190, 218, 0.1);
    }

    body.theme-light .sidebar .model-type-image {
        color: #7651cc;
        border-color: rgba(128, 82, 215, 0.28);
        background: rgba(142, 97, 226, 0.09);
    }

    body.theme-light .sidebar .model-type-video {
        color: #c85e20;
        border-color: rgba(224, 102, 34, 0.28);
        background: rgba(237, 122, 55, 0.09);
    }

    body.theme-light .toggle-sidebar:hover {
        color: #24283a;
        background: rgba(15, 23, 42, 0.06);
        border-color: rgba(15, 23, 42, 0.12);
    }

    body.sidebar-collapsed .sidebar {
        width: 0;
        overflow: visible;
        border-right: 0;
        box-shadow: none;
    }

    body.sidebar-collapsed .sidebar-header {
        display: block;
        min-height: 0;
        padding: 0;
        border: 0;
    }

    body.sidebar-collapsed .nav-logo,
    body.sidebar-collapsed .logo-text,
    body.sidebar-collapsed .model-tabs,
    body.sidebar-collapsed .model-search-wrap,
    body.sidebar-collapsed .model-info,
    body.sidebar-collapsed .model-list {
        display: none !important;
    }

    body.sidebar-collapsed .toggle-sidebar {
        position: fixed;
        top: 14px;
        left: 12px;
        z-index: 310;
        width: 32px;
        height: 32px;
        flex-basis: 32px;
        background: var(--bg-sidebar);
        box-shadow: 0 5px 16px rgba(15, 23, 42, 0.14);
    }

    body.sidebar-collapsed .top-left-console {
        left: 60px;
    }

    body.sidebar-collapsed .sidebar-toggle-chevron {
        transform: rotate(180deg);
        transform-origin: center;
    }

}

/* Compact reference tokens inside sent video prompts. */
.message.user .video-reference-chip {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 22px;
    margin: 0 2px;
    padding: 2px 6px;
    border: 1px solid rgba(129, 140, 248, 0.3);
    border-radius: 6px;
    color: #dce2ff;
    background: rgba(99, 102, 241, 0.14);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    letter-spacing: 0;
    vertical-align: middle;
    white-space: nowrap;
}

.message.user button.video-reference-chip {
    cursor: pointer;
    appearance: none;
}

.message.user .video-reference-chip:hover {
    border-color: rgba(129, 140, 248, 0.5);
    background: rgba(99, 102, 241, 0.22);
}

.message.user .video-reference-chip.is-audio {
    border-color: rgba(45, 212, 191, 0.3);
    color: #ccfbf1;
    background: rgba(20, 184, 166, 0.13);
}

.message.user .video-reference-chip svg {
    width: 13px;
    height: 13px;
    flex: 0 0 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.theme-light .message.user .video-reference-chip {
    border-color: rgba(79, 70, 229, 0.2);
    color: #4338ca;
    background: rgba(99, 102, 241, 0.08);
}

body.theme-light .message.user .video-reference-chip:hover {
    border-color: rgba(79, 70, 229, 0.34);
    background: rgba(99, 102, 241, 0.13);
}

body.theme-light .message.user .video-reference-chip.is-audio {
    border-color: rgba(13, 148, 136, 0.2);
    color: #0f766e;
    background: rgba(20, 184, 166, 0.08);
}

.message.user .message-img.is-reference-highlighted {
    outline: 2px solid #6366f1;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.13);
}

/* ==========================================================================
   Composer A parity
   Keep the production upload stages, while matching the selected preview.
   ========================================================================== */
body.workspace-mode-chat .input-container,
body.workspace-mode-image .input-container,
body.workspace-mode-video .input-container {
    width: min(720px, calc(100% - 48px));
    max-width: 720px;
}

body.workspace-mode-chat .chat-input-box,
body.workspace-mode-image .chat-input-box,
body.workspace-mode-video .chat-input-box {
    width: 100%;
    max-width: 720px;
    border: 1px solid #444b59;
    border-radius: 14px;
    background: rgba(28, 31, 38, 0.92);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.42), 0 2px 10px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

body.theme-light.workspace-mode-chat .chat-input-box,
body.theme-light.workspace-mode-image .chat-input-box,
body.theme-light.workspace-mode-video .chat-input-box {
    border-color: #cfd4dd;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 18px 50px rgba(22, 29, 43, 0.12), 0 2px 8px rgba(22, 29, 43, 0.05);
}

body.workspace-mode-chat .chat-input-box:not(.has-reference-stage) .rich-input,
body.workspace-mode-image .chat-input-box:not(.has-reference-stage) .rich-input,
body.workspace-mode-video .chat-input-box:not(.has-reference-stage) .rich-input {
    min-height: 63px;
    max-height: 140px;
    padding: 20px 20px 4px;
    font-size: 14px;
    line-height: 1.55;
}

body.workspace-mode-chat .input-hint,
body.workspace-mode-image .input-hint,
body.workspace-mode-video .input-hint {
    display: none;
}

body.workspace-mode-chat .input-toolbar,
body.workspace-mode-image .input-toolbar,
body.workspace-mode-video .input-toolbar {
    min-height: 46px;
    padding: 3px 10px 9px 12px;
    gap: 10px;
}

body.workspace-mode-chat .input-toolbar-left,
body.workspace-mode-image .input-toolbar-left,
body.workspace-mode-video .input-toolbar-left {
    gap: 4px;
    flex-wrap: nowrap;
}

body.workspace-mode-chat .input-toolbar-left::before,
body.workspace-mode-image .input-toolbar-left::before,
body.workspace-mode-video .input-toolbar-left::before {
    content: "";
    width: 1px;
    height: 20px;
    flex: 0 0 1px;
    margin-right: 3px;
    background: #303540;
}

body.theme-light.workspace-mode-chat .input-toolbar-left::before,
body.theme-light.workspace-mode-image .input-toolbar-left::before,
body.theme-light.workspace-mode-video .input-toolbar-left::before {
    background: #e3e6ec;
}

/* Chat attachments use the paperclip control as their add action. Keep the
   image/video reference placeholder out of the language composer and show
   uploaded files as small, stable cards instead of a tilted empty card. */
body.workspace-mode-chat .reference-stage {
    top: 10px;
    left: 14px;
    width: 70px;
    height: 58px;
    pointer-events: none;
}

body.workspace-mode-chat .reference-stage .empty-reference-trigger,
body.workspace-mode-chat .reference-stage .preview-item-add {
    display: none !important;
}

body.workspace-mode-chat .reference-stage.has-images {
    display: block;
}

body.workspace-mode-chat .reference-stage.has-images .preview-area {
    display: block;
    width: 70px;
    height: 58px;
    overflow: visible;
}

body.workspace-mode-chat .reference-stage.has-images .preview-item {
    top: 0;
    left: 0;
    width: 58px;
    height: 58px;
    border-radius: 9px;
    transform: none !important;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .22);
}

body.workspace-mode-chat .reference-stage.has-images .preview-item-file {
    width: 64px;
    height: 48px;
    top: 5px;
}

body.workspace-mode-chat .reference-stage.has-images .preview-item .preview-floating-name,
body.workspace-mode-chat .reference-stage.has-images .preview-item .preview-name {
    display: none;
}

body.workspace-mode-chat .reference-stage.has-images .preview-remove {
    display: grid;
    place-items: center;
    top: -7px;
    right: -7px;
    width: 18px;
    height: 18px;
    opacity: 1;
    border: 2px solid var(--chat-surface, #191c23);
    font-size: 11px;
}

body.workspace-mode-chat .chat-input-box.has-reference-stage .rich-input,
body.workspace-mode-chat .chat-input-box.has-reference-stage textarea {
    padding-left: 92px;
    min-height: 76px;
}

body.workspace-mode-chat .tool-btn,
body.workspace-mode-image .tool-btn,
body.workspace-mode-video .tool-btn,
body.workspace-mode-chat .asset-entry-btn,
body.workspace-mode-image .asset-entry-btn,
body.workspace-mode-video .asset-entry-btn {
    height: 32px;
    min-height: 32px;
    padding: 0 9px;
    border: 0;
    border-radius: 7px;
    color: rgba(226, 232, 240, 0.68);
    background: transparent;
    box-shadow: none;
}

body.workspace-mode-chat .tool-btn:hover,
body.workspace-mode-image .tool-btn:hover,
body.workspace-mode-video .tool-btn:hover,
body.workspace-mode-chat .asset-entry-btn:hover,
body.workspace-mode-image .asset-entry-btn:hover,
body.workspace-mode-video .asset-entry-btn:hover {
    color: #f2f4f7;
    background: #2d323d;
}

body.theme-light.workspace-mode-chat .tool-btn,
body.theme-light.workspace-mode-image .tool-btn,
body.theme-light.workspace-mode-video .tool-btn,
body.theme-light.workspace-mode-chat .asset-entry-btn,
body.theme-light.workspace-mode-image .asset-entry-btn,
body.theme-light.workspace-mode-video .asset-entry-btn {
    color: #686d77;
    background: transparent;
}

body.theme-light.workspace-mode-chat .tool-btn:hover,
body.theme-light.workspace-mode-image .tool-btn:hover,
body.theme-light.workspace-mode-video .tool-btn:hover,
body.theme-light.workspace-mode-chat .asset-entry-btn:hover,
body.theme-light.workspace-mode-image .asset-entry-btn:hover,
body.theme-light.workspace-mode-video .asset-entry-btn:hover {
    color: #17191d;
    background: #eceff4;
}

body.workspace-mode-chat .tool-btn.active,
body.workspace-mode-chat .asset-entry-btn.is-active,
body.workspace-mode-image .tool-btn.active,
body.workspace-mode-video .tool-btn.active {
    color: #f2f4f7;
    background: #252932;
    border: 0;
}

body.theme-light.workspace-mode-chat .tool-btn.active,
body.theme-light.workspace-mode-chat .asset-entry-btn.is-active,
body.theme-light.workspace-mode-image .tool-btn.active,
body.theme-light.workspace-mode-video .tool-btn.active {
    color: #17191d;
    background: #f3f5f8;
}

body.workspace-mode-chat #webSearchBtn.active.web-search {
    color: #a7f3d0;
    background: rgba(16, 185, 129, 0.14);
    box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.3);
}

body.theme-light.workspace-mode-chat #webSearchBtn.active.web-search {
    color: #047857;
    background: rgba(16, 185, 129, 0.12);
    box-shadow: inset 0 0 0 1px rgba(5, 150, 105, 0.25);
}

body.workspace-mode-chat #uploadBtn {
    order: 2;
    width: 32px;
    padding: 0;
    justify-content: center;
}
body.workspace-mode-chat .asset-entry-rail { order: 3; gap: 4px; }
body.workspace-mode-chat .thinking-level-picker { order: 4; }
body.workspace-mode-chat #webSearchBtn { order: 5; }
body.workspace-mode-image #imageModeBtn { order: 2; }
body.workspace-mode-image #imageAspectRatioBtn,
body.workspace-mode-image #imageSizeBtn,
body.workspace-mode-video #imageAspectRatioBtn { order: 3; }
body.workspace-mode-image #imageResolutionBtn,
body.workspace-mode-image #imageQualityBtn,
body.workspace-mode-video #imageResolutionBtn { order: 4; }
body.workspace-mode-image #imageCountBtn,
body.workspace-mode-video #videoDurationBtn { order: 5; }
body.workspace-mode-image #imageFormatBtn,
body.workspace-mode-video #videoStyleBtn { order: 6; }
body.workspace-mode-video #videoMovementBtn { order: 7; }
body.workspace-mode-video #imageCountBtn { order: 8; }

body.workspace-mode-image #imageModeBtn.is-display-only {
    pointer-events: none;
}

body.workspace-mode-image .image-option-btn.is-display-only {
    cursor: default;
    pointer-events: none;
}

.thinking-level-menu {
    width: 220px;
    padding: 7px;
    border-color: #303540;
    border-radius: 9px;
    background: #1c1f26;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.42), 0 2px 10px rgba(0, 0, 0, 0.24);
}

.thinking-level-option {
    min-height: 0;
    padding: 8px;
    border-radius: 6px;
}

body.theme-light .thinking-level-menu {
    border-color: #e3e6ec;
    background: #fff;
    box-shadow: 0 18px 50px rgba(22, 29, 43, 0.12), 0 2px 8px rgba(22, 29, 43, 0.05);
}

.image-options-popup {
    min-width: 220px;
    max-width: min(280px, calc(100vw - 24px));
    max-height: 320px;
    padding: 0;
    overflow: auto;
    border: 1px solid #363c48;
    border-radius: 10px;
    color: #d8dde7;
    background: rgba(28, 31, 38, 0.98);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.44), 0 2px 8px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    animation: composerOptionMenuIn 140ms ease-out;
    transform-origin: bottom left;
}

.image-option-popup-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 13px 11px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.image-option-popup-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    border-radius: 8px;
    color: #a8b9ff;
    background: rgba(124, 145, 255, 0.14);
}

.image-option-popup-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.image-option-popup-copy strong {
    color: #f2f4f7;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}

.image-option-popup-copy small {
    overflow: hidden;
    color: #858d9b;
    font-size: 11px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-option-popup-list {
    display: grid;
    gap: 2px;
    padding: 7px;
}

.image-option-item {
    width: 100%;
    border: 0;
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    padding: 7px 8px;
    border-radius: 7px;
    color: #c7cdd8;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: 0;
    text-align: left;
}

.image-option-item + .image-option-item {
    margin-top: 2px;
}

.image-option-item-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 22px;
    border-radius: 6px;
    color: #8f9db7;
    background: rgba(255, 255, 255, 0.06);
}

.image-option-item-label {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-option-item-check {
    flex: 0 0 15px;
    opacity: 0;
}

.image-option-item:hover {
    color: #f2f4f7;
    background: #252a34;
}

.image-option-item.active {
    color: #8db4ff;
    background: #242c3b;
}

.image-option-item.active .image-option-item-icon {
    color: #a8b9ff;
    background: rgba(124, 145, 255, 0.16);
}

.image-option-item.active .image-option-item-check {
    opacity: 1;
}

body.theme-light .image-options-popup {
    border-color: #d9dee7;
    color: #30343b;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 42px rgba(22, 29, 43, 0.14), 0 2px 7px rgba(22, 29, 43, 0.05);
}

body.theme-light .image-option-popup-head {
    border-bottom-color: rgba(17, 24, 39, 0.09);
}

body.theme-light .image-option-popup-icon {
    color: #386bc4;
    background: rgba(56, 107, 196, 0.11);
}

body.theme-light .image-option-popup-copy strong {
    color: #20242b;
}

body.theme-light .image-option-popup-copy small {
    color: #858c98;
}

body.theme-light .image-option-item {
    color: #555c68;
}

body.theme-light .image-option-item-icon {
    color: #7c8798;
    background: rgba(17, 24, 39, 0.055);
}

body.theme-light .image-option-item:hover {
    color: #17191d;
    background: #f1f3f7;
}

body.theme-light .image-option-item.active {
    color: #285fca;
    background: #edf3ff;
}

body.theme-light .image-option-item.active .image-option-item-icon {
    color: #386bc4;
    background: rgba(56, 107, 196, 0.12);
}

@keyframes composerOptionMenuIn {
    from {
        opacity: 0;
        transform: translateY(4px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Compact media controls: each action gets a quiet accent and a clear menu affordance. */
body.workspace-mode-image .image-option-btn,
body.workspace-mode-video .image-option-btn {
    --media-accent: #a8b9ff;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: auto;
    min-width: 0;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, 0.105) !important;
    border-radius: 9px !important;
    color: #c7ccd6;
    background: rgba(255, 255, 255, 0.035);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
    transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

body.workspace-mode-image .image-option-btn > svg:first-child,
body.workspace-mode-video .image-option-btn > svg:first-child {
    flex: 0 0 auto;
    color: var(--media-accent);
}

body.workspace-mode-image .image-option-btn > span,
body.workspace-mode-video .image-option-btn > span {
    overflow: hidden;
    max-width: 92px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.workspace-mode-image .image-option-btn:hover,
body.workspace-mode-video .image-option-btn:hover,
body.workspace-mode-image .image-option-btn.popup-open,
body.workspace-mode-video .image-option-btn.popup-open {
    border-color: color-mix(in srgb, var(--media-accent) 56%, transparent) !important;
    color: #f1f3f7;
    background: rgba(255, 255, 255, 0.08);
}

body.workspace-mode-image .image-option-btn.popup-open,
body.workspace-mode-video .image-option-btn.popup-open {
    transform: translateY(-1px);
}

#imageModeBtn { --media-accent: #d49cff; }
#imageSizeBtn { --media-accent: #9db2ff; }
#imageQualityBtn { --media-accent: #8eddb6; }
#imageFormatBtn { --media-accent: #aab4c6; }
#imageCountBtn { --media-accent: #e8bf62; }
#imageAspectRatioBtn { --media-accent: #7ed4e8; }
#imageResolutionBtn { --media-accent: #a9b9ff; }
#videoDurationBtn { --media-accent: #81d3df; }
#videoStyleBtn { --media-accent: #e9b275; }
#videoMovementBtn { --media-accent: #c2a0ff; }

body.workspace-mode-image .image-option-chevron,
body.workspace-mode-video .image-option-chevron {
    width: 12px;
    height: 12px;
    margin-left: 1px;
    color: #7e8795;
}

.image-options-popup[data-option-type="mode"] .image-option-popup-icon { color: #d49cff; background: rgba(212, 156, 255, 0.14); }
.image-options-popup[data-option-type="size"] .image-option-popup-icon { color: #9db2ff; background: rgba(157, 178, 255, 0.14); }
.image-options-popup[data-option-type="quality"] .image-option-popup-icon { color: #8eddb6; background: rgba(142, 221, 182, 0.14); }
.image-options-popup[data-option-type="count"] .image-option-popup-icon { color: #e8bf62; background: rgba(232, 191, 98, 0.14); }
.image-options-popup[data-option-type="aspectRatio"] .image-option-popup-icon { color: #7ed4e8; background: rgba(126, 212, 232, 0.14); }
.image-options-popup[data-option-type="resolution"] .image-option-popup-icon { color: #a9b9ff; background: rgba(169, 185, 255, 0.14); }
.image-options-popup[data-option-type="duration"] .image-option-popup-icon { color: #81d3df; background: rgba(129, 211, 223, 0.14); }
.image-options-popup[data-option-type="style"] .image-option-popup-icon { color: #e9b275; background: rgba(233, 178, 117, 0.14); }
.image-options-popup[data-option-type="movementAmplitude"] .image-option-popup-icon { color: #c2a0ff; background: rgba(194, 160, 255, 0.14); }

body.theme-light.workspace-mode-image .image-option-btn,
body.theme-light.workspace-mode-video .image-option-btn {
    border-color: rgba(17, 24, 39, 0.12) !important;
    color: #4f5663;
    background: rgba(17, 24, 39, 0.028);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

body.theme-light.workspace-mode-image .image-option-btn:hover,
body.theme-light.workspace-mode-video .image-option-btn:hover,
body.theme-light.workspace-mode-image .image-option-btn.popup-open,
body.theme-light.workspace-mode-video .image-option-btn.popup-open {
    border-color: color-mix(in srgb, var(--media-accent) 58%, rgba(17, 24, 39, 0.12)) !important;
    color: #20242b;
    background: rgba(17, 24, 39, 0.065);
}

body.workspace-mode-video .chat-input-box:not(.has-reference-stage) .rich-input.is-empty {
    height: 56px !important;
    min-height: 56px !important;
}

body.workspace-mode-chat .role-entry-btn {
    width: auto;
    padding: 0 9px;
    gap: 6px;
}

body.workspace-mode-chat .asset-entry-label {
    display: inline;
    font-size: 12px;
    font-weight: 500;
}

body.workspace-mode-chat .asset-entry-icon,
body.workspace-mode-chat .role-entry-btn .asset-entry-icon,
body.theme-light.workspace-mode-chat .asset-entry-icon,
body.theme-light.workspace-mode-chat .role-entry-btn .asset-entry-icon {
    color: inherit;
}

body.workspace-mode-chat .route-trigger-btn,
body.workspace-mode-image .route-trigger-btn,
body.workspace-mode-video .route-trigger-btn {
    display: none !important;
}

body.workspace-mode-chat .chat-price-badge,
body.workspace-mode-image .chat-price-badge,
body.workspace-mode-video .chat-price-badge {
    top: auto;
    right: 54px;
    bottom: 17px;
    max-width: 180px;
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: #787f8c;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    font-family: inherit;
    font-size: 10px;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.theme-light.workspace-mode-chat .chat-price-badge,
body.theme-light.workspace-mode-image .chat-price-badge,
body.theme-light.workspace-mode-video .chat-price-badge {
    border: 0;
    color: #969ca8;
    background: transparent;
}

body.workspace-mode-chat .send-btn,
body.workspace-mode-chat .stop-btn,
body.workspace-mode-image .send-btn,
body.workspace-mode-image .stop-btn,
body.workspace-mode-video .send-btn,
body.workspace-mode-video .stop-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border: 0;
    border-radius: 8px;
    color: #17191d;
    background: #f2f4f7;
    box-shadow: none;
}

body.theme-light.workspace-mode-chat .send-btn,
body.theme-light.workspace-mode-chat .stop-btn,
body.theme-light.workspace-mode-image .send-btn,
body.theme-light.workspace-mode-image .stop-btn,
body.theme-light.workspace-mode-video .send-btn,
body.theme-light.workspace-mode-video .stop-btn {
    color: #fff;
    background: #17191d;
}

body.workspace-mode-chat .send-btn:disabled,
body.workspace-mode-image .send-btn:disabled,
body.workspace-mode-video .send-btn:disabled {
    color: #787f8c;
    background: #252932;
}

body.theme-light.workspace-mode-chat .send-btn:disabled,
body.theme-light.workspace-mode-image .send-btn:disabled,
body.theme-light.workspace-mode-video .send-btn:disabled {
    color: #fff;
    background: #17191d;
}

body.workspace-mode-image .input-area,
body.workspace-mode-video .input-area {
    padding-right: 24px;
    padding-bottom: 18px;
    padding-left: 24px;
}

@media (max-width: 900px) {
    body.workspace-mode-chat .input-container,
    body.workspace-mode-image .input-container,
    body.workspace-mode-video .input-container {
        width: min(680px, calc(100% - 32px));
    }
}

@media (max-width: 768px) {
    body.workspace-mode-chat .input-container,
    body.workspace-mode-image .input-container,
    body.workspace-mode-video .input-container {
        width: 100%;
        max-width: none;
    }

    body.workspace-mode-chat .input-toolbar-left,
    body.workspace-mode-image .input-toolbar-left,
    body.workspace-mode-video .input-toolbar-left {
        flex-wrap: wrap;
        overflow: visible !important;
    }

    body.workspace-mode-chat .asset-entry-label,
    body.workspace-mode-chat #webSearchBtn > span {
        display: none;
    }

    body.workspace-mode-chat .role-entry-btn {
        width: 32px;
        padding: 0;
        justify-content: center;
    }

    body.workspace-mode-chat .chat-price-badge,
    body.workspace-mode-image .chat-price-badge,
    body.workspace-mode-video .chat-price-badge {
        display: none !important;
    }

    body.workspace-mode-chat .send-btn,
    body.workspace-mode-chat .stop-btn,
    body.workspace-mode-image .send-btn,
    body.workspace-mode-image .stop-btn,
    body.workspace-mode-video .send-btn,
    body.workspace-mode-video .stop-btn {
        min-width: 44px;
        min-height: 44px;
    }

    body.workspace-mode-image .input-area,
    body.workspace-mode-video .input-area {
        padding-right: 10px;
        padding-bottom: 10px;
        padding-left: 10px;
    }
}

/* Final desktop parity layer: this must remain after the legacy composer CSS. */
@media (min-width: 769px) {
    body.workspace-mode-chat .chat-input-box {
        padding: 12px 12px 10px;
        color: #f2f4f7;
        font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
        font-size: 14px;
        font-weight: 400;
        line-height: normal;
        letter-spacing: 0;
    }

    body.theme-light.workspace-mode-chat .chat-input-box {
        color: #17191d;
    }

    body.workspace-mode-chat .chat-input-box:not(.has-reference-stage) .rich-input {
        width: 100%;
        height: 56px;
        min-height: 56px;
        max-height: 140px;
        padding: 7px 8px 4px;
        color: inherit;
        font: inherit;
        line-height: 1.55;
        letter-spacing: 0;
    }

    body.workspace-mode-chat .input-toolbar {
        width: 100%;
        height: 34px;
        min-height: 34px;
        padding: 0;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        color: inherit;
        font: inherit;
        line-height: normal;
        letter-spacing: 0;
    }

    body.workspace-mode-chat .input-toolbar-left {
        height: 32px;
        gap: 4px;
        flex-wrap: nowrap;
        color: inherit;
        font: inherit;
        line-height: normal;
        letter-spacing: 0;
    }

    body.workspace-mode-chat #uploadBtn {
        display: grid;
        place-items: center;
        gap: 0;
    }

    body.workspace-mode-chat #thinkingBtn.active,
    body.workspace-mode-chat #thinkingBtn.thinking-mode {
        color: #adb3bf;
        background: transparent;
    }

    body.theme-light.workspace-mode-chat #thinkingBtn.active,
    body.theme-light.workspace-mode-chat #thinkingBtn.thinking-mode {
        color: #686d77;
        background: transparent;
    }

    body.workspace-mode-chat .chat-price-badge:not(.hidden) {
        right: 56px;
        bottom: 20px;
        display: block !important;
        height: auto;
        color: #787f8c;
        opacity: 1 !important;
        font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
        font-size: 10px;
        font-weight: 400;
        line-height: normal;
        letter-spacing: 0;
        transition: none;
    }

    body.theme-light.workspace-mode-chat .chat-price-badge:not(.hidden) {
        color: #969ca8;
    }

    body.workspace-mode-chat .send-btn,
    body.workspace-mode-chat .stop-btn {
        display: grid;
        place-items: center;
        padding: 0;
    }
}

/* Image and video use the same A composer, with upload stages above it. */
@media (min-width: 769px) {
    body.workspace-mode-image .chat-input-box,
    body.workspace-mode-video .chat-input-box {
        padding: 12px 12px 10px;
        color: #f2f4f7;
        font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
        font-size: 14px;
        font-weight: 400;
        line-height: normal;
        letter-spacing: 0;
    }

    body.theme-light.workspace-mode-image .chat-input-box,
    body.theme-light.workspace-mode-video .chat-input-box {
        color: #17191d;
    }

    body.workspace-mode-image .chat-input-box .rich-input,
    body.workspace-mode-video .chat-input-box .rich-input,
    body.workspace-mode-image .chat-input-box.has-reference-stage .rich-input,
    body.workspace-mode-video .chat-input-box.has-reference-stage .rich-input {
        width: 100%;
        height: 56px;
        min-height: 56px;
        max-height: 140px;
        padding: 7px 8px 4px;
        color: inherit;
        font: inherit;
        line-height: 1.55;
        letter-spacing: 0;
    }

    body.workspace-mode-image .chat-input-box .rich-input.is-empty::before,
    body.workspace-mode-video .chat-input-box .rich-input.is-empty::before {
        color: #787f8c;
        font: inherit;
        letter-spacing: 0;
    }

    body.theme-light.workspace-mode-image .chat-input-box .rich-input.is-empty::before,
    body.theme-light.workspace-mode-video .chat-input-box .rich-input.is-empty::before {
        color: #969ca8;
    }

    body.workspace-mode-image .input-toolbar,
    body.workspace-mode-video .input-toolbar {
        width: 100%;
        height: 34px;
        min-height: 34px;
        padding: 0;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        color: inherit;
        font: inherit;
        line-height: normal;
        letter-spacing: 0;
    }

    body.workspace-mode-image .input-toolbar-left,
    body.workspace-mode-video .input-toolbar-left {
        height: 32px;
        align-items: center;
        gap: 4px;
        flex-wrap: nowrap;
        color: inherit;
        font: inherit;
        line-height: normal;
        letter-spacing: 0;
    }

    body.workspace-mode-image .image-option-btn,
    body.workspace-mode-video .image-option-btn,
    body.workspace-mode-video #videoBgmBtn {
        height: 32px;
        min-height: 32px;
        border: 0;
        border-radius: 7px;
        color: #adb3bf;
        background: transparent;
        box-shadow: none;
        font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
        font-size: 14px;
        font-weight: 400;
        line-height: normal;
        letter-spacing: 0;
    }

    body.theme-light.workspace-mode-image .image-option-btn,
    body.theme-light.workspace-mode-video .image-option-btn,
    body.theme-light.workspace-mode-video #videoBgmBtn {
        color: #686d77;
        background: transparent;
    }

    body.workspace-mode-image .image-option-btn,
    body.workspace-mode-video .image-option-btn,
    body.workspace-mode-video #videoBgmBtn {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 6px;
        width: auto;
        padding: 0 9px;
    }

    body.workspace-mode-image .image-option-btn > span,
    body.workspace-mode-video .image-option-btn > span,
    body.workspace-mode-video #videoBgmBtn > span {
        color: inherit;
        font: inherit;
        line-height: normal;
        letter-spacing: 0;
    }

    body.workspace-mode-image .image-option-btn.active,
    body.workspace-mode-video .image-option-btn.active,
    body.workspace-mode-video #videoBgmBtn.active {
        color: #adb3bf;
        background: transparent;
    }

    body.theme-light.workspace-mode-image .image-option-btn.active,
    body.theme-light.workspace-mode-video .image-option-btn.active,
    body.theme-light.workspace-mode-video #videoBgmBtn.active {
        color: #686d77;
        background: transparent;
    }

    body.workspace-mode-image .image-option-btn:hover,
    body.workspace-mode-video .image-option-btn:hover,
    body.workspace-mode-video #videoBgmBtn:hover {
        color: #f2f4f7;
        background: #2d323d;
    }

    body.theme-light.workspace-mode-image .image-option-btn:hover,
    body.theme-light.workspace-mode-video .image-option-btn:hover,
    body.theme-light.workspace-mode-video #videoBgmBtn:hover {
        color: #17191d;
        background: #eceff4;
    }

    body.workspace-mode-image .chat-price-badge:not(.hidden),
    body.workspace-mode-video .chat-price-badge:not(.hidden) {
        right: 56px;
        bottom: 20px;
        display: block !important;
        height: auto;
        color: #787f8c;
        opacity: 1 !important;
        font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
        font-size: 10px;
        font-weight: 400;
        line-height: normal;
        letter-spacing: 0;
        transition: none;
    }

    body.theme-light.workspace-mode-image .chat-price-badge:not(.hidden),
    body.theme-light.workspace-mode-video .chat-price-badge:not(.hidden) {
        color: #969ca8;
    }

    body.workspace-mode-image .send-btn,
    body.workspace-mode-image .stop-btn,
    body.workspace-mode-video .send-btn,
    body.workspace-mode-video .stop-btn {
        display: grid;
        place-items: center;
        padding: 0;
    }

    body.workspace-mode-image .reference-stage,
    body.workspace-mode-video .reference-stage {
        top: -112px;
        left: 0;
        width: 100%;
        height: 86px;
        contain: layout paint;
    }

    body.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-trigger,
    body.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-trigger {
        inset: 0;
        width: 100%;
        height: 86px;
        flex-direction: row;
        border: 1px dashed #444b59;
        border-radius: 8px;
        background: rgba(28, 31, 38, 0.68);
        box-shadow: none;
        transform: none;
    }

    body.theme-light.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-trigger,
    body.theme-light.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-trigger {
        border-color: #cfd4dd;
        background: rgba(255, 255, 255, 0.66);
    }

    body.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-trigger:hover,
    body.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-trigger:hover {
        border-color: #5c6678;
        background: rgba(37, 41, 50, 0.82);
        box-shadow: none;
        transform: none;
    }

    body.theme-light.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-trigger:hover,
    body.theme-light.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-trigger:hover {
        border-color: #aeb6c3;
        background: rgba(255, 255, 255, 0.9);
    }

    body.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-content,
    body.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-content {
        flex-direction: row;
        gap: 12px;
        color: #adb3bf;
    }

    body.theme-light.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-content,
    body.theme-light.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-content {
        color: #686d77;
    }

    body.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-icon,
    body.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-icon {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        border-radius: 7px;
        color: #79a7ff;
        background: #203150;
    }

    body.theme-light.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-icon,
    body.theme-light.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-icon {
        color: #326bde;
        background: #e9f0ff;
    }

    body.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-icon svg,
    body.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-icon svg {
        width: 19px;
        height: 19px;
        stroke-width: 2;
    }

    body.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-content span,
    body.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-content span {
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0;
    }

    body.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-content span::before,
    body.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-content span::before {
        content: "添加";
    }

    body.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-badge,
    body.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-badge {
        display: none;
    }

    body.workspace-mode-image .reference-stage.has-images,
    body.workspace-mode-video .reference-stage.has-images {
        border: 1px dashed #444b59;
        border-radius: 8px;
        background: rgba(28, 31, 38, 0.68);
    }

    body.theme-light.workspace-mode-image .reference-stage.has-images,
    body.theme-light.workspace-mode-video .reference-stage.has-images {
        border-color: #cfd4dd;
        background: rgba(255, 255, 255, 0.66);
    }

    body.workspace-mode-image .reference-stage.has-images .preview-item,
    body.workspace-mode-video .reference-stage.has-images .preview-item {
        top: 6px;
        width: 56px;
        height: 72px;
        border-radius: 7px;
    }

    body.workspace-mode-image .reference-stage.has-images .empty-reference-trigger,
    body.workspace-mode-video .reference-stage.has-images .empty-reference-trigger {
        top: 53px;
        left: 78px;
    }

    body.workspace-mode-video .frame-upload-panel.visible {
        position: absolute;
        left: 0;
        bottom: calc(100% + 26px);
        z-index: 8;
        width: 100%;
        height: 86px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        margin: 0;
        padding: 10px 12px;
        border: 1px dashed #444b59;
        border-radius: 8px;
        background: rgba(28, 31, 38, 0.68);
    }

    body.theme-light.workspace-mode-video .frame-upload-panel.visible {
        border-color: #cfd4dd;
        background: rgba(255, 255, 255, 0.66);
    }

    body.workspace-mode-video .frame-upload-panel.visible .frame-slot {
        width: 100%;
        height: 64px;
        border: 1px dashed #444b59;
        border-radius: 7px;
        background: rgba(28, 31, 38, 0.72);
    }

    body.theme-light.workspace-mode-video .frame-upload-panel.visible .frame-slot {
        border-color: #cfd4dd;
        background: rgba(255, 255, 255, 0.82);
    }

    body.workspace-mode-video .frame-upload-panel.visible .frame-slot:hover {
        border-color: #5c6678;
        background: #252932;
    }

    body.theme-light.workspace-mode-video .frame-upload-panel.visible .frame-slot:hover {
        border-color: #aeb6c3;
        background: #f3f5f8;
    }

    body.workspace-mode-video .frame-upload-panel.visible .frame-slot-placeholder {
        flex-direction: row;
        gap: 8px;
        color: #adb3bf;
        font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
        font-size: 12px;
        font-weight: 600;
    }

    body.theme-light.workspace-mode-video .frame-upload-panel.visible .frame-slot-placeholder {
        color: #686d77;
    }

    body.workspace-mode-video .frame-upload-panel.visible .frame-slot-placeholder svg {
        width: 19px;
        height: 19px;
        opacity: 1;
    }

    body.workspace-mode-video .frame-upload-panel.visible .frame-slot-arrow {
        justify-content: center;
        color: #787f8c;
    }

    body.theme-light.workspace-mode-video .frame-upload-panel.visible .frame-slot-arrow {
        color: #969ca8;
    }

    body.workspace-mode-video .input-container:has(.frame-upload-panel.visible) .reference-stage {
        display: none !important;
    }
}

/* Upload placeholders stay inside the image/video composer. */
@media (min-width: 769px) {
    body.workspace-mode-image #imageModeBtn {
        display: none !important;
    }

    body.workspace-mode-image .chat-input-box.has-reference-stage,
    body.workspace-mode-video .chat-input-box.has-reference-stage,
    body.workspace-mode-video .input-container:has(.frame-upload-panel.visible) .chat-input-box {
        min-height: 146px;
    }

    body.workspace-mode-image .chat-input-box.has-reference-stage .rich-input,
    body.workspace-mode-video .chat-input-box.has-reference-stage .rich-input {
        height: 88px;
        min-height: 88px;
        padding: 10px 8px 4px 104px;
    }

    body.workspace-mode-image .reference-stage,
    body.workspace-mode-video .reference-stage {
        top: 12px;
        left: 12px;
        width: 84px;
        height: 88px;
        border: 0;
        border-radius: 0;
        background: transparent;
        contain: layout;
    }

    body.theme-light.workspace-mode-image .reference-stage,
    body.theme-light.workspace-mode-video .reference-stage,
    body.theme-light.workspace-mode-image .reference-stage.has-images,
    body.theme-light.workspace-mode-video .reference-stage.has-images,
    body.workspace-mode-image .reference-stage.has-images,
    body.workspace-mode-video .reference-stage.has-images {
        border: 0;
        background: transparent;
    }

    body.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-trigger,
    body.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-trigger {
        inset: 6px 4px;
        width: 76px;
        height: 76px;
        flex-direction: column;
        border: 1px dashed #4a5260;
        border-radius: 8px;
        background: rgba(37, 41, 50, 0.76);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
        transform: rotate(-2deg);
    }

    body.theme-light.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-trigger,
    body.theme-light.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-trigger {
        border-color: #cfd4dd;
        background: rgba(247, 248, 251, 0.92);
        box-shadow: 0 7px 18px rgba(22, 29, 43, 0.07);
    }

    body.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-trigger:hover,
    body.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-trigger:hover {
        border-color: #667386;
        background: #2d323d;
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
        transform: translateY(-2px) rotate(0deg);
    }

    body.theme-light.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-trigger:hover,
    body.theme-light.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-trigger:hover {
        border-color: #aeb6c3;
        background: #fff;
        box-shadow: 0 10px 24px rgba(22, 29, 43, 0.11);
    }

    body.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-content,
    body.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-content {
        flex-direction: column;
        gap: 6px;
    }

    body.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-icon,
    body.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-icon {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
        border-radius: 7px;
    }

    body.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-icon svg,
    body.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-icon svg {
        width: 16px;
        height: 16px;
    }

    body.workspace-mode-image .reference-stage:not(.has-images) .empty-reference-content span,
    body.workspace-mode-video .reference-stage:not(.has-images) .empty-reference-content span {
        font-size: 10px;
        font-weight: 600;
        line-height: 1.2;
    }

    body.workspace-mode-image .reference-stage.has-images .preview-item,
    body.workspace-mode-video .reference-stage.has-images .preview-item {
        top: 7px;
        left: 7px;
        width: 58px;
        height: 74px;
        padding: 3px;
        border-radius: 8px;
    }

    body.workspace-mode-image .reference-stage.has-images .empty-reference-trigger,
    body.workspace-mode-video .reference-stage.has-images .empty-reference-trigger {
        top: 58px;
        left: 58px;
        width: 24px;
        height: 24px;
    }

    body.workspace-mode-video .frame-upload-panel.visible {
        position: absolute;
        top: 12px;
        bottom: auto;
        left: 12px;
        z-index: 8;
        width: 184px;
        height: 88px;
        grid-template-columns: 76px 12px 76px;
        gap: 4px;
        margin: 0;
        padding: 6px 4px;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    body.theme-light.workspace-mode-video .frame-upload-panel.visible {
        border: 0;
        background: transparent;
    }

    body.workspace-mode-video .frame-upload-panel.visible .frame-slot {
        width: 76px;
        height: 76px;
        border: 1px dashed #4a5260;
        border-radius: 8px;
        background: rgba(37, 41, 50, 0.76);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
    }

    body.theme-light.workspace-mode-video .frame-upload-panel.visible .frame-slot {
        border-color: #cfd4dd;
        background: rgba(247, 248, 251, 0.92);
        box-shadow: 0 7px 18px rgba(22, 29, 43, 0.07);
    }

    body.workspace-mode-video .frame-upload-panel.visible .frame-slot-placeholder {
        flex-direction: column;
        gap: 5px;
        font-size: 10px;
        line-height: 1.2;
    }

    body.workspace-mode-video .frame-upload-panel.visible .frame-slot-placeholder svg {
        width: 17px;
        height: 17px;
    }

    body.workspace-mode-video .frame-upload-panel.visible .frame-slot-arrow svg {
        width: 12px;
        height: 12px;
    }

body.workspace-mode-video .input-container:has(.frame-upload-panel.visible) .chat-input-box .rich-input {
        height: 88px;
        min-height: 88px;
        padding: 10px 8px 4px 204px;
    }
}

/* Keep compact text controls on one line when the toolbar is tight. */

body.workspace-mode-chat .asset-entry-label { white-space: nowrap; }

/* Match the image/video asset icon to the visual weight of adjacent controls. */

body.workspace-mode-image #assetSelectorBtn,
body.workspace-mode-video #assetSelectorBtn {
    width: 32px;
    min-width: 32px;
    padding: 0;
    gap: 0;
    justify-content: center;
}

body.workspace-mode-image #assetSelectorBtn .asset-entry-icon,
body.workspace-mode-video #assetSelectorBtn .asset-entry-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

body.workspace-mode-image #assetSelectorBtn .asset-entry-icon svg,
body.workspace-mode-video #assetSelectorBtn .asset-entry-icon svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 768px) {
    body.workspace-mode-image #assetSelectorBtn,
    body.workspace-mode-video #assetSelectorBtn {
        width: 44px;
        min-width: 44px;
        padding: 0;
        justify-content: center;
    }
}

/* Quiet framed controls: clear affordance without turning the toolbar into a grid. */

body.workspace-mode-chat .chat-input-box,
body.workspace-mode-image .chat-input-box,
body.workspace-mode-video .chat-input-box {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(25, 28, 34, 0.94);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

body.workspace-mode-chat .chat-input-box:focus-within,
body.workspace-mode-image .chat-input-box:focus-within,
body.workspace-mode-video .chat-input-box:focus-within {
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.theme-light.workspace-mode-chat .chat-input-box,
body.theme-light.workspace-mode-image .chat-input-box,
body.theme-light.workspace-mode-video .chat-input-box {
    border-color: rgba(17, 24, 39, 0.12);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body.theme-light.workspace-mode-chat .chat-input-box:focus-within,
body.theme-light.workspace-mode-image .chat-input-box:focus-within,
body.theme-light.workspace-mode-video .chat-input-box:focus-within {
    border-color: rgba(17, 24, 39, 0.22);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body.workspace-mode-chat .tool-btn,
body.workspace-mode-image .tool-btn,
body.workspace-mode-video .tool-btn,
body.workspace-mode-chat .asset-entry-btn,
body.workspace-mode-image .asset-entry-btn,
body.workspace-mode-video .asset-entry-btn {
    box-sizing: border-box;
    height: 32px;
    min-height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 7px;
    color: #adb3bf;
    background: rgba(255, 255, 255, 0.025);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.018);
}

body.workspace-mode-chat .tool-btn:hover,
body.workspace-mode-image .tool-btn:hover,
body.workspace-mode-video .tool-btn:hover,
body.workspace-mode-chat .asset-entry-btn:hover,
body.workspace-mode-image .asset-entry-btn:hover,
body.workspace-mode-video .asset-entry-btn:hover {
    border-color: rgba(255, 255, 255, 0.15);
    color: #f2f4f7;
    background: rgba(255, 255, 255, 0.065);
}

body.workspace-mode-chat .tool-btn.active,
body.workspace-mode-chat .asset-entry-btn.is-active,
body.workspace-mode-image .tool-btn.active,
body.workspace-mode-video .tool-btn.active,
body.workspace-mode-image .asset-entry-btn.is-active,
body.workspace-mode-video .asset-entry-btn.is-active {
    border-color: rgba(255, 255, 255, 0.17);
    color: #f2f4f7;
    background: rgba(255, 255, 255, 0.085);
}

body.theme-light.workspace-mode-chat .tool-btn,
body.theme-light.workspace-mode-image .tool-btn,
body.theme-light.workspace-mode-video .tool-btn,
body.theme-light.workspace-mode-chat .asset-entry-btn,
body.theme-light.workspace-mode-image .asset-entry-btn,
body.theme-light.workspace-mode-video .asset-entry-btn {
    border-color: rgba(17, 24, 39, 0.09);
    color: #686d77;
    background: rgba(17, 24, 39, 0.018);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

body.theme-light.workspace-mode-chat .tool-btn:hover,
body.theme-light.workspace-mode-image .tool-btn:hover,
body.theme-light.workspace-mode-video .tool-btn:hover,
body.theme-light.workspace-mode-chat .asset-entry-btn:hover,
body.theme-light.workspace-mode-image .asset-entry-btn:hover,
body.theme-light.workspace-mode-video .asset-entry-btn:hover {
    border-color: rgba(17, 24, 39, 0.16);
    color: #17191d;
    background: rgba(17, 24, 39, 0.055);
}

body.theme-light.workspace-mode-chat .tool-btn.active,
body.theme-light.workspace-mode-chat .asset-entry-btn.is-active,
body.theme-light.workspace-mode-image .tool-btn.active,
body.theme-light.workspace-mode-video .tool-btn.active,
body.theme-light.workspace-mode-image .asset-entry-btn.is-active,
body.theme-light.workspace-mode-video .asset-entry-btn.is-active {
    border-color: rgba(17, 24, 39, 0.18);
    color: #17191d;
    background: rgba(17, 24, 39, 0.075);
}

body.workspace-mode-chat .send-btn,
body.workspace-mode-chat .stop-btn,
body.workspace-mode-image .send-btn,
body.workspace-mode-image .stop-btn,
body.workspace-mode-video .send-btn,
body.workspace-mode-video .stop-btn {
    border: 0;
    box-shadow: none;
}

/* The sidebar owns model selection, so the toolbar starts without a divider. */

body.workspace-mode-chat .input-toolbar-left::before,
body.workspace-mode-image .input-toolbar-left::before,
body.workspace-mode-video .input-toolbar-left::before { display: none; }

/* Composer A needs an explicit compact state because its expanded rules load last. */

body.workspace-mode-chat .chat-input-box.composer-collapsed {
    width: min(620px, 100%);
    max-width: 620px;
    min-height: 72px;
    height: 72px;
    padding: 0;
    overflow: hidden;
    border-radius: 18px;
}

body.workspace-mode-chat .chat-input-box.composer-collapsed .rich-input {
    box-sizing: border-box;
    min-height: 70px;
    height: 70px !important;
    max-height: 70px;
    padding: 0 76px 0 24px;
    overflow: hidden;
    white-space: nowrap;
    font-size: 14px;
    line-height: 70px !important;
}

/* Image and video composers use the same compact scroll state. */

body.workspace-mode-image .chat-input-box.composer-collapsed,
body.workspace-mode-video .chat-input-box.composer-collapsed {
    width: min(620px, 100%);
    max-width: 620px;
    min-height: 72px !important;
    height: 72px !important;
    padding: 0;
    overflow: hidden;
    border-radius: 18px;
}

body.workspace-mode-image .chat-input-box.composer-collapsed .rich-input,
body.workspace-mode-video .chat-input-box.composer-collapsed .rich-input,
body.workspace-mode-image .chat-input-box.composer-collapsed.has-reference-stage .rich-input,
body.workspace-mode-video .chat-input-box.composer-collapsed.has-reference-stage .rich-input,
body.workspace-mode-video .input-container:has(.frame-upload-panel.visible) .chat-input-box.composer-collapsed .rich-input {
    box-sizing: border-box;
    min-height: 70px !important;
    height: 70px !important;
    max-height: 70px !important;
    padding: 0 76px 0 24px !important;
    overflow: hidden;
    white-space: nowrap;
    font-size: 14px;
    line-height: 70px !important;
}

body.workspace-mode-image .chat-input-box.composer-collapsed .reference-stage,
body.workspace-mode-video .chat-input-box.composer-collapsed .reference-stage,
body.workspace-mode-video .input-area.composer-collapsed .frame-upload-panel.visible {
    display: none !important;
}

body.workspace-mode-chat .chat-input-box.composer-collapsed .input-toolbar,
body.workspace-mode-image .chat-input-box.composer-collapsed .input-toolbar,
body.workspace-mode-video .chat-input-box.composer-collapsed .input-toolbar {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0 11px 0 0;
    align-items: center;
    justify-content: flex-end;
    pointer-events: none;
}

body.workspace-mode-chat .chat-input-box.composer-collapsed .input-toolbar-right,
body.workspace-mode-image .chat-input-box.composer-collapsed .input-toolbar-right,
body.workspace-mode-video .chat-input-box.composer-collapsed .input-toolbar-right {
    display: flex;
    align-items: center;
    transform: none;
    pointer-events: auto;
}

body.workspace-mode-chat .chat-input-box.composer-collapsed .send-btn,
body.workspace-mode-chat .chat-input-box.composer-collapsed .stop-btn,
body.workspace-mode-image .chat-input-box.composer-collapsed .send-btn,
body.workspace-mode-image .chat-input-box.composer-collapsed .stop-btn,
body.workspace-mode-video .chat-input-box.composer-collapsed .send-btn,
body.workspace-mode-video .chat-input-box.composer-collapsed .stop-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    border-radius: 14px;
}

/* Start/end frame cards live inside the video composer, to the left of the prompt. */

body.workspace-mode-video .chat-input-box > .frame-upload-panel.visible {
    position: absolute !important;
    inset: 12px auto auto 12px !important;
    z-index: 6;
    box-sizing: border-box;
    width: 154px !important;
    height: 76px !important;
    display: grid !important;
    grid-template-columns: 68px 10px 68px !important;
    align-items: center;
    gap: 4px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
}

body.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot {
    position: relative;
    box-sizing: border-box;
    width: 68px !important;
    height: 76px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px dashed rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
    color: #adb3bf;
    background: rgba(255, 255, 255, 0.035) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025) !important;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

body.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot:hover {
    border-color: rgba(255, 255, 255, 0.38) !important;
    color: #f2f4f7;
    background: rgba(255, 255, 255, 0.075) !important;
    transform: translateY(-1px);
}

body.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot.has-image {
    border-style: solid !important;
    border-color: rgba(255, 255, 255, 0.24) !important;
}

body.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot-placeholder {
    display: flex;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
    gap: 6px !important;
    color: inherit;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    font-size: 11px !important;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0;
}

body.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot-placeholder svg {
    width: 20px !important;
    height: 20px !important;
    opacity: 0.82 !important;
}

body.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot-arrow {
    width: 10px;
    display: flex;
    align-items: center;
    justify-content: center !important;
    color: #686f7c;
    opacity: 1;
}

body.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot-arrow svg {
    width: 12px !important;
    height: 12px !important;
}

body.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 7px;
}

body.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot-label {
    bottom: 0;
    padding: 10px 0 4px;
    border-radius: 0 0 7px 7px;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
}

body.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot-remove {
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    background: rgba(17, 19, 24, 0.78);
    font-size: 10px;
    line-height: 16px;
}

body.workspace-mode-video .chat-input-box:has(> .frame-upload-panel.visible) > .reference-stage {
    display: none !important;
}

body.workspace-mode-video .chat-input-box:has(> .frame-upload-panel.visible) > .rich-input {
    box-sizing: border-box;
    width: 100%;
    height: 88px !important;
    min-height: 88px !important;
    padding: 9px 8px 4px 174px !important;
}

body.theme-light.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot {
    border-color: rgba(17, 24, 39, 0.17) !important;
    color: #686d77;
    background: rgba(17, 24, 39, 0.025) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}

body.theme-light.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot:hover {
    border-color: rgba(17, 24, 39, 0.32) !important;
    color: #17191d;
    background: rgba(17, 24, 39, 0.055) !important;
}

body.theme-light.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot.has-image {
    border-color: rgba(17, 24, 39, 0.22) !important;
}

body.theme-light.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot-arrow {
    color: #969ca8;
}

/* Light workspace background: quiet blue-gray canvas, dark theme unchanged. */
body.theme-light.chat-shell,
body.theme-light .app-container,
body.theme-light .main-content,
body.theme-light .content-area {
    background: #f6f8fb;
}

body.theme-light .top-left-console,
body.theme-light .top-action-btn,
body.theme-light .top-model-capsule {
    color: #334155;
    background: rgba(255, 255, 255, 0.84);
    border-color: rgba(30, 50, 80, 0.1);
    box-shadow: 0 6px 20px rgba(36, 52, 77, 0.08);
}

body.theme-light .top-model-capsule .current-model-name,
body.theme-light .top-left-console .console-btn,
body.theme-light .top-action-btn {
    color: #334155;
}

body.theme-light .top-left-console:hover,
body.theme-light .top-action-btn:hover,
body.theme-light .top-model-capsule:hover {
    background: #ffffff;
    border-color: rgba(79, 70, 229, 0.18);
    box-shadow: 0 8px 24px rgba(36, 52, 77, 0.12);
}

body.theme-light .input-area {
    background: linear-gradient(180deg, rgba(246, 248, 251, 0) 0%, rgba(246, 248, 251, 0.86) 42%, #f6f8fb 100%);
}

body.workspace-mode-video .chat-input-box.composer-collapsed > .frame-upload-panel.visible {
    display: none !important;
}

/* API connection modal: the original premium skin is dark-first. Keep that
   skin in dark mode and provide explicit readable tokens for light mode. */
body.theme-light .ultra-premium-modal {
    background: rgba(255, 255, 255, 0.98) !important;
    border-color: rgba(15, 23, 42, 0.12) !important;
    box-shadow: 0 28px 72px rgba(15, 23, 42, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

body.theme-light .up-modal-header::after {
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.12), transparent) !important;
}

body.theme-light .up-header-titles h3,
body.theme-light .up-modal-body h4 {
    color: #172033 !important;
}

body.theme-light .up-header-titles p,
body.theme-light .up-status-indicator,
body.theme-light .up-key-meta,
body.theme-light .up-empty-state p,
body.theme-light .up-link-muted {
    color: #64748b !important;
}

body.theme-light .up-close-btn,
body.theme-light .up-input-icon-btn {
    color: #64748b !important;
}

body.theme-light .up-close-btn:hover,
body.theme-light .up-input-icon-btn:hover {
    color: #172033 !important;
    background: rgba(15, 23, 42, 0.06) !important;
}

body.theme-light .up-status-card,
body.theme-light .up-key-item {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    box-shadow: none !important;
}

body.theme-light .up-key-item:hover,
body.theme-light .up-key-item.active {
    background: #f1f5ff !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08) !important;
}

body.theme-light .up-status-value,
body.theme-light .up-key-name,
body.theme-light .up-empty-state h4 {
    color: #172033 !important;
}

body.theme-light .up-key-tag {
    background: #e2e8f0 !important;
    color: #475569 !important;
}

body.theme-light .up-key-list {
    scrollbar-color: #cbd5e1 transparent;
}

body.theme-light .up-modal-body > div[style*="linear-gradient"] {
    background: linear-gradient(90deg, transparent 0%, rgba(15, 23, 42, 0.12) 50%, transparent 100%) !important;
}

body.theme-light .up-form-group > div[style*="font-size"] {
    color: #64748b !important;
}

body.theme-light .up-input {
    background: #f8fafc !important;
    border-color: #d7dee9 !important;
    color: #172033 !important;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03) !important;
}

body.theme-light .up-input:focus {
    background: #fff !important;
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12) !important;
}

body.theme-light .up-input::placeholder {
    color: #94a3b8 !important;
}

/* Keep the action cards inside the popover. Hover lift must not enlarge the
   pseudo-border beyond the parent panel. */
.action-popover {
    box-sizing: border-box;
    overflow: hidden;
}

.action-menu-grid {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.action-menu-item {
    min-width: 0;
    box-sizing: border-box;
    transform-origin: center;
}

.action-menu-item:hover {
    transform: translateY(-1px) !important;
}

@media (max-width: 768px) {
    .action-popover {
        overflow-x: hidden;
        overflow-y: auto;
    }
}

@media (max-width: 768px) {
    body.workspace-mode-video .chat-input-box:has(> .frame-upload-panel.visible) {
        min-height: 140px;
    }
    body.workspace-mode-video .chat-input-box > .frame-upload-panel.visible {
        inset: 10px auto auto 10px !important;
        width: 134px !important;
        height: 66px !important;
        grid-template-columns: 59px 8px 59px !important;
        gap: 4px !important;
    }
    body.workspace-mode-video .chat-input-box > .frame-upload-panel.visible .frame-slot {
        width: 59px !important;
        height: 66px !important;
    }
    body.workspace-mode-video .chat-input-box:has(> .frame-upload-panel.visible) > .rich-input {
        min-height: 82px !important;
        height: 82px !important;
        padding: 8px 8px 4px 150px !important;
    }
}

/* The active role is a separate context label above the composer. It never
   changes the input box height or the text's starting position. */
.input-container > .role-status-chip {
    position: relative !important;
    inset: auto !important;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: min(320px, 100%);
    min-height: 30px;
    margin: 0 0 8px 2px !important;
    padding: 0 8px 0 9px;
    gap: 7px;
    border: 1px solid rgba(129, 140, 248, .28);
    border-radius: 10px;
    background: rgba(99, 102, 241, .12);
    box-shadow: 0 5px 16px rgba(30, 41, 59, .12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transform-origin: left bottom;
    animation: roleStatusEnter .2s ease-out;
}

.input-container > .role-status-chip .role-status-dot {
    width: 6px;
    height: 6px;
    background: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

.input-container > .role-status-chip .role-status-label {
    color: #4f46e5;
    font-size: 11px;
    font-weight: 650;
}

.input-container > .role-status-chip .role-status-name {
    max-width: 170px;
    color: #1e1b4b;
    font-size: 12px;
    font-weight: 700;
}

.input-container > .role-status-chip .role-status-close {
    width: 20px;
    height: 20px;
    border: 0;
    color: #6366f1;
    background: rgba(99, 102, 241, .09);
}

.input-container > .role-status-chip .role-status-close:hover {
    color: #3730a3;
    background: rgba(99, 102, 241, .18);
}

/* Moving the chip outside means the original input metrics remain
   authoritative, including when the composer is collapsed. */
.chat-input-box.has-role-status > .rich-input,
.chat-input-box.has-role-status > textarea {
    padding: 20px 20px 4px !important;
}

.chat-input-box.composer-collapsed.has-role-status > .rich-input,
.chat-input-box.composer-collapsed.has-role-status > textarea {
    padding: 24px 84px 18px 24px !important;
}

body.theme-dark .input-container > .role-status-chip,
body:not(.theme-light) .input-container > .role-status-chip {
    border-color: rgba(165, 180, 252, .26);
    background: rgba(49, 46, 129, .26);
    box-shadow: 0 8px 20px rgba(2, 6, 23, .28);
}

body.theme-dark .input-container > .role-status-chip .role-status-label,
body:not(.theme-light) .input-container > .role-status-chip .role-status-label {
    color: #c7d2fe;
}

body.theme-dark .input-container > .role-status-chip .role-status-name,
body:not(.theme-light) .input-container > .role-status-chip .role-status-name {
    color: #eef2ff;
}

body.theme-dark .input-container > .role-status-chip .role-status-close,
body:not(.theme-light) .input-container > .role-status-chip .role-status-close {
    color: #c7d2fe;
    background: rgba(165, 180, 252, .1);
}

@keyframes roleStatusEnter {
    from { opacity: 0; transform: translateY(3px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 640px) {
    .input-container > .role-status-chip {
        max-width: calc(100% - 4px);
        margin-left: 0 !important;
    }
    .input-container > .role-status-chip .role-status-name { max-width: 130px; }
}
