:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Georgia", "Times New Roman", serif;
  
  /* Light Theme */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-surface: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --border-color: #e2e8f0;
  --border-subtle: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  
  /* Brand & Tree Lineage Accents */
  --jarzab-gold: #b45309;
  --jarzab-gold-light: #fef3c7;
  --jarzab-gold-border: #f59e0b;
  --jarzab-gold-glow: rgba(245, 158, 11, 0.25);
  
  --male-color: #2563eb;
  --male-bg: #eff6ff;
  --female-color: #db2777;
  --female-bg: #fdf2f8;
  
  --line-normal: #94a3b8;
  --line-jarzab: #f59e0b;
  
  --canvas-bg: #f8fafc;
  --canvas-dot: #cbd5e1;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

[data-theme="dark"] {
  --bg-main: #0b0f19;
  --bg-card: #151d2d;
  --bg-surface: #1e293b;
  --bg-surface-hover: #273549;
  --border-color: #243042;
  --border-subtle: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --jarzab-gold: #fbbf24;
  --jarzab-gold-light: rgba(251, 191, 36, 0.12);
  --jarzab-gold-border: #f59e0b;
  --jarzab-gold-glow: rgba(245, 158, 11, 0.35);

  --male-color: #60a5fa;
  --male-bg: rgba(96, 165, 250, 0.1);
  --female-color: #f472b6;
  --female-bg: rgba(244, 114, 182, 0.1);

  --line-normal: #475569;
  --line-jarzab: #f59e0b;

  --canvas-bg: #0b0f19;
  --canvas-dot: #1e293b;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Header & Navigation */
.app-header {
  height: 64px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  background-color: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.nav-tab-btn {
  background: transparent;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.nav-tab-btn:hover {
  color: var(--text-main);
}

.nav-tab-btn.active {
  background-color: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

/* Header Controls */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-subtle);
}

.btn-admin {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
  position: relative;
}

.btn-admin:hover {
  background: var(--bg-surface-hover);
}

.btn-admin.is-admin {
  background: var(--jarzab-gold-light);
  border-color: var(--jarzab-gold-border);
  color: var(--jarzab-gold);
}

.admin-badge {
  background-color: #ef4444;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  padding: 1px 6px;
  margin-left: 2px;
}

/* Main Container */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 24px 24px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* Tab Views */
.tab-view {
  display: none;
  flex: 1;
  flex-direction: column;
  height: calc(100vh - 104px);
}

.tab-view.active {
  display: flex;
}

/* ==========================================================================
   TREE VIEW
   ========================================================================== */
.tree-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

/* Toolbar inside tree */
.tree-toolbar {
  padding: 12px 18px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 20;
  flex-wrap: wrap;
}

.tree-search-box {
  position: relative;
  width: 280px;
}

.tree-search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition-fast);
}

.tree-search-input:focus {
  border-color: var(--jarzab-gold-border);
  box-shadow: 0 0 0 3px var(--jarzab-gold-glow);
}

.tree-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.search-result-item {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: var(--bg-surface-hover);
}

.search-result-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background-color: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
}

.search-result-info {
  flex: 1;
  font-size: 0.82rem;
}

.search-result-info strong {
  display: block;
  color: var(--text-main);
}

.search-result-info span {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Nav hints */
.tree-hints {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 0.78rem;
  background-color: var(--bg-surface);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.tree-hint-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.key-badge {
  display: inline-block;
  padding: 1px 6px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

/* Tree actions / zoom controls */
.tree-zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-ctrl {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-ctrl:hover {
  background-color: var(--bg-surface-hover);
}

.zoom-level-text {
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 44px;
  text-align: center;
  color: var(--text-muted);
}

/* Filter / Legend */
.tree-legend {
  display: flex;
  align-items: center;
  gap: 12px;
}

.legend-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.legend-pill.active-gold {
  background: var(--jarzab-gold-light);
  border-color: var(--jarzab-gold-border);
  color: var(--jarzab-gold);
  font-weight: 600;
  box-shadow: 0 0 10px var(--jarzab-gold-glow);
}

/* Tree Canvas / Viewport */
.tree-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  background-color: var(--canvas-bg);
  background-image: radial-gradient(var(--canvas-dot) 1px, transparent 1px);
  background-size: 24px 24px;
}

.tree-viewport.is-dragging {
  cursor: grabbing;
}

.tree-world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

/* SVG Connector Lines */
.tree-svg-layer {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: visible;
}

.tree-line {
  fill: none;
  stroke: var(--line-normal);
  stroke-width: 2px;
  stroke-linecap: round;
  transition: stroke var(--transition-normal);
}

.tree-line.jarzab-line {
  stroke: var(--line-jarzab);
  stroke-width: 3.5px;
  filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.4));
}

.tree-line.marriage-line {
  stroke: #e11d48;
  stroke-width: 2px;
  stroke-dasharray: 4 3;
}

/* Tree Node Card */
.tree-node {
  position: absolute;
  width: 230px;
  min-height: 96px;
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  padding: 10px;
  gap: 12px;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.tree-node:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-xl);
  border-color: var(--border-subtle);
  z-index: 50;
}

/* JARZĄB MALE TRUNK SPECIAL STYLING */
.tree-node.jarzab-trunk {
  border: 2.5px solid var(--jarzab-gold-border);
  background: linear-gradient(135deg, var(--bg-card) 80%, var(--jarzab-gold-light));
  box-shadow: 0 4px 14px var(--jarzab-gold-glow), var(--shadow-md);
  position: absolute;
}

.tree-node.jarzab-trunk::before {
  content: "👑 TRZON JARZĄBÓW";
  position: absolute;
  top: -11px;
  right: 8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 4px rgba(217, 119, 6, 0.3);
}

.node-avatar-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  align-self: center;
}

.node-avatar-img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--border-color);
  background-color: var(--bg-surface);
}

.tree-node.jarzab-trunk .node-avatar-img {
  border-color: var(--jarzab-gold-border);
}

.node-avatar-fallback {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  background: #64748b;
  border: 2px solid var(--border-color);
}

.node-avatar-fallback.male {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.node-avatar-fallback.female {
  background: linear-gradient(135deg, #ec4899, #be185d);
}

.tree-node.jarzab-trunk .node-avatar-fallback.male {
  background: linear-gradient(135deg, #f59e0b, #b45309);
  border-color: var(--jarzab-gold-border);
}

.node-gender-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 13px;
  height: 13px;
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-card);
}

.node-gender-dot.male { background-color: var(--male-color); }
.node-gender-dot.female { background-color: var(--female-color); }

.node-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.node-name {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-maiden {
  font-size: 0.74rem;
  font-style: italic;
  color: var(--female-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.node-dates {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.node-age {
  font-weight: 600;
  color: var(--text-subtle);
}

/* Minimap */
.tree-minimap {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 180px;
  height: 120px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 30;
  opacity: 0.85;
  transition: opacity var(--transition-fast);
}

.tree-minimap:hover {
  opacity: 1;
}

.minimap-canvas {
  width: 100%;
  height: 100%;
}

.minimap-viewport-rect {
  position: absolute;
  border: 1.5px solid var(--jarzab-gold-border);
  background-color: var(--jarzab-gold-glow);
  pointer-events: none;
}

/* ==========================================================================
   MEDIA VIEW
   ========================================================================== */
.media-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  padding-right: 4px;
}

.media-hero {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-surface));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.media-hero-text h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.media-hero-text p {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 700px;
  line-height: 1.5;
}

.author-quote-box {
  background-color: var(--jarzab-gold-light);
  border-left: 4px solid var(--jarzab-gold-border);
  padding: 12px 18px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-top: 14px;
  font-style: italic;
  font-size: 0.84rem;
  color: var(--text-main);
  line-height: 1.5;
}

.author-quote-box strong {
  display: block;
  font-style: normal;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--jarzab-gold);
}

/* Book Viewer Section */
.book-viewer-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.book-viewer-header {
  padding: 14px 20px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.book-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.book-search-input {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.84rem;
  outline: none;
  width: 220px;
}

.book-nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.book-page-input {
  width: 50px;
  text-align: center;
  padding: 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.85rem;
}

.book-canvas-area {
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111827;
  padding: 24px;
  position: relative;
  overflow: auto;
}

.book-spread-img {
  max-width: 100%;
  max-height: 750px;
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  border-radius: 4px;
  transition: transform 0.2s ease;
}

/* Gallery of Archival Photos */
.media-gallery-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.gallery-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
}

.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.gallery-card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background-color: var(--bg-surface);
}

.gallery-card-body {
  padding: 14px;
}

.gallery-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-main);
}

.gallery-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   MODALS & DRAWERS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-close:hover {
  background-color: var(--bg-surface);
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--bg-surface);
}

/* Person Detail Layout */
.person-profile-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.profile-avatar-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}

.profile-avatar-img {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--border-color);
}

.profile-avatar-fallback {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  color: white;
  background: #64748b;
}

.profile-avatar-fallback.male { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.profile-avatar-fallback.female { background: linear-gradient(135deg, #ec4899, #be185d); }

.profile-title-area {
  flex: 1;
}

.profile-name {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.2;
}

.profile-maiden {
  font-size: 0.95rem;
  color: var(--female-color);
  font-style: italic;
  margin-top: 3px;
}

.profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-jarzab {
  background: var(--jarzab-gold-light);
  color: var(--jarzab-gold);
  border: 1px solid var(--jarzab-gold-border);
}

.badge-male {
  background: var(--male-bg);
  color: var(--male-color);
}

.badge-female {
  background: var(--female-bg);
  color: var(--female-color);
}

/* Detail Grid */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  background-color: var(--bg-surface);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}

.detail-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
}

.detail-value.empty {
  color: var(--text-subtle);
  font-style: italic;
}

/* Relatives Section */
.relatives-section {
  margin-bottom: 24px;
}

.relatives-group {
  margin-bottom: 12px;
}

.relatives-group-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.relative-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.relative-chip {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.relative-chip:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-subtle);
}

/* Bio & Trivia */
.bio-box, .trivia-box {
  margin-bottom: 20px;
  background: var(--bg-surface);
  padding: 16px;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--border-subtle);
}

.bio-box.has-content, .trivia-box.has-content {
  border-left-color: var(--jarzab-gold-border);
}

.box-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.box-content {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-main);
}

.cite-link {
  color: var(--jarzab-gold);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.btn-primary {
  background-color: var(--jarzab-gold);
  color: white;
}

.btn-primary:hover {
  background-color: #92400e;
}

.btn-secondary {
  background-color: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
}

.btn-success {
  background-color: #10b981;
  color: white;
}

.btn-success:hover {
  background-color: #059669;
}

.btn-danger {
  background-color: #ef4444;
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--jarzab-gold-border);
  box-shadow: 0 0 0 3px var(--jarzab-gold-glow);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* Diff Viewer */
.diff-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}

.diff-col {
  background-color: var(--bg-surface);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.diff-col-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.diff-field {
  margin-bottom: 8px;
  font-size: 0.84rem;
}

.diff-field.changed {
  background-color: rgba(16, 185, 129, 0.15);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  border-left: 3px solid #10b981;
}

/* Proposal Item */
.proposal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.proposal-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .app-header {
    padding: 0 12px;
  }
  .brand-text p {
    display: none;
  }
  .main-content {
    padding: 10px;
  }
  .tree-hints {
    display: none;
  }
  .tree-search-box {
    width: 100%;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .diff-container {
    grid-template-columns: 1fr;
  }
}
