* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #4f6ef7;
  --primary-light: #eef1fe;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-sub: #6b7280;
  --radius: 10px;
}

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ============ 登录页 ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f6ef7 0%, #7c3aed 100%);
}
.login-box {
  background: #fff;
  padding: 40px;
  border-radius: 16px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-box h1 { font-size: 22px; text-align: center; margin-bottom: 8px; }
.login-sub { text-align: center; color: var(--text-sub); margin-bottom: 28px; font-size: 13px; }
.form-item { margin-bottom: 16px; }
.form-item label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.form-item input, .form-item select, .form-item textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--primary); }
.form-item textarea { resize: vertical; min-height: 70px; }
.login-err { color: var(--danger); font-size: 13px; text-align: center; margin-top: 12px; min-height: 20px; }
.login-divider { display: flex; align-items: center; margin: 16px 0; color: var(--text-sub); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-divider span { padding: 0 12px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-block;
  padding: 9px 18px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: opacity .2s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn + .btn { margin-left: 8px; }

/* ============ 布局 ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: #1e293b;
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.logo { padding: 20px 18px; font-size: 16px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.1); }
.nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: block;
  padding: 12px 20px;
  color: #cbd5e1;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  transition: background .2s;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.1); }
.user-info { margin-bottom: 10px; }
.user-info #user-name { display: block; font-weight: 600; }
.user-role { font-size: 12px; color: #94a3b8; }

.main { flex: 1; padding: 24px; overflow-y: auto; }
.page { display: none; }
.page.active { display: block; }
.page h2 { margin-bottom: 20px; font-size: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-head h2 { margin-bottom: 0; }

/* ============ 卡片 ============ */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.card h3 { margin-bottom: 16px; font-size: 16px; }

/* ============ 统计卡片 ============ */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.stat-card .stat-num { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.stat-card .stat-label { color: var(--text-sub); font-size: 13px; }
.stat-card.accent .stat-num { color: var(--primary); }
.stat-card.warn .stat-num { color: var(--warning); }
.stat-card.danger .stat-num { color: var(--danger); }

/* ============ 表格 ============ */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.table th { background: #f9fafb; font-weight: 600; color: var(--text-sub); white-space: nowrap; }
.table tr:hover td { background: #fafbfe; }
.table .link-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 标签 ============ */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag-red { background: #fee2e2; color: #dc2626; }
.tag-orange { background: #ffedd5; color: #ea580c; }
.tag-green { background: #dcfce7; color: #16a34a; }
.tag-blue { background: #dbeafe; color: #2563eb; }
.tag-gray { background: #f3f4f6; color: #6b7280; }
.tag-purple { background: #ede9fe; color: #7c3aed; }

/* ============ 筛选 ============ */
.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filters select, .filters input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none;
}

/* ============ 评价看板 ============ */
.review-summary { display: flex; gap: 20px; margin-bottom: 16px; }
.review-summary .sum-item { background: var(--bg); padding: 14px 20px; border-radius: 8px; }
.review-summary .sum-item b { display: block; font-size: 22px; }
.review-summary .sum-item span { font-size: 12px; color: var(--text-sub); }

/* ============ 分类 ============ */
.category-layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; }
.category-tree-box, .category-detail-box { min-height: 400px; }
.tree-item { padding: 6px 8px; cursor: pointer; border-radius: 6px; }
.tree-item:hover { background: var(--primary-light); }
.tree-item.active { background: var(--primary); color: #fff; }
.tree-item .tree-children { margin-left: 18px; }
.tree-toggle { cursor: pointer; margin-right: 4px; color: var(--text-sub); }

/* ============ 工具库 ============ */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.tool-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.tool-card h4 { margin-bottom: 6px; font-size: 15px; }
.tool-card .tool-type { display: inline-block; margin-bottom: 8px; }
.tool-card .tool-desc { color: var(--text-sub); font-size: 13px; margin-bottom: 12px; min-height: 36px; }
.tool-card .tool-imgs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tool-card .tool-imgs img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; cursor: pointer; }
.tool-card .tool-actions { display: flex; gap: 5px; flex-wrap: nowrap; }
.tool-card .tool-actions .btn { padding: 4px 8px; font-size: 12px; border-radius: 6px; white-space: nowrap; flex-shrink: 0; }

/* ============ 每日打卡 ============ */
.task-date { color: var(--text-sub); font-size: 14px; }
.task-hint { background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.shop-task-card { background: var(--card); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.shop-task-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.shop-task-head h4 { font-size: 15px; }
.shop-task-progress { font-size: 13px; color: var(--text-sub); }
.task-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.task-btn { padding: 8px 16px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: #fff; font-size: 13px; transition: all .2s; }
.task-btn.done { background: #dcfce7; border-color: var(--success); color: #16a34a; font-weight: 600; }

/* ============ 模态框 ============ */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 14px; padding: 24px; width: 520px; max-height: 85vh; overflow-y: auto; }
.modal h3 { margin-bottom: 20px; font-size: 18px; }
.modal .form-item { margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-lg { width: 680px; }

/* ============ 图片预览 ============ */
.img-preview-list { display: flex; gap: 8px; flex-wrap: wrap; }
.img-preview-list img { width: 70px; height: 70px; object-fit: cover; border-radius: 6px; }
.img-upload-btn { width: 70px; height: 70px; border: 2px dashed var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-sub); font-size: 24px; }

/* ============ Toast ============ */
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 12px 24px; border-radius: 8px; z-index: 200; opacity: 0; transition: opacity .3s; pointer-events: none; }
.toast.show { opacity: 1; }

/* ============ 空状态 ============ */
.empty { text-align: center; color: var(--text-sub); padding: 40px 0; }

/* ============ 商品ID / 复制 ============ */
.goods-id {
  display: inline-block;
  font-family: "SF Mono", "Consolas", monospace;
  background: #eef1fe;
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.goods-id:hover { background: #dbe4fe; }
.copy-link {
  display: inline-block;
  background: #f3f4f6;
  color: var(--text);
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  margin: 2px;
  white-space: nowrap;
}
.copy-link:hover { background: #e5e7eb; }

/* 补单计划单元格 */
.plan-cell { font-size: 12px; color: var(--text-sub); max-width: 220px; }
.mini-bar { display: inline-block; width: 60px; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; vertical-align: middle; margin-left: 4px; }
.mini-bar span { display: block; height: 100%; border-radius: 3px; transition: width .3s; }

/* ============ 资料分类 ============ */
.tree-count { float: right; background: #eef1fe; color: var(--primary); font-size: 11px; padding: 0 6px; border-radius: 10px; }
.tree-item.active .tree-count { background: rgba(255,255,255,0.3); color: #fff; }
.category-link-item { padding: 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; }
.cat-link-head { display: flex; justify-content: space-between; align-items: center; }
.cat-img { width: 70px; height: 70px; object-fit: cover; border-radius: 6px; margin: 4px; cursor: pointer; }
.cat-link-actions { display: flex; gap: 6px; margin-top: 8px; }
.img-wrap { position: relative; display: inline-block; }
.img-wrap img { width: 70px; height: 70px; object-fit: cover; border-radius: 6px; }
.img-del { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; background: var(--danger); color: #fff; border-radius: 50%; text-align: center; line-height: 18px; cursor: pointer; font-size: 12px; }
.form-tip { font-size: 12px; color: var(--text-sub); margin-top: 4px; }

/* ============ 关键词分平台分学段 ============ */
.keyword-platforms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) { .keyword-platforms { grid-template-columns: 1fr; } }
.kw-platform { border: 2px solid #e5e7eb; border-radius: 12px; overflow: hidden; background: var(--card); }
.kw-platform-head { padding: 12px 16px; color: #fff; display: flex; justify-content: space-between; align-items: center; }
.kw-platform-name { font-weight: 700; font-size: 16px; }
.btn-xs { padding: 3px 10px; font-size: 12px; border-radius: 6px; background: rgba(255,255,255,0.9); color: #333; border: none; cursor: pointer; }
.kw-stage-list { padding: 12px; }
.stage-block { margin-bottom: 10px; }
.stage-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.stage-title { font-size: 13px; font-weight: 700; }
.stage-count { display: inline-block; background: rgba(0,0,0,0.08); font-size: 11px; padding: 0 6px; border-radius: 10px; font-weight: 600; }
.btn-copy { background: rgba(255,255,255,0.9); }
.kw-more { margin-top: 6px; width: 100%; }
.kw-hidden { display: none; }
.kw-platform-count { display: inline-block; background: rgba(255,255,255,0.25); font-size: 11px; padding: 0 6px; border-radius: 10px; font-weight: 600; margin-left: 4px; }
.stage-小学 .stage-title { color: #16a34a; }
.stage-初中 .stage-title { color: #2563eb; }
.stage-高中 .stage-title { color: #7c3aed; }
.stage-全学段 .stage-title { color: #ea580c; }
.stage-小学 { background: #f0fdf4; border-radius: 8px; padding: 10px; }
.stage-初中 { background: #eff6ff; border-radius: 8px; padding: 10px; }
.stage-高中 { background: #f5f3ff; border-radius: 8px; padding: 10px; }
.stage-全学段 { background: #fff7ed; border-radius: 8px; padding: 10px; }
.kw-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.kw-tag {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
}
.kw-tag em { font-style: normal; color: #f59e0b; font-size: 11px; margin-left: 4px; }
.kw-ops { margin-left: 6px; color: var(--text-sub); }
.kw-ops span { margin: 0 2px; }
.kw-ops span:hover { color: var(--danger); }
.kw-empty { color: #c0c4cc; font-size: 12px; }

/* ============ 岗位打卡 ============ */
.role-task-card { background: var(--card); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.role-task-head { margin-bottom: 12px; }
.role-task-head h4 { font-size: 15px; margin-bottom: 6px; }
.role-boards { display: flex; gap: 6px; flex-wrap: wrap; }
.aftersale-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.aftersale-item { background: var(--bg); border-radius: 8px; padding: 12px; }
.aftersale-item label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.aftersale-item input { width: 80px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
.unit { font-size: 12px; color: var(--text-sub); margin-left: 4px; }
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.work-item { background: var(--bg); border-radius: 8px; padding: 12px; }
.work-item label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.work-item input { width: 80px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
.check-group { display: flex; gap: 12px; flex-wrap: wrap; }
.check-label { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: normal; }

/* ============ 演示角色选择 ============ */
.role-pick {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all .2s;
}
.role-pick:hover { border-color: var(--primary); background: var(--primary-light); }
.role-pick b { display: block; font-size: 15px; margin-bottom: 4px; }
.role-pick span { font-size: 12px; color: var(--text-sub); }

/* ============ 首页店铺总览 ============ */
.shop-overview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .shop-overview-grid { grid-template-columns: 1fr; } }
.shop-overview-platform { border: 2px solid #e5e7eb; border-radius: 10px; overflow: hidden; }
.sop-head { padding: 10px 14px; color: #fff; font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.sop-head b { font-size: 18px; }
.sop-body { padding: 8px 12px; max-height: 220px; overflow-y: auto; }
.sop-row { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.sop-row:last-child { border-bottom: none; }
.sop-name { font-weight: 600; font-size: 13px; }
.sop-price { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.sop-account { font-weight: 400; font-size: 12px; color: var(--text-sub); margin-left: 6px; }
.sop-type { display: inline-block; font-size: 11px; color: #7c3aed; background: #ede9fe; padding: 0 6px; border-radius: 4px; margin-left: 6px; }
.sop-empty { color: #c0c4cc; font-size: 12px; text-align: center; padding: 16px 0; }

/* ============ 首页销售额 ============ */
.sales-date { color: var(--text-sub); font-size: 13px; margin-bottom: 12px; }
.sales-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.sales-item { background: var(--bg); border-radius: 8px; padding: 12px 16px; }
.sales-item label { display: block; font-size: 12px; color: var(--text-sub); margin-bottom: 4px; }
.sales-item b { font-size: 20px; }
.sales-edit { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; padding: 12px; background: #f9fafb; border-radius: 8px; font-size: 13px; }
.sales-edit span { display: inline-flex; align-items: center; gap: 6px; }
.sales-edit input { width: 90px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* 分店铺销售额行 */
.sales-shop-row { display: block; }
.sales-shop-edit { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.sales-shop-input { width: 110px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.sales-shop-unit { font-size: 12px; color: var(--text-sub); }
.sales-shop-val { font-size: 15px; font-weight: 700; color: var(--primary); }
.sales-shop-week { font-size: 12px; color: var(--text-sub); margin-left: auto; }

/* ============ 售后话术 ============ */
.script-group { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.script-group-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.script-group-head h4 { font-size: 15px; }
.script-item { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.script-content { font-size: 13px; line-height: 1.6; margin-bottom: 10px; white-space: pre-wrap; }
.script-actions { display: flex; gap: 8px; }

/* ============ 按店铺填工作量 ============ */
.shop-work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.work-item-wide { grid-column: span 1; }
.work-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.work-row span { display: inline-flex; align-items: center; gap: 4px; }
.work-row input { width: 70px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* ============ 自动回复文档 ============ */
.auto-reply-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 700px) { .auto-reply-grid { grid-template-columns: 1fr; } }
.auto-reply-card { border: 2px solid #e5e7eb; border-radius: 10px; overflow: hidden; }
.arc-head { padding: 10px 14px; color: #fff; font-weight: 600; font-size: 14px; }
.arc-body { padding: 14px; }
.arc-file { font-size: 13px; margin-bottom: 12px; word-break: break-all; }
.arc-empty { color: #c0c4cc; font-size: 13px; margin-bottom: 12px; }
.arc-actions { display: flex; gap: 8px; }

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .nav-item { padding: 12px; text-align: center; font-size: 0; }
  .sidebar .nav-item::before { font-size: 20px; }
  .category-layout { grid-template-columns: 1fr; }
}
