.quick-new {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: color-mix(in oklch, var(--surface) 74%, transparent);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-3);
  cursor: pointer;
  font-weight: 900;
  transition: transform var(--motion-fast) var(--ease-out), background var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out);
}

.quick-new:hover {
  transform: translateY(-1px);
  background: var(--surface);
  box-shadow: var(--shadow-hover);
}

.icon-plus {
  --icon: url("data:image/svg+xml,%3Csvg width='24' height='24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
}

.icon-skill {
  --icon: url("data:image/svg+xml,%3Csvg width='24' height='24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 3.5 14.5 9 20 11.5 14.5 14 12 19.5 9.5 14 4 11.5 9.5 9z'/%3E%3Cpath d='M18 3.5v4M16 5.5h4'/%3E%3C/svg%3E");
}

.icon-search {
  --icon: url("data:image/svg+xml,%3Csvg width='24' height='24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m16 16 4.2 4.2'/%3E%3C/svg%3E");
}

.rail-projects {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: var(--space-2);
  padding-top: var(--space-2);
}

.rail-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0 var(--space-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.rail-section-title button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.rail-project-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: var(--space-1);
  overflow: auto;
}

.rail-project-row {
  width: 100%;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  cursor: pointer;
  text-align: left;
}

.rail-project-row:hover,
.rail-project-row.active {
  border-color: color-mix(in oklch, var(--primary) 18%, var(--line));
  background: color-mix(in oklch, var(--primary-soft) 70%, transparent);
}

.rail-project-row span,
.rail-project-row em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-project-row em,
.rail-empty {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.rail-empty {
  padding: var(--space-2) var(--space-3);
}

.rail-system {
  position: relative;
}

.account-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 12px);
  z-index: 20;
  width: min(320px, calc(100vw - 28px));
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in oklch, var(--surface) 98%, transparent);
  box-shadow: var(--shadow-paper);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(.98);
  transform-origin: left bottom;
  visibility: hidden;
  transition: opacity var(--motion-mid) var(--ease-out), transform var(--motion-mid) var(--ease-out);
}

.account-popover.open,
.rail-system:hover .account-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.popover-user {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
}

.popover-user > span {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: var(--surface);
  font-weight: 900;
}

.popover-user strong,
.popover-user em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popover-user strong {
  font-size: 20px;
  line-height: 26px;
}

.popover-user em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.popover-menu {
  display: grid;
  gap: 2px;
}

.popover-menu button,
.popover-logout {
  min-height: 38px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0 var(--space-2);
  text-align: left;
  font-weight: 850;
}

.popover-menu button:hover {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.popover-logout {
  color: var(--danger);
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.top-search {
  width: min(260px, 30vw);
}

/* ===== 侧边栏收拢态：文字退场，图标居中 ===== */
.app-shell.rail-collapsed .rail-brand {
  justify-content: center;
  padding-inline: 0;
}

.app-shell.rail-collapsed .brand-home {
  display: none;
}

.app-shell.rail-collapsed .rail-toggle {
  flex: 0 0 28px;
  margin-left: 0;
}

.app-shell.rail-collapsed .rail-nav button,
.app-shell.rail-collapsed .account-card,
.app-shell.rail-collapsed .quick-new {
  justify-content: center;
  padding-inline: 0;
}

.app-shell.rail-collapsed .quick-new {
  padding: 0;
}

.app-shell.rail-collapsed .nav-text,
.app-shell.rail-collapsed .account-copy {
  display: none;
}

.app-shell.rail-collapsed .rail-projects {
  display: none;
}

.app-shell.rail-collapsed .account-popover {
  left: 48px;
  bottom: 0;
  transform-origin: left center;
}

@media (max-width: 980px) {
  .top-search {
    width: 100%;
  }

  .account-popover {
    position: fixed;
    left: 12px;
    bottom: 84px;
  }
}

/* ===== 2026-06-05: 账户浮层降噪 ===== */
.account-popover {
  width: min(260px, calc(100vw - 28px));
  padding: var(--space-3);
}
.popover-user {
  grid-template-columns: 38px minmax(0, 1fr);
  gap: var(--space-2);
}
.popover-user > span {
  width: 38px;
  height: 38px;
  font-size: 14px;
}
.popover-user strong {
  font-size: 16px;
  line-height: 21px;
}
.popover-user em {
  font-size: 12px;
}
.popover-menu button,
.popover-logout {
  min-height: 34px;
  font-size: 13px;
}

/* ===== 2026-06-05: 账户悬浮层与账户卡接轨 ===== */
.account-popover {
  width: min(228px, calc(100vw - 28px));
  bottom: 100%;
  border-bottom-left-radius: 0;
  transform-origin: left bottom;
}
.account-popover.open,
.rail-system:hover .account-popover {
  transform: translateY(0) scale(1);
}

/* 账户浮层扣掉 rail-system 顶部内边距，避免 hover 断桥 */
.account-popover {
  bottom: calc(100% - var(--space-3));
}
