:root {
  --bg: #080c0b;
  --surface: #0e1513;
  --panel: #121c19;
  --code-bg: #050807;
  --border: #1d2b26;
  --border-strong: #2c413a;
  --text: #edf4f1;
  --muted: #8ca199;
  --dim: #5e746c;
  --mint: #2ee59d;
  --mint-soft: #a7f3d0;
  --mint-bg: rgba(46, 229, 157, 0.12);
  --sky: #38bdf8;
  --sky-bg: rgba(56, 189, 248, 0.12);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, 0.12);
  --rose: #fb7185;
  --rose-bg: rgba(251, 113, 133, 0.13);
  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mobile-menu-btn {
  display: none;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--mint-soft);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.api-brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.api-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--mint-bg);
  border: 1px solid rgba(46, 229, 157, 0.4);
  color: var(--mint);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.api-brand > div {
  display: flex;
  flex-direction: column;
}

.api-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.api-ver {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.env-pill {
  display: inline-flex;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.env-btn {
  padding: 5px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.env-btn.is-active {
  background: var(--panel);
  color: var(--mint);
}

.spec-status {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mint);
  background: var(--mint-bg);
  border: 1px solid rgba(46, 229, 157, 0.3);
  padding: 4px 8px;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 420px;
  align-items: start;
  min-height: calc(100vh - 53px);
}

.sidebar {
  position: sticky;
  top: 53px;
  height: calc(100vh - 53px);
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 14px 12px 24px;
  min-width: 0;
}

.sidebar-search-wrap {
  margin-bottom: 14px;
}

.sidebar-search {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--code-bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12.5px;
}

.sidebar-search::placeholder {
  color: var(--dim);
}

.sidebar-group {
  margin-bottom: 16px;
}

.group-label {
  padding: 0 8px 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--dim);
}

.ep-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  margin-bottom: 3px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.ep-btn:hover {
  background: var(--panel);
  color: var(--text);
}

.ep-btn.is-active {
  background: var(--mint-bg);
  border-color: rgba(46, 229, 157, 0.34);
  color: var(--text);
  font-weight: 600;
}

.ep-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m-pill {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  min-width: 38px;
  text-align: center;
  flex-shrink: 0;
}

.m-get {
  color: var(--mint);
  background: var(--mint-bg);
}

.m-post {
  color: var(--sky);
  background: var(--sky-bg);
}

.m-patch {
  color: var(--amber);
  background: var(--amber-bg);
}

.m-delete {
  color: var(--rose);
  background: var(--rose-bg);
}

.doc-pane {
  padding: 24px 28px 40px;
  min-width: 0;
}

.doc-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.group-chip,
.auth-chip,
.rate-chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.group-chip {
  color: var(--mint-soft);
  border-color: rgba(46, 229, 157, 0.35);
  background: var(--mint-bg);
}

.doc-title {
  margin: 0 0 10px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.doc-summary {
  margin: 0 0 18px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 68ch;
}

.endpoint-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 26px;
  min-width: 0;
}

.method-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.endpoint-url {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

.copy-mini-btn,
.ghost-btn {
  padding: 4px 9px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.copy-mini-btn:hover,
.ghost-btn:hover {
  color: var(--text);
  border-color: var(--mint);
}

.schema-section {
  margin-bottom: 28px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.section-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
}

.param-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.param-item {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.param-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.param-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.param-loc,
.param-type,
.param-req {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
}

.param-loc {
  color: var(--muted);
  background: var(--code-bg);
  border: 1px solid var(--border);
}

.param-type {
  color: var(--sky);
  background: var(--sky-bg);
}

.param-req {
  color: var(--amber);
  background: var(--amber-bg);
}

.param-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.nested-toggle {
  margin-top: 8px;
  padding: 4px 9px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--mint-soft);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
}

.nested-box {
  margin-top: 9px;
  padding: 10px 12px;
  border-left: 2px solid var(--mint);
  background: var(--code-bg);
  border-radius: 0 6px 6px 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nested-box[hidden] {
  display: none;
}

.nested-row {
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.nested-row code {
  font-family: var(--mono);
  color: var(--mint-soft);
  margin-right: 6px;
}

.resp-tabs {
  display: inline-flex;
  gap: 5px;
  flex-wrap: wrap;
}

.resp-tab {
  padding: 4px 9px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.resp-tab.is-active {
  border-color: rgba(46, 229, 157, 0.45);
  background: var(--mint-bg);
  color: var(--mint);
}

.resp-schema-box {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--code-bg);
  overflow: hidden;
}

.resp-meta-line {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
}

.code-block,
.snippet-pre {
  margin: 0;
  padding: 13px 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: #d6ede4;
  overflow-x: auto;
  max-width: 100%;
  white-space: pre;
}

.workbench {
  position: sticky;
  top: 53px;
  height: calc(100vh - 53px);
  overflow-y: auto;
  border-left: 1px solid var(--border);
  background: #0a100e;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.wb-card {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  overflow: hidden;
  min-width: 0;
  flex-shrink: 0;
}

.wb-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 11px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.wb-lang-head {
  padding: 7px 10px;
}

.wb-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--code-bg);
}

.key-prefix {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--mint);
  flex-shrink: 0;
}

.key-input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  min-width: 0;
}

.inputs-stack {
  padding: 8px 11px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
}

.field-row:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-label {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
}

.field-req-dot {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--amber);
}

.field-input,
.field-select {
  width: 100%;
  padding: 7px 9px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--code-bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}

.field-input:focus,
.field-select:focus,
.sidebar-search:focus {
  outline: 1px solid var(--mint);
  border-color: var(--mint);
}

.lang-tabs {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

.lang-btn {
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.lang-btn.is-active {
  background: var(--mint-bg);
  border-color: rgba(46, 229, 157, 0.35);
  color: var(--mint-soft);
}

.snippet-pre {
  background: var(--code-bg);
  padding: 9px 12px;
  min-height: 70px;
  max-height: 165px;
  font-size: 11.5px;
  line-height: 1.45;
}

.try-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 11px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.try-btn {
  padding: 8px 16px;
  border: 0;
  border-radius: 6px;
  background: var(--mint);
  color: #041d14;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.try-btn:hover {
  background: var(--mint-soft);
}

.try-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
}

.resp-status-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.status-pill {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}

.status-pill.is-idle {
  color: var(--muted);
  background: var(--code-bg);
}

.status-pill.is-ok {
  color: var(--mint);
  background: var(--mint-bg);
}

.status-pill.is-err {
  color: var(--rose);
  background: var(--rose-bg);
}

.latency-pill {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.resp-headers-bar {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: #0a100e;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.resp-pre {
  background: var(--code-bg);
  min-height: 128px;
  max-height: 240px;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .workbench {
    grid-column: 1 / -1;
    position: static;
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 760px) {
  .mobile-menu-btn {
    display: inline-flex;
  }

  .spec-status {
    display: none;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    display: none;
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar.is-open {
    display: block;
  }

  .doc-pane {
    padding: 18px 14px 24px;
  }

  .doc-title {
    font-size: 21px;
  }

  .workbench {
    padding: 12px;
  }
}
