:root {
  --bg: #f7f8fb;
  --bg-elev: rgba(255, 255, 255, 0.72);
  --panel: rgba(255, 255, 255, 0.72);
  --panel-solid: #ffffff;
  --text: #141414;
  --muted: rgba(20, 20, 20, 0.64);
  --border: rgba(20, 20, 20, 0.10);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
  --shadow-soft: 0 4px 18px rgba(0, 0, 0, 0.08);
  --brand: #2f54eb;
  --brand-2: #13c2c2;
  --code-bg: rgba(20, 20, 20, 0.04);
  --code-text: #0b1020;
  --radius: 14px;
  --radius-sm: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
    "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d14;
    --bg-elev: rgba(15, 17, 26, 0.66);
    --panel: rgba(15, 17, 26, 0.66);
    --panel-solid: #0f111a;
    --text: rgba(255, 255, 255, 0.92);
    --muted: rgba(255, 255, 255, 0.64);
    --border: rgba(255, 255, 255, 0.10);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    --shadow-soft: 0 4px 18px rgba(0, 0, 0, 0.35);
    --brand: #6d8dff;
    --brand-2: #2ad0c6;
    --code-bg: rgba(255, 255, 255, 0.06);
    --code-text: rgba(255, 255, 255, 0.90);
  }
}

html[data-theme="light"] {
  color-scheme: light;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d14;
  --bg-elev: rgba(15, 17, 26, 0.66);
  --panel: rgba(15, 17, 26, 0.66);
  --panel-solid: #0f111a;
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.64);
  --border: rgba(255, 255, 255, 0.10);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 4px 18px rgba(0, 0, 0, 0.35);
  --brand: #6d8dff;
  --brand-2: #2ad0c6;
  --code-bg: rgba(255, 255, 255, 0.06);
  --code-text: rgba(255, 255, 255, 0.90);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: radial-gradient(
      900px 520px at 80% -10%,
      rgba(47, 84, 235, 0.18),
      transparent 60%
    ),
    radial-gradient(
      800px 520px at 10% 0%,
      rgba(19, 194, 194, 0.14),
      transparent 60%
    ),
    var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

code {
  font-family: var(--mono);
  font-size: 0.95em;
  background: var(--code-bg);
  padding: 0.12em 0.35em;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  box-shadow: var(--shadow-soft);
  transform: translateY(-140%);
  transition: transform 0.2s ease;
  z-index: 999;
}
.skip-link:focus {
  transform: translateY(0);
  outline: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.65),
    rgba(255, 255, 255, 0.36)
  );
  border-bottom: 1px solid var(--border);
}
html[data-theme="dark"] .topbar {
  background: linear-gradient(
    to bottom,
    rgba(15, 17, 26, 0.78),
    rgba(15, 17, 26, 0.50)
  );
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 22px rgba(47, 84, 235, 0.22);
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}
.pill-label {
  color: var(--muted);
  font-size: 12px;
}
.pill-value {
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  color: var(--text);
}
.icon-button:active {
  transform: translateY(1px);
}
.icon {
  font-size: 14px;
}
.icon-button-text {
  font-size: 12px;
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  padding: 18px 16px 44px;
}

.sidebar {
  position: sticky;
  top: 86px;
  height: calc(100vh - 96px);
  align-self: start;
}

.sidebar-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.search input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--text);
  outline: none;
}
.search input::placeholder {
  color: var(--muted);
}

.nav {
  margin-top: 12px;
  overflow: auto;
  padding-right: 6px;
}

.nav a {
  display: block;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--muted);
  line-height: 1.25;
}
.nav a:hover {
  color: var(--text);
  background: rgba(47, 84, 235, 0.08);
}
.nav a.active {
  color: var(--text);
  border-color: rgba(47, 84, 235, 0.24);
  background: rgba(47, 84, 235, 0.12);
}
.nav .indent-1 {
  padding-left: 18px;
  font-size: 13px;
}
.nav .indent-2 {
  padding-left: 28px;
  font-size: 13px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.content {
  min-width: 0;
}

.doc {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card h1 {
  margin: 0 0 10px;
  font-size: 22px;
  letter-spacing: 0.2px;
}

.card h2 {
  margin: 16px 0 10px;
  font-size: 16px;
}

.lead {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

.panel {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

.list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}
.list li {
  margin: 6px 0;
}
.list.ordered {
  padding-left: 22px;
}

.code {
  position: relative;
  margin: 10px 0 0;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  overflow: auto;
}
.code code {
  display: block;
  padding: 12px 12px 12px 12px;
  background: transparent;
  border: none;
  color: var(--code-text);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
}
.code .copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}
html[data-theme="dark"] .code .copy {
  background: rgba(15, 17, 26, 0.72);
}
.code .copy:active {
  transform: translateY(1px);
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-title {
  color: var(--muted);
  font-size: 12px;
}
.kpi-value {
  font-weight: 700;
  font-size: 20px;
}
.kpi-sub {
  color: var(--muted);
  font-size: 12px;
}

.footer {
  padding: 10px 2px 0;
}
.link {
  color: var(--brand);
  text-decoration: none;
}
.link:hover {
  text-decoration: underline;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    top: 0;
    height: auto;
  }
  .topbar-inner {
    align-items: flex-start;
  }
  .grid.two {
    grid-template-columns: 1fr;
  }
}
