/* ---------------------------------------------------------------
   商家转账免确认授权 — 视觉基调取自纸质回单：
   冷调纸面、墨黑正文、等宽对齐的金额与单号、唯一强调色为微信支付绿。
   --------------------------------------------------------------- */

:root {
  --paper: #f7f6f3;
  --paper-raised: #fffefb;
  --ink: #1b1f1d;
  --ink-muted: #6b7370;
  --rule: #e2e0da;
  --green: #07c160;
  --green-deep: #05984b;
  --alert: #c4442e;

  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
          system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --step: 1.5rem;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.0625rem; }
h3 { font-size: 0.9375rem; }

p { margin: 0 0 0.75rem; max-width: 34em; }
p:last-child { margin-bottom: 0; }

a { color: var(--green-deep); }

.muted { color: var(--ink-muted); }
.small { font-size: 0.8125rem; line-height: 1.55; }
.num { font-variant-numeric: tabular-nums; }
.no  { font-family: var(--mono); font-size: 0.8125rem; word-break: break-all; }

/* ---------------------------------------------------------- 凭条卡片 */

/* 撕口用 mask 从纸面裁掉，缺口是切进纸里的，不是背景压在纸上。
   投影加在外层，drop-shadow 会跟随 mask 后的形状走。 */
.sheet-wrap {
  filter:
    drop-shadow(0 1px 2px rgba(27, 31, 29, 0.10))
    drop-shadow(0 0 1px rgba(27, 31, 29, 0.14));
}

.sheet {
  --tear: 10px;
  background: var(--paper-raised);
  padding: 1.75rem 1.5rem calc(1.5rem + var(--tear));
  -webkit-mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--tear)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg)
      bottom / 18px var(--tear) repeat-x;
  mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--tear)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg)
      bottom / 18px var(--tear) repeat-x;
}

/* 不支持 mask 的老浏览器退化成普通卡片，不会破版 */
@supports not (mask: linear-gradient(#000 0 0)) {
  .sheet { border: 1px solid var(--rule); padding-bottom: 1.5rem; }
}

/* ---------------------------------------------------------- 用户端 */

.wrap-user {
  max-width: 26rem;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.brandline {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.8125rem;
  color: var(--ink-muted);
}
.brandline b { color: var(--ink); font-weight: 600; font-size: 0.9375rem; }

.lede { margin: 0.5rem 0 1.5rem; color: var(--ink-muted); }

/* 三步流程是真实序列，所以用序号 */
.steps { margin: 0 0 1.5rem; padding: 0; list-style: none; counter-reset: s; }
.steps li {
  counter-increment: s;
  position: relative;
  padding: 0 0 0.875rem 2rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}
.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 0.15rem;
  width: 1.375rem;
  height: 1.375rem;
  border: 1px solid var(--rule);
  border-radius: 50%;
  font-size: 0.75rem;
  line-height: 1.25rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  background: var(--paper);
}
.steps li:last-child { padding-bottom: 0; }
.steps li.is-done { color: var(--ink); }
.steps li.is-done::before {
  content: "✓";
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* ---------------------------------------------------------- 表单 */

.field { margin-bottom: 1rem; }
.field label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

input, select, textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper-raised);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9375rem;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
  border-color: transparent;
}
input.num, .amount-input { font-variant-numeric: tabular-nums; }

.hint { margin-top: 0.3125rem; font-size: 0.75rem; color: var(--ink-muted); }

button {
  font-family: inherit;
  font-size: 0.9375rem;
  cursor: pointer;
  border-radius: 3px;
}
button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.btn-primary {
  width: 100%;
  padding: 0.8125rem;
  border: none;
  background: var(--green);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { background: var(--green-deep); }
.btn-primary:disabled { background: #b9c2bd; cursor: not-allowed; }

.btn-quiet {
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  font-size: 0.8125rem;
}
.btn-quiet:hover { border-color: var(--ink-muted); }
.btn-quiet.danger { color: var(--alert); }

/* ---------------------------------------------------------- 状态 */

.state { display: inline-flex; align-items: center; gap: 0.375rem; font-size: 0.8125rem; }
.state::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-muted);
}
.state.ok::before      { background: var(--green); }
.state.pending::before { background: #d9a441; }
.state.bad::before     { background: var(--alert); }

.notice {
  margin: 1rem 0 0;
  padding: 0.75rem 0.875rem;
  border-left: 2px solid var(--rule);
  font-size: 0.8125rem;
  color: var(--ink-muted);
  background: var(--paper);
}
.notice.error { border-left-color: var(--alert); color: var(--alert); }
.notice.ok    { border-left-color: var(--green); color: var(--green-deep); }

/* 授权成功后的收款额展示 */
.receipt-done { text-align: center; padding: 0.5rem 0 0; }
.receipt-done .mark {
  width: 44px; height: 44px;
  margin: 0 auto 0.875rem;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 1.375rem;
  line-height: 44px;
}
.kv {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--rule);
  font-size: 0.875rem;
  text-align: left;
}
.kv:last-child { border-bottom: none; }
.kv dt { color: var(--ink-muted); flex: none; }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- 商户端 */

.wrap-admin {
  display: grid;
  grid-template-columns: 20rem 1fr;
  gap: 2rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  align-items: start;
}

.console-head {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
.console-head .meta { font-size: 0.8125rem; color: var(--ink-muted); }
.console-head .meta b {
  color: var(--ink);
  font-weight: 500;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.panel { position: sticky; top: 2rem; }
.panel h2 { margin-bottom: 0.875rem; }

.block { margin-bottom: 2.5rem; }
.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
th, td {
  padding: 0.625rem 0.75rem 0.625rem 0;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
th {
  font-weight: 500;
  color: var(--ink-muted);
  border-bottom-color: var(--ink-muted);
  white-space: nowrap;
}
/* 数字列右对齐，但仍要留出与下一列的间距，否则金额会贴上状态 */
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 1.5rem; }
/* 只有真正处在最后一列时才收掉右内边距 */
td.num:last-child, th.num:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 0.375rem; justify-content: flex-end; }

.empty {
  padding: 1.5rem 0;
  color: var(--ink-muted);
  font-size: 0.875rem;
}

@media (max-width: 860px) {
  .wrap-admin { grid-template-columns: 1fr; gap: 1.5rem; padding: 1.5rem 1rem 3rem; }
  .panel { position: static; }
  table { font-size: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
