.api-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 2rem;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.6rem 4rem;
  align-items: start;
}

.api-side {
  position: sticky;
  top: 4.6rem;
  max-height: calc(100vh - 5.6rem);
  overflow-y: auto;
  padding: 1.6rem 0;
}

.api-side nav { display: flex; flex-direction: column; gap: 0.15rem; }

.api-side .side-group {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin: 1rem 0 0.35rem;
}

.api-side a {
  color: var(--text);
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  font-size: 0.97rem;
  padding: 0.28rem 0.6rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.api-side a:hover { background: var(--surface2); color: var(--text); }
.api-side a.current { background: var(--surface2); border-left-color: var(--accent); color: var(--accent); }
.api-side a code { font-size: 0.86rem; color: var(--muted); }

.api-main { padding: 1.6rem 0 0; min-width: 0; }

.api-section { margin-bottom: 2.6rem; scroll-margin-top: 5rem; }
.api-section > h2 { font-size: 1.55rem; margin-bottom: 0.7rem; }
.api-section > .section-note { color: var(--muted); margin-bottom: 1rem; max-width: 78ch; }

.api-main p { max-width: 78ch; }
.api-main p + p { margin-top: 0.6rem; }

.api-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.4rem;
  overflow: hidden;
  scroll-margin-top: 5rem;
}

.card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
  padding: 1rem 1.3rem;
  border-bottom: 1px solid var(--border);
}

.card-head h3 { font-size: 1.15rem; }
.card-body { padding: 1.3rem; }
.card-body > * + * { margin-top: 1.2rem; }

.method {
  border-radius: 6px;
  color: var(--on-accent);
  font-family: var(--font-num);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
}

.method.get { background: var(--ok); }
.method.post { background: var(--fire); }
.method.put, .method.patch { background: var(--warn); }
.method.delete { background: var(--danger); }

.route {
  font-family: var(--font-num);
  font-size: 1.05rem;
  font-weight: 600;
  word-break: break-all;
}

.op-summary { color: var(--muted); margin-right: auto; }

.lock-tag {
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 600;
  gap: 0.35rem;
  padding: 0.15rem 0.65rem;
}

.sub-title {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.55rem;
}

code, pre {
  font-family: var(--font-num);
  font-size: 0.92rem;
}

.api-main :not(pre) > code {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 0.08em 0.38em;
}

pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  line-height: 1.5;
  overflow-x: auto;
  padding: 0.9rem 1.1rem;
}

.api-table { border-collapse: separate; border-spacing: 0; width: 100%; }

.api-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-align: left;
  text-transform: uppercase;
  padding: 0 1.1rem 0.5rem 0;
}

.api-table td {
  border-top: 1px solid var(--border);
  padding: 0.85rem 1.1rem 0.85rem 0;
  vertical-align: top;
}

.api-table td:last-child, .api-table th:last-child { padding-right: 0; }
.api-table .field-name { font-family: var(--font-num); font-weight: 600; white-space: nowrap; }
.api-table .field-desc { color: var(--muted); min-width: 22ch; }

.type-tag {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  display: inline-block;
  font-family: var(--font-num);
  font-size: 0.85rem;
  padding: 0.22em 0.62em;
  white-space: nowrap;
}

.flag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-left: 0.5rem;
  text-transform: uppercase;
}

.flag.required { color: var(--fire); }
.flag.optional { color: var(--muted); }

.tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.7rem; }

.tab {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.25rem 0.8rem;
}

.tab:hover { background: var(--surface3); border-color: var(--border-strong); color: var(--text); }
.tab.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.status-row { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.5rem; }

.status-code {
  border-radius: 6px;
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.15rem 0.55rem;
  background: var(--surface2);
  border: 1px solid var(--border-strong);
}

.status-code.ok { background: var(--ok); border-color: var(--ok); color: var(--on-accent); }
.status-code.bad { background: var(--danger); border-color: var(--danger); color: var(--on-accent); }
.status-text { color: var(--muted); }

.try-panel {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem;
}

.try-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.8rem; }
.try-field { display: flex; flex-direction: column; gap: 0.25rem; }
.try-field label { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.try-field input { width: 100%; }
.try-body { width: 100%; min-height: 8.5rem; }

textarea {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--font-num);
  font-size: 0.92rem;
  line-height: 1.5;
  padding: 0.6rem 0.75rem;
  resize: vertical;
}

textarea:focus { outline: none; border-color: var(--accent); }

.try-actions { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.9rem; flex-wrap: wrap; }
.try-hint { color: var(--muted); font-size: 0.88rem; }
.try-result { margin-top: 0.9rem; }

.auth-field { display: flex; flex-direction: column; gap: 0.3rem; max-width: 30rem; }
.auth-note { color: var(--muted); font-size: 0.88rem; }

@media (max-width: 900px) {
  .api-layout { grid-template-columns: 1fr; gap: 0; padding: 0 1rem 3rem; }
  .api-side { position: static; max-height: none; padding: 1rem 0 0; }
}
