/* ============================================================
   荣匠集团 CRM — 管理员端通用样式（轻量自研，无第三方依赖）
   ============================================================ */
:root {
  --c-primary: #211cd0;
  --c-primary-dark: #1b17b8;
  --c-sidebar: #1e293b;
  --c-sidebar-hover: #334155;
  --c-bg: #f1f5f9;
  --c-border: #e2e8f0;
  --c-text: #0f172a;
  --c-text-2: #475569;
  --c-text-3: #94a3b8;
  --c-danger: #dc2626;
  --c-success: #16a34a;
  --c-warning: #d97706;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-bg);
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.admin-layout { display: flex; height: 100vh; }
.sidebar {
  width: 216px; flex: 0 0 216px;
  background: var(--c-sidebar);
  color: #cbd5e1;
  display: flex; flex-direction: column;
}
.sidebar .brand {
  height: 56px; display: flex; align-items: center;
  padding: 0 18px; gap: 10px;
  color: #fff; font-size: 16px; font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar .brand img { display: block; }
.sidebar .menu { flex: 1; overflow-y: auto; padding: 10px 0; }
/* 侧边栏滚动条美化：细、半透明、贴合深色侧栏 */
.sidebar .menu { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.sidebar .menu::-webkit-scrollbar { width: 6px; }
.sidebar .menu::-webkit-scrollbar-track { background: transparent; }
.sidebar .menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 3px; }
.sidebar .menu::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.3); }
.sidebar .menu-group {
  padding: 10px 18px 4px;
  font-size: 11px; color: #64748b; letter-spacing: 1px;
}
.sidebar .menu-item {
  display: block; padding: 10px 18px;
  color: #cbd5e1; cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar .menu-item:hover { background: var(--c-sidebar-hover); color: #fff; text-decoration: none; }
.sidebar .menu-item.active {
  background: var(--c-primary); color: #fff;
}
.sidebar .foot {
  padding: 14px 18px; font-size: 12px; color: #64748b;
  border-top: 1px solid rgba(255,255,255,.06);
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.topbar .crumb { color: var(--c-text-2); }
.topbar .user { display: flex; align-items: center; gap: 12px; }
.topbar .user .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--c-primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.content { flex: 1; overflow-y: auto; padding: 18px; }

/* ---------- 卡片 ---------- */
.card {
  background: #fff; border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card .card-title {
  font-size: 15px; font-weight: 600; margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--c-border);
}

/* ---------- 表格 ---------- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
  font-size: 13px;
}
.data-table th { background: #f8fafc; color: var(--c-text-2); font-weight: 600; white-space: nowrap; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table .actions { white-space: nowrap; }

/* 员工列表：按部门分组行 */
.dept-row td { background: #f1f5f9; color: #1e293b; font-weight: 600; padding: 8px 12px; }
.dept-row.dept-sub td { background: #f8fafc; color: #475569; font-weight: 500; }
.dept-row.dept-unassigned td { background: #fffbeb; color: #92400e; }
.dept-row .dept-icon { margin-right: 6px; opacity: .6; }
.dept-row .dept-meta { font-weight: 400; color: #64748b; margin-left: 10px; font-size: 12px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 14px; border-radius: 6px; border: 1px solid transparent;
  font-size: 13px; cursor: pointer; transition: opacity .15s;
  background: #fff; color: var(--c-text);
}
.btn:hover { opacity: .85; text-decoration: none; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-outline { border-color: var(--c-border); background: #fff; color: var(--c-text-2); }
.btn-block { width: 100%; }
.btn + .btn { margin-left: 8px; }

/* ---------- 表单 ---------- */
.form { max-width: 560px; }
.form-item { margin-bottom: 16px; }
.form-item label {
  display: block; margin-bottom: 6px; font-size: 13px; color: var(--c-text-2);
}
.form-item .required::before { content: '*'; color: var(--c-danger); margin-right: 3px; }
.input, .select {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--c-border);
  border-radius: 6px; font-size: 13px; color: var(--c-text);
  background: #fff; outline: none; transition: border-color .15s;
}
.textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--c-border);
  border-radius: 6px; font-size: 13px; color: var(--c-text);
  background: #fff; outline: none; transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--c-primary); }
.textarea { resize: vertical; min-height: 80px; }

/* ---------- 单选（勾选卡片，通用） ----------
   用法：容器 .seg-select[data-name=字段名] + 选项 .seg-option[data-value]
   每个选项 = 带边框 + 勾选圈的盒子；选中 = 蓝边框 + 对勾高亮
   配合 zadmin.segSelect(容器, onChange) / zadmin.segSelectSet(容器, 值) 使用
*/
.seg-select { display: inline-flex; gap: 10px; flex-wrap: wrap; }
.seg-select .seg-option {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 28px 9px 14px; border: 1.5px solid #cbd5e1; border-radius: 8px;
  cursor: pointer; background: #fff; color: var(--c-text-2); font-size: 14px;
  transition: border-color .15s, background .15s; user-select: none;
}
.seg-select .seg-option:hover { border-color: #b3aef0; }
.seg-select .seg-option.active { border-color: var(--c-primary); background: #eeedfb; color: var(--c-primary-dark); font-weight: 600; }
.seg-select .seg-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid #cbd5e1; background: #fff;
  font-size: 12px; color: transparent; flex: none;
  transition: background .15s, border-color .15s;
}
.seg-select .seg-option.active .seg-check { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.seg-check svg { width: 12px; height: 12px; display: block; }

/* ---------- 徽标 / 标签 ---------- */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 12px; background: #eeedfb; color: var(--c-primary);
}
.tag-green { background: #f0fdf4; color: var(--c-success); }
.tag-red { background: #fef2f2; color: var(--c-danger); }
.tag-gray { background: #f1f5f9; color: var(--c-text-2); }
.tag-orange { background: #fffbeb; color: var(--c-warning); }
.tag-blue { background: #eeedfb; color: #211cd0; }
.tag-purple { background: #faf5ff; color: #9333ea; }
.tag-yellow { background: #fefce8; color: #ca8a04; }
/* 标签颜色：red/orange/yellow/green/blue/gray/black */
.tag-c-red { background: #fef2f2; color: #dc2626; }
.tag-c-orange { background: #fffbeb; color: #d97706; }
.tag-c-yellow { background: #fefce8; color: #ca8a04; }
.tag-c-green { background: #f0fdf4; color: #16a34a; }
.tag-c-blue { background: #eeedfb; color: #211cd0; }
.tag-c-gray { background: #f1f5f9; color: #64748b; }
.tag-c-black { background: #f4f4f5; color: #18181b; }
/* 成熟度颜色：A+红 → E/F 灰 */
.tag-m-a-plus { background: #fee2e2; color: #b91c1c; }
.tag-m-a { background: #fee2e2; color: #dc2626; }
.tag-m-b-plus { background: #ffedd5; color: #c2410c; }
.tag-m-b { background: #fef3c7; color: #b45309; }
.tag-m-c-plus { background: #fef9c3; color: #a16207; }
.tag-m-c { background: #ecfccb; color: #4d7c0f; }
.tag-m-d { background: #dcfce7; color: #15803d; }
.tag-m-e { background: #f1f5f9; color: #64748b; }
.tag-m-f { background: #f1f5f9; color: #94a3b8; }

/* 拖拽排序 */
.drag-handle { cursor: grab; color: #94a3b8; margin-right: 6px; user-select: none; }
tr.dragging { opacity: .5; background: #eeedfb; }

/* ---------- 统计卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card {
  background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.stat-card .num { font-size: 26px; font-weight: 700; color: var(--c-primary); }
.stat-card .label { font-size: 13px; color: var(--c-text-2); margin-top: 4px; }

/* ---------- 分页 / 提示 ---------- */
.pagination { margin-top: 14px; display: flex; justify-content: flex-end; gap: 6px; font-size: 13px; list-style: none; padding-left: 0; }
.pagination li { list-style: none; }
.pagination li::before, .pagination li::after { content: none; }
.pagination a, .pagination span {
  padding: 4px 10px; border: 1px solid var(--c-border); border-radius: 4px; color: var(--c-text-2);
}
.pagination .current { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.empty { text-align: center; color: var(--c-text-3); padding: 40px 0; }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: none; align-items: center; justify-content: center; z-index: 1000;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius); width: 420px; max-width: 92vw;
  box-shadow: 0 10px 40px rgba(15,23,42,.2);
}
.modal .modal-head { padding: 14px 18px; font-weight: 600; border-bottom: 1px solid var(--c-border); }
.modal .modal-body { padding: 18px; }
.modal .modal-foot { padding: 12px 18px; text-align: right; border-top: 1px solid var(--c-border); }

/* ---------- 登录页 ---------- */
.login-bg {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
}
.login-body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(33,28,208,.35), transparent 60%),
    radial-gradient(900px 500px at 90% 110%, rgba(124,58,237,.28), transparent 55%),
    #0f172a;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.login-box {
  position: relative; z-index: 1;
  width: 380px; max-width: 92vw; background: #fff;
  border-radius: 14px; padding: 36px 32px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-foot.outer { z-index: 1; }
.login-box .login-brand { text-align: center; margin-bottom: 24px; }
.login-box .login-brand img { display: block; margin: 0 auto 12px; }
.login-box .login-brand p { font-size: 13px; color: var(--c-text-3); margin-top: 4px; }
.login-box .form-item { margin-bottom: 16px; }
.login-box .input { height: 42px; padding: 0 14px; font-size: 14px; }
.login-box .btn-block { height: 42px; }
.login-foot { text-align: center; color: var(--c-text-3); font-size: 12px; margin-top: 20px; }
.login-foot.outer { position: fixed; bottom: 16px; left: 0; right: 0; margin-top: 0; color: #64748b; }

/* ---------- 公共工具类（原散落在各模板内，统一收敛到这里） ---------- */
.muted { color: #94a3b8; }

/* 胶囊 Tab 导航 */
.tabs { display: inline-flex; gap: 2px; background: #eef2f7; border: 1px solid #e2e8f0; border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.tabs a { padding: 8px 24px; font-size: 14px; font-weight: 600; color: #64748b; border-radius: 7px; cursor: pointer; text-decoration: none; transition: all .15s ease; }
.tabs a:hover { color: #1b17b8; background: #fff; }
.tabs a.active { background: #211cd0; color: #fff; box-shadow: 0 2px 8px rgba(33,28,208,.35); }

/* 管理端/只读标记 */
.admin-badge { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 600; color: #211cd0; background: #eeedfb; border: 1px solid #c9c5f1; border-radius: 4px; padding: 1px 8px; vertical-align: middle; }

/* 掉公海预警文案 */
.warn { font-size: 12px; }
.warn-remind { color: #d97706; font-weight: 600; }
.warn-overdue { color: #dc2626; font-weight: 700; }

/* 全屏 iframe 弹窗骨架屏（客户详情 / 录客资等） */
.detail-skeleton { flex: 1; padding: 18px; display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.detail-skeleton .sk { background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%); background-size: 400% 100%; animation: skload 1.3s ease infinite; border-radius: 6px; }
.detail-skeleton .sk-big { height: 92px; }
.detail-skeleton .sk-line { height: 16px; }
.detail-skeleton .sk-cards { display: flex; gap: 10px; flex-wrap: wrap; }
.detail-skeleton .sk-card { width: 150px; height: 56px; }
@keyframes skload { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
