:root {
  --bg: #111417;
  --surface: #212a33;
  --raised: #293440;
  --field: #242e38;
  --line: #1a2026;
  --code: #161c22;
  --text: #eef2f6;
  --soft: #c6d0da;
  --muted: #8c9aa9;
  --accent: #248bda;
  --link: #4db2ff;
  --ok: #3fbf7f;
  --wait: #e0a43a;
  --bad: #e5534b;
  --radius: 8px;
  --bar-h: 56px;
  --side-w: 260px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

body.finder-open,
body.menu-open {
  overflow: hidden;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.offscreen {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
}

.bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--bar-h);
  padding: 0 20px;
  background: rgba(17, 20, 23, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
}

.bar-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--soft);
  cursor: pointer;
}

.bar-btn:hover {
  background: var(--surface);
}

.bar-menu {
  display: none;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  font-weight: 650;
  font-size: 16px;
  white-space: nowrap;
}

.logo:hover {
  text-decoration: none;
}

.logo-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.logo-mark svg,
.logo-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-tag {
  padding: 1px 7px;
  border: 1px solid var(--raised);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.bar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 380px;
  height: 36px;
  margin-left: 28px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--raised);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--muted);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.bar-search:hover {
  border-color: #34424f;
  color: var(--soft);
}

.bar-search-text {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

kbd {
  padding: 1px 6px;
  border: 1px solid var(--raised);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font: 11px/1.6 var(--mono);
}

.bar-cab {
  margin-left: auto;
  padding: 7px 14px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.bar-cab:hover {
  background: #2f97e6;
  text-decoration: none;
}

.shell {
  display: flex;
  align-items: flex-start;
}

.side {
  position: sticky;
  top: var(--bar-h);
  flex: none;
  width: var(--side-w);
  height: calc(100vh - var(--bar-h));
  padding: 12px 12px 48px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  overscroll-behavior: contain;
}

.side-head {
  display: none;
}

.nav-sec ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-title {
  margin: 18px 0 6px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-link {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--soft);
  font-size: 14px;
}

.nav-link:hover {
  background: var(--surface);
  text-decoration: none;
}

.nav-link.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}

.nav-sub {
  margin: 2px 0 6px;
  padding: 0 0 0 12px;
  list-style: none;
}

.nav-sub a {
  display: block;
  padding: 4px 10px;
  border-left: 1px solid var(--raised);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.nav-sub a:hover {
  color: var(--soft);
  text-decoration: none;
}

.nav-sub a.on {
  border-left-color: var(--link);
  color: var(--link);
}

.veil {
  display: none;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 36px 44px 56px;
}

.page {
  max-width: 1200px;
}

.page-head {
  max-width: 740px;
  padding-bottom: 24px;
}

.crumb {
  color: var(--link);
  font-size: 13px;
  font-weight: 600;
}

h1 {
  margin: 6px 0 14px;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h2 {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.3;
}

.h-link {
  color: inherit;
}

.h-link:hover {
  text-decoration: none;
}

.h-link:hover::after {
  content: " #";
  color: var(--muted);
}

.lead {
  margin: 14px 0 0;
  color: var(--soft);
  font-size: 17px;
}

p {
  margin: 0 0 12px;
}

ul,
ol {
  margin: 0 0 12px;
  padding-left: 20px;
}

li {
  margin: 4px 0;
}

strong {
  font-weight: 650;
}

code {
  padding: 1px 6px;
  border: 1px solid var(--raised);
  border-radius: 6px;
  background: var(--field);
  font: 0.86em/1.5 var(--mono);
  overflow-wrap: anywhere;
}

.endpoint {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--raised);
  border-radius: var(--radius);
  background: var(--surface);
}

.endpoint code {
  padding: 0;
  border: 0;
  background: none;
  font-size: 14px;
}

.verb {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.verb-post {
  background: rgba(36, 139, 218, 0.18);
  color: var(--link);
}

.verb-get {
  background: rgba(63, 191, 127, 0.16);
  color: #5fd39a;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--bar-h) + 12px);
}

.row-text {
  min-width: 0;
  max-width: 740px;
}

.row-text > :last-child {
  margin-bottom: 0;
}

.row-code {
  min-width: 0;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--raised);
  border-radius: var(--radius);
  background: var(--code);
}

.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 0 6px 0 4px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.panel-tabs {
  display: flex;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.panel-tabs::-webkit-scrollbar {
  display: none;
}

.panel-tab,
.panel-label {
  flex: none;
  padding: 10px 10px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.panel-tab {
  cursor: pointer;
}

.panel-tab:hover {
  color: var(--soft);
}

.panel-tab.on {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.panel-label {
  color: var(--soft);
}

.panel-copy {
  flex: none;
  padding: 4px 10px;
  border: 1px solid var(--raised);
  border-radius: 6px;
  background: var(--field);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.panel-copy:hover {
  color: var(--text);
}

.panel-copy.done {
  border-color: rgba(63, 191, 127, 0.5);
  color: var(--ok);
}

.panel-body {
  max-height: 620px;
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  color: #d5dde5;
  font: 13px/1.65 var(--mono);
  tab-size: 2;
}

.panel-body code {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  overflow-wrap: normal;
}

.t-s { color: #9ad59f; }
.t-k { color: #7fc3f5; }
.t-n { color: #f2b56b; }
.t-w { color: #c9a2f5; }
.t-v { color: #f39b8e; }

.tbl {
  margin: 4px 0 14px;
  overflow-x: auto;
  border: 1px solid var(--raised);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  padding: 9px 12px;
  border-bottom: 1px solid var(--raised);
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

tbody tr:first-child td {
  border-top: 0;
}

td:first-child {
  white-space: nowrap;
}

td code {
  overflow-wrap: normal;
}

.fields {
  margin: 4px 0 14px;
  border: 1px solid var(--raised);
  border-radius: var(--radius);
  background: var(--surface);
}

.field {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.field:first-child {
  border-top: 0;
}

.field-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.field-name {
  font: 600 14px/1.4 var(--mono);
  color: var(--text);
}

.field-type {
  color: var(--muted);
  font-size: 13px;
}

.flag {
  padding: 0 7px;
  border-radius: 6px;
  background: rgba(224, 164, 58, 0.12);
  color: var(--wait);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
}

.field-desc {
  margin-top: 4px;
  color: var(--soft);
  font-size: 14px;
}

.note {
  margin: 14px 0;
  padding: 11px 14px;
  border: 1px solid var(--raised);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--soft);
  font-size: 14px;
}

.note-warn { border-left-color: var(--wait); }
.note-stop { border-left-color: var(--bad); }
.note-tip { border-left-color: var(--ok); }

.steps {
  margin: 4px 0 14px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  margin: 0;
  padding: 0 0 14px 40px;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--raised);
  border-radius: 50%;
  background: var(--field);
  color: var(--link);
  font-size: 13px;
  font-weight: 700;
}

.steps li::after {
  content: "";
  position: absolute;
  left: 12.5px;
  top: 30px;
  bottom: 4px;
  width: 1px;
  background: var(--raised);
}

.steps li:last-child {
  padding-bottom: 0;
}

.steps li:last-child::after {
  display: none;
}

.states {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}

.state {
  padding: 12px 14px;
  border: 1px solid var(--raised);
  border-radius: var(--radius);
  background: var(--surface);
}

.state-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 600 14px/1.4 var(--mono);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.state-pending .dot { background: var(--wait); }
.state-paid .dot { background: var(--ok); }
.state-failed .dot { background: var(--bad); }

.state-text {
  margin-top: 4px;
  color: var(--soft);
  font-size: 14px;
}

.checks {
  padding: 0;
  list-style: none;
}

.checks li {
  position: relative;
  margin: 0;
  padding: 7px 0 7px 30px;
  border-top: 1px solid var(--line);
}

.checks li:first-child {
  border-top: 0;
}

.checks li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 10px;
  width: 16px;
  height: 16px;
  border: 1.5px solid #3a4856;
  border-radius: 5px;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 740px;
  margin-top: 36px;
}

.pager a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--raised);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.pager a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.pager small {
  color: var(--muted);
  font-size: 12px;
}

.pager-next {
  align-items: flex-end;
  text-align: right;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  max-width: 1200px;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.finder {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
  background: rgba(5, 7, 9, 0.6);
}

.finder[hidden] {
  display: none;
}

.finder-box {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  max-height: 76vh;
  overflow: hidden;
  border: 1px solid var(--raised);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.finder-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.finder-field input {
  flex: 1;
  min-width: 0;
  height: 52px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 16px var(--sans);
}

.finder-field input::-webkit-search-cancel-button {
  display: none;
}

.finder-list {
  overflow-y: auto;
  padding: 6px;
}

.finder-empty {
  padding: 18px 12px;
  color: var(--muted);
  font-size: 14px;
}

.hit {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text);
}

.hit:hover,
.hit.on {
  background: var(--raised);
  text-decoration: none;
}

.hit-title {
  font-weight: 600;
  font-size: 14px;
}

.hit-where {
  color: var(--link);
  font-size: 12px;
}

.hit-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

mark {
  border-radius: 3px;
  background: rgba(36, 139, 218, 0.32);
  color: inherit;
}

@media (min-width: 1280px) {
  .row.has-code {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 40px;
  }

  .row-code {
    position: sticky;
    top: calc(var(--bar-h) + 20px);
    align-self: start;
  }
}

@media (max-width: 960px) {
  .bar {
    gap: 6px;
    padding: 0 12px;
  }

  .bar-menu {
    display: inline-grid;
  }

  .bar-search {
    flex: none;
    width: 36px;
    margin-left: auto;
    padding: 0;
    justify-content: center;
  }

  .bar-search-text,
  .bar-search kbd {
    display: none;
  }

  .bar-cab {
    margin-left: 4px;
    padding: 7px 12px;
  }

  .side {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    width: auto;
    height: auto;
    max-height: 82vh;
    padding: 0 12px calc(24px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--raised);
    border-right: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--surface);
    transform: translateY(104%);
    transition: transform 0.26s ease;
    visibility: hidden;
  }

  body.menu-open .side {
    transform: none;
    visibility: visible;
  }

  .side-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0 8px 10px;
    background: var(--surface);
  }

  .side-grip {
    position: absolute;
    left: 50%;
    top: 7px;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 2px;
    background: var(--raised);
  }

  .side-caption {
    font-weight: 650;
  }

  .nav-link.active {
    background: var(--raised);
  }

  .nav-link:hover {
    background: var(--raised);
  }

  .nav-sub {
    display: none;
  }

  .veil {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: block;
    background: rgba(5, 7, 9, 0.55);
  }

  .veil[hidden] {
    display: none;
  }

  .main {
    padding: 24px 16px 40px;
  }

  h1 {
    font-size: 26px;
  }

  .lead {
    font-size: 16px;
  }
}

@media (max-width: 560px) {
  .logo-tag {
    display: none;
  }

  .states {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager-next {
    grid-column: 1;
  }

  .finder {
    padding-top: 8px;
  }

  .panel-body {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .side {
    transition: none;
  }
}
