/* ============================================================
   APS 智能排程系统 — 设计系统（从零重构 2026-07-17）
   黑夜为默认主题；[data-theme="light"] 切白日。
   色板：经 CVD 验证的 8 色分类色板 + 独立状态色 + 蓝色主色阶。
   ============================================================ */

/* ---------- 1. 设计令牌 ---------- */
:root {
  /* 表面与文字（黑夜） */
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #222221;
  --surface-3: #2a2a28;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --grid-line: #2c2c2a;
  --text: #f4f3ee;
  --text-2: #c3c2b7;
  --text-3: #898781;
  --inverse: #0b0b0b;

  /* 主色（蓝阶） */
  --accent: #3987e5;
  --accent-strong: #5598e7;
  --accent-deep: #1c5cab;
  --accent-soft: rgba(57, 135, 229, 0.14);
  --accent-ring: rgba(57, 135, 229, 0.45);

  /* 状态色（固定，不随主题换色相） */
  --good: #0ca30c;
  --good-soft: rgba(12, 163, 12, 0.15);
  --warn: #fab219;
  --warn-soft: rgba(250, 178, 25, 0.15);
  --serious: #ec835a;
  --serious-soft: rgba(236, 131, 90, 0.15);
  --crit: #d03b3b;
  --crit-strong: #e05252;
  --crit-soft: rgba(208, 59, 59, 0.16);
  --violet: #9085e9;
  --violet-soft: rgba(144, 133, 233, 0.15);
  /* 交期预警（荧光黄描边+辉光） */
  --deadline: #eaff29;
  --deadline-glow: rgba(234, 255, 41, 0.40);

  /* 分类色板（黑夜档，甘特/图例/批次用） */
  --cat-1: #3987e5; --cat-2: #199e70; --cat-3: #c98500; --cat-4: #008300;
  --cat-5: #9085e9; --cat-6: #e66767; --cat-7: #d55181; --cat-8: #d95926;

  /* 几何 */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --sidebar-w: 236px;
  --topbar-h: 52px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-pop: 0 12px 48px rgba(0, 0, 0, 0.55);

  /* 字体 */
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Courier New", monospace;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f6f5f2;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --surface-3: #eceae5;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.20);
  --grid-line: #e1e0d9;
  --text: #17170f;
  --text-2: #52514e;
  --text-3: #898781;
  --inverse: #ffffff;

  --accent: #2a78d6;
  --accent-strong: #256abf;
  --accent-deep: #184f95;
  --accent-soft: rgba(42, 120, 214, 0.10);
  --accent-ring: rgba(42, 120, 214, 0.35);

  --good-soft: rgba(12, 163, 12, 0.12);
  --warn-soft: rgba(201, 133, 0, 0.14);
  --serious-soft: rgba(236, 131, 90, 0.14);
  --crit-soft: rgba(208, 59, 59, 0.10);
  --violet: #4a3aa7;
  --violet-soft: rgba(74, 58, 167, 0.10);
  /* 白日主题荧光黄加深一档，保证浅底上依然醒目 */
  --deadline: #e3d400;
  --deadline-glow: rgba(227, 212, 0, 0.45);

  --cat-1: #2a78d6; --cat-2: #1baf7a; --cat-3: #eda100; --cat-4: #008300;
  --cat-5: #4a3aa7; --cat-6: #e34948; --cat-7: #e87ba4; --cat-8: #eb6834;

  --shadow-1: 0 1px 2px rgba(20, 18, 10, 0.06);
  --shadow-2: 0 6px 20px rgba(20, 18, 10, 0.10);
  --shadow-pop: 0 12px 40px rgba(20, 18, 10, 0.18);

  color-scheme: light;
}

/* ---------- 2. 基础重置 ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
p { margin: 0.4em 0; }
::selection { background: var(--accent-soft); }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- 3. 应用布局 ---------- */
#app { display: flex; min-height: 100vh; }

#sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 60;
  transition: transform 0.22s ease;
}
body.sidebar-collapsed #sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }

#main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex; flex-direction: column;
  transition: margin-left 0.22s ease;
}
body.sidebar-collapsed #main { margin-left: 0; }

/* 品牌区 */
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: var(--shadow-1);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-title { font-size: 15px; font-weight: 700; letter-spacing: 0.02em; }
.brand-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }

/* 导航 */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 10px 24px; }
.nav-group { margin-top: 6px; }
.nav-group > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--text-3);
  padding: 8px 10px 4px;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after {
  content: ""; width: 7px; height: 7px; margin-left: auto;
  border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3);
  transform: rotate(45deg); transition: transform 0.15s ease;
}
.nav-group:not([open]) > summary::after { transform: rotate(-45deg); }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13px;
  border-left: 2px solid transparent;
}
.nav-item svg { width: 16px; height: 16px; flex: none; opacity: 0.75; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft); color: var(--accent-strong);
  border-left-color: var(--accent);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }
#sidebar-scrim { display: none; }

/* 顶栏 */
#topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
#page-title { font-size: 16px; font-weight: 700; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.clock { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* 用户胶囊 */
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; position: relative;
}
.user-chip:hover { border-color: var(--border-strong); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.user-name { font-size: 12.5px; font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 200px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 6px; z-index: 80;
}
.user-menu-head { padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 0; background: none; text-align: left;
  color: var(--text-2); font-size: 13px; font-family: inherit;
  border-radius: var(--radius-sm); cursor: pointer;
}
.user-menu-item svg { width: 15px; height: 15px; flex: none; opacity: 0.8; }
.user-menu-item:hover { background: var(--surface-2); color: var(--text); }
.user-menu-item.danger:hover { background: var(--crit-soft); color: var(--crit-strong); }

/* 内容区 */
#content { padding: 20px 24px 56px; max-width: 1720px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; letter-spacing: 0.01em; }
.page-head .sub { color: var(--text-3); font-size: 12.5px; }
.page-head .spacer { flex: 1; }

/* ---------- 4. 卡片 / 统计块 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-1);
}
.card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; margin-bottom: 12px;
}
.card-title .hint { font-weight: 400; font-size: 12px; color: var(--text-3); }
.card-title .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px 12px;
  position: relative; overflow: hidden;
}
.stat-tile::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); opacity: 0.85;
}
.stat-tile.good::before { background: var(--good); }
.stat-tile.warn::before { background: var(--warn); }
.stat-tile.crit::before { background: var(--crit); }
.stat-tile.muted::before { background: var(--text-3); }
.stat-label { font-size: 12px; color: var(--text-3); }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 2px; line-height: 1.2; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--text-2); }
.stat-foot { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

/* ---------- 5. 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer;
  background: var(--surface-2); color: var(--text-2);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  white-space: nowrap; user-select: none; line-height: 1.4;
}
.btn:hover { background: var(--surface-3); color: var(--text); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--crit); color: #fff; }
.btn-danger:hover { background: var(--crit-strong); color: #fff; }
.btn-danger-outline { background: transparent; border-color: var(--crit); color: var(--crit-strong); }
.btn-danger-outline:hover { background: var(--crit-soft); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-icon { padding: 6px 8px; }
.btn-block { width: 100%; }

/* ---------- 6. 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.field > label .en { color: var(--text-3); font-weight: 400; font-size: 11px; }
.field .req { color: var(--crit-strong); margin-left: 2px; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="datetime-local"], input[type="time"], input[type="file"], select, textarea {
  font-family: inherit; font-size: 13px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; width: 100%;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:disabled, select:disabled, input[readonly] { opacity: 0.6; cursor: not-allowed; }
textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
select {
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
                    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
  padding-right: 28px;
}

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; flex: none; }
.check:hover { color: var(--text); }

.form-actions { display: flex; gap: 10px; margin-top: 14px; align-items: center; flex-wrap: wrap; }

/* ---------- 7. 表格 ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  position: sticky; top: 0; z-index: 2;
  text-align: left; font-weight: 600; font-size: 11.5px;
  color: var(--text-3); letter-spacing: 0.03em;
  background: var(--surface-2);
  padding: 9px 12px; border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
table.data td {
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle; color: var(--text-2);
}
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data td .main { color: var(--text); font-weight: 500; }
table.data td .sub { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; }
table.data td.actions { white-space: nowrap; text-align: right; }
table.data td.actions .btn { margin-left: 6px; }
.table-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.table-toolbar input[type="text"] { max-width: 240px; }
.table-toolbar select { width: auto; }
.table-meta { font-size: 12px; color: var(--text-3); margin-left: auto; }
.pager { display: flex; gap: 6px; align-items: center; margin-top: 10px; justify-content: flex-end; font-size: 12px; color: var(--text-3); }

/* ---------- 8. 徽章 / 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; line-height: 1;
  padding: 4px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
:root[data-theme="light"] .tag.warn { color: #8a6100; }
.tag.crit { background: var(--crit-soft); color: var(--crit-strong); }
.tag.serious { background: var(--serious-soft); color: var(--serious); }
:root[data-theme="light"] .tag.serious { color: #b05528; }
.tag.accent { background: var(--accent-soft); color: var(--accent-strong); }
.tag.violet { background: var(--violet-soft); color: var(--violet); }
.tag.outline { background: transparent; border: 1px solid var(--border-strong); }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- 9. 横幅 / 提示条 ---------- */
.banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; color: var(--text-2); margin-bottom: 14px;
}
.banner.info { border-color: var(--accent); border-left-width: 3px; background: var(--accent-soft); }
.banner.warn { border-color: var(--warn); border-left-width: 3px; background: var(--warn-soft); }
.banner.crit { border-color: var(--crit); border-left-width: 3px; background: var(--crit-soft); }
.banner.good { border-color: var(--good); border-left-width: 3px; background: var(--good-soft); }
.banner .right { margin-left: auto; display: flex; gap: 8px; }
.banner > svg { width: 16px; height: 16px; flex: none; opacity: 0.8; }

/* 本页说明 */
.page-help { margin-bottom: 14px; }
.page-help > details {
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 0; background: transparent;
}
.page-help summary {
  cursor: pointer; user-select: none; list-style: none;
  padding: 8px 14px; font-size: 12.5px; color: var(--text-3); font-weight: 600;
}
.page-help summary::-webkit-details-marker { display: none; }
.page-help ul { margin: 0; padding: 0 16px 10px 30px; color: var(--text-3); font-size: 12.5px; }
.page-help li { margin: 3px 0; }
body.hide-page-help .page-help { display: none; }

/* ---------- 10. 模态框 ---------- */
#modal-overlay, .overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}
#modal-overlay.hidden, .overlay.hidden { display: none; }
#modal-box, .overlay-box {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
  width: 100%; max-width: 560px; max-height: 86vh;
  display: flex; flex-direction: column;
  animation: popIn 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
#modal-box.wide { max-width: 880px; }
#modal-title { font-size: 15px; font-weight: 700; padding: 16px 20px 0; }
#modal-body { padding: 12px 20px; overflow-y: auto; font-size: 13px; color: var(--text-2); }
#modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 11. Toast ---------- */
#toast-container {
  position: fixed; top: 14px; right: 16px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-left-width: 3px;
  border-radius: var(--radius); box-shadow: var(--shadow-2);
  padding: 10px 14px; font-size: 13px; max-width: 380px;
  animation: toastIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15);
  pointer-events: auto;
}
.toast.success { border-left-color: var(--good); }
.toast.error { border-left-color: var(--crit); }
.toast.warning { border-left-color: var(--warn); }
.toast.info { border-left-color: var(--accent); }
.toast.leaving { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }

/* ---------- 12. 登录 / 更新说明遮罩 ---------- */
#auth-overlay {
  position: fixed; inset: 0; z-index: 300;
  background:
    radial-gradient(1100px 500px at 80% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-box {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 16px; box-shadow: var(--shadow-pop);
  padding: 30px 30px 26px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-brand .brand-mark { width: 42px; height: 42px; border-radius: 11px; }
.auth-brand .brand-mark svg { width: 24px; height: 24px; }
.auth-title { font-size: 18px; font-weight: 700; }
.auth-sub { font-size: 12px; color: var(--text-3); }
.auth-box .field { margin-bottom: 12px; }
.auth-error { color: var(--crit-strong); font-size: 12.5px; min-height: 18px; margin: 2px 0 8px; }
.update-notice-list { margin: 8px 0 4px; padding-left: 20px; color: var(--text-2); font-size: 13px; }
.update-notice-list li { margin: 5px 0; }

/* ---------- 13. 加载 / 空状态 / 进度 ---------- */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite; display: inline-block; vertical-align: -4px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: flex; align-items: center; gap: 10px; color: var(--text-3); padding: 32px; justify-content: center; font-size: 13px; }
.empty {
  padding: 40px 20px; text-align: center; color: var(--text-3); font-size: 13px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: transparent;
}
.empty .big { font-size: 30px; opacity: 0.5; margin-bottom: 6px; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent-strong));
  transition: width 0.5s ease;
}
.mini-meter { display: flex; align-items: center; gap: 8px; }
.mini-meter .progress { flex: 1; min-width: 60px; }

/* ---------- 14. 选项卡 / 分段控件 ---------- */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg > button {
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  border: 0; background: transparent; color: var(--text-3);
  padding: 5px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap;
}
.seg > button:hover { color: var(--text); }
.seg > button.active { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-1); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; flex-wrap: wrap; }
.tabs > button {
  font-family: inherit; font-size: 13px; font-weight: 600;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-3); padding: 8px 14px; cursor: pointer; margin-bottom: -1px;
}
.tabs > button:hover { color: var(--text); }
.tabs > button.active { color: var(--accent-strong); border-bottom-color: var(--accent); }

/* ---------- 15. 上传区 ---------- */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  padding: 18px; text-align: center; color: var(--text-3); font-size: 12.5px;
  cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); color: var(--text-2); }
.dropzone input[type="file"] { display: none; }

/* ---------- 16. 向导 ---------- */
.wizard-steps { display: flex; gap: 0; margin-bottom: 18px; overflow-x: auto; }
.wizard-step { display: flex; align-items: center; gap: 8px; padding: 6px 10px; color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.wizard-step .n {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--border-strong); color: var(--text-3);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.wizard-step.active { color: var(--text); font-weight: 600; }
.wizard-step.active .n { background: var(--accent); border-color: var(--accent); color: #fff; }
.wizard-step.done .n { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.wizard-step + .wizard-step::before { content: ""; width: 26px; height: 1px; background: var(--border-strong); margin-right: 8px; }

/* ---------- 17. SVG 图表容器 ---------- */
.chart-card svg { display: block; width: 100%; height: auto; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.chart-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.chart-tile .t { font-size: 12.5px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chart-tile .t .tag { margin-left: auto; }

/* ============================================================
   18. 甘特图
   ============================================================ */
.gantt-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.gantt-toolbar .zoom { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.gantt-toolbar input[type="range"] { width: 130px; accent-color: var(--accent); }
.gantt-filterbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.gantt-filterbar select { width: auto; max-width: 200px; font-size: 12px; padding: 5px 26px 5px 8px; }
.gantt-filterbar .hint { font-size: 12px; color: var(--text-3); }

.gantt-scroll {
  position: relative; overflow: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
  max-height: calc(100vh - 210px);
  cursor: grab; user-select: none;
}
.gantt-scroll.panning { cursor: grabbing; }
.gantt-canvas { position: relative; min-width: 100%; }

/* 时间轴（冻结顶部） */
.g-timeline { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border-strong); }
.g-tl-row { position: relative; height: 22px; }
.g-tl-row.days { height: 20px; }
.g-tl-cell {
  position: absolute; top: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-3);
  border-left: 1px solid var(--grid-line);
  overflow: hidden; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.g-tl-cell.month { font-weight: 700; color: var(--text-2); justify-content: flex-start; padding-left: 8px; }
.g-tl-cell.night { background: rgba(120, 120, 160, 0.07); }

.g-corner {
  position: sticky; left: 0; z-index: 35; flex: none;
  background: var(--surface-2); border-right: 1px solid var(--border-strong);
  display: flex; align-items: flex-end; padding: 4px 10px;
  font-size: 11px; color: var(--text-3); font-weight: 600;
}
.g-tl-body { position: relative; flex: 1; min-width: 0; }

/* 泳道 */
.g-lane { display: flex; border-bottom: 1px solid var(--grid-line); position: relative; }
.g-sub-label {
  position: absolute; left: 4px; top: 2px; z-index: 8;
  font-size: 9.5px; color: var(--text-3); padding: 0 5px;
  background: var(--surface); opacity: 0.92; border-radius: 4px;
  max-width: 200px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  pointer-events: none;
}
.g-lane-name {
  position: sticky; left: 0; z-index: 20; flex: none;
  background: var(--surface-2);
  border-right: 1px solid var(--border-strong);
  padding: 3px 10px; cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; gap: 0;
}
.g-lane-name:hover { background: var(--surface-3); }
.g-lane-name .nm { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; flex: none; }
.g-lane-name .meta { font-size: 10.5px; color: var(--text-3); white-space: nowrap; line-height: 1.25; flex: none; }
.g-lane-body { position: relative; flex: 1; min-width: 0; }
.g-lane-sub { position: relative; border-top: 1px dotted var(--grid-line); }
.g-lane-sub:first-child { border-top: 0; }

/* 网格与当前时间线 */
.g-grid-line { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--grid-line); pointer-events: none; }
.g-grid-line.day { border-left-color: var(--border-strong); }
.g-nowline { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--crit-strong); z-index: 10; pointer-events: none; }

/* 甘特条 */
.g-bar {
  position: absolute; height: 24px;
  border-radius: 5px;
  color: #fff; font-size: 10.5px; line-height: 1.15;
  padding: 1px 6px; overflow: hidden; cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: filter 0.1s ease;
}
.g-bar:hover { filter: brightness(1.12); z-index: 9 !important; }
.g-bar .l1 { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-bar .l2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.85; font-size: 9.5px; }
.g-bar.no-text .l1, .g-bar.no-text .l2 { display: none; }
.g-bar { transition: filter 0.1s ease, min-width 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.1), box-shadow 0.15s ease; }
.g-bar.hover-grow {
  min-width: 170px; z-index: 12 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.g-bar.hover-grow .l1, .g-bar.hover-grow .l2 { display: block; }

/* 悬停信息卡（跟随光标的完整信息提示） */
#g-tooltip {
  position: fixed; z-index: 250; pointer-events: none;
  max-width: 340px; padding: 10px 13px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-pop);
  font-size: 12px; line-height: 1.5; color: var(--text-2);
  opacity: 0; transform: translateY(5px) scale(0.98);
  transition: opacity 0.14s ease, transform 0.14s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
#g-tooltip.show { opacity: 1; transform: none; }
#g-tooltip .tt-title {
  font-size: 12.5px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 6px; margin-bottom: 5px;
}
#g-tooltip .tt-sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
#g-tooltip .tt-row { display: flex; gap: 8px; }
#g-tooltip .tt-row .k { color: var(--text-3); flex: none; min-width: 3.5em; }
#g-tooltip .tt-warn { color: var(--crit-strong); font-weight: 600; margin-top: 4px; }
#g-tooltip .tt-foot { color: var(--text-3); font-size: 11px; margin-top: 5px; border-top: 1px solid var(--border); padding-top: 5px; }
.g-bar.deadline-miss {
  border: 3px solid var(--deadline);
  box-shadow: 0 0 0 2px var(--deadline-glow), 0 0 10px var(--deadline-glow), inset 0 1px 0 rgba(255,255,255,0.18);
}
.g-bar.manual-lock { outline: 2px dashed #ffd35c; outline-offset: -2px; }
.g-bar.progress-lock {
  background: repeating-linear-gradient(45deg, #4c4c58, #4c4c58 6px, #3c3c46 6px, #3c3c46 12px) !important;
  color: #ddd;
}
.g-bar.changeover {
  background: repeating-linear-gradient(135deg, transparent, transparent 4px, rgba(137,135,129,0.55) 4px, rgba(137,135,129,0.55) 8px);
  border: 1px dashed var(--text-3); color: var(--text-2);
  box-shadow: none;
}
.g-bar.editable-hint { cursor: ew-resize; }
.g-bar.mini { height: 6px; padding: 0; border-radius: 3px; }
:root[data-theme="light"] .g-bar { border-color: rgba(255,255,255,0.55); box-shadow: none; }

/* 图例 */
.g-legend { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 10px 2px 0; font-size: 11.5px; color: var(--text-3); }
.g-legend .it { display: inline-flex; align-items: center; gap: 5px; }
.g-legend .sw { width: 14px; height: 10px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,0.3); }
:root[data-theme="light"] .g-legend .sw { border-color: rgba(0,0,0,0.15); }

/* 甘特编辑模式 */
.gantt-editbar { display: none; gap: 8px; align-items: center; }
body.gantt-editing .gantt-editbar { display: flex; }
body.gantt-editing .gantt-scroll { cursor: default; }

/* 甘特详情弹窗 */
.gd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 14px; margin: 8px 0; }
.gd-item .k { font-size: 11px; color: var(--text-3); }
.gd-item .v { font-size: 13px; color: var(--text); font-weight: 500; word-break: break-all; }
.gd-trace { font-size: 12px; color: var(--text-3); }
.gd-trace summary { cursor: pointer; color: var(--text-3); font-size: 12px; margin: 6px 0; }

/* ---------- 18.5 页头 / KPI / 快捷入口 / 列表项 / 二级菜单（showcase 风格） ---------- */
.page-header { display: flex; align-items: flex-start; gap: 16px; margin: 2px 0 18px; flex-wrap: wrap; }
.page-header h1 { font-size: 19px; font-weight: 700; letter-spacing: 0.01em; }
.page-header p { color: var(--text-3); font-size: 12.5px; margin: 3px 0 0; max-width: 640px; }
.page-header .header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.stat-tile .kpi-meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.stat-tile .kpi-meta .up { color: var(--good); font-weight: 600; }
.stat-tile .kpi-meta .down { color: var(--crit-strong); font-weight: 600; }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.quick-card {
  font-family: inherit; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.quick-card:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px); }
.quick-card .qc-icon {
  width: 34px; height: 34px; border-radius: 9px; margin-bottom: 10px;
  background: var(--accent-soft); color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
}
.quick-card .qc-icon svg { width: 18px; height: 18px; }
.quick-card h4 { font-size: 13.5px; font-weight: 700; color: var(--text); margin: 0 0 3px; }
.quick-card p { font-size: 11.5px; color: var(--text-3); margin: 0; line-height: 1.45; }

.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; }
.list-item .li-icon {
  width: 32px; height: 32px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.list-item .li-icon svg { width: 16px; height: 16px; }
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-desc { font-size: 11.5px; color: var(--text-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-meta { font-size: 11.5px; color: var(--text-3); flex: none; }

/* 基础数据中心：左侧二级菜单布局 */
.md-layout { display: grid; grid-template-columns: 188px minmax(0, 1fr); gap: 16px; align-items: start; }
.md-nav {
  position: sticky; top: calc(var(--topbar-h) + 14px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 8px; display: flex; flex-direction: column; gap: 2px;
}
.md-nav .md-sec { font-size: 10.5px; font-weight: 700; color: var(--text-3); letter-spacing: 0.07em; padding: 8px 10px 3px; }
.md-nav button {
  font-family: inherit; font-size: 12.5px; text-align: left;
  background: none; border: 0; border-left: 2px solid transparent;
  color: var(--text-2); padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.md-nav button:hover { background: var(--surface-2); color: var(--text); }
.md-nav button.active { background: var(--accent-soft); color: var(--accent-strong); border-left-color: var(--accent); font-weight: 600; }
@media (max-width: 1100px) {
  .md-layout { grid-template-columns: 1fr; }
  .md-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .md-nav .md-sec { display: none; }
}

/* 统一导入弹窗：步骤条 */
.imp-steps { display: flex; gap: 0; margin: 2px 0 14px; }
.imp-step { display: flex; align-items: center; gap: 7px; padding: 4px 8px; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.imp-step .n {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--border-strong); color: var(--text-3);
  display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700;
}
.imp-step.active { color: var(--text); font-weight: 600; }
.imp-step.active .n { background: var(--accent); border-color: var(--accent); color: #fff; }
.imp-step.done .n { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.imp-step + .imp-step::before { content: ""; width: 22px; height: 1px; background: var(--border-strong); margin-right: 7px; }
.dropzone h5 { font-size: 13px; color: var(--text); margin: 6px 0 2px; font-weight: 600; }
.dropzone .dz-hint { font-size: 11.5px; color: var(--text-3); }

/* ---------- 19. 工具类 ---------- */
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mt0 { margin-top: 0; } .mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0; } .mb8 { margin-bottom: 8px; }
.hidden { display: none !important; }
.text-right { text-align: right; }
.danger-text { color: var(--crit-strong); }
.good-text { color: var(--good); }
.warn-text { color: var(--warn); }
:root[data-theme="light"] .warn-text { color: #8a6100; }
.divider { height: 1px; background: var(--border); margin: 14px 0; border: 0; }
kbd {
  font-family: var(--mono); font-size: 11px;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px;
}

/* 只读角色：隐藏写操作 */
body.role-user .admin-only { display: none !important; }

/* ---------- 20. 响应式 ---------- */
@media (max-width: 960px) {
  #sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); box-shadow: var(--shadow-pop); }
  body.sidebar-open #sidebar { transform: none; }
  #main { margin-left: 0 !important; }
  #sidebar-scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 55; }
  body.sidebar-open #sidebar-scrim { display: block; }
  #content { padding: 14px 14px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
  .clock { display: none; }
}
@media print {
  #sidebar, #topbar, .gantt-toolbar, .gantt-filterbar, #toast-container { display: none !important; }
  #main { margin: 0; }
  body { background: #fff; }
}

/* ---------- 21. 流程总览（views_flow.js） ---------- */
.fv-tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin-bottom: 12px;
}
.fv-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px 10px; box-shadow: var(--shadow-1);
  opacity: 0; transform: translateY(12px); animation: fv-rise .55s cubic-bezier(.2,.7,.2,1) forwards;
  animation-delay: calc(var(--i) * 60ms);
}
.fv-tile.warn { border-color: var(--warn); }
.fv-tile .k { font-size: 12px; color: var(--text-3); font-weight: 600; letter-spacing: .3px; }
.fv-tile .v { font-size: 24px; font-weight: 700; margin-top: 2px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.fv-tile.warn .v { color: var(--warn); }
.fv-tile .s { font-size: 11px; color: var(--text-2); margin-top: 4px; }
@keyframes fv-rise { to { opacity: 1; transform: none; } }

.fv-controls {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; box-shadow: var(--shadow-1);
  position: sticky; top: 8px; z-index: 30;
}
.fv-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fv-ctl .lab { font-size: 12px; color: var(--text-3); font-weight: 600; }
.fv-seg { display: flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; }
.fv-seg button {
  border: 0; background: transparent; color: var(--text-2); font-size: 12.5px; font-weight: 600;
  font-family: var(--font); padding: 5px 12px; border-radius: 6px; cursor: pointer; transition: all .18s;
}
.fv-seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.fv-dd { position: relative; }
.fv-dd-btn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-size: 12px; font-weight: 600; font-family: var(--font);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.fv-dd-btn:hover { background: var(--surface-3); }
.fv-dd-btn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.fv-dd-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 6px; min-width: 230px; max-height: 340px; overflow: auto;
}
.fv-dd-panel[hidden] { display: none; }
.fv-dd-head {
  display: flex; gap: 6px; align-items: center; justify-content: flex-end;
  padding: 2px 4px 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.fv-dd-head input {
  flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 12px; padding: 4px 8px; font-family: var(--font);
}
.fv-dd-head button {
  border: 0; background: var(--surface-2); color: var(--text-2); font-size: 11px; font-weight: 600;
  font-family: var(--font); padding: 3px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.fv-dd-head button:hover { color: var(--text); }
.fv-dd-item {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px;
  cursor: pointer; font-size: 12px; color: var(--text-2);
}
.fv-dd-item:hover { background: var(--surface-2); color: var(--text); }
.fv-dd-item input { accent-color: var(--accent); cursor: pointer; }
.fv-dd-more { font-size: 11px; color: var(--text-3); padding: 6px; }
.fv-legend { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.fv-legend .li { display: flex; align-items: center; gap: 5px; }
.fv-legend .sw { width: 16px; height: 4px; border-radius: 2px; }
.fv-legend .box { width: 14px; height: 11px; border: 1.5px dashed var(--text-3); border-radius: 3px; }
.fv-legend .dashline { width: 18px; height: 0; border-top: 2px dashed var(--text-3); }

.fv-board-wrap { overflow-x: auto; overflow-y: hidden; position: relative; padding: 0; }
.fv-board { position: relative; width: max-content; min-width: 100%; padding: 14px 14px 20px; display: flex; gap: 0; }
#fv-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
#fv-svg path.fv-flow {
  fill: none; stroke-linecap: round; pointer-events: stroke; cursor: pointer;
  transition: opacity .25s ease, stroke-width .25s ease;
}
#fv-svg path.fv-flow.dim { opacity: .05; }
#fv-svg path.fv-flow.hi { opacity: .95; }
#fv-svg path.fv-flow.hi.animated { stroke-dasharray: 7 11; animation: fv-dash 1s linear infinite; }
#fv-svg path.fv-flow.alt { stroke-dasharray: 4 7; }
@keyframes fv-dash { to { stroke-dashoffset: -18; } }

.fv-col { position: relative; z-index: 2; display: flex; flex-direction: column; flex: 1; min-width: 108px; pointer-events: none; }
.fv-col .fv-pcard, .fv-col .fv-node, .fv-col .fv-glab { pointer-events: auto; }
.fv-col.fv-products { flex: 0 0 190px; }
.fv-col.fv-spacer { flex: 0 0 22px; min-width: 22px; }
.fv-col-head {
  display: flex; align-items: center; gap: 6px; margin-bottom: 12px; padding: 0 2px;
  opacity: 0; animation: fv-rise .5s ease forwards; animation-delay: calc(var(--i) * 60ms + 150ms);
}
.fv-col-head .num {
  width: 17px; height: 17px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 9.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none;
}
.fv-col-head .t { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fv-col-head .c {
  font-size: 9.5px; color: var(--text-3); font-weight: 600; margin-left: auto;
  background: var(--surface-2); padding: 1px 6px; border-radius: 999px; white-space: nowrap;
}
.fv-col-body { display: flex; flex-direction: column; justify-content: space-between; flex: 1; gap: 7px; }

.fv-grp {
  position: relative; border: 1.5px dashed var(--gc, var(--text-3)); border-radius: 10px;
  padding: 8px 4px 4px; display: flex; flex-direction: column; gap: 5px;
  opacity: 0; animation: fv-rise .45s ease forwards; animation-delay: calc(var(--i) * 30ms + 200ms);
  transition: opacity .3s;
}
.fv-grp.dim { opacity: .25; }
.fv-glab {
  position: absolute; top: -9px; left: 6px; max-width: calc(100% - 12px);
  font-size: 9.5px; font-weight: 700; letter-spacing: .2px; color: var(--gc, var(--text-2));
  background: var(--surface); border: 1px solid var(--gc, var(--text-3));
  padding: 1px 8px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; z-index: 3; transition: transform .15s;
}
.fv-glab:hover { transform: scale(1.06); }

.fv-pcard {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--gc, var(--border-strong)); border-radius: 8px;
  padding: 5px 8px; cursor: pointer; box-shadow: var(--shadow-1);
  transition: transform .18s ease, box-shadow .18s ease, opacity .3s, border-color .18s;
}
.fv-pcard:hover, .fv-pcard.hi { transform: translateX(3px); box-shadow: var(--shadow-2); }
.fv-pcard.dim { opacity: .28; }
.fv-pcard.pin { box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-2); border-color: var(--accent); }
.fv-pcard .nm { font-size: 11.5px; font-weight: 700; line-height: 1.3; word-break: break-all; }
.fv-pcard .meta { display: flex; align-items: center; gap: 5px; margin-top: 3px; flex-wrap: wrap; }
.fv-pcard .chip {
  font-size: 9.5px; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); padding: 0 6px; border-radius: 999px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.fv-pcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.fv-node {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--stage-c, var(--accent)); border-radius: 8px;
  padding: 3px 7px; cursor: pointer; box-shadow: var(--shadow-1);
  transition: transform .18s ease, box-shadow .18s ease, opacity .3s, border-color .18s;
}
.fv-grp .fv-node { animation: none; opacity: 1; }
.fv-node:hover, .fv-node.hi { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.fv-node.dim { opacity: .22; }
.fv-node.todo { border-style: dashed; background: transparent; }
.fv-node.todo .id { color: var(--warn); }
.fv-node .id {
  font-family: var(--mono); font-size: 10px; font-weight: 700; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fv-node .eq {
  font-size: 9px; color: var(--text-2); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums;
}
.fv-node .cnt {
  position: absolute; top: -6px; right: -5px; min-width: 14px; height: 14px; padding: 0 3px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 8.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-1);
}
.fv-node.todo .cnt { background: var(--warn); color: var(--inverse); }
.fv-col-body > .fv-node { opacity: 0; animation: fv-rise .45s ease forwards; animation-delay: calc(var(--i) * 20ms + 240ms); }
.fv-node:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#fv-tip {
  position: fixed; z-index: 99; pointer-events: none; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 12px 14px; font-size: 12.5px; color: var(--text);
  opacity: 0; transform: translateY(6px) scale(.98); transition: opacity .16s ease, transform .16s ease;
}
#fv-tip.show { opacity: 1; transform: none; }
#fv-tip h4 { font-size: 13px; margin: 0 0 6px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
#fv-tip .tag {
  font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
}
#fv-tip table { border-collapse: collapse; width: 100%; }
#fv-tip th { font-size: 11px; color: var(--text-3); text-align: left; font-weight: 600; padding: 3px 8px 3px 0; }
#fv-tip td { font-size: 11.5px; padding: 3px 8px 3px 0; border-top: 1px solid var(--border); color: var(--text-2); font-variant-numeric: tabular-nums; }
#fv-tip td:first-child { color: var(--text); font-weight: 600; }
#fv-tip .rt { display: flex; align-items: center; gap: 6px; margin: 2px 0 6px; flex-wrap: wrap; }
#fv-tip .hint { color: var(--text-3); font-size: 11px; margin-top: 7px; }
#fv-tip .muted { color: var(--text-3); font-weight: 400; }
.gchip { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; border: 1px solid; vertical-align: baseline; }
.gchip.rule { color: var(--violet); border-color: var(--violet); font-size: 9px; padding: 0 5px; }
.todo-txt { color: var(--warn); font-style: italic; }

.fv-detail {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-1); overflow: hidden;
}
.fv-detail > summary { padding: 12px 16px; font-weight: 600; font-size: 13px; cursor: pointer; }
.fv-detail[open] > summary { border-bottom: 1px solid var(--border); }
#fv-table { padding: 0 14px 14px; }

@media (max-width: 960px) {
  .fv-legend { margin-left: 0; }
  .fv-controls { position: static; }
}

/* 流程总览：工序列拖拽调序 */
.fv-col-head { pointer-events: auto; cursor: grab; user-select: none; }
.fv-col-head:active { cursor: grabbing; }
.fv-col.dragging { opacity: .45; }
.fv-col-head.drag-over { outline: 2px dashed var(--accent); outline-offset: 3px; border-radius: 8px; background: var(--accent-soft); }

/* 流程总览：油漆工装（组别=产品组） */
.fv-node.paint {
  border-left-color: var(--cat-6);
  background: linear-gradient(135deg, var(--surface) 55%, rgba(155, 89, 182, .08));
}
.fv-node.paint .id { color: var(--cat-6); }
.fv-node.paint .cnt { background: var(--cat-6); }
.fv-node.paint.todo { border-style: dashed; background: transparent; }
.fv-node.paint.todo .id { color: var(--warn); }
.fv-legend .paint-sw {
  display: inline-block; width: 14px; height: 10px; border-radius: 3px;
  border: 1px solid var(--cat-6); background: rgba(155, 89, 182, .18);
}
