/* 简易版外贸CRM 样式 —— 小满风格侧边栏布局 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #1677ff;
  --primary-d: #0958d9;
  --primary-l: #e6f4ff;
  --green: #52c41a;
  --orange: #fa8c16;
  --red: #ff4d4f;
  --bg: #f0f2f5;
  --card: #fff;
  --border: #e8e8e8;
  --text: #262626;
  --muted: #8c8c8c;
  --side-bg: #001529;
  --side-bg-2: #000c17;
}
body { font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }

/* ===== 左侧侧边栏 ===== */
.sidebar { width: 232px; background: var(--side-bg); color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 100; }
.side-logo { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.logo-icon { font-size: 24px; }
.logo-name { font-size: 16px; font-weight: 600; color: #fff; line-height: 1.2; }
.logo-ver { font-size: 11px; color: rgba(255,255,255,.35); }

.side-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.side-nav::-webkit-scrollbar { width: 4px; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.nav-group-title { padding: 14px 20px 6px; font-size: 11px; color: rgba(255,255,255,.3); letter-spacing: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 20px; color: rgba(255,255,255,.65); text-decoration: none; font-size: 13px; transition: .15s; border-left: 3px solid transparent; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; background: var(--primary); border-left-color: #69b1ff; }
.nav-ico { font-size: 15px; width: 18px; text-align: center; }

.side-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.side-user { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.side-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
.side-avatar.admin { background: var(--orange); }
.side-user-name { font-size: 13px; color: #fff; }
.side-user-role { font-size: 11px; color: rgba(255,255,255,.4); }
.side-logout { display: block; text-align: center; padding: 6px; color: rgba(255,255,255,.4); text-decoration: none; font-size: 12px; border-radius: 4px; }
.side-logout:hover { color: var(--red); background: rgba(255,77,79,.1); }

/* ===== 右侧主区域 ===== */
.main { flex: 1; margin-left: 232px; display: flex; flex-direction: column; min-width: 0; }
.main-topbar { height: 52px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.breadcrumb { font-size: 14px; color: var(--muted); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.bc-sep { margin: 0 8px; }
.bc-current { color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.lang-switch {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 4px;
  background: var(--bg); border: 1px solid var(--border); color: var(--primary);
  font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: all .2s;
}
.lang-switch:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.top-date { color: var(--muted); font-size: 13px; }
.content { padding: 20px 24px; flex: 1; }

/* ===== 标题 ===== */
.page-title { font-size: 20px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.page-sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; gap: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== 卡片 ===== */
.panel { background: var(--card); border-radius: 8px; padding: 18px 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-head h3 { font-size: 15px; }

/* ===== 统计卡片 ===== */
.stat-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 16px; }
.stat-card { background: var(--card); border-radius: 8px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); border-left: 4px solid var(--primary); }
.stat-card.warn { border-left-color: var(--orange); }
.stat-card.green { border-left-color: var(--green); }
.stat-card.red { border-left-color: var(--red); }
.stat-num { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-label { color: var(--muted); margin-top: 4px; font-size: 13px; }

/* ===== 表格 ===== */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 10px 12px; background: #fafafa; color: var(--muted); font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:hover td { background: #fafcff; }
.table a { color: var(--primary); text-decoration: none; }
.table a.strong { font-weight: 600; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }

/* ===== 按钮 ===== */
.btn { display: inline-block; padding: 6px 14px; border: 1px solid var(--border); border-radius: 4px; background: #fff; color: var(--text); text-decoration: none; cursor: pointer; font-size: 13px; transition: .2s; white-space: nowrap; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { opacity: .85; color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-block { width: 100%; text-align: center; padding: 10px; }
.btn-link { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; }
.btn-link:hover { color: var(--red); }

/* ===== 等级标签 ===== */
.lvl { display: inline-block; width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 4px; font-size: 12px; font-weight: 700; color: #fff; }
.lvl-S { background: var(--red); }
.lvl-A { background: var(--orange); }
.lvl-B { background: var(--primary); }
.lvl-C { background: var(--muted); }

/* ===== 状态标签 ===== */
.stag { display: inline-block; padding: 2px 10px; border-radius: 11px; font-size: 12px; }
.stag b { margin-left: 4px; }
.stag-potential { background: #e6f4ff; color: #1677ff; }
.stag-following { background: #fff7e6; color: #fa8c16; }
.stag-dealing { background: #f6ffed; color: #52c41a; }
.stag-won { background: #d9f7be; color: #389e0d; }
.stag-lost { background: #fff1f0; color: #ff4d4f; }
.tag { display: inline-block; background: #f5f5f5; padding: 2px 8px; border-radius: 3px; font-size: 12px; margin: 2px; color: #595959; }

/* ===== 筛选栏 ===== */
.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; background: var(--card); padding: 14px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.filter-bar select, .search-input { padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.search-input { flex: 1; min-width: 220px; }

/* ===== 工作台 ===== */
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
.dist-list { display: flex; flex-direction: column; gap: 12px; }
.dist-row { display: flex; align-items: center; gap: 10px; }
.dist-name { width: 80px; font-size: 13px; }
.bar-wrap { flex: 1; background: #f0f0f0; height: 16px; border-radius: 8px; overflow: hidden; }
.bar { height: 100%; background: linear-gradient(90deg, var(--primary), #69b1ff); border-radius: 8px; transition: width .4s; }
.dist-num { font-weight: 700; width: 28px; text-align: right; }
.status-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.todo-date { color: var(--orange); font-weight: 600; }

/* ===== 详情页 ===== */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-table { width: 100%; }
.info-table th { text-align: right; padding: 8px 12px 8px 0; color: var(--muted); font-weight: 400; width: 70px; vertical-align: top; }
.info-table td { padding: 8px 12px; }
.info-table a { color: var(--primary); }

/* ===== 表单 ===== */
.form-card { background: var(--card); border-radius: 8px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.form-section { border-bottom: 1px solid var(--border); padding-bottom: 20px; margin-bottom: 20px; }
.form-section h4 { margin-bottom: 16px; color: var(--text); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; color: #595959; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 14px; font-family: inherit; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px rgba(22,119,255,.1); }
.req { color: var(--red); }
.form-actions { display: flex; gap: 10px; }

/* ===== 跟进时间线 ===== */
.followup-form .form-row { grid-template-columns: 1fr 1fr; }
.timeline { position: relative; padding-left: 8px; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-left: 30px; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: 4px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.tl-dot.todo { background: var(--orange); box-shadow: 0 0 0 2px var(--orange); }
.tl-content { background: #fafafa; border-radius: 6px; padding: 12px 14px; }
.tl-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.tl-method { background: var(--primary); color: #fff; padding: 1px 8px; border-radius: 3px; font-size: 12px; }
.tl-time { color: var(--muted); font-size: 12px; }
.tl-next { color: var(--orange); font-size: 12px; font-weight: 600; }
.tl-body { color: #595959; line-height: 1.6; }

/* ===== 提示 ===== */
.flash { padding: 10px 16px; border-radius: 4px; margin-bottom: 16px; }
.flash.success { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.flash.error { background: #fff1f0; color: #cf1322; border: 1px solid #ffa39e; }
.empty { text-align: center; padding: 32px; color: var(--muted); }

/* ===== 占位页(开发中) ===== */
.coming-soon { text-align: center; padding: 80px 20px; }
.cs-icon { font-size: 56px; margin-bottom: 16px; }
.cs-title { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.cs-desc { color: var(--muted); margin-bottom: 24px; max-width: 420px; margin-left: auto; margin-right: auto; line-height: 1.7; }
.cs-features { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 24px; }
.cs-feat { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 14px 18px; min-width: 140px; text-align: left; }
.cs-feat .cf-ico { font-size: 22px; }
.cs-feat .cf-name { font-weight: 600; margin: 6px 0 2px; }
.cs-feat .cf-desc { font-size: 12px; color: var(--muted); }

/* ===== 联系人卡片 ===== */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.contact-card { background: var(--card); border-radius: 8px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); border-top: 3px solid var(--primary); }
.contact-card h4 { font-size: 15px; margin-bottom: 4px; }
.contact-card .cc-pos { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.contact-card .cc-line { font-size: 13px; margin: 4px 0; }
.contact-card .cc-company { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }

/* ===== 任务列表 ===== */
.task-item { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); border-left: 4px solid var(--orange); }
.task-item.overdue { border-left-color: var(--red); }
.task-item.done { border-left-color: var(--green); opacity: .7; }
.task-check { width: 20px; height: 20px; border: 2px solid var(--border); border-radius: 50%; flex-shrink: 0; cursor: pointer; }
.task-info { flex: 1; }
.task-title { font-weight: 600; }
.task-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.task-date { font-size: 12px; padding: 2px 8px; border-radius: 11px; background: #fff7e6; color: var(--orange); }
.task-date.overdue { background: #fff1f0; color: var(--red); }

/* ===== 数据统计 ===== */
.chart-bar { display: flex; align-items: flex-end; gap: 14px; height: 200px; padding: 10px 0; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.cb-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cb-bar { width: 60%; max-width: 50px; background: linear-gradient(180deg, var(--primary), #69b1ff); border-radius: 4px 4px 0 0; min-height: 4px; transition: height .4s; }
.cb-num { font-size: 12px; font-weight: 600; }
.cb-label { font-size: 11px; color: var(--muted); }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.rank-no { width: 24px; height: 24px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.rank-no.top1 { background: var(--red); color: #fff; }
.rank-no.top2 { background: var(--orange); color: #fff; }
.rank-no.top3 { background: var(--primary); color: #fff; }

/* ===== 登录页 ===== */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #001529, #003a70); }
.login-card { background: #fff; padding: 40px; border-radius: 12px; width: 360px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.login-logo { font-size: 24px; font-weight: 700; text-align: center; }
.login-sub { text-align: center; color: var(--muted); margin: 6px 0 24px; }
.login-tip { text-align: center; color: var(--muted); font-size: 12px; margin-top: 16px; }

/* ===== 社媒链接 ===== */
.cc-socials { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.sm-link { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 4px; font-size: 11px; text-decoration: none; background: #f5f5f5; color: #595959; transition: .15s; }
.sm-link:hover { background: #e6f4ff; color: var(--primary); }
.sm-whatsapp::before { content: '💬'; font-size: 11px; }
.sm-facebook::before { content: '📘'; font-size: 11px; }
.sm-linkedin::before { content: '🔗'; font-size: 11px; }
.sm-instagram::before { content: '📷'; font-size: 11px; }
.sm-telegram::before { content: '✈️'; font-size: 11px; }
.sm-skype::before { content: '🟦'; font-size: 11px; }
.sm-wechat::before { content: '💚'; font-size: 11px; }

/* ===== 世界地图 ===== */
.map-container { margin-top: 8px; }
.map-sidebar { padding-left: 12px; border-left: 1px solid var(--border); }
.map-sidebar::-webkit-scrollbar { width: 4px; }
.map-sidebar::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 2px; }
.country-rank-item { display: flex; align-items: center; gap: 6px; padding: 5px 0; font-size: 12px; border-bottom: 1px solid #f5f5f5; }
.country-rank-item:last-child { border-bottom: none; }
.cr-rank { width: 18px; height: 18px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--muted); flex-shrink: 0; }
.country-rank-item:nth-child(1) .cr-rank { background: #ff4d4f; color: #fff; }
.country-rank-item:nth-child(2) .cr-rank { background: #fa8c16; color: #fff; }
.country-rank-item:nth-child(3) .cr-rank { background: #1677ff; color: #fff; }
.cr-flag { font-size: 14px; flex-shrink: 0; }
.cr-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.cr-count { font-weight: 700; color: var(--primary); flex-shrink: 0; }

/* ===== 表格内社媒标签 ===== */
.sm-tag { display: inline-block; width: 24px; height: 24px; line-height: 24px; text-align: center; border-radius: 4px; text-decoration: none; font-size: 13px; background: #f5f5f5; transition: .15s; }
.sm-tag:hover { background: var(--primary-l); transform: scale(1.15); }
.sm-tag.nosm { cursor: default; }
.sm-tag.nosm:hover { background: #f5f5f5; transform: none; }

@media (max-width: 900px) {
  .stat-cards { grid-template-columns: repeat(2,1fr); }
  .dash-grid, .detail-grid, .form-row { grid-template-columns: 1fr; }
  .sidebar { width: 60px; }
  .sidebar .logo-text, .nav-item span:not(.nav-ico), .nav-group-title, .side-user-info, .side-logout { display: none; }
  .nav-item { justify-content: center; }
  .main { margin-left: 60px; }
}
