:root {
  color-scheme: light;
  --page: #f3f6fa;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --text: #101828;
  --muted: #667085;
  --line: #dbe2ea;
  --line-strong: #c8d2df;
  --blue: #2777e8;
  --blue-hover: #1f66ca;
  --blue-soft: #eaf2ff;
  --green: #15895f;
  --green-soft: #e9f7f1;
  --red: #c53f4e;
  --red-soft: #fff0f2;
  --warning: #9a6700;
  --warning-soft: #fff7df;
  --shadow: 0 22px 55px rgba(27, 45, 70, .12);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--page); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button, input, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
[hidden] { display: none !important; }

.page-shell {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 70px 0 38px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
}

.page-header h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.2;
  font-weight: 760;
}

.subtitle {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.service-state {
  min-width: 108px;
  height: 38px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #bfe4d5;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 12px;
  white-space: nowrap;
}

.service-state span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.service-state.is-loading { color: var(--muted); border-color: var(--line); background: var(--surface-soft); }
.service-state.is-error { color: var(--warning); border-color: #efdba0; background: var(--warning-soft); }

.recharge-card {
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stepper {
  min-height: 92px;
  margin: 0;
  padding: 0 44px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  list-style: none;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.stepper li {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #98a2b3;
}

.stepper li:not(:last-child)::after {
  position: absolute;
  top: 50%;
  right: 22px;
  width: 31px;
  height: 1px;
  content: "";
  background: var(--line-strong);
}

.stepper li > span {
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
}

.stepper li div { min-width: 0; display: grid; gap: 3px; }
.stepper b { color: inherit; font-size: 13px; }
.stepper small { font-size: 11px; white-space: nowrap; }
.stepper li.is-active, .stepper li.is-done { color: var(--blue); }
.stepper li.is-active > span, .stepper li.is-done > span { border-color: var(--blue); color: #fff; background: var(--blue); }
.stepper li.is-done > span { color: transparent; }
.stepper li.is-done > span::after { content: "✓"; color: #fff; }

.panel-stack { min-height: 500px; }

.step-panel {
  min-height: 500px;
  padding: 52px 54px 56px;
  animation: panel-in .22s ease-out both;
}

.panel-heading { margin-bottom: 30px; }
.panel-heading > p, .result-kicker, .dialog-label {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}

.panel-heading h2, .result-panel h2, .dialog h2 {
  margin: 0;
  font-size: 27px;
  line-height: 1.3;
}

.panel-heading > span {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

form label, .label-row label {
  display: block;
  margin-bottom: 9px;
  color: #344054;
  font-size: 14px;
  font-weight: 650;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

input { height: 52px; padding: 0 15px; }
textarea { min-height: 168px; padding: 14px 15px; resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #98a2b3; }
input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39, 119, 232, .12); }

.field-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.form-message {
  min-height: 21px;
  margin: 10px 0 0;
  color: var(--red);
  font-size: 12px;
  line-height: 1.5;
}

.form-message.is-success { color: var(--green); }

.primary-button, .secondary-button, .danger-button {
  min-width: 116px;
  height: 44px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 650;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.primary-button { border: 1px solid var(--blue); color: #fff; background: var(--blue); }
.primary-button:hover:not(:disabled) { border-color: var(--blue-hover); background: var(--blue-hover); }
.secondary-button { border: 1px solid var(--line-strong); color: #344054; background: var(--surface); }
.secondary-button:hover:not(:disabled) { border-color: #aebbc9; background: var(--surface-soft); }
.danger-button { border: 1px solid var(--red); color: #fff; background: var(--red); }
.danger-button:hover:not(:disabled) { background: #a93140; }
.primary-button:active:not(:disabled), .secondary-button:active:not(:disabled), .danger-button:active:not(:disabled) { transform: translateY(1px); }
#card-submit { margin-top: 6px; }

.form-actions, .result-actions, .dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.label-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.link-button { padding: 3px 0; border: 0; color: var(--blue); background: transparent; font-size: 13px; font-weight: 650; }

.card-summary {
  margin: -4px 0 28px;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 1.15fr 1fr .8fr;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.card-summary div { min-width: 0; display: grid; gap: 5px; }
.card-summary small { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.card-summary strong { overflow: hidden; color: #344054; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.card-summary div:last-child strong { color: var(--green); }

.confirm-box { padding-top: 8px; text-align: center; }
.confirm-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
  font-size: 25px;
  font-weight: 700;
}
.confirm-box h3 { margin: 0; font-size: 24px; }
.confirm-box > p { margin: 9px 0 22px; color: var(--muted); font-size: 14px; }

.confirm-box dl, .duplicate-dialog dl {
  margin: 0 0 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: left;
}

.confirm-box dl div, .duplicate-dialog dl div {
  min-height: 46px;
  padding: 0 14px;
  display: grid;
  grid-template-columns: 95px 1fr;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.confirm-box dl div:last-child, .duplicate-dialog dl div:last-child { border-bottom: 0; }
dt { color: var(--muted); font-size: 12px; }
dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: #344054; font-size: 13px; font-weight: 600; }

.result-panel { padding-top: 57px; text-align: center; }
.result-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
}
.result-icon > span { width: 25px; height: 25px; border: 3px solid rgba(39, 119, 232, .22); border-top-color: var(--blue); border-radius: 50%; animation: spin .9s linear infinite; }
.result-icon.is-success { color: var(--green); background: var(--green-soft); }
.result-icon.is-success > span { width: auto; height: auto; border: 0; animation: none; }
.result-icon.is-success > span::after { content: "✓"; font-size: 29px; font-weight: 750; }
.result-icon.is-failed { color: var(--red); background: var(--red-soft); }
.result-icon.is-failed > span { position: relative; width: 26px; height: 26px; border: 0; animation: none; }
.result-icon.is-failed > span::before, .result-icon.is-failed > span::after { position: absolute; left: 12px; top: 1px; width: 2px; height: 25px; content: ""; background: var(--red); transform: rotate(45deg); }
.result-icon.is-failed > span::after { transform: rotate(-45deg); }
.result-message { max-width: 455px; margin: 10px auto 24px; color: var(--muted); font-size: 14px; line-height: 1.7; }

.result-details {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  text-align: left;
}
.result-details div { min-width: 0; padding: 14px 15px; border-right: 1px solid var(--line); }
.result-details div:last-child { border-right: 0; }
.result-details dt { margin-bottom: 6px; }
.result-details dd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-track { height: 3px; margin: 24px 0 30px; overflow: hidden; border-radius: 99px; background: var(--line); }
.progress-track span { display: block; width: 18%; height: 100%; background: var(--blue); transition: width .35s ease; }
.result-actions { justify-content: center; }

.page-footer {
  min-height: 54px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #7d8998;
  font-size: 11px;
}

.dialog {
  position: relative;
  width: min(500px, calc(100% - 28px));
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(20, 35, 55, .24);
}
.dialog::backdrop { background: rgba(20, 31, 48, .52); }
.dialog-close { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border: 0; color: var(--muted); background: transparent; font-size: 25px; line-height: 1; }
.dialog h2 { margin-bottom: 22px; }
.dialog ol { margin: 0; padding: 0; display: grid; gap: 15px; list-style: none; }
.dialog li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.dialog li > span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; color: var(--blue); background: var(--blue-soft); font-size: 12px; font-weight: 700; }
.dialog li p { margin: 3px 0 0; color: #475467; font-size: 13px; line-height: 1.6; }
.dialog a { color: var(--blue); font-weight: 650; }
.dialog-note { margin: 20px 0 0; padding: 11px 12px; border-left: 3px solid var(--blue); color: #475467; background: var(--blue-soft); font-size: 12px; }
.duplicate-dialog > p:not(.dialog-label) { margin: -10px 0 22px; color: var(--muted); font-size: 14px; line-height: 1.65; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  max-width: calc(100% - 32px);
  padding: 11px 15px;
  border: 1px solid #243143;
  border-radius: 6px;
  color: #fff;
  background: #182230;
  box-shadow: 0 14px 35px rgba(16, 24, 40, .22);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .18s ease, transform .18s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: #6e2530; background: #4c2028; }

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid rgba(39, 119, 232, .55); outline-offset: 3px; }

@keyframes panel-in { from { opacity: 0; transform: translateY(7px); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 650px) {
  .page-shell { width: min(100% - 20px, 760px); padding-top: 34px; }
  .page-header { align-items: flex-start; margin-bottom: 20px; }
  .page-header h1 { font-size: 29px; }
  .subtitle { font-size: 13px; }
  .service-state { min-width: 0; height: 34px; padding: 0 10px; }
  .stepper { min-height: 76px; padding: 0 15px; }
  .stepper li { justify-content: center; gap: 7px; }
  .stepper li:not(:last-child)::after { display: none; }
  .stepper li > span { width: 25px; height: 25px; flex-basis: 25px; }
  .stepper small { display: none; }
  .step-panel { min-height: 465px; padding: 33px 20px 37px; }
  .panel-stack { min-height: 465px; }
  .panel-heading h2, .result-panel h2 { font-size: 23px; }
  .card-summary { grid-template-columns: 1fr 1fr; }
  .card-summary div:last-child { display: none; }
  .form-actions, .result-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .form-actions button, .result-actions button { min-width: 0; width: 100%; }
  .confirm-box dl div { grid-template-columns: 78px 1fr; }
  .result-details { grid-template-columns: 1fr; }
  .result-details div { padding: 11px 13px; display: grid; grid-template-columns: 82px 1fr; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .result-details div:last-child { border-bottom: 0; }
  .result-details dt { margin: 0; }
  .page-footer { justify-content: center; }
  .page-footer span:last-child { display: none; }
}

@media (max-width: 390px) {
  .page-header { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
  .page-header h1 { font-size: 26px; }
  .service-state b { display: none; }
  .service-state { width: 34px; padding: 0; }
  .stepper b { font-size: 11px; }
  .card-summary { grid-template-columns: 1fr; }
  .card-summary div:nth-child(2) { display: none; }
}

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