/* ===== 族谱页面样式（浅色主题）===== */

/* 头部 */
.family-hero {
  padding-top: 88px;
  padding-bottom: 24px;
  text-align: center;
  background: transparent;
}
.family-hero h1 { font-size: 2rem; color: #1a1a2e; margin-bottom: 4px; }
.family-hero p { color: rgba(0,0,0,0.4); font-size: 0.9rem; }
.family-hero .stat { color: rgba(0,0,0,0.45); font-size: 0.85rem; margin-top: 8px; }

/* 控制栏 */
.family-toolbar {
  max-width: 960px; margin: 0 auto; padding: 0 24px 16px;
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}
.family-toolbar input {
  flex: 1; min-width: 160px;
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #fff;
  color: #1a1a2e; font-size: 0.9rem;
  outline: none; transition: border 0.2s;
}
.family-toolbar input:focus { border-color: rgba(99,102,241,0.4); }
.family-toolbar input::placeholder { color: rgba(0,0,0,0.25); }

.filter-bar {
  display: flex; gap: 8px; align-items: center;
  margin: 8px 20px 0; flex-wrap: wrap;
}
.filter-bar select {
  padding: 6px 10px; border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #fff;
  color: rgba(0,0,0,0.7); font-size: 0.82rem; outline: none;
  cursor: pointer; transition: border 0.2s;
}
.filter-bar select:focus { border-color: rgba(99,102,241,0.4); }
.btn-add {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 20px; border-radius: 10px; border: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-size: 0.9rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.btn-add:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,0.25); }

/* 世代分组 */
.generation-group { max-width: 960px; margin: 0 auto; padding: 0 24px 32px; }
.gen-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.gen-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 32px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 8px; color: #fff; font-weight: 600; font-size: 0.85rem;
  padding: 0 10px;
}
.gen-char {
  color: rgba(0,0,0,0.3); font-size: 0.85rem;
}
.gen-count { color: rgba(0,0,0,0.25); font-size: 0.8rem; margin-left: auto; }

/* ===== 树形布局（扁平世代行 + 夫妻成对 + 连线） ===== */

.tree-view {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 24px 40px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
/* 世代标题 — 只用于网格视图，树形视图中不再显示 */

/* 世代行：同辈全在一行，不换行 */
.gen-row {
  display: flex;
  justify-content: center;
  gap: 24px 32px;
  padding: 8px 0 0;
  position: relative;
  min-width: min-content;
  z-index: 2;
}

/* 每个家庭列 */
.family-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* 夫妻容器：水平并排 */
.couple-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
  gap: 0;
}
.couple-wrap .member-card {
  margin: 4px 2px;
}

/* 配偶横线（紫色加粗 = 婚配关系） */
.spouse-line {
  display: inline-block;
  width: 28px;
  height: 3px;
  background: #c084fc;
  border-radius: 2px;
  margin: 0 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* 子女行：嵌套在父列内，水平排列，直连正下方 */
.children-row {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 0 8px;
  position: relative;
  min-width: min-content;
}
.children-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
  border-left: 2px solid #6366f1;
  border-right: 2px solid #6366f1;
  border-top: 2px solid #6366f1;
  border-radius: 4px 4px 0 0;
  pointer-events: none;
}
/* 子列顶部的竖线，接到父列底部的横线 */
.family-column > .family-column {
  margin-top: 20px;
  position: relative;
}
.family-column > .family-column::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 50%;
  width: 2px;
  height: 20px;
  background: #6366f1;
}
.family-column > .children-row > .family-column:first-child::before {
  left: 0;
  width: 50%;
  border-left: 2px solid #6366f1;
  border-top: 2px solid #6366f1;
  height: 20px;
  top: -20px;
  background: transparent;
}
.family-column > .children-row > .family-column:last-child::before {
  right: 0;
  width: 50%;
  border-right: 2px solid #6366f1;
  border-top: 2px solid #6366f1;
  height: 20px;
  top: -20px;
  background: transparent;
}
/* 夫妻向下竖线（有子女才显示） */
.couple-down-line {
  width: 3px;
  height: 20px;
  background: #6366f1;
  border-radius: 2px;
  margin: 2px auto 0;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* 代际连接行 - 向上向下重叠，让竖线视觉连续 */
.gen-connector {
  display: flex;
  justify-content: center;
  gap: 24px 32px;
  padding: 0;
  position: relative;
  min-height: 0;
  min-width: min-content;
  margin-top: -16px;
  margin-bottom: -10px;
  z-index: 1;
}

/* 每个父母的连线区域 */
.cn-parent-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-width: 60px;
  flex: 0 0 auto;
}

/* 竖线：从父母竖线连续延伸到水平基线 */
.cn-v-start {
  width: 3px;
  height: 18px;
  background: #6366f1;
  margin-top: -4px;  /* 向上延伸到上方的couple-down-line，视觉连续 */
}

/* 水平基线（子女共用横线） */
.cn-h-bar {
  display: flex;
  justify-content: center;
  gap: 0;
  position: relative;
  width: 100%;
  border-top: 3px solid #6366f1;
  padding-top: 0;
}

/* 每个子女的竖线终点 - 向下延伸到下一行 */
.cn-v-end {
  width: 3px;
  height: 16px;
  background: #6366f1;
  flex: 1;
  min-width: 20px;
  margin-bottom: -6px;  /* 向下延伸到下一行的卡片上方 */
}

/* 无子女占位 */
.cn-no-child {
  min-width: 60px;
  flex: 0 0 auto;
}

/* 卡片在树形布局中的层级 */
.tree-view .member-card {
  z-index: 2;
  position: relative;
}

/* 移动端适配 */
@media (max-width: 600px) {
  .spouse-line { width: 16px; margin: 0 2px; }
  .tree-view { padding: 0 12px 24px; }
  .gen-row { gap: 16px; }
  .gen-connector { gap: 16px; }
}

/* 成员卡片网格（带搜索/筛选时用） */
.member-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.member-card {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 14px; padding: 14px;
  cursor: pointer; transition: all 0.2s;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.member-card:hover {
  border-color: rgba(99,102,241,0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(99,102,241,0.06);
}
.mc-main { display: flex; gap: 12px; align-items: flex-start; }
.mc-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.mc-avatar.male { background: rgba(99,102,241,0.08); }
.mc-avatar.female { background: rgba(236,72,153,0.08); }
.mc-body { flex: 1; min-width: 0; }
.mc-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mc-name {
  font-size: 1rem; font-weight: 600; color: #1a1a2e;
}
.mc-gen {
  font-size: 0.7rem; color: rgba(0,0,0,0.35);
  background: rgba(0,0,0,0.04);
  padding: 1px 8px; border-radius: 4px;
}
.mc-sub {
  font-size: 0.75rem; color: rgba(0,0,0,0.35);
  margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mc-origin-hint { font-size: 0.72rem; color: rgba(0,0,0,0.3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.mc-tag {
  font-size: 0.65rem; padding: 1px 7px;
  border-radius: 4px; background: rgba(0,0,0,0.04);
  color: rgba(0,0,0,0.45);
}
.mc-tag.origin { background: rgba(99,102,241,0.08); color: #6366f1; }
.mc-tag.spouse { background: rgba(236,72,153,0.08); color: #db2777; }
.mc-tag.child { background: rgba(16,185,129,0.08); color: #059669; }
.mc-tag.parent { background: rgba(251,191,36,0.1); color: #b45309; }
.mc-tag.alive { background: rgba(52,211,153,0.15); color: #059669; font-size: 11px; padding: 0 6px; font-weight: 500; }
.mc-tag.deceased { background: rgba(156,163,175,0.12); color: #6b7280; font-size: 11px; padding: 0 6px; font-weight: 500; }

/* 空状态 */
.empty-state {
  text-align: center; padding: 60px 24px;
  color: rgba(0,0,0,0.3);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; margin-bottom: 16px; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: #fff; border: 1px solid rgba(0,0,0,0.08);
  border-radius: 20px; max-width: 600px; width: 100%;
  max-height: 85vh; overflow-y: auto;
  padding: 28px; position: relative;
  box-shadow: 0 12px 40px rgba(0,0,0,0.08);
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: rgba(0,0,0,0.3);
  font-size: 1.5rem; cursor: pointer; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: all 0.2s;
}
.modal-close:hover { background: rgba(0,0,0,0.05); color: #1a1a2e; }
.modal h2 { font-size: 1.3rem; color: #1a1a2e; margin-bottom: 20px; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 0.85rem; color: rgba(0,0,0,0.55);
  margin-bottom: 6px; font-weight: 500;
}
.form-group select, .form-group input {
  width: 100%; padding: 10px 14px; border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #fff;
  color: #1a1a2e; font-size: 0.9rem; outline: none;
  transition: border 0.2s;
}
.form-group select:focus, .form-group input:focus {
  border-color: rgba(99,102,241,0.4);
}
.form-error {
  display: block; font-size: 0.78rem; color: #dc2626;
  margin-top: 4px; font-weight: 400;
}
.form-group select option { background: #fff; color: #1a1a2e; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* 生源添加区域 */
.origin-section {
  background: rgba(0,0,0,0.02);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px; padding: 16px; margin-bottom: 16px;
}
.origin-section h3 {
  font-size: 0.95rem; color: rgba(0,0,0,0.65);
  margin-bottom: 12px; font-weight: 500;
}
.origin-add-row {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.origin-add-row select, .origin-add-row .origin-target-select {
  flex: 1; padding: 8px 12px; border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #fff;
  color: #1a1a2e; font-size: 0.85rem; outline: none;
}
.origin-add-row select option { background: #fff; }
.btn-sm {
  padding: 8px 16px; border-radius: 8px; border: none;
  font-size: 0.85rem; cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.btn-origin-add { background: rgba(99,102,241,0.1); color: #4f46e5; }
.btn-origin-add:hover { background: rgba(99,102,241,0.18); }
.btn-origin-remove { background: rgba(239,68,68,0.1); color: #dc2626; }
.btn-origin-remove:hover { background: rgba(239,68,68,0.18); }

/* 已添加的生源列表 */
.origin-list { margin-top: 8px; }
.origin-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 8px;
  background: rgba(0,0,0,0.02);
  margin-bottom: 6px; font-size: 0.85rem;
}
.origin-item .oi-type {
  padding: 2px 8px; border-radius: 4px;
  background: rgba(99,102,241,0.08); color: #4f46e5;
  font-size: 0.75rem; font-weight: 500;
}
.origin-item .oi-name { color: #1a1a2e; flex: 1; }
.origin-item .oi-gen { color: rgba(0,0,0,0.35); font-size: 0.8rem; }
.origin-item .oi-status {
  font-size: 0.7rem; padding: 1px 6px; border-radius: 3px;
}
.oi-status.ok { background: rgba(16,185,129,0.1); color: #059669; }
.oi-status.conflict { background: rgba(239,68,68,0.1); color: #dc2626; }

/* 按钮 */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 24px; border-radius: 10px; border: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-size: 0.9rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,0.25); }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 24px; border-radius: 10px;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.08);
  color: rgba(0,0,0,0.7); font-size: 0.9rem;
  cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(0,0,0,0.07); color: #1a1a2e; }
.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 24px; border-radius: 10px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.2);
  color: #dc2626; font-size: 0.9rem;
  cursor: pointer; transition: all 0.2s;
}
.btn-danger:hover { background: rgba(239,68,68,0.12); color: #b91c1c; }
.form-actions {
  display: flex; gap: 12px; justify-content: flex-end;
  margin-top: 20px;
}

/* 成员详情弹窗 */
.detail-section { margin-bottom: 20px; }
.detail-section h3 {
  font-size: 0.9rem; color: rgba(0,0,0,0.4);
  margin-bottom: 8px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.detail-name {
  font-size: 1.5rem; font-weight: 700; color: #1a1a2e;
  margin-bottom: 4px;
}
.detail-name .gender-badge {
  display: inline-block; font-size: 0.75rem;
  padding: 2px 10px; border-radius: 6px; vertical-align: middle;
  margin-left: 8px;
}
.detail-name .gender-badge.male { background: rgba(99,102,241,0.08); color: #4f46e5; }
.detail-name .gender-badge.female { background: rgba(236,72,153,0.08); color: #db2777; }
.detail-gen {
  font-size: 0.9rem; color: rgba(0,0,0,0.4);
  margin-bottom: 16px;
}
.detail-field {
  display: flex; gap: 8px; margin-bottom: 6px;
  font-size: 0.85rem;
}
.detail-field .df-label { color: rgba(0,0,0,0.4); min-width: 70px; }
.detail-field .df-value { color: rgba(0,0,0,0.7); }
.origin-list-readonly {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.origin-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px;
  background: rgba(99,102,241,0.06);
  font-size: 0.8rem; color: #4f46e5;
}

/* 冲突提示 */
.conflict-box {
  background: rgba(239,68,68,0.04);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: 10px; padding: 16px; margin-bottom: 16px;
}
.conflict-box h4 { color: #dc2626; font-size: 0.95rem; margin-bottom: 8px; }
.conflict-item {
  display: flex; gap: 8px; font-size: 0.85rem;
  padding: 6px 0; border-bottom: 1px solid rgba(0,0,0,0.04);
}
.conflict-item:last-child { border-bottom: none; }
.conflict-item .ci-type { color: #6366f1; min-width: 60px; }
.conflict-item .ci-detail { color: rgba(0,0,0,0.6); }

/* 警告 */
.warn-box {
  background: rgba(251,191,36,0.06);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 12px;
}
.warn-box p { color: #92400e; font-size: 0.85rem; }

/* 成功提示 */
.success-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: rgba(5,150,105,0.9); color: #fff;
  padding: 12px 24px; border-radius: 12px;
  font-size: 0.9rem; z-index: 300;
  animation: fadeInUp 0.3s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* 加载状态 */
.loading {
  text-align: center; padding: 40px;
  color: rgba(0,0,0,0.35); font-size: 0.9rem;
}
.spinner {
  display: inline-block; width: 24px; height: 24px;
  border: 2px solid rgba(99,102,241,0.15);
  border-top-color: #6366f1; border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-bottom: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
/* 顶部栏 */
.family-topbar {
  max-width: 960px; margin: 0 auto; padding: 88px 24px 0;
  display: flex; align-items: center; justify-content: space-between;
}
/* 批量导入 */
.import-step { margin-bottom: 24px; padding: 16px; background: rgba(0,0,0,0.02); border-radius: 12px; border: 1px solid rgba(0,0,0,0.05); }
.import-step h3 { font-size: 1rem; color: #1a1a2e; margin-bottom: 6px; }
.import-upload { margin-top: 8px; }
.import-result { padding: 16px; border-radius: 12px; margin-bottom: 16px; }
.import-result.ok { background: rgba(16,185,129,0.05); border: 1px solid rgba(16,185,129,0.15); }
.import-result.err { background: rgba(248,113,113,0.05); border: 1px solid rgba(248,113,113,0.15); }
.import-result h3 { font-size: 1rem; margin-bottom: 6px; }
.import-errors { margin-top: 8px; }
.import-err-item { font-size: 0.82rem; color: rgba(0,0,0,0.5); padding: 4px 0; border-bottom: 1px solid rgba(0,0,0,0.04); }

@media (max-width: 640px) {
  .member-grid { grid-template-columns: 1fr 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .origin-add-row { flex-direction: column; }
  .modal { padding: 20px; margin: 12px; }
  .family-topbar { flex-direction: column; gap: 8px; align-items: flex-start; padding-top: 76px; }
}
@media (max-width: 400px) {
  .member-grid { grid-template-columns: 1fr; }
}

/* ===== 头像样式 ===== */

/* 卡片内的图片头像 */
.mc-avatar-img {
  width: 44px; height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.mc-avatar-pic {
  cursor: pointer;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
  image-orientation: from-image;
}

/* 详情页头像区域 */
.detail-avatar-uploaded {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.detail-avatar-pic {
  width: 96px; height: 96px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 2px solid rgba(0,0,0,0.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  image-orientation: from-image;
}
.detail-avatar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.detail-avatar-actions {
  display: flex;
  gap: 6px;
}
.avatar-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(99,102,241,0.06);
  color: #4f46e5;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.avatar-btn:hover {
  background: rgba(99,102,241,0.12);
}
/* ===== 暗黑模式 ===== */
body.dark-mode {
  --bg: #1a1a2e;
  --bg-card: #16213e;
  --text: #e0e0e0;
  --text-muted: #a0a0b0;
  --border: rgba(255,255,255,0.08);
  --accent: #818cf8;
  --hover: rgba(129,140,248,0.1);
  background: var(--bg);
  color: var(--text);
}

/* !important 覆盖 JS 内联 rgba(0,0,0,*) 颜色 */
body.dark-mode [style*="color:rgba(0,0,0"] {
  color: #c0c0d0 !important;
}
body.dark-mode .family-topbar [style*="color"] {
  color: #a0a0b0 !important;
}
body.dark-mode .family-topbar [style*="color"]:hover {
  color: #e0e0e0 !important;
}
body.dark-mode .family-hero h1 { color: #e0e0e0; }
body.dark-mode .family-hero p,
body.dark-mode .family-hero [style*="color"] {
  color: #c0c0d0 !important;
}
body.dark-mode .family-topbar { background: #0f3460; }
body.dark-mode .family-hero h1 { color: #e0e0e0; }
body.dark-mode .member-card { background: var(--bg-card); border-color: var(--border); }
body.dark-mode .member-card:hover { border-color: var(--accent); }
body.dark-mode .mc-name { color: #e0e0e0; }
body.dark-mode .mc-gen { color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.06); }
body.dark-mode .mc-sub { color: rgba(255,255,255,0.4); }
body.dark-mode .mc-origin-hint { color: rgba(255,255,255,0.3); }
body.dark-mode .mc-tag { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.45); }
body.dark-mode .member-card h3 { color: #e0e0e0; }
body.dark-mode .member-card p { color: var(--text-muted); }
body.dark-mode .gen-header { border-color: var(--border); color: var(--accent); }
body.dark-mode input, body.dark-mode textarea, body.dark-mode select {
  background: #0d1b3e; color: #e0e0e0; border-color: var(--border);
}
body.dark-mode .family-form label { color: #c0c0d0; }
body.dark-mode .btn-primary { background: var(--accent); }
body.dark-mode .btn-secondary { background: var(--bg-card); color: #c0c0d0; border-color: var(--border); }
body.dark-mode .family-detail { background: var(--bg-card); border-color: var(--border); }
body.dark-mode .family-detail h2, body.dark-mode .family-detail h3 { color: #e0e0e0; }
body.dark-mode .family-detail p { color: var(--text-muted); }
body.dark-mode .origin-tag { background: rgba(129,140,248,0.15); color: #a5b4fc; }
body.dark-mode .search-input, body.dark-mode .filter-select, body.dark-mode .filter-input {
  background: #0d1b3e; color: #e0e0e0; border-color: var(--border);
}
body.dark-mode .family-topbar a { color: #a0a0b0; }
body.dark-mode .family-topbar a:hover { color: #e0e0e0; }
body.dark-mode .loading { background: rgba(26,26,46,0.9); }
body.dark-mode .toast { box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
body.dark-mode .toast-success { background: #065f46; }
body.dark-mode .toast-error { background: #7f1d1d; }
body.dark-mode .toast-warn { background: #78350f; }
body.dark-mode .toast-info { background: #1e3a5f; }
body.dark-mode .import-step h3 { color: #e0e0e0; }
body.dark-mode .import-result { background: var(--bg-card); }
body.dark-mode .import-result table th { background: #0d1b3e; }
body.dark-mode .import-result table td { border-color: var(--border); }
body.dark-mode .dialog-overlay { background: rgba(0,0,0,0.6); }
body.dark-mode .dialog-box { background: var(--bg-card); color: #e0e0e0; }
body.dark-mode .audit-result pre { background: #0d1b3e; color: #c0c0d0; }
body.dark-mode .calendar-month { border-color: var(--border); }
body.dark-mode .calendar-month h3 { color: var(--accent); }
/* 开关样式 */
.toggle { position:relative; display:inline-block; width:44px; height:24px; flex-shrink:0 }
.toggle input { opacity:0; width:0; height:0 }
.toggle .slider { position:absolute; cursor:pointer; top:0; left:0; right:0; bottom:0; background:#ccc; border-radius:24px; transition:0.3s }
.toggle .slider:before { position:absolute; content:''; height:18px; width:18px; left:3px; bottom:3px; background:#fff; border-radius:50%; transition:0.3s }
.toggle input:checked + .slider { background:#818cf8 }
.toggle input:checked + .slider:before { transform:translateX(20px) }
body.dark-mode .toggle .slider { background:rgba(255,255,255,0.2) }
body.dark-mode .toggle input:checked + .slider { background:#818cf8 }

body.dark-mode .login-container { background: var(--bg-card); }
/* 角色选择弹窗暗黑模式 */
body.dark-mode [onclick*="changeUserRole"] + * .role-select-box,
body.dark-mode .role-select-box { background: var(--bg-card); color: #e0e0e0; }
body.dark-mode .role-select-box h3 { color: #e0e0e0; }
body.dark-mode .role-select-box .role-item { color: #e0e0e0; }
body.dark-mode .role-select-box .role-desc { color: rgba(255,255,255,0.4); }

