:root {
  --bg: #f4f5fa;
  --card: #ffffff;
  --ink: #171a2b;
  --muted: #6b7186;
  --line: #e6e8f0;
  --brand: #4f46e5;
  --brand-soft: #eef0ff;
  --ok: #0f9d58;
  --warn: #c77700;
  --bad: #d93025;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 26, 43, .04), 0 8px 24px rgba(23, 26, 43, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  height: 62px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: .2px;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 26px; height: 26px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #4338ca);
  box-shadow: 0 4px 10px rgba(79, 70, 229, .35);
}

.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a {
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.nav a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }

.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }

main { max-width: 1120px; margin: 0 auto; padding: 28px 20px 64px; }

h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.2px; }
h2 { font-size: 16px; margin: 0 0 14px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat .label { color: var(--muted); font-size: 12.5px; letter-spacing: .3px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; letter-spacing: .3px; }
tr:last-child td { border-bottom: 0; }
td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #f1f2f8;
  color: var(--muted);
}
.tag.ok { background: #e7f6ee; color: var(--ok); }
.tag.warn { background: #fff4e5; color: var(--warn); }
.tag.bad { background: #fdecea; color: var(--bad); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }

form.inline { display: inline; }

button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
button:hover, .btn:hover { border-color: #cfd3e6; text-decoration: none; }
button.primary, .btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .28);
}
button.primary:hover { background: #4338ca; }
button.small { padding: 5px 11px; font-size: 12.5px; border-radius: 9px; }
button.ghost { background: transparent; }

label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=file], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font: inherit;
  font-size: 14px;
  background: #fbfbfe;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #a5a9f5;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .14);
}
textarea { min-height: 84px; resize: vertical; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 0 0 auto; }

.notice {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid #d9dcf0;
  background: #f6f7ff;
}
.notice.ok { background: #eaf7f0; border-color: #c7e9d7; }
.notice.bad { background: #fdecea; border-color: #f6c9c4; }
.notice pre { white-space: pre-wrap; word-break: break-all; margin: 8px 0 0; font-size: 12.5px; }
.notice .keyval { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt0 { margin-top: 0; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* pay page */
.pay-wrap { max-width: 460px; margin: 8vh auto; padding: 0 16px; }
.pay-card { text-align: center; padding: 30px 24px; }
.pay-amount { font-size: 44px; font-weight: 800; letter-spacing: -1.5px; margin: 6px 0 2px; }
.pay-amount small { font-size: 20px; font-weight: 600; color: var(--muted); }
.pay-qr { width: 232px; height: 232px; object-fit: contain; border-radius: 16px; border: 1px solid var(--line); background: #fff; padding: 8px; margin: 16px auto 6px; display: block; }
canvas.pay-qr { width: 232px; height: 232px; image-rendering: pixelated; padding: 0; }
.pay-qr-wrap { display: flex; justify-content: center; }
.pay-state { font-size: 15px; font-weight: 600; margin-top: 10px; }
.pay-step { color: var(--muted); font-size: 13px; margin-top: 4px; }
.countdown { font-variant-numeric: tabular-nums; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; padding: 30px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }

/* wide tables scroll instead of squeezing */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 560px; }

/* filter chips scroll horizontally instead of stacking into a tall block */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips > * { flex: 0 0 auto; }

@media (max-width: 720px) {
  .topbar { padding: 8px 12px; gap: 10px; height: auto; flex-wrap: wrap; }
  .brand { font-size: 15px; }
  .who { margin-left: auto; font-size: 12.5px; }
  .nav {
    order: 3; flex: 1 0 100%; width: 100%; flex-wrap: nowrap; overflow-x: auto;
    gap: 6px; padding-bottom: 2px; scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: 0 0 auto; padding: 7px 12px; }
  main { padding: 16px 12px 56px; }
  h1 { font-size: 20px; }
  .card { padding: 16px 14px; border-radius: 12px; margin-bottom: 14px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat .value { font-size: 21px; }
  button, .btn { min-height: 40px; }
  /* 16px fields stop mobile browsers from zooming the page on focus */
  input[type=text], input[type=password], input[type=number], input[type=url], input[type=file], select, textarea {
    font-size: 16px;
  }
  .notice .keyval { word-break: break-all; }
}

/* phones: data tables become stacked label/value rows */
@media (max-width: 640px) {
  .table-wrap { overflow: visible; }
  .table-wrap table { min-width: 0; }
  table.responsive thead { display: none; }
  table.responsive,
  table.responsive tbody,
  table.responsive tr,
  table.responsive td { display: block; width: 100%; }
  table.responsive tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.responsive tr:last-child { border-bottom: 0; }
  table.responsive td {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 14px; padding: 4px 0; border: 0; text-align: right;
    overflow-wrap: anywhere; min-width: 0;
  }
  table.responsive td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    text-align: left;
  }
  table.responsive td.mono { word-break: break-all; }
  table.responsive td.actions { justify-content: flex-end; padding-top: 8px; }
  table.responsive td.actions::before { content: none; }
}

/* pay page on small screens */
@media (max-width: 480px) {
  .pay-wrap { margin: 12px auto 28px; padding: 0 12px; }
  .pay-card { padding: 22px 16px; }
  .pay-amount { font-size: clamp(36px, 13vw, 46px); }
  .pay-qr { width: min(232px, 70vw); height: auto; aspect-ratio: 1 / 1; }
  canvas.pay-qr { width: min(232px, 70vw); height: auto; }
}

/* utilities (no inline styles: CSP style-src 'self') */
.mb18 { margin-bottom: 18px; }
.mt16 { margin-top: 16px; }
.mt18 { margin-top: 18px; }
.w100 { width: 100%; }
.center { text-align: center; }
.justify-center { justify-content: center; }
.text-ok { color: var(--ok); }
.text-bad { color: var(--bad); }
.brandline { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }

/* ---- 支付页：微信收银台（版式复刻 pay.y1yun.net 的微信支付手机版） ---- */
body.pay-theme-wechat { background: #fff; max-width: 546px; margin: 0 auto; }
.pay-banner { height: 180px; background: linear-gradient(90deg, #00aa72 0%, #24b77f 49.92%, #6cd990 100.88%); }
.pay-logo { position: relative; margin-top: -170px; height: 80px; display: flex; align-items: center; gap: 16px; padding: 7px 18px; }
.pay-logo-img { width: 62px; height: 62px; filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, .18)); }
.pay-logo-icon { width: 46px; height: auto; filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, .18)); }
.pay-logo-text { color: #fff; font-size: 26px; font-weight: 500; letter-spacing: 4px; }
.pay-sheet { margin-top: -12px; background: #fff; border-radius: 20px 20px 0 0; padding: 25px 20px 40px; min-height: calc(100vh - 168px); position: relative; z-index: 2; }
.pay-shop { color: #8a94ad; font-size: 13px; letter-spacing: 1px; margin-bottom: 6px; }
.pay-h1 { color: #252f4a; font-size: 34px; font-weight: 600; letter-spacing: -.5px; margin: 8px 0 16px; }
.pay-subject { color: #78829d; font-size: 13px; margin: 0 0 16px; }
.pay-tabs { display: flex; padding: 9px; border: 1px solid #f1f1f4; border-bottom: 0; border-radius: 8px 8px 0 0; }
.pay-tab { flex: 1; height: 38px; border: 0; background: transparent; border-radius: 8px; color: #78829d; font-size: 15px; letter-spacing: 3px; font-family: inherit; cursor: pointer; }
.pay-tab.is-active { background: #f1f1f4; color: #252f4a; font-weight: 600; }
.pay-panel { border: 1px solid #f1f1f4; border-radius: 0 0 8px 8px; }
.pay-qr-title { color: #252f4a; font-size: 20px; font-weight: 500; letter-spacing: 1px; text-align: center; margin: 0; padding: 20px 14px 0; }
.pay-qrbox { text-align: center; padding: 15px; }
.pay-qrbox canvas, .pay-qrbox img { padding: 12px; border: 1px solid #f1f1f4; border-radius: 6px; background: #fff; width: 230px; height: 230px; box-sizing: content-box; }
.pay-operate { display: flex; gap: 10px; padding: 0 15px 16px; }
.pay-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px; border: 0; border-radius: 4px; background: #f9f9f9; color: #4b5669; font-size: 14px; font-family: inherit; text-decoration: none; cursor: pointer; }
.pay-btn-ico { font-size: 14px; opacity: .75; }
.pay-link { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; border-top: 1px solid #f1f1f4; padding: 12px 15px; font-size: 12px; color: #78829d; line-height: 1.6; }
.pay-link-url { color: #4b5669; word-break: break-all; }
.pay-copy { flex: 0 0 auto; height: 26px; padding: 0 12px; border: 0; border-radius: 3px; background: #5bc0de; color: #fff; font-size: 12px; font-family: inherit; cursor: pointer; }
.pay-tip { padding: 0 15px 10px; margin: 0; font-size: 12px; color: #9aa3b8; line-height: 1.6; }
.pay-hint { padding: 0 15px; margin: 8px 0; font-size: 13px; color: #78829d; text-align: center; }
.pay-hint-bad { color: #d9534f; }
.pay-countdown { margin: 6px 0 16px; text-align: center; font-size: 13px; color: #6b768c; }
.pay-countdown .countdown { font-variant-numeric: tabular-nums; }
.pay-result { text-align: center; padding: 10px 0 20px; }
.pay-result-title { font-size: 20px; font-weight: 600; color: #07c160; margin-bottom: 10px; }
.pay-result-bad { color: #d9534f; }

