/* Genogramm Modul Stylesheet */

/* Hide 2D board chrome when Genogram is active */
body.is-genogram .toolbar,
body.is-genogram .palette,
body.is-genogram .mobile-add,
body.is-genogram .orbit,
body.is-genogram .empty,
body.is-genogram #board-badge,
body.is-genogram .board-minimap,
body.is-genogram .stage-3d-hint {
  display: none !important;
}

/* Shared panel container styled as sidebar in Genogram mode */
body.is-genogram .panel {
  position: fixed;
  top: 48px;
  right: 0;
  bottom: 0;
  width: 340px;
  max-width: 100vw;
  max-height: none;
  padding: 0;
  background: #f8f4eb;
  border-left: 1px solid rgba(0, 0, 0, 0.1);
  border-top: none;
  border-right: none;
  border-bottom: none;
  border-radius: 0;
  box-shadow: -2px 0 16px rgba(0, 0, 0, 0.06);
  z-index: 15;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.is-genogram .panel[hidden],
body.is-genogram .panel.hidden {
  display: none !important;
}

/* Give room for the panel when open */
body.is-genogram:has(.panel:not([hidden])) .genogram-svg-container,
body.is-genogram.has-genogram-panel .genogram-svg-container {
  margin-right: 340px;
}

.genogram-svg-container {
  transition: margin-right 0.18s ease;
}

@media (max-width: 768px) {
  body.is-genogram .panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 55vh;
    border-radius: 18px 18px 0 0;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    border-left: none;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
  }
  body.is-genogram:has(.panel:not([hidden])) .genogram-svg-container {
    margin-right: 0;
    margin-bottom: 55vh;
  }
}

/* Position the 2D/3D/Genogramm view toggle seamlessly into the Genogram toolbar */
body.is-genogram .view-tools {
  position: fixed;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  right: auto;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 0;
}

body.is-genogram .view-switch {
  background: rgba(255, 253, 246, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 9px;
  padding: 3px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

body.is-genogram .view-switch button {
  min-width: 44px;
  min-height: 30px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
}

/* Responsive adjustment for Genogram toolbar */
@media (max-width: 850px) {
  body.is-genogram .geno-context-title {
    font-size: 12px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 680px) {
  body.is-genogram .genogram-toolbar-left {
    display: none;
  }
  body.is-genogram .view-tools {
    left: 12px;
    transform: none;
  }
}

.genogram-view-wrapper {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-paper, #f4efe3);
  color: #2b2b2b;
  overflow: hidden;
  user-select: none;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.genogram-toolbar {
  height: 48px;
  background: rgba(244, 239, 227, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 10;
}

.genogram-toolbar-left,
.genogram-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.genogram-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #ffffff;
  color: #2b2b2b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.genogram-btn:hover {
  background: #f7f5f0;
  border-color: rgba(0, 0, 0, 0.2);
}

.genogram-btn.primary {
  background: #3d6350;
  color: #ffffff;
  border-color: #3d6350;
}

.genogram-btn.primary:hover {
  background: #315141;
}

.genogram-main-area {
  flex: 1;
  position: relative;
  display: flex;
  overflow: hidden;
}

.genogram-svg-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: grab;
}

.genogram-svg-container.panning {
  cursor: grabbing;
}

.genogram-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Generation Guide Lines */
.generation-guideline {
  stroke: rgba(0, 0, 0, 0.08);
  stroke-dasharray: 4, 6;
  stroke-width: 1;
}

.generation-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  fill: rgba(0, 0, 0, 0.35);
  user-select: none;
}

/* Node Elements */
.geno-node {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.geno-node-hitbox {
  fill: transparent;
  pointer-events: all;
  cursor: pointer;
}

.geno-node:hover .geno-shape {
  stroke-width: 2.5px;
}

.geno-node.selected .geno-shape {
  stroke: #2b55a7 !important;
  stroke-width: 3px !important;
  filter: drop-shadow(0 2px 8px rgba(43, 85, 167, 0.3));
}

.geno-shape {
  fill: #ffffff;
  stroke: var(--node-accent, #333333);
  stroke-width: 2px;
  transition: stroke 0.15s, stroke-width 0.15s;
}

.geno-index-inner {
  fill: none;
  stroke: var(--node-accent, #333333);
  stroke-width: 1.5px;
}

.geno-deceased-cross {
  stroke: #c0392b;
  stroke-width: 2px;
  stroke-linecap: round;
}

/* Node Labels (Smooth slide-down when node is selected under quick-actions) */
.geno-node-labels {
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}

.geno-node.selected .geno-node-labels {
  transform: translateY(32px);
  animation: genoNodeLabelSlideDown 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes genoNodeLabelSlideDown {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(32px);
  }
}

.geno-node-name {
  font-size: 13px;
  font-weight: 600;
  fill: #222222;
  text-anchor: middle;
  pointer-events: none;
  user-select: none;
}

.geno-node-dates {
  font-size: 11px;
  fill: #666666;
  text-anchor: middle;
  pointer-events: none;
  user-select: none;
}

/* Note / Bio Indicator Badge on Node */
.geno-note-badge {
  cursor: help;
  pointer-events: all;
}

.geno-badge-bg {
  fill: #d97706;
  stroke: #ffffff;
  stroke-width: 1.2px;
  transition: transform 0.15s ease, fill 0.15s ease;
}

.geno-note-badge:hover .geno-badge-bg {
  fill: #b45309;
  transform: scale(1.15);
}

.geno-badge-icon {
  fill: #ffffff;
  font-size: 8px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  pointer-events: none;
  user-select: none;
}

/* Lines */
.line-union {
  stroke: #333333;
  stroke-width: 2px;
  fill: none;
}

.geno-slash-mark {
  stroke: #333333;
  stroke-width: 2px;
  stroke-linecap: round;
}

.line-parent-child {
  stroke: #444444;
  stroke-width: 2px;
  fill: none;
}

.line-adopted {
  stroke-dasharray: 6, 4;
}

.line-foster {
  stroke-dasharray: 2, 3;
}

.line-step {
  stroke-dasharray: 8, 4, 2, 4;
}

.line-donor {
  stroke-dasharray: 10, 3, 2, 3;
}

.line-emotional {
  stroke-width: 2px;
  fill: none;
}

.line-emotional.pattern-connected {
  stroke: #2855a7;
  stroke-width: 2.5px;
}

.line-emotional.pattern-fused {
  stroke: #8e44ad;
  stroke-width: 3.5px;
}

.line-emotional.pattern-conflictual {
  stroke: #c0392b;
  stroke-width: 2px;
}

.line-emotional.pattern-distant {
  stroke: #7f8c8d;
  stroke-width: 1.5px;
  stroke-dasharray: 4, 4;
}

.line-emotional.pattern-cutoff {
  stroke: #a07168;
}

.geno-cutoff-base {
  stroke: #a07168;
  stroke-width: 2px;
}

.geno-cutoff-bar {
  stroke: #c0392b;
  stroke-width: 2.5px;
  stroke-linecap: round;
}

/* Quick-Add Overlay on Selected Node */
.geno-quick-handles {
  pointer-events: all;
  animation: genoHandlesPopIn 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-origin: center center;
}

@keyframes genoHandlesPopIn {
  from {
    opacity: 0;
    transform: scale(0.75);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.geno-handle-btn {
  cursor: pointer;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.25));
  transition: filter 0.15s ease;
}

.geno-handle-btn:hover {
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.4));
}

.geno-handle-hit {
  fill: transparent;
  pointer-events: all;
}

.geno-handle-bg {
  fill: #3d6350;
  stroke: #ffffff;
  stroke-width: 1.5px;
  transition: fill 0.15s ease, stroke-width 0.15s ease, r 0.15s ease;
  pointer-events: all;
}

.geno-handle-btn:hover .geno-handle-bg {
  fill: #2d4d3e;
  stroke-width: 2.2px;
  r: 12.5;
}

.geno-handle-icon {
  fill: #ffffff;
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  user-select: none;
}

/* Right Inspector Panel (shared container) */
body.is-genogram .genogram-inspector {
  width: 100%;
  height: 100%;
  background: #f8f4eb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body:not(.is-genogram) .genogram-inspector {
  display: none !important;
}

.genogram-inspector.hidden {
  display: none !important;
}

.inspector-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inspector-title {
  font-size: 14px;
  font-weight: 600;
  color: #111111;
  margin: 0;
}

.inspector-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #888888;
  border-radius: 4px;
  padding: 2px 6px;
}

.inspector-close:hover {
  color: #222222;
  background: #f0ede6;
}

.inspector-tabs {
  display: flex;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: #f3ede1;
  overflow-x: auto;
}

.inspector-tab {
  flex: 1;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  border: none;
  background: none;
  color: #666666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.inspector-tab.active {
  color: #3d6350;
  border-bottom-color: #3d6350;
  background: #f8f4eb;
}

.inspector-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.inspector-section {
  margin-bottom: 16px;
}

.inspector-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #555555;
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.inspector-input,
.inspector-select,
.inspector-textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #d4cebe;
  border-radius: 6px;
  background: #ffffff;
  color: #222222;
  box-sizing: border-box;
  font-family: inherit;
}

.inspector-input:focus,
.inspector-select:focus,
.inspector-textarea:focus {
  outline: none;
  border-color: #3d6350;
  box-shadow: 0 0 0 2px rgba(61, 99, 80, 0.15);
}

.inspector-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.gender-button-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.gender-btn {
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #d4cebe;
  background: #ffffff;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.gender-btn.active {
  background: #3d6350;
  color: #ffffff;
  border-color: #3d6350;
}

.color-swatch-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  padding: 0;
}

.color-swatch.active {
  box-shadow: 0 0 0 2px #3d6350;
}

.inspector-item-card {
  background: #faf8f5;
  border: 1px solid #e5dfd3;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}

.inspector-item-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-weight: 600;
}

.inspector-remove-btn {
  background: none;
  border: none;
  color: #c0392b;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
}

/* Legend Modal */
.geno-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.geno-modal-backdrop.hidden {
  display: none;
}

.geno-modal-dialog {
  width: 540px;
  max-width: 90vw;
  max-height: 85vh;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.geno-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.geno-modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.geno-modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.5;
}

.geno-legend-category {
  margin-bottom: 18px;
}

.geno-legend-cat-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #555555;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.geno-legend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid #f4efe3;
}

.geno-legend-row:last-child {
  border-bottom: none;
}

.geno-legend-name {
  font-weight: 600;
  width: 180px;
  flex-shrink: 0;
}

.geno-legend-desc {
  color: #666666;
  font-size: 12px;
}

/* Systembrett Figure Panel Integration */
.figure-genogram-section {
  margin: 10px 0 14px 0;
  padding: 10px;
  background: #fdfbf7;
  border: 1px solid #e7decb;
  border-radius: 8px;
}

.btn-genogram-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #c9bca8;
  background: #ffffff;
  color: #2c3e50;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-genogram-link:hover {
  background: #f4efe3;
  border-color: #8c7355;
}

.btn-genogram-link.is-linked {
  background: #eef6f0;
  border-color: #a4ceb2;
  color: #2d5a3c;
}

.btn-genogram-link.is-linked:hover {
  background: #e2f0e6;
  border-color: #79b38c;
}

.btn-genogram-link.is-add-existing {
  background: #f2f7fc;
  border-color: #abc9e9;
  color: #1e5288;
}

.btn-genogram-link.is-add-existing:hover {
  background: #e5f0fa;
}

.geno-link-hint {
  display: block;
  font-size: 11px;
  color: #777777;
  margin: 6px 0 0 0;
  text-align: center;
}

/* Unified PersonSelector Component Styles */
.person-selector-root {
  display: flex;
  flex-direction: column;
}

.person-selector-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #d7d4c8;
  margin-bottom: 14px;
}

.person-selector-tab {
  padding: 8px 12px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: #555555;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.person-selector-tab:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #222222;
}

.person-selector-tab.active {
  background: #fffdf7;
  border-color: #d7d4c8;
  color: #3d6350;
  font-weight: 600;
  margin-bottom: -1px;
  border-bottom: 1px solid #fffdf7;
}

.person-selector-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.person-selector-view.hidden {
  display: none !important;
}

.person-selector-hint {
  font-size: 13px;
  color: #586355;
  margin: 4px 0 8px;
  line-height: 1.45;
}

.person-selector-search {
  width: 100%;
  padding: 7px 11px;
  border: 1px solid #d7d4c8;
  border-radius: 8px;
  font-size: 13px;
  background: #ffffff;
  margin-bottom: 6px;
}

.person-selector-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.person-selector-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid #ded6c5;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}

.person-selector-item:hover {
  background: #f8f5ee;
  border-color: #bfae93;
  transform: translateY(-1px);
}

.person-selector-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.person-selector-item-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.person-selector-item-text strong {
  font-size: 13px;
  color: #2b2b2b;
}

.person-selector-badge {
  font-size: 10px;
  color: #707b6a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.person-selector-item-action {
  font-size: 11px;
  font-weight: 600;
  color: #3d6350;
  padding: 4px 8px;
  background: #eef5f1;
  border-radius: 4px;
  flex-shrink: 0;
}

.person-selector-role-label {
  margin-top: 12px;
  font-size: 13px;
  display: block;
}

.person-selector-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.person-selector-swatch {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.person-selector-swatch:hover {
  transform: scale(1.15);
}

.person-selector-swatch.active {
  border-color: #222222;
  box-shadow: 0 0 0 2px #ffffff;
}

/* Palette Genogram Import Picker (Legacy Fallback) */
.palette-genogram-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  margin: 12px 0;
}

.palette-geno-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid #ded6c5;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.palette-geno-pick:hover {
  background: #f8f5ee;
  border-color: #bfae93;
}

.palette-geno-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}

.palette-geno-pick strong {
  flex: 1;
  font-size: 13px;
  color: #222222;
}

.btn-pick-action {
  font-size: 12px;
  font-weight: 600;
  color: #3d6350;
  padding: 4px 8px;
  background: #eef5f1;

  border-radius: 4px;
}

/* Delete Choices in Multi-Tool Dialog */
.del-choice-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}

.del-choice-btn {
  text-align: left;
  padding: 10px 14px;
  border: 1px solid #dcd3c1;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
  transition: background 0.15s ease;
}

.del-choice-btn:hover {
  background: #f7f3ea;
}

.del-choice-btn.danger {
  border-color: #e5b4b4;
  background: #fff8f8;
  color: #c0392b;
}

.del-choice-btn.danger:hover {
  background: #faebeb;
}

.del-choice-btn strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

.del-choice-btn small {
  display: block;
  font-size: 11px;
  color: #666666;
  line-height: 1.3;
}

/* Unconnected Persons Dock (Randleiste) */
.genogram-unconnected-dock {
  width: 250px;
  min-width: 250px;
  background: #faf8f5;
  border-right: 1px solid #e5dfd3;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s cubic-bezier(0.16, 1, 0.3, 1), min-width 0.2s ease;
  z-index: 10;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.03);
}

.genogram-unconnected-dock.is-collapsed {
  width: 42px;
  min-width: 42px;
}

.genogram-unconnected-dock.is-collapsed .geno-dock-desc,
.genogram-unconnected-dock.is-collapsed .geno-dock-list,
.genogram-unconnected-dock.is-collapsed .geno-dock-title,
.genogram-unconnected-dock.is-collapsed .geno-dock-badge {
  display: none !important;
}

.geno-dock-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e8e2d5;
  background: #f4efe6;
}

.geno-dock-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.geno-dock-title {
  font-size: 13px;
  font-weight: 700;
  color: #2b2b28;
}

.geno-dock-badge {
  font-size: 11px;
  font-weight: 700;
  background: #3d6350;
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 10px;
}

.geno-dock-toggle {
  background: none;
  border: 1px solid #d4cebe;
  border-radius: 4px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #555;
  transition: background 0.15s ease;
}

.geno-dock-toggle:hover {
  background: #e9e3d5;
  color: #111;
}

.geno-dock-desc {
  font-size: 11px;
  color: #777;
  padding: 8px 14px;
  margin: 0;
  line-height: 1.35;
  border-bottom: 1px dashed #e8e2d5;
  background: #faf8f5;
}

.geno-dock-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.geno-dock-card {
  background: #ffffff;
  border: 1px solid #dcd7ca;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.geno-dock-card:hover {
  border-color: #3d6350;
  box-shadow: 0 2px 6px rgba(61, 99, 80, 0.12);
  transform: translateY(-1px);
}

.geno-dock-card.is-selected {
  border-color: #3d6350;
  background: #f4f8f5;
  box-shadow: 0 0 0 2px rgba(61, 99, 80, 0.25);
}

.geno-dock-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.geno-dock-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.geno-dock-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.geno-dock-name {
  font-size: 13px;
  color: #222222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.geno-dock-gender {
  font-size: 11px;
  color: #777777;
}

.geno-dock-card-actions {
  display: flex;
  justify-content: flex-end;
}

.geno-dock-btn-place {
  background: #3d6350;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.geno-dock-btn-place:hover {
  background: #2d4a3e;
}

.genogram-svg-container.is-drag-over {
  outline: 2px dashed #3d6350;
  outline-offset: -4px;
  background: rgba(61, 99, 80, 0.04);
}

.inspector-unconnected-banner {
  background: #f4efe6;
  border: 1px solid #dcd3c1;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.unconnected-banner-title {
  font-size: 12px;
  font-weight: 700;
  color: #4a3b2c;
  margin-bottom: 4px;
}

.unconnected-banner-desc {
  font-size: 11px;
  color: #6d5b4b;
  margin: 0 0 10px 0;
  line-height: 1.35;
}



/* Unified sand-toned inspectors and shared controls in every perspective. */
:root { --panel-sand: #f8f4eb; }
.panel { background: var(--panel-sand); }
body.is-genogram .inspector-content { background: var(--panel-sand); }
body.is-genogram .inspector-header { background: var(--panel-sand); }
body.is-genogram .inspector-title { font: 21px/1.2 Georgia, serif; color: #343c34; }
body.is-genogram .inspector-tabs { background: #f3ede1; }
body.is-genogram .inspector-tab.active { background: var(--panel-sand); }
body.is-genogram .inspector-input,
body.is-genogram .inspector-content textarea,
body.is-genogram .inspector-content select { background: #fffcf5; }

/* A single shared Person action is owned by BoardView in 2D, 3D and Genogramm. */
.view-tools .shared-person-add {
  min-height: 44px; border-radius: 12px; padding: 8px 13px;
  background: #3d6350; color: #fffdf6; border: 1px solid #3d6350;
  font-weight: 650; white-space: nowrap;
}
.view-tools .shared-person-add:hover { background: #315141; color: #fff; }
body.is-genogram .bottom {
  display: flex !important; z-index: 12; bottom: 20px; padding: 4px;
}
body.is-genogram .bottom > :not(#undo):not(#redo) { display: none !important; }
body.is-genogram .zoom { display: flex !important; z-index: 12; bottom: 20px; }
body.is-genogram:has(.panel:not([hidden])) .zoom { right: 360px; }
body.is-genogram #status {
  display: block !important; z-index: 9; top: 56px; bottom: auto;
  left: 50%; right: auto; transform: translateX(-50%);
  max-width: min(420px, 60vw); background: #f8f4ebd9;
  border-radius: 10px; padding: 2px 10px; font-size: 11px;
}
/* The layout uses three mutually exclusive horizontal zones to prevent collisions:
   left context, central perspective controls, right context actions. */
@media (max-width: 1050px) {
  body.is-genogram .geno-context-title { display: none; }
}
@media (max-width: 780px) {
  body.is-genogram .view-tools { left: 12px; right: auto; transform: none; }
  body.is-genogram .genogram-toolbar-right { margin-left: auto; }
  body.is-genogram .genogram-toolbar-right button { max-width: 95px; font-size: 10px; padding: 5px 7px; }
  body.is-genogram:has(.panel:not([hidden])) .zoom { right: 12px; bottom: calc(55vh + 12px); }
  body.is-genogram:has(.panel:not([hidden])) .bottom { bottom: calc(55vh + 12px); }
  body.is-genogram:has(.panel:not([hidden])) .genogram-svg-container { margin-bottom: 55vh; }
  body.is-genogram #status { top: 96px; max-width: 80vw; }
}
@media (max-width: 600px) {
  body.is-genogram .view-tools { top: 6px; left: 7px; gap: 3px; }
  body.is-genogram .view-switch { padding: 2px; }
  body.is-genogram .view-switch button { min-width: 32px; padding: 3px 6px; font-size: 11px; }
  body.is-genogram .view-tools .shared-person-add { min-height: 36px; padding: 5px 8px; font-size: 11px; }
  body.is-genogram .genogram-toolbar-right { position: absolute; right: 5px; top: 52px; z-index: 14; }
  body.is-genogram .bottom { left: 12px; transform: none; bottom: 12px; }
  body.is-genogram .zoom { right: 12px; bottom: 12px; }
}
@media (max-width: 380px) {
  body.is-genogram .view-tools .shared-person-add { padding: 3px 5px; }
  body.is-genogram .view-switch button { min-width: 28px; }
}
/* Correspondence cue on entering the other view (not an automatic selection). */
@keyframes genogramCorrespondencePulse {
  0%,100% { stroke-width: 2; filter: none; }
  40% { stroke-width: 5; filter: drop-shadow(0 0 5px #b38339); }
}
.geno-node.geno-correspondence .geno-shape {
  stroke: #b38339 !important;
  animation: genogramCorrespondencePulse 1.3s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .geno-node.geno-correspondence .geno-shape { animation: none; stroke-width: 4; }
}

/* Global create action is unavailable while presenting prerecorded scenes. */
.demo-mode .view-tools .shared-person-add,
.presenting .view-tools .shared-person-add { display: none !important; }


/* Scene workshop reference: the Genogram may be inspected but not edited. */
.genogram-reference-banner {
  background: #e7e6d9;
  color: #455446;
  border-bottom: 1px solid #cdd0c0;
  font-size: 12px;
  padding: 8px 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.genogram-reference-banner strong { color: #304c3b; white-space: nowrap; }
.genogram-view-wrapper.is-reference-only .geno-quick-handles,
.genogram-view-wrapper.is-reference-only .geno-dock-card-actions { display: none !important; }
#genogram-container.is-reference-only .geno-quick-handles,
#genogram-container.is-reference-only .geno-dock-card-actions { display: none !important; }
#genogram-container.is-reference-only .geno-node { cursor: pointer; }
body.is-workshop-active.is-genogram .shared-person-add { display: none !important; }
body.is-workshop-active.is-genogram .bottom { display: none !important; }
body.is-workshop-active.is-genogram .zoom {
  bottom: calc(var(--workshop-dock-height, 180px) + 26px) !important;
}
body.is-workshop-active.is-genogram .panel {
  bottom: calc(var(--workshop-dock-height, 180px) + 24px);
}
body.is-workshop-active.is-genogram .genogram-svg-container {
  margin-bottom: 0;
}
@media (max-width: 768px) {
  body.is-workshop-active.is-genogram .panel {
    top: auto;
    bottom: calc(var(--workshop-dock-height, 180px) + 12px);
    max-height: min(32dvh, 285px);
  }
  body.is-workshop-active.is-genogram .genogram-svg-container {
    margin-bottom: calc(var(--workshop-dock-height, 180px) + min(32dvh, 285px));
  }
  body.is-workshop-active.is-genogram .zoom {
    bottom: calc(var(--workshop-dock-height, 180px) + min(32dvh, 285px) + 25px) !important;
  }
  body.is-workshop-active.is-genogram .genogram-reference-banner {
    font-size: 11px; padding: 7px 10px;
  }
}

/* Parallel family systems share aligned generation guides, not kinship relations. */
.geno-family-group { fill:#8ba5930c; stroke:#91a58c; stroke-width:1.5; stroke-dasharray:8 6; }
.geno-family-group-label { font:600 13px system-ui,sans-serif; fill:#536b5a; }
.line-social-context { fill:none; stroke:#658ba0; stroke-width:2.4; stroke-dasharray:7 5; opacity:.88; }
.geno-social-label { fill:#52798e; font:12px system-ui,sans-serif; text-anchor:middle;
  paint-order:stroke; stroke:#f8f4eb; stroke-width:5; stroke-linejoin:round; }
.genogram-toolbar-right { display:flex; flex-wrap:wrap; align-items:center; gap:5px; max-width: min(690px,60vw); }
.genogram-toolbar-right [aria-pressed="true"] { background:#dbe8e2; border-color:#789c88; color:#2b5d47; }
.geno-context-fieldset { background:#f8f4eb; border:1px solid #d6d4c8;
  border-radius:11px; padding:11px; margin:10px 0; }
.geno-context-fieldset legend { color:#344b3a; font-weight:600; }
.geno-member-scroll { display:grid; gap:6px; max-height:220px; overflow:auto; }
.geno-group-member { display:flex; align-items:center; gap:8px; font-size:13px; }
@media(max-width:850px) {
  .genogram-toolbar-right { max-width: calc(100vw - 120px); }
  .genogram-toolbar-right .genogram-btn { font-size:11px; padding:5px 7px; }
}
@media(max-width:600px) {
  .genogram-toolbar { padding-top:95px; }
  .genogram-toolbar-right { max-width:100%; justify-content:flex-start; }
  .genogram-toolbar-right .genogram-btn { max-width:none; }
}

/* Shared perspective toolbar owns the actual Export buttons (same DOM
   elements in 2D/3D/Genogramm), while Genogram-specific controls are
   placed on a distinct second row: no header intersection. */
body.is-genogram .genogram-toolbar {
  flex: 0 0 auto;
  height: auto;
  min-height: 104px;
  align-items: stretch;
  justify-content: flex-end;
  flex-direction: column;
  gap: 0;
  padding: 54px 12px 8px;
}
body.is-genogram .genogram-toolbar-left { display:none; }
body.is-genogram .genogram-toolbar-right {
  position: static;
  margin: 0;
  max-width: 100%;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
}
body.is-genogram .view-tools {
  position: fixed;
  top: 6px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  gap: 5px;
  z-index: 26;
  max-width: calc(100vw - 12px);
}
body.is-genogram .view-tools #export-hub {
  font-size: 11px;
  min-height: 34px;
  padding: 5px 9px;
  border-radius: 9px;
}
body.is-genogram .view-tools #export-options {
  min-height: 34px;
  padding: 4px 6px;
  border-radius: 9px;
}
@media(max-width:760px) {
  body.is-genogram .view-tools { left: 6px; right:auto; transform:none; gap:3px; }
  body.is-genogram .genogram-toolbar { padding: 53px 6px 7px; }
  body.is-genogram .genogram-toolbar-right { justify-content:flex-start; }
  body.is-genogram .genogram-toolbar-right .genogram-btn {
    min-width:0; max-width:none; min-height:32px;
    font-size:10px; padding:5px 8px;
  }
  body.is-genogram .view-tools #export-hub { font-size:0; min-width:34px; padding:4px 6px; }
  body.is-genogram .view-tools #export-hub::after { content:'⤓'; font-size:18px; }
  body.is-genogram .view-tools #export-options { min-width:26px; }
}
@media(max-width:380px) {
  body.is-genogram .view-tools .shared-person-add { font-size:10px; padding:4px 5px; }
  body.is-genogram .view-switch button { min-width:28px; padding:3px 5px; }
  body.is-genogram .genogram-toolbar-right { gap:3px; }
}


/* Demo player has its own scene header. Shift shared and Genogram tools
   below that header instead of layering controls over the scene title. */
body.demo-mode.is-genogram .view-tools,
body.demo-sequence-mode.is-genogram .view-tools {
  top: 92px;
  left: auto;
  right: 18px;
  transform: none;
}
body.demo-mode.is-genogram .genogram-toolbar,
body.demo-sequence-mode.is-genogram .genogram-toolbar {
  padding-top: 142px;
}
body.demo-mode.is-genogram .demo-caption {
  top: 205px;
  max-width: min(330px, 32vw);
}
@media(max-width:760px) {
  body.demo-mode.is-genogram .view-tools,
  body.demo-sequence-mode.is-genogram .view-tools {
    top: 90px; left: 8px; right: 8px; transform:none;
  }
  body.demo-mode.is-genogram .genogram-toolbar,
  body.demo-sequence-mode.is-genogram .genogram-toolbar {
    padding-top: 140px;
  }
  body.demo-mode.is-genogram .demo-caption {
    top: 240px; max-width:calc(100vw - 32px);
  }
}


/* Roles and process patterns are optional non-genealogical overlays. */
.geno-role-overlay { pointer-events:none; }
.geno-role-badge { filter: drop-shadow(0px 1px 1px #0002); pointer-events:none; }
.geno-role-count {fill:#537362;font-size:10px;font-weight:700;pointer-events:none;}
.geno-pattern-edge {stroke-linecap:round;pointer-events:none;}
body.is-genogram .genogram-toolbar-right [id^="geno-btn-"][aria-pressed="true"] {
  background:#d9e7dc;color:#315c44;border-color:#7d9b85;
}


/* Shared tool layout: no view-mode-dependent jump of the perspective switch. */
body.is-genogram:not(.demo-mode) .view-tools {
  position: fixed;
  top: 108px;
  right: 24px;
  left: auto;
  transform: none;
  gap: 8px;
  z-index: 26;
  max-width: calc(100vw - 48px);
}

/* The person inspector is #panel.panel.genogram-inspector; the older
   .genogram-inspector {width:100%} must not stretch that shared root. */
@media (min-width: 769px) {
  body.is-genogram .panel.genogram-inspector {
    width: 340px;
    max-width: min(340px, 100vw);
    min-width: 0;
    height: auto;
  }
}
@media (max-width: 768px) {
  body.is-genogram .panel.genogram-inspector {
    width: 100%;
    max-width: 100vw;
    height: auto;
    max-height: 55dvh;
  }
}

/* The same left palette now offers only actions supported by GenogramView. */
body.is-genogram:not(.demo-mode):not(.presenting):not(.is-workshop-active) .palette {
  display: flex !important;
  position: fixed;
  top: 145px;
  left: 24px;
  z-index: 22;
  max-width: min(232px, calc(100vw - 48px));
}
body.is-genogram .genogram-toolbar #geno-btn-groups,
body.is-genogram .genogram-toolbar #geno-btn-social-add {
  display: none !important; /* Available through the common left palette */
}
@media (max-width: 1000px) {
  body.is-genogram:not(.demo-mode) .view-tools { right: 14px; }
  body.is-genogram:not(.demo-mode):not(.presenting):not(.is-workshop-active) .palette { left: 14px; }
}
@media (max-width: 600px) {
  body.is-genogram:not(.demo-mode) .view-tools {
    top: 88px; right: 12px; left: auto; transform: none; gap: 5px;
    max-width: calc(100vw - 24px);
  }
  body.is-genogram .genogram-toolbar { padding: 145px 6px 7px; }
  body.is-genogram:not(.demo-mode):not(.presenting):not(.is-workshop-active) .palette {
    top: auto; bottom: 100px; left: 14px;
  }
  body.is-genogram:not(.demo-mode):not(.presenting):not(.is-workshop-active) .palette:not(.open) {
    display: none !important;
  }
  body.is-genogram:not(.demo-mode):not(.presenting):not(.is-workshop-active) .palette.open {
    display: flex !important;
  }
  body.is-genogram:not(.demo-mode):not(.presenting):not(.is-workshop-active) .mobile-add {
    display: block !important; z-index: 23;
  }
}

/* The only export trigger belongs to the shared perspective toolbar. */
body.is-genogram .geno-detach[hidden] { display:none!important; }
body.is-genogram .geno-detach { white-space:nowrap; color:#315841; border-color:#83a390; background:#eff5ef; }
body.is-genogram .view-tools #export-hub { white-space:nowrap; }
@media(max-width:760px) {
  body.is-genogram .view-tools #export-hub { font-size:11px; min-width:auto; }
  body.is-genogram .view-tools #export-hub::after { content:none; }
}

/* Unified work surface V1 (proposal A)
   Scene navigation, perspective, export and camera are the SAME toolbar
   in 2D, 3D and Genogram. The inspector begins below its footprint. */
body .view-tools,
body.is-genogram .view-tools,
body.is-genogram:not(.demo-mode) .view-tools,
body.demo-mode.is-genogram .view-tools,
body.demo-sequence-mode.is-genogram .view-tools {
  position:fixed!important;
  top:12px!important;right:18px!important;left:auto!important;
  transform:none!important;
  z-index:80!important;
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  gap:6px!important;
  max-width:calc(100vw - 36px)!important;
  border-radius:12px;
  padding:5px;
  background:#fffcf5f5;
  border:1px solid #d9d8cb;
  box-shadow:0 4px 20px #28382e16;
}
body .view-tools button { white-space:nowrap; }
body .view-tools [data-open-scenes],
body .view-tools [data-edit-scene] {
  background:#eff3eb;color:#365c47;
  border:1px solid #d5ddd1;
  min-height:34px;font-size:12px;padding:5px 11px;
}
body .view-tools [data-edit-scene][hidden]{display:none!important;}
body .view-tools [data-open-scenes]:focus-visible,
body .view-tools [data-edit-scene]:focus-visible {outline:2px solid #ae7840;}
body .view-tools #export-hub {font-size:12px!important;min-height:34px!important;padding:5px 11px!important;}
body .view-tools #export-hub::after { content:none!important; }
body.is-genogram .genogram-toolbar,
body.demo-mode.is-genogram .genogram-toolbar,
body.demo-sequence-mode.is-genogram .genogram-toolbar {
  padding:78px 18px 9px!important;
  min-height:0!important;height:auto!important;
  flex:0 0 auto!important;
  flex-direction:row!important;
  align-items:center!important;
  justify-content:center!important;
  border-bottom:1px solid #dfdfd3;
}
body.is-genogram .genogram-toolbar-left {display:none!important;}
body.is-genogram .genogram-toolbar-right {
  justify-content:center!important;
  flex-wrap:wrap;
  gap:6px!important;
}
body.is-genogram .genogram-toolbar #geno-btn-detach {display:none!important;}
/* These actions exist in the common palette or common top bar, not twice. */
body.is-genogram .panel.genogram-inspector,
body.is-genogram .panel {
  top:145px!important;right:18px!important;bottom:20px!important;
  z-index:35!important;
}
body.is-genogram .panel[hidden] {display:none!important;}
body:not(.is-genogram) .panel {top:94px;}
body.is-genogram .genogram-svg-container { min-height:0; flex:1 1 auto; }
body.demo-mode .demo-header,
body.demo-sequence-mode .demo-header {
  padding-right:min(560px,48vw)!important;
  min-height:73px;
}
body.demo-mode .demo-header [data-library],
body.demo-mode .demo-header [data-detach] {display:none!important;}
body.demo-mode.is-genogram .demo-caption {top:156px!important;}
body.demo-mode.is-genogram .genogram-reference-banner {margin-top:0;}
body.is-genogram:not(.presenting):not(.demo-mode):not(.is-workshop-active) .palette {
  display:flex!important;left:18px!important;top:146px!important;
}
body.demo-sequence-mode.is-genogram .palette {display:flex!important;}
body.is-genogram .genogram-toolbar-right .genogram-btn:disabled {
  opacity:.32;filter:grayscale(1);cursor:not-allowed;
  box-shadow:none!important;
}
@media(max-width:1000px) {
  body .view-tools,
  body.is-genogram .view-tools,
  body.is-genogram:not(.demo-mode) .view-tools,
  body.demo-mode.is-genogram .view-tools,
  body.demo-sequence-mode.is-genogram .view-tools {
    top:6px!important;right:8px!important;
    gap:2px!important;
    max-width:calc(100vw - 16px)!important;
  }
  body .view-tools [data-open-scenes],
  body .view-tools [data-edit-scene] {padding:5px 7px;font-size:11px;}
  body.demo-mode .demo-header,
  body.demo-sequence-mode .demo-header {padding-top:68px!important;padding-right:14px!important;min-height:118px;}
  body.is-genogram .genogram-toolbar,
  body.demo-mode.is-genogram .genogram-toolbar,
  body.demo-sequence-mode.is-genogram .genogram-toolbar {padding-top:124px!important;}
  body.is-genogram .panel,
  body.is-genogram .panel.genogram-inspector {top:192px!important;}
  body.demo-mode.is-genogram .demo-caption {top:197px!important;}
}
@media(max-width:768px) {
  body.is-genogram .panel,
  body.is-genogram .panel.genogram-inspector {top:auto!important;bottom:0!important;right:0!important;}
  body.is-genogram:not(.presenting):not(.demo-mode):not(.is-workshop-active) .palette {
    top:auto!important;bottom:105px!important;left:10px!important;
  }
  body.is-genogram:not(.demo-mode) .palette:not(.open){display:none!important;}
  body.is-genogram:not(.demo-mode) .palette.open{display:flex!important;}
  body .view-tools [data-edit-scene] {max-width:115px;overflow:hidden;text-overflow:ellipsis;}
}

/* Momentnavigator: narrative transport belongs to the spatial 2D/3D story.
   During a read-only Genogram the family tree gets the canvas unobstructed.
   An editable user's Momentfolge (demo-sequence-mode) remains accessible. */
body.demo-mode.is-genogram .demo-controls,
body.demo-mode.is-genogram .branch-rail,
body.demo-mode.is-genogram .player-top {
  display:none!important;
}

/* Compact, unified Genogram chrome: do not waste a full header row's height.
   Keep global scene/view tools in the top line and contextual layers just below. */
body.is-genogram .genogram-toolbar,
body.demo-mode.is-genogram .genogram-toolbar,
body.demo-sequence-mode.is-genogram .genogram-toolbar {
  padding:59px 14px 5px!important;
  min-height:0!important;
}
body.is-genogram .genogram-toolbar-right {
  min-height:35px!important;
  gap:5px!important;
}
body.is-genogram .panel,
body.is-genogram .panel.genogram-inspector {
  top:113px!important;
}
body.demo-mode.is-genogram .demo-caption {top:115px!important;}
@media(max-width:1000px){
 body.is-genogram .genogram-toolbar,
 body.demo-mode.is-genogram .genogram-toolbar,
 body.demo-sequence-mode.is-genogram .genogram-toolbar {padding:117px 8px 5px!important;}
 body.is-genogram .panel,
 body.is-genogram .panel.genogram-inspector {top:174px!important;}
 body.demo-mode.is-genogram .demo-caption {top:178px!important;}
}
@media(max-width:768px){
 body.is-genogram .panel,
 body.is-genogram .panel.genogram-inspector {top:auto!important;}
}
.geno-marriage-year text {font:600 12px/1.2 system-ui;fill:#536b5b;}
.geno-node-labels .geno-node-name tspan {text-anchor:middle;}
