:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #17243b;
  --muted: #68758b;
  --line: #dfe6f0;
  --primary: #1769e0;
  --primary-soft: #eaf2ff;
  --green: #0a8f62;
  --warning: #a85d08;
  --warning-bg: #fff7e8;
  --danger: #bb3545;
  --code: #111a2b;
  --sidebar: 264px;
  --header: 68px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header) + 24px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.72 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: inherit; }
code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
code { font-size: .92em; }

.topbar {
  position: fixed;
  z-index: 30;
  inset: 0 0 auto 0;
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: white;
  background: linear-gradient(145deg, #267bea, #104bb7);
  border-radius: 11px;
  font-size: 21px;
  font-weight: 800;
  box-shadow: 0 7px 18px rgba(23,105,224,.25);
}
.brand strong, .brand small { display: block; line-height: 1.2; }
.brand strong { font-size: 17px; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.version { padding: 5px 10px; color: var(--primary); background: var(--primary-soft); border-radius: 999px; font-size: 12px; font-weight: 700; }
.outline-button, .menu-button {
  padding: 8px 13px;
  color: var(--text);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.outline-button:hover, .menu-button:hover { border-color: #a9c5eb; color: var(--primary); }
.menu-button { display: none; }

.page-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); padding-top: var(--header); }
.sidebar {
  position: fixed;
  z-index: 20;
  top: var(--header);
  bottom: 0;
  left: 0;
  width: var(--sidebar);
  padding: 25px 18px 40px;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid var(--line);
}
.sidebar nav { display: grid; gap: 3px; }
.sidebar a {
  padding: 8px 12px;
  color: #506078;
  border-radius: 8px;
  text-decoration: none;
  transition: .15s ease;
}
.sidebar a:hover { color: var(--primary); background: var(--primary-soft); }
.sidebar a.active { color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.nav-label { margin: 19px 12px 5px; color: #9aa6b7; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.nav-label:first-child { margin-top: 0; }

.content { grid-column: 2; width: min(1120px, calc(100% - 64px)); margin: 0 auto; padding: 54px 0 80px; }
.hero, .doc-section { scroll-margin-top: calc(var(--header) + 22px); }
.hero { padding-bottom: 20px; }
.eyebrow { color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
h1 { margin: 7px 0 12px; font-size: clamp(34px, 5vw, 52px); line-height: 1.15; letter-spacing: -.035em; }
.lead { max-width: 820px; margin: 0; color: var(--muted); font-size: 18px; }
.hero-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 28px 0 18px; }
.hero-grid div { padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.hero-grid span, .hero-grid strong { display: block; }
.hero-grid span { margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.hero-grid strong { font-size: 14px; }

.doc-section {
  margin-top: 30px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 30px rgba(32,55,88,.045);
}
.section-heading { display: flex; align-items: flex-start; gap: 15px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.section-heading > span {
  flex: 0 0 auto;
  padding: 5px 9px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
}
h2 { margin: 0; font-size: 27px; line-height: 1.3; letter-spacing: -.015em; }
.hero h2 { margin: 40px 0 12px; }
.section-heading p { margin: 5px 0 0; color: var(--muted); }
h3 { margin: 28px 0 10px; font-size: 17px; }
.endpoint-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 11px; margin: 22px 0; padding: 14px 16px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.endpoint-meta > code { color: #243853; font-size: 15px; font-weight: 700; }
.endpoint-meta > span:last-child { margin-left: auto; color: var(--muted); font-size: 12px; }
.method { padding: 4px 9px; color: white; background: var(--green); border-radius: 6px; font-size: 12px; font-weight: 800; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 13px 15px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { color: #53637a; background: #f8fafc; font-size: 12px; font-weight: 750; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td code { color: #185dbb; font-weight: 650; white-space: nowrap; }
.required { display: inline-block; color: #b42332; font-weight: 750; }

.code-panel { margin: 12px 0 18px; overflow: hidden; background: var(--code); border: 1px solid #22304a; border-radius: 12px; }
.code-title { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 14px 0 17px; color: #a9b6ca; background: #172238; border-bottom: 1px solid #293751; font-size: 12px; }
.copy-button { padding: 5px 10px; color: #cbd6e7; background: transparent; border: 1px solid #40506a; border-radius: 6px; font: inherit; cursor: pointer; }
.copy-button:hover { color: white; border-color: #7c91b2; }
.copy-button.copied { color: #8ce0bd; border-color: #397e65; }
pre { margin: 0; padding: 18px; overflow: auto; color: #e7edf7; font-size: 13px; line-height: 1.65; tab-size: 2; }
pre code { font-size: inherit; }
.error-code { border-color: #67313b; }
.error-code .code-title { background: #2b1a23; border-color: #54303a; color: #e7aeb8; }

.notice { margin: 20px 0 0; padding: 15px 17px; background: #f6f8fb; border-left: 4px solid #8fa0b8; border-radius: 7px; }
.notice strong { display: block; margin-bottom: 3px; }
.notice p { margin: 0; color: #526077; }
.notice.primary { background: var(--primary-soft); border-color: var(--primary); }
.notice.warning { background: var(--warning-bg); border-color: #e29a30; }
.notice.warning strong { color: var(--warning); }
.steps { padding-left: 22px; }
.steps li { margin: 8px 0; padding-left: 5px; }

.catalog-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 22px 0 14px; }
.catalog-intro strong { display: block; font-size: 16px; }
.catalog-intro p { margin: 4px 0 0; color: var(--muted); }
.catalog-count { flex: 0 0 auto; padding: 6px 11px; color: var(--primary); background: var(--primary-soft); border-radius: 999px; font-size: 12px; font-weight: 750; }
.catalog-filters { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(150px, 220px) auto; align-items: end; gap: 12px; margin: 0 0 14px; padding: 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 11px; }
.catalog-filters label { display: grid; gap: 6px; color: #53637a; font-size: 12px; font-weight: 700; }
.catalog-filters input, .catalog-filters select, .catalog-filters button { height: 40px; padding: 0 12px; color: var(--text); background: #fff; border: 1px solid #ced8e6; border-radius: 8px; font: inherit; font-size: 14px; }
.catalog-filters input:focus, .catalog-filters select:focus { border-color: var(--primary); outline: 3px solid rgba(23,105,224,.12); }
.catalog-filters button { color: #4d5d74; font-weight: 700; cursor: pointer; }
.catalog-filters button:hover { color: var(--primary); border-color: #9dbce5; }
.catalog-table td { vertical-align: middle; }
.catalog-table td:first-child { color: #243853; font-weight: 800; }
.catalog-loading, .catalog-empty, .catalog-error { padding: 34px !important; color: var(--muted); text-align: center; }
.catalog-error { color: var(--danger); }
.bank-icon { display: block; width: 38px; height: 38px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.bank-icon-placeholder { display: grid; place-items: center; color: #8190a5; background: #eef2f7; font-size: 11px; font-weight: 800; }

footer { display: flex; justify-content: space-between; align-items: center; margin-top: 36px; padding: 24px 4px; color: var(--muted); border-top: 1px solid var(--line); font-size: 13px; }
footer a { color: var(--primary); text-decoration: none; }

@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: repeat(2, 1fr); }
  .content { width: min(100% - 40px, 920px); }
}

@media (max-width: 780px) {
  :root { --header: 62px; }
  .topbar { padding: 0 16px; }
  .version, .outline-button { display: none; }
  .menu-button { display: inline-block; }
  .page-shell { display: block; }
  .sidebar {
    transform: translateX(-105%);
    width: min(82vw, 310px);
    box-shadow: 10px 0 35px rgba(18,31,52,.15);
    transition: transform .2s ease;
  }
  body.menu-open { overflow: hidden; }
  body.menu-open .sidebar { transform: translateX(0); }
  .content { width: calc(100% - 28px); padding-top: 32px; }
  .doc-section { padding: 23px 17px; border-radius: 14px; }
  h2 { font-size: 23px; }
  .lead { font-size: 16px; }
  .endpoint-meta > span:last-child { width: 100%; margin-left: 0; }
  .catalog-intro { align-items: flex-start; flex-direction: column; }
  .catalog-filters { grid-template-columns: 1fr; }
  th, td { padding: 11px 12px; min-width: 100px; }
  th:first-child, td:first-child { min-width: 155px; }
  pre { padding: 15px; font-size: 12px; }
}

@media (max-width: 520px) {
  .brand small { display: none; }
  .hero-grid { grid-template-columns: 1fr; }
  .section-heading { gap: 10px; }
  footer { align-items: flex-start; flex-direction: column; gap: 8px; }
}
