* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f5f7f9;
    font-family: Arial, Helvetica, sans-serif;
    color: #222;
}

.credit-chat {
    width: 100%;
    max-width: 950px;
    height: 760px;
    margin: 20px auto;
    background: white;
    border: 1px solid #e3e8ed;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0,0,0,.08);
}

.chat-header {
    padding: 22px 26px;
    background: linear-gradient(
        135deg,
        #168bd2,
        #116ea8
    );
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.credit-label {
    font-size: 11px;
    letter-spacing: 1.4px;
    font-weight: 800;
    opacity: .85;
    margin-bottom: 5px;
}

.chat-header h1 {
    margin: 0;
    font-size: 24px;
}

.chat-header p {
    margin: 5px 0 0;
    font-size: 12px;
    opacity: .85;
}

.online-status {
    font-size: 12px;
    display: flex;
    align-items: center;
}

.online-status span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #7dff9c;
    margin-right: 7px;
}

.quick-actions {
    padding: 15px 18px 8px;
    background: #fafbfc;
    border-bottom: 1px solid #edf0f2;
    display: flex;
    flex-wrap: wrap;
}

.quick-actions button {
    border: 1px solid #dfe5ea;
    background: white;
    color: #35637f;
    padding: 8px 12px;
    margin: 4px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
}

.quick-actions button:hover {
    background: #eef7fd;
    border-color: #bfdff2;
}

.chat-mode {
    padding: 10px 22px;
    border-bottom: 1px solid #edf0f2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 12px;
}

.chat-mode label {
    margin-right: 7px;
    color: #68727a;
}

.chat-mode select {
    border: 1px solid #dfe5ea;
    padding: 6px 9px;
    border-radius: 6px;
    background: white;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 22px;
}

.message {
    display: flex;
    margin-bottom: 16px;
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.bubble {
    max-width: 78%;
    padding: 12px 15px;
    border-radius: 13px;
    line-height: 1.55;
    font-size: 14px;
    white-space: pre-wrap;
}

.assistant .bubble {
    background: #f1f5f8;
    color: #303940;
    border-bottom-left-radius: 4px;
}

.user .bubble {
    background: #168bd2;
    color: white;
    border-bottom-right-radius: 4px;
}

.typing {
    color: #84909a;
    font-style: italic;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid #edf0f2;
    display: flex;
    background: white;
}

.chat-input-area textarea {
    flex: 1;
    resize: none;
    min-height: 45px;
    max-height: 120px;
    border: 1px solid #dce3e8;
    border-radius: 9px;
    padding: 12px;
    font: inherit;
    outline: none;
}

.chat-input-area textarea:focus {
    border-color: #168bd2;
}

.chat-input-area button {
    margin-left: 10px;
    width: 90px;
    border: 0;
    border-radius: 9px;
    background: #168bd2;
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.chat-input-area button:hover {
    background: #1178b8;
}

@media(max-width:700px) {

    .credit-chat {
        margin: 0;
        border-radius: 0;
        height: 100vh;
    }

    .bubble {
        max-width: 90%;
    }

    .quick-actions {
        max-height: 115px;
        overflow-y: auto;
    }

}

.credit-ai-line {
    margin-bottom: 5px;
}

.credit-ai-list-item {
    margin: 4px 0;
    padding-left: 4px;
}

.credit-ai-sources {
    max-width: 78%;
    margin: -5px 0 18px 10px;
    padding: 10px 12px;
    background: #fafcfd;
    border: 1px solid #e3e9ed;
    border-radius: 9px;
}

.credit-ai-sources-title {
    margin-bottom: 6px;
    color: #6a747c;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.credit-ai-sources a {
    display: block;
    margin: 4px 0;
    color: #168bd2;
    font-size: 11px;
    line-height: 1.4;
    text-decoration: none;
}

.credit-ai-sources a:hover {
    text-decoration: underline;
}