/* 字体:自托管 Fira Sans / Fira Code(SIL OFL),中文回落系统字体 */
@font-face { font-family: "Fira Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/fira-sans-400.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fonts/fira-sans-500.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/fira-sans-600.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/fira-sans-700.woff2") format("woff2"); }
@font-face { font-family: "Fira Code"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/fira-code-400.woff2") format("woff2"); }
@font-face { font-family: "Fira Code"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fonts/fira-code-500.woff2") format("woff2"); }
@font-face { font-family: "Fira Code"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/fira-code-600.woff2") format("woff2"); }

/* 默认:深色科技主题;浅色通过 <html data-theme="light"> 启用 */
:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #111831;
  --panel-2: #172041;
  --text: #e6ebfa;
  --muted: #8d99b8;
  --line: #243056;
  --accent: #4da3ff;
  --accent-2: #22d3ee;
  --accent-weak: rgba(77, 163, 255, .14);
  --danger: #fb7185;
  --danger-weak: rgba(251, 113, 133, .14);
  --warn: #fbbf24;
  --warn-weak: rgba(251, 191, 36, .14);
  --ok: #34d399;
  --ok-weak: rgba(52, 211, 153, .14);
  --on-accent: #04101f;
  --on-danger: #2a0710;
  --grad: linear-gradient(135deg, #4da3ff, #22d3ee);
  --glow: 0 0 0 1px rgba(77, 163, 255, .4), 0 0 18px rgba(77, 163, 255, .2);
  --glow-sm: 0 0 8px rgba(77, 163, 255, .55);
  --ring: 0 0 0 3px rgba(77, 163, 255, .28);
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .6);
  --overlay: rgba(3, 6, 16, .66);
  --topbar-bg: rgba(11, 16, 32, .78);
  --toast-bg: #172041;
  --toast-text: #e6ebfa;
  --page-bg:
    radial-gradient(900px 480px at 85% -8%, rgba(77, 163, 255, .12), transparent 70%),
    radial-gradient(700px 420px at -5% 105%, rgba(34, 211, 238, .08), transparent 70%),
    #0b1020;
  --grid: linear-gradient(rgba(77, 163, 255, .06) 1px, transparent 1px) 0 0 / 32px 32px,
          linear-gradient(90deg, rgba(77, 163, 255, .06) 1px, transparent 1px) 0 0 / 32px 32px;
  --s0: #94a3b8; /* 待确认 */
  --s1: #a78bfa; /* 未启动 */
  --s2: #4da3ff; /* 研发中 */
  --s3: #fbbf24; /* 生产中 */
  --s4: #34d399; /* 已入库 */
  --s5: #64748b; /* 暂停 */
  --s6: #f472b6; /* 需求中(软件) */
  --s7: #22d3ee; /* 设计中(软件) */
  --s8: #fb923c; /* 测试中(软件) */
  --s9: #818cf8; /* 开发中(软件) */
  --s10: #2dd4bf; /* 已发布(软件) */
  --radius: 10px;
  --mono: "Fira Code", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-family: "Fira Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #f9fafb;
  --text: #1c2230;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2f6fed;
  --accent-2: #2f6fed;
  --accent-weak: #e9f0fe;
  --danger: #d23f3f;
  --danger-weak: #fdecec;
  --warn: #b26b00;
  --warn-weak: #fdf2de;
  --ok: #18865a;
  --ok-weak: #e3f5ec;
  --on-accent: #ffffff;
  --on-danger: #ffffff;
  --grad: linear-gradient(135deg, #2f6fed, #2f6fed);
  --glow: none;
  --glow-sm: none;
  --ring: 0 0 0 3px #e9f0fe;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --overlay: rgba(15, 18, 25, .35);
  --topbar-bg: #ffffff;
  --toast-bg: #1f2937;
  --toast-text: #ffffff;
  --page-bg: #f5f6f8;
  --grid: none;
  --s2: #3b82f6;
  --s3: #f59e0b;
  --s4: #10b981;
  --s5: #cbd5e1;
  --s6: #ec4899;
  --s7: #06b6d4;
  --s8: #f97316;
  --s9: #6366f1;
  --s10: #14b8a6;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; }
/* 背景光晕放在固定层上,滚动时不重绘整页背景(iOS 也不支持 background-attachment: fixed) */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--page-bg); pointer-events: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-weak); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.3; }
.muted { color: var(--muted); }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }

/* ---------- 控件 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer;
  white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn { transition: border-color .18s, background-color .18s, box-shadow .18s, color .18s; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { box-shadow: var(--glow); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.icon-btn { width: 36px; height: 36px; padding: 0; justify-content: center; color: var(--muted); }
.btn.icon-btn:hover { color: var(--text); }
.theme-btn svg { animation: theme-pop .18s ease-out; }
@keyframes theme-pop { from { opacity: 0; transform: rotate(-30deg) scale(.8); } to { opacity: 1; transform: none; } }

.input, select.input, textarea.input {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); outline: none;
}
textarea.input { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }
.input { transition: border-color .18s, box-shadow .18s; }
.input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.input:disabled { background: var(--panel-2); color: var(--text); opacity: .85; cursor: not-allowed; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 32px; cursor: pointer; color: var(--muted); transition: background-color .18s, color .18s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent-weak); color: var(--accent); font-weight: 600; }

.chip { display: inline-block; padding: 0 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; color: var(--muted); white-space: nowrap; }
/* 筛选栏里的附加条件,点 ✕ 去掉 */
.filter-chip { display: inline-flex; align-items: center; gap: 4px; align-self: center; color: var(--accent); border-color: var(--accent); }
.filter-chip button { padding: 0 2px; border: 0; background: none; color: inherit; cursor: pointer; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; background: var(--panel-2); color: var(--muted); }
.badge.danger { background: var(--danger-weak); color: var(--danger); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }
.badge.ok { background: var(--ok-weak); color: var(--ok); }
.badge.accent { background: var(--accent-weak); color: var(--accent); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.s0 { background: var(--s0); } .s1 { background: var(--s1); } .s2 { background: var(--s2); }
.s3 { background: var(--s3); } .s4 { background: var(--s4); } .s5 { background: var(--s5); }
.s6 { background: var(--s6); } .s7 { background: var(--s7); } .s8 { background: var(--s8); }
.s9 { background: var(--s9); } .s10 { background: var(--s10); }

.bar { height: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--grad); border-radius: 999px; box-shadow: var(--glow-sm); }
.bar.ok > i { background: var(--ok); box-shadow: none; }

/* ---------- 登录 ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--grid); }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow), var(--glow); }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card form { display: grid; gap: 12px; margin-top: 20px; }
.auth-card label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.auth-card .btn.primary { justify-content: center; height: 38px; }
.auth-switch { margin-top: 16px; text-align: center; font-size: 13px; }
.auth-switch button { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--accent-weak); color: var(--text); font-size: 13px; }
.notice.error { background: var(--danger-weak); color: var(--danger); }

/* ---------- 框架 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 56px; background: var(--topbar-bg); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px) saturate(140%); backdrop-filter: blur(12px) saturate(140%);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--grad); display: grid; place-items: center; box-shadow: var(--glow-sm); }
.brand-mark i { display: block; width: 3px; height: 11px; background: var(--on-accent); border-radius: 2px; box-shadow: 5px 3px 0 var(--on-accent), -5px -2px 0 var(--on-accent); }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs a {
  position: relative; padding: 0 12px; height: 56px; display: flex; align-items: center; gap: 6px;
  color: var(--muted); text-decoration: none; white-space: nowrap; cursor: pointer; transition: color .18s;
}
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); font-weight: 600; }
.tabs a.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; background: var(--grad); border-radius: 2px; box-shadow: var(--glow-sm); }
.tabs .num, .msg-btn .num { background: var(--danger); color: var(--on-danger); font-weight: 600; border-radius: 999px; font-size: 11px; padding: 0 6px; line-height: 17px; }
/* 顶栏「留言」:有回复你的显示数字,只有别的未读时显示小圆点 */
.msg-btn { display: inline-flex; align-items: center; gap: 5px; }
.msg-btn .dot-new { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.who { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.who-name { font-weight: 600; }
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: 40px; min-width: 160px; background: var(--panel); z-index: 30; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; display: none;
}
.menu.open .menu-pop { display: block; }
.menu-pop button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; transition: background-color .18s; }
.menu-pop button:hover { background: var(--panel-2); }

main { padding: 20px; max-width: 1600px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h2 { font-size: 20px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 120px; }
.filters .search { min-width: 200px; flex: 0 1 260px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; color: var(--muted); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 15px; }
.panel-body { padding: 12px 16px; }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* ---------- 总览 ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 2px; background: var(--grad); opacity: .55; }
.tile .k { color: var(--muted); font-size: 13px; }
.tile .v { font-family: var(--mono); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 4px; }
.tile .s { color: var(--muted); font-size: 12px; }
.tile.danger .v { color: var(--danger); }
.tile.warn .v { color: var(--warn); }

.stagebar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; }
.stagebar > i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; }
.legend button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer; padding: 2px 0; color: var(--text); }
.legend b { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; }

.span-all { grid-column: 1 / -1; }
.grid2 > * { min-width: 0; }
.owner-section { margin-bottom: 16px; }
.section-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.section-head h3 { font-size: 15px; }
.owner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.owner-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; cursor: pointer; min-width: 0; transition: border-color .18s, box-shadow .18s; }
.owner-card:hover, .owner-card:focus-visible { border-color: var(--accent); box-shadow: var(--glow); }
.owner-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.owner-name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owner-total { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.owner-total b { font-family: var(--mono); font-size: 18px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.stagebar.sm { height: 8px; }
.legend.sm { gap: 4px 12px; margin-top: 10px; font-size: 12px; }
.legend.sm > span { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.legend.sm b { color: var(--text); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-top: 16px; }
.list-rows { list-style: none; margin: 0; padding: 0; }
.list-rows li { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-top: 1px solid var(--line); cursor: pointer; }
.list-rows li:first-child { border-top: 0; }
.list-rows li { transition: background-color .18s; }
.list-rows li:hover { background: var(--panel-2); }
.list-rows .main { flex: 1; min-width: 0; }
.list-rows .title { font-weight: 600; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list-rows .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-rows .more { cursor: default; color: var(--muted); font-size: 12px; justify-content: center; }
.list-rows .more:hover { background: none; }

/* ---------- 看板 ---------- */
.board { display: grid; gap: 16px; align-content: start; }
.stage { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .18s, background-color .18s, box-shadow .18s; }
.stage-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px 16px; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; font-size: 15px; text-align: left; cursor: pointer; border-radius: var(--radius); transition: background-color .18s; }
.stage-head:hover:not([aria-disabled]) { background: var(--panel); }
.stage-head[aria-disabled] { cursor: default; }
.stage-head .count { font-family: var(--mono); font-size: 12px; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; line-height: 20px; }
.stage-head .chev { margin-left: auto; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin-top: -3px; transition: transform .18s; }
.stage.collapsed .chev { transform: rotate(-45deg); margin-top: 0; }
.stage-head[aria-disabled] .chev { visibility: hidden; }
.stage.collapsed .stage-body { display: none; }
.stage-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; padding: 0 12px 12px; }
.stage-empty { padding: 0 16px 12px; color: var(--muted); font-size: 13px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer;
  box-shadow: var(--shadow); display: grid; gap: 6px; outline: none; min-width: 0; overflow-wrap: anywhere;
}
.card { transition: border-color .18s, box-shadow .18s; }
.card:hover, .card:focus-visible { border-color: var(--accent); box-shadow: var(--glow); }
.card.mine { border-left: 3px solid var(--accent); }
.dot.brand { background: var(--accent); }
.stage-tag { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 12px; color: var(--muted); }
.stage-tag select { border: 0; background: transparent; color: inherit; font: inherit; padding: 0 2px; cursor: pointer; border-radius: 4px; }
.stage-tag select:hover, .stage-tag select:focus-visible { color: var(--text); background: var(--panel); }
.stage-tag select option { color: initial; }
.card-top { display: flex; align-items: flex-start; gap: 6px; }
.card-top strong { min-width: 0; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-top .chip { margin-left: auto; flex: none; }
.card-top .chip + .chip { margin-left: 0; }
.chip.sw { color: var(--s7); border-color: currentColor; }
.card-meta { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-text { margin: 0; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.card-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; min-width: 0; }
.card-foot .time { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 11px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { position: sticky; top: 0; background: var(--panel-2); font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; cursor: pointer; user-select: none; }
table.data th.sorted { color: var(--text); }
table.data tbody tr { cursor: pointer; }
table.data tbody tr td { transition: background-color .18s; }
table.data tbody tr:hover td { background: var(--panel-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.num { font-family: var(--mono); font-size: 13px; }
table.data .clip { max-width: 320px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
table.data .group td { background: var(--panel-2); font-weight: 600; cursor: default; }
table.data .group:hover td { background: var(--panel-2); }
table.data .cell-input { height: 28px; width: 100px; padding: 0 6px; text-align: right; }
table.data select.cell-input { width: 92px; text-align: left; }
table.data .progress-cell { display: flex; align-items: center; gap: 8px; min-width: 130px; }
table.data .progress-cell .bar { flex: 1; }

/* ---------- 抽屉 ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--panel); z-index: 41;
  box-shadow: var(--shadow-lg); border-left: 1px solid var(--line); display: flex; flex-direction: column;
}
.drawer-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 18px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
.drawer-foot { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form .f { display: grid; gap: 4px; align-content: start; }
.form .f.wide { grid-column: 1 / -1; }
.form label { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.form .hint { font-size: 12px; color: var(--muted); }
.lock { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.section { margin-top: 24px; }
.table-scroll { overflow-x: auto; }
.sku-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sku-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 4px 6px; white-space: nowrap; }
.sku-table td { padding: 3px 4px; vertical-align: middle; }
.sku-table .input { height: 30px; padding: 0 8px; width: 100%; min-width: 64px; }
.sku-table td.n input { text-align: right; }
.sku-table select.input { min-width: 92px; }
.sku-table input[type=date].input { min-width: 130px; }
.sku-table td.act { width: 1%; white-space: nowrap; text-align: right; }
.list-rows .more.link { cursor: pointer; color: var(--accent); }
.list-rows .more.link:hover { text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.sku-sum { color: var(--muted); font-size: 12px; margin-top: 8px; }
.sku-wrap .notice { margin-top: 8px; }
.sku-add { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.4fr auto; gap: 6px; margin-top: 10px; align-items: end; }
.sku-add .sku-add-f { display: grid; gap: 4px; min-width: 0; align-items: stretch; color: var(--text); } /* 嵌在详情表单里时,不跟 .form label 变成灰色小字 */
.sku-add .sku-add-f > span { font-size: 13px; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
.sku-add .input { height: 30px; padding: 0 8px; min-width: 0; }
.sku-add.version-add { grid-template-columns: 1.2fr 1fr 1fr 1fr 1.4fr auto; }
.sku-add.part-add { grid-template-columns: 2fr 1fr 1fr auto; }
.sku-add.dev-add { grid-template-columns: 1fr 1.4fr auto; }
.sku-add[hidden] { display: none; }
/* 夹在表单网格中间的子表(硬件项目的配件/辅料) */
.form > .section { grid-column: 1 / -1; margin: 4px 0; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
@media (max-width: 640px) { .sku-add, .sku-add.version-add, .sku-add.part-add, .sku-add.dev-add { grid-template-columns: 1fr 1fr; } .sku-add .btn { grid-column: 1 / -1; } }
/* 项目页「全部」时按类型分块;总览阶段分布按类型分条 */
.type-block + .type-block { margin-top: 24px; }
.stage-block + .stage-block { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.stage-block-head { margin-bottom: 8px; }
.unassigned-row { margin: 16px -8px 0; padding: 12px 8px 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); cursor: pointer; }
.unassigned-row .owner-head { margin-bottom: 8px; }
.unassigned-row .owner-total { margin-left: 0; }
.unassigned-row .more-link { margin-left: auto; font-size: 12px; }
.unassigned-row:hover .more-link, .unassigned-row:focus-visible .more-link { color: var(--accent); }
.unassigned-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 多选(产品的配套软件) */
.multi { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.multi .check { color: var(--text); white-space: normal; }
.multi .check .muted { font-size: 12px; }
.section h3 { font-size: 15px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.perm { margin-bottom: 14px; }

.comments { display: grid; gap: 10px; margin-bottom: 10px; }
.comment { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.comment-head { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.comment-head b { color: var(--text); font-size: 13px; }
.comment-head .acts { margin-left: auto; display: flex; gap: 10px; }
.comment-head button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; }
.comment-head button:hover { color: var(--accent); }
.comment-body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.comment-form { display: grid; gap: 8px; }
.comment-form .row { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.form-note { font-size: 12px; color: var(--muted); }
.form-note.error { color: var(--danger); }
/* 两级楼层:楼主留言 + 缩进一层的回复;输入框上方的「回复 某某」 */
.floor { display: grid; gap: 6px; }
.floor-replies { display: grid; gap: 6px; margin-left: 14px; padding-left: 10px; border-left: 2px solid var(--line); }
.comment.reply { padding: 6px 10px; }
.comment.gone { color: var(--muted); font-style: italic; font-size: 13px; }
.comment-head .reply-to { color: var(--text); font-size: 13px; font-weight: 600; }
.comment-head .reply-to:hover:not(:disabled) { color: var(--accent); text-decoration: underline; }
.comment-head .reply-to:disabled { cursor: default; text-decoration: line-through; color: var(--muted); }
.floor-more { justify-self: start; border: 0; background: none; padding: 0; color: var(--accent); font-size: 12px; cursor: pointer; }
.floor-more:hover { text-decoration: underline; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-left: 3px solid var(--accent); border-radius: 4px; background: var(--accent-weak); font-size: 12px; }
.reply-bar[hidden] { display: none; }
.reply-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; }
.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background-color: var(--accent-weak); box-shadow: inset 0 0 0 1px var(--accent); } }

/* 留言集:总览的「项目 - 人员 - 留言」行,和弹窗 */
.set-line { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.set-line .chip { align-self: center; }
.set-label, .set-who { flex: none; max-width: 32%; overflow: hidden; text-overflow: ellipsis; }
.set-who { color: var(--muted); }
.set-line .sep { color: var(--muted); flex: none; }
.set-body { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
dialog.pane-dialog[open] { display: flex; flex-direction: column; width: min(560px, calc(100vw - 32px)); height: min(640px, calc(100vh - 64px)); }
.thread-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.thread-head h3 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-dialog .thread { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane-dialog .list-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.pane-dialog .comments { flex: 1; overflow-y: auto; align-content: start; margin: 0; padding: 12px 16px; overscroll-behavior: contain; }
.pane-dialog .comment-form { padding: 10px 16px 14px; border-top: 1px solid var(--line); }
.new-below { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); border: 1px solid var(--accent); border-radius: 999px; background: var(--panel); color: var(--accent); padding: 3px 12px; font-size: 12px; cursor: pointer; box-shadow: var(--shadow); }
.new-below[hidden] { display: none; }
.sets-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.sets-more { display: flex; justify-content: center; padding: 10px; }
.sets-more:has(button[hidden]) { display: none; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.timeline li:first-child { border-top: 0; }
.timeline .when { color: var(--muted); font-size: 12px; }
.chg { display: inline; }
.chg del { color: var(--muted); }
.chg ins { text-decoration: none; font-weight: 600; }

/* ---------- 动态 ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; }
.feed li.clickable { cursor: pointer; }
.feed li.clickable:hover { background: var(--panel-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-weak); color: var(--accent); border: 1px solid var(--line); font-family: var(--mono); display: grid; place-items: center; font-weight: 700; flex: none; }
.feed .what { flex: 1; min-width: 0; word-break: break-word; }
.feed .when { color: var(--muted); font-size: 12px; }
.day { padding: 8px 16px; font-size: 12px; color: var(--muted); background: var(--panel-2); border-top: 1px solid var(--line); }
.day:first-child { border-top: 0; border-radius: var(--radius) var(--radius) 0 0; }

/* ---------- 用户管理 ---------- */
.pending-card { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); align-items: end; }
.pending-card:first-child { border-top: 0; }
.pending-card .fields { display: grid; grid-template-columns: 160px 1fr 150px; gap: 10px; align-items: end; margin-top: 8px; }
.pending-card .fields label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.pending-card .btns { display: flex; gap: 8px; }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; background: var(--panel); color: var(--text); width: min(400px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: var(--overlay); }
dialog form { display: grid; gap: 12px; padding: 20px; }
dialog h3 { font-size: 16px; }
dialog label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
dialog .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* 弹窗开着时提示放进弹窗里(.toasts),才能显示在弹窗上面 */
#toasts, .toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: var(--toast-bg); color: var(--toast-text); border: 1px solid var(--line); padding: 9px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 13px; max-width: calc(100vw - 32px); white-space: pre-line; }
.toast.error { background: var(--danger); border-color: transparent; color: var(--on-danger); }
.toast-act { pointer-events: auto; margin-left: 12px; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.toast-act:hover { text-decoration: underline; }
/* 系统已更新 / 权限已调整:请保存后刷新 */
.banner {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 70; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; border: 1px solid var(--accent); border-radius: 8px;
  background: var(--toast-bg); color: var(--toast-text); box-shadow: var(--shadow-lg); font-size: 13px;
}
.banner .btn { flex: none; }

/* ---------- 窄屏 ---------- */
@media (max-width: 760px) {
  .topbar { padding: 0 12px; gap: 8px; flex-wrap: wrap; height: auto; }
  .brand { height: 48px; }
  .brand span { display: none; }
  .tabs { order: 3; flex-basis: 100%; }
  .tabs a { height: 42px; }
  .who { margin-left: auto; min-width: 0; }
  .who .chip { display: none; }
  /* 姓名太长时省略,不把顶栏撑出横向滚动 */
  .who-name { display: inline-block; min-width: 0; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; }
  main { padding: 14px 16px; }
  .filters .search { flex: 1 1 100%; }
  .filters .input { flex: 1 1 40%; }
  .form { grid-template-columns: 1fr; }
  .form .spacer { display: none; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .tile .v { font-size: 24px; }
  .pending-card { grid-template-columns: 1fr; }
  .pending-card .fields { grid-template-columns: 1fr; }
  .set-count { display: none; }
  /* 窄屏:「项目 - 人员」一行,留言另起一行 */
  .set-line { flex-wrap: wrap; row-gap: 2px; }
  .set-line .body-sep { display: none; }
  .set-label, .set-who { max-width: 45%; }
  .set-body { flex-basis: 100%; }
}
@media (max-width: 640px) {
  dialog.pane-dialog[open] { width: 100vw; height: 100dvh; max-width: none; max-height: none; border: 0; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* 用户页:菜单勾选 */
.menu-checks { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.menu-check { color: var(--text); font-size: 13px; }
.menu-cell { min-width: 220px; }
.menu-custom { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.menu-field { display: flex; flex-direction: column; gap: 6px; grid-column: 1 / -1; }
.menu-field > span { font-size: 13px; color: var(--muted); }
.table-wrap .menu-cell, .table-wrap select.input { min-width: 130px; }
.table-wrap .menu-cell { min-width: 230px; }
.merge-row { display: flex; gap: 8px; margin-top: 10px; }
.merge-row select { flex: 1; min-width: 0; }
