:root {
  --ink: #111111;
  --muted: #5b5b5b;
  --line: #e2e2e2;
  --bg: #ffffff;
  --panel: #f7f7f7;
  --green: #0f7a3a;
  --green-line: #16a34a;
  --green-bg: #ecfdf3;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration-color: #9a9a9a; text-underline-offset: 3px; }
a:hover { color: var(--green); text-decoration-color: var(--green); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--mono); font-weight: 700; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green-line); display: inline-block; }
.top-links { margin-left: auto; display: flex; gap: 16px; font-size: 14px; }
.menu-toggle {
  display: none; font-family: var(--mono); font-size: 13px; padding: 6px 10px;
  border: 1px solid var(--ink); background: #fff; border-radius: 4px; cursor: pointer;
}

.layout { display: flex; min-height: calc(100vh - 53px); }
.sidebar {
  width: 320px; flex: 0 0 320px;
  border-right: 1px solid var(--line);
  padding: 16px; background: var(--panel);
  position: sticky; top: 53px; align-self: flex-start;
  height: calc(100vh - 53px); overflow-y: auto;
}
.search {
  width: 100%; padding: 9px 11px; font-size: 14px;
  border: 1px solid var(--ink); border-radius: 4px; background: #fff; font-family: var(--sans);
}
.search:focus { outline: 2px solid var(--green-line); outline-offset: 1px; }
.search-results { margin-top: 8px; border: 1px solid var(--line); background: #fff; border-radius: 4px; max-height: 320px; overflow-y: auto; }
.search-results a { display: block; padding: 8px 10px; text-decoration: none; border-bottom: 1px solid var(--line); font-size: 13px; }
.search-results a:last-child { border-bottom: 0; }
.search-results a small { display: block; color: var(--muted); }
.search-results a:hover { background: var(--green-bg); }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 10px; }
.filter-tabs button {
  font-family: var(--mono); font-size: 12px; padding: 4px 9px;
  border: 1px solid var(--ink); background: #fff; border-radius: 999px; cursor: pointer;
}
.filter-tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
.nav-section { margin-top: 16px; }
.nav-label { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.nav-tree ul { list-style: none; margin: 0; padding: 0; }
.nav-tree a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5px 8px; font-size: 13.5px; text-decoration: none; border-left: 2px solid transparent; border-radius: 0 4px 4px 0;
}
.nav-tree a:hover { background: #eee; }
.nav-tree a.active { border-left-color: var(--green-line); background: var(--green-bg); color: var(--green); font-weight: 600; }
.nav-tree .lvl-1 a { padding-left: 20px; }
.nav-tree .lvl-2 a { padding-left: 34px; font-size: 13px; }
.badge {
  font-family: var(--mono); font-size: 10px; padding: 1px 6px; border-radius: 999px;
  border: 1px solid var(--green-line); color: var(--green); background: var(--green-bg); white-space: nowrap;
}

.main { flex: 1; min-width: 0; padding: 28px 40px 48px; }
.breadcrumb { font-family: var(--mono); font-size: 12px; color: var(--muted); max-width: 860px; margin: 0 auto 8px; }
.content { max-width: 860px; margin: 0 auto; }
.content h1 { font-size: 2rem; line-height: 1.25; margin: .2em 0 .6em; letter-spacing: -.01em; }
.content h2 { font-size: 1.4rem; margin: 2em 0 .6em; padding-bottom: .3em; border-bottom: 1px solid var(--line); }
.content h3 { font-size: 1.1rem; margin: 1.6em 0 .4em; }
.content h4 { font-size: 1rem; margin: 1.3em 0 .3em; }
.content p { margin: .8em 0; }
.content ul, .content ol { padding-left: 1.4em; }
.content li { margin: .25em 0; }
.content hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.content blockquote {
  margin: 1em 0; padding: 10px 16px; background: var(--panel); border-left: 3px solid var(--ink); border-radius: 0 4px 4px 0;
}
.content code { font-family: var(--mono); font-size: .88em; background: #f0f0f0; padding: 1px 5px; border-radius: 3px; }
.content code.status-green, .content strong.status-green {
  background: var(--green-bg); color: var(--green); border: 1px solid var(--green-line); border-radius: 3px; padding: 0 5px;
}
.content pre {
  background: #fafafa; border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; overflow-x: auto; line-height: 1.45;
}
.content pre code { background: none; padding: 0; font-size: 12.5px; }
.diagram-active { color: var(--green); font-weight: 600; background: var(--green-bg); display: inline-block; width: 100%; }
.diagram-active-inline { color: var(--green); font-weight: 600; }
.table-wrap { overflow-x: auto; margin: 1em 0; }
.content table { border-collapse: collapse; width: 100%; font-size: 14px; }
.content th, .content td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.content th { background: var(--panel); font-family: var(--mono); font-size: 12.5px; }
.pager { max-width: 860px; margin: 40px auto 0; display: flex; justify-content: space-between; gap: 12px; }
.pager a { flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; text-decoration: none; font-size: 14px; }
.pager a:hover { border-color: var(--green-line); background: var(--green-bg); }
.pager a small { display: block; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.pager .next { text-align: right; }
.footer {
  max-width: 860px; margin: 40px auto 0; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 8px 20px; font-family: var(--mono); font-size: 12px; color: var(--muted);
}

@media (max-width: 860px) {
  .menu-toggle { display: inline-block; }
  .top-links { display: none; }
  .sidebar {
    position: fixed; top: 53px; left: 0; z-index: 15; width: 86%; max-width: 340px; height: calc(100vh - 53px);
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 18px rgba(0,0,0,.12);
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 20px 16px 40px; }
  .content h1 { font-size: 1.6rem; }
}
