:root {
  --bg: #f1f4f9;
  --surface: #ffffff;
  --text: #2a3038;
  --muted: #6b7785;
  --border: #d9e1e8;
  --border-subtle: #e8edf2;
  --accent: #1a7a82;
  --accent-soft: #7da8ad;
  --accent-bg: rgba(26, 122, 130, 0.08);
  --header-bg: #2a3038;
  --code-bg: #eef2f6;
  --code-fg: #1a1f26;
  --sidebar-w: 272px;
  --header-h: 56px;
  --content-max: 760px;
  --home-max: 920px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --shadow-sm: 0 1px 2px rgba(42, 48, 56, 0.06);
  --shadow-card: 0 8px 24px rgba(42, 48, 56, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #145f66; text-decoration: underline; }

/* Header */
.docs-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: var(--header-bg);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.docs-header__brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.docs-header__brand:hover { text-decoration: none; opacity: 0.92; }

.docs-header__mark {
  width: 28px;
  height: 28px;
  border-radius: 22%;
  display: block;
  flex-shrink: 0;
}

.docs-header__links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.8125rem;
}

.docs-header__links a {
  color: rgba(255, 255, 255, 0.72);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  text-decoration: none;
}

.docs-header__links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.docs-search {
  max-width: 260px;
  flex: 1;
  margin-left: 0.5rem;
  position: relative;
}

.docs-search input {
  width: 100%;
  padding: 0.45rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font: inherit;
  font-size: 0.8125rem;
  transition: border-color 0.15s, background 0.15s;
}

.docs-search input:focus {
  outline: none;
  border-color: rgba(125, 168, 173, 0.55);
  background: rgba(255, 255, 255, 0.1);
}

.docs-search input::placeholder { color: rgba(255, 255, 255, 0.42); }

.docs-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  max-height: 320px;
  overflow-y: auto;
  z-index: 200;
}

.docs-search-results a {
  display: block;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border-subtle);
}

.docs-search-results a:last-child { border-bottom: none; }

.docs-search-results a:hover,
.docs-search-results a.is-active {
  background: var(--accent-bg);
  color: var(--accent);
}

.docs-search-results__title {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
}

.docs-search-results__meta {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.docs-search-results__snippet {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.2rem;
  line-height: 1.35;
}

.docs-search-results__empty {
  padding: 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.docs-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

/* Layout */
.docs-shell {
  display: flex;
  padding-top: var(--header-h);
  min-height: 100vh;
}

.docs-sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem 0 2rem;
  scrollbar-width: thin;
}

.docs-nav-group { margin-bottom: 1.1rem; }

.docs-nav-group__label {
  padding: 0 1.1rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.docs-nav-group a {
  display: block;
  padding: 0.38rem 1.1rem;
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
  border-left: 2px solid transparent;
  line-height: 1.35;
}

.docs-nav-group a:hover {
  background: var(--bg);
  text-decoration: none;
}

.docs-nav-group a.is-active {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
  background: var(--accent-bg);
}

.docs-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2.25rem 2.5rem 4rem;
  max-width: calc(var(--content-max) + var(--sidebar-w) + 8rem);
}

.docs-main--home {
  max-width: calc(var(--home-max) + var(--sidebar-w) + 5rem);
}

.docs-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 2.5rem;
  align-items: start;
}

.docs-page-main { min-width: 0; }

.docs-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.docs-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.docs-breadcrumb a:hover { color: var(--accent); }

.docs-breadcrumb__sep { opacity: 0.45; }

.docs-toc {
  position: sticky;
  top: calc(var(--header-h) + 1.25rem);
  font-size: 0.8125rem;
  max-height: calc(100vh - var(--header-h) - 2.5rem);
  overflow-y: auto;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border-subtle);
}

.docs-toc__title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

.docs-toc__nav { display: flex; flex-direction: column; gap: 0.25rem; }

.docs-toc__nav a {
  color: var(--muted);
  text-decoration: none;
  line-height: 1.4;
  padding: 0.15rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.5rem;
  margin-left: -0.5rem;
}

.docs-toc__nav a:hover { color: var(--text); }

.docs-toc__nav a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.docs-toc__nav a[data-level="3"] {
  padding-left: 1rem;
  font-size: 0.78rem;
}

.docs-callout {
  margin: 0 0 1.5rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.55;
}

.docs-callout p:last-child { margin-bottom: 0; }

.docs-callout--note {
  background: #f0f7f8;
  border-color: rgba(26, 122, 130, 0.22);
  border-left: 3px solid var(--accent);
}

.docs-callout--pilot {
  background: #faf6f0;
  border-color: rgba(203, 126, 65, 0.25);
  border-left: 3px solid #cb7e41;
}

.docs-header__cta {
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-weight: 600;
}

.docs-header__cta:hover {
  background: rgba(255, 255, 255, 0.18) !important;
}

/* Content */
.docs-content h1 {
  font-size: 2.125rem;
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 0.75rem;
  letter-spacing: -0.03em;
  color: var(--text);
}

.docs-content blockquote {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1.1rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-bg);
  color: var(--muted);
  font-size: 0.975rem;
}

.docs-content blockquote p:last-child { margin-bottom: 0; }

.docs-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 2.25rem 0 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-subtle);
  letter-spacing: -0.02em;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.docs-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.75rem 0 0.5rem;
  letter-spacing: -0.01em;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.docs-content h2:first-of-type { margin-top: 1.75rem; }

.docs-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.25rem 0 0.4rem;
}

.docs-content p { margin: 0 0 1rem; }

.docs-content ul,
.docs-content ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
}

.docs-content li { margin-bottom: 0.35rem; }

.docs-content li > ul,
.docs-content li > ol { margin-top: 0.35rem; }

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.9rem;
  border: none;
  border-radius: 0;
}

.docs-table-wrap {
  overflow-x: auto;
  margin: 0 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
}

.docs-table-wrap table {
  border: none;
  min-width: 480px;
}

.docs-content th,
.docs-content td {
  border: 1px solid var(--border-subtle);
  padding: 0.55rem 0.8rem;
  text-align: left;
  vertical-align: top;
}

.docs-content th {
  background: var(--code-bg);
  font-weight: 600;
  font-size: 0.8125rem;
}

.docs-content tr:nth-child(even) td { background: rgba(241, 244, 249, 0.45); }

/* Hide markdown tables with empty header cells */
.docs-content table:has(thead th:empty) thead { display: none; }

.docs-content code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 0.14em 0.38em;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.docs-content pre {
  background: var(--header-bg);
  color: #e8edf2;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 0 0 1.5rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-sm);
}

.docs-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  border: none;
  font-size: inherit;
}

.docs-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.docs-content strong { font-weight: 600; }

.docs-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.docs-content .mermaid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin: 0 0 1.5rem;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.docs-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--muted);
}

.docs-footer a { color: var(--muted); }
.docs-footer a:hover { color: var(--accent); }

/* Homepage */
.docs-content--home > h1 { margin-bottom: 0.35rem; }

.docs-content--home > blockquote {
  font-size: 1.05rem;
  margin-bottom: 0;
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 0;
}

.docs-lead {
  margin: -0.25rem 0 1rem;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.55;
}

.docs-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.5rem;
  margin: 0 0 1.75rem;
}

.docs-flow__step {
  flex: 1 1 120px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.85rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
}

.docs-flow__step:hover {
  border-color: var(--accent-soft);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}

.docs-flow__step:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.docs-flow__num {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.docs-flow__label {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
}

.docs-flow__hint {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

.docs-faq > h2:not(:first-of-type) {
  font-size: 1.05rem;
  margin-top: 2rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
}

.docs-faq h3 {
  margin-top: 1.35rem;
  margin-bottom: 0.45rem;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
}

.docs-faq h3::before {
  content: "?";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: middle;
}

.docs-faq p {
  margin-left: 1.7rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.docs-faq p a {
  color: var(--accent);
}

.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.docs-pager__link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.docs-pager__link:hover {
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
}

.docs-pager__link--next { text-align: right; align-items: flex-end; }

.docs-pager__dir {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.docs-pager__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.docs-back-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  z-index: 80;
  transition: opacity 0.2s, color 0.15s, border-color 0.15s;
}

.docs-back-top:hover {
  color: var(--accent);
  border-color: var(--accent-soft);
}

.docs-content h3.docs-step-title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.65rem 0 0.65rem 0.85rem;
  margin-top: 1.5rem;
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, var(--accent-bg), transparent 70%);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.docs-content--home > h1 { margin-bottom: 0.5rem; }

.docs-content--home > blockquote {
  font-size: 1.05rem;
  margin-bottom: 0;
}

.docs-hero {
  margin: 1.25rem 0 0;
  padding: 1.15rem 1.25rem;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafb 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
}

.docs-content > blockquote:first-of-type {
  font-size: 1.08rem;
  color: var(--text);
}

.docs-hero p { margin: 0; }

.docs-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0.85rem 0 0.25rem;
}

.docs-cards--compact {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.docs-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.docs-card:hover {
  text-decoration: none;
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
  color: inherit;
}

.docs-card strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.docs-card span:not(.docs-card__tag) {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}

.docs-card code {
  font-size: 0.78em;
}

.docs-card__tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  margin-bottom: 0.15rem;
}

.docs-card--compact {
  padding: 0.85rem 1rem;
}

.docs-home-footer {
  margin-top: 2.5rem;
  padding: 0;
  background: transparent;
  border: none;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}

.docs-home-footer p { margin: 0; }

/* Callouts in content pages */
.docs-content blockquote:has(strong:first-child) {
  background: #fff8f0;
  border-left-color: #cb7e41;
}

@media (max-width: 1100px) {
  .docs-page-grid { grid-template-columns: 1fr; }
  .docs-toc { display: none; }
}

@media (max-width: 900px) {
  .docs-cards { grid-template-columns: 1fr; }
  .docs-flow__step:not(:last-child)::after { display: none; }
  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager__link--next { text-align: left; align-items: flex-start; }
}

@media (max-width: 768px) {
  .docs-menu-toggle { display: block; }

  .docs-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 90;
    box-shadow: 4px 0 24px rgba(42, 48, 56, 0.12);
  }

  .docs-sidebar.is-open { transform: translateX(0); }

  .docs-main {
    margin-left: 0;
    padding: 1.25rem 1rem 3rem;
    max-width: none;
  }

  .docs-header__links { display: none; }

  .docs-search {
    max-width: none;
    margin-left: 0;
  }

  .docs-content h1 { font-size: 1.75rem; }
}
