/* 布局样式入口：当前规则由 base.css 引入的既有样式承载；新增布局规则写入本文件。 */

/* 用户控制台与管理后台共用同一套侧栏尺寸和菜单排版。 */
.app-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  inset: auto;
  top: 0;
  width: auto;
  height: 100vh;
  padding: 27px 20px;
  overflow: hidden;
}

.sidebar .brand {
  padding: 0 12px 28px;
}

.menu-label {
  margin: 0 12px 8px;
  color: #91a0b4;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.sidebar nav {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0;
  margin-right: -4px;
  padding-right: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #cbd5e1 transparent;
  scrollbar-width: thin;
}

.nav-link {
  display: block;
  margin: 2px 0;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 650;
}

.main {
  min-width: 0;
  margin-left: 0;
  padding: 42px clamp(22px, 4vw, 60px) 70px;
}

.main-dashboard {
  width: 100%;
  max-width: 1420px;
  min-height: 100vh;
}

.main-dashboard > .section-title,
.dashboard-content > .section-title {
  margin-bottom: 28px;
}

.main-dashboard > .card,
.main-dashboard > .stat-grid,
.main-dashboard > .loading,
.main-dashboard > .notice,
.dashboard-content > .card,
.dashboard-content > .upload-panel,
.dashboard-content > .loading,
.dashboard-content > .notice {
  margin-bottom: 22px;
}

.main-dashboard > .card,
.dashboard-content > .card {
  min-height: 148px;
  padding: 24px;
}

.main-dashboard > .stat-grid .stat {
  min-height: 125px;
  padding: 22px;
}

.dashboard-upload-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.dashboard-upload-page .dashboard-content {
  width: min(1420px, 100%);
  flex: 1 0 auto;
  padding: 42px clamp(22px, 4vw, 60px) 42px;
}

.dashboard-upload-page > .site-footer {
  flex: 0 0 auto;
  width: 100%;
  margin-top: 0;
}

.sidebar nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar nav::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.sidebar nav::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.side-user {
  flex: 0 0 auto;
}

.dashboard-mobile-head,
.dashboard-menu-close,
.dashboard-menu-backdrop {
  display: none;
}

html.dashboard-menu-locked {
  overflow: hidden;
}

body.dashboard-menu-locked {
  position: fixed;
  width: 100%;
  overflow: hidden;
}

@media (max-width: 800px) {
  .dashboard-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    margin: -22px -16px 22px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: #fff;
  }

  .dashboard-mobile-head .brand {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .dashboard-mobile-head button {
    flex: 0 0 auto;
    min-height: 44px;
  }

  .enterprise-mobile-head {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .enterprise-mobile-head .brand {
    display: block;
    grid-column: 2;
    grid-row: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .enterprise-mobile-head button {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  #dashboard-sidebar.dashboard-menu-open {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1101;
    display: flex;
    flex-direction: column;
    width: min(300px, 86vw);
    height: 100vh;
    height: 100dvh;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    background: #fff;
    box-shadow: 10px 0 32px rgb(15 23 42 / 18%);
    overscroll-behavior: contain;
  }

  #dashboard-sidebar .dashboard-menu-close {
    display: inline-flex;
    align-self: flex-end;
    flex: 0 0 auto;
    min-height: 44px;
    margin-bottom: 12px;
  }

  #dashboard-sidebar .brand {
    flex: 0 0 auto;
    padding-bottom: 16px;
  }

  #dashboard-sidebar .nav-link {
    min-height: 44px;
  }

  .dashboard-menu-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: block;
    background: rgb(15 23 42 / 45%);
    touch-action: none;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
    padding: 22px 16px;
  }

  .dashboard-upload-page .dashboard-content {
    padding: 22px 16px;
  }
}

@media (max-width: 520px) {
  .main-dashboard > .card,
  .dashboard-content > .card {
    padding: 18px;
  }
}
