:root{
  --bg:#0b0f17;
  --panel:#0f1625;
  --panel2:#121b2d;
  --text:#e9eefc;
  --muted:#a6b0c3;
  --border:rgba(255,255,255,.08);
  --primary:#6ea8fe;
  --primary2:#3f7dff;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius:14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Helvetica Neue", "Noto Sans", "Liberation Sans", sans-serif;
}

[data-theme="light"]{
  --bg:#f6f8fc;
  --panel:#ffffff;
  --panel2:#fbfcff;
  --text:#0f172a;
  --muted:#475569;
  --border:rgba(2,6,23,.10);
  --primary:#2563eb;
  --primary2:#1d4ed8;
  --shadow: 0 10px 30px rgba(2,6,23,.10);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--sans);
  background:var(--bg);
  color:var(--text);
}

.topbar{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; gap:14px;
  padding:12px 14px;
  background:linear-gradient(to bottom, var(--panel), rgba(0,0,0,0));
  border-bottom:1px solid var(--border);
  backdrop-filter: blur(10px);
}

.icon-btn{
  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--text);
  border-radius:12px;
  padding:8px 10px;
  cursor:pointer;
}

.brand{display:flex; flex-direction:column; line-height:1.1}
.brand__title{font-weight:700; letter-spacing:.2px}
.brand__subtitle{font-size:12px; color:var(--muted)}

.topbar__actions{
  margin-left:auto;
  display:flex; align-items:center; gap:10px;
}

.search{position:relative; width:min(520px, 44vw)}
.search input{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--text);
  outline:none;
}
.search__results{
  position:absolute; top:44px; left:0; right:0;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.search__item{
  padding:10px 12px;
  cursor:pointer;
  border-top:1px solid var(--border);
}
.search__item:first-child{border-top:none}
.search__item:hover{background:rgba(255,255,255,.04)}
.search__item .small{display:block; color:var(--muted); font-size:12px; margin-top:2px}

.btn{
  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--text);
  border-radius:12px;
  padding:10px 12px;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  gap:8px;
  align-items:center;
  white-space:nowrap;
}
.btn--primary{
  background:linear-gradient(180deg, var(--primary), var(--primary2));
  border-color:rgba(255,255,255,.12);
  color:white;
}

.layout{
  display:grid;
  grid-template-columns: 290px 1fr;
  min-height: calc(100vh - 58px);
}

.sidebar{
  position:sticky;
  top:58px;
  height: calc(100vh - 58px);
  overflow:auto;
  border-right:1px solid var(--border);
  background:var(--panel);
}
.nav{padding:14px}
.nav__section{margin-bottom:14px}
.nav__title{
  font-size:12px;
  color:var(--muted);
  margin:10px 10px 8px;
  text-transform:uppercase;
  letter-spacing:.08em;
}
.nav__link{
  display:block;
  padding:10px 10px;
  border-radius:12px;
  color:var(--text);
  text-decoration:none;
  border:1px solid transparent;
}
.nav__link:hover{background:rgba(255,255,255,.04)}
.nav__link.active{
  background:rgba(110,168,254,.12);
  border-color:rgba(110,168,254,.25);
}

.sidebar__footer{
  margin-top:18px;
  padding:10px;
  border-top:1px solid var(--border);
}
.badge{
  display:inline-block;
  font-size:12px;
  color:var(--text);
  background:rgba(110,168,254,.12);
  border:1px solid rgba(110,168,254,.25);
  padding:8px 10px;
  border-radius:999px;
}

.content{padding:18px}
.content__inner{
  max-width: 980px;
  margin:0 auto;
}
.content__header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:14px;
}
.crumbs{color:var(--muted); font-size:13px}
.content__tools{display:flex; gap:10px; flex-wrap:wrap}

.doc{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:20px;
  box-shadow:var(--shadow);
}

.doc h1{margin:0 0 12px; font-size:28px}
.doc h2{margin:22px 0 10px; font-size:20px}
.doc h3{margin:18px 0 8px; font-size:16px}
.doc p{line-height:1.65; color:rgba(255,255,255,.92)}
[data-theme="light"] .doc p{color:rgba(15,23,42,.92)}

.doc code{
  font-family:var(--mono);
  padding:2px 6px;
  border-radius:8px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.06);
}
.doc pre{
  margin:14px 0;
  padding:14px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.25);
  overflow:auto;
}
[data-theme="light"] .doc pre{background:rgba(2,6,23,.04)}
.doc pre code{border:none; background:transparent; padding:0}

.doc .callout{
  border:1px solid rgba(110,168,254,.25);
  background:rgba(110,168,254,.08);
  padding:12px 12px;
  border-radius:14px;
  margin:14px 0;
}
.doc .warn{
  border:1px solid rgba(255,193,7,.25);
  background:rgba(255,193,7,.10);
}
.doc .ok{
  border:1px solid rgba(34,197,94,.22);
  background:rgba(34,197,94,.10);
}

.footer{padding:14px 4px; color:var(--muted); font-size:13px}
.muted{color:var(--muted)}

.toast{
  position:fixed;
  bottom:16px;
  left:50%;
  transform:translateX(-50%);
  background:var(--panel);
  border:1px solid var(--border);
  padding:10px 12px;
  border-radius:999px;
  box-shadow:var(--shadow);
}

.skeleton{padding:12px}
.skeleton__line{
  height:12px;
  border-radius:999px;
  background:rgba(255,255,255,.08);
  margin:10px 0;
}
[data-theme="light"] .skeleton__line{background:rgba(2,6,23,.08)}
.w60{width:60%}
.w80{width:80%}
.w90{width:90%}

/* Mobile */
@media (max-width: 980px){
  .layout{grid-template-columns: 1fr}
  .sidebar{
    position:fixed;
    left:-310px;
    top:58px;
    width:290px;
    transition:left .2s ease;
    box-shadow:var(--shadow);
    z-index:30;
  }
  .sidebar.open{left:0}
  .search{width:min(520px, 55vw)}
}
