/* 联成木业外贸 CRM 样式 - 极简中文界面，业务员上手快 */

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: #1f2937;
  background: #f3f4f6;
  font-size: 14px;
  line-height: 1.5;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.muted { color: #6b7280; font-size: 12px; }
.error-msg { color: #dc2626; font-size: 13px; margin-top: 8px; min-height: 18px; }

/* ===== 登录页 ===== */
.login-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
}
.login-card {
  background: #fff; border-radius: 12px; padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: 100%; max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 24px; }
.logo-mark {
  width: 56px; height: 56px; border-radius: 12px;
  background: linear-gradient(135deg, #b45309, #92400e);
  color: #fff; font-weight: 800; font-size: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: 2px; margin-bottom: 12px;
}
.logo-mark.sm { width: 38px; height: 38px; font-size: 14px; }
.login-card h1 { font-size: 22px; color: #111827; }
.login-sub { color: #6b7280; margin-top: 4px; font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-tip { margin-top: 20px; padding-top: 16px; border-top: 1px solid #e5e7eb; font-size: 12px; color: #6b7280; }
.login-tip p { margin-bottom: 4px; }

/* ===== 表单通用 ===== */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-row label { font-size: 13px; color: #374151; font-weight: 500; }
.form-row label.checkbox { flex-direction: row; align-items: center; gap: 6px; font-weight: normal; }
input, select, textarea {
  border: 1px solid #d1d5db; border-radius: 6px; padding: 8px 12px;
  font-size: 14px; background: #fff; outline: none; transition: border-color 0.15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
textarea { resize: vertical; min-height: 70px; }

button, .btn {
  cursor: pointer; border: 1px solid transparent; border-radius: 6px;
  padding: 8px 16px; font-size: 14px; font-weight: 500; transition: all 0.15s;
  font-family: inherit; background: #fff; color: #374151; border-color: #d1d5db;
}
button:hover, .btn:hover { background: #f9fafb; }
.btn-primary {
  background: #2563eb; color: #fff; border-color: #2563eb;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-block { width: 100%; padding: 10px; font-size: 15px; }

/* ===== 主框架 ===== */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  background: #fff; border-bottom: 1px solid #e5e7eb;
  padding: 12px 24px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 16px; font-weight: 700; color: #111827; }
.topbar-sub { font-size: 12px; color: #6b7280; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-link { color: #4b5563; font-size: 13px; }
.user-badge {
  background: #eff6ff; color: #1e40af; padding: 4px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}

.main { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: 220px; background: #fff; border-right: 1px solid #e5e7eb;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 16px 0;
}
.sidebar nav { display: flex; flex-direction: column; }
.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; color: #4b5563; font-size: 14px;
  border-left: 3px solid transparent; transition: all 0.15s;
}
.nav-link:hover { background: #f9fafb; color: #111827; text-decoration: none; }
.nav-link.active { background: #eff6ff; color: #1e40af; border-left-color: #2563eb; font-weight: 600; }
.nav-link.hot { color: #b45309; }
.nav-link.hot.active { background: #fff7ed; color: #b45309; border-left-color: #b45309; }
.cnt { margin-left: auto; background: #fee2e2; color: #b91c1c; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.sidebar-foot { padding: 12px 20px; border-top: 1px solid #e5e7eb; }
.sidebar-foot p { margin-bottom: 2px; }

.content { flex: 1; padding: 24px; overflow: auto; }
.page { display: none; }
.page.active { display: block; }
.page h2 { font-size: 20px; color: #111827; margin-bottom: 16px; }

/* ===== 仪表板 KPI ===== */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi {
  background: #fff; border-radius: 8px; padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border-left: 4px solid #2563eb;
}
.kpi.alert { border-left-color: #dc2626; }
.kpi.warn { border-left-color: #d97706; }
.kpi-num { font-size: 32px; font-weight: 700; color: #111827; }
.kpi-label { color: #6b7280; font-size: 13px; margin-top: 4px; }

.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card {
  background: #fff; border-radius: 8px; padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.chart-card h3 { font-size: 15px; color: #111827; margin-bottom: 12px; }
.chart-body { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-label { width: 110px; font-size: 13px; color: #4b5563; }
.bar-track { flex: 1; height: 18px; background: #f3f4f6; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #2563eb, #60a5fa); transition: width 0.3s; }
.bar-fill.alert { background: linear-gradient(90deg, #dc2626, #f87171); }
.bar-fill.warn { background: linear-gradient(90deg, #d97706, #fbbf24); }
.bar-count { width: 50px; text-align: right; font-size: 13px; font-weight: 600; color: #111827; }

/* ===== 客户列表 ===== */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h2 { margin-bottom: 0; }
.page-head-actions { display: flex; gap: 8px; }
.search-input { width: 320px; }
.filter-row { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-row select { padding: 6px 10px; }
.table-wrap {
  background: #fff; border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05); overflow: auto;
}
.lead-table { width: 100%; border-collapse: collapse; }
.lead-table th, .lead-table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}
.lead-table th {
  background: #f9fafb; color: #374151; font-weight: 600;
  position: sticky; top: 0; z-index: 1;
}
.lead-table tbody tr { transition: background 0.1s; cursor: pointer; }
.lead-table tbody tr:hover { background: #eff6ff; }
.lead-table tbody tr.flag-real { background: #fef2f2; }
.lead-table tbody tr.flag-real:hover { background: #fee2e2; }
.lead-table tbody tr.flag-proc { background: #fffbeb; }
.lead-table tbody tr.flag-proc:hover { background: #fef3c7; }
.lead-table tbody tr.flag-hot { background: #f5f3ff; }
.lead-table tbody tr.flag-hot:hover { background: #ede9fe; }
.col-flag { width: 4px; padding: 0 !important; }
.flag-cell { width: 4px; padding: 0 !important; }
.flag-real-cell { background: #dc2626 !important; }
.flag-proc-cell { background: #d97706 !important; }
.flag-hot-cell { background: #7c3aed !important; }
.lead-id { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: #6b7280; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.badge-NEW { background: #f1f5f9; color: #475569; }
.badge-CONTACTED { background: #dbeafe; color: #1e40af; }
.badge-REPLIED { background: #fef3c7; color: #92400e; }
.badge-QUOTED { background: #fde68a; color: #78350f; }
.badge-SAMPLE_SENT { background: #c7d2fe; color: #3730a3; }
.badge-NEGOTIATING { background: #fed7aa; color: #9a3412; }
.badge-WON { background: #bbf7d0; color: #14532d; }
.badge-LOST { background: #fecaca; color: #7f1d1d; }
.badge-NO_ANSWER { background: #e5e7eb; color: #374151; }
.badge-PROCUREMENT { background: linear-gradient(135deg,#fde68a,#fbbf24); color: #78350f; }
.badge-HOT { background: #fecaca; color: #7f1d1d; }
.badge-WARM { background: #fed7aa; color: #9a3412; }
.badge-COLD { background: #e5e7eb; color: #374151; }
.badge-YES { background: #bbf7d0; color: #14532d; }
.badge-PLANNED { background: #fde68a; color: #78350f; }
.badge-NO { background: #fecaca; color: #7f1d1d; }

.pagination { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 16px; }

/* ===== 客户详情弹窗 ===== */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 30px; z-index: 100; overflow: auto;
}
.modal-card {
  background: #fff; border-radius: 12px;
  width: 100%; max-width: 1100px; max-height: calc(100vh - 60px);
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-card.sm { max-width: 460px; }
.modal-head {
  padding: 20px 24px; border-bottom: 1px solid #e5e7eb;
  display: flex; justify-content: space-between; align-items: flex-start;
  position: sticky; top: 0; background: #fff; z-index: 1; border-radius: 12px 12px 0 0;
}
.modal-head h2 { font-size: 20px; color: #111827; margin-bottom: 4px; }
.modal-close {
  border: none; background: transparent; font-size: 28px;
  color: #6b7280; cursor: pointer; padding: 0; line-height: 1;
}
.modal-body { padding: 24px; overflow: auto; }
.flag-inline {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px;
  font-weight: 600; margin-left: 8px; vertical-align: middle;
}
.flag-inline.real { background: #fef2f2; color: #b91c1c; }
.flag-inline.proc { background: #fffbeb; color: #b45309; }
.flag-inline.hot { background: #f5f3ff; color: #6d28d9; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.detail-block {
  background: #f9fafb; border-radius: 8px; padding: 16px;
  margin-bottom: 16px;
}
.detail-block h3 { font-size: 14px; color: #111827; margin-bottom: 12px; }
.detail-block dl { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; font-size: 13px; }
.detail-block dt { color: #6b7280; }
.detail-block dd { color: #1f2937; word-break: break-all; }

.edit-form { display: flex; flex-direction: column; }
.note-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.notes-list, .history-list { display: flex; flex-direction: column; gap: 8px; }
.note-item, .history-item {
  background: #fff; padding: 10px 12px; border-radius: 6px;
  border-left: 3px solid #2563eb; font-size: 13px;
}
.note-meta, .history-meta { color: #6b7280; font-size: 11px; margin-bottom: 4px; display: flex; gap: 8px; }
.history-item { border-left-color: #d97706; }

.empty-hint { color: #9ca3af; font-size: 12px; padding: 12px; text-align: center; }
