:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --primary: #e5b65d;
  --primary-400: #c99838;
  --primary-100: #4a3214;
  --primary-500: #fdf0d0;
  --background: #f8f8f8;
  --surface: #fff;
  --main: #131313;
  --muted: #4a4a4a;
  --border: #d1d1d1;
  --success: #17603a;
  --error: #a72c27;
}

* { box-sizing: border-box; }
html { background: var(--surface); }
body { margin: 0; min-width: 280px; min-height: 100vh; color: var(--main); background: var(--surface); }
button, input { font: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--primary-100); outline-offset: 3px; }
[hidden] { display: none !important; }

.site-header { border-bottom: 1px solid var(--border); }
.header-inner { min-height: 64px; padding: 11px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; flex: none; }
.brand img { display: block; width: min(174px, 45vw); height: auto; }
.header-label { color: var(--muted); font-size: 11px; text-align: right; }

.content { padding: 28px 20px calc(100px + env(safe-area-inset-bottom)); }
.site-footer { position: fixed; bottom: 0; left: 50%; z-index: 30; transform: translateX(-50%); width: 100%; max-width: 720px; border-top: 1px solid var(--border); padding: 8px 20px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); text-align: center; box-shadow: 0 -4px 14px rgba(0, 0, 0, .08); }
.return-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; color: var(--main); font-size: 14px; font-weight: 650; text-decoration: underline; text-decoration-color: var(--primary-400); text-underline-offset: 4px; }
.content-inner { width: 100%; max-width: 480px; margin: 0 auto; }
h1 { margin: 0 0 12px; color: var(--main); font-size: 28px; font-weight: 650; line-height: 1.2; letter-spacing: -.025em; }
.intro { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.result-status { margin-bottom: 20px; padding: 16px; border-left: 4px solid var(--primary-400); border-radius: 6px; background: var(--primary-500); color: var(--main); }
.result-status[data-result="success"] { border-color: var(--success); background: #eaf5ed; color: var(--success); }
.result-status[data-result="failed"] { border-color: var(--error); background: #fdf0ef; color: var(--error); }
.result-status .intro { margin: 0; color: inherit; }
.result-progress { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; font-size: 14px; font-weight: 650; }
.result-spinner { width: 26px; height: 26px; border-width: 3px; }
.notice { margin: 0 0 22px; border-left: 3px solid var(--primary-400); padding: 10px 12px; background: var(--primary-500); color: var(--primary-100); font-size: 12px; line-height: 1.5; }
.spinner { display: inline-block; flex: none; width: 17px; height: 17px; border: 2px solid var(--border); border-top-color: var(--primary-100); border-right-color: var(--primary-400); border-radius: 50%; animation: spin .7s linear infinite; will-change: transform; }
.spinner-large { width: 48px; height: 48px; border-width: 4px; }
.busy-overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(19, 19, 19, .6); }
.busy-panel { display: grid; justify-items: center; gap: 17px; width: min(100%, 320px); padding: 32px 24px; border-radius: 12px; background: var(--surface); color: var(--main); box-shadow: 0 14px 44px rgba(0, 0, 0, .2); text-align: center; font-size: 16px; line-height: 1.4; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; border-color: var(--primary-100); } }

.steps { display: flex; gap: 9px; list-style: none; padding: 0; margin: 0 0 26px; }
.steps li { flex: 1; border-top: 2px solid var(--border); padding-top: 8px; color: var(--muted); font-size: 11px; }
.steps li[aria-current="step"] { border-color: var(--primary-400); color: var(--main); font-weight: 700; }
.summary { margin: 0 0 24px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.review-summary { position: relative; display: flow-root; }
.quote-overlay { position: absolute; bottom: 60px; left: 50%; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 12px; width: min(82%, 300px); min-height: 76px; margin: 0; padding: 14px 16px; transform: translateX(-50%); border: 2px solid var(--primary-400); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 26px rgba(0, 0, 0, .18); color: var(--main); font-size: 14px; font-weight: 650; line-height: 1.35; pointer-events: none; }
.spinner-quote { width: 30px; height: 30px; border-width: 3px; }
.summary div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid #e0e0e0; }
.summary div:last-child { border-bottom: 0; }
.summary dt { flex: none; color: var(--muted); font-size: 12px; }
.summary dd { margin: 0; max-width: 65%; color: var(--main); text-align: right; font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.summary dd small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 400; }
.summary .limit { padding: 8px 0; }
.summary .limit dt, .summary .limit dd { color: var(--muted); font-size: 12px; font-weight: 500; }
.summary .amount dd { font-size: 22px; font-weight: 750; }
.amount-field { width: min(145px, 42vw); border: 0; border-bottom: 1px solid var(--border); background: var(--surface); color: var(--main); font-size: 20px; font-weight: 700; text-align: right; }
.amount-field:focus { border-color: var(--primary-400); }
.amount-field[aria-invalid="true"] { border-color: var(--error); border-bottom-width: 2px; }
.monthly-limit { margin-top: -12px; padding: 10px 0 24px; }
.monthly-heading { display: flex; justify-content: space-between; gap: 8px; color: var(--main); font-size: 12px; }
.monthly-heading strong { font-size: 12px; font-weight: 650; }
.monthly-track { display: block; width: 100%; height: 12px; margin-top: 10px; overflow: hidden; border-radius: 10px; }
.monthly-track .month-remaining { fill: #e7e7e7; }
.monthly-track .month-used { fill: #34495e; }
.monthly-track .month-current { fill: var(--primary-400); }
.monthly-legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; margin-top: 9px; color: var(--muted); font-size: 11px; }
.monthly-legend span { white-space: nowrap; }
.legend-dot { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; }
.legend-dot.used { background: #34495e; }
.legend-dot.current { background: var(--primary-400); }
.primary { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; border: 0; border-radius: 8px; background: var(--primary-400); color: var(--main); font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer; }
.primary:disabled { opacity: .55; cursor: not-allowed; }
.primary:hover:not(:disabled) { background: var(--primary); }
.secondary { display: block; border: 0; background: transparent; color: var(--main); font-size: 14px; font-weight: 650; margin: 13px auto 0; padding: 11px 18px; text-align: center; cursor: pointer; text-decoration: underline; text-decoration-color: var(--primary-400); text-underline-offset: 5px; }
.code-label { display: block; font-size: 13px; font-weight: 650; margin: 0 0 8px; }
.code-field { display: block; width: 100%; min-height: 52px; border: 0; border-bottom: 1px solid var(--border); padding: 10px 0; background: var(--surface); color: var(--main); font-size: 16px; letter-spacing: .12em; margin-bottom: 20px; }
.code-field:focus { border-color: var(--primary-400); }
.code-field[aria-invalid="true"] { border-color: var(--error); border-bottom-width: 2px; }
.field-error { margin: -10px 0 15px; color: var(--error); font-size: 13px; line-height: 1.4; }
.resend { display: block; min-height: 44px; margin: 12px auto 0; padding: 8px; border: 0; background: none; color: var(--main); font-size: 14px; text-decoration: underline; text-decoration-color: var(--primary-400); text-underline-offset: 4px; cursor: pointer; }
.resend:disabled { color: var(--muted); text-decoration: none; cursor: not-allowed; }
.resend-info { margin: 4px 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }


@media (min-width: 768px) {
  html, body { background: var(--background); }
  .page { max-width: 720px; min-height: 100vh; margin: 0 auto; background: var(--surface); }
  .header-inner { padding: 16px 40px; }
  .content { padding: 48px 40px 100px; }
}
