/* 外贸业务管理系统 - 全局样式
   设计原则：浅色商务风，紧凑布局，表格友好，类 Windows 桌面 ERP */

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

:root {
  --c-bg: #f4f6fa;
  --c-card: #ffffff;
  --c-border: #e3e7ee;
  --c-text: #1f2937;
  --c-muted: #6b7280;
  --c-primary: #2563eb;
  --c-primary-hover: #1d4ed8;
  --c-success: #16a34a;
  --c-warn: #d97706;
  --c-danger: #dc2626;
  --c-info: #0891b2;
  --c-stock-bg: #eff6ff;
  --c-row-alt: #f9fafb;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
  --radius: 6px;
}

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

/* 登录页 */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
}
.login-card {
  background: #fff; padding: 36px 32px; border-radius: 10px;
  box-shadow: var(--shadow-md); width: 380px;
}
.login-card h1 { font-size: 20px; margin-bottom: 4px; color: #111827; }
.login-card .sub { color: var(--c-muted); margin-bottom: 24px; font-size: 12px; }
.login-card label { display: block; font-size: 12px; margin: 14px 0 6px; color: var(--c-muted); }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: var(--radius); font-size: 14px; }
.login-card input:focus { outline: none; border-color: var(--c-primary); }
.login-card button { width: 100%; margin-top: 22px; padding: 10px; background: var(--c-primary); color: #fff; border: 0; border-radius: var(--radius); font-size: 14px; cursor: pointer; font-weight: 500; }
.login-card button:hover { background: var(--c-primary-hover); }
.login-card .hint { margin-top: 12px; font-size: 11px; color: var(--c-muted); text-align: center; }
.login-card .err { margin-top: 12px; color: var(--c-danger); font-size: 12px; text-align: center; min-height: 16px; }

/* 主布局 */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px; background: #1e293b; color: #cbd5e1;
  display: flex; flex-direction: column;
}
.sidebar .brand {
  padding: 16px 18px; background: #0f172a;
  font-size: 14px; color: #fff; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.sidebar .brand .dot { width: 8px; height: 8px; background: var(--c-primary); border-radius: 50%; }
.sidebar nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px; color: #cbd5e1; text-decoration: none;
  font-size: 13px; border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: #334155; color: #fff; }
.sidebar nav a.active { background: #334155; color: #fff; border-left-color: var(--c-primary); }
.sidebar nav .group { font-size: 11px; color: #64748b; padding: 14px 18px 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.sidebar .user { padding: 12px 18px; border-top: 1px solid #334155; font-size: 12px; color: #94a3b8; }
.sidebar .user a { color: #94a3b8; text-decoration: none; }
.sidebar .user a:hover { color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--c-border);
  padding: 10px 24px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-sm);
}
.topbar .crumb { font-size: 13px; color: var(--c-muted); }
.topbar .crumb b { color: var(--c-text); }
.topbar .right { display: flex; align-items: center; gap: 16px; font-size: 12px; color: var(--c-muted); }

.content { flex: 1; padding: 20px 24px; overflow-y: auto; }

/* 通用卡片 */
.card {
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card h3 { font-size: 14px; margin-bottom: 12px; color: var(--c-text); display: flex; align-items: center; justify-content: space-between; }
.card h3 .actions { font-weight: normal; }

/* KPI 卡片 */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius); padding: 16px 18px; }
.kpi .label { color: var(--c-muted); font-size: 12px; }
.kpi .value { font-size: 24px; font-weight: 600; margin-top: 4px; color: var(--c-text); }
.kpi .delta { font-size: 11px; color: var(--c-muted); margin-top: 2px; }
.kpi.warn .value { color: var(--c-warn); }
.kpi.danger .value { color: var(--c-danger); }
.kpi.ok .value { color: var(--c-success); }

/* 工具栏 */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar input, .toolbar select {
  padding: 6px 10px; border: 1px solid var(--c-border); border-radius: var(--radius);
  font-size: 13px; background: #fff;
}
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--c-primary); }

/* 筛选条 */
.filter-bar {
  background: #f8fafc;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.filter-bar-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.filter-bar-row + .filter-bar-row { margin-top: 8px; }
.filter-bar label.field-label {
  font-size: 12px; color: var(--c-muted); font-weight: 600;
  margin-right: 4px;
}
.filter-bar input, .filter-bar select {
  padding: 5px 9px; border: 1px solid var(--c-border); border-radius: var(--radius);
  font-size: 13px; background: #fff;
}
.filter-bar input { min-width: 200px; }
.filter-bar select { min-width: 110px; }
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: var(--c-primary); }
.filter-chips {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 8px;
  padding-top: 8px; border-top: 1px dashed var(--c-border);
  font-size: 12px; color: var(--c-muted);
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #e0f2fe; color: #075985; padding: 2px 8px;
  border-radius: 12px; font-size: 11px; font-weight: 600;
}
.filter-chip .x {
  cursor: pointer; opacity: 0.6; font-weight: 700;
}
.filter-chip .x:hover { opacity: 1; color: #991b1b; }
.filter-summary { color: var(--c-muted); }
.filter-summary strong { color: var(--c-text); }

/* Drawer（右侧抽屉） */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.drawer-mask.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 720px; max-width: 95vw;
  background: #fff; box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  z-index: 1001; transform: translateX(100%); transition: transform 0.25s;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  padding: 16px 20px; border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 12px;
  background: #f8fafc;
}
.drawer-header h2 { margin: 0; font-size: 16px; flex: 1; }
.drawer-header .actions { display: flex; gap: 6px; }
.drawer-tabs {
  display: flex; gap: 4px; padding: 0 20px;
  border-bottom: 1px solid var(--c-border);
  background: #fff;
}
.drawer-tabs .d-tab {
  padding: 10px 14px; border: 0; background: transparent;
  border-bottom: 2px solid transparent;
  font-size: 13px; color: var(--c-muted); cursor: pointer;
}
.drawer-tabs .d-tab.active {
  color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 600;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-body .tab-pane { display: none; }
.drawer-body .tab-pane.active { display: block; }
.drawer-close {
  width: 28px; height: 28px; border-radius: 50%; border: 0;
  background: transparent; cursor: pointer; font-size: 18px; color: var(--c-muted);
}
.drawer-close:hover { background: #e2e8f0; }

/* 客户头部信息块 */
.cust-header {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 20px; background: #f8fafc; border-bottom: 1px solid var(--c-border);
}
.cust-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--c-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600; flex-shrink: 0;
}
.cust-info { flex: 1; }
.cust-info h3 { margin: 0 0 4px 0; font-size: 18px; }
.cust-meta { display: flex; gap: 12px; font-size: 12px; color: var(--c-muted); flex-wrap: wrap; align-items: center; }
.cust-meta .meta-item { display: inline-flex; align-items: center; gap: 4px; }

/* 抽屉内的小节标题 */
.section-title {
  font-size: 12px; font-weight: 700; color: var(--c-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--c-border);
}
.section-title:first-child { margin-top: 0; }

/* 时间线 */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px;
  width: 2px; background: #e2e8f0;
}
.timeline-item { position: relative; padding-bottom: 14px; }
.timeline-item::before {
  content: ''; position: absolute; left: -20px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--c-primary); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--c-primary);
}
.timeline-item.scope-客户::before { background: #3b82f6; box-shadow: 0 0 0 2px #3b82f6; }
.timeline-item.scope-商机::before { background: #f97316; box-shadow: 0 0 0 2px #f97316; }
.timeline-item.scope-邮件::before { background: #10b981; box-shadow: 0 0 0 2px #10b981; }
.timeline-item.scope-联系人::before { background: #8b5cf6; box-shadow: 0 0 0 2px #8b5cf6; }
.timeline-item.scope-等级::before { background: #ef4444; box-shadow: 0 0 0 2px #ef4444; }
.timeline-time { font-size: 11px; color: var(--c-muted); }
.timeline-title { font-size: 13px; margin: 2px 0 4px; }
.timeline-body { font-size: 12px; color: var(--c-text); }
.timeline-diff { font-size: 11px; color: var(--c-muted); margin-top: 4px; }
.timeline-diff .field-from { color: #dc2626; text-decoration: line-through; }
.timeline-diff .field-to { color: #16a34a; }

/* 商机卡片 */
.opp-card {
  border: 1px solid var(--c-border); border-radius: 8px;
  padding: 12px; margin-bottom: 8px; background: #fff;
}
.opp-card:hover { border-color: var(--c-primary); box-shadow: 0 2px 8px rgba(59,130,246,0.1); }
.opp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.opp-title { font-weight: 600; font-size: 13px; }
.opp-meta { display: flex; gap: 10px; font-size: 11px; color: var(--c-muted); margin-top: 6px; flex-wrap: wrap; }

/* 商机状态 tag */
.opp-status { padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; }
.opp-status.inquiry { background: #f3f4f6; color: #4b5563; }
.opp-status.quoting { background: #dbeafe; color: #1e40af; }
.opp-status.quoted { background: #ddd6fe; color: #5b21b6; }
.opp-status.negotiating { background: #fef3c7; color: #92400e; }
.opp-status.won { background: #dcfce7; color: #166534; }
.opp-status.lost { background: #fee2e2; color: #991b1b; }
.opp-status.on_hold { background: #f3e8ff; color: #6b21a8; }

/* 来源 chip */
.source-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 10px; font-size: 11px;
  background: #f1f5f9; color: #475569; font-weight: 500;
}
.source-chip::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8;
}

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border: 1px solid var(--c-border); border-radius: var(--radius);
  background: #fff; color: var(--c-text); font-size: 12px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.btn-primary:hover { background: var(--c-primary-hover); border-color: var(--c-primary-hover); }
.btn-danger { background: var(--c-danger); color: #fff; border-color: var(--c-danger); }
.btn-sm { padding: 3px 8px; font-size: 11px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--c-border); font-size: 12px; }
th { background: #f1f5f9; color: #475569; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:nth-child(even) td { background: var(--c-row-alt); }
tr:hover td { background: #f0f9ff; }
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.03em;
}
.tag.A { background: #dcfce7; color: #166534; }
.tag.B { background: #dbeafe; color: #1e40af; }
.tag.C { background: #fef3c7; color: #92400e; }
.tag.D { background: #f3e8ff; color: #6b21a8; }
.tag.draft { background: #f3f4f6; color: #4b5563; }
.tag.confirmed { background: #dbeafe; color: #1e40af; }
.tag.shipped { background: #dcfce7; color: #166534; }
.tag.done { background: #cffafe; color: #155e75; }
.tag.cancelled { background: #fee2e2; color: #991b1b; }
.tag.low { background: #fee2e2; color: #991b1b; }
.tag.normal { background: #dcfce7; color: #166534; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
.form-row { display: flex; flex-direction: column; }
.form-row.full { grid-column: 1 / -1; }
.form-row label { font-size: 11px; color: var(--c-muted); margin-bottom: 4px; }
.form-row label .req { color: var(--c-danger); }
.form-row input, .form-row select, .form-row textarea {
  padding: 7px 10px; border: 1px solid var(--c-border); border-radius: var(--radius);
  font-size: 13px; background: #fff;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--c-primary); }
.form-row textarea { resize: vertical; min-height: 60px; }
.form-actions { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--c-border); display: flex; gap: 8px; justify-content: flex-end; }

/* Modal（z-index 由 JS 弹窗栈动态分配，基准 1100 高于抽屉） */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
  display: flex; align-items: center; justify-content: center; z-index: 1100;
  animation: modal-fade .12s ease-out;
}
@keyframes modal-fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: 8px; width: 640px; max-width: 90vw;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 10px 40px rgba(15, 23, 42, .2);
}
.modal .modal-head {
  padding: 14px 20px; border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal .modal-head h3 { font-size: 15px; }
.modal .modal-head .close { background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--c-muted); }
.modal .modal-body { padding: 18px 20px; overflow-y: auto; }
.modal .modal-foot { padding: 12px 20px; border-top: 1px solid var(--c-border); display: flex; gap: 8px; justify-content: flex-end; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--c-border); margin-bottom: 14px; }
.tab { padding: 8px 14px; border: 0; background: none; cursor: pointer; color: var(--c-muted); font-size: 13px; border-bottom: 2px solid transparent; }
.tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 500; }

/* Loading / empty */
.loading { padding: 60px; text-align: center; color: var(--c-muted); }
.empty { padding: 40px; text-align: center; color: var(--c-muted); }
.empty .icon { font-size: 36px; margin-bottom: 6px; opacity: .4; }

/* hint */
.muted { color: var(--c-muted); font-size: 12px; }
.flex { display: flex; align-items: center; gap: 6px; }
.flex.wrap { flex-wrap: wrap; }
.flex.between { justify-content: space-between; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mt-2 { margin-top: 8px; }

/* 价格阶梯 */
.price-tier {
  display: grid; grid-template-columns: 60px 1fr 80px 80px; gap: 8px; align-items: center;
  background: #f8fafc; padding: 8px 10px; border-radius: var(--radius); margin-bottom: 4px;
  font-size: 12px;
}
.price-tier .label { font-weight: 600; }
.price-tier.A .label { color: #166534; }
.price-tier.B .label { color: #1e40af; }
.price-tier.C .label { color: #92400e; }
.price-tier.D .label { color: #6b21a8; }

/* 适配机型 tag list */
.fitment-list { display: flex; flex-wrap: wrap; gap: 4px; }
.fitment-list .pill { background: #e0e7ff; color: #3730a3; padding: 2px 8px; border-radius: 10px; font-size: 11px; }

/* 联系人列表 */
.contact-item { padding: 8px 10px; border: 1px solid var(--c-border); border-radius: var(--radius); margin-bottom: 6px; background: #fafafa; }
.contact-item .name { font-weight: 500; }
.contact-item .role-tag { background: #dbeafe; color: #1e40af; padding: 1px 6px; border-radius: 8px; font-size: 10px; margin-left: 6px; }

/* ============ 邮件撰写 (Email Compose) ============ */
.email-compose { font-size: 13px; }
.email-compose .em-row {
  display: flex; gap: 8px; align-items: center;
}
.email-compose .em-row label {
  color: #475569; font-weight: 500; text-align: right;
}
.email-compose .em-vars {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 6px 0; font-size: 12px;
}
.email-compose .em-var-chip {
  background: #eef2ff; color: #3730a3;
  padding: 1px 8px; border-radius: 10px;
  font-size: 11px;
}
.email-compose .em-var-chip:hover {
  background: #c7d2fe;
}
.email-compose .em-tpl-bar .input,
.email-compose .em-row .input {
  min-width: 0;
}
.email-compose .em-editor-wrap {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.email-compose .ql-toolbar.ql-snow {
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  padding: 6px;
}
.email-compose .ql-container.ql-snow {
  border: 0;
  font-size: 14px;
  min-height: 280px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.email-compose .ql-editor {
  min-height: 280px;
  max-height: 420px;
  overflow-y: auto;
  padding: 12px 16px;
}
.email-compose .ql-editor img {
  max-width: 100%;
  height: auto;
}
.email-compose .ql-editor.ql-blank::before {
  font-style: italic;
  color: #9ca3af;
}
.email-compose .em-attachments {
  border: 1px dashed #d1d5db;
  border-radius: 6px;
  padding: 8px 12px;
  background: #fafafa;
}
.email-compose .em-attachments-head {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 6px; margin-bottom: 6px;
  border-bottom: 1px dashed #e5e7eb;
}
.email-compose .em-attach-list {
  display: flex; flex-direction: column; gap: 4px;
}
.email-compose .em-attach-item {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; background: #fff;
  border: 1px solid #e5e7eb; border-radius: 4px;
}
.email-compose .em-attach-name {
  flex: 1; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.email-compose .em-attach-size {
  font-size: 11px; color: #6b7280;
  min-width: 60px; text-align: right;
}
.email-compose .em-attach-tip { color: #94a3b8; }
.email-compose .em-attachments:empty { display: none; }

/* ============ 跟进任务 ============ */
.task-row td { vertical-align: top; }
.task-row.overdue td { background: #fef2f2 !important; }
.task-row.today td { background: #fffbeb !important; }
.task-row.done td { opacity: .65; }
.task-row.dismissed td { opacity: .5; text-decoration: line-through; }

.task-status {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 600;
}
.task-status.pending { background: #fef3c7; color: #92400e; }
.task-status.done { background: #dcfce7; color: #166534; }
.task-status.dismissed { background: #f3f4f6; color: #6b7280; }
.task-status.snoozed { background: #e0e7ff; color: #3730a3; }

.task-state, .state-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 600;
}
.task-state.overdue, .state-badge.overdue { background: #fee2e2; color: #991b1b; }
.task-state.today, .state-badge.today { background: #fef3c7; color: #92400e; }
.task-state.week, .state-badge.week { background: #dbeafe; color: #1e40af; }

/* V0.7 — owner / 头像 / 业绩条 */
.owner-bar-bg {
  margin-top: 6px; height: 4px; background: #f1f5f9; border-radius: 2px; overflow: hidden;
}
.owner-bar-fill {
  height: 100%; transition: width .4s ease;
}
.rank-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 700; color: #fff;
}
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 12px;
  flex-shrink: 0; vertical-align: middle;
}
.avatar-sm { width: 22px; height: 22px; font-size: 11px; }
.readonly {
  padding: 6px 10px; border: 1px solid var(--c-border); border-radius: 4px;
  background: #f8fafc; color: var(--c-muted);
}
.btn-group { display: inline-flex; border: 1px solid var(--c-border); border-radius: 6px; overflow: hidden; }
.btn-group .btn {
  border-radius: 0; padding: 4px 12px; font-size: 12px;
  border: 0; background: #fff; color: var(--c-muted);
}
.btn-group .btn:hover { background: #f8fafc; }
.btn-group .btn.btn-primary { background: #2563eb; color: #fff; }

.task-type {
  display: inline-block; padding: 1px 7px; border-radius: 8px;
  background: #e0e7ff; color: #3730a3; font-size: 10px;
}
.task-title { font-weight: 500; }

.overdue-code { color: #dc2626; font-weight: 600; }
.today-code { color: #d97706; font-weight: 600; }

.task-table { font-size: 12px; }
.task-table td { padding: 6px 8px; }

/* ============ 公海客户 ============ */
.tag.pool { background: #dbeafe; color: #1e40af; }

.pool-table tr td { vertical-align: middle; }
.pool-reason {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 600;
}
.pool-reason.manual { background: #fef3c7; color: #92400e; }
.pool-reason.rule_no_contact { background: #fee2e2; color: #991b1b; }
.pool-reason.rule_no_order { background: #e0e7ff; color: #3730a3; }
.pool-reason.rule_level_loss { background: #f3e8ff; color: #6b21a8; }
.pool-reason.workflow { background: #cffafe; color: #155e75; }
.pool-reason.inactive { background: #f3f4f6; color: #4b5563; }

.pool-stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.pool-stat {
  background: #f8fafc; border-radius: var(--radius);
  padding: 10px; text-align: center;
}
.pool-stat .num { font-size: 22px; font-weight: 600; color: var(--c-text); }
.pool-stat .num.pool-num { color: #0891b2; }
.pool-stat > .muted { font-size: 11px; }

/* ============ 销售漏斗 ============ */
.funnel { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 8px; }
.funnel-row { display: flex; align-items: center; gap: 12px; }
.funnel-label { width: 48px; font-size: 13px; font-weight: 600; text-align: right; flex: none; }
.funnel-bar-wrap { flex: 1; background: #f1f5f9; border-radius: 6px; height: 30px; overflow: hidden; }
.funnel-bar {
  height: 100%; min-width: 52px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12.5px; font-weight: 600; border-radius: 6px; transition: width .3s;
}
.funnel-meta { width: 200px; flex: none; font-size: 12px; display: flex; gap: 8px; align-items: center; }
.funnel-foot { margin-top: 10px; font-size: 12.5px; color: var(--c-muted); }
.tag.conv { background: #eff6ff; color: #1d4ed8; font-size: 10.5px; padding: 1px 6px; border-radius: 8px; }

.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }

.level-chip-row {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.level-chip-row .level-chip {
  padding: 4px 12px; border: 1px solid var(--c-border); border-radius: 12px;
  background: #fff; font-size: 12px; display: inline-flex; align-items: center; gap: 4px;
}

.link { color: var(--c-primary); text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; }

.ts { min-width: 160px; }

/* ============ 批量导入弹窗 ============ */
.bulk-import { font-size: 13px; }
.bulk-steps {
  display: flex; gap: 8px;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px dashed var(--c-border);
}
.bulk-steps .step {
  padding: 6px 14px; border-radius: 16px;
  background: #f1f5f9; color: var(--c-muted);
  font-size: 12px; font-weight: 600;
}
.bulk-steps .step.active {
  background: var(--c-primary); color: #fff;
}

.bulk-file {
  display: block; border: 2px dashed #cbd5e1; border-radius: 8px;
  padding: 32px; text-align: center; background: #f8fafc;
  cursor: pointer; transition: all .2s;
}
.bulk-file:hover, .bulk-file.drag { border-color: var(--c-primary); background: #eff6ff; }
.bulk-file input[type=file] { display: none; }
.bulk-file-tip { color: var(--c-muted); font-size: 14px; }

.bulk-stat-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
}
.bulk-stat {
  background: #f8fafc; border-radius: 8px;
  padding: 14px; text-align: center;
  border: 1px solid var(--c-border);
}
.bulk-stat .num { font-size: 28px; font-weight: 600; }
.bulk-stat .lbl { font-size: 11px; color: var(--c-muted); margin-top: 4px; }
.bulk-stat.success { background: #f0fdf4; border-color: #86efac; }
.bulk-stat.success .num { color: #16a34a; }
.bulk-stat.warn { background: #fffbeb; border-color: #fcd34d; }
.bulk-stat.warn .num { color: #d97706; }
.bulk-stat.danger { background: #fef2f2; border-color: #fca5a5; }
.bulk-stat.danger .num { color: #dc2626; }

.bulk-tables {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px;
}
.bulk-table-wrap h4 {
  font-size: 12px; font-weight: 600; color: var(--c-muted);
  margin: 0 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--c-border);
}
.bulk-tbl-scroll {
  max-height: 280px; overflow-y: auto;
  border: 1px solid var(--c-border); border-radius: 4px; background: #fff;
}
.bulk-tbl { font-size: 11px; }
.bulk-tbl th { position: sticky; top: 0; background: #f1f5f9; z-index: 1; }
.bulk-tbl td { padding: 4px 6px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-tbl tr:nth-child(even) td { background: #fafbfc; }

/* 商机状态管道 / 库存锁定样式 */
.opp-line-items { margin-top: 8px; padding: 8px 10px; border-radius: 6px; font-size: 12px; }
.opp-line-items.locking { background: #fffbeb; border: 1px solid #fde68a; }
.opp-line-items.idle { background: #f8fafc; border: 1px solid #e2e8f0; }
.opp-line-items .row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed rgba(0,0,0,.04); }
.opp-line-items .row:last-child { border-bottom: none; }
.opp-status-pipeline { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e5e7eb; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.opp-status-pipeline .label { font-size: 11px; color: #94a3b8; margin-right: 4px; }
.opp-line-row { display: grid; grid-template-columns: 2fr 90px 100px 32px; gap: 6px; margin-bottom: 6px; align-items: center; }
.opp-line-row select, .opp-line-row input { font-size: 12px; padding: 4px 6px; }
.lock-warn-low { background: #fef2f2; color: #dc2626; padding: 1px 5px; border-radius: 3px; font-size: 10px; }
.lock-active-pill { background: #fef3c7; color: #92400e; padding: 1px 6px; border-radius: 3px; font-size: 11px; font-weight: 600; }

/* ============ V0.11 新增：订单 / 单据 / 跟单 / 货代 ============ */

/* 跟单进度小点（订单列表） */
.opp-steps { display: flex; align-items: center; margin-top: 6px; }
.opp-step {
  width: 18px; height: 4px; border-radius: 2px; background: #e2e8f0; display: inline-block;
}
.opp-step.done { background: #2563eb; }

/* 订单行项表 */
table.order-items { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.order-items th {
  background: #f1f5f9; padding: 6px 8px; text-align: left; font-weight: 600;
  color: #334155; border: 1px solid var(--c-border); font-size: 12px;
}
table.order-items td { padding: 4px 6px; border: 1px solid var(--c-border); vertical-align: middle; }
table.order-items input, table.order-items select {
  width: 100%; padding: 4px 6px; border: 1px solid var(--c-border); border-radius: 4px;
  font-size: 12.5px; font-family: inherit;
}
table.order-items input:focus, table.order-items select:focus { outline: none; border-color: var(--c-primary); }

/* 通用子项卡片（货代联系人 / 银行账户） */
.sub-item { background: #fbfcfe; }
.sub-item .form-grid { gap: 8px 10px; }
.sub-item .form-row input { font-size: 12.5px; }

/* 单据选择卡片 */
.doc-card:hover .muted { color: #475569; }

/* checkbox 行 */
label.checkbox {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer;
  white-space: nowrap;
}
label.checkbox input { width: auto; margin: 0; }

/* 订单详情中的状态时间线微调 */
.timeline-item > div > div:first-child { font-size: 13px; }

/* ============ 世界地图 ============ */
.wm-wrap { display: flex; flex-direction: column; gap: 8px; }
.wm-bar { display: flex; align-items: center; gap: 10px; font-size: 12.5px; flex-wrap: wrap; }
.wm-crumb a { color: #2563eb; text-decoration: none; }
.wm-crumb a:hover { text-decoration: underline; }
.wm-body { display: grid; grid-template-columns: 1fr 300px; gap: 12px; align-items: start; }
.wm-map { border: 1px solid var(--c-border); border-radius: 8px; overflow: hidden; background: #f8fafc; }
.wm-map svg { display: block; width: 100%; height: auto; max-height: 420px; }
.wm-country { stroke: #ffffff; stroke-width: .4; transition: fill .15s; }
.wm-country.has-data:hover { stroke: #1e293b; stroke-width: .9; }
.wm-cont-label text { pointer-events: none; }
.wm-side { border: 1px solid var(--c-border); border-radius: 8px; padding: 10px 12px; max-height: 430px; overflow: auto; }
.wm-side table td { padding: 4px 2px; border-bottom: 1px solid #f1f5f9; }
.wm-side table tr:hover { background: #f8fafc; }
.wm-tip {
  position: fixed; z-index: 9999; display: none; pointer-events: none;
  background: rgba(15,23,42,.92); color: #fff; font-size: 12px; line-height: 1.5;
  padding: 6px 10px; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
@media (max-width: 1000px) {
  .wm-body { grid-template-columns: 1fr; }
}

/* ============ 订单派工流转 / 收款账龄 ============ */
/* 工具条内的胶囊式标签页 */
.tab-btn {
  padding: 6px 14px; border: 1px solid var(--c-border); border-radius: 999px;
  background: #fff; color: var(--c-muted); font-size: 12.5px; cursor: pointer;
  transition: all .15s;
}
.tab-btn:hover { background: #f8fafc; color: var(--c-text); }
.tab-btn.active { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 500; }

/* 工序任务状态标签补充：进行中 / 已取消 */
.task-status.doing { background: #dbeafe; color: #1e40af; }
.task-status.cancelled { background: #f3f4f6; color: #6b7280; text-decoration: line-through; }

/* 工序任务行：逾期的整行高亮（不依赖 .task-row） */
tr.overdue td { background: #fef2f2 !important; }
tr.done-row td { opacity: .72; }

/* 各人待办分布卡片 */
[data-user] { transition: background .15s, border-color .15s; }
[data-user]:hover { background: #f1f5f9; border-color: #cbd5e1 !important; }
