:root {
  --paper: #f2efe8;
  --card: #fffdf8;
  --ink: #16181c;
  --muted: #64655f;
  --line: #d9d4c7;
  --line-strong: #b8b2a2;
  --accent: #14563d;
  --accent-hover: #0e4430;
  --danger: #9c2c1f;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { 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.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* --------------------------------------------------------------- masthead */

.masthead {
  max-width: 960px;
  margin: 0 auto;
  padding: 22px 20px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.masthead-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ------------------------------------------------------------------ shell */

.shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 56px;
}

.kicker {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(30px, 6vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0;
  max-width: 42ch;
  color: var(--muted);
  font-size: 15px;
}

/* ------------------------------------------------------------ create view */

.steps {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  max-width: 360px;
  border-top: 1px solid var(--line);
}

.steps li {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}

.steps span {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
}

.panel {
  margin-top: 32px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
}

@media (min-width: 840px) {
  .shell.create {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 64px;
    align-items: start;
    padding-top: 56px;
  }
  .shell.create .panel { margin-top: 0; }
}

/* ------------------------------------------------------------------- form */

.field {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
}

input[type="text"],
select {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.amount-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
}

.amount-input span {
  padding-left: 12px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
}

.amount-input input {
  border: 0;
  background: transparent;
  padding-left: 8px;
}

.amount-input input:focus { outline: none; }
.amount-input:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.method {
  position: relative;
  padding: 11px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
}

.method input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.method span {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.method small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
}

.method:has(input:checked) {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.method:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 3px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.primary { background: var(--accent); color: #fffdf8; }
.primary:hover { background: var(--accent-hover); }

.secondary {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.secondary:hover { background: #f7f4ec; }

.button:disabled { opacity: 0.6; cursor: wait; }

.error {
  min-height: 18px;
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--danger);
}

[hidden] { display: none !important; }

/* -------------------------------------------------------------- pay view */

.shell.pay { max-width: 600px; }

.pay-panel { margin-top: 0; }

.pay-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 26px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.tag.pending { color: #7a5200; border-color: #dcc590; background: #fcf5e5; }
.tag.success { color: var(--accent); border-color: #a6c5b3; background: #eef6f0; }
.tag.failed { color: var(--danger); border-color: #d8b2ab; background: #fbefed; }

.ref {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: right;
  word-break: break-all;
}

.amount {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(30px, 8vw, 40px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.for {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.for strong { color: var(--ink); font-weight: 600; }

.meta {
  margin: 26px 0 0;
  border-top: 1px solid var(--line);
}

.meta div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.meta dt { color: var(--muted); }
.meta dd { margin: 0; text-align: right; }

.pay-body { margin-top: 26px; }

.qr {
  width: fit-content;
  margin: 0 auto;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.qr img {
  display: block;
  width: min(260px, 66vw);
  height: auto;
}

.qr-note,
.pay-note {
  margin: 14px auto 18px;
  max-width: 38ch;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  text-align: center;
}

.result {
  padding: 26px 0 6px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.result svg {
  width: 38px;
  height: 38px;
  color: var(--accent);
}

.result h2 {
  margin: 10px 0 4px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
}

.result p {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--muted);
}

.result .button { display: flex; max-width: 260px; margin: 0 auto; }

.pay-foot { margin-top: 24px; }

.empty .button { display: flex; margin-top: 22px; }

.loading {
  margin: 0;
  padding: 28px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.notice {
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  font-size: 14px;
  color: var(--muted);
}

/* ----------------------------------------------------------------- footer */

.footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
  border-top: 1px solid var(--line);
}

.footer p {
  margin: 0;
  max-width: 60ch;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}

@media (max-width: 560px) {
  .masthead { padding: 18px 16px; }
  .shell { padding: 28px 16px 44px; }
  .panel { padding: 20px 16px; }
  .footer { padding: 18px 16px; }
  .steps { margin-top: 26px; }
}
