/* ============================================================
   多租户 CRM · 设计系统 (Design System)
   主题：企业蓝 / 中性灰，圆角 + 柔和阴影，跨端响应式
   ============================================================ */

/* ---------- 会话恢复：避免刷新闪现登录页 ---------- */
html.restoring #login-view { display: none !important; }
.loading-splash {
  display: flex; align-items: center; justify-content: center;
  min-height: 60vh; color: var(--c-text-3); font-size: 15px;
}

/* ---------- 设计令牌 ---------- */
:root {
  /* 背景与表面 */
  --c-bg: #f4f6fb;
  --c-surface: #ffffff;
  --c-surface-2: #f7f9fc;
  --c-surface-3: #eef2f9;
  /* 边框 */
  --c-border: #e6e9f0;
  --c-border-strong: #d4d9e6;
  /* 文本 */
  --c-text: #1f2733;
  --c-text-2: #5b6577;
  --c-text-3: #8a93a6;
  /* 品牌主色 */
  --c-primary: #2563eb;
  --c-primary-600: #1d4ed8;
  --c-primary-700: #1e40af;
  --c-primary-50: #eef4ff;
  --c-primary-100: #dbe6ff;
  --c-primary-grad: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  /* 状态色 */
  --c-success: #15a37f;  --c-success-bg: #e3f7f0;
  --c-warning: #d98a17;  --c-warning-bg: #fdf2e0;
  --c-danger:  #e0453c;  --c-danger-bg:  #fdeceb;
  --c-info:    #2f6bff;  --c-info-bg:    #e7eeff;
  /* 圆角 */
  --r-sm: 8px;  --r-md: 12px;  --r-lg: 16px;  --r-xl: 22px;  --r-pill: 999px;
  /* 阴影 */
  --sh-sm: 0 1px 3px rgba(24,39,75,.06);
  --sh-md: 0 4px 16px rgba(24,39,75,.08);
  --sh-lg: 0 12px 40px rgba(24,39,75,.14);
  /* 间距 */
  --sp-1: 6px; --sp-2: 10px; --sp-3: 14px; --sp-4: 18px; --sp-5: 24px; --sp-6: 32px;
  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: var(--font); background: var(--c-bg); color: var(--c-text);
  font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; transition: background .15s, color .15s, border-color .15s, transform .05s; }
button:active { transform: translateY(1px); }
a { color: var(--c-primary); }
input, select, textarea { font-family: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid var(--c-border);
  border-radius: var(--r-sm); width: 100%; background: var(--c-surface); color: var(--c-text); outline: none;
  transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--c-text-3); }
input:focus, select:focus, textarea:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-50); }
input:disabled, select:disabled { background: var(--c-surface-2); color: var(--c-text-3); cursor: not-allowed; }
textarea { resize: vertical; min-height: 72px; }
label { font-size: 13px; color: var(--c-text-2); margin: 12px 0 5px; display: block; font-weight: 500; }
.hint { color: var(--c-text-3); font-size: 12px; font-weight: 400; }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--c-border);
  background: var(--c-surface); padding: 9px 15px; border-radius: var(--r-sm); color: var(--c-text); font-size: 14px; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--c-surface-3); border-color: var(--c-border-strong); }
.btn.primary { background: var(--c-primary-grad); border-color: transparent; color: #fff; box-shadow: var(--sh-sm); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--c-primary); }
.btn.ghost:hover { background: var(--c-primary-50); }
.btn.block { width: 100%; margin-top: 16px; padding: 12px; font-size: 15px; }
.btn.sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.btn.danger { color: var(--c-danger); border-color: #f3c4c1; background: #fff; }
.btn.danger:hover { background: var(--c-danger-bg); }
.btn.ok { color: var(--c-success); border-color: #b7e3d6; background: #fff; }
.btn.ok:hover { background: var(--c-success-bg); }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 登录页 ---------- */
.login-wrap { display: flex; min-height: 100vh; }
.login-aside { flex: 0 0 44%; max-width: 540px; background: var(--c-primary-grad); color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 56px; position: relative; overflow: hidden; }
.login-aside::after { content: ""; position: absolute; right: -90px; bottom: -90px; width: 320px; height: 320px;
  background: rgba(255,255,255,.12); border-radius: 50%; }
.login-aside::before { content: ""; position: absolute; left: -70px; top: -70px; width: 240px; height: 240px;
  background: rgba(255,255,255,.08); border-radius: 50%; }
.login-brand { position: relative; z-index: 1; max-width: 360px; }
.login-logo { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; margin-bottom: 26px; }
.login-logo .mark { width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center; font-size: 20px; }
.login-brand h1 { font-size: 30px; line-height: 1.3; margin: 0 0 14px; font-weight: 800; }
.login-brand p { font-size: 14px; opacity: .9; margin: 0 0 28px; }
.login-feat { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.login-feat li { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.login-feat .dot { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; font-size: 13px; flex: none; }
.login-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 28px; }
.login-card { background: var(--c-surface); width: 100%; max-width: 392px; border-radius: var(--r-lg);
  box-shadow: var(--sh-lg); padding: 30px 28px; animation: fadeIn .4s ease; }
.login-title { margin: 0 0 4px; font-size: 21px; font-weight: 700; }
.login-sub { margin: 0 0 18px; color: var(--c-text-3); font-size: 13px; }
.tabs { display: flex; gap: 4px; background: var(--c-surface-3); padding: 4px; border-radius: var(--r-pill); margin-bottom: 20px; }
.tab { flex: 1; border: 0; background: transparent; padding: 9px 4px; border-radius: var(--r-pill); color: var(--c-text-2); font-size: 13px; font-weight: 500; }
.tab.active { background: var(--c-surface); color: var(--c-primary); font-weight: 600; box-shadow: var(--sh-sm); }
.login-form { display: flex; flex-direction: column; }
.msg { margin-top: 12px; font-size: 13px; color: var(--c-danger); min-height: 18px; text-align: center; }
.demo-box { margin-top: 18px; font-size: 12px; color: var(--c-text-2); background: var(--c-surface-2);
  border: 1px dashed var(--c-border-strong); border-radius: var(--r-md); padding: 12px 14px; line-height: 1.8; }
.demo-box b { color: var(--c-text); }

/* ---------- 应用外壳 ---------- */
.app-wrap { min-height: 100vh; background: var(--c-bg); }
.topbar { height: 56px; background: var(--c-surface); border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; padding: 0 18px; position: sticky; top: 0; z-index: 20; box-shadow: var(--sh-sm); }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; color: var(--c-text); font-size: 15px; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; background: var(--c-primary-grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 16px; box-shadow: var(--sh-sm); }
.hamburger { display: none; border: 0; background: transparent; font-size: 22px; margin-right: 6px; color: var(--c-text-2); }
.user-box { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-box #current-user { font-size: 13px; color: var(--c-text-2); }
.layout { display: flex; }
.sidebar { width: 220px; background: var(--c-surface); border-right: 1px solid var(--c-border);
  position: fixed; left: 0; top: 56px; bottom: 0; padding: 14px 12px; overflow-y: auto; z-index: 10; }
.sidebar .nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar .nav button { display: flex; align-items: center; gap: 11px; text-align: left; border: 0; background: transparent;
  padding: 11px 14px; border-radius: var(--r-sm); color: var(--c-text-2); font-size: 14px; font-weight: 500; position: relative; }
.sidebar .nav button .nav-ico { font-size: 16px; width: 20px; text-align: center; }
.sidebar .nav button:hover { background: var(--c-surface-3); color: var(--c-text); }
.sidebar .nav button.active { background: var(--c-primary-50); color: var(--c-primary-600); font-weight: 600; }
.sidebar .nav button.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px;
  border-radius: 3px; background: var(--c-primary); }
.content { flex: 1; padding: 26px 30px; max-width: 1180px; margin-left: 220px; min-height: calc(100vh - 56px); }
.section-title { font-size: 19px; font-weight: 700; margin: 0 0 5px; letter-spacing: .2px; }
.section-desc { color: var(--c-text-3); font-size: 13px; margin: 0 0 18px; }

/* ---------- 卡片 / 统计 / 栅格 ---------- */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg);
  padding: 20px; box-shadow: var(--sh-sm); margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 170px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 4px 0 18px; }
.stat-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md);
  padding: 16px 18px; box-shadow: var(--sh-sm); display: flex; flex-direction: column; gap: 4px; }
.stat-card .label { font-size: 12px; color: var(--c-text-3); }
.stat-card .value { font-size: 26px; font-weight: 700; color: var(--c-text); line-height: 1.1; }
.stat-card .bar { height: 4px; border-radius: 4px; background: var(--c-primary-100); margin-top: 6px; overflow: hidden; }
.stat-card .bar > i { display: block; height: 100%; background: var(--c-primary-grad); }

/* ---------- 表格 ---------- */
.table-wrap { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm); overflow: hidden; margin-bottom: 18px; }
.table { width: 100%; border-collapse: collapse; background: transparent; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--c-border);
  font-size: 13px; vertical-align: middle; }
.table th { background: var(--c-surface-2); color: var(--c-text-2); font-weight: 600; white-space: nowrap; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--c-surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .col-ops { white-space: nowrap; width: 1%; }
.table .col-ops .btn-group { justify-content: flex-end; }

/* ---------- 标签 / 徽章 ---------- */
.tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 12px; background: var(--c-surface-3); color: var(--c-text-2); margin: 2px 4px 2px 0; line-height: 1.5; }
.tag.ok { background: var(--c-success-bg); color: var(--c-success); }
.tag.warn { background: var(--c-warning-bg); color: var(--c-warning); }
.tag.danger { background: var(--c-danger-bg); color: var(--c-danger); }
.tag.primary { background: var(--c-info-bg); color: var(--c-info); }
.badge-pub { background: var(--c-warning-bg) !important; color: var(--c-warning) !important; }
.badge-share { background: var(--c-info-bg) !important; color: var(--c-info) !important; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(17,24,39,.5); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 18px; animation: fadeIn .18s ease; }
.modal { background: var(--c-surface); border-radius: var(--r-lg); width: 100%; max-width: 580px; max-height: 92vh;
  overflow: auto; padding: 24px; box-shadow: var(--sh-lg); animation: slideUp .22s ease; }
.modal h3 { margin: 0 0 16px; font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkbox-row { display: flex; gap: 18px; margin-top: 10px; }
.checkbox-row label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; color: var(--c-text); cursor: pointer; }
.checkbox-row input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--c-primary); }
.multi-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.multi-list label { display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 6px 12px;
  border: 1px solid var(--c-border); border-radius: var(--r-pill); font-size: 13px; color: var(--c-text-2);
  cursor: pointer; font-weight: 400; transition: all .15s; }
.multi-list label:hover { border-color: var(--c-primary-100); }
.multi-list input { width: auto; margin: 0; accent-color: var(--c-primary); }
.multi-list label:has(input:checked) { background: var(--c-primary-50); border-color: var(--c-primary); color: var(--c-primary-600); }
.address-line { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.currency-line { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }

/* ---------- 密码显隐 / 企业 LOGO ---------- */
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input { padding-right: 38px; }
.eye-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent;
  color: var(--c-text-3); font-size: 15px; padding: 6px 9px; border-radius: 6px; cursor: pointer; line-height: 1; }
.eye-btn:hover { background: var(--c-surface-3); color: var(--c-text-2); }
.topbar .ent-logo { width: 30px; height: 30px; object-fit: contain; border-radius: 7px; margin-right: 8px; background: var(--c-surface-2); padding: 2px; }
.table .row-logo { width: 26px; height: 26px; object-fit: contain; border-radius: 5px; margin-right: 8px; vertical-align: middle; background: var(--c-surface-2); padding: 2px; }
.logo-preview { min-height: 80px; border: 1px dashed var(--c-border-strong); border-radius: var(--r-md);
  background: var(--c-surface-2); display: flex; align-items: center; justify-content: center; padding: 10px; margin: 6px 0 12px; }
.logo-preview img { max-height: 60px; max-width: 100%; object-fit: contain; }

/* 企业管理 / 账号管理：多列表单 */
.row.multi { flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row.multi > div { flex: 1; min-width: 160px; }
.logo-upload { position: relative; width: 80px; height: 80px; border: 1px dashed var(--c-border-strong); border-radius: var(--r-md);
  background: var(--c-surface-2); display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; }
.logo-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.logo-upload .logo-thumb { width: 100%; height: 100%; font-size: 12px; color: var(--c-text-3); text-align: center; padding: 6px; display: flex; align-items: center; justify-content: center; }
.logo-upload .logo-thumb img { width: 100%; height: 100%; object-fit: contain; }
.auth-line { display: flex; gap: 8px; }
.auth-line input { flex: 1; }
.auth-line button { flex: none; }
.logo-upload-wrap { display: flex; gap: 10px; align-items: center; }
.logo-upload-wrap input[type="file"] { flex: 0 0 auto; width: auto; padding: 6px; }
.logo-upload-wrap input[type="text"] { flex: 1; }

/* ---------- 其它 ---------- */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #1f2733; color: #fff;
  padding: 11px 20px; border-radius: var(--r-pill); font-size: 13px; z-index: 80; box-shadow: var(--sh-lg);
  animation: toastIn .2s ease; max-width: 90vw; }
.empty { text-align: center; color: var(--c-text-3); padding: 44px 0; font-size: 14px; }
.tabs2 { display: inline-flex; gap: 4px; margin-bottom: 16px; background: var(--c-surface-3); padding: 4px; border-radius: var(--r-pill); }
.tabs2 button { border: 1px solid transparent; background: transparent; padding: 7px 16px; border-radius: var(--r-pill);
  color: var(--c-text-2); font-size: 13px; font-weight: 500; }
.tabs2 button.active { background: var(--c-surface); color: var(--c-primary); font-weight: 600; box-shadow: var(--sh-sm); }

/* ---------- 动画 ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 响应式（手机 / 平板） ---------- */
@media (max-width: 880px) {
  .login-aside { display: none; }
  .login-wrap { display: block; }
  .login-main { min-height: 100vh; padding: 24px 16px; }
  .login-card { margin: 0 auto; }
  .hamburger { display: block; }
  .sidebar { position: fixed; left: 0; top: 56px; bottom: 0; z-index: 40; transform: translateX(-100%);
    transition: transform .22s ease; width: 240px; box-shadow: var(--sh-lg); }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 16px; margin-left: 0; }
  .grid2, .grid3, .field-row, .address-line { grid-template-columns: 1fr; }
  .row.multi { flex-direction: column; align-items: stretch; }
  .row > * { min-width: 100%; }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .dash-panel.span-2 { grid-column: span 2; }
  /* 抽屉式侧栏遮罩 */
  .sidebar.open::before { content: ''; position: fixed; inset: 56px 0 0 0; background: rgba(17,24,39,.35); z-index: -1; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 12px; height: 56px; }
  .content { padding: 12px; }
  .user-box #current-user { display: none; }
  .user-box .btn { padding: 6px 10px; font-size: 13px; }
  .dash-grid { grid-template-columns: 1fr; gap: 12px; }
  .dash-panel.span-2 { grid-column: span 1; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .card, .role-card, .dept-card { padding: 14px; }
  .modal { width: 94vw; padding: 18px; max-height: 90vh; overflow: auto; }
  .modal-mask { padding: 12px; }
  .row.multi { gap: 10px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 640px; }
  .table.sm { min-width: 540px; }
  .ent-create-card .row { flex-direction: column; }
  .role-mod-grid, .role-scope-grid { grid-template-columns: 1fr; }
  .nav button { padding: 12px 14px; font-size: 15px; }
  .kanban { grid-auto-columns: 78vw; }
  .btn { min-height: 40px; }
  .section-title { font-size: 18px; }
  .login-title { font-size: 22px; }
  /* 手机端：表格横向滚动，避免挤压 */
  .content > .table-wrap { margin: 0 -12px; padding: 0 12px; }
}

/* ---------- 部门管理 ---------- */
.dept-card { padding: 16px; }
.dept-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.dept-header strong { font-size: 15px; color: var(--c-text); margin-right: 10px; }
.dept-header .hint { font-size: 12px; color: var(--c-text-3); background: var(--c-surface-2); padding: 2px 8px; border-radius: var(--r-pill); }
.dept-members { margin-bottom: 12px; }
.dept-members .table.sm { font-size: 13px; }
.dept-members .table.sm th, .dept-members .table.sm td { padding: 6px 8px; }
.dept-add-member { display: flex; gap: 8px; align-items: center; padding-top: 10px; border-top: 1px solid var(--c-border); }
.dept-add-member select { flex: 1; min-width: 160px; }

/* ---------- 仪表盘（增强） ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; align-items: start; margin: 4px 0 18px; }
.dash-grid > .stat-card { grid-column: span 1; }
.dash-grid > .dash-panel { grid-column: span 1; }
.dash-grid > .dash-panel.span-2 { grid-column: span 2; }
.stat-card .sub { display: block; font-size: 12px; color: var(--c-text-3); margin-top: 2px; }
.dash-panel { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 14px 16px; }
.dash-panel-title { font-size: 13px; font-weight: 600; color: var(--c-text-2); margin-bottom: 12px; }
.bar-list { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 84px 1fr 42px; align-items: center; gap: 8px; font-size: 13px; }
.bar-name { color: var(--c-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; background: var(--c-surface-3); border-radius: 6px; overflow: hidden; }
.bar-track > i { display: block; height: 100%; background: var(--c-primary-grad); border-radius: 6px; }
.bar-val { text-align: right; color: var(--c-text); font-variant-numeric: tabular-nums; }
.funnel { display: flex; flex-direction: column; gap: 6px; }
.funnel-step { display: flex; justify-content: center; }
.funnel-bar { background: var(--c-info-bg); color: var(--c-info); border-radius: 8px; padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; min-width: 120px; transition: width .3s ease; }
.funnel-bar:nth-child(odd) { background: var(--c-primary-100); color: var(--c-primary); }
.funnel-name { font-size: 13px; }
.funnel-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.spark-wrap { width: 100%; }
.spark { width: 100%; height: 60px; display: block; }
.spark-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--c-text-3); margin-top: 2px; }
.rank-list { display: flex; flex-direction: column; gap: 6px; }
.rank-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; background: var(--c-surface-2); font-size: 13px; }
.rank-no { width: 22px; height: 22px; border-radius: 50%; background: var(--c-primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.rank-name { font-weight: 600; color: var(--c-text); }
.rank-val { margin-left: auto; color: var(--c-text-2); font-variant-numeric: tabular-nums; }

/* ---------- 角色管理 ---------- */
.role-card { padding: 14px 16px; margin-bottom: 12px; }
.role-head { display: flex; justify-content: space-between; align-items: center; }
.role-head strong { font-size: 15px; color: var(--c-text); }
.role-head .hint { font-size: 12px; color: var(--c-text-3); margin-left: 8px; }
.role-ops { display: flex; gap: 6px; }
.role-mods { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.role-form { margin: 12px 0; }
.role-form .row { margin-bottom: 16px; }
.role-section { margin: 18px 0 10px; }
.role-section > label { display: block; font-size: 13px; font-weight: 600; color: var(--c-text); margin-bottom: 10px; }
.role-mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.role-mod-card, .role-scope-card { position: relative; border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: all .15s; background: var(--c-surface); }
.role-mod-card:hover, .role-scope-card:hover { border-color: var(--c-primary-100); }
.role-mod-card.checked, .role-scope-card.checked { border-color: var(--c-primary); background: var(--c-primary-50); }
.role-mod-card input, .role-scope-card input { position: absolute; top: 10px; right: 10px; width: auto; margin: 0; accent-color: var(--c-primary); }
.mod-title, .scope-title { font-size: 14px; font-weight: 600; color: var(--c-text); }
.mod-desc, .scope-desc { font-size: 12px; color: var(--c-text-3); line-height: 1.4; }
.role-scope-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px 16px; }
.radio-col { display: flex; flex-direction: column; gap: 6px; }

/* ---------- 导入 ---------- */
.modal.wide { width: min(720px, 94vw); max-height: 88vh; overflow: auto; }
.import-map { max-height: 320px; overflow: auto; border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 8px; }
.import-map .table.sm th, .import-map .table.sm td { padding: 6px 8px; }

/* ---------- 线索：工具栏 / 标签筛选 ---------- */
.lead-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 16px; }
.lead-toolbar .tabs2 { margin-bottom: 0; }
.lead-tag-filter { width: auto; min-width: 150px; flex: 0 0 auto; }
.lead-ops { margin-left: auto; display: flex; gap: 8px; }
.stat-card .value.danger { color: var(--c-danger); }

/* ---------- 线索：阶段看板（Kanban） ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--r-md); display: flex; flex-direction: column; min-height: 120px; }
.kanban-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; font-weight: 600; color: var(--c-text); border-bottom: 1px solid var(--c-border); position: sticky; top: 0; background: var(--c-surface-3); border-radius: var(--r-md) var(--r-md) 0 0; }
.kanban-count { background: var(--c-primary-100); color: var(--c-primary-700); border-radius: var(--r-pill); font-size: 12px; padding: 1px 9px; font-weight: 700; }
.kanban-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.kanban-empty { text-align: center; color: var(--c-text-3); font-size: 12px; padding: 14px 0; }
.kanban-item { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-sm); padding: 10px 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.kanban-item:hover { border-color: var(--c-primary-100); box-shadow: var(--sh-sm); }
.ki-name { font-weight: 600; color: var(--c-text); }
.ki-meta { font-size: 12px; color: var(--c-text-3); margin-top: 3px; }
.ki-tags { margin-top: 6px; }
.ki-owner { font-size: 12px; color: var(--c-text-2); margin-top: 6px; }

/* ---------- 线索：标签编辑器 ---------- */
.tag-editor { border: 1px solid var(--c-border); border-radius: var(--r-sm); padding: 8px 10px; margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: var(--c-surface-2); }
.tag-editor-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--c-primary-50); color: var(--c-primary-700); border-radius: var(--r-pill); padding: 3px 10px; font-size: 12px; }
.tag-chip .tag-x { border: 0; background: transparent; color: var(--c-primary-600); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.tag-chip .tag-x:hover { color: var(--c-danger); }
.tag-input { border: 0; background: transparent; padding: 4px; flex: 1; min-width: 120px; outline: none; width: auto; }
.tag-input:focus { box-shadow: none; }

/* ---------- 线索：查重警告 ---------- */
.dup-warn { margin-top: 10px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--c-warning-bg); color: var(--c-warning); font-size: 13px; border: 1px solid #f6dfb4; line-height: 1.7; }
.dup-warn a { color: var(--c-primary); cursor: pointer; text-decoration: underline; margin: 0 2px; }

/* ---------- 线索：跟进时间线 ---------- */
.act-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--c-border); }
.act-section h4 { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--c-text); }
.act-list { display: flex; flex-direction: column; gap: 10px; max-height: 280px; overflow-y: auto; }
.act-item { border-left: 3px solid var(--c-primary); background: var(--c-surface-2); border-radius: var(--r-sm); padding: 9px 12px; }
.act-item.act-plan { border-left-color: var(--c-warning); }
.act-top { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.act-time { color: var(--c-text-3); }
.act-by { color: var(--c-text-3); }
.act-del { margin-left: auto; border: 0; background: transparent; color: var(--c-danger); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.act-del:hover { text-decoration: underline; }
.act-content { margin-top: 5px; color: var(--c-text); white-space: pre-wrap; font-size: 13px; line-height: 1.6; }
.act-form { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--c-border); }
.act-form-row { display: flex; gap: 10px; align-items: center; }
.act-form-row #act-type { flex: 0 0 120px; width: 120px; }
.act-form-row #act-plan { flex: 1; }
.act-form textarea { margin-top: 8px; }
.act-form-actions { margin-top: 8px; text-align: right; }

/* ---------- 仪表盘：可点击下钻 ---------- */
.stat-card.clickable, .bar-row.clickable, .funnel-step.clickable { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.stat-card.clickable:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.bar-row.clickable:hover { background: var(--c-primary-50); border-radius: 8px; }
.funnel-step.clickable:hover .funnel-bar { outline: 2px solid var(--c-primary); }
.card-link { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--c-primary); font-weight: 600; }
.card-link::after { content: ' ›'; }
.bar-row.clickable .bar-name, .funnel-step.clickable { position: relative; }
.bar-row.clickable .bar-name::after { content: ' ›'; color: var(--c-primary); font-weight: 700; margin-left: 4px; }

/* ---------- 开关（Toggle Switch） ---------- */
.switch-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--c-text-2); font-size: 14px; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--c-border-strong); border-radius: 999px; transition: .2s; }
.switch .slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--sh-sm); }
.switch input:checked + .slider { background: var(--c-primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ---------- 角色关联部门 ---------- */
.role-dep { display: flex; align-items: center; gap: 10px; }
.role-dep select { flex: 1; }
.role-dep .hint { font-size: 12px; color: var(--c-text-3); white-space: nowrap; }

/* ---------- 线索：内联登记 / 编辑（桌面端免弹窗） ---------- */
.lead-inline-add { margin: 12px 0 4px; }
.lead-inline-form { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 14px 16px; }
.lff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.lf-field { display: flex; flex-direction: column; gap: 5px; }
.lf-field > label { font-size: 12px; font-weight: 600; color: var(--c-text-2); }
.lf-field .lf-assign { grid-column: 1 / -1; }
.lf-field textarea { min-height: 64px; resize: vertical; }
.lf-actions { display: flex; gap: 10px; margin-top: 14px; }
.inline-edit-row > td { background: var(--c-primary-50); padding: 0 !important; }
.inline-edit-wrap { padding: 14px 16px; }
.inline-edit-row .lead-inline-form { background: #fff; border-color: var(--c-primary-100); }
@media (max-width: 560px) {
  .lff-grid { grid-template-columns: 1fr; }
}

/* ===== 新增页面样式（预约/会员/审批/公海/公域/AI/视图/字段可见） ===== */
.sec-head { margin-bottom: 14px; }
.sec-head h2 { margin: 0 0 4px; font-size: 18px; }
.sec-desc { margin: 0; color: var(--c-text-2); font-size: 13px; }
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.row.multi { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.row.multi .inp { flex: 1 1 160px; min-width: 120px; }
.voice-btn { align-self: flex-start; background: var(--c-primary-50); border-color: var(--c-primary-100); color: var(--c-primary); }
.voice-btn.recording { background: var(--c-danger); color: #fff; border-color: var(--c-danger); animation: pulse 1s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: .55; } 100% { opacity: 1; } }
.ap-list table, .card table { width: 100%; }
.tier-row { gap: 8px; }
.tier-row .inp { flex: 1 1 120px; }
.churn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--c-border); border-radius: var(--r-md); margin-bottom: 8px; background: var(--c-surface-2); font-size: 13px; }
.ret-script, .ai-script { flex-basis: 100%; color: var(--c-text-2); font-style: italic; white-space: pre-wrap; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.switch-row > span { font-size: 14px; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; }
.slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--c-primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.hint { color: var(--c-text-2); font-size: 12px; margin: 8px 0 0; }
.empty { color: var(--c-text-2); font-size: 13px; padding: 14px 0; text-align: center; }

/* ===== 顶部搜索（C6） ===== */
.search-wrap { position: relative; flex: 1 1 auto; max-width: 420px; margin: 0 14px; }
.top-search { width: 100%; padding: 8px 12px; border: 1px solid var(--c-border, #e2e8f0); border-radius: 999px; background: var(--c-bg, #fff); color: var(--c-text, #1f2937); font-size: 14px; }
.top-search:focus { outline: none; border-color: var(--c-primary, #4f46e5); }
.search-suggest { position: absolute; top: 42px; left: 0; right: 0; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 50; overflow: hidden; }
.suggest-item { padding: 9px 14px; font-size: 13px; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.suggest-item:hover { background: #f8fafc; }

/* ===== 悬浮快捷入口（C1） ===== */
#float-add { position: fixed; right: 22px; bottom: 22px; width: 54px; height: 54px; border-radius: 50%; border: none; background: var(--c-primary, #4f46e5); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; box-shadow: 0 6px 18px rgba(79,70,229,.45); z-index: 60; transition: transform .15s; }
#float-add:hover { transform: scale(1.08); }

/* ===== 看板拖拽（C3） ===== */
.kanban-body.drag-over { background: rgba(79,70,229,.08); outline: 2px dashed var(--c-primary, #4f46e5); border-radius: 8px; }
.kanban-item[draggable="true"] { cursor: grab; }

/* ===== AI 下一步（C7） ===== */
.ai-next-box { background: linear-gradient(135deg, #eef2ff, #f5f3ff); border: 1px solid #c7d2fe; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.ai-next-title { font-weight: 600; color: #4338ca; margin-bottom: 4px; }

/* ===== 今日优先（C4） ===== */
.stat-card.clickable { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.stat-card.clickable:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.1); }
.home-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== 营销/报价/集成通用 ===== */
.bar-list { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 10px; background: #f8fafc; border-radius: 8px; }
.bar-name { color: var(--c-text-2, #64748b); }
.bar-val { font-weight: 600; }
.q-item { align-items: flex-end; }
.ai-next-line { font-size: 13px; }
.panel-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px 18px; margin: 8px 0; }

/* ===== 入口徽标 / 返回链接（三门户拆分） ===== */
.entry-badge { display: inline-flex; align-items: center; align-self: flex-start; padding: 4px 12px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; margin-bottom: 16px; }
.entry-platform { background: #e7eeff; color: #2f6bff; }
.entry-enterprise { background: #e3f7f0; color: #15a37f; }
.entry-member { background: #fdf2e0; color: #d98a17; }
.portal-back { display: inline-block; margin-top: 14px; font-size: 12px; color: var(--c-text-3); text-decoration: none; }
.portal-back:hover { color: var(--c-primary); text-decoration: underline; }

/* ===== 门户分发页（index.html） ===== */
.dispatch-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 20px; background: radial-gradient(1200px 520px at 50% -10%, #eef4ff 0%, var(--c-bg) 55%); }
.dispatch-head { text-align: center; max-width: 560px; margin-bottom: 34px; }
.dispatch-logo { justify-content: center; margin-bottom: 18px; }
.dispatch-logo .mark { background: var(--c-primary-grad); color: #fff; }
.dispatch-head h1 { font-size: 28px; margin: 0 0 10px; font-weight: 800; }
.dispatch-head p { margin: 0; color: var(--c-text-2); font-size: 14px; }
.dispatch-cards { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 18px; width: 100%; max-width: 920px; }
.portal-card { display: flex; flex-direction: column; gap: 10px; padding: 26px 22px; border-radius: var(--r-lg);
  background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--sh-md); text-decoration: none;
  color: var(--c-text); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.portal-card:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); }
.card-platform { border-top: 3px solid #2f6bff; }
.card-platform:hover { border-color: #2f6bff; }
.card-enterprise { border-top: 3px solid #15a37f; }
.card-enterprise:hover { border-color: #15a37f; }
.card-member { border-top: 3px solid #d98a17; }
.card-member:hover { border-color: #d98a17; }
.portal-icon { width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.card-platform .portal-icon { background: #e7eeff; }
.card-enterprise .portal-icon { background: #e3f7f0; }
.card-member .portal-icon { background: #fdf2e0; }
.portal-name { font-size: 17px; font-weight: 700; }
.portal-desc { font-size: 13px; color: var(--c-text-2); line-height: 1.6; }
.portal-demo { font-size: 12px; color: var(--c-text-3); background: var(--c-surface-2); border-radius: var(--r-sm);
  padding: 7px 10px; margin-top: 2px; }
.portal-go { margin-top: 4px; font-size: 14px; font-weight: 600; color: var(--c-primary); }
.dispatch-foot { margin-top: 34px; font-size: 12px; color: var(--c-text-3); }
@media (max-width: 720px) {
  .dispatch-cards { grid-template-columns: 1fr; max-width: 420px; }
  .dispatch-head h1 { font-size: 24px; }
}


