:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f0f4f8;
  --text: #17202a;
  --muted: #5f6f82;
  --line: #dbe3ec;
  --accent: #1f6feb;
  --accent-dark: #1457b8;
  --green: #0f766e;
  --amber: #a16207;
  --code-bg: #111827;
  --code-text: #e5edf7;
  --radius: 8px;
  --shadow: 0 16px 36px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

button,
input,
textarea {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 20;
  padding: 8px 12px;
  color: #fff;
  background: var(--text);
  border-radius: 6px;
}

.skip-link:focus {
  top: 12px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand,
.top-actions,
.tester-actions,
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background: var(--text);
  border-radius: 7px;
}

.brand-title {
  font-weight: 800;
  line-height: 1.1;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.page-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 0;
  max-width: 1440px;
  margin: 0 auto;
}

.toc {
  position: sticky;
  top: 65px;
  height: calc(100vh - 65px);
  padding: 24px 16px;
  border-right: 1px solid var(--line);
}

.toc a {
  display: block;
  padding: 9px 10px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
}

.toc a:hover,
.toc a:focus {
  color: var(--text);
  background: var(--surface-2);
  outline: none;
}

.content {
  min-width: 0;
  padding: 24px clamp(16px, 3vw, 40px) 64px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: 24px;
  align-items: end;
  padding: 20px 0 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

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

.lead {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
}

.endpoint-panel,
.doc-section,
.tester {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.endpoint-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  box-shadow: var(--shadow);
}

.endpoint-panel span,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  background: #dff6f1;
  border-radius: 999px;
}

.endpoint-panel code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-section {
  margin-top: 18px;
  padding: 22px;
}

.doc-section p {
  color: var(--muted);
}

.section-head {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-head p {
  margin-bottom: 0;
}

.button,
.icon-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.button {
  padding: 8px 14px;
}

.icon-button {
  min-height: 34px;
  padding: 5px 10px;
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--line);
}

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

.button-primary:hover,
.button-primary:focus {
  color: #fff;
  background: var(--accent-dark);
}

.button-secondary {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}

.button-secondary:hover,
.button-secondary:focus,
.icon-button:hover,
.icon-button:focus {
  color: var(--text);
  background: var(--surface-2);
  border-color: #b8c5d4;
}

.button:active,
.icon-button:active {
  transform: translateY(1px);
}

pre {
  overflow: auto;
  margin: 14px 0;
  padding: 16px;
  color: var(--code-text);
  background: var(--code-bg);
  border-radius: var(--radius);
}

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

code {
  font-size: 0.92em;
}

.wide-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #334155;
  font-size: 13px;
  background: #eef3f8;
}

td {
  color: #334155;
}

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

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.split > *,
.tester-grid > *,
.section-head > *,
.brand {
  min-width: 0;
}

.tester-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-weight: 700;
}

label span {
  font-size: 13px;
}

input,
textarea {
  width: 100%;
  color: var(--text);
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  outline: none;
}

input {
  min-height: 42px;
  padding: 8px 10px;
}

textarea {
  min-height: 300px;
  padding: 12px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus,
.button:focus,
.icon-button:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15);
}

.payload-field {
  grid-column: span 1;
}

.tester-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: none;
  max-width: min(440px, calc(100vw - 36px));
  padding: 12px 14px;
  color: #fff;
  background: var(--text);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}

@media (max-width: 980px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static;
    display: flex;
    height: auto;
    gap: 4px;
    overflow-x: auto;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
  }

  .toc a {
    flex: 0 0 auto;
  }

  .intro,
  .tester-grid,
  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .button {
    flex: 1;
  }

  .content {
    padding-inline: 12px;
  }

  .doc-section {
    padding: 16px;
  }

  .endpoint-panel {
    grid-template-columns: 1fr;
  }
}
