.ai-view {
    min-height: calc(100vh - 48px);
    background: #fff;
    color: #111;
}

.ai-main {
    min-height: calc(100vh - 48px);
    padding: 1.5rem;
}

.ai-chat-workspace {
    display: flex;
    width: min(100%, 880px);
    min-height: calc(100vh - 100px);
    margin: auto;
    flex-direction: column;
}

.ai-chat-welcome {
    display: flex;
    min-height: 290px;
    flex: 1 0 auto;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
    text-align: center;
}

.ai-chat-welcome[hidden],
.ai-chat-messages:empty {
    display: none;
}

.ai-eyebrow {
    margin-bottom: .85rem;
    color: #666;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .12em;
}

.ai-chat-welcome h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 650;
    letter-spacing: -.045em;
    line-height: 1.2;
}

.ai-chat-welcome p:not(.ai-eyebrow) {
    max-width: 28rem;
    margin-top: .8rem;
    color: #666;
    font-size: .98rem;
    line-height: 1.6;
}

.ai-chat-messages,
.ai-composer-area {
    width: min(100%, 740px);
    margin: 0 auto;
}

.ai-chat-messages {
    display: flex;
    max-height: min(48vh, 560px);
    margin-bottom: 1rem;
    flex-direction: column;
    gap: .8rem;
    overflow-y: auto;
}

.ai-chat-messages .ai-msg-user,
.ai-chat-messages .ai-msg-bot {
    max-width: min(85%, 620px);
    padding: .85rem 1rem;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    font-size: .95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ai-chat-messages .ai-msg-user {
    align-self: flex-end;
    background: #111;
    color: #fff;
}

.ai-chat-messages .ai-msg-bot {
    align-self: flex-start;
    background: #f5f5f5;
    color: #111;
}

.ai-composer-area {
    margin-top: auto;
    padding-top: 1rem;
}

.ai-composer {
    overflow: hidden;
    border: 1px solid #ccc;
    border-radius: 14px;
    background: #fff;
}

.ai-composer:focus-within {
    border-color: #111;
}

.ai-composer-label {
    display: block;
    padding: .8rem 1rem 0;
    color: #666;
    font-size: .75rem;
}

.ai-chat-form {
    display: flex;
    min-height: 120px;
    flex-direction: column;
    justify-content: space-between;
    padding: .3rem .75rem .7rem 1rem;
}

.ai-chat-form textarea {
    width: 100%;
    min-height: 42px;
    max-height: 150px;
    padding: .65rem 0;
    resize: vertical;
    border: 0;
    outline: 0;
    background: transparent;
    color: #111;
    font: inherit;
    font-size: .95rem;
}

.ai-chat-form textarea::placeholder {
    color: #888;
}

.ai-composer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-model-chip {
    padding: .4rem .65rem;
    border: 1px solid #e5e5e5;
    border-radius: 999px;
    color: #555;
    font-size: .75rem;
}

.ai-send-button {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #111;
    color: #fff;
    cursor: pointer;
}

.ai-send-button:hover:not(:disabled) {
    background: #444;
}

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

.ai-send-button svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

@media (max-width: 600px) {
    .ai-view {
        padding-bottom: calc(62px + env(safe-area-inset-bottom));
    }

    .ai-main {
        min-height: calc(100dvh - 62px);
        padding: .5rem .85rem 1rem;
    }

    .ai-chat-workspace {
        min-height: calc(100dvh - 138px - env(safe-area-inset-bottom));
    }

    .ai-chat-welcome {
        min-height: 220px;
        padding: 1.5rem .25rem;
    }
}
