/* ========== 基础：重置、布局骨架、导航 ========== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-md)/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: var(--primary-soft); }

.file-banner {
  background: var(--warning-soft); color: #7a4a00; padding: var(--s-3) var(--s-4);
  font-size: var(--fs-sm); line-height: 1.7; border-bottom: 1px solid #f3d9a4;
}
.file-banner code { background: rgba(0, 0, 0, .06); padding: 1px 6px; border-radius: 4px; }

/* ---- 侧边导航 ---- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 80;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center;
  padding: var(--s-5) var(--s-2) var(--s-4);
}
.brand { display: flex; flex-direction: column; align-items: center; margin-bottom: var(--s-5); }
.brand-mark {
  width: 42px; height: 42px; border-radius: var(--r-md); display: grid; place-items: center;
  color: #fff; font-size: 19px; font-weight: 800; background: var(--primary);
  box-shadow: 0 6px 16px var(--primary-ring);
}
.brand-caption { font-size: 11px; color: var(--text-3); margin-top: var(--s-2); font-weight: 600; letter-spacing: .3px; }
.side-nav { width: 100%; display: flex; flex-direction: column; align-items: center; gap: var(--s-1); }
.side-item {
  position: relative; width: 68px; min-height: 60px; border-radius: var(--r-md);
  color: var(--text-2); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; font-size: 11px; font-weight: 500; transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.side-item svg { width: 22px; height: 22px; stroke-width: 1.8; }
.side-item:hover { background: var(--surface-2); color: var(--text); }
.side-item:active { transform: scale(.97); }
.side-item[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-item[aria-current="page"]::before {
  content: ""; position: absolute; left: -10px; width: 3px; height: 26px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-badge {
  position: absolute; top: 7px; right: 9px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-full); background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.side-bottom { margin-top: auto; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  color: #7a3e5a; background: linear-gradient(135deg, #ffe4d6, #ffd2e8); border: 2px solid var(--surface); box-shadow: var(--shadow-1);
}

/* ---- 主内容区 ---- */
.main { margin-left: var(--sidebar-w); padding: var(--s-6) var(--s-8) var(--s-10); min-height: 100vh; }
.main-inner { max-width: var(--content-max); margin: 0 auto; }
.page { animation: page-in var(--dur-slow) var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-5); }
.page-title { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.3px; line-height: 1.25; }
.page-sub { font-size: var(--fs-sm); color: var(--text-3); margin-top: var(--s-1); }
.page-actions { display: flex; align-items: center; gap: var(--s-2); flex-shrink: 0; }
.h2 { font-size: var(--fs-lg); font-weight: 700; }
.muted { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }

/* ---- 响应式 ---- */
@media (max-width: 1100px) { .main { padding: var(--s-5) var(--s-5) var(--s-10); } }
@media (max-width: 640px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    top: auto; bottom: 0; width: 100%; height: 64px; flex-direction: row; padding: var(--s-1) var(--s-2);
    border-right: 0; border-top: 1px solid var(--line); justify-content: center;
  }
  .brand, .side-bottom { display: none; }
  .side-nav { flex-direction: row; justify-content: space-around; gap: 0; }
  .side-item { width: 84px; min-height: 54px; }
  .side-item[aria-current="page"]::before { display: none; }
  .main { margin-left: 0; padding: var(--s-4) var(--s-4) 90px; }
  .page-title { font-size: 22px; }
  .page-sub { display: none; }
  .page-head { margin-bottom: var(--s-4); }
}
