:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #1c2333;
  --ink-2: #5b6478;
  --line: #e6e9f0;
  --brand: #1f6feb;
  --brand-soft: #e8f1ff;
  --ok: #12a150;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(24, 39, 75, .06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  padding-bottom: 72px;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #1f6feb, #38bdf8); color: #fff; font-weight: 700;
}
.brand-name { font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: var(--ink-2); }
.chip {
  font-size: 12px; color: var(--ink-2); background: var(--bg);
  padding: 4px 10px; border-radius: 999px; max-width: 46vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 主体 */
#view { padding: 14px 14px 20px; max-width: 760px; margin: 0 auto; }
.loading { text-align: center; color: var(--ink-2); padding: 40px 0; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); margin-bottom: 12px;
}
.card-title { font-weight: 700; font-size: 15px; margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--ink-2); font-size: 13px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; }
.row + .row { border-top: 1px dashed var(--line); }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 10px 16px; background: var(--brand);
  color: #fff; font-weight: 600; cursor: pointer;
}
.btn.block { width: 100%; }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.line { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid #f3c9c9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.actions { display: flex; gap: 10px; margin-top: 12px; }
.actions .btn { flex: 1; }

/* 表单 */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
input[type=text], input[type=tel], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fbfcfe; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); background: #fff; }
.inline { display: flex; gap: 8px; }
.inline > * { flex: 1; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 7px 14px; cursor: pointer; font-size: 13px;
}
.seg button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 门店 */
.store { display: flex; gap: 12px; align-items: flex-start; }
.store-logo {
  width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 18px;
}
.store-name { font-weight: 600; }
.store-addr { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.dist { font-size: 12px; color: var(--brand); white-space: nowrap; }
.price-tag { font-size: 12px; color: var(--ok); }

/* 徽标 */
.badge {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
}
.badge.ok { background: #e6f7ee; color: var(--ok); }
.badge.warn { background: #fdf1e0; color: var(--warn); }
.badge.danger { background: #fdeaea; color: var(--danger); }
.badge.gray { background: #eef0f4; color: var(--ink-2); }

/* 订单 */
.order-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--ink-2); }
.price { font-size: 20px; font-weight: 700; }
.files { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 13px; }
.timeline li:before {
  content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--brand);
}
.timeline li:after {
  content: ""; position: absolute; left: 7px; top: 14px; bottom: 0; width: 2px; background: var(--line);
}
.timeline li:last-child:before { background: var(--line); }
.timeline li:last-child:after { display: none; }
.timeline li.pending:before { background: #cfd6e4; }

/* 指标 */
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.metric { background: #fff; border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.metric b { display: block; font-size: 19px; }
.metric span { font-size: 12px; color: var(--ink-2); }

/* 底部导航 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: #fff; border-top: 1px solid var(--line); padding: 6px 0 env(safe-area-inset-bottom);
}
.tabbar a { flex: 1; text-align: center; font-size: 11px; color: var(--ink-2); }
.tabbar a i { display: block; font-style: normal; font-size: 20px; margin-bottom: 2px; }
.tabbar a.on { color: var(--brand); }

/* 文件上传 */
.upload-box {
  border: 1px dashed #c8d2e6; border-radius: var(--radius); padding: 18px; text-align: center;
  background: #fbfcfe; cursor: pointer;
}
.file-item { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.hint { font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(28,35,51,.92); color: #fff; padding: 9px 16px; border-radius: 999px;
  font-size: 13px; z-index: 99; max-width: 84vw; text-align: center;
}
.empty { text-align: center; color: var(--ink-2); padding: 34px 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 13px; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.split { display: flex; justify-content: space-between; gap: 10px; }
@media (max-width: 420px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
}
