/* 基础重置 + 应用骨架（侧栏 + 主区），全部用相对单位与 minmax，窄屏自动收起 */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

h1 { font-size: var(--fs-xl); font-weight: 640; letter-spacing: -.01em; }
h2 { font-size: var(--fs-lg); font-weight: 620; letter-spacing: -.01em; }
h3 { font-size: var(--fs-md); font-weight: 600; }
h4 { font-size: var(--fs-base); font-weight: 600; }
code, pre { font-family: var(--font-mono); font-size: .92em; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ------------------------------------------------------------ 骨架 ---- */

#app {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.sidebar {
  width: 216px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-4) var(--sp-3);
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  transition: width var(--dur) var(--ease);
}

.brand { display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-2) var(--sp-4); }
.brand-mark {
  width: 30px; height: 30px; flex: none; border-radius: 8px;
  background: linear-gradient(140deg, var(--accent), hsl(calc(var(--accent-h) + 40) 70% 60%));
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: var(--shadow-sm);
}
.brand-text { min-width: 0; }
.brand-title { font-size: var(--fs-base); font-weight: 640; letter-spacing: -.01em; white-space: nowrap; }
.brand-sub { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }

.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 8px var(--sp-3); border-radius: var(--r-md);
  color: var(--text-2); font-size: var(--fs-base); font-weight: 500;
  white-space: nowrap; width: 100%; text-align: left;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--bg-active); color: var(--accent-strong); font-weight: 600; }
.nav-item .icon { flex: none; opacity: .85; }
.nav-spacer { flex: 1; }
.nav-foot { display: flex; flex-direction: column; gap: var(--sp-1); border-top: 1px solid var(--border); padding-top: var(--sp-3); margin-top: var(--sp-3); }
.nav-meta { font-size: var(--fs-xs); color: var(--text-3); padding: 0 var(--sp-3); }

.main { min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

.view { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.view-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.container { width: min(1240px, 100%); margin-inline: auto; padding: var(--sp-6) var(--sp-5) var(--sp-7); }
.container-wide { width: 100%; padding: var(--sp-5); }

.page-head { display: flex; align-items: flex-start; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.page-head .grow { flex: 1 1 260px; min-width: 0; }
.page-title { font-size: var(--fs-2xl); font-weight: 660; letter-spacing: -.02em; }
.page-desc { color: var(--text-2); font-size: var(--fs-base); margin-top: 2px; }

.icon { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 14px; height: 14px; }

@media (max-width: 900px) {
  #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .sidebar {
    width: 100%; flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden;
    border-right: none; border-bottom: 1px solid var(--border); padding: var(--sp-2) var(--sp-3); gap: var(--sp-2);
  }
  .brand { padding: 0 var(--sp-2) 0 0; }
  .brand-text { display: none; }
  .nav-item { padding: 6px 10px; }
  .nav-foot { flex-direction: row; border-top: none; padding-top: 0; margin-top: 0; }
  .nav-meta { display: none; }
  .container { padding: var(--sp-4) var(--sp-3) var(--sp-6); }
}
