.ai-chat-body {
    height: 100vh;
    overflow: hidden;
    background: #fff;
}

.ai-chat-shell {
    height: calc(100vh - 62px);
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.ai-chat-sidebar {
    min-height: 0;
    padding: 14px 10px;
    border-right: 1px solid #e5e7eb;
    background: #f7f7f8;
}

.ai-chat-new {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #fff;
    color: #202123;
    cursor: pointer;
    font-weight: 600;
}

.ai-chat-new span {
    font-size: 21px;
    line-height: 1;
}

.ai-chat-conversations {
    display: grid;
    gap: 4px;
    margin-top: 12px;
    max-height: calc(100vh - 142px);
    overflow: auto;
}

.ai-chat-conversation {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 4px;
    align-items: center;
    padding: 7px 6px 7px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #343541;
    cursor: pointer;
    text-align: left;
}

.ai-chat-conversation:hover,
.ai-chat-conversation.active {
    background: #e9e9eb;
}

.ai-chat-conversation b {
    overflow: hidden;
    font-size: 13px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-chat-delete {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    font-size: 18px;
}

.ai-chat-main {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: 54px minmax(0, 1fr) auto;
}

.ai-chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 20px;
    border-bottom: 1px solid #ececf1;
}

.ai-chat-topbar strong,
.ai-chat-topbar span {
    display: block;
}

.ai-chat-topbar strong {
    color: #202123;
    font-size: 15px;
}

.ai-chat-topbar span {
    margin-top: 2px;
    color: #8e8ea0;
    font-size: 11px;
}

.ai-chat-text-only {
    color: #047857;
    font-size: 12px;
    font-weight: 700;
}

.ai-chat-messages {
    min-height: 0;
    overflow: auto;
    scroll-behavior: smooth;
}

.ai-chat-welcome {
    min-height: 100%;
    display: grid;
    place-content: center;
    padding: 32px;
    color: #343541;
    text-align: center;
}

.ai-chat-welcome h1 {
    margin: 0 0 10px;
    font-size: 30px;
    letter-spacing: 0;
}

.ai-chat-welcome p {
    margin: 0;
    color: #6b7280;
}

.ai-chat-message {
    border-bottom: 1px solid #ececf1;
}

.ai-chat-message.assistant {
    background: #f7f7f8;
}

.ai-chat-message-inner {
    width: min(820px, calc(100% - 40px));
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 16px;
    margin: 0 auto;
    padding: 24px 0;
}

.ai-chat-avatar {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 4px;
    background: #2563eb;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.ai-chat-message.assistant .ai-chat-avatar {
    background: #10a37f;
}

.ai-chat-content {
    min-width: 0;
    color: #343541;
    font-size: 15px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-chat-message-images {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.ai-chat-message-images img {
    width: 112px;
    height: 112px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.ai-chat-composer-wrap {
    padding: 10px 20px 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0), #fff 18%);
}

.ai-chat-composer,
.ai-chat-image-preview,
.ai-chat-footnote {
    width: min(820px, 100%);
    margin-right: auto;
    margin-left: auto;
}

.ai-chat-composer {
    min-height: 54px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 8px;
    align-items: end;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .08);
}

.ai-chat-composer textarea {
    width: 100%;
    max-height: 170px;
    min-height: 36px;
    padding: 7px 2px;
    border: 0;
    outline: 0;
    resize: none;
    color: #202123;
    background: transparent;
}

.ai-chat-upload,
.ai-chat-send {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

.ai-chat-upload {
    color: #374151;
    background: #f3f4f6;
    font-size: 22px;
}

.ai-chat-upload input {
    display: none;
}

.ai-chat-send {
    color: #fff;
    background: #10a37f;
    font-size: 20px;
}

.ai-chat-send:disabled {
    cursor: wait;
    opacity: .55;
}

.ai-chat-image-preview {
    display: flex;
    gap: 8px;
    padding-bottom: 8px;
}

.ai-chat-image-preview.hidden {
    display: none;
}

.ai-chat-image-chip {
    position: relative;
    width: 64px;
    height: 64px;
}

.ai-chat-image-chip img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.ai-chat-image-chip button {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #202123;
    color: #fff;
    cursor: pointer;
}

.ai-chat-footnote {
    padding-top: 7px;
    color: #8e8ea0;
    font-size: 11px;
    text-align: center;
}

@media (max-width: 760px) {
    .ai-chat-shell {
        grid-template-columns: 1fr;
    }
    .ai-chat-sidebar {
        display: none;
    }
    .ai-chat-topbar {
        padding: 0 12px;
    }
    .ai-chat-text-only {
        max-width: 150px;
        text-align: right;
    }
    .ai-chat-message-inner {
        width: calc(100% - 28px);
        gap: 10px;
    }
    .ai-chat-composer-wrap {
        padding-right: 10px;
        padding-left: 10px;
    }
}
