/* ext-sidebar.css — 自绘下拉、列表 Tab / 归档 / 滑动、搜索结果、新建按钮、左栏覆盖面板（由 features.css 按顺序拆出，层叠顺序不变） */
/* ==========================================================
   features.css — batch3：自绘下拉、列表 Tab / 归档 / 滑动、全局与会话内搜索、
   联系人 / 资料卡 / 添加好友、新建流程、输入区（录音 / 附件 / 格式 / @ / 发送菜单）、
   新消息类型（位置 / 名片 / 投票 / 视频 / 贴纸图片）、动图与贴纸面板
   ========================================================== */

/* ---------- 通用 ---------- */
.scroll-x { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.scroll-x::-webkit-scrollbar { display: none; }
.btn.sm { min-height: 30px; height: 30px; padding: 0 10px; font-size: 13px; }
.btn-link { color: var(--accent); font-size: 13px; padding: 4px 6px; border-radius: 6px; }
.btn-link:hover { background: var(--accent-soft); }
.c-blue { color: #3390ec; } .c-teal { color: #1f9bb0; } .c-green { color: #2fa36b; } .c-orange { color: #e0752d; } .c-red { color: #d9465f; }

/* 通用浮动菜单 */
.ctx-menu {
  position: fixed; z-index: 85;
  min-width: 200px; padding: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.ctx-menu button {
  width: 100%; min-height: 40px; padding: 6px 12px;
  display: flex; align-items: center; gap: 12px;
  border-radius: var(--radius-sm); font-size: 14px; text-align: left;
}
.ctx-menu button .ti { font-size: 20px; color: var(--text-2); }
.ctx-menu button:hover, .ctx-menu button:focus-visible { background: var(--bg-hover); }
.ctx-menu .ti.c-blue, .ctx-menu .ti.c-teal, .ctx-menu .ti.c-green, .ctx-menu .ti.c-orange, .ctx-menu .ti.c-red { color: inherit; }
.attach-menu .ti { font-size: 22px; }
.attach-menu button i.c-blue { color: #3390ec; } .attach-menu button i.c-teal { color: #1f9bb0; }
.attach-menu button i.c-green { color: #2fa36b; } .attach-menu button i.c-orange { color: #e0752d; } .attach-menu button i.c-red { color: #d9465f; }

/* ==========================================================
   自绘下拉
   ========================================================== */
.dd { position: relative; display: inline-block; min-width: 0; }
.dd > .dd-list { display: none; }
.dd-trigger {
  width: 100%; min-height: 36px; padding: 4px 8px 4px 12px;
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text);
  font-size: 14px; text-align: left;
  line-height: 1.4;
}
.dd-trigger:hover { border-color: var(--border-strong); }
.dd.open .dd-trigger, .dd-trigger:focus-visible { border-color: var(--accent); outline: none; }
.dd-trigger .ti { font-size: 16px; color: var(--text-2); transition: transform .15s; flex-shrink: 0; }
.dd.open .dd-trigger .ti { transform: rotate(180deg); }
.dd-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd.is-disabled .dd-trigger { opacity: .5; pointer-events: none; }
.dd-field { display: block; }
.dd-field .dd-trigger { height: 52px; border-radius: var(--radius); padding: 0 12px 0 14px; font-size: inherit; }
.dd-plain .dd-trigger { border-color: transparent; background: none; color: var(--text-2); }
.dd-chip .dd-trigger { min-height: 30px; height: 30px; border-radius: 15px; padding: 0 8px 0 12px; font-size: 13px; background: var(--bg-soft); border-color: transparent; }
.dd-chip.open .dd-trigger { border-color: var(--accent); }

.dd-layer {
  position: fixed; z-index: 140;
  display: none; flex-direction: column;
  max-width: min(340px, calc(100vw - 16px));
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dd-layer.open { display: flex; }
.dd-layer .dd-list { display: block; overflow-y: auto; max-height: inherit; outline: none; }
.dd-opt {
  width: 100%; min-height: 40px; padding: 8px 36px 8px 12px;
  display: flex; align-items: center;
  position: relative;
  border-radius: var(--radius-sm);
  font-size: 14px; text-align: left; line-height: 1.4;
  font-family: var(--font-lang), var(--font), "IM Noto Sans Khmer", "IM Noto Sans Thai", "IM Noto Sans Myanmar", "IM Noto Sans Lao", sans-serif;
}
/* 缅 / 高棉 / 泰 / 老挝：行高 ×1.15 */
.dd-opt:is(:lang(my), :lang(km), :lang(th), :lang(lo)),
.dd-trigger:is(:lang(my), :lang(km), :lang(th), :lang(lo)) { line-height: 1.61; }
.dd-opt:lang(km) { font-family: "IM Noto Sans Khmer", var(--font); }
.dd-opt:lang(th) { font-family: "IM Noto Sans Thai", var(--font); }
.dd-opt:lang(my) { font-family: "IM Noto Sans Myanmar", var(--font); }
.dd-opt:lang(lo) { font-family: "IM Noto Sans Lao", var(--font); }
.dd-opt:hover, .dd-opt:focus { background: var(--bg-hover); outline: none; }
.dd-opt:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.dd-opt.active { color: var(--accent); font-weight: 600; }
.dd-opt.active::after {
  content: ""; position: absolute; right: 14px; top: 50%;
  width: 10px; height: 5px; margin-top: -4px;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}
.dd-backdrop { display: none; }
.dd-sheet-title { padding: 10px 12px 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }

/* ==========================================================
   左栏：Tab / 列表 / 归档 / 滑动 / 搜索结果 / 新建按钮
   ========================================================== */
.sidebar { position: relative; }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.side-scroll .chat-list { flex: none; overflow: visible; padding-bottom: 0; }

.list-tabs { flex-shrink: 0; display: flex; gap: 4px; padding: 0 8px 6px; border-bottom: 1px solid var(--border); }
.lt {
  flex-shrink: 0; height: 34px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 17px;
  font-size: 14px; font-weight: 500; color: var(--text-2);
  white-space: nowrap;
}
.lt:hover { background: var(--bg-hover); }
.lt.active { background: var(--accent-soft); color: var(--accent); }
.lt-count:empty { display: none; }
.lt-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--badge-muted); color: #fff; font-size: 11px; font-weight: 600;
}
.lt.active .lt-count { background: var(--accent); }

.ci-wrap { position: relative; overflow: hidden; list-style: none; }
.ci-wrap .chat-item { position: relative; z-index: 1; background: var(--bg); }
.ci-wrap .chat-item:hover { background: var(--bg-hover); }
.ci-wrap .chat-item.active { background: var(--item-active-bg); }
.chat-item.archived .avatar { opacity: .75; }
.swipe-l, .swipe-r { position: absolute; top: 0; bottom: 0; display: flex; z-index: 0; visibility: hidden; }
.ci-wrap.swiping-l .swipe-l, .ci-wrap.swiping-r .swipe-r { visibility: visible; }
.swipe-l { left: 0; }
.swipe-r { right: 0; }
.sw {
  width: 76px; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: #fff; font-size: 12px; text-align: center; line-height: 1.2; padding: 0 4px;
}
.sw .ti { font-size: 22px; }
.sw-pin { width: 84px; background: #2fa36b; }
.sw-arch { background: #7d8d9c; }
.sw-mute { background: #e0752d; }
.sw-unread { background: #3390ec; }

.archive-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 6px 12px 6px 8px;
  cursor: pointer; color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
.archive-row:hover { background: var(--bg-hover); }
.arch-av { width: 42px !important; height: 42px !important; background: var(--bg-soft) !important; color: var(--text-2) !important; }
.arch-av .ti { font-size: 20px !important; }
.ar-text { flex: 1; font-weight: 600; color: var(--text); }
.ar-chev { font-size: 18px; transition: transform .15s; }
.archive-row.open .ar-chev { transform: rotate(180deg); }
.badge.muted-b { background: var(--badge-muted); }
.badge.dot { min-width: 12px; width: 12px; height: 12px; padding: 0; border-radius: 50%; }
.ci-draft { color: var(--danger); font-weight: 500; }
.ci-time .ti-clock { color: var(--text-3); }

.search-results { padding: 4px 0 12px; }
.sr-title { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 12px 16px 4px; background: var(--bg-soft); margin: 0; }
.sr-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; cursor: pointer; }
.sr-item:hover { background: var(--bg-hover); }
.sr-item .m-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sr-row { display: flex; gap: 8px; align-items: baseline; }
.sr-row .m-name { flex: 1; }
.sr-time { font-size: 12px; color: var(--text-3); flex-shrink: 0; }
.search-results mark, mark.hit { background: color-mix(in srgb, #f0b429 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.msg-hit .m-sub b { font-weight: 500; color: var(--text); }

.fab {
  position: absolute; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 6;
  width: 54px; height: 54px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-accent);
  box-shadow: var(--shadow);
  transition: background .15s, transform .15s;
}
.fab:hover { background: var(--accent-hover); }
.fab:disabled { opacity: .5; }
.fab .ti { font-size: 24px; }
.new-menu { min-width: 180px; }

/* ---------- 左栏覆盖面板：联系人 / 新建 ---------- */
.side-panel {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column;
  background: var(--bg);
}
.side-panel[hidden] { display: none; }
.panel-title { flex: 1; min-width: 0; font-size: 17px; font-weight: 600; display: flex; flex-direction: column; line-height: 1.25; }
.panel-title small { font-size: 12px; font-weight: 400; color: var(--text-2); }
.panel-title small:empty { display: none; }
.cp-tools { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; padding: 0 12px 8px; border-bottom: 1px solid var(--border); }
.cp-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--text-2); min-height: 32px; cursor: pointer; }
.cp-wrap { flex: 1; min-height: 0; display: flex; position: relative; }
.cp-body { flex: 1; overflow-y: auto; padding-bottom: 24px; }
.cp-letter { font-size: 13px; font-weight: 600; color: var(--accent); padding: 10px 16px 2px; margin: 0; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.cp-item { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 28px 6px 12px; cursor: pointer; }
.cp-item:hover { background: var(--bg-hover); }
.cp-item .m-body { display: flex; flex-direction: column; min-width: 0; }
.az-index { position: absolute; right: 2px; top: 8px; bottom: 8px; display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.az-index button { width: 22px; height: 20px; font-size: 11px; font-weight: 600; color: var(--accent); border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; }
.az-index button:hover { background: var(--accent-soft); }
.az-index .ti { font-size: 12px; color: var(--online); }

.np-step { display: none; flex: 1; min-height: 0; flex-direction: column; position: relative; }
.np-step.active { display: flex; }
.np-pad { padding: 0 12px 8px; }
.pick-chips { flex-shrink: 0; display: flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 12px 8px; }   /* 多选时一直占位：选第一个人时列表不往下跳 */
.pick-none { font-size: 13px; color: var(--text-3); padding-left: 4px; }
.pick-chips[hidden] { display: none; }
.pick-chip {
  flex-shrink: 0; height: 34px; padding: 0 8px 0 2px;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 17px; background: var(--accent-soft); color: var(--text); font-size: 13px;
}
.pick-chip .avatar.xs { width: 30px; height: 30px; font-size: 12px; }
.pick-chip .ti { font-size: 14px; color: var(--text-2); }
.pick-list { flex: 1; overflow-y: auto; padding-bottom: 90px; border-top: 1px solid var(--border); }
.pick-item { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 16px 6px 12px; cursor: pointer; }
.pick-item:hover { background: var(--bg-hover); }
.pick-item .m-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pick-box { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; color: transparent; }
.pick-box .ti { font-size: 14px; }
.pick-item.on .pick-box { background: var(--accent); border-color: var(--accent); color: #fff; }
.np-next[hidden] { display: none; }
.np-form { padding: 20px 16px 32px; overflow-y: auto; gap: 4px; }
.np-avatar {
  width: 96px; height: 96px; margin: 0 auto 16px; border-radius: 50%;
  display: flex; cursor: pointer; flex-shrink: 0;
}
.np-av-inner {
  width: 100%; height: 100%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent) center / cover no-repeat; color: #fff;
}
.np-av-inner .ti { font-size: 34px; }
.field-input.area { height: auto; padding: 12px 14px; resize: vertical; min-height: 84px; line-height: 1.5; }
.np-note { font-size: 13px; color: var(--text-2); margin: 4px 2px 12px; }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; }
.prefix-input { display: flex; align-items: center; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); padding-left: 12px; background: var(--bg); }
.prefix-input b { color: var(--text-2); font-weight: 500; }
.prefix-input .field-input { border: 0; padding-left: 4px; }
.prefix-input:focus-within { border-color: var(--accent); }

/* ---------- 跨公司（轻聊网络） ---------- */
.org-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; margin-left: 6px; border-radius: 4px; font-size: 11px; font-weight: 500;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); white-space: nowrap; flex-shrink: 0; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.net-av { display: inline-flex; align-items: center; justify-content: center; background: var(--bg-hover); color: var(--text-2); font-weight: 600; flex-shrink: 0; }
.new-friends ul { list-style: none; margin: 0; padding: 0; }
.nf-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.nf-item .m-body { flex: 1; min-width: 0; }
.nf-acts { display: flex; gap: 6px; flex-shrink: 0; }
.pick-item.is-off { opacity: .5; cursor: not-allowed; }
#addFriendBtn { position: relative; }
#addFriendBtn .badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; font-size: 10px; }
.my-net { display: flex; flex-direction: column; gap: 8px; }
.my-net .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-item.active .org-tag { color: #fff; background: rgba(255, 255, 255, .22); }
.nf-item .m-name { display: flex; align-items: center; min-width: 0; overflow: hidden; white-space: nowrap; }
.nf-item .m-name .org-tag { max-width: 96px; overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: 18px; }
.nf-item .m-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-av { overflow: hidden; }
.net-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 我的收藏（sidebar/favorites.js） */
#favPanel { display: flex; flex-direction: column; }
#favPanel[hidden] { display: none; }
.fav-count { margin-left: auto; font-size: 12.5px; color: var(--text-2, #707579); }
.fav-tools { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 16px 10px; border-bottom: 1px solid var(--divider, rgba(0,0,0,.06)); }
.fav-tools .search { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 36px; border-radius: 18px; background: var(--hover, rgba(0,0,0,.05)); }
.fav-tools .search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font: inherit; color: inherit; }
.fav-types { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { padding: 4px 10px; border-radius: 14px; font-size: 13px; background: var(--hover, rgba(0,0,0,.05)); color: var(--text, inherit); }
.chip-btn.active { background: var(--accent); color: #fff; }
.fav-list { list-style: none; margin: 0; padding: 0 8px; flex: 1; min-height: 0; overflow-y: auto; }
.fav-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px; border-radius: 10px; cursor: pointer; }
.fav-item:hover { background: var(--hover, rgba(0,0,0,.04)); }
.fav-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); flex-shrink: 0; }
.fav-icon .ti { font-size: 19px; }
.fav-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.fav-meta { font-size: 12.5px; color: var(--text-2, #707579); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-meta b { color: var(--text, inherit); font-weight: 600; }
.fav-prev { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fav-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; font-size: 14px; }
.fav-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.fav-item .icon-btn { opacity: 0; }
.fav-item:hover .icon-btn, .fav-item:focus-within .icon-btn { opacity: 1; }
@media (hover: none) { .fav-item .icon-btn { opacity: .7; } }
.fav-empty { text-align: center; padding: 48px 16px; color: var(--text-2, #707579); }
.fav-empty .ti { font-size: 40px; opacity: .5; }
.fav-more { margin: 8px auto 12px; }
