/* ============================================================
   YY Chat — 客户 IM + 客服工作台 共用样式（暖色，对标站点）
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

/* 全页容器高度：
   1) --yy-vh 由 JS 同步真实可视高度（软键盘弹出时也能保证输入框可见）
   2) 回退 100dvh（跟随浏览器地址栏伸缩）
   3) 最后才是 100vh（老浏览器）
   移动端用固定 100vh 时，输入框会被地址栏/浏览器工具栏挤到屏幕外，就是这个变量要解决的问题。 */
/* 全页容器锁定视口：position:fixed 让移动端聚焦输入框时浏览器无法把页面滚动，
   从而杜绝「输入框飞到顶部」；高度走 --yy-vh（软键盘弹出时自动收缩到键盘上方）。 */
.yy-chat-app {
    position: fixed; top: 0; left: 0; right: 0;
    display: flex; flex-direction: column;
    height: 100vh;
    height: 100dvh;
    height: var(--yy-vh, 100dvh);
    overflow: hidden;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #faf7f2;
    color: #3d3530;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

/* ---------- 顶部栏 ---------- */
.yy-c-header {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px;
    background: #fff;
    border-bottom: 1px solid #f0ebe3;
    flex: 0 0 auto;
}
.yy-c-logo {
    width: 38px; height: 38px; border-radius: 50%;
    background: #7a9e7e; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 16px; flex: 0 0 auto;
}
.yy-c-title { font-weight: 600; font-size: 16px; }
.yy-c-sub { font-size: 12px; color: #a89e94; }

/* ---------- 消息区 ---------- */
.yy-c-chat {
    flex: 1 1 auto; overflow-y: auto;
    padding: 20px 16px;
    display: flex; flex-direction: column; gap: 14px;
    min-height: 0;
}
.yy-c-msg { display: flex; align-items: flex-start; gap: 10px; max-width: 78%; }
.yy-c-msg.self { align-self: flex-end; flex-direction: row-reverse; }
.yy-c-msg .avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: #e8a87c; color: #fff; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600; overflow: hidden;
}
.yy-c-msg .avatar img { width: 100%; height: 100%; object-fit: cover; }
.yy-c-msg .body { display: flex; flex-direction: column; }
.yy-c-msg.self .body { align-items: flex-end; }
.yy-c-bubble {
    padding: 10px 14px; border-radius: 14px;
    background: #fff; border: 1px solid #f0ebe3;
    font-size: 15px; word-break: break-word; white-space: pre-wrap;
    max-width: 100%;
}
.yy-c-msg.self .yy-c-bubble { background: #7a9e7e; color: #fff; border-color: #7a9e7e; }
.yy-c-bubble img.msg-img {
    display: block; max-width: 220px; max-height: 280px; border-radius: 10px; cursor: zoom-in;
}
/* 视频消息气泡：深色底衬，控件自带播放条 */
.yy-c-bubble.video-bubble { padding: 4px; background: #1c1c1c; border-color: #1c1c1c; }
.yy-c-msg.self .yy-c-bubble.video-bubble { background: #1c1c1c; border-color: #1c1c1c; }
.yy-c-bubble.video-bubble video.msg-video {
    display: block; width: 240px; max-width: 72vw; max-height: 320px; border-radius: 8px; background: #000;
}
@media (max-width: 900px) {
    .yy-c-bubble.video-bubble video.msg-video { width: 200px; }
}
.yy-c-time { font-size: 11px; color: #b4a99f; margin-top: 4px; }
.yy-c-read { font-size: 11px; color: #7a9e7e; margin-top: 2px; text-align: right; opacity: .85; }
.yy-a-ua { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yy-c-tip {
    align-self: center; font-size: 12px; color: #a89e94;
    background: rgba(255,255,255,.6); padding: 4px 14px; border-radius: 20px;
}

/* ---------- 输入栏 ---------- */
.yy-c-input {
    display: flex; align-items: flex-end; gap: 10px;
    padding: 14px 16px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    background: #fff; border-top: 1px solid #f0ebe3; flex: 0 0 auto;
}
.yy-c-input .img-btn {
    width: 52px; height: 52px; border-radius: 14px; border: 1px solid #ece5dd;
    background: #fff; color: #7a6e64; cursor: pointer; font-size: 22px; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.yy-c-input .img-btn:hover { background: #f3f7f3; color: #5d8462; }
.yy-c-input textarea {
    flex: 1 1 auto; height: 52px; min-height: 52px; max-height: 200px; resize: none;
    border: 1px solid #ece5dd; border-radius: 14px; padding: 14px 16px;
    font-size: 15px; line-height: 1.5; font-family: inherit; color: #3d3530; background: #faf8f5;
    outline: none; transition: border-color .2s;
    overflow-y: auto;
}
.yy-c-input textarea:focus { border-color: #7a9e7e; background: #fff; }
.yy-c-input .send-btn {
    height: 52px; padding: 0 28px; border: none; border-radius: 14px;
    background: #7a9e7e; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; flex: 0 0 auto;
    transition: all .2s;
}
.yy-c-input .send-btn:hover { background: #5d8462; }
.yy-c-input .send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* 图片消息加载失败（文件已被清理等）时的占位，避免显示成破图 */
.yy-c-img-broken {
    padding: 16px 22px; border-radius: 12px; background: #f3efe9;
    color: #a89e94; font-size: 13px; text-align: center; min-width: 120px;
}

/* 聊天头部操作按钮（相册集素材 / 用户资料）—— 放大点击热区 */
.yy-c-header .img-btn {
    width: 46px; height: 46px; flex: 0 0 auto; padding: 0;
    border: 1px solid #ece5dd; border-radius: 13px;
    background: #fff; color: #7a6e64; cursor: pointer;
    font-size: 22px; line-height: 1; font-family: inherit;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s;
}
.yy-c-header .img-btn:hover {
    background: #f3f7f3; color: #5d8462; border-color: #7a9e7e;
}
.yy-c-header .img-btn:active { transform: scale(.93); }

/* ---------- 图片灯箱 ---------- */
.yy-lb { position: fixed; inset: 0; z-index: 99999; background: rgba(30,26,23,.92);
    display: none; align-items: center; justify-content: center; cursor: zoom-out; }
.yy-lb.show { display: flex; }
.yy-lb img { max-width: 92%; max-height: 90%; border-radius: 10px; box-shadow: 0 12px 48px rgba(0,0,0,.5); }

/* ============================================================
   客服工作台
   ============================================================ */
.yy-a-wrap {
    position: fixed; top: 0; left: 0; right: 0;
    display: flex; flex-direction: column;
    height: 100vh;
    height: 100dvh;
    height: var(--yy-vh, 100dvh);
    overflow: hidden;
}
.yy-a-header {
    display: flex; align-items: center; gap: 12px; padding: 12px 20px;
    background: #fff; border-bottom: 1px solid #f0ebe3; flex: 0 0 auto;
}
.yy-a-header .brand { font-weight: 600; font-size: 16px; }
.yy-a-header .spacer { flex: 1; }
.yy-a-header .agent-name { color: #7a6e64; font-size: 13px; }
.yy-a-header .conn { font-size: 12px; padding: 3px 10px; border-radius: 20px; }
.yy-a-header .conn.on { background: #eaf3de; color: #3b6d11; }
.yy-a-header .conn.off { background: #fcebeb; color: #a32d2d; }

.yy-a-main { display: flex; flex: 1 1 auto; min-height: 0; }

/* 会话列表 */
.yy-a-list { width: 300px; flex: 0 0 auto; border-right: 1px solid #f0ebe3; background: #fff;
    display: flex; flex-direction: column; min-height: 0; }
.yy-a-list-head { padding: 12px 16px; font-weight: 600; font-size: 14px; color: #7a6e64; border-bottom: 1px solid #f5f0ea; }
.yy-a-convs { flex: 1; overflow-y: auto; }
.yy-a-conv {
    display: flex; gap: 10px; padding: 12px 16px; cursor: pointer;
    border-bottom: 1px solid #faf6f0; transition: background .15s;
}
.yy-a-conv:hover { background: #faf7f2; }
.yy-a-conv.active { background: #f3f7f3; }
.yy-a-conv .avatar { width: 40px; height: 40px; border-radius: 50%; background: #e8a87c; color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 600; flex: 0 0 auto; overflow: hidden; }
.yy-a-conv .avatar img { width: 100%; height: 100%; object-fit: cover; }
.yy-a-conv .meta { flex: 1; min-width: 0; }
.yy-a-conv .row1 { display: flex; justify-content: space-between; align-items: center; }
.yy-a-conv .name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yy-a-conv .time { font-size: 11px; color: #b4a99f; flex: 0 0 auto; margin-left: 8px; }
.yy-a-conv .preview { font-size: 12px; color: #a89e94; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.yy-a-badge { background: #d4895f; color: #fff; font-size: 11px; min-width: 18px; height: 18px;
    border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.yy-a-empty { padding: 40px 20px; text-align: center; color: #a89e94; font-size: 13px; }

/* 聊天面板 */
.yy-a-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.yy-a-chat .yy-c-header { border-bottom: 1px solid #f0ebe3; flex: 0 0 auto; }
.yy-a-chat .yy-c-header .yy-c-title { font-size: 15px; }
.yy-a-chat-placeholder { flex: 1; display: flex; align-items: center; justify-content: center; color: #a89e94; }
/* 消息区必须允许收缩，否则消息变多时 flex 容器会被撑开，把输入框顶出屏幕 */
.yy-a-chat .yy-c-chat { min-height: 0; }

/* 移动端返回按钮（桌面隐藏） */
.yy-a-back { display: none; }
.yy-a-mask { display: none; }

/* 用户信息侧栏 */
.yy-a-info { width: 280px; flex: 0 0 auto; border-left: 1px solid #f0ebe3; background: #fff;
    display: none; flex-direction: column; min-height: 0; }
.yy-a-info.show { display: flex; }
.yy-a-info .block { padding: 14px 16px; border-bottom: 1px solid #f5f0ea; }
.yy-a-info h4 { font-size: 13px; color: #7a6e64; margin-bottom: 8px; }
.yy-a-info .kv { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.yy-a-info .kv .k { color: #a89e94; }
.yy-a-info .order { border: 1px solid #f0ebe3; border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; font-size: 12px; }
.yy-a-info .order .top { display: flex; justify-content: space-between; }
.yy-a-info .order .id { font-weight: 600; }
.yy-a-info .order .st { color: #d4895f; }
.yy-a-info .order .total { color: #3d3530; font-weight: 600; }

/* ============================================================
   移动端适配（≤ 900px）
   目标：输入框永远贴底可见；工作台改成「列表 / 聊天」单栏切换
   ============================================================ */
@media (max-width: 900px) {
    /* --- 工作台：列表与聊天二选一 --- */
    .yy-a-list { width: 100%; border-right: none; }
    .yy-a-chat { display: none; }
    body.yy-a-chat-open .yy-a-list { display: none; }
    body.yy-a-chat-open .yy-a-chat { display: flex; }

    .yy-a-back {
        display: flex; align-items: center; justify-content: center;
        width: 34px; height: 34px; margin-left: -6px; flex: 0 0 auto;
        border: none; background: transparent; color: #7a6e64;
        font-size: 24px; line-height: 1; cursor: pointer; padding: 0;
    }
    .yy-a-back:active { background: #f3f0eb; border-radius: 50%; }

    /* --- 客户信息侧栏 → 右侧抽屉 --- */
    .yy-a-info {
        position: fixed; top: 0; right: 0; bottom: 0; z-index: 60;
        width: 84%; max-width: 340px; overflow-y: auto;
        border-left: none;
        box-shadow: -8px 0 32px rgba(61, 53, 48, .18);
        padding-top: env(safe-area-inset-top, 0px);
    }
    .yy-a-mask {
        position: fixed; inset: 0; z-index: 55; background: rgba(30, 26, 23, .35);
    }
    body.yy-a-info-open .yy-a-mask { display: block; }

    /* --- 输入框：给足空间 + 贴底 + 安全区 --- */
    .yy-c-input {
        gap: 8px;
        padding: 10px 12px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }
    /* 字号 16px 是为了避免 iOS 聚焦时自动放大页面 */
    .yy-c-input textarea {
        height: 48px; min-height: 48px; max-height: 132px;
        font-size: 16px; padding: 12px 14px; border-radius: 13px;
    }
    .yy-c-input .img-btn {
        width: 48px; height: 48px; font-size: 21px; border-radius: 13px;
    }
    .yy-c-input .send-btn {
        height: 48px; padding: 0 20px; font-size: 15px; border-radius: 13px;
    }

    /* --- 其它间距收紧 --- */
    .yy-c-header { padding: 11px 14px; gap: 10px; }
    .yy-c-logo { width: 34px; height: 34px; font-size: 15px; }
    .yy-c-chat { padding: 16px 12px; gap: 12px; }
    .yy-c-msg { max-width: 86%; }
    .yy-a-header { padding: 10px 14px; gap: 10px; }
    .yy-a-header .brand { font-size: 15px; }
    .yy-a-header .agent-name { display: none; }
    .yy-a-info .block { padding: 12px 14px; }
}

/* 超窄屏（≤ 380px）：进一步压缩，保证输入框不被挤没 */
@media (max-width: 380px) {
    .yy-c-input { gap: 6px; padding: 8px 10px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
    .yy-c-input .send-btn { padding: 0 14px; font-size: 14px; }
    .yy-c-input .img-btn { width: 44px; height: 48px; }
}

/* ============================================================
   客服工作台：导航 + 相册集 + 个人资料 + 素材弹窗
   ============================================================ */
.yy-a-logo {
    width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
    background: #7a9e7e; color: #fff; font-size: 14px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
}
.yy-a-nav { display: flex; gap: 4px; margin-left: 20px; flex: 0 0 auto; }
.yy-a-nav-item {
    border: none; background: transparent; cursor: pointer; font-family: inherit;
    padding: 7px 14px; border-radius: 10px; font-size: 14px; color: #7a6e64;
    transition: all .18s; white-space: nowrap;
}
.yy-a-nav-item:hover { background: #f5f0ea; color: #3d3530; }
.yy-a-nav-item.is-active { background: #7a9e7e; color: #fff; font-weight: 600; }

/* 视图容器 */
.yy-a-view { display: none; flex: 1 1 auto; min-width: 0; min-height: 0; }
.yy-a-view.is-active { display: flex; }

/* 通用页面（相册 / 资料） */
.yy-a-page { flex: 1; overflow-y: auto; padding: 24px 28px 40px; min-width: 0; }
.yy-a-page-head { margin-bottom: 20px; }
.yy-a-page-head h3 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.yy-a-page-desc { font-size: 13px; color: #a89e94; }
.yy-a-hint { font-size: 12px; color: #b4a99f; margin-top: 6px; }

.yy-a-input {
    height: 40px; border: 1px solid #ece5dd; border-radius: 10px; padding: 0 12px;
    font-size: 14px; font-family: inherit; color: #3d3530; background: #fff; outline: none;
    transition: border-color .2s;
}
.yy-a-input:focus { border-color: #7a9e7e; }
.yy-a-btn {
    height: 40px; padding: 0 18px; border: 1px solid #ece5dd; border-radius: 10px;
    background: #fff; color: #3d3530; font-size: 14px; font-family: inherit;
    cursor: pointer; transition: all .18s; white-space: nowrap;
}
.yy-a-btn:hover { border-color: #7a9e7e; color: #5d8462; }
.yy-a-btn.primary { background: #7a9e7e; border-color: #7a9e7e; color: #fff; font-weight: 600; }
.yy-a-btn.primary:hover { background: #5d8462; border-color: #5d8462; color: #fff; }
.yy-a-btn.ghost { background: transparent; color: #a89e94; }
.yy-a-btn.ghost:hover { color: #d4895f; border-color: #e8a87c; }
.yy-a-btn.danger:hover { color: #c0392b; border-color: #e6b0aa; }
.yy-a-btn:disabled { opacity: .55; cursor: not-allowed; }

/* 相册集 */
.yy-album-create { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.yy-album-create .yy-a-input { flex: 1 1 240px; min-width: 200px; }
.yy-album-list { display: flex; flex-direction: column; gap: 18px; }
.yy-album {
    background: #fff; border: 1px solid #f0ebe3; border-radius: 16px; padding: 16px 18px;
}
.yy-album-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.yy-album-name { font-size: 15px; font-weight: 600; margin-right: 2px; }
.yy-album-count { font-size: 12px; color: #b4a99f; }
.yy-album-head .spacer { flex: 1; }
.yy-album-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px; margin-top: 4px;
}
.yy-album-cell {
    position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden;
    background: #faf8f5; border: 1px solid #f0ebe3;
}
.yy-album-cell img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.yy-album-del {
    position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%;
    border: none; background: rgba(30, 26, 23, .55); color: #fff; font-size: 15px; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0;
    transition: opacity .18s;
}
.yy-album-cell:hover .yy-album-del { opacity: 1; }
.yy-album-add {
    aspect-ratio: 1 / 1; border: 2px dashed #e3dbd2; border-radius: 12px; background: #fdfaf6;
    color: #a89e94; font-size: 26px; cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: all .18s;
}
.yy-album-add:hover { border-color: #7a9e7e; color: #7a9e7e; background: #f3f7f3; }
.yy-album-empty { color: #b4a99f; font-size: 13px; padding: 6px 0 2px; }

/* 个人资料 */
.yy-profile-card {
    background: #fff; border: 1px solid #f0ebe3; border-radius: 16px;
    padding: 24px 26px; max-width: 560px;
}
.yy-profile-avatar { display: flex; gap: 20px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.yy-avatar-preview {
    width: 78px; height: 78px; border-radius: 50%; overflow: hidden; flex: 0 0 auto;
    background: #e8a87c; color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 600;
}
.yy-avatar-preview img { width: 100%; height: 100%; object-fit: cover; display: none; }
.yy-avatar-preview.has-img img { display: block; }
.yy-avatar-preview.has-img span { display: none; }
.yy-avatar-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.yy-profile-row { margin-bottom: 18px; }
.yy-profile-row label { display: block; font-size: 13px; color: #7a6e64; margin-bottom: 6px; }
.yy-profile-row .yy-a-input { width: 100%; max-width: 320px; }
.yy-profile-actions { display: flex; gap: 10px; padding-top: 6px; flex-wrap: wrap; }
.yy-profile-preview {
    margin-top: 26px; padding-top: 20px; border-top: 1px dashed #ece5dd;
}

/* 素材选择弹窗 */
.yy-modal { position: fixed; inset: 0; z-index: 200; display: none; }
.yy-modal.show { display: block; }
.yy-modal-mask { position: absolute; inset: 0; background: rgba(30, 26, 23, .45); }
.yy-modal-box {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: min(760px, 92vw); max-height: 84vh; background: #fff; border-radius: 18px;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 24px 64px rgba(61, 53, 48, .28);
}
.yy-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid #f0ebe3; font-weight: 600; font-size: 15px;
}
.yy-modal-close {
    border: none; background: transparent; font-size: 24px; line-height: 1; cursor: pointer;
    color: #a89e94; padding: 0 4px;
}
.yy-modal-close:hover { color: #3d3530; }
.yy-modal-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.yy-modal-foot { padding: 10px 18px; border-top: 1px solid #f5f0ea; }
.yy-picker-album { margin-bottom: 18px; }
.yy-picker-album-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: #3d3530; }
.yy-picker-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px;
}
.yy-picker-cell {
    aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; border: 2px solid transparent;
    cursor: pointer; background: #faf8f5; transition: all .16s; padding: 0;
}
.yy-picker-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yy-picker-cell:hover { border-color: #7a9e7e; transform: translateY(-2px); }

/* 多选：选中态 / 全选按钮 / 底部发送栏 */
.yy-picker-cell.is-selected { border-color: #7a9e7e; box-shadow: 0 0 0 3px rgba(122, 158, 126, .22); }
.yy-picker-cell.is-selected::after {
    content: '✓';
    position: absolute; right: 4px; bottom: 3px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #7a9e7e; color: #fff; font-size: 13px; line-height: 20px; text-align: center;
}
.yy-picker-cell { position: relative; }
.yy-picker-album-head {
    display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.yy-picker-album-title { margin-bottom: 0; }
.yy-picker-album-head .spacer { flex: 1; }
.yy-picker-select-all {
    height: 30px; padding: 0 14px; border: 1px solid #ece5dd; border-radius: 8px;
    background: #fff; color: #7a6e64; font-size: 13px; font-family: inherit;
    cursor: pointer; transition: all .16s; white-space: nowrap;
}
.yy-picker-select-all:hover { border-color: #7a9e7e; color: #5d8462; background: #f3f7f3; }
.yy-picker-select-all.is-on { background: #7a9e7e; border-color: #7a9e7e; color: #fff; }

.yy-modal-foot {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 18px; border-top: 1px solid #f5f0ea;
}
.yy-modal-foot .spacer { flex: 1; }
.yy-picker-count { font-size: 14px; color: #7a6e64; }
.yy-picker-count b { color: #d4895f; font-size: 16px; margin: 0 2px; }
.yy-modal-foot .yy-a-btn { height: 38px; }

/* 移动端：导航横向滚动、页面内边距收紧 */
@media (max-width: 900px) {
    .yy-a-nav { margin-left: 8px; gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .yy-a-nav-item { padding: 6px 10px; font-size: 13px; }
    .yy-a-page { padding: 16px 14px 32px; }
    .yy-profile-card { padding: 18px 16px; }
    .yy-album-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
    .yy-modal-box { width: 94vw; max-height: 78vh; }
    .yy-picker-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
    /* 移动端按钮也要够大好点，但不能挤掉会话名 */
    .yy-c-header .img-btn { width: 42px; height: 42px; font-size: 20px; border-radius: 12px; }
    .yy-picker-select-all { height: 32px; padding: 0 12px; }
    .yy-modal-foot { padding: 10px 14px; }
}

/* ============ 会话右键菜单（置顶 / 备注 / 删除） ============ */
.yy-ctx-menu {
    position: fixed;
    z-index: 10000;
    min-width: 132px;
    background: #fff;
    border: 1px solid #ece5dc;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(93, 82, 73, .18);
    padding: 6px;
    font-size: 14px;
    color: #3d3530;
    user-select: none;
}
.yy-ctx-item {
    padding: 9px 14px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease;
}
.yy-ctx-item:hover { background: #f5f0ea; }
.yy-ctx-item.danger { color: #c0584f; }
.yy-ctx-item.danger:hover { background: #fbeae8; }

/* 会话列表中的置顶标记与备注 */
.yy-a-conv.pinned { background: #fbf6ee; }
.yy-a-pin {
    font-size: 12px;
    line-height: 1;
    margin-right: 2px;
}
.yy-a-remark {
    font-size: 12px;
    color: #a89486;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

/* 轻量提示 toast */
.yy-a-toast {
    position: fixed;
    left: 50%;
    bottom: 36px;
    transform: translateX(-50%) translateY(10px);
    background: rgba(61, 53, 48, .92);
    color: #fff;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    z-index: 10001;
    opacity: 0;
    transition: opacity .25s ease, transform .25s ease;
    pointer-events: none;
    max-width: 80vw;
}
.yy-a-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 控制台头部按钮（提示音 / 设置） ============ */
.yy-a-hbtn {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: #f1ece5;
    color: #6b5f56;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, transform .15s ease;
}
.yy-a-hbtn:hover { background: #e6ddd2; transform: translateY(-1px); }
.yy-a-hbtn.off { background: #efe7e7; color: #b08a8a; }

/* ============ 设置弹窗 ============ */
.yy-set-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.yy-set-row.col { flex-direction: column; align-items: stretch; gap: 6px; }
.yy-set-label { font-size: 14px; font-weight: 600; color: #3d3530; min-width: 96px; }
.yy-set-hint { font-size: 12px; color: #a89486; line-height: 1.5; }
.yy-set-divider { height: 1px; background: #efe7dd; margin: 6px 0 16px; }
.yy-set-subtitle { font-size: 13px; font-weight: 700; color: #7a9e7e; margin: 4px 0 12px; letter-spacing: .3px; }

/* 对话背景图管理 */
.yy-bg-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.yy-bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; margin-top: 4px; }
.yy-bg-empty { grid-column: 1 / -1; font-size: 12px; color: #a89486; padding: 8px 0; }
.yy-bg-item { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid #efe7dd; aspect-ratio: 16 / 10; background: #faf7f2; }
.yy-bg-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yy-bg-del { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; line-height: 18px; text-align: center; border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 14px; cursor: pointer; padding: 0; }
.yy-bg-del:hover { background: #d4895f; }

/* 会话背景（客服端 + 顾客端消息区；移动端自适应，cover 不变形） */
.yy-c-chat.yy-has-bg {
    background-color: transparent;
    -webkit-background-size: cover;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}
/* 移动端：消息气泡投影略强，保证照片背景上依然清晰 */
@media (max-width: 640px) {
    .yy-c-chat.yy-has-bg .yy-c-msg .body { box-shadow: 0 2px 10px rgba(0,0,0,.14); }
}


/* 开关 */
.yy-switch { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; flex: 0 0 auto; }
.yy-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.yy-switch-track {
    position: absolute; inset: 0; background: #d9cfc4; border-radius: 24px;
    transition: background .2s ease;
}
.yy-switch-track::before {
    content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px;
    background: #fff; border-radius: 50%; transition: transform .2s ease; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.yy-switch input:checked + .yy-switch-track { background: #7a9e7e; }
.yy-switch input:checked + .yy-switch-track::before { transform: translateX(20px); }

/* 请求包预览 */
.yy-webhook-preview {
    background: #2a2521;
    color: #e8e0d6;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.55;
    padding: 12px 14px;
    border-radius: 10px;
    margin: 0;
    max-height: 240px;
    overflow: auto;
    white-space: pre;
    word-break: break-all;
}

/* ---------- 相册：视频素材 ---------- */
.yy-album-cell video { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; background: #000; }
.yy-picker-cell video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.yy-album-cell .yy-album-play, .yy-picker-cell .yy-album-play {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(30, 26, 23, .55); color: #fff; font-size: 12px;
    line-height: 30px; text-align: center; pointer-events: none;
}

/* ---------- 上传进度浮层 ---------- */
.yy-upload { position: fixed; inset: 0; z-index: 100000; display: none; align-items: center; justify-content: center; }
.yy-upload.show { display: flex; }
.yy-upload-mask { position: absolute; inset: 0; background: rgba(30, 26, 23, .45); }
.yy-upload-box {
    position: relative; width: min(420px, 88vw); background: #fff; border-radius: 16px;
    padding: 20px 22px; box-shadow: 0 18px 60px rgba(0, 0, 0, .28);
}
.yy-upload-title { font-size: 15px; font-weight: 600; color: #3d3530; margin-bottom: 14px; }
.yy-upload-bar { height: 10px; border-radius: 999px; background: #f0ebe3; overflow: hidden; }
.yy-upload-bar > i { display: block; height: 100%; width: 0; background: #7a9e7e; border-radius: 999px; transition: width .18s ease; }
.yy-upload-meta { display: flex; align-items: center; margin-top: 8px; font-size: 12px; color: #7a6e64; }
.yy-upload-meta .spacer { flex: 1; }
.yy-upload-file { margin-top: 6px; font-size: 13px; color: #3d3530; word-break: break-all; }
.yy-upload-count { margin-top: 4px; font-size: 12px; color: #b4a99f; }
.yy-upload-foot { margin-top: 16px; display: flex; justify-content: flex-end; }
.yy-lb video { cursor: default; }
