.csage-chatbot-wrapper,
.csage-chatbot-wrapper * {
    box-sizing: border-box;
}

.csage-chatbot-wrapper {
    position: fixed;
    right: 20px;
    bottom: 310px;
    z-index: 999999;
    font-family: Arial, Helvetica, sans-serif;
}

.csage-screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

.csage-launcher {
    background: #111111;
    color: #ffffff;
    border: 2px solid #e2cb6b;
    border-radius: 999px;
    padding: 9px 15px 9px 9px;
    cursor: grab;
    touch-action: none;
    user-select: none;
    font-size: 15px;
    font-weight: 800;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
}

.csage-launcher:hover,
.csage-launcher:focus {
    transform: translateY(-1px);
    outline: none;
}

.csage-dragging .csage-launcher {
    cursor: grabbing;
    transform: none;
}

.csage-custom-position {
    right: auto;
    bottom: auto;
}

.csage-launcher-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2cb6b;
    flex-shrink: 0;
}

.csage-launcher-text {
    line-height: 1;
    white-space: nowrap;
}

.csage-chat-panel {
    position: fixed;
    left: 50%;
    top: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: 430px;
    max-width: calc(100vw - 40px);
    height: min(620px, calc(100vh - 120px));
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.csage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: linear-gradient(135deg, #111111, #2a2119);
    color: #ffffff;
    border-bottom: 3px solid #e2cb6b;
    cursor: move;
    touch-action: none;
    user-select: none;
}

.csage-panel-custom-position {
    transform: none;
}

.csage-panel-dragging {
    user-select: none;
}

.csage-panel-dragging .csage-header {
    cursor: grabbing;
}

.csage-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.csage-avatar,
.csage-msg-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.csage-msg-avatar {
    box-shadow: 0 0 0 2px #e2cb6b;
}

.csage-avatar {
    border: 2px solid #e2cb6b;
}

.csage-msg-avatar-placeholder {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e2cb6b;
    color: #111111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 12px;
    flex-shrink: 0;
}

.csage-title {
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.csage-subtitle {
    font-size: 12px;
    opacity: 0.84;
    line-height: 1.2;
}

.csage-close {
    background: transparent;
    color: #ffffff;
    border: none;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.csage-close:hover,
.csage-close:focus {
    opacity: 0.82;
    outline: none;
}

.csage-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f7f4ef;
}

.csage-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
}

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

.csage-user .csage-bubble {
    background: #111111;
    color: #ffffff;
    margin-left: 54px;
    border-bottom-right-radius: 5px;
}

.csage-bot .csage-bubble {
    background: #ffffff;
    color: #191919;
    border: 1px solid #e5ded3;
    margin-right: 18px;
    border-bottom-left-radius: 5px;
}

.csage-bubble {
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.48;
    word-break: break-word;
    max-width: 78%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.csage-bubble a {
    color: #6f5c1e;
    text-decoration: underline;
    font-weight: 700;
}

.csage-user .csage-bubble a {
    color: #ffffff;
}

.csage-typing-bubble {
    min-width: 62px;
}

.csage-typing-bubble span {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin: 0 2px;
    background: #e2cb6b;
    border-radius: 50%;
    opacity: 0.3;
    animation: csagePulse 1s infinite ease-in-out;
}

.csage-typing-bubble span:nth-child(2) {
    animation-delay: 0.15s;
}

.csage-typing-bubble span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes csagePulse {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

.csage-prompts {
    padding: 10px 12px;
    display: flex;
    gap: 7px;
    overflow-x: auto;
    background: #ffffff;
    border-top: 1px solid #ece6dc;
}

.csage-prompt-chip {
    border: 1px solid #e3d8c8;
    background: #fffaf2;
    color: #3a2a1c;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.csage-prompt-chip:hover,
.csage-prompt-chip:focus {
    background: #f3e5d2;
    outline: none;
}


.csage-fridge-panel {
    padding: 12px;
    background: #fffaf2;
    border-top: 1px solid #ece0c7;
    border-bottom: 1px solid #ece0c7;
}

.csage-fridge-title {
    font-size: 14px;
    font-weight: 900;
    color: #1f1b14;
    margin-bottom: 4px;
}

.csage-fridge-help {
    font-size: 12px;
    line-height: 1.35;
    color: #554a36;
    margin: 0 0 9px;
}

.csage-fridge-input {
    width: 100%;
    resize: vertical;
    border: 1px solid #d7cfc4;
    border-radius: 13px;
    padding: 10px 11px;
    font-size: 13px;
    line-height: 1.35;
    min-height: 72px;
    outline: none;
    color: #111111;
    background: #ffffff;
}

.csage-fridge-input:focus,
.csage-fridge-select:focus {
    border-color: #e2cb6b;
    box-shadow: 0 0 0 2px rgba(226, 203, 107, 0.28);
}

.csage-fridge-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 9px;
}

.csage-fridge-select {
    width: 100%;
    border: 1px solid #d7cfc4;
    border-radius: 12px;
    padding: 8px 9px;
    font-size: 12px;
    background: #ffffff;
    color: #111111;
    outline: none;
}

.csage-fridge-send {
    grid-column: 1 / -1;
    border: none;
    background: #e2cb6b;
    color: #111111;
    border-radius: 13px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
}

.csage-fridge-send:hover,
.csage-fridge-send:focus {
    filter: brightness(0.96);
    outline: none;
}

.csage-form {
    border-top: 1px solid #e6e0d6;
    background: #ffffff;
    padding: 12px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.csage-input {
    flex: 1;
    resize: none;
    border: 1px solid #d7cfc4;
    border-radius: 14px;
    padding: 11px 12px;
    font-size: 14px;
    min-height: 48px;
    outline: none;
    color: #111111;
    background: #ffffff;
}

.csage-input:focus {
    border-color: #e2cb6b;
    box-shadow: 0 0 0 2px rgba(226, 203, 107, 0.28);
}

.csage-send {
    border: none;
    background: #e2cb6b;
    color: #111111;
    border-radius: 14px;
    padding: 13px 15px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.csage-send:hover,
.csage-send:focus {
    background: #d4b94d;
    outline: none;
}

.csage-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .csage-chatbot-wrapper {
        right: 12px;
        bottom: 280px;
        left: 12px;
    }

    .csage-launcher {
        max-width: 100%;
        cursor: grab;
        touch-action: none;
    }

    .csage-chatbot-wrapper.csage-custom-position {
        right: auto;
        bottom: auto;
    }

    .csage-chat-panel {
        left: 12px;
        right: 12px;
        top: auto;
        bottom: 135px;
        transform: none;
        width: auto;
        height: clamp(360px, 56dvh, 520px);
        max-height: calc(100dvh - 180px);
        border-radius: 18px;
    }

    .csage-header {
        padding: 10px 12px;
    }

    .csage-avatar,
    .csage-msg-avatar {
        width: 38px;
        height: 38px;
    }

    .csage-messages {
        padding: 10px;
    }

    .csage-prompts {
        padding: 8px;
    }

    .csage-form {
        padding: 8px;
    }

    .csage-input {
        min-height: 42px;
        padding: 9px 10px;
    }

    .csage-send {
        padding: 11px 13px;
    }

    .csage-bubble {
        max-width: 82%;
        font-size: 14px;
    }
}

@supports not (height: 100dvh) {
    @media (max-width: 640px) {
        .csage-chat-panel {
            height: clamp(360px, 56vh, 520px);
            max-height: calc(100vh - 180px);
        }
    }
}

@media (max-width: 640px) {

    .csage-fridge-panel {
        padding: 9px 10px;
    }

    .csage-fridge-input {
        min-height: 58px;
        font-size: 12px;
        padding: 8px 9px;
    }

    .csage-fridge-controls {
        gap: 6px;
        margin-top: 7px;
    }

    .csage-fridge-select,
    .csage-fridge-send {
        font-size: 12px;
        padding: 8px 9px;
    }

}
