#smc-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    direction: ltr;
}

#smc-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--smc-primary, #013C82);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    z-index: 99998;
    transition: transform .2s, box-shadow .2s;
}

#smc-launcher:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(0,0,0,.25);
}

#smc-launcher svg {
    width: 26px;
    height: 26px;
}

#smc-panel {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 370px;
    max-width: calc(100vw - 48px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    display: none;
    flex-direction: column;
    z-index: 99999;
    overflow: hidden;
    animation: smcFadeIn .25s ease;
}

@keyframes smcFadeIn {
    from { opacity: 0; transform: translateY(16px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

#smc-panel.open {
    display: flex;
}

#smc-header {
    background: var(--smc-primary, #013C82);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 8px;
}

#smc-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

#smc-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#smc-avatar svg {
    width: 20px;
    height: 20px;
}

#smc-header-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#smc-title {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#smc-subtitle {
    font-size: 12px;
    opacity: .85;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#smc-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

#smc-clear {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    opacity: .7;
    transition: opacity .15s;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#smc-clear svg {
    width: 18px;
    height: 18px;
}

#smc-clear:hover {
    opacity: 1;
    background: rgba(255,255,255,.1);
}

#smc-minimize {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
    opacity: .8;
    transition: opacity .15s;
    border-radius: 4px;
}

#smc-minimize:hover {
    opacity: 1;
    background: rgba(255,255,255,.1);
}

#smc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f5f7fb;
}

.smc-msg {
    display: flex;
    max-width: 92%;
    gap: 8px;
    animation: smcMsgIn .2s ease;
}

@keyframes smcMsgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.smc-msg.smc-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.smc-msg.smc-bot {
    align-self: flex-start;
}

.smc-avatar-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--smc-primary, #013C82);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 4px;
}

.smc-avatar-icon svg {
    width: 16px;
    height: 16px;
}

.smc-user .smc-avatar-icon {
    display: none;
}

.smc-bubble-wrap {
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 38px);
}

.smc-user .smc-bubble-wrap {
    align-items: flex-end;
}

.smc-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.55;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.smc-user .smc-bubble {
    background: var(--smc-primary, #013C82);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.smc-bot .smc-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #e0e4ea;
    border-bottom-left-radius: 4px;
}

.smc-bot .smc-bubble a {
    color: var(--smc-accent, #97A23A);
    text-decoration: underline;
}

.smc-bot .smc-bubble a:hover {
    opacity: .8;
}

.smc-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

.smc-typing {
    display: flex;
    align-items: center;
    gap: 8px;
}

.smc-typing .smc-avatar-icon {
    margin-top: 0;
}

.smc-typing .smc-bubble {
    padding: 14px 18px;
    display: flex;
    gap: 5px;
    align-items: center;
}

.smc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #aaa;
    animation: smcTyping 1.2s infinite;
    display: inline-block;
}

.smc-dot:nth-child(2) { animation-delay: .2s; }
.smc-dot:nth-child(3) { animation-delay: .4s; }

@keyframes smcTyping {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

.smc-welcome {
    margin-bottom: 4px;
}

.smc-welcome .smc-bubble {
    background: linear-gradient(135deg, var(--smc-primary, #013C82), #002a5c);
    color: #fff;
    border: none;
    border-bottom-left-radius: 4px;
}

.smc-welcome .smc-avatar-icon {
    background: var(--smc-accent, #97A23A);
}

#smc-input-area {
    border-top: 1px solid #e8ecf0;
    padding: 10px 12px 12px;
    background: #fff;
    flex-shrink: 0;
}

.smc-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

#smc-input {
    flex: 1;
    border: 1px solid #d0d5dd;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: 13.5px;
    outline: none;
    transition: border-color .15s;
}

#smc-input:focus {
    border-color: var(--smc-primary, #013C82);
}

#smc-input:disabled {
    opacity: .6;
}

#smc-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--smc-primary, #013C82);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity .15s;
}

#smc-send:hover:not(:disabled) {
    background: var(--smc-accent, #97A23A);
}

#smc-send:disabled {
    opacity: .4;
    cursor: default;
}

#smc-send svg {
    width: 17px;
    height: 17px;
}

@media (max-width: 480px) {
    #smc-panel {
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    #smc-launcher {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
    }

    #smc-launcher svg {
        width: 22px;
        height: 22px;
    }

    .smc-msg {
        max-width: 95%;
    }

    .smc-bubble {
        font-size: 14px;
        padding: 11px 15px;
    }

    #smc-input {
        font-size: 14px;
        padding: 10px 16px;
    }
}
