:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --radius: 14px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------- 页头 ---------- */
.page-header {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  color: #fff;
  padding: 28px 16px 22px;
  text-align: center;
}
.page-header h1 { font-size: 24px; font-weight: 700; letter-spacing: 1px; }
.page-header p { margin-top: 6px; font-size: 14px; opacity: 0.9; }

.admin-header { padding: 16px; }
.admin-header .header-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  text-align: left;
}
.admin-header h1 { font-size: 20px; }
.header-actions { display: flex; gap: 10px; }

/* ---------- 布局 ---------- */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px 60px;
}
.container.wide { max-width: 1080px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  padding: 18px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-title::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--primary);
  display: inline-block;
}

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

.field label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 7px;
}
.req { color: var(--danger); }
.opt { color: var(--muted); font-weight: 400; font-size: 13px; }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 52px; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field .input-suffix { position: relative; }
.field .input-suffix input { padding-right: 52px; }
.field .input-suffix .suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
  pointer-events: none;
}

.field-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 6px;
  display: none;
}
.field-error.show { display: block; }
.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--danger); }

/* ---------- 省市区 ---------- */
.region-row { display: flex; gap: 8px; }
.region-row select {
  flex: 1;
  min-width: 0;
  padding: 22px 12px;
  font-size: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.region-row select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.region-row select option { color: var(--text); }

/* ---------- 按钮 ---------- */
.btn-submit {
  width: 100%;
  padding: 14px;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
  font-family: inherit;
}
.btn-submit:active { transform: scale(0.98); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-primary:active { background: var(--primary-dark); }

.btn-secondary {
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
}
.btn-secondary:active { background: #f8fafc; }

.btn-quick {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--primary-dark);
  background: var(--primary-light);
  border: 1px solid #dbeafe;
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
}
.btn-quick:active { background: #dbeafe; }

.btn-danger {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}
.btn-danger:active { background: #fecaca; }

.form-tip { text-align: center; color: var(--muted); font-size: 13px; margin-top: 12px; }

/* ---------- 提交成功 ---------- */
.success-panel { text-align: center; padding: 48px 20px; }
.success-icon {
  width: 84px;
  height: 84px;
  line-height: 84px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  font-size: 44px;
  font-weight: 700;
}
.success-panel h2 { font-size: 22px; margin-bottom: 8px; }
.success-panel p { color: var(--muted); margin-bottom: 24px; }

/* ---------- 页脚 ---------- */
.page-footer {
  text-align: center;
  padding: 20px 16px 32px;
  color: var(--muted);
  font-size: 13px;
}
.page-footer a { color: var(--muted); text-decoration: none; border-bottom: 1px dashed var(--muted); }

/* ---------- 登录页 ---------- */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card { width: 100%; max-width: 360px; text-align: center; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .muted { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.login-card .field { text-align: left; }
.error-text { color: var(--danger); font-size: 14px; margin-top: 12px; }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.toolbar label { font-size: 15px; font-weight: 500; }
.toolbar input[type="date"] {
  padding: 9px 12px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  color: var(--text);
}
.summary-bar {
  color: var(--muted);
  font-size: 14px;
  margin: 4px 2px 14px;
}

/* ---------- 表格 ---------- */
.table-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; min-width: 960px; }
thead th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  white-space: nowrap;
}
tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tr.group-head td {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 14px;
}
tr.group-foot td {
  background: #f8fafc;
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 14px;
}
tr.total-foot td {
  background: var(--success-bg);
  color: #14532d;
  font-weight: 700;
  font-size: 15px;
}
.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-content {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
}
.modal-content h2 { font-size: 18px; margin-bottom: 4px; }
.modal-content .muted { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.modal-content img { width: 240px; height: 240px; margin-bottom: 12px; }
.qr-url {
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
  margin-bottom: 16px;
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 10px;
}
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions .btn-primary { flex: 1; }
.modal-actions .btn-secondary { flex: 1; }
/* ---------- 业务类型选择（装车/卸车） ---------- */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 6px;
}
.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  transition: transform 0.1s, border-color 0.15s, box-shadow 0.15s;
}
.mode-card:hover { border-color: var(--primary); }
.mode-card:active { transform: scale(0.97); }
.mode-icon { font-size: 44px; line-height: 1; }
.mode-title { font-size: 18px; font-weight: 700; color: var(--text); }
.mode-desc { font-size: 12px; color: var(--muted); }

.mode-note {
  font-size: 13px;
  color: var(--primary-dark);
  background: var(--primary-light);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
}

.btn-link {
  display: block;
  width: 100%;
  margin-top: 14px;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  text-align: center;
}

/* ---------- 管理端分节（装车/卸车） ---------- */
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 20px 2px 10px;
  color: var(--primary-dark);
}
.grand-total {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--success-bg);
  color: #14532d;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
}
/* ---------- 装货/卸货地区两行固定 ---------- */
.region-line { margin-bottom: 18px; }
.region-line:last-child { margin-bottom: 0; }
.region-line-label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 7px;
}
.fixed-location {
  padding: 22px 12px;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  color: var(--primary-dark);
  background: var(--primary-light);
  border: 1px dashed var(--primary);
  border-radius: 10px;
}
