/* ============================================================
   你我伙伴社企业务管理系统 V4 · 设计规范
   完全对齐讲师系统：page-header-std / toolbar-std / 无边框card / tag标签 / 微软雅黑
   ============================================================ */
:root {
  --primary: #2563EB;
  --primary-soft: #EFF6FF;
  --accent: #F59E0B;
  --bg: #F3F4F6;
  --card: #FFFFFF;
  --border: #E5E7EB;
  --text: #1F2937;
  --muted: #6B7280;
  --sidebar-w: 220px;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --shadow-lg: 0 10px 30px rgba(16,24,40,.12);
  --green: #16A34A;
  --green-soft: #DCFCE7;
  --red: #DC2626;
  --red-soft: #FEE2E2;
  --amber-soft: #FEF3C7;
  --purple: #7C3AED;
  --purple-soft: #EDE9FE;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }

/* ============ 全局字体：微软雅黑（与讲师系统一致） ============ */
body, button, input, select, textarea, .btn, .btn-sm, .btn-primary, .btn-outline, .btn-danger, .btn-ghost, .table, .input, .tag {
  font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif !important;
}

/* ============ 全局去阴影与聚焦环（讲师系统规范） ============ */
.btn, .btn-sm, .btn-primary, .btn-outline, .btn-danger, .btn-ghost, .icon-btn, .tab-btn, .modal-close, button {
  box-shadow: none !important;
  outline: none !important;
}

/* ============ Material Icons（单色扁平） ============ */
.mi {
  font-family: 'Material Icons Outlined';
  font-weight: normal; font-style: normal;
  font-size: 20px; line-height: 1;
  letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; word-wrap: normal;
  direction: ltr; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  color: inherit;
}
.mi-nav { font-size: 20px; width: 20px; text-align: center; opacity: .85; }
.sidebar-nav a.active .mi-nav { color: var(--primary); opacity: 1; }

/* ============ 布局 ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: #FFFFFF;
  border-right: 1px solid #E5E7EB;
  display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #F9FAFB; }
/* 通栏内容区（与讲师系统一致：无最大宽度限制） */
.content { padding: 22px; width: 100%; }

/* ============ 侧边栏 ============ */
.brand { display: flex; flex-direction: column; align-items: flex-start; padding: 14px 18px 12px; border-bottom: 1px solid #E5E7EB; }
.nav-section { padding: 8px 0 6px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; margin: 2px 8px; border-radius: 6px;
  color: #4B5563; font-size: 14px; cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: #F3F4F6; color: #111827; }
.sidebar-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sidebar-spacer { flex: 1; }

/* ============ 侧边栏底部用户信息（讲师系统规范：姓名+职位+灰退出） ============ */
.sidebar-footer { padding: 16px 20px; border-top: 1px solid #E5E7EB; background: #FFFFFF; }
.user-info { margin-bottom: 10px; }
.btn-logout2 {
  display: block; width: 100%; padding: 7px 0;
  border: 1px solid #E5E7EB; border-radius: 6px; background: #FFFFFF; color: #6B7280;
  font-size: 13px; cursor: pointer; transition: background .15s, color .15s; text-align: center;
  font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
}
.btn-logout2:hover { background: #F9FAFB; color: #111827; }

/* ============ 页面规范：图标+标题 → 分割线 → 内容（讲师系统 page-header-std） ============ */
.page-header-std {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 0 14px; margin-bottom: 16px;
  border-bottom: 1px solid #E5E7EB;
}
.page-header-std .mi { font-size: 20px; color: #1f2937; vertical-align: -4px; }
.page-header-std h2 { margin: 0; font-size: 20px; font-weight: 700; color: #1f2937; }
.page-header-std .spacer { flex: 1; }
.page-header-std .ph-sub { font-size: 12px; color: var(--muted); }

/* 统一工具栏：分割线之下的搜索/筛选/操作按钮行（高度统一 36px） */
.toolbar-std {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 16px;
}
.toolbar-std .input { height: 36px; box-sizing: border-box; }
.toolbar-std .btn { height: 36px; box-sizing: border-box; padding: 0 16px; }

/* ============ 卡片（讲师系统：无边框、8px圆角） ============ */
.card {
  background: #FFFFFF; border: none; border-radius: 8px;
  padding: 16px;
}
.card-title { font-size: 16px; font-weight: 600; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; color: #111827; }
.card-title .mi { font-size: 20px; color: var(--primary); }
.card-sub { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; }

/* ============ 表格（讲师系统：仅横向分隔线、无竖线边框） ============ */
.table { width: 100%; border-collapse: collapse; font-size: 13px; background: #FFFFFF; }
.table th {
  text-align: left; font-size: 12px; color: #6B7280; font-weight: 500;
  padding: 10px 12px; border-bottom: 1px solid #E5E7EB; background: #F9FAFB;
  white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid #F3F4F6; vertical-align: middle; color: #374151; font-size: 13px; line-height: 1.4; }
.table tbody tr:hover { background: #F9FAFB; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td .btn-sm { height: 30px; box-sizing: border-box; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.cell-actions-left { display: flex; gap: 6px; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }

/* ============ 标签（讲师系统 tag：4px圆角，非胶囊） ============ */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 400; white-space: nowrap; }
.tag-blue { background: #EFF6FF; color: #2563EB; }
.tag-green { background: #DCFCE7; color: #16A34A; }
.tag-red { background: #FEE2E2; color: #DC2626; }
.tag-amber { background: #FEF3C7; color: #B45309; }
.tag-gray { background: #F3F4F6; color: #6B7280; }
.tag-purple { background: #EDE9FE; color: #7C3AED; }

/* ============ 按钮（讲师系统：无阴影、雅黑） ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 16px; border-radius: 6px; border: 1px solid #E5E7EB;
  background: #FFFFFF; color: #374151; font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all .15s ease; box-shadow: none;
}
.btn:hover { background: #F9FAFB; border-color: #D1D5DB; }
.btn:active { background: #F3F4F6; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #2563EB; color: #FFFFFF; border-color: #2563EB; box-shadow: none; }
.btn-primary:hover { background: #1D4ED8; border-color: #1D4ED8; box-shadow: none; }
.btn-outline { background: transparent; border: 1px solid #E5E7EB; color: #374151; }
.btn-danger { background: #FEF2F2; color: #DC2626; border-color: #FECACA; box-shadow: none; }
.btn-danger:hover { background: #FEE2E2; }
.btn-ghost { background: transparent; border: none; color: #6B7280; }
.btn-ghost:hover { background: #F3F4F6; color: #111827; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 5px; }
.btn .mi { font-size: 16px; }

/* ============ 输入框 ============ */
.input, select.input, textarea.input {
  width: 100%; padding: 8px 12px; font-size: 14px; font-family: 'Microsoft YaHei', sans-serif;
  border: 1px solid #E5E7EB; border-radius: 6px; background: #FFF; color: var(--text);
  transition: border-color .15s;
  box-shadow: none; outline: none;
}
.input:focus { outline: none; border-color: var(--primary); }

/* ============ KPI 统计卡（讲师系统 kpi-card） ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi-card { background: #fff; border: 1px solid #E5E7EB; border-radius: 10px; padding: 14px 16px; }
.kpi-card .k-label { font-size: 12px; color: #6B7280; display: flex; align-items: center; gap: 6px; }
.kpi-card .k-label .mi { font-size: 17px; color: #2563EB; opacity: .85; }
.kpi-card .k-num { font-size: 24px; font-weight: 700; color: #1F2937; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-card .k-sub { font-size: 11px; color: #9CA3AF; margin-top: 2px; min-height: 14px; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

/* ============ 登录页 ============ */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(160deg, #EBF3FF 0%, #F6F9FF 45%, #EFF6FF 100%);
  padding: 24px;
}
.login-card {
  width: 380px; max-width: 100%;
  background: #FFFFFF; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 28px;
}
.login-card .field { margin-bottom: 14px; }
.login-card .field label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 6px; }
.login-err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 10px; text-align: center; }

/* ============ 空状态（讲师系统：图标+文字，无emoji） ============ */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .em-icon { font-size: 34px; opacity: .6; }
.empty .em-icon .mi { font-size: 34px; }
.empty .em-text { font-size: 14px; margin: 8px 0 14px; }
.muted { color: var(--muted); }

/* ============ 模态框 ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(2px);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 200; padding: 40px 16px; overflow-y: auto;
}
.modal-mask.show { display: flex; }
.modal {
  background: #FFF; border: 1px solid var(--border); border-radius: 14px;
  width: 640px; max-width: 100%;
  max-height: calc(100vh - 80px); display: flex; flex-direction: column;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-title { font-size: 16px; font-weight: 600; color: #111827; }
.modal-close { background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 6px; color: #6B7280; display: grid; place-items: center; }
.modal-close:hover { background: #F3F4F6; color: #111827; }
.modal-close .mi { font-size: 20px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); flex-shrink: 0; }

/* ============ 表单 ============ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-item label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 6px; }
.form-item label .req { color: var(--red); margin-left: 2px; }

/* ============ Toast ============ */
.toast-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #111827; color: #FFF; font-size: 13.5px; padding: 10px 18px;
  border-radius: 8px; box-shadow: var(--shadow-lg); animation: toastIn .2s ease;
  max-width: 90vw;
}
.toast.toast-ok { background: #065F46; }
.toast.toast-err { background: #991B1B; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ============ 阶段 Tab（销售管理） ============ */
.stage-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.st-tab {
  padding: 6px 14px; border-radius: 6px; font-size: 13px; cursor: pointer;
  background: #FFF; border: 1px solid var(--border); color: var(--muted); transition: all .15s;
  font-family: 'Microsoft YaHei', sans-serif;
}
.st-tab:hover { border-color: var(--primary); color: var(--primary); }
.st-tab.on { background: var(--primary); border-color: var(--primary); color: #FFF; font-weight: 500; }

/* ============ 时间线（跟进记录） ============ */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--border); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ''; position: absolute; left: -6px; top: 3px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); border: 2px solid #FFF; box-shadow: 0 0 0 1px var(--border);
}

/* ============ 双列网格 ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }

/* ============ 移动端 ============ */
.scrim { display: none; position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 90; }
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 100; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .scrim.show { display: block; }
  .content { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
