/* ==========================================================================
   招生线索管理系统 · 样式（视觉令牌取自 PRD 7.1「现代 SaaS」）
   ========================================================================== */
:root {
  --bg-base: #f7f8fb;
  --surface: #ffffff;
  --surface-subtle: #f2f4f8;
  --border: #e3e7ef;
  --border-strong: #c9d0dc;
  --primary: #2f6bff;
  --primary-hover: #1f55e0;
  --primary-soft: #eaf0ff;
  --success: #12a150;
  --success-soft: #e7f7ee;
  --warning: #d9820a;
  --warning-soft: #fdf3e3;
  --danger: #dc3b36;
  --danger-soft: #fdeceb;
  --text-primary: #151a23;
  --text-secondary: #5a6472;
  --text-tertiary: #8b94a3;
  --text-disabled: #b7bec9;
  --focus-ring: #2f6bff;
  --grad-brand: linear-gradient(135deg, #2f6bff, #6e4bff);
  --grad-head: linear-gradient(90deg, rgba(47, 107, 255, 0.1) 0%, rgba(110, 75, 255, 0.04) 60%, rgba(255, 255, 255, 0) 100%);
  --sidenav-bg: #161b26;
  --sidenav-bg-2: #1e2533;
  --sidenav-fg: #e7ebf2;
  --sidenav-fg-dim: #98a2b3;
  --sidenav-hover: rgba(255, 255, 255, 0.07);
  --sidenav-active: rgba(47, 107, 255, 0.2);
  --sidenav-border: rgba(255, 255, 255, 0.08);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 6px 16px rgba(16, 24, 40, 0.08), 0 2px 6px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 18px 44px rgba(16, 24, 40, 0.16), 0 4px 12px rgba(16, 24, 40, 0.08);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --sidebar-w: 232px;
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-x: hidden;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text-primary); }
::placeholder { color: var(--text-tertiary); }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidenav-bg), var(--sidenav-bg-2));
  color: var(--sidenav-fg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--sidenav-border);
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--grad-brand);
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px; color: #fff;
  box-shadow: 0 4px 12px rgba(47, 107, 255, 0.35);
}
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: 0.2px; }
.brand-sub { font-size: 11px; color: var(--sidenav-fg-dim); margin-top: 2px; }
.nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav-group { font-size: 11px; color: var(--sidenav-fg-dim); padding: 14px 10px 6px; letter-spacing: 0.6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--radius-md);
  color: var(--sidenav-fg-dim);
  font-size: 13.5px; cursor: pointer; user-select: none;
  border-left: 2px solid transparent;
  transition: background 160ms ease-out, color 160ms ease-out;
}
.nav-item:hover { background: var(--sidenav-hover); color: var(--sidenav-fg); }
.nav-item.active { background: var(--sidenav-active); color: #fff; border-left-color: var(--primary); }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; opacity: 0.9; }
.nav-badge {
  margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 10px;
  background: rgba(47, 107, 255, 0.25); color: #bcd0ff;
}
.sidebar-foot { padding: 14px 16px; border-top: 1px solid var(--sidenav-border); font-size: 11px; color: var(--sidenav-fg-dim); line-height: 1.6; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; gap: 14px;
  padding: 0 26px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 600; }
.topbar .sub { font-size: 12px; color: var(--text-tertiary); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
}
.user-meta { line-height: 1.25; }
.user-meta b { font-size: 13px; font-weight: 600; display: block; }
.user-meta span { font-size: 11px; color: var(--text-tertiary); }
.content { padding: 22px 26px 40px; max-width: 1480px; width: 100%; margin: 0 auto; }

/* ---------- 通用 ---------- */
.muted { color: var(--text-secondary); }
.tiny { font-size: 12px; color: var(--text-tertiary); }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; } .mb16 { margin-bottom: 16px; }
.hidden { display: none !important; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-hd {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-hd h2 { margin: 0; font-size: 14px; font-weight: 600; }
.card-hd .tiny { margin-left: auto; }
.card-bd { padding: 16px 18px; }
.card-bd.flush { padding: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-primary);
  font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
}
.btn:hover { background: var(--surface-subtle); border-color: var(--border-strong); }
.btn:disabled { color: var(--text-disabled); background: var(--surface-subtle); cursor: not-allowed; border-color: var(--border); }
.btn-primary { background: var(--grad-brand); color: #fff; border-color: transparent; }
.btn-primary:hover { filter: brightness(1.06); background: var(--grad-brand); }
.btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn-danger:hover { background: #c3322d; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); padding: 0 8px; }
.btn-ghost:hover { background: var(--primary-soft); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.btn:focus-visible, .nav-item:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; line-height: 18px; white-space: nowrap;
  background: var(--surface-subtle); color: var(--text-secondary);
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge.pending { background: var(--primary-soft); color: var(--primary); }
.badge.following { background: var(--warning-soft); color: var(--warning); }
.badge.released { background: var(--danger-soft); color: var(--danger); }
.badge.converted { background: var(--success-soft); color: var(--success); }
.badge.tracked { background: var(--success-soft); color: var(--success); }
.badge.overdue { background: var(--danger-soft); color: var(--danger); }
.badge.neutral { background: var(--surface-subtle); color: var(--text-secondary); }
.badge.dup { background: var(--warning-soft); color: var(--warning); }
.badge.soft { background: var(--primary-soft); color: var(--primary); }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
  background: var(--surface);
}
.login-hero {
  background: linear-gradient(160deg, #161b26 0%, #1e2533 55%, #22304d 100%);
  color: #fff; padding: 56px 60px; display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.login-hero::after {
  content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  right: -180px; bottom: -220px;
  background: radial-gradient(circle, rgba(47, 107, 255, 0.45), rgba(110, 75, 255, 0) 65%);
}
.login-hero .brand { border: 0; padding: 0; }
.login-hero h2 { font-size: 30px; line-height: 1.35; margin: 72px 0 14px; font-weight: 600; letter-spacing: 0.5px; }
.login-hero p { color: #b9c2d4; font-size: 14px; line-height: 1.9; max-width: 420px; margin: 0; }
.login-points { margin-top: 40px; display: grid; gap: 14px; position: relative; z-index: 1; }
.login-point { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: #dbe3f5; }
.login-point i {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 7px;
  background: rgba(47, 107, 255, 0.22); color: #9fbaff;
  display: grid; place-items: center; font-style: normal; font-size: 12px;
}
.login-panel { display: grid; place-items: center; padding: 40px; }
.login-box { width: 360px; }
.login-box h3 { font-size: 22px; margin: 0 0 6px; }
.login-box .muted { font-size: 13px; }
.login-box form { margin-top: 26px; }
.login-tip {
  margin-top: 22px; padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--surface-subtle); color: var(--text-secondary); font-size: 12.5px; line-height: 1.8;
}
.login-tip b { color: var(--text-primary); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 6px; }
.field label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 11px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); outline: none;
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
}
.textarea { height: auto; min-height: 88px; padding: 9px 11px; resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.14);
}
.input:disabled, .select:disabled { background: var(--surface-subtle); color: var(--text-tertiary); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.form-error { color: var(--danger); font-size: 12.5px; min-height: 18px; margin-top: 4px; }

/* ---------- 录入表单 ---------- */
.intake-form .form-section { padding: 18px 22px; border-bottom: 1px dashed var(--border); }
.intake-form .form-section:last-of-type { border-bottom: 0; }
.form-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; margin-bottom: 14px;
}
.form-section-title::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--primary); }
.form-section-title span { font-weight: 400; color: var(--text-tertiary); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.form-grid.cols4 { grid-template-columns: repeat(4, 1fr); }
.tf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.tf-item {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-subtle, #fafbfc);
}
.tf-item span { color: var(--text-tertiary); font-size: 12px; min-width: 56px; }
.tf-item b { color: var(--text-primary); font-weight: 500; word-break: break-all; }
.form-grid .field:last-child { margin-bottom: 0; }
.form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; background: var(--surface-subtle);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.course-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.course-opt {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); font-size: 12.5px; color: var(--text-secondary);
  cursor: pointer; user-select: none;
  transition: border-color 160ms ease-out, background 160ms ease-out, color 160ms ease-out;
}
.course-opt::before {
  content: ""; width: 14px; height: 14px; flex: 0 0 14px;
  border: 1.5px solid var(--border-strong); border-radius: 4px;
  background: var(--surface); transition: background 160ms ease-out, border-color 160ms ease-out;
}
.course-opt:hover { border-color: var(--border-strong); background: var(--surface-subtle); }
.course-opt.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.course-opt.on::before {
  content: "✓"; display: grid; place-items: center;
  background: var(--primary); border-color: var(--primary);
  color: #fff; font-size: 10px; line-height: 1;
}
@media (max-width: 1180px) {
  .form-grid, .form-grid.cols4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .form-grid, .form-grid.cols4 { grid-template-columns: 1fr; }
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }.chip {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 20px;
  background: var(--surface); font-size: 12.5px; color: var(--text-secondary); cursor: pointer;
  transition: all 160ms ease-out;
}
.chip:hover { border-color: var(--border-strong); }
.chip.on { background: var(--primary-soft); border-color: rgba(47, 107, 255, 0.4); color: var(--primary); font-weight: 500; }

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-grid.cols5 { grid-template-columns: repeat(5, 1fr); }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .label { font-size: 12.5px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.stat .num { font-size: 28px; font-weight: 650; margin-top: 8px; letter-spacing: 0.4px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.stat.accent .num { color: var(--primary); }
.stat.warn .num { color: var(--warning); }
.stat.danger .num { color: var(--danger); }
.stat.ok .num { color: var(--success); }
.stat::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px;
  border-radius: 50%; background: var(--primary-soft); opacity: 0.55;
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--text-secondary);
  background: var(--surface-subtle); padding: 10px 14px; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
th:first-child { border-top-left-radius: 0; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #fafbfe; }
tbody tr:last-child td { border-bottom: 0; }
td.nowrap, th.nowrap { white-space: nowrap; }
td .name { font-weight: 500; }
td .sub { font-size: 11.5px; color: var(--text-tertiary); margin-top: 2px; }
.change-cell { max-width: 220px; }
.fee-cell { min-width: 120px; }
.change-line { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.mini-table th, .mini-table td { padding: 8px 12px; font-size: 12px; }

/* ---------- 线索卡片列表 ---------- */
.lead-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 16px; }
.lead-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-left-width: 3px; border-radius: 12px; box-shadow: var(--shadow-sm);
}
.lead-card.status-pending { background: #f2f7ff; border-color: #dce7fb; border-left-color: var(--primary); }
.lead-card.status-following { background: #fffaf1; border-color: #f3e3c6; border-left-color: var(--warning); }
.lead-card.status-overdue { background: #fff5f4; border-color: #f5d5d2; border-left-color: var(--danger); }
.lead-card.status-released { background: #f7f8fa; border-color: #e3e7ef; border-left-color: var(--text-disabled); }
.lead-card.status-converted { background: #f2fbf5; border-color: #cdebd9; border-left-color: var(--success); }
.lc-head { display: flex; align-items: flex-start; gap: 8px; }
.lc-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.lc-name { font-size: 15px; font-weight: 600; }
.lc-actions { margin-left: auto; display: flex; gap: 6px; flex: 0 0 auto; }
.lc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 12px; color: var(--text-tertiary); }
.lc-meta .mono { color: var(--text-secondary); }
.lc-count { padding: 1px 8px; border-radius: 20px; background: var(--primary-soft); color: var(--primary); font-size: 11.5px; }
.lc-follows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.lc-follows.single { grid-template-columns: 1fr; }
.fu-card { min-width: 0; padding: 8px 10px; background: rgba(255, 255, 255, 0.82); border: 1px solid rgba(16, 24, 40, 0.04); border-radius: 8px; }
.fu-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; font-size: 11.5px; color: var(--text-tertiary); }
.fu-text {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 12.5px; line-height: 1.6; color: var(--text-secondary);
}
.fu-empty { grid-column: 1 / -1; padding: 10px 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.7); font-size: 12px; color: var(--text-tertiary); }
.lc-more { font-size: 11.5px; color: var(--text-tertiary); }
.lc-more button { padding: 0; border: 0; background: none; color: var(--primary); font-size: 11.5px; cursor: pointer; }
.lc-more button:hover { text-decoration: underline; }
@media (max-width: 1200px) {
  .lead-cards { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .lc-follows { grid-template-columns: 1fr; }
}
.empty { padding: 46px 20px; text-align: center; color: var(--text-tertiary); font-size: 13px; }
.empty .big { font-size: 26px; display: block; margin-bottom: 8px; opacity: 0.5; }

.pager { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.pager .info { font-size: 12px; color: var(--text-tertiary); margin-right: auto; }
.pager button {
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 12px; color: var(--text-secondary);
}
.pager button.on { background: var(--primary-soft); border-color: rgba(47, 107, 255, 0.35); color: var(--primary); font-weight: 600; }
.pager button:disabled { color: var(--text-disabled); cursor: not-allowed; }

/* ---------- 筛选条 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.filters .input, .filters .select { width: auto; min-width: 130px; height: 34px; }
.filters .search { min-width: 220px; flex: 1; max-width: 320px; }
.filters .spacer { flex: 1; }
.filters.stacked { flex-direction: column; align-items: stretch; gap: 10px; }
.filter-line { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 10px; width: 100%; }
.filter-label { flex: 0 0 64px; padding-top: 6px; font-size: 12.5px; color: var(--text-tertiary); white-space: nowrap; }
.filters.stacked .chips { gap: 6px; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 16px 12px; }
.tl-item::before {
  content: ""; position: absolute; left: -18px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong);
}
.tl-item.hi::before { border-color: var(--primary); background: var(--primary-soft); }
.tl-hd { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; }
.tl-hd b { font-size: 13px; }
.tl-body { margin-top: 6px; font-size: 13px; color: var(--text-secondary); line-height: 1.7; }
.tl-time { font-size: 11.5px; color: var(--text-tertiary); }

/* ---------- 抽屉 / 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, 0.32);
  z-index: 90; display: flex; justify-content: flex-end;
  animation: fade 160ms ease-out;
}
.mask.center { justify-content: center; align-items: center; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  width: 620px; max-width: 94vw; height: 100%; background: var(--surface);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slideIn 180ms ease-out;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.drawer-hd { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 12px; }
.drawer-hd h3 { margin: 0; font-size: 17px; }
.drawer-hd .tiny { margin-top: 4px; }
.drawer-bd { padding: 18px 22px 28px; overflow-y: auto; flex: 1; }
.drawer-ft { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; background: var(--surface); }
.x-btn {
  margin-left: auto; width: 30px; height: 30px; border-radius: var(--radius-sm);
  border: 0; background: transparent; cursor: pointer; color: var(--text-tertiary); font-size: 18px; line-height: 1;
}
.x-btn:hover { background: var(--surface-subtle); color: var(--text-primary); }

.modal {
  width: 520px; max-width: 92vw; max-height: 88vh; background: var(--surface);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: pop 160ms ease-out;
}
.modal.wide { width: 720px; }
@keyframes pop { from { transform: scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-hd { padding: 18px 22px 12px; display: flex; align-items: center; }
.modal-hd h3 { margin: 0; font-size: 16px; }
.modal-bd { padding: 4px 22px 8px; overflow-y: auto; }
.modal-ft { padding: 14px 22px 18px; display: flex; justify-content: flex-end; gap: 10px; }

.kv { display: grid; grid-template-columns: 92px 1fr; gap: 9px 12px; font-size: 13px; }
.kv dt { color: var(--text-tertiary); font-size: 12.5px; }
.kv dd { margin: 0; color: var(--text-primary); word-break: break-all; }

.notice {
  padding: 10px 13px; border-radius: var(--radius-md);
  background: var(--warning-soft); color: #8a5405; font-size: 12.5px; line-height: 1.7;
  border: 1px solid rgba(217, 130, 10, 0.18);
}
.notice.info { background: var(--primary-soft); color: #23479e; border-color: rgba(47, 107, 255, 0.18); }
.notice.danger { background: var(--danger-soft); color: #9c2823; border-color: rgba(220, 59, 54, 0.18); }

/* ---------- 提示 ---------- */
#toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; }
.toast {
  min-width: 220px; max-width: 460px; padding: 10px 16px; border-radius: var(--radius-md);
  background: #1f2937; color: #fff; font-size: 13px; box-shadow: var(--shadow-md);
  animation: fade 160ms ease-out;
  display: flex; gap: 8px; align-items: center;
}
.toast.ok { background: #0f7a3d; }
.toast.err { background: #b3271f; }
.toast.warn { background: #9a5c05; }

/* ---------- 图表 ---------- */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 130px; padding: 6px 2px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bar-stack { display: flex; align-items: flex-end; gap: 4px; height: 100%; width: 100%; justify-content: center; }
.bar { width: 11px; border-radius: 3px 3px 0 0; background: var(--primary); min-height: 2px; transition: height 300ms ease-out; }
.bar.alt { background: #b9c9ef; }
.bar-x { font-size: 11px; color: var(--text-tertiary); }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-secondary); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

.hbar { display: grid; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: 110px 1fr 36px; gap: 10px; align-items: center; font-size: 12.5px; }
.hbar-track { height: 7px; border-radius: 4px; background: var(--surface-subtle); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #2f6bff, #6e4bff); }
.hbar-num { text-align: right; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* ---------- 录入 ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); padding: 0 4px; }
.tabs-wrap { flex-wrap: wrap; row-gap: 0; }
.tab {
  padding: 11px 16px; font-size: 13.5px; color: var(--text-secondary); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; user-select: none;
}
.tab:hover { color: var(--text-primary); }
.tab.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; background: var(--primary-soft); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.tab-count {
  display: inline-block; margin-left: 5px; padding: 0 5px;
  border-radius: 8px; background: var(--surface-subtle);
  color: var(--text-tertiary); font-size: 11px; line-height: 16px;
}
.tab.on .tab-count { background: rgba(47, 107, 255, 0.14); color: var(--primary); }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 26px; text-align: center; color: var(--text-secondary); font-size: 13px;
  background: var(--surface-subtle); cursor: pointer; transition: all 160ms ease-out;
}
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone b { color: var(--primary); }

.page-head { margin-bottom: 18px; display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 19px; font-weight: 600; }
.page-head p { margin: 6px 0 0; color: var(--text-secondary); font-size: 13px; }
.page-head .spacer { flex: 1; }

.clock {
  display: inline-flex; align-items: baseline; gap: 10px;
  padding: 6px 14px; margin-right: 4px;
  background: var(--primary-soft);
  border: 1px solid rgba(47, 107, 255, 0.16);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
.clock::before {
  content: ""; align-self: center; width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 0 3px rgba(18, 161, 80, 0.14);
}
.clock b {
  font-size: 20px; font-weight: 700; letter-spacing: 1px; line-height: 1.05;
  font-variant-numeric: tabular-nums; color: var(--primary);
}
.clock span {
  font-size: 20px; color: var(--text-secondary); letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
}
.section-title { font-size: 13px; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--primary); }

.tip-line { font-size: 12px; color: var(--text-tertiary); line-height: 1.7; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid.cols5 { grid-template-columns: repeat(3, 1fr); }
  .grid3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 68px; }
  .brand-name, .brand-sub, .nav-item span.txt, .sidebar-foot, .nav-group { display: none; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .nav-badge { display: none; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar .sub { display: none; }
  .drawer { width: 100vw; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .stat-grid, .stat-grid.cols5 { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: 78px 1fr; }
  .clock { padding: 5px 10px; gap: 6px; }
  .clock b { font-size: 19px; }
  .clock span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- 移动端（手机） ---------- */
.icon-btn {
  display: none;
  width: 36px; height: 36px; flex: 0 0 36px;
  align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text-primary);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.nav-overlay { display: none; }
body.nav-open { overflow: hidden; }

/* 下拉刷新提示 */
.ptr {
  position: fixed; left: 0; right: 0; top: 56px; height: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  z-index: 45; pointer-events: none;
  font-size: 12px; color: var(--text-secondary);
  background: linear-gradient(180deg, var(--bg-base), rgba(247, 248, 251, 0));
  transition: height 120ms ease-out;
}
.ptr.on { color: var(--primary); }
.ptr-ico { display: inline-block; font-size: 14px; }
.ptr.loading .ptr-ico { animation: ptr-spin 800ms linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* 移动端底部导航 */
.mobile-tabs { display: none; }
.me-head { display: flex; align-items: center; gap: 12px; padding: 6px 0 16px; border-bottom: 1px solid var(--border); }
.me-head .avatar { width: 44px; height: 44px; font-size: 18px; }
.me-head b { font-size: 15px; }
.me-list { margin-top: 4px; }
.me-item {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 14px 2px; background: none; border: 0; border-bottom: 1px solid var(--border);
  font-size: 14px; color: var(--text-primary); cursor: pointer; text-align: left;
}
.me-item:last-child { border-bottom: 0; }
.me-item.danger { color: var(--danger); }
.me-arrow { color: var(--text-tertiary); font-size: 18px; line-height: 1; }

@media (max-width: 640px) {
  .mobile-menu { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 256px; flex-basis: 256px; height: 100vh; height: 100dvh;
    transform: translateX(-105%);
    transition: transform 220ms ease-out;
    z-index: 70;
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.28);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.45); z-index: 60;
  }
  .brand-name, .brand-sub, .nav-item span.txt, .sidebar-foot, .nav-group { display: block; }
  .nav-item { justify-content: flex-start; padding: 11px 12px; font-size: 14px; }
  .nav-badge { display: inline-block; }
  .main { width: 100%; }

  .topbar { height: 56px; padding: 0 12px; gap: 10px; }
  .topbar h1 { font-size: 15px; }
  .topbar-right { gap: 8px; }
  .topbar-right .user-meta, .topbar-right .avatar { display: none; }
  .topbar-right .btn { height: 32px; padding: 0 10px; font-size: 12px; }

  .content { padding: 12px 12px calc(80px + env(safe-area-inset-bottom)); }
  .mobile-tabs {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(10px);
  }
  .mtab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 3px 0; border: 0; background: none; cursor: pointer;
    font-size: 11px; color: var(--text-tertiary); text-decoration: none;
  }
  .mtab-ico { font-size: 17px; line-height: 1.15; }
  .mtab.on { color: var(--primary); font-weight: 600; }
  .page-head { align-items: flex-start; gap: 10px; margin-bottom: 14px; }
  .page-head h2 { font-size: 18px; }
  .page-head p { font-size: 12.5px; line-height: 1.65; }
  .page-head .clock { order: 5; }
  .clock { padding: 4px 10px; gap: 6px; }
  .clock b { font-size: 16px; }
  .clock span { display: none; }

  .card { border-radius: 10px; }
  .card-hd { padding: 12px 14px; }
  .stat-grid, .stat-grid.cols5 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .label { font-size: 12px; }
  .stat .num { font-size: 22px; margin-top: 4px; }
  .stat .sub { font-size: 11.5px; }

  .lead-cards { grid-template-columns: 1fr; padding: 12px; gap: 12px; }
  .filters { padding: 12px; gap: 8px; }
  .filters .search { min-width: 0; max-width: none; flex: 1 1 100%; }
  .filters .input, .filters .select { height: 38px; }
  .filters.stacked { gap: 8px; }
  .filter-line { gap: 6px 8px; }
  .filter-label { width: auto; }

  .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; padding: 10px 12px; }

  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 720px; }
  .table-wrap th:first-child, .table-wrap td:first-child {
    position: sticky; left: 0; z-index: 2; background: var(--surface);
    box-shadow: 1px 0 0 var(--border);
  }
  th, td { padding: 9px 10px; }

  .grid2, .grid3 { grid-template-columns: 1fr; }
  .form-grid, .form-grid.cols4 { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .stat-grid[style*="grid-template-columns"] { grid-template-columns: 1fr 1fr !important; }
  .stat-grid.cols5 .stat:last-child:nth-child(odd) { grid-column: span 2; }
  .intake-form .form-section { padding: 14px; }
  .form-actions { padding: 12px 14px; position: sticky; bottom: 0; background: var(--surface); z-index: 5; }
  input, select, textarea { font-size: 16px !important; }

  .modal, .modal.wide { width: calc(100vw - 20px); max-height: 92vh; }
  .modal-hd { padding: 16px 16px 10px; }
  .modal-bd { padding: 0 16px 8px; }
  .modal-ft { padding: 12px 16px 16px; flex-wrap: wrap; }
  .modal-ft .btn { flex: 1 1 auto; }

  .drawer { width: 100vw; }
  .drawer-hd, .drawer-bd, .drawer-ft { padding-left: 16px; padding-right: 16px; }
  .drawer-ft { flex-wrap: wrap; }
  .drawer-ft .btn { flex: 1 1 auto; }

  .kv { grid-template-columns: 76px 1fr; font-size: 12.5px; }
  .tf-grid { grid-template-columns: 1fr; }

  .login-panel { padding: 24px 16px; }
  .login-box { width: 100%; max-width: 360px; }
  .login-wrap { display: block; }
  .login-panel { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 28px 20px; }
  .login-box { width: 100%; max-width: 380px; }
}

@media (max-width: 380px) {
  .topbar-right .btn { padding: 0 8px; font-size: 11.5px; }
  .stat .num { font-size: 20px; }
}
