/* 外贸前台聊天挂件（P1-8a） */
.ft-chat-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.ft-chat-widget__toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #1677ff;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(22, 119, 255, 0.4);
    transition: transform .15s ease;
}

.ft-chat-widget__toggle:hover { transform: scale(1.06); }

.ft-chat-widget__panel {
    position: absolute;
    right: 0;
    bottom: 70px;
    width: 340px;
    max-width: calc(100vw - 32px);
    height: 460px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e8eef5;
}

.ft-chat-widget__panel--open { display: flex; }

.ft-chat-widget__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1677ff;
    color: #fff;
    flex-shrink: 0;
}

.ft-chat-widget__title { font-size: 15px; font-weight: 600; }
.ft-chat-widget__close { background: none; border: none; color: #fff; font-size: 16px; cursor: pointer; }

.ft-chat-widget__messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f6f9fc;
}

.ft-chat-widget__msg { margin-bottom: 10px; max-width: 82%; clear: both; }
.ft-chat-widget__msg--buyer { float: right; }
.ft-chat-widget__msg--agent, .ft-chat-widget__msg--system { float: left; }
.ft-chat-widget__msg .bubble {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}
.ft-chat-widget__msg--buyer .bubble { background: #1677ff; color: #fff; border-top-right-radius: 2px; }
.ft-chat-widget__msg--agent .bubble { background: #fff; border: 1px solid #e2e8f0; border-top-left-radius: 2px; }
.ft-chat-widget__msg--system .bubble { background: #eef2f7; color: #64748b; font-size: 13px; text-align: center; width: 100%; }
.ft-chat-widget__msg .time { font-size: 11px; color: #94a3b8; margin-top: 2px; }

.ft-chat-widget__form { border-top: 1px solid #e8eef5; padding: 10px; background: #fff; flex-shrink: 0; }
.ft-chat-widget__fields { display: flex; gap: 8px; margin-bottom: 8px; }
.ft-chat-widget__input {
    flex: 1;
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid #d7e0ea;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
}
.ft-chat-widget__input:focus, .ft-chat-widget__textarea:focus { border-color: #1677ff; }
.ft-chat-widget__sendrow { display: flex; gap: 8px; align-items: flex-end; }
.ft-chat-widget__textarea {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #d7e0ea;
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    outline: none;
    font-family: inherit;
}
.ft-chat-widget__send {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    background: #1677ff;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}
.ft-chat-widget__channels { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.ft-chat-widget__channel {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    text-decoration: none;
    color: #1677ff;
    border: 1px solid #bfdbfe;
    background: #f0f7ff;
}
.ft-chat-widget__channel--wa { color: #1da851; border-color: #b7ecc8; background: #f0fbf4; }
.ft-chat-widget__channel--fb { color: #1877f2; border-color: #bcd9fb; background: #f0f6ff; }
