:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --sidebar: #ffffff;
  --sidebar-soft: #eef6fc;
  --sidebar-line: #e2e8f0;
  --text: #111827;
  --muted: #667085;
  --line: #d9e2ee;
  --brand: #ffd166;
  --blue: #1768ac;
  --blue-dark: #0f4f86;
  --green: #0f9f6e;
  --green-soft: #e8f7ef;
  --orange: #d9603f;
  --orange-soft: #fff1e9;
  --code-bg: #101828;
  --code-text: #d9e8ff;
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
  letter-spacing: 0;
}

.console-shell {
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 36px 22px 28px;
  border-right: 1px solid var(--sidebar-line);
  color: var(--text);
  background: var(--sidebar);
  box-shadow: 8px 0 24px rgba(15, 23, 42, 0.04);
}

.side-brand {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: min(238px, 100%);
  height: auto;
  object-fit: contain;
}

.side-brand p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.side-nav {
  display: grid;
  gap: 12px;
  margin-top: 32px;
}

.side-nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #344054;
  background: transparent;
  text-align: left;
  text-decoration: none;
  font-size: 19px;
  font-weight: 900;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.side-nav-item:hover,
.side-nav-item.active {
  border-color: rgba(23, 104, 172, 0.18);
  color: var(--blue-dark);
  background: var(--sidebar-soft);
}

.side-nav-item.active {
  box-shadow: inset 4px 0 0 var(--blue);
}

.side-nav-item:hover {
  transform: translateX(2px);
}

.main-shell {
  min-width: 0;
  padding: 28px 32px 42px;
}

.route-view[hidden] {
  display: none;
}

.route-view.active {
  display: block;
}

.route-view.route-enter {
  animation: routeEnter 0.22s var(--ease) both;
}

.docs-route {
  max-width: 1220px;
}

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

.main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.main-header h2 {
  margin-top: 5px;
  font-size: 30px;
  font-weight: 900;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(520px, 48vw);
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  box-shadow: var(--shadow);
}

.header-actions code {
  overflow: hidden;
  color: var(--blue-dark);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(15, 159, 110, 0.12);
}

.panel,
.auth-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.18s var(--ease), opacity 0.18s var(--ease);
}

.auth-card {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: end;
  padding: 18px;
  margin-bottom: 18px;
}

.auth-title h3 {
  font-size: 18px;
  font-weight: 900;
}

.auth-title p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(210px, 0.75fr);
  gap: 12px;
  align-items: end;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 72px 72px;
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.auth-status {
  display: inline-grid;
  place-items: center;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #b64d2d;
  background: var(--orange-soft);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.auth-status.logged-in {
  color: #087456;
  background: var(--green-soft);
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span,
.panel-title {
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: #ffffff;
  color: var(--text);
}

input {
  height: 39px;
  padding: 0 11px;
}

textarea {
  min-height: 186px;
  padding: 12px;
  resize: vertical;
  line-height: 1.55;
  font-family: Consolas, "SFMono-Regular", monospace;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 104, 172, 0.12);
}

input:disabled,
textarea:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 350px;
  gap: 18px;
  align-items: start;
}

.endpoint-panel,
.request-head,
.request-panel,
.response-panel,
.doc-panel,
.api-docs {
  padding: 16px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.endpoint-list {
  display: grid;
  gap: 8px;
}

.endpoint-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.16s var(--ease);
}

.endpoint-item:hover,
.endpoint-item.active {
  border-color: rgba(23, 104, 172, 0.24);
  background: #eef6fc;
}

.endpoint-item:hover {
  transform: translateX(2px);
}

.endpoint-item.active {
  box-shadow: inset 3px 0 0 var(--blue);
}

.endpoint-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  min-height: 58px;
  padding: 10px;
}

.endpoint-item strong,
.endpoint-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-item strong {
  font-size: 14px;
}

.endpoint-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.request-stack {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.request-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.request-head h2 {
  margin-top: 5px;
  font-size: 27px;
  font-weight: 900;
}

.request-head p:not(.eyebrow) {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.path-box {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 510px;
  min-width: 250px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.path-box code {
  overflow: hidden;
  color: #475467;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.param-form:empty {
  display: none;
}

.body-editor.hidden {
  display: none;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 6px;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  font-weight: 900;
}

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

.primary-btn:hover {
  background: var(--blue-dark);
}

.secondary-btn,
.ghost-btn,
.icon-btn {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--text);
}

.secondary-btn:hover,
.ghost-btn:hover,
.icon-btn:hover {
  border-color: rgba(23, 104, 172, 0.34);
  background: #eef6fc;
}

.ghost-btn {
  min-height: 32px;
  padding: 0 10px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.method-mini,
.method-badge,
.method-inline {
  display: inline-grid;
  place-items: center;
  height: 24px;
  min-width: 44px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.get {
  color: #087456;
  background: var(--green-soft);
}

.post {
  color: #b64d2d;
  background: var(--orange-soft);
}

.response-title {
  align-items: flex-start;
}

.response-title > div:first-child {
  display: grid;
  gap: 4px;
}

.response-title small {
  color: var(--muted);
  font-weight: 800;
}

.response-actions {
  display: flex;
  gap: 8px;
}

.response-box {
  min-height: 360px;
  max-height: 52vh;
  margin: 0;
  overflow: auto;
  padding: 16px;
  border-radius: 8px;
  color: var(--code-text);
  background: var(--code-bg);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
}

.doc-panel {
  position: sticky;
  top: 18px;
}

.doc-content {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.request-head.switching-out,
.request-panel.switching-out,
.doc-panel.switching-out {
  opacity: 0.45;
  transform: translateY(4px);
}

.request-head.switching-in,
.request-panel.switching-in,
.doc-panel.switching-in {
  animation: panelEnter 0.18s var(--ease) both;
}

@keyframes panelEnter {
  from {
    opacity: 0.45;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.doc-card {
  min-width: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.doc-card:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.doc-card h3 {
  margin-bottom: 8px;
  color: #101828;
  font-size: 15px;
}

.doc-card p {
  color: #344054;
  line-height: 1.65;
}

.doc-card code {
  word-break: break-all;
}

.doc-card pre,
.doc-tab-panel pre,
.doc-article pre {
  overflow: auto;
  max-width: 100%;
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 8px;
  color: var(--code-text);
  background: var(--code-bg);
  line-height: 1.55;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}

.param-table,
.wide-table {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 320px;
  border-collapse: collapse;
  font-size: 13px;
}

.wide-table table {
  min-width: 640px;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--panel-soft);
  font-weight: 900;
}

tr:last-child td {
  border-bottom: 0;
}

.api-docs {
  margin-top: 20px;
}

.docs-shell {
  max-width: 1220px;
}

.docs-page {
  padding: 20px;
}

.docs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
}

.doc-toc {
  position: sticky;
  top: 20px;
  display: grid;
  align-content: start;
  gap: 4px;
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.doc-toc a {
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
}

.doc-toc a:hover {
  color: var(--blue);
  background: #eef6fc;
}

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

.doc-article section {
  min-width: 0;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.doc-article section:first-child {
  padding-top: 0;
}

.doc-article section:last-child {
  border-bottom: 0;
}

.doc-article h3 {
  margin-bottom: 10px;
  font-size: 19px;
}

.doc-article p {
  color: #344054;
  margin-top: 8px;
  line-height: 1.7;
}

.doc-article code {
  word-break: break-word;
  font-family: Consolas, "SFMono-Regular", monospace;
}

.docs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.docs-head h2 {
  margin-top: 5px;
  font-size: 26px;
  font-weight: 900;
}

.docs-head p:not(.eyebrow) {
  margin-top: 8px;
  color: var(--muted);
}

.update-badge {
  display: inline-grid;
  place-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  color: #087456;
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.docs-body {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.doc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.doc-tab {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

.doc-tab:hover,
.doc-tab.active {
  border-color: rgba(23, 104, 172, 0.32);
  color: var(--blue);
  background: #eef6fc;
}

.doc-tab-panels {
  min-width: 0;
}

.doc-tab-panel {
  display: none;
  min-width: 0;
}

.doc-tab-panel.active {
  display: block;
}

.doc-tab-panel h3 {
  margin-bottom: 10px;
  font-size: 19px;
}

.doc-tab-panel p {
  color: #344054;
  margin-top: 8px;
  line-height: 1.7;
}

.doc-tab-panel code {
  word-break: break-word;
  font-family: Consolas, "SFMono-Regular", monospace;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(17, 24, 39, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

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

  .doc-panel {
    position: static;
    grid-column: 1 / -1;
  }

  .doc-content {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .console-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    padding: 20px;
  }

  .side-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 18px;
  }

  .side-nav-item {
    justify-content: center;
    min-height: 44px;
    padding: 0 12px;
    font-size: 16px;
    white-space: nowrap;
  }

  .main-shell {
    padding: 22px 18px 34px;
  }

  .auth-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .main-header,
  .request-head,
  .docs-head {
    display: grid;
  }

  .header-actions {
    max-width: 100%;
  }

  .auth-fields,
  .workspace-grid,
  .docs-body,
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .doc-toc {
    position: relative;
    top: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }

  .doc-content {
    grid-template-columns: 1fr;
  }

  .endpoint-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .path-box {
    max-width: 100%;
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .sidebar {
    padding: 18px 14px;
  }

  .brand-logo {
    width: min(210px, 100%);
  }

  .main-shell {
    padding: 18px 12px 28px;
  }

  .main-header h2 {
    font-size: 24px;
  }

  .endpoint-list,
  .param-form {
    grid-template-columns: 1fr;
  }

  .path-box {
    align-items: flex-start;
    flex-direction: column;
  }

  .path-box code,
  .header-actions code {
    white-space: normal;
    word-break: break-all;
  }

  .response-box {
    min-height: 300px;
  }
}
