:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --text: #17202e;
  --text-strong: #101828;
  --muted: #667085;
  --muted-strong: #475467;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --blue: #2468d8;
  --blue-strong: #1757bd;
  --blue-soft: #eef5ff;
  --green: #087e5b;
  --green-soft: #ecfdf3;
  --amber: #b54708;
  --amber-soft: #fffaeb;
  --red: #b42318;
  --red-soft: #fef3f2;
  --code-bg: #151a22;
  --code-text: #e8edf5;
  --sidebar-width: 276px;
  --shadow-float: 0 12px 32px rgba(16, 24, 40, 0.12);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111318;
  --bg-soft: #171a20;
  --surface: #15181e;
  --surface-raised: #1b1f27;
  --text: #e7eaf0;
  --text-strong: #f7f8fa;
  --muted: #a7adba;
  --muted-strong: #c3c8d1;
  --border: #2b3039;
  --border-strong: #3a414c;
  --blue: #68a0ff;
  --blue-strong: #8bb5ff;
  --blue-soft: #17243a;
  --green: #55d6a9;
  --green-soft: #132a23;
  --amber: #f8ba62;
  --amber-soft: #302515;
  --red: #ff9189;
  --red-soft: #321a1d;
  --code-bg: #0a0d12;
  --code-text: #edf1f7;
  --shadow-float: 0 14px 38px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Aptos, "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-size: 16px;
  line-height: 1.72;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

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

code {
  font-size: 0.9em;
}

:not(pre) > code {
  padding: 0.15em 0.38em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--text-strong);
  overflow-wrap: anywhere;
}

::selection {
  background: rgba(36, 104, 216, 0.22);
}

:focus-visible {
  outline: 3px solid rgba(36, 104, 216, 0.36);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  transform: translateY(-160%);
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--text-strong);
  color: var(--bg);
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 80;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
}

.sidebar-top {
  display: flex;
  min-height: 84px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px 22px;
}

.brand,
.mobile-brand {
  display: inline-flex;
  align-items: center;
  color: var(--text-strong);
  text-decoration: none;
}

.brand {
  gap: 11px;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
}

.brand span {
  display: grid;
  line-height: 1.25;
}

.brand strong {
  font-size: 15px;
  font-weight: 760;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

.search-box {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  height: 42px;
  align-items: center;
  gap: 7px;
  margin: 0 16px 12px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
}

.search-box:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 104, 216, 0.1);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.search-box input::placeholder {
  color: var(--muted);
}

.search-box kbd {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 10px;
  box-shadow: 0 1px 0 var(--border-strong);
}

.doc-nav {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 22px;
  scrollbar-width: thin;
}

.nav-group + .nav-group {
  margin-top: 22px;
}

.nav-group p {
  margin: 0 10px 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.nav-group a {
  position: relative;
  display: flex;
  min-height: 35px;
  align-items: center;
  margin: 1px 0;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 540;
  text-decoration: none;
}

.nav-group a:hover {
  background: var(--surface);
  color: var(--text-strong);
}

.nav-group a.active {
  background: var(--blue-soft);
  color: var(--blue-strong);
  font-weight: 690;
}

.nav-group a.active::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  border-radius: 3px;
  background: var(--blue);
  content: "";
}

.sidebar-footer {
  display: grid;
  grid-template-columns: 1fr 1fr 34px;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.sidebar-footer > a {
  padding: 6px 4px;
  color: var(--muted-strong);
  font-size: 12px;
  text-align: center;
  text-decoration: none;
}

.sidebar-footer > a:hover {
  color: var(--blue-strong);
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-strong);
}

.sidebar-close,
.mobile-header {
  display: none;
}

.main {
  display: grid;
  grid-template-columns: minmax(0, 860px) 180px;
  justify-content: center;
  gap: 64px;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 0 46px;
}

.document {
  min-width: 0;
  max-width: 860px;
}

.doc-hero {
  padding: 70px 0 62px;
  border-bottom: 1px solid var(--border);
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--blue-strong);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.3;
  text-transform: uppercase;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow span {
  width: 22px;
  height: 2px;
  background: var(--blue);
}

.doc-hero h1 {
  max-width: 720px;
  margin: 18px 0 16px;
  color: var(--text-strong);
  font-size: 42px;
  font-weight: 790;
  line-height: 1.16;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 720px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 17px;
  line-height: 1.85;
}

.endpoint-strip {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 28px;
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-soft);
}

.endpoint-strip > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 14%, transparent);
}

.endpoint-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  text-transform: uppercase;
}

.endpoint-strip code {
  min-width: 0;
  color: var(--text-strong);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.copy-value,
.code-copy {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted-strong);
  cursor: pointer;
}

.copy-value {
  width: 34px;
  height: 34px;
}

.copy-value:hover,
.code-copy:hover {
  border-color: var(--blue);
  color: var(--blue-strong);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.button.primary {
  background: var(--blue-strong);
  color: #ffffff;
}

.button.primary:hover {
  background: #12499e;
}

html[data-theme="dark"] .button.primary:hover {
  background: #2f75df;
}

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

.button.secondary:hover {
  border-color: var(--blue);
  color: var(--blue-strong);
}

.doc-section {
  padding: 58px 0 62px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 22px;
}

.doc-section > p {
  max-width: 760px;
  color: var(--muted-strong);
}

.section-heading,
.agent-heading {
  display: flex;
  align-items: flex-start;
  margin-bottom: 20px;
}

.section-heading {
  gap: 16px;
}

.section-number {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--muted);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
}

.section-heading h2,
.agent-heading h2 {
  margin: 5px 0 0;
  color: var(--text-strong);
  font-size: 28px;
  font-weight: 770;
  line-height: 1.24;
  letter-spacing: 0;
}

.doc-section h3 {
  margin: 34px 0 10px;
  color: var(--text-strong);
  font-size: 18px;
  font-weight: 730;
  line-height: 1.4;
}

.endpoint-table {
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.endpoint-row {
  display: grid;
  grid-template-columns: 1fr 1.55fr 1fr;
  min-height: 54px;
  align-items: center;
  border-top: 1px solid var(--border);
}

.endpoint-row:first-child {
  border-top: 0;
}

.endpoint-row > span {
  min-width: 0;
  padding: 12px 14px;
  color: var(--muted-strong);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.endpoint-row > span + span {
  border-left: 1px solid var(--border);
}

.endpoint-row strong {
  color: var(--text-strong);
}

.endpoint-head {
  min-height: 40px;
  background: var(--bg-soft);
}

.endpoint-head > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.callout {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  margin-top: 24px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 6px;
}

.callout.info {
  border-left-color: var(--blue);
  background: var(--blue-soft);
}

.callout.warning {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.callout.subtle {
  border-left-color: var(--green);
  background: var(--bg-soft);
}

.callout-mark {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--blue-strong);
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.warning .callout-mark {
  color: var(--amber);
}

.subtle .callout-mark {
  color: var(--green);
}

.callout strong {
  color: var(--text-strong);
  font-size: 13px;
}

.callout p {
  margin: 3px 0 0;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.65;
}

.steps {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 26px;
}

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

.steps li::before {
  position: absolute;
  top: 36px;
  bottom: 0;
  left: 17px;
  width: 1px;
  background: var(--border);
  content: "";
}

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

.steps li > span {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--blue-strong);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  font-weight: 760;
}

.steps strong {
  color: var(--text-strong);
  font-size: 14px;
}

.steps p {
  margin: 3px 0 0;
  color: var(--muted-strong);
  font-size: 14px;
}

.text-link {
  display: inline-block;
  margin-top: 7px;
  color: var(--blue-strong);
  font-size: 13px;
  font-weight: 680;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.code-tabs {
  margin-top: 18px;
}

.tab-list {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 3px;
  margin-bottom: 8px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-soft);
}

.tab-list button {
  min-height: 28px;
  padding: 4px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 680;
  cursor: pointer;
}

.tab-list button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text-strong);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1);
}

.code-block {
  position: relative;
  overflow: hidden;
  border: 1px solid #29303b;
  border-radius: 8px;
  background: var(--code-bg);
}

.code-label {
  min-height: 36px;
  padding: 9px 46px 8px 14px;
  border-bottom: 1px solid #29303b;
  color: #9ca6b5;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 10px;
  font-weight: 650;
}

.code-block pre {
  margin: 0;
  padding: 17px 18px 20px;
  overflow-x: auto;
  color: var(--code-text);
  font-size: 12.5px;
  line-height: 1.72;
  tab-size: 2;
  scrollbar-width: thin;
}

.code-block code {
  font-size: inherit;
}

.code-copy {
  position: absolute;
  top: 6px;
  right: 7px;
  z-index: 2;
  width: 28px;
  height: 26px;
  border-color: #363e4b;
  background: #1c222c;
  color: #b7c0cd;
  font-size: 14px;
}

.code-copy:hover {
  border-color: #6e89b5;
  color: #ffffff;
}

.result-line {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin-top: 16px;
}

.result-line + .result-line {
  margin-top: 8px;
}

.result-line p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 13px;
}

.status,
.protocol-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 760;
  line-height: 1;
}

.status {
  min-height: 23px;
  padding: 4px 8px;
}

.status.success {
  background: var(--green-soft);
  color: var(--green);
}

.status.danger {
  background: var(--red-soft);
  color: var(--red);
}

.agent-index {
  padding-bottom: 50px;
}

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

.agent-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 18px;
  min-height: 72px;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.agent-card:hover {
  transform: translateY(-1px);
  border-color: var(--blue);
  box-shadow: 0 7px 18px rgba(16, 24, 40, 0.07);
}

.agent-card > span:nth-child(2) {
  display: grid;
  min-width: 0;
}

.agent-card strong {
  color: var(--text-strong);
  font-size: 13px;
}

.agent-card small {
  color: var(--muted);
  font-size: 11px;
}

.agent-card b {
  color: var(--muted);
  font-size: 15px;
}

.agent-monogram {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue-strong);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
}

.agent-monogram.warm {
  background: var(--amber-soft);
  color: var(--amber);
}

.agent-monogram.dark {
  background: var(--text-strong);
  color: var(--bg);
}

.agent-monogram.green {
  background: var(--green-soft);
  color: var(--green);
}

.agent-heading {
  position: relative;
  align-items: center;
  gap: 13px;
}

.agent-heading .section-kicker {
  font-size: 10px;
}

.agent-heading h2 {
  margin-top: 3px;
}

.protocol-badge {
  margin-left: auto;
  padding: 7px 9px;
  background: var(--blue-soft);
  color: var(--blue-strong);
}

.warm-badge {
  background: var(--amber-soft);
  color: var(--amber);
}

.dark-badge {
  background: var(--text-strong);
  color: var(--bg);
}

.green-badge {
  background: var(--green-soft);
  color: var(--green);
}

.compact-list {
  padding-left: 21px;
  color: var(--muted-strong);
  font-size: 14px;
}

.compact-list li + li {
  margin-top: 7px;
}

.short-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.short-steps li {
  display: block;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.short-steps li::before {
  display: none;
}

.short-steps li > span {
  margin-bottom: 12px;
}

.cc-table .endpoint-row {
  grid-template-columns: 0.8fr 1.35fr 1.1fr;
}

.error-list {
  margin-top: 22px;
  border-top: 1px solid var(--border);
}

.error-list details {
  border-bottom: 1px solid var(--border);
}

.error-list summary {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr) auto 20px;
  min-height: 58px;
  align-items: center;
  gap: 13px;
  padding: 10px 2px;
  color: var(--text-strong);
  cursor: pointer;
  list-style: none;
}

.error-list summary::-webkit-details-marker,
.faq-list summary::-webkit-details-marker {
  display: none;
}

.error-list summary::after,
.faq-list summary::after {
  color: var(--muted);
  content: "+";
  font-size: 18px;
  font-weight: 400;
}

.error-list details[open] summary::after,
.faq-list details[open] summary::after {
  content: "−";
}

.error-list summary code {
  color: var(--red);
  font-size: 11px;
}

.error-list summary span {
  font-size: 13px;
  font-weight: 660;
}

.error-list summary b {
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 10px;
}

.error-list summary::after {
  grid-column: 4;
}

.error-list details > div {
  padding: 0 36px 17px 109px;
}

.error-list details p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 13px;
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.security-grid > div {
  min-height: 124px;
  padding: 18px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.security-grid > div:nth-child(2n) {
  border-right: 0;
}

.security-grid > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.security-grid strong {
  color: var(--text-strong);
  font-size: 13px;
}

.security-grid p {
  margin: 6px 0 0;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.65;
}

.faq-list {
  margin-top: 18px;
  border-top: 1px solid var(--border);
}

.faq-list details {
  border-bottom: 1px solid var(--border);
}

.faq-list summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  min-height: 56px;
  align-items: center;
  gap: 12px;
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 680;
  cursor: pointer;
  list-style: none;
}

.faq-list details p {
  margin: -2px 40px 18px 0;
  color: var(--muted-strong);
  font-size: 13px;
}

.search-hidden {
  display: none !important;
}

.search-empty {
  padding: 64px 0;
  text-align: center;
}

.search-empty strong {
  color: var(--text-strong);
}

.search-empty p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.doc-footer {
  padding: 38px 0 52px;
  color: var(--muted);
  font-size: 12px;
}

.doc-footer > div {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.doc-footer img {
  width: 30px;
  height: 30px;
  border-radius: 6px;
}

.doc-footer > div span {
  display: grid;
  line-height: 1.3;
}

.doc-footer strong {
  color: var(--text-strong);
  font-size: 12px;
}

.doc-footer small {
  color: var(--muted);
  font-size: 10px;
}

.doc-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 18px;
}

.doc-footer nav a {
  color: var(--muted-strong);
  text-decoration: none;
}

.doc-footer nav a:hover {
  color: var(--blue-strong);
}

.doc-footer > p {
  margin: 10px 0 0;
}

.page-outline {
  position: sticky;
  top: 42px;
  align-self: start;
  margin-top: 72px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.page-outline > p {
  margin: 0 0 10px;
  color: var(--text-strong);
  font-size: 11px;
  font-weight: 760;
}

.page-outline a {
  display: block;
  padding: 4px 0;
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
}

.page-outline a:hover,
.page-outline a.active {
  color: var(--blue-strong);
}

.outline-progress {
  width: 100%;
  height: 2px;
  margin-top: 14px;
  overflow: hidden;
  background: var(--border);
}

.outline-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
  transition: width 120ms linear;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 120;
  padding: 9px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-raised);
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 680;
  box-shadow: var(--shadow-float);
}

.toast.show {
  animation: toast-in 180ms ease-out;
}

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

/* Legal pages */
.legal-page {
  min-height: 100vh;
  background: var(--bg);
}

.legal-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
}

.legal-topbar-inner {
  display: flex;
  min-height: 64px;
  max-width: 980px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto;
  padding: 0 24px;
}

.legal-topbar .brand img {
  width: 34px;
  height: 34px;
}

.legal-back {
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.legal-back:hover {
  color: var(--blue-strong);
}

.legal-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 720px);
  justify-content: center;
  gap: 56px;
  padding: 54px 24px 80px;
}

.legal-nav {
  position: sticky;
  top: 102px;
  align-self: start;
}

.legal-nav p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.legal-nav a {
  display: block;
  margin: 2px 0;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--muted-strong);
  font-size: 12px;
  text-decoration: none;
}

.legal-nav a:hover,
.legal-nav a.active {
  background: var(--blue-soft);
  color: var(--blue-strong);
}

.legal-article {
  min-width: 0;
}

.legal-article header {
  margin-bottom: 38px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.legal-article h1 {
  margin: 10px 0 12px;
  color: var(--text-strong);
  font-size: 36px;
  line-height: 1.2;
}

.legal-meta {
  color: var(--muted);
  font-size: 12px;
}

.legal-content h2 {
  margin: 38px 0 12px;
  color: var(--text-strong);
  font-size: 21px;
  line-height: 1.4;
}

.legal-content h3 {
  margin: 26px 0 9px;
  color: var(--text-strong);
  font-size: 16px;
}

.legal-content p,
.legal-content li {
  color: var(--muted-strong);
  font-size: 14px;
}

.legal-content ul,
.legal-content ol {
  padding-left: 22px;
}

.legal-content li + li {
  margin-top: 6px;
}

.legal-content blockquote {
  margin: 0 0 22px;
  padding: 12px 14px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
}

.legal-content blockquote p {
  margin: 0;
}

.legal-content a {
  color: var(--blue-strong);
}

.guide-figure {
  width: min(100%, 760px);
  max-width: 100%;
  margin: 24px 0 30px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-raised);
}

.guide-figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: contain;
  object-position: left top;
  border-radius: 13px 13px 0 0;
  background: var(--code-bg);
}

.guide-figure figcaption {
  margin: 0;
  padding: 10px 12px 12px;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.65;
}

.guide-figure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 760px;
}

.guide-figure-grid .guide-figure {
  width: 100%;
  max-width: none;
  margin-top: 14px;
}

.route-map {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0 30px;
}

.route-card {
  display: grid;
  gap: 6px;
  min-height: 116px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-raised);
}

.route-card strong {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.route-card span {
  color: var(--ink);
  font-weight: 700;
}

.route-card small {
  color: var(--muted-strong);
  line-height: 1.5;
}

.route-card-warm {
  border-color: rgba(214, 127, 64, 0.34);
  background: linear-gradient(135deg, rgba(255, 247, 239, 0.98), var(--surface-raised));
}

.route-card-dark {
  border-color: rgba(35, 54, 82, 0.28);
  background: linear-gradient(135deg, rgba(241, 246, 253, 0.98), var(--surface-raised));
}

.support-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  align-items: center;
  gap: 28px;
  padding: 26px;
  border: 1px solid rgba(47, 112, 232, 0.2);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(239, 247, 255, 0.96), var(--surface-raised));
}

.support-panel h3 {
  margin: 5px 0 10px;
  font-size: 22px;
}

.support-panel p {
  max-width: 620px;
}

.support-kicker {
  margin: 0;
  color: var(--blue-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.support-number {
  margin: 16px 0 0;
  color: var(--ink);
}

.support-qr {
  margin: 0;
  text-align: center;
}

.support-qr img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 8px solid #fff;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(33, 76, 141, 0.14);
}

.support-qr figcaption {
  margin-top: 8px;
  color: var(--muted-strong);
  font-size: 12px;
}

@media (max-width: 1500px) {
  .main {
    grid-template-columns: minmax(0, 860px);
  }

  .page-outline {
    display: none;
  }
}

@media (max-width: 900px) {
  html {
    scroll-padding-top: 76px;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .mobile-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 70;
    display: flex;
    height: 62px;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 93%, transparent);
    backdrop-filter: blur(12px);
  }

  .mobile-brand {
    gap: 8px;
    font-size: 13px;
    font-weight: 740;
  }

  .mobile-brand img {
    width: 30px;
    height: 30px;
    border-radius: 6px;
  }

  .sidebar {
    width: min(86vw, 300px);
    transform: translateX(-105%);
    transition: transform 200ms ease;
    box-shadow: var(--shadow-float);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-close {
    display: inline-grid;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 75;
    display: block;
    background: rgba(0, 0, 0, 0.42);
  }

  .main {
    display: block;
    margin-left: 0;
    padding: 0 22px;
  }

  .document {
    max-width: 760px;
    margin: 0 auto;
  }

  .doc-hero {
    padding-top: 102px;
  }

  .desktop-theme-toggle {
    display: none;
  }

  .legal-layout {
    grid-template-columns: minmax(0, 720px);
  }

  .legal-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }

  .legal-nav p {
    width: 100%;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .main {
    padding: 0 16px;
  }

  .doc-hero {
    padding: 94px 0 48px;
  }

  .doc-hero h1 {
    margin-top: 14px;
    font-size: 32px;
  }

  .hero-copy {
    font-size: 15px;
  }

  .endpoint-strip > div {
    display: grid;
    grid-template-columns: 10px 1fr;
    gap: 2px 9px;
  }

  .endpoint-strip code {
    grid-column: 2;
    font-size: 11px;
  }

  .doc-section {
    padding: 46px 0 50px;
  }

  .section-heading h2,
  .agent-heading h2 {
    font-size: 24px;
  }

  .endpoint-table {
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  .endpoint-head {
    display: none;
  }

  .endpoint-row {
    grid-template-columns: 1fr;
    margin-top: 10px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
  }

  .endpoint-row > span {
    padding: 3px 0;
  }

  .endpoint-row > span + span {
    border-left: 0;
  }

  .agent-grid,
  .security-grid,
  .short-steps,
  .guide-figure-grid,
  .route-map {
    grid-template-columns: 1fr;
  }

  .support-panel {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .support-qr {
    width: min(220px, 100%);
    justify-self: center;
  }

  .security-grid > div,
  .security-grid > div:nth-child(2n),
  .security-grid > div:nth-last-child(-n + 2) {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .security-grid > div:last-child {
    border-bottom: 0;
  }

  .protocol-badge {
    display: none;
  }

  .code-block pre {
    padding: 15px 14px 18px;
    font-size: 11px;
  }

  .error-list summary {
    grid-template-columns: 74px minmax(0, 1fr) 20px;
    gap: 8px;
  }

  .error-list summary b {
    display: none;
  }

  .error-list summary::after {
    grid-column: 3;
  }

  .error-list details > div {
    padding: 0 8px 16px 82px;
  }

  .legal-topbar-inner {
    padding: 0 16px;
  }

  .legal-topbar .brand small {
    display: none;
  }

  .legal-layout {
    gap: 32px;
    padding: 32px 16px 64px;
  }

  .legal-article h1 {
    font-size: 30px;
  }
}

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