:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --green: #2fb344;
  --orange: #f08300;
  --red: #e60012;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --radius: 12px;
}

* { box-sizing: border-box; }

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

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

.container { max-width: 720px; margin: 0 auto; padding: 24px 16px 60px; }

/* 头部 */
.topbar {
  background: linear-gradient(135deg, #0b3d91 0%, #1a73e8 60%, #2f9bff 100%);
  color: #fff;
  padding: 40px 16px 48px;
  text-align: center;
}
.topbar h1 { margin: 0 0 6px; font-size: 26px; font-weight: 700; letter-spacing: 1px; }
.topbar p { margin: 0; opacity: .9; font-size: 14px; }

/* 查询框 */
.search-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,.08);
  padding: 20px;
  margin-top: -26px;
}
.search-row { display: flex; gap: 10px; }
.search-row input {
  flex: 1;
  height: 48px;
  padding: 0 16px;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.search-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,.12); }
.btn {
  height: 48px;
  padding: 0 24px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.small { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 8px; }
.btn.danger { background: #e5484d; }
.btn.green { background: var(--green); }

/* 结果卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.05);
  padding: 20px;
  margin-top: 16px;
}
.card h2 { margin: 0 0 4px; font-size: 18px; }
.muted { color: var(--muted); font-size: 13px; }

.hidden { display: none !important; }

/* 状态横幅 */
.status-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 16px;
  background: #eef6ff;
  border: 1px solid #cfe4ff;
}
.status-banner .dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(26,115,232,.15);
}
.status-banner.delivered { background: #eafaf0; border-color: #bfe8cd; }
.status-banner.delivered .dot { background: var(--green); box-shadow: 0 0 0 5px rgba(47,179,68,.15); }
.status-banner .label { font-size: 13px; color: var(--muted); }
.status-banner .value { font-size: 20px; font-weight: 700; }

/* 时间线 */
.timeline { margin-top: 8px; position: relative; padding-left: 4px; }
.tl-item { display: flex; gap: 14px; position: relative; padding: 0 0 22px 0; }
.tl-item:last-child { padding-bottom: 0; }
.tl-marker { display: flex; flex-direction: column; align-items: center; width: 26px; flex-shrink: 0; }
.tl-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid #cbd5e1; margin-top: 2px; z-index: 1;
}
.tl-item.reached .tl-dot { background: var(--primary); border-color: var(--primary); }
.tl-item.current .tl-dot { background: #fff; border-color: var(--primary); box-shadow: inset 0 0 0 4px var(--primary); }
.tl-line { flex: 1; width: 2px; background: #e5e7eb; margin-top: 2px; min-height: 30px; }
.tl-item.reached .tl-line { background: var(--primary); }
.tl-item:last-child .tl-line { display: none; }
.tl-body { flex: 1; }
.tl-title { font-weight: 600; }
.tl-item.reached .tl-title { color: var(--primary); }
.tl-item.pending .tl-title { color: #9ca3af; }
.tl-time { font-size: 12px; color: var(--muted); }
.tl-note { font-size: 12px; color: #6b7280; background: #f8fafc; padding: 4px 8px; border-radius: 6px; margin-top: 4px; display: inline-block; }

/* 快递事件 */
.ev-list { margin-top: 12px; }
.ev-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.ev-item:last-child { border-bottom: none; }
.ev-time { flex-shrink: 0; width: 120px; font-size: 13px; color: var(--muted); }
.ev-main { flex: 1; }
.ev-status { font-weight: 600; }
.ev-detail { font-size: 13px; color: var(--muted); }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: #eef2f7; color: #4b5563;
}
.badge.green { background: #eafaf0; color: #1a7f37; }
.badge.blue { background: #eef6ff; color: var(--primary); }
.badge.gray { background: #f3f4f6; color: #6b7280; }

.error-box {
  background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
  padding: 16px; border-radius: var(--radius); margin-top: 16px;
}
.empty-box {
  text-align: center; color: var(--muted); padding: 32px 0; margin-top: 16px;
  background: var(--card); border-radius: var(--radius);
}

/* 后台 */
.admin-body { max-width: 1080px; margin: 0 auto; padding: 0 16px 60px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; }
.admin-header h1 { margin: 0; font-size: 20px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select {
  height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; outline: none; font-size: 14px;
}
.toolbar .grow { flex: 1; min-width: 160px; }
.spacer { flex: 1; }

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: 0 4px 16px rgba(0,0,0,.05); }
th, td { padding: 12px 14px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--line); }
th { background: #f8fafc; color: #4b5563; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr.row { cursor: pointer; }
tr.row:hover { background: #f8fafc; }
.stage-chip { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; background: #eef6ff; color: var(--primary); font-weight: 600; }

/* 弹窗 */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: flex; align-items: flex-start; justify-content: center; z-index: 50; overflow-y: auto; padding: 30px 16px;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 640px; padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal h2 { margin: 0 0 16px; font-size: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; outline: none; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 90px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.login-wrap { max-width: 360px; margin: 80px auto; }
.login-card { background: var(--card); border-radius: var(--radius); padding: 32px; box-shadow: 0 10px 40px rgba(0,0,0,.08); }
.login-card h1 { margin: 0 0 20px; font-size: 20px; text-align: center; }
.login-card .field { margin-bottom: 14px; }

.toast {
  position: fixed; top: 20px; right: 20px; z-index: 100;
  background: #111827; color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: 0; transform: translateY(-8px); transition: .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: #b91c1c; }

.section-title { font-size: 15px; font-weight: 700; margin: 20px 0 6px; color: #374151; }
.mt0 { margin-top: 0; }
