:root {
  color-scheme: light;
  --ink: #18312d;
  --muted: #4e6661;
  --paper: #f2f6f4;
  --line: #cddcd6;
  --accent: #136344;
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.masthead { background: #fff; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; min-height: 58px; padding: .55rem max(1rem, calc((100vw - 850px) / 2)); }
.masthead img { display: block; object-fit: contain; object-position: left; }
main { width: min(850px, calc(100% - 2rem)); margin: 2rem auto 3rem; }
h1 { margin: 0 0 1rem; font-size: clamp(1.65rem, 4vw, 2.2rem); }
h2 { margin: 0 0 1rem; font-size: 1.22rem; }
button, input, select, textarea { font: inherit; }
button { border: 1px solid transparent; border-radius: .5rem; background: var(--accent); color: white; padding: .6rem .9rem; min-height: 40px; cursor: pointer; font-weight: 650; }
button:disabled { opacity: .55; cursor: default; }
button:not(:disabled):hover { filter: brightness(.93); }
button.quiet { color: var(--accent); border-color: var(--line); background: #fff; }
:focus-visible { outline: 3px solid #398de1; outline-offset: 2px; }
.wallet { background: #144736; color: #f0fff7; border-radius: 1rem; display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.35rem; }
.wallet > div { min-width: 0; overflow-wrap: anywhere; }
.wallet p { margin: .3rem 0 0; }
.wallet strong { font-size: clamp(2.1rem, 7vw, 3.35rem); letter-spacing: -.045em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.wallet button { flex: 0 0 auto; background: #c9f0d1; color: #164b34; white-space: nowrap; }
#navigation { display: flex; gap: .3rem; margin: 1rem 0; border-bottom: 1px solid var(--line); }
#navigation button { background: transparent; color: var(--muted); border-radius: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; }
#navigation button[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.panel { padding: 1.25rem; border: 1px solid var(--line); border-radius: .82rem; background: #fff; }
form, label { display: grid; gap: .5rem; min-width: 0; }
form { gap: .95rem; }
input, select, textarea { width: 100%; min-height: 42px; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: .46rem; color: var(--ink); background: #fff; }
input[type="radio"] { width: 16px; min-height: 16px; margin: 0; accent-color: var(--accent); }
.plans { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .6rem; }
.plan { align-content: start; background: #f8fbf9; border: 1px solid var(--line); border-radius: .56rem; padding: .7rem; }
.plan:has(:checked) { border-color: var(--accent); background: #e8f6ed; box-shadow: inset 0 0 0 1px var(--accent); }
.plan span { font-variant-numeric: tabular-nums; }
.plan small, .muted { color: var(--muted); }
.checkout { display: grid; grid-template-columns: minmax(90px,130px) 1fr auto; gap: .7rem; align-items: end; }
.checkout p { margin: 0 0 .62rem; }
.section-head, .actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.section-head { justify-content: space-between; margin-bottom: .65rem; }
.section-head h2 { margin: 0; }
.filter { max-width: 230px; }
.row { border-bottom: 1px solid var(--line); padding: .9rem 0; overflow-wrap: anywhere; }
.row:last-child { border-bottom: 0; }
.row p, .panel p { margin: .45rem 0; }
.row .actions { margin-top: .55rem; }
.notice { background: #fff2d4; color: #543706; padding: .7rem .9rem; border-radius: .5rem; }
.issued { margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--line); }
.code-output { display: grid; gap: .55rem; }
.code-output button { justify-self: start; }
textarea { resize: vertical; font-family: ui-monospace, monospace; }
dialog { color: var(--ink); width: min(470px, calc(100% - 2rem)); max-height: 90dvh; border: 1px solid var(--line); border-radius: .9rem; padding: 1.1rem; }
dialog::backdrop { background: #13231eba; }
#dialog-controls { display: grid; gap: .75rem; }
.qr { width: min(230px, 80%); height: auto; justify-self: center; }
#payment-form, #login-form { max-width: 420px; }
@media (max-width: 520px) {
  main { margin-top: 1rem; }
  input, select, textarea { font-size: 16px; }
  .panel { padding: .9rem; }
  .plans { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .checkout { grid-template-columns: minmax(80px,1fr) 1fr; }
  .checkout button { grid-column: 1 / -1; }
  #navigation button { flex: 1; padding-inline: .2rem; white-space: nowrap; font-size: .92rem; }
}
