/* ============================================================
   跨境物流运费自动核算系统 - 全响应式样式（PC / 手机自适应）
   ============================================================ */
:root {
  --primary: #1d6ef5;
  --primary-dark: #1255c4;
  --bg: #f3f6fb;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e3e8f0;
  --danger: #dc2626;
  --success: #059669;
  --radius: 12px;
}

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1000px; margin: 0 auto; padding: 20px 16px 40px; }

/* ---------- 页头 ---------- */
.header { text-align: center; padding: 22px 0 26px; }
.header h1 {
  font-size: 26px;
  background: linear-gradient(120deg, var(--primary), #6d4df2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}
.header .sub { color: var(--text-light); font-size: 13px; margin-top: 6px; }

/* ---------- 卡片通用 ---------- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(30, 60, 120, 0.06);
  padding: 22px;
  margin-bottom: 18px;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-left: 10px;
  border-left: 4px solid var(--primary);
}

/* ---------- 数据源设置面板（高级，默认收起） ---------- */
.datasource { padding: 0; overflow: hidden; }
.ds-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  list-style: none;
  user-select: none;
}
.ds-summary::-webkit-details-marker { display: none; }
.ds-summary::before { content: '⚙ '; }
.ds-status { font-size: 12px; font-weight: 400; color: var(--primary); }
.ds-body { padding: 0 22px 18px; border-top: 1px dashed var(--border); }
.ds-tip { font-size: 12px; color: var(--text-light); margin: 12px 0; }
.ds-tip code { background: #eef2f8; padding: 1px 5px; border-radius: 4px; }
.ds-row { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.ds-row input, .ds-row select {
  flex: 1;
  min-width: 220px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13px;
  background: #fafbfd;
  outline: none;
}
.ds-row input:focus, .ds-row select:focus { border-color: var(--primary); }
.ds-row button {
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
}
.ds-row button:hover { background: #f0f6ff; }
.ds-row button:disabled { opacity: 0.5; cursor: not-allowed; }
.ds-row .ds-reset { border-color: var(--border); color: var(--text-light); }
.ds-msg { font-size: 12px; min-height: 16px; }
.ds-msg.ok { color: var(--success); }
.ds-msg.err { color: var(--danger); }

/* ---------- 输入表单：自适应网格 ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px 16px;
}
.field { display: flex; flex-direction: column; }
.field label { font-size: 13px; color: var(--text-light); margin-bottom: 6px; }
.field input,
.field select {
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 15px;
  background: #fafbfd;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 110, 245, 0.12);
  background: #fff;
}
.field .hint { font-size: 12px; color: var(--success); margin-top: 4px; min-height: 18px; }

.field-btn { justify-content: flex-end; }
.field-btn button {
  height: 42px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(120deg, var(--primary), #4a8bff);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(29, 110, 245, 0.3);
}
.field-btn button:hover { background: var(--primary-dark); }
.field-btn button:active { transform: scale(0.98); }
.field-btn button:disabled { opacity: 0.6; cursor: not-allowed; }

.error { color: var(--danger); font-size: 13px; margin-top: 12px; }

/* ---------- 实时标签 ---------- */
.live-tag {
  display: inline-block;
  background: #e6f7ef;
  color: var(--success);
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  padding: 1px 8px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ---------- 方数明细 ---------- */
.cbm-detail {
  font-size: 15px;
  background: #f0f6ff;
  border: 1px dashed #b9d4ff;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
  font-family: "SF Mono", Consolas, monospace;
}
.cbm-detail b { color: var(--primary); }

/* ---------- 计费重三栏 ---------- */
.weight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.weight-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  background: #fafbfd;
}
.weight-item.highlight {
  background: linear-gradient(135deg, #eef5ff, #f3efff);
  border-color: #c3d8ff;
}
.weight-label { display: block; font-size: 13px; color: var(--text-light); }
.weight-label small { display: block; font-size: 11px; }
.weight-value { font-size: 22px; font-weight: 700; color: var(--primary-dark); }
.weight-item.highlight .weight-value { color: #6d4df2; }

/* ---------- 渠道对比表 ---------- */
.table-wrap { overflow-x: auto; }   /* 手机端表格横向滚动，避免挤压 */
.rate-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.rate-table th, .rate-table td {
  padding: 12px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  white-space: nowrap;
}
.rate-table thead th {
  background: #f0f4fa;
  color: var(--text-light);
  font-weight: 600;
  font-size: 13px;
}
.rate-table tbody tr:hover { background: #f7faff; }
.rate-table .price { color: var(--danger); font-weight: 700; font-size: 16px; }
.rate-table .best td { background: #effaf3; }
.rate-table .best .price { color: var(--success); }
.rate-table .na { color: #9ca3af; }
.badge-best {
  display: inline-block;
  background: var(--success);
  color: #fff;
  font-size: 11px;
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
}

.tips { font-size: 12px; color: var(--text-light); margin-top: 10px; }

.footer { text-align: center; color: #9ca3af; font-size: 12px; margin-top: 24px; }

/* ---------- 手机端微调 ---------- */
@media (max-width: 600px) {
  .header h1 { font-size: 21px; }
  .card { padding: 16px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .field-btn { grid-column: 1 / -1; }
  .weight-value { font-size: 18px; }
}
