:root {
  --primary: #4f46e5;
  --primary-light: #e0e7ff;
  --primary-dark: #3730a3;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  font-size: 14px;
  line-height: 1.6;
}

/* ====== 登录页 ====== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px 36px;
  width: 420px; max-width: 90vw; box-shadow: var(--shadow-lg);
}
.login-brand {
  text-align: center; margin-bottom: 24px;
}
.login-logo {
  width: 72px; height: 72px; margin-bottom: 12px; object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
}
.login-card h1 { font-size: 22px; text-align: center; margin-bottom: 8px; color: var(--gray-900); }
.login-card .subtitle { text-align: center; color: var(--gray-500); margin-bottom: 28px; font-size: 14px; }
.login-card .form-group { margin-bottom: 16px; }
.login-card label { display: block; font-size: 13px; color: var(--gray-700); margin-bottom: 6px; font-weight: 500; }
.login-card input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--gray-300); border-radius: 8px;
  font-size: 14px; outline: none; transition: border 0.2s;
}
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
/* 密码框小眼睛切换 */
.pwd-box { position: relative; }
.pwd-box input { padding-right: 42px; }
.pwd-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 6px 8px;
  font-size: 16px; line-height: 1; opacity: .4; transition: opacity .15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.pwd-eye:hover { opacity: .8; }
.pwd-eye.on { opacity: 1; }
.pwd-eye svg { display: block; }
.login-card .btn-login {
  width: 100%; padding: 11px; background: var(--primary); color: #fff; border: none;
  border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: background 0.2s; margin-top: 8px;
}
.login-card .btn-login:hover { background: var(--primary-dark); }
.login-card .error { background: var(--danger-light); color: var(--danger); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.login-card .success-banner { background: var(--success-light); color: #065f46; padding: 14px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; line-height: 1.6; text-align: center; }
.login-card .notice { background: #fef3c7; color: #92400e; padding: 10px 14px; border-radius: 8px; margin: 12px 0; font-size: 12px; }
.login-card .login-footer { text-align: center; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--gray-200); font-size: 13px; color: var(--gray-500); }
.login-card .login-footer a { color: var(--primary); text-decoration: none; font-weight: 500; }
.login-card .login-footer a:hover { text-decoration: underline; }
.login-card .demo { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--gray-200); font-size: 12px; color: var(--gray-500); }
.login-card .demo p { margin-bottom: 4px; }

/* ====== 布局 ====== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--gray-900); color: #fff; padding: 0;
  position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 100;
  display: flex; flex-direction: column;
  transition: transform 0.3s;
}
.sidebar-header { padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; }
.sidebar-logo { width: 36px; height: 36px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; flex-shrink: 0; }
.sidebar-header h2 { font-size: 16px; color: #fff; line-height: 1.2; }
.sidebar-header .role-badge { font-size: 11px; color: var(--gray-300); margin-top: 4px; }
.sidebar-header .role-badge a.portal-switch { color: inherit; text-decoration: none; cursor: pointer; transition: color 0.15s; }
.sidebar-header .role-badge a.portal-switch:hover { color: #fff; text-decoration: underline; }
.sidebar .sidebar-footer a.portal-switch { color: var(--gray-400); }
.sidebar .sidebar-footer a.portal-switch:hover { color: #fff; }
.sidebar nav { padding: 8px 0; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 20px;
  color: rgba(255,255,255,0.65); text-decoration: none; font-size: 14px; transition: all 0.15s;
}
.sidebar nav a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.sidebar nav a.active { color: #fff; background: rgba(255,255,255,0.12); border-left: 3px solid var(--primary); }
.sidebar nav a .icon { font-size: 18px; width: 24px; text-align: center; }
.sidebar .sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); margin-top: auto; }
.sidebar .sidebar-footer .user-info { font-size: 13px; color: rgba(255,255,255,0.8); }
.sidebar .sidebar-footer .logout { font-size: 12px; color: var(--gray-500); margin-top: 8px; display: inline-block; text-decoration: none; }
.sidebar .sidebar-footer .logout:hover { color: var(--danger); }

.main-content {
  flex: 1; margin-left: 220px; padding: 24px 28px;
  min-width: 0;
}
.main-content .page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.main-content .page-header h1 { font-size: 20px; color: var(--gray-900); }
.main-content .page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ====== 卡片/面板 ====== */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card h3 { font-size: 15px; color: var(--gray-700); margin-bottom: 12px; }

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.stat-card .stat-label { font-size: 13px; color: var(--gray-500); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); }
.stat-card .stat-value .unit { font-size: 14px; font-weight: 400; color: var(--gray-500); margin-left: 4px; }
.stat-card .stat-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 12px; margin-top: 6px; }
.stat-card.blue .stat-value { color: var(--primary); }
.stat-card.green .stat-value { color: var(--success); }
.stat-card.orange .stat-value { color: var(--warning); }
.stat-card.red .stat-value { color: var(--danger); }

/* ====== 迷你统计卡片（CEO 工作台） ====== */
.stat-card-mini { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 12px 16px; border-left: 3px solid var(--gray-300); transition: box-shadow 0.15s; }
.stat-card-mini:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.stat-card-mini .stat-label { font-size: 12px; color: var(--gray-500); margin-bottom: 4px; }
.stat-card-mini .stat-value-mini { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.stat-card-mini.blue { border-left-color: var(--primary); }
.stat-card-mini.blue .stat-value-mini { color: var(--primary); }
.stat-card-mini.green { border-left-color: var(--success); }
.stat-card-mini.green .stat-value-mini { color: var(--success); }
.stat-card-mini.orange { border-left-color: var(--warning); }
.stat-card-mini.orange .stat-value-mini { color: var(--warning); }
.stat-card-mini.red { border-left-color: var(--danger); }
.stat-card-mini.red .stat-value-mini { color: var(--danger); }

/* ====== 表格 ====== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th { text-align: left; padding: 10px 12px; background: var(--gray-50); color: var(--gray-500); font-weight: 600; border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
table tr:hover td { background: var(--gray-50); }

/* ====== 按钮 ====== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border: none; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-100); border-color: var(--gray-400); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ====== 徽章/标签 ====== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-pending { background: var(--gray-100); color: var(--gray-500); }
.badge-accepted { background: var(--primary-light); color: var(--primary-dark); }
.badge-processing { background: var(--warning-light); color: #92400e; }
.badge-reviewing { background: #dbeafe; color: #1e40af; }
.badge-completed { background: var(--success-light); color: #065f46; }
.badge-late { background: var(--danger-light); color: var(--danger); }
.badge-normal { background: var(--success-light); color: #065f46; }
.badge-absent { background: var(--danger-light); color: var(--danger); }
.badge-remote { background: var(--primary-light); color: var(--primary-dark); }
.badge-leave { background: var(--warning-light); color: #92400e; }
.badge-out { background: #dbeafe; color: #1e40af; }
.badge-urgent { background: var(--danger-light); color: var(--danger); }
.badge-high { background: var(--warning-light); color: #92400e; }
.badge-normal-pri { background: var(--gray-100); color: var(--gray-500); }
.badge-low { background: var(--gray-50); color: var(--gray-500); }

/* ====== 表单 ====== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--gray-700); margin-bottom: 5px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 8px;
  font-size: 14px; outline: none; transition: border 0.2s; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-group textarea { min-height: 80px; resize: vertical; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* ====== 模态框 ====== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 500px; max-width: 92vw; max-height: 85vh; overflow-y: auto; }
.modal h2 { font-size: 18px; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ====== 任务看板 ====== */
.task-board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.task-col h3 { font-size: 13px; color: var(--gray-700); margin-bottom: 10px; padding: 8px 12px; border-radius: 8px; background: var(--gray-50); display: flex; justify-content: space-between; align-items: center; }
.task-col h3 .count { background: var(--gray-200); color: var(--gray-700); padding: 1px 8px; border-radius: 10px; font-size: 11px; }
.task-card { background: #fff; border-radius: 8px; box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px; border-left: 3px solid var(--gray-300); cursor: pointer; transition: box-shadow 0.15s; }
.task-card:hover { box-shadow: var(--shadow-lg); }
.task-card .task-title { font-size: 14px; font-weight: 500; margin-bottom: 6px; color: var(--gray-900); }
.task-card .task-meta { font-size: 12px; color: var(--gray-500); display: flex; flex-wrap: wrap; gap: 8px; }
.task-card .task-due { color: var(--danger); }
.task-card .task-due.normal { color: var(--gray-500); }
.task-card.priority-urgent { border-left-color: var(--danger); }
.task-card.priority-high { border-left-color: var(--warning); }
.task-card.priority-normal { border-left-color: var(--gray-300); }
.task-card.priority-low { border-left-color: var(--gray-200); }

/* ====== 筛选栏 ====== */
.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar select, .filter-bar input { padding: 7px 12px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 13px; outline: none; }

/* ====== Toast ====== */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--gray-900); color: #fff; padding: 12px 20px; border-radius: 8px; box-shadow: var(--shadow-lg); z-index: 300; display: none; font-size: 14px; }
.toast.show { display: block; animation: slideUp 0.3s ease; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ====== 空状态 ====== */
.empty { text-align: center; padding: 40px; color: var(--gray-500); }
.empty .icon { font-size: 40px; margin-bottom: 12px; opacity: 0.3; }

/* ====== 时间线 ====== */
.timeline { padding-left: 20px; border-left: 2px solid var(--gray-200); }
.timeline-item { position: relative; padding: 0 0 16px 20px; }
.timeline-item::before { content: ''; position: absolute; left: -27px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; }
.timeline-item .timeline-time { font-size: 12px; color: var(--gray-500); }
.timeline-item .timeline-content { font-size: 13px; color: var(--gray-700); margin-top: 2px; }

/* ====== 岗位职责 ====== */
.role-overview-bar {
  display: flex; align-items: center; gap: 24px; background: #fff;
  border-radius: var(--radius); padding: 16px 24px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.role-overview-item { display: flex; flex-direction: column; gap: 4px; }
.role-overview-label { font-size: 12px; color: var(--gray-500); }
.role-overview-value { font-size: 20px; font-weight: 700; color: var(--gray-900); }
.role-overview-divider { width: 1px; height: 32px; background: var(--gray-200); }

.roles-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px; padding-bottom: 20px;
}
.role-card {
  background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow); transition: box-shadow 0.2s, transform 0.2s;
  border: 1px solid var(--gray-200);
}
.role-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.role-card-header {
  padding: 16px 20px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--gray-100);
}
.role-card-title-area { display: flex; align-items: center; gap: 12px; }
.role-card-avatar {
  width: 44px; height: 44px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 18px; font-weight: 700;
  color: #fff; flex-shrink: 0;
}
.role-card-title { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.role-card-person { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.role-card-status {
  display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px;
}
.role-status-online { background: var(--success-light); color: #065f46; }
.role-status-offline { background: var(--gray-100); color: var(--gray-500); }
.role-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.role-dot-online { background: var(--success); animation: rolePulse 2s infinite; }
.role-dot-offline { background: var(--gray-300); }
@keyframes rolePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.role-card-body { padding: 16px 20px; }
.role-card-section { margin-bottom: 16px; }
.role-card-section:last-child { margin-bottom: 0; }
.role-card-section-title {
  font-size: 12px; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.role-resp-list { list-style: none; padding: 0; margin: 0; }
.role-resp-item {
  font-size: 13px; color: var(--gray-700); padding: 6px 0;
  display: flex; align-items: flex-start; gap: 8px; line-height: 1.5;
}
.role-resp-bullet {
  width: 6px; height: 6px; border-radius: 50%; background: var(--primary);
  margin-top: 7px; flex-shrink: 0;
}
.role-collab-list { display: flex; flex-wrap: wrap; gap: 6px; }
.role-collab-chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px;
  padding: 4px 10px; border-radius: 16px; background: var(--primary-light);
  color: var(--primary-dark); font-weight: 500;
}
.role-collab-chip .collab-name { font-weight: 600; }
.role-collab-chip .collab-role { font-size: 11px; opacity: 0.7; }
.role-card-time {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--gray-700); padding: 10px 14px; background: var(--gray-50);
  border-radius: 8px; margin-top: 12px;
}
.role-card-time-icon { font-size: 16px; }
.role-card-time strong { color: var(--gray-900); }
.role-card-footer {
  padding: 10px 20px; border-top: 1px solid var(--gray-100);
  display: flex; justify-content: flex-end; gap: 8px;
}
.role-card-edit-btn, .role-card-del-btn {
  font-size: 12px; padding: 4px 10px; border-radius: 6px; border: none;
  cursor: pointer; transition: background 0.2s;
}
.role-card-edit-btn { background: var(--primary-light); color: var(--primary-dark); }
.role-card-edit-btn:hover { background: var(--primary); color: #fff; }
.role-card-del-btn { background: var(--danger-light); color: var(--danger); }
.role-card-del-btn:hover { background: var(--danger); color: #fff; }
.loading-placeholder { text-align: center; padding: 40px; color: var(--gray-500); grid-column: 1 / -1; }
.empty-placeholder { text-align: center; padding: 60px 20px; color: var(--gray-500); grid-column: 1 / -1; }
.empty-placeholder .empty-icon { font-size: 48px; margin-bottom: 12px; }

/* 岗位员工卡片（链路）*/
.role-section-target { color: var(--primary-dark) !important; }
.role-section-collab { color: var(--gray-700) !important; }
.role-users-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.role-user-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border-radius: 10px;
  background: var(--gray-50); border: 1px solid var(--gray-200);
  transition: all 0.2s;
}
.role-user-card.user-online {
  background: var(--success-light); border-color: #6ee7b7;
}
.role-user-card.user-offline {
  background: var(--gray-50); border-color: var(--gray-200);
  opacity: 0.85;
}
.role-user-card:hover {
  transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.role-user-card .user-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; flex-shrink: 0;
}
.role-user-card.user-online .user-avatar { background: var(--success); }
.role-user-card.user-offline .user-avatar { background: var(--gray-500); }
.role-user-card .user-info { flex: 1; min-width: 0; }
.role-user-card .user-name {
  font-size: 14px; font-weight: 700; color: var(--gray-900);
  margin-bottom: 2px;
}
.role-user-card .user-pos {
  font-size: 12px; color: var(--gray-500); margin-bottom: 6px;
}
.role-user-card .user-online-row {
  display: flex; align-items: center; gap: 6px; margin-bottom: 4px;
}
.role-user-card .user-online-text {
  font-size: 12px; font-weight: 600;
}
.role-user-card .text-online { color: #065f46; }
.role-user-card .text-offline { color: var(--gray-500); }
.role-user-card .user-online-desc {
  font-size: 11px; color: var(--gray-500); margin-bottom: 6px;
}
.role-user-card .user-contact {
  font-size: 12px; color: var(--gray-700);
  padding-top: 6px; border-top: 1px dashed var(--gray-200);
  line-height: 1.6;
}
.role-collab-group {
  margin-bottom: 10px; padding: 8px 10px;
  background: var(--gray-50); border-radius: 8px;
  border-left: 3px solid var(--primary);
}
.role-collab-group .role-collab-label {
  font-size: 12px; font-weight: 600; color: var(--primary-dark);
  margin-bottom: 8px;
}
.role-no-user {
  font-size: 12px; color: var(--gray-500);
  padding: 10px 12px; background: var(--gray-50);
  border-radius: 6px; border: 1px dashed var(--gray-300);
}

/* ====== 客户与商务管理 ====== */
.client-overview-bar {
  display: flex; align-items: center; gap: 24px; background: #fff;
  border-radius: var(--radius); padding: 16px 24px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.client-overview-item { display: flex; flex-direction: column; gap: 4px; }
.client-overview-label { font-size: 12px; color: var(--gray-500); }
.client-overview-value { font-size: 20px; font-weight: 700; color: var(--gray-900); }
.client-overview-divider { width: 1px; height: 32px; background: var(--gray-200); }
.client-filter-bar {
  display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
  align-items: center;
}
.client-filter-bar input, .client-filter-bar select {
  padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 8px;
  font-size: 13px; outline: none; background: #fff; transition: border 0.2s;
}
.client-filter-bar input:focus, .client-filter-bar select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.client-table-wrap {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; overflow-x: auto;
}
.client-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.client-table th {
  background: var(--gray-50); padding: 12px 14px; text-align: left;
  font-weight: 600; color: var(--gray-500); white-space: nowrap;
  border-bottom: 1px solid var(--gray-200); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.client-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700); vertical-align: middle;
}
.client-table tr { cursor: pointer; transition: background 0.15s; }
.client-table tr:hover { background: var(--gray-50); }
.client-name-cell { font-weight: 600; color: var(--gray-900); }
.client-opp-code { font-size: 12px; color: var(--primary); font-weight: 600; }
.stage-badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.stage-gray { background: var(--gray-100); color: var(--gray-500); }
.stage-blue { background: #dbeafe; color: #1e40af; }
.stage-cyan { background: #cffafe; color: #0e7490; }
.stage-amber { background: var(--warning-light); color: #92400e; }
.stage-orange { background: #ffedd5; color: #9a3412; }
.stage-indigo { background: var(--primary-light); color: var(--primary-dark); }
.stage-green { background: var(--success-light); color: #065f46; }
.stage-teal { background: #ccfbf1; color: #115e59; }
.stage-yellow { background: #fef9c3; color: #854d0e; }
.stage-red { background: var(--danger-light); color: var(--danger); }
.market-chip {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600; margin-right: 4px;
}
.market-US { background: #dbeafe; color: #1e40af; }
.market-BR { background: #dcfce7; color: #166534; }
.market-MX { background: #fef3c7; color: #92400e; }
.market-other { background: var(--gray-100); color: var(--gray-500); }
/* 客户详情 */
.client-detail-header {
  display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
}
/* Detail page tabs */
.detail-tab {
  padding: 10px 20px; border: none; background: none; cursor: pointer;
  font-size: 14px; color: var(--gray-500); border-bottom: 2px solid transparent;
  transition: all 0.2s; white-space: nowrap;
}
.detail-tab:hover { color: var(--gray-700); }
.detail-tab.active {
  color: var(--primary); border-bottom-color: var(--primary); font-weight: 600;
}
.client-detail-back {
  padding: 6px 12px; border: 1px solid var(--gray-300); border-radius: 8px;
  background: #fff; cursor: pointer; font-size: 13px; color: var(--gray-700);
  transition: all 0.2s; white-space: nowrap;
}
.client-detail-back:hover { border-color: var(--primary); color: var(--primary); }
.client-detail-title { font-size: 20px; font-weight: 700; color: var(--gray-900); }
.client-detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px;
}
.client-info-card {
  background: #fff; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow);
}
.client-info-card h3 {
  font-size: 14px; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--gray-100);
}
.client-info-row {
  display: flex; gap: 12px; padding: 6px 0; font-size: 13px;
  border-bottom: 1px solid var(--gray-50);
}
.client-info-label { color: var(--gray-500); min-width: 80px; }
.client-info-value { color: var(--gray-900); font-weight: 500; flex: 1; }
.client-contact-card {
  background: #fff; border-radius: var(--radius); padding: 12px 16px;
  margin-bottom: 8px; box-shadow: var(--shadow); display: flex;
  align-items: center; gap: 12px;
}
.client-contact-name { font-weight: 600; color: var(--gray-900); font-size: 14px; }
.client-contact-pos { font-size: 12px; color: var(--gray-500); }
.client-contact-info { font-size: 12px; color: var(--gray-700); margin-top: 2px; }
.client-contact-actions { margin-left: auto; display: flex; gap: 6px; }
.opp-card {
  background: #fff; border-radius: var(--radius); padding: 16px 20px;
  margin-bottom: 12px; box-shadow: var(--shadow);
  border-left: 3px solid var(--primary);
}
.opp-card-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.opp-code-badge {
  font-size: 12px; font-weight: 700; padding: 3px 8px;
  background: var(--primary-light); color: var(--primary-dark);
  border-radius: 4px;
}
.opp-title { font-size: 15px; font-weight: 600; color: var(--gray-900); }
.opp-detail-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px; margin-top: 8px;
}
.opp-detail-item { font-size: 12px; }
.opp-detail-label { color: var(--gray-500); }
.opp-detail-value { color: var(--gray-900); font-weight: 500; }
.opp-next-step {
  margin-top: 10px; padding: 8px 12px; background: var(--success-light);
  border-radius: 6px; font-size: 12px; color: #065f46;
  display: flex; align-items: center; gap: 8px;
}
.opp-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.opp-action-btn {
  font-size: 12px; padding: 4px 10px; border-radius: 6px; border: none;
  cursor: pointer; transition: all 0.2s;
}
.opp-action-btn-primary { background: var(--primary); color: #fff; }
.opp-action-btn-primary:hover { background: var(--primary-dark); }
.opp-action-btn-secondary { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); }
.opp-action-btn-secondary:hover { background: var(--gray-100); border-color: var(--gray-400); }
.opp-action-btn-warning { background: var(--warning-light); color: #92400e; }
.opp-action-btn-warning:hover { background: var(--warning); color: #fff; }
/* 沟通记录时间线 */
.log-timeline { position: relative; padding-left: 24px; }
.log-timeline::before {
  content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: var(--gray-200);
}
.log-item { position: relative; margin-bottom: 16px; }
.log-item::before {
  content: ''; position: absolute; left: -19px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--primary);
  border: 2px solid #fff;
}
.log-item-content {
  background: #fff; border-radius: 8px; padding: 12px 16px;
  box-shadow: var(--shadow); font-size: 13px;
}
.log-item-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  font-size: 12px; color: var(--gray-500);
}
.log-item-type {
  padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600;
}
.log-type-communication { background: #dbeafe; color: #1e40af; }
.log-type-stage_change { background: var(--warning-light); color: #92400e; }
.log-type-proposal { background: var(--primary-light); color: var(--primary-dark); }
.log-type-contract { background: var(--success-light); color: #065f46; }
.log-type-delivery { background: #ccfbf1; color: #115e59; }
.log-type-payment { background: #fef3c7; color: #92400e; }
.log-type-note { background: var(--gray-100); color: var(--gray-500); }
.log-item-text { color: var(--gray-700); line-height: 1.5; }
.log-item-next {
  margin-top: 6px; padding: 6px 10px; background: var(--success-light);
  border-radius: 6px; font-size: 12px; color: #065f46;
}
.log-item-empty { text-align: center; padding: 30px; color: var(--gray-500); font-size: 13px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--gray-700); margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300);
  border-radius: 8px; font-size: 13px; outline: none; transition: border 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.form-group textarea { resize: vertical; min-height: 60px; }
.market-checkbox-group { display: flex; gap: 12px; flex-wrap: wrap; }
.market-checkbox-group label {
  display: flex; align-items: center; gap: 4px; cursor: pointer;
  font-weight: 400; margin-bottom: 0;
}
.btn { padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-100); border-color: var(--gray-400); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }

/* ====== 响应式 ====== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 16px; }
  .task-board { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .menu-toggle { display: flex !important; }
}
.menu-toggle { display: none; position: fixed; top: 16px; left: 16px; z-index: 101; background: var(--gray-900); color: #fff; border: none; border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 18px; }
.overlay-mask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 99; }
.overlay-mask.show { display: block; }

/* ========== 工作流链路 ========== */
.wf-section {
  margin-bottom: 32px;
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
/* 遇事找谁快速表 */
.wf-quickfind-wrap { overflow-x: auto; }
.wf-quickfind-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.wf-quickfind-table th {
  text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 600;
  color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gray-100); background: var(--gray-50);
}
.wf-quickfind-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: top;
}
.wf-quickfind-table tr:hover { background: var(--gray-25, #fafafa); }
.wf-qf-title { font-weight: 600; color: var(--gray-900); font-size: 14px; margin-bottom: 4px; }
.wf-qf-trigger { font-size: 12px; color: var(--gray-500); }
.wf-qf-handler-role { font-weight: 500; color: var(--primary); margin-bottom: 4px; }
.wf-qf-users { display: flex; flex-wrap: wrap; gap: 6px; }
.wf-qf-user { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--gray-700); }
.wf-qf-tag {
  display: inline-block; background: var(--warning-light, #fef3c7); color: #92400e;
  font-size: 10px; padding: 1px 6px; border-radius: 4px; margin-right: 6px; vertical-align: middle;
}
/* 折叠详情 */
.wf-details { margin-bottom: 24px; }
.wf-details-summary {
  cursor: pointer; font-size: 14px; font-weight: 500; color: var(--gray-600);
  padding: 12px 0; user-select: none; border-top: 1px dashed var(--gray-200);
}
.wf-details-summary:hover { color: var(--primary); }
.wf-section-header {
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 12px;
  margin-bottom: 20px;
}
.wf-section-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wf-section-icon { font-size: 22px; }
.wf-section-desc {
  margin: 0;
  font-size: 13px;
  color: #888;
}

/* 原则卡片网格 */
.wf-principle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.wf-principle-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  transition: all .15s;
}
.wf-principle-card:hover {
  border-color: #4f46e5;
  background: #fff;
  box-shadow: 0 2px 8px rgba(79,70,229,0.08);
}
.wf-principle-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.wf-principle-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}
.wf-principle-role { font-weight: 600; font-size: 14px; color: #1a1a1a; }
.wf-principle-person { font-size: 12px; color: #888; margin-top: 2px; }
.wf-principle-online {
  margin-left: auto;
  display: flex; align-items: center; gap: 4px;
  font-size: 12px;
  color: #555;
}
.wf-principle-text {
  font-size: 13px;
  line-height: 1.65;
  color: #333;
  padding-left: 4px;
  border-left: 3px solid #4f46e5;
}

/* 主链路时间线 */
.wf-timeline {
  display: flex;
  flex-direction: column;
  padding-left: 8px;
}
.wf-step {
  display: flex;
  gap: 16px;
  position: relative;
}
.wf-step-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
}
.wf-step-number {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(79,70,229,0.25);
  flex-shrink: 0;
}
.wf-step-line {
  width: 2px;
  flex: 1;
  background: linear-gradient(to bottom, #c7d2fe, #e0e7ff);
  margin-top: 4px;
  margin-bottom: 4px;
  min-height: 24px;
}
.wf-step-content {
  flex: 1;
  background: #fafbfc;
  border: 1px solid #eef0f4;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
.wf-step-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.wf-step-title { font-size: 15px; font-weight: 600; color: #1a1a1a; }
.wf-step-trigger {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}
.wf-step-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.wf-step-btn {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  color: #4b5563;
  transition: all .15s;
}
.wf-step-btn:hover { background: #f3f4f6; }
.wf-step-btn-danger { color: #dc2626; border-color: #fecaca; }
.wf-step-btn-danger:hover { background: #fef2f2; }
.wf-step-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 12px;
}
@media (max-width: 900px) {
  .wf-step-grid { grid-template-columns: 1fr; }
}
.wf-step-col {
  background: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid #eef0f4;
}
.wf-step-handler { border-left: 3px solid #4f46e5; }
.wf-step-find { border-left: 3px solid #f59e0b; }
.wf-step-outcome { border-left: 3px solid #10b981; background: #f0fdf4; }
.wf-step-label {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.wf-step-role-name {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}
.wf-step-note {
  font-size: 12px;
  color: #555;
  line-height: 1.55;
  margin-bottom: 6px;
}
.wf-step-users {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.wf-step-user {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  background: #f9fafb;
  border-radius: 6px;
  padding: 6px 10px;
  flex-wrap: wrap;
}
.wf-step-user-name { font-weight: 600; color: #1a1a1a; }
.wf-step-user-pos { color: #6b7280; font-size: 11px; }
.wf-step-user-desc { color: #888; font-size: 11px; margin-left: auto; }
.wf-step-user-contact {
  width: 100%;
  font-size: 11px;
  color: #4b5563;
  padding-top: 4px;
  border-top: 1px dashed #e5e7eb;
}
.wf-step-no-user {
  font-size: 12px;
  color: #b45309;
  background: #fef3c7;
  padding: 6px 10px;
  border-radius: 6px;
}
.wf-step-outcome-text {
  font-size: 13px;
  color: #065f46;
  line-height: 1.6;
}
.wf-step-add {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}
.wf-step-add-btn {
  padding: 8px 18px;
  background: #fff;
  border: 1px dashed #c7d2fe;
  color: #4f46e5;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
}
.wf-step-add-btn:hover {
  background: #eef2ff;
  border-style: solid;
}

/* 支线卡片网格 */
.wf-branch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.wf-branch-card {
  background: #fafbfc;
  border: 1px solid #eef0f4;
  border-radius: 10px;
  padding: 16px 18px;
}
.wf-branch-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.wf-branch-tag {
  background: #fbbf24;
  color: #78350f;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
}
.wf-branch-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  flex: 1;
}
.wf-branch-trigger {
  font-size: 12px;
  color: #666;
  margin-bottom: 12px;
}
.wf-branch-grid-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.wf-branch-outcome {
  background: #f0fdf4;
  border-left: 3px solid #10b981;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  color: #065f46;
  line-height: 1.55;
}

/* 访问规则表 */
.wf-access-table-wrap {
  overflow-x: auto;
}
.wf-access-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.wf-access-table th, .wf-access-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  text-align: left;
  vertical-align: top;
}
.wf-access-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #555;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.wf-access-table td { color: #333; }
.wf-access-notes {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
  font-weight: normal;
}
.wf-access-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
}
.wf-access-full { background: #d1fae5; color: #065f46; }
.wf-access-partial { background: #fef3c7; color: #92400e; }
.wf-access-none { background: #fee2e2; color: #991b1b; }

/* 原有职责模块样式保留兼容 */
.role-card-section { margin-bottom: 16px; }
.role-card-section-title { font-size: 13px; font-weight: 600; color: #444; margin-bottom: 8px; }
.role-section-target { color: #059669; }
.role-section-collab { color: #d97706; }

/* ===== 岗位头像（CEO薄荷蓝 · CBDO闪电紫 · CTO肉粉 · CHRO白 · COO淡黄） ===== */
.avatar-circle {
  display: inline-flex; width: 30px; height: 30px; border-radius: 50%;
  align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; line-height: 1;
  border: 1px solid rgba(36,55,70,.15);
  vertical-align: middle; flex-shrink: 0;
}
.avatar-circle.lg { width: 42px; height: 42px; font-size: 15px; }
.avatar-chip { display: inline-flex; align-items: center; gap: 8px; }

/* Persistent action notices shared by management and employee pages. */
html.sh-action-open,html.sh-action-open body{overflow:hidden}
.sh-action-dialog{box-sizing:border-box;width:min(440px,calc(100vw - 32px));max-height:calc(100dvh - 32px);margin:auto;padding:28px;border:1px solid #d8e7da;border-radius:20px;background:#fff;color:#224c3b;box-shadow:0 24px 90px #082d2850;overflow:auto;text-align:left}
.sh-action-dialog::backdrop{background:rgb(6 28 22 / 64%);backdrop-filter:blur(4px)}
.sh-action-mark{display:grid;place-items:center;width:42px;height:42px;margin-bottom:18px;border-radius:13px;background:#fff0e4;color:#b46c2c;font-size:24px;font-weight:700}
.sh-action-dialog h2{margin:0 0 12px;font-size:22px;line-height:1.4;color:#193f31}
.sh-action-dialog p{margin:0;color:#687e71;font-size:14px;line-height:1.85;white-space:pre-wrap;overflow-wrap:anywhere}
.sh-action-dialog footer{display:flex;justify-content:flex-end;gap:10px;margin-top:26px}
.sh-action-dialog .btn{min-height:44px;padding:11px 19px;border-radius:10px;font-size:14px;font-weight:600;cursor:pointer}
.sh-action-dialog .btn-primary{background:#07563f;color:white;border:1px solid #07563f}.sh-action-dialog .btn-secondary{background:white;color:#486c57;border:1px solid #d5e2d5}
.sh-action-dialog .sh-action-danger{color:#b04d47;border-color:#e9d1cf}.sh-action-dialog button:focus-visible{outline:3px solid #9bc7ac;outline-offset:3px}
@media(max-width:600px){.sh-action-dialog{padding:24px 20px;border-radius:17px;width:calc(100vw - 28px)}.sh-action-dialog h2{font-size:20px}.sh-action-dialog footer .btn{flex:1;min-height:46px}.sh-action-dialog p{font-size:15px}}
