/* ============================================================
 * dept.css — 部门管理 + 组织架构树
 * ============================================================ */

/* ---------------- 统计卡（图一的四宫格） ---------------- */
.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .18s, transform .18s, box-shadow .18s;
  text-decoration: none;
  color: inherit;
  position: relative;
}
a.stat-card { cursor: pointer; }
a.stat-card .drill-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--txt-3);
  font-size: 14px;
  transition: .15s;
}
a.stat-card:hover .drill-arrow { color: var(--acc); transform: translateY(-50%) translateX(2px); }
.stat-card:hover {
  border-color: var(--line-2);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
}
.stat-mark {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
}
.stat-body { min-width: 0; }
.stat-label { font-size: 12px; color: var(--txt-3); margin-bottom: 5px; }
.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.6px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: 11px; color: var(--txt-3); margin-top: 4px; }

/* ---------------- 卡片头 ---------------- */
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 650; margin: 0; }
.card-desc { font-size: 11.5px; color: var(--txt-3); margin-top: 4px; line-height: 1.6; }

/* ---------------- 筛选栏 ---------------- */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.filter-field { flex: 1; min-width: 220px; }
.filter-field label {
  display: block;
  font-size: 11.5px;
  color: var(--txt-3);
  margin-bottom: 6px;
}
.filter-field input {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--txt);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}
.filter-field input:focus { border-color: var(--acc); }

/* ---------------- 干净表格 ---------------- */
.clean-table,
.table-wrap > table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.clean-table thead th,
.table-wrap > table thead th {
  text-align: left;
  font-weight: 500;
  font-size: 11.5px;
  color: var(--txt-3);
  padding: 11px 14px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.clean-table thead th:first-child,
.table-wrap > table thead th:first-child { border-radius: 8px 0 0 0; }
.clean-table thead th:last-child,
.table-wrap > table thead th:last-child { border-radius: 0 8px 0 0; }
.clean-table tbody td,
.table-wrap > table tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.clean-table tbody tr,
.table-wrap > table tbody tr { transition: background .15s; }
.clean-table tbody tr:hover,
.table-wrap > table tbody tr:hover { background: var(--bg-3); }
.clean-table tbody tr:last-child td,
.table-wrap > table tbody tr:last-child td { border-bottom: none; }

/* 全局状态标签做成柔和胶囊 */
.badge {
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 500;
}

.dept-name { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.tiny { font-size: 11px; }
.muted { color: var(--txt-3); }

/* ---------------- 胶囊按钮 ---------------- */
.pill-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--txt-2);
  font-size: 12px;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
  margin-right: 4px;
}
.pill-btn:hover { background: var(--bg-3); color: var(--txt); }
.pill-btn.primary {
  background: var(--acc);
  border-color: var(--acc);
  color: #fff;
}
.pill-btn.primary:hover { filter: brightness(1.1); }
.pill-btn.danger {
  color: var(--red);
  border-color: rgba(239, 68, 68, .35);
}
.pill-btn.danger:hover { background: rgba(239, 68, 68, .1); }

/* ---------------- 软标签 ---------------- */
.soft-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

/* ---------------- 模式选择器 ---------------- */
.mode-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.mode-item {
  padding: 11px 13px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  cursor: pointer;
  transition: .15s;
  background: var(--bg-3);
}
.mode-item:hover { border-color: var(--acc); }
.mode-item.active {
  border-color: var(--acc);
  background: rgba(59, 130, 246, .1);
  box-shadow: 0 0 0 1px var(--acc) inset;
}
.mode-title { font-size: 12.5px; font-weight: 600; margin-bottom: 3px; }
.mode-desc { font-size: 10.5px; color: var(--txt-3); line-height: 1.5; }

.center-group {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-3);
}
.group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

/* ============================================================
 * 组织架构树（图二的账号层级）
 * ============================================================ */
.org-wrap {
  overflow-x: auto;
  padding: 24px 12px 12px;
  background: var(--bg-3);
  border-radius: 12px;
  border: 1px solid var(--line);
}
.org-tree, .org-children {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  flex-wrap: nowrap;
}
/* 子节点超过 5 个时自动换行，避免被压扁 */
.org-children.wrap { flex-wrap: wrap; max-width: 1060px; margin: 0 auto; }
.org-node {
  position: relative;
  padding: 24px 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* 从父节点垂下来的竖线 */
.org-children > .org-node::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 24px;
  background: var(--line-2);
}
/* 兄弟节点之间的横线 */
.org-children > .org-node::after {
  content: '';
  position: absolute;
  top: 0;
  height: 1px;
  background: var(--line-2);
}
.org-children > .org-node:not(:first-child)::after { left: 0; width: 50%; }
.org-children > .org-node:not(:last-child)::after { right: 0; width: 50%; }
.org-children > .org-node:only-child::after { display: none; }
/* 单个子节点不需要横线 */
.org-children > .org-node:first-child:last-child::before { height: 24px; }

/* 根节点上方不加线 */
.org-tree > .org-node { padding-top: 0; }
.org-tree > .org-node::before { display: none; }

.org-card {
  width: 176px;
  padding: 13px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
  transition: transform .16s, box-shadow .16s, border-color .16s;
  cursor: default;
}
.org-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .16);
  border-color: var(--line-2);
}
.org-card.disabled { opacity: .5; }

.org-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}
.org-name {
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.org-role {
  padding: 1px 7px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 500;
  flex-shrink: 0;
}
.org-mail {
  font-size: 10.5px;
  color: var(--txt-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 7px;
}
.org-meta {
  font-size: 10.5px;
  color: var(--txt-3);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.org-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.org-sep { opacity: .4; }

/* 浅色主题微调 */
[data-theme="light"] .org-card {
  box-shadow: 0 2px 10px rgba(30, 50, 90, .07);
}
[data-theme="light"] .org-card:hover {
  box-shadow: 0 10px 26px rgba(30, 50, 90, .13);
}
[data-theme="light"] .stat-card:hover {
  box-shadow: 0 6px 20px rgba(30, 50, 90, .09);
}
[data-theme="light"] .org-wrap { background: #f8fafd; }

/* 缩放控制 */
.org-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.org-stat {
  font-size: 11.5px;
  color: var(--txt-3);
  padding: 4px 11px;
  border-radius: 12px;
  background: var(--bg-3);
}
