.chat-composer {
    position: relative;
    width: 100%;
    isolation: isolate;
    z-index: 12;
}

    .chat-composer .chat-input-overlay {
        position: absolute;
        inset: auto 0 100% 0;
        display: grid;
        align-items: end;
        z-index: 20;
    }

        .chat-composer .chat-input-overlay .chat-input-overlay-layer {
            grid-area: 1 / 1;
            min-width: 0;
            width: 100%;
        }

        .chat-composer .chat-input-overlay .quick-starter-layer {
            z-index: 100;
        }

        .chat-composer .chat-input-overlay .command-layer {
            display: flex;
            justify-content: center;
            z-index: 200;
        }

    .chat-composer .input-box-grid {
        position: relative;
        display: grid;
        width: 100%;
        grid-template-areas:
            "file file file"
            "plus input tails"
            ". option .";
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto auto;
        justify-content: space-around;
        align-items: center;
        border-radius: 28px;
        border: ridge 1px var(--clv-chat-input-border);
        background-color: var(--clv-chat-input-bg);
        z-index: 10;
        overflow: hidden;
        padding: 10px;
        box-shadow: 0 0px 4px rgba(0, 0, 0, 0.1);
        cursor: text;
    }

        .chat-composer .input-box-grid.expanded {
            grid-template-areas:
                "file file file"
                "input input input"
                "plus option tails";
            grid-template-columns: auto 1fr auto;
            grid-template-rows: auto auto auto;
        }

        .chat-composer .input-box-grid > * {
            transition: padding 0.5s cubic-bezier(0.05, 0.9, 0.2, 1), margin 0.5s cubic-bezier(0.05, 0.9, 0.2, 1), opacity 0.5s cubic-bezier(0.05, 0.9, 0.2, 1), color 250ms cubic-bezier(0.4, 0, 0.2, 1), background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
        }

        .chat-composer .input-box-grid .grid-area-plus {
            grid-area: plus;
            margin-top: auto;
        }

        .chat-composer .input-box-grid .grid-area-input {
            grid-area: input;
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
            white-space: pre-wrap;
            word-break: break-word;
            overflow-wrap: break-word;
        }

        .chat-composer .input-box-grid.expanded .grid-area-input {
            grid-area: input;
            width: 100%;
            padding-inline: calc(0.25rem * 2.5);
            margin: 6px 0 12px 0;
        }

        .chat-composer .input-box-grid .grid-area-tails {
            grid-area: tails;
            margin-top: auto;
        }

        .chat-composer .input-box-grid .grid-area-option {
            grid-area: option;
            min-width: 0;
        }

        .chat-composer .input-box-grid .grid-area-file {
            grid-area: file;
        }

    .chat-composer .grid-area-file,
    .chat-composer .grid-area-option {
        height: 0;
        opacity: 0;
        overflow: hidden;
    }

    .chat-composer .input-box-grid.expanded .grid-area-file,
    .chat-composer .input-box-grid.expanded .grid-area-option {
        opacity: 1;
        height: auto;
    }

    .chat-composer .input-button-wrap {
        display: flex;
    }

        .chat-composer .input-button-wrap.grid-area-plus {
            align-items: center;
            min-width: 0;
        }

    .chat-composer .input-tail-wrap {
        display: inline-flex;
        align-items: center;
        justify-content: flex-end;
        gap: 0;
        min-width: 0;
    }

    .chat-composer .input-button {
        display: flex;
        padding: 0 !important;
        border-radius: 50%;
        -webkit-border-bottom-left-radius: 50%;
        width: 36px;
        height: 36px;
        outline: none;
        border: none;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        transition: color 250ms cubic-bezier(0.4, 0, 0.2, 1), background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
    }

        .chat-composer .input-button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .chat-composer .input-button.plus {
            color: var(--clv-chat-input-btn-ghost-color);
            background-color: var(--clv-chat-input-btn-ghost-bg);
        }

        .chat-composer .input-button.send {
            color: var(--clv-chat-input-btn-solid-color);
            background-color: var(--clv-chat-input-btn-solid-bg);
        }

            .chat-composer .input-button.send svg {
                color: var(--clv-background);
                width: 24px;
                height: 24px;
            }

    .chat-composer .cl-chatbox--sendbox {
        position: relative;
        flex: 1;
        font-family: Pretendard;
        line-height: 20px;
        font-size: 16px;
        white-space: pre-wrap;
        word-wrap: break-word;
        color: var(--clv-chat-input-text);
        background-color: transparent;
        outline: none;
        border: none;
        resize: none;
        min-height: 20px;
        max-height: 200px;
        overflow-y: auto;
        overflow-x: hidden;
        box-sizing: border-box;
        -webkit-box-sizing: border-box;
    }

    .chat-composer .contenteditable-input:empty:before,
    .chat-composer .contenteditable-input[data-empty="true"]:before {
        content: attr(data-placeholder);
        position: absolute;
        inset: 0 auto auto 0;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 15px;
        color: var(--clv-chat-input-placeholder);
        pointer-events: none;
        user-select: none;
        -webkit-user-select: none;
    }

    .chat-composer .contenteditable-input.disabled {
        background-color: #f5f5f5;
        color: var(--clc-base-400);
        cursor: not-allowed;
    }

    .chat-composer .entity-token {
        display: inline-flex;
        align-items: center;
        max-width: 180px;
        margin: 0 2px;
        padding: 3px 7px;
        border-radius: 8px;
        background-color: var(--clc-primary-lighter);
        color: var(--clc-primary-dark);
        font-size: 13px;
        font-weight: 600;
        line-height: 1.2;
        vertical-align: baseline;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        user-select: none;
        -webkit-user-select: none;
        cursor: default;
    }

        .chat-composer .entity-token--bot {
            background-color: var(--clc-assign-base-100);
            color: var(--clv-text-primary);
        }

        .chat-composer .entity-token[contenteditable="false"] {
            pointer-events: none;
        }

    .chat-composer .input-text-wrap {
        padding: 0 6px;
        align-items: center;
    }

    .chat-composer .input-box-grid.expanded .input-text-wrap {
        padding: 6px;
        -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 2px, black calc(100% - 2px), transparent 100%);
        mask-image: linear-gradient(to bottom, transparent 0%, black 2px, black calc(100% - 2px), transparent 100%);
    }

    .chat-composer .input-option-container {
        display: flex;
        width: 100%;
        min-width: 0;
        overflow: hidden;
        flex-wrap: nowrap;
        -webkit-flex-wrap: nowrap;
        flex-direction: row;
        -webkit-flex-direction: row;
    }

    .chat-composer .input-option {
        display: flex;
        flex-direction: row;
        -webkit-flex-direction: row;
        justify-content: center;
        align-items: center;
        border: none;
        outline: none;
        background-color: transparent;
        color: var(--clc-text-color);
        padding: 5px 7px;
        padding-right: 10px;
        border-radius: 28px;
        gap: 7px;
        cursor: pointer;
        width: fit-content;
        max-width: 100%;
        min-width: 0;
        height: 36px;
        flex: 0 1 auto;
        -webkit-flex: 0 1 auto;
        opacity: 0.9;
        user-select: none;
    }

        .chat-composer .input-option:hover {
            opacity: 1;
            background-color: color-mix(in srgb, currentColor 20%, transparent);
        }

            .chat-composer .input-option:hover .icon {
                background-color: color-mix(in srgb, currentColor 20%, transparent);
            }

        .chat-composer .input-option .label {
            font-size: 1rem;
            font-weight: 400;
            min-width: 0;
            white-space: nowrap;
        }

            .chat-composer .input-option .label.whisper-label {
                display: inline-flex;
                align-items: center;
                -webkit-align-items: center;
                max-width: 100%;
            }

                .chat-composer .input-option .label.whisper-label .target {
                    min-width: 0;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                }

                .chat-composer .input-option .label.whisper-label .suffix {
                    flex: 0 0 auto;
                    -webkit-flex: 0 0 auto;
                    white-space: nowrap;
                }

        .chat-composer .input-option .icon {
            display: flex;
            justify-content: center;
            align-items: center;
            border-radius: 50%;
            width: 24px;
            height: 24px;
            min-width: 24px;
            flex: 0 0 24px;
            -webkit-flex: 0 0 24px;
            overflow: hidden;
            background-color: transparent;
        }

            .chat-composer .input-option .icon .visible {
                display: flex;
                flex-shrink: 0;
                justify-content: center;
                align-items: center;
                width: 22px;
                height: 22px;
            }

            .chat-composer .input-option .icon .hover {
                display: flex;
                flex-shrink: 0;
                justify-content: center;
                align-items: center;
            }

                .chat-composer .input-option .icon .hover svg {
                    display: none;
                    stroke: none;
                    fill: currentColor;
                }

        .chat-composer .input-option:hover .visible {
            display: none;
        }

        .chat-composer .input-option:hover .hover svg {
            display: inline;
        }

        .chat-composer .input-option.withfile {
            color: cornflowerblue;
        }

        .chat-composer .input-option.thinkdeeper {
            color: dodgerblue;
        }

        .chat-composer .input-option.internetsearch {
            color: cornflowerblue;
        }

        .chat-composer .input-option.agentcoding {
            color: #FFBF00;
        }

        .chat-composer .input-option.bettercalculation {
            color: lightslategrey;
        }

        .chat-composer .input-option.whisperto,
        .chat-composer .input-option.whisperreply {
            color: var(--clv-chat-input-whisper-text);
        }

    .chat-composer .input-box-grid:has(.input-option.whisperto),
    .chat-composer .input-box-grid:has(.input-option.whisperreply) {
        background-color: var(--clv-chat-input-whisper-bg);
        border-color: var(--clv-chat-input-whisper-border);
    }

        .chat-composer .input-box-grid:has(.input-option.whisperto) .cl-chatbox--sendbox,
        .chat-composer .input-box-grid:has(.input-option.whisperreply) .cl-chatbox--sendbox {
            color: var(--clv-chat-input-whisper-text);
        }

        .chat-composer .input-box-grid:has(.input-option.whisperto) .contenteditable-input:empty:before,
        .chat-composer .input-box-grid:has(.input-option.whisperreply) .contenteditable-input:empty:before,
        .chat-composer .input-box-grid:has(.input-option.whisperto) .contenteditable-input[data-empty="true"]:before,
        .chat-composer .input-box-grid:has(.input-option.whisperreply) .contenteditable-input[data-empty="true"]:before {
            color: var(--clv-chat-input-whisper-placeholder);
        }

        .chat-composer .input-box-grid:has(.input-option.whisperto) .input-button.plus,
        .chat-composer .input-box-grid:has(.input-option.whisperreply) .input-button.plus {
            background-color: var(--clv-chat-input-whisper-btn-ghost-bg);
            color: var(--clv-chat-input-whisper-btn-ghost-color);
        }

        .chat-composer .input-box-grid:has(.input-option.whisperto) .input-button.send,
        .chat-composer .input-box-grid:has(.input-option.whisperreply) .input-button.send {
            background-color: var(--clv-chat-input-whisper-btn-solid-bg);
            color: var(--clv-chat-input-whisper-btn-solid-color);
        }

    .chat-composer .input-file-wrap {
        display: inline-block;
        margin: 0 6px;
    }

    .chat-composer .file-container {
        display: flex;
        overflow-x: auto;
        gap: 10px;
        padding-bottom: 2px;
        scrollbar-width: thin;
        scrollbar-color: var(--clv-text-secondary) transparent;
    }

    .chat-composer .input-file {
        position: relative;
        display: flex;
        width: auto;
        max-width: 100%;
        background-color: var(--clv-chat-input-bg);
        border-radius: 15px;
        cursor: default;
        user-select: none;
        flex-shrink: 0;
    }

    .chat-composer .file-upload-container {
        display: none;
    }

    .chat-composer .preview-file {
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 6px;
        padding: 8px 10px;
        width: fit-content;
        max-width: 200px;
        min-width: 0;
        overflow: hidden;
    }

        .chat-composer .preview-file.non-image-file {
            align-items: flex-start;
            min-width: 130px;
            max-width: 220px;
            padding-right: 28px;
            gap: 6px;
        }

        .chat-composer .preview-file .file-name {
            width: 100%;
            max-width: 100%;
            min-width: 0;
            color: var(--clc-assign-base-500);
            font-size: 13px;
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            display: block;
        }

        .chat-composer .preview-file .extension-wrap {
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: flex-start;
            min-width: 0;
            gap: 6px;
        }

            .chat-composer .preview-file .extension-wrap .file-extension {
                color: var(--clc-assign-base-400);
                font-size: 12px;
                z-index: 1;
                white-space: nowrap;
            }

        .chat-composer .preview-file .file-remove-btn {
            position: absolute;
            inset: 6px 6px auto auto;
            width: 20px;
            height: 20px;
            border: none;
            border-radius: 50%;
            background: color-mix(in srgb, var(--clc-text-color) 12%, transparent);
            color: var(--clc-text-color);
            line-height: 1;
            cursor: pointer;
        }

@media screen and (max-width: 768px) {
    .chat-composer .input-box-grid {
        grid-template-areas:
            "file file file"
            "input input input"
            "plus option tails";
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto auto;
    }

        .chat-composer .input-box-grid .grid-area-input {
            width: 100%;
            padding-inline: calc(0.25rem * 2.5);
            margin: 6px 0 12px 0;
        }

        .chat-composer .input-box-grid .grid-area-file,
        .chat-composer .input-box-grid .grid-area-option {
            opacity: 1;
            height: auto;
        }
}
