@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #111318;
  --bg2: #181c24;
  --bg3: #212733;
  --bg4: #2d3444;
  --border: rgba(255, 184, 108, 0.12);
  --border2: rgba(255, 184, 108, 0.24);
  --text: #f3f4f7;
  --muted: #b5bcc8;
  --accent: #ffb86c;
  --accent2: #ffd39e;
  --accent3: #50d2c2;
  --accent4: #ff7d66;
  --accent5: #f3c95d;
  --accent6: #91a8ff;
  --code-bg: #0d1015;
  --tag-bg: rgba(255, 184, 108, 0.11);
  --tag-text: #ffd39e;
  --mono: 'JetBrains Mono', 'Cascadia Code', monospace;
  --sans: 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(circle at top left, rgba(80, 210, 194, 0.14), transparent 28%),
    radial-gradient(circle at bottom right, rgba(255, 184, 108, 0.16), transparent 30%),
    linear-gradient(180deg, #111318 0%, #0c0f14 100%);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.7;
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  min-width: 280px;
  background: linear-gradient(180deg, rgba(24, 28, 36, 0.97), rgba(12, 15, 20, 0.97));
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 0 40px;
  flex-shrink: 0;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.logo {
  padding: 0 22px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.logo-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.logo-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.nav-section { margin-bottom: 4px; }

.nav-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 10px 22px 4px;
}

.nav-link {
  display: block;
  padding: 7px 22px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.18s, background 0.18s, border-color 0.18s;
  border-left: 2px solid transparent;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 184, 108, 0.07);
}

.nav-link.active {
  color: var(--accent2);
  border-left-color: var(--accent);
  background: rgba(255, 184, 108, 0.10);
}

.main {
  flex: 1;
  max-width: 980px;
  padding: 40px 48px 88px;
  overflow-x: hidden;
}

section {
  margin-bottom: 60px;
  scroll-margin-top: 24px;
}

h1 {
  font-size: 31px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 36px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 24px 0 10px;
}

p {
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.78;
  font-size: 14px;
}

p strong {
  color: var(--text);
  font-weight: 600;
}

a {
  color: var(--accent2);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

.hero {
  background:
    linear-gradient(140deg, rgba(255, 184, 108, 0.15) 0%, rgba(80, 210, 194, 0.09) 50%, rgba(145, 168, 255, 0.10) 100%),
    linear-gradient(180deg, rgba(24, 28, 36, 0.96), rgba(12, 15, 20, 0.96));
  border: 1px solid rgba(255, 184, 108, 0.28);
  border-radius: 18px;
  padding: 28px 30px;
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: auto -56px -56px auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 184, 108, 0.22), transparent 68%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 24px 24px auto auto;
  width: 116px;
  height: 116px;
  border-radius: 24px;
  border: 1px solid rgba(80, 210, 194, 0.22);
  transform: rotate(12deg);
  pointer-events: none;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 10px;
}

.hero h1 { font-size: 25px; margin-bottom: 4px; }

.hero-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-amber { background: rgba(255, 184, 108, 0.14); color: var(--accent2); border: 1px solid rgba(255, 184, 108, 0.26); }
.badge-cyan { background: rgba(80, 210, 194, 0.14); color: var(--accent3); border: 1px solid rgba(80, 210, 194, 0.26); }
.badge-green { background: rgba(164, 214, 91, 0.12); color: #bce583; border: 1px solid rgba(164, 214, 91, 0.26); }
.badge-slate { background: rgba(145, 168, 255, 0.14); color: var(--accent6); border: 1px solid rgba(145, 168, 255, 0.26); }

.card-grid {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

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

.card {
  background: linear-gradient(180deg, rgba(33, 39, 51, 0.94), rgba(17, 19, 24, 0.96));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 18px 16px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-1px);
  border-color: var(--border2);
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

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

.mode-card {
  border-radius: 14px;
  padding: 18px 20px;
  border-left: 3px solid;
  background: linear-gradient(180deg, rgba(24, 28, 36, 0.96), rgba(12, 15, 20, 0.96));
  border-right: 1px solid var(--border);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 12px 0;
}

.mode-card.red { border-left-color: var(--accent4); }

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

.mode-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.callout {
  display: flex;
  gap: 12px;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.62;
}

.callout-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.callout-body { color: var(--muted); }
.callout-body strong { color: var(--text); }

.callout.tip { background: rgba(80, 210, 194, 0.08); border: 1px solid rgba(80, 210, 194, 0.20); }
.callout.tip .callout-icon { background: rgba(80, 210, 194, 0.16); color: var(--accent3); }
.callout.warn { background: rgba(243, 201, 93, 0.08); border: 1px solid rgba(243, 201, 93, 0.22); }
.callout.warn .callout-icon { background: rgba(243, 201, 93, 0.16); color: var(--accent5); }
.callout.info { background: rgba(145, 168, 255, 0.08); border: 1px solid rgba(145, 168, 255, 0.22); }
.callout.info .callout-icon { background: rgba(145, 168, 255, 0.16); color: var(--accent6); }
.callout.danger { background: rgba(255, 125, 102, 0.08); border: 1px solid rgba(255, 125, 102, 0.22); }
.callout.danger .callout-icon { background: rgba(255, 125, 102, 0.16); color: var(--accent4); }
.callout.billing { background: rgba(255, 184, 108, 0.08); border: 1px solid rgba(255, 184, 108, 0.22); }
.callout.billing .callout-icon { background: rgba(255, 184, 108, 0.16); color: var(--accent); }

.flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.flow-step {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(33, 39, 51, 0.94);
  border: 1px solid var(--border);
  color: var(--text);
}

.flow-arrow {
  color: var(--muted);
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

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

th {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent2);
  background: rgba(255, 184, 108, 0.08);
}

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

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  overflow-x: auto;
  margin: 12px 0;
  font-family: var(--mono);
  font-size: 12.7px;
  line-height: 1.68;
}

pre::-webkit-scrollbar { height: 4px; }
pre::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent2);
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
  font-size: 12.7px;
}

.comment { color: #6d7687; }
.kw { color: #ff9f72; }
.str { color: #9fe870; }

ul, ol {
  margin: 8px 0 12px 20px;
  color: var(--muted);
  font-size: 14px;
}

li {
  margin-bottom: 4px;
  line-height: 1.72;
}

li strong { color: var(--text); font-weight: 600; }

@media (max-width: 980px) {
  .card-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at top left, rgba(27, 151, 178, 0.10), transparent 26%),
    radial-gradient(circle at bottom right, rgba(232, 120, 57, 0.12), transparent 28%),
    linear-gradient(180deg, #f4f7fb 0%, #edf2f8 100%);
}

html[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 246, 251, 0.98));
  border-right-color: rgba(24, 33, 53, 0.10);
}

html[data-theme="light"] .logo {
  border-bottom-color: rgba(24, 33, 53, 0.10);
}

html[data-theme="light"] .logo-title {
  color: #bf4f17;
}

html[data-theme="light"] .nav-label,
html[data-theme="light"] .logo-sub,
html[data-theme="light"] .nav-link,
html[data-theme="light"] p,
html[data-theme="light"] td,
html[data-theme="light"] .card-body,
html[data-theme="light"] .callout-body,
html[data-theme="light"] ul,
html[data-theme="light"] ol,
html[data-theme="light"] li {
  color: #5d6a82;
}

html[data-theme="light"] .nav-link:hover {
  color: #182135;
  background: rgba(24, 33, 53, 0.05);
}

html[data-theme="light"] .nav-link.active {
  color: #bf4f17;
  border-left-color: #d36a2e;
  background: rgba(211, 106, 46, 0.10);
}

html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] .card-title,
html[data-theme="light"] .mode-name,
html[data-theme="light"] .callout-body strong,
html[data-theme="light"] li strong,
html[data-theme="light"] p strong,
html[data-theme="light"] .flow-step {
  color: #182135;
}

html[data-theme="light"] h2 {
  border-bottom-color: rgba(24, 33, 53, 0.10);
}

html[data-theme="light"] a {
  color: #1d6fd1;
}

html[data-theme="light"] .hero {
  background:
    linear-gradient(140deg, rgba(211, 106, 46, 0.12) 0%, rgba(27, 151, 178, 0.08) 52%, rgba(61, 114, 214, 0.08) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 246, 251, 0.98));
  border-color: rgba(211, 106, 46, 0.22);
}

html[data-theme="light"] .hero::before {
  background: radial-gradient(circle, rgba(211, 106, 46, 0.18), transparent 68%);
}

html[data-theme="light"] .hero::after {
  border-color: rgba(27, 151, 178, 0.18);
}

html[data-theme="light"] .hero-kicker {
  color: #bf4f17;
}

html[data-theme="light"] .badge-amber {
  background: rgba(211, 106, 46, 0.12);
  color: #bf4f17;
  border-color: rgba(211, 106, 46, 0.20);
}

html[data-theme="light"] .badge-cyan {
  background: rgba(27, 151, 178, 0.11);
  color: #0f7589;
  border-color: rgba(27, 151, 178, 0.18);
}

html[data-theme="light"] .badge-green {
  background: rgba(66, 150, 84, 0.10);
  color: #2f7a46;
  border-color: rgba(66, 150, 84, 0.18);
}

html[data-theme="light"] .badge-slate {
  background: rgba(61, 114, 214, 0.10);
  color: #245eb3;
  border-color: rgba(61, 114, 214, 0.18);
}

html[data-theme="light"] .card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 251, 0.98));
  border-color: rgba(24, 33, 53, 0.10);
}

html[data-theme="light"] .card:hover {
  border-color: rgba(24, 33, 53, 0.18);
}

html[data-theme="light"] .mode-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 251, 0.98));
  border-right-color: rgba(24, 33, 53, 0.10);
  border-top-color: rgba(24, 33, 53, 0.10);
  border-bottom-color: rgba(24, 33, 53, 0.10);
}

html[data-theme="light"] .flow-step {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(24, 33, 53, 0.10);
}

html[data-theme="light"] .flow-arrow {
  color: #7b8698;
}

html[data-theme="light"] .table-wrap {
  border-color: rgba(24, 33, 53, 0.10);
}

html[data-theme="light"] th {
  color: #bf4f17;
  background: rgba(211, 106, 46, 0.08);
  border-bottom-color: rgba(24, 33, 53, 0.10);
}

html[data-theme="light"] th,
html[data-theme="light"] td {
  border-bottom-color: rgba(24, 33, 53, 0.10);
}

html[data-theme="light"] .callout.tip {
  background: rgba(27, 151, 178, 0.08);
  border-color: rgba(27, 151, 178, 0.18);
}

html[data-theme="light"] .callout.tip .callout-icon {
  background: rgba(27, 151, 178, 0.12);
  color: #0f7589;
}

html[data-theme="light"] .callout.warn {
  background: rgba(214, 154, 51, 0.10);
  border-color: rgba(214, 154, 51, 0.18);
}

html[data-theme="light"] .callout.warn .callout-icon {
  background: rgba(214, 154, 51, 0.14);
  color: #9a6900;
}

html[data-theme="light"] .callout.info {
  background: rgba(61, 114, 214, 0.08);
  border-color: rgba(61, 114, 214, 0.18);
}

html[data-theme="light"] .callout.info .callout-icon {
  background: rgba(61, 114, 214, 0.12);
  color: #245eb3;
}

html[data-theme="light"] .callout.danger {
  background: rgba(196, 73, 86, 0.08);
  border-color: rgba(196, 73, 86, 0.16);
}

html[data-theme="light"] .callout.danger .callout-icon {
  background: rgba(196, 73, 86, 0.12);
  color: #a43645;
}

html[data-theme="light"] .callout.billing {
  background: rgba(211, 106, 46, 0.08);
  border-color: rgba(211, 106, 46, 0.16);
}

html[data-theme="light"] .callout.billing .callout-icon {
  background: rgba(211, 106, 46, 0.12);
  color: #bf4f17;
}

html[data-theme="light"] code {
  background: rgba(24, 33, 53, 0.06);
  color: #bf4f17;
}

html[data-theme="light"] pre {
  border-color: rgba(24, 33, 53, 0.10);
}

@media (max-width: 860px) {
  body { flex-direction: column; }

  .sidebar {
    width: 100%;
    min-width: unset;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
  }

  .main { padding: 24px 20px 60px; }
  .card-grid-2,
  .card-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .hero {
    padding: 22px 20px;
    border-radius: 16px;
  }

  h1 { font-size: 28px; }
  .hero h1 { font-size: 23px; }
  pre { padding: 14px 16px; }
}