/* ================================================================
   layout.css — 应用壳体、侧边栏、顶栏、移动端导航、页面容器
   ================================================================ */

/* ---- App 壳体 ---- */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 218px 1fr;
  background: var(--bg);
}

/* ---- 侧边栏 ---- */
.sidebar {
  border-right: 1px solid var(--line) !important;
  background: rgba(255, 255, 255, .96) !important;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 9px;
  font-family: Georgia, serif;
  font-size: 19px;
  letter-spacing: -.4px;
  color: var(--ink) !important;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--soft) !important;
  color: var(--accent-dark) !important;
  display: grid;
  place-items: center;
}

.brand-mark svg {
  width: 17px;
  height: 17px;
}

.brand-icon {
  background: var(--soft) !important;
  color: var(--accent-dark) !important;
  border-radius: 12px;
  padding: 9px;
}

.navgroup {
  display: grid;
  gap: 4px;
}

.navlabel {
  padding: 0 12px 7px;
  color: #9aa39d;
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.navitem {
  border: 0;
  background: transparent;
  color: var(--muted) !important;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-align: left;
  width: 100%;
  font-size: 13px;
}

.navitem svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.7;
}

.navitem:hover {
  background: var(--surface-soft) !important;
}

.navitem.active {
  background: var(--accent-dark) !important;
  color: #fff !important;
  border-color: var(--accent-dark) !important;
}

.navbottom {
  margin-top: auto;
}

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--line);
  color: #98a19b;
  font-size: 11px;
}

.side-tools {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.side-foot {
  border-top: 1px solid var(--line);
  padding: 14px;
  text-align: center;
  color: #a1a1aa;
  font-size: 10px;
  letter-spacing: .025em;
}

.card-list {
  padding: 4px 12px 14px;
  overflow: auto;
  flex: 1;
}

/* ---- 主区域 ---- */
.main {
  min-width: 0;
  padding: 24px 30px 45px;
  max-width: 1600px;
  width: 100%;
  margin: auto;
  background: transparent !important;
  overflow: visible !important;
  box-sizing: border-box;
}

.main-inner {
  max-width: 960px;
  margin: 0 auto;
}

/* ---- 顶栏 ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 25px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mobile-brand {
  display: none;
  flex-shrink: 0;
  color: var(--ink);
}

.mobile-menu-btn {
  display: none;
}

/* ---- 移动端元素初始隐藏 ---- */
.mobile-head,
.mobile-backdrop,
.mobile-nav {
  display: none;
}

/* ---- 页面容器 ---- */
.page {
  display: none;
  animation: page-in .2s ease-out;
}

.page.active {
  display: block;
}

/* ---- 页面标题区 ---- */
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin: 0 0 22px;
}

.page-heading h1 {
  color: var(--ink) !important;
  letter-spacing: -.035em;
}

.heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ---- 区块标题行 ---- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 25px 0 13px;
}

.section-head h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -.2px;
}

/* ---- 详情双栏布局 ---- */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, .8fr);
  gap: 16px;
}

.detail-heading {
  align-items: center;
}

.detail-heading .btn {
  flex-shrink: 0;
}

/* ==================================
   平板适配 (≤1000px)
   ================================== */
@media (max-width: 1000px) {
  .app {
    grid-template-columns: 190px 1fr;
  }
  .main {
    padding: 20px;
  }
}

/* ==================================
   移动端整体布局 (≤760px)
   ================================== */
@media (max-width: 760px) {
  body {
    padding-bottom: 70px;
    overflow-x: hidden;
  }

  .app {
    display: block;
    min-height: 100dvh;
    min-width: 0;
    max-width: 100vw;
  }

  .sidebar {
    display: none;
  }

  .sidebar.open {
    display: flex !important;
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    width: min(86vw, 320px) !important;
    height: 100dvh !important;
    min-height: 0 !important;
    transform: translateX(0) !important;
    z-index: 99 !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    box-shadow: 12px 0 35px rgba(0, 0, 0, 0.15) !important;
  }

  .mobile-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(3px);
    z-index: 29;
  }

  .main {
    padding: 12px 14px 28px !important;
    max-width: 100vw;
    box-sizing: border-box;
  }

  /* 顶栏自适应紧凑排版 */
  .topbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    padding-top: 3px;
    width: 100%;
    min-width: 0;
  }

  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 16px;
    flex-shrink: 0;
    border-radius: 9px;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: Georgia, serif;
    font-size: 13px;
    letter-spacing: -.3px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .mobile-brand .brand-mark {
    width: 24px;
    height: 24px;
    border-radius: 7px;
  }

  .mobile-brand .brand-mark svg {
    width: 14px;
    height: 14px;
  }

  /* 搜索框自适应延伸，隐藏 ⌘ K */
  .topbar > .search {
    flex: 1;
    min-width: 0 !important;
    max-width: none !important;
    height: 34px;
    padding: 0 8px;
    gap: 6px;
  }

  .topbar > .search input {
    font-size: 12px;
    min-width: 0;
  }

  .topbar > .search .small {
    display: none !important; /* 关键：手机端隐藏 ⌘ K 省出空间 */
  }

  .top-actions {
    margin-left: 0;
    gap: 0;
    flex-shrink: 0;
  }

  .top-actions .iconbtn {
    display: none !important; /* 隐藏通知和设置图标，底部导航已有 */
  }

  .top-actions .avatar {
    width: 30px !important;
    height: 30px !important;
    border-radius: 8px !important;
    font-size: 10px;
    flex-shrink: 0;
  }

  /* 底部固定导航栏 */
  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    z-index: 50;
  }

  .mobile-nav button {
    border: 0;
    background: transparent;
    color: #859087;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    min-width: 0;
    flex: 1;
    padding: 2px 0;
  }

  .mobile-nav button svg {
    width: 18px;
    height: 18px;
  }

  .mobile-nav button.active {
    color: var(--accent);
    font-weight: 700;
  }

  .mobile-nav .plus {
    width: 40px;
    height: 34px;
    flex: 0 0 40px;
    border-radius: 18px;
    background: var(--accent);
    color: white;
    display: grid;
    place-items: center;
  }

  .mobile-nav .plus svg {
    width: 18px;
  }

  /* 页面标题 */
  .page-heading {
    align-items: flex-start !important;
    flex-direction: column !important;
    gap: 12px !important;
    margin-bottom: 17px !important;
  }

  .page-heading h1 {
    font-size: 24px !important;
  }

  .heading-actions {
    width: 100%;
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .heading-actions .btn {
    width: 100%;
    min-height: 42px;
  }

  .detail-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
  }

  .detail-layout > .panel {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .detail-heading .btn {
    width: 100%;
  }

  .section-head {
    margin: 20px 0 10px;
  }
}
