/* 订单轨迹查询系统 - 全站样式（无外部依赖，可离线使用） */
:root {
  --pri: #2563eb;
  --pri-d: #1d4ed8;
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --ok: #16a34a;
  --err: #dc2626;
  --warn: #d97706;
  --side: #111827;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--pri); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 12.5px;
}

/* ---------- 顶部 ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
.topbar-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; color: var(--text); }
.brand .logo {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, var(--pri), #7c3aed);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.brand:hover { text-decoration: none; }
.topbar .link-muted { color: var(--muted); font-size: 13px; }

/* ---------- 查询页 ---------- */
.page { max-width: 900px; margin: 0 auto; padding: 26px 20px 70px; }
.hero { text-align: center; padding: 30px 0 22px; }
.hero h1 { margin: 0 0 8px; font-size: 23px; letter-spacing: .3px; }
.hero p { margin: 0; color: var(--muted); font-size: 13.5px; }

.search-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(17, 24, 39, .04);
}
.search-row { display: flex; gap: 10px; }
.search-row input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-row input:focus { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.search-tip { color: var(--muted); font-size: 12.5px; margin-top: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--pri);
  color: #fff;
  border: 0;
  border-radius: 7px;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.btn:hover { background: var(--pri-d); text-decoration: none; }
.btn:disabled { background: #9ca3af; cursor: not-allowed; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid #d1d5db; }
.btn-ghost:hover { background: #f9fafb; }
.btn-danger { background: var(--err); }
.btn-danger:hover { background: #b91c1c; }
.btn-link {
  background: none; border: 0; padding: 0; color: var(--pri);
  cursor: pointer; font-size: 13px;
}
.btn-link.danger { color: var(--err); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 16px;
  overflow: hidden;
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ---------- 订单摘要 ---------- */
.order-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  align-items: flex-start;
  justify-content: space-between;
}
.order-no { font-size: 19px; font-weight: 700; letter-spacing: .2px; word-break: break-all; }
.order-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: #eef2ff;
  color: #4338ca;
}
.pill.gray { background: #f3f4f6; color: #4b5563; }
.pill.ok { background: #ecfdf5; color: #047857; }
.pill.warn { background: #fffbeb; color: #b45309; }

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 24px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.kv-item .k { color: var(--muted); font-size: 12.5px; margin-bottom: 2px; }
.kv-item .v { font-size: 14px; word-break: break-word; }
.spec-text {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f9fafb;
  border: 1px solid #f0f1f3;
  border-radius: 7px;
  padding: 12px 14px;
  margin-top: 6px;
  font-size: 13.5px;
  line-height: 1.7;
}

/* ---------- 时间轴 ---------- */
.timeline { position: relative; padding: 4px 0 0 28px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 9px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(#dbeafe, #e5e7eb);
}
.tl-item { position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 4px; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -28px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--pri);
  box-shadow: 0 0 0 3px #fff;
}
.tl-item.is-new::before { background: var(--pri); }
.tl-time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-text {
  margin-top: 3px;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}
.tl-src { font-size: 11.5px; color: #9ca3af; margin-top: 3px; }

/* ---------- 空状态 / 提示 ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .icon { font-size: 34px; opacity: .35; margin-bottom: 8px; }

.alert { padding: 11px 14px; border-radius: 7px; font-size: 13.5px; margin-bottom: 14px; }
.alert.err { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert.ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert.warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert.info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 5px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=password], input[type=date], input[type=datetime-local], input[type=number], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 180px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left;
  padding: 10px 14px;
  background: #f9fafb;
  color: #4b5563;
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.data td {
  padding: 11px 14px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fafbfc; }
table.data .num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ellipsis { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 分页 ---------- */
.pager { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); }
.pager a, .pager span {
  min-width: 32px; height: 32px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 6px;
  font-size: 13px; color: var(--text); background: #fff;
}
.pager a:hover { border-color: var(--pri); color: var(--pri); text-decoration: none; }
.pager .cur { background: var(--pri); border-color: var(--pri); color: #fff; }
.pager .sum { border: 0; background: none; color: var(--muted); margin-left: auto; }

/* ---------- 后台布局 ---------- */
.admin { display: flex; min-height: 100vh; }
.sidebar {
  width: 208px;
  flex: none;
  background: var(--side);
  color: #9ca3af;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .s-brand {
  padding: 18px 18px 16px;
  color: #fff;
  font-weight: 600;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid #1f2937;
}
.sidebar .s-brand .logo {
  width: 24px; height: 24px; border-radius: 6px; flex: none;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.sidebar nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: 6px;
  color: #9ca3af; font-size: 13.5px; margin-bottom: 2px;
}
.sidebar nav a:hover { background: #1f2937; color: #e5e7eb; text-decoration: none; }
.sidebar nav a.active { background: var(--pri); color: #fff; }
.sidebar .s-foot { padding: 12px 16px; border-top: 1px solid #1f2937; font-size: 12.5px; }
.sidebar .s-foot a { color: #9ca3af; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-head {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.main-head h1 { margin: 0; font-size: 16px; font-weight: 600; }
.main-head .who { font-size: 13px; color: var(--muted); }
.main-body { padding: 20px 22px 60px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .label { font-size: 12.5px; color: var(--muted); }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .value.small { font-size: 17px; font-weight: 600; }

.filter-bar {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
}
.filter-bar .field { margin: 0; flex: 1; min-width: 140px; }
.filter-bar .field.wide { flex: 2; min-width: 220px; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 370px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 30px 26px 26px;
  box-shadow: 0 6px 24px rgba(17, 24, 39, .06);
}
.login-card h1 { margin: 0 0 4px; font-size: 19px; text-align: center; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-card .btn { width: 100%; padding: 11px; }

.mono { font-family: Consolas, Monaco, "Courier New", monospace; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.text-right { text-align: right; }
.mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0; }
.hidden { display: none; }

@media (max-width: 860px) {
  .admin { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; }
  .sidebar .s-brand { border-bottom: 0; padding: 12px 14px; flex: none; }
  .sidebar nav { display: flex; overflow-x: auto; padding: 8px; }
  .sidebar nav a { white-space: nowrap; margin-bottom: 0; }
  .sidebar .s-foot { display: none; }
  .main-body { padding: 14px 14px 50px; }
  .search-row { flex-direction: column; }
  .search-row .btn { width: 100%; }
}

/* ---------- 接口文档页 ---------- */
.doc-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 20px 70px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.doc-nav {
  width: 196px;
  flex: none;
  position: sticky;
  top: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 8px;
}
.doc-nav .group { font-size: 11px; color: #9ca3af; letter-spacing: .6px; padding: 10px 10px 4px; }
.doc-nav a { display: block; padding: 6px 10px; border-radius: 6px; color: #4b5563; font-size: 13px; }
.doc-nav a:hover { background: #f3f4f6; color: var(--pri); text-decoration: none; }
.doc-main { flex: 1; min-width: 0; }
.doc-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  scroll-margin-top: 18px;
}
.doc-section > h2 { margin: 0 0 10px; font-size: 16.5px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-section h3 { font-size: 13.5px; margin: 18px 0 8px; color: #374151; }
.doc-section p { margin: 8px 0; }
.method {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .3px;
}
.method.get { background: #059669; }
.method.post { background: var(--pri); }
.endpoint {
  display: block;
  background: #f8fafc;
  border: 1px solid #e8ebef;
  border-radius: 6px;
  padding: 9px 12px;
  font-family: Consolas, Monaco, monospace;
  font-size: 12.8px;
  word-break: break-all;
  color: #0f172a;
  margin: 8px 0 12px;
}
pre.code {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 12.8px;
  line-height: 1.7;
  font-family: Consolas, Monaco, monospace;
  margin: 8px 0 0;
}
pre.code .c { color: #7dd3fc; }
pre.code .s { color: #86efac; }
.req-line { display: flex; align-items: center; gap: 8px; }
.doc-section td code,
.doc-section p code {
  word-break: break-all;
}
@media (max-width: 860px) {
  .doc-wrap { flex-direction: column; align-items: stretch; padding: 14px 14px 50px; }
  .doc-nav { width: 100%; position: static; }
  .doc-nav a { display: inline-block; }
  .doc-section { padding: 16px 14px; }
  .doc-main { width: 100%; }
  .order-hero > .text-right { text-align: left; }
}
