.site-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: clamp(240px, 18vw, 280px) minmax(0, 1fr);
}
.site-sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 100vh;
  overflow: auto;
  padding: 28px 18px;
  background: var(--surface-subtle);
}
.site-sidebar::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 1px;
  background: var(--fade-v);
}
.sidebar-backdrop, .sidebar-toggle { display: none; }
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 900;
}
.site-logo-mark, .avatar {
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}
.site-logo-mark { width: 40px; height: 40px; border-radius: 12px; }
.site-logo-mark.has-image {
  overflow: hidden;
  background: #fff;
  color: transparent;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .16), inset 0 0 0 1px rgba(37, 99, 235, .12);
}
.site-logo-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.avatar { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }
.avatar.has-image { overflow: hidden; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.site-sidebar-summary {
  margin: 14px 0 28px;
  color: var(--muted);
  line-height: 1.7;
}
.nav-group { position: relative; display: grid; gap: 8px; margin-top: 20px; }
.nav-group-separated { padding-top: 18px; }
.nav-group-separated::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10px;
  right: 10px;
  height: 1px;
  background: var(--fade-h);
}
.nav-label { padding: 0 10px; color: var(--muted); font-size: 12px; font-weight: 850; }
.site-nav { display: grid; gap: 6px; }
.site-nav a {
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 14px;
  color: var(--muted);
  font-weight: 760;
}
.site-nav a:hover { color: var(--ink); background: var(--surface-hover); }
.site-nav-ico { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-status {
  margin-top: 30px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.sidebar-status strong { display: block; margin-bottom: 6px; }
.sidebar-status span { color: var(--muted); line-height: 1.6; }
.site-main { min-width: 0; padding: 28px; }
.site-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 72px;
  margin-bottom: 20px;
  padding: 14px 0 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--paper);
}
.site-topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--fade-h);
}
.site-search { flex: 1; display: flex; justify-content: center; }
.site-search input {
  width: min(540px, 100%);
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
}
.theme-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .sun-icon { display: none; }
body.dark-mode .theme-toggle .moon-icon { display: none; }
body.dark-mode .theme-toggle .sun-icon { display: block; }
.site-footer {
  position: relative;
  margin-top: 20px;
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--fade-h);
}
.site-footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px 16px; font-weight: 760; }
@media (max-width: 980px) {
  .site-shell {
    display: block;
    min-width: 0;
  }
  .site-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    width: min(76vw, 292px);
    height: 100dvh;
    padding: 22px 16px;
    display: block;
    overflow: auto;
    transform: translateX(-104%);
    transition: transform .3s ease, box-shadow .3s ease;
    box-shadow: none;
  }
  body.nav-open .site-sidebar {
    transform: translateX(0);
    box-shadow: 24px 0 70px rgba(15, 23, 42, .2);
  }
  .site-sidebar::after { inset: 0 0 0 auto; width: 1px; height: auto; background: var(--fade-v); }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: block;
    border: 0;
    background: rgba(15, 23, 42, .42);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
  }
  body.nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  body.nav-open { overflow: hidden; }
  .site-logo {
    font-size: 21px;
  }
  .site-logo-mark { width: 38px; height: 38px; border-radius: 13px; }
  .site-sidebar-summary { display: block; margin-bottom: 20px; font-size: 13px; }
  .sidebar-status { display: block; }
  .nav-group {
    margin-top: 18px;
    gap: 8px;
  }
  .nav-group-separated { padding-top: 18px; }
  .nav-group-separated::before { display: block; }
  .nav-label { padding: 0 10px; }
  .site-nav {
    display: grid;
    gap: 8px;
  }
  .site-nav a {
    min-height: 40px;
    padding: 0 10px;
    font-size: 14px;
  }
  .site-main { padding: 18px; }
  .site-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: auto;
    margin-bottom: 16px;
    padding: 10px 0 14px;
  }
  .sidebar-toggle {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    gap: 3px;
    border: 1px solid rgba(37, 99, 235, .18);
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(235, 243, 255, .96));
    color: var(--brand-deep);
    box-shadow: 0 12px 28px rgba(59, 104, 159, .14), inset 0 1px 0 rgba(255, 255, 255, .95);
    cursor: pointer;
  }
  body.dark-mode .sidebar-toggle {
    border-color: rgba(147, 197, 253, .22);
    background: linear-gradient(145deg, rgba(30, 41, 59, .98), rgba(15, 23, 42, .96));
    color: var(--brand);
  }
  .sidebar-toggle span {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }
  .site-search input {
    height: 42px;
    padding: 0 12px;
    font-size: clamp(12px, 3vw, 14px);
  }
}
@media (max-width: 720px) {
  .site-sidebar {
    width: min(74vw, 280px);
    padding: 20px 14px;
  }
  .sidebar-status { display: none; }
  .site-main { padding: 14px; }
  .site-topbar {
    align-items: center;
    gap: 10px;
  }
  .site-search { justify-content: flex-start; }
  .theme-toggle {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
  }
  .sidebar-toggle {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    border-radius: 16px;
  }
  .site-footer { align-items: flex-start; flex-direction: column; }
  .site-footer-links { justify-content: flex-start; }
}
