/* 共用左侧图标栏 + 顶栏通知铃（2026-10-14 ㉕，栋栋反馈第四批）。
   由 /app2（simple.html）、/account（account.html）、/help（help.html）三页共用：
   DOM 由 assets/side-rail.js 生成，样式在这里。规则原文从 assets/simple.css 原样搬来（回滚见 _backup/2026-10-14_rail/），
   /app2 的像素表现不变；account / help 靠 studio-pages.css 里的令牌（--rail-bg / --tab-h 等）取得同一套深浅色。
   加载顺序：放在 simple.css 之前（simple.html）/ studio-pages.css 之后（account、help）。 */

/* ══════════════════ 左侧图标栏 ══════════════════ */
.rail { position: fixed; left: 0; top: 0; bottom: 0; width: 64px; z-index: 40; display: flex; flex-direction: column; align-items: center; padding: 12px 0 16px; background: var(--rail-bg); border-right: 1px solid var(--line); }
.rail-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 0; }
.rail-item { position: relative; width: 52px; height: 54px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--sub); font-size: 11px; line-height: 1; border: 0; background: none; cursor: pointer; text-decoration: none; padding: 0; }
.rail-item:hover { color: var(--ink); background: rgba(0,0,0,.04); }
[data-theme="dark"] .rail-item:hover { background: rgba(255,255,255,.04); }
.rail-item.is-on, .rail-item.is-on:hover { color: var(--accent); background: none; border: 0; box-shadow: none; }
.rail-item.is-on::before { content: none; }
.rail-m-only { display: none; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
:root[data-theme="dark"] .ic-moon, :root:not([data-theme="dark"]) .ic-sun { display: none; }

/* 头像菜单（账户 / 主题 / 退出），锚在图标栏底部向右弹 */
.rail .ui-avatar-trigger { width: 32px; height: 32px; padding: 0; gap: 0; border-radius: 50%; border: 1px solid var(--line-2); background: var(--panel-3); justify-content: center; }
.rail .ui-avatar-badge { width: auto; height: auto; background: none; color: var(--ink); font-size: 13px; font-weight: 600; }
.rail .ui-avatar-list { left: calc(100% + 12px); right: auto; top: auto; bottom: -4px; min-width: 250px; z-index: 70; padding: 8px; background: var(--pop-bg); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--pop-sh); transform-origin: bottom left; }
.avatar-who { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.avatar-who-name { font-size: 14px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.avatar-who-sub { font-size: 12px; color: var(--faint); }
.ui-avatar-item { height: 38px; padding: 0 10px; border-radius: 9px; font-size: 14px; text-decoration: none; }
.ui-avatar-item .ui-icon { color: var(--sub); }
.ui-avatar-item-danger, .ui-avatar-item-danger .ui-icon { color: #E5484D; }
:root[data-theme="dark"] .ui-avatar-item-danger, :root[data-theme="dark"] .ui-avatar-item-danger .ui-icon { color: #FF8A8A; }
.avatar-theme-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 38px; padding: 0 6px 0 10px; font-size: 14px; }
.avatar-theme-label { display: inline-flex; align-items: center; gap: 9px; }
.avatar-theme-label .ui-icon { color: var(--sub); }
:root[data-theme="dark"] #themeDarkBtn, :root:not([data-theme="dark"]) #themeLightBtn { background: var(--panel-3); color: var(--ink); }

.main { margin-left: 64px; min-height: 100vh; }

/* 铃铛 + 通知面板（锚在铃铛下方右对齐） */
.bell-wrap { position: relative; }
.bell-badge { position: absolute; top: 3px; right: 3px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px; background: #F2549E; color: #fff; font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; box-shadow: 0 0 0 2px var(--rail-bg); }
.bell-list { position: absolute; right: 0; top: calc(100% + 10px); width: min(340px, calc(100vw - 32px)); max-height: 60vh; overflow: hidden; display: flex; flex-direction: column; background: var(--pop-bg); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--pop-sh); z-index: 45; transform-origin: top right; }
.bell-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; font-size: 14px; font-weight: 600; color: var(--ink); }
.bell-markall { border: 0; background: none; padding: 4px 8px; border-radius: 8px; font-size: 12px; font-weight: 400; color: var(--sub); cursor: pointer; }
.bell-markall:hover { background: var(--panel-3); color: var(--ink); }
.bell-body { flex: 1; overflow-y: auto; padding: 0 6px 8px; min-height: 0; }
.bell-item { padding: 10px; border-radius: 10px; font-size: 13px; color: var(--sub); }
.bell-item.unread { color: var(--ink); }
.bell-item.unread .bell-item-text::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #F2549E; margin-right: 6px; vertical-align: 2px; }
.bell-item-text { line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell-item-time { font-size: 11px; color: var(--faint); margin-top: 3px; }
.bell-item[data-job] { cursor: pointer; }
.bell-item[data-job]:hover { background: var(--panel-3); }
.bell-empty { padding: 24px 10px; text-align: center; color: var(--faint); font-size: 13px; }

/* 分段开关（头像菜单里的主题浅色 / 深色） */
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.seg button { height: 26px; padding: 0 12px; border-radius: 7px; border: 0; background: none; font-size: 12px; color: var(--sub); cursor: pointer; transition: background-color .12s ease, color .12s ease; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--panel-3); color: var(--ink); }
.seg em { font-style: normal; color: var(--faint); margin-left: 4px; }
.seg-sm button { height: 24px; padding: 0 10px; }

/* 动效：通知面板下滑 / 收起、头像菜单弹出 */
@keyframes s-slide-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes s-slide-up-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-8px); } }
.bell-list:not([hidden]) { animation: s-slide-down .2s var(--ease-out); }
.bell-list.is-closing { animation: s-slide-up-out .2s var(--ease-out) forwards; pointer-events: none; }
.ui-avatar-list:not([hidden]) { animation: s-pop .16s var(--ease-out); }

/* ══════════════════ 手机（≤640px）：左栏变底部标签栏 ══════════════════ */
@media (max-width: 640px) {
  .rail { top: auto; right: 0; width: auto; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); flex-direction: row; padding: 0 8px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--rail-bg) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
  .rail-foot, .rail-d-only { display: none; }
  .rail-m-only { display: flex; }
  .rail-nav { flex-direction: row; justify-content: space-around; width: 100%; margin: 0; gap: 0; }
  .rail-item { width: 64px; height: 54px; }
  .rail-item:hover { background: none; }
  .rail-item.is-on { background: none; }
  .rail-item.is-on::before { content: none; }
  .main { margin-left: 0; }
  .bell-list { position: fixed; left: 8px; right: 8px; top: 58px; width: auto; max-height: 70vh; }
}

/* ══════════════════ account / help 页壳（body.studio-page > .main）══════════════════
   只对这两页生效（/app2 的 .main 由 simple.css 的 body.studio 体系管，不带 .studio-page）。
   studio-pages.css 的令牌与顶栏已与 /app2 同值，这里只补左栏带来的几处：主区让出 64px、手机底栏留位、
   左栏链接配色、顶栏胶囊/铃铛与 /app2 对齐，以及压掉 account.css（老壳）里一套不同的 .bell-* 样式。 */
.studio-page .main { margin-left: 64px; flex: 1; min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.studio-page .auth-area, .studio-page .auth-user { display: flex; align-items: center; gap: 10px; }
.studio-page .auth-guest { display: inline-flex; align-items: center; gap: 10px; }
.studio-page .auth-guest[hidden], .studio-page .auth-area > [hidden] { display: none; }

/* 左栏里的 <a>：颜色与 /app2 上的按钮项一致（studio-pages.css 的 a { color: inherit } 已让路） */
.studio-page .rail a.rail-item { color: var(--sub); }
.studio-page .rail a.rail-item:hover { color: var(--ink); }
.studio-page .rail a.rail-item.is-on, .studio-page .rail a.rail-item.is-on:hover { color: var(--accent); }
.studio-page .rail .ui-avatar-list a.ui-avatar-item { color: var(--ink); }

/* 铃铛面板：压掉 account.css 的老样式（内边距、条目分隔线、未读加粗 + 底色、≤899px 的顶栏定位） */
.studio-page .bell-list { padding: 0; }
.studio-page .bell-item + .bell-item { border-top: 0; }
.studio-page .bell-item.unread { font-weight: 400; background: none; }
@media (min-width: 641px) {
  .studio-page .bell-list { position: absolute; left: auto; right: 0; top: calc(100% + 10px); width: min(340px, calc(100vw - 32px)); }
}

/* 版本号已经在左栏底部：子菜单 / 目录里那个重复的藏起来；手机（≤640px）左栏没有版本号，页尾那个保留 */
.studio-page .main .acct-nav > .app-version, .studio-page .main .help-toc > .app-version { display: none; }
@media (min-width: 641px) { .studio-page .main .account-version { display: none; } }

@media (max-width: 640px) {
  .studio-page .main { margin-left: 0; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
  .studio-page .main > .topbar .topbar-sep, .studio-page .main > .topbar .topbar-title { display: none; }
  .studio-page .auth-area, .studio-page .auth-user { gap: 6px; }
}
/* Fourth batch v5: current account remains visible outside the avatar menu. */
.current-account { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.account-switch-row { display: flex; align-items: center; }
.account-switch-row > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.account-switch-row > :last-child { flex-shrink: 0; width: auto; font-size: 12px; }
@media(max-width:640px) { .current-account { max-width: 96px; } }
