:root {
  --primary: #ff6a00;
  --primary-dark: #e55e00;
  --primary-light: #fff3e8;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2329;
  --text-2: #6b7280;
  --border: #e6e8eb;
  --green: #10b981;
  --red: #ef4444;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- 头部 ---------- */
.page-header {
  background: linear-gradient(135deg, #ff8a00, #ff6a00);
  color: #fff;
  padding: 22px 16px 20px;
}
.page-header h1 { font-size: 20px; font-weight: 700; }
.page-header .sub { font-size: 13px; opacity: 0.92; margin-top: 4px; }

/* ---------- 布局 ---------- */
.container { max-width: 640px; margin: 0 auto; padding: 14px 12px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.req { color: var(--red); margin-left: 2px; }
.opt-tip { font-size: 12px; color: var(--text-2); font-weight: 400; margin-left: 6px; }

/* ---------- 选项 ---------- */
.opt-grid { display: grid; gap: 10px; }
.opt-grid.two { grid-template-columns: 1fr 1fr; }
.opt-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.opt-grid.one { grid-template-columns: 1fr; }

.opt-card.center { align-items: center; text-align: center; }

.opt-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
}
.opt-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.opt-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}
.opt-card:has(input:checked) .opt-name { color: var(--primary-dark); }
.opt-card .opt-name { font-weight: 600; font-size: 15px; }
.opt-card .opt-desc { font-size: 12px; color: var(--text-2); }

.opt-card.row { flex-direction: row; align-items: center; justify-content: space-between; }
.opt-card.row .opt-name { flex: 1; }
.opt-card .opt-price { color: var(--primary-dark); font-weight: 700; font-size: 15px; }

/* ---------- 对比链接 ---------- */
.compare-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  color: #2563eb;
}

/* ---------- 表单 ---------- */
.field-hint { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
textarea, input[type="text"] {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  resize: vertical;
}
textarea:focus, input[type="text"]:focus { border-color: var(--primary); }

/* ---------- 价格表 ---------- */
.price-list { list-style: none; }
.price-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px dashed var(--border);
}
.price-row:last-child { border-bottom: none; }
.price-row.empty { color: var(--text-2); }
.price-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1.5px solid var(--border);
  font-weight: 700;
  font-size: 16px;
}
.total-num { color: var(--red); font-size: 22px; }
.total-num b { font-weight: 800; }

.form-gap { height: 96px; }

/* ---------- 底部结算栏 ---------- */
.checkout-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  z-index: 100;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}
.checkout-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.checkout-total { font-size: 14px; color: var(--text-2); }
.checkout-total b { color: var(--red); font-size: 22px; }
.checkout-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.checkout-note { font-size: 11px; color: var(--text-2); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 22px;
  padding: 10px 28px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 22px;
  padding: 9px 22px;
  font-size: 15px;
  cursor: pointer;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-mask[hidden] { display: none; }
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  position: relative;
}
.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal-tip { font-size: 13px; color: var(--text-2); margin-bottom: 16px; }
.code-box {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--primary-dark);
  background: var(--primary-light);
  border: 1.5px dashed var(--primary);
  border-radius: 12px;
  padding: 16px 8px;
  margin-bottom: 18px;
  user-select: all;
}
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-close {
  display: block;
  margin: 18px auto 0;
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.78);
  color: #fff;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 300;
  max-width: 80%;
  text-align: center;
}
.toast[hidden] { display: none; }

/* ============================================================
   进度查询页
   ============================================================ */
.track-hero {
  background: linear-gradient(135deg, #ff8a00, #ff6a00);
  color: #fff;
  padding: 22px 16px;
  text-align: center;
}
.track-hero h1 { font-size: 19px; }
.track-hero .code-big { font-size: 26px; font-weight: 800; letter-spacing: 2px; margin: 8px 0 2px; }

.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}
.tl-item { position: relative; padding: 12px 0; }
.tl-dot {
  position: absolute;
  left: -24px;
  top: 16px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d1d5db;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px #d1d5db;
}
.tl-item.done .tl-dot { background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.tl-item.current .tl-dot { background: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.tl-title { font-weight: 700; font-size: 15px; }
.tl-item.done .tl-title, .tl-item.current .tl-title { color: var(--text); }
.tl-item.pending .tl-title { color: var(--text-2); }
.tl-time { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.tl-status { font-size: 12px; }

.search-box { display: flex; gap: 8px; }
.search-box input { flex: 1; text-transform: uppercase; letter-spacing: 1px; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.pending { background: #fef3c7; color: #b45309; }
.badge.accepted { background: #dbeafe; color: #1d4ed8; }
.badge.building { background: #ede9fe; color: #6d28d9; }
.badge.delivered { background: #d1fae5; color: #047857; }
.badge.completed { background: #e5e7eb; color: #374151; }
.badge.urged { background: #fee2e2; color: #b91c1c; }

/* ============================================================
   后台管理
   ============================================================ */
.admin-header {
  background: #1f2329;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-header h1 { font-size: 17px; }
.admin-header a { color: #fff; font-size: 13px; opacity: 0.85; }
.admin-wrap { max-width: 960px; margin: 0 auto; padding: 16px 12px; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar .stat { font-size: 13px; color: var(--text-2); }
.filter-tab {
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text-2);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
}
.filter-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.order-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.order-table th, .order-table td {
  padding: 12px 10px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.order-table th { background: #fafafa; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.order-table tr:last-child td { border-bottom: none; }
.order-table .code-cell { font-weight: 700; color: var(--primary-dark); letter-spacing: 0.5px; }
.order-table a.code-cell:hover { text-decoration: underline; }

.btn-small {
  display: inline-block;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
}
.btn-small.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-small.danger { color: var(--red); border-color: #fecaca; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.form-row input, .form-row textarea, .form-row select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { border-color: var(--primary); }

/* 登录页 */
.login-wrap { max-width: 380px; margin: 60px auto; padding: 0 16px; }
.login-card { background: #fff; border-radius: 16px; padding: 28px 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 20px; }

/* 详情页信息 */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.detail-grid .k { color: var(--text-2); font-size: 13px; }
.detail-grid .v { font-size: 14px; font-weight: 500; word-break: break-all; }
.detail-grid .full { grid-column: 1 / -1; }

.muted { color: var(--text-2); font-size: 13px; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }

/* 图片网格 */
.img-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.img-item { position: relative; display: block; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.img-item img { width: 100%; height: 90px; object-fit: cover; display: block; }
.img-tag { position: absolute; left: 0; bottom: 0; right: 0; font-size: 10px; padding: 2px 6px; color: #fff; background: rgba(0,0,0,.5); }
.img-tag.t-admin { background: rgba(16,185,129,.85); }
.img-tag.t-client { background: rgba(37,99,235,.85); }

@media (max-width: 480px) {
  .opt-grid.two { grid-template-columns: 1fr 1fr; }
  .order-table { display: block; overflow-x: auto; white-space: nowrap; }
}
