#user-menu-btn {
  position: relative;
  min-width: 0;
  min-height: 44px;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 9px;
  color: var(--ak-text);
  font: 600 14px/1.45 "Microsoft YaHei", sans-serif;
}
#user-menu-btn:hover, #user-menu-btn[aria-expanded="true"] {
  background: var(--ak-raised);
  box-shadow: inset 0 0 0 1px var(--ak-border);
}
#user-menu-btn:focus-visible {
  outline: 2px solid var(--ak-accent);
  outline-offset: 2px;
}
#user-menu-btn .user-avatar, #account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ak-selected);
  color: var(--ak-accent-strong);
  font-size: 14px;
  font-weight: 700;
}
.account-more { flex: none; color: var(--ak-muted); }
body.sidebar-collapsed #user-menu-btn { justify-content: center; padding: 0; }
body.sidebar-collapsed .account-more { display: none; }

#account-popover {
  position: fixed;
  inset: auto;
  z-index: 1100;
  width: min(280px, calc(100vw - 16px));
  box-sizing: border-box;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--ak-border);
  border-radius: 14px;
  background: var(--ak-surface);
  color: var(--ak-text);
  box-shadow: 0 12px 36px rgb(0 0 0 / 28%), 0 2px 8px rgb(0 0 0 / 16%);
  overflow: auto;
  overscroll-behavior: contain;
  font: 14px/1.5 "Microsoft YaHei", sans-serif;
  text-align: left;
}
body.light-theme #account-popover {
  box-shadow: 0 12px 36px rgb(23 34 56 / 12%), 0 2px 8px rgb(23 34 56 / 6%);
}
#account-popover[hidden] { display: none; }
.account-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 9px 14px;
  margin: 0 4px 5px;
  border-bottom: 1px solid var(--ak-border);
}
#account-avatar { width: 40px; height: 40px; font-size: 17px; }
.account-identity > div { min-width: 0; }
#account-name { display: block; overflow-wrap: anywhere; font-size: 15px; line-height: 1.4; }
#account-validity { color: var(--ak-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
#account-commands button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 8px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
#account-commands button > svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ak-muted);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#account-commands button:is(:hover,:focus-visible) { background: var(--ak-raised); }
#account-commands button:focus-visible { outline: 2px solid var(--ak-accent); outline-offset: -2px; }
.account-divider { height: 1px; margin: 5px 10px; background: var(--ak-border); }
.account-switch {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  width: 30px;
  height: 18px;
  margin-left: auto;
  padding: 2px;
  border: 1px solid var(--ak-control-border);
  border-radius: 20px;
  background: var(--ak-raised);
}
.account-switch::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ak-muted);
}
#account-dark[aria-checked="true"] .account-switch {
  justify-content: flex-end;
  border-color: var(--ak-accent);
  background: var(--ak-accent);
}
#account-dark[aria-checked="true"] .account-switch::after { background: var(--ak-canvas); }
@media (min-width: 721px) {
  .shell-view > .sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
  }
  .sidebar > .sidebar-head { flex: none; }
  .sidebar > #app-nav { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .sidebar > .sidebar-footer {
    position: static;
    flex: none;
    align-items: stretch;
    gap: 2px;
    width: 100%;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--ak-border);
  }
  .sidebar-footer > .sidebar-help-link { margin-bottom: 0; }
  body.sidebar-collapsed .sidebar-footer > .ak-inbox-entry { justify-content: center; position: relative; padding-inline: 0; }
  body.sidebar-collapsed .sidebar-footer > .ak-inbox-entry span { display: none; }
  body.sidebar-collapsed .sidebar-footer > .ak-inbox-entry b { position: absolute; top: 0; right: 0; }
}
@media (max-width: 720px) {
  body .shell-view:not([hidden]) { grid-template-rows: max-content 1fr; }
  body .shell-view .sidebar { gap: 6px; padding-inline: 8px; }
  #shell-view:has(.me-host) > .sidebar { height: 60px; max-height: none; overflow: visible; }
  body:not(.ak-mobile-open) #shell-view:has(.me-host) > .sidebar > .sidebar-footer { display: flex; }
  body .shell-view .ak-mobile-nav-toggle { width: 44px; height: 44px; }
  body.ak-mobile-open .shell-view #app-nav {
    max-height: calc(100dvh - 60px - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  body .shell-view .sidebar-footer { display: flex; flex-direction: row; align-items: center; gap: 2px; }
  body .shell-view .sidebar-footer > :is(.ak-inbox-entry,.sidebar-help-link):not([hidden]) {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
  }
  body .shell-view .sidebar-footer > :is(.ak-inbox-entry,.sidebar-help-link) > span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  body .shell-view .sidebar-footer > .ak-inbox-entry b { position: absolute; top: 0; right: 0; }
  body .shell-view #user-menu-btn { min-width: 44px; width: 44px; height: 44px; padding: 0; }
  body .shell-view .account-more { display: none; }
}
@media (max-width: 720px), (pointer: coarse) {
  #account-commands button { min-height: 46px; }
}
