/* ==========================================================================
   联系渠道浮窗（扁平 / 浅色 / 无黑边）
   ========================================================================== */

html.fc-chw-scroll-locked,
html.fc-chw-scroll-locked body {
    overflow: hidden !important;
    overscroll-behavior: none !important;
}

.fc-chw {
    --fc-ch-color: #25d366;
    --fc-ch-text: #fff;
    --fc-ch-x: 24px;
    --fc-ch-y: 24px;
    position: fixed;
    bottom: var(--fc-ch-y);
    z-index: 99990;
    opacity: 0;
    /* 这里不能用 transform 做动画：会让本元素成为 fixed 子元素的包含块，
       手机端的面板（position:fixed）宽度就会被压成按钮那么宽 */
    transition: opacity .25s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.fc-chw-right { right: var(--fc-ch-x); }
.fc-chw-left { left: var(--fc-ch-x); }

.fc-chw.is-on { opacity: 1; }

/* ---------- 浮窗按钮 ---------- */
.fc-chw-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 0 auto;
    padding: 0;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 28px;
    background: var(--fc-ch-color);
    color: var(--fc-ch-text);
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .18);
    transition: transform .18s ease, box-shadow .18s ease, padding .18s ease;
    justify-content: center;
    font: inherit;
}

.fc-chw-left .fc-chw-btn { margin: 0 auto 0 0; }
.fc-chw-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(15, 23, 42, .22); }
.fc-chw-btn-ico { display: flex; }
.fc-chw-btn-ico svg { width: 26px; height: 26px; }
.fc-chw-btn-x { display: none; }

.fc-chw-label .fc-chw-btn {
    width: auto;
    padding: 0 20px;
    border-radius: 28px;
}

.fc-chw-label .fc-chw-btn-txt {
    font-size: var(--fc-ch-fs-name, 15px);
    font-weight: 600;
    white-space: nowrap;
}

.fc-chw.is-open .fc-chw-btn-ico { display: none; }
.fc-chw.is-open .fc-chw-btn-x { display: flex; }
.fc-chw.is-open .fc-chw-btn-ico,
.fc-chw.is-open .fc-chw-btn-x { align-items: center; }
.fc-chw.is-open .fc-chw-btn-x svg { width: 22px; height: 22px; }

/* ---------- 展开面板 ---------- */
.fc-chw-box {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .18);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(.98);
    transform-origin: bottom right;
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
}

.fc-chw-left .fc-chw-box { left: 0; right: auto; transform-origin: bottom left; }
.fc-chw.is-open .fc-chw-box { opacity: 1; visibility: visible; transform: none; }

.fc-chw-hd {
    padding: 18px 20px 16px;
    background: var(--fc-ch-color);
    color: var(--fc-ch-text);
}

.fc-chw-hd-t { font-size: var(--fc-ch-fs-title, 17px); font-weight: 700; line-height: 1.4; }
.fc-chw-hd-d { margin-top: 4px; font-size: var(--fc-ch-fs-desc, 13px); line-height: 1.6; opacity: .92; }

.fc-chw-list {
    padding: 8px;
    max-height: 60vh;
    overflow-y: auto;
}

.fc-chw-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: #1f2937;
    transition: background .16s ease;
}

.fc-chw-item:hover { background: #f4f7fa; }

.fc-chw-ico {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(37, 211, 102, .12);
    color: var(--fc-ch-color);
    overflow: hidden;
}

.fc-chw-ico svg { width: 22px; height: 22px; }
.fc-chw-ico img { width: 100%; height: 100%; object-fit: cover; }
/* 后台自定义了底色时，图标用白色 */
.fc-chw-ico[style] { color: #fff; }

.fc-chw-txt { flex: 1 1 auto; min-width: 0; }
.fc-chw-txt b {
    display: block;
    font-size: var(--fc-ch-fs-name, 15px);
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fc-chw-txt em {
    display: block;
    margin-top: 2px;
    font-size: var(--fc-ch-fs-sub, 13px);
    font-style: normal;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc-chw-arrow { color: #c3cad4; font-size: 20px; line-height: 1; }

/* 分组小标题 */
.fc-chw-group {
    padding: 10px 12px 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .3px;
    color: #8a94a3;
}

/* 多个客服：缩进显示，表示从属于上面那条渠道 */
.fc-chw-item.is-agent {
    padding-left: 26px;
}

.fc-chw-item.is-agent .fc-chw-ico {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(37, 211, 102, .08);
}

.fc-chw-item.is-agent .fc-chw-ico svg {
    width: 18px;
    height: 18px;
}

/* GDPR 同意 */
.fc-chw-gdpr {
    padding: 10px 14px 12px;
    border-top: 1px solid #f1f3f6;
}

.fc-chw-gdpr-l {
    display: flex;
    gap: 8px;
    font-size: 12.5px;
    color: #5b6572;
    line-height: 1.6;
    cursor: pointer;
}

.fc-chw-gdpr-cb {
    flex: none;
    width: 15px;
    height: 15px;
    margin-top: 2px;
    accent-color: var(--fc-ch-color);
}

.fc-chw-gdpr-cb.is-need {
    outline: 2px solid #e6a23c;
    outline-offset: 2px;
    border-radius: 3px;
}

.fc-chw-gdpr-link {
    display: inline-block;
    margin: 6px 0 0 23px;
    font-size: 12.5px;
    color: var(--fc-ch-color);
}

.fc-chw-gdpr.is-done {
    opacity: .7;
}

/* 右侧小徽标（如「推荐」「24h」） */
.fc-chw-badge {
    flex: none;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(37, 211, 102, .14);
    color: #1a7f45;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

/* 离线渠道 */
.fc-chw-item.is-offline .fc-chw-ico,
.fc-chb.is-offline .fc-chb-ico {
    filter: grayscale(.55);
    opacity: .75;
}

.fc-chw-item.is-offline .fc-chw-txt em {
    color: #9aa3af;
}

/* ---------- 弹层（二维码 / 客服窗口 / 号码） ---------- */
.fc-chw-modal {
    --fc-ch-color: #25d366;
    --fc-ch-text: #fff;
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
    overscroll-behavior: contain;
}

.fc-chw-modal[hidden] { display: none; }

.fc-chw-mask {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .45);
}

.fc-chw-card {
    position: relative;
    width: 420px;
    max-width: 100%;
    max-height: 88vh;
    max-height: min(88vh, calc(100dvh - 32px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
    overflow: hidden;
    overscroll-behavior: contain;
    animation: fc-chw-pop .18s ease;
}

.fc-chw-card:focus { outline: none; }

@keyframes fc-chw-pop {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: none; }
}

.fc-chw-card-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: #f7f9fb;
}

.fc-chw-card-t { font-size: 15px; color: #111827; }

.fc-chw-card-x {
    border: 0;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0 4px;
}
.fc-chw-card-x:hover { color: #111827; }

.fc-chw-card-bd {
    padding: 16px;
    overflow: auto;
    min-height: 0;
    overscroll-behavior: contain;
    color: #374151;
    font-size: 14px;
    line-height: 1.7;
}

.fc-chw-card-bd.fc-chw-card-bd-ai {
    display: flex;
    padding: 0;
    overflow: hidden;
    overscroll-behavior: none;
}

.fc-chw-card-bd.fc-chw-card-bd-ai .fc-chw-ai {
    width: 100%;
    margin: 0;
}

.fc-chw-card-bd iframe {
    display: block;
    width: 100%;
    height: min(64vh, 620px);
    border: 0;
    border-radius: 10px;
    background: #f7f9fb;
}

.fc-chw-qr { display: block; margin: 0 auto; width: 240px; max-width: 100%; border-radius: 10px; }
.fc-chw-qr-tip { margin-top: 12px; text-align: center; font-size: 13px; color: #6b7280; }

.fc-chw-num {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f4f7fa;
}

.fc-chw-num b { font-size: 17px; color: #111827; letter-spacing: .5px; }

.fc-chw-copy {
    border: 0;
    border-radius: 8px;
    padding: 8px 14px;
    background: var(--fc-ch-color);
    color: var(--fc-ch-text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.fc-chw-copy:hover { opacity: .92; }

.fc-chw-card-ft {
    display: flex;
    justify-content: center;
    gap: 14px;
    padding: 0 16px 16px;
    font-size: 13px;
}

.fc-chw-card-ft:empty { display: none; }
.fc-chw-card-ft a { color: var(--fc-ch-color); text-decoration: none; }
.fc-chw-card-ft a:hover { text-decoration: underline; }

/* ---------- 页面内嵌按钮（短码） ---------- */

.fc-chb-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0;
}

.fc-chb {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 11px 20px;
    border: 0;
    border-radius: 999px;
    background: var(--fc-ch-btn-bg, #25d366);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .14);
    transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.fc-chb:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, .18);
}

.fc-chb:focus-visible {
    outline: 2px solid var(--fc-ch-btn-bg, #25d366);
    outline-offset: 3px;
}

.fc-chb-square { border-radius: 10px; }

.fc-chb-text {
    padding: 0;
    background: none;
    color: var(--fc-ch-btn-bg, #25d366);
    box-shadow: none;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.fc-chb-text:hover { transform: none; box-shadow: none; opacity: .85; }

.fc-chb-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    overflow: hidden;
    border-radius: 6px;
}

.fc-chb-ico svg { width: 20px; height: 20px; }
.fc-chb-ico img { width: 100%; height: 100%; object-fit: cover; }
.fc-chb-text .fc-chb-ico { width: 18px; height: 18px; }
.fc-chb-text .fc-chb-ico svg { width: 16px; height: 16px; }

/* 短码写错时，只给管理员看的提示 */
.fc-chb-hint {
    margin: 14px 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: #fff8e6;
    border: 1px dashed #e6c98a;
    color: #8a6d1f;
    font-size: 13px;
    line-height: 1.7;
}

/* 键盘焦点可见 */
.fc-chw-btn:focus-visible,
.fc-chw-item:focus-visible,
.fc-chw-copy:focus-visible,
.fc-chw-card-x:focus-visible,
.fc-chw-card-ft a:focus-visible {
    outline: 2px solid var(--fc-ch-color, #25d366);
    outline-offset: 2px;
}

/* 复制成功的小提示 */
.fc-chw-toast {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    z-index: 100000;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(17, 24, 39, .9);
    color: #fff;
    font-size: 13.5px;
    animation: fc-chw-pop .18s ease;
}

/* ---------- 手机端：底部整条 ---------- */
@media (max-width: 782px) {
    .fc-chw {
        bottom: calc(var(--fc-ch-y) + env(safe-area-inset-bottom, 0px));
    }

    .fc-chw-right { right: calc(var(--fc-ch-x) + env(safe-area-inset-right, 0px)); }
    .fc-chw-left { left: calc(var(--fc-ch-x) + env(safe-area-inset-left, 0px)); }

    .fc-chw-box {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        max-width: none;
        border-radius: 16px 16px 0 0;
        max-height: 82vh;
        transform: translateY(20px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .fc-chw.is-open .fc-chw-box { transform: none; }
    .fc-chw-list { max-height: 62vh; }
    .fc-chw-card { width: 100%; max-height: 84vh; }
    .fc-chw-card-bd iframe { height: 60vh; }
    .fc-chb { width: 100%; justify-content: center; }
}

/* ---------- AI 主入口：海军蓝 / 冷灰 / 克制蓝 ---------- */

.fc-chw-hd-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.fc-chw-ai-priority {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: none;
    padding: 4px 8px;
    border: 1px solid rgba(37, 99, 235, .16);
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 10.5px;
    font-weight: 650;
    line-height: 1.25;
}

.fc-chw-ai-priority i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #3b82f6;
}

.fc-chw-ai_primary {
    --fc-ai-ink: #0f172a;
    --fc-ai-navy: #111827;
    --fc-ai-blue: #2563eb;
    --fc-ai-blue-deep: #1d4ed8;
    --fc-ai-slate: #64748b;
    --fc-ai-border: #e2e8f0;
}

.fc-chw-ai_primary .fc-chw-btn {
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
    box-shadow:
        0 12px 30px rgba(15, 23, 42, .3),
        0 0 0 1px rgba(148, 163, 184, .12),
        inset 0 1px 0 rgba(255, 255, 255, .12);
}

.fc-chw-ai_primary .fc-chw-btn:hover {
    box-shadow:
        0 15px 34px rgba(15, 23, 42, .36),
        0 0 0 1px rgba(148, 163, 184, .18),
        inset 0 1px 0 rgba(255, 255, 255, .15);
}

.fc-chw-ai_primary .fc-chw-box {
    width: 382px;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 18px;
    background: #f8fafc;
    box-shadow:
        0 28px 70px rgba(15, 23, 42, .24),
        0 2px 8px rgba(15, 23, 42, .08);
}

.fc-chw-ai_primary.has-ai-feature .fc-chw-hd {
    padding: 17px 18px 15px;
    border-bottom: 1px solid #e8edf3;
    background: #fff;
    color: var(--fc-ai-ink);
}

.fc-chw-ai_primary.has-ai-feature .fc-chw-hd-t {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.fc-chw-ai_primary.has-ai-feature .fc-chw-hd-d {
    margin-top: 5px;
    color: var(--fc-ai-slate);
    font-size: 12px;
    opacity: 1;
}

.fc-chw-ai_primary .fc-chw-list-ai {
    padding: 12px;
    background:
        radial-gradient(circle at 100% 0%, rgba(59, 130, 246, .055), transparent 15rem),
        #f8fafc;
}

.fc-chw-ai-feature-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 104px;
    padding: 15px 14px;
    overflow: hidden;
    border: 1px solid rgba(96, 165, 250, .18);
    border-radius: 16px;
    background:
        linear-gradient(135deg, #0f172a 0%, #172033 58%, #1e3a8a 145%);
    box-shadow:
        0 14px 30px rgba(15, 23, 42, .18),
        inset 0 1px 0 rgba(255, 255, 255, .08);
    color: #fff;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.fc-chw-ai-feature-item::after {
    content: "";
    position: absolute;
    right: -48px;
    top: -68px;
    width: 170px;
    height: 170px;
    border: 1px solid rgba(147, 197, 253, .16);
    border-radius: 50%;
    box-shadow:
        0 0 0 28px rgba(59, 130, 246, .035),
        0 0 0 56px rgba(59, 130, 246, .025);
    pointer-events: none;
}

.fc-chw-ai-feature-item:hover {
    transform: translateY(-1px);
    box-shadow:
        0 18px 34px rgba(15, 23, 42, .22),
        inset 0 1px 0 rgba(255, 255, 255, .11);
}

.fc-chw-ai-feature-icon {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 14px;
    background: rgba(255, 255, 255, .09);
    color: #dbeafe;
}

.fc-chw-ai-feature-icon svg {
    width: 25px;
    height: 25px;
}

.fc-chw-ai-feature-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fc-chw-ai-feature-copy {
    position: relative;
    z-index: 1;
    display: block;
    flex: 1 1 auto;
    min-width: 0;
}

.fc-chw-ai-kicker {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 4px;
    color: #93c5fd;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .045em;
}

.fc-chw-ai-kicker i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, .1);
}

.fc-chw-ai-feature-copy strong {
    display: block;
    overflow: hidden;
    color: #f8fafc;
    font-size: 15px;
    font-weight: 650;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fc-chw-ai-feature-copy em {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    color: #aebed0;
    font-size: 11px;
    font-style: normal;
    line-height: 1.55;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fc-chw-ai-start {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
    padding: 6px 8px;
    border: 1px solid rgba(147, 197, 253, .2);
    border-radius: 8px;
    background: rgba(37, 99, 235, .22);
    color: #dbeafe;
    font-size: 10px;
    font-weight: 650;
    white-space: nowrap;
}

.fc-chw-ai-start svg {
    width: 13px;
    height: 13px;
}

.fc-chw-ai-feature-item.is-offline {
    filter: grayscale(.45);
}

.fc-chw-alt-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 15px 3px 8px;
    color: #64748b;
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: .04em;
}

.fc-chw-alt-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.fc-chw-alt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 7px;
}

.fc-chw-ai_primary .fc-chw-alt-item {
    gap: 8px;
    min-width: 0;
    min-height: 54px;
    padding: 8px 9px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .025);
}

.fc-chw-ai_primary .fc-chw-alt-item:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.fc-chw-ai_primary .fc-chw-alt-item .fc-chw-ico {
    width: 33px;
    height: 33px;
    border-radius: 9px;
    background: #f1f5f9;
    color: #475569;
}

.fc-chw-ai_primary .fc-chw-alt-item .fc-chw-ico svg {
    width: 18px;
    height: 18px;
}

.fc-chw-ai_primary .fc-chw-alt-item .fc-chw-txt b {
    color: #334155;
    font-size: 12px;
    font-weight: 600;
}

.fc-chw-ai_primary .fc-chw-alt-item .fc-chw-txt em {
    margin-top: 1px;
    color: #94a3b8;
    font-size: 9.5px;
}

.fc-chw-ai_primary .fc-chw-alt-item .fc-chw-arrow {
    display: none;
}

.fc-chw-ai_primary .fc-chw-alt-item .fc-chw-badge {
    max-width: 52px;
    overflow: hidden;
    border-radius: 5px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 9px;
    text-overflow: ellipsis;
}

.fc-chw-ai_primary .fc-chw-alt-item.is-agent {
    padding-left: 9px;
}

.fc-chw-ai_primary .fc-chw-alt-item.is-agent .fc-chw-ico {
    width: 33px;
    height: 33px;
    background: #f1f5f9;
}

.fc-chw-alt-group {
    grid-column: 1 / -1;
    padding: 5px 3px 1px;
    color: #94a3b8;
    font-size: 9.5px;
    font-weight: 650;
    letter-spacing: .04em;
}

.fc-chw-ai_primary .fc-chw-ai-feature-item:focus-visible,
.fc-chw-ai_primary .fc-chw-alt-item:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

@media (max-width: 782px) {
    .fc-chw-ai_primary .fc-chw-box {
        width: auto;
        border-radius: 18px 18px 0 0;
    }

    .fc-chw-ai-feature-item {
        min-height: 98px;
        padding: 13px 12px;
    }

    .fc-chw-ai-start {
        padding: 5px 6px;
    }
}

/* ---------- AI 智能问答 ---------- */

.fc-chw-ai {
    display: flex;
    flex-direction: column;
    height: min(68vh, 620px);
    height: min(68dvh, 620px);
    min-height: 420px;
    margin: -16px;
    background: #f7f9fb;
}

.fc-chw-ai,
.fc-chw-ai * {
    box-sizing: border-box;
}

.fc-chw-ai-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    padding: 20px 18px 14px;
    background: linear-gradient(180deg, #f8fafc 0%, #f5f7fa 100%);
    overscroll-behavior: contain;
}

.fc-chw-ai-row {
    display: flex;
    margin: 0 0 12px;
}

.fc-chw-ai-row.is-user {
    justify-content: flex-end;
}

.fc-chw-ai-msg {
    max-width: 86%;
    padding: 10px 13px;
    border: 1px solid #e4e9f0;
    border-radius: 14px 14px 14px 4px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .055);
    color: #283548;
}

.fc-chw-ai-row.is-user .fc-chw-ai-msg {
    border-color: var(--fc-ch-color);
    border-radius: 14px 14px 4px;
    background: var(--fc-ch-color);
    color: var(--fc-ch-text);
    box-shadow: none;
}

.fc-chw-ai-msg p {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.fc-chw-ai-row.is-loading .fc-chw-ai-msg p::after {
    content: "";
    display: inline-block;
    width: 1em;
    text-align: left;
    animation: fc-chw-ai-dots 1.2s steps(4, end) infinite;
}

@keyframes fc-chw-ai-dots {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75%, 100% { content: "..."; }
}

.fc-chw-ai-sources {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 9px;
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px solid rgba(107, 114, 128, .18);
    font-size: 12px;
}

.fc-chw-ai-sources-t {
    opacity: .68;
}

.fc-chw-ai-sources a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.fc-chw-ai-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0 14px;
    padding: 9px 11px;
    border: 1px solid #f0d2d2;
    border-radius: 10px;
    background: #fff5f5;
    color: #a12d2d;
    font-size: 12.5px;
}

.fc-chw-ai-error button {
    flex: none;
    padding: 4px 9px;
    border: 1px solid currentColor;
    border-radius: 7px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.fc-chw-ai-composer {
    display: flex;
    align-items: end;
    gap: 9px;
    padding: 12px;
    border-top: 1px solid #e3e8ef;
    background: #fff;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, .035);
}

.fc-chw-ai-input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: 46px;
    min-height: 46px;
    max-height: 112px;
    padding: 11px 13px;
    overflow-y: hidden;
    resize: none;
    border: 1px solid #d9e0e8;
    border-radius: 11px;
    background: #fff;
    color: #1f2937;
    font: inherit;
    font-size: 14px;
    line-height: 22px;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.fc-chw-ai-input:focus {
    border-color: var(--fc-ch-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, .15);
}

.fc-chw-ai-send {
    flex: 0 0 auto;
    height: 46px;
    min-width: 64px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    background: var(--fc-ch-color);
    color: var(--fc-ch-text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

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

.fc-chw-ai-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px 14px;
    padding: 0 12px 11px;
    background: #fff;
    text-align: center;
    font-size: 12.5px;
}

.fc-chw-ai-links:empty {
    display: none;
}

.fc-chw-ai-links a {
    color: var(--fc-ch-color);
    text-decoration: none;
}

.fc-chw-ai-links a:hover {
    text-decoration: underline;
}

.fc-chw-ai-handoff-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 6px 12px;
    border: 1px solid #bfd3ea;
    border-radius: 8px;
    background: #fff;
    color: #1d4ed8 !important;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none !important;
    box-shadow: 0 3px 10px rgba(30, 64, 175, .07);
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.fc-chw-ai-handoff-button:hover {
    border-color: #2563eb;
    background: #eff6ff;
    transform: translateY(-1px);
}

.fc-chw-ai-lead-toggle {
    min-height: 32px;
    padding: 6px 13px;
    border: 1px solid #1d4ed8;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font: inherit;
    font-size: inherit;
    font-weight: 650;
    line-height: 1.2;
    box-shadow: 0 5px 14px rgba(37, 99, 235, .2);
    cursor: pointer;
    transition: background .16s ease, box-shadow .16s ease, transform .16s ease;
}

.fc-chw-ai-lead-toggle:hover {
    background: #1d4ed8;
    box-shadow: 0 7px 17px rgba(37, 99, 235, .26);
    transform: translateY(-1px);
}

.fc-chw-ai-lead-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 18px;
    background: #f7f9fb;
}

.fc-chw-ai-lead-panel[hidden] {
    display: none;
}

.fc-chw-ai.is-lead-mode .fc-chw-ai-list,
.fc-chw-ai.is-lead-mode .fc-chw-ai-composer,
.fc-chw-ai.is-lead-mode .fc-chw-ai-links {
    display: none;
}

.fc-chw-ai-lead-hd {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    max-width: 460px;
    margin: 0 auto 14px;
}

.fc-chw-ai-lead-hd-copy strong,
.fc-chw-ai-lead-hd-copy span {
    display: block;
}

.fc-chw-ai-lead-hd-copy strong {
    color: #172033;
    font-size: 15px;
    font-weight: 700;
}

.fc-chw-ai-lead-hd-copy span {
    margin-top: 3px;
    color: #7a8597;
    font-size: 11.5px;
}

.fc-chw-ai-lead-back {
    flex: none;
    padding: 5px 7px;
    border: 1px solid #dce3eb;
    border-radius: 7px;
    background: #fff;
    color: #657184;
    font: inherit;
    font-size: 10.5px;
    cursor: pointer;
}

.fc-chw-ai-lead-form {
    max-width: 460px;
    margin: 0 auto;
    padding: 16px;
    border: 1px solid #e3e8ef;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .045);
}

.fc-chw-ai-lead-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 11px;
}

.fc-chw-ai-lead-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.fc-chw-ai-lead-field:first-child,
.fc-chw-ai-lead-field:last-child {
    grid-column: 1 / -1;
}

.fc-chw-ai-lead-field > span {
    color: #475569;
    font-size: 11px;
    font-weight: 600;
}

.fc-chw-ai-lead-field input,
.fc-chw-ai-lead-field textarea {
    width: 100%;
    min-height: 40px;
    padding: 9px 10px;
    border: 1px solid #dce3eb;
    border-radius: 9px;
    outline: none;
    background: #fbfcfe;
    color: #1f2937;
    font: inherit;
    font-size: 12.5px;
    line-height: 1.5;
}

.fc-chw-ai-lead-field textarea {
    resize: vertical;
}

.fc-chw-ai-lead-field input:focus,
.fc-chw-ai-lead-field textarea:focus {
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .1);
}

.fc-chw-ai-honeypot {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

.fc-chw-ai-lead-consent {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin-top: 12px;
    color: #6b7788;
    font-size: 10.5px;
    line-height: 1.6;
    cursor: pointer;
}

.fc-chw-ai-lead-consent input {
    flex: none;
    margin-top: 2px;
    accent-color: #2563eb;
}

.fc-chw-ai-lead-status {
    min-height: 18px;
    margin: 8px 0 0;
    color: #64748b;
    font-size: 11px;
    line-height: 1.5;
}

.fc-chw-ai-lead-status.is-error {
    color: #b42318;
}

.fc-chw-ai-lead-status.is-success {
    color: #18794e;
}

.fc-chw-ai-lead-submit {
    width: 100%;
    min-height: 40px;
    margin-top: 9px;
    border: 0;
    border-radius: 9px;
    background: #2563eb;
    color: #fff;
    font: inherit;
    font-size: 12.5px;
    font-weight: 650;
    cursor: pointer;
}

.fc-chw-ai-lead-submit:hover {
    background: #1d4ed8;
}

.fc-chw-ai-lead-submit:disabled {
    opacity: .6;
    cursor: wait;
}

.fc-chw-ai-send:focus-visible,
.fc-chw-ai-error button:focus-visible,
.fc-chw-ai-sources a:focus-visible,
.fc-chw-ai-links a:focus-visible,
.fc-chw-ai-lead-toggle:focus-visible,
.fc-chw-ai-lead-back:focus-visible,
.fc-chw-ai-lead-submit:focus-visible {
    outline: 2px solid var(--fc-ch-color, #25d366);
    outline-offset: 2px;
}

@media (max-width: 782px) {
    .fc-chw-ai {
        height: calc(84vh - 56px);
        height: calc(84dvh - 56px);
        min-height: 360px;
    }

    .fc-chw-ai-list {
        padding: 16px 12px 12px;
    }

    .fc-chw-ai-msg {
        max-width: 91%;
    }

    .fc-chw-ai-lead-panel {
        padding: 14px 12px;
    }

    .fc-chw-ai-lead-fields {
        grid-template-columns: minmax(0, 1fr);
    }

    .fc-chw-ai-lead-field {
        grid-column: 1 / -1;
    }

    .fc-chw-ai-composer {
        gap: 8px;
        padding: 10px;
    }

    .fc-chw-ai-input {
        font-size: 16px;
    }

    .fc-chw-ai-send {
        min-width: 60px;
        padding: 0 13px;
    }
}
