:root {
  --bg: #f7f7fb;
  --panel: #ffffff;
  --panel-strong: #f2eefb;
  --panel-border: #e3e1ec;
  --text: #181622;
  --muted: #615d6c;
  --accent: #b45309;
  --accent-strong: #92400e;
  --accent-glow: rgba(180, 83, 9, 0.14);
  --teal: #1f9d6c;
  --warning: #c48a1c;
  --danger: #d9394a;
  --purple: #6b3fa0;
  --indigo: #4c3a86;
  --slate: #544f7d;
  --shadow: 0 1px 3px rgba(20, 18, 30, 0.07), 0 1px 2px rgba(20, 18, 30, 0.04);
  --shadow-lg: 0 12px 32px rgba(20, 18, 30, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --header-h: 64px;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 1.2;
}

p { margin: 0 0 14px; }
p:last-child { margin-bottom: 0; }

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

img { max-width: 100%; }

code {
  font-family: var(--font-mono);
  font-size: 0.87em;
  background: var(--panel-strong);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 1px 6px;
}

pre {
  background: #14121f;
  color: #e9e6f2;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 16px;
}
pre code { background: none; border: none; padding: 0; color: inherit; font-size: 0.85rem; }

/* ── Header ─────────────────────────────────────────────────────────── */
.docs-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-border);
}

.docs-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.docs-header-brand .mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.docs-header-brand .divider {
  width: 1px;
  height: 20px;
  background: var(--panel-border);
}

.docs-header-brand .site-name { color: var(--muted); font-weight: 600; font-size: 0.92rem; }

.docs-search-wrap { flex: 1; max-width: 520px; position: relative; }

.docs-search {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--bg);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text);
}
.docs-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.docs-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 0.9rem;
}

.docs-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 250;
}
.docs-search-results[hidden] { display: none; }

.docs-search-result {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--panel-border);
}
.docs-search-result:last-child { border-bottom: none; }
.docs-search-result:hover { background: var(--panel-strong); text-decoration: none; }
.docs-search-result .category { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-strong); font-weight: 600; }
.docs-search-result .title { display: block; font-weight: 600; color: var(--text); margin: 2px 0; }
.docs-search-result .excerpt { display: block; font-size: 0.82rem; color: var(--muted); }
.docs-search-empty { padding: 16px; color: var(--muted); font-size: 0.88rem; text-align: center; }

.docs-header-actions { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }

.docs-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}
.docs-btn:hover { border-color: var(--accent); text-decoration: none; }
.docs-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.docs-btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

/* ── Shell layout ───────────────────────────────────────────────────── */
.docs-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  max-width: 1400px;
  margin: 0 auto;
}

.docs-shell.with-toc { grid-template-columns: 260px minmax(0, 1fr) 220px; }

.docs-sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 22px 14px 40px;
  border-right: 1px solid var(--panel-border);
}

.docs-sidebar-group { margin-bottom: 4px; }

.docs-sidebar-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.docs-sidebar-group-label:hover { background: var(--panel-strong); }

.docs-sidebar-group-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
  color: #fff;
}

.docs-sidebar-chev {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--muted);
  transition: transform 150ms ease;
  flex-shrink: 0;
}
.docs-sidebar-group.open .docs-sidebar-chev { transform: rotate(90deg); }

.docs-sidebar-pages {
  display: none;
  flex-direction: column;
  padding-left: 30px;
  gap: 1px;
}
.docs-sidebar-group.open .docs-sidebar-pages { display: flex; }

.docs-sidebar-pages a {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.86rem;
  border-left: 2px solid transparent;
}
.docs-sidebar-pages a:hover { background: var(--panel-strong); text-decoration: none; color: var(--text); }
.docs-sidebar-pages a.active {
  color: var(--accent-strong);
  font-weight: 600;
  background: var(--accent-glow);
  border-left-color: var(--accent);
}

.docs-main { min-width: 0; padding: 32px 40px 80px; }

.docs-toc {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  height: fit-content;
  padding: 0 20px 40px 0;
  font-size: 0.84rem;
}
.docs-toc-label { font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 10px; }
.docs-toc a { display: block; padding: 4px 0; color: var(--muted); border-left: 2px solid var(--panel-border); padding-left: 12px; }
.docs-toc a:hover { color: var(--text); text-decoration: none; }
.docs-toc a.active { color: var(--accent-strong); border-left-color: var(--accent); font-weight: 600; }

/* ── Breadcrumb ─────────────────────────────────────────────────────── */
.docs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.docs-breadcrumb a { color: var(--muted); }
.docs-breadcrumb a:hover { color: var(--accent-strong); }
.docs-breadcrumb .sep { color: var(--panel-border); }

/* ── Homepage ───────────────────────────────────────────────────────── */
.docs-hero {
  max-width: 1400px;
  margin: 0 auto;
  padding: 56px 40px 40px;
  text-align: center;
}
.docs-hero-eyebrow {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-glow);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.docs-hero h1 {
  font-size: 2.4rem;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}
.docs-hero p { max-width: 560px; margin: 0 auto 26px; color: var(--muted); font-size: 1.05rem; }
.docs-hero .docs-search-wrap { max-width: 560px; margin: 0 auto; }

.docs-home-body { max-width: 1400px; margin: 0 auto; padding: 0 40px 80px; }

.docs-section-title { font-size: 1.3rem; margin-bottom: 4px; }
.docs-section-sub { color: var(--muted); margin-bottom: 22px; }

.docs-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 44px;
}

.docs-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.docs-card:hover { transform: translateY(-2px); border-color: rgba(180, 83, 9, 0.35); box-shadow: var(--shadow-lg); text-decoration: none; }

.docs-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}

.docs-card h3 { font-size: 1.02rem; color: var(--text); }
.docs-card p { color: var(--muted); font-size: 0.88rem; margin: 0; }
.docs-card .count { font-size: 0.76rem; color: var(--accent-strong); font-weight: 600; margin-top: auto; }

/* ── Guide-card (used on category landing pages) ───────────────────── */
.docs-guide-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: border-color 150ms ease, transform 150ms ease;
}
.docs-guide-card:hover { border-color: rgba(180, 83, 9, 0.35); transform: translateX(2px); text-decoration: none; }
.docs-guide-card .num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--panel-strong);
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.docs-guide-card h4 { color: var(--text); font-size: 0.98rem; margin-bottom: 3px; }
.docs-guide-card p { color: var(--muted); font-size: 0.86rem; }
.docs-guide-card .meta { font-size: 0.74rem; color: var(--muted); margin-top: 6px; display: flex; gap: 10px; }

/* ── Category page header ──────────────────────────────────────────── */
.docs-cat-header { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.docs-cat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}
.docs-cat-header h1 { font-size: 1.6rem; }
.docs-cat-desc { color: var(--muted); margin: 10px 0 26px; max-width: 640px; }

/* ── Guide page ─────────────────────────────────────────────────────── */
.docs-guide-header { margin-bottom: 24px; }
.docs-guide-header h1 { font-size: 1.9rem; margin-bottom: 10px; letter-spacing: -0.01em; }
.docs-guide-meta { display: flex; gap: 14px; color: var(--muted); font-size: 0.84rem; align-items: center; flex-wrap: wrap; }
.docs-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--panel-border);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
}

.docs-lede { font-size: 1.05rem; color: var(--muted); margin-bottom: 26px; }

.docs-content h2 { font-size: 1.28rem; margin: 34px 0 12px; padding-top: 6px; border-top: 1px solid var(--panel-border); }
.docs-content h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.docs-content h3 { font-size: 1.05rem; margin: 22px 0 10px; }
.docs-content ul, .docs-content ol { margin: 0 0 16px; padding-left: 22px; }
.docs-content li { margin-bottom: 6px; }

/* callouts */
.docs-callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin: 0 0 18px;
  border: 1px solid;
  font-size: 0.9rem;
}
.docs-callout .icon { flex-shrink: 0; font-size: 1.05rem; line-height: 1.4; }
.docs-callout p { margin: 0; }
.docs-callout strong { display: block; margin-bottom: 2px; }
.docs-callout.tip { background: rgba(31, 157, 108, 0.08); border-color: rgba(31, 157, 108, 0.3); color: #0f5c3f; }
.docs-callout.note { background: var(--accent-glow); border-color: rgba(180, 83, 9, 0.3); color: var(--accent-strong); }
.docs-callout.warn { background: rgba(196, 138, 28, 0.1); border-color: rgba(196, 138, 28, 0.35); color: #7a5811; }
.docs-callout.prereq { background: rgba(107, 63, 160, 0.08); border-color: rgba(107, 63, 160, 0.28); color: #4a2c72; }

/* step list — mirrors the app's own onboarding-step visual language */
.docs-steps { display: flex; flex-direction: column; margin: 0 0 22px; }
.docs-step { display: flex; gap: 16px; position: relative; padding-bottom: 22px; }
.docs-step:last-child { padding-bottom: 0; }
.docs-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: 0;
  width: 2px;
  background: var(--panel-border);
}
.docs-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  z-index: 1;
}
.docs-step-body { flex: 1; min-width: 0; padding-top: 4px; }
.docs-step-body h4 { font-size: 0.98rem; margin-bottom: 4px; }
.docs-step-body p { color: var(--muted); font-size: 0.9rem; }
.docs-step-body p:last-child { margin-bottom: 0; }

kbd {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
}

.docs-table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 0.88rem; }
.docs-table th, .docs-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--panel-border); }
.docs-table th { color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; }

.docs-icon-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 4px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--panel-border);
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0 2px;
}
.docs-icon-chip .sw { width: 16px; height: 16px; border-radius: 5px; flex-shrink: 0; }

.docs-guide-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 46px;
  padding-top: 22px;
  border-top: 1px solid var(--panel-border);
}
.docs-guide-nav a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  color: var(--text);
}
.docs-guide-nav a:hover { border-color: var(--accent); text-decoration: none; }
.docs-guide-nav .dir { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); display: block; margin-bottom: 4px; }
.docs-guide-nav .next { text-align: right; grid-column: 2; }

.docs-footer {
  text-align: center;
  padding: 30px 20px 50px;
  color: var(--muted);
  font-size: 0.82rem;
}

/* tone backgrounds shared by category/card icon badges */
.tone-amber { background: var(--accent); }
.tone-teal { background: var(--teal); }
.tone-purple { background: var(--purple); }
.tone-indigo { background: var(--indigo); }
.tone-slate { background: var(--slate); }
.tone-danger { background: var(--danger); }
.tone-warning { background: var(--warning); }

[hidden] { display: none !important; }

/* ── Mobile sidebar toggle ──────────────────────────────────────────── */
.docs-sidebar-toggle { display: none; }

@media (max-width: 1150px) {
  .docs-shell.with-toc { grid-template-columns: 260px minmax(0, 1fr); }
  .docs-toc { display: none; }
}

@media (max-width: 860px) {
  /* The search box can't share a row with the logo/hamburger/CTA at phone
     widths without shrinking to an unusable few px — drop it to its own
     full-width row instead, and grow --header-h to match so the sticky
     sidebar (which anchors off that var) starts below both rows. */
  :root { --header-h: 108px; }
  .docs-header { height: auto; flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .docs-header-brand .site-name { display: none; }
  .docs-search-wrap { order: 3; flex-basis: 100%; max-width: none; margin-top: 4px; }
  .docs-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--panel-border);
    background: var(--panel);
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
  }
  .docs-shell, .docs-shell.with-toc { grid-template-columns: 1fr; }
  .docs-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 190;
    background: var(--bg);
    transform: translateX(-100%);
    transition: transform 200ms ease;
    box-shadow: var(--shadow-lg);
  }
  .docs-sidebar.open { transform: translateX(0); }
  .docs-main { padding: 24px 18px 60px; }
  .docs-hero { padding: 36px 18px 30px; }
  .docs-hero h1 { font-size: 1.7rem; }
  .docs-home-body { padding: 0 18px 60px; }
  .docs-guide-nav { grid-template-columns: 1fr; }
  .docs-guide-nav .next { text-align: left; grid-column: 1; }
}
