:root {
  color-scheme: light;
  --ink: #18201d;
  --muted: #68736e;
  --line: #dce2de;
  --paper: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #edf1ee;
  --green: #1f7a52;
  --green-soft: #d9eee3;
  --coral: #d45f45;
  --coral-soft: #f7e1db;
  --gold: #b47b13;
  --gold-soft: #f4e7c8;
  --nav: #151c19;
  --code: #111714;
  --sidebar-width: 244px;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

code,
pre {
  font-family: "IBM Plex Mono", Consolas, monospace;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  color: #f5f8f6;
  background: var(--nav);
  border-right: 1px solid #2d3732;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 86px;
  padding: 0 24px;
  border-bottom: 1px solid #2d3732;
}

.brand strong,
.brand small {
  display: block;
  letter-spacing: 0;
}

.brand strong {
  font-size: 17px;
}

.brand small {
  margin-top: 2px;
  color: #98a49e;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  grid-template-columns: repeat(3, 7px);
  align-items: end;
  justify-content: center;
  gap: 3px;
  padding: 7px 0;
  background: #e4f3ea;
  border: 1px solid #8fb9a2;
  border-radius: 6px;
}

.brand-mark i {
  display: block;
  width: 7px;
  background: var(--green);
  border-radius: 1px;
}

.brand-mark i:nth-child(1) { height: 8px; }
.brand-mark i:nth-child(2) { height: 17px; }
.brand-mark i:nth-child(3) { height: 12px; background: var(--coral); }

.nav {
  display: grid;
  gap: 4px;
  padding: 22px 14px;
}

.nav-item {
  display: grid;
  width: 100%;
  min-height: 46px;
  grid-template-columns: 34px 1fr;
  align-items: center;
  padding: 0 12px;
  color: #aeb8b3;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
}

.nav-item:hover {
  color: #ffffff;
  background: #202925;
}

.nav-item.is-active {
  color: #ffffff;
  background: #25312b;
  border-color: #35463e;
}

.nav-glyph {
  color: #738078;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
}

.nav-item.is-active .nav-glyph {
  color: #75c89e;
}

.sidebar-foot {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 2px 8px;
  align-items: center;
  margin-top: auto;
  padding: 20px 24px;
  color: #d3dad6;
  border-top: 1px solid #2d3732;
  font-size: 12px;
}

.sidebar-foot small {
  grid-column: 2;
  color: #7e8a84;
}

.environment-dot {
  width: 8px;
  height: 8px;
  background: #43b87b;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #234b37;
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 86px;
  align-items: center;
  gap: 16px;
  padding: 14px clamp(20px, 4vw, 52px);
  background: rgba(244, 246, 243, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.topbar h1 {
  margin: 3px 0 0;
  font-size: 22px;
  line-height: 1.3;
}

.eyebrow {
  margin: 0;
  color: #7a857f;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.status-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: #505b56;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}

.status-pill i {
  width: 7px;
  height: 7px;
  background: var(--gold);
  border-radius: 50%;
}

.status-pill.is-ok i { background: var(--green); }
.status-pill.is-error i { background: var(--coral); }

.quiet-button,
.copy-button,
.text-button,
.code-block button {
  min-height: 32px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 12px;
}

.quiet-button:hover,
.copy-button:hover,
.code-block button:hover {
  border-color: #9aa59f;
}

.text-button {
  padding: 0;
  color: var(--green);
  background: transparent;
  border: 0;
  font-weight: 600;
}

.menu-button {
  display: none;
  width: 38px;
  height: 38px;
  place-content: center;
  gap: 4px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.menu-button span {
  display: block;
  width: 16px;
  height: 1px;
  background: var(--ink);
}

main {
  padding: 36px clamp(20px, 4vw, 52px) 52px;
}

.view {
  display: none;
  width: min(1220px, 100%);
  margin: 0 auto;
}

.view.is-active {
  display: block;
  animation: reveal 180ms ease-out;
}

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

.notice-band {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  color: #f3f8f5;
  background: var(--ink);
  border-radius: 7px;
}

.notice-band > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.notice-band code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice-label {
  color: #87a194;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
}

.notice-band .copy-button {
  flex: 0 0 auto;
  margin-left: auto;
  color: #ffffff;
  background: #2a3731;
  border-color: #46574f;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.metric-card {
  position: relative;
  min-height: 142px;
  padding: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.metric-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #7e8a84;
  content: "";
}

.metric-card.accent-green::before { background: var(--green); }
.metric-card.accent-coral::before { background: var(--coral); }
.metric-card.accent-gold::before { background: var(--gold); }

.metric-card span,
.metric-card strong,
.metric-card small {
  display: block;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  margin-top: 18px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 20px;
}

.metric-card small {
  margin-top: 7px;
  color: #7f8984;
  line-height: 1.5;
}

.overview-grid,
.console-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  gap: 16px;
  margin-top: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.panel-heading {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-heading > :last-child {
  margin-left: auto;
}

.panel-heading h2 {
  margin: 4px 0 0;
  font-size: 17px;
}

.count-badge,
.method-badge {
  padding: 5px 8px;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 600;
}

.checklist {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  display: grid;
  min-height: 68px;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid #edf0ee;
}

.checklist li:last-child { border-bottom: 0; }

.checklist li > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #76817b;
  background: var(--surface-2);
  border-radius: 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}

.checklist li.is-done > span {
  color: #ffffff;
  background: var(--green);
}

.checklist strong,
.checklist small {
  display: block;
}

.checklist strong { font-size: 13px; }
.checklist small { margin-top: 3px; color: var(--muted); }

.request-panel pre {
  min-height: 272px;
  margin: 0;
  padding: 26px;
  overflow: auto;
  color: #e4ece8;
  background: var(--code);
  border-radius: 0 0 6px 6px;
  font-size: 12px;
  line-height: 1.8;
}

.code-muted { color: #8aa397; }
.code-key { color: #e3b95e; }
.code-value { color: #78caa1; }

.console-layout {
  margin-top: 0;
}

.console-form > label,
.console-form .field-row,
.form-actions {
  margin-right: 20px;
  margin-left: 20px;
}

.console-form > label {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: #4e5954;
  font-size: 12px;
  font-weight: 600;
}

.console-form label small {
  color: #8b948f;
  font-weight: 400;
  line-height: 1.5;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 12px;
  margin-top: 18px;
}

.field-row label {
  display: grid;
  gap: 8px;
  color: #4e5954;
  font-size: 12px;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  color: var(--ink);
  background: #fbfcfb;
  border: 1px solid #ccd4cf;
  border-radius: 5px;
  outline: 0;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 170px;
  padding: 12px;
  resize: vertical;
  line-height: 1.65;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 82, 0.1);
}

.form-actions {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 16px;
}

.form-actions > span {
  color: var(--muted);
  font-size: 12px;
}

.primary-button {
  min-width: 112px;
  min-height: 42px;
  margin-left: auto;
  color: #ffffff;
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: 5px;
  font-weight: 600;
}

.primary-button:hover { background: #176943; }
.primary-button:disabled { cursor: wait; opacity: 0.65; }

.response-panel {
  display: flex;
  min-height: 620px;
  flex-direction: column;
  overflow: hidden;
}

.response-meta {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  color: #90a097;
  background: #18201d;
  border-bottom: 1px solid #303b36;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
}

.response-output {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 22px;
  overflow: auto;
  color: #dce7e1;
  background: var(--code);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.7;
}

.docs-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 780px);
  justify-content: center;
  gap: 52px;
}

.docs-index {
  position: sticky;
  top: 120px;
  display: grid;
  align-self: start;
  border-left: 1px solid var(--line);
}

.docs-index a {
  padding: 9px 14px;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  font-size: 13px;
}

.docs-index a:hover {
  color: var(--green);
  border-left-color: var(--green);
}

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

.docs-content section {
  margin-bottom: 46px;
  scroll-margin-top: 116px;
}

.docs-content h2 {
  margin: 8px 0 16px;
  font-size: 28px;
}

.docs-content h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

.docs-content p {
  color: #53605a;
  line-height: 1.8;
}

.callout {
  margin-top: 20px;
  padding: 14px 16px;
  color: #5e4b1a;
  background: var(--gold-soft);
  border-left: 3px solid var(--gold);
  border-radius: 0 5px 5px 0;
  line-height: 1.7;
}

.code-block {
  position: relative;
}

.code-block pre {
  margin: 0;
  padding: 22px;
  overflow: auto;
  color: #dce7e1;
  background: var(--code);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.75;
}

.code-block button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  color: #dce7e1;
  background: #26312c;
  border-color: #3a4942;
}

.error-table {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.error-table > div {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.error-table > div:last-child { border-bottom: 0; }
.error-table code { color: var(--coral); font-weight: 600; }

.status-layout {
  display: grid;
  gap: 16px;
  width: min(860px, 100%);
  margin: 0 auto;
}

.status-banner {
  display: grid;
  min-height: 144px;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: var(--green-soft);
  border: 1px solid #bddcca;
  border-radius: 7px;
}

.status-banner.is-error {
  background: var(--coral-soft);
  border-color: #ebc1b6;
}

.large-status-dot {
  width: 20px;
  height: 20px;
  background: var(--green);
  border: 5px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--green);
}

.status-banner.is-error .large-status-dot {
  background: var(--coral);
  box-shadow: 0 0 0 1px var(--coral);
}

.status-banner h2 {
  margin: 5px 0;
  font-size: 22px;
}

.status-banner p:last-child {
  margin: 0;
  color: #53605a;
}

.status-banner time {
  align-self: start;
  color: #64716a;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
}

.service-list {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.service-list article {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.service-list article:last-child { border-bottom: 0; }
.service-list strong, .service-list small { display: block; }
.service-list small { margin-top: 4px; color: var(--muted); }

.service-state {
  margin-left: auto;
  padding: 5px 8px;
  color: var(--gold);
  background: var(--gold-soft);
  border-radius: 4px;
  font-size: 11px;
}

.service-state.ok { color: var(--green); background: var(--green-soft); }
.service-state.error { color: var(--coral); background: var(--coral-soft); }

.status-detail dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.status-detail dl > div {
  padding: 18px 20px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.status-detail dl > div:nth-child(2n) { border-right: 0; }
.status-detail dl > div:nth-last-child(-n + 2) { border-bottom: 0; }
.status-detail dt { color: var(--muted); font-size: 11px; }
.status-detail dd { margin: 8px 0 0; font-weight: 600; }

footer {
  display: flex;
  width: min(1220px, calc(100% - 40px));
  min-height: 70px;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  margin: 0 auto;
  color: #85908a;
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 16px;
  color: #ffffff;
  background: var(--ink);
  border-radius: 6px;
  box-shadow: 0 14px 34px rgba(16, 24, 20, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: 160ms ease;
  font-size: 12px;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1020px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid, .console-layout { grid-template-columns: 1fr; }
  .response-panel { min-height: 520px; }
}

@media (max-width: 760px) {
  :root { --sidebar-width: 240px; }

  .sidebar {
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform 180ms ease, visibility 180ms;
  }

  .sidebar.is-open { visibility: visible; transform: translateX(0); }
  .workspace { margin-left: 0; }
  .menu-button { display: grid; }

  .topbar {
    min-height: 76px;
    padding: 12px 16px;
  }

  .topbar h1 { font-size: 18px; }
  .status-pill { display: none; }
  .quiet-button { padding: 0 9px; }
  main { padding: 22px 16px 40px; }
  .notice-band { align-items: flex-start; }
  .notice-band code { font-size: 11px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 132px; padding: 16px; }
  .metric-card strong { font-size: 16px; }

  .docs-layout {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .docs-index {
    position: static;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid var(--line);
    border-radius: 6px;
  }

  .docs-index a {
    padding: 10px;
    text-align: center;
    border: 0;
    font-size: 11px;
  }

  .status-banner {
    grid-template-columns: 24px 1fr;
  }

  .status-banner time {
    grid-column: 2;
  }
}

@media (max-width: 520px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 118px; }
  .field-row { grid-template-columns: 1fr; }
  .notice-band { flex-wrap: wrap; }
  .notice-band .copy-button { margin-left: 0; }
  .panel-heading { padding: 14px 16px; }
  .console-form > label, .console-form .field-row, .form-actions { margin-right: 16px; margin-left: 16px; }
  .status-detail dl { grid-template-columns: 1fr; }
  .status-detail dl > div { border-right: 0; }
  .status-detail dl > div:nth-last-child(2) { border-bottom: 1px solid var(--line); }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; }
}

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