/* ============ 医疗客服流量号转化系统 · 样式 ============ */
:root {
  /* 品牌主色：蓝色系 */
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --primary-light: #e0f2fe;
  --accent2: #38bdf8;
  /* 深藏青文字体系 */
  --navy: #1a2a4a;
  --navy2: #1e3260;
  /* 中性色 */
  --bg: #f0f2f7;
  --card: #ffffff;
  --border: #e5e9f0;
  --text: #1a2a4a;
  --text-2: #4a5568;
  --text-3: #9aa5b4;
  /* 语义色 */
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --blue: #1d6bd8;
  /* 圆角/阴影 */
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 4px rgba(26, 42, 74, .08);
  --shadow-md: 0 4px 14px rgba(26, 42, 74, .10);
  --tabbar-h: 56px;
  --topbar-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.5;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ============ 登录页 ============ */
#login-page { min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: #f0f2f7; padding: 20px; }
.login-wrap { width: 100%; max-width: 380px; }
.login-logo { text-align: center; color: var(--navy); margin-bottom: 26px; }
.logo-badge { width: 72px; height: 72px; margin: 0 auto 14px; background: var(--primary);
  border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 38px;
  box-shadow: 0 8px 24px rgba(14,165,233,.25); }
.login-logo h1 { font-size: 22px; font-weight: 700; letter-spacing: 1px; color: var(--navy); }
.login-logo p { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.login-card { background: var(--card); border-radius: var(--radius-lg); border-radius: 14px; padding: 28px 22px;
  box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field input { width: 100%; height: 44px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 14px; font-size: 15px; background: #fff; color: var(--text); transition: .2s; }
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-err { color: var(--danger); font-size: 13px; margin: -4px 0 10px; min-height: 18px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent2)); color: #fff; border-radius: var(--radius-sm);
  height: 46px; font-size: 16px; font-weight: 600; letter-spacing: 4px; box-shadow: 0 6px 16px rgba(14,165,233,.3); transition: .15s; }
.btn-primary:active { transform: scale(.97); }
.btn-block { display: block; width: 100%; }
.login-tip { text-align: center; color: var(--text-2); font-size: 12px; margin-top: 14px; }
.remember { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; color: var(--text-2); font-size: 13px; cursor: pointer; user-select: none; }
.remember input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* ============ 应用骨架 ============ */
/* 移动端与 PC 共用顶部导航：drawer / tabbar / mask 全部隐藏 */
.drawer, .drawer-mask, .tabbar { display: none !important; }
.app { padding-bottom: var(--safe-b) !important; }
.hidden-mobile { display: none; }
.hidden-desktop { display: none !important; }
/* 强制顶部二级导航在所有设备上显示 */
.ptabs.hidden-mobile { display: flex !important; }
/* 移动端 ptab 更紧凑（省略 caret，节省空间） */
@media (max-width: 768px) {
  /* 移动端 ptabs 用 grid 3 等分（屏幕自适应），去掉横滚避免裁切 submenu */
  .ptabs {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 10px 12px !important;
    overflow: visible !important;
    border-bottom: 1px solid var(--border);
    background: #fff;
  }
  .ptabs::-webkit-scrollbar { display: none; }
  .ptabs .ptab {
    padding: 12px 8px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: var(--text) !important;
    background: var(--card);
    border-radius: 10px;
    border-bottom: none !important;
    box-shadow: 0 1px 2px rgba(26,42,74,.08);
    justify-content: center;
    position: relative;
    white-space: nowrap;
  }
  .ptabs .ptab.active { background: var(--primary) !important; color: #fff !important; }
  .ptabs .ptab .caret { display: inline-block !important; font-size: 11px; opacity: 1; }
  .submenu-inline {
    position: absolute !important;
    top: calc(100% + 6px);
    left: 0;
    transform: none;
    width: max-content;
    min-width: 200px;
    max-width: calc(100vw - 24px);
    background: #ffffff;
    border: 2px solid #0ea5e9;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(26,42,74,.18);
    padding: 6px;
    z-index: 999;
    color: #1a2a4a;
  }
  .submenu-inline:not(.hidden) { display: block !important; }
  .submenu-inline.hidden { display: none !important; }
  .submenu-inline .submenu-item {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 12px 16px !important;
    font-size: 15px !important;
    color: #1a2a4a !important;
    background: #ffffff !important;
    font-weight: 500 !important;
    border-radius: 6px;
    width: 100%;
    cursor: pointer;
    white-space: nowrap;
  }
  .submenu-inline .submenu-item .sm-icon { width: 20px; text-align: center; }
  .submenu-inline .submenu-item .sm-name { flex: 1; }
  .submenu-inline .submenu-item:active { background: #e0f2fe !important; color: #0ea5e9 !important; }
  .submenu { max-width: calc(100vw - 16px); }
}
.app { min-height: 100dvh; padding-top: var(--topbar-h); }
.app-main { min-height: 100dvh; }
.topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 50;
  background: #fff; color: var(--navy); display: flex; align-items: center; padding: 0 8px;
  border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.topbar-title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; letter-spacing: 1px; color: var(--navy); }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; color: var(--text); font-size: 19px; display: flex;
  align-items: center; justify-content: center; }
.icon-btn:active { background: var(--primary-light); }

.main { padding: 12px 12px 20px; max-width: 720px; margin: 0 auto; }

/* 底部导航 */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--tabbar-h) + var(--safe-b));
  background: var(--card); display: flex; z-index: 50; border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b); }
.tabbar .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-2); font-size: 11px; }
.tabbar .tab .tab-icon { font-size: 20px; line-height: 1; }
.tabbar .tab.active { color: var(--primary); font-weight: 600; }

/* 抽屉 */
.drawer-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 60; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: 78%; max-width: 300px; background: var(--card);
  z-index: 70; display: flex; flex-direction: column; box-shadow: 4px 0 24px rgba(15,23,42,.2);
  animation: slide-in .22s ease; }
@keyframes slide-in { from { transform: translateX(-100%); } to { transform: translateX(0); } }
.drawer-head { padding: 24px 18px 18px; background: linear-gradient(135deg, var(--navy), var(--navy2)); color: #fff;
  display: flex; align-items: center; gap: 12px; }
.drawer-avatar { width: 48px; height: 48px; border-radius: 14px; background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center; font-size: 26px; }
.drawer-name { font-size: 16px; font-weight: 600; }
.drawer-user { font-size: 12px; opacity: .85; }
.drawer-nav { flex: 1; overflow-y: auto; padding: 8px; }
.drawer-nav .dn-item { display: flex; align-items: center; gap: 12px; padding: 14px 12px; border-radius: 12px;
  font-size: 15px; color: var(--text); }
.drawer-nav .dn-item .dn-icon { font-size: 20px; }
.drawer-nav .dn-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.drawer-foot { padding: 12px; border-top: 1px solid var(--border); }
.btn-ghost { border: 1.5px solid var(--border); border-radius: 12px; height: 44px; color: var(--text-2);
  font-size: 14px; background: #fff; }
.btn-ghost:active { background: var(--bg); }

/* ============ 卡片与工具 ============ */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center;
  justify-content: space-between; }
.card-title .sub { font-size: 12px; color: var(--text-2); font-weight: 400; }
.row { display: flex; gap: 10px; align-items: center; }
.row .grow { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; color: var(--text-2); }
.chip.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
  position: relative; overflow: hidden; }
.stat-card .s-label { font-size: 12px; color: var(--text-2); }
.stat-card .s-value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat-card .s-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.stat-card.accent { background: linear-gradient(135deg, var(--primary), var(--accent2)); color: #fff; }
.stat-card.accent .s-label, .stat-card.accent .s-sub { color: rgba(255,255,255,.85); }

/* ============ 看板 ============ */
.filter-card { position: sticky; top: calc(var(--topbar-h) + 6px); z-index: 40; }
.date-nav { display: flex; align-items: center; gap: 8px; }
.date-nav .date-val { flex: 1; text-align: center; font-size: 15px; font-weight: 600; }
.date-nav .date-val .week { font-size: 12px; color: var(--text-2); font-weight: 400; margin-left: 6px; }
.date-btn { width: 36px; height: 36px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border);
  font-size: 16px; color: var(--text); display: flex; align-items: center; justify-content: center; }
.date-btn:active { background: var(--primary-light); }

/* 参考截图：6 快捷 chips + 起止日期 picker */
.date-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.quick-chip { display: inline-flex; align-items: center; padding: 7px 14px; border-radius: 8px;
  background: #fff; border: 1px solid var(--border); color: var(--text); font-size: 13px;
  cursor: pointer; user-select: none; transition: .15s; white-space: nowrap; }
.quick-chip:hover { border-color: var(--primary); color: var(--primary-dark); }
.quick-chip.active { background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 2px 6px rgba(14,165,233,.3); font-weight: 600; }
.date-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px;
  background: #fafcfe; border: 1px solid var(--border); border-radius: 10px; }
.date-range .dp-icon { color: var(--text-2); font-size: 16px; }
.date-range input[type="date"] { flex: 1; min-width: 130px; height: 34px; border: 1px solid var(--border);
  border-radius: 8px; padding: 0 10px; font-size: 14px; background: #fff; color: var(--text); font-family: inherit; }
.date-range input[type="date"]:focus { outline: none; border-color: var(--primary); }
.date-range .to { color: var(--text-2); font-size: 13px; font-weight: 600; }
@media (min-width: 768px) {
  .date-range { flex-wrap: nowrap; }
  .date-range input[type="date"] { min-width: 0; }
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
table.btable { width: 100%; border-collapse: collapse; background: var(--card); font-size: 13px;
  table-layout: fixed; }    /* 固定列宽，杜绝错位 */
.btable th { position: sticky; top: 0; background: #f8fafc; color: var(--text-2); font-weight: 600;
  padding: 10px 8px; white-space: nowrap; border-bottom: 1.5px solid var(--border);
  text-align: center; vertical-align: middle; }
.btable th.sortable { cursor: pointer; user-select: none; transition: .15s; }
.btable th.sortable:hover { background: var(--primary-light); color: var(--primary-dark); }
.btable th.sortable.active { color: var(--primary-dark); box-shadow: inset 0 -2px 0 var(--primary); }
.btable th.sortable .arr { font-size: 10px; margin-left: 2px; color: var(--primary); font-weight: 700; }
.btable th .th-inner { display: inline-flex; align-items: center; justify-content: center; }
.btable td { padding: 10px 6px; text-align: center; white-space: nowrap; border-bottom: 1px solid #eef2f7;
  vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
.btable tbody tr:nth-child(even) { background: #fafcfe; }
.btable tbody tr:active { background: var(--primary-light); }
.btable td.td-left { text-align: left; }
.btable td.org { text-align: center; }
.btable td.agent { text-align: center; }
.btable .team-tag { display: inline-block; background: var(--primary-light); color: var(--primary-dark);
  border-radius: 6px; padding: 1px 5px; font-size: 11px; margin-left: 4px; flex-shrink: 0; vertical-align: middle; }
.btable .rate { font-weight: 600; }
.btable .rate.hi { color: var(--success); }
.btable .rate.lo { color: var(--danger); }
.btable td.num { font-variant-numeric: tabular-nums; }
/* 列宽通过 inline style 控制（最稳定，避免 CSS 选择器失效）；
   这里给 col 默认宽兜底，JS 内联 style 优先级更高 */
.rank-badge { display: inline-flex; width: 20px; height: 20px; border-radius: 6px; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 700; }
.rank-1 { background: #fef3c7; color: #b45309; }
.rank-2 { background: var(--primary-light); color: var(--primary-dark); }
.rank-3 { background: #fce7f3; color: #be185d; }
.rank-n { background: var(--bg); color: var(--text-2); }

.empty { text-align: center; color: var(--text-2); padding: 40px 0; font-size: 14px; }
.empty .e-icon { font-size: 40px; margin-bottom: 10px; }

/* ============ 底部弹出面板(多选) ============ */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); z-index: 70;
  border-radius: 18px 18px 0 0; max-height: 70dvh; display: flex; flex-direction: column;
  animation: sheet-up .22s ease; box-shadow: 0 -8px 30px rgba(15,23,42,.2); }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); display: flex;
  align-items: center; justify-content: space-between; }
.sheet-head .t { font-size: 15px; font-weight: 600; }
.sheet-body { overflow-y: auto; padding: 10px 12px 16px; }
.sheet .chip { padding: 10px 16px; }
.sheet .chip-row { gap: 10px; }
.sheet-actions { display: flex; gap: 10px; padding: 10px 14px calc(14px + var(--safe-b)); border-top: 1px solid var(--border); }
.sheet-actions .btn { flex: 1; height: 44px; border-radius: 12px; font-size: 15px; font-weight: 600; }
.btn-light { background: var(--bg); color: var(--text); }
.btn-solid { background: var(--primary); color: #fff; }

/* 弹层内搜索框 */
.sheet-search { position: sticky; top: 0; background: var(--card); padding: 4px 0 10px; z-index: 1; }
.sheet-search input { width: 100%; height: 38px; padding: 0 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; background: var(--bg); color: var(--text);
  font-family: inherit; transition: .15s; }
.sheet-search input:focus { outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px var(--primary-light); }

/* ============ 访客中心 ============ */
.visitor-toggle { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.visitor-toggle .vt { flex: 1; text-align: center; padding: 8px 0; border-radius: 8px; font-size: 13px; color: var(--text-2); }
.visitor-toggle .vt.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }
.bar-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.bar-item .b-label { width: 64px; font-size: 12px; color: var(--text-2); text-align: right; flex-shrink: 0; }
.bar-item .b-track { flex: 1; height: 22px; background: var(--bg); border-radius: 8px; overflow: hidden; }
.bar-item .b-fill { height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--primary), var(--accent2));
  min-width: 2px; transition: width .4s; }
.bar-item .b-val { width: 52px; font-size: 12px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.trend-svg { width: 100%; display: block; }

/* ============ 显示管理 ============ */
.team-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.team-toggle .team-label { font-weight: 600; }
.team-toggle .team-count { font-size: 12px; color: var(--text-2); }

.team-section { margin-bottom: 16px; }
.team-head { font-size: 15px; font-weight: 600; padding: 8px 0; border-bottom: 2px solid var(--primary);
  margin-bottom: 12px; cursor: pointer; user-select: none; color: var(--primary-dark); }
.team-people { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0; }
.org-block { margin: 8px 0 12px 0; }
.org-block .org-name { font-weight: 600; color: var(--primary-dark); font-size: 14px; margin-bottom: 6px; padding-left: 4px; }
.org-block .org-people { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 12px; }

.person-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: 10px; border: 1.5px solid var(--border); background: #fff;
  font-size: 13px; cursor: pointer; user-select: none; transition: .15s; }
.person-chip input { display: none; }
.person-chip .ck { width: 18px; height: 18px; border-radius: 5px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.person-chip.on { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
.person-chip.on .ck { background: var(--primary); color: #fff; }
.person-chip.off { background: #f8fafc; color: var(--text-2); border-style: dashed; }
.person-chip.off .ck { background: #e2e8f0; color: #94a3b8; }
.person-chip .nm { font-weight: 500; }
.person-chip .team-mini { font-size: 10px; color: var(--text-2); background: var(--bg); padding: 1px 6px; border-radius: 999px; }
.person-chip:active { transform: scale(.97); }

/* 机构块（人跟机构分离） */
.org-block { margin: 10px 0 14px; padding: 8px 12px; background: #f8fafc; border-radius: 10px; }
.org-block .org-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.org-block .org-name { font-weight: 700; color: var(--primary-dark); font-size: 14px; }
.org-block .org-stats { font-size: 12px; color: var(--text-2); }
.org-block .org-people { display: flex; flex-wrap: wrap; gap: 6px; }

/* 兼容旧版 .agent-item 列表（保留以防回滚）*/
.agent-list { display: flex; flex-direction: column; }
.agent-item { display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-bottom: 1px solid #f1f5f9; }
.agent-item:last-child { border-bottom: none; }
.agent-item .a-name { flex: 1; font-size: 14px; }
.agent-item .a-team { font-size: 11px; color: var(--text-2); background: var(--bg); border-radius: 6px; padding: 2px 7px; }
.agent-item .a-company { font-size: 11px; color: #fff; background: var(--primary); border-radius: 6px; padding: 2px 7px; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { display: none; }
.switch .sw-track { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; }
.switch .sw-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .sw-track { background: var(--success); }
.switch input:checked + .sw-track::after { transform: translateX(20px); }
/* 半开（部分团队被隐藏）状态：黄色中间色 */
.switch input:indeterminate + .sw-track { background: var(--warn); }
.switch input:indeterminate + .sw-track::after { transform: translateX(10px); }
.team-toggle.partial .team-label { color: #b45309; }

/* ============ 账号管理 ============ */
.user-item { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid #f1f5f9; }
.user-item:last-child { border-bottom: none; }
.user-item.disabled { opacity: .55; }
.user-avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--primary-light); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-info .u-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.user-info .u-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 10px; padding: 2px 7px; border-radius: 999px; }
.badge.super { background: #fef3c7; color: #b45309; }
.badge.normal { background: var(--bg); color: var(--text-2); }
.badge.disabled { background: #fee2e2; color: #b91c1c; }
.btn-sm { height: 32px; padding: 0 12px; border-radius: 9px; font-size: 12px; font-weight: 600; }
.btn-sm.edit { background: var(--primary-light); color: var(--primary-dark); }
.btn-sm.del { background: #fee2e2; color: var(--danger); }
.fab { position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); width: 52px; height: 52px;
  border-radius: 50%; background: var(--primary); color: #fff; font-size: 26px; z-index: 45;
  box-shadow: 0 6px 18px rgba(14,165,233,.4); display: flex; align-items: center; justify-content: center; }
.fab:active { transform: scale(.93); }

/* 权限编辑器 */
.perm-section { margin-bottom: 14px; }
.perm-section .ps-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.perm-section .chip-row .chip { padding: 8px 12px; }
.form-input, .form-select { width: 100%; height: 44px; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 0 12px; font-size: 14px; background: #fff; color: var(--text); }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--primary); }
.scope-editor { background: var(--bg); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.scope-row { display: flex; gap: 8px; margin-bottom: 8px; }
.scope-row:last-child { margin-bottom: 0; }
.scope-row .form-select { flex: 1; height: 38px; font-size: 13px; }
.scope-row .btn-sm.del { flex-shrink: 0; }

/* ============ 上传 ============ */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 30px 16px; text-align: center;
  color: var(--text-2); margin-bottom: 14px; background: #fafcfe; }
.upload-zone .uz-icon { font-size: 40px; margin-bottom: 8px; }
.upload-zone.dragover { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
.upload-note { font-size: 12px; color: var(--text-2); background: var(--primary-light); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 14px; }
.upload-note b { color: var(--primary-dark); }

/* ============ Toast ============ */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 40px); transform: translateX(-50%);
  background: rgba(15,23,42,.92); color: #fff; padding: 11px 20px; border-radius: 999px; font-size: 14px;
  z-index: 100; max-width: 85vw; text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: toast-in .2s; }
.toast.err { background: rgba(220,38,38,.95); }
.toast.ok { background: rgba(5,150,105,.95); }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* 桌面端：顶部导航布局（参考投流系统 ptabs） */
@media (min-width: 1024px) {
  .hidden-mobile { display: flex; }
  .hidden-desktop { display: none !important; }
  .app { padding-top: 0; padding-left: 0; padding-bottom: 0; }

  /* 顶部栏：品牌（左） + 用户（右） */
  .topbar { position: sticky; top: 0; height: 52px; padding: 0 20px; display: flex;
    align-items: center; justify-content: space-between; }
  .topbar-brand { display: flex; align-items: center; gap: 10px; }
  .mini-logo { width: 34px; height: 34px; border-radius: 9px; background: var(--primary);
    display: flex; align-items: center; justify-content: center; font-size: 18px;
    box-shadow: 0 3px 8px rgba(14,165,233,.3); }
  .brand-name { font-size: 16px; font-weight: 700; color: var(--navy); letter-spacing: .5px; }
  .topbar-user { display: flex; align-items: center; gap: 10px; }
  .tb-user-name { font-size: 13px; color: var(--text-2); }

  /* 顶部导航条（参考投流系统 .ptabs） */
  .ptabs { position: sticky; top: 52px; z-index: 199; background: #fff; display: flex;
    overflow-x: auto; overflow-y: visible; padding: 0 12px;
    border-bottom: 1px solid var(--border); box-shadow: 0 2px 4px rgba(26,42,74,.06);
    align-items: stretch; }
  .ptabs::-webkit-scrollbar { display: none; }
  .ptab { padding: 12px 16px; font-size: 14px; font-weight: 500; color: var(--text-2);
    white-space: nowrap; cursor: pointer; border-bottom: 2px solid transparent;
    display: flex; align-items: center; gap: 6px; transition: all .15s; user-select: none; }
  .ptab:hover { color: var(--primary); }
  .ptab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

  /* 后台管理 sub-tab（内容区顶部，胶囊风格） */
  .admin-sub-tabs { padding: 12px 14px; }
  .admin-sub-tab { display: inline-flex; align-items: center; gap: 5px; padding: 8px 14px;
    border-radius: 8px; background: var(--bg); border: 1px solid var(--border);
    color: var(--text-2); font-size: 13px; cursor: pointer; user-select: none; transition: .15s; }
  .admin-sub-tab:hover { color: var(--primary); border-color: var(--primary); }
  .admin-sub-tab.active { background: var(--primary); color: #fff; border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(14,165,233,.3); font-weight: 600; }

  .main { padding: 18px 24px 32px; max-width: 1200px; }
  .tabbar { display: none; }

/* 顶部一级导航（PC）二级菜单（hover 弹出） */
.submenu { position: fixed; background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(26,42,74,.15); padding: 6px; min-width: 160px; z-index: 300; animation: submenu-in .15s; }
@keyframes submenu-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.submenu-item { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 6px;
  font-size: 13px; color: var(--text); cursor: pointer; transition: .12s; user-select: none; }
.submenu-item:hover { background: var(--primary-light); color: var(--primary-dark); }
.submenu-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.submenu-item .sm-icon { width: 18px; text-align: center; font-size: 14px; }
.ptab .caret { font-size: 10px; margin-left: 2px; opacity: .7; }
.ptab:hover .caret, .ptab.active .caret { opacity: 1; }

/* 手机端 drawer 子项二级 */
.dn-group { margin-bottom: 4px; }
.dn-item-title { display: flex; align-items: center; gap: 8px; padding: 12px 16px 8px;
  font-size: 14px; font-weight: 700; color: var(--navy); border-bottom: 1px solid var(--border); }
.dn-subs { padding: 4px 0 8px; }
.dn-sub { display: flex; align-items: center; gap: 8px; padding: 9px 20px; font-size: 13px;
  color: var(--text-2); cursor: pointer; transition: .12s; user-select: none; }
.dn-sub:hover { background: var(--primary-light); color: var(--primary-dark); }
.dn-sub.active { color: var(--primary); font-weight: 600; background: var(--primary-light); }
.dn-sub-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.dn-sub.active .dn-sub-dot { background: var(--primary); }

/* 客服明细 / 机构明细：多份小表堆叠 */
.detail-stack { display: flex; flex-direction: column; gap: 14px; }
.detail-card { padding: 0; overflow: hidden; }
.detail-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  background: linear-gradient(135deg, var(--primary-light), #f0f9ff); border-bottom: 1px solid var(--border); }
.detail-head .dh-icon { font-size: 16px; }
.detail-head .dh-name { font-size: 15px; font-weight: 700; color: var(--navy); flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-head .dh-count { font-size: 12px; color: var(--text-2); padding: 2px 8px;
  background: #fff; border-radius: 999px; }
.detail-table { font-size: 12px; }
.detail-table th { background: #f8fafc; }

/* 显示管理：以团队为单位的二级块 */
.team-block { background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.team-block-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe); border-bottom: 1px solid var(--border); }
.team-block-icon { font-size: 16px; }
.team-block-name { font-size: 15px; font-weight: 700; color: var(--navy); flex: 1; }
.team-block-stats { font-size: 12px; color: var(--text-2); padding: 3px 10px;
  background: #fff; border-radius: 999px; border: 1px solid var(--border); }
.team-block-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.team-block-body.team-people-flat { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
.person-chip .team-count-mini { font-size: 11px; color: var(--text-3); padding: 1px 6px;
  background: rgba(0,0,0,.04); border-radius: 999px; margin-left: 4px; }
.person-chip.off .team-count-mini { background: rgba(0,0,0,.06); color: var(--text-2); }
.team-block-body .org-block { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 0; }
.team-block-body .org-block .org-head { padding: 8px 12px; background: #fafbfc; border-bottom: 1px solid var(--border); border-radius: 8px 8px 0 0; }
.team-block-body .org-block .org-people { padding: 10px 12px; }

/* 访客中心 */
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-box { flex: 1; min-width: 90px; background: var(--bg); border-radius: 10px; padding: 14px 10px;
  text-align: center; }
.stat-box b { display: block; font-size: 20px; color: var(--primary-dark); }
.stat-box span { font-size: 12px; color: var(--text-2); }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; color: var(--text-2); }
.bl-ip { font-weight: 600; font-family: monospace; }
#visitor-snippet { background: #f8fafc; }
  .btable { font-size: 14px; }
  .btable td { padding: 11px 14px; }
  .filter-card { position: sticky; top: 116px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .fab { right: 28px; bottom: 28px; }
}

/* ============ 最终兜底：所有设备都强制隐藏移动端专用元素 ============ */
.drawer, .drawer-mask, .tabbar {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}
