/* ============================================================
   layout.css —— 骨架布局：侧边栏 + 主内容区
   ============================================================ */

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

/* ---------- 侧边栏 ---------- */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand .mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(18, 148, 108, .28);
}
.brand .mark svg { width: 17px; height: 17px; }
.brand .txt { min-width: 0; flex: 1; }
.brand h1 {
  font-size: 13.5px;
  line-height: 1.25;
  letter-spacing: -.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand .tag {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav { padding: 10px 10px 14px; flex: 1; }
.nav-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .7px;
  color: var(--text-3);
  padding: 14px 10px 6px;
}
.nav-label:first-child { padding-top: 4px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 2px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .13s, color .13s;
}
.nav-item::before {
  content: '';
  position: absolute;
  left: -10px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 0;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  transition: height .16s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.on::before { height: 20px; }
.nav-item .ico {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: .75;
}
.nav-item.on .ico { opacity: 1; }
.nav-item .dot {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  background: var(--danger-soft);
  color: var(--danger);
  padding: 1px 6px;
  border-radius: 20px;
}

.side-foot {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.side-foot .who { font-size: 11px; color: var(--text-3); line-height: 1.5; }

.theme-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .13s, color .13s, border-color .13s;
}
.theme-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-2); }
.theme-btn svg { width: 15px; height: 15px; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar .title { font-size: 15.5px; font-weight: 600; line-height: 1.25; }
.topbar .desc { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.topbar .spacer { flex: 1; }
.topbar .actions { display: flex; align-items: center; gap: 8px; }
.save-state {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
}
.save-state i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.content {
  padding: 26px 32px 40px;
  max-width: 1340px;
  width: 100%;
  flex: 1;                 /* 让页脚始终贴底 */
}

.app-foot {
  padding: 0 32px 26px;
  max-width: 1340px;
  width: 100%;
  font-size: 11.5px;
  color: var(--text-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.foot-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.foot-btn {
  font: inherit;
  font-size: 11.5px;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-xs, 6px);
  padding: 3px 9px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.foot-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.foot-btn.foot-danger:hover { color: var(--danger); border-color: var(--danger); }

.panel { display: none; }
.panel.on { display: block; animation: fade .2s ease; }
@keyframes fade {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 栅格 ---------- */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

/* 分栏：主内容 + 侧栏 */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }

@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 1000px) {
  .app {
    grid-template-columns: 1fr;
    /* 侧边栏折成顶部一条之后，.app 就变成「一条侧边栏 + 一块主内容」两行。
       容器有 min-height: 100vh，而 grid 的 align-content 默认是 stretch ——
       两行会被拉长去填满整个视口高度。正常视口下看不出来，但截图脚本用
       「宽 900 × 高 8000」这种超长视口时，顶部那条会被撑到 1689px 高，
       页面标题被顶到屏幕外，看着像布局坏了。auto 行就该按内容高排。 */
    align-content: start;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .brand { padding: 14px 16px 12px; }
  .nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px 10px; flex: none; }
  .nav-label { display: none; }
  .nav-item { width: auto; white-space: nowrap; margin-bottom: 0; }
  .nav-item::before { display: none; }
  .nav-item .dot { display: none; }
  .side-foot { display: none; }
  .content { padding: 18px 16px 32px; }
  .app-foot { padding: 0 16px 20px; }
  .topbar { padding: 0 16px; height: 56px; }
  .topbar .actions { display: none; }
  .g5, .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g2 { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .g5, .g4, .g3, .g-auto { grid-template-columns: 1fr; }
}
