:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --border: #e4e6eb;
  --border-strong: #d0d4dc;
  --text: #16181d;
  --text-2: #5b616e;
  --text-3: #8b919e;
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-soft: #eff4ff;
  --ok: #12813f;
  --ok-soft: #e9f7ef;
  --warn: #a16207;
  --warn-soft: #fef8e7;
  --err: #c02626;
  --err-soft: #fdeeee;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .12);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

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

/* ---------- 布局 ---------- */
.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 20px 96px;
}
.wrap-narrow { max-width: 720px; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  font-size: 15px;
  color: var(--text);
}
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.topbar-nav { margin-left: auto; display: flex; gap: 6px; }
.topbar-nav a {
  color: var(--text-2);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.topbar-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.topbar-nav a.active { color: var(--brand); background: var(--brand-soft); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}
.card-flat { box-shadow: none; }
.card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}
.card-title { font-size: 15px; font-weight: 650; margin: 0; }
.card-sub { font-size: 13px; color: var(--text-2); margin: 2px 0 0; }
.step-no {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-top: 1px;
}
.step-no.done { background: var(--ok-soft); color: var(--ok); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.label .opt { font-weight: 400; color: var(--text-3); margin-left: 4px; }
.hint { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }

.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.textarea {
  min-height: 132px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
}
.input.invalid, .textarea.invalid { border-color: var(--err); }
.input.invalid:focus, .textarea.invalid:focus { box-shadow: 0 0 0 3px rgba(192, 38, 38, .1); }

.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-lg { padding: 11px 20px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* ---------- 商品选择 ---------- */
.products { display: grid; gap: 10px; }
.product {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--surface);
}
.product:hover { border-color: var(--border-strong); background: var(--surface-2); }
.product.selected { border-color: var(--brand); background: var(--brand-soft); }
.product input { display: none; }
.product-body { flex: 1; min-width: 0; }
.product-name { font-weight: 600; font-size: 14px; }
.product-desc { font-size: 12.5px; color: var(--text-2); }
.product-price {
  font-family: var(--mono);
  font-weight: 650;
  font-size: 16px;
  letter-spacing: -.02em;
}
.radio-dot {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: grid;
  place-items: center;
}
.product.selected .radio-dot { border-color: var(--brand); }
.product.selected .radio-dot::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}

/* ---------- 状态提示 ---------- */
.msg {
  display: none;
  align-items: flex-start;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  margin-top: 8px;
  border: 1px solid transparent;
}
.msg.show { display: flex; }
.msg-err { background: var(--err-soft); border-color: #f3c9c9; color: var(--err); }
.msg-ok { background: var(--ok-soft); border-color: #bfe6cf; color: var(--ok); }
.msg-warn { background: var(--warn-soft); border-color: #f0dfad; color: var(--warn); }
.msg-info { background: var(--brand-soft); border-color: #cfdffd; color: var(--brand); }
.msg-icon { flex: none; font-weight: 700; }

/* 校验清单 */
.checks { margin-top: 10px; display: grid; gap: 6px; }
.check-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.check-item.err { background: var(--err-soft); border-color: #f3c9c9; color: var(--err); }
.check-item.warn { background: var(--warn-soft); border-color: #f0dfad; color: var(--warn); }
.check-item.ok { background: var(--ok-soft); border-color: #bfe6cf; color: var(--ok); }
.check-mark { flex: none; font-weight: 700; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.badge-ok { background: var(--ok-soft); border-color: #bfe6cf; color: var(--ok); }
.badge-warn { background: var(--warn-soft); border-color: #f0dfad; color: var(--warn); }
.badge-err { background: var(--err-soft); border-color: #f3c9c9; color: var(--err); }
.badge-info { background: var(--brand-soft); border-color: #cfdffd; color: var(--brand); }
.badge-dot::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  font-size: 12.5px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table tr:last-child td { border-bottom: none; }
.table .mono { font-family: var(--mono); font-size: 12px; }

/* ---------- 消息列表 ---------- */
.notice {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--surface);
}
.notice-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.notice-title { font-weight: 600; font-size: 13.5px; }
.notice-time { margin-left: auto; font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.notice-body {
  font-size: 12.5px;
  color: var(--text-2);
  white-space: pre-wrap;
  font-family: var(--mono);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
}

/* ---------- 时间线 ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  position: relative;
  padding: 0 0 16px 22px;
  border-left: 2px solid var(--border);
  margin-left: 5px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
}
.timeline li.ok::before { border-color: var(--ok); background: var(--ok); }
.timeline li.active::before { border-color: var(--brand); background: var(--brand); }
.tl-title { font-size: 13px; font-weight: 600; }
.tl-note { font-size: 12.5px; color: var(--text-2); }
.tl-time { font-size: 11.5px; color: var(--text-3); font-family: var(--mono); }

/* ---------- 收银台 ---------- */
.cashier-shell {
  max-width: 420px;
  margin: 0 auto;
}
.cashier-amount {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.cashier-amount .unit { font-size: 18px; font-weight: 600; margin-right: 2px; }
.pay-methods { display: grid; gap: 8px; margin: 18px 0; }
.pay-method {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  background: var(--surface);
}
.pay-method.selected { border-color: var(--brand); background: var(--brand-soft); }
.pay-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex: none;
}
.pi-blue { background: #1677ff; }
.pi-green { background: #07c160; }
.pi-gray { background: #6b7280; }
.pay-name { font-size: 13.5px; font-weight: 550; }
.pay-desc { font-size: 12px; color: var(--text-2); }

/* ---------- 其他 ---------- */
.section-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 28px 0 12px;
}
.divider { height: 1px; background: var(--border); margin: 20px 0; border: none; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack > * + * { margin-top: 10px; }
.spin {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 550; }

.steps-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.steps-line .s-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  color: var(--text-3);
}
.steps-line .s-dot.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.steps-line .s-dot.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps-line .s-sep { width: 14px; height: 1px; background: var(--border-strong); }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
  font-size: 13px;
}

@media (max-width: 640px) {
  .wrap { padding: 20px 14px 80px; }
  .card { padding: 18px; }
  .kv { grid-template-columns: 80px 1fr; }
}
