/* 版面：桌機左側欄＋上方列；手機上方列＋底部分頁列；安全區域 */
.shell { min-height: 100vh; min-height: 100dvh; }
.content { min-width: 0; }
.main { padding: 0 0 calc(var(--tab-h) + var(--safe-b) + 16px); outline: none; min-width: 0; }

/* 上方列 */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 4px;
  height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) calc(8px + var(--safe-r)) 0 calc(8px + var(--safe-l));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-title { flex: 1; min-width: 0; padding-left: 8px; }
.top-title h1 { font-size: 17px; font-weight: 700; }
.top-back + .top-title { padding-left: 0; }
.top-right { display: flex; align-items: center; gap: 2px; flex: none; }
.top-actions { display: flex; gap: 6px; }
.top-me { display: none; padding: 6px; border-radius: 50%; }
.conn { width: 8px; height: 8px; border-radius: 50%; margin: 0 8px; background: transparent; }
.conn[data-state=online] { background: var(--ok); }
.conn[data-state=connecting], .conn[data-state=offline] { background: var(--warn); animation: pulse 1.6s infinite; }

/* 側欄（桌機） */
.sidebar { display: none; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; padding: 18px 18px 14px; letter-spacing: .01em; }
.brand b { color: var(--accent); font-weight: 800; }
.logo-mark { line-height: 0; }
.ws-switch {
  display: flex; align-items: center; gap: 10px; width: calc(100% - 24px); margin: 0 12px 10px; min-height: 48px; padding: 6px 10px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left;
}
.ws-switch:hover { border-color: var(--line-strong); }
.ws-name { flex: 1; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-avatar { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.ws-avatar.lg { width: 44px; height: 44px; border-radius: 12px; font-size: 20px; }
.side-nav { display: flex; flex-direction: column; padding: 4px 8px; gap: 2px; }
.side-nav a, .side-project {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 9px; color: var(--ink-2); font-weight: 550;
}
.side-nav a:hover, .side-project:hover { background: var(--surface-2); color: var(--ink); }
.side-nav a.active, .side-project.active { background: var(--accent-soft); color: var(--accent-ink); }
.side-section { padding: 12px 8px; flex: 1; overflow-y: auto; min-height: 0; }
.side-title { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 4px 10px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em; }
.side-projects { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.pdot { width: 7px; height: 7px; border-radius: 2px; background: var(--line-strong); flex: none; }
.side-project.active .pdot { background: var(--accent); }
.side-project .count { margin-left: auto; font-size: 12px; color: var(--muted); }
.side-foot { border-top: 1px solid var(--line); padding: 10px 12px calc(10px + var(--safe-b)); }
.side-user { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 6px; border-radius: 10px; font-weight: 550; }
.side-user:hover { background: var(--surface-2); }

/* 底部分頁列（手機） */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tab-h) + var(--safe-b)); padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11.5px; font-weight: 600; min-height: var(--tap); }
.tab.active { color: var(--accent-ink); }
.tab-ic { position: relative; line-height: 0; }
.tab-ic .badge { top: -6px; right: -12px; }
body.is-public .tabbar { display: none; }

/* 頁面 */
.page { max-width: 1180px; margin: 0 auto; padding: 16px calc(16px + var(--safe-r)) 24px calc(16px + var(--safe-l)); }
.page.wide { max-width: none; }
.page.narrow { max-width: 760px; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 18px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.hide-sm { display: none; }

/* 有新版本 */
.update-bar {
  position: fixed; z-index: 100; top: calc(var(--safe-t) + 8px); left: 50%; transform: translateX(-50%);
  max-width: calc(100vw - 24px); padding: 10px 18px; min-height: var(--tap); border-radius: 999px; border: 0;
  background: var(--ink); color: var(--bg); font-weight: 650; box-shadow: var(--shadow-2); cursor: pointer;
}

@media (min-width: 768px) {
  .sidebar {
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: var(--side-w); z-index: 35;
    background: var(--surface); border-right: 1px solid var(--line); padding-top: var(--safe-t);
  }
  .content { margin-left: var(--side-w); }
  .tabbar { display: none; }
  .main { padding-bottom: 32px; }
  .top-me { display: inline-flex; }
  .topbar { padding-left: 16px; }
  .page { padding: 24px 28px 40px; }
  .hide-sm { display: inline; }
  h1 { font-size: 26px; }
}
@media (min-width: 1280px) { :root { --side-w: 280px; } }
