:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #121826;
  --muted: #5f6b7e;
  --line: #e2e7ef;
  --accent: #2463eb;
  --accent-ink: #ffffff;
  --accent-soft: #e8efff;
  --ok: #138a4b;
  --ok-soft: #e5f6ec;
  --warn-soft: #fff6e0;
  --warn-ink: #7a5300;
  --danger: #c43030;
  --danger-soft: #fdecec;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --card: #161b24;
    --text: #e8ecf3;
    --muted: #97a2b4;
    --line: #283041;
    --accent: #5b8cff;
    --accent-ink: #0d1117;
    --accent-soft: #1b2742;
    --ok: #4cc485;
    --ok-soft: #12291e;
    --warn-soft: #2c2410;
    --warn-ink: #f0c661;
    --danger: #ff7272;
    --danger-soft: #2f1717;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.shell { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; }
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.brand-mark { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.brand h1 { margin: 0; font-size: 22px; line-height: 1.2; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.steps { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.steps li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.steps li span { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line); font-weight: 600; font-size: 12px; background: var(--card); }
.steps li.is-active { color: var(--text); font-weight: 600; }
.steps li.is-active span { border-color: var(--accent); color: var(--accent); }
.steps li.is-done span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h2 { font-size: 16px; margin: 22px 0 10px; }
.card h2:first-child { margin-top: 0; }

.field { display: block; margin-bottom: 12px; }
.label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input, select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: 48px;
}
input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent-soft); border-color: var(--accent); outline-offset: 1px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; border-radius: 10px; padding: 12px 18px; min-height: 48px; border: 0; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); width: 100%; }
.btn.primary:disabled { opacity: .6; cursor: progress; }
.btn.block { width: 100%; margin-top: 18px; }
.btn.link { background: none; color: var(--accent); padding: 8px 0; min-height: 40px; }

.error { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 14px; }
.alert { margin: 12px 0; padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn-ink); font-size: 14px; }
.note { margin: 14px 0; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; }
.muted { color: var(--muted); }
.danger { color: var(--danger); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }

.guide { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.guide-title { margin: 0 0 10px; font-weight: 600; font-size: 14px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tabs button { font: inherit; font-size: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 6px 14px; min-height: 36px; cursor: pointer; }
.tabs button[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.guide-steps { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.guide-steps li { margin: 4px 0; }

.account { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; }
.account-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.account-row:last-child { border-bottom: 0; }
.account-row > span { flex: none; }
.account-row strong { text-align: right; overflow-wrap: anywhere; }

.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; font: inherit; color: var(--text); background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 8px; cursor: pointer; }
.choice span { color: var(--muted); font-size: 14px; }

.periods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.period, .method {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  font: inherit; color: var(--text); background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; min-height: 48px;
}
.period[aria-checked="true"], .method[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.period-label { font-size: 14px; color: var(--muted); }
.period-price { font-size: 17px; font-weight: 700; }
.period-save { font-size: 12px; font-weight: 600; color: var(--ok); }
.methods { display: grid; gap: 8px; }
.method span { color: var(--muted); font-size: 14px; }

.qr { display: grid; place-items: center; margin: 14px 0; }
.qr img { width: min(280px, 100%); height: auto; border-radius: 12px; background: #fff; padding: 8px; border: 1px solid var(--line); }
.details { border: 1px solid var(--line); border-radius: 12px; padding: 2px 14px; }
.detail { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.detail:last-child { border-bottom: 0; }
.detail-value { display: flex; align-items: center; gap: 8px; text-align: right; overflow-wrap: anywhere; }
.copy { flex: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border: 0; border-radius: 8px; padding: 6px 10px; min-height: 32px; cursor: pointer; }

.status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--bg); font-size: 14px; }
.status.success { background: var(--ok-soft); color: var(--ok); }
.status.success .muted { color: inherit; opacity: .85; }
.status.danger { background: var(--danger-soft); color: var(--danger); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.foot { margin-top: 20px; text-align: center; font-size: 14px; }
.foot a { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

@media (max-width: 380px) {
  .periods { grid-template-columns: 1fr; }
  .steps li { font-size: 12px; gap: 6px; }
}
