:root {
  --admin-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  --bg: #f0f2f5;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-soft: rgba(248, 250, 252, 0.78);
  --panel-strong: rgba(241, 245, 249, 0.96);
  --line: rgba(71, 85, 105, 0.18);
  --line-strong: rgba(71, 85, 105, 0.32);
  --accent: #409eff;
  --accent-soft: #79bbff;
  --spouse: #0ea5a4;
  --ink: #303133;
  --muted: #606266;
  --danger: #f56c6c;
  --success: #55745d;
  --shadow-lg: 0 22px 58px rgba(31, 45, 61, 0.12);
  --shadow-md: 0 14px 30px rgba(31, 45, 61, 0.08);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--admin-font-sans);
  font-size: 14px;
  font-feature-settings: "tnum" 1;
  background:
    radial-gradient(circle at top left, rgba(64, 158, 255, 0.2), transparent 24%),
    radial-gradient(circle at bottom right, rgba(71, 85, 105, 0.08), transparent 20%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(71, 85, 105, 0.4);
  box-shadow: 0 0 0 4px rgba(64, 158, 255, 0.14);
}

textarea {
  resize: vertical;
  min-height: 112px;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1660px, calc(100vw - 40px));
  margin: 20px auto 32px;
}

.hero,
.card,
.panel,
.modal-dialog {
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr);
  gap: 28px;
  padding: 34px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.96), rgba(226, 232, 240, 0.92));
}

.hero-mark,
.section-tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.1);
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1,
.section-head h2,
.panel-head h3,
.modal-head h3,
.branch-chip-name,
.detail-name {
  margin: 0;
  font-family: var(--admin-font-sans);
  font-weight: 600;
}

.hero h1 {
  margin-top: 16px;
  font-size: 42px;
  line-height: 1.28;
}

.hero p {
  margin: 16px 0 0;
  max-width: 760px;
  font-size: 17px;
  line-height: 1.8;
  color: var(--muted);
}

.hero-side {
  display: grid;
  gap: 16px;
}

.hint,
.canvas-summary,
.branch-chip-intro,
.summary-copy,
.detail-branch,
.detail-item-label,
.detail-bio,
.relation-empty,
.action-empty,
.modal-copy,
.detail-empty {
  color: var(--muted);
}

.card,
.panel {
  margin-top: 22px;
  padding: 24px;
  border-radius: var(--radius-xl);
  background: var(--panel);
}

.section-head,
.panel-head,
.modal-head,
.branch-chip-head,
.detail-head,
.detail-name-row,
.relation-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.section-head h2 {
  margin-top: 16px;
  font-size: 30px;
}

.panel-head h3,
.modal-head h3 {
  margin-top: 14px;
  font-size: 24px;
}

.login-mode-tabs,
.panel-actions,
.canvas-tools,
.login-actions,
.detail-actions,
.modal-actions,
.tree-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-grid,
.form-grid,
.modal-grid,
.detail-grid,
.summary-metrics {
  display: grid;
  gap: 16px;
}

.login-grid,
.form-grid,
.modal-grid,
.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.login-panel {
  margin-top: 18px;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: rgba(248, 250, 252, 0.80);
  border: 1px solid rgba(71, 85, 105, 0.08);
}

.login-panel-title {
  font-family: var(--admin-font-sans);
  font-size: 20px;
}

.login-panel-copy,
.modal-copy,
.detail-bio,
.detail-empty,
.canvas-summary,
.branch-chip-intro {
  line-height: 1.7;
}

.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

label span,
.section-subhead {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--muted);
}

.primary-btn,
.ghost-btn,
.login-mode-btn,
.branch-chip,
.relation-pill,
.tree-action-btn,
.tree-token {
  border-radius: 999px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.primary-btn,
.login-mode-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent) 0%, #337ecc 100%);
  box-shadow: 0 14px 30px rgba(71, 85, 105, 0.22);
}

.primary-btn {
  padding: 13px 24px;
}

.ghost-btn,
.login-mode-btn,
.branch-chip,
.relation-pill,
.tree-action-btn,
.tree-token {
  border: 1px solid transparent;
  background: rgba(228, 231, 237, 0.62);
  color: var(--ink);
}

.ghost-btn,
.login-mode-btn,
.tree-action-btn {
  padding: 11px 18px;
}

.ghost-btn:hover,
.primary-btn:hover,
.login-mode-btn:hover,
.branch-chip:hover,
.relation-pill:hover,
.tree-action-btn:hover,
.tree-token:hover {
  transform: translateY(-1px);
}

.danger-btn {
  background: rgba(178, 77, 57, 0.12);
  color: var(--danger);
}

.icon-btn {
  min-width: 76px;
}

.full-btn {
  width: 100%;
}

.workspace {
  margin-top: 22px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.workspace.branch-collapsed {
  grid-template-columns: 78px minmax(0, 1fr) auto;
}

.workspace.detail-open {
  grid-template-columns: auto minmax(0, 1fr) 400px;
}

.workspace.branch-collapsed.detail-open {
  grid-template-columns: 78px minmax(0, 1fr) 400px;
}

.panel-center {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.panel-left,
.panel-right {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.panel-left {
  width: 320px;
  transition: width 180ms ease, padding 180ms ease;
}

.panel-right {
  width: 400px;
}

.panel-left::-webkit-scrollbar,
.panel-right::-webkit-scrollbar {
  width: 10px;
}

.panel-left::-webkit-scrollbar-thumb,
.panel-right::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.24);
}

.panel-left::-webkit-scrollbar-track,
.panel-right::-webkit-scrollbar-track {
  background: transparent;
}

.workspace.branch-collapsed .panel-left {
  width: 78px;
  padding: 16px 12px;
}

.workspace.branch-collapsed .panel-left .panel-head,
.workspace.branch-collapsed .panel-left .branch-list,
.workspace.branch-collapsed .panel-left .panel-foot {
  display: none;
}

.panel-toggle-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.panel-toggle-row-right {
  margin-bottom: 10px;
}

.panel-toggle-btn {
  white-space: nowrap;
}

.branch-list {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.branch-chip {
  width: 100%;
  padding: 16px 18px;
  text-align: left;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.86), rgba(241, 245, 249, 0.8));
  border-color: rgba(71, 85, 105, 0.08);
}

.branch-chip.active {
  color: #ffffff;
  background: linear-gradient(135deg, #409eff 0%, #337ecc 100%);
  border-color: transparent;
}

.branch-chip-count {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.panel-foot,
.editor-form,
.branch-form {
  margin-top: 20px;
}

.summary-layout {
  display: grid;
  gap: 14px;
}

.summary-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-metric {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(71, 85, 105, 0.08);
  background: rgba(248, 250, 252, 0.66);
}

.summary-metric strong {
  display: block;
  font-size: 30px;
  font-family: var(--admin-font-sans);
  color: var(--accent);
}

.summary-metric span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.summary-footer {
  display: grid;
  gap: 8px;
}

.root-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.root-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(71, 85, 105, 0.12);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}

.root-filter-chip strong {
  display: inline-flex;
  min-width: 24px;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.08);
  color: var(--accent);
  font-size: 12px;
}

.root-filter-chip.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent) 0%, #337ecc 100%);
  border-color: transparent;
}

.root-filter-chip.active strong {
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
}

.root-filter-chip.root-filter-chip-action {
  border-style: dashed;
  border-color: rgba(14, 165, 164, 0.42);
  background: rgba(240, 249, 255, 0.98);
  color: var(--accent);
}

.root-filter-chip.root-filter-chip-action span {
  font-weight: 600;
}

.tree-canvas {
  margin-top: 16px;
  height: clamp(520px, calc(100vh - 260px), 720px);
  min-height: 520px;
  overflow: auto;
  cursor: grab;
}

.quick-entry-bar {
  display: grid;
  grid-template-columns: minmax(160px, 0.72fr) minmax(0, 2.28fr);
  align-items: center;
  gap: 14px;
  margin: 12px 16px 0;
  padding: 10px 12px;
  border: 1px solid #b3d8ff;
  border-radius: 6px;
  background: #ecf5ff;
  box-shadow: 0 2px 8px rgba(64, 158, 255, 0.08);
}

.quick-entry-context {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.quick-entry-context strong {
  overflow: hidden;
  color: #303133;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-entry-context small {
  overflow: hidden;
  color: #5f7896;
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-entry-form {
  display: grid;
  grid-template-columns: minmax(130px, 1.15fr) auto auto minmax(180px, 1.45fr) auto;
  align-items: end;
  gap: 8px;
  min-width: 0;
}

.quick-entry-form label,
.quick-entry-gender,
.quick-entry-generation {
  display: grid;
  align-content: end;
  gap: 4px;
  min-width: 0;
}

.quick-entry-form label > span,
.quick-entry-gender > span,
.quick-entry-generation > span {
  color: #5f7896;
  font-size: 11px;
  line-height: 1.2;
}

.quick-entry-form input,
.quick-entry-form select {
  min-height: 34px;
  padding: 7px 9px;
  border-color: #b3d8ff;
  background: #ffffff;
}

.quick-entry-generation {
  grid-template-columns: auto auto;
  align-items: center;
  gap: 8px;
  padding: 0 3px 7px;
  white-space: nowrap;
}

.quick-entry-generation strong {
  color: #337ecc;
  font-size: 12px;
  font-weight: 600;
}

.quick-entry-gender {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-bottom: 0;
  white-space: nowrap;
}

.quick-entry-gender > span { margin-right: 2px; }

.quick-entry-gender button {
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid #b3d8ff;
  border-radius: 4px;
  color: #606266;
  background: #ffffff;
  cursor: pointer;
}

.quick-entry-gender button:hover,
.quick-entry-gender button.is-active {
  border-color: #409eff;
  color: #337ecc;
  background: #d9ecff;
}

.quick-entry-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding-bottom: 0;
  white-space: nowrap;
}

.quick-entry-actions .ghost-btn,
.quick-entry-actions .primary-btn {
  min-height: 34px;
  padding: 7px 11px;
}

.quick-entry-bar.hidden { display: none; }

@media (max-width: 1240px) {
  .quick-entry-bar { grid-template-columns: 1fr; gap: 8px; }
  .quick-entry-form { grid-template-columns: minmax(150px, 1.2fr) auto auto minmax(160px, 1fr) auto; }
}

@media (max-width: 760px) {
  .quick-entry-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-entry-name { grid-column: 1 / -1; }
  .quick-entry-generation { justify-content: start; }
  .quick-entry-actions { grid-column: 1 / -1; justify-content: stretch; }
  .quick-entry-actions button { flex: 1; }
}

.tree-canvas.is-panning,
.tree-canvas.is-panning * {
  cursor: grabbing !important;
  user-select: none !important;
}

.panel-center.is-fullscreen,
.panel-center:fullscreen {
  position: fixed;
  inset: 0;
  z-index: 60;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 20px;
  border-radius: 0;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
}

.panel-center.is-fullscreen .tree-canvas,
.panel-center:fullscreen .tree-canvas {
  min-height: 0;
  height: 100%;
}

.panel-center.is-fullscreen .lineage-tree,
.panel-center:fullscreen .lineage-tree {
  min-height: 100%;
}

.lineage-tree {
  --generation-track-width: 96px;
  display: block;
  width: max(100%, calc(var(--generation-tree-width) + 24px));
  min-width: 100%;
  padding: 0;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(71, 85, 105, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.96));
}

.generation-header {
  position: sticky;
  z-index: 18;
  top: 0;
  width: 100%;
  padding: 0 12px;
  border-bottom: 1px solid #dcdfe6;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 2px 7px rgba(0, 21, 41, 0.08);
}

.generation-header-track {
  display: grid;
  grid-template-columns: repeat(var(--generation-track-count), var(--generation-track-width));
  width: max-content;
  height: 34px;
}

.generation-header-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  border-right: 1px solid #ebeef5;
  color: #606266;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.generation-header-cell:last-child { border-right: 0; }

.generation-tree-body {
  min-width: calc(var(--generation-tree-width) + 24px);
  padding: 8px 12px 10px;
}

.tree-branch {
  position: relative;
}

.tree-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3px;
  width: var(--generation-tree-width);
  min-height: 26px;
  padding-left: var(--generation-offset);
}

.tree-branch.has-generation-parent > .tree-row::before {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: calc(var(--parent-generation-offset) + 48px);
  width: var(--generation-relation-width);
  height: 1px;
  background: rgba(71, 85, 105, 0.2);
  content: '';
}

.tree-toggle {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.08);
  color: var(--accent);
  font-size: 12px;
  line-height: 1;
}

.tree-toggle.is-empty {
  opacity: 0.5;
}

.tree-node-cluster {
  display: flex;
  flex: 0 0 74px;
  width: 74px;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
  align-items: stretch;
}

.tree-token {
  display: inline-flex;
  width: 74px;
  min-width: 0;
  align-items: center;
  gap: 4px;
  padding: 5px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(71, 85, 105, 0.12);
  box-shadow: var(--shadow-md);
}

.tree-token-label {
  min-width: 0;
  overflow: hidden;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-token-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  flex: none;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  border: 1px solid transparent;
}

.tree-token-gender-male {
  border-color: rgba(86, 124, 185, 0.28);
  background: linear-gradient(180deg, rgba(246, 249, 255, 0.98), rgba(234, 241, 252, 0.98));
}

.tree-token-gender-male .tree-token-marker {
  color: #456da8;
  background: rgba(86, 124, 185, 0.12);
  border-color: rgba(86, 124, 185, 0.24);
}

.tree-token-gender-female {
  border-color: rgba(205, 120, 151, 0.28);
  background: linear-gradient(180deg, rgba(255, 248, 250, 0.98), rgba(251, 238, 242, 0.98));
}

.tree-token-gender-female .tree-token-marker {
  color: #bf6f86;
  background: rgba(205, 120, 151, 0.12);
  border-color: rgba(205, 120, 151, 0.24);
}

.tree-token-gender-unknown {
  border-color: rgba(132, 118, 104, 0.24);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.98));
}

.tree-token-gender-unknown .tree-token-marker {
  color: #7c6e62;
  background: rgba(132, 118, 104, 0.1);
  border-color: rgba(132, 118, 104, 0.2);
}

.tree-token[draggable="true"] {
  cursor: grab;
}

.tree-token[draggable="true"]:active {
  cursor: grabbing;
}

.tree-token.is-drag-source {
  opacity: 0.55;
  transform: scale(0.98);
}

.tree-token.is-drop-target {
  border-color: rgba(14, 165, 164, 0.68);
  box-shadow: 0 0 0 4px rgba(14, 165, 164, 0.14), var(--shadow-md);
}

.tree-token.selected {
  color: #ffffff;
  border-color: transparent;
}

.tree-token.selected .tree-token-marker {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.24);
}

.tree-token-gender-male.selected {
  background: linear-gradient(135deg, #567db8 0%, #335d92 100%);
}

.tree-token-gender-female.selected {
  background: linear-gradient(135deg, #d27f95 0%, #ad6277 100%);
}

.tree-token-gender-unknown.selected {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.tree-token-spouse {
  background: rgba(240, 249, 255, 0.98);
  border-style: dashed;
  border-color: rgba(14, 165, 164, 0.42);
  color: var(--spouse);
}

.tree-token-spouse.selected {
  color: #ffffff;
  background: linear-gradient(135deg, var(--spouse) 0%, #2dd4bf 100%);
  border-color: transparent;
}

.tree-action-tray {
  width: min(420px, calc(100% - var(--generation-offset) - 22px));
  margin: 4px 0 2px calc(var(--generation-offset) + 19px);
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.72);
  border: 1px solid rgba(71, 85, 105, 0.08);
}

.tree-action-title {
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
}
.tree-branch-children {
  position: relative;
  margin: 2px 0 0;
  padding-left: 0;
  display: grid;
  gap: 2px;
}

.tree-branch-children::before {
  position: absolute;
  top: -2px;
  bottom: 13px;
  left: calc(var(--generation-offset) + 48px);
  width: 1px;
  background: rgba(71, 85, 105, 0.16);
  content: '';
}

.marriage-group {
  display: grid;
  gap: 2px;
}

.marriage-group-head {
  display: flex;
  align-items: center;
  gap: 4px;
}

.marriage-group-head:empty {
  display: none;
}

.marriage-label {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(14, 165, 164, 0.1);
  color: var(--spouse);
  font-size: 11px;
}

.tree-children {
  display: grid;
  gap: 8px;
}

.is-selected-family > .tree-row .tree-token:not(.selected) {
  border-color: rgba(71, 85, 105, 0.2);
}

.detail-summary {
  margin-top: 18px;
}

.panel-right.hidden {
  display: none !important;
}

.detail-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(71, 85, 105, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.92));
}

.detail-name {
  font-size: 24px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(71, 85, 105, 0.08);
  background: rgba(241, 245, 249, 0.66);
}

.detail-generation {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 78px;
  min-height: 56px;
  padding: 8px 10px;
  border-radius: 18px;
  background: rgba(71, 85, 105, 0.08);
  color: var(--accent);
  font-family: var(--admin-font-sans);
  text-align: center;
}

.detail-generation strong {
  font-size: 16px;
  line-height: 1.2;
}

.detail-generation span {
  color: var(--admin-text-regular, #606266);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
}

.detail-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.62);
}

.detail-item-value {
  display: block;
  margin-top: 6px;
  font-size: 16px;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.switch-row input {
  width: auto;
}

.relation-section {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.56);
  border: 1px solid rgba(71, 85, 105, 0.08);
}

.relation-section-head span,
.relation-section-head strong {
  font-size: 13px;
}

.relation-section-head strong {
  color: var(--accent);
}

.relation-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.relation-pill {
  padding: 8px 12px;
  font-size: 13px;
}

.relation-pill-spouse {
  border-style: dashed;
  color: var(--spouse);
}

.relation-manage-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.relation-manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(71, 85, 105, 0.08);
  background: rgba(255, 255, 255, 0.82);
}

.relation-manage-row.is-spouse {
  background: rgba(240, 249, 255, 0.88);
}

.relation-manage-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.relation-order-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.08);
  color: var(--accent);
  font-size: 12px;
}

.relation-order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tiny-btn {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(71, 85, 105, 0.12);
  background: rgba(248, 250, 252, 0.72);
  color: var(--ink);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.tiny-btn:hover {
  transform: translateY(-1px);
}

.tiny-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.action-empty,
.relation-empty {
  padding: 8px 0 2px;
  font-size: 13px;
}

.canvas-empty,
.detail-empty {
  padding: 30px 24px;
  border-radius: 24px;
  border: 1px dashed rgba(71, 85, 105, 0.18);
  background: rgba(248, 250, 252, 0.7);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 45, 61, 0.28);
  backdrop-filter: blur(6px);
}

.modal-dialog {
  position: relative;
  width: min(680px, calc(100vw - 32px));
  margin: 64px auto;
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.96));
}

.modal-form {
  margin-top: 18px;
}

.modal-switch {
  margin-top: 16px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  min-width: 220px;
  max-width: 420px;
  padding: 16px 18px;
  border-radius: 16px;
  color: #ffffff;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 1200;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.tree-branch-children > .marriage-group > .marriage-group-head {
  margin-left: calc(var(--generation-offset) + 52px);
}

.tree-token.is-search-located {
  position: relative;
  z-index: 4;
  animation: tree-search-locate 1.5s ease-out;
}

@keyframes tree-search-locate {
  0%, 24% { box-shadow: 0 0 0 0 rgba(64, 158, 255, 0.58), 0 0 0 0 rgba(64, 158, 255, 0.28); }
  52% { box-shadow: 0 0 0 8px rgba(64, 158, 255, 0.24), 0 0 0 16px rgba(64, 158, 255, 0.08); }
  100% { box-shadow: 0 0 0 14px rgba(64, 158, 255, 0), 0 0 0 22px rgba(64, 158, 255, 0); }
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0;
  padding: 8px;
  width: fit-content;
  border: 1px solid rgba(71, 85, 105, 0.16);
  border-radius: 16px;
  background: rgba(245, 247, 250, 0.86);
}

.admin-nav-btn {
  border: 0;
  border-radius: 11px;
  padding: 11px 18px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.admin-nav-btn.active {
  color: #ffffff;
  background: #409eff;
}

.nav-count {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f56c6c;
  color: #ffffff;
  font-size: 11px;
}

.review-workspace {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(340px, 1.12fr) minmax(390px, 1.28fr);
  gap: 16px;
  align-items: start;
}

.review-filter-panel,
.review-list-panel,
.review-detail-panel {
  min-height: 620px;
}

.review-filter-panel {
  position: sticky;
  top: 16px;
  background-image: linear-gradient(145deg, rgba(64, 158, 255, 0.09), transparent 46%);
}

.review-filter-panel h2 {
  margin: 8px 0 12px;
  font-family: var(--admin-font-sans);
  font-size: 26px;
}

.review-lead,
.review-status-line,
.review-muted {
  color: var(--muted);
  line-height: 1.7;
}

.review-filter-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.review-filter-form label,
.review-decision label {
  display: grid;
  gap: 8px;
}

.review-filter-actions,
.review-decision > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.review-status-line {
  margin: 4px 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(71, 85, 105, 0.13);
  font-size: 13px;
}

.review-list {
  display: grid;
  gap: 9px;
}

.review-item {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 16px;
  border: 1px solid rgba(71, 85, 105, 0.13);
  border-left: 4px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.70);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.review-item:hover,
.review-item.active {
  transform: translateX(3px);
  border-left-color: #409eff;
  background: #ffffff;
}

.review-item-kicker {
  color: #409eff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.review-item span,
.review-item small {
  color: var(--muted);
}

.review-empty,
.review-detail-empty {
  padding: 34px 18px;
  border: 1px dashed rgba(71, 85, 105, 0.24);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.review-merge-status {
  display: grid;
  gap: 9px;
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid #dcdfe6;
  border-left: 4px solid #e6a23c;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.10);
  color: #303133;
}

.review-merge-status.is-success {
  border-left-color: #67c23a;
  background: #f0f9eb;
}

.review-merge-status.is-danger {
  border-left-color: #f56c6c;
  background: #fef0f0;
}

.review-merge-status__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review-merge-status__head span {
  color: #606266;
  font-size: 12px;
  font-weight: 700;
}

.review-merge-status p {
  margin: 0;
  color: #606266;
  line-height: 1.55;
}

.review-merge-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.review-merge-summary span {
  padding: 3px 8px;
  border: 1px solid rgba(103, 194, 58, 0.32);
  border-radius: 3px;
  background: #ffffff;
  color: #529b2e;
  font-size: 12px;
  font-weight: 700;
}

.review-merge-conflicts {
  display: grid;
  gap: 8px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.review-merge-conflicts li {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid rgba(245, 108, 108, 0.3);
  border-radius: 3px;
  background: #ffffff;
}

.review-merge-conflicts small,
.review-merge-conflicts span {
  color: #606266;
  font-size: 12px;
  line-height: 1.5;
}

.review-detail-panel {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.review-detail-head {
  padding: 10px 0 20px;
  border-bottom: 2px solid #409eff;
}

.review-detail-head span {
  color: #409eff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.review-detail-head h3 {
  margin: 8px 0;
  font-family: var(--admin-font-sans);
  font-size: 23px;
}

.review-detail-head small {
  color: var(--muted);
}

.review-risk {
  margin: 18px 0;
  padding: 14px 16px;
  border-left: 4px solid #f56c6c;
  background: rgba(163, 58, 43, 0.08);
  color: #70291f;
}

.review-risk p {
  margin: 6px 0 0;
}

.review-root-note {
  margin: 18px 0 0;
  padding: 13px 15px;
  border-left: 4px solid var(--admin-primary, #247568);
  border-radius: 0 8px 8px 0;
  background: #eef6f4;
  color: #195f55;
  line-height: 1.6;
}

.review-detail-section {
  padding: 18px 0;
  border-bottom: 1px solid rgba(71, 85, 105, 0.13);
}

.review-detail-section h4 {
  margin: 0 0 12px;
  color: #409eff;
}

.review-detail-section dl {
  margin: 0;
}

.review-detail-section dl > div {
  display: grid;
  grid-template-columns: minmax(92px, 0.42fr) 1fr;
  gap: 14px;
  padding: 9px 0;
}

.review-detail-section dt {
  color: var(--muted);
}

.review-detail-section dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.review-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.review-media-item {
  overflow: hidden;
  border: 1px solid rgba(71, 85, 105, 0.13);
  border-radius: 8px;
  background: #ffffff;
}

.review-media-item > a,
.review-media-placeholder {
  display: flex;
  height: 150px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f5f7fa;
}

.review-media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 160ms ease;
}

.review-media-item a:hover img {
  transform: scale(1.025);
}

.review-media-placeholder {
  color: var(--muted);
  font-size: 12px;
}

.review-media-item > div:last-child {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
}

.review-media-item span,
.review-media-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-decision {
  display: grid;
  gap: 14px;
  padding-top: 20px;
}

.review-merge-action {
  margin-top: 4px;
  border-top: 1px solid rgba(71, 85, 105, 0.13);
}

.review-merge-action p {
  margin: 0;
  color: #606266;
  font-size: 12px;
  line-height: 1.6;
}

.review-placement {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #d8e2e6;
  border-left: 3px solid var(--admin-primary, #247568);
  border-radius: 6px;
  background: #f7fafb;
}

.review-existing-candidates {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #e6c98a;
  border-left: 3px solid #d99a22;
  border-radius: 6px;
  background: #f8fafc;
}

.review-existing-candidates__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.review-existing-candidates__head h4,
.review-existing-candidates__head p {
  margin: 0;
}

.review-existing-candidates__head span {
  color: #a56d0d;
  font-size: 12px;
  font-weight: 700;
}

.review-existing-candidates__head p {
  max-width: 62%;
  color: #856a37;
  font-size: 12px;
  line-height: 1.6;
}

.review-existing-candidates__grid {
  display: grid;
  gap: 10px;
}

.review-existing-candidate {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid #eadfca;
  border-radius: 5px;
  background: #fff;
}

.review-existing-candidate > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.review-existing-candidate span,
.review-existing-candidate p {
  margin: 0;
  color: #6f6a5d;
  font-size: 12px;
  line-height: 1.5;
}

.review-existing-candidate .is-selected {
  border-color: #247568;
  color: #247568;
}

.review-placement-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.review-placement-head h4,
.review-placement-head p {
  margin: 0;
}

.review-placement-head span {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--admin-danger, #b34040);
  font-size: 12px;
  font-weight: 700;
}

.review-placement-head p,
.review-placement-note {
  color: var(--admin-text-secondary, #60757a);
  font-size: 12px;
  line-height: 1.6;
}

.review-anchor-search,
.review-placement-grid label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.review-anchor-search > div:first-of-type {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
}

.review-anchor-search input,
.review-placement-grid input,
.review-placement-grid select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.review-anchor-selected {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid #b8d4dc;
  border-radius: 4px;
  background: #ffffff;
}

.review-anchor-selected.is-empty {
  border-style: dashed;
  color: var(--admin-text-secondary, #60757a);
}

.review-anchor-selected span,
.review-anchor-results span,
.review-anchor-results small {
  color: var(--admin-text-secondary, #60757a);
  font-size: 12px;
}

.review-anchor-results {
  display: grid;
  max-height: 260px;
  overflow: auto;
  border: 1px solid #d8e2e6;
  border-radius: 4px;
  background: #ffffff;
}

.review-anchor-results button {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #edf1f3;
  background: transparent;
  color: var(--admin-text-primary, #173f46);
  text-align: left;
  cursor: pointer;
}

.review-anchor-results button:hover,
.review-anchor-results button:focus-visible {
  background: #eef6f6;
  outline: none;
}

.review-anchor-results p {
  margin: 0;
  padding: 14px;
  color: var(--admin-text-secondary, #60757a);
}

.review-placement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.review-placement-note {
  margin: 0;
}

.review-decision [data-review-action="APPROVE"]:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

@media (max-width: 1260px) {
  .review-workspace {
    grid-template-columns: minmax(220px, 0.72fr) minmax(360px, 1.28fr);
  }

  .review-detail-panel {
    position: static;
    grid-column: 1 / -1;
    max-height: none;
  }

  .workspace,
  .workspace.detail-open,
  .workspace.branch-collapsed,
  .workspace.branch-collapsed.detail-open {
    grid-template-columns: 1fr;
  }

  .panel-left,
  .panel-right {
    position: static;
    width: auto;
  }

  .workspace.branch-collapsed .panel-left {
    width: auto;
    padding: 24px;
  }

  .workspace.branch-collapsed .panel-left .panel-head,
  .workspace.branch-collapsed .panel-left .branch-list,
  .workspace.branch-collapsed .panel-left .panel-foot {
    display: block;
  }
}

@media (max-width: 900px) {
  .review-workspace {
    grid-template-columns: 1fr;
  }

  .review-filter-panel,
  .review-detail-panel {
    position: static;
    min-height: auto;
  }

  .review-detail-panel {
    grid-column: auto;
  }
  .shell {
    width: min(100vw - 20px, 100%);
  }

  .hero,
  .login-grid,
  .summary-metrics,
  .detail-grid,
  .form-grid,
  .modal-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 24px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .lineage-tree { --generation-track-width: 96px; }
}

@media (max-width: 560px) {
  .review-media-grid {
    grid-template-columns: 1fr;
  }

  .review-placement {
    padding: 14px;
  }

  .review-placement-head,
  .review-anchor-search > div:first-of-type {
    display: grid;
    grid-template-columns: 1fr;
  }

  .review-placement-grid {
    grid-template-columns: 1fr;
  }
}

.summary-layout-compact { display: grid; gap: 8px; }
.summary-stats-inline,
.summary-context-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 0; color: #909399; font-size: 12px; line-height: 1.5; }
.summary-stats-inline span { display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.summary-stats-inline span + span::before { content: ''; width: 1px; height: 11px; margin: 0 10px; background: #dcdfe6; }
.summary-stats-inline strong { color: #606266; font-size: 13px; font-weight: 600; }
.summary-context-inline { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-layout-compact .root-filter-bar { margin-top: 0; }

.workspace.is-tree-fullscreen,
.workspace:fullscreen {
  display: flex;
  width: 100vw;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  background: #f0f2f5;
}
.workspace.is-fullscreen-fallback {
  position: fixed;
  z-index: 100;
  inset: 0;
}
.workspace.is-tree-fullscreen .panel-left,
.workspace:fullscreen .panel-left { display: none !important; }
.workspace.is-tree-fullscreen .panel-center,
.workspace:fullscreen .panel-center {
  display: flex;
  flex: 1 1 auto;
  width: auto;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
  position: static;
}
.workspace.is-tree-fullscreen .panel-center .tree-canvas,
.workspace:fullscreen .panel-center .tree-canvas {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.workspace.is-tree-fullscreen .panel-right,
.workspace:fullscreen .panel-right {
  position: static;
  flex: 0 0 min(400px, 34vw);
  width: min(400px, 34vw);
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.workspace.is-tree-fullscreen:not(.detail-open) .panel-center,
.workspace:fullscreen:not(.detail-open) .panel-center { width: 100%; }

@media (max-width: 760px) {
  .workspace.is-tree-fullscreen,
  .workspace:fullscreen { flex-direction: column; overflow: hidden; }
  .workspace.is-tree-fullscreen .panel-center,
  .workspace:fullscreen .panel-center { flex: 1 1 52vh; height: auto; }
  .workspace.is-tree-fullscreen .panel-right,
  .workspace:fullscreen .panel-right { flex: 0 1 40vh; width: 100%; max-height: 40vh; }
}

/* Enterprise admin shell: intentionally scoped away from the genealogy canvas internals. */
:root {
  --admin-primary: #409eff;
  --admin-primary-dark: #337ecc;
  --admin-success: #67c23a;
  --admin-warning: #e6a23c;
  --admin-danger: #f56c6c;
  --admin-sidebar: #304156;
  --admin-sidebar-deep: #263445;
  --admin-bg: #f0f2f5;
  --admin-surface: #ffffff;
  --admin-text: #303133;
  --admin-text-regular: #606266;
  --admin-text-muted: #909399;
  --admin-border: #dcdfe6;
  --admin-border-light: #ebeef5;
  --admin-sidebar-width: 216px;
  --admin-topbar-height: 56px;
}

body {
  color: var(--admin-text);
  font-family: var(--admin-font-sans);
}

button,
input,
select,
textarea {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--admin-primary);
  outline-offset: 2px;
}

body:not(.admin-authenticated) {
  background: #eef1f6;
}

body:not(.admin-authenticated) .shell {
  display: grid;
  grid-template-columns: minmax(460px, 1.15fr) minmax(420px, 0.85fr);
  width: 100%;
  min-height: 100vh;
  margin: 0;
}

body:not(.admin-authenticated) .hero {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(48px, 8vw, 112px);
  border: 0;
  border-radius: 0;
  color: #e6edf5;
  background:
    linear-gradient(rgba(38, 52, 69, 0.88), rgba(38, 52, 69, 0.96)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 18px),
    var(--admin-sidebar);
  box-shadow: none;
}

body:not(.admin-authenticated) .hero-mark {
  color: #8ec7ff;
  font-size: 14px;
  letter-spacing: 0.12em;
}

body:not(.admin-authenticated) .hero h1 {
  max-width: 520px;
  margin-top: 24px;
  color: #ffffff;
  font-family: var(--admin-font-sans);
  font-size: clamp(38px, 5vw, 62px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

body:not(.admin-authenticated) .hero p {
  max-width: 560px;
  color: #bfcbd9;
  font-size: 17px;
}

body:not(.admin-authenticated) .login-card {
  align-self: center;
  width: min(430px, calc(100% - 48px));
  margin: 48px auto;
  padding: 36px;
  border: 1px solid var(--admin-border-light);
  border-radius: 8px;
  background: var(--admin-surface);
  box-shadow: 0 12px 34px rgba(31, 45, 61, 0.12);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.login-brand-seal,
.sidebar-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: var(--admin-primary);
  color: #ffffff;
  font-family: 'Noto Serif SC', 'Songti SC', serif;
  font-size: 21px;
  font-weight: 700;
}

.login-brand div,
.sidebar-brand div {
  display: grid;
  gap: 1px;
}

.login-brand strong {
  font-size: 18px;
}

.login-brand small,
.sidebar-brand small {
  color: var(--admin-text-muted);
  font-size: 11px;
  letter-spacing: 0.12em;
}

body:not(.admin-authenticated) .login-card .section-tag {
  color: var(--admin-primary);
}

body:not(.admin-authenticated) .login-card h2 {
  font-family: var(--admin-font-sans);
  font-size: 24px;
}

.login-mode-tabs {
  border-bottom: 1px solid var(--admin-border-light);
}

.login-mode-btn {
  border-radius: 4px 4px 0 0;
  color: var(--admin-text-regular);
}

.login-mode-btn.active {
  border-color: var(--admin-primary);
  color: var(--admin-primary);
  background: #ecf5ff;
}

.login-panel-copy,
.hint {
  color: var(--admin-text-muted);
}

input,
select,
textarea {
  border-color: var(--admin-border);
  border-radius: 4px;
  background: #ffffff;
  color: var(--admin-text);
  box-shadow: none;
}

input,
select {
  min-height: 36px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.12);
}

.primary-btn,
.ghost-btn {
  min-height: 36px;
  border-radius: 4px;
  padding: 8px 15px;
  font-weight: 500;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease, opacity 180ms ease;
}

.primary-btn {
  border: 1px solid var(--admin-primary);
  color: #ffffff;
  background: var(--admin-primary);
  box-shadow: none;
}

.primary-btn:hover {
  border-color: #66b1ff;
  background: #66b1ff;
}

.ghost-btn {
  border-color: var(--admin-border);
  color: var(--admin-text-regular);
  background: #ffffff;
}

.ghost-btn:hover {
  border-color: #b3d8ff;
  color: var(--admin-primary);
  background: #ecf5ff;
}

.danger-btn {
  border-color: #fab6b6;
  color: var(--admin-danger);
  background: #fef0f0;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.admin-authenticated {
  min-height: 100vh;
  background: var(--admin-bg);
}

.admin-authenticated .shell {
  width: auto;
  margin: 0 0 0 var(--admin-sidebar-width);
  padding: calc(var(--admin-topbar-height) + 16px) 16px 24px;
  transition: margin-left 200ms ease;
}

.admin-authenticated .hero {
  position: fixed;
  z-index: 30;
  top: 0;
  right: 0;
  left: var(--admin-sidebar-width);
  display: flex;
  min-height: var(--admin-topbar-height);
  height: var(--admin-topbar-height);
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border: 0;
  border-bottom: 1px solid var(--admin-border-light);
  border-radius: 0;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  transition: left 200ms ease;
}

.topbar-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-menu-btn {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--admin-text-regular);
  cursor: pointer;
}

.topbar-menu-btn.hidden,
.sidebar-badge.hidden,
.nav-count.hidden {
  display: none;
}

.topbar-menu-btn:hover {
  background: #f5f7fa;
}

.topbar-menu-btn svg,
.app-sidebar svg,
.metric-card svg,
.quick-actions svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-authenticated .hero-mark,
.admin-authenticated .hero h1,
.admin-authenticated .hero p {
  display: none;
}

.admin-authenticated .breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--admin-text-muted);
  font-size: 13px;
}

.breadcrumb b {
  color: #c0c4cc;
  font-weight: 400;
}

.breadcrumb strong {
  color: var(--admin-text);
  font-weight: 500;
}

.admin-authenticated .hero-side {
  display: flex;
  gap: 24px;
}

.account-area { position: relative; }
.account-trigger {
  display: flex; align-items: center; gap: 10px; min-width: 168px; padding: 6px 10px;
  border: 0; border-radius: 6px; background: transparent; color: var(--admin-text-regular); cursor: pointer;
}
.account-trigger:hover, .account-trigger[aria-expanded="true"] { background: #f1f5f9; }
.account-trigger > svg { width: 16px; height: 16px; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 2; }
.account-avatar, .profile-avatar {
  display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: #409eff; font-weight: 700;
}
.account-avatar { width: 32px; height: 32px; border-radius: 50%; }
.account-copy { display: grid; min-width: 0; text-align: left; }
.account-copy small { color: #909399; font-size: 11px; }
.account-copy strong { max-width: 150px; overflow: hidden; color: #303133; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.account-menu {
  position: absolute; z-index: 80; top: calc(100% + 8px); right: 0; width: 160px; padding: 6px;
  border: 1px solid #e4e7ed; border-radius: 6px; background: #fff; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}
.account-menu button { width: 100%; padding: 9px 12px; border: 0; border-radius: 4px; background: transparent; color: #303133; text-align: left; cursor: pointer; }
.account-menu button:hover { background: #f5f7fa; color: #409eff; }
.account-menu .account-menu-danger { color: #f56c6c; }
.account-menu-divider { display: block; height: 1px; margin: 5px 0; background: #ebeef5; }

.profile-workspace { display: grid; gap: 16px; }
.profile-grid { display: grid; grid-template-columns: minmax(240px, 0.65fr) minmax(420px, 1.35fr); gap: 16px; align-items: start; }
.profile-card { padding: 30px 24px; text-align: center; }
.profile-avatar { width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 50%; font-size: 28px; }
.profile-card h3 { margin: 0; color: #303133; }
.profile-card > p { margin: 7px 0 24px; color: #909399; }
.profile-card dl { margin: 0; text-align: left; }
.profile-card dl div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid #ebeef5; }
.profile-card dt { color: #909399; }
.profile-card dd { margin: 0; color: #606266; font-weight: 500; }
.profile-forms { display: grid; gap: 16px; }
.profile-form { padding: 22px; }
.profile-form > label { display: grid; grid-template-columns: 100px 1fr; gap: 14px; align-items: center; margin-top: 16px; }
.profile-form > label > span { color: #606266; text-align: right; }
.profile-form input:disabled { color: #909399; background: #f5f7fa; cursor: not-allowed; }
.form-error { margin: 12px 0 0 114px; color: #f56c6c; font-size: 13px; }

/* Focused member inspector: enterprise card and action menu. */
.admin-authenticated .panel-right {
  color: var(--admin-text);
  font-family: var(--admin-font-sans);
  font-size: 14px;
  line-height: 1.5;
}
.admin-authenticated .panel-right .panel-toggle-row {
  margin-bottom: 12px;
}
.admin-authenticated .panel-right .panel-toggle-btn {
  font-size: 12px;
}
.admin-authenticated .panel-right .panel-head h3 {
  margin-top: 5px;
  color: var(--admin-text);
  font-family: var(--admin-font-sans);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
}
.admin-authenticated .panel-right .detail-summary {
  margin-top: 12px;
}
.admin-authenticated .detail-card {
  gap: 14px;
  padding: 16px;
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 21, 41, 0.08);
}
.admin-authenticated .detail-head {
  align-items: flex-start;
  gap: 12px;
}
.admin-authenticated .detail-name-row {
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.admin-authenticated .detail-name {
  color: var(--admin-text);
  font-family: var(--admin-font-sans);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}
.admin-authenticated .detail-branch {
  margin-top: 4px;
  color: var(--admin-text-muted);
  font-size: 12px;
  line-height: 1.5;
}
.admin-authenticated .detail-tags {
  gap: 5px;
}

.detail-claim-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid #dcdfe6;
  border-radius: 999px;
  color: #909399;
  background: #f4f4f5;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.detail-claim-badge.is-claimed {
  border-color: #b3e19d;
  color: #529b2e;
  background: #f0f9eb;
}
.admin-authenticated .detail-tags .tag {
  padding: 2px 7px;
  border-color: #e4e7ed;
  color: var(--admin-text-regular);
  background: #f4f4f5;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
}
.admin-authenticated .detail-generation {
  min-width: 72px;
  min-height: 48px;
  padding: 6px 8px;
  border: 1px solid #b3d8ff;
  border-radius: 6px;
  color: #409eff;
  background: #ecf5ff;
  font-family: var(--admin-font-sans);
  font-weight: 600;
  line-height: 1.2;
}
.admin-authenticated .detail-generation span {
  color: #606266;
}
.admin-authenticated .detail-grid {
  gap: 8px;
}
.admin-authenticated .detail-item,
.admin-authenticated .relation-section {
  border: 1px solid #ebeef5;
  border-radius: 6px;
  background: #f8fafc;
}
.admin-authenticated .detail-item {
  padding: 10px 12px;
}
.admin-authenticated .detail-item-label {
  display: block;
  margin: 0;
  color: var(--admin-text-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
}
.admin-authenticated .detail-item-value {
  margin-top: 4px;
  color: var(--admin-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.admin-authenticated .detail-bio {
  padding: 12px 14px;
  border-left: 3px solid #409eff;
  border-radius: 0 4px 4px 0;
  background: #f5f7fa;
}
.admin-authenticated .detail-bio-label {
  display: block;
  color: var(--admin-text-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}
.admin-authenticated .detail-bio p {
  margin: 4px 0 0;
  color: var(--admin-text-regular);
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.admin-authenticated .detail-relations {
  display: grid;
  gap: 8px;
}
.admin-authenticated .relation-section {
  padding: 10px 12px;
}
.admin-authenticated .relation-section-head {
  align-items: center;
  gap: 8px;
}
.admin-authenticated .relation-section-head span {
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.admin-authenticated .relation-section-head strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--admin-primary-dark);
  background: #d9ecff;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.admin-authenticated .relation-pill-row,
.admin-authenticated .relation-manage-list {
  gap: 6px;
  margin-top: 8px;
}
.admin-authenticated .relation-pill {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}
.admin-authenticated .relation-manage-row {
  padding: 8px 10px;
  border: 1px solid #e4e7ed;
  border-radius: 6px;
  background: #ffffff;
}
.admin-authenticated .relation-manage-row.is-spouse { background: #f0f9ff; }
.admin-authenticated .relation-order-tag {
  padding: 4px 7px;
  font-size: 11px;
  line-height: 1.4;
}
.admin-authenticated .relation-empty {
  padding: 7px 0 1px;
  color: var(--admin-text-muted);
  font-size: 12px;
  line-height: 1.5;
}
.admin-authenticated .tiny-btn,
.admin-authenticated .detail-actions .ghost-btn {
  border-color: #dcdfe6;
  border-radius: 4px;
  color: #606266;
  background: #ffffff;
  font-size: 12px;
  line-height: 1.4;
}
.admin-authenticated .tiny-btn {
  min-height: 28px;
  padding: 5px 8px;
}
.admin-authenticated .tiny-btn:hover,
.admin-authenticated .detail-actions .ghost-btn:hover {
  border-color: #8ec7ff;
  color: #409eff;
  background: #ecf5ff;
}
.admin-authenticated .detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #ebeef5;
}
.admin-authenticated .detail-actions .danger-btn {
  border-color: #fab6b6;
  color: #f56c6c;
  background: #fef0f0;
}
.admin-authenticated .panel-right .detail-empty {
  padding: 24px 16px;
  border-color: #dcdfe6;
  border-radius: 6px;
  color: var(--admin-text-muted);
  background: #f8fafc;
  font-size: 13px;
  line-height: 1.6;
}
.admin-authenticated #memberForm {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--admin-border-light);
}
.admin-authenticated #memberForm .form-grid {
  gap: 12px 10px;
}
.admin-authenticated #memberForm label:not(.switch-row) {
  display: grid;
  gap: 6px;
}
.admin-authenticated #memberForm > label:not(.switch-row) {
  margin-top: 12px;
}
.admin-authenticated #memberForm label > span {
  margin-bottom: 0;
  color: var(--admin-text-regular);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}
.admin-authenticated #memberForm input,
.admin-authenticated #memberForm select,
.admin-authenticated #memberForm textarea {
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.5;
}
.admin-authenticated #memberForm textarea {
  resize: vertical;
}
.admin-authenticated #memberForm .switch-row {
  color: var(--admin-text-regular);
  font-size: 13px;
}
.admin-authenticated #memberForm .editor-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}
.admin-authenticated #memberForm .primary-btn {
  font-size: 13px;
  font-weight: 600;
}
.admin-authenticated .member-contact-fieldset {
  min-width: 0;
  margin: 16px 0 0;
  padding: 14px 12px 12px;
  border: 1px solid var(--admin-border-light);
  border-radius: 6px;
  background: #f8fafc;
}
.admin-authenticated .member-contact-fieldset legend {
  padding: 0 6px;
  color: var(--admin-text-regular);
  font-size: 12px;
  font-weight: 600;
}
.admin-authenticated .member-contact-fieldset legend small {
  margin-left: 6px;
  color: var(--admin-text-secondary);
  font-weight: 400;
}
.admin-authenticated .contact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.admin-authenticated .contact-grid label {
  display: grid;
  gap: 6px;
}
.admin-authenticated .contact-grid input,
.admin-authenticated .contact-grid select {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--admin-border);
  border-radius: 4px;
  color: var(--admin-text-primary);
  background: #ffffff;
  font-size: 13px;
}
.admin-authenticated .member-contact-status {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--admin-text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.admin-authenticated .member-contact-status[data-tone="loading"] { color: var(--admin-primary); }
.admin-authenticated .member-contact-status[data-tone="success"] { color: var(--admin-success); }
.admin-authenticated .member-contact-status[data-tone="error"] { color: var(--admin-danger); }
.admin-authenticated .member-save-status {
  min-height: 20px;
  margin-right: auto;
  color: var(--admin-text-secondary);
  font-size: 12px;
  line-height: 32px;
}
.admin-authenticated .member-save-status[data-tone="loading"] { color: var(--admin-primary); }
.admin-authenticated .member-save-status[data-tone="success"] { color: var(--admin-success); }
.admin-authenticated .member-save-status[data-tone="error"] { color: var(--admin-danger); }
.admin-authenticated .modal-backdrop {
  background: rgba(0, 21, 41, 0.45);
  backdrop-filter: blur(2px);
}
.admin-authenticated .modal-dialog {
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  color: #303133;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(0, 21, 41, 0.18);
}

@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
  .account-copy small { display: none; }
  .account-trigger { min-width: 0; }
}

@media (max-width: 760px) {
  .admin-authenticated .contact-grid { grid-template-columns: 1fr; }
}

.app-sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--admin-sidebar-width);
  flex-direction: column;
  color: #bfcbd9;
  background: var(--admin-sidebar);
  box-shadow: 2px 0 6px rgba(0, 21, 41, 0.18);
  transition: width 200ms ease, transform 200ms ease;
}

.app-sidebar.hidden {
  display: none;
}

.sidebar-brand {
  display: flex;
  height: var(--admin-topbar-height);
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  color: #ffffff;
  background: #2b3a4d;
  overflow: hidden;
}

.sidebar-seal {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  font-size: 18px;
}

.sidebar-brand strong {
  white-space: nowrap;
}

.sidebar-brand small {
  color: #8fa3b8;
  white-space: nowrap;
}

.sidebar-nav {
  display: grid;
  gap: 2px;
  padding: 12px 0;
}

.sidebar-nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 18px;
  border: 0;
  color: #bfcbd9;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease;
}

.sidebar-nav-item:hover {
  color: #ffffff;
  background: rgba(38, 52, 69, 0.72);
}

.sidebar-nav-item.active {
  color: #ffffff;
  background: var(--admin-sidebar-deep);
}

.sidebar-nav-item.active::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--admin-primary);
  content: '';
}

.sidebar-nav-child {
  min-height: 42px;
  padding-left: 42px;
  color: #9fb0c4;
  font-size: 13px;
}

.sidebar-nav-child svg {
  width: 17px;
  height: 17px;
}

.sidebar-badge,
.nav-count {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 10px;
  color: #ffffff;
  background: var(--admin-danger);
  font-size: 11px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #8295aa;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-nav {
  display: none !important;
}

.dashboard,
.review-workspace,
.relation-workspace,
.settings-workspace,
.workspace {
  animation: admin-panel-enter 180ms ease-out;
}

@keyframes admin-panel-enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.page-heading h2 {
  margin: 4px 0;
  font-family: var(--admin-font-sans);
  font-size: 24px;
}

.page-heading p,
.page-kicker {
  margin: 0;
  color: var(--admin-text-muted);
  font-size: 13px;
}

.page-kicker {
  color: var(--admin-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}

.metric-card {
  position: relative;
  display: flex;
  min-height: 126px;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--admin-border-light);
  border-radius: 6px;
  color: var(--admin-text);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 21, 41, 0.05);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: #c6e2ff;
  box-shadow: 0 8px 20px rgba(0, 21, 41, 0.1);
}

.metric-icon {
  display: inline-flex;
  width: 56px;
  height: 56px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
}

.metric-icon svg {
  width: 27px;
  height: 27px;
}

.metric-blue .metric-icon { color: var(--admin-primary); background: #ecf5ff; }
.metric-teal .metric-icon { color: #247568; background: #e8f5f2; }
.metric-green .metric-icon { color: var(--admin-success); background: #f0f9eb; }
.metric-orange .metric-icon { color: var(--admin-warning); background: rgba(245, 158, 11, 0.10); }
.metric-red .metric-icon { color: var(--admin-danger); background: #fef0f0; }

.metric-copy {
  display: grid;
  min-width: 0;
}

.metric-copy small {
  color: var(--admin-text-muted);
  font-size: 13px;
}

.metric-copy strong {
  margin: 3px 0;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.metric-copy em {
  overflow: hidden;
  color: var(--admin-text-muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-copy em.is-error {
  color: var(--admin-danger);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 16px;
  margin-top: 16px;
}

.dashboard-panel {
  border: 1px solid var(--admin-border-light);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 21, 41, 0.04);
}

.dashboard-panel-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--admin-border-light);
}

.dashboard-panel-head span {
  color: var(--admin-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-panel-head h3 {
  margin: 3px 0 0;
  font-size: 17px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 20px;
}

.quick-actions button {
  display: flex;
  min-height: 92px;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--admin-border-light);
  border-radius: 5px;
  color: var(--admin-text);
  background: #fafafa;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.quick-actions button:hover {
  border-color: #b3d8ff;
  color: var(--admin-primary);
  background: #ecf5ff;
}

.quick-actions button > span {
  display: grid;
  gap: 4px;
}

.quick-actions small {
  color: var(--admin-text-muted);
  font-size: 11px;
}

.system-panel dl {
  margin: 0;
  padding: 12px 20px;
}

.system-panel dl > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--admin-border-light);
  font-size: 13px;
}

.system-panel dl > div:last-child {
  border-bottom: 0;
}

.system-panel dt {
  color: var(--admin-text-muted);
}

.system-panel dd {
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.admin-authenticated .workspace {
  gap: 12px;
}

.admin-authenticated .panel,
.admin-authenticated .card {
  border: 1px solid var(--admin-border-light);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 21, 41, 0.05);
}

.admin-authenticated .panel {
  padding: 16px;
}

.admin-authenticated .panel-head {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--admin-border-light);
}

.admin-authenticated .panel-head h3,
.admin-authenticated .review-filter-panel h2 {
  font-family: var(--admin-font-sans);
  font-size: 17px;
}

.admin-authenticated .section-tag {
  color: var(--admin-primary);
  font-size: 10px;
}

.admin-authenticated .panel-left,
.admin-authenticated .panel-right,
.admin-authenticated .review-detail-panel,
.admin-authenticated .review-filter-panel {
  top: calc(var(--admin-topbar-height) + 16px);
}

/* Preserve .tree-canvas, .lineage-tree, .tree-token and relationship visuals. */
.admin-authenticated .panel-center {
  overflow: hidden;
  padding: 0;
}

.admin-authenticated .panel-center > .panel-head,
.admin-authenticated .panel-center > .canvas-summary {
  margin-right: 16px;
  margin-left: 16px;
}

.admin-authenticated .panel-center > .panel-head {
  margin-top: 16px;
}

.admin-authenticated .tree-canvas {
  border-radius: 0 0 6px 6px;
}

.admin-authenticated .branch-list {
  margin-top: 12px;
  gap: 8px;
}

.admin-authenticated .branch-chip {
  position: relative;
  overflow: hidden;
  padding: 12px;
  border-color: var(--admin-border-light);
  border-radius: 6px;
  color: var(--admin-text-regular);
  background: #ffffff;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.admin-authenticated .branch-chip::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: transparent;
  content: "";
}

.admin-authenticated .branch-chip:hover {
  border-color: #b3d8ff;
  background: #f5f9ff;
  box-shadow: 0 2px 8px rgba(64, 158, 255, 0.08);
  transform: none;
}

.admin-authenticated .branch-chip.active {
  border-color: #b3d8ff;
  color: var(--admin-primary);
  background: #ecf5ff;
}

.admin-authenticated .branch-chip.active::before {
  background: var(--admin-primary);
}

.admin-authenticated .branch-chip-head {
  align-items: flex-start;
  gap: 8px;
}

.admin-authenticated .branch-chip-name {
  min-width: 0;
  color: var(--admin-text);
  font-family: var(--admin-font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.admin-authenticated .branch-chip-intro {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 5px;
  color: var(--admin-text-muted);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.admin-authenticated .branch-chip-count {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid #e4e7ed;
  border-radius: 999px;
  color: var(--admin-text-regular);
  background: #f4f4f5;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.admin-authenticated .branch-chip.active .branch-chip-name {
  color: var(--admin-primary-dark);
}

.admin-authenticated .branch-chip.active .branch-chip-intro {
  color: #5f7896;
}

.admin-authenticated .branch-chip.active .branch-chip-count {
  border-color: #b3d8ff;
  color: var(--admin-primary-dark);
  background: #d9ecff;
}

.admin-authenticated .review-workspace {
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 12px;
}

.admin-authenticated .review-filter-panel {
  position: static;
  grid-column: 1 / -1;
  min-height: 0;
  background: #ffffff;
}

.admin-authenticated .review-filter-panel h2 {
  display: inline-block;
  margin: 4px 12px 4px 0;
}

.admin-authenticated .review-lead {
  display: inline;
  font-size: 12px;
}

.admin-authenticated .review-filter-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  align-items: end;
  gap: 12px;
  margin-top: 16px;
}

.admin-authenticated .review-filter-form label,
.admin-authenticated .review-decision label {
  gap: 6px;
  color: var(--admin-text-regular);
  font-size: 12px;
}

.admin-authenticated .review-filter-actions {
  flex-wrap: nowrap;
}

.admin-authenticated .review-list-panel,
.admin-authenticated .review-detail-panel {
  min-height: 580px;
}

.admin-authenticated .review-item {
  border-radius: 4px;
  background: #ffffff;
}

.admin-authenticated .review-item:hover,
.admin-authenticated .review-item.active {
  transform: none;
  border-left-color: var(--admin-primary);
  background: #ecf5ff;
}

.admin-authenticated .review-item-kicker,
.admin-authenticated .review-detail-section h4 {
  color: var(--admin-primary);
}

.admin-authenticated .review-detail-head {
  border-bottom-color: var(--admin-primary);
}

.admin-authenticated .review-detail-head h3 {
  font-family: var(--admin-font-sans);
}

.admin-authenticated .review-risk {
  border-left-color: var(--admin-warning);
  color: #b88230;
  background: rgba(245, 158, 11, 0.10);
}

.sidebar-collapsed .app-sidebar {
  width: 64px;
}

.sidebar-collapsed .shell {
  margin-left: 64px;
}

.sidebar-collapsed .hero {
  left: 64px;
}

.sidebar-collapsed .sidebar-brand {
  padding: 0 16px;
}

.sidebar-collapsed .sidebar-brand div,
.sidebar-collapsed .sidebar-nav-item span,
.sidebar-collapsed .sidebar-footer {
  display: none;
}

.sidebar-collapsed .sidebar-nav-item {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0;
}

.sidebar-collapsed .sidebar-nav-child {
  display: none;
}

@media (max-width: 1280px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-authenticated .review-filter-form {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .admin-authenticated .review-filter-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  body:not(.admin-authenticated) .shell {
    display: block;
  }

  body:not(.admin-authenticated) .hero {
    display: none;
  }

  body:not(.admin-authenticated) .login-card {
    width: min(480px, calc(100% - 24px));
    margin: 28px auto;
  }

  .admin-authenticated .shell,
  .sidebar-collapsed .shell {
    margin-left: 0;
    padding: calc(var(--admin-topbar-height) + 12px) 12px 20px;
  }

  .admin-authenticated .hero,
  .sidebar-collapsed .hero {
    left: 0;
  }

  .app-sidebar,
  .sidebar-collapsed .app-sidebar {
    width: var(--admin-sidebar-width);
    transform: translateX(-100%);
  }

  .sidebar-mobile-open .app-sidebar {
    transform: translateX(0);
  }

  .sidebar-mobile-open::after {
    position: fixed;
    z-index: 35;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    content: '';
  }

  .sidebar-collapsed .sidebar-brand div,
  .sidebar-collapsed .sidebar-nav-item span,
  .sidebar-collapsed .sidebar-footer {
    display: initial;
  }

  .sidebar-collapsed .sidebar-nav-item {
    grid-template-columns: 24px 1fr auto;
    justify-items: initial;
    padding: 0 18px;
  }

  .sidebar-collapsed .sidebar-nav-child {
    display: grid;
    padding-left: 42px;
  }

  .metric-grid,
  .dashboard-grid,
  .quick-actions,
  .admin-authenticated .review-workspace,
  .admin-authenticated .review-filter-form {
    grid-template-columns: 1fr;
  }

  .admin-authenticated .review-filter-actions {
    grid-column: auto;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Genealogy canvas palette: neutral enterprise surface; nodes and relation tokens remain unchanged. */
.admin-authenticated .tree-canvas {
  background: #f8fafc;
}

.admin-authenticated .lineage-tree {
  border-color: #e5e7eb;
  background: #ffffff;
}

.admin-authenticated .panel-center.is-fullscreen,
.admin-authenticated .panel-center:fullscreen {
  background: #f8fafc;
}

/* Classic RuoYi-style focused login. */
body:not(.admin-authenticated) {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(236, 245, 255, 0.96), rgba(240, 242, 245, 0.98)),
    #f0f2f5;
}

body:not(.admin-authenticated) .shell {
  display: block;
  width: 100%;
  min-height: 100vh;
  padding-top: 56px;
}

body:not(.admin-authenticated) .hero {
  position: fixed;
  z-index: 20;
  inset: 0 0 auto;
  display: flex;
  width: 100%;
  min-height: 56px;
  height: 56px;
  align-items: center;
  justify-content: flex-start;
  padding: 0 24px;
  border: 0;
  color: #ffffff;
  background: #304156;
  box-shadow: 0 2px 8px rgba(0, 21, 41, 0.18);
}

body:not(.admin-authenticated) .hero .topbar-main {
  width: 100%;
}

body:not(.admin-authenticated) .hero-mark {
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

body:not(.admin-authenticated) .hero h1,
body:not(.admin-authenticated) .hero p,
body:not(.admin-authenticated) .hero-side,
body:not(.admin-authenticated) .topbar-menu-btn,
body:not(.admin-authenticated) .breadcrumb {
  display: none;
}

body:not(.admin-authenticated) .login-card {
  width: min(420px, calc(100% - 32px));
  margin: clamp(48px, 10vh, 104px) auto 40px;
  padding: 30px 34px 28px;
  border: 1px solid #e4e7ed;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(31, 45, 61, 0.14);
}

body:not(.admin-authenticated) .login-brand {
  justify-content: center;
  margin-bottom: 22px;
  text-align: left;
}

body:not(.admin-authenticated) .login-brand-seal {
  background: #409eff;
}

body:not(.admin-authenticated) .login-brand strong {
  font-size: 19px;
}

body:not(.admin-authenticated) .login-card .section-head {
  justify-content: center;
  margin-bottom: 20px;
  text-align: center;
}

body:not(.admin-authenticated) .login-card .section-tag {
  display: none;
}

body:not(.admin-authenticated) .login-card h2 {
  margin: 0;
  color: #303133;
  font-size: 21px;
  font-weight: 600;
}

body:not(.admin-authenticated) .login-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid #dcdfe6;
}

body:not(.admin-authenticated) .login-mode-btn {
  min-height: 40px;
  padding: 8px 6px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: #606266;
  background: transparent;
  font-size: 13px;
}

body:not(.admin-authenticated) .login-mode-btn:hover {
  color: #409eff;
}

body:not(.admin-authenticated) .login-mode-btn.active {
  border-bottom-color: #409eff;
  color: #409eff;
  background: transparent;
}

body:not(.admin-authenticated) .login-mode-btn.login-anonymous-btn {
  grid-column: 1 / -1;
  order: 2;
  min-height: 32px;
  margin-top: 8px;
  border: 0;
  color: #909399;
  font-size: 12px;
}

body:not(.admin-authenticated) .login-panel-title {
  display: none;
}

body:not(.admin-authenticated) .login-panel-copy {
  margin-bottom: 14px;
  color: #909399;
  font-size: 12px;
  line-height: 1.6;
}

body:not(.admin-authenticated) .login-grid {
  grid-template-columns: 1fr;
  gap: 14px;
}

body:not(.admin-authenticated) .login-grid label,
body:not(.admin-authenticated) .login-panel > label {
  gap: 6px;
  color: #606266;
  font-size: 12px;
}

.login-input-shell {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  min-height: 40px;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  background: #ffffff;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.login-input-shell:focus-within {
  border-color: #409eff;
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.12);
}

.login-input-shell > svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #909399;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-input-shell > input {
  min-width: 0;
  min-height: 38px;
  padding: 0;
  border: 0;
  outline: 0;
  box-shadow: none;
}

.login-input-shell > input:focus {
  border: 0;
  box-shadow: none;
}

.password-toggle {
  min-width: 42px;
  min-height: 32px;
  padding: 0 4px;
  border: 0;
  color: #409eff;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

body:not(.admin-authenticated) .inline-field {
  gap: 8px;
}

body:not(.admin-authenticated) .inline-field input {
  min-height: 40px;
}

body:not(.admin-authenticated) .inline-field .ghost-btn {
  flex: 0 0 112px;
  min-height: 40px;
}

body:not(.admin-authenticated) .login-actions {
  margin-top: 16px;
}

body:not(.admin-authenticated) .login-actions .primary-btn {
  width: 100%;
  min-height: 40px;
}

body:not(.admin-authenticated) .hint {
  color: #909399;
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.login-error {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #fab6b6;
  border-radius: 4px;
  color: #c45656;
  background: #fef0f0;
  font-size: 12px;
  line-height: 1.5;
}

.login-error.hidden {
  display: none;
}

@media (max-width: 600px) {
  body:not(.admin-authenticated) .hero {
    padding: 0 16px;
  }

  body:not(.admin-authenticated) .login-card {
    margin-top: 28px;
    padding: 26px 22px 24px;
  }
}

/* Tree inline action tray must stay on the enterprise palette. */
.admin-authenticated .tree-action-tray {
  padding: 7px 9px;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 21, 41, 0.08);
}
.admin-authenticated .tree-action-title { color: #606266; }
.admin-authenticated .tree-action-btn {
  border: 1px solid #b3d8ff;
  border-radius: 4px;
  color: #409eff;
  background: #ffffff;
  box-shadow: none;
}
.admin-authenticated .tree-action-btn:hover {
  border-color: #409eff;
  color: #ffffff;
  background: #409eff;
}
.admin-authenticated .tree-action-btn.danger-btn {
  border-color: #fab6b6;
  color: #f56c6c;
  background: #ffffff;
}
.admin-authenticated .tree-action-btn.danger-btn:hover {
  border-color: #f56c6c;
  color: #ffffff;
  background: #f56c6c;
}

.member-delete-dialog {
  width: min(480px, calc(100vw - 32px));
  margin: min(18vh, 140px) auto 24px;
}

.member-delete-tag {
  color: #f56c6c;
}

.member-delete-target {
  margin: 18px 0;
  padding: 12px 14px;
  border: 1px solid #fbc4c4;
  border-radius: 6px;
  color: #c45656;
  background: #fef0f0;
  font-size: 15px;
  font-weight: 600;
}

.member-delete-dialog .modal-actions {
  justify-content: flex-end;
}

.member-search-shell { position: relative; display: flex; gap: 8px; min-width: min(560px, 48vw); }
.member-search-shell input { min-width: 280px; min-height: 36px; border-radius: 4px; background: #ffffff; }
.member-search-shell .primary-btn, .member-search-shell .ghost-btn { flex: 0 0 auto; }
.member-search-results {
  position: absolute; z-index: 70; top: calc(100% + 8px); right: 0; width: min(760px, 84vw); max-height: 520px;
  overflow-y: auto; padding: 8px; border: 1px solid #dcdfe6; border-radius: 6px; background: #ffffff;
  box-shadow: 0 12px 32px rgba(0, 21, 41, 0.18);
}
.member-search-head { display: flex; justify-content: space-between; padding: 8px 10px 12px; color: #606266; font-size: 12px; }
.member-search-item { display: grid; grid-template-columns: minmax(150px, .62fr) minmax(260px, 1fr); gap: 8px 14px; width: 100%; padding: 12px; border-top: 1px solid #ebeef5; color: #303133; background: #ffffff; text-align: left; }
.member-search-item:hover { background: #ecf5ff; }
.member-search-item-main { display: grid; gap: 4px; }
.member-search-item-detail { display: grid; gap: 3px; min-width: 0; color: #606266; font-size: 12px; line-height: 1.45; }
.member-search-item-detail span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-search-relations { color: #303133; }
.member-search-item-main small, .member-search-match { color: #909399; font-size: 12px; }
.member-search-tags { display: flex; flex-wrap: wrap; grid-column: 1 / 2; gap: 5px; align-content: start; }
.member-search-tags em { padding: 2px 7px; border-radius: 999px; color: #409eff; background: #ecf5ff; font-size: 11px; font-style: normal; }
.member-search-match { grid-column: 2 / 3; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; align-self: center; }
.member-search-empty { padding: 28px 16px; color: #909399; text-align: center; }
.member-search-empty.error { color: #f56c6c; }
.form-field-wide { grid-column: 1 / -1; }

.relation-workspace { display: grid; gap: 16px; }
.relation-page-heading { margin-bottom: 0; }
.relation-page-actions { display: flex; align-items: center; gap: 8px; }
.relation-data-status { padding: 10px 14px; border: 1px solid #dcdfe6; border-radius: 6px; color: #606266; background: #f8fafc; font-size: 13px; }
.relation-data-status.is-error { color: #f56c6c; border-color: #fbc4c4; background: #fef0f0; }
.relation-picker-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 12px; }
.relation-picker-card { min-width: 0; padding: 18px; }
.relation-picker-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.relation-picker-title h3 { margin: 3px 0 0; color: #303133; font-size: 16px; }
.relation-slot-badge { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: #ffffff; background: #409eff; font-size: 16px; font-weight: 700; }
.relation-slot-badge.is-alt { background: #67c23a; }
.relation-search-input { position: relative; }
.relation-search-input input { min-height: 40px; border-radius: 6px; background: #ffffff; }
.relation-candidates { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; max-height: 360px; overflow-y: auto; padding: 6px; border: 1px solid #dcdfe6; border-radius: 6px; background: #ffffff; box-shadow: 0 10px 28px rgba(0, 21, 41, 0.16); }

/* Content center: dense two-pane editorial workspace. */
.content-workspace {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.content-page-heading { margin-bottom: 0; }
.content-type-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--admin-border-light);
  border-radius: 6px;
  background: #ffffff;
}
.content-type-tabs button,
.markdown-toolbar button {
  border: 0;
  border-radius: 4px;
  color: var(--admin-text-regular);
  background: transparent;
  cursor: pointer;
  font: inherit;
}
.content-type-tabs button { padding: 9px 16px; font-size: 13px; font-weight: 600; }
.content-type-tabs button:hover,
.content-type-tabs button.active { color: var(--admin-primary); background: #ecf5ff; }
.content-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(560px, 1.65fr);
  gap: 14px;
  min-width: 0;
  align-items: start;
}
.content-list-panel,
.content-editor-panel {
  min-width: 0;
  border-radius: 6px;
  background: #ffffff;
}
.content-workspace { font-family: var(--admin-font-sans); }
.content-list-panel { position: sticky; top: 74px; max-height: calc(100vh - 104px); overflow: hidden; padding: 14px; }
.content-filter-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto; gap: 8px; }
.content-filter-row input,
.content-filter-row select,
.content-form-grid input,
.content-form-grid select,
.content-form-grid textarea,
.markdown-source textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--admin-border);
  border-radius: 4px;
  color: var(--admin-text-primary);
  background: #ffffff;
  font-family: var(--admin-font-sans);
  font-size: 13px;
}
.content-filter-row input,
.content-filter-row select,
.content-form-grid input,
.content-form-grid select { min-height: 34px; padding: 7px 9px; }
.content-list-status { min-height: 20px; padding: 8px 0 4px; color: var(--admin-text-secondary); font-size: 12px; }
.content-record-list { display: grid; gap: 6px; max-height: calc(100vh - 236px); overflow-y: auto; padding-right: 3px; }
.content-record-item {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 11px;
  border: 1px solid var(--admin-border-light);
  border-radius: 5px;
  color: var(--admin-text-primary);
  background: #ffffff;
  cursor: pointer;
  text-align: left;
}
.content-record-item:hover { border-color: #b3d8ff; background: #f5faff; }
.content-record-item.active { border-color: var(--admin-primary); box-shadow: inset 3px 0 0 var(--admin-primary); }
.content-record-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.content-record-top strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.content-record-top em,
.content-status-badge { padding: 2px 7px; border-radius: 10px; color: #606266; background: #f0f2f5; font-size: 11px; font-style: normal; white-space: nowrap; }
.content-record-top em[data-status="PUBLISHED"], .content-status-badge[data-status="PUBLISHED"] { color: #529b2e; background: #f0f9eb; }
.content-record-top em[data-status="ARCHIVED"], .content-status-badge[data-status="ARCHIVED"] { color: #909399; background: #f4f4f5; }
.content-record-top em[data-status="DELETED"], .content-status-badge[data-status="DELETED"] { color: #c45656; background: #fef0f0; }
.content-record-source {
  justify-self: start;
  padding: 2px 7px;
  border: 1px solid #d8e3e6;
  border-radius: 3px;
  color: #526b70;
  background: #f3f6f7;
  font-size: 11px;
  line-height: 1.4;
}
.content-record-source[data-source="WECHAT_URL"] { border-color: #b8d8d2; color: #17675b; background: #edf7f5; }
.content-record-flags { display: flex; flex-wrap: wrap; gap: 5px; }
.content-record-flag { padding: 2px 7px; border: 1px solid #cfd8dc; border-radius: 10px; color: #52626b; background: #ffffff; font-size: 11px; line-height: 1.35; }
.content-record-flag[data-flag="home-featured"] { border-color: #247568; color: #ffffff; background: #247568; }
.content-record-item small { overflow: hidden; color: var(--admin-text-secondary); font-size: 12px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.content-empty { padding: 28px 12px; color: var(--admin-text-secondary); font-size: 13px; text-align: center; }
.content-pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; color: var(--admin-text-secondary); font-size: 12px; }
.content-editor-panel { padding: 18px; }
.content-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--admin-border-light); }
.content-editor-head h3 { margin: 4px 0 0; color: var(--admin-text-primary); font-size: 18px; }
.content-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; padding: 16px 0; }
.content-form-grid label:not(.switch-row) { display: grid; gap: 6px; }
.content-author-search { display: grid; gap: 6px; }
.content-author-search > span { color: var(--admin-text-regular); font-size: 12px; font-weight: 600; }
.content-author-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.content-author-search-row .ghost-btn { min-width: 64px; min-height: 34px; padding: 7px 12px; }
.content-author-search small { color: var(--admin-text-secondary); font-size: 11px; line-height: 1.4; }
.content-form-grid label > span,
.markdown-source > span { color: var(--admin-text-regular); font-size: 12px; font-weight: 600; }
.content-source-field { display: grid; gap: 7px; }
.content-source-field > span { color: var(--admin-text-regular); font-size: 12px; font-weight: 600; }
.content-source-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(118px, 1fr));
  justify-self: start;
  overflow: hidden;
  border: 1px solid #dcdfe6;
  border-radius: 5px;
  background: #f3f6f7;
}
.content-source-switch label { position: relative; display: block; cursor: pointer; }
.content-source-switch input { position: absolute; opacity: 0; pointer-events: none; }
.content-source-switch label span {
  display: block;
  padding: 8px 15px;
  color: #52626b;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  transition: color .16s ease, background .16s ease, box-shadow .16s ease;
}
.content-source-switch label + label span { border-left: 1px solid #dcdfe6; }
.content-source-switch input:checked + span { color: #ffffff; background: #247568; box-shadow: inset 0 0 0 1px #247568; }
.content-source-switch input:focus-visible + span { outline: 2px solid #409eff; outline-offset: -2px; }
.content-source-switch input:disabled + span { cursor: not-allowed; opacity: .62; }
.content-form-grid textarea { padding: 8px 9px; resize: vertical; }
.content-field-wide { grid-column: 1 / -1; }
.content-form-grid .switch-row { align-self: end; min-height: 34px; margin: 0; }
.content-display-settings { display: grid; gap: 7px; }
.content-display-title { color: var(--admin-text-regular); font-size: 12px; font-weight: 600; }
.content-display-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.content-toggle-card { display: grid; align-content: center; gap: 4px; min-height: 62px; padding: 10px 12px; border: 1px solid var(--admin-border-light); border-radius: 5px; background: #f8fafc; }
.content-toggle-card .switch-row { align-self: auto; min-height: auto; }
.content-toggle-card small { color: var(--admin-text-secondary); font-size: 11px; line-height: 1.45; }
.content-toggle-card.disabled { background: #f5f7fa; }
.content-toggle-card.disabled .switch-row,
.content-toggle-card.disabled small { color: #909399; }
.content-media-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; border: 1px dashed #c0c4cc; border-radius: 5px; background: #f8fafc; }
.content-media-row input[type="file"] { max-width: 270px; color: var(--admin-text-regular); font-size: 12px; }
.content-media-row span { color: var(--admin-text-secondary); font-size: 12px; }
.markdown-toolbar { display: flex; align-items: center; gap: 4px; margin-top: 16px; padding: 4px; border: 1px solid var(--admin-border-light); border-bottom: 0; border-radius: 5px 5px 0 0; background: #f5f7fa; }
.markdown-toolbar button { padding: 7px 12px; font-size: 12px; }
.markdown-toolbar button.active { color: var(--admin-primary); background: #ffffff; box-shadow: 0 0 0 1px var(--admin-border-light); }
.markdown-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 430px; border: 1px solid var(--admin-border-light); border-radius: 0 0 5px 5px; overflow: hidden; }
.markdown-source { display: grid; grid-template-rows: auto 1fr; gap: 8px; min-width: 0; padding: 14px; border-right: 1px solid var(--admin-border-light); background: #ffffff; }
.markdown-source textarea { height: 100%; min-height: 390px; padding: 12px; border: 0; border-radius: 0; outline: 0; resize: vertical; font-family: "JetBrains Mono", Consolas, monospace; line-height: 1.65; }
.markdown-preview { min-width: 0; overflow-wrap: anywhere; padding: 18px; color: var(--admin-text-primary); background: #ffffff; font-size: 14px; line-height: 1.8; }
.markdown-preview h1, .markdown-preview h2, .markdown-preview h3 { margin: 1em 0 0.45em; line-height: 1.35; }
.markdown-preview p { margin: 0.65em 0; }
.markdown-preview img { display: block; max-width: 100%; height: auto; margin: 12px 0; border-radius: 4px; }
.markdown-preview blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--admin-primary); color: var(--admin-text-regular); background: #f5f7fa; }
.markdown-preview pre { overflow-x: auto; padding: 12px; border-radius: 4px; color: #e5e7eb; background: #1f2937; }
.markdown-preview code { font-family: "JetBrains Mono", Consolas, monospace; }
.markdown-media-placeholder { display: inline-block; padding: 8px 10px; border: 1px dashed #c0c4cc; color: var(--admin-text-secondary); background: #f8fafc; }
.markdown-editor-grid.preview-only { grid-template-columns: 1fr; }
.markdown-editor-grid.preview-only .markdown-source { display: none; }
.content-save-status { min-height: 22px; padding-top: 10px; color: var(--admin-text-secondary); font-size: 12px; }
.content-save-status[data-tone="loading"] { color: var(--admin-primary); }
.content-save-status[data-tone="success"] { color: var(--admin-success); }
.content-save-status[data-tone="error"] { color: var(--admin-danger); }
.content-save-status[data-tone="warning"] { color: #b88230; }
.content-editor-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding-top: 10px; }
.content-delete-btn { margin-right: auto; }
.content-editor-panel form[data-deleted="true"] input:disabled,
.content-editor-panel form[data-deleted="true"] textarea:disabled,
.content-editor-panel form[data-deleted="true"] select:disabled { color: #606266; background: #f5f7fa; cursor: not-allowed; opacity: 1; }
.content-editor-panel form[data-deleted="true"] .content-media-row { border-style: solid; background: #f5f7fa; }

.content-delete-dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  color: #303133;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(0, 21, 41, 0.22);
}
.content-delete-dialog::backdrop { background: rgba(0, 21, 41, 0.46); backdrop-filter: blur(2px); }
.content-delete-dialog-form { padding: 22px; }
.content-delete-dialog-head { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 14px; align-items: start; }
.content-delete-warning-mark { display: grid; width: 34px; height: 34px; border-radius: 50%; place-items: center; color: #ffffff; background: #f56c6c; font-weight: 700; }
.content-delete-dialog-head h3 { margin: 0; color: #303133; font-size: 18px; font-weight: 600; }
.content-delete-dialog-head p { margin: 8px 0 0; color: #606266; font-size: 13px; line-height: 1.7; }
.content-delete-confirm-field { display: grid; gap: 7px; margin: 18px 0 0 52px; }
.content-delete-confirm-field span { color: #606266; font-size: 12px; font-weight: 600; }
.content-delete-confirm-field input { width: 100%; }
.content-delete-confirm-field input:focus { border-color: #f56c6c; box-shadow: 0 0 0 2px rgba(245, 108, 108, 0.12); }
.content-delete-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid #ebeef5; }

@media (max-width: 1180px) {
  .content-layout { grid-template-columns: minmax(230px, 0.65fr) minmax(480px, 1.35fr); }
  .markdown-editor-grid { grid-template-columns: 1fr; }
  .markdown-source { border-right: 0; border-bottom: 1px solid var(--admin-border-light); }
}

@media (max-width: 900px) {
  .content-type-tabs { overflow-x: auto; }
  .content-type-tabs button { flex: 0 0 auto; }
  .content-layout { grid-template-columns: 1fr; }
  .content-list-panel { position: static; max-height: none; }
  .content-record-list { max-height: 340px; }
}

@media (max-width: 620px) {
  .content-filter-row, .content-form-grid { grid-template-columns: 1fr; }
  .content-field-wide { grid-column: auto; }
  .content-display-options { grid-template-columns: 1fr; }
  .content-editor-panel { padding: 14px; }
}
.relation-candidate { display: grid; grid-template-columns: minmax(130px, .7fr) minmax(160px, 1.3fr); gap: 10px; width: 100%; padding: 10px; border-top: 1px solid #ebeef5; color: #303133; background: #ffffff; text-align: left; }
.relation-candidate:first-child { border-top: 0; }
.relation-candidate:hover { background: #ecf5ff; }
.relation-candidate-main { display: grid; gap: 4px; min-width: 0; }
.relation-candidate-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relation-candidate-main small, .relation-candidate-detail em { color: #909399; font-size: 12px; font-style: normal; }
.relation-candidate-detail { display: grid; gap: 3px; min-width: 0; }
.relation-candidate-detail em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relation-search-empty { padding: 20px 12px; color: #909399; text-align: center; }
.relation-selected { min-height: 68px; margin-top: 12px; }
.relation-selected-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid #b3d8ff; border-radius: 6px; background: #ecf5ff; }
.relation-selected-card > div { display: grid; gap: 3px; min-width: 0; }
.relation-selected-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relation-selected-card small { color: #606266; font-size: 12px; }
.relation-selected-label { color: #409eff; font-size: 11px; font-weight: 700; }
.relation-selected-empty { padding: 14px 2px; color: #909399; font-size: 13px; }
.relation-swap-wrap { display: flex; align-items: center; justify-content: center; }
.relation-swap-btn { white-space: nowrap; }
.relation-result-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: 16px; }
.relation-result-panel, .relation-node-panel { min-width: 0; padding: 16px; }
.relation-result { min-height: 260px; }
.relation-result-empty { display: grid; place-items: center; min-height: 180px; padding: 24px; color: #909399; text-align: center; }
.relation-result-empty.is-error { color: #f56c6c; }
.relation-result-summary { padding: 14px; border: 1px solid #d9ecff; border-radius: 6px; background: #f4f9ff; }
.relation-result-summary h3 { margin: 4px 0 6px; color: #303133; font-size: 19px; }
.relation-result-summary p { margin: 5px 0; color: #606266; font-size: 13px; line-height: 1.6; }
.relation-result-proof { color: #909399 !important; }
.relation-common-ancestor { display: grid; gap: 3px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #d9ecff; color: #303133; }
.relation-common-ancestor small { color: #909399; }
.relation-alternatives { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; color: #909399; font-size: 12px; }
.relation-alternative { padding: 5px 8px; border: 1px solid #b3d8ff; border-radius: 4px; color: #409eff; background: #ffffff; font-size: 12px; }
.relation-alternative.active { color: #ffffff; background: #409eff; }
.relation-tree-result { position: relative; margin-top: 16px; padding: 16px; overflow-x: auto; border: 1px solid #ebeef5; border-radius: 6px; background: #ffffff; }
.relation-tree-root, .relation-tree-node { display: grid; gap: 3px; min-width: 150px; padding: 10px 12px; border: 1px solid #c6e2ff; border-radius: 6px; color: #303133; background: #f8fbff; text-align: left; }
.relation-tree-root { position: relative; margin: 0 auto 18px; text-align: center; }
.relation-tree-root::after { position: absolute; bottom: -19px; left: 50%; width: 1px; height: 18px; background: #dcdfe6; content: ''; }
.relation-tree-result > .relation-tree-node { position: relative; margin: 0 auto 18px; }
.relation-tree-result > .relation-tree-node::after { position: absolute; bottom: -19px; left: 50%; width: 1px; height: 18px; background: #dcdfe6; content: ''; }
.relation-tree-root span, .relation-tree-node-role { color: #409eff; font-size: 11px; font-weight: 600; }
.relation-tree-root small, .relation-tree-node small { color: #909399; font-size: 11px; }
.relation-tree-node.is-target { border-color: #409eff; box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1); }
.relation-tree-branches { position: relative; display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 24px; min-width: 420px; padding-top: 18px; }
.relation-tree-branches::before { position: absolute; top: 0; left: 25%; right: 25%; height: 1px; background: #dcdfe6; content: ''; }
.relation-tree-branches.is-single { grid-template-columns: 1fr; min-width: 0; }
.relation-tree-branches.is-single::before { left: 50%; right: auto; width: 1px; }
.relation-tree-branch { position: relative; min-width: 0; }
.relation-tree-branch::before { position: absolute; top: -18px; left: 50%; width: 1px; height: 18px; background: #dcdfe6; content: ''; }
.relation-tree-branch-title { margin-bottom: 8px; color: #606266; font-size: 12px; font-weight: 600; }
.relation-tree-same-root { padding: 12px; border: 1px dashed #b3d8ff; border-radius: 6px; color: #409eff; background: #f4f9ff; font-size: 12px; text-align: center; }
.relation-tree-step { display: grid; gap: 5px; justify-items: center; }
.relation-tree-edge { display: flex; align-items: center; width: 100%; color: #909399; font-size: 11px; }
.relation-tree-edge::before { flex: 1; height: 1px; margin-right: 6px; background: #dcdfe6; content: ''; }
.relation-tree-edge::after { flex: 1; height: 1px; margin-left: 6px; background: #dcdfe6; content: ''; }
.relation-tree-edge.is-spouse::before, .relation-tree-edge.is-spouse::after { height: 0; border-top: 1px dashed #67c23a; background: transparent; }
.relation-tree-edge span { padding: 2px 5px; border-radius: 3px; background: #f4f4f5; white-space: nowrap; }
.relation-tree-edge span:only-child { }
.relation-tree-branch-A .relation-tree-edge span { color: #409eff; }
.relation-tree-branch-B .relation-tree-edge span { color: #67c23a; }
.relation-node-detail { min-height: 180px; }
.relation-node-detail-card { display: grid; gap: 10px; }
.relation-node-detail-card h4 { margin: 4px 0 0; color: #303133; font-size: 18px; }
.relation-node-detail-card p { margin: 0; color: #606266; font-size: 13px; line-height: 1.6; }
.relation-detail-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.relation-detail-tags em { padding: 3px 7px; border-radius: 999px; color: #409eff; background: #ecf5ff; font-size: 11px; font-style: normal; }

/* System settings: a focused single-column maintenance form. */
.settings-workspace { display: grid; gap: 16px; }
.settings-panel { width: min(760px, 100%); padding: 24px; }
.settings-panel .panel-head h3 { margin: 4px 0 0; color: #303133; font-size: 18px; }
.settings-copy { max-width: 640px; margin: 14px 0 0; color: #606266; line-height: 1.7; }
.settings-form { display: grid; gap: 18px; margin-top: 24px; }
.settings-form > label { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 16px; }
.settings-form > label > span { color: #606266; text-align: right; }
.settings-form input { min-height: 40px; border-radius: 4px; background: #ffffff; }
.settings-form .editor-actions { margin-left: 136px; }
.settings-status { min-height: 20px; margin: 0 0 0 136px; color: #909399; font-size: 13px; }
.settings-status[data-state="success"] { color: #67c23a; }
.settings-status[data-state="error"] { color: #f56c6c; }
.settings-status[data-state="loading"] { color: #409eff; }

@media (max-width: 900px) {
  .relation-picker-grid, .relation-result-layout { grid-template-columns: 1fr; }
  .relation-swap-wrap { order: 2; }
  .relation-picker-grid .relation-picker-card:last-child { order: 3; }
  .relation-tree-branches { grid-template-columns: 1fr; min-width: 0; }
  .settings-panel { padding: 18px; }
  .settings-form > label { grid-template-columns: 1fr; gap: 8px; }
  .settings-form > label > span { text-align: left; }
  .settings-form .editor-actions,
  .settings-status { margin-left: 0; }
}
@media (max-width: 900px) {
  .member-search-shell { min-width: 0; width: 100%; flex-wrap: wrap; }
  .member-search-shell input { flex: 1 1 220px; min-width: 0; }
  .member-search-results { right: auto; left: 0; width: min(620px, calc(100vw - 48px)); }
  .member-search-item { grid-template-columns: 1fr; }
}

/* Genealogy image import: dense industrial review console. */
.genealogy-import-workspace {
  --import-bg: #f4f7f6;
  --import-panel: #ffffff;
  --import-ink: #173f3a;
  --import-accent: #247568;
  --import-warning: #d97706;
  --import-danger: #b42318;
  display: grid;
  gap: 14px;
  font-family: var(--admin-font-sans);
}
.genealogy-import-heading { margin-bottom: 0; }
.genealogy-import-heading-actions,
.genealogy-import-toolbar-actions,
.genealogy-import-footer > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.genealogy-import-shell { display: grid; grid-template-columns: 254px minmax(0, 1fr); gap: 12px; min-height: 760px; }
.genealogy-import-task-panel,
.genealogy-import-main { min-width: 0; border-radius: 10px; border: 1px solid #dbe5e2; background: var(--import-panel); box-shadow: 0 8px 24px rgba(23, 63, 58, 0.07); }
.genealogy-import-task-panel { padding: 14px; }
.genealogy-import-task-panel .panel-head { margin-bottom: 8px; }
.genealogy-import-task-panel h3 { margin: 2px 0 0; color: var(--import-ink); font-size: 16px; }
.genealogy-import-status,
.genealogy-import-operation-status,
.genealogy-import-save-status { min-height: 20px; color: #657b77; font-size: 12px; line-height: 1.5; }
.genealogy-import-status[data-state="error"],
.genealogy-import-operation-status[data-state="error"],
.genealogy-import-save-status[data-state="error"] { color: var(--import-danger); }
.genealogy-import-status[data-state="success"],
.genealogy-import-operation-status[data-state="success"],
.genealogy-import-save-status[data-state="saved"] { color: var(--import-accent); }
.genealogy-import-status[data-state="loading"],
.genealogy-import-operation-status[data-state="loading"],
.genealogy-import-save-status[data-state="saving"] { color: #2563a9; }
.genealogy-import-task-list { display: grid; gap: 8px; max-height: 690px; overflow-y: auto; padding: 3px; }
.genealogy-import-task { display: grid; gap: 7px; width: 100%; padding: 12px; border: 1px solid #dbe5e2; border-radius: 8px; color: #344d49; text-align: left; background: #ffffff; }
.genealogy-import-task:hover { border-color: #84aaa3; }
.genealogy-import-task.active { border-color: var(--import-accent); box-shadow: inset 3px 0 0 var(--import-accent); background: #edf7f5; }
.genealogy-import-task > span:first-child { display: flex; justify-content: space-between; gap: 8px; }
.genealogy-import-task strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.genealogy-import-task em,
.genealogy-import-task-badge { flex: 0 0 auto; padding: 2px 7px; border-radius: 999px; color: var(--import-accent); background: #e2f2ef; font-size: 11px; font-style: normal; }
.genealogy-import-task em[data-status="FAILED"],
.genealogy-import-task-badge[data-status="FAILED"] { color: var(--import-danger); background: #feeceb; }
.genealogy-import-task em[data-status="RECOGNIZING"],
.genealogy-import-task-badge[data-status="RECOGNIZING"] { color: #2563a9; background: #e8f2fd; }
.genealogy-import-task em[data-status="READY_TO_MERGE"],
.genealogy-import-task-badge[data-status="READY_TO_MERGE"] { color: #166534; background: #e7f6eb; }
.genealogy-import-task small { color: #71827f; font-size: 11px; }
.genealogy-import-task-foot { display: flex; justify-content: space-between; gap: 6px; color: #71827f; font-size: 11px; }
.genealogy-import-task-foot b { overflow: hidden; color: var(--import-danger); text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.genealogy-import-task-empty { padding: 26px 10px; color: #71827f; text-align: center; font-size: 12px; }
.genealogy-import-main { display: flex; flex-direction: column; overflow: hidden; }
.genealogy-import-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 14px; border-bottom: 1px solid #dbe5e2; background: #f8fbfa; }
.genealogy-import-toolbar > div:first-child { display: flex; align-items: center; gap: 10px; min-width: 0; }
.genealogy-import-toolbar strong { overflow: hidden; color: var(--import-ink); text-overflow: ellipsis; white-space: nowrap; }
.genealogy-import-toolbar-actions input[type="file"] { width: min(240px, 30vw); min-height: 36px; padding: 6px; border-radius: 6px; background: #ffffff; }
.genealogy-import-operation-status { padding: 6px 14px; border-bottom: 1px solid #e7eeec; background: #ffffff; }
.genealogy-import-generation-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 14px; border-bottom: 1px solid #e7eeec; color: #5f756f; font-size: 12px; background: #f5faf8; }
.genealogy-import-generation-bar label { color: var(--import-ink); font-weight: 700; }
.genealogy-import-generation-bar input { width: 72px; min-height: 30px; padding: 4px 8px; border: 1px solid #b6cbc5; border-radius: 5px; color: var(--import-ink); font-size: 13px; font-weight: 700; background: #fff; }
.genealogy-import-generation-bar input:disabled { color: #8b9b97; background: #eef3f1; }
.genealogy-import-generation-bar strong { min-width: 22px; color: var(--import-accent); font-size: 15px; }
.genealogy-import-generation-bar small { color: #7b8f8a; }
.genealogy-import-empty { display: grid; place-content: center; flex: 1; gap: 8px; min-height: 560px; color: #71827f; text-align: center; background: var(--import-bg); }
.genealogy-import-empty strong { color: var(--import-ink); font-size: 18px; }
.genealogy-import-review { display: flex; flex: 1; min-height: 0; flex-direction: column; background: var(--import-bg); }
.genealogy-import-columns { display: grid; grid-template-columns: minmax(260px, .9fr) minmax(380px, 1.3fr) minmax(300px, .92fr); flex: 1; min-height: 530px; border-bottom: 1px solid #dbe5e2; }
.genealogy-import-pane { display: flex; min-width: 0; min-height: 0; flex-direction: column; border-right: 1px solid #dbe5e2; background: #ffffff; }
.genealogy-import-pane:last-child { border-right: 0; }
.genealogy-import-pane-head { display: flex; flex: 0 0 44px; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; border-bottom: 1px solid #dbe5e2; background: #f8fbfa; }
.genealogy-import-pane-head > div:first-child { display: flex; align-items: center; gap: 7px; color: var(--import-ink); }
.genealogy-import-pane-head > div:first-child > span { display: inline-grid; place-items: center; width: 23px; height: 23px; border-radius: 5px; color: #ffffff; background: var(--import-ink); font-size: 10px; }
.genealogy-import-compact-tools { display: flex; align-items: center; gap: 3px; }
.genealogy-import-compact-tools button,
.genealogy-import-text-button,
.genealogy-import-issue-filters button { min-width: 27px; height: 27px; padding: 0 7px; border: 1px solid #cfddda; border-radius: 5px; color: #385752; background: #ffffff; font-size: 11px; }
.genealogy-import-compact-tools button:hover,
.genealogy-import-text-button:hover,
.genealogy-import-issue-filters button:hover,
.genealogy-import-issue-filters button.active { color: #ffffff; border-color: var(--import-accent); background: var(--import-accent); }
.genealogy-import-source-viewport,
.genealogy-import-tree-viewport { position: relative; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; cursor: grab; background-color: #eef3f2; background-image: linear-gradient(#dce6e3 1px, transparent 1px), linear-gradient(90deg, #dce6e3 1px, transparent 1px); background-size: 20px 20px; }
.genealogy-import-source-viewport.is-panning,
.genealogy-import-tree-viewport.is-panning { cursor: grabbing; user-select: none; }
.genealogy-import-source-frame { position: relative; margin: 24px; transform-origin: top left; background: #ffffff; box-shadow: 0 8px 22px rgba(23, 63, 58, .15); }
.genealogy-import-source-image { display: block; width: 100%; height: 100%; object-fit: fill; }
.genealogy-import-token-layer { position: absolute; inset: 0; }
.genealogy-import-token { position: absolute; min-width: 3px; min-height: 3px; padding: 0; border: 1px solid rgba(36, 117, 104, .35); background: rgba(36, 117, 104, .07); }
.genealogy-import-token.active { z-index: 2; border: 2px solid var(--import-warning); background: rgba(217, 119, 6, .18); }
.genealogy-import-tree-surface { position: relative; min-width: 100%; min-height: 100%; }
.genealogy-import-tree-content { position: absolute; top: 0; left: 0; transform-origin: top left; }
.genealogy-import-tree-content svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.genealogy-import-generation { position: absolute; top: 20px; color: #55716c; text-align: center; font-family: "Songti SC", STSong, serif; font-size: 12px; font-weight: 700; }
.genealogy-import-edge { fill: none; stroke: #8da7a2; stroke-width: 1.4; }
.genealogy-import-edge[data-relation-type="SPOUSE"] { stroke: #d97706; stroke-dasharray: 5 4; }
.genealogy-import-tree-node { position: absolute; display: grid; align-content: center; gap: 2px; padding: 5px 9px; border: 1px solid #9db5b0; border-left: 4px solid #5c879f; border-radius: 7px; color: var(--import-ink); text-align: left; background: #ffffff; box-shadow: 0 2px 7px rgba(23, 63, 58, .08); }
.genealogy-import-tree-node[data-gender="FEMALE"] { border-left-color: #bd6575; }
.genealogy-import-tree-node[data-gender="UNKNOWN"] { border-left-color: #879794; }
.genealogy-import-tree-node[data-decision="UNDECIDED"]::after { position: absolute; top: 5px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--import-warning); content: ""; }
.genealogy-import-tree-node:hover,
.genealogy-import-tree-node.active { border-color: var(--import-accent); outline: 3px solid rgba(36, 117, 104, .16); }
.genealogy-import-tree-node strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.genealogy-import-tree-node small { overflow: hidden; color: #71827f; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.genealogy-import-tree-viewport:fullscreen { background-color: #eef3f2; }
.genealogy-import-property-pane { overflow: hidden; }
.genealogy-import-property-empty { display: grid; place-content: center; flex: 1; padding: 20px; color: #71827f; text-align: center; }
.genealogy-import-property-content { flex: 1; min-height: 0; overflow-y: auto; }
.genealogy-import-member-form { padding: 10px; }
.genealogy-import-member-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.genealogy-import-member-fields label { display: grid; gap: 4px; min-width: 0; }
.genealogy-import-member-fields label.wide { grid-column: 1 / -1; }
.genealogy-import-member-fields label > span { color: #607773; font-size: 11px; }
.genealogy-import-member-fields label > small { color: #879995; font-size: 9px; line-height: 1.4; }
.genealogy-import-member-fields input,
.genealogy-import-member-fields select,
.genealogy-import-member-fields textarea { min-height: 32px; padding: 6px 8px; border-radius: 5px; font-size: 12px; background: #ffffff; }
.genealogy-import-member-fields textarea { min-height: 64px; resize: vertical; }
.genealogy-import-member-fields input[data-generation-derived="true"] { color: #4c6861; background: #f1f6f4; }
.genealogy-import-subsection { padding: 11px 10px; border-top: 1px solid #e3ebe9; }
.genealogy-import-subsection-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.genealogy-import-subsection-head strong { color: var(--import-ink); font-size: 12px; }
.genealogy-import-subsection-head small { color: #7a8e8a; font-size: 10px; }
.genealogy-import-relation-list { display: grid; gap: 5px; }
.genealogy-import-relation-list > div { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 5px; background: #f2f7f6; font-size: 11px; }
.genealogy-import-relation-list button { color: var(--import-danger); background: transparent; font-size: 11px; }
.genealogy-import-relation-add { display: grid; grid-template-columns: 88px minmax(0, 1fr) 62px; gap: 5px; margin-top: 7px; }
.genealogy-import-relation-add select,
.genealogy-import-relation-add button { min-height: 30px; padding: 4px 6px; border: 1px solid #cfddda; border-radius: 5px; font-size: 11px; background: #ffffff; }
.genealogy-import-relation-add button { color: #ffffff; border-color: var(--import-accent); background: var(--import-accent); }
.genealogy-import-new-decision { width: 100%; padding: 8px; border: 1px dashed #84aaa3; border-radius: 6px; color: var(--import-accent); background: #edf7f5; font-size: 12px; }
.genealogy-import-new-decision.active { color: #ffffff; border-style: solid; background: var(--import-accent); }
.genealogy-import-candidate { display: grid; gap: 5px; margin-top: 7px; padding: 8px; border: 1px solid #dbe5e2; border-radius: 6px; background: #ffffff; }
.genealogy-import-candidate.active { border-color: var(--import-accent); background: #f0f8f6; }
.genealogy-import-candidate > div:first-child,
.genealogy-import-candidate > div:last-child { display: flex; justify-content: space-between; gap: 5px; }
.genealogy-import-candidate strong { color: var(--import-ink); font-size: 12px; }
.genealogy-import-candidate em { color: var(--import-warning); font-size: 10px; font-style: normal; }
.genealogy-import-candidate p,
.genealogy-import-candidate small { margin: 0; color: #637b77; font-size: 10px; line-height: 1.5; }
.genealogy-import-candidate button { flex: 1; padding: 5px; border: 1px solid #9eb7b2; border-radius: 4px; color: var(--import-accent); background: #ffffff; font-size: 10px; }
.genealogy-import-no-candidate { padding: 8px 0; color: #71827f; font-size: 11px; }
.genealogy-import-update-table { display: grid; gap: 1px; margin-top: 9px; overflow-x: auto; background: #dbe5e2; }
.genealogy-import-update-table > div { display: grid; grid-template-columns: 64px minmax(72px, 1fr) minmax(72px, 1fr) 76px; gap: 1px; background: #dbe5e2; }
.genealogy-import-update-table > div > * { min-width: 0; padding: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: #ffffff; font-size: 10px; }
.genealogy-import-update-table select { min-height: 25px; border-radius: 3px; }
.genealogy-import-update-head > * { color: #ffffff; background: var(--import-ink) !important; font-weight: 600; }
.genealogy-import-issues { flex: 0 0 140px; min-height: 0; background: #ffffff; }
.genealogy-import-issues-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 12px; border-bottom: 1px solid #dbe5e2; }
.genealogy-import-issues-head > div:first-child { display: flex; align-items: center; gap: 7px; color: var(--import-ink); }
.genealogy-import-issues-head > div:first-child span { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 10px; color: #ffffff; background: var(--import-danger); font-size: 10px; }
.genealogy-import-issue-filters { display: flex; gap: 4px; }
.genealogy-import-issue-list { display: flex; gap: 7px; padding: 8px 12px; overflow-x: auto; }
.genealogy-import-issue { display: grid; grid-template-columns: auto minmax(160px, 1fr); gap: 3px 7px; flex: 0 0 auto; min-width: 250px; max-width: 360px; padding: 7px 9px; border: 1px solid #e4cfca; border-radius: 6px; text-align: left; background: #fff7f6; }
.genealogy-import-issue[data-blocking="false"] { border-color: #ead8b6; background: #fff9ed; }
.genealogy-import-issue.active { outline: 3px solid rgba(180, 35, 24, .15); }
.genealogy-import-issue span { grid-row: 1 / span 2; align-self: start; padding: 2px 5px; border-radius: 3px; color: #ffffff; background: var(--import-danger); font-size: 9px; }
.genealogy-import-issue[data-blocking="false"] span { background: var(--import-warning); }
.genealogy-import-issue strong { overflow: hidden; color: #5d3631; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.genealogy-import-issue small { color: #92736e; font-size: 9px; }
.genealogy-import-issue-empty { padding: 16px; color: #71827f; font-size: 11px; }
.genealogy-import-footer { display: flex; flex: 0 0 50px; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid #dbe5e2; background: #f8fbfa; }
.genealogy-import-preview-dialog { width: min(820px, calc(100vw - 40px)); max-height: calc(100vh - 60px); padding: 0; overflow: auto; border: 0; border-radius: 10px; color: #334c48; background: #ffffff; box-shadow: 0 26px 80px rgba(23, 63, 58, .28); }
.genealogy-import-preview-dialog::backdrop { background: rgba(19, 38, 35, .58); }
.genealogy-import-preview-head,
.genealogy-import-preview-actions { position: sticky; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; background: #ffffff; }
.genealogy-import-preview-head { top: 0; border-bottom: 1px solid #dbe5e2; }
.genealogy-import-preview-head h3 { margin: 3px 0 0; color: var(--import-ink); }
.genealogy-import-preview-actions { bottom: 0; border-top: 1px solid #dbe5e2; }
.genealogy-import-preview-dialog #genealogyImportPreviewContent { display: grid; gap: 16px; padding: 18px; }
.genealogy-import-preview-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.genealogy-import-preview-metrics > div { display: grid; gap: 4px; padding: 10px; border: 1px solid #dbe5e2; border-radius: 6px; background: #f4f7f6; }
.genealogy-import-preview-metrics span { color: #667d79; font-size: 10px; }
.genealogy-import-preview-metrics strong { color: var(--import-ink); font-size: 20px; }
.genealogy-import-preview-dialog section h4 { margin: 0 0 8px; color: var(--import-ink); }
.genealogy-import-preview-dialog section p { margin: 0; line-height: 1.7; }
.genealogy-import-preview-list { display: grid; max-height: 260px; overflow: auto; border: 1px solid #dbe5e2; }
.genealogy-import-preview-list > div { display: grid; grid-template-columns: 1fr 80px 1.4fr; gap: 8px; padding: 7px 9px; border-bottom: 1px solid #e7eeec; font-size: 11px; }

@media (max-width: 1320px) {
  .genealogy-import-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .genealogy-import-columns { grid-template-columns: minmax(230px, .8fr) minmax(340px, 1.2fr) minmax(280px, .9fr); }
}
@media (max-width: 1040px) {
  .genealogy-import-shell { grid-template-columns: 1fr; }
  .genealogy-import-task-panel { max-height: 230px; }
  .genealogy-import-task-list { display: flex; max-height: 150px; overflow-x: auto; }
  .genealogy-import-task { flex: 0 0 230px; }
  .genealogy-import-columns { grid-template-columns: 1fr 1.3fr; }
  .genealogy-import-property-pane { grid-column: 1 / -1; min-height: 430px; border-top: 1px solid #dbe5e2; }
}

