:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg-page: #f4f6f8;
  --bg-card: #ffffff;
  --bg-soft: #f8fafc;
  --text-main: #111827;
  --text-sub: #5f6b7a;
  --border-color: #e3e8ef;
  --shadow: 0 16px 40px rgba(17, 24, 39, 0.06);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(244, 246, 248, 0) 210px),
    var(--bg-page);
  color: var(--text-main);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-mark,
.tiny-icon {
  display: inline-grid;
  place-items: center;
  color: var(--primary);
}

.brand-mark {
  width: 30px;
  height: 30px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
}

.brand-mark svg,
.tiny-icon svg,
.icon-btn svg,
.btn-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: #eef2f7;
  border-radius: 8px;
}

.nav-item {
  min-height: 34px;
  padding: 0 14px;
  color: var(--text-sub);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.nav-item.active {
  color: var(--primary);
  background: #fff;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.12);
}

.main-container {
  width: min(1120px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: fade-in 0.22s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.recharge-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.guide-card,
.action-card,
.query-container,
.docs-sidebar,
.endpoint-block {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.guide-card {
  padding: 22px;
}

.guide-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-weight: 700;
}

.step-list {
  position: relative;
  margin-left: 9px;
  padding-left: 20px;
  border-left: 2px solid #eef2f7;
}

.step-item {
  position: relative;
  min-height: 58px;
  margin-bottom: 20px;
}

.step-item:last-child {
  margin-bottom: 0;
}

.step-dot {
  position: absolute;
  top: 2px;
  left: -27px;
  width: 12px;
  height: 12px;
  background: #cbd5e1;
  border: 2px solid #fff;
  border-radius: 50%;
}

.step-item.active .step-dot {
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.step-item.completed .step-dot {
  background: var(--accent);
}

.step-name {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 700;
}

.step-desc {
  color: var(--text-sub);
  font-size: 12px;
  line-height: 1.6;
}

.action-card {
  min-height: 520px;
  padding: 28px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.panel-heading.compact {
  align-items: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.25;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.3;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.status-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  color: #166534;
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.input-field {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  color: var(--text-main);
  background: #fbfcfe;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.input-field:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea.input-field {
  min-height: 150px;
  resize: vertical;
  line-height: 1.55;
}

textarea.query-textarea {
  min-height: 180px;
}

.input-meta {
  margin-top: 6px;
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.input-meta .over-limit {
  color: var(--danger);
}

.option-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  margin: 0 0 18px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  cursor: pointer;
}

.option-row input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.option-row strong {
  display: block;
  margin-bottom: 4px;
  color: #344054;
  font-size: 15px;
}

.option-row small {
  display: block;
  color: #ea580c;
  font-size: 13px;
  line-height: 1.6;
}

.option-row.confirm-check {
  margin-top: 18px;
  background: #f8fafc;
  border-color: #d9e1ec;
}

.option-row.confirm-check small {
  color: #667085;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.form-group {
  margin-bottom: 18px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: #eef2f7;
  border-radius: 8px;
}

.segment {
  min-height: 38px;
  color: var(--text-sub);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.segment.active {
  color: var(--primary);
  background: #fff;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.12);
}

.step-panel {
  display: none;
}

.step-panel.active {
  display: block;
  animation: fade-in 0.22s ease;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: 800;
}

.step-number {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
  font-size: 13px;
}

.btn-row {
  display: flex;
  gap: 10px;
}

.btn-row.narrow {
  justify-content: center;
}

.btn-row.narrow .btn {
  width: auto;
  min-width: 140px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  width: 100%;
  padding: 0 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.08s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.btn.primary:disabled,
.btn.secondary:disabled {
  color: #667085;
  background: #eef2f7;
  border-color: #d9e1ec;
  transform: none;
}

.btn.primary {
  color: #fff;
  background: var(--primary);
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn.secondary {
  color: #344054;
  background: #fff;
  border: 1px solid var(--border-color);
}

.btn.secondary:hover:not(:disabled) {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.result-slot {
  min-height: 0;
  margin-bottom: 16px;
}

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.alert strong {
  display: block;
  margin-bottom: 2px;
}

.alert.success {
  color: #166534;
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
}

.alert.error {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.alert.info {
  color: #1e3a8a;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.alert.warning {
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.confirm-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  margin: 0 0 20px;
  background: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.confirm-list div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  background: #fff;
}

.confirm-list dt,
.confirm-list dd {
  margin: 0;
  padding: 12px;
  font-size: 13px;
}

.confirm-list dt {
  color: var(--text-sub);
  background: #f8fafc;
  font-weight: 700;
}

.confirm-list dd {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.result-panel {
  padding-top: 20px;
  text-align: center;
}

.result-hero {
  margin-bottom: 24px;
}

.result-badge {
  display: inline-grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 18px;
  color: #fff;
  border-radius: 50%;
}

.result-badge.success {
  background: var(--accent);
}

.result-badge.processing {
  background: var(--warning);
}

.result-badge.error {
  background: var(--danger);
}

.result-badge svg {
  width: 38px;
  height: 38px;
  fill: currentColor;
}

.result-title {
  margin-bottom: 8px;
  font-size: 24px;
  font-weight: 800;
}

.result-message {
  margin: 0 auto;
  max-width: 540px;
  color: var(--text-sub);
  line-height: 1.7;
}

.result-detail-list {
  display: grid;
  gap: 1px;
  width: min(640px, 100%);
  margin: 26px auto 0;
  overflow: hidden;
  background: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-align: left;
}

.result-detail-list div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  background: #fff;
}

.result-detail-list dt,
.result-detail-list dd {
  margin: 0;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.45;
}

.result-detail-list dt {
  color: var(--text-sub);
  background: #f8fafc;
  font-weight: 800;
}

.result-detail-list dd {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.query-container {
  padding: 26px;
}

.task-form {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.query-results-section {
  margin-top: 22px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #475467;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--danger);
  background: #fff7f7;
  border-color: #fecaca;
}

.history-block {
  margin-top: 2px;
}

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

.table-heading span {
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.result-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 13px;
}

.result-table th,
.result-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  vertical-align: middle;
}

.result-table th {
  color: var(--text-sub);
  background: #f8fafc;
  font-weight: 800;
}

.result-table tr:last-child td {
  border-bottom: 0;
}

.empty-cell {
  color: var(--text-sub);
  text-align: center !important;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.tag.success {
  color: #166534;
  background: #dcfce7;
}

.tag.processing {
  color: #1d4ed8;
  background: #dbeafe;
}

.tag.failed {
  color: #991b1b;
  background: #fee2e2;
}

.tag.neutral {
  color: #475467;
  background: #eef2f7;
}

.docs-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: 84px;
  padding: 24px;
}

.docs-sidebar p {
  margin-bottom: 8px;
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 700;
}

.docs-sidebar code {
  display: block;
  padding: 10px;
  overflow-wrap: anywhere;
  color: #1e3a8a;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.docs-content {
  display: grid;
  gap: 16px;
}

.endpoint-block {
  overflow: hidden;
}

.endpoint-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.endpoint-title code {
  flex: 1;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-weight: 800;
}

.method {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: #fff;
  background: var(--accent);
  border-radius: 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 800;
}

.method.light {
  color: #1d4ed8;
  background: #dbeafe;
}

.copy-btn {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  color: #344054;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.copy-btn:hover {
  color: var(--primary);
  background: #f8fafc;
}

pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  color: #263241;
  background: #fbfcfe;
  font-size: 13px;
  line-height: 1.65;
}

pre code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 50;
  display: none;
  max-width: min(420px, calc(100% - 32px));
  padding: 10px 16px;
  color: #fff;
  background: rgba(17, 24, 39, 0.92);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  transform: translateX(-50%);
}

.toast.show {
  display: block;
  animation: toast-in 0.18s ease;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.48);
}

.modal {
  position: relative;
  width: min(520px, 100%);
  padding: 34px 36px 28px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 26px 80px rgba(17, 24, 39, 0.24);
}

.modal h3 {
  margin-bottom: 18px;
  font-size: 22px;
}

.modal p {
  color: #344054;
  font-size: 16px;
  line-height: 1.8;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #667085;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
}

.modal-close:hover {
  background: #f2f4f7;
}

.modal-close svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
}

.modal-actions .btn {
  width: auto;
  min-width: 120px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 860px) {
  .navbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
  }

  .brand {
    justify-content: center;
  }

  .nav-tabs {
    width: 100%;
  }

  .nav-item {
    flex: 1;
    padding: 0 8px;
  }

  .main-container {
    width: 100%;
    margin-top: 0;
  }

  .recharge-grid,
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .guide-card,
  .action-card,
  .query-container,
  .docs-sidebar,
  .endpoint-block {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .guide-card {
    order: -1;
    padding: 20px 16px;
  }

  .action-card,
  .query-container {
    padding: 22px 16px;
  }

  .docs-sidebar {
    position: static;
    padding: 22px 16px;
  }

  .docs-content {
    gap: 10px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-heading.compact {
    flex-direction: row;
    align-items: center;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .confirm-list div {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .btn-row {
    flex-direction: column;
  }

  .step-number {
    display: none;
  }

  .endpoint-title {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 21px;
  }

  h2 {
    font-size: 20px;
  }

  .brand {
    font-size: 16px;
  }

  .segment {
    font-size: 13px;
  }
}
