/* Compact attachment previews inside the chat composer. */
body[data-mode="chat"] .chat-input-wrap.has-attachments .chat-attachment-bar:not(.hidden) {
    position: absolute;
    top: 8px;
    left: 14px;
    z-index: 6;
    display: block;
    width: max-content;
    max-width: min(calc(100% - 132px), 55%);
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
}

body[data-mode="chat"] .chat-input-wrap .chat-attachment-list {
    width: max-content;
    max-width: 100%;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 8px 4px 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

body[data-mode="chat"] .chat-input-wrap .chat-attachment-list::-webkit-scrollbar {
    display: none;
}

body[data-mode="chat"] .chat-input-wrap .chat-attachment-meta,
body[data-mode="chat"] .chat-input-wrap .chat-attachment-copy {
    display: none !important;
}

body[data-mode="chat"] .chat-input-wrap .chat-attachment-chip {
    position: relative;
    display: block;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    min-height: 44px;
    height: 44px;
    flex: 0 0 44px;
    padding: 0;
    overflow: visible;
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: 10px;
    background: #eef2f7;
}

body[data-mode="chat"] .chat-input-wrap .chat-attachment-thumb {
    display: block;
    width: 42px;
    height: 42px;
    overflow: hidden;
    border-radius: 9px;
    background: #e9eef7;
}

body[data-mode="chat"] .chat-input-wrap .chat-attachment-chip img,
body[data-mode="chat"] .chat-input-wrap .chat-attachment-chip video {
    width: 42px;
    height: 42px;
    border-radius: 9px;
    object-fit: cover;
}

body[data-mode="chat"] .chat-input-wrap .chat-attachment-chip > .chat-file-icon {
    width: 42px;
    height: 42px;
    border-radius: 9px;
    font-size: 9px;
}

body[data-mode="chat"] .chat-input-wrap .chat-attachment-state {
    inset: 1px;
    padding: 3px;
    border-radius: 9px;
    font-size: 8px;
}

body[data-mode="chat"] .chat-input-wrap .chat-attachment-remove {
    top: -5px;
    right: -5px;
    transform: none;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, .14);
    background: #fff;
    color: #475569;
    font-size: 14px;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(15, 23, 42, .16);
}

body[data-mode="chat"] .chat-input-wrap .chat-attachment-remove:hover {
    border-color: #dc2626;
    background: #dc2626;
    color: #fff;
}

body[data-mode="chat"] .chat-input-wrap.has-attachments textarea {
    padding-left: min(var(--chat-attachment-offset, 72px), 55%) !important;
}

body[data-mode="chat"] .chat-input-wrap.has-attachments .chat-input-tools {
    position: absolute !important;
    left: 12px !important;
    right: 12px !important;
    bottom: 10px !important;
    width: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
}

body[data-ui-theme="dark"][data-mode="chat"] .chat-input-wrap .chat-attachment-chip,
body[data-ui-theme="dark"][data-mode="chat"] .chat-input-wrap .chat-attachment-thumb {
    border-color: rgba(148, 163, 184, .22);
    background: #172033;
}

body[data-ui-theme="dark"][data-mode="chat"] .chat-input-wrap .chat-attachment-remove {
    border-color: rgba(148, 163, 184, .28);
    background: #1e293b;
    color: #e2e8f0;
}

@media (max-width: 920px) {
    /* This file is loaded after the shared responsive contract. Preserve the
     * 44px touch targets when attachment/composer rules win the cascade. */
    html body[data-mode] .mobile-nav-trigger,
    html body[data-mode] .ui-language-switch-btn,
    html body[data-mode] .chat-tool-btn,
    html body[data-mode] .mobile-chat-toolbar-btn,
    html body.chat-landing[data-mode] .mobile-nav-trigger,
    html body.chat-landing[data-mode] .ui-language-switch-btn,
    html body.chat-landing[data-mode] .chat-tool-btn,
    html body.chat-landing[data-mode] .mobile-chat-toolbar-btn {
        min-width: 44px !important;
        min-height: 44px !important;
    }

    html body[data-mode] .mobile-nav-trigger,
    html body[data-mode] .ui-language-switch-btn,
    html body[data-mode] .chat-tool-btn,
    html body.chat-landing[data-mode] .mobile-nav-trigger,
    html body.chat-landing[data-mode] .ui-language-switch-btn,
    html body.chat-landing[data-mode] .chat-tool-btn {
        width: 44px !important;
        height: 44px !important;
    }

    body[data-mode="chat"] .chat-input-wrap .chat-attachment-remove::before {
        position: absolute;
        inset: -13px;
        content: "";
    }
}


/* Phone landing should honor dark mode; this file is loaded last, so keep the final overrides here. */
@media (max-width: 920px), (hover: none) and (pointer: coarse) and (max-width: 1366px) {
    html body[data-ui-theme="dark"].chat-landing[data-mode="chat"],
    html body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .app[data-fuuvo-app-shell="1"],
    html body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .workspace[data-fuuvo-app-workspace="1"],
    html body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .composer {
        background: #080f1c !important;
        color: #edf2ff !important;
    }

    html body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .mobile-chat-topbar {
        background: rgba(8, 15, 28, .96) !important;
        border-bottom-color: rgba(148, 163, 184, .12) !important;
    }

    html body[data-ui-theme="dark"].chat-landing[data-mode="chat"] :is(.mobile-nav-bars, .composer-title, .chat-tool-btn, .mobile-chat-toolbar-btn, .core-feature-btn) {
        color: #edf2ff !important;
        -webkit-text-fill-color: #edf2ff !important;
    }

    html body[data-ui-theme="dark"].chat-landing[data-mode="chat"] :is(.chat-input-hint, .workspace-disclaimer, .ui-language-switch-btn:not(.active)) {
        color: #8fa0bc !important;
        -webkit-text-fill-color: #8fa0bc !important;
    }

    html body[data-ui-theme="dark"].chat-landing[data-mode="chat"] :is(.chat-input-wrap, .chat-tool-btn, .mobile-chat-toolbar-btn, .core-feature-btn) {
        border-color: rgba(148, 163, 184, .22) !important;
        background: #0f172a !important;
        box-shadow: none !important;
    }

    html body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-input-wrap {
        background: #111827 !important;
        box-shadow: 0 12px 26px rgba(2, 6, 23, .34) !important;
    }

    html body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-input-wrap textarea {
        color: #edf2ff !important;
        -webkit-text-fill-color: #edf2ff !important;
        caret-color: #7db5ff !important;
    }

    html body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .send-btn {
        border-color: #0d72f5 !important;
        background: #0d72f5 !important;
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
        box-shadow: 0 8px 17px rgba(13, 114, 245, .24) !important;
    }
}

@media (max-width: 600px) {
    html:has(body.chat-landing[data-mode="chat"]),
    body.chat-landing[data-mode="chat"] {
        width: var(--mobile-viewport-width, 100%) !important;
        max-width: var(--mobile-viewport-width, 100%) !important;
        height: var(--mobile-viewport-height, 100dvh) !important;
        min-height: var(--mobile-viewport-height, 100dvh) !important;
        max-height: var(--mobile-viewport-height, 100dvh) !important;
        overflow: hidden !important;
        overscroll-behavior: none !important;
    }

    html body.chat-landing[data-mode="chat"] .app[data-fuuvo-app-shell="1"],
    html body.chat-landing[data-mode="chat"] .workspace[data-fuuvo-app-workspace="1"] {
        height: var(--mobile-viewport-height, 100dvh) !important;
        min-height: 0 !important;
        max-height: var(--mobile-viewport-height, 100dvh) !important;
        overflow: hidden !important;
    }

    html body.chat-landing[data-mode="chat"] .app[data-fuuvo-app-shell="1"] {
        display: flex !important;
        flex-direction: column !important;
    }

    html body.chat-landing[data-mode="chat"] .workspace[data-fuuvo-app-workspace="1"] {
        display: flex !important;
        flex-direction: column !important;
    }

    html body.chat-landing[data-mode="chat"] .mobile-chat-topbar {
        flex: 0 0 auto !important;
        min-height: 62px !important;
    }

    html body.chat-landing[data-mode="chat"] .composer {
        flex: 1 1 auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        padding: clamp(44px, 11vh, 78px) 18px 12px !important;
        overflow: hidden !important;
    }

    html body.chat-landing[data-mode="chat"] .composer-top {
        margin-bottom: 12px !important;
    }

    html body.chat-landing[data-mode="chat"] .composer-title,
    html body.chat-landing[data-mode="chat"] .composer-title.has-wenzhi-slogan {
        font-size: 16px !important;
        line-height: 1.34 !important;
    }

    html body.chat-landing[data-mode="chat"] .composer-title.has-wenzhi-slogan {
        gap: 5px !important;
        align-items: center !important;
        justify-content: center !important;
    }

    html body.chat-landing[data-mode="chat"] .composer-title-logo-link {
        min-width: 0 !important;
        min-height: 0 !important;
        height: 18px !important;
        line-height: 0 !important;
    }

    html body.chat-landing[data-mode="chat"] .composer-title-logo {
        width: auto !important;
        height: 18px !important;
        max-height: 18px !important;
    }

    html body.chat-landing[data-mode="chat"] .chat-input-wrap,
    html body.chat-landing[data-mode="chat"] .chat-input-wrap textarea {
        min-height: 132px !important;
        height: 132px !important;
    }

    html body.chat-landing[data-mode="chat"] .chat-input-wrap textarea {
        padding: 15px 16px 56px !important;
        overflow-y: auto !important;
        font-size: 15px !important;
        line-height: 1.45 !important;
    }

    html body.chat-landing[data-mode="chat"] .chat-input-hint {
        top: 16px !important;
        right: 16px !important;
        left: 16px !important;
        font-size: 14px !important;
    }

    html body.chat-landing[data-mode="chat"] .chat-input-tools {
        right: 12px !important;
        bottom: 10px !important;
        left: 12px !important;
    }

    html body.chat-landing[data-mode="chat"] .chat-tool-btn,
    html body.chat-landing[data-mode="chat"] .send-btn {
        width: 38px !important;
        min-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
    }

    html body.chat-landing[data-mode="chat"] .chat-tool-btn svg,
    html body.chat-landing[data-mode="chat"] .send-btn svg {
        width: 18px !important;
        height: 18px !important;
    }

    html body.chat-landing[data-mode="chat"] .mobile-chat-toolbar {
        left: 58px !important;
        bottom: 12px !important;
    }

    html body.chat-landing[data-mode="chat"] .mobile-chat-toolbar-btn {
        min-width: 0 !important;
        min-height: 32px !important;
        height: 32px !important;
        padding: 0 10px !important;
        font-size: 12px !important;
    }

    html body.chat-landing[data-mode="chat"] #core-feature-slot {
        margin-top: 8px !important;
    }

    html body.chat-landing[data-mode="chat"] .core-feature-actions {
        gap: 7px !important;
    }

    html body.chat-landing[data-mode="chat"] .core-feature-btn {
        min-height: 64px !important;
        padding: 5px 4px !important;
        gap: 4px !important;
        border-radius: 10px !important;
        font-size: 12px !important;
        line-height: 1.25 !important;
    }

    html body.chat-landing[data-mode="chat"] .core-feature-btn-icon,
    html body.chat-landing[data-mode="chat"] .core-feature-btn-icon .fuuvo-icon,
    html body.chat-landing[data-mode="chat"] .core-feature-btn-icon .home-core-feature-icon,
    html body.chat-landing[data-mode="chat"] .core-feature-btn-icon .home-capability-icon {
        width: 24px !important;
        height: 24px !important;
        flex-basis: 24px !important;
    }

    html body.chat-landing[data-mode="chat"] .workspace > .fuuvo-ai-disclaimer {
        flex: 0 0 auto !important;
        padding: 4px 8px max(5px, env(safe-area-inset-bottom)) !important;
        font-size: 9px !important;
        line-height: 1.28 !important;
    }

    html body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .workspace > .fuuvo-ai-disclaimer {
        background: #080f1c !important;
        color: #9fb0c8 !important;
    }
}
