/* ===================== 外壳：头像入口 + 侧拉板块栏 ===================== */

.topbar { min-height: 60px; }

.topbar-title h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.current-tab {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.current-tab:not(:empty)::before { content: "· "; }

/* ---------- 头像 ---------- */
.avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
  flex: 0 0 auto;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.lg { width: 44px; height: 44px; font-size: 18px; }
.avatar.xl { width: 88px; height: 88px; font-size: 34px; }

.avatar-btn {
  position: relative;
  padding: 0;
  min-height: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: transparent;
  flex: 0 0 auto;
  line-height: 0;
}
.avatar-btn:hover,
.avatar-btn[aria-expanded="true"] { border-color: var(--focus); }
.avatar-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* 透明的"桥"：鼠标从头像往下滑到侧边栏的途中不会触发收起 */
.avatar-btn::after {
  content: "";
  position: absolute;
  left: -12px;
  right: -12px;
  top: 100%;
  height: 16px;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  width: 236px;
  max-width: calc(100vw - 48px);
  padding: 72px 12px 16px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 28px rgba(23, 32, 42, 0.12);
  overflow-y: auto;
  transform: translateX(-105%);
  visibility: hidden;
  transition: transform 0.18s ease, visibility 0s linear 0.18s;
}
.sidebar.open {
  transform: none;
  visibility: visible;
  transition: transform 0.18s ease;
}

/* 头像按钮要盖在侧边栏上方，悬停状态才能连贯 */
header { z-index: 60; }

.sidebar-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(23, 32, 42, 0.3);
}

.side-account {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 0;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  background: #fbfcfd;
}
.side-account:hover { background: var(--accent-soft); }
.side-account-text { display: flex; flex-direction: column; min-width: 0; }
.side-name,
.side-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-name { font-weight: 700; color: var(--text); }
.side-sub { font-size: 12px; color: var(--muted); }
.side-sub.synced { color: var(--green); }
.side-sub.syncing { color: var(--accent); }
.side-sub.error { color: var(--red); }

.sidebar .tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .tab-button {
  width: 100%;
  border-color: transparent;
  background: transparent;
  text-align: left;
}
.sidebar .tab-button:hover { background: #f2f5f7; color: var(--text); }
.sidebar .tab-button.active {
  background: var(--accent-soft);
  color: var(--focus);
  border-color: transparent;
}

/* ---------- 设置分组（默认折叠，侧边栏平时只是一列导航） ---------- */
.side-settings {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.side-settings > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.side-settings > summary::-webkit-details-marker { display: none; }
.side-settings > summary::after {
  content: "▸";
  display: inline-block;
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.15s;
}
.side-settings[open] > summary::after { transform: rotate(90deg); }
.side-settings > summary:hover { background: #f2f5f7; }
.side-settings > summary .tab-icon { background: var(--muted); }

.side-settings-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 4px 4px;
}
.side-settings-body > button { width: 100%; }
.side-row { display: flex; gap: 8px; }
.side-row > button { flex: 1 1 0; padding: 0 6px; }
.side-settings-body .gpa-digits { justify-content: space-between; padding: 4px 2px; }
.side-settings-body .saved { min-width: 0; text-align: left; padding: 0 2px; }
.side-hint { margin: 0; font-size: 12px; color: var(--muted); }

@media (max-width: 560px) {
  .topbar-title { gap: 8px; }
  .topbar-title h1 { font-size: 17px; white-space: nowrap; }
  .current-tab { font-size: 13px; }
  .search-trigger { padding: 0 10px; }
}
