:root {
  --cyan: #0daacb;
  --cyan-dark: #0a8eaa;
  --cyan-soft: #eef8fb;
  --pink: #e80060;
  --pink-dark: #c40052;
  --ink: #0f1720;
  --text: #334155;
  --muted: #64748b;
  --line: #e8eef2;
  --paper: #f7fafc;
  --code: #0b1220;
  --warn: #fff7ed;
  --warn-ink: #9a3412;
  --header: 68px;
  --sidebar: 268px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 32, 0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: #fff;
  padding-top: var(--header);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.84em;
  background: var(--paper);
  color: var(--ink);
  padding: 0.12rem 0.35rem;
  border-radius: 5px;
  border: 1px solid var(--line);
}

.ico {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ico-18 { width: 18px; height: 18px; flex-basis: 18px; }

/* Header */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 0 1.5rem;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.topbar-actions { justify-content: flex-end; }

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none !important;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan) 0%, #0891b2 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  gap: 2px;
}

.brand-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 38px;
  padding: 0 0.9rem;
  border-radius: 9px;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none !important;
  white-space: nowrap;
}

.btn-ghost {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.btn-ghost:hover { border-color: #c9d6de; background: var(--paper); }

.btn-solid {
  color: #fff;
  background: var(--pink);
  border: 1px solid var(--pink);
}

.btn-solid:hover { background: var(--pink-dark); }

.btn-label { display: inline; }

/* Shell */
.shell { display: flex; min-height: calc(100vh - var(--header)); }

.sidenav {
  position: sticky;
  top: var(--header);
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  height: calc(100vh - var(--header));
  overflow: auto;
  padding: 1.25rem 0.85rem 2.5rem;
  background: #fbfcfd;
  border-right: 1px solid var(--line);
}

.nav-label {
  margin: 1.15rem 0.7rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-label:first-child { margin-top: 0.15rem; }

.sidenav a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.7rem;
  margin: 1px 0;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none !important;
}

.sidenav a .ico { color: var(--muted); }
.sidenav a:hover { background: #f1f5f8; color: var(--ink); }
.sidenav a.active {
  background: var(--cyan-soft);
  color: var(--cyan-dark);
  font-weight: 600;
}
.sidenav a.active .ico { color: var(--cyan); }

.nav-backdrop { display: none; }

.main {
  flex: 1;
  min-width: 0;
  padding: 2.4rem 2.4rem 4.5rem;
  background: #fff;
}

.article { max-width: 780px; }

h1, h2, h3 {
  color: var(--ink);
  letter-spacing: -0.03em;
  font-weight: 600;
}

h1 { font-size: 2.15rem; line-height: 1.15; margin: 0 0 0.75rem; }
h2 { font-size: 1.4rem; margin: 2.6rem 0 0.7rem; padding-top: 0.4rem; }
h3 { font-size: 1.08rem; margin: 1.7rem 0 0.45rem; }

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.7rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: var(--cyan-soft);
  color: var(--cyan-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-time {
  display: inline-block;
  margin-left: 0.7rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.lead {
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--muted);
  margin: 0 0 1.6rem;
  max-width: 40rem;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
  margin: 0 0 1.6rem;
}

.guide-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.05rem 1.05rem 1.1rem;
  background: #fff;
  box-shadow: var(--shadow);
}

.guide-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--cyan-soft);
  color: var(--cyan-dark);
  margin-bottom: 0.7rem;
}

.guide-card:nth-child(2) .guide-icon {
  background: var(--pink-soft, #fde8f0);
  color: var(--pink);
}

.guide-card h3 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.guide-card p { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

table { width: 100%; border-collapse: collapse; min-width: 440px; }
th, td { text-align: left; padding: 0.72rem 0.9rem; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
th {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--paper);
  font-weight: 600;
}
td { color: var(--ink); }
tr:last-child td { border-bottom: 0; }

.endpoint {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.8rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.3rem 0.7rem 0.3rem 0.3rem;
  margin: 0.15rem 0 0.85rem;
  color: var(--ink);
}

.endpoint .method {
  background: var(--cyan);
  color: #fff;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.45rem;
}

.hmac {
  background: var(--cyan-soft);
  border: 1px solid #d4eef4;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin: 0.85rem 0;
  font-size: 0.9rem;
  color: var(--ink);
}

.hmac::before {
  content: "Signature";
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cyan-dark);
  margin-bottom: 0.3rem;
}

.hmac code { color: var(--ink); background: #fff; }

.sign-walk { display: grid; gap: 0.55rem; margin: 0.9rem 0 1.3rem; }
.sign-row { display: grid; grid-template-columns: 6.4rem 1fr; gap: 0.7rem; }
.sign-lbl {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.45rem;
}
.sign-val {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.78rem;
  word-break: break-all;
  color: var(--ink);
}

.steps { counter-reset: steps; list-style: none; padding: 0; margin: 0 0 1.3rem; }
.steps li {
  counter-increment: steps;
  position: relative;
  padding: 0.15rem 0 0.85rem 2.3rem;
}
.steps li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--cyan-soft);
  color: var(--cyan-dark);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.code-tabs {
  margin: 0.9rem 0 1.35rem;
  border: 1px solid #1e293b;
  border-radius: 12px;
  overflow: hidden;
  background: var(--code);
}

.lang-tabs {
  display: flex;
  flex-wrap: wrap;
  background: #111827;
  border-bottom: 1px solid #1f2937;
}

.lang-tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
}

.lang-tabs button.active {
  color: #fff;
  box-shadow: inset 0 -2px 0 var(--cyan);
}

.code-pane { display: none; }
.code-pane.active { display: block; }
.code-tabs pre, .sample pre { margin: 0; overflow-x: auto; }
.code-tabs pre code, .sample pre code {
  display: block;
  padding: 1rem 1.05rem 1.15rem;
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 0.78rem;
  line-height: 1.55;
}

.sample {
  margin: 0.8rem 0 1.2rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.lab {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.2rem 1.2rem 1.3rem;
  margin: 0.9rem 0 1.5rem;
  box-shadow: var(--shadow);
}

.lab h3 { margin: 0 0 0.2rem; }
.lab .hint { margin: 0 0 0.9rem; color: var(--muted); font-size: 0.86rem; }

.warn {
  background: var(--warn);
  color: var(--warn-ink);
  border-radius: 9px;
  padding: 0.7rem 0.85rem;
  margin: 0 0 1rem;
  font-size: 0.84rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.lab-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 0.9rem;
}

.lab-grid .span-2 { grid-column: 1 / -1; }

.lab label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.28rem;
  color: var(--muted);
}

.lab input, .lab select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.52rem 0.65rem;
  font-size: 0.88rem;
  background: #fff;
  color: var(--ink);
}

.lab-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.95rem; }

.lab-btn {
  appearance: none;
  border: 0;
  border-radius: 9px;
  padding: 0.52rem 0.95rem;
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
  background: var(--cyan);
  color: #fff;
}

.lab-btn.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.mono-out {
  margin-top: 0.8rem;
  background: var(--code);
  color: #d5dee4;
  border-radius: 9px;
  padding: 0.85rem 0.95rem;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.76rem;
  word-break: break-all;
  white-space: pre-wrap;
}

.page-foot {
  margin-top: 3rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 980px) {
  .nav-toggle { display: inline-flex; }

  .sidenav {
    position: fixed;
    top: var(--header);
    left: 0;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 12px 0 40px rgba(15, 23, 32, 0.12);
    background: #fff;
  }

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

  .nav-backdrop {
    display: none;
    position: fixed;
    inset: var(--header) 0 0 0;
    background: rgba(15, 23, 32, 0.4);
    z-index: 35;
  }

  body.nav-open .nav-backdrop { display: block; }

  .main { padding: 1.4rem 1.1rem 3.2rem; }
  .guide-grid, .lab-grid, .sign-row { grid-template-columns: 1fr; }
  h1 { font-size: 1.7rem; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 0.8rem; }
  .btn-ghost .btn-label { display: none; }
  .btn { padding: 0 0.7rem; }
}
