/* styles.css —— 设计令牌 + 组件样式。风格：主体黑白灰，马卡龙色仅作语义点缀（樱花粉·珊瑚粉·淡蓝·抹茶绿·薰衣草紫）。 */

:root {
  /* 原生控件（下拉、日期、滚动条）跟随主题配色，避免暗色下白底浅字 */
  color-scheme: light;

  /* 中性色（黑白灰主体） */
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-muted: #F2F2F2;
  --border: #E9E9E9;
  --border-strong: #D6D6D6;
  --text: #050505;
  --text-hover: #1A1A1A;
  --text-sub: #575456;
  --text-faint: #6B6B6B;
  --on-dark: #FFFFFF;
  --on-dark-sub: rgba(255, 255, 255, 0.65);
  --on-dark-faint: rgba(255, 255, 255, 0.55);

  /* 马卡龙语义点缀色 */
  --accent: #D4879F;         /* 樱花粉（强调） */
  --accent-soft: #FAE9EF;
  --accent-border: rgba(212, 135, 159, 0.3);
  --danger: #DC6B84;         /* 珊瑚粉（危险） */
  --danger-soft: #FBE9EE;
  --info: #6E9BD6;           /* 淡蓝（信息） */
  --info-soft: #EAF0FA;
  --info-strong: #4A6FA8;    /* 信息蓝深档（文字） */
  --info-border: rgba(110, 155, 214, 0.25);
  --success: #6FAE94;        /* 抹茶绿（成功/标配） */
  --success-soft: #E6F3EE;
  --success-border: rgba(111, 174, 148, 0.3);
  --purple: #7B6BB0;         /* 薰衣草紫（磨削域 / 代码评审闸门） */

  /* 头像色板（马卡龙深档；浅色下白字，全部组合 ≥ 4.5:1） */
  --avatar-ink: #FFFFFF;
  --av-1: #B25A76;
  --av-2: #4A6FA8;
  --av-3: #477F68;
  --av-4: #6B5AA3;
  --av-5: #B54A63;

  /* 功能域分类色（铣削/车削/磨削/齿轮/综合） */
  --fam-mill: #4A6FA8;
  --fam-mill-soft: #E8EFFA;
  --fam-turn: #A9743B;
  --fam-turn-soft: #F8EBDD;
  --fam-grind: #7B6BB0;
  --fam-grind-soft: #ECE7F8;
  --fam-gear: #3F8E68;
  --fam-gear-soft: #E6F3EE;
  --fam-comp: #C25774;
  --fam-comp-soft: #FBE6EC;

  /* 字体 */
  --font-display: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --font-body: -apple-system, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* 圆角 / 阴影 / 间距 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-full: 999px;
  --shadow-sm: 0 1px 2px rgba(5, 5, 5, 0.05);
  --shadow-md: 0 6px 20px rgba(5, 5, 5, 0.10);
  --shadow-lg: 0 18px 48px rgba(5, 5, 5, 0.18);
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --topbar-h: 60px;
  --sidebar-note: 0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }
.app-body { flex: 1; display: flex; align-items: stretch; min-height: 0; }
.content { flex: 1; min-width: 0; min-height: 0; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-5);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); margin-right: var(--sp-2); }
.brand-logo {
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: var(--text);
  color: var(--on-dark);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(5, 5, 5, 0.18);
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: var(--text-faint); margin-left: 2px; }

.seg {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.seg-btn {
  position: relative;
  border: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  padding: 6px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: color .15s ease;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--text);
  color: var(--on-dark);
  font-weight: 600;
  box-shadow: none;
}
.seg-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .5; }
.seg-btn.active .seg-dot { background: var(--on-dark); opacity: 1; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }

/* ===== 右上角用户菜单（当前身份 / 退出登录 / 开发模式切换） ===== */
.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 11px 4px 5px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-full); cursor: pointer; font: inherit; color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.user-btn:hover { border-color: var(--text); box-shadow: var(--shadow-sm); }
.user-btn .avatar { width: 26px; height: 26px; font-size: 12px; }
.user-btn-name {
  font-weight: 600; font-size: 13px; max-width: 110px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-btn-caret { display: inline-flex; color: var(--text-sub); transition: transform .2s ease; }
.user-menu.open .user-btn { border-color: var(--text); }
.user-menu.open .user-btn-caret { transform: rotate(180deg); }
.user-drop {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 302px; max-height: min(72vh, 520px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 90;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.user-menu.open .user-drop { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
.user-drop-head {
  padding: 6px 10px 5px; font-size: 11px; color: var(--text-faint);
  border-bottom: 1px dashed var(--border); margin-bottom: 4px;
}
.user-drop-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left; font: inherit;
  padding: 7px 9px; border: 0; border-radius: var(--r-sm);
  background: transparent; cursor: pointer;
  transition: background .12s ease;
}
.user-drop-item:hover { background: var(--surface-muted); }
.user-drop-item.active { background: var(--text); color: var(--on-dark); }
.user-drop-item.active .udi-check { color: var(--on-dark); }
.user-drop-item .avatar { width: 24px; height: 24px; font-size: 11px; flex: 0 0 auto; }
.udi-name {
  font-weight: 600; font-size: 13px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.udi-check { color: var(--text); display: inline-flex; flex: 0 0 auto; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  border-radius: var(--r-md); border: 1px solid transparent;
  padding: 8px 14px; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--text); color: var(--on-dark); }
.btn-primary:hover { background: var(--text-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--border-strong); background: var(--surface-muted); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn-block { width: 100%; justify-content: center; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-sub);
  cursor: pointer; transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--surface-muted); color: var(--text); }
.icon-btn .dot-badge {
  position: absolute; transform: translate(12px, -12px);
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.icon-btn { position: relative; }

/* ===== 指标条（并入看板工具栏右侧的紧凑字条） ===== */
.metric-strip { display: flex; align-items: center; gap: var(--sp-4); white-space: nowrap; }
.m-chip { display: inline-flex; align-items: baseline; gap: 5px; font-size: 12px; color: var(--text-sub); }
.m-chip b { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--text); }
.m-chip.warn b { color: var(--accent); }
.m-chip.danger b { color: var(--danger); }

/* ===== 看板 ===== */
.board {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5) var(--sp-6);
  overflow-x: auto;
}
/* 产品泳道：一排一个产品，排内按状态分列，每排可收起 */
.band { display: flex; flex-direction: column; }
.band-head {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; font: inherit; color: inherit;
  transition: border-color .15s ease;
}
.band-head:hover { border-color: var(--text); }
.band-caret { display: inline-flex; color: var(--text-sub); transition: transform .2s ease; flex: 0 0 auto; }
.band.collapsed .band-caret { transform: rotate(-90deg); }
.band-title { font-weight: 700; font-family: var(--font-display); font-size: 15px; }
.band-count {
  font-family: var(--font-mono); font-size: 12px; color: var(--text-sub);
  background: var(--surface-muted); border: 1px solid var(--border);
  border-radius: var(--r-full); padding: 1px 10px;
}
.band-sub { font-size: 12px; color: var(--text-faint); flex: 0 0 auto; }
/* 项目栏信息：产品经理 / 项目经理 / 截止日期 / 优先级（靠右收纳），加号为新增需求入口 */
.band-meta { display: inline-flex; align-items: center; gap: 12px; margin-left: auto; flex: 0 0 auto; }
.bm { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-sub); white-space: nowrap; }
.bm .avatar { width: 18px; height: 18px; font-size: 10px; flex: 0 0 auto; }
.bm-name { max-width: 5em; overflow: hidden; text-overflow: ellipsis; }
.band-add {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; margin-left: 10px; flex: 0 0 auto;
  border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-sub); cursor: pointer; padding: 0;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.band-add:hover { background: var(--text); border-color: var(--text); color: var(--on-dark); }
/* 项目栏编辑按钮（总监）：与加号同为圆底按钮，仅悬停色不同（主色描边不填充） */
.band-edit { margin-left: 0; }
.band-edit:hover { background: var(--surface); border-color: var(--text); color: var(--text); }
/* 流程网格：五阶段列与五关卡节点交错（列 → G1 → 列 → G2 → 列 → 代码评审 → 列 → G3 → 列 → G4），关卡槽仅 40px 窄轨 */
.band-body {
  display: grid;
  grid-template-columns:
    minmax(190px, 1fr) 40px
    minmax(190px, 1fr) 40px
    minmax(190px, 1fr) 40px
    minmax(190px, 1fr) 40px
    minmax(190px, 1fr) 40px;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}
.band.collapsed .band-body { display: none; }
.band .col { min-height: 92px; }
.col {
  display: flex; flex-direction: column;
  border-radius: var(--r-md);
  min-height: 320px;
}
/* 阶段列无边框无背景（简洁风）；拖拽悬停以浅色底提示落点 */
.col.drag-over { background: var(--surface-muted); box-shadow: 0 0 0 3px var(--surface-muted); }
.col-head {
  display: flex; align-items: baseline; gap: var(--sp-2);
  padding: 7px 10px 3px;
}
.col-title { font-weight: 600; font-family: var(--font-display); font-size: 13px; }
.col-count {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-sub);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-full); padding: 0 7px;
}
.col-sub { padding: 0 var(--sp-3); font-size: 12px; color: var(--text-faint); }
.col-body {
  display: flex; flex-direction: column; gap: 6px;
  padding: 6px 6px 8px;
  min-height: 60px;
}
.band .col-sub { display: none; }

/* ===== 卡片（紧凑 · 统一高度） ===== */
.card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 9px;
  height: 122px; overflow: hidden;
  cursor: grab;
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card.dragging { opacity: .4; }
.card.mine { border-left: 3px solid var(--text); }
.card.mine::after {
  content: "我的"; position: absolute; top: 0; right: 9px;
  font-size: 9px; color: var(--on-dark); background: var(--text);
  padding: 0 5px; border-radius: 0 0 4px 4px; line-height: 1.6;
}
.card-top { display: flex; align-items: baseline; gap: 6px; min-width: 0; padding-right: 26px; }
.card-id {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-faint);
  letter-spacing: .3px; flex: 0 0 auto;
}
.card-title {
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.card-tags { display: flex; flex-wrap: nowrap; gap: 4px; margin-top: 4px; overflow: hidden; }
.tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 500; padding: 0 6px;
  border-radius: var(--r-full); line-height: 1.8; flex: 0 0 auto;
}
.tag-p-hi { background: var(--danger-soft); color: var(--danger); }
.tag-p-mid { background: var(--accent-soft); color: var(--accent); }
.tag-p-low { background: var(--surface-muted); color: var(--text-sub); border: 1px solid var(--border); }
.tag-blocked { background: var(--danger-soft); color: var(--danger); }
.tag-returned { background: var(--accent-soft); color: var(--accent); }
/* 停驻关卡卡片上的「xx评审中」标记（卡片位于关卡前的列中，竖线不存卡片） */
.tag-gate { background: var(--info-soft); color: var(--info); }
.tag-due { background: var(--info-soft); color: var(--info); }
.tag-due.overdue { background: var(--danger-soft); color: var(--danger); }
.tag-next { background: var(--surface-muted); color: var(--text-sub); border: 1px solid var(--border); }

/* 元信息行贴卡片底部（弹性占位撑起统一高度，标签行与元信息之间的空档随内容伸缩） */
.card-meta { display: flex; align-items: center; gap: var(--sp-2); margin-top: auto; padding-top: 5px; min-height: 18px; }
.meta-due { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--text-sub); }
.avatar {
  width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 600; color: var(--avatar-ink);
  flex: 0 0 auto;
}
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -5px; border: 1.5px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-label { font-size: 11px; color: var(--text-sub); }

.card-foot {
  display: flex; align-items: center; justify-content: flex-end;
  margin-top: 6px;
}
.advance-btn {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--text);
  background: var(--surface-muted); border: 0; border-radius: var(--r-sm);
  padding: 3px 8px; cursor: pointer; flex: 0 0 auto;
  transition: background .15s ease;
}
.advance-btn:hover { background: var(--border); }
.advance-btn:disabled { opacity: .45; cursor: not-allowed; }

.progress { display: flex; align-items: center; gap: 6px; margin: 6px 0 8px; }
.progress.slim { margin: 5px 0 0; gap: 5px; }
.progress.slim .progress-track { height: 3px; }
.progress.slim .progress-label { font-size: 9px; }
.progress-track { flex: 1; height: 5px; border-radius: var(--r-full); background: var(--surface-muted); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--r-full); background: var(--text); }
.progress-label { font-family: var(--font-mono); font-size: 10px; color: var(--text-sub); flex: 0 0 auto; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 8px; color: var(--text-faint); font-size: 11px; text-align: center;
}
.empty .e-ico { opacity: .55; }

/* ===== 审批关卡竖线（两个阶段之间的一条竖线，仅此而已） =====
   未到关卡：灰色实线 · 到达关卡：彩色实线 + 关卡名文字 · 已通过：灰色虚线
   除「到达」态的文字外，无图标、徽标、卡片等任何标识；竖线只是时刻，不可点击，
   待审卡片显示在关卡前的列中（带「xx评审中」标记），点击卡片可打开详情 */
.gate-slot { position: relative; }
.gate-slot::before {
  content: ""; position: absolute; top: 8px; bottom: 8px; left: 50%;
  width: 0; border-left: 2px solid var(--border);
}
.gate-slot.done::before { border-left-style: dashed; }
.gate-slot.active::before { border-left: 2px solid var(--accent); }
.gate-slot.active[data-gate="gate2"]::before { border-left-color: var(--info); }
.gate-slot.active[data-gate="codereview"]::before { border-left-color: var(--purple); }
.gate-slot.active[data-gate="gate3"]::before { border-left-color: var(--success); }
.gate-slot.active[data-gate="gate4"]::before { border-left-color: var(--danger); }
/* 关卡名文字：竖排骑在竖线上（背景同页面底色，视觉上文字长在线上），位于竖线中间上下居中 */
.gate-label {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  writing-mode: vertical-rl; letter-spacing: 2px;
  font-family: var(--font-display); font-weight: 600; font-size: 11px; line-height: 1.3;
  color: var(--accent);
  background: var(--bg);
  padding: 10px 1px;
  white-space: nowrap;
}
.gate-slot.active[data-gate="gate2"] .gate-label { color: var(--info); }
.gate-slot.active[data-gate="codereview"] .gate-label { color: var(--purple); }
.gate-slot.active[data-gate="gate3"] .gate-label { color: var(--success); }
.gate-slot.active[data-gate="gate4"] .gate-label { color: var(--danger); }

/* ===== 历史项目视图 ===== */
/* 看板空态：所有项目均已走完（需求全部归档），项目栏随终审离开看板 */
.board-empty {
  padding: 60px 20px; text-align: center;
  color: var(--text-faint); font-size: 13px;
}
.history-head {
  display: flex; align-items: baseline; gap: var(--sp-3);
  flex-wrap: wrap; margin-bottom: var(--sp-4);
}
.history-head h2 { margin: 0; font-family: var(--font-display); font-size: 18px; }
.clear-archive { margin-left: auto; flex: 0 0 auto; }
.history-empty {
  padding: 60px 20px; text-align: center;
  color: var(--text-faint); font-size: 13px;
}
.history-list {
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.history-item {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; transition: box-shadow .15s ease, border-color .15s ease;
}
.history-item:hover { box-shadow: var(--shadow-md); border-color: var(--text); }
.hi-left { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; flex: 1; }
.hi-id { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); flex: 0 0 auto; }
.hi-title { font-family: var(--font-display); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hi-meta { display: flex; align-items: center; gap: var(--sp-3); flex: 0 0 auto; }
.hi-owner { font-size: 12px; color: var(--text-sub); }
.hi-date { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }

/* ===== 历史项目分组（项目归档快照 + 组内需求列表） ===== */
.hist-group {
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-4);
  background: var(--surface-muted);
  border: 1px solid var(--border); border-radius: var(--r-lg);
}
.hg-head {
  display: flex; align-items: center; gap: var(--sp-3);
  flex-wrap: wrap; padding: 2px 4px;
}
.hg-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.hg-tag {
  font-size: 11px; padding: 2px 8px; border-radius: var(--r-full);
  background: var(--surface); border: 1px solid var(--border); color: var(--text-sub);
}
.hg-tag.tag-archived { background: var(--surface-muted); border-color: var(--text); color: var(--text); }
.hg-tag.tag-ongoing { background: var(--surface); border-color: var(--border); color: var(--text-sub); }
.hg-meta { font-size: 12px; color: var(--text-sub); }
.hg-note {
  font-size: 12px; color: var(--text-sub); max-width: 380px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hg-count { margin-left: auto; font-size: 12px; color: var(--text-faint); }

/* ===== 项目栏归档按钮与可归档徽标 ===== */
.band-close { color: var(--text); }
.band-close:hover { background: var(--text); border-color: var(--text); color: var(--on-dark); }
.band-close.off { color: var(--text-faint); cursor: not-allowed; }
.band-close.off:hover { background: transparent; border-color: var(--border); color: var(--text-faint); }
.tag-archivable {
  background: var(--surface-muted); color: var(--text);
  border: 1px dashed var(--text);
}

/* ===== 骨架屏 ===== */
.skeleton {
  background: linear-gradient(90deg, var(--surface-muted) 25%, var(--border) 37%, var(--surface-muted) 63%);
  background-size: 400% 100%;
  animation: sk 1.2s ease infinite;
  border-radius: var(--r-md);
}
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ===== 抽屉 ===== */
.drawer-mask, .modal-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5, 5, 5, 0.34);
  opacity: 0; transition: opacity .2s ease;
  pointer-events: none; visibility: hidden;
}
.drawer-mask.show, .modal-mask.show { opacity: 1; pointer-events: auto; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(440px, 100%);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .26s cubic-bezier(.32,.72,.24,1);
  display: flex; flex-direction: column;
  pointer-events: none; visibility: hidden;
}
.drawer.show { transform: translateX(0); pointer-events: auto; visibility: visible; }
.drawer-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4); border-bottom: 1px solid var(--border);
}
.drawer-body { flex: 1; overflow-y: auto; padding: var(--sp-4); }
.drawer-foot {
  padding: var(--sp-4); border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
}

/* ===== 弹窗 ===== */
.modal {
  position: fixed; left: 50%; top: 50%; z-index: 61;
  transform: translate(-50%, -50%) scale(.96);
  width: min(460px, calc(100% - 32px));
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  max-height: 86vh; overflow-y: auto;
  pointer-events: none; visibility: hidden;
}
.modal.show { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; visibility: visible; }
.modal-head { padding: var(--sp-4); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--sp-2); }
.modal-body { padding: var(--sp-4); }
.modal-foot { padding: 0 var(--sp-4) var(--sp-4); display: flex; gap: var(--sp-2); justify-content: flex-end; }

/* ===== 表单 ===== */
.field { margin-bottom: var(--sp-4); }
.field label { display: block; font-size: 12px; color: var(--text-sub); margin-bottom: 6px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; font-family: var(--font-body); font-size: 14px; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 9px 11px; background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { resize: vertical; min-height: 72px; }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); opacity: 1; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--surface-muted);
}
.chip-check { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-option {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-full);
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 13px; cursor: pointer; transition: all .15s ease;
}
.chip-option.selected { border-color: var(--text); background: var(--text); color: var(--on-dark); font-weight: 600; }

/* ===== 方案弹窗：任务拆解行（标题/责任人 + 每任务独立的难度/用时/截止） ===== */
.plan-row { padding: 10px; border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 10px; }
.plan-row .pr-line { display: flex; align-items: center; gap: 8px; }
.plan-row .pr-line.pr-attrs { margin-top: 8px; }
.plan-row .pr-title { flex: 1; min-width: 0; }
.plan-row .pr-dev { width: 126px; flex: 0 0 auto; }
.plan-row .pr-diff { width: 96px; flex: 0 0 auto; }
.plan-row .pr-est { flex: 1; min-width: 0; }
.plan-row .pr-due { flex: 0 0 auto; width: 150px; }
.pr-del {
  width: 30px; height: 34px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-faint); cursor: pointer;
  transition: all .15s ease;
}
.pr-del:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

/* ===== Toast ===== */
.toast-wrap {
  position: fixed; left: 50%; bottom: 28px; z-index: 80;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  background: var(--text-hover); color: var(--on-dark); font-size: 13px;
  padding: 10px 16px; border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  animation: toast-in .24s ease;
}
.toast.err { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== 摘要抽屉条目 ===== */
.summary-item {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3); border-radius: var(--r-md);
  border: 1px solid var(--border); margin-bottom: var(--sp-2);
}
.summary-item .si-ico { flex: 0 0 auto; margin-top: 1px; }
.summary-item .si-text { font-size: 13px; }
.summary-item .si-tag {
  margin-left: auto; font-size: 11px; font-weight: 600;
  padding: 1px 8px; border-radius: var(--r-full); flex: 0 0 auto;
}
.summary-item.todo .si-tag { background: var(--surface-muted); color: var(--text); }
.summary-item.warn .si-tag { background: var(--accent-soft); color: var(--accent); }
.summary-item.risk .si-tag { background: var(--danger-soft); color: var(--danger); }
.summary-item.meta .si-tag { background: var(--surface-muted); color: var(--text-sub); }

/* ===== 详情段落 ===== */
.sec { margin-bottom: var(--sp-5); }
.sec-title { font-size: 12px; font-weight: 600; color: var(--text-sub); margin-bottom: var(--sp-2); text-transform: uppercase; letter-spacing: .4px; }
.kv { display: flex; gap: var(--sp-2); font-size: 13px; padding: 3px 0; }
.kv .k { color: var(--text-sub); flex: 0 0 72px; }
.task-row {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm);
  margin-bottom: 6px;
}
.task-row .ts-main { display: flex; align-items: center; gap: var(--sp-2); }
.task-row .ts-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.task-row .ts-dot.done { background: var(--text); }
.task-row .ts-dot.doing { background: var(--info); }
.task-row .ts-dot.blocked { background: var(--danger); }
.task-row .ts-dot.todo { background: var(--surface-muted); border: 1.5px solid var(--border-strong); box-sizing: border-box; }
.task-row .ts-title { flex: 1; font-size: 13px; }
.task-row .ts-status { font-size: 11px; color: var(--text-sub); }
/* 每任务独立的难度 / 用时 / 截止 */
.task-row .ts-meta { font-size: 11px; color: var(--text-faint); padding-left: 16px; }

/* ===== 详情抽屉重排（dd-*）：横幅 / 流程进度 / 两列信息 / 团队 / 过程记录 / 评审时间线 ===== */
/* 阻塞 / 返工横幅（置顶醒目） */
.dd-banner {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 12px; margin-bottom: var(--sp-3);
  border-radius: var(--r-sm); font-size: 13px; line-height: 1.45;
}
.dd-banner svg { flex: 0 0 auto; margin-top: 2px; }
.dd-banner b { font-weight: 600; margin-right: 6px; }
.dd-banner.warn { background: var(--accent-soft); color: var(--accent); }
.dd-banner.danger { background: var(--danger-soft); color: var(--danger); }

/* ① 流程进度：11 节点胶囊链 */
.dd-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.dd-step {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; line-height: 1; padding: 5px 8px; white-space: nowrap;
  border: 1px solid var(--border-strong); border-radius: var(--r-full); color: var(--text-sub);
}
.dd-step.done { background: var(--surface-muted); border-color: var(--border-strong); color: var(--text); }
.dd-step.cur { background: var(--text); border-color: var(--text); color: var(--on-dark); font-weight: 600; box-shadow: 0 2px 10px rgba(5, 5, 5, 0.28); }
.dd-step.todo { border-style: dashed; color: var(--text-faint); }
.dd-sep { font-size: 11px; color: var(--text-faint); }
.dd-sep::after { content: "›"; }
.dd-sep.past { color: var(--text); }

/* ② 基本信息：两列网格 */
.dd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px var(--sp-3); }
.dd-k { font-size: 11px; color: var(--text-faint); margin-bottom: 2px; }
.dd-v { font-size: 13px; overflow-wrap: anywhere; }
.dd-cell-wide { grid-column: 1 / -1; }
.dd-mono { font-family: var(--font-mono); font-size: 12px; }

/* ③ 团队：角色 + 头像姓名横排 */
.dd-team-row { display: flex; align-items: flex-start; gap: var(--sp-3); padding: 4px 0; }
.dd-role { flex: 0 0 60px; font-size: 11px; color: var(--text-sub); padding-top: 3px; }
.dd-members { display: flex; flex-wrap: wrap; gap: 4px 12px; min-width: 0; }
.dd-member { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.dd-empty { font-size: 12px; color: var(--text-faint); }
.dd-ok { font-size: 12px; color: var(--text); font-weight: 500; }

/* ④ 需求描述：目标 / 验收标准卡片 */
.dd-block { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: var(--sp-2); }
.dd-block:last-child { margin-bottom: 0; }
.dd-block-k { font-size: 11px; color: var(--text-sub); margin-bottom: 4px; }
.dd-block-v { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ⑤ 过程记录：固定六行（未到灰显占位） */
.dd-prec { display: flex; gap: var(--sp-3); padding: 8px 0 10px; border-bottom: 1px dashed var(--border); }
.dd-prec:last-child { border-bottom: none; padding-bottom: 2px; }
.dd-prec-side { flex: 0 0 68px; }
.dd-prec-label { font-size: 12px; font-weight: 600; }
.dd-prec.todo .dd-prec-label { color: var(--text-faint); font-weight: 500; }
.dd-prec-count { margin-left: 5px; font-size: 10px; font-weight: 600; color: var(--text); background: var(--surface-muted); border-radius: var(--r-full); padding: 1px 7px; }
.dd-prec-body { flex: 1; min-width: 0; }
.dd-prec .task-row { margin: 6px 0; }
.dd-prec .task-row:last-child { margin-bottom: 0; }
.dd-text { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dd-link { color: var(--text); font-family: var(--font-mono); font-size: 12px; }
.dd-meta { font-size: 11px; color: var(--text-faint); margin-top: 4px; }

/* ⑥ 评审留痕：垂直时间线（已留痕 / 待审 / 未启动） */
.dd-tl-item { display: flex; gap: var(--sp-2); padding-bottom: 14px; }
.dd-tl-item:last-child { padding-bottom: 2px; }
.dd-tl-rail { position: relative; flex: 0 0 10px; }
.dd-tl-rail::before { content: ""; position: absolute; left: 4px; top: 15px; bottom: -15px; width: 2px; background: var(--border); }
.dd-tl-item:last-child .dd-tl-rail::before { display: none; }
.dd-tl-rail::after {
  content: ""; position: absolute; left: 0; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface-muted); border: 2px solid var(--border-strong);
}
.dd-tl-item.ok .dd-tl-rail::after { background: var(--text); border-color: var(--text); }
.dd-tl-item.no .dd-tl-rail::after { background: var(--accent); border-color: var(--accent); }
.dd-tl-item.wait .dd-tl-rail::after { background: var(--surface); border-color: var(--info); box-shadow: 0 0 0 3px var(--info-soft); }
.dd-tl-item.future { opacity: 0.55; }
.dd-tl-body { flex: 1; min-width: 0; padding-top: 1px; }
.dd-tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dd-tl-gate { font-size: 13px; font-weight: 600; }
.dd-tl-item.future .dd-tl-gate { font-weight: 500; color: var(--text-sub); }
.dd-badge { font-size: 10px; font-weight: 700; border-radius: var(--r-full); padding: 1px 8px; line-height: 1.6; }
.dd-badge.ok { background: var(--surface-muted); color: var(--text); }
.dd-badge.no { background: var(--accent-soft); color: var(--accent); }
.dd-badge.wait { background: var(--info-soft); color: var(--info); }
.dd-tl-meta { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.dd-tl-note { font-size: 12px; color: var(--text-sub); margin-top: 5px; padding: 6px 9px; background: var(--surface-muted); border-radius: var(--r-sm); }

/* ===== 入场动画 ===== */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.rise { animation: rise .4s ease both; }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .band-body {
    grid-template-columns:
      200px 44px 200px 44px 200px
      44px 200px 44px 200px 44px;
  }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; }
  .brand-sub { display: none; }
  .board { padding: 12px 14px 32px; }
}

/* ===== 需求类型标签 ===== */
.tag-pkg { background: var(--surface-muted); color: var(--text); }
.tag-custom { background: var(--accent-soft); color: var(--accent); }
.tag-unit { background: var(--surface-muted); color: var(--text-sub); border: 1px solid var(--border); }

/* ===== 看板筛选栏 ===== */
.board-toolbar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5) var(--sp-2);
  flex-wrap: wrap;
}
.filter-note { font-size: 12px; color: var(--text-faint); }

/* ===== 新建需求：类型选择 ===== */
.type-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-3); }
.type-row.two { grid-template-columns: 1fr 1fr; }
.type-opt {
  padding: var(--sp-3); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); cursor: pointer; background: var(--surface);
  transition: all .15s ease;
}
.type-opt:hover { border-color: var(--text); }
.type-opt.on { border-color: var(--text); background: var(--text); }
.type-opt .to-label { font-weight: 600; font-size: 14px; color: var(--text); }
.type-opt.on .to-label { color: var(--on-dark); }
.type-opt .to-desc { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.type-opt.on .to-desc { color: var(--on-dark-sub); }

/* ===== 新建需求：产品包选择 ===== */
.pkg-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-height: 180px; overflow-y: auto; }
.pkg-opt {
  padding: 8px 10px; border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); cursor: pointer; background: var(--surface);
  display: flex; align-items: center; gap: 6px; transition: all .15s ease;
}
.pkg-opt:hover { border-color: var(--text); }
.pkg-opt.on { border-color: var(--text); background: var(--text); }
.pkg-opt .pk-code { font-family: var(--font-mono); font-weight: 700; font-size: 13px; color: var(--text); }
.pkg-opt.on .pk-code { color: var(--on-dark); }
.pkg-opt .pk-name { font-size: 11px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pkg-opt.on .pk-name { color: var(--on-dark-sub); }
.pkg-opt .pk-fam { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.pkg-opt .pk-fam.mill { background: var(--fam-mill); }
.pkg-opt .pk-fam.turn { background: var(--fam-turn); }
.pkg-opt .pk-fam.grind { background: var(--fam-grind); }
.pkg-opt .pk-fam.gear { background: var(--fam-gear); }
.pkg-opt .pk-fam.comp { background: var(--fam-comp); }

/* ===== 管理单元弹窗：Tab 切换（基础包 / 产品单元） ===== */
.mu-tabs { margin-bottom: 12px; }
.mu-panel { max-height: 52vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.mu-group { border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px 10px; }
.mu-group-title { font-size: 12px; font-weight: 700; color: var(--text-sub); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.mu-group-title .mu-cnt { font-family: var(--font-mono); font-size: 11px; font-weight: 400; color: var(--text-faint); background: var(--surface-muted); border-radius: var(--r-full); padding: 0 8px; }
.mu-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); cursor: pointer; }
.mu-row:hover { background: var(--surface-muted); }
.mu-row input[type=checkbox] { accent-color: var(--text); flex-shrink: 0; }
.mu-row .mu-name { flex: 1; font-size: 13px; color: var(--text); min-width: 0; }
/* 左右切换开关：左「选配」右「标配」，滑块滑到当前侧 */
.mu-sw { position: relative; display: inline-flex; width: 76px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: var(--r-full); background: var(--surface-muted); cursor: pointer; flex-shrink: 0; overflow: hidden; transition: border-color .15s ease; }
.mu-sw:hover { border-color: var(--text); }
.mu-sw .mu-sw-half { flex: 1; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-faint); position: relative; z-index: 1; transition: color .15s ease; user-select: none; }
.mu-sw .mu-sw-thumb { position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 4px); border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(5, 5, 5, .08); transition: left .18s ease; }
.mu-sw[data-std="1"] .mu-sw-thumb { left: calc(50% + 2px); }
/* 激活侧配色区分：选配（std=0 左侧）抹茶绿、标配（std=1 右侧）黑色；thumb 是末子元素，右侧用 :nth-child(2) 定位 */
.mu-sw[data-std="0"] .mu-sw-half:first-child { color: var(--success); font-weight: 600; }
.mu-sw[data-std="1"] .mu-sw-half:nth-child(2) { color: var(--text); font-weight: 600; }
.mu-sw:disabled { opacity: .45; cursor: default; }
.mu-sw:disabled:hover { border-color: var(--border); }

/* ===== 新建需求：功能单元分组 ===== */
.unit-group { margin-bottom: var(--sp-3); }
.ug-name { font-size: 12px; color: var(--text-sub); font-weight: 600; margin-bottom: 6px; }
.hint-note { font-size: 12px; color: var(--text-faint); padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: var(--r-sm); }

/* ===== 详情：功能单元标签列表 ===== */
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0; }

/* ===== 弹窗加宽 ===== */
.modal.wide { width: min(680px, calc(100% - 32px)); }

@media (max-width: 720px) {
  .type-row { grid-template-columns: 1fr; }
  .pkg-pick { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 左侧导航 ===== */
.sidebar {
  width: 216px;
  flex: 0 0 auto;
  border-right: 1px solid var(--border);
  padding: var(--sp-4) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(255, 255, 255, 0.42);
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.nav-sec {
  font-size: 11px; color: var(--text-faint); font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  padding: var(--sp-3) var(--sp-2) 6px;
}
.nav-sec:not(:first-child) { margin-top: var(--sp-3); }
.mainnav-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 9px 12px; font-size: 14px; font-weight: 600; color: var(--text-sub);
  border: none; background: none; border-radius: var(--r-md); cursor: pointer; transition: all .15s ease;
}
.mainnav-btn:hover { color: var(--text); background: var(--surface-muted); }
.mainnav-btn.active { color: var(--on-dark); background: var(--text); }
.mainnav-btn .nav-ico { display: inline-flex; opacity: .85; flex: 0 0 auto; }

/* ===== 用户管理（列表） ===== */
.user-list {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden;
}
.user-list-head {
  display: flex; align-items: center; gap: 16px;
  height: 40px; padding: 0 16px;
  background: var(--surface-muted);
  font-size: 11px; font-weight: 700; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.user-list-head .th-member { flex: 1; min-width: 0; }
.user-list-head .th-role { width: 110px; flex: 0 0 auto; }
.user-list-head .th-perm { width: 110px; flex: 0 0 auto; }
.user-list-head .th-actions { width: 72px; flex: 0 0 auto; text-align: right; }
.user-row {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .15s ease;
}
.user-row:last-child { border-bottom: none; }
.user-row:hover { background: var(--surface-muted); }
.user-row.me { background: var(--surface-muted); }
.user-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-weight: 600; }
.me-tag {
  font-size: 10px; font-weight: 600; color: var(--text);
  border: 1px solid currentColor; border-radius: var(--r-full);
  padding: 0 6px; margin-left: 4px; vertical-align: 1px;
}
.user-role { width: 110px; flex: 0 0 auto; display: flex; }
.user-perm { width: 110px; flex: 0 0 auto; display: flex; }
.perm-none { color: var(--text-faint); font-size: 12px; }
.user-actions { width: 72px; flex: 0 0 auto; display: flex; gap: 2px; justify-content: flex-end; }
.role-chip { display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; padding: 2px 12px; border-radius: var(--r-full); }
.role-chip.rc-pm { background: var(--info-soft); color: var(--info); }
.role-chip.rc-dev { background: var(--surface-muted); color: var(--text-sub); border: 1px solid var(--border); }

/* ===== 审批权限徽标（产品总监 / 架构师）与表单控件 ===== */
.perm-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700;
  color: var(--text); background: var(--surface-muted);
  border: 1px solid var(--border-strong);
  padding: 1px 9px; border-radius: var(--r-full);
  white-space: nowrap;
}
.perm-badge.pb-architect { color: var(--info); background: var(--info-soft); border-color: var(--info-border); }
.user-drop .perm-badge { flex: 0 0 auto; padding: 1px 7px; font-size: 10px; }
/* 无框勾选（通用行内复选，如「仅显示差异」；提高优先级，覆盖 .field label 的块级样式） */
.field label.check-label,
label.check-label {
  display: inline-flex; align-items: center; gap: 7px;
  cursor: pointer; user-select: none;
  font-size: 13px; font-weight: 400; color: var(--text);
  margin-bottom: 0; line-height: 1;
}
label.check-label:hover { color: var(--text); }
label.check-label input[type="checkbox"] {
  width: 14px; height: 14px; margin: 0; padding: 0;
  flex: 0 0 auto; accent-color: var(--text); cursor: pointer;
  vertical-align: middle; position: relative; top: -1px;
}
/* 审批权限单选组（无 / 产品总监 / 架构师） */
.perm-check { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.perm-check .hint-note { width: 100%; }
.perm-opt {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none;
  font-size: 13px; font-weight: 400; color: var(--text);
  padding: 5px 12px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface);
  transition: border-color .15s ease, background .15s ease;
}
.perm-opt:hover { border-color: var(--text); color: var(--text); }
.perm-opt:has(input:checked) { background: var(--surface-muted); border-color: var(--text); color: var(--text); font-weight: 600; }
.perm-opt input[type="radio"] { width: 14px; height: 14px; margin: 0; accent-color: var(--text); cursor: pointer; }
.perm-check.self { cursor: not-allowed; opacity: .65; }
.perm-check.self .perm-opt { cursor: not-allowed; }
.perm-check.self .perm-opt input[type="radio"] { cursor: not-allowed; }
.user-id { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }

/* ===== 人员分配（产品包 / 产品单元 / 功能单元责任人） ===== */
/* 分栏复用产品管理页的 .ptabs / .ptab；列表与下拉框沿用通用 .select 样式 */
.owner-cnt { margin-left: 2px; font-size: 11px; font-weight: 600; color: var(--text-faint); font-family: var(--font-mono); }
.owner-sec { margin-bottom: var(--sp-4); }
.owner-sec-title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 15px; font-weight: 700;
  margin-bottom: var(--sp-3);
}
.owner-list {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden;
}
.owner-row {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .15s ease;
}
.owner-row:last-child { border-bottom: none; }
.owner-row:hover { background: var(--surface-muted); }
.owner-info { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.owner-name { font-weight: 600; }
.owner-sub { font-size: 12px; color: var(--text-faint); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owner-select { width: 200px; flex: 0 0 auto; padding: 5px 10px; font-size: 13px; }
.owner-select:disabled { opacity: .6; cursor: not-allowed; }
.owner-empty { padding: 18px 16px; font-size: 13px; color: var(--text-faint); }

/* ===== 人员分配 · 概览（每类中每人负责数量的条形图） ===== */
.ov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--sp-4); align-items: start; }
.ov-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4) 18px; }
.ov-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: var(--sp-3); }
.ov-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.ov-sub { margin-left: auto; font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); }
.ov-bars { display: flex; flex-direction: column; gap: 12px; }
.ov-person { display: flex; flex-direction: column; gap: 6px; }
.ov-bar { display: flex; align-items: center; gap: 10px; }
.ov-bar-name { width: 72px; flex: 0 0 auto; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-bar-track { flex: 1; display: block; height: 10px; background: var(--surface-muted); border-radius: var(--r-full); overflow: hidden; }
.ov-bar-fill { display: block; height: 100%; border-radius: var(--r-full); background: var(--accent); }
.ov-bar-val { width: 34px; flex: 0 0 auto; text-align: right; font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--text); }
/* 人员行可点击展开其负责条目；默认收起，保持概览整洁 */
.ov-person.expandable { cursor: pointer; }
.ov-person.expandable .ov-bar:hover .ov-bar-name { color: var(--accent); }
.ov-caret { color: var(--text-faint); font-size: 13px; line-height: 1; transition: transform .15s ease; }
.ov-caret.open { transform: rotate(90deg); }
/* 展开后逐行显示的条目 */
.ov-items { padding-left: 82px; display: flex; flex-direction: column; gap: 2px; }
.ov-item { font-size: 12px; color: var(--text-sub); line-height: 1.7; word-break: break-word; }
.ov-person.unassigned .ov-bar-name { color: var(--text-faint); font-weight: 400; }
.ov-person.unassigned .ov-bar-fill { background: var(--border-strong); }
.ov-person.unassigned .ov-bar-val { color: var(--text-faint); font-weight: 600; }
.ov-person.unassigned.expandable .ov-bar:hover .ov-bar-name { color: var(--text-sub); }
.ov-empty { font-size: 13px; color: var(--text-faint); padding: 4px 0; }

/* ===== 产品管理 ===== */
/* 页面容器用 plan-page（不能叫 planning：与版本状态徽章 ver-badge planning 撞名，会把胶囊拉伸成全宽） */
.plan-page { padding: var(--sp-5); max-width: 1280px; margin: 0 auto; width: 100%; }
.planning-head { display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.planning-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.planning-sub { font-size: 12px; color: var(--text-faint); }
.owner-banner {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-sub);
  background: var(--surface-muted); border: 1px dashed var(--border-strong);
  border-radius: var(--r-md); padding: 10px 14px; margin: var(--sp-3) 0;
}
.owner-banner .ob-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text); flex-shrink: 0; }
.owner-banner.readonly .ob-dot { background: var(--text-faint); }

.ptabs { display: flex; gap: var(--sp-2); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-4); }
.ptab {
  padding: 10px 18px; font-size: 13px; font-weight: 600; color: var(--text-sub);
  border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.ptab.active { color: var(--text); border-bottom-color: var(--text); }

.plan-toolbar { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.plan-toolbar .input { padding: 5px 11px; font-size: 13px; max-width: 240px; }
.plan-toolbar .grow, .ver-head .grow, .pkg-ver-head .grow { flex: 1; }
.grow { flex: 1; }

/* 产品包可折叠分组（标准版 / 机型专用版） */
.pkg-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: var(--sp-4); overflow: hidden; }
.pkg-sec-head { display: flex; align-items: center; gap: var(--sp-3); padding: 13px 18px; cursor: pointer; user-select: none; background: var(--surface-muted); transition: background .15s ease; }
.pkg-sec-head:hover { background: var(--surface-muted); }
.pkg-sec-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text); }
.pkg-sec-cnt { font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); }
.pkg-sec-caret { margin-left: auto; color: var(--text-faint); display: inline-flex; transition: transform .2s ease; }
.pkg-sec.open .pkg-sec-caret { transform: rotate(180deg); }
.pkg-sec-body { display: none; padding: var(--sp-4); }
.pkg-sec.open .pkg-sec-body { display: block; }

/* 产品包网格（卡片含简介） */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
.plan-grid.pkg-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.plan-card {
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; background: var(--surface);
  cursor: pointer; position: relative; transition: all .15s ease;
}
.plan-card:hover { border-color: var(--text); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.plan-card.selected { border-color: var(--text); background: var(--text); }
.plan-card .pc-top { display: flex; align-items: center; gap: 8px; }
.plan-card .pc-code { font-family: var(--font-mono); font-size: 17px; font-weight: 700; min-width: 0; }
.plan-card.selected .pc-code { color: var(--on-dark); }
.plan-card .pc-name { font-size: 12px; color: var(--text-sub); margin-top: 6px; }
.plan-card.selected .pc-name { color: var(--on-dark-sub); }
.plan-card .pc-latest {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: var(--r-full); flex-shrink: 0;
  background: var(--surface-muted); color: var(--text-faint);
}
.plan-card .pc-latest.on { background: var(--success-soft); color: var(--success); }
/* 机型系别标签（五系配色） */
.fam-tag {
  display: inline-block; font-size: 11px; font-weight: 600; line-height: 1;
  padding: 4px 10px; border-radius: var(--r-full); white-space: nowrap;
}
.fam-tag.mill { background: var(--fam-mill-soft); color: var(--fam-mill); }
.fam-tag.turn { background: var(--fam-turn-soft); color: var(--fam-turn); }
.fam-tag.grind { background: var(--fam-grind-soft); color: var(--fam-grind); }
.fam-tag.gear { background: var(--fam-gear-soft); color: var(--fam-gear); }
.fam-tag.comp { background: var(--fam-comp-soft); color: var(--fam-comp); }
.plan-card .pc-brief {
  font-size: 11px; color: var(--text-sub); line-height: 1.55; margin-top: 8px; min-height: 34px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.plan-card.selected .pc-brief { color: var(--on-dark-sub); }
.plan-card .pc-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 10px; }
.plan-card .pc-vers { font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); flex-shrink: 0; }
.plan-card.selected .pc-vers { color: var(--on-dark-faint); }
.plan-card .card-actions { display: flex; gap: 2px; flex-shrink: 0; }

/* 版本状态徽标 */
.ver-badge { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; padding: 1px 8px; border-radius: var(--r-full); white-space: nowrap; flex-shrink: 0; }
.ver-badge.released { background: var(--success-soft); color: var(--success); }
.ver-badge.developing { background: var(--info-soft); color: var(--info-strong); }
.ver-badge.planning { background: var(--accent-soft); color: var(--accent); }
.ver-badge.deprecated { background: var(--surface-muted); color: var(--text-faint); }

/* 产品包版本视图 */
.pkg-ver-head { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.pv-back { align-self: stretch; width: 30px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text-sub); cursor: pointer; flex-shrink: 0; transition: all .15s ease; }
.pv-back:hover { border-color: var(--text); color: var(--text); }
/* 版本代号：黑色色块，与左侧返回箭头同高对齐 */
.pkg-ver-head .pv-code { align-self: stretch; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: var(--r-md); background: var(--text); font-family: var(--font-mono); font-size: 24px; font-weight: 700; color: var(--on-dark); flex-shrink: 0; }
.pkg-ver-head .pv-code.uv-name { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; }
.pkg-ver-head .pv-info { min-width: 220px; flex: 1; }
.pkg-ver-head .pv-name { font-size: 15px; font-weight: 700; }
.pkg-ver-head .pv-name .fam-tag { vertical-align: 2px; }
.pkg-ver-head .pv-brief { font-size: 12px; color: var(--text-sub); margin-top: 3px; line-height: 1.5; }
.pkg-ver-layout { display: grid; grid-template-columns: 250px 1fr; gap: var(--sp-4); align-items: start; }

.ver-nav { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px; position: sticky; top: 72px; }
.ver-nav-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px 8px; }
.ver-nav-title { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.ver-add { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: none; background: var(--text); color: var(--on-dark); cursor: pointer; transition: all .15s ease; }
.ver-add:hover { background: var(--text-hover); color: var(--on-dark); }
.ver-item { padding: 10px 12px; border-radius: var(--r-sm); cursor: pointer; border-left: 2px solid transparent; display: flex; flex-direction: column; gap: 4px; }
.ver-item:hover { background: var(--surface-muted); }
.ver-item.active { background: var(--text); border-left-color: var(--text); }
.ver-item .ver-id { font-family: var(--font-mono); font-weight: 700; font-size: 15px; color: var(--text); }
.ver-item.active .ver-id { color: var(--on-dark); }
.ver-item .ver-date { font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }
.ver-item.active .ver-date { color: var(--on-dark-faint); }
.ver-item .ver-line { display: flex; align-items: center; gap: 6px; }
.ver-item .ver-sub { font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }
.ver-item.active .ver-sub { color: var(--on-dark-faint); }

.ver-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.ver-head { display: flex; align-items: center; gap: var(--sp-3); padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-muted); flex-wrap: wrap; }
.ver-head .ver-id.lg { font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: var(--text); }
.ver-head .ver-date { font-size: 12px; color: var(--text-sub); font-family: var(--font-mono); }
.ver-note { padding: 12px 18px 0; font-size: 13px; color: var(--text-sub); }
.ver-follow { margin: 12px 18px 0; font-size: 12px; color: var(--text-sub); background: var(--surface-muted); border: 1px dashed var(--border-strong); border-radius: var(--r-md); padding: 8px 12px; }

/* 规格/列表通用容器（版本面板与单元列表共用） */
.pd-body { padding: var(--sp-4); }
.pd-empty { color: var(--text-faint); font-size: 13px; padding: 24px; text-align: center; }

@media (max-width: 900px) {
  .pkg-ver-layout { grid-template-columns: 1fr; }
  .ver-nav { position: static; }
}

.sec-block { margin-bottom: var(--sp-4); }
.sec-block:last-child { margin-bottom: 0; }
.sec-head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.sec-title { font-size: 13px; font-weight: 700; color: var(--text); }
.sec-cnt { font-size: 11px; color: var(--text-faint); margin-left: auto; font-family: var(--font-mono); }
.item-list { list-style: none; margin: 0; padding: 0; }
.item-row { display: flex; align-items: center; gap: var(--sp-2); padding: 7px 4px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-sub); }
.item-row:last-child { border-bottom: none; }
.item-row .iname { flex: 1; color: var(--text); }
.status-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: var(--r-full); flex-shrink: 0; }
.status-tag.std { background: var(--success-soft); color: var(--success); border: 1px solid var(--success-border); }
.status-tag.opt { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-border); }

/* 物料号（产品单元 / 产品包，选填属性） */
.mat-no {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: var(--text-sub); background: var(--surface-muted);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 1px 6px; white-space: nowrap; vertical-align: 1px; flex-shrink: 0;
}
/* 规格清单行：名称固定列宽 + 独立物料号列，保证物料号逐行对齐；物料号与名称留出间距 */
.spec-head { display: flex; align-items: center; gap: var(--sp-2); padding: 0 4px 6px; font-size: 11px; font-weight: 700; color: var(--text-faint); border-bottom: 1px solid var(--border); }
.item-row.spec-row .iname { flex: 0 1 250px; min-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-row.spec-row .mat-cell, .spec-head .mat-cell { flex: 0 0 auto; margin-left: 24px; }
.item-row.spec-row .status-tag, .spec-head .status-col { margin-left: auto; }

/* 产品单元库 */
.unit-lib { display: grid; grid-template-columns: 240px 1fr; gap: var(--sp-4); align-items: start; }
.domain-nav { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px; position: sticky; top: 72px; }
.domain-nav-title { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 1px; padding: 8px 12px 6px; font-weight: 700; }
.domain-item { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; color: var(--text-sub); border-left: 2px solid transparent; }
.domain-item:hover { background: var(--surface-muted); color: var(--text); }
.domain-item.active { background: var(--text); color: var(--on-dark); font-weight: 600; border-left-color: var(--text); }
.domain-item .dname { flex: 1; }
.domain-item .cnt { font-family: var(--font-mono); font-size: 11px; background: var(--surface-muted); color: var(--text-faint); padding: 0 7px; border-radius: var(--r-full); }
.domain-item.active .cnt { background: rgba(255, 255, 255, 0.18); color: rgba(255, 255, 255, 0.85); }

.units-pane { min-width: 0; }
.unit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }

/* 长条卡（产品单元 / 功能单元 / 定制单元）：每行一个 */
.unit-rows { display: flex; flex-direction: column; gap: var(--sp-2); }
.unit-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 0; transition: border-color .15s ease, box-shadow .15s ease; }
.unit-card:hover { border-color: var(--text); }
.unit-card.open { border-color: var(--text); box-shadow: 0 0 0 3px var(--surface-muted); }
.unit-row-line { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 12px 16px; }
.unit-rows .unit-name { width: 180px; flex: 0 0 auto; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 长条卡简介：固定起始位置（名称列右侧），灰字省略，悬停看全文 */
.unit-brief { min-width: 0; flex: 1 1 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-faint); text-align: left; }
.unit-adopt-btn { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text); background: var(--surface-muted); border: none; border-radius: var(--r-sm); padding: 5px 10px; cursor: pointer; flex-shrink: 0; transition: background .15s ease; }
.unit-adopt-btn:hover { background: var(--border); }
.ua-caret { display: inline-flex; transition: transform .2s ease; }
.unit-card.open .ua-caret { transform: rotate(180deg); }
.unit-adopt-body { padding: 10px 16px 14px; border-top: 1px dashed var(--border); display: flex; flex-wrap: wrap; gap: 6px; }
.unit-adopt-body .adopt-none { margin-top: 0; }
.unit-actions { display: flex; gap: 2px; flex-shrink: 0; }
.adopt-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.adopt-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-full); }
.adopt-chip .code { font-family: var(--font-mono); font-weight: 700; }
.adopt-chip.std { background: var(--success-soft); color: var(--success); }
.adopt-chip.opt { background: var(--accent-soft); color: var(--accent); }
.adopt-chip.basic { background: var(--surface-muted); color: var(--text-sub); border: 1px solid var(--border); }

/* ===== 功能单元 / 统一左导航布局 ===== */
.domain-group { font-size: 11px; font-weight: 700; color: var(--text-faint); letter-spacing: 1px; padding: 10px 12px 4px; }
.domain-nav .domain-group + .domain-item { margin-top: 2px; }
.units-pane .pkg-detail { margin-top: var(--sp-4); }
.units-pane .pd-empty { grid-column: 1 / -1; }
.adopt-none { font-size: 12px; color: var(--text-faint); margin-top: 8px; }

/* 通用小按钮 */
.btn-sm { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: var(--r-sm); cursor: pointer; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-sub); transition: all .12s ease; }
.btn-sm:hover { border-color: var(--text); color: var(--text); }
.btn-sm.primary { background: var(--text); border-color: var(--text); color: var(--on-dark); }
.btn-sm.primary:hover { background: var(--text-hover); border-color: var(--text-hover); color: var(--on-dark); }
.btn-sm.danger { color: var(--danger); }
.btn-sm.danger:hover { border-color: var(--danger); }
.btn-sm:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm:disabled:hover { border-color: var(--border-strong); color: var(--text-sub); }
.icon-btn-sm { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-sm); border: none; background: none; color: var(--text-faint); cursor: pointer; }
.icon-btn-sm:hover { background: var(--surface-muted); color: var(--text); }

@media (max-width: 860px) {
  .unit-lib { grid-template-columns: 1fr; }
  .domain-nav { position: static; }
  .unit-grid { grid-template-columns: 1fr; }
}

/* ===== 页面容器（工作报工 / 数据看板） ===== */
.pageview { padding: var(--sp-5); max-width: 1280px; margin: 0 auto; width: 100%; }

/* 统计卡 */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; }
.stat-card .sc-num { font-family: var(--font-mono); font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-card .sc-num.accent { color: var(--accent); }
.stat-card .sc-num.danger { color: var(--danger); }
.stat-card .sc-label { font-size: 12px; color: var(--text-sub); margin-top: 4px; }

/* 报工列表 */
.wl-group { margin-bottom: var(--sp-4); }
.wl-date { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text); padding: 6px 2px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.wl-date .wd-total { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); font-weight: 400; }
.wl-row { display: flex; align-items: center; gap: var(--sp-3); padding: 9px 6px; border-bottom: 1px solid var(--border); }
.wl-row:last-child { border-bottom: none; }
.wl-avatar { flex-shrink: 0; }
.wl-name { width: 64px; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.wl-hours { width: 46px; font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--text); flex-shrink: 0; }
.wl-req { flex-shrink: 0; max-width: 220px; overflow: hidden; }
.wl-task { flex: 0 0 210px; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-note { flex: 1; font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 看板卡片 */
.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); margin-bottom: var(--sp-4); align-items: start; }
.insight-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4); }
.insight-card .ic-title { font-size: 14px; font-weight: 700; margin-bottom: var(--sp-3); }

/* 横向条形图 */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-label { width: 120px; font-size: 12px; color: var(--text-sub); text-align: right; flex-shrink: 0; }
.bar-label.bar-gate { color: var(--accent); font-weight: 600; }
.bar-track { flex: 1; height: 14px; background: var(--surface-muted); border-radius: var(--r-full); overflow: hidden; }
.bar-fill { height: 100%; background: var(--info); border-radius: var(--r-full); transition: width .4s ease; }
.bar-fill.accent { background: var(--accent); }
.bar-num { width: 26px; font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); flex-shrink: 0; }

/* 趋势柱状图 */
.trend { display: flex; align-items: flex-end; gap: 8px; height: 130px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.trend-bar { width: 100%; max-width: 32px; background: var(--accent); border-radius: var(--r-sm) var(--r-sm) 0 0; min-height: 2px; }
.trend-val { font-family: var(--font-mono); font-size: 11px; color: var(--text-sub); }
.trend-day { font-size: 10px; color: var(--text-faint); }

/* 个人投入表 */
.person-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.person-table th { text-align: left; font-size: 11px; color: var(--text-faint); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .5px; }
.person-table td { padding: 10px; border-bottom: 1px solid var(--border); }
.person-table tr:last-child td { border-bottom: none; }
.pt-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.pt-role { font-size: 11px; color: var(--text-faint); font-weight: 400; }
.pt-bar-track { width: 120px; height: 8px; background: var(--surface-muted); border-radius: var(--r-full); overflow: hidden; display: inline-block; vertical-align: middle; }
.pt-bar-fill { height: 100%; background: var(--success); border-radius: var(--r-full); }

@media (max-width: 860px) {
  .insight-grid { grid-template-columns: 1fr; }
  .wl-task { flex: 0 0 auto; }
  .wl-note { display: none; }
  .bar-label { width: 90px; }
}

/* 需求总览 · 按产品（分栏排布，可按列收放） */
.pkg-acc { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.pkg-acc-item { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.pkg-acc-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: none; border: none; cursor: pointer; font-size: 13px; text-align: left; color: var(--text); }
.pkg-acc-head:hover { background: var(--surface-muted); }
.pkg-acc-head .chev { display: inline-flex; color: var(--text-faint); transition: transform .16s ease; }
.pkg-acc-item.open .chev { transform: rotate(90deg); }
.pkg-acc-head .pkg-code { font-family: var(--font-mono); font-weight: 700; color: var(--text); flex-shrink: 0; }
.pkg-acc-head .pkg-name { font-weight: 600; flex: 1; }
.pkg-acc-head .pkg-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); flex-shrink: 0; }
.pkg-acc-body { display: none; padding: 0 14px 12px; border-top: 1px solid var(--border); }
.pkg-acc-item.open .pkg-acc-body { display: block; }
.req-mini { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border); font-size: 12px; }
.req-mini:last-child { border-bottom: none; }
.req-mini .rm-id { font-family: var(--font-mono); color: var(--text-faint); flex-shrink: 0; }
.req-mini .rm-title { flex: 1; color: var(--text); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-mini .rm-status { font-size: 11px; color: var(--text-faint); flex-shrink: 0; }
.req-mini .rm-meta { color: var(--text-faint); font-size: 11px; flex-shrink: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-mini .rm-prog { font-family: var(--font-mono); font-size: 11px; color: var(--text); flex-shrink: 0; }

/* ===== 产品对比 / 规格导出（选择弹窗卡片 + 对比界面） ===== */
.cmp-setup-tip { font-size: 12px; color: var(--text-sub); line-height: 1.7; margin-bottom: 12px; }
.cmp-setup-tip strong { color: var(--text); }
.cmp-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; max-height: 52vh; overflow-y: auto; padding: 2px; }
.cmp-card { border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 11px 12px 10px; cursor: pointer; background: var(--surface); transition: border-color .15s, box-shadow .15s, background .15s; }
.cmp-card:hover { border-color: var(--text); }
.cmp-card.picked { border-color: var(--text); background: var(--text); box-shadow: 0 0 0 1px var(--text); }
.cmp-card-top { display: flex; align-items: center; gap: 6px; }
.cmp-card .cmp-code { font-family: var(--font-mono); font-weight: 700; color: var(--text); font-size: 13px; }
.cmp-card.picked .cmp-code { color: var(--on-dark); }
.cmp-pick-dot { width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: transparent; }
.cmp-card.picked .cmp-pick-dot { background: var(--on-dark); border-color: var(--on-dark); color: var(--text); }
.cmp-pick-dot::after { content: ""; width: 4px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); margin-top: -2px; }
.cmp-card-name { font-size: 13px; font-weight: 600; margin: 7px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-card.picked .cmp-card-name { color: var(--on-dark); }
/* 两步向导 · 第 2 步：逐包勾选版本 */
.pw-list { max-height: 52vh; overflow-y: auto; padding: 2px; display: grid; gap: 14px; }
.pw-pkg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.pw-code { font-family: var(--font-mono); font-weight: 700; color: var(--text); font-size: 13px; }
.pw-pkg-name { font-size: 13px; font-weight: 600; }
.pw-vers { display: grid; gap: 6px; }
.pw-ver { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 7px 12px; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.pw-ver:hover { border-color: var(--text); }
.pw-ver.on { border-color: var(--text); background: var(--text); }
.pw-ver .pwv-id { font-family: var(--font-mono); font-weight: 700; font-size: 12.5px; min-width: 56px; }
.pw-ver.on .pwv-id { color: var(--on-dark); }
.pw-ver .pwv-date { font-size: 11px; color: var(--text-faint); }
.pw-ver.on .pwv-date { color: var(--on-dark-faint); }
.pw-ver.on .cmp-pick-dot { background: var(--on-dark); border-color: var(--on-dark); color: var(--text); }
/* 全选 / 取消全选按钮（第 1 步 footer、第 2 步包头部与 footer） */
.pw-all-btn { border: none; background: none; font-size: 12px; color: var(--text); cursor: pointer; padding: 3px 10px; border-radius: var(--r-sm); flex-shrink: 0; user-select: none; }
.pw-all-btn:hover { background: var(--surface-muted); }
.modal-foot .pw-all-btn { margin-right: auto; }
.cmp-ver-none { font-size: 11px; color: var(--text-faint); padding: 3px 0; }

/* 对比界面 */
.cmp-view { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: auto; }
.cmp-bar { padding: 9px 16px; font-size: 12px; color: var(--text-sub); border-bottom: 1px solid var(--border); background: var(--surface-muted); }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 540px; }
.cmp-table th { position: sticky; top: 0; z-index: 1; background: var(--surface-muted); color: var(--text); font-size: 12px; font-weight: 600; text-align: left; padding: 9px 16px; white-space: nowrap; }
.cmp-table th .cmp-th-code { font-family: var(--font-mono); font-weight: 700; margin-right: 6px; opacity: .85; }
.cmp-table th.cmp-item, .cmp-table td.cmp-item { min-width: 220px; }
.cmp-table td { padding: 7px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.cmp-table tr.cmp-sec td { background: var(--surface-muted); color: var(--text); font-weight: 700; font-size: 12px; padding: 7px 16px; }
.cmp-table tr.cmp-sec em { font-style: normal; font-weight: 500; margin-left: 8px; color: var(--text-sub); font-size: 11px; }
.cmp-table tr.cmp-diff td { background: var(--accent-soft); }
.cmp-table tr.cmp-diff td.cmp-item { box-shadow: inset 3px 0 0 var(--accent); }
.cmp-table td.cmp-yes { color: var(--text); }
.cmp-table td.cmp-none { color: var(--text-faint); }
.cmp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-col-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-muted); color: var(--text); border-radius: var(--r-full); padding: 3px 11px; font-size: 12px; font-weight: 500; }
.cmp-col-chip b { font-family: var(--font-mono); }
.cmp-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-sub); cursor: pointer; user-select: none; }
.cmp-toggle input { display: none; }
.cmp-toggle-track { width: 34px; height: 19px; border-radius: var(--r-full); background: var(--border-strong); position: relative; transition: background .15s; flex-shrink: 0; }
.cmp-toggle-knob { position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: var(--shadow-sm); }
.cmp-toggle input:checked + .cmp-toggle-track { background: var(--text); }
.cmp-toggle input:checked + .cmp-toggle-track .cmp-toggle-knob { left: 17px; }

/* ===== 左侧导航响应式 ===== */
@media (max-width: 720px) {
  .sidebar { width: 60px; padding: var(--sp-3) var(--sp-2); }
  .sidebar .nav-sec { display: none; }
  .mainnav-btn { justify-content: center; padding: 10px; }
  .mainnav-btn span:not(.nav-ico) { display: none; }
}

/* ===== 登录遮罩 ===== */
.login-mask {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--bg);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .2s ease, visibility .2s;
}
.login-mask.show { opacity: 1; visibility: visible; pointer-events: auto; }

.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-6);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: var(--sp-5); }
.login-logo {
  width: 46px; height: 46px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); color: var(--on-dark); background: var(--text);
  box-shadow: var(--shadow-md);
}
.login-title { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.1; }
.login-sub { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.login-error {
  min-height: 18px; font-size: 12px; color: var(--danger);
  margin: -6px 0 10px; opacity: 0; transition: opacity .15s ease;
}
.login-error.show { opacity: 1; }
.login-form .btn { width: 100%; justify-content: center; margin-top: 2px; }

/* 用户下拉：开发模式 / 退出登录 */
.user-drop-head { display: flex; align-items: center; gap: 8px; }
.dev-pill {
  margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .03em;
  color: var(--text); background: var(--surface-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full); padding: 1px 8px;
}
.user-drop-divider { height: 1px; background: var(--border); margin: 4px 0; }
.user-drop-item.static { cursor: default; }
.user-drop-item.static:hover { background: transparent; }
.user-drop-item.logout { color: var(--text-sub); }
.user-drop-item.logout:hover { background: var(--danger-soft); color: var(--danger); }

/* ===== 暗色主题（黑白灰主体 + 马卡龙语义点缀） ===== */
html[data-theme="dark"] {
  color-scheme: dark;

  /* 中性色反转 */
  --bg: #0B0B0C;
  --surface: #161618;
  --surface-muted: #1F1F22;
  --border: #42424A;
  --border-strong: #6C6C75;
  --text: #F2F2F3;
  --text-hover: #D6D6D9;
  --text-sub: #B3B3BA;
  --text-faint: #9A9AA1;
  --on-dark: #0B0B0C;
  --on-dark-sub: rgba(11, 11, 12, 0.65);
  --on-dark-faint: rgba(11, 11, 12, 0.55);

  /* 马卡龙语义点缀色（提亮，保持柔和） */
  --accent: #E39BB4;
  --accent-soft: #2B1C23;
  --accent-border: rgba(227, 155, 180, 0.4);
  --danger: #E58A9E;
  --danger-soft: #2B1B20;
  --info: #8FB4E8;
  --info-soft: #17212E;
  --info-strong: #A8C2EA;
  --info-border: rgba(143, 180, 232, 0.4);
  --success: #8FC5AA;
  --success-soft: #16251E;
  --success-border: rgba(143, 197, 170, 0.4);
  --purple: #9C8FCC;

  /* 头像色板（暗色下提亮，深墨字对比度 6.7～10:1） */
  --avatar-ink: #0B0B0C;
  --av-1: #E39BB4;
  --av-2: #8FB4E8;
  --av-3: #8FC5AA;
  --av-4: #9C8FCC;
  --av-5: #E58A9E;

  /* 功能域分类色（提亮） */
  --fam-mill: #80A7D7;
  --fam-mill-soft: #1A2433;
  --fam-turn: #C99A6B;
  --fam-turn-soft: #2A2118;
  --fam-grind: #9C8FCC;
  --fam-grind-soft: #211D33;
  --fam-gear: #80BF9B;
  --fam-gear-soft: #182620;
  --fam-comp: #D4879F;
  --fam-comp-soft: #2B1C23;

  /* 阴影增强（黑底上用更重的黑） */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.6);
}

/* 暗色下：半透明白表面 → 半透明黑表面 */
html[data-theme="dark"] .topbar {
  background: rgba(11, 11, 12, 0.85);
}
html[data-theme="dark"] .sidebar {
  background: rgba(11, 11, 12, 0.5);
}
html[data-theme="dark"] .domain-item.active .cnt {
  background: rgba(11, 11, 12, 0.18);
  color: rgba(11, 11, 12, 0.85);
}
/* 暗色下开关轮廓需达到 3:1，才能看清轨道与滑块边界 */
html[data-theme="dark"] .mu-sw,
html[data-theme="dark"] .mu-sw .mu-sw-thumb { border-color: var(--border-strong); }

/* ICP 备案号（合规要求：挂在登录页底部并链接工信部） */
.login-icp { margin-top: 18px; text-align: center; font-size: 12px; color: var(--text-faint); }
.login-icp a { color: inherit; text-decoration: none; }
.login-icp a:hover { text-decoration: underline; }
