:root {
  --ink: #17252c;
  --muted: #68777e;
  --paper: #eef1f0;
  --surface: #fbfcfa;
  --line: #d5dcda;
  --accent: #28677a;
  --accent-dark: #173747;
  --accent-soft: #dce9eb;
  --danger: #9b4138;
  font-family: "Geist", "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-height: 100dvh; background: var(--paper); }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; }

.page-shell { width: min(100%, 700px); margin: 0 auto; padding: 20px 16px 56px; }
.eyebrow { margin: 0; color: var(--accent); font-size: 10px; font-weight: 780; letter-spacing: .16em; }

.payment-form {
  padding: 26px 20px 22px; border: 1px solid rgba(23,37,44,.12); border-radius: 22px;
  background: var(--surface); box-shadow: 0 26px 58px -44px rgba(23,55,71,.56);
}
.section-heading { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; }
.section-heading > span { padding-top: 2px; color: var(--accent); font-size: 11px; font-weight: 760; font-variant-numeric: tabular-nums; }
.section-heading h1, .section-heading h2 { margin: 0; font-size: 20px; line-height: 1.15; letter-spacing: -.035em; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.invoice-heading { margin-top: 36px; padding-top: 27px; border-top: 1px solid var(--line); }

.form-grid { display: grid; gap: 24px; margin-top: 28px; }
.field { min-width: 0; }
.label-row { min-height: 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.label-row label { font-size: 13px; font-weight: 700; }
.label-row span, .label-row em { padding: 3px 7px; border-radius: 20px; font-size: 9px; font-style: normal; font-weight: 700; }
.label-row span { background: var(--accent-dark); color: #fff; }
.label-row em { background: var(--accent-soft); color: var(--accent-dark); }
.field > input, .field > textarea, .amount-input {
  width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 13px; outline: none; background: #fff;
  transition: border-color .22s cubic-bezier(.16,1,.3,1), box-shadow .22s cubic-bezier(.16,1,.3,1), transform .22s cubic-bezier(.16,1,.3,1);
}
.field > input { height: 60px; padding: 0 14px; }
.field > textarea { min-height: 96px; padding: 14px; resize: vertical; line-height: 1.6; }
.field > input:focus, .field > textarea:focus, .amount-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(40,103,122,.1); }
.field > input::placeholder, .field > textarea::placeholder, .amount-input input::placeholder { color: #9aa5a8; }
.amount-input { height: 60px; display: grid; grid-template-columns: 35px 1fr; align-items: center; padding: 0 15px; }
.amount-input span { color: var(--accent); font-size: 18px; font-weight: 720; }
.amount-input input { min-width: 0; border: 0; outline: 0; background: transparent; font-size: 29px; font-weight: 740; letter-spacing: -.035em; }
.field-help, .field-error { margin: 7px 1px 0; font-size: 10px; line-height: 1.5; }
.field-help { color: #859095; }
.field-error { color: var(--danger); }
.field.has-error > input, .field.has-error > textarea, .field.has-error .amount-input { border-color: var(--danger); }

.notice { margin-top: 31px; padding: 18px; display: grid; grid-template-columns: 24px 1fr; gap: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.notice svg { width: 20px; color: var(--accent); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.notice h2 { margin: 0; font-size: 13px; }
.notice p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.primary-button {
  width: 100%; height: 55px; margin-top: 24px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between;
  border: 0; border-radius: 14px; background: var(--accent-dark); color: #fff; font-weight: 720;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14); transition: transform .22s cubic-bezier(.16,1,.3,1), opacity .22s;
}
.primary-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.primary-button:active { transform: translateY(1px) scale(.99); }
.preview-note { margin: 10px 0 0; color: #899398; text-align: center; font-size: 10px; }

.confirm-view { position: fixed; inset: 0; padding: 18px; display: grid; place-items: center; background: rgba(23,37,44,.58); z-index: 5; animation: reveal .3s cubic-bezier(.16,1,.3,1) both; }
.confirm-view[hidden] { display: none; }
.confirm-dialog { width: min(100%, 440px); max-height: calc(100dvh - 36px); overflow: auto; padding: 29px; border: 1px solid rgba(255,255,255,.28); border-radius: 22px; background: var(--surface); box-shadow: 0 34px 74px -34px rgba(9,26,34,.72); }
.confirm-dialog h2 { margin: 9px 0 0; font-size: 27px; letter-spacing: -.045em; }
.confirm-dialog dl { margin: 24px 0 0; border-top: 1px solid var(--line); }
.confirm-dialog dl > div { padding: 14px 0; display: grid; grid-template-columns: 82px 1fr; gap: 15px; border-bottom: 1px solid var(--line); }
.confirm-dialog dt { color: var(--muted); font-size: 11px; }
.confirm-dialog dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 650; line-height: 1.5; }
.confirm-dialog .summary-amount dd { color: var(--accent-dark); font-size: 23px; line-height: 1; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 10px; margin-top: 24px; }
.confirm-actions button { height: 49px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.secondary-button { border: 1px solid var(--line); background: transparent; }
.confirm-pay-button { border: 0; background: var(--accent-dark); color: #fff; }
.confirm-pay-button:disabled { opacity: .65; }
.secondary-button:active { transform: translateY(1px); }
.payment-error { margin: 12px 0 0; padding: 11px 13px; border-radius: 10px; background: #f8e9e6; color: var(--danger); font-size: 11px; line-height: 1.55; }
.payment-dialog { text-align: center; }
.native-amount { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.native-qr { width: min(240px, 72vw); aspect-ratio: 1; margin: 20px auto 10px; display: block; border-radius: 12px; background: #fff; }
.native-status { margin: 10px auto 20px; max-width: 300px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.full-button { width: 100%; height: 48px; border-radius: 12px; }
.success-view { min-height: 100dvh; padding: 20px; display: grid; place-items: center; }
.success-view[hidden] { display: none; }
.success-card { width: min(100%, 500px); padding: 44px 28px; border: 1px solid rgba(23,37,44,.12); border-radius: 22px; background: var(--surface); text-align: center; box-shadow: 0 26px 58px -44px rgba(23,55,71,.56); }
.success-mark { width: 56px; height: 56px; margin: 0 auto 22px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-dark); color: #fff; font-size: 28px; }
.success-card h2 { margin: 9px 0 0; font-size: 30px; letter-spacing: -.04em; }
.success-card > p:not(.eyebrow):not(.success-order) { margin: 14px auto 0; max-width: 390px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.success-order { margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--accent-dark); font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }
.loading::after { content: ""; width: 12px; height: 12px; margin-left: 8px; display: inline-block; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; vertical-align: -2px; animation: spin .8s linear infinite; }

@keyframes breathe { 50% { opacity: .35; transform: scale(.72); } }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 760px) {
  .page-shell { padding-top: 48px; }
  .payment-form { padding: 32px; }
  .form-grid { grid-template-columns: 1fr 1fr; gap: 24px 18px; }
  .field-wide { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
