/* ==========================================================================
   岐黄养生 · 布局层
   应用外壳 / 侧栏 / 顶栏 / 内容区 / 响应式
   ========================================================================== */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
   侧栏
   -------------------------------------------------------------------------- */
.sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 14px;
}

.brand__mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: linear-gradient(145deg, #5B9270, #3D694A);
  color: #fff;
  font-family: var(--font-serif);
  font-size: 21px;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(74, 124, 89, .28);
}

.brand__name {
  display: block;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.25;
}

.brand__sub {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  letter-spacing: .04em;
  color: var(--text-3);
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 16px;
}

/* ---- 导航项 ---- */
.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 2px;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  transition: background .15s ease, color .15s ease;
}

.nav__item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav__item .icon {
  width: 18px;
  height: 18px;
  color: var(--text-3);
  transition: color .15s ease;
}

.nav__item.is-active {
  background: var(--primary-50);
  color: var(--primary-700);
  font-weight: 600;
}

.nav__item.is-active .icon {
  color: var(--primary);
}

.nav__group-toggle {
  cursor: pointer;
}

.nav__chev {
  width: 14px;
  height: 14px;
  margin-left: auto;
  color: var(--text-3);
  transition: transform .2s ease;
}

.nav__group.is-open .nav__chev {
  transform: rotate(90deg);
}

.nav__sub {
  display: none;
  margin: 2px 0 6px 19px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.nav__group.is-open .nav__sub {
  display: block;
}

.nav__item--sub {
  margin-bottom: 0;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 450;
}

/* ---- 侧栏底部用户卡 ---- */
.sidebar__foot {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
  transition: background .15s ease;
}

.user-card:hover {
  background: var(--surface-3);
}

.user-card__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E8A87C, #D08B5B);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.user-card__name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.user-card__hint {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   主区域 / 顶栏
   -------------------------------------------------------------------------- */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 28px;
  background: rgba(250, 251, 248, .84);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn.topbar__menu {
  display: none;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
}

.crumbs a {
  color: var(--text-2);
  transition: color .15s ease;
}

.crumbs a:hover {
  color: var(--primary-700);
}

.crumbs .sep {
  opacity: .45;
}

.crumbs .current {
  color: var(--text);
  font-weight: 600;
}

/* ---- 顶栏搜索 ---- */
.topsearch {
  position: relative;
  display: flex;
  align-items: center;
  width: 320px;
}

.topsearch input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  font-size: 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.topsearch input::placeholder {
  color: var(--text-3);
}

.topsearch input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 124, 89, .12);
}

.topsearch__icon {
  position: absolute;
  left: 13px;
  display: flex;
  color: var(--text-3);
  pointer-events: none;
}

.topsearch__icon .icon {
  width: 16px;
  height: 16px;
}

.icon-btn.topsearch-mobile {
  display: none;
}

/* ---- 内容区 ---- */
.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px 36px 72px;
}

/* ---- 页头 ---- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-head h1 {
  font-size: 28px;
  letter-spacing: -.01em;
}

.eyebrow {
  margin-bottom: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .16em;
  color: var(--primary);
}

.page-head__desc {
  max-width: 64ch;
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-2);
}

.page-head__actions {
  display: flex;
  flex: none;
  gap: 12px;
  align-items: center;
}

/* ---- 页脚 ---- */
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-3);
}

.footer__links {
  display: flex;
  gap: 16px;
}

.footer__links a:hover {
  color: var(--primary-700);
}

/* ---- 遮罩 ---- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(20, 30, 24, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.backdrop.is-show {
  opacity: 1;
  pointer-events: auto;
}

body.no-scroll {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */
@media (max-width: 1120px) {
  .content {
    padding: 24px 24px 64px;
  }

  .topsearch {
    width: 250px;
  }
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    transition: transform .25s ease;
  }

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

  .icon-btn.topbar__menu {
    display: inline-flex;
  }

  .topbar {
    padding: 0 18px;
  }

  .content {
    padding: 20px 18px 60px;
  }
}

@media (max-width: 720px) {
  .topsearch {
    display: none;
  }

  .icon-btn.topsearch-mobile {
    display: inline-flex;
  }

  .crumbs {
    display: none;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .page-head h1 {
    font-size: 24px;
  }
}
