* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f6f8;
    color: #2c3e50;
}

/* ============ 未登录引导 ============ */
.login-invite { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-invite .card {
    background: #fff; border-radius: 14px; padding: 40px 36px; max-width: 460px; text-align: center;
    box-shadow: 0 6px 26px rgba(30,60,110,.12);
}
.login-invite h1 { font-size: 22px; margin-bottom: 14px; }
.login-invite p { color: #5a6b80; font-size: 14px; line-height: 1.9; margin-bottom: 22px; }
.login-invite .muted { margin-top: 14px; color: #8a97a8; font-size: 12px; }
.primary.big { display: inline-block; background: #1e5aa8; color: #fff; padding: 10px 26px; border-radius: 8px; text-decoration: none; font-size: 15px; border: 0; cursor: pointer; font-family: inherit; }
.primary.big:hover { background: #174a8c; }

/* 查看密码门禁 */
.gate-icon { font-size: 40px; margin-bottom: 8px; }
.gate-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 6px; }
.gate-row input {
    width: 220px; padding: 10px 14px; border: 1px solid #c5ccd6; border-radius: 8px;
    font-size: 14px; outline: none;
}
.gate-row input:focus { border-color: #1e5aa8; background: #f4f9ff; }
.gate-err { color: #c0392b; font-size: 12.5px; min-height: 18px; margin-bottom: 6px; }
.gate-divider { display: flex; align-items: center; gap: 12px; color: #8a97a8; font-size: 12px; margin: 14px 0; }
.gate-divider::before, .gate-divider::after { content: ""; flex: 1; height: 1px; background: #e3e8ef; }
.gate-divider span { white-space: nowrap; }
.primary.big.ghost-link { background: #fff; color: #1e5aa8; border: 1px solid #1e5aa8; }
.primary.big.ghost-link:hover { background: #f0f6fd; }

/* ============ 回收站页按钮 ============ */
.danger-btn {
    background: #fff; color: #c0392b; border: 1px solid #e7b4ad; border-radius: 7px;
    padding: 8px 16px; cursor: pointer; font-size: 13px; font-family: inherit;
}
.danger-btn:hover { background: #fdecea; }
.mini-btn {
    border: 1px solid #c5ccd6; background: #fff; color: #555; border-radius: 6px;
    padding: 3px 12px; cursor: pointer; font-size: 12.5px; font-family: inherit;
}
.mini-btn.ok { color: #1e5aa8; border-color: #b9cde8; }
.mini-btn.ok:hover { background: #eaf1fb; }
.mini-btn.danger { color: #c0392b; border-color: #e7b4ad; }
.mini-btn.danger:hover { background: #fdecea; }

/* ============ 布局 ============ */
.layout { display: flex; min-height: 100vh; }
.main { flex: 1; position: relative; min-width: 0; padding: 16px 18px 16px; }

/* ============ 左侧项目栏 ============ */
.sidebar {
    width: 262px; flex-shrink: 0; background: #fff; border-right: 1px solid #dde3ea;
    display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0;
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px; }
.brand { font-weight: 700; font-size: 15px; color: #1e5aa8; }
.side-collapse { border: 1px solid #c5ccd6; background: #fff; border-radius: 6px; width: 26px; height: 26px; cursor: pointer; color: #555; }
.side-collapse:hover { background: #eef2f7; }
.proj-scroll { flex: 1; overflow-y: auto; padding: 4px 10px; }
.new-proj {
    /* 侧栏展开：图标＋文字整行按钮；侧栏收起：仅显示「＋」图标 */
    display: flex; align-items: center; justify-content: center; gap: 6px;
    width: 100%; height: 34px; border: 1px dashed #1e5aa8; color: #1e5aa8; background: #f3f8fd;
    border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 600; line-height: 1;
    margin: 0 auto 10px; padding: 0;
}
.new-proj .np-ico { font-size: 16px; line-height: 1; }
.new-proj:hover { background: #e6f0fb; }
.sidebar.collapsed .new-proj { width: 34px; }
.sidebar.collapsed .new-proj .np-txt { display: none; }
.proj-list { list-style: none; }
.proj-item { display: flex; align-items: center; border-radius: 8px; margin-bottom: 4px; transition: background .15s; }
.proj-item:hover { background: #f1f5fa; }
.proj-item.active { background: #e3edf9; }
.proj-link { flex: 1; padding: 9px 10px; color: #2c3e50; text-decoration: none; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-ops { display: flex; gap: 2px; padding-right: 6px; }
.proj-ops .mini { border: none; background: transparent; cursor: pointer; font-size: 13px; padding: 2px 4px; border-radius: 4px; color: #7a8ba0; }
.proj-ops .mini:hover { background: #d7e2f0; color: #1e5aa8; }
.proj-ops .mini.del:hover { background: #fbe3e0; color: #c0392b; }
.proj-empty { color: #8a97a8; font-size: 12px; padding: 10px; line-height: 1.7; }

/* 部门编制预览 */
.preview-box { margin-top: 16px; border-top: 1px solid #eef2f7; padding-top: 12px; }
.preview-title { font-size: 13px; font-weight: 700; color: #2c3e50; margin-bottom: 8px; }
.preview-title .title-sub { font-size: 11px; font-weight: 400; color: #9aa7b5; margin-left: 6px; }
/* 编制预览：二级 / 三级行缩进弱化 */
.preview-body .dp-list li.dp-l2 { padding-left: 20px; font-size: 12.5px; }
.preview-body .dp-list li.dp-l2 .dp-num { color: #4a76b3; }
.preview-body .dp-list li.dp-l3 { padding-left: 34px; font-size: 12px; color: #6b7785; }
.preview-body .dp-list li.dp-l3 .dp-num { color: #7d97bb; }
.preview-body .dp-list { list-style: none; }
.preview-body .dp-list li {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 7px 9px; border-radius: 7px; cursor: pointer; font-size: 13px; transition: background .15s;
}
.preview-body .dp-list li:hover { background: #f1f5fa; }
.preview-body .dp-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-body .dp-num { color: #1e5aa8; font-weight: 700; flex-shrink: 0; }
.preview-body .dp-total {
    display: flex; justify-content: space-between; margin-top: 8px; padding: 9px;
    background: #1e5aa8; color: #fff; border-radius: 8px; font-size: 14px;
}
.preview-body .dp-total b { font-size: 18px; }
.preview-body .dp-empty { color: #8a97a8; font-size: 12px; padding: 6px 2px; }
/* 岗位统计行（侧栏实时汇总：类别 + 人数 + 占比细条 + 岗位数），按人数降序，点击定位节点 */
.preview-body .dp-list li.jb-row { display: block; padding: 7px 9px 8px; }
.preview-body .dp-list li.jb-row:hover { background: #eef4fc; }
.preview-body .jb-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.preview-body .dp-num i { font-style: normal; font-size: 10.5px; font-weight: 400; color: #7a8aa0; }
.preview-body .jb-track { height: 4px; border-radius: 99px; background: #edf1f6; margin-top: 5px; overflow: hidden; }
.preview-body .jb-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #3a78d6, #1e5aa8); }
.preview-body .jb-sub { font-size: 10.5px; color: #8a97a8; margin-top: 3px; }

/* 底栏：两行布局 —— 上行「头像 + 账号 + 角色徽章」，下行「图标按钮均分整行」 */
.side-foot {
    border-top: 1px solid #eef2f7; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
    font-size: 12px; background: #fbfcfe;
}
.foot-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.foot-avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, #1e5aa8, #4a8fe0); color: #fff;
    font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(30,90,168,.3);
}
.foot-avatar.guest { background: linear-gradient(135deg, #6b7f99, #94a8c0); box-shadow: 0 2px 6px rgba(90,107,128,.3); }
.foot-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.foot-name { font-size: 13.5px; font-weight: 600; color: #2c3e50; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-role {
    align-self: flex-start; font-size: 10.5px; line-height: 1.5; color: #1e5aa8; background: #e3edf9;
    border: 1px solid #c9dcf3; border-radius: 99px; padding: 0 9px; white-space: nowrap;
}
/* 退出登录：用户名后的小圆形图标（替代原整行按钮） */
.foot-out {
    flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; margin-left: auto;
    background: #fff; border: 1px solid #dde3ea; color: #42566e; font-size: 14px; text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.foot-out:hover { background: #fdecea; border-color: #f3c1ba; color: #c0392b; }
/* 用户名后的用户管理图标（仅管理员）：与退出按钮同款圆形，紧邻其后 */
.foot-act {
    flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; margin-left: auto;
    background: #fff; border: 1px solid #dde3ea; color: #42566e; text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.foot-act svg { width: 15px; height: 15px; display: block; }
.foot-act:hover { background: #eaf1fb; border-color: #b9d2f0; color: #1e5aa8; }
.foot-act + .foot-out { margin-left: 0; }

/* 收起态 */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .brand, .sidebar.collapsed .proj-link, .sidebar.collapsed .preview-box, .sidebar.collapsed .foot-user { display: none; }
.sidebar.collapsed .side-foot { flex-direction: column; padding: 10px 6px; }
.sidebar.collapsed .proj-ops { display: none; }
.sidebar.collapsed .new-proj { margin-bottom: 6px; }

/* ============ 底部工具栏（Mac Docker 风格：固定视口底部、毛玻璃圆角，可手动隐藏） ============ */
.dock {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.dock-bar {
  display: flex; align-items: center; gap: 8px;
  max-width: calc(100vw - 24px); /* 窄屏时工具条内部左右滑动，胶囊不超出屏幕 */
  /* 参照 macOS Dock：浅灰磨砂半透明（约 45% 透明）+ 大模糊 + 细白边高光 */
  background: rgba(226,232,240,.55);
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 20px; padding: 2px 12px 6px;
  box-shadow: 0 10px 30px rgba(20,40,80,.18), inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform .26s cubic-bezier(.2,.8,.2,1), opacity .26s ease;
}
.dock.hidden .dock-bar { transform: translateY(160%); opacity: 0; pointer-events: none; }
.dock-hide {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid rgba(30,50,90,.18); background: rgba(30,50,90,.06);
  color: #5a6b80; font-size: 17px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; margin-left: 4px;
  transition: background .15s, color .15s, border-color .15s;
}
.dock-hide:hover { background: #1e5aa8; color: #fff; border-color: #1e5aa8; }
/* 隐藏后留在底部中心、随时唤出工具栏的美观图标（2×2 圆角宫格，类 macOS 启动台） */
.dock-fab {
  position: fixed; left: 50%; bottom: 16px; transform: translate(-50%, 160%);
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(30,50,90,.14); color: #1e5aa8;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 8px 24px rgba(20,40,80,.22); opacity: 0; pointer-events: none;
  transition: transform .26s cubic-bezier(.2,.8,.2,1), opacity .26s ease, background .15s, color .15s;
}
.dock-fab:hover { background: #fff; color: #174a8c; }
.dock.hidden .dock-fab { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }

/* 工具条内按钮：单行图标化，宽度不足时左右滑动（细滚动条），悬停显示文字提示 */
.topbar {
  display: flex; align-items: flex-end; gap: 7px; flex-wrap: nowrap; justify-content: flex-start;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  /* 顶部留白：给 Mac 式悬停放大留出伸展空间（否则会被横向滚动容器裁掉） */
  padding: 16px 2px 4px;
}
.topbar::-webkit-scrollbar { height: 5px; }
.topbar::-webkit-scrollbar-track { background: transparent; }
.topbar::-webkit-scrollbar-thumb { background: rgba(30,50,90,.18); border-radius: 99px; }
.topbar::-webkit-scrollbar-thumb:hover { background: rgba(30,50,90,.32); }
/* 工具条按钮：实色蓝渐变圆角块 + 白色单行文字，悬停上浮提亮 */
.topbar button, .topbar a {
    flex: none; height: 38px; padding: 0 16px; display: flex; align-items: center; justify-content: center;
    border: none; cursor: pointer; text-decoration: none; line-height: 1; position: relative;
    border-radius: 11px; color: #fff;
    background: linear-gradient(160deg, #3a78d6 0%, #1e5aa8 58%, #1a4f96 100%);
    box-shadow: 0 2px 6px rgba(20,50,100,.25), inset 0 1px 0 rgba(255,255,255,.22);
    transform-origin: bottom center; /* 以底部为原点向上放大（Mac Dock 放大效果） */
    transition: transform .18s cubic-bezier(.2,.8,.2,1), filter .16s, box-shadow .18s;
}
/* 单行文字标签 */
.topbar button .lab, .topbar a .lab {
    font-size: 13px; font-weight: 500; letter-spacing: 2px; white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,.18);
}
/* 撤销/恢复弯箭头（Office 风格：↶ 撤销前一步 / ↷ 恢复被撤销的动作）；按图标在文字前/后自适应间距 */
.topbar button .ar { width: 15px; height: 15px; margin-left: 6px; flex: none; }
.topbar button .ar:first-child { margin-left: 0; margin-right: 6px; }
/* 悬停：Mac Dock 式放大（向上放大 1.16 倍并轻微上浮），相邻按钮轻微联动 */
.topbar button:hover, .topbar a:hover {
    transform: translateY(-4px) scale(1.16); filter: brightness(1.09);
    box-shadow: 0 10px 22px rgba(20,50,100,.34), inset 0 1px 0 rgba(255,255,255,.30);
    z-index: 3;
}
.topbar button:hover + button, .topbar button:hover + a,
.topbar a:hover + button, .topbar a:hover + a,
.topbar button:has(+ button:hover), .topbar button:has(+ a:hover),
.topbar a:has(+ button:hover), .topbar a:has(+ a:hover) {
    transform: translateY(-2px) scale(1.07);
}
.topbar button:active, .topbar a:active { transform: translateY(-1px) scale(1.06); filter: brightness(.97); }
/* 撤销/重做在无历史时禁用：降低不透明度并禁用悬停上浮 */
.topbar button.dock-item:disabled, .topbar button.dock-item[disabled] {
    opacity: .38; cursor: not-allowed; filter: grayscale(.35);
    box-shadow: none; transform: none; pointer-events: none;
}
.topbar button.dock-item:disabled:hover, .topbar button.dock-item[disabled]:hover { transform: none; filter: grayscale(.35); }

/* 保存状态直接体现在「保存」按钮上：未保存=蓝色 / 保存中=灰色 / 已保存=绿色 / 失败=红色 */
.topbar button#saveBtn { transition: background .2s ease, box-shadow .2s ease, transform .16s cubic-bezier(.2,.8,.2,1), filter .16s; }
.topbar button#saveBtn[data-state="saving"] {
    background: #dde3ec; color: #55677d;
    box-shadow: none;
}
.topbar button#saveBtn[data-state="saving"] .lab { text-shadow: none; }
.topbar button#saveBtn[data-state="saved"] {
    background: linear-gradient(160deg, #35b877 0%, #2aa564 58%, #248f57 100%);
    box-shadow: 0 2px 8px rgba(42,165,100,.38), inset 0 1px 0 rgba(255,255,255,.22);
}
.topbar button#saveBtn[data-state="error"] {
    background: linear-gradient(160deg, #e35c5c 0%, #d64545 58%, #c03b3b 100%);
    box-shadow: 0 2px 8px rgba(214,69,69,.38), inset 0 1px 0 rgba(255,255,255,.22);
}
/* 灰色态悬停不要被蓝色 hover 提亮覆盖 */
.topbar button#saveBtn[data-state="saving"]:hover { filter: none; background: #d5dce7; }

/* ============ 缩略图导航（minimap）：右下角全图预览 + 视口框，点击/拖动快速定位 ============ */
.minimap {
  position: fixed; right: 14px; bottom: 16px; z-index: 78;
  width: 208px; border-radius: 12px; overflow: hidden; user-select: none;
  /* 全透明：不遮挡内容，仅保留细边框勾勒范围 */
  background: transparent;
  -webkit-backdrop-filter: blur(4px) saturate(120%); backdrop-filter: blur(4px) saturate(120%);
  border: 1px solid rgba(30,50,90,.18);
  box-shadow: none;
}
.minimap .mm-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 7px 5px 10px; font-size: 11px; color: #43536a; letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(255,255,255,.75); /* 透明底上保证文字可读 */
}
.minimap .mm-toggle {
  width: 18px; height: 18px; border-radius: 50%; padding: 0;
  border: 1px solid rgba(30,50,90,.16); background: #fff; color: #43536a;
  font-size: 12px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.minimap .mm-toggle:hover { background: #eaf1fb; color: #1e5aa8; }
.minimap .mm-body {
  position: relative; height: 132px; margin: 0 6px 6px;
  border-radius: 8px; background: transparent; overflow: hidden; cursor: crosshair;
}
.minimap .mm-img { position: absolute; display: block; }
.minimap .mm-view {
  position: absolute; border: 2px solid #1e5aa8; border-radius: 3px;
  background: rgba(30,90,168,.12); pointer-events: none;
  transition: left .06s linear, top .06s linear, width .12s linear, height .12s linear;
}
.minimap.collapsed .mm-body { display: none; }
.minimap.collapsed { width: 140px; }

/* 导出数据：弹出格式选择（fixed 定位，避免被工具条横向滚动裁切） */
.dock-item-wrap { position: relative; display: flex; flex: none; }
.dock-export-pop {
    position: fixed; min-width: 156px; padding: 6px; border-radius: 12px; z-index: 95; transform: translateX(-50%);
    display: flex; flex-direction: column; gap: 2px;
    background: rgba(255,255,255,.94); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid rgba(30,50,90,.14); box-shadow: 0 12px 30px rgba(20,40,80,.26);
    opacity: 0; pointer-events: none; transition: opacity .14s ease;
}
.dock-export-pop.open { opacity: 1; pointer-events: auto; }
.dock-export-pop button {
    display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
    border: none; background: transparent; color: #2c3e50; font-size: 13.5px; cursor: pointer;
    padding: 9px 12px; border-radius: 8px; transition: background .12s;
}
.dock-export-pop button:hover { background: #eaf1fb; }
.dock-export-pop .ei { width: 18px; height: 18px; flex: none; color: #1e5aa8; }

/* 缩放控制（悬浮于主区右上角） */
.zoom-bar { display: inline-flex; gap: 6px; }
.zoom-bar button {
    min-width: 48px; text-align: center; border: 1px solid #c5ccd6; background: #fff; color: #555;
    border-radius: 7px; padding: 4px 10px; cursor: pointer; font-size: 12.5px;
}
.zoom-bar button:hover { background: #eef2f7; border-color: #a9b4c2; }
.zoom-bar #zoomReset { font-weight: 600; color: #1e5aa8; }
/* 全屏控件：紧跟缩放控件，尺寸风格一致（与缩放按钮同高同圆角） */
.fs-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; padding: 4px 10px; box-sizing: border-box;
  border: 1px solid #c5ccd6; background: #fff; color: #555; border-radius: 7px;
  font-size: 12.5px; line-height: 1; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.fs-btn svg { width: 15px; height: 15px; display: block; }
.fs-btn:hover { background: #eef2f7; border-color: #a9b4c2; color: #1e5aa8; }
/* 全屏中显示「收起」图标，未全屏显示「展开」图标 */
.fs-btn .ico-collapse { display: none; }
.fs-btn.is-fs .ico-expand { display: none; }
.fs-btn.is-fs .ico-collapse { display: block; }
.fs-btn.is-fs { color: #1e5aa8; border-color: #a9b4c2; }

/* ============ 主区头部 ============ */
header { text-align: center; margin-bottom: 12px; }
header h1 { font-size: 21px; margin-bottom: 10px; }
/* 右上悬浮组：缩放 + 编制总人数（仅侧栏收起时显示），两者同尺寸协调；总人数在缩放前面 */
.float-right { position: fixed; top: 14px; right: 14px; z-index: 95; display: flex; align-items: center; gap: 10px; }
.float-total { display: none; }
.sidebar.collapsed ~ .main .float-total { display: inline-flex; }
/* 编制总人数：白底蓝字胶囊，尺寸与缩放控件一致 */
.total-bar {
    display: inline-flex; align-items: center; gap: 8px;
    background: #fff; border: 1px solid #c5ccd6; color: #555;
    padding: 4px 12px; border-radius: 7px; font-size: 12.5px;
    cursor: pointer; transition: background .15s, border-color .15s;
}
.total-bar:hover { background: #eef2f7; border-color: #a9b4c2; }
.total-bar b { font-size: 14px; font-weight: 600; color: #1e5aa8; font-family: "DIN Alternate", "Helvetica Neue", monospace; }
.total-bar .sub { font-size: 11px; opacity: .7; }
/* 缩放控件取消独立定位，交由 .float-right 统一排布 */
.float-zoom { position: static; }

.canvas-wrap { overflow: auto; padding: 12px 0 20px; max-height: calc(100vh - 66px); }
.tree { margin: 0 auto; transform-origin: top left; position: relative; }

/* ============ 按层级分行布局：坐标由 JS 计算后绝对定位（与 PNG 导出同一算法） ============ */
.npos { position: absolute; width: 170px; z-index: 1; }
.npos .node { width: 100%; min-height: 72px; box-sizing: border-box; }
/* 层级连线层：坐标与节点同源（JS 计算），绝对覆盖整棵树、置于卡片下层、不拦截鼠标 */
.links { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; z-index: 0; }

.node {
    position: relative; background: #fff; border: 2px solid #2c3e50; border-radius: 6px; min-width: 108px; overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,.08); transition: box-shadow .2s; flex-shrink: 0;
}
/* 方案C：左侧类别色标（按岗位库类别着色，未匹配不显示） */
/* 卡片统计一行式（编制｜下属），已按需求取消岗位类别色标与「直属」维度 */
.node:hover { box-shadow: 0 4px 14px rgba(30,90,168,.25); }
.node .title {
    display: block; padding: 5px 8px; font-size: 13px; font-weight: 600; line-height: 1.35;
    background: #eaf1f9; border-bottom: 1px solid #d4dee9; outline: none;
    text-align: center; word-break: break-all;
}
.node .title small { font-weight: 400; color: #5a6b80; font-size: 11px; }
.node .title:focus { background: #fff8e1; }
.node .count { display: flex; align-items: center; justify-content: center; gap: 3px; padding: 4px 6px; font-size: 12px; background: #fff; white-space: nowrap; }
.node .count input {
    width: 46px; border: 1px solid #c5ccd6; border-radius: 4px; padding: 2px 2px; font-size: 13px;
    text-align: center; color: #c0392b; font-weight: 700; outline: none;
}
.node .count input:focus { border-color: #1e5aa8; background: #f4f9ff; }
.node input::-webkit-outer-spin-button, .node input::-webkit-inner-spin-button { -webkit-appearance: none; }
.node input { -moz-appearance: textfield; appearance: textfield; }
.node .sub { display: block; font-size: 10.5px; color: #7a8ba0; padding: 0 6px 4px; text-align: center; background: #fff; white-space: nowrap; }
/* 方案C：一行式统计「编制 x ｜ 直属 N ｜ 下属 M人」+ 底部占比细条 */
.node .nsub { font-size: 11px; color: #33414f; white-space: nowrap; }
.node .nsub b { color: #1e5aa8; font-weight: 700; }
.node .nsep { color: #c3d5ee; margin: 0 1px; }
.node .tval { color: #1e5aa8; font-weight: 700; }
.node.root { border-color: #1e5aa8; }
.node.root .title { background: #1e5aa8; color: #fff; border-bottom-color: #1e5aa8; }
.node.root .title small { color: #cfe0f5; }
.node.dept { border-color: #1e5aa8; border-style: dashed; }
.node.dept .title { background: #e3edf9; border-bottom-color: #ccdcee; }
.node.manager .title { background: #dff0d8; border-bottom-color: #c9e3bd; }
.node.leaf .title { background: #fdeeee; border-bottom-color: #f3d9d9; }

.node .ctrls { display: none; justify-content: center; align-items: stretch; gap: 3px; padding: 4px; background: #f0f4f9; border-top: 1px solid #d4dee9; }
.node:hover .ctrls { display: flex; }
.node .ctrls button {
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-align: center;
  border: 1px solid #c5ccd6; background: #fff; color: #1e5aa8; border-radius: 5px;
  font-size: 10px; padding: 2px 0; cursor: pointer; line-height: 1.5;
  transition: background .12s, color .12s, border-color .12s;
}
.node .ctrls button:hover { background: #1e5aa8; color: #fff; border-color: #1e5aa8; }
.node .ctrls button.del { flex: 0 0 22px; color: #c0392b; }
.node .ctrls button.del:hover { background: #c0392b; color: #fff; border-color: #c0392b; }

/* ============ Excel 批注式备注（标记/气泡为 .npos 子节点，避免被 .node overflow 裁掉） ============ */
.npos:hover { z-index: 5; } /* 悬停时抬升整张卡片，确保备注气泡盖在相邻卡片之上 */
/* ① 卡片右上角红三角标记（有备注才出现） */
.note-flag { position: absolute; top: 0; right: 0; width: 0; height: 0;
  border-style: solid; border-width: 0 13px 13px 0; border-color: transparent #e74c3c transparent transparent;
  cursor: help; z-index: 6; }
/* ② 悬停气泡：浅黄批注框，类似 Excel 批注 */
.note-bubble { display: none; position: absolute; left: 100%; top: -4px; margin-left: 0; z-index: 30;
  width: 220px; max-width: 260px; background: #fffce0; border: 1px solid #d4b106; border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18); padding: 7px 9px; text-align: left; }
.npos:hover .note-bubble { display: block; }
.note-bubble-h { font-size: 11px; font-weight: 700; color: #8a6d00; margin-bottom: 3px; }
.note-bubble-b { font-size: 12px; line-height: 1.55; color: #3a3a3a; white-space: pre-wrap; word-break: break-word; }
/* ③ 内联编辑框（点「备注」按钮弹出，卡片下方） */
.note-editor { position: absolute; z-index: 50; width: 250px; background: #fff;
  border: 1px solid #2c3e50; border-radius: 8px; box-shadow: 0 6px 22px rgba(0,0,0,.25); padding: 10px; }
.note-editor .ne-hint { font-size: 11px; color: #8a97a8; margin-bottom: 6px; line-height: 1.4; }
.note-editor textarea { width: 100%; height: 84px; box-sizing: border-box; resize: vertical;
  font: 13px/1.5 inherit; padding: 6px 8px; border: 1px solid #c5ccd6; border-radius: 5px; outline: none; }
.note-editor textarea:focus { border-color: #1e5aa8; }
.note-editor .ne-bar { display: flex; gap: 6px; margin-top: 8px; }
.note-editor .ne-bar button { border: 1px solid #c5ccd6; background: #fff; color: #1e5aa8;
  border-radius: 5px; font-size: 12px; padding: 4px 12px; cursor: pointer; }
.note-editor .ne-bar button:hover { background: #1e5aa8; color: #fff; }
.note-editor .ne-bar .ne-del { color: #c0392b; border-color: #e6b3b3; }
.note-editor .ne-bar .ne-del:hover { background: #c0392b; color: #fff; }
.note-editor .ne-bar .ne-cancel { color: #6b7785; }

/* 只读态 */
body.readonly .ctrls { display: none !important; }
body.readonly .count input { pointer-events: none; background: #f4f4f4; color: #555; }

/* ============ 拖拽调整层级 / 排序（仅管理员） ============ */
.node.dragging { opacity: .4; }
.node.drop-before { box-shadow: 0 -4px 0 0 #1e5aa8; }
.node.drop-after  { box-shadow: 0 4px 0 0 #1e5aa8; }
.node.drop-child  { outline: 2px dashed #1e5aa8; outline-offset: 3px; }

.hint { text-align: center; color: #8a97a8; font-size: 12px; line-height: 1.8; }
/* 主界面操作提示：脱离文档流，毛玻璃半透明悬浮在 Dock 上方，不占页面空间（管理子页 hint 不受影响） */
.main > .hint {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 79; max-width: calc(100vw - 32px); margin: 0;
  padding: 7px 18px; color: #43536a;
  background: rgba(148,163,184,.05); -webkit-backdrop-filter: blur(24px) saturate(130%); backdrop-filter: blur(24px) saturate(130%);
  border: 1px solid rgba(255,255,255,.18); border-radius: 14px;
  box-shadow: 0 6px 18px rgba(20,40,80,.06);
  transition: opacity .3s ease, visibility .3s ease;
}
/* 滚动到浏览器底部时自动隐藏（避免遮挡底层节点），回滚恢复 */
.main > .hint.at-bottom { opacity: 0; visibility: hidden; }

/* ============ 侧栏收起态：全部隐藏，仅留一枚悬浮展开按钮 ============ */
.sidebar { transition: width .22s ease; }
.sidebar.collapsed { width: 0; min-width: 0; border-right: none; overflow: hidden; }
/* 侧栏展开按钮：独立悬浮（固定视口左上），仅侧栏收起时显示；与缩放控件同款尺寸 */
.side-fab {
  display: none; position: fixed; top: 14px; left: 14px; z-index: 90;
  width: 40px; height: 40px; border-radius: 12px; padding: 0;
  align-items: center; justify-content: center;
  background: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(12px) saturate(160%); backdrop-filter: blur(12px) saturate(160%);
  border: 1px solid rgba(30,50,90,.14); color: #1e5aa8; font-size: 17px; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 18px rgba(20,40,80,.20);
  transition: transform .15s, background .15s, color .15s;
}
.side-fab:hover { transform: scale(1.08); background: #fff; color: #174a8c; }
.sidebar.collapsed + .side-fab { display: flex; }

/* ============ 管理子页（版本管理 / 用户管理 / 回收站）：统一卡片式 UI ============ */
body.admin-page { background: #f2f5f9; }
.admin-wrap { max-width: 920px; margin: 0 auto; padding: 22px 20px 46px; }
/* 顶栏：标题 + 右侧导航（浅色胶囊，替代旧的深蓝磁贴） */
.admin-top {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #fff; border-radius: 14px; padding: 14px 20px; margin-bottom: 18px;
  box-shadow: 0 2px 10px rgba(16,42,80,.06);
}
.admin-top h1 { font-size: 17px; color: #1f2d3d; margin: 0; }
.admin-top .sp { flex: 1; }
.admin-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-nav a {
  display: inline-flex; align-items: center; gap: 5px; font-size: 13px; line-height: 1.4;
  color: #1e5aa8; text-decoration: none; border: 1px solid #cfe0f5; background: #f4f9ff;
  border-radius: 999px; padding: 5px 14px; transition: background .15s, border-color .15s;
}
.admin-nav a:hover { background: #cfe0f5; border-color: #b9cde8; }
.admin-nav a.back { font-weight: 600; }
/* 内容卡片与分区标题 */
.admin-card { background: #fff; border-radius: 14px; padding: 18px 20px; box-shadow: 0 2px 10px rgba(16,42,80,.06); margin-bottom: 18px; }
.admin-card h3 { margin: 0 0 12px; font-size: 15px; color: #1f2d3d; }
.admin-card .sub { font-size: 12.5px; color: #7a8ba0; margin: 0 0 12px; line-height: 1.7; }
.admin-section-title { font-size: 14.5px; color: #2c3e50; margin: 24px 0 10px; display: flex; align-items: center; gap: 8px; }
.admin-section-title:first-child { margin-top: 0; }
.admin-section-title .cnt { color: #1e5aa8; }
/* 表格：圆角卡片、浅蓝表头、行悬停 */
.admin-table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(16,42,80,.06); }
.admin-table thead tr { background: #f4f8fc; text-align: left; }
.admin-table th { padding: 11px 14px; font-size: 12.5px; color: #6b7785; font-weight: 600; white-space: nowrap; }
.admin-table td { padding: 11px 14px; font-size: 13.5px; color: #2c3e50; border-top: 1px solid #eef2f7; }
.admin-table tbody tr:hover td { background: #f8fbff; }
.admin-table .empty { text-align: center; color: #8a97a8; padding: 24px 14px; }
.admin-table a { color: #1e5aa8; text-decoration: none; }
.admin-table a:hover { text-decoration: underline; }
/* 表单与按钮 */
.field label { font-size: 12px; display: block; margin-bottom: 4px; color: #6b7785; }
.field input, .field select {
  padding: 8px 10px; border: 1px solid #c5ccd6; border-radius: 8px; font-size: 13.5px;
  font-family: inherit; background: #fff; color: #2c3e50;
}
.field input:focus, .field select:focus { outline: none; border-color: #1e5aa8; box-shadow: 0 0 0 3px rgba(30,90,168,.12); }
.btn-primary {
  background: linear-gradient(160deg, #2f6cc4, #1e5aa8); color: #fff; border: 0;
  padding: 9px 20px; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-family: inherit;
  box-shadow: 0 2px 6px rgba(30,90,168,.28); transition: filter .15s, transform .15s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }
/* 行内文字按钮（回滚/删除等）与分隔线 */
.link-btn { border: 0; background: none; color: #1e5aa8; cursor: pointer; padding: 0; font-size: 13.5px; font-family: inherit; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: #c0392b; }
.admin-sep { color: #d5dce5; margin: 0 8px; }
/* 角色徽章与提示条 */
.role-badge { display: inline-block; font-size: 11.5px; color: #1e5aa8; background: #e3edf9; border: 1px solid #c9dcf3; border-radius: 99px; padding: 1px 10px; white-space: nowrap; }
.msg-tip { background: #e8f6ec; color: #2e7d32; border: 1px solid #bfe3c8; border-radius: 10px; padding: 10px 14px; font-size: 13px; margin: 0 0 16px; }
.admin-page .hint { text-align: left; max-width: 920px; margin: 14px auto 0; padding: 0 20px; }

/* ============ 新建项目弹窗 ============ */
.modal { display: none; position: fixed; inset: 0; background: rgba(20,40,70,.45); z-index: 200; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-card { background: #fff; border-radius: 14px; padding: 26px 24px; width: 360px; max-width: 90vw; box-shadow: 0 10px 40px rgba(0,0,0,.25); position: relative; }
.modal-card h3 { font-size: 18px; margin-bottom: 16px; }
.modal-card label { display: block; font-size: 13px; color: #5a6b80; margin-bottom: 6px; }
.modal-card input { width: 100%; border: 1px solid #c5ccd6; border-radius: 8px; padding: 10px 12px; font-size: 14px; outline: none; }
.modal-card input:focus { border-color: #1e5aa8; background: #f4f9ff; }
.modal-ops { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-ops button { border-radius: 8px; padding: 9px 18px; font-size: 14px; cursor: pointer; border: 1px solid #c5ccd6; background: #fff; color: #555; }
.modal-ops button.primary { background: #1e5aa8; color: #fff; border-color: #1e5aa8; }
.modal-ops button.primary:hover { background: #174a8c; }
.modal-ops button.ghost:hover { background: #eef2f7; }
.modal-card.wide { width: 480px; }
/* 弹窗右上角关闭按钮 */
.modal-close { position: absolute; top: 12px; right: 14px; width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: #eef2f7; color: #5a6b80; font-size: 15px; line-height: 1; cursor: pointer; }
.modal-close:hover { background: #dde5ee; color: #2c3e50; }

/* ============ 岗位统计弹窗（岗位库 + 人数图表） ============ */
.jm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.jm-grid h3 { font-size: 15px; margin-bottom: 12px; }
.jm-grid h3 .muted { font-weight: 400; font-size: 12px; color: #8a97a8; }
@media (max-width: 560px) { .jm-grid { grid-template-columns: 1fr; } }
/* 岗位库编辑 */
#jobLibList { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.jl-row { display: grid; grid-template-columns: 88px 1fr 30px; gap: 6px; align-items: center; }
.jl-row input { border: 1px solid #c5ccd6; border-radius: 7px; padding: 7px 9px; font-size: 13px; outline: none; width: 100%; box-sizing: border-box; }
.jl-row input:focus { border-color: #1e5aa8; background: #f4f9ff; }
.jl-row .jl-del { border: 1px solid #e6b3b3; background: #fff; color: #c0392b; border-radius: 7px; cursor: pointer; height: 30px; }
.jl-row .jl-del:hover { background: #c0392b; color: #fff; }
.primary.sm { background: #1e5aa8; color: #fff; border: 0; border-radius: 7px; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.primary.sm:hover { background: #174a8c; }
.jm-tip { font-size: 11.5px; color: #8a97a8; line-height: 1.6; margin: 10px 0 0; }
/* 统计图表（横向条形） */
#jobChart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 60px 1fr auto; gap: 8px; align-items: center; }
.bar-label { font-size: 13px; color: #2c3e50; white-space: nowrap; }
.bar-track { background: #eef2f7; border-radius: 6px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg,#2c7be5,#1e5aa8); border-radius: 6px; transition: width .25s; }
.bar-other .bar-fill { background: #9aa7b5; }
.bar-val { font-size: 13px; font-weight: 700; color: #1e5aa8; white-space: nowrap; }
.bar-other .bar-val { color: #6b7785; }
.bar-sub { font-size: 11px; font-weight: 400; color: #8a97a8; }
/* 分享弹窗 */
.share-form { display: flex; flex-direction: column; gap: 12px; padding: 6px 0 14px; border-bottom: 1px solid #eef2f7; margin-bottom: 14px; }
.share-form .ck { display: flex; align-items: center; gap: 8px; color: #333; font-size: 14px; margin: 0; }
.share-form .ck input { width: auto; }
.share-form .exp { display: flex; align-items: center; gap: 8px; margin: 0; }
.share-form .exp select { border: 1px solid #c5ccd6; border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.share-form #sharePwdVal { width: 100%; border: 1px solid #c5ccd6; border-radius: 8px; padding: 9px 12px; font-size: 14px; }
.share-list { display: flex; flex-direction: column; gap: 10px; max-height: 240px; overflow: auto; }
.share-row { display: flex; flex-direction: column; gap: 6px; background: #f7f9fc; border: 1px solid #e4e9f1; border-radius: 10px; padding: 10px 12px; }
.share-info { font-size: 12.5px; color: #5a6b80; }
.share-url { display: flex; gap: 6px; align-items: center; }
.share-url input { flex: 1; border: 1px solid #c5ccd6; border-radius: 8px; padding: 7px 9px; font-size: 12px; background: #fff; color: #333; }
.share-row .mini { padding: 6px 10px; font-size: 12px; border: 1px solid #c5ccd6; border-radius: 7px; background: #fff; cursor: pointer; }
.share-row .mini.del { color: #c0392b; border-color: #f0c5c0; }
.share-row .mini.del:hover { background: #fdeceb; }
.share-row .mini[data-copy]:hover { background: #eef2f7; }

/* ============ 访客预览水印（防截图外传，仅查看密码访客显示） ============ */
.wm { position: fixed; inset: -25%; z-index: 55; pointer-events: none; overflow: hidden; transform: rotate(-22deg); }
.wm .wm-cell { position: absolute; white-space: nowrap; font-size: 18px; font-weight: 700; color: rgba(20,40,80,.09); letter-spacing: 2px; }

/* ============ 打印（导出 PDF） ============ */
@media print {
    body { background: #fff; }
    .sidebar, .dock, .zoom-bar, .float-total, .float-zoom, .fs-btn, .hint, .minimap, header h1 { display: none !important; }
    .wm { display: block !important; } /* 导出 PDF 时保留访客水印 */
    .main { padding: 0; }
    .canvas-wrap { overflow: visible; max-height: none; }
    .node .ctrls { display: none !important; }
    .node { box-shadow: none; }
    .tree { transform: none !important; }
}
