/* 第二版新增的界面：矩阵表、就地编辑、版本树、小菜单。 */

/* 主题开关：手动选的主题，浏览器自带的控件也跟着走。颜色变量在 styles-theme.css */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
.segmented button[aria-pressed="true"] { background: var(--thumb) !important; }

.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.muted-strong { font-weight: 600; color: var(--label-2); }
.tab-num { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--label-2); white-space: nowrap; }
.btn.block { width: 100%; }
.btn.small { min-height: 26px; padding: 2px 6px; font-size: 13px; }
.empty.slim { padding: 18px 16px; }
.section-actions { margin-left: auto; display: flex; gap: 2px; }
.narrow-gap { gap: 12px; }
.tint-teal { background-color: var(--teal-soft) !important; color: var(--teal) !important; }
.tint-orange { background-color: var(--orange-soft) !important; color: var(--orange) !important; }

/* 就地编辑：平时看起来是文字，鼠标放上去才显示成下拉框 */
.select.cell {
  width: auto; max-width: 150px; min-height: 28px; padding: 3px 8px; border-radius: 7px; font-size: 14px;
  background-color: transparent; background-image: none; color: var(--label); cursor: pointer; transition: background-color .12s;
}
.select.cell:hover:not(:disabled), .select.cell:focus-visible {
  background-color: var(--fill); background-image: var(--chevron); background-position: right 5px center; padding-right: 20px;
}
.select.cell:disabled { opacity: 1; cursor: default; }
.prio-select { font-weight: 600; color: var(--label-3); font-variant-numeric: tabular-nums; }
.prio-select.p0 { color: var(--red); font-weight: 700; }
.prio-select.p1 { color: var(--orange); font-weight: 700; }
.cell-status { cursor: pointer; }
.cell-owner { display: inline-flex; align-items: center; gap: 2px; }
.av.empty { background: var(--fill); }
.cell-date { position: relative; display: inline-block; min-width: 44px; padding: 3px 8px; border-radius: 7px; font-size: 13px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.cell-date:hover { background: var(--fill); }
.cell-date.empty { color: var(--label-3); }
.cell-date.overdue { color: var(--red); font-weight: 600; }
.cell-date input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.cell-date input:disabled { cursor: default; }

/* 矩阵表 */
.table-wrap { max-height: calc(100dvh - 186px); }
table.matrix { min-width: 0; font-size: 14px; }
table.matrix td { padding: 6px 6px; }
table.matrix th { padding: 9px 8px; }
table.matrix td.line-td { padding: 4px 3px; text-align: center; }
table.matrix th.line-th { text-align: center; padding: 9px 3px; }
table.matrix .name { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 240px; max-width: 340px; padding-left: 14px; box-shadow: inset 0 -1px 0 var(--sep), 1px 0 0 var(--sep); }
table.matrix thead .name { z-index: 3; }
table.matrix tbody tr:hover td { background: var(--fill-soft); }
table.matrix tbody tr:hover td.name { background: color-mix(in srgb, var(--surface) 92%, var(--label) 8%); }
td.narrow { width: 1%; }
.link-btn { font-weight: 500; }
.link-btn:hover { color: var(--accent-text); }
.group-row td { background: var(--fill-soft) !important; padding: 6px 14px !important; }
.group-row .n { margin-left: 8px; color: var(--label-3); font-variant-numeric: tabular-nums; }
.mark-changed { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 5px; background: var(--orange-soft); color: var(--orange); font-size: 12px; font-weight: 600; white-space: nowrap; }
.mark { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; color: var(--label-3); font-size: 12px; font-variant-numeric: tabular-nums; vertical-align: middle; }
.mark svg { width: 13px; height: 13px; }
.due { font-size: 13px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.due.overdue { color: var(--red); font-weight: 600; }
.my-line { font-weight: 600; }

/* 矩阵里的一格：谁负责、什么状态 */
table.matrix .select.cell { max-width: 128px; text-overflow: ellipsis; }
table.matrix .name { min-width: 210px; max-width: 280px; }
.search { flex-basis: 190px; min-width: 150px; }
.line-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center; width: 58px; min-height: 40px; margin: 0 auto; padding: 3px 2px;
  border-radius: 8px; background: var(--fill); color: var(--label-2); line-height: 1.25; transition: filter .12s, transform .12s var(--spring);
}
.line-cell:hover:not(:disabled) { filter: brightness(.94); }
.line-cell:active:not(:disabled) { transform: scale(.96); }
.line-owner { font-size: 13px; font-weight: 600; white-space: nowrap; max-width: 54px; overflow: hidden; text-overflow: ellipsis; }
.line-status { font-size: 11px; opacity: .85; }
.line-cell.doing { background: var(--blue-soft); color: var(--blue); }
.line-cell.done { background: var(--green-soft); color: var(--green); }
.line-cell.block { background: var(--red-soft); color: var(--red); }
.line-cell.overdue { box-shadow: inset 0 0 0 1.5px var(--red); }
.line-cell.unassigned .line-owner { font-weight: 400; }
.line-cell.add { background: none; color: transparent; font-size: 18px; min-height: 40px; }
tr:hover .line-cell.add:not(:disabled), .line-cell.add:focus-visible { color: var(--label-2); }
.line-cell.add:hover:not(:disabled) { background: var(--fill); color: var(--accent-text); filter: none; }
.line-cell.add:disabled { cursor: default; }
.matrix-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 14px; font-size: 13px; box-shadow: inset 0 1px 0 var(--sep); }
.legend { display: inline-flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--label-2); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.line-swatch { width: 14px; height: 14px; border-radius: 4px; background: var(--fill-strong); }
.line-swatch.doing { background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }
.line-swatch.done { background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green); }
.line-swatch.block { background: var(--red-soft); box-shadow: inset 0 0 0 1px var(--red); }
.add-cols { display: inline-flex; align-items: center; gap: 2px; flex-wrap: wrap; }

/* 端的小标签：名字加负责人 */
.ln em { margin-left: 4px; font-style: normal; color: var(--label-2); }
button.ln { cursor: pointer; transition: filter .12s; }
button.ln:hover { filter: brightness(.92); }

/* 版本树 */
.split { display: flex; gap: 12px; align-items: flex-start; }
.split-main { flex: 1; min-width: 0; }
.tree-panel { flex: none; width: 216px; max-height: calc(100dvh - 186px); overflow: auto; padding: 8px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-card); }
.tree-track { padding: 12px 8px 4px; font-size: 12px; font-weight: 600; color: var(--label-3); }
.tree-empty { padding: 2px 8px 6px; font-size: 13px; color: var(--label-3); }
.tree-row { display: flex; align-items: center; border-radius: 7px; }
.tree-row:hover { background: var(--fill-soft); }
.tree-row.selected { background: var(--accent-soft); }
.tree-row.selected .tree-name { color: var(--accent-text); font-weight: 600; }
.tree-toggle { flex: none; display: grid; place-items: center; width: 20px; height: 28px; color: var(--label-3); }
.tree-toggle svg { width: 12px; height: 12px; transition: transform .18s var(--spring); }
.tree-toggle.open svg { transform: rotate(90deg); }
.tree-toggle-space { flex: none; width: 20px; }
.tree-label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; min-height: 30px; padding: 3px 7px 3px 0; text-align: left; font-size: 14px; }
.tree-icon { flex: none; color: var(--label-3); }
.tree-icon svg { display: block; width: 15px; height: 15px; }
.tree-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 当前版本的标记：版本树、任务分组、发布页、版本详情都用它 */
.current-mark { flex: none; padding: 0 6px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 11px; font-weight: 600; line-height: 16px; white-space: nowrap; }
.tree-count { margin-left: auto; flex: none; font-size: 12px; color: var(--label-3); font-variant-numeric: tabular-nums; }

/* 小菜单 */
.floating {
  position: fixed; z-index: 50; overflow: hidden; border-radius: 14px; background: var(--surface-raised); box-shadow: var(--shadow-float); outline: 1px solid var(--sep);
  animation: pop-in .2s var(--spring);
}
.menu-head { display: flex; flex-direction: column; gap: 1px; padding: 11px 14px 9px; font-size: 13px; box-shadow: inset 0 -1px 0 var(--sep); }
.menu-head strong { font-size: 15px; }
.menu-body { display: flex; flex-direction: column; gap: 10px; padding: 10px; }
.status-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pick { min-height: 34px; border-radius: 8px; background: var(--fill); color: var(--label-2); font-size: 13px; font-weight: 500; }
.pick:hover:not(:disabled) { filter: brightness(.94); }
.pick:disabled { cursor: default; opacity: .6; }
.pick[aria-pressed="true"] { font-weight: 700; box-shadow: inset 0 0 0 1.5px currentColor; }
.pick.doing { background: var(--blue-soft); color: var(--blue); }
.pick.done { background: var(--green-soft); color: var(--green); }
.pick.block { background: var(--red-soft); color: var(--red); }
.group.flat { background: var(--fill-soft); box-shadow: none; border-radius: 10px; }
.group.flat .row { min-height: 38px; padding: 3px 10px; font-size: 14px; }
.group.flat .row-label { font-size: 14px; }
.input.inline-date { width: auto; min-height: 30px; padding: 2px 4px; background: none; text-align: right; font-size: 14px; color: var(--label-2); }
.input.inline-number { width: 72px; min-height: 30px; padding: 2px 4px; background: none; text-align: right; font-size: 14px; }

/* 其他补充 */
.list-desc { margin-top: 2px; font-size: 13px; color: var(--label-2); }
.list-lines { margin-top: 6px; }
.list-title.link { font-weight: 500; }
.tcard { cursor: default; }
.tcard-title { display: block; width: 100%; text-align: left; font-size: 15px; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.tcard-title:hover { color: var(--accent-text); }
.keep-login { display: flex; align-items: center; justify-content: flex-start; gap: 8px; padding: 0 2px; font-size: 14px; color: var(--label-2); cursor: pointer; text-align: left; }
.keep-login input { width: 16px; height: 16px; accent-color: var(--accent); }
.nav-user { color: inherit; text-decoration: none; }
.view-item { justify-content: space-between; }
.view-name { flex: 1; text-align: left; }
.view-name:hover { color: var(--accent-text); }
.tl-detail { margin-top: 4px; font-size: 13px; color: var(--label-3); }
.tl-detail summary { cursor: pointer; }
.tl-detail pre { margin: 4px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--fill-soft); white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; color: var(--label-2); }
.sub-row .input.inline-date { flex: none; width: 118px; }

@media (max-width: 760px) {
  .split { flex-direction: column; }
  .tree-panel.full-mobile { width: 100%; max-height: none; }
  .tree-label { min-height: 40px; }
  .sub-row .input.inline-date { width: 100%; flex-basis: 100%; text-align: right; }
  .status-pick .pick { min-height: 40px; }
  .ln { padding: 3px 8px; font-size: 13px; }
}

/* 拖拽 */
.draggable { cursor: grab; touch-action: pan-x pan-y; -webkit-user-select: none; user-select: none; }
.tcard.dragging { opacity: .35; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 70; pointer-events: none; margin: 0; opacity: .96; box-shadow: var(--shadow-float); cursor: grabbing; }
.col { transition: background-color .15s, box-shadow .15s, opacity .15s; }
.col.drop-ok { box-shadow: inset 0 0 0 1.5px var(--accent-soft); }
.col.drop-over { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.col.drop-no { opacity: .45; }
.col-empty { padding: 16px 8px; text-align: center; font-size: 13px; color: var(--label-3); }
.wide-page { max-width: none; }

/* 状态堆叠条。颜色变量在 styles-theme.css：相邻颜色色弱用户也分得清，文字和图例不靠颜色。 */
.viz-done { background: var(--viz-done); } .viz-accepting { background: var(--viz-accepting); } .viz-testing { background: var(--viz-testing); }
.viz-blocked { background: var(--viz-blocked); } .viz-doing { background: var(--viz-doing); } .viz-pending { background: var(--viz-pending); }
.stack { display: flex; gap: 2px; width: 100%; height: 8px; min-width: 60px; }
.stack i { display: block; min-width: 3px; }
.stack i:first-child { border-radius: 999px 0 0 999px; }
.stack i:last-child { border-radius: 0 999px 999px 0; }
.stack i:only-child { border-radius: 999px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; }

/* 版本详情 */
.version-detail { display: flex; flex-direction: column; gap: 18px; }
.vd-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vd-head h2 { font-size: 21px; font-weight: 700; }
.vd-actions { margin-left: auto; display: flex; gap: 8px; }
.vd-progress { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.vd-progress .vnums { align-items: baseline; }
.vd-progress .btn.plain { margin-left: auto; }
.big { font-size: 26px; font-weight: 700; color: var(--label); }
.list-row.compact { min-height: 46px; padding: 7px 16px; }
.stack-side { width: 46%; gap: 12px; }
.stack-side .tab-num { flex: none; min-width: 48px; text-align: right; }
.line-progress { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 1px; background: var(--sep); }
.line-stat { display: flex; flex-direction: column; gap: 1px; padding: 10px 14px; background: var(--surface); text-align: left; font-size: 13px; color: var(--label-2); }
.line-stat:hover { background: var(--fill-soft); }
.line-stat b { font-size: 16px; color: var(--label); font-variant-numeric: tabular-nums; }
.alert { color: var(--red); }

/* 发布 */
.release-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--sep); }
.release-slot { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--surface); }
.release-platform { font-size: 13px; font-weight: 600; color: var(--label-2); }
.release-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.release-add { min-height: 30px; padding: 2px 8px; border-radius: 7px; color: var(--label-3); font-size: 13px; }
.release-add:hover { background: var(--fill); color: var(--accent-text); }
.release-table td { padding: 8px !important; vertical-align: top; }
.timeline.tight { padding-top: 2px; }

/* 文档 */
.doc-row { min-height: 54px; }
.doc-badge { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--fill); color: var(--label-2); font-size: 11px; font-weight: 700; }
.doc-badge svg { width: 18px; height: 18px; }
.tone-red { background: var(--red-soft); color: var(--red); } .tone-purple { background: var(--purple-soft); color: var(--purple); }
.tone-blue { background: var(--blue-soft); color: var(--blue); } .tone-green { background: var(--green-soft); color: var(--green); }
.tone-orange { background: var(--orange-soft); color: var(--orange); } .tone-teal { background: var(--teal-soft); color: var(--teal); }
.doc-name { color: inherit; text-decoration: none; text-align: left; font-weight: 500; overflow-wrap: anywhere; }
.doc-name:hover { color: var(--accent-text); }
.doc-context { color: var(--accent-text); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-context:hover { text-decoration: underline; }
.upload-progress { display: flex; align-items: center; gap: 10px; padding: 8px 14px; margin-bottom: 8px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; }
.upload-progress .bar { flex: 1; }
.upload-progress .bar i { background: var(--accent); }
dialog.modal.wide { width: min(960px, calc(100vw - 32px)); }
.preview-body { height: min(76vh, 900px); overflow: auto; background: var(--surface); }
.preview-body iframe { display: block; width: 100%; height: 100%; border: 0; }
.preview-body img { display: block; max-width: 100%; margin: 0 auto; }
.preview-text { margin: 0; padding: 18px 22px; white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.6 var(--mono); }
.markdown { padding: 20px 26px 32px; line-height: 1.65; overflow-wrap: anywhere; }
.markdown h2 { font-size: 22px; margin: 18px 0 8px; } .markdown h3 { font-size: 18px; margin: 16px 0 6px; } .markdown h4, .markdown h5, .markdown h6 { font-size: 15px; margin: 14px 0 4px; }
.markdown p, .markdown ul, .markdown ol, .markdown blockquote, .markdown pre { margin: 0 0 10px; }
.markdown blockquote { padding-left: 12px; border-left: 3px solid var(--sep); color: var(--label-2); }
.markdown code { padding: 1px 5px; border-radius: 5px; background: var(--fill); font: 13px var(--mono); }
.markdown pre { padding: 12px 14px; border-radius: 10px; background: var(--fill-soft); overflow: auto; }
.markdown pre code { padding: 0; background: none; }
.markdown a { color: var(--accent-text); }
.md-table { overflow: auto; margin-bottom: 10px; }
.md-table table { min-width: 0; font-size: 14px; }
.md-table th, .md-table td { position: static; padding: 6px 10px; border: 1px solid var(--sep); box-shadow: none; background: none; }
.copy-box { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.copy-box .password-box { flex: 1; margin: 0; font-size: 14px; text-align: left; max-height: 180px; overflow: auto; white-space: pre-wrap; }
/* 设置里的“连接 WorkBuddy” */
.connect-step { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.6; }
.connect-step .copy-box { margin-top: 0; min-width: 0; }
.connect-step .copy-box .password-box { min-width: 0; font-size: 13px; font-weight: 500; }
.connect-step .copy-box .btn { flex: none; }
.connect-field { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 8px; color: var(--label-2); font-size: 13px; }
@media (max-width: 760px) {
  .vd-actions { margin-left: 0; width: 100%; }
  .stack-side { width: 50%; }
  .doc-row { flex-wrap: wrap; }
}

/* 设置 */
.settings-nav { flex: none; width: 216px; padding: 4px 8px 8px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-card); }
.settings-link { display: flex; align-items: center; justify-content: space-between; min-height: 34px; padding: 5px 8px; border-radius: 7px; color: var(--label); text-decoration: none; font-size: 14px; }
.settings-link svg { width: 12px; height: 12px; color: var(--label-3); }
.settings-link:hover { background: var(--fill-soft); }
.settings-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.settings-content { display: flex; flex-direction: column; gap: 22px; max-width: 860px; }
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--fill-strong); transition: background-color .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .22s var(--spring); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled { cursor: default; }
.switch input:disabled + span { opacity: .55; }
.switch input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }
.mono-area { font: 14px/1.6 var(--mono); min-height: 180px; }
.check-row { justify-content: flex-start; cursor: pointer; }
.check-row input { width: 17px; height: 17px; accent-color: var(--accent); }
.group-names { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.position-group + .position-group { margin-top: 4px; }
.perm-table { min-width: 620px; font-size: 14px; }
.perm-table th, .perm-table td { padding: 9px 12px; }
.perm-table th:not(:first-child), .perm-table td:not(:first-child) { text-align: center; width: 92px; }
.type-name { flex: 1; min-width: 0; min-height: 30px; }
.small-toggle { min-height: 28px !important; width: 30px; padding: 0 !important; font-size: 13px !important; }
.week-pick { gap: 4px; flex-wrap: wrap; }
.setup-card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; font-size: 14px; }
.setup-card ol { margin: 0; padding-left: 20px; line-height: 1.8; }
.setup-card p { margin: 0; }
.setup-card .password-box { font-size: 13px; font-weight: 500; }
.preview-table { min-width: 640px; font-size: 13px; }
.preview-table th, .preview-table td { padding: 7px 10px; white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.more-link { color: inherit; text-decoration: none; }
.more-icon { display: grid; }
.more-icon svg { width: 21px; height: 21px; }
.more-link .row-value svg { width: 13px; height: 13px; color: var(--label-3); }
.nav-link { color: var(--label); }

/* 统计 */
.stats-body { display: flex; flex-direction: column; gap: 20px; transition: opacity .15s; }
.stats-body.refreshing { opacity: .6; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { padding: 12px 15px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-card); }
.kpi-label { font-size: 13px; color: var(--label-2); }
.kpi-value { margin-top: 2px; font-size: 27px; font-weight: 600; line-height: 1.2; }
.kpi-value.alert { color: var(--red); }
.kpi-unit { margin-left: 3px; font-size: 13px; font-weight: 400; color: var(--label-2); }
.chart-card { display: flex; flex-direction: column; gap: 4px; padding: 13px 16px; }
.chart-legend { padding-bottom: 8px; }
.viz-row { display: grid; grid-template-columns: 170px minmax(80px, 1fr) 118px 70px; align-items: center; gap: 12px; width: 100%; min-height: 34px; padding: 3px 6px; margin: 0 -6px; border-radius: 7px; text-align: left; font-size: 14px; }
button.viz-row:hover { background: var(--fill-soft); }
.viz-row.static { cursor: default; }
.viz-num { font-size: 13px; color: var(--label-2); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.viz-flag { font-size: 13px; color: var(--red); white-space: nowrap; }
.slow-bar { display: block; }
.hbar { display: block; flex: 1; height: 8px; border-radius: 999px; background: var(--fill-soft); overflow: hidden; }
.hbar i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--viz-1); }
.bar-cell { display: flex; align-items: center; gap: 8px; }
.bar-cell .hbar { min-width: 90px; }
.stats-table { min-width: 760px; font-size: 14px; }
.stats-table th, .stats-table td { padding: 8px 10px; white-space: nowrap; }
.stats-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.stats-table .alert { color: var(--red); font-weight: 600; }
.stats-table .wide-col { width: 28%; min-width: 180px; }
.data-table { margin-top: 6px; font-size: 13px; color: var(--label-3); }
.data-table summary { cursor: pointer; padding: 3px 0; }
.chart { position: relative; }
.chart svg { display: block; touch-action: pan-y; }
.chart .grid { stroke: var(--sep); stroke-width: 1; }
.chart .axis { fill: var(--label-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .crosshair { stroke: var(--label-3); stroke-width: 1; }
.chart .series { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .series.viz-1, .line-key.viz-1 { stroke: var(--viz-1); background: var(--viz-1); }
.chart .series.viz-2, .line-key.viz-2 { stroke: var(--viz-2); background: var(--viz-2); }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .dot.viz-1 { fill: var(--viz-1); } .chart .dot.viz-2 { fill: var(--viz-2); }
.chart .end-label { fill: var(--label); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.line-key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.chart-tip { position: absolute; top: 8px; padding: 7px 10px; border-radius: 9px; background: var(--surface-raised); box-shadow: var(--shadow-float); outline: 1px solid var(--sep); font-size: 13px; pointer-events: none; white-space: nowrap; }

@media (max-width: 760px) {
  .settings-nav { width: 100%; }
  .settings-link { min-height: 44px; }
  .settings-content { max-width: none; }
  .viz-row { grid-template-columns: 96px minmax(60px, 1fr) 62px; }
  .viz-row .viz-num { display: block; font-size: 12px; }
  .viz-row .viz-flag { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 绑定二维码：二维码背景固定白色，深色模式下也要扫得出来 */

/* 整列都能放卡片，空列也一样高 */
.board { align-items: stretch; }
.col { min-height: calc(100dvh - 190px); }
.col-body { flex: 1; }
@media (max-width: 760px) { .col { min-height: 60vh; } }

/* 日历 */
.cal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; }
.cal-title { font-size: 16px; }
.cal-nav { margin-left: auto; display: flex; gap: 2px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-week { box-shadow: inset 0 1px 0 var(--sep), inset 0 -1px 0 var(--sep); }
.cal-weekday { padding: 6px 8px; font-size: 12px; color: var(--label-3); }
.cal-cell { min-height: 112px; padding: 4px 5px 6px; display: flex; flex-direction: column; gap: 2px; box-shadow: inset -1px -1px 0 var(--sep); min-width: 0; transition: background-color .12s; }
.cal-cell.outside { background: var(--fill-soft); }
.cal-cell.outside .cal-day { color: var(--label-3); }
.cal-cell.drop-over { background: var(--accent-soft); }
.cal-day { padding: 1px 3px; font-size: 13px; font-variant-numeric: tabular-nums; align-self: flex-start; }
.cal-cell.today .cal-day { min-width: 22px; text-align: center; border-radius: 999px; background: var(--danger-fill); color: #fff; font-weight: 600; }
.cal-task { display: flex; align-items: center; gap: 4px; width: 100%; min-height: 22px; padding: 1px 5px; border-radius: 5px; background: var(--fill-soft); text-align: left; font-size: 13px; }
.cal-task:hover { background: var(--fill); }
.cal-task.overdue { background: var(--red-soft); color: var(--red); }
.cal-task.done { opacity: .55; }
.cal-task.dragging { opacity: .35; }
.cal-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--label-3); }
.cal-dot.prio-p0 { background: var(--viz-blocked); }
.cal-dot.prio-p1 { background: var(--viz-accepting); }
.cal-more { align-self: flex-start; padding: 0 5px; font-size: 12px; color: var(--accent-text); }

/* 时间线 */
.timeline-view { display: flex; flex-direction: column; }
.tv-scroll { overflow: auto; max-height: calc(100dvh - 232px); }
.tv-inner { position: relative; }
.tv-header { position: sticky; top: 0; z-index: 3; display: flex; background: var(--surface); box-shadow: inset 0 -1px 0 var(--sep); }
.tv-name-head { position: sticky; left: 0; z-index: 4; flex: none; width: 260px; padding: 8px 14px; background: var(--surface); box-shadow: 1px 0 0 var(--sep); font-size: 13px; color: var(--label-3); }
.tv-months { display: flex; }
.tv-months div { flex: none; padding: 5px 6px 2px; font-size: 12px; font-weight: 600; color: var(--label-2); overflow: hidden; white-space: nowrap; }
.tv-days { display: flex; }
.tv-days div { flex: none; padding-bottom: 4px; text-align: center; font-size: 11px; color: var(--label-3); font-variant-numeric: tabular-nums; }
.tv-days .weekend { background: var(--fill-soft); }
.tv-days .today { color: #fff; }
.tv-days .today { background: var(--danger-fill); border-radius: 6px; font-weight: 600; }
.tv-row { display: flex; align-items: stretch; box-shadow: inset 0 -1px 0 var(--sep); }
.tv-name { position: sticky; left: 0; z-index: 2; flex: none; display: flex; align-items: center; width: 260px; min-height: 36px; padding: 4px 14px; background: var(--surface); box-shadow: 1px 0 0 var(--sep); text-align: left; font-size: 14px; font-weight: 500; }
.tv-name:hover { color: var(--accent-text); }
.tv-track { position: relative; flex: none; }
.tv-today { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--danger-fill); opacity: .55; }
.tv-bar { position: absolute; top: 10px; height: 16px; border-radius: 5px; transition: filter .12s; }
.tv-bar:hover { filter: brightness(1.08); }
.tv-bar.overdue { box-shadow: 0 0 0 1.5px var(--red); }
.tv-label { position: absolute; top: 6px; white-space: nowrap; }

@media (max-width: 760px) {
  .head-tools { flex-wrap: wrap; }
  .cal-cell { min-height: 74px; padding: 2px; }
  .cal-task { min-height: 20px; padding: 1px 3px; font-size: 11px; }
  .cal-dot { display: none; }
  .tv-name, .tv-name-head { width: 130px; font-size: 13px; padding-inline: 8px; }
  .tv-scroll { max-height: calc(100dvh - 300px); }
}

/* 分段控件不换行；手机上独占一行 */
.segmented button { white-space: nowrap; }
@media (max-width: 760px) {
  .head-tools .segmented { flex: 1 1 100%; }
  .head-tools .select.pill { flex: 1; }
  .head-tools .btn.primary { flex: none; }
  .floating { max-width: calc(100vw - 16px); }
}

/* 发布：平台 → 渠道 */
.release-version { gap: 0; }
.release-title { align-items: center; flex-wrap: wrap; }
.release-name { font-size: 16px; font-weight: 700; color: var(--label); }
.release-name:hover { color: var(--accent-text); }
.platform-row { position: relative; }
.platform-row + .platform-row { box-shadow: inset 0 1px 0 var(--sep); }
.platform-head { display: flex; align-items: center; gap: 10px; min-height: 30px; flex-wrap: wrap; padding: 6px 14px; }
.platform-head strong { font-size: 14px; }
.platform-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.select.pill.mini { min-height: 26px; padding: 2px 22px 2px 9px; font-size: 13px; }
.channel-add { min-height: 28px; padding: 2px 6px; border-radius: 7px; color: var(--label-2); font-size: 13px; }
.channel-add:hover { background: var(--fill); color: var(--accent-text); }

/* 文档按版本 */
.docs-main { display: flex; flex-direction: column; gap: 14px; }
.doc-context.strong { font-size: 14px; font-weight: 600; color: var(--label); max-width: 520px; }
.doc-context.strong:hover { color: var(--accent-text); }
.preview-video { display: block; width: 100%; max-height: 100%; background: #000; }
.sheet-nav .left { gap: 12px; }
a.nav-btn { text-decoration: none; }
@media (max-width: 760px) {
  /* “全部改成”和“…”跟平台名同一行靠右，放不下时一起换行，“…”不单独占一行 */
  .platform-actions { flex-wrap: nowrap; }
}

/* 主题开关 */
.nav-theme { padding: 2px 4px 8px; }
.theme-switch { display: flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--fill); }
.theme-switch button { flex: 1; display: grid; place-items: center; height: 26px; border-radius: 7px; color: var(--label-2); transition: background-color .15s; }
.theme-switch button svg { width: 15px; height: 15px; }
.theme-switch button:hover { color: var(--label); }
.theme-switch button[aria-pressed="true"] { background: var(--thumb); color: var(--label); box-shadow: var(--shadow-thumb); }
.theme-mobile { display: none; }

/* ---------- 拖拽 ---------- */
body.is-dragging, body.is-dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
.drag-pill {
  max-width: 320px; padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 500;
  background: var(--surface); color: var(--label); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drop-line { position: fixed; left: 0; top: 0; z-index: 69; height: 2px; border-radius: 2px; background: var(--accent); pointer-events: none; }
.drop-line::before { content: ""; position: absolute; left: -3px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.tree-row.drop-hover, .tree-track.drop-hover { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); border-radius: 7px; }
.tree-row.drop-deny { opacity: .5; }
.tree-track.drop-hover { color: var(--accent-text); }
tbody.drop-hover .group-row td { background: var(--accent-soft) !important; box-shadow: inset 0 0 0 1.5px var(--accent); }
tbody.drop-deny .group-row td { opacity: .5; }
tr.row-dragging td { opacity: .4; }
.tree-row.draggable { touch-action: pan-y; }
.grip {
  position: absolute; left: 3px; top: 50%; width: 8px; height: 14px; margin-top: -7px; opacity: 0; transition: opacity .12s;
  background-image: radial-gradient(circle, var(--label-3) 1.1px, transparent 1.3px); background-size: 4px 5px; pointer-events: none;
}
table.matrix tr:hover .grip { opacity: 1; }
table.matrix td.name.draggable .link-btn { cursor: inherit; }
table.matrix td.name.draggable .link-btn:hover { cursor: pointer; }
.drag-hint { font-size: 12px; }
.tv-bar { cursor: pointer; }
.tv-bar.can-drag { cursor: grab; touch-action: pan-y; }
.tv-bar.resizing { filter: brightness(1.1); box-shadow: 0 0 0 2px var(--accent); z-index: 2; }
.tv-handle { position: absolute; top: -2px; bottom: -2px; width: 8px; cursor: ew-resize; }
.tv-handle.left { left: -2px; }
.tv-handle.right { right: -2px; }

/* ---------- 成员与权限 ---------- */
.member-groups .tree-row { padding-left: 4px; }
.member-groups .tree-row.drop-hover { background: var(--accent-soft); }
.new-group { padding: 8px 4px 2px; }
.new-group .input { min-height: 30px; font-size: 14px; }
.tree-empty { padding: 4px 8px; font-size: 13px; color: var(--label-3); }
.member-filters { margin-bottom: 10px; }
.member-add { margin-left: auto; display: flex; gap: 8px; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; padding: 8px 12px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; }
.bulk-bar strong { color: var(--accent-text); margin-right: 4px; }
.group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 0 2px; }
.group-head .input { max-width: 260px; font-size: 16px; }
table.member-table { width: 100%; min-width: 860px; font-size: 14px; }
table.member-table th { padding: 9px 8px; text-align: left; white-space: nowrap; }
table.member-table td { padding: 6px 8px; vertical-align: middle; }
table.member-table tr.inactive td { opacity: .55; }
table.member-table tr.selected td { background: var(--accent-soft); }
table.member-table .check { width: 34px; padding-left: 14px; }
table.member-table .check input { width: 16px; height: 16px; accent-color: var(--accent); }
td.member-name { position: relative; min-width: 180px; padding-left: 14px !important; }
td.member-name > .av { vertical-align: middle; }
td.member-name { display: flex; align-items: center; gap: 8px; }
.member-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
table.member-table tr:hover .grip { opacity: 1; }
.inline-edit { min-height: 26px; width: 100%; min-width: 96px; padding: 2px 6px; margin-left: -6px; background: transparent; border-radius: 6px; font-size: inherit; }
.inline-edit:hover:not(:disabled) { background: var(--fill-soft); }
.inline-edit:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--accent); outline: none; }
.inline-edit:disabled { color: inherit; opacity: 1; }
.inline-edit.strong { font-weight: 600; }
.group-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.group-chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; background: var(--fill); font-size: 13px; white-space: nowrap; }
.group-chip button { color: var(--label-3); font-size: 13px; line-height: 1; padding: 0 1px; }
.group-chip button:hover { color: var(--red); }
.select.add-group { max-width: 92px; color: var(--label-3); }
.member-actions { text-align: right; }
.new-role { align-items: center; gap: 6px; }
.new-role .input { width: 180px; min-height: 30px; font-size: 14px; }
.perm-table th { vertical-align: top; }
.perm-table .role-name { width: 76px; min-width: 0; margin: 0; text-align: center; font-weight: 600; }
.role-count { font-weight: 400; }
.sort-row { position: relative; }
.grip-static { flex: none; width: 10px; height: 16px; margin-right: 8px; opacity: .6; background-image: radial-gradient(circle, var(--label-3) 1.1px, transparent 1.3px); background-size: 4px 5px; }
@media (max-width: 720px) {
  .member-groups { width: 100%; max-height: none; }
  .member-add { margin-left: 0; }
  table.member-table { min-width: 760px; }
  td.member-name { min-width: 150px; }
}

/* ---------- 成员表修正 ---------- */
td.member-name { display: table-cell; }
.member-who { display: flex; align-items: center; gap: 8px; }
table.member-table th:nth-child(5), table.member-table td:nth-child(5) { min-width: 178px; }
.group-chips { flex-wrap: nowrap; }
.select.add-group { width: auto; flex: none; }

/* ---------- 在线文档 ---------- */
.doc-online { background: var(--accent-soft); color: var(--accent-text); }
.article-read { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-card); padding: 18px 26px 28px; }
.article-sheet .article-read { box-shadow: none; }
.article-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; }
.article-head h2 { flex: 1 1 280px; margin: 0; font-size: 24px; line-height: 1.3; overflow-wrap: anywhere; }
.article-actions { display: flex; gap: 8px; flex: none; }
.article-meta { margin: 6px 0 12px; }
.article-content { padding: 6px 0 0; max-width: 760px; }
.article-snippet { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.markdown img { display: block; max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; }
.md-image { display: inline-block; max-width: 100%; }
.md-todo { list-style: none; margin-left: -18px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; font-size: 13px; color: var(--label-3); }
.crumbs a { color: var(--label-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent-text); }
.crumbs i { font-style: normal; margin-right: 4px; color: var(--label-3); }
.kb-back-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; min-width: 0; }
.kb-back-row .crumbs { margin-bottom: 0; min-width: 0; }
.kb-back { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px 4px 6px; border: 0; border-radius: 8px; background: transparent; color: var(--accent-text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.kb-back:hover { background: var(--fill-soft); }
.kb-back span { font-size: 18px; line-height: 1; }
.article-editor { display: flex; flex-direction: column; min-height: calc(100dvh - 160px); background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-card); overflow: hidden; }
.article-sheet .article-editor { min-height: 100%; box-shadow: none; border-radius: 0; }
.editor-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--sep); }
.article-title-input { flex: 1; min-width: 0; font-size: 20px; font-weight: 600; }
.save-state { flex: none; font-size: 13px; color: var(--label-3); }
.save-state.failed, .save-state.conflict { color: var(--red); }
.conflict-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 16px; background: var(--fill-soft); color: var(--red); font-size: 14px; }
.conflict-bar span { flex: 1 1 240px; }
.editor-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 12px; border-bottom: 1px solid var(--sep); }
.tool-btn { min-height: 28px; padding: 3px 9px; border-radius: 6px; font-size: 13px; color: var(--label-2); }
.tool-btn:hover { background: var(--fill-soft); color: var(--label); }
.editor-pane-switch { display: none; margin-left: auto; }
.editor-panes { flex: 1; display: grid; grid-template-columns: 1fr 1fr; min-height: 0; }
.article-body-input { width: 100%; min-height: 460px; height: 100%; padding: 16px 18px; border: 0; border-right: 1px solid var(--sep); border-radius: 0; background: transparent; resize: none; font: 14px/1.65 var(--mono); }
.article-body-input:focus { outline: none; }
.article-preview { min-width: 0; padding: 16px 22px 28px; overflow: auto; }
dialog.article-sheet { width: min(1180px, 96vw); max-width: none; height: 92dvh; max-height: none; padding: 0; }
dialog.article-sheet[open] { display: flex; flex-direction: column; }
.article-scroll { flex: 1; min-height: 0; overflow: auto; }
.revision-body { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.revision-list { flex: none; width: 200px; padding: 8px; overflow: auto; border-right: 1px solid var(--sep); }
.revision-item { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; font-size: 14px; }
.revision-item:hover { background: var(--fill-soft); }
.revision-item[aria-current="true"] { background: var(--accent-soft); }
.revision-content { flex: 1; min-width: 0; overflow: auto; }

/* ---------- 知识库 ---------- */
.kb-search { margin-bottom: 10px; }
.kb-main { display: flex; flex-direction: column; gap: 12px; }
.kb-list.drop-hover { box-shadow: var(--shadow-card); }
.kb-folder-row { min-height: 46px; gap: 8px; }
.kb-folder-row.drop-hover { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.kb-folder-row.drop-deny { opacity: .5; }
.kb-folder-head { padding: 0 2px; }
.kb-folder-title { display: flex; align-items: center; gap: 8px; }
.kb-folder-title .input { max-width: 320px; font-size: 17px; }
@media (max-width: 720px) {
  .article-read { padding: 14px 16px 20px; }
  .article-head h2 { font-size: 20px; }
  .editor-pane-switch { display: inline-flex; }
  .editor-panes { display: block; }
  .editor-panes[data-pane="edit"] .article-preview { display: none; }
  .editor-panes[data-pane="preview"] .article-body-input { display: none; }
  .article-body-input { border-right: 0; min-height: 60dvh; }
  dialog.article-sheet { width: 100vw; height: 100dvh; border-radius: 0; }
  .revision-body { flex-direction: column; }
  .revision-list { width: 100%; max-height: 180px; border-right: 0; border-bottom: 1px solid var(--sep); }
}
.kb-folder-title .btn { margin-left: auto; }
.load-more { padding: 10px; text-align: center; }
.col-more { width: 100%; }
@media (max-width: 720px) {
  .split { align-items: stretch; }
  .split-main { width: 100%; }
}

/* ---------- 开发 → 测试 ---------- */
.c-purple { background: var(--purple-soft); color: var(--purple); }
.tint-purple { background-color: var(--purple-soft) !important; color: var(--purple) !important; }
.line-cell.ready, .ln.ready { background: var(--purple-soft); color: var(--purple); }
.line-cell.waiting, .ln.waiting { background: none; color: var(--label-2); box-shadow: inset 0 0 0 1px var(--sep); }
.line-swatch.ready { background: var(--purple-soft); box-shadow: inset 0 0 0 1px var(--purple); }
.line-swatch.waiting { background: none; box-shadow: inset 0 0 0 1px var(--label-3); }
.wait-note { margin: 0 0 8px; font-size: 13px; color: var(--label-2); }
.dim-row .list-title, .dim-row .list-desc { color: var(--label-2); }
.select.qa-owner { max-width: 130px; }
