:root {
  --bg: #f0f5f9;
  --card-bg: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --error: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ==================== 通用 ==================== */
.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
}

.header { text-align: center; margin-bottom: 24px; }
.header .icon { font-size: 48px; margin-bottom: 8px; }
.header h1 { font-size: 22px; font-weight: 700; }
.header p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

/* 步骤指示器 */
.steps { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; }
.step-dot {
  width: 32px; height: 4px; border-radius: 2px;
  background: var(--border); transition: background .3s;
}
.step-dot.active { background: var(--primary); }
.step-dot.done { background: var(--success); }

/* 表单 */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 14px; font-weight: 600;
  margin-bottom: 6px; color: var(--text);
}
.form-group input,
.form-group select {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 15px; outline: none; transition: border-color .2s;
  background: #f8fafc; color: var(--text);
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary); background: #fff;
}
.form-group input:read-only {
  background: #f0fdf4; font-weight: 600; color: #166534; cursor: default;
}

.hint { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

.error-msg {
  font-size: 13px; color: var(--error); margin-top: 4px; display: none;
}
.error-msg.show { display: block; }

/* 按钮 */
.btn {
  width: 100%; padding: 13px; border: none; border-radius: var(--radius);
  font-size: 16px; font-weight: 600; cursor: pointer;
  transition: background .2s, transform .1s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }
.btn-outline {
  background: #fff; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: #eff6ff; }

/* 步骤内容 */
.step-content { display: none; }
.step-content.active { display: block; }

/* 客户信息卡片 */
.customer-section { margin-top: 8px; }
.customer-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.customer-card .customer-title {
  font-size: 14px; font-weight: 700; color: var(--primary);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
.customer-card .customer-title::before {
  content: ''; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
}
.customer-card .form-group { margin-bottom: 12px; }
.customer-card .form-group:last-child { margin-bottom: 0; }

/* 结果 */
.result-box {
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: var(--radius); padding: 20px; margin-top: 16px;
}
.result-box .dest { font-size: 26px; margin-bottom: 12px; text-align: center; }
.result-box .detail { font-size: 14px; color: var(--text-secondary); line-height: 2.2; }
.result-box .detail span { font-weight: 600; color: var(--text); }
.result-box .detail .customer-tag {
  display: inline-block; background: #dcfce7; color: #166534;
  font-size: 12px; padding: 2px 8px; border-radius: 10px;
  margin-right: 4px; margin-bottom: 4px;
}

.back-link {
  display: block; text-align: center; margin-top: 16px;
  color: var(--primary); font-size: 14px; cursor: pointer; text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

/* 加载状态 */
.loading {
  text-align: center; padding: 40px 0; color: var(--text-secondary);
}
.spinner {
  display: inline-block; width: 32px; height: 32px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .6s linear infinite;
  margin-bottom: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; color: #fff; z-index: 9999;
  opacity: 0; transition: opacity .3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--error); }

/* ==================== 后台管理页 ==================== */
.admin-container { max-width: 960px; }

/* 统计卡片 */
.stats-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow);
  text-align: center;
}
.stat-card .stat-num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* 工具栏 */
.toolbar {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;
  align-items: center;
}
.toolbar input {
  flex: 1; min-width: 180px; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 14px; outline: none;
}
.toolbar input:focus { border-color: var(--primary); }
.toolbar .btn { width: auto; padding: 10px 20px; font-size: 14px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse;
  background: var(--card-bg); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
thead { background: #f8fafc; }
th, td {
  padding: 12px 14px; text-align: left; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
th { font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
td { color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

.dest-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
  background: #e0f2fe; color: #0369a1;
}

/* 配置面板 */
.config-section {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 20px 24px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.config-section h3 { font-size: 15px; margin-bottom: 14px; }
.config-row {
  display: flex; gap: 10px; margin-bottom: 10px; align-items: center; flex-wrap: wrap;
}
.config-row input {
  padding: 8px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; outline: none;
}
.config-row input:focus { border-color: var(--primary); }
.config-row .code-input { width: 90px; }
.config-row .name-input { flex: 1; min-width: 140px; }

.btn-sm {
  padding: 6px 14px; border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-sm.danger { background: #fee2e2; color: #dc2626; }
.btn-sm.danger:hover { background: #fecaca; }
.btn-sm.primary { background: var(--primary); color: #fff; }
.btn-sm.primary:hover { background: var(--primary-hover); }
.btn-sm.success { background: #d1fae5; color: #065f46; }
.btn-sm.success:hover { background: #a7f3d0; }

.section-title {
  font-size: 16px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}

.empty-state {
  text-align: center; padding: 40px 0; color: var(--text-secondary);
}
.empty-state .icon { font-size: 48px; margin-bottom: 8px; }

.pagination {
  display: flex; justify-content: center; align-items: center;
  gap: 12px; margin-top: 20px;
}
.pagination a,
.pagination button {
  padding: 8px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: #fff; cursor: pointer;
  font-size: 14px; text-decoration: none; color: var(--text);
}
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination a:hover,
.pagination button:hover:not(:disabled) { background: #f1f5f9; }
.pagination .page-info { font-size: 13px; color: var(--text-secondary); }

@media (max-width: 600px) {
  .card { padding: 24px 18px; }
  .container { padding: 16px 10px 32px; }
}
