/* 收起时也要看得出是什么、点得到、知道现在在哪：图标模式、折叠的菜单组、窄条、折叠的区块，还有目录的排序。 */

/*
 * ---------- 图标模式 ----------
 * 入口是一列，图标下面带短文字，收起也看得出是什么。平时是浅色图标，选中的才是实心图标加浅色底，不是整块深色。
 * 顶部（标识、通知、搜索、新建）和底部（设置、主题、自己、展开）都是大家认得的工具：只放图标，悬停看名字，
 * 排成两列两行，和入口列左右对齐，高度省给入口。800 高的窗口放得下全部入口。
 */
.shell.rail { grid-template-columns: 72px minmax(0, 1fr); }
@media (min-width: 761px) {
  .nav.rail {
    display: grid; grid-template-columns: repeat(2, 32px); grid-template-rows: auto auto minmax(0, 1fr) auto;
    justify-content: center; align-items: stretch; padding: 10px 0 8px;
  }
  .nav.rail .brand { grid-area: 1 / 1; display: grid; place-items: center; height: 32px; margin: 0; padding: 0; }
  .nav.rail .brand img { width: 24px; height: 24px; }
  .nav.rail > .bell-wrap { grid-area: 1 / 2; }
  .nav.rail .side-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 32px); gap: 0; margin: 0 0 6px; }
  .nav.rail .nav-scroll { grid-column: 1 / -1; min-height: 0; gap: 0; margin: 0; padding: 0; }
  .nav.rail .nav-group { gap: 1px; }
  .nav.rail .nav-foot { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 32px); gap: 0; margin: 4px 0 0; padding-top: 6px; }
  .nav.rail .nav-foot-row { display: contents; }
  .nav.rail .nav-theme { display: block; padding: 0; }
}
.nav.rail .brand .nav-text { display: none; }

/* 入口 */
.nav.rail .nav-text { display: block; max-width: 100%; overflow: hidden; font-size: 11px; line-height: 13px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.nav.rail .nav-link {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 100%; height: auto; min-height: 42px; padding: 2px; border-radius: 10px; background: none; color: var(--label-2);
}
.nav.rail .nav-scroll .nav-tile { width: 22px; height: 22px; background: color-mix(in srgb, var(--tile, #8E8E93) 15%, transparent); }
/* 图标色混一点文字色：浅色模式下深一点，深色模式下亮一点，黄色、靛蓝这些都看得清 */
.nav.rail .nav-scroll .nav-link .nav-tile svg { width: 15px; height: 15px; color: color-mix(in srgb, var(--tile, #8E8E93) 78%, var(--label)); }
.nav.rail .nav-link:hover { background: var(--fill-soft); color: var(--label); }
.nav.rail .nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.nav.rail .nav-link[aria-current="page"] .nav-text { font-weight: 600; }
.nav.rail .nav-scroll .nav-link[aria-current="page"] .nav-tile { background: var(--tile, #8E8E93); box-shadow: none; }
.nav.rail .nav-scroll .nav-link[aria-current="page"] .nav-tile svg { color: #fff; }
.nav.rail .nav-sep { width: 24px; margin: 3px auto; }
.nav.rail .nav-group:first-child .nav-sep { display: none; }

/* 顶部和底部的工具：一样大的方格，只放图标 */
.nav.rail .side-add { background: none; }
.nav.rail .bell-wrap { flex: none; }
.nav.rail .bell-btn, .nav.rail .side-search, .nav.rail .side-add-main,
.nav.rail .nav-foot .nav-link, .nav.rail .nav-user, .nav.rail .nav-collapse, .nav.rail .nav-theme .icon-btn {
  position: relative; display: grid; flex: none; place-items: center; width: 32px; height: 32px; min-height: 0; padding: 0; border-radius: 8px; background: none; color: var(--label-2);
}
.nav.rail .side-actions .nav-text, .nav.rail .bell-wrap .nav-text, .nav.rail .nav-foot .nav-text { display: none; }
.nav.rail .bell-btn svg, .nav.rail .side-search svg, .nav.rail .side-add-main svg, .nav.rail .nav-collapse svg, .nav.rail .nav-theme .icon-btn svg { width: 18px; height: 18px; }
.nav.rail .nav-foot .nav-tile { width: auto; height: auto; background: none; box-shadow: none; color: inherit; }
.nav.rail .nav-foot .nav-link .nav-tile svg { width: 18px; height: 18px; color: currentColor; }
.nav.rail .nav-foot .nav-user .av { flex: none; width: 22px; height: 22px; font-size: 11px; }
.nav.rail .bell-btn:hover, .nav.rail .side-search:hover, .nav.rail .side-add-main:hover,
.nav.rail .nav-foot .nav-link:hover, .nav.rail .nav-user:hover, .nav.rail .nav-collapse:hover, .nav.rail .nav-theme .icon-btn:hover { background: var(--fill-soft); color: var(--label); }
.nav.rail .nav-foot .nav-link[aria-current="page"], .nav.rail .nav-user[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.nav.rail .bell-btn .badge { top: 0; right: 0; left: auto; min-width: 15px; height: 15px; padding: 0 4px; font-size: 10px; line-height: 15px; box-shadow: 0 0 0 1.5px var(--sidebar); }

/* 待办数字：红底白字的角标，有才显示 */
.nav-link { position: relative; }
.nav-badge {
  flex: none; min-width: 17px; height: 17px; margin-left: auto; padding: 0 5px; border-radius: 999px;
  background: var(--danger-fill); color: #fff; font-size: 11px; font-weight: 600; line-height: 17px; text-align: center; font-variant-numeric: tabular-nums;
}
/* 图标模式：小一号，只压住图标右上角，不盖图标本身 */
.nav.rail .nav-badge { position: absolute; top: 0; left: calc(50% + 5px); min-width: 15px; height: 15px; margin: 0; padding: 0 4px; font-size: 10px; line-height: 15px; box-shadow: 0 0 0 1.5px var(--sidebar); }
.nav.rail .nav-link[aria-current="page"] .nav-badge { background: var(--danger-fill); color: #fff; box-shadow: none; }

/* ---------- 折叠的菜单组：标题后面写几项，下面一排小图标 ---------- */
.nav-group-title span:first-child { flex: 1; min-width: 0; }
.nav-group-count { flex: none; margin-right: 4px; font-weight: 500; color: var(--label-3); font-variant-numeric: tabular-nums; }
.nav-mini { display: flex; flex-wrap: wrap; gap: 2px; padding: 1px 6px 2px; }
.nav-mini-link { position: relative; display: grid; place-items: center; width: 30px; height: 28px; border-radius: 7px; color: var(--accent-text); text-decoration: none; }
.nav-mini-link svg { width: 17px; height: 17px; }
.nav-mini-link:hover { background: var(--fill-soft); }
.nav-mini-link[aria-current="page"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.nav-mini-link .nav-badge { position: absolute; top: -3px; right: -3px; min-width: 14px; height: 14px; margin: 0; padding: 0 3px; font-size: 10px; line-height: 14px; box-shadow: 0 0 0 1.5px var(--bg); }
.nav-group.drop-hover { border-radius: 8px; background: var(--accent-soft); }
.nav-group.drop-deny { opacity: .6; }

/* ---------- 窄条：和展开时的面板头一样，左边标题、右边按钮；下面是个小下拉框，写着当前选中的 ---------- */
.side-panel-strip {
  flex: none; align-self: flex-start; position: sticky; top: 70px; display: flex; flex-direction: column; gap: 2px; width: 84px; padding: 4px 6px 6px;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-card);
}
.strip-head { display: flex; align-items: center; justify-content: space-between; gap: 2px; min-height: 26px; }
.strip-label { min-width: 0; overflow: hidden; font-size: 12px; line-height: 14px; font-weight: 500; color: var(--label-3); text-overflow: ellipsis; white-space: nowrap; }
.side-panel-strip .strip-expand { flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin-right: -3px; border-radius: 7px; color: var(--label-3); }
.side-panel-strip .strip-expand:hover { background: var(--fill-soft); color: var(--label); }
.side-panel-strip .strip-pick {
  display: flex; align-items: center; justify-content: space-between; gap: 2px; width: 100%; min-height: 28px; padding: 4px 4px 4px 7px; border-radius: 7px;
  background: var(--fill-soft); color: var(--label); text-align: left;
}
.side-panel-strip .strip-pick:hover { background: var(--fill); }
.side-panel-strip .strip-pick[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent-text); }
.strip-summary {
  display: -webkit-box; min-width: 0; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
  font-size: 13px; line-height: 17px; font-weight: 500; overflow-wrap: anywhere;
}
.strip-more { flex: none; display: grid; place-items: center; color: var(--label-3); }
.side-panel-strip .strip-more svg { width: 12px; height: 12px; }
.strip-pop { max-height: min(72vh, 560px); overflow: auto; padding: 8px; }
.strip-pop .settings-link { min-height: 34px; }
.strip-pop .tree-track:first-child { padding-top: 4px; }

/* ---------- 折叠的区块：标题后面一句话 ---------- */
.fold-toggle { min-width: 0; max-width: 100%; }
.fold-toggle strong, .fold-toggle .n { flex: none; }
.fold-summary { min-width: 0; margin-left: 6px; overflow: hidden; color: var(--label-2); font-size: 13px; font-weight: 400; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.fold.closed .section-actions { margin-left: auto; }
.group-toggle .group-flag { margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--red); white-space: nowrap; }

/* ---------- 目录：已发布收成一行、当前版本的标记、数字对齐 ---------- */
.tree-row.released-row .tree-name { color: var(--label-3); font-weight: 500; }
.tree-panel { width: 240px; }
/* 版本树宽了一点，各端进度也让一点，七个端还能排一行 */
.line-progress { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.tree-count { min-width: 20px; text-align: right; }

/* 很矮的窗口：入口再紧一点，720 高还放得下；再矮的话入口自己滚动，顶部和底部一直看得见。行距不能小到图标贴着上一行的字 */
@media (min-width: 761px) and (max-height: 780px) {
  .nav.rail .nav-group { gap: 0; }
  .nav.rail .nav-scroll .nav-link { min-height: 36px; gap: 2px; padding-block: 1px; }
  .nav.rail .nav-scroll .nav-tile { width: 20px; height: 20px; }
  .nav.rail .nav-scroll .nav-link .nav-tile svg { width: 14px; height: 14px; }
  .nav.rail .nav-scroll .nav-text { font-size: 10px; line-height: 12px; }
}

@media (max-width: 760px) {
  .side-panel-strip { display: none; }
  .shell.rail { grid-template-columns: minmax(0, 1fr); }
}
