/* ================= Zaka 侧边栏导航 =================
   把「管理中心」的功能卡片 / 底部导航 / 顶部导航 / 账户信息统一收进左侧侧边栏
   桌面端:常驻左侧栏,主内容区右移
   移动端:汉堡按钮 + 抽屉式侧边栏
   v3 · 2026-09-30 新增:首页「账户信息卡 + 客服卡片」收进侧边栏「账户」组
   v4 · 2026-09-30 新增:管理中心主界面「站点信息页」样式(#zsb-home-info)
   ================================================== */
:root {
  --zsb-w: 244px;
  --zsb-accent: #1677ff;
  --zsb-text: #1f1f1f;
  --zsb-muted: #8a8a8e;
  --zsb-line: rgba(0, 0, 0, .06);
  --zsb-bg: #ffffff;
  --zsb-hover: #f5f5f7;
  --zsb-z: 900;
}

/* ---------- 已被收编的原始导航:硬隐藏(不依赖 JS,避免闪回) ---------- */
html.zsb-on .feature-grid,
html.zsb-on .custom-tabbar,
html.zsb-on .tabbar,
html.zsb-on .bottom-tabbar,
html.zsb-on .bottom-nav,
html.zsb-on .desktop-sidebar-nav,
html.zsb-on .topbar-nav,
html.zsb-on .content > .info-card,
html.zsb-on .content > .tg-notice,
html.zsb-on .zsb-taken { display: none !important; }
.zsb-hidden { display: none !important; }

/* ---------- 侧边栏主体 ---------- */
#zsb-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--zsb-w);
  background: var(--zsb-bg);
  border-right: 1px solid var(--zsb-line);
  display: flex;
  flex-direction: column;
  z-index: var(--zsb-z);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
  transition: transform .26s cubic-bezier(.32, .72, 0, 1);
}

html.zsb-mobile #zsb-panel {
  transform: translateX(-102%);
  box-shadow: 0 0 40px rgba(0, 0, 0, .18);
  z-index: calc(var(--zsb-z) + 10);
}
html.zsb-mobile.zsb-open #zsb-panel { transform: translateX(0); }

/* 品牌头:站名居中大字(参考图样式) */
#zsb-panel .zsb-brand {
  padding: calc(18px + env(safe-area-inset-top, 0px)) 16px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 0 0 auto;
  position: relative;
  border-bottom: 1px solid #f0f0f2;
}
#zsb-panel .zsb-logo {
  width: 30px; height: 30px; border-radius: 50%;
  background: #eef1f5;
  color: #fff; font-size: 16px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
}
#zsb-panel .zsb-logo img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 20%;
  display: block; border: 0;
}
#zsb-panel .zsb-brand-txt { min-width: 0; flex: 0 1 auto; display: flex; align-items: center; justify-content: center; gap: 7px; }
#zsb-panel .zsb-brand-name { font-size: 17px; letter-spacing: .02em; }
#zsb-panel .zsb-brand .zsb-close { margin-left: auto; }
#zsb-panel .zsb-brand-name {
  font-size: 19px; font-weight: 700; color: var(--zsb-text); letter-spacing: .04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#zsb-panel .zsb-brand-sub { font-size: 12.5px; color: var(--zsb-muted); margin: 0; text-decoration: none; white-space: nowrap; font-weight: 500; transform: translateY(1px); }
#zsb-panel .zsb-close {
  border: 0; background: transparent; color: var(--zsb-muted);
  font-size: 22px; line-height: 1; padding: 0 2px; cursor: pointer; display: none;
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
}
html.zsb-mobile #zsb-panel .zsb-close { display: block; }

/* 滚动区 */
#zsb-panel .zsb-scroll {
  flex: 1 1 auto; overflow-y: auto; overflow-x: hidden;
  padding: 4px 0 18px;
  -webkit-overflow-scrolling: touch;
}
#zsb-panel .zsb-scroll::-webkit-scrollbar { width: 4px; }
#zsb-panel .zsb-scroll::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .14); border-radius: 4px; }

#zsb-panel .zsb-group {
  font-size: 11px; color: #a6abb3; font-weight: 600;
  letter-spacing: .1em; padding: 18px 18px 6px;
}
#zsb-panel .zsb-group:first-child { padding-top: 6px; }

/* 菜单项 */
#zsb-panel .zsb-item {
  display: flex; align-items: center; gap: 12px;
  height: 46px; padding: 0 18px; border-radius: 0;
  color: #16181c; font-size: 15px; font-weight: 600; cursor: pointer;
  position: relative; box-sizing: border-box;
  transition: background-color .16s ease, color .16s ease;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
#zsb-panel .zsb-item:hover { background: #f7f8fa; }
#zsb-panel .zsb-item:active { background: #f1f2f5; }
#zsb-panel .zsb-item.active {
  background: rgba(22, 119, 255, .07);
  color: var(--zsb-accent);
  font-weight: 600;
}
#zsb-panel .zsb-item.active::before { display: none; }
#zsb-panel .zsb-item.active::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 3px; height: 18px; margin-top: -9px;
  border-radius: 0 3px 3px 0; background: var(--zsb-accent);
}
#zsb-panel .zsb-ico {
  width: 20px; height: 20px; flex: 0 0 20px;
  display: flex; align-items: center; justify-content: center;
  opacity: .95;
}
#zsb-panel .zsb-ico svg,
#zsb-panel .zsb-ico img {
  width: 20px !important; height: 20px !important; display: block;
}
#zsb-panel .zsb-txt {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto;
}
#zsb-panel .zsb-item.zsb-danger { color: #f53f3f; }
#zsb-panel .zsb-item.zsb-danger:hover { background: rgba(245, 63, 63, .08); }
#zsb-panel .zsb-item.zsb-danger.active { background: rgba(245, 63, 63, .1); }
#zsb-panel .zsb-item.zsb-danger.active::before { background: #f53f3f; }

/* ---------- 账户信息组(账号 / 到期 / 余额 / 客服) ---------- */
#zsb-panel .zsb-item.zsb-acct { height: 46px; }
#zsb-panel .zsb-item.zsb-acct .zsb-txt { flex: 0 0 auto; }
#zsb-panel .zsb-val {
  margin-left: auto;
  font-size: 13px;
  font-weight: 400;
  color: #7f858e;
  max-width: 118px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: right;
  flex: 0 1 auto;
}
#zsb-panel .zsb-badge {
  flex: 0 0 auto;
  font-size: 10px; line-height: 1;
  padding: 3px 5px; border-radius: 5px;
  background: rgba(22, 119, 255, .1);
  color: var(--zsb-accent);
  font-weight: 600;
  white-space: nowrap;
}
#zsb-panel .zsb-badge.zsb-warn { background: rgba(255, 125, 0, .12); color: #d25f00; }
#zsb-panel .zsb-badge.zsb-ok { background: rgba(0, 180, 42, .12); color: #009a29; }
#zsb-panel .zsb-item.zsb-refresh .zsb-val { color: var(--zsb-accent); }
#zsb-panel .zsb-item.zsb-refreshing .zsb-ico { animation: zsb-spin .8s linear infinite; }
@keyframes zsb-spin { to { transform: rotate(360deg); } }
#zsb-panel .zsb-flash { animation: zsb-flash .7s ease; }
@keyframes zsb-flash {
  0% { background: rgba(22, 119, 255, .18); }
  100% { background: transparent; }
}
#zsb-panel .zsb-item.zsb-acctrow { background: rgba(22, 119, 255, .04); }
#zsb-panel .zsb-item.zsb-acctrow:hover { background: rgba(22, 119, 255, .09); }

/* ---------- 手机端首页轻提示:已按需求移除 ---------- */

/* ---------- 移动端汉堡按钮 ---------- */
#zsb-toggle {
  position: fixed;
  transition: top .22s ease;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 12px;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .14);
  border: 0; align-items: center; justify-content: center;
  z-index: calc(var(--zsb-z) + 5); cursor: pointer; padding: 0;
  display: none;
  -webkit-tap-highlight-color: transparent;
}
html.zsb-mobile #zsb-toggle { display: flex; }
html.zsb-empty #zsb-toggle { display: none !important; }
#zsb-toggle i {
  display: block; width: 17px; height: 2px; border-radius: 2px;
  background: #1f1f1f; position: relative;
}
#zsb-toggle i::before,
#zsb-toggle i::after {
  content: ""; position: absolute; left: 0; width: 17px; height: 2px;
  border-radius: 2px; background: #1f1f1f;
}
#zsb-toggle i::before { top: -5.5px; }
#zsb-toggle i::after { top: 5.5px; }

/* ---------- 移动端遮罩 ---------- */
#zsb-mask {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0, 0, 0, .38);
  opacity: 0; pointer-events: none; transition: opacity .24s ease;
  z-index: calc(var(--zsb-z) + 2); display: none;
}
html.zsb-mobile #zsb-mask { display: block; }
html.zsb-mobile.zsb-open #zsb-mask { opacity: 1; pointer-events: auto; }
html.zsb-open body { overflow: hidden; }

/* ---------- 全屏浮层(分享页等)打开时:侧边栏整体让位,保持原站观感 ---------- */
html.zsb-overlay #zsb-panel,
html.zsb-overlay #zsb-toggle,
html.zsb-overlay #zsb-mask { display: none !important; }
html.zsb-overlay.zsb-ondesk #app-wrapper { padding-left: 0 !important; }

/* ---------- 桌面端布局让位 ---------- */
@media (min-width: 1024px) {
  html.zsb-ondesk #app-wrapper { padding-left: var(--zsb-w); box-sizing: border-box; }
  html.zsb-ondesk #zsb-mask { display: none !important; }
}

/* ---------- 聊天页里按钮保留(聊天里也要能打开菜单),位置让开原站控件 ----------
   会话列表:按钮留在左上角原位,原站标题右移让位;
   会话详情:左上角是返回箭头、右上角是客户头像,按钮下移到顶栏下方,
            具体位置由 JS 写进 --zsb-toggle-top(顶栏底边 + 8px)。 */
html.zsb-mobile.zsb-inchat #zsb-toggle {
  top: var(--zsb-toggle-top, calc(12px + env(safe-area-inset-top, 0px))) !important;
}

/* ---------- 移动端:给汉堡按钮让出标题位置 ---------- */
html.zsb-mobile.zsb-on .page-title { padding-left: 66px !important; }
html.zsb-mobile.zsb-on .chat-header { padding-left: 62px !important; }
html.zsb-mobile.zsb-on .topbar { padding-left: 62px !important; }

/* ---------- 管理后台头像:桌面端顶栏那颗「A」换成头像图 ---------- */
.topbar .topbar-right > .avatar {
  background-image: url("/assets/zaka-avatar.jpg") !important;
  background-size: cover !important;
  background-position: center 20% !important;
  background-repeat: no-repeat !important;
  color: transparent !important;
  font-size: 0 !important;
  text-indent: -9999px;
  overflow: hidden;
}

/* ---------- 玻璃拟态(跟随站点开关) ---------- */
html.zsb-glass #zsb-panel {
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: saturate(180%) blur(40px);
  backdrop-filter: saturate(180%) blur(40px);
}

/* ================= 管理中心首页:站点信息页 =================
   把管理中心主界面做成「资源网信息 / Telegram 频道 / 我的联系方式 / 通知」
   四块,数据取自本页已有元素与当前域名,站名或客服号改了这里自动跟着变。 */
#zsb-home-info { display: none; }

/* 顶部右侧:头像 + 站名 + 客服号(点一下开抽屉) */
#zsb-home-info .zsb-hi-top {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 1px 0 20px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
#zsb-home-info .zsb-hi-av {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: 0 0 32px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .16);
}
#zsb-home-info .zsb-hi-name {
  font-size: 16px; font-weight: 600; color: #16181c; letter-spacing: .01em;
}
#zsb-home-info .zsb-hi-handle { font-size: 14px; color: #9aa0a6; }
#zsb-home-info .zsb-hi-caret { width: 15px; height: 15px; color: #bcc2ca; flex: 0 0 15px; }

/* 三行信息卡 */
#zsb-home-info .zsb-hi-list { display: flex; flex-direction: column; gap: 10px; }
#zsb-home-info .zsb-hi-row {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border: 1px solid rgba(0, 0, 0, .05); border-radius: 16px;
  padding: 12px 14px; box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
  cursor: pointer; transition: transform .14s ease, box-shadow .14s ease;
  -webkit-tap-highlight-color: transparent;
}
#zsb-home-info .zsb-hi-row:active { transform: scale(.985); box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
#zsb-home-info .zsb-hi-ico {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .12); overflow: hidden;
}
#zsb-home-info .zsb-hi-ico img { width: 100%; height: 100%; object-fit: cover; display: block; }
#zsb-home-info .zsb-hi-ico.zsb-tg {
  background: #229ED9; box-shadow: 0 2px 9px rgba(34, 158, 217, .34); border-radius: 50%;
}
#zsb-home-info .zsb-hi-ico.zsb-tg svg { width: 23px; height: 23px; fill: #fff; }
#zsb-home-info .zsb-hi-txt {
  min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 3px;
}
#zsb-home-info .zsb-hi-t { font-size: 16px; font-weight: 600; color: #16181c; }
#zsb-home-info .zsb-hi-s {
  font-size: 13px; color: #8d939c;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#zsb-home-info .zsb-hi-go { width: 17px; height: 17px; flex: 0 0 17px; color: #c8cdd4; }

/* 通知 */
#zsb-home-info .zsb-hi-notice { margin-top: 26px; padding: 0 2px 6px; }
#zsb-home-info .zsb-hi-nt {
  font-size: 17px; font-weight: 700; color: #16181c;
  letter-spacing: .01em; margin-bottom: 12px;
}
#zsb-home-info .zsb-hi-np {
  font-size: 14.5px; line-height: 1.85; color: #5b6169; word-break: break-word;
}
#zsb-home-info .zsb-hi-np em { font-style: normal; font-weight: 600; color: #ff5a2c; }

html.zsb-mobile.zsb-on #zsb-home-info { display: block; }

/* 手机端首页:去掉多余留白,让信息页贴合屏幕 */
html.zsb-mobile.zsb-on .content { padding-top: 8px !important; }

/* ---------- 聊天页顶栏:一键删除所有聊天 ---------- */
html.zsb-on #zsb-chatclear {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(245, 63, 63, .1);
  color: #f53f3f;
  cursor: pointer;
  z-index: 11;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .18s, transform .12s;
}
html.zsb-on #zsb-chatclear svg { width: 19px; height: 19px; display: block; }
html.zsb-on #zsb-chatclear:hover { background: rgba(245, 63, 63, .16); }
html.zsb-on #zsb-chatclear:active { background: rgba(245, 63, 63, .22); transform: translateY(-50%) scale(.92); }
html.zsb-on #zsb-chatclear.zsb-busy { opacity: .55; }
/* 分享页等全屏浮层打开时让位,跟侧边栏一致 */
html.zsb-overlay #zsb-chatclear { display: none !important; }

/* ---------- 聊天页顶栏:选择模式(勾选删除 / 清空所有) ----------
   点顶栏那个删除图标进入;条目左侧出现圆形勾选框,顶栏换成操作条。 */
html.zsb-on .chat-page.zsb-sel-mode .chat-header { position: relative; }
html.zsb-on .chat-page.zsb-sel-mode .chat-header h2,
html.zsb-on .chat-page.zsb-sel-mode .chat-header .filter-tabs,
html.zsb-on .chat-page.zsb-sel-mode .chat-header .chat-header-add { display: none !important; }
html.zsb-on .chat-page.zsb-sel-mode #zsb-chatclear { display: none !important; }

#zsb-selbar {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 6px; z-index: 40;
}
#zsb-selbar button {
  border: 0; font: inherit; font-size: 12.5px; line-height: 1;
  padding: 7px 11px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; transition: transform .12s, background .15s;
}
#zsb-selbar button:active { transform: scale(.94); }
#zsb-selbar .zsb-sel-all { background: rgba(22, 119, 255, .1); color: #1677ff; }
#zsb-selbar .zsb-sel-del { background: #f53f3f; color: #fff; box-shadow: 0 2px 8px rgba(245, 63, 63, .3); }
#zsb-selbar .zsb-sel-del[disabled] { background: rgba(245, 63, 63, .3); box-shadow: none; cursor: default; }
#zsb-selbar .zsb-sel-clear { background: rgba(245, 63, 63, .1); color: #f53f3f; }
#zsb-selbar .zsb-sel-cancel {
  width: 30px; height: 30px; padding: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .06); color: #4b5563;
  display: flex; align-items: center; justify-content: center;
}
#zsb-selbar .zsb-sel-cancel svg { width: 15px; height: 15px; display: block; }
#zsb-selbar.zsb-busy { opacity: .5; pointer-events: none; }

/* 会话条目:圆形勾选框 */
html.zsb-on .chat-page.zsb-sel-mode .session-item { position: relative; cursor: pointer; }
html.zsb-on .chat-page.zsb-sel-mode .session-item .zsb-check {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 21px; height: 21px; border-radius: 50%;
  border: 1.8px solid #cfd6de; background: #fff;
  display: flex; align-items: center; justify-content: center; z-index: 6;
  transition: background .15s, border-color .15s;
}
html.zsb-on .chat-page.zsb-sel-mode .session-item .zsb-check svg {
  width: 12px; height: 12px; color: #fff; opacity: 0; transition: opacity .12s;
}
html.zsb-on .chat-page.zsb-sel-mode .session-item.zsb-checked .zsb-check {
  background: #f53f3f; border-color: #f53f3f;
}
html.zsb-on .chat-page.zsb-sel-mode .session-item.zsb-checked .zsb-check svg { opacity: 1; }
html.zsb-on .chat-page.zsb-sel-mode .session-item.zsb-checked { background: rgba(245, 63, 63, .055); }

/* ---------- v5 · 2026-09-30:按参考图改版(扁平菜单 + 右侧箭头 + 底部版本栏) ---------- */
/* 可跳转的行:右侧细箭头 */
#zsb-panel .zsb-arrow {
  flex: 0 0 16px; width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #c8ccd2; margin-left: 6px;
  transition: color .16s ease;
}
#zsb-panel .zsb-arrow svg { width: 16px !important; height: 16px !important; display: block; }
#zsb-panel .zsb-item:hover .zsb-arrow { color: #9aa0a6; }
#zsb-panel .zsb-item.active .zsb-arrow { color: var(--zsb-accent); }
#zsb-panel .zsb-item.zsb-danger .zsb-arrow { color: #f0a8a8; }
/* 底部版本栏 */
#zsb-panel .zsb-foot {
  flex: 0 0 auto;
  border-top: 1px solid #f0f0f2;
  padding: 13px 20px calc(15px + env(safe-area-inset-bottom, 0px));
  font-size: 12px; color: #b3b8bf; letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
