/* 全站壳层：左侧导航 + 右侧内容（无顶栏） */
:root {
  --sidebar-w: 228px;
}

body.app-shell {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

body.app-has-sidebar {
  display: flex;
  flex-direction: row;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.app-shell .page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
}

.app-sidebar.site-header-dark::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 0% 0%, rgba(91, 75, 255, 0.28), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(232, 83, 154, 0.2), transparent 50%);
}

.app-sidebar {
  position: relative;
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  background:
    linear-gradient(165deg, rgba(26, 22, 54, 0.98) 0%, rgba(45, 27, 105, 0.96) 48%, rgba(74, 25, 66, 0.96) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 4px 0 24px rgba(26, 22, 54, 0.12);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand,
.sidebar-brand-desktop {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
  font-size: 0.95rem;
}

.sidebar-brand-text {
  min-width: 0;
}

.sidebar-brand-text strong {
  display: block;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.sidebar-brand-text span {
  display: block;
  margin-top: 3px;
  font-size: 0.66rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.3;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.84rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-link.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.sidebar-num {
  flex-shrink: 0;
  width: 28px;
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.45);
}

.sidebar-link.active .sidebar-num {
  color: rgba(255, 200, 120, 0.95);
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-status {
  margin: 0 0 10px;
  font-size: 0.68rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.55);
}

.sidebar-auth-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-sidebar-login {
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #5b4bff 0%, #e8539a 55%, #ff8a4c 100%);
  box-shadow: 0 4px 14px rgba(91, 75, 255, 0.35);
  transition: opacity 0.15s, transform 0.15s;
}

.btn-sidebar-login:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-sidebar-ghost {
  width: 100%;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: background 0.15s;
}

.btn-sidebar-ghost:hover {
  background: rgba(255, 255, 255, 0.14);
}

.sidebar-foot {
  margin: 10px 0 0;
  font-size: 0.62rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.38);
}

.sidebar-mobile-bar {
  display: none;
}

.sidebar-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.app-main {
  flex: 1;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.app-main .app-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.page-banner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 20px 0;
}

.page-banner-inner {
  padding: 16px 20px;
  border-radius: calc(var(--radius) - 4px);
}

.page-banner .kicker {
  margin: 0 0 6px;
}

.page-banner-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-banner-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

@media (max-width: 900px) {
  :root {
    --sidebar-w: 100%;
  }

  body.app-has-sidebar {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    flex-shrink: 0;
    padding: 0;
    overflow: visible;
  }

  .sidebar-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    min-height: 46px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .sidebar-mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    text-decoration: none;
    color: #fff;
  }

  .sidebar-mobile-logo {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 800;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06));
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  .sidebar-mobile-name {
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar-toggle {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
  }

  .sidebar-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease;
  }

  body.sidebar-nav-open .sidebar-panel {
    max-height: min(70vh, 520px);
    overflow-y: auto;
    padding: 8px 12px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .sidebar-brand-desktop {
    display: none;
  }

  .sidebar-nav {
    flex: 0;
    flex-direction: column;
    gap: 2px;
  }

  .sidebar-link {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .sidebar-num {
    width: 28px;
    font-size: 0.68rem;
  }

  .sidebar-bottom {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .sidebar-status {
    margin: 0 0 8px;
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar-auth-btns {
    flex-direction: row;
    gap: 8px;
  }

  .btn-sidebar-login,
  .btn-sidebar-ghost {
    width: auto;
    flex: 1;
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  .sidebar-foot {
    display: none;
  }

  .app-main {
    flex: 1;
    min-height: 0;
    height: auto;
  }
}

@media (min-width: 901px) {
  .sidebar-brand-desktop {
    display: block;
  }
}
