/* ===== 全局 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px; color: #1e293b; background: #f1f5f9;
}
a { color: #2563eb; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}
.login-card {
  width: 360px; background: #fff; border-radius: 12px; padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 4px; color: #0f172a; }
.login-card .sub { text-align: center; color: #64748b; font-size: 13px; margin-bottom: 24px; }
.login-card .field { margin-bottom: 16px; }
.login-card label { display: block; font-size: 13px; color: #475569; margin-bottom: 6px; }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px;
  font-size: 14px; outline: none;
}
.login-card input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.login-card .btn { width: 100%; }
.login-tip { margin-top: 14px; font-size: 12px; color: #94a3b8; text-align: center; line-height: 1.7; }

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; background: #0f172a; color: #cbd5e1; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; flex-shrink: 0;
}
.sidebar .logo { padding: 20px 20px 16px; border-bottom: 1px solid #1e293b; }
.sidebar .logo h2 { font-size: 16px; color: #fff; }
.sidebar .logo p { font-size: 11px; color: #64748b; margin-top: 2px; }
.sidebar nav { flex: 1; padding: 12px 0; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 20px; color: #94a3b8;
  font-size: 14px; border-left: 3px solid transparent;
}
.sidebar nav a:hover { color: #e2e8f0; background: #1e293b; }
.sidebar nav a.active { color: #fff; background: #1e293b; border-left-color: #3b82f6; }
.sidebar .user-box { padding: 14px 20px; border-top: 1px solid #1e293b; font-size: 13px; }
.sidebar .user-box .name { color: #e2e8f0; font-weight: 600; }
.sidebar .user-box .role { color: #64748b; font-size: 12px; }
.sidebar .logout { margin-top: 8px; color: #f87171; font-size: 12px; cursor: pointer; display: inline-block; }
.main { flex: 1; padding: 24px; min-width: 0; }
.page-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: #64748b; font-size: 13px; margin-bottom: 20px; }

/* ===== 卡片与通用 ===== */
.card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(15,23,42,.06); }
.card + .card { margin-top: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border: none; border-radius: 8px; font-size: 14px;
  background: #2563eb; color: #fff; transition: .15s;
}
.btn:hover { background: #1d4ed8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn-green { background: #16a34a; } .btn-green:hover { background: #15803d; }
.btn-red { background: #dc2626; } .btn-red:hover { background: #b91c1c; }
.btn-ghost { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-ghost:hover { background: #e2e8f0; color: #1e293b; }
.btn-gray { background: #64748b; } .btn-gray:hover { background: #475569; }
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
}
.tag-blue { background: #dbeafe; color: #1d4ed8; }
.tag-green { background: #dcfce7; color: #15803d; }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-gray { background: #f1f5f9; color: #64748b; }
.tag-amber { background: #fef3c7; color: #b45309; }
.tag-orange { background: #ffedd5; color: #c2410c; }
.tag-purple { background: #ede9fe; color: #6d28d9; }

/* ===== 表格 ===== */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 10px 12px; font-size: 12px; color: #64748b;
  background: #f8fafc; border-bottom: 1px solid #e2e8f0; white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.table tr:hover td { background: #f8fafc; }
.table .empty { text-align: center; color: #94a3b8; padding: 32px 0; }

/* ===== 统计数字卡 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat-card { background: #fff; border-radius: 10px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(15,23,42,.06); }
.stat-card .label { font-size: 12px; color: #64748b; }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 6px; color: #0f172a; }
.stat-card .value.blue { color: #2563eb; }
.stat-card .value.green { color: #16a34a; }
.stat-card .value.red { color: #dc2626; }
.stat-card .value.amber { color: #d97706; }
.stat-card .value.orange { color: #ea580c; }

/* ===== P0:订单分配 / 线索池 / 团队看板 ===== */
.mini-stat { border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; background: #fff; }
.mini-num { font-size: 22px; font-weight: 700; color: #0f172a; margin: 4px 0 2px; }
.mini-num.red { color: #dc2626; }
.pool-cell {
  display: flex; align-items: center; justify-content: space-between;
  background: #f8fafc; border-radius: 8px; padding: 10px 12px; font-size: 13px;
}
.pool-cell b { font-size: 18px; }
.rowsel { background: #eff6ff !important; }

/* ===== 工作台 ===== */
.wb-grid { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.order-card-big { border: 1px solid #e2e8f0; border-radius: 10px; padding: 22px; }
.order-card-big .o-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.order-card-big .o-name { font-size: 28px; font-weight: 800; }
.order-card-big .o-phone { font-size: 24px; font-weight: 700; color: #0f172a; letter-spacing: 1px; margin: 8px 0 4px; }
.order-card-big .o-meta { color: #334155; font-size: 15px; font-weight: 600; line-height: 1.9; }
.order-card-big .o-product { margin-top: 12px; background: #f8fafc; border-radius: 8px; padding: 13px 15px; font-size: 16px; font-weight: 600; }
.result-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.result-btns .btn { padding: 12px; font-size: 14px; font-weight: 600; }
.wb-side .my-order {
  display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}
.wb-side .my-order:last-child { border-bottom: none; }

/* 回拨待办卡片(网格布局)与 24-48h 高亮 */
.my-order {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 10px;
  background: #f8fafc; font-size: 13px; transition: box-shadow .15s;
}
.my-order:hover { box-shadow: 0 2px 8px rgba(15, 23, 42, .08); }
.my-order.recall-warn {
  background: #fef3c7; border-color: #f59e0b;
  box-shadow: 0 0 0 1px #fbbf24 inset;
}
.my-order.recall-warn:hover { box-shadow: 0 0 0 1px #fbbf24 inset, 0 2px 8px rgba(245, 158, 11, .25); }

/* 回拨待办:最近一次拨打未接通(未接通/忙线/空号)的客户红色高亮,提醒优先回拨 */
.my-order.recall-unreached {
  background: #fef2f2; border-color: #f87171;
  box-shadow: 0 0 0 1px #fca5a5 inset;
}
.my-order.recall-unreached:hover { box-shadow: 0 0 0 1px #f87171 inset, 0 2px 8px rgba(239, 68, 68, .18); }
tr.recall-unreached td { background: #fef2f2 !important; }
tr.recall-unreached:hover td { background: #fee2e2 !important; }

/* 表格行级 24-48h 回拨高亮(合并列表用) */
tr.recall-warn td { background: #fef3c7 !important; }
tr.recall-warn:hover td { background: #fde68a !important; }
.wb-empty { text-align: center; color: #94a3b8; padding: 40px 0; }
.wb-empty .icon { font-size: 40px; margin-bottom: 10px; }

/* ===== 筛选栏 ===== */
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select {
  padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 13px; outline: none;
  background: #fff;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: #2563eb; }
.filter-bar .spacer { flex: 1; }

/* ===== 看板 ===== */
.funnel { display: flex; align-items: flex-end; gap: 40px; padding: 10px 4px; }
.funnel .f-item { text-align: center; }
.funnel .f-bar { width: 70px; border-radius: 6px 6px 0 0; margin: 0 auto; }
.funnel .f-num { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.funnel .f-label { font-size: 12px; color: #64748b; margin-top: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.bar-row .b-label { width: 60px; color: #64748b; flex-shrink: 0; }
.bar-row .b-track { flex: 1; background: #f1f5f9; border-radius: 6px; height: 22px; overflow: hidden; }
.bar-row .b-fill { height: 100%; background: linear-gradient(90deg,#3b82f6,#2563eb); border-radius: 6px; }
.bar-row .b-num { width: 80px; text-align: right; color: #475569; flex-shrink: 0; }
.rank-list .rank-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.rank-item .rank-no { width: 24px; height: 24px; border-radius: 50%; background: #f1f5f9; color: #64748b;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.rank-item:nth-child(1) .rank-no { background: #fef3c7; color: #d97706; }
.rank-item:nth-child(2) .rank-no { background: #e2e8f0; color: #475569; }
.rank-item:nth-child(3) .rank-no { background: #fed7aa; color: #c2410c; }

/* 客服排行对比(双指标条) */
.rank-item-cmp { align-items: stretch; }
.rank-bar-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; }
.rank-bar-row .rk-label { width: 30px; color: #94a3b8; flex-shrink: 0; }
.rank-bar-row .b-track { flex: 1; background: #f1f5f9; border-radius: 4px; height: 10px; overflow: hidden; }
.rank-bar-row .b-fill { height: 100%; border-radius: 4px; }
.rank-bar-row .rk-val { width: 34px; text-align: right; color: #475569; font-weight: 600; flex-shrink: 0; }

/* 分段切换按钮(趋势天数 / 排行今日累计) */
.seg { display: inline-flex; background: #f1f5f9; border-radius: 8px; padding: 2px; gap: 2px; }
.seg-btn { padding: 4px 12px; font-size: 12px; color: #64748b; border-radius: 6px; cursor: pointer;
  user-select: none; transition: all .15s; }
.seg-btn:hover { color: #334155; }
.seg-btn.on { background: #fff; color: #1d4ed8; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ===== 进度/提示 ===== */
.progress-wrap { display: flex; align-items: center; gap: 12px; }
.progress { flex: 1; height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress .fill { height: 100%; background: #3b82f6; border-radius: 999px; transition: width .3s; }
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 13px; z-index: 999; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  opacity: 0; transition: .25s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.err { background: #b91c1c; }

/* ===== 二期:表单字段 / 弹窗 / 分页 ===== */
.card .field { margin-bottom: 14px; }
.card .field label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.card .field input, .card .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 8px;
  font-size: 13px; outline: none; background: #fff; box-sizing: border-box;
}
.card .field input:focus, .card .field textarea:focus { border-color: #2563eb; }
.card .field .hint { font-size: 12px; color: #94a3b8; margin-top: 5px; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 12px; padding: 20px; width: 100%; max-width: 480px;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.modal-title { font-size: 15px; font-weight: 600; color: #1e293b; margin-bottom: 14px; }
.form-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.form-row label { width: 70px; flex: none; font-size: 13px; color: #475569; }
.form-row input, .form-row select {
  flex: 1; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 8px;
  font-size: 13px; outline: none; background: #fff;
}
.form-row input:focus, .form-row select:focus { border-color: #2563eb; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding-top: 14px; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .wb-grid { grid-template-columns: 1fr; }
  .sidebar { width: 64px; }
  .sidebar .logo h2, .sidebar .logo p, .sidebar nav a span, .sidebar .user-box { display: none; }
  .sidebar nav a { justify-content: center; padding: 14px 0; }
  .main { padding: 16px; }
}
