/* ===== styles-layout.css@topbar / 4&- /   / 	 / I	
    styles.css6b	}z, 2 M ===== */

/* 外壳布局 */
.topbar { background: #fff; color: #1f2937; border-bottom: 1px solid #e5e7eb; padding: 0 24px; height: 52px; box-sizing: border-box; display: flex; align-items: center; position: relative; z-index: 80; }
.topbar .logo { font-weight: 700; font-size: 16px; color: #1e3a8a; }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #374151; margin-left: auto; }
.topbar .tag { background: #eef2ff; color: #3730a3; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.topbar .tag-uid { background: #1f2937; color: #f9fafb; font-family: ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .5px; font-weight: 600; }
.topbar .btn-ghost { background: transparent; border: 1px solid #cbd5e1; color: #374151; padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.topbar .btn-ghost:hover { background: #f3f4f6; }
/* 头像 + 个人账号中心下拉 */
.avatar-wrap { position: relative; margin-left: 4px; }
.avatar-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid #cbd5e1; background: #eef2ff; color: #3730a3; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; padding: 0; transition: background .15s, box-shadow .15s; }
.avatar-btn:hover { background: #e0e7ff; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.account-menu { position: absolute; top: calc(100% + 8px); right: 0; width: 240px; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; box-shadow: 0 10px 30px rgba(15,23,42,.18); padding: 8px; z-index: 200; text-align: left; }
.am-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; border-bottom: 1px solid #f1f5f9; }
.am-avatar { width: 40px; height: 40px; border-radius: 50%; background: #eef2ff; color: #3730a3; font-size: 18px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: 0 0 40px; }
.avatar-block { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; color: #fff; font-weight: 700; flex: 0 0 auto; vertical-align: middle; background: #cbd5e1; }
.avatar-block img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-avatar, .grp-mem-av { cursor: pointer; }
.chat-avatar:hover .avatar-block, .grp-mem-av:hover .avatar-block { opacity: .85; }
.profile-avatar { display: flex; justify-content: center; margin-bottom: 14px; }
.am-info { min-width: 0; }
.am-name { font-size: 14px; font-weight: 600; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-uid { font-size: 13px; font-weight: 600; color: #111827; font-family: ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .5px; margin-top: 2px; }
.am-role { font-size: 12px; }
.am-list { padding-top: 6px; }
.am-item { padding: 9px 10px; border-radius: 7px; font-size: 14px; color: #374151; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.am-item:hover { background: #f3f4f6; }
.am-sep { height: 1px; background: #f1f5f9; margin: 6px 4px; }
@media (max-width: 768px) {
  .topbar .who { gap: 6px; font-size: 12px; }
  .topbar .tag { display: none; }
  .account-menu { width: 200px; }
}

/* 左侧导航 sidebar */
.hamburger { display: none; background: transparent; border: none; font-size: 20px; line-height: 1; cursor: pointer; color: #374151; margin-right: 12px; padding: 5px 9px; border-radius: 6px; }
.hamburger:hover { background: #f3f4f6; }
.side { flex: 0 0 224px; width: 224px; background: #fff; border-right: 1px solid #e5e7eb; height: 100%; overflow-y: auto; scrollbar-width: none; padding: 10px; box-sizing: border-box; transition: margin-left .2s; }
.side::-webkit-scrollbar { display: none; }
.side::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: 11px; color: #9ca3af; letter-spacing: 1px; text-transform: uppercase; padding: 15px 12px 5px; font-weight: 600; white-space: nowrap; }
.nav { display: flex; align-items: center; padding: 9px 12px; border-radius: 8px; background: transparent; color: #374151; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.nav:hover { background: #f3f4f6; color: #1d4ed8; }
.nav.active { background: #eff6ff; color: #2563eb; font-weight: 600; }
.nav.disabled { color: #9ca3af; cursor: not-allowed; }
.nav.disabled:hover { background: transparent; color: #9ca3af; }

.layout { display: flex; height: calc(100vh - 52px); overflow: hidden; position: relative; }
.content { flex: 1; padding: 20px 24px; min-width: 0; height: 100%; overflow-y: auto; }
.soon { font-size: 10px; background: #fef3c7; color: #b45309; padding: 1px 6px; border-radius: 8px; margin-left: 4px; }

/* 二级侧边栏：通讯录 / 聊天 */
.sub-side { flex: 0 0 260px; width: 260px; background: #f9fafb; border-right: 1px solid #e5e7eb; height: 100%; display: flex; flex-direction: column; box-sizing: border-box; transition: flex-basis .2s, width .2s; overflow: hidden; }
.sub-side.collapsed { flex: 0 0 44px; width: 44px; }
.sub-side-inner { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; }
.sub-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px; background: #fff; border-bottom: 1px solid #e5e7eb; user-select: none; white-space: nowrap; }
.sub-title { font-size: 14px; font-weight: 600; color: #111827; }
.sub-head-action { cursor: pointer; }
.chat-tabs { display: flex; margin: 8px 10px; padding: 3px; background: #f3f4f6; border-radius: 8px; }
.chat-tab { flex: 1; padding: 6px 4px; font-size: 12px; border: none; background: transparent; color: #6b7280; border-radius: 6px; cursor: pointer; font-weight: 500; transition: all .15s; display: flex; align-items: center; justify-content: center; gap: 4px; }
.chat-tab.active { background: #fff; color: #2563eb; box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }
.chat-tab:hover:not(.active) { color: #374151; }
.chat-tab-unread { display: inline-flex; align-items: center; justify-content: center; min-width: 14px; padding: 0 4px; height: 14px; font-size: 10px; font-weight: 600; color: #fff; background: #ef4444; border-radius: 7px; }
.sub-side.collapsed .sub-title { display: none; }
.sub-side.collapsed .sub-search,
.sub-side.collapsed .sub-list { display: none; }
.sub-search { position: relative; padding: 8px; background: #fff; border-bottom: 1px solid #e5e7eb; }
.sub-search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 13px; color: #9ca3af; pointer-events: none; }
.sub-search .form-input { padding: 6px 10px 6px 30px; font-size: 12px; }
.contact-group { margin-bottom: 4px; }
.contact-group-head { display: flex; align-items: center; gap: 6px; padding: 8px 6px; cursor: pointer; user-select: none; border-radius: 6px; }
.contact-group-head:hover { background: #f3f4f6; }
.contact-group-arrow { font-size: 10px; color: #6b7280; width: 12px; text-align: center; }
.contact-group-name { flex: 1; font-size: 13px; font-weight: 600; color: #374151; }
.contact-group-count { font-size: 11px; color: #9ca3af; background: #f3f4f6; padding: 1px 5px; border-radius: 8px; }
.contact-group-body { padding-left: 4px; }
.sub-list { flex: 1 1 auto; overflow-y: auto; padding: 6px; }
.sub-foot { padding: 8px; background: #fff; border-top: 1px solid #e5e7eb; }
.sub-loading, .sub-empty { padding: 24px 8px; text-align: center; color: #9ca3af; font-size: 12px; }
.sub-contact { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 6px; cursor: pointer; transition: background .15s; }
.sub-contact:hover { background: #e5e7eb; }
.sub-av { flex: 0 0 32px; width: 32px; height: 32px; line-height: 32px; text-align: center; border-radius: 6px; background: #2563eb; color: #fff; font-size: 13px; font-weight: 600; overflow: hidden; }
.sub-contact-info { flex: 1 1 auto; min-width: 0; }
.sub-add-btn { flex: 0 0 auto; margin-left: 6px; padding: 3px 8px; font-size: 12px; line-height: 1.4; border: 1px solid #bfdbfe; background: #eff6ff; color: #2563eb; border-radius: 999px; cursor: pointer; }
.sub-add-btn:hover { background: #dbeafe; }
.sub-contact-name { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #111827; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-contact-dept { font-size: 11px; color: #6b7280; font-weight: 400; }
.sub-contact-meta { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: 11px; color: #6b7280; margin-top: 2px; }
.sub-time { margin-left: auto; font-size: 11px; color: #9ca3af; }
.sub-last { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-unread { flex: 0 0 auto; min-width: 15px; height: 15px; line-height: 15px; padding: 0 3px; background: #ef4444; color: #fff; border-radius: 999px; font-size: 10px; text-align: center; }
.sub-unread-badge { display: inline-block; min-width: 16px; height: 16px; line-height: 16px; padding: 0 4px; margin-left: 4px; background: #ef4444; color: #fff; border-radius: 999px; font-size: 11px; text-align: center; vertical-align: middle; }
.sub-tag-customer { color: #2563eb; }
.sub-tag-supplier { color: #16a34a; }
.sub-tag-partner { color: #9333ea; }
.sub-tag-cross_tenant { color: #d97706; }
.sub-tag-manual { color: #4b5563; }
/* 好友系统：搜索结果操作区 / 好友请求区 */
.sub-contact-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.sub-req-box { margin: 6px 8px; padding: 6px; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; }
.sub-req-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: #c2410c; margin-bottom: 4px; }
.sub-req-head .btn { padding: 2px 8px; font-size: 11px; }
.fr-list { max-height: 50vh; overflow: auto; }
.fr-req { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-bottom: 1px solid #f1f5f9; }
.fr-req:last-child { border-bottom: none; }
.fr-req-out { background: #f8fafc; }
.fr-req-info { flex: 1 1 auto; min-width: 0; }
.fr-req-name { font-size: 14px; font-weight: 600; color: #111827; }
.fr-req-name .muted { font-weight: 400; font-size: 12px; }
.fr-req-msg { font-size: 12px; color: #6b7280; margin: 4px 0; }
.fr-req-btns { display: flex; gap: 6px; margin-top: 6px; }
.fr-req-status { font-size: 12px; color: #f59e0b; margin-top: 4px; }
.fr-out-title { font-size: 12px; font-weight: 600; color: #6b7280; padding: 10px 10px 4px; }
/* 资料卡关系标签 */
.profile-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.profile-rel { display: inline-block; margin-top: 4px; padding: 2px 8px; font-size: 11px; border-radius: 999px; background: #f1f5f9; color: #475569; }
.profile-rel.friend { background: #ecfdf5; color: #059669; }
.profile-rel.colleague { background: #eff6ff; color: #2563eb; }
.profile-rel.pending_in, .profile-rel.pending_out { background: #fff7ed; color: #c2410c; }
.profile-rel.stranger { background: #fef2f2; color: #dc2626; }

/* 侧栏折叠按钮（阿里云控制台风格）：位于 sidebar 与 content 交界处 */
.sidebar-toggle {
  position: absolute; top: 50%; left: 224px; transform: translate(-50%, -50%);
  width: 22px; height: 48px; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 999px; cursor: pointer; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 6px rgba(0,0,0,.08); transition: left .2s, box-shadow .15s;
  padding: 0; color: #64748b; font-size: 12px; line-height: 1;
}
.sidebar-toggle:hover { box-shadow: 0 2px 10px rgba(0,0,0,.14); color: #2563eb; border-color: #bfdbfe; }
.sidebar-toggle::before { content: '‹'; }
#app.nav-collapsed .sidebar-toggle { left: 12px; }
#app.nav-collapsed .sidebar-toggle::before { content: '›'; }

/* 二级栏折叠按钮：位于 sub-side 与 content 交界处，风格与 sidebar-toggle 一致 */
.sub-toggle {
  position: absolute; top: 50%; left: calc(224px + 260px); transform: translate(-50%, -50%);
  width: 22px; height: 48px; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 999px; cursor: pointer; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 6px rgba(0,0,0,.08); transition: left .2s, box-shadow .15s;
  padding: 0; color: #64748b; font-size: 12px; line-height: 1;
}
.sub-toggle:hover { box-shadow: 0 2px 10px rgba(0,0,0,.14); color: #2563eb; border-color: #bfdbfe; }
.sub-toggle::before { content: '‹'; }
#app.sub-collapsed .sub-toggle { left: calc(224px + 44px); }
#app.sub-collapsed .sub-toggle::before { content: '›'; }
#app.nav-collapsed .sub-toggle { left: 260px; }
#app.nav-collapsed.sub-collapsed .sub-toggle { left: 44px; }

/* 桌面折叠侧栏 */
#app.nav-collapsed .side { margin-left: -224px; }

/* 手机端：侧栏改为抽屉 */
.nav-overlay { display: none; }
@media (max-width: 768px) {
  .hamburger { display: inline-block; }
  .sidebar-toggle { display: none; }
  .side { position: fixed; top: 52px; left: 0; bottom: 0; z-index: 90; transform: translateX(-100%); box-shadow: 2px 0 12px rgba(0,0,0,.12); }
  #app.nav-open .side { transform: translateX(0); }
  #app.nav-open .nav-overlay { display: block; position: fixed; inset: 52px 0 0 0; background: rgba(15,23,42,.35); z-index: 85; }
  .content { padding: 14px 12px; }
}
