:root {
  --bg: #0a1013;
  --bg-2: #0f171c;
  --ink: #e6f1ef;
  --ink-muted: rgba(214, 230, 226, 0.82);
  --ink-soft: rgba(196, 214, 209, 0.72);
  --accent: #1fc9ad;
  --accent-2: #6ce8d5;
  --card: rgba(15, 24, 30, 0.82);
  --line: rgba(156, 212, 201, 0.2);
  --panel: #0f171c;
  --panel-2: #0c141b;
  --muted: #9db8b3;
  --accent-soft: rgba(31, 201, 173, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 16% 5%, rgba(31, 201, 173, 0.2), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(41, 96, 158, 0.28), transparent 32%),
    linear-gradient(145deg, var(--bg), var(--bg-2) 60%, #121c22);
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  position: relative;
  overflow-x: hidden;
}

.mesh {
  position: fixed;
  inset: -20% auto auto -10%;
  width: 60vw;
  aspect-ratio: 1;
  background: radial-gradient(circle at 30% 35%, rgba(108, 232, 213, 0.28), transparent 60%);
  pointer-events: none;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1rem;
  max-width: 1360px;
  margin: 1rem auto;
  padding: 0 1rem 1.2rem;
}

.sidebar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  position: sticky;
  top: 4.4rem;
  height: fit-content;
}

.sidebar label {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.sidebar input {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel-2);
  border-radius: 9px;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.8rem;
}

.sidebar input::placeholder {
  color: #7f9893;
}

.sidebar-section + .sidebar-section {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.sidebar-title {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

.group-title {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

.doc-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 0.45rem 0.55rem;
  margin: 0.15rem 0;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
}

.doc-item:hover,
.doc-item.active {
  border-color: rgba(122, 206, 189, 0.56);
  background: var(--accent-soft);
}

.tree-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
}

.tree-panel-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.tree-status {
  font-size: 0.74rem;
  color: var(--muted);
}

.tree-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tree-action {
  border: 1px solid var(--line);
  background: rgba(13, 23, 30, 0.9);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.tree-action:hover {
  background: var(--accent-soft);
}

.tree-root,
.tree-children {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.tree-node {
  display: flex;
  flex-direction: column;
}

.tree-folder {
  border-radius: 10px;
}

.tree-folder > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.3rem 0.45rem;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 500;
}

.tree-folder > summary::-webkit-details-marker {
  display: none;
}

.tree-folder > summary:hover {
  background: rgba(31, 201, 173, 0.09);
}

.tree-folder-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.tree-folder-label::before {
  content: ">";
  font-size: 0.72rem;
  color: var(--muted);
  transition: transform 140ms ease;
}

.tree-folder[open] > summary .tree-folder-label::before {
  transform: rotate(90deg);
}

.tree-children {
  margin-left: 0.85rem;
  padding-left: 0.55rem;
  border-left: 1px dashed rgba(121, 182, 169, 0.26);
}

.tree-file {
  margin: 0;
  padding: 0.35rem 0.45rem;
  font-size: 0.92rem;
}

.tree-empty {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.content-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 70vh;
  overflow: hidden;
}

.content {
  padding: 1.2rem;
  line-height: 1.6;
}

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

.breadcrumb-item,
.breadcrumb-current {
  line-height: 1.4;
}

.breadcrumb-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb-sep {
  color: #7ea8a0;
}

.content h1,
.content h2,
.content h3 {
  font-family: "IBM Plex Serif", serif;
  line-height: 1.25;
}

.content a {
  color: var(--accent);
}

.note {
  border: 1px solid rgba(121, 182, 169, 0.35);
  border-radius: 10px;
  padding: 0.75rem;
  background: rgba(12, 20, 27, 0.85);
}

.content .internal-doc-link {
  font-weight: 500;
}

.sidebar-toggle-btn,
.sidebar-mobile-head,
.go-top-btn {
  display: none;
}

.drawer-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95rem;
  height: 0.95rem;
}

.drawer-arrow svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 12, 0.56);
  backdrop-filter: blur(2px);
  z-index: 185;
}

.sidebar-close {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(13, 23, 30, 0.9);
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sidebar-close svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.go-top-btn {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 170;
  border: 1px solid rgba(108, 232, 213, 0.3);
  background: rgba(10, 18, 24, 0.96);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.78rem;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease, background-color 160ms ease;
}

.go-top-btn:hover {
  background: rgba(20, 34, 40, 0.98);
}

.go-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

body.sidebar-open {
  overflow: hidden;
}

@media (max-width: 1000px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    width: min(86vw, 360px);
    max-width: 360px;
    border-radius: 0 14px 14px 0;
    border-left: none;
    z-index: 200;
    overflow-y: auto;
    transform: translateX(-104%);
    transition: transform 220ms ease;
    padding-top: 0.8rem;
  }

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

  .sidebar-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    gap: 0.6rem;
  }

  .sidebar-mobile-head .sidebar-title {
    margin: 0;
  }

  .sidebar-toggle-btn {
    position: fixed;
    left: 0.9rem;
    bottom: 4.25rem;
    z-index: 165;
    border: 1px solid rgba(108, 232, 213, 0.62);
    background: linear-gradient(145deg, rgba(28, 58, 56, 0.96), rgba(12, 24, 31, 0.96));
    color: #effffc;
    border-radius: 999px;
    padding: 0.56rem 0.86rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(0, 9, 12, 0.34);
    cursor: pointer;
  }

  .sidebar-toggle-btn .nav-icon {
    width: 0.95rem;
    height: 0.95rem;
  }

  .sidebar-toggle-btn .nav-icon,
  .sidebar-toggle-btn .drawer-arrow {
    color: var(--accent-2);
  }

  body.sidebar-open .sidebar-toggle-btn .drawer-arrow {
    transform: rotate(180deg);
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  .tree-panel-header,
  .tree-panel-meta {
    align-items: flex-start;
  }

  .tree-actions {
    justify-content: flex-start;
  }

  .go-top-btn {
    display: inline-flex;
  }

}
