:root {
  --gold: #c99a00;
  --gold-soft: #fff8db;
  --ink: #13221c;
  --muted: #66716c;
  --dim: #909893;
  --paper: #ffffff;
  --canvas: #f7f7f3;
  --line: #e6e8e3;
  --line-dark: #d7dad4;
  --code: #101712;
  --green: #147b4e;
  --red: #c64d4d;
  --blue: #4263a7;
  --font: "Manrope", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

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

body {
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

code {
  font-family: var(--mono);
}

.docs-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: 66px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.docs-header-inner {
  display: grid;
  grid-template-columns: 252px minmax(280px, 460px) 1fr;
  gap: 28px;
  align-items: center;
  width: min(100% - 36px, 1536px);
  height: 100%;
  margin-inline: auto;
}

.docs-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.docs-brand svg {
  width: 27px;
  height: 27px;
  color: var(--gold);
}

.docs-brand i {
  width: 1px;
  height: 17px;
  margin-inline: 3px;
  background: var(--line-dark);
}

.docs-brand strong {
  color: var(--muted);
  font-weight: 600;
}

.docs-search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: var(--canvas);
  color: var(--dim);
  font-size: 0.73rem;
  text-align: left;
  cursor: pointer;
}

.docs-search-trigger svg {
  width: 16px;
}

.docs-search-trigger span {
  flex: 1;
}

kbd {
  padding: 2px 6px;
  border: 1px solid var(--line-dark);
  border-radius: 4px;
  background: var(--paper);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.58rem;
}

.docs-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
}

.api-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.api-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(20, 123, 78, 0.08);
}

.header-apply {
  padding: 8px 13px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  text-decoration: none;
}

.docs-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  padding-top: 66px;
}

.docs-sidebar {
  position: fixed;
  top: 66px;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  width: 270px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fbfbf8;
}

.docs-sidebar nav {
  flex: 1;
  padding: 31px 26px 36px;
}

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

.nav-group p {
  margin-bottom: 7px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-group a {
  position: relative;
  display: block;
  padding: 5px 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 120ms ease;
}

.nav-group a:hover,
.nav-group a.active {
  color: var(--ink);
}

.nav-group a.active::before {
  position: absolute;
  top: 10px;
  left: -13px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  content: "";
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 26px;
  border-top: 1px solid var(--line);
}

.sidebar-footer a {
  color: var(--ink);
  font-size: 0.67rem;
  font-weight: 600;
  text-decoration: none;
}

.sidebar-footer span {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.52rem;
}

.docs-main {
  grid-column: 2;
  display: grid;
  grid-template-columns: minmax(0, 820px) 160px;
  gap: 84px;
  justify-content: center;
  padding: 0 48px;
}

.docs-content {
  min-width: 0;
}

.docs-toc {
  position: sticky;
  top: 104px;
  align-self: start;
  padding-top: 55px;
}

.docs-toc p {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 0.65rem;
  font-weight: 700;
}

.docs-toc a {
  display: block;
  padding: 4px 0;
  color: var(--dim);
  font-size: 0.62rem;
  text-decoration: none;
}

.docs-toc a.active {
  color: var(--gold);
}

.doc-section {
  padding: 78px 0;
  border-bottom: 1px solid var(--line);
}

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

.section-kicker,
.section-label {
  margin-bottom: 18px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.doc-section h1 {
  max-width: 700px;
  margin-bottom: 24px;
  font-size: clamp(3rem, 6vw, 5.3rem);
  font-weight: 600;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.doc-section h2 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 4vw, 3.05rem);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1.08;
}

.doc-section > p,
.lead {
  max-width: 690px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.85;
}

.lead {
  font-size: 1.04rem;
}

.doc-section p code,
.callout code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--canvas);
  color: #7f6816;
  font-size: 0.76em;
}

.doc-notice,
.callout {
  display: flex;
  gap: 14px;
  margin-top: 31px;
  padding: 18px;
  border: 1px solid #e6dcae;
  border-radius: 10px;
  background: #fffdf3;
}

.notice-icon {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
}

.doc-notice strong,
.callout strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.76rem;
}

.doc-notice p,
.callout p {
  color: var(--muted);
  font-size: 0.7rem;
}

.capability-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 58px;
  border-top: 1px solid var(--line-dark);
}

.capability-grid > div {
  padding: 28px 28px 0 0;
}

.capability-grid > div + div {
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.capability-grid span,
.security-grid span {
  display: block;
  margin-bottom: 34px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.58rem;
}

.capability-grid strong,
.security-grid strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
}

.capability-grid p,
.security-grid p {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.65;
}

.steps-list {
  margin-top: 42px;
}

.docs-step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 19px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.docs-step > span {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.6rem;
}

.docs-step h3 {
  margin-bottom: 3px;
  font-size: 0.8rem;
}

.docs-step p {
  color: var(--muted);
  font-size: 0.7rem;
}

.code-window {
  margin-top: 35px;
  overflow: hidden;
  border: 1px solid #263229;
  border-radius: 12px;
  background: var(--code);
  box-shadow: 0 20px 50px rgba(18, 34, 27, 0.12);
}

.code-titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 43px;
  padding: 0 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #9da8a1;
  font-family: var(--mono);
  font-size: 0.58rem;
}

.code-titlebar > div {
  display: flex;
  gap: 5px;
}

.code-titlebar > div i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #405047;
}

.code-titlebar > div i:first-child {
  background: #d6ae36;
}

.code-titlebar > span {
  flex: 1;
}

.copy-button {
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 4px;
  background: transparent;
  color: #9da8a1;
  font-family: var(--mono);
  font-size: 0.55rem;
  cursor: pointer;
}

pre {
  overflow-x: auto;
  padding: 24px;
  color: #d6ddd8;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.85;
}

.c-purple { color: #c9a8ff; }
.c-blue { color: #8eb8ff; }
.c-green { color: #a5d6b3; }

.data-table {
  margin-top: 35px;
  overflow: hidden;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
}

.table-row {
  display: grid;
  grid-template-columns: 0.75fr 1.5fr 0.8fr;
  align-items: center;
  min-height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
}

.table-row:last-child {
  border-bottom: 0;
}

.table-head {
  min-height: 38px;
  background: var(--canvas);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.table-row code {
  color: #5d6b65;
  font-size: 0.62rem;
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
}

.status-dot.sandbox { background: var(--gold); }
.status-dot.production { background: var(--green); }

.architecture-map {
  display: grid;
  grid-template-columns: 1fr 88px 1fr 88px 1fr;
  align-items: center;
  margin-top: 42px;
}

.architecture-map.second {
  margin-top: 14px;
}

.arch-node {
  padding: 18px;
  border: 1px solid var(--line-dark);
  border-radius: 9px;
  background: var(--paper);
}

.arch-node.primary {
  border-color: #e2cc74;
  background: #fffdf2;
}

.arch-node span,
.arch-node strong,
.arch-node small {
  display: block;
}

.arch-node span {
  margin-bottom: 15px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.5rem;
  text-transform: uppercase;
}

.arch-node strong {
  font-size: 0.74rem;
}

.arch-node small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.59rem;
}

.arch-link {
  position: relative;
  text-align: center;
}

.arch-link i {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--line-dark);
}

.arch-link i::after {
  position: absolute;
  top: -3px;
  right: 0;
  width: 6px;
  height: 6px;
  border-top: 1px solid var(--dim);
  border-right: 1px solid var(--dim);
  transform: rotate(45deg);
  content: "";
}

.arch-link em {
  display: block;
  margin-top: 6px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.45rem;
  font-style: normal;
}

.visa-node {
  border-color: #cdd3e9;
  background: #f8f9ff;
}

.boundary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 38px;
}

.boundary-card {
  padding: 24px;
  border: 1px solid var(--line-dark);
  border-radius: 11px;
}

.boundary-card.allowed {
  border-color: #bfddca;
  background: #f7fcf9;
}

.boundary-card.blocked {
  border-color: #ead0d0;
  background: #fffafa;
}

.boundary-title {
  margin-bottom: 18px;
  font-size: 0.76rem;
  font-weight: 700;
}

.allowed .boundary-title span { color: var(--green); }
.blocked .boundary-title span { color: var(--red); }

.boundary-card ul {
  list-style: none;
}

.boundary-card li {
  padding: 8px 0;
  border-top: 1px solid rgba(20, 34, 28, 0.07);
  color: var(--muted);
  font-size: 0.68rem;
}

.state-flow,
.decision-path {
  display: flex;
  align-items: center;
  margin-top: 39px;
}

.state-flow > div,
.decision-path > div {
  flex: 1;
  min-width: 0;
  padding: 18px 14px;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
}

.state-flow span,
.state-flow strong,
.state-flow small,
.decision-path span,
.decision-path small {
  display: block;
}

.state-flow span {
  margin-bottom: 13px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.5rem;
}

.state-flow strong,
.decision-path span {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.61rem;
  text-overflow: ellipsis;
}

.state-flow small,
.decision-path small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--dim);
  font-size: 0.53rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.state-flow > i,
.decision-path > b {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-style: normal;
}

.callout.warning {
  border-color: #ebd6ac;
  background: #fffaf1;
}

.decision-path > div.approved {
  border-color: #b7dac4;
  background: #f5fcf8;
}

.decision-path > div.approved span {
  color: var(--green);
}

.property-list {
  margin-top: 34px;
  border-top: 1px solid var(--line-dark);
}

.property-list > div {
  display: grid;
  grid-template-columns: 180px 1fr;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
}

.property-list code {
  color: #806914;
  font-size: 0.64rem;
}

.property-list span {
  color: var(--muted);
}

.endpoint-list {
  margin-top: 34px;
  overflow: hidden;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
}

.endpoint-row {
  display: grid;
  grid-template-columns: 64px minmax(170px, 1fr) 1fr 18px;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 57px;
  padding: 0 17px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.endpoint-row:hover {
  background: #fafaf7;
}

.method {
  width: fit-content;
  padding: 3px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.52rem;
  font-weight: 600;
}

.method.post {
  background: #edf7f1;
  color: var(--green);
}

.method.get {
  background: #eef3ff;
  color: var(--blue);
}

.method.patch {
  background: var(--gold-soft);
  color: #866b10;
}

.endpoint-row code {
  font-size: 0.65rem;
}

.endpoint-row > span:nth-child(3) {
  color: var(--muted);
  font-size: 0.64rem;
}

.endpoint-row > i {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-style: normal;
  text-align: right;
}

.endpoint-detail {
  display: none;
  padding: 26px;
  border-bottom: 1px solid var(--line);
  background: #fafaf7;
}

.endpoint-detail.open {
  display: block;
}

.parameter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.parameter-grid > div {
  padding-right: 15px;
}

.parameter-grid code {
  color: #806914;
  font-size: 0.64rem;
}

.parameter-grid span {
  display: block;
  margin: 3px 0 9px;
  color: var(--dim);
  font-size: 0.55rem;
}

.parameter-grid p {
  color: var(--muted);
  font-size: 0.64rem;
}

.code-window.compact {
  margin-top: 25px;
  box-shadow: none;
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 34px;
}

.event-grid code {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--canvas);
  color: #5f6c66;
  font-size: 0.61rem;
}

.error-table .table-row {
  grid-template-columns: 0.4fr 1fr 1.5fr;
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  margin-top: 37px;
  overflow: hidden;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  background: var(--line);
}

.security-grid > div {
  min-height: 190px;
  padding: 25px;
  background: var(--paper);
}

.docs-end {
  padding: 100px 0 130px;
  text-align: center;
}

.docs-end > span {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.58rem;
  text-transform: uppercase;
}

.docs-end h2 {
  margin: 15px 0 7px;
  font-size: clamp(2rem, 5vw, 3.3rem);
  letter-spacing: -0.05em;
}

.docs-end p {
  color: var(--muted);
  font-size: 0.76rem;
}

.docs-end a {
  display: inline-block;
  margin-top: 25px;
  padding: 10px 16px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
}

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 30, 24, 0.38);
  backdrop-filter: blur(3px);
}

.search-dialog {
  position: relative;
  width: min(620px, calc(100% - 32px));
  margin: 11vh auto 0;
  overflow: hidden;
  border: 1px solid var(--line-dark);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 30px 90px rgba(14, 31, 23, 0.22);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 58px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.search-input-wrap svg {
  width: 18px;
  color: var(--muted);
}

.search-input-wrap input {
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 0.83rem;
}

.search-results {
  max-height: 390px;
  overflow-y: auto;
  padding: 9px;
}

.search-hint,
.search-empty {
  padding: 25px;
  color: var(--dim);
  font-size: 0.7rem;
  text-align: center;
}

.search-result {
  display: block;
  padding: 12px 13px;
  border-radius: 7px;
  color: var(--ink);
  text-decoration: none;
}

.search-result:hover {
  background: var(--canvas);
}

.search-result strong {
  display: block;
  font-size: 0.72rem;
}

.search-result span {
  color: var(--muted);
  font-size: 0.61rem;
}

@media (max-width: 1180px) {
  .docs-main {
    grid-template-columns: minmax(0, 820px);
    padding: 0 44px;
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 820px) {
  .docs-header-inner {
    grid-template-columns: 1fr auto;
  }

  .docs-search-trigger {
    display: none;
  }

  .api-status {
    display: none;
  }

  .docs-layout {
    display: block;
  }

  .docs-sidebar {
    display: none;
  }

  .docs-main {
    display: block;
    padding: 0 24px;
  }

  .capability-grid,
  .boundary-grid,
  .security-grid,
  .parameter-grid {
    grid-template-columns: 1fr;
  }

  .capability-grid > div,
  .capability-grid > div + div {
    padding: 22px 0;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .capability-grid span,
  .security-grid span {
    margin-bottom: 18px;
  }

  .architecture-map {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .arch-link {
    height: 26px;
  }

  .arch-link i {
    width: 1px;
    height: 100%;
    margin-inline: auto;
  }

  .arch-link i::after {
    top: auto;
    right: calc(50% - 3px);
    bottom: 0;
    transform: rotate(135deg);
  }

  .state-flow,
  .decision-path {
    align-items: stretch;
    flex-direction: column;
    gap: 5px;
  }

  .state-flow > i,
  .decision-path > b {
    transform: rotate(90deg);
    text-align: center;
  }

  .endpoint-row {
    grid-template-columns: 58px 1fr 18px;
  }

  .endpoint-row > span:nth-child(3) {
    display: none;
  }

  .event-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .docs-header-actions .header-apply {
    display: none;
  }

  .docs-header-inner {
    grid-template-columns: 1fr;
  }

  .doc-section {
    padding: 62px 0;
  }

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

  .doc-section h1 {
    font-size: 3.1rem;
  }

  .table-row {
    grid-template-columns: 1fr;
    gap: 3px;
    padding: 13px;
  }

  .table-head {
    display: none;
  }

  .property-list > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .endpoint-detail {
    padding: 17px;
  }

  pre {
    padding: 18px;
    font-size: 0.62rem;
  }
}
