﻿:root {
  --gold-1: #e3a73d;
  --gold-2: #d89428;
  --gold-3: #f0bf62;
  --ink: #07131e;
  --ink-soft: #263849;
  --paper: #fffaf0;
  --paper-2: #f8efe1;
  --panel-bg: rgba(255, 250, 240, 0.92);
  --line: #f7d899;
  --red: #b3132f;
  --red-dark: #7e1027;
  --teal: #0e6d6f;
  --orange: #f16818;
  --primary-button-text: #ffffff;
  --selected-button-text: #0b0b0b;
  --workbench-bg: rgba(230, 164, 50, 0.8);
  --shadow: 0 18px 42px rgba(71, 38, 0, 0.18);
  --city-map-grid-line-color: #c1121f;
  --city-map-grid-name-color: #8f1020;
  --city-map-grid-line-width: 2px;
  --input-label-font-size: 13px;
  --input-text-font-size: 14px;
  --input-text-line-height: 1.25;
  --input-control-min-height: 40px;
  --input-control-padding-x: 11px;
  --input-control-padding-y: 10px;
  --input-textarea-min-height: 86px;
  --input-button-min-height: 40px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 242, 211, 0.2), rgba(92, 53, 8, 0.12)),
    var(--gold-1);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

body[data-input-text-size="small"] {
  --input-label-font-size: 12px;
  --input-text-font-size: 13px;
  --input-control-min-height: 36px;
  --input-control-padding-x: 10px;
  --input-control-padding-y: 8px;
  --input-textarea-min-height: 76px;
  --input-button-min-height: 36px;
}

body[data-input-text-size="medium"] {
  --input-label-font-size: 13px;
  --input-text-font-size: 14px;
  --input-control-min-height: 40px;
  --input-control-padding-x: 11px;
  --input-control-padding-y: 10px;
  --input-textarea-min-height: 86px;
  --input-button-min-height: 40px;
}

body[data-input-text-size="large"] {
  --input-label-font-size: 15px;
  --input-text-font-size: 18px;
  --input-text-line-height: 1.28;
  --input-control-min-height: 54px;
  --input-control-padding-x: 14px;
  --input-control-padding-y: 13px;
  --input-textarea-min-height: 124px;
  --input-button-min-height: 48px;
}

body[data-input-text-size="huge"] {
  --input-label-font-size: 17px;
  --input-text-font-size: 22px;
  --input-text-line-height: 1.32;
  --input-control-min-height: 68px;
  --input-control-padding-x: 16px;
  --input-control-padding-y: 16px;
  --input-textarea-min-height: 168px;
  --input-button-min-height: 56px;
}

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

button {
  cursor: pointer;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell {
  min-height: 100vh;
}

body.auth-locked {
  overflow: hidden;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(255, 214, 138, 0.28), transparent 38%),
    rgba(18, 13, 8, 0.72);
  backdrop-filter: blur(3px);
}

.auth-gate[hidden] {
  display: none;
}

.auth-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

.auth-logo {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: cover;
  margin: 0 auto 16px;
  border-radius: 16px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.auth-copy {
  margin: 0 0 18px;
  color: var(--ink-soft);
  line-height: 1.45;
}

.auth-login-form,
.auth-inline-form {
  display: grid;
  gap: 14px;
}

.auth-login-form label,
.auth-inline-form label {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

.auth-login-form input,
.auth-inline-form input {
  min-height: var(--input-control-min-height);
  padding: var(--input-control-padding-y) var(--input-control-padding-x);
  border: 1px solid #e6ba63;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: var(--input-text-font-size);
}

.account-summary {
  display: grid;
  gap: 10px;
  margin: 0;
}

.account-summary div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(227, 167, 61, 0.34);
}

.account-summary dt {
  font-weight: 800;
  color: var(--ink-soft);
}

.account-summary dd {
  margin: 0;
  font-weight: 800;
}

.topbar {
  display: grid;
  grid-template-columns: 220px minmax(360px, 1fr) 220px;
  align-items: center;
  gap: 16px;
  min-height: 112px;
  padding: 10px 22px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.75);
}

.history-controls,
.account-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
}

.account-controls {
  justify-content: flex-end;
}

.icon-button,
.lang-button,
.account-button,
.tab-button,
.primary-action,
.secondary-action,
.danger-action,
.record-grid button {
  border: 0;
  font-weight: 800;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.06);
}

.icon-button.muted {
  background: rgba(255, 250, 240, 0.52);
  color: rgba(7, 19, 30, 0.58);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.icon {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.brand-block {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-block h1 {
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}

.brand-block h1 strong,
.brand-block h1 span {
  font-family: inherit;
}

.brand-block h1 strong {
  font-weight: 800;
}

.brand-block h1 span {
  font-weight: 800;
  margin-left: 10px;
  margin-right: 10px;
}

.brand-logo {
  display: block;
  width: 166px;
  height: 66px;
  object-fit: contain;
  padding: 3px 18px;
  background: #000;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.17);
}

.brand-block.brand-anorix {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-width: 0;
}

.anorix-logo {
  display: block;
  width: 118px;
  height: 118px;
  margin: -12px 0 -10px;
  object-fit: cover;
  background: #050505;
  border-radius: 16px;
  box-shadow: 0 9px 20px rgba(0, 0, 0, 0.2);
  flex: 0 0 auto;
}

.brand-byline {
  color: var(--ink);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.brand-logo.sfba-logo {
  width: 136px;
  height: 54px;
  padding: 3px 15px;
  flex: 0 0 auto;
}

.lang-button,
.account-button {
  min-height: 40px;
  border-radius: 7px;
  padding: 0 14px;
}

.lang-button {
  background: var(--paper);
  color: var(--ink);
}

.account-button {
  background: var(--orange);
  color: var(--selected-button-text);
}

.workspace {
  padding: 20px clamp(12px, 1.25vw, 24px) 36px;
}

.workbench {
  width: min(1760px, 100%);
  min-height: 620px;
  margin: 0 auto;
  background: var(--workbench-bg);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-top: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 7px 7px 0 0;
  box-shadow: var(--shadow);
  position: relative;
}

.workbench::before,
.workbench::after {
  display: none;
}

.module-tabs {
  display: flex;
  align-items: center;
  align-content: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 72px;
  margin: 12px 14px 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background: rgba(255, 244, 220, 0.12);
  overflow: visible;
  position: relative;
  z-index: 1;
}

.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 92px;
  min-height: 42px;
  height: auto;
  padding: 0 14px;
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
}

.tab-button .icon {
  width: 17px;
  height: 17px;
}

.tab-button.icon-only {
  flex: 0 0 44px;
  min-width: 44px;
  width: 44px;
  padding: 0;
  color: var(--teal);
}

.tab-button.active {
  background: var(--orange);
  color: var(--selected-button-text);
  outline: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 0 0 2px rgba(14, 109, 111, 0.28),
    0 2px 0 rgba(0, 0, 0, 0.12);
}

.view-stack {
  min-height: 540px;
  padding: 12px 20px 28px;
  border-top: 1px solid rgba(255, 244, 220, 0.44);
}

.view {
  display: none;
  pointer-events: none;
}

.view.active {
  display: block;
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

#indata.view.active {
  isolation: isolate;
  z-index: 80;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-header h2,
.panel-card h3 {
  margin: 0;
}

.section-header h2 {
  font-size: 26px;
  line-height: 1.2;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.primary-action,
.secondary-action,
.danger-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  white-space: nowrap;
}

.primary-action {
  background: var(--teal);
  color: var(--primary-button-text);
}

.secondary-action {
  background: var(--paper);
  color: var(--ink);
}

.danger-action {
  background: #fff1f1;
  color: var(--red-dark);
}

.danger-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.stat-grid,
.content-grid,
.record-grid,
.search-panel {
  display: grid;
  gap: 14px;
}

.stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.stat-card,
.panel-card {
  min-width: 0;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(67, 38, 0, 0.12);
}

.stat-card {
  min-height: 96px;
  padding: 14px;
  display: grid;
  align-content: center;
  gap: 4px;
}

.stat-card span,
.source-list span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-card strong {
  font-size: 25px;
  line-height: 1.15;
}

.stat-card small {
  color: #5a4b35;
  font-weight: 700;
}

.stat-card.accent {
  border-color: rgba(14, 109, 111, 0.5);
}

.two-columns {
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
}

.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-area-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: -2px 0 14px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: rgba(255, 194, 80, 0.2);
}

.settings-area-button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 7px;
  padding: 0 16px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(67, 38, 0, 0.1);
}

.settings-area-button.active {
  background: var(--orange);
  color: var(--selected-button-text);
  outline: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow:
    0 0 0 1px rgba(177, 19, 47, 0.45),
    0 8px 18px rgba(67, 38, 0, 0.16);
}

.settings-panel-stack {
  display: grid;
  gap: 14px;
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.user-license-card {
  display: grid;
  gap: 16px;
}

.user-license-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.user-license-summary div {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid rgba(14, 109, 111, 0.24);
  border-radius: 10px;
  background: #e8f5f2;
}

.user-license-summary span {
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.user-license-summary strong {
  color: var(--ink);
  font-size: clamp(18px, 2vw, 25px);
  font-weight: 950;
}

.user-license-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
  align-items: start;
}

.database-settings-card {
  display: grid;
  gap: 16px;
}

.database-access-note {
  padding: 14px 16px;
  border: 1px solid rgba(14, 109, 111, 0.35);
  border-radius: 12px;
  background: #e8f5f2;
  color: #12353a;
  font-weight: 850;
}

.database-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.database-summary-grid div {
  display: grid;
  gap: 6px;
  min-height: 84px;
  padding: 14px;
  border: 1px solid rgba(14, 109, 111, 0.24);
  border-radius: 12px;
  background: #e8f5f2;
}

.database-summary-grid span {
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.database-summary-grid strong {
  color: var(--ink);
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 950;
  line-height: 1.15;
}

.database-panel-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.database-admin-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.database-info-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(217, 183, 102, 0.72);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.82);
}

.database-detail-list {
  display: grid;
  grid-template-columns: minmax(130px, 0.45fr) minmax(0, 1fr);
  margin: 0;
  border: 1px solid rgba(217, 183, 102, 0.5);
  border-radius: 10px;
  overflow: hidden;
}

.database-detail-list dt,
.database-detail-list dd {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(217, 183, 102, 0.34);
}

.database-detail-list dt {
  background: rgba(255, 244, 220, 0.72);
  color: #243235;
  font-weight: 850;
}

.database-detail-list dd {
  min-width: 0;
  overflow-wrap: anywhere;
  background: #fffdf7;
  font-weight: 800;
}

.database-detail-list dt:nth-last-child(2),
.database-detail-list dd:last-child {
  border-bottom: 0;
}

.database-row-list,
.database-maintenance-list {
  display: grid;
  gap: 8px;
}

.database-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(217, 183, 102, 0.72);
  border-radius: 10px;
  background: #fffdf7;
}

.database-row strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-weight: 950;
}

.database-row span,
.database-row small {
  color: #26393d;
  font-weight: 650;
  line-height: 1.35;
}

.database-row small {
  grid-column: 1 / -1;
  color: #5c5140;
}

.database-row em {
  justify-self: end;
  min-width: 74px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e8f5f2;
  color: #006d70;
  font-style: normal;
  font-weight: 950;
  text-align: center;
}

.database-row em[data-status="kontrollera"],
.database-row em[data-status="warning"] {
  background: #fff1d1;
  color: #8a4b00;
}

.database-row em[data-status="pågår"] {
  background: #eaf2ff;
  color: #1f5c9c;
}

.database-row em[data-status="planeras"],
.database-row em[data-status="info"] {
  background: #f4efe4;
  color: #5c5140;
}

.source-rules-settings-card {
  display: grid;
  gap: 16px;
}

.source-rules-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.source-rules-summary div {
  display: grid;
  gap: 6px;
  min-height: 84px;
  padding: 14px;
  border: 1px solid rgba(14, 109, 111, 0.24);
  border-radius: 12px;
  background: #e8f5f2;
}

.source-rules-summary span {
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.source-rules-summary strong {
  color: var(--ink);
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 950;
  line-height: 1.15;
}

.source-rules-note {
  padding: 13px 15px;
  border: 1px solid rgba(14, 109, 111, 0.24);
  border-radius: 12px;
  background: #eefbf7;
  color: #12353a;
  font-weight: 850;
}

.source-rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.source-rules-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border: 1px solid rgba(217, 183, 102, 0.72);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.84);
}

.wide-source-rule {
  grid-column: 1 / -1;
}

.source-rules-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-rule-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid rgba(14, 109, 111, 0.24);
  border-radius: 999px;
  padding: 5px 10px;
  background: #e8f5f2;
  color: var(--teal);
  font-weight: 900;
}

.source-rule-chip.muted-chip {
  background: #f4efe4;
  color: #5c5140;
}

.source-rules-list {
  display: grid;
  gap: 8px;
}

.source-rule-row {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 183, 102, 0.72);
  border-radius: 10px;
  background: #fffdf7;
}

.source-rule-row strong {
  color: var(--ink);
  font-weight: 950;
}

.source-rule-row span,
.source-rules-work-card p {
  margin: 0;
  color: #26393d;
  font-weight: 700;
  line-height: 1.35;
}

@media (max-width: 980px) {
  .database-summary-grid,
  .database-admin-layout,
  .source-rules-summary,
  .source-rules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .database-summary-grid,
  .database-admin-layout,
  .database-detail-list,
  .database-row,
  .source-rules-summary,
  .source-rules-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .wide-source-rule {
    grid-column: auto;
  }

  .database-detail-list dt {
    border-bottom: 0;
  }

  .database-detail-list dd {
    border-bottom: 1px solid rgba(217, 183, 102, 0.34);
  }

  .database-row em {
    justify-self: start;
  }
}

.settings-user-form,
.settings-organization-form,
.settings-license-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(217, 183, 102, 0.72);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.78);
}

.settings-user-side {
  display: grid;
  gap: 14px;
}

.settings-user-grid,
.settings-organization-form,
.settings-license-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-user-grid {
  display: grid;
  gap: 10px;
}

.settings-user-grid label,
.settings-organization-form label,
.settings-license-form label {
  display: grid;
  gap: 6px;
  align-content: start;
  color: #1b2e36;
  font-weight: 850;
}

.settings-user-grid .wide-field,
.settings-organization-form .wide-field,
.settings-license-form .wide-field,
.settings-organization-form h4,
.settings-license-form h4,
.settings-organization-form .form-actions,
.settings-license-form .form-actions {
  grid-column: 1 / -1;
}

.settings-user-grid input,
.settings-user-grid select,
.settings-user-grid textarea,
.settings-organization-form input,
.settings-organization-form select,
.settings-organization-form textarea,
.settings-license-form input,
.settings-license-form select,
.settings-license-form textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d9b766;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
  font-weight: 750;
}

.settings-user-grid textarea,
.settings-organization-form textarea,
.settings-license-form textarea {
  min-height: 74px;
  resize: vertical;
}

.settings-user-lists {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 14px;
}

.compact-title {
  align-items: center;
  margin-bottom: 2px;
}

.compact-title h4 {
  margin: 0;
  color: var(--red-dark);
  font-size: 1.05rem;
}

.settings-user-table,
.settings-license-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.settings-user-row,
.settings-license-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(110px, 0.4fr) minmax(95px, 0.35fr) minmax(145px, 0.45fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  border: 1px solid rgba(217, 183, 102, 0.78);
  border-radius: 10px;
  background: #fffdf7;
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.settings-license-row {
  grid-template-columns: minmax(220px, 1fr) 80px minmax(145px, 0.55fr);
}

.settings-user-row:hover,
.settings-license-row:hover {
  border-color: var(--teal);
  background: #e8f5f2;
}

.settings-user-row span,
.settings-license-row span {
  display: grid;
  gap: 3px;
}

.settings-user-row strong,
.settings-license-row strong {
  color: var(--ink);
  font-weight: 950;
}

.settings-user-row small,
.settings-license-row small {
  color: var(--ink-soft);
  font-weight: 750;
}

.settings-user-row b,
.settings-license-row b {
  color: var(--teal);
  font-weight: 950;
}

.settings-user-row em {
  color: var(--red-dark);
  font-style: normal;
  font-weight: 900;
}

.settings-user-invitation {
  padding: 12px;
  border: 1px solid rgba(14, 109, 111, 0.35);
  border-radius: 10px;
  background: #e8f5f2;
}

.settings-user-invitation code {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 6px;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
  color: var(--red-dark);
  font-weight: 900;
}

.tree-line-settings-form {
  display: grid;
  gap: 16px;
}

.tree-line-color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.tree-line-color-field {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(217, 164, 77, 0.72);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.48);
  font-weight: 900;
}

.tree-line-color-field input[type="color"] {
  width: 100%;
  height: 44px;
  padding: 4px;
  border: 1px solid rgba(217, 164, 77, 0.9);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}

.tree-line-settings-preview {
  display: block;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.app-appearance-form {
  display: grid;
  gap: 14px;
}

.input-text-size-field,
.appearance-theme-field {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.input-text-size-field legend,
.appearance-theme-field legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 900;
}

.input-text-size-field label,
.appearance-theme-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  border: 1px solid rgba(217, 164, 77, 0.72);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.input-text-size-field input,
.appearance-theme-field input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--teal);
}

.input-text-size-field label:has(input:checked),
.appearance-theme-field label:has(input:checked) {
  border-color: var(--teal);
  background: #e8f5f2;
  color: var(--teal);
  box-shadow: inset 0 0 0 1px rgba(14, 109, 111, 0.18);
}

.input-text-size-preview {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.2fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(217, 164, 77, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.appearance-color-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(217, 164, 77, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.appearance-color-grid label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 900;
}

.appearance-color-grid input[type="color"] {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(217, 164, 77, 0.72);
  border-radius: 8px;
  padding: 4px;
  background: var(--paper);
  cursor: pointer;
}

.appearance-button-preview {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 2px;
}

@media (max-width: 820px) {
  .input-text-size-field,
  .appearance-theme-field,
  .appearance-color-grid,
  .input-text-size-preview {
    grid-template-columns: 1fr;
  }
}

.panel-card {
  padding: 16px;
}

.panel-card p {
  margin: 10px 0 0;
  color: #3c4650;
  line-height: 1.45;
}

.sources-workbench {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.35fr);
  gap: 16px;
}

.source-register-panel,
.source-side-stack {
  min-width: 0;
}

.source-side-stack {
  display: grid;
  gap: 16px;
}

.source-filter-form,
.source-editor-form,
.source-link-form,
.source-import-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.source-filter-form .wide-field,
.source-editor-form .wide-field,
.source-link-form .wide-field,
.source-import-form .wide-field,
.source-filter-actions {
  grid-column: 1 / -1;
}

.source-card-list,
.source-link-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.source-register-card {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 1px solid rgba(217, 164, 77, 0.75);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.source-register-card:hover,
.source-register-card.active {
  border-color: var(--teal);
  background: #e8f5f2;
  box-shadow: inset 0 0 0 1px rgba(14, 109, 111, 0.18);
}

.source-card-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.source-card-topline strong {
  overflow-wrap: anywhere;
}

.source-type-badge,
.source-status-badge,
.source-quality-badge,
.source-linked-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(217, 164, 77, 0.22);
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 900;
}

.source-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-status-badge {
  background: rgba(14, 109, 111, 0.12);
  color: var(--teal);
}

.source-quality-badge {
  background: rgba(0, 0, 0, 0.08);
  color: var(--ink);
}

.source-link-card,
.source-review-card {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(217, 164, 77, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.source-link-card blockquote,
.source-card blockquote {
  margin: 4px 0;
  border-left: 4px solid var(--teal);
  padding-left: 10px;
  color: #3c4650;
  font-weight: 700;
}

.mini-action {
  justify-self: start;
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.source-ai-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.source-ai-result {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border: 1px dashed rgba(14, 109, 111, 0.35);
  border-radius: 8px;
  background: rgba(232, 245, 242, 0.55);
  padding: 12px;
  color: var(--ink);
  font-weight: 700;
}

.source-report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.source-report-grid div {
  border: 1px solid rgba(217, 164, 77, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  padding: 10px;
}

.source-report-grid strong,
.source-report-grid span {
  display: block;
}

.research-layout {
  display: grid;
  grid-template-columns: minmax(380px, 1fr) minmax(460px, 1.15fr);
  gap: 16px;
}

.research-list-panel,
.research-side-stack {
  min-width: 0;
}

.research-side-stack {
  display: grid;
  gap: 16px;
}

.research-filter-form,
.research-log-form,
.research-hypothesis-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.research-filter-form .wide-field,
.research-log-form .wide-field,
.research-hypothesis-form .wide-field,
.research-filter-form .form-actions {
  grid-column: 1 / -1;
}

.research-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.research-stat-card {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(217, 164, 77, 0.72);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
}

.research-stat-card strong {
  color: var(--teal);
  font-size: 22px;
  line-height: 1.1;
}

.research-stat-card span,
.research-stat-card small {
  color: var(--ink);
  font-weight: 800;
}

.research-stat-list {
  align-content: start;
}

.research-log-list,
.research-hypothesis-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.research-log-card,
.research-hypothesis-card {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 1px solid rgba(217, 164, 77, 0.75);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.research-log-card:hover,
.research-log-card.active,
.research-hypothesis-card:hover,
.research-hypothesis-card.active {
  border-color: var(--teal);
  background: #e8f5f2;
  box-shadow: inset 0 0 0 1px rgba(14, 109, 111, 0.18);
}

.research-card-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.research-card-topline strong,
.research-hypothesis-card strong {
  overflow-wrap: anywhere;
}

.research-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.research-result-badge,
.research-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(14, 109, 111, 0.12);
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.research-result-badge {
  background: rgba(217, 164, 77, 0.24);
  color: var(--red-dark);
}

.research-status-badge.muted {
  background: rgba(0, 0, 0, 0.08);
  color: var(--ink);
}

.research-card-excerpt {
  display: block;
  color: #4d5962;
  font-weight: 700;
  line-height: 1.35;
}

.research-ai-result {
  display: grid;
  gap: 10px;
  border: 1px dashed rgba(14, 109, 111, 0.35);
  border-radius: 8px;
  background: rgba(232, 245, 242, 0.55);
  padding: 12px;
  color: var(--ink);
  font-weight: 700;
}

.research-ai-section {
  display: grid;
  gap: 4px;
}

.research-ai-section p {
  margin: 0;
  white-space: pre-line;
}

.research-auto-field {
  justify-self: start;
}

.research-person-card {
  border-left: 5px solid var(--teal);
}

.hypothesis-workbench {
  display: grid;
  grid-template-columns: minmax(380px, 0.95fr) minmax(520px, 1.25fr);
  gap: 16px;
}

.hypothesis-list-panel,
.hypothesis-side-stack {
  min-width: 0;
}

.hypothesis-side-stack {
  display: grid;
  gap: 16px;
}

.hypothesis-filter-form,
.hypothesis-form,
.hypothesis-entity-form,
.hypothesis-evidence-form,
.hypothesis-suggest-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hypothesis-filter-form .wide-field,
.hypothesis-form .wide-field,
.hypothesis-entity-form .wide-field,
.hypothesis-evidence-form .wide-field,
.hypothesis-suggest-form .wide-field,
.hypothesis-filter-form .form-actions {
  grid-column: 1 / -1;
}

.hypothesis-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.hypothesis-stat-card {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(217, 164, 77, 0.72);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
}

.hypothesis-stat-card strong {
  color: var(--teal);
  font-size: 22px;
  line-height: 1.1;
}

.hypothesis-stat-card span {
  color: var(--ink);
  font-weight: 900;
}

.hypothesis-list,
.hypothesis-mini-list,
.hypothesis-suggestion-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.hypothesis-card,
.hypothesis-mini-card,
.hypothesis-suggestion-card,
.hypothesis-ai-card {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 1px solid rgba(217, 164, 77, 0.75);
  border-left: 8px solid rgba(14, 109, 111, 0.55);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.hypothesis-card {
  cursor: pointer;
}

.hypothesis-card:hover,
.hypothesis-card.active {
  border-color: var(--teal);
  background: #e8f5f2;
  box-shadow: inset 0 0 0 1px rgba(14, 109, 111, 0.18);
}

.hypothesis-card.status-ny { border-left-color: #7b8794; }
.hypothesis-card.status-under-utredning { border-left-color: #1f75cb; }
.hypothesis-card.status-vantar-pa-kallor,
.hypothesis-card.status-vantar-pa-dna { border-left-color: #d9a44d; }
.hypothesis-card.status-trolig,
.hypothesis-card.status-bekraftad { border-left-color: var(--teal); }
.hypothesis-card.status-avfardad { border-left-color: var(--red-dark); }

.hypothesis-card-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.hypothesis-card-topline strong,
.hypothesis-mini-card strong,
.hypothesis-ai-card strong {
  overflow-wrap: anywhere;
}

.hypothesis-type-badge,
.hypothesis-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(217, 164, 77, 0.24);
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 950;
}

.hypothesis-status-badge {
  background: rgba(14, 109, 111, 0.12);
  color: var(--teal);
}

.hypothesis-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hypothesis-card-excerpt,
.hypothesis-mini-card small,
.hypothesis-suggestion-card p {
  color: #4d5962;
  font-weight: 750;
  line-height: 1.35;
}

.hypothesis-probability-meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.1);
}

.hypothesis-probability-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d9a44d, var(--teal));
}

.hypothesis-mini-card {
  border-left-width: 6px;
}

.hypothesis-mini-card.evidence-supporting { border-left-color: var(--teal); }
.hypothesis-mini-card.evidence-opposing { border-left-color: var(--red-dark); }
.hypothesis-mini-card.evidence-missing { border-left-color: #d9a44d; }
.hypothesis-mini-card.evidence-context { border-left-color: #7b8794; }

.hypothesis-diagram {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 1.2fr) minmax(120px, 1fr);
  gap: 12px;
  align-items: stretch;
  border: 1px dashed rgba(14, 109, 111, 0.35);
  border-radius: 12px;
  background: rgba(232, 245, 242, 0.48);
  padding: 14px;
  color: var(--ink);
  font-weight: 800;
}

.hypothesis-node {
  position: relative;
  display: grid;
  gap: 4px;
  align-content: center;
  border: 1px solid rgba(217, 164, 77, 0.8);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  min-height: 86px;
  padding: 12px;
  text-align: center;
}

.hypothesis-node:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -14px;
  width: 16px;
  height: 3px;
  border-radius: 999px;
  background: var(--teal);
}

.hypothesis-node-main {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 2px rgba(14, 109, 111, 0.14);
}

.hypothesis-node small {
  color: #4d5962;
  font-weight: 800;
}

.hypothesis-ai-result {
  display: grid;
  gap: 10px;
  border: 1px dashed rgba(14, 109, 111, 0.35);
  border-radius: 8px;
  background: rgba(232, 245, 242, 0.55);
  padding: 12px;
  color: var(--ink);
  font-weight: 700;
}

.hypothesis-ai-section {
  display: grid;
  gap: 4px;
}

.hypothesis-ai-section span {
  color: var(--red-dark);
  font-weight: 950;
}

.hypothesis-ai-section p {
  margin: 0;
  white-space: pre-line;
}

.migration-workbench {
  display: grid;
  grid-template-columns: minmax(540px, 1.35fr) minmax(360px, 0.8fr);
  gap: 16px;
}

.migration-main-panel,
.migration-side-stack {
  min-width: 0;
}

.migration-side-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.migration-filter-form,
.migration-manual-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.migration-manual-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.migration-filter-form .wide-field,
.migration-manual-form .wide-field,
.migration-filter-form .form-actions,
.migration-manual-form .form-actions {
  grid-column: 1 / -1;
}

.migration-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.migration-stat-card {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(217, 164, 77, 0.72);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.74);
  padding: 10px;
}

.migration-stat-card strong {
  color: var(--teal);
  font-size: 20px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.migration-stat-card span {
  color: var(--ink);
  font-weight: 900;
}

.migration-map-card {
  margin-top: 16px;
  border: 1px solid rgba(14, 109, 111, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  padding: 14px;
}

.migration-map-svg {
  display: block;
  width: 100%;
  min-height: 320px;
}

.migration-map-bg {
  fill: rgba(232, 245, 242, 0.72);
}

.migration-map-line {
  fill: none;
  stroke: rgba(14, 109, 111, 0.58);
  stroke-width: 3;
  stroke-linecap: round;
}

.migration-map-line.active {
  stroke: var(--red-dark);
  stroke-width: 7;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.25));
}

.migration-map-dot {
  fill: #fff;
  stroke: var(--teal);
  stroke-width: 3;
}

.migration-map-dot.destination {
  fill: var(--orange);
  stroke: var(--red-dark);
}

.migration-map-dot.active {
  fill: var(--red-dark);
  stroke: #fff;
  stroke-width: 4;
}

.migration-map-label,
.migration-map-empty {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.migration-chain-list,
.migration-heatmap-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.migration-chain-card {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(217, 164, 77, 0.75);
  border-left: 8px solid var(--teal);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.84);
  padding: 12px;
}

.migration-chain-card.active {
  background: #e8f5f2;
  box-shadow: inset 0 0 0 1px rgba(14, 109, 111, 0.18);
}

.migration-chain-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.migration-chain-header strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.migration-chain-header span {
  color: var(--teal);
  font-weight: 900;
}

.migration-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.migration-path span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: rgba(14, 109, 111, 0.12);
  color: var(--teal);
  padding: 0 10px;
  font-weight: 900;
}

.migration-path b {
  color: var(--red-dark);
  font-size: 18px;
}

.migration-move-list {
  display: grid;
  gap: 6px;
}

.migration-move-row,
.migration-heatmap-row {
  display: grid;
  width: 100%;
  border: 1px solid rgba(217, 164, 77, 0.6);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
  font-weight: 800;
  cursor: pointer;
}

.migration-move-row:hover,
.migration-move-row.active,
.migration-heatmap-row:hover {
  border-color: var(--teal);
  background: #e8f5f2;
}

.migration-heatmap-row {
  grid-template-columns: minmax(0, 1fr) minmax(80px, 0.8fr) auto;
  align-items: center;
  gap: 8px;
}

.migration-heatmap-row strong {
  overflow-wrap: anywhere;
}

.migration-heatmap-row em {
  justify-self: end;
  color: var(--teal);
  font-style: normal;
  font-weight: 950;
}

.migration-heatmap-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.1);
}

.migration-heatmap-bar::before {
  content: "";
  display: block;
  width: var(--heat, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d9a44d, var(--teal));
}

.migration-ai-result {
  display: grid;
  gap: 10px;
  border: 1px dashed rgba(14, 109, 111, 0.35);
  border-radius: 8px;
  background: rgba(232, 245, 242, 0.55);
  padding: 12px;
  color: var(--ink);
  font-weight: 700;
}

.migration-ai-section {
  display: grid;
  gap: 4px;
}

.migration-ai-section strong {
  color: var(--red-dark);
}

.migration-ai-section p {
  margin: 0;
  white-space: pre-line;
}

.timeline-workbench {
  display: grid;
  grid-template-columns: minmax(520px, 1.45fr) minmax(360px, 0.75fr);
  gap: 16px;
}

.timeline-main-panel,
.timeline-side-stack {
  min-width: 0;
}

.timeline-side-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.timeline-filter-form,
.timeline-historical-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.timeline-historical-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.timeline-filter-form .wide-field,
.timeline-historical-form .wide-field,
.timeline-category-field,
.timeline-filter-form .form-actions {
  grid-column: 1 / -1;
}

.timeline-category-field {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  border: 1px solid rgba(217, 164, 77, 0.65);
  border-radius: 8px;
  padding: 10px 12px;
}

.timeline-category-field legend {
  color: var(--red-dark);
  font-weight: 900;
}

.timeline-category-field label {
  display: inline-flex;
  align-items: center;
  width: auto;
  gap: 6px;
}

.timeline-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.timeline-stat-card {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(217, 164, 77, 0.72);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.74);
  padding: 10px;
}

.timeline-stat-card strong {
  color: var(--teal);
  font-size: 22px;
  line-height: 1.1;
}

.timeline-stat-card span {
  color: var(--ink);
  font-weight: 900;
}

.timeline-gap-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.timeline-gap-list strong,
.timeline-gap-list span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(177, 19, 47, 0.1);
  color: var(--red-dark);
  font-weight: 900;
}

.timeline-gap-list strong {
  background: transparent;
  padding-left: 0;
}

.timeline-band {
  margin-top: 16px;
  border: 1px solid rgba(14, 109, 111, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  padding: 20px 18px;
  overflow-x: auto;
}

.timeline-rail {
  position: relative;
  min-width: 620px;
  height: 58px;
}

.timeline-rail::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 28px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(14, 109, 111, 0.25), rgba(217, 164, 77, 0.65));
}

.timeline-dot {
  position: absolute;
  top: 17px;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: var(--timeline-color, var(--teal));
  transform: translateX(-50%);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

.timeline-dot:focus-visible {
  outline: 3px solid rgba(14, 109, 111, 0.3);
}

.timeline-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.timeline-decade-group {
  display: grid;
  gap: 10px;
}

.timeline-decade-group h4 {
  margin: 8px 0 0;
  color: var(--red-dark);
  font-size: 18px;
}

.timeline-event-card {
  display: grid;
  grid-template-columns: minmax(82px, 0.22fr) minmax(0, 1fr);
  gap: 12px;
  border: 1px solid rgba(217, 164, 77, 0.72);
  border-left: 8px solid var(--timeline-color, var(--teal));
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  padding: 12px;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.08);
}

.timeline-event-card.focus-pulse {
  animation: timelinePulse 0.85s ease-in-out;
}

@keyframes timelinePulse {
  0%, 100% { box-shadow: 0 2px 7px rgba(0, 0, 0, 0.08); }
  50% { box-shadow: 0 0 0 4px rgba(14, 109, 111, 0.22); }
}

.timeline-event-marker {
  color: var(--teal);
  font-size: 17px;
  font-weight: 950;
}

.timeline-event-content {
  display: grid;
  gap: 5px;
}

.timeline-event-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.timeline-event-topline strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.timeline-event-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: color-mix(in srgb, var(--timeline-color, var(--teal)) 18%, #fff);
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 950;
}

.timeline-event-content p,
.timeline-event-content small {
  margin: 0;
  color: #4d5962;
  font-weight: 750;
  line-height: 1.35;
}

.timeline-event-source {
  color: var(--teal) !important;
}

.timeline-ai-result {
  display: grid;
  gap: 10px;
  border: 1px dashed rgba(14, 109, 111, 0.35);
  border-radius: 8px;
  background: rgba(232, 245, 242, 0.55);
  padding: 12px;
  color: var(--ink);
  font-weight: 700;
}

.timeline-ai-section {
  display: grid;
  gap: 4px;
}

.timeline-ai-section p {
  margin: 0;
  white-space: pre-line;
}

.profile-timeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-timeline-band {
  margin-top: 0;
  padding: 14px;
}

.profile-timeline-list {
  margin-top: 0;
}

@media (max-width: 980px) {
  .sources-workbench,
  .source-ai-actions,
  .research-layout,
  .hypothesis-workbench,
  .migration-workbench,
  .timeline-workbench {
    grid-template-columns: 1fr;
  }

  .source-filter-form,
  .source-editor-form,
  .source-link-form,
  .source-import-form,
  .research-filter-form,
  .research-log-form,
  .research-hypothesis-form,
  .hypothesis-filter-form,
  .hypothesis-form,
  .hypothesis-entity-form,
  .hypothesis-evidence-form,
  .hypothesis-suggest-form,
  .migration-filter-form,
  .migration-manual-form,
  .research-stat-grid,
  .hypothesis-stat-grid,
  .migration-stat-grid,
  .timeline-filter-form,
  .timeline-historical-form,
  .timeline-stat-grid {
    grid-template-columns: 1fr;
  }

  .hypothesis-diagram {
    grid-template-columns: 1fr;
  }

  .hypothesis-node:not(:last-child)::after {
    display: none;
  }

  .timeline-event-card {
    grid-template-columns: 1fr;
  }
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(14, 109, 111, 0.12);
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.muted-pill {
  background: rgba(177, 19, 47, 0.1);
  color: var(--red-dark);
}

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

label {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: var(--ink-soft);
  font-size: var(--input-label-font-size);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #dfc892;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input,
select {
  min-height: 40px;
  padding: 0 11px;
}

textarea {
  min-height: 86px;
  padding: 10px 11px;
  resize: vertical;
}

body[data-input-text-size] :where(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="hidden"]), select, textarea) {
  min-height: var(--input-control-min-height);
  font-size: var(--input-text-font-size);
  line-height: var(--input-text-line-height);
}

body[data-input-text-size] :where(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="hidden"]), select) {
  padding-right: var(--input-control-padding-x);
  padding-left: var(--input-control-padding-x);
}

body[data-input-text-size] input[type="file"] {
  padding: var(--input-control-padding-y) var(--input-control-padding-x);
}

body[data-input-text-size] textarea {
  min-height: var(--input-textarea-min-height);
  padding: var(--input-control-padding-y) var(--input-control-padding-x);
}

body[data-input-text-size] :where(form button, .modal-card button, .tree-floating-menu button, .registry-result-menu button) {
  min-height: var(--input-button-min-height);
  font-size: var(--input-text-font-size);
  line-height: var(--input-text-line-height);
}

body[data-input-text-size] :where(label small, .field-hint, .save-status) {
  font-size: max(12px, calc(var(--input-label-font-size) - 1px));
  line-height: var(--input-text-line-height);
}

.geo-path {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.geo-path span {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 250, 240, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.75);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.geo-path span + span::before {
  content: ">";
  margin-right: 8px;
  color: var(--red-dark);
}

.indata-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-width: 0;
  gap: 14px;
}

.indata-layout.city-map-workspace-mode {
  grid-template-columns: minmax(0, 1fr);
}

.indata-menu {
  display: grid;
  align-content: start;
  gap: 10px;
}

.indata-layout.city-map-workspace-mode .indata-menu {
  display: flex;
  flex-wrap: wrap;
}

.indata-layout.city-map-workspace-mode .indata-menu button {
  flex: 1 1 170px;
}

.indata-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
  font-weight: 800;
  text-align: left;
}

.indata-menu button.active {
  background: var(--teal);
  color: #fff;
}

.indata-menu button.is-locked {
  opacity: 0.52;
  cursor: not-allowed;
}

.indata-menu button.is-locked::after {
  content: "Endast admin";
  margin-left: auto;
  border-radius: 999px;
  background: rgba(122, 27, 42, 0.1);
  color: var(--red-dark);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 900;
}

.geo-form.is-readonly {
  opacity: 0.78;
}

.indata-panels {
  min-width: 0;
  position: relative;
  z-index: 2;
}

.indata-panel {
  display: none;
}

.indata-panel.active {
  display: block;
}

.indata-editor-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  position: relative;
}

.indata-editor-layout > .panel-card {
  position: relative;
  z-index: 1;
}

.indata-editor-layout > .panel-card:has(.geo-form),
.indata-editor-layout > div.panel-card {
  z-index: 3;
}

.indata-panel .geo-form input,
.indata-panel .geo-form select,
.indata-panel .geo-form textarea,
.indata-panel .geo-form button {
  position: relative;
  z-index: 4;
  pointer-events: auto;
}

.indata-record-list {
  display: grid;
  grid-template-rows: auto auto minmax(390px, 1fr);
  gap: 12px;
  padding: 14px;
  align-self: stretch;
  min-height: min(620px, calc(100vh - 260px));
}

.indata-record-rows {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 390px;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.indata-record-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fff7e8;
  color: var(--ink);
  padding: 8px 10px;
  text-align: left;
}

.indata-record-row.active {
  border-color: var(--teal);
  background: #e8f6f3;
}

.indata-record-row strong,
.indata-record-row small {
  display: block;
}

.indata-record-row strong {
  color: var(--red-dark);
  font-size: 15px;
}

.indata-record-row small {
  color: var(--ink-soft);
  font-weight: 800;
}

.indata-record-row span:last-child {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.geo-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
  gap: 12px;
}

.existing-file-hint {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  padding: 7px 8px;
  min-height: 56px;
  border: 1px dashed #d8bd7d;
  border-radius: 7px;
  background: #fffaf1;
  color: var(--ink);
}

.existing-file-hint.is-empty {
  background: rgba(255, 250, 241, 0.62);
  color: #705d3a;
}

.existing-file-hint.is-selected {
  border-style: solid;
  border-color: var(--teal);
  background: #e8f6f3;
}

.existing-file-thumb {
  width: 42px;
  height: 42px;
  border: 1px solid #e5cf9d;
  border-radius: 6px;
  background-color: #fff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.existing-file-hint.is-empty .existing-file-thumb {
  background:
    linear-gradient(135deg, transparent 48%, #d8bd7d 50%, transparent 52%),
    linear-gradient(45deg, transparent 48%, #d8bd7d 50%, transparent 52%),
    #fffaf1;
}

.existing-file-text {
  min-width: 0;
}

.existing-file-text strong,
.existing-file-text small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.existing-file-text strong {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.existing-file-text small {
  color: #5f4c2f;
  font-size: 11px;
  font-weight: 700;
}

.wide-field {
  grid-column: 1 / -1;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.save-status {
  margin-right: auto;
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 800;
}

.save-status.success {
  color: var(--teal);
}

.save-status.warning {
  color: #7c4a00;
}

.source-list {
  display: grid;
  gap: 10px;
}

.source-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  background: #fff7e8;
  border: 1px solid #ead8ad;
  border-radius: 6px;
}

.overview-summary-grid {
  margin-bottom: 14px;
}

.overview-area-list,
.contact-list {
  display: grid;
  gap: 10px;
}

.overview-area-list div,
.contact-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 44px;
  padding: 0 12px;
  background: #fff7e8;
  border: 1px solid #ead8ad;
  border-radius: 6px;
}

.overview-area-list span,
.contact-list span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.overview-area-list strong,
.contact-list strong {
  text-align: right;
}

.about-card {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 22px;
  align-items: center;
}

.statistics-filter-card {
  margin-bottom: 14px;
}

.statistics-filter-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px minmax(320px, auto);
  gap: 12px;
  align-items: end;
}

.statistics-filter-form label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.statistics-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.statistics-stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.statistics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.statistics-wide-panel {
  grid-column: 1 / -1;
}

.statistics-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.statistics-bars {
  display: grid;
  gap: 10px;
}

.statistics-bars.compact {
  gap: 8px;
}

.statistics-bar-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(0, 1.4fr) auto;
  gap: 10px;
  align-items: center;
}

.statistics-bar-row span {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 900;
}

.statistics-bar-row strong {
  color: var(--ink);
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

.statistics-bar-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0dfb8;
  box-shadow: inset 0 0 0 1px rgba(125, 88, 22, 0.1);
}

.statistics-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.statistics-bar-fill.male {
  background: #169bd5;
}

.statistics-bar-fill.female {
  background: #f04b59;
}

.statistics-bar-fill.other {
  background: #d9911d;
}

.statistics-bar-fill.unknown {
  background: #8c8c8c;
}

.statistics-bar-fill.children {
  background: #6b9f3a;
}

.statistics-bar-fill.decade {
  background: #7a63b8;
}

.statistics-facts {
  display: grid;
  gap: 8px;
  margin: 0;
}

.statistics-facts div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #ead8ad;
  border-radius: 6px;
  background: #fff7e8;
}

.statistics-facts dt {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.statistics-facts dd {
  margin: 0;
  font-weight: 900;
}

.statistics-list {
  display: grid;
  gap: 8px;
}

.statistics-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #ead8ad;
  border-radius: 6px;
  background: #fff7e8;
}

.statistics-list-row strong {
  min-width: 0;
}

.statistics-list-row span {
  color: var(--teal);
  font-weight: 900;
  white-space: nowrap;
}

.record-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.record-grid button {
  min-height: 86px;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.82);
}

.search-panel {
  grid-template-columns: minmax(220px, 1.3fr) minmax(220px, 1.3fr) minmax(110px, 0.6fr) minmax(110px, 0.6fr) auto;
  align-items: end;
  padding: 16px;
  background: rgba(255, 250, 240, 0.92);
  border-radius: 8px;
}

.metric {
  display: block;
  margin-top: 18px;
  color: var(--teal);
  font-size: 34px;
}

.city-map-style-card {
  display: grid;
  gap: 12px;
}

.city-map-style-form {
  display: grid;
  gap: 12px;
}

.city-map-settings-upload-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.city-map-settings-upload-form .wide-field,
.city-map-settings-upload-form .form-actions {
  grid-column: 1 / -1;
}

.city-map-style-form label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.city-map-style-form input[type="color"] {
  width: 100%;
  height: 42px;
  padding: 4px;
}

.city-map-style-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 76px;
  overflow: hidden;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fff7e8;
  color: var(--city-map-grid-name-color);
  font-weight: 900;
}

.city-map-style-preview::before,
.city-map-style-preview::after {
  content: "";
  position: absolute;
  background: var(--city-map-grid-line-color);
}

.city-map-style-preview::before {
  top: 0;
  bottom: 0;
  left: 50%;
  width: var(--city-map-grid-line-width);
  transform: translateX(-50%);
}

.city-map-style-preview::after {
  right: 0;
  bottom: 50%;
  left: 0;
  height: var(--city-map-grid-line-width);
  transform: translateY(50%);
}

.city-map-style-preview span {
  position: relative;
  z-index: 1;
  padding: 4px 9px;
  border-radius: 999px;
  background: #fffaf0;
}

.city-map-settings {
  margin-top: 16px;
}

.city-map-input-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.city-map-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 12px;
}

.city-map-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.city-map-settings .city-map-form {
  grid-template-columns: 1fr;
}

.city-map-step {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.72);
}

.city-map-step.is-targeted {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 109, 111, 0.15);
}

.city-map-step + .city-map-step {
  margin-top: 2px;
}

.city-map-step-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.city-map-step-header span {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}

.city-map-step-header strong {
  color: var(--ink);
  font-size: 16px;
}

.city-map-step-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

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

.city-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.city-map-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.86);
}

.city-map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px;
  border-bottom: 1px solid #d9c38c;
  background: #fff7e8;
}

.city-map-toolbar > div:first-child {
  display: grid;
  gap: 3px;
}

.city-map-toolbar strong {
  color: var(--ink);
  font-size: 17px;
}

.city-map-toolbar span {
  color: var(--ink-soft);
  font-weight: 800;
}

.city-map-zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.city-map-zoom-controls button {
  min-height: 34px;
  border: 1px solid #ead8ad;
  border-radius: 7px;
  background: #fffdf7;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 900;
}

.city-map-zoom-controls span {
  min-width: 52px;
  color: var(--teal);
  text-align: center;
}

.city-map-canvas {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  padding: 16px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.3)),
    #e5d2a6;
  touch-action: none;
}

.city-map-editor-panel {
  min-height: 76vh;
}

.city-map-editor-canvas {
  min-height: 72vh;
  cursor: grab;
  user-select: none;
}

.city-map-view-canvas {
  cursor: grab;
  user-select: none;
}

.city-map-editor-canvas.is-panning,
.city-map-view-canvas.is-panning {
  cursor: grabbing;
}

.city-map-grid {
  position: relative;
  display: grid;
  min-width: 760px;
  width: max-content;
  border: 2px solid var(--city-map-grid-line-color);
  background-size: cover;
  background-position: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.city-map-property-layer {
  position: absolute;
  z-index: 1;
  overflow: visible;
  pointer-events: none;
}

.city-map-property-layer.is-drawing {
  cursor: crosshair;
  pointer-events: auto;
}

.city-map-property {
  cursor: pointer;
  fill: var(--property-fill, #f6b26b);
  fill-opacity: 0.24;
  stroke: var(--property-stroke, #f16818);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  pointer-events: auto;
  transition: fill-opacity 120ms ease, stroke-width 120ms ease;
}

.city-map-property:hover,
.city-map-property.active {
  fill-opacity: 0.48;
  stroke-width: 4;
}

.city-map-property-draft {
  fill: rgba(14, 109, 111, 0.25);
  stroke: #0e6d6f;
  stroke-width: 3;
  stroke-dasharray: 8 5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.city-map-property-handle {
  fill: #fffdf7;
  stroke: #0e6d6f;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.city-map-property-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.city-map-property-picker {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  font-weight: 900;
}

.city-map-property-picker select {
  width: 100%;
}

.city-map-grid.is-editor,
.city-map-grid.is-viewer {
  min-width: 0;
}

.city-map-grid.is-editor {
  border-width: 0;
  background-position: var(--city-map-label-width, 32px) var(--city-map-label-height, 24px);
  background-repeat: no-repeat;
  background-size: var(--city-map-map-width, 960px) var(--city-map-map-height, 576px);
}

.city-map-grid.is-editor.grid-visible {
  border: 1px solid rgba(143, 16, 32, 0.35);
}

.city-map-grid.is-editor .city-map-corner,
.city-map-grid.is-editor .city-map-col-label,
.city-map-grid.is-editor .city-map-row-label {
  background: rgba(255, 247, 232, 0.82);
}

.city-map-grid.is-viewer {
  border: 0;
  background-color: #efe1bf;
  background-position: 0 0;
  background-size: 100% 100%;
}

.city-map-corner,
.city-map-col-label,
.city-map-row-label {
  display: grid;
  place-items: center;
  min-width: 54px;
  min-height: 42px;
  background: rgba(255, 247, 232, 0.9);
  color: var(--city-map-grid-name-color);
  font-size: 22px;
  font-weight: 900;
}

.city-map-col-label {
  border-bottom: var(--city-map-grid-line-width) solid var(--city-map-grid-line-color);
}

.city-map-row-label {
  border-right: var(--city-map-grid-line-width) solid var(--city-map-grid-line-color);
}

.city-map-grid.is-editor .city-map-corner,
.city-map-grid.is-editor .city-map-col-label,
.city-map-grid.is-editor .city-map-row-label {
  min-width: var(--city-map-label-width, 32px);
  min-height: var(--city-map-label-height, 24px);
  font-size: 10px;
}

.city-map-grid.is-editor .city-map-col-label {
  border-bottom: 1px solid rgba(143, 16, 32, 0.35);
}

.city-map-grid.is-editor .city-map-row-label {
  border-right: 1px solid rgba(143, 16, 32, 0.35);
}

.city-map-cell {
  position: relative;
  width: 154px;
  height: 112px;
  padding: 0;
  border-right: 1px solid rgba(54, 43, 25, 0.32);
  border-bottom: 1px solid rgba(54, 43, 25, 0.32);
  appearance: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.08));
}

.city-map-grid.is-editor .city-map-cell {
  cursor: crosshair;
  border: 0;
  background: transparent;
}

.city-map-grid.is-editor.grid-visible .city-map-cell {
  border-right: 1px solid rgba(143, 16, 32, 0.28);
  border-bottom: 1px solid rgba(143, 16, 32, 0.28);
}

.city-map-grid.is-viewer .city-map-cell {
  border: 0;
  background: transparent;
}

.city-map-grid.is-viewer.grid-visible .city-map-cell {
  border-right: 1px solid rgba(143, 16, 32, 0.3);
  border-bottom: 1px solid rgba(143, 16, 32, 0.3);
}

.city-map-cell::after {
  content: attr(data-grid);
  position: absolute;
  left: 8px;
  top: 6px;
  color: var(--city-map-grid-name-color);
  font-weight: 900;
  opacity: 0.78;
}

.city-map-grid.is-editor .city-map-cell::after {
  left: 3px;
  top: 2px;
  font-size: 9px;
  opacity: 0.42;
}

.city-map-grid.is-viewer.grid-hidden .city-map-cell::after {
  content: none;
}

.city-map-grid.is-viewer.grid-visible .city-map-cell::after {
  left: 3px;
  top: 2px;
  font-size: 9px;
  opacity: 0.42;
}

.city-map-point {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.32);
}

.city-map-point:hover,
.city-map-point.active {
  background: var(--orange);
  color: #0b0b0b;
}

.city-map-point[data-point-code="G1"] { left: 8px; top: 8px; }
.city-map-point[data-point-code="G2"] { left: 50%; top: 8px; transform: translateX(-50%); }
.city-map-point[data-point-code="G3"] { right: 8px; top: 8px; }
.city-map-point[data-point-code="G4"] { left: 8px; top: 50%; transform: translateY(-50%); }
.city-map-point[data-point-code="G5"] { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.city-map-point[data-point-code="G6"] { right: 8px; top: 50%; transform: translateY(-50%); }
.city-map-point[data-point-code="G7"] { left: 8px; bottom: 8px; }
.city-map-point[data-point-code="G8"] { left: 50%; bottom: 8px; transform: translateX(-50%); }
.city-map-point[data-point-code="G9"] { right: 8px; bottom: 8px; }

.city-map-grid.is-editor .city-map-point {
  width: var(--city-map-point-size, 10px);
  height: var(--city-map-point-size, 10px);
  border-width: 1px;
  font-size: 0;
}

.city-map-grid.is-viewer .city-map-point {
  width: 12px;
  height: 12px;
  border-width: 2px;
  font-size: 0;
  opacity: 0.86;
}

.city-map-grid.is-viewer .city-map-point::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.city-map-grid.is-editor .city-map-point[data-point-code="G1"],
.city-map-grid.is-viewer .city-map-point[data-point-code="G1"] { left: 1px; top: 1px; }
.city-map-grid.is-editor .city-map-point[data-point-code="G2"],
.city-map-grid.is-viewer .city-map-point[data-point-code="G2"] { left: 50%; top: 1px; transform: translateX(-50%); }
.city-map-grid.is-editor .city-map-point[data-point-code="G3"],
.city-map-grid.is-viewer .city-map-point[data-point-code="G3"] { right: 1px; top: 1px; }
.city-map-grid.is-editor .city-map-point[data-point-code="G4"],
.city-map-grid.is-viewer .city-map-point[data-point-code="G4"] { left: 1px; top: 50%; transform: translateY(-50%); }
.city-map-grid.is-editor .city-map-point[data-point-code="G5"],
.city-map-grid.is-viewer .city-map-point[data-point-code="G5"] { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.city-map-grid.is-editor .city-map-point[data-point-code="G6"],
.city-map-grid.is-viewer .city-map-point[data-point-code="G6"] { right: 1px; top: 50%; transform: translateY(-50%); }
.city-map-grid.is-editor .city-map-point[data-point-code="G7"],
.city-map-grid.is-viewer .city-map-point[data-point-code="G7"] { left: 1px; bottom: 1px; }
.city-map-grid.is-editor .city-map-point[data-point-code="G8"],
.city-map-grid.is-viewer .city-map-point[data-point-code="G8"] { left: 50%; bottom: 1px; transform: translateX(-50%); }
.city-map-grid.is-editor .city-map-point[data-point-code="G9"],
.city-map-grid.is-viewer .city-map-point[data-point-code="G9"] { right: 1px; bottom: 1px; }

.city-map-hover-tooltip {
  position: fixed;
  z-index: 500;
  max-width: min(280px, calc(100vw - 28px));
  padding: 10px 12px;
  border: 1px solid rgba(7, 19, 30, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.98);
  color: var(--ink);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

.city-map-hover-tooltip[hidden] {
  display: none;
}

.city-map-hover-tooltip strong {
  display: block;
  color: var(--teal);
  font-size: 15px;
}

.city-map-hover-tooltip span {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
}

.city-map-info {
  position: sticky;
  top: 12px;
}

.city-map-info p {
  color: var(--ink-soft);
  font-weight: 800;
}

.city-map-info dl {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid #ead8ad;
  border-radius: 7px;
}

.city-map-info dt,
.city-map-info dd {
  min-width: 0;
  margin: 0;
  padding: 9px 10px;
  background: #fff7e8;
}

.city-map-info dd {
  background: #fffdf7;
  font-weight: 800;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.tree-preview {
  display: grid;
  gap: 22px;
  min-height: 380px;
  align-content: center;
  padding: 22px;
  background: rgba(255, 250, 240, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 8px;
}

.tree-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.tree-row div {
  display: grid;
  place-items: center;
  min-width: 112px;
  min-height: 48px;
  padding: 8px 12px;
  background: #fff;
  border: 2px solid #d4bb7c;
  border-radius: 8px;
  font-weight: 800;
}

.tree-row.focus div {
  min-width: 150px;
  border-color: var(--teal);
  background: #e8f5f2;
}

[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.tree-actions,
.tree-map-actions,
.profile-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tree-import-status {
  margin-right: 0;
  color: var(--ink-soft);
}

body.is-gedcom-importing,
body.is-gedcom-importing * {
  cursor: progress !important;
}

.file-action.is-disabled {
  opacity: 0.66;
  pointer-events: none;
}

.gedcom-import-progress {
  display: grid;
  gap: 9px;
  margin: -2px 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(14, 109, 111, 0.42);
  border-radius: 8px;
  background: rgba(232, 245, 242, 0.92);
  color: var(--ink);
}

.gedcom-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 900;
}

.gedcom-progress-header span {
  color: var(--teal);
  white-space: nowrap;
}

.gedcom-progress-bar {
  position: relative;
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(14, 109, 111, 0.14);
}

.gedcom-progress-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #2fa7a9);
  animation: gedcom-progress-slide 1.15s ease-in-out infinite;
}

.gedcom-import-progress p {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 800;
}

@keyframes gedcom-progress-slide {
  0% {
    transform: translateX(-105%);
  }

  50% {
    transform: translateX(74%);
  }

  100% {
    transform: translateX(240%);
  }
}

.tree-stage-empty {
  min-height: 430px;
}

.tree-map-empty {
  min-height: 430px;
}

.tree-empty-canvas {
  display: grid;
  min-height: 330px;
  place-items: center;
  padding: 28px;
}

.tree-empty-state {
  max-width: 680px;
  border: 1px dashed rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  padding: 22px 24px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-align: center;
}

.tree-empty-state h3,
.tree-empty-state p {
  margin: 0;
}

.tree-empty-state h3 {
  font-size: 24px;
}

.tree-empty-state p {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.84);
  font-weight: 800;
  line-height: 1.45;
}

.tree-import-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}

.tree-import-metrics div {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.tree-import-metrics dt,
.tree-import-metrics dd {
  margin: 0;
}

.tree-import-metrics dt {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.tree-import-metrics dd {
  margin-top: 4px;
  color: #fff;
  font-size: 24px;
  font-weight: 950;
}

.gedcom-import-summary {
  display: grid;
  gap: 8px;
  margin: -4px 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(14, 109, 111, 0.34);
  border-radius: 8px;
  background: rgba(255, 247, 232, 0.72);
}

.gedcom-import-summary h3,
.gedcom-import-summary p {
  margin: 0;
}

.gedcom-import-summary h3 {
  color: var(--ink);
  font-size: 17px;
}

.gedcom-import-summary p {
  color: var(--ink-soft);
  font-weight: 800;
}

.gedcom-step-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gedcom-step-list li {
  min-width: 0;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  padding: 9px 10px;
  background: #fffdf7;
}

.gedcom-step-list strong,
.gedcom-step-list span {
  display: block;
}

.gedcom-step-list strong {
  color: var(--maroon);
  font-size: 12px;
  text-transform: uppercase;
}

.gedcom-step-list span {
  margin-top: 3px;
  color: #1d2832;
  font-weight: 800;
}

.file-action {
  position: relative;
  cursor: pointer;
}

.file-action input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.tree-stage {
  position: relative;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  min-height: clamp(610px, calc(100vh - 300px), 820px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  background: #4c4c4c;
  color: #fff;
}

.tree-toolrail {
  position: relative;
  display: grid;
  align-content: start;
  gap: 10px;
  width: 60px;
  padding: 18px 10px;
  background: #5a5a5a;
  border-right: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset -1px 0 rgba(0, 0, 0, 0.18);
  z-index: 120;
  overflow: visible;
}

.tree-toolrail button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.tree-toolrail button:hover,
.tree-toolrail button.active {
  background: rgba(255, 255, 255, 0.18);
}

.tree-toolrail button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.88);
  outline-offset: 2px;
}

.tree-toolrail button[data-tooltip]::before {
  content: "";
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  right: auto;
  bottom: auto;
  z-index: 121;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 10px solid #fff;
  opacity: 0;
  transform: translateY(-50%);
  pointer-events: none;
}

.tree-toolrail button[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 15px);
  top: 50%;
  right: auto;
  bottom: auto;
  z-index: 122;
  min-width: max-content;
  max-width: 310px;
  padding: 8px 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 4px;
  background: #fff;
  color: #2a2a2a;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  transform: translateY(-50%);
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  white-space: nowrap;
}

.tree-toolrail button[data-tooltip]:hover::before,
.tree-toolrail button[data-tooltip]:focus-visible::before,
.tree-toolrail button[data-tooltip]:hover::after,
.tree-toolrail button[data-tooltip]:focus-visible::after {
  opacity: 1;
}

.tree-tool-divider {
  display: block;
  width: 34px;
  height: 1px;
  margin: 8px auto 10px;
  background: rgba(255, 255, 255, 0.82);
}

.tree-map {
  position: relative;
  min-width: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.tree-map.is-panning {
  cursor: grabbing;
  user-select: none;
}

.tree-map.is-panning * {
  cursor: grabbing !important;
}

.tree-map-header,
.tree-search-panel,
.tree-floating-menu,
.tree-context-menu,
.tree-person-popover,
.tree-minimap {
  cursor: default;
}

.tree-minimap {
  position: absolute;
  left: 78px;
  bottom: 18px;
  z-index: 12;
  width: 172px;
  height: 116px;
  border-radius: 7px;
  padding: 8px;
  background: rgba(92, 92, 92, 0.92);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
}

.tree-minimap-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  background: rgba(55, 55, 55, 0.94);
  cursor: grab;
}

.tree-minimap-stage:active {
  cursor: grabbing;
}

.tree-minimap-content {
  position: absolute;
}

.tree-minimap-line,
.tree-minimap-node {
  position: absolute;
  display: block;
  box-sizing: border-box;
}

.tree-minimap-line {
  background: rgba(216, 216, 216, 0.65);
}

.tree-minimap-node {
  border-radius: 1px;
  background: #f5f1ea;
}

.tree-minimap-node.male {
  background: #c9ddeb;
}

.tree-minimap-node.female {
  background: #efc2b1;
}

.tree-minimap-node.focus {
  outline: 1px solid #98d85f;
  background: #e9f5ef;
}

.tree-minimap-window {
  position: absolute;
  z-index: 3;
  min-width: 18px;
  min-height: 18px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.94);
  border-radius: 2px;
  appearance: none;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  font-size: 0;
  line-height: 0;
  cursor: grab;
}

.tree-minimap-window:active {
  cursor: grabbing;
}

.tree-map-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 940px;
  min-height: 68px;
  padding: 12px 18px;
  background: rgba(83, 83, 83, 0.96);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12);
}

.tree-map-header > div:first-child {
  display: grid;
  gap: 4px;
}

.tree-current-block {
  position: relative;
  min-width: min(360px, 58vw);
}

.tree-selector-button {
  position: relative;
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 7px 34px 7px 10px;
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.tree-selector-button::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 19px;
  border: 7px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.82);
}

.tree-selector-button:hover,
.tree-selector-button[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.09);
}

.tree-selector-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 24;
  display: grid;
  width: min(330px, calc(100vw - 36px));
  overflow: hidden;
  border-radius: 7px;
  background: #fff;
  color: #202020;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
}

.tree-selector-menu > strong,
.tree-selector-tools span {
  padding: 12px 14px;
  color: #313131;
  font-size: 13px;
  font-weight: 900;
}

#tree-selector-list {
  display: grid;
  max-height: 370px;
  overflow: auto;
}

.tree-selector-item,
.tree-selector-tools button {
  position: relative;
  display: grid;
  gap: 2px;
  min-height: 46px;
  border: 0;
  border-top: 1px solid #ececec;
  padding: 8px 14px;
  background: #fff;
  color: #222;
  font-weight: 800;
  text-align: left;
}

.tree-selector-menu .tree-selector-item span,
.tree-selector-menu .tree-selector-tools span,
.tree-selector-menu .tree-selector-tools button {
  color: #172027;
}

.tree-selector-item small {
  color: #64707a;
  font-size: 12px;
  font-weight: 700;
}

.tree-selector-item:hover,
.tree-selector-tools button:hover {
  background: #f2f7f6;
}

.tree-selector-item.active {
  background: #e6f4f2;
  color: var(--teal-dark);
}

.tree-selector-item.active::after {
  content: "✓";
  position: absolute;
  right: 14px;
  color: var(--teal);
}

.tree-selector-item.active::after {
  content: "\2713";
}

.tree-selector-tools {
  display: grid;
  border-top: 1px solid #dddddd;
  background: #f9f9f9;
}

.tree-map-header span {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

.tree-map-actions button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 800;
}

.tree-map-actions strong {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #b96a21;
}

.tree-search-panel {
  position: sticky;
  top: 68px;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(260px, 420px) auto;
  gap: 12px;
  align-items: end;
  min-width: 940px;
  padding: 12px 18px;
  background: rgba(60, 60, 60, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.tree-search-panel label {
  display: grid;
  gap: 5px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 13px;
  font-weight: 800;
}

.tree-search-panel input {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  font-weight: 800;
}

.tree-search-panel span {
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 800;
}

.tree-search-results {
  grid-column: 1 / -1;
  display: grid;
  align-content: start;
  gap: 6px;
  max-width: 760px;
  max-height: 250px;
  overflow: auto;
  padding-top: 2px;
}

.tree-search-results:empty {
  display: none;
}

.tree-search-result {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.tree-search-result:hover,
.tree-search-result:focus-visible {
  border-color: var(--teal);
  background: #e7f6f4;
  outline: none;
}

.tree-search-result strong {
  color: var(--wine);
  font-size: 15px;
}

.tree-search-result small,
.tree-search-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tree-search-empty {
  margin: 0;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 7px;
  padding: 10px;
  color: rgba(255, 255, 255, 0.78);
}

.pedigree-map {
  position: relative;
  min-width: 1040px;
  min-height: 540px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  background: #4c4c4c;
}

.pedigree-map.is-panning,
.tree-map.is-panning .pedigree-map {
  cursor: grabbing;
}

.tree-line {
  position: absolute;
  z-index: 0;
  background: rgba(205, 205, 205, 0.55);
}

.line-parents {
  left: 272px;
  top: 190px;
  width: 330px;
  height: 3px;
}

.line-spouse {
  left: 582px;
  top: 258px;
  width: 145px;
  height: 3px;
}

.line-children {
  left: 522px;
  top: 360px;
  width: 360px;
  height: 3px;
}

.person-node {
  position: absolute;
  z-index: 1;
  display: grid;
  grid-template-rows: 82px auto auto auto;
  width: 108px;
  min-height: 156px;
  overflow: hidden;
  border: 2px solid #e6e6e6;
  border-radius: 5px;
  background: #fff;
  color: #111;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32);
}

.person-node *,
.node-avatar {
  cursor: pointer;
}

.person-node strong,
.person-node span,
.person-node small {
  display: block;
  padding: 0 7px;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
}

.person-node strong {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.08;
}

.person-node span,
.person-node small {
  font-size: 11px;
  line-height: 1.12;
}

.person-node .node-life {
  display: grid;
  align-self: center;
  gap: 1px;
  min-height: 24px;
  padding: 1px 0 0;
}

.person-node .node-life small {
  padding: 0 6px;
  line-height: 1.08;
  white-space: nowrap;
}

.node-avatar {
  display: grid;
  place-items: center;
  background-color: #f2d8ca;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 76px 52px;
  color: #8a3c22;
  font-weight: 900;
}

.node-avatar.male {
  background-color: #dff2fb;
  background-image: url("../img/person-male.png");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: auto 82px;
}

.node-avatar.female {
  background-color: #ffe3df;
  background-image: url("../img/person-female.png");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: auto 82px;
}

.node-avatar.photo {
  background-color: #dfe9ef;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  color: #fff;
  font-size: 24px;
}

.tree-ancestor-switch {
  position: absolute;
  left: -13px;
  top: -13px;
  z-index: 8;
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  background:
    radial-gradient(circle at 10px 10px, #9ec6d9 0 4px, transparent 4.5px),
    radial-gradient(circle at 19px 10px, #d28572 0 4px, transparent 4.5px),
    linear-gradient(#ffffff, #ffffff) 8px 19px / 14px 2px no-repeat,
    linear-gradient(90deg, #9ec6d9 0 50%, #d28572 50% 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.42);
  cursor: pointer;
}

.tree-ancestor-switch:hover {
  border-color: #a6d977;
  box-shadow: 0 0 0 3px rgba(129, 185, 86, 0.45), 0 2px 8px rgba(0, 0, 0, 0.42);
}

.focus-node {
  left: 470px;
  top: 190px;
  width: 118px;
  border-color: #d7eadf;
  outline: 3px solid rgba(124, 174, 69, 0.8);
}

.a1 {
  left: 230px;
  top: 80px;
}

.a2 {
  left: 360px;
  top: 80px;
}

.s1 {
  left: 725px;
  top: 190px;
}

.c1 {
  left: 468px;
  top: 370px;
}

.c2 {
  left: 610px;
  top: 370px;
}

.c3 {
  left: 752px;
  top: 370px;
}

.node-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 7px;
  align-self: end;
}

.node-actions button,
.tree-add {
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.node-actions button {
  min-height: 22px;
  padding: 0 5px;
  line-height: 1;
}

.tree-add {
  position: absolute;
  min-height: 34px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.16);
}

.add-parent {
  left: 615px;
  top: 118px;
}

.add-child {
  left: 900px;
  top: 410px;
}

.ancestry-tree {
  min-width: 1220px;
  min-height: 960px;
  will-change: transform;
  background: #4c4c4c;
}

.ancestry-tree .is-hidden {
  display: none;
}

.ancestry-tree .is-muted-branch {
  opacity: 0.34;
}

.ancestry-tree .is-search-match {
  border-color: #f7c948;
  outline: 4px solid rgba(247, 201, 72, 0.72);
}

.ancestry-tree .is-search-focused {
  border-color: #15a6b8;
  outline: 5px solid rgba(21, 166, 184, 0.82);
  z-index: 8;
}

.ancestry-tree-line {
  position: absolute;
  z-index: 1;
  background: rgba(198, 198, 198, 0.62);
  border-radius: 999px;
}

.father-to-spine {
  left: 452px;
  top: 408px;
  width: 3px;
  height: 26px;
}

.mother-to-spine {
  left: 772px;
  top: 408px;
  width: 3px;
  height: 26px;
}

.parent-spine {
  left: 452px;
  top: 432px;
  width: 323px;
  height: 3px;
}

.spine-to-focus {
  left: 610px;
  top: 432px;
  width: 3px;
  height: 48px;
}

.focus-to-spouse {
  left: 672px;
  top: 566px;
  width: 133px;
  height: 3px;
}

.focus-to-children {
  left: 610px;
  top: 654px;
  width: 3px;
  height: 62px;
}

.children-spine {
  left: 445px;
  top: 715px;
  width: 330px;
  height: 3px;
}

.child-one-link,
.child-two-link,
.child-three-link {
  width: 3px;
  height: 40px;
  top: 715px;
}

.child-one-link {
  left: 445px;
}

.child-two-link {
  left: 610px;
}

.child-three-link {
  left: 775px;
}

.father-grandparent-a {
  left: 368px;
  top: 182px;
  width: 3px;
  height: 28px;
}

.father-grandparent-b {
  left: 528px;
  top: 182px;
  width: 3px;
  height: 28px;
}

.father-grandparent-spine {
  left: 368px;
  top: 210px;
  width: 160px;
  height: 3px;
}

.father-grandparent-to-child {
  left: 452px;
  top: 210px;
  width: 3px;
  height: 40px;
}

.mother-grandparent-a {
  left: 708px;
  top: 182px;
  width: 3px;
  height: 28px;
}

.mother-grandparent-b {
  left: 868px;
  top: 182px;
  width: 3px;
  height: 28px;
}

.mother-grandparent-spine {
  left: 708px;
  top: 210px;
  width: 160px;
  height: 3px;
}

.mother-grandparent-to-child {
  left: 772px;
  top: 210px;
  width: 3px;
  height: 40px;
}

.tree-relation-caption {
  position: absolute;
  z-index: 2;
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  font-weight: 800;
}

.parents-caption {
  left: 626px;
  top: 442px;
}

.children-caption {
  left: 625px;
  top: 680px;
}

.ancestry-tree .person-node {
  z-index: 3;
  grid-template-rows: 84px auto auto auto auto;
  width: 124px;
  min-height: 178px;
  cursor: pointer;
  overflow: visible;
  border: 3px solid #f2f2f2;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.36);
}

.ancestry-tree .person-node.is-proband {
  border-color: #9f9f9f;
  background: #3f3f3f;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22), 0 7px 16px rgba(0, 0, 0, 0.46);
}

.ancestry-tree .person-node.is-proband strong,
.ancestry-tree .person-node.is-proband span,
.ancestry-tree .person-node.is-proband small {
  color: #fff;
}

.ancestry-tree .person-node.is-proband .node-avatar {
  filter: brightness(0.84) saturate(0.92);
}

.ancestry-tree .person-node.is-proband .node-actions button {
  background: #007f82;
  color: #fff;
}

.ancestry-tree .mini-card {
  grid-template-rows: 72px auto auto auto auto;
  box-sizing: border-box;
  height: 184px;
  width: 116px;
  min-height: 164px;
}

.ancestry-tree .mini-card strong {
  display: -webkit-box;
  min-height: 30px;
  max-height: 30px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ancestry-tree .person-node strong {
  margin-top: 8px;
  color: #060606;
  font-size: 14px;
}

.ancestry-tree .person-node span {
  color: #111;
  font-size: 12px;
}

.ancestry-tree .person-node small {
  color: #111;
  font-size: 11px;
}

.ancestry-tree .person-node .node-life {
  display: grid;
  align-content: center;
  gap: 1px;
}

.ancestry-tree .mini-card .node-life small {
  font-size: 10.5px;
}

.ancestry-tree .focus-node {
  left: 548px;
  top: 480px;
  width: 120px;
  min-height: 184px;
  border-color: #e9fff0;
  outline: 3px solid #81b956;
}

.father-card {
  left: 390px;
  top: 250px;
}

.mother-card {
  left: 710px;
  top: 250px;
}

.father-grandfather {
  left: 310px;
  top: 40px;
}

.father-grandmother {
  left: 470px;
  top: 40px;
}

.mother-grandfather {
  left: 650px;
  top: 40px;
}

.mother-grandmother {
  left: 810px;
  top: 40px;
}

.spouse-card {
  left: 805px;
  top: 480px;
}

.child-one {
  left: 383px;
  top: 755px;
}

.child-two {
  left: 548px;
  top: 755px;
}

.child-three {
  left: 713px;
  top: 755px;
}

.tree-expand {
  position: absolute;
  z-index: 5;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(250, 252, 252, 0.96), rgba(213, 219, 219, 0.94));
  color: #5f686c;
  cursor: pointer;
  box-shadow:
    0 2px 7px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.tree-expand::before {
  content: "";
  width: 7px;
  height: 7px;
  border-top: 3px solid currentColor;
  border-left: 3px solid currentColor;
  border-radius: 1px;
  transform: translateY(2px) rotate(45deg);
}

.tree-expand.backward {
  left: 50%;
  top: -15px;
  transform: translateX(-50%);
}

.tree-expand.backward:hover,
.tree-expand.backward:focus-visible {
  transform: translateX(-50%) translateY(-1px);
}

.tree-expand[aria-expanded="true"] {
  background: linear-gradient(180deg, #8dcf48, #57a62f);
  color: #fff;
  border-color: rgba(232, 255, 220, 0.98);
  box-shadow:
    0 2px 8px rgba(25, 74, 29, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.tree-expand.muted,
.tree-expand:disabled {
  opacity: 0.62;
  cursor: default;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 10;
  transform: translateX(-50%);
  min-width: max-content;
  border-radius: 6px;
  padding: 9px 11px;
  background: #fff;
  color: #202020;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

[data-tooltip]::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  z-index: 10;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
}

.tree-pill {
  position: absolute;
  z-index: 4;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 15px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.tree-pill:hover {
  background: rgba(255, 255, 255, 0.28);
}

.add-parent-pill {
  display: none;
  left: 900px;
  top: 210px;
}

.add-child-pill {
  display: none;
  left: 920px;
  top: 690px;
}

.relationship-switcher {
  position: absolute;
  left: -10px;
  top: -10px;
  z-index: 6;
  display: grid;
  gap: 2px;
  place-content: center;
  width: 30px;
  height: 30px;
  border: 2px solid #e6e6e6;
  border-radius: 999px;
  background: rgba(85, 85, 85, 0.92);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
}

.relationship-switcher span {
  width: 15px;
  height: 2px;
  padding: 0;
  background: #fff;
  border-radius: 999px;
}

.tree-parent-placeholder {
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  place-items: center;
  border: 3px solid #7abd38;
  background: #fff;
  color: #111;
  cursor: pointer;
  box-shadow: 0 5px 13px rgba(0, 0, 0, 0.34);
}

.tree-parent-placeholder .placeholder-question {
  align-self: end;
  padding: 0 0 2px;
  color: #111;
  font-size: 96px;
  font-weight: 900;
  line-height: 0.78;
}

.ancestry-tree .person-node.tree-parent-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 184px;
  min-height: 184px;
  padding: 12px 8px;
}

.ancestry-tree .person-node.tree-parent-placeholder .placeholder-question {
  display: block;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  font-size: 72px !important;
  font-weight: 900;
  line-height: 0.82 !important;
}

.tree-parent-placeholder strong {
  align-self: center;
  min-height: 0;
  max-height: none;
  margin: 0;
  color: #333;
  font-size: 13px;
  line-height: 1.15;
  -webkit-line-clamp: unset;
}

.tree-parent-placeholder .placeholder-plus {
  display: grid;
  place-items: center;
  align-self: start;
  width: auto;
  height: auto;
  margin-top: 3px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #111;
  font-size: 34px;
  font-weight: 900;
  line-height: 0.9;
}

.ancestry-tree .person-node.tree-parent-placeholder .placeholder-plus {
  font-size: 40px !important;
  line-height: 0.9 !important;
}

.tree-parent-placeholder:hover,
.tree-parent-placeholder:focus-visible {
  border-color: #98d84f;
  outline: none;
  box-shadow: 0 0 0 3px rgba(122, 189, 56, 0.26), 0 7px 16px rgba(0, 0, 0, 0.38);
}

.expanded-parent-line {
  background: rgba(205, 205, 205, 0.7);
}

.expanded-parent-anchor {
  position: absolute;
  z-index: 0;
  pointer-events: none;
}

.person-node.is-newly-expanded-parent,
.parent-placeholder.is-newly-expanded-parent {
  outline: 3px solid rgba(124, 184, 69, 0.75);
  outline-offset: 3px;
}

.tree-floating-menu,
.tree-context-menu,
.tree-person-popover {
  position: absolute;
  z-index: 20;
  color: #1c1c1c;
  background: #fff;
  border-radius: 7px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
}

.tree-floating-menu[hidden],
.tree-context-menu[hidden],
.tree-person-popover[hidden],
.tree-search-panel[hidden],
.tree-minimap[hidden] {
  display: none !important;
}

.tree-floating-menu {
  display: grid;
  min-width: 250px;
  overflow: hidden;
}

.tree-floating-menu strong {
  padding: 12px 14px;
  border-bottom: 1px solid #eee;
}

.tree-floating-menu button,
.tree-context-menu button {
  min-height: 42px;
  border: 0;
  border-bottom: 1px solid #eee;
  padding: 0 14px;
  background: #fff;
  color: #222;
  font-weight: 800;
  text-align: left;
}

.tree-floating-menu button:hover,
.tree-context-menu button:hover {
  background: #f1f7f6;
}

.tree-floating-menu button:disabled,
.tree-context-menu button:disabled {
  color: #777;
  cursor: default;
  opacity: 0.72;
}

.tree-floating-menu button:disabled:hover,
.tree-context-menu button:disabled:hover {
  background: #fff;
}

.tree-floating-menu button.active::after {
  content: "✓";
  float: right;
  color: #4a9b30;
}

.tree-view-menu {
  left: 74px;
  top: 74px;
}

.tree-more-menu {
  left: 74px;
  top: 172px;
}

.tree-floating-menu button.active::after {
  content: "\2713";
}

.partner-menu {
  width: min(330px, calc(100vw - 48px));
  overflow: visible;
}

.partner-menu::before {
  content: "";
  position: absolute;
  right: -10px;
  top: 42px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 10px solid #fff;
  filter: drop-shadow(3px 2px 2px rgba(0, 0, 0, 0.12));
}

.partner-menu.opens-right::before {
  right: auto;
  left: -10px;
  border-right: 10px solid #fff;
  border-left: 0;
  filter: drop-shadow(-3px 2px 2px rgba(0, 0, 0, 0.12));
}

.partner-menu label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid #eee;
  font-weight: 800;
}

.partner-menu small {
  display: block;
  margin-top: 2px;
  color: #5f6b72;
  font-weight: 700;
}

.partner-menu input {
  width: 44px;
  height: 24px;
  accent-color: var(--teal);
}

.partner-empty {
  margin: 0;
  padding: 12px 14px;
  color: #4f5960;
  font-weight: 750;
}

.partner-choice {
  display: grid !important;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 62px !important;
  padding: 9px 12px !important;
  border-bottom: 1px solid #eee !important;
  text-align: left;
}

.partner-choice-avatar {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  background-color: #dff2fb;
  background-image: url("../img/person-male.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: auto 92%;
}

.partner-choice-avatar.female {
  background-color: #ffe3df;
  background-image: url("../img/person-female.png");
}

.partner-choice-avatar.photo {
  background-size: cover;
}

.partner-choice-text {
  display: grid;
  min-width: 0;
}

.partner-choice-text strong {
  overflow: hidden;
  padding: 0;
  border-bottom: 0;
  color: var(--teal);
  font-size: 16px;
  line-height: 1.05;
  text-overflow: ellipsis;
}

.partner-choice-text small {
  color: #333;
  font-size: 12px;
  font-weight: 750;
}

.partner-choice-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  min-height: 30px;
  border-radius: 999px;
  background: #737373;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.partner-choice.is-visible .partner-choice-toggle {
  background: var(--teal);
}

.tree-person-popover {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  width: min(470px, calc(100vw - 40px));
  padding: 18px;
}

.mini-close {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: #eee;
  font-size: 18px;
  font-weight: 900;
}

.popover-avatar {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 0;
  border-radius: 5px;
  background: linear-gradient(135deg, #dfe9ef, #6b8c82);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  color: #fff;
  cursor: pointer;
  font-size: 24px;
  font-weight: 900;
  padding: 0;
}

.popover-avatar.male {
  background-color: #dff2fb;
  background-image: url("../img/person-male.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: auto 92%;
}

.popover-avatar.female {
  background-color: #ffe3df;
  background-image: url("../img/person-female.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: auto 92%;
}

.popover-avatar.photo {
  background-color: #dfe9ef;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.popover-body h3 {
  margin: 0 28px 8px 0;
  color: var(--teal);
  font-size: 24px;
}

.popover-body p {
  margin: 3px 0;
  color: #202020;
  font-weight: 700;
}

.popover-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.popover-actions button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: #ececec;
  color: #111;
  font-weight: 900;
}

.popover-actions button:first-child {
  background: var(--teal);
  color: #fff;
}

.tree-context-menu {
  display: grid;
  min-width: 210px;
  overflow: hidden;
}

.ancestry-tree.is-horizontal {
  min-width: 1280px;
  min-height: 700px;
}

.ancestry-tree.is-horizontal .focus-node {
  left: 410px;
  top: 250px;
}

.ancestry-tree.is-horizontal .father-card {
  left: 170px;
  top: 130px;
}

.ancestry-tree.is-horizontal .mother-card {
  left: 170px;
  top: 360px;
}

.ancestry-tree.is-horizontal .father-grandfather {
  left: 20px;
  top: 55px;
}

.ancestry-tree.is-horizontal .father-grandmother {
  left: 20px;
  top: 205px;
}

.ancestry-tree.is-horizontal .mother-grandfather {
  left: 20px;
  top: 350px;
}

.ancestry-tree.is-horizontal .mother-grandmother {
  left: 20px;
  top: 500px;
}

.ancestry-tree.is-horizontal .spouse-card {
  left: 410px;
  top: 470px;
}

.ancestry-tree.is-horizontal .child-one {
  left: 690px;
  top: 112px;
}

.ancestry-tree.is-horizontal .child-two {
  left: 690px;
  top: 292px;
}

.ancestry-tree.is-horizontal .child-three {
  left: 690px;
  top: 472px;
}

.ancestry-tree.is-horizontal .father-to-spine {
  left: 294px;
  top: 212px;
  width: 78px;
  height: 3px;
}

.ancestry-tree.is-horizontal .mother-to-spine {
  left: 294px;
  top: 442px;
  width: 78px;
  height: 3px;
}

.ancestry-tree.is-horizontal .parent-spine {
  left: 370px;
  top: 212px;
  width: 3px;
  height: 233px;
}

.ancestry-tree.is-horizontal .spine-to-focus {
  left: 370px;
  top: 334px;
  width: 40px;
  height: 3px;
}

.ancestry-tree.is-horizontal .focus-to-spouse {
  left: 470px;
  top: 424px;
  width: 3px;
  height: 48px;
}

.ancestry-tree.is-horizontal .focus-to-children {
  left: 530px;
  top: 336px;
  width: 160px;
  height: 3px;
}

.ancestry-tree.is-horizontal .children-spine {
  left: 690px;
  top: 193px;
  width: 3px;
  height: 360px;
}

.ancestry-tree.is-horizontal .child-one-link,
.ancestry-tree.is-horizontal .child-two-link,
.ancestry-tree.is-horizontal .child-three-link {
  left: 690px;
  width: 34px;
  height: 3px;
}

.ancestry-tree.is-horizontal .child-one-link {
  top: 193px;
}

.ancestry-tree.is-horizontal .child-two-link {
  top: 373px;
}

.ancestry-tree.is-horizontal .child-three-link {
  top: 553px;
}

.ancestry-tree.is-horizontal .parents-caption {
  left: 377px;
  top: 222px;
}

.ancestry-tree.is-horizontal .children-caption {
  left: 566px;
  top: 314px;
}

.ancestry-tree.is-horizontal .father-grandparent-a,
.ancestry-tree.is-horizontal .father-grandparent-b,
.ancestry-tree.is-horizontal .mother-grandparent-a,
.ancestry-tree.is-horizontal .mother-grandparent-b {
  left: 136px;
  width: 34px;
  height: 3px;
}

.ancestry-tree.is-horizontal .father-grandparent-a {
  top: 126px;
}

.ancestry-tree.is-horizontal .father-grandparent-b {
  top: 276px;
}

.ancestry-tree.is-horizontal .mother-grandparent-a {
  top: 421px;
}

.ancestry-tree.is-horizontal .mother-grandparent-b {
  top: 571px;
}

.ancestry-tree.is-horizontal .father-grandparent-spine {
  left: 136px;
  top: 126px;
  width: 3px;
  height: 150px;
}

.ancestry-tree.is-horizontal .mother-grandparent-spine {
  left: 136px;
  top: 421px;
  width: 3px;
  height: 150px;
}

.ancestry-tree.is-horizontal .father-grandparent-to-child {
  left: 136px;
  top: 212px;
  width: 34px;
  height: 3px;
}

.ancestry-tree.is-horizontal .mother-grandparent-to-child {
  left: 136px;
  top: 442px;
  width: 34px;
  height: 3px;
}

.ancestry-tree.is-horizontal .add-parent-pill {
  left: 60px;
  top: 20px;
}

.ancestry-tree.is-horizontal .add-child-pill {
  left: 850px;
  top: 335px;
}

.rut-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 14px;
}

.rut-chat-card,
.rut-side-card {
  min-height: 520px;
}

.settings-ai-agents-card {
  grid-column: 1 / -1;
}

.ai-settings-overview,
.ai-work-areas {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.ai-settings-overview {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-settings-overview div,
.ai-work-area {
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px solid rgba(14, 109, 111, 0.24);
  border-radius: 8px;
  background: #e8f5f2;
}

.ai-settings-overview strong,
.ai-work-area h3 {
  color: var(--red-dark);
  font-weight: 900;
}

.ai-settings-overview span,
.ai-work-area p {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 750;
}

.ai-settings-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 2px 0 16px;
  padding: 12px;
  border: 1px solid rgba(217, 183, 102, 0.72);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.62);
}

.ai-settings-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: min(260px, 100%);
  border: 2px solid rgba(14, 109, 111, 0.22);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 18px;
  font: inherit;
  font-weight: 950;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.07);
}

.ai-settings-tab:hover,
.ai-settings-tab:focus-visible {
  border-color: rgba(14, 109, 111, 0.6);
}

.ai-settings-tab.active {
  border-color: var(--teal);
  background: var(--orange);
  color: var(--selected-button-text);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.5),
    0 3px 0 rgba(0, 0, 0, 0.1);
}

.ai-settings-section {
  display: grid;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid #ead8ad;
}

.ai-settings-section[hidden] {
  display: none;
}

.ai-settings-section + .ai-settings-section {
  margin-top: 0;
}

.ai-work-area {
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
  margin-bottom: 0;
  background: #fff7e8;
}

.ai-work-area > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
}

.ai-work-area strong {
  color: var(--teal);
  font-size: 13px;
}

.rut-source-mode {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  align-items: stretch;
  margin: -4px 0 18px;
}

.rut-source-mode label {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 62px;
  padding: 12px 14px;
  border: 2px solid rgba(95, 62, 0, 0.2);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff9ec 0%, #f9e4b4 100%);
  color: var(--ink);
  font-size: clamp(16px, 1.35vw, 20px);
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(80, 50, 0, 0.12);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.rut-source-mode label:hover {
  border-color: rgba(14, 109, 111, 0.55);
  background: linear-gradient(180deg, #ffffff 0%, #e9f6f4 100%);
  transform: translateY(-1px);
}

.rut-source-mode label:has(input:checked) {
  border-color: var(--teal);
  background: linear-gradient(180deg, #e9fbf7 0%, #cfece7 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.62),
    0 12px 24px rgba(14, 109, 111, 0.2);
}

.rut-source-mode input {
  appearance: none;
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  border: 5px solid #070707;
  box-sizing: border-box;
  background: transparent;
  opacity: 0;
}

.rut-source-mode span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.rut-source-mode span::before {
  content: "\1F451";
  display: inline-grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 2px solid #1b1b1b;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 28px;
  line-height: 1;
  filter: grayscale(1);
  opacity: 0.58;
  transform: translateY(-1px) scale(0.9);
  transition: transform 0.15s ease, opacity 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.rut-source-mode input:checked + span::before {
  border-color: #070707;
  background: radial-gradient(circle at 50% 58%, #fff4b5 0 34%, #d7a51d 35% 64%, #8b4c00 65% 100%);
  box-shadow: 0 0 0 4px rgba(255, 236, 142, 0.3), 0 5px 10px rgba(0, 0, 0, 0.2);
  filter: none;
  opacity: 1;
  transform: translateY(-1px) scale(1.08);
}

.rut-source-mode input:focus-visible + span::before {
  outline: 3px solid rgba(0, 121, 126, 0.35);
  outline-offset: 4px;
}

.ai-external-db-form {
  display: grid;
  gap: 12px;
}

.ai-external-db-table {
  display: grid;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.ai-external-db-header,
.ai-external-db-row {
  display: grid;
  grid-template-columns:
    54px
    minmax(250px, 0.85fr)
    minmax(170px, 0.45fr)
    minmax(320px, 1.2fr);
  gap: 10px;
  align-items: center;
  min-width: 860px;
}

.ai-external-db-table.can-manage-system-paths .ai-external-db-header,
.ai-external-db-table.can-manage-system-paths .ai-external-db-row {
  grid-template-columns:
    54px
    minmax(210px, 0.75fr)
    minmax(230px, 1fr)
    minmax(230px, 1fr)
    minmax(170px, 0.5fr)
    minmax(300px, 1.15fr);
  min-width: 1280px;
}

.ai-external-db-header {
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.ai-external-db-row {
  padding: 7px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fffdf7;
}

.ai-external-db-row.is-active {
  border-color: rgba(14, 109, 111, 0.58);
  background: rgba(231, 247, 244, 0.68);
  box-shadow: inset 0 0 0 1px rgba(14, 109, 111, 0.1);
}

.ai-external-db-row.is-network [name="database_path"] {
  border-color: rgba(14, 109, 111, 0.45);
  background: #fff;
  color: var(--ink);
}

.ai-external-db-row input[type="text"] {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d9b766;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
  font-weight: 700;
}

.ai-external-path-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.path-picker-button {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.path-picker-button:hover {
  background: #0b6869;
}

.ai-external-db-check {
  display: grid;
  place-items: center;
}

.ai-external-db-check input {
  width: 28px;
  height: 28px;
  accent-color: var(--teal);
}

.ai-external-db-name {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ai-external-db-name strong {
  color: #1f272d;
  font-weight: 950;
}

.ai-external-db-name small {
  color: #6d6256;
  font-size: 12px;
  font-weight: 750;
}

.ai-external-mode {
  display: grid;
  gap: 4px;
  color: #1f272d;
  font-size: 12px;
  font-weight: 800;
}

.ai-external-mode label {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.ai-external-mode input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.ai-agent-list {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.ai-agent-card {
  margin: 0;
}

.ai-agent-card.active {
  border-color: rgba(14, 109, 111, 0.45);
  box-shadow: 0 0 0 2px rgba(14, 109, 111, 0.08);
}

.ai-agent-portraits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
  min-height: 0;
}

.ai-agent-portraits .rut-portrait {
  position: relative;
  min-height: 172px;
  height: 172px;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid rgba(14, 109, 111, 0.18);
  background: linear-gradient(180deg, #f8fff9 0%, #e8f5f2 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.62);
}

.ai-agent-portraits .rut-portrait img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center top;
}

.ai-agent-portraits .saga-portrait img {
  object-fit: cover;
  object-position: center center;
}

.rut-profile {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  align-items: end;
  margin: -8px -4px 16px;
  padding: 10px 10px 0;
  border: 1px solid rgba(14, 109, 111, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.7), rgba(232, 245, 242, 0.9)),
    #fff7e8;
  overflow: hidden;
}

.rut-profile.ai-agent-card {
  grid-template-columns: 1fr;
  align-items: start;
  gap: 12px;
  margin: -6px -4px 16px;
  padding: 12px;
}

.rut-portrait {
  align-self: end;
  min-height: 188px;
  display: grid;
  align-items: end;
}

.rut-portrait img {
  display: block;
  width: min(150px, 100%);
  max-height: 210px;
  object-fit: contain;
  object-position: bottom center;
}

.saga-portrait img {
  width: min(150px, 100%);
  height: 188px;
  max-height: 188px;
  object-fit: cover;
  object-position: center;
  border-radius: 6px;
}

.rut-profile-text {
  display: grid;
  gap: 4px;
  align-self: center;
  padding-bottom: 14px;
}

.rut-profile.ai-agent-card .rut-profile-text {
  padding-bottom: 0;
}

.rut-profile-text span {
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.rut-profile-text h3 {
  margin: 0;
  font-size: 28px;
}

.rut-profile-text p {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 700;
}

.rut-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 280px;
  max-height: 420px;
  overflow: auto;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fff7e8;
}

.rut-message {
  position: relative;
  display: grid;
  gap: 5px;
  width: min(88%, 680px);
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid #ead8ad;
  background: #fffdf7;
}

.rut-message.assistant {
  padding-right: 46px;
}

.rut-message.user {
  justify-self: end;
  background: #e8f5f2;
  border-color: rgba(14, 109, 111, 0.28);
}

.rut-message.thinking {
  border-color: rgba(14, 109, 111, 0.24);
  background: #fffdf7;
}

.rut-thinking {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  color: var(--ink);
  font-weight: 800;
}

.rut-thinking-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(14, 109, 111, 0.18);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: rut-thinking-spin 0.85s linear infinite;
}

.rut-thinking-dots::after {
  display: inline-block;
  min-width: 18px;
  color: var(--teal);
  content: "";
  animation: rut-thinking-dots 1.1s steps(4, end) infinite;
}

.rut-form button:disabled {
  cursor: wait;
  opacity: 0.72;
}

@keyframes rut-thinking-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rut-thinking-dots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75%,
  100% {
    content: "...";
  }
}

.rut-message strong {
  color: var(--red-dark);
  font-size: 13px;
}

.rut-message.user strong {
  color: var(--teal);
}

.rut-message p,
.rut-message-body {
  margin: 0;
  color: var(--ink);
  white-space: pre-wrap;
}

.rut-message-body .rut-structured-answer {
  display: grid;
  gap: 12px;
  white-space: normal;
}

.rut-message-body > .rut-structured-answer + .rut-structured-answer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(234, 216, 173, 0.95);
}

.rut-answer-intro {
  margin: 0;
  font-weight: 800;
  color: var(--ink);
}

.rut-result-card {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(14, 109, 111, 0.18);
  border-radius: 8px;
  background: #fffdf7;
  box-shadow: 0 8px 18px rgba(7, 19, 30, 0.06);
}

.rut-result-name {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.rut-result-fields {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 14px;
  margin: 0;
}

.rut-result-fields dt {
  color: var(--ink-soft);
  font-weight: 800;
}

.rut-result-fields dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  line-height: 1.35;
}

.rut-result-fields strong,
.rut-result-source strong {
  color: var(--ink);
  font-weight: 900;
}

.rut-result-source {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 26px;
  padding-top: 8px;
  border-top: 1px solid rgba(234, 216, 173, 0.9);
  color: var(--ink);
}

.rut-result-source b {
  color: var(--ink-soft);
}

.rut-kb-results {
  display: grid;
  gap: 10px;
}

.rut-kb-card {
  border-color: rgba(139, 76, 0, 0.24);
  background: linear-gradient(180deg, #fffdf7 0%, #fff7e8 100%);
}

.rut-sa-hit-connection {
  margin: 2px 0 0;
  border-left: 4px solid rgba(14, 109, 111, 0.5);
  padding: 7px 10px;
  border-radius: 0 8px 8px 0;
  background: rgba(232, 245, 242, 0.72);
  color: var(--ink);
  line-height: 1.35;
}

.rut-sa-hit-connection b {
  color: var(--teal);
  font-weight: 950;
}

.rut-kb-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rut-kb-ocr-button,
.rut-kb-show-more button {
  min-height: 34px;
  border: 1px solid rgba(14, 109, 111, 0.24);
  border-radius: 999px;
  padding: 0 12px;
  background: #e8f5f2;
  color: var(--teal);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.rut-kb-ocr-button:hover,
.rut-kb-ocr-button:focus-visible,
.rut-kb-show-more button:hover,
.rut-kb-show-more button:focus-visible {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  outline: none;
}

.rut-kb-ocr-panel {
  max-height: 360px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid rgba(14, 109, 111, 0.18);
  border-radius: 8px;
  background: #f8fff9;
  color: var(--ink);
  font-weight: 750;
  line-height: 1.45;
  white-space: pre-wrap;
}

.rut-kb-ocr-panel .rut-ocr-highlight {
  border-radius: 3px;
  padding: 0 2px;
  background: #ffe66d;
  color: #111;
  box-shadow: 0 0 0 1px rgba(139, 76, 0, 0.18);
}

.rut-kb-show-more {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

.rut-kb-links a,
.rut-kb-ref-link,
.rut-kb-source-link a {
  color: var(--teal);
  font-weight: 900;
  text-decoration: none;
}

.rut-kb-links a:hover,
.rut-kb-ref-link:hover,
.rut-kb-source-link a:hover {
  text-decoration: underline;
}

.rut-kb-ref-link {
  white-space: nowrap;
}

.rut-kb-narrative {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(14, 109, 111, 0.18);
  border-radius: 8px;
  background: #f8fff9;
}

.rut-kb-evidence {
  display: grid;
  gap: 10px;
}

.rut-kb-refine {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(234, 216, 173, 0.9);
  border-radius: 8px;
  background: #fffdf7;
}

.rut-kb-refine > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rut-kb-refine button {
  min-height: 34px;
  border: 1px solid rgba(14, 109, 111, 0.24);
  border-radius: 999px;
  padding: 0 12px;
  background: #e8f5f2;
  color: var(--teal);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.rut-kb-refine button:hover,
.rut-kb-refine button:focus-visible {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  outline: none;
}

.rut-kb-top-actions {
  display: grid;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid rgba(14, 109, 111, 0.22);
  border-radius: 8px;
  background: #eefbf7;
}

.rut-kb-top-actions p {
  margin: 0;
  color: var(--ink);
  font-weight: 850;
}

.rut-kb-top-actions > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rut-kb-top-actions button {
  min-height: 36px;
  border: 1px solid rgba(14, 109, 111, 0.24);
  border-radius: 999px;
  padding: 0 14px;
  background: var(--teal);
  color: #fff;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.rut-kb-top-actions button:hover,
.rut-kb-top-actions button:focus-visible {
  border-color: var(--red-dark);
  background: var(--red-dark);
  outline: none;
}

.rut-kb-guided-refine {
  display: grid;
  gap: 10px;
  padding: 13px 14px;
  border: 2px solid rgba(14, 109, 111, 0.22);
  border-radius: 10px;
  background: linear-gradient(180deg, #eefbf7 0%, #fffdf7 100%);
}

.rut-kb-guided-refine h4,
.rut-kb-guided-refine h5,
.rut-kb-guided-refine p {
  margin: 0;
}

.rut-kb-guided-refine h4 {
  color: var(--red-dark);
  font-size: 16px;
  font-weight: 950;
}

.rut-kb-guided-refine > p {
  color: var(--ink-soft);
  font-weight: 800;
  line-height: 1.35;
}

.rut-kb-guided-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.rut-kb-guided-grid article {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(234, 216, 173, 0.95);
  border-radius: 9px;
  background: rgba(255, 253, 247, 0.92);
}

.rut-kb-guided-grid h5 {
  color: var(--teal);
  font-size: 14px;
  font-weight: 950;
}

.rut-kb-guided-grid p {
  color: var(--ink);
  font-weight: 750;
  line-height: 1.35;
}

.rut-kb-guided-grid article > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.rut-kb-guided-grid button {
  min-height: 34px;
  border: 1px solid rgba(14, 109, 111, 0.24);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--teal);
  color: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.rut-kb-guided-grid button:hover,
.rut-kb-guided-grid button:focus-visible {
  border-color: var(--red-dark);
  background: var(--red-dark);
  outline: none;
}

@media (max-width: 900px) {
  .rut-kb-guided-grid {
    grid-template-columns: 1fr;
  }
}

.rut-kb-material-map {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(139, 76, 0, 0.18);
  border-radius: 8px;
  background: #fffaf0;
}

.rut-kb-material-map-sample {
  border-color: rgba(173, 106, 0, 0.28);
  background: #fff8e6;
}

.rut-kb-material-map details {
  display: grid;
  gap: 10px;
}

.rut-kb-material-map summary {
  cursor: pointer;
  color: var(--red-dark);
  font-size: 16px;
  font-weight: 950;
}

.rut-kb-map-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.rut-kb-map-metrics > div {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid rgba(234, 216, 173, 0.95);
  border-radius: 8px;
  background: #fffdf7;
}

.rut-kb-map-metrics span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
}

.rut-kb-map-metrics b {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
}

.rut-kb-map-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.rut-kb-map-card,
.rut-kb-map-highlights {
  padding: 10px;
  border: 1px solid rgba(234, 216, 173, 0.95);
  border-radius: 8px;
  background: #fffdf7;
}

.rut-kb-map-themes {
  grid-column: 1 / -1;
}

.rut-kb-map-themes ul {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  column-gap: 18px;
}

.rut-kb-map-columns h5,
.rut-kb-map-highlights h5 {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 14px;
  font-weight: 950;
}

.rut-kb-map-columns ul,
.rut-kb-map-highlights ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.rut-kb-map-columns li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.rut-kb-map-columns li span {
  min-width: 0;
  color: var(--ink);
  font-weight: 800;
}

.rut-kb-map-columns li span button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--teal);
  font: inherit;
  font-weight: 950;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}

.rut-kb-map-themes li span button {
  max-width: 100%;
  line-height: 1.25;
}

@media (max-width: 820px) {
  .rut-kb-map-columns {
    grid-template-columns: 1fr;
  }
}

.rut-kb-map-columns li span button:hover,
.rut-kb-map-columns li span button:focus-visible {
  color: var(--red-dark);
  outline: none;
}

.rut-kb-map-columns li small,
.rut-kb-map-highlights small {
  display: block;
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.rut-kb-map-columns li b {
  min-width: 2.2em;
  border-radius: 999px;
  padding: 2px 8px;
  background: #e8f5f2;
  color: var(--teal);
  font-size: 12px;
  text-align: center;
}

.rut-kb-map-highlights {
  margin-top: 10px;
}

.rut-kb-map-highlights li {
  color: var(--ink);
  font-weight: 750;
  line-height: 1.35;
}

.rut-kb-map-highlights a {
  color: var(--teal);
  font-weight: 900;
  text-decoration: none;
}

.rut-kb-map-highlights a:hover {
  text-decoration: underline;
}

.rut-kb-map-warning,
.rut-kb-map-preview {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(173, 106, 0, 0.22);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.35;
}

.rut-kb-map-warning {
  border-color: rgba(180, 0, 35, 0.18);
  background: #fff5ec;
  color: var(--red-dark);
}

.rut-kb-map-preview h5 {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 14px;
  font-weight: 950;
}

.rut-kb-map-preview p {
  margin: 0;
}

.rut-kb-map-action {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.rut-kb-map-action button {
  min-height: 36px;
  border: 1px solid rgba(14, 109, 111, 0.24);
  border-radius: 999px;
  padding: 0 14px;
  background: #e8f5f2;
  color: var(--teal);
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.rut-kb-map-action button:hover,
.rut-kb-map-action button:focus-visible {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  outline: none;
}

.rut-kb-map-note {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.rut-kb-evidence > h4,
.rut-kb-refine > h4,
.rut-kb-narrative h4 {
  margin: 0;
  color: var(--red-dark);
  font-size: 16px;
}

.rut-kb-evidence > p,
.rut-kb-narrative p,
.rut-kb-source-link {
  margin: 0;
}

.rut-kb-evidence > p {
  color: var(--ink-soft);
  font-weight: 800;
}

.rut-search-logic {
  display: inline-block;
  margin-left: 6px;
  color: var(--teal);
  font-weight: 850;
}

.rut-kb-narrative .rut-kb-ai-note {
  border-left: 4px solid rgba(14, 109, 111, 0.5);
  padding: 7px 10px;
  border-radius: 0 8px 8px 0;
  background: rgba(232, 245, 242, 0.72);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 850;
}

.rut-kb-narrative details {
  color: var(--ink);
  font-weight: 750;
}

.rut-kb-narrative summary {
  cursor: pointer;
  color: var(--teal);
  font-weight: 900;
}

.rut-kb-narrative ol {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding-left: 22px;
}

.rut-copy-button {
  position: absolute;
  top: 12px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.rut-copy-button span,
.rut-copy-button span::before {
  position: absolute;
  width: 14px;
  height: 17px;
  border: 2px solid #8d969c;
  border-radius: 3px;
  background: #fffdf7;
  content: "";
}

.rut-copy-button span {
  top: 10px;
  left: 9px;
}

.rut-copy-button span::before {
  top: -5px;
  left: 5px;
  background: #fffdf7;
}

.rut-copy-button:hover span,
.rut-copy-button:hover span::before {
  border-color: var(--teal);
}

.rut-copy-button:hover {
  background: rgba(14, 109, 111, 0.09);
}

.rut-copy-button.copied span,
.rut-copy-button.copied span::before {
  display: none;
}

.rut-copy-button.copied::after {
  position: absolute;
  top: 7px;
  left: 12px;
  width: 9px;
  height: 17px;
  border: solid #198a3e;
  border-width: 0 3px 3px 0;
  content: "";
  transform: rotate(45deg);
}

.rut-copy-button:focus-visible {
  outline: 3px solid rgba(0, 121, 126, 0.28);
  outline-offset: 2px;
}

.rut-form {
  display: grid;
  gap: 12px;
}

.rut-form textarea {
  min-height: 104px;
}

.rut-form-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 0.42fr);
  gap: 12px;
  align-items: stretch;
}

.rut-form-row > label:not(.rut-deep-search-toggle):not(.rut-ai-summary-toggle) {
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 183, 102, 0.78);
  border-radius: 12px;
  background: #fffdf7;
  font-weight: 900;
}

.rut-deep-search-toggle,
.rut-ai-summary-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  font-weight: 800;
}

.rut-deep-search-toggle input,
.rut-ai-summary-toggle input {
  width: 18px;
  min-height: 18px;
}

.rut-deep-search-toggle {
  display: none;
}

.rut-ai-summary-toggle {
  grid-column: 1 / -1;
  justify-content: flex-start;
  align-items: flex-start;
  min-height: 72px;
  padding: 13px 14px;
  border: 2px solid #e7c36b;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffaf0 0%, #ffe8aa 100%);
  box-shadow: 0 10px 20px rgba(99, 62, 0, 0.12);
  cursor: pointer;
}

.rut-ai-summary-toggle:has(input:checked) {
  border-color: var(--teal);
  background: linear-gradient(180deg, #eefafa 0%, #dff3f1 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.72),
    0 12px 24px rgba(14, 109, 111, 0.18);
}

.rut-ai-summary-toggle input {
  flex: 0 0 auto;
  margin-top: 5px;
  accent-color: var(--teal);
}

.rut-ai-summary-text {
  display: grid;
  gap: 3px;
  line-height: 1.2;
}

.rut-ai-summary-text strong {
  color: var(--red-dark);
  font-size: 1.08rem;
}

.rut-ai-summary-text small {
  color: var(--ink-soft);
  font-weight: 700;
}

.rut-prompts {
  display: grid;
  gap: 12px;
}

.rut-prompts button {
  position: relative;
  min-height: 60px;
  border: 2px solid rgba(217, 183, 102, 0.85);
  border-radius: 14px;
  background: linear-gradient(180deg, #fffaf0 0%, #f7df9d 100%);
  color: var(--ink);
  padding: 12px 14px 12px 52px;
  font-size: 1rem;
  font-weight: 950;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(99, 62, 0, 0.1);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.rut-prompts button::before {
  position: absolute;
  top: 50%;
  left: 14px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  content: "?";
  font-weight: 950;
  transform: translateY(-50%);
}

.rut-prompts button:hover {
  border-color: var(--teal);
  background: linear-gradient(180deg, #ffffff 0%, #e5f4f1 100%);
  box-shadow: 0 12px 24px rgba(14, 109, 111, 0.16);
  transform: translateY(-1px);
}

.rut-form-row > .primary-action {
  grid-column: 1 / -1;
  min-height: 58px;
  border: 2px solid #073f42;
  border-radius: 14px;
  background: linear-gradient(180deg, #0f7f7d 0%, #075f62 100%);
  color: #fff;
  font-size: 1.08rem;
  font-weight: 950;
  box-shadow: 0 14px 24px rgba(7, 95, 98, 0.24);
}

.rut-form-row > .primary-action:hover {
  background: linear-gradient(180deg, #12908e 0%, #06676a 100%);
  transform: translateY(-1px);
}

.rut-note {
  margin-top: 16px;
  padding: 13px;
  border: 1px solid rgba(14, 109, 111, 0.24);
  border-radius: 8px;
  background: #e8f5f2;
}

.rut-note strong {
  color: var(--teal);
}

.rut-knowledge-card {
  grid-column: 1 / -1;
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.rut-knowledge-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 14px;
  align-items: start;
}

.rut-knowledge-form textarea {
  min-height: 104px;
}

#rut-knowledge-text {
  min-height: 180px;
}

.rut-knowledge-browser {
  display: grid;
  gap: 12px;
}

.rut-knowledge-list {
  display: grid;
  gap: 9px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.rut-knowledge-item {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 82px;
  padding: 12px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fff7e8;
  color: var(--ink);
  text-align: left;
}

.rut-knowledge-item:hover,
.rut-knowledge-item.active {
  border-color: rgba(14, 109, 111, 0.5);
  background: #e8f5f2;
}

.rut-knowledge-item strong {
  color: var(--red-dark);
  font-size: 15px;
}

.rut-knowledge-item span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.rut-knowledge-item p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.rut-knowledge-detail {
  min-height: 180px;
  padding: 14px;
  border: 1px solid rgba(14, 109, 111, 0.25);
  border-radius: 8px;
  background: #fffdf7;
}

.rut-knowledge-detail strong {
  display: block;
  margin-bottom: 8px;
  color: var(--teal);
  font-size: 18px;
}

.rut-knowledge-detail dl {
  display: grid;
  grid-template-columns: minmax(90px, 0.35fr) minmax(0, 0.65fr);
  gap: 8px 10px;
  margin: 0;
}

.rut-knowledge-detail dt {
  color: var(--ink-soft);
  font-weight: 800;
}

.rut-knowledge-detail dd {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}

.empty-state {
  margin: 0;
  padding: 12px;
  border: 1px dashed #dfc892;
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.75);
  color: var(--ink-soft);
  font-weight: 800;
}

.project-layout {
  display: grid;
  grid-template-columns: minmax(250px, 0.7fr) minmax(420px, 1.35fr) minmax(280px, 0.8fr);
  gap: 14px;
  align-items: start;
}

.project-sidebar,
.project-report-column {
  position: sticky;
  top: 12px;
}

.project-list,
.project-step-list,
.project-document-list {
  display: grid;
  gap: 10px;
}

.project-list {
  max-height: 560px;
  margin-top: 12px;
  overflow: auto;
  padding-right: 4px;
}

.project-list-item {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 86px;
  padding: 12px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fff7e8;
  color: var(--ink);
  text-align: left;
}

.project-list-item.active,
.project-list-item:hover {
  border-color: rgba(14, 109, 111, 0.65);
  background: #e8f5f2;
}

.project-list-item strong {
  color: var(--red-dark);
  font-size: 16px;
}

.project-list-item span,
.project-list-item small {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.project-main {
  display: grid;
  gap: 14px;
}

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

.project-step-list {
  margin-top: 14px;
}

.project-step-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fffdf7;
}

.project-step-head {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.project-step-head small {
  color: var(--ink-soft);
  font-weight: 800;
}

.project-step-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--teal);
}

.project-step-check input {
  width: 20px;
  min-height: 20px;
}

.project-step-check span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
}

.project-step-title-input {
  color: var(--red-dark);
  font-size: 18px;
  font-weight: 900;
}

.project-documents {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid #ead8ad;
}

.project-document-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 10px;
}

.project-document-form textarea {
  min-height: 64px;
}

.project-document-form button,
.project-document-form input[type="file"] {
  align-self: end;
}

.project-document-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fff7e8;
}

.project-document-item a {
  margin-left: 8px;
  color: var(--teal);
  font-weight: 900;
}

.project-document-item p {
  margin: 6px 0 0;
  font-size: 13px;
}

.project-report-preview {
  min-height: 360px;
  max-height: 620px;
  margin: 14px 0 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  white-space: pre-wrap;
}

.project-report-card .primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.dna-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 14px;
}

.dna-step-shell {
  display: grid;
  grid-column: 1 / -1;
  gap: 16px;
}

.dna-step-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  align-items: stretch;
  margin-top: 22px;
}

.dna-step-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 86px;
  padding: 12px 14px;
  border: 3px solid #050505;
  border-radius: 22px;
  background: #e6a633;
  color: #050505;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.dna-step-button:hover,
.dna-step-button:focus-visible {
  background: #f0b64a;
  outline: 3px solid rgba(15, 118, 110, 0.35);
  outline-offset: 2px;
}

.dna-step-button.active {
  background: var(--teal);
  color: #fff;
}

.dna-step-button.active .dna-step-number {
  background: #fff;
  color: var(--teal);
}

.dna-step-number {
  display: inline-grid;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #050505;
  color: #fff;
  font-weight: 950;
}

.dna-step-text {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-weight: 950;
  line-height: 1.15;
}

.dna-step-text small {
  color: inherit;
  font-size: 13px;
  font-weight: 900;
  opacity: 0.82;
}

.dna-step-panels {
  display: grid;
  gap: 14px;
}

.dna-step-panel {
  display: none;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  gap: 14px;
}

.dna-step-panel.active {
  display: grid;
}

.dna-step-panel .dna-wide-card {
  grid-column: 1 / -1;
}

.dna-step-panel .panel-card {
  min-width: 0;
}

.dna-intro-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.8fr);
  gap: 16px;
  align-items: center;
  grid-column: 1 / -1;
}

.dna-intro-card h3 {
  margin-top: 12px;
  font-size: 25px;
}

.dna-metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dna-metric-row div {
  display: grid;
  gap: 4px;
  min-height: 82px;
  align-content: center;
  padding: 12px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fff7e8;
}

.dna-metric-row span,
.dna-tool-list span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.dna-metric-row strong {
  color: var(--teal);
  font-size: 28px;
}

.dna-cm-tool {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.dna-result-placeholder {
  min-height: 136px;
  padding: 14px;
  border: 2px dashed #d4bb7c;
  border-radius: 8px;
  background: #fff7e8;
}

.dna-result-placeholder strong {
  display: block;
  margin-bottom: 6px;
  color: var(--red-dark);
}

.dna-card-note {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-weight: 800;
  line-height: 1.35;
}

.dna-cm-summary {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ead8ad;
}

.dna-cm-summary strong {
  color: var(--teal);
  font-size: 18px;
}

.dna-cm-summary p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-weight: 800;
  line-height: 1.35;
}

.leeds-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.leeds-dot {
  display: block;
  min-height: 96px;
  border-radius: 8px;
  border: 1px solid rgba(7, 19, 30, 0.1);
}

.leeds-dot.maternal {
  background: #3b82f6;
}

.leeds-dot.paternal {
  background: #ef4444;
}

.leeds-dot.unknown {
  background: #22c55e;
}

.leeds-dot.research {
  background: #eab308;
}

.dna-tool-list {
  display: grid;
  gap: 10px;
}

.dna-tool-list div {
  display: grid;
  gap: 4px;
  min-height: 62px;
  padding: 11px 12px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fff7e8;
}

.dna-tool-list strong {
  color: var(--red-dark);
}

.dna-tool-list span {
  text-transform: none;
  line-height: 1.35;
}

.dna-wide-card {
  grid-column: 1 / -1;
}

.dna-step-card {
  display: grid;
  gap: 12px;
}

.dna-import-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1.2fr);
  gap: 14px;
}

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

.dna-form label {
  display: grid;
  gap: 6px;
  font-weight: 900;
}

.dna-form .wide-field,
.dna-form .form-actions {
  grid-column: 1 / -1;
}

.dna-form textarea {
  min-height: 132px;
  resize: vertical;
}

.dna-project-workspace,
.dna-match-workspace {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.dna-investigation-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(300px, 0.8fr);
  gap: 14px;
  align-items: start;
}

.dna-research-list {
  display: grid;
  gap: 10px;
  max-height: 720px;
  overflow: auto;
}

.dna-research-list.compact {
  max-height: 260px;
}

.dna-research-item {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid #d8c18d;
  border-radius: 8px;
  background: #fffdf7;
}

.dna-research-item-header {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.dna-research-item p,
.dna-research-item small {
  margin: 0;
  line-height: 1.4;
}

.dna-research-item small {
  color: var(--ink-soft);
  font-weight: 800;
}

@media (max-width: 900px) {
  .dna-investigation-grid {
    grid-template-columns: 1fr;
  }
}

.person-indata-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(0, 1.5fr);
  gap: 16px;
  align-items: start;
}

.sdb10-import-form {
  margin-top: 10px;
}

.sdb10-import-note {
  padding: 12px 14px;
  border: 1px dashed rgba(127, 29, 29, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
}

.sdb10-import-result {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.sdb10-progress {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
  background: rgba(240, 253, 250, 0.72);
}

.sdb10-progress[hidden] {
  display: none;
}

.sdb10-progress-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  color: var(--ink);
}

.sdb10-progress-header span {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--teal);
  white-space: nowrap;
}

.sdb10-progress-bar {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.14);
}

.sdb10-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 160ms ease;
}

.sdb10-progress-meta {
  color: var(--muted);
  font-weight: 800;
}

.sdb10-import-row,
.sdb10-import-summary {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 8px;
  background: rgba(240, 253, 250, 0.62);
}

.sdb10-import-row strong,
.sdb10-import-summary strong {
  color: var(--wine);
}

.dna-project-picker,
.dna-match-list-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fff7e8;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.checkbox-field input {
  width: 18px;
  min-height: 18px;
}

.dna-project-match-list,
.dna-image-import-list {
  display: grid;
  gap: 10px;
  max-height: 430px;
  overflow: auto;
  padding-right: 3px;
}

.dna-gedcom-import-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(220px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.dna-gedcom-preview,
.dna-tree-import-item {
  padding: 13px 14px;
  border: 1px solid rgba(15, 118, 110, 0.25);
  border-radius: 10px;
  background: rgba(240, 253, 250, 0.75);
}

.dna-gedcom-preview strong,
.dna-tree-import-item strong {
  display: block;
  color: var(--teal);
}

.dna-gedcom-preview p,
.dna-gedcom-preview small {
  display: block;
  margin: 6px 0 0;
}

.dna-gedcom-report {
  margin-top: 14px;
}

.dna-tree-import-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.dna-tree-candidate-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.dna-tree-import-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  align-items: center;
}

.dna-tree-candidate-item {
  display: grid;
  gap: 8px;
  padding: 13px 14px;
  border: 1px solid rgba(15, 118, 110, 0.25);
  border-radius: 10px;
  background: #fffdf7;
}

.dna-tree-candidate-item.accepted {
  border-color: rgba(34, 197, 94, 0.45);
  background: #f0fdf4;
}

.dna-tree-candidate-item.rejected {
  opacity: 0.72;
  background: #fff7f7;
}

.dna-tree-candidate-item > small {
  color: var(--ink-soft);
  font-weight: 800;
}

.dna-tree-candidate-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.08);
}

.dna-tree-candidate-detail .wide {
  grid-column: 1 / -1;
}

.dna-tree-candidate-detail b,
.dna-tree-candidate-detail span {
  display: block;
}

.dna-tree-candidate-detail span {
  margin-top: 3px;
  color: var(--ink-soft);
  font-weight: 800;
}

.dna-tree-import-item span {
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 800;
}

.dna-tree-import-item b {
  justify-self: end;
  border-radius: 999px;
  background: #e7f6ee;
  color: var(--teal);
  padding: 3px 9px;
}

.dna-project-match-item,
.dna-image-import-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 90px;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fffdf7;
}

.dna-image-import-item {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.dna-project-match-item strong,
.dna-project-match-item span,
.dna-project-match-item small,
.dna-image-import-item strong,
.dna-image-import-item span,
.dna-image-import-item p {
  display: block;
}

.dna-project-match-item strong {
  color: var(--red-dark);
  font-size: 16px;
}

.dna-project-match-item span,
.dna-project-match-item small,
.dna-image-import-item p {
  color: var(--ink-soft);
  font-weight: 800;
  line-height: 1.35;
}

.dna-project-match-item label,
.dna-image-form label {
  min-width: 0;
}

.dna-image-import-item a {
  color: var(--teal);
  font-weight: 900;
}

.dna-network-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fff7e8;
}

.dna-network-controls > label,
.segmented-control label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  color: var(--ink);
  font-weight: 900;
}

.dna-network-controls input[type="checkbox"],
.segmented-control input {
  width: 18px;
  min-height: 18px;
}

.dna-network-controls input[type="number"] {
  width: 92px;
  min-height: 34px;
}

.segmented-control {
  display: inline-flex;
  gap: 8px;
  padding-right: 10px;
  border-right: 1px solid #dcc48e;
}

.dna-cluster-list,
.dna-finding-list {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
  padding-right: 3px;
}

.dna-cluster-item,
.dna-finding-item,
.dna-cm-result {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fff7e8;
}

.dna-cm-result {
  grid-template-columns: minmax(0, 1fr) auto;
}

.dna-cm-result strong,
.dna-cm-result span {
  grid-column: 1;
}

.dna-cm-result small,
.dna-cm-result .dna-cm-range {
  grid-column: 1 / -1;
}

.dna-cm-result b {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 13px;
}

.dna-cm-range {
  position: relative;
  height: 12px;
  margin: 7px 0 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dbeafe, #a7f3d0, #fef3c7);
}

.dna-cm-range i,
.dna-cm-range em {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.dna-cm-range i {
  background: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.22);
}

.dna-cm-range em {
  background: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
}

.dna-cluster-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dna-cluster-header small {
  margin-left: auto;
  color: var(--ink-soft);
  font-weight: 900;
}

.dna-cluster-color {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(7, 19, 30, 0.18);
}

.dna-cluster-item p,
.dna-finding-item span,
.dna-cm-result span {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.35;
}

.dna-finding-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.dna-finding-item strong,
.dna-finding-item span {
  grid-column: 1;
}

.dna-finding-item b {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e8f2de;
  color: var(--teal);
}

.dna-network-panel {
  min-height: 430px;
  overflow: hidden;
  border: 1px solid #d7c18a;
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(15, 118, 110, 0.12) 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(15, 118, 110, 0.12) 40px);
}

#dna-network-svg {
  width: 100%;
  min-height: 430px;
  display: block;
}

.dna-network-edge {
  stroke: rgba(15, 118, 110, 0.5);
  stroke-linecap: round;
}

.dna-network-edge.main_match {
  stroke: rgba(12, 92, 86, 0.72);
}

.dna-network-edge.shared_match {
  stroke-dasharray: 8 5;
}

.dna-network-edge.geographic {
  stroke: rgba(202, 138, 4, 0.65);
}

.dna-network-edge.gedcom {
  stroke: rgba(99, 102, 241, 0.6);
}

.dna-network-edge.branch-ff {
  stroke: rgba(37, 99, 235, 0.72);
}

.dna-network-edge.branch-fm {
  stroke: rgba(22, 163, 74, 0.72);
}

.dna-network-edge.branch-mf {
  stroke: rgba(147, 51, 234, 0.7);
}

.dna-network-edge.branch-mm {
  stroke: rgba(220, 38, 38, 0.72);
}

.dna-network-edge.branch-unknown {
  stroke: rgba(85, 85, 85, 0.48);
}

.dna-network-edge.known {
  stroke: rgba(22, 101, 52, 0.62);
}

.dna-network-edge.cluster {
  stroke: rgba(127, 29, 29, 0.42);
}

.dna-network-node circle {
  stroke: #fff;
  stroke-width: 3;
  filter: drop-shadow(0 4px 6px rgba(7, 19, 30, 0.22));
}

.dna-network-node.kit circle {
  fill: var(--teal);
}

.dna-network-node.match circle {
  fill: #0ea5e9;
}

.dna-network-node.person circle {
  fill: #16a34a;
}

.dna-network-node text,
.dna-network-empty {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.dna-rut-result {
  min-height: 190px;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  margin: 0;
  padding: 14px;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fff7e8;
  color: var(--ink);
  font-family: inherit;
  font-weight: 800;
  line-height: 1.45;
}

.muted-text {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 800;
}

.output-tabs,
.geo-view-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: thin;
}

.output-tabs {
  margin-bottom: 14px;
}

.output-tabs button {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 18px;
  font-weight: 800;
}

.output-tabs button.active {
  background: var(--teal);
  color: #fff;
}

#sok > .search-panel {
  display: none;
}

.person-match-search {
  display: grid;
  gap: 24px;
}

.match-family-strip {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(260px, 1.35fr) minmax(180px, 0.9fr);
  gap: 14px;
  align-items: stretch;
  border-radius: 8px;
  background: rgba(255, 250, 239, 0.92);
  padding: 14px;
}

.match-family-strip section,
.match-main-person {
  border: 1px solid #ded6c8;
  border-radius: 6px;
  background: #fff;
  padding: 12px;
}

.match-family-strip strong,
.match-main-person strong {
  display: block;
  color: #2a3034;
  font-weight: 900;
}

.match-main-person strong {
  color: var(--teal);
  font-size: 18px;
}

.match-main-person span {
  display: block;
  margin-top: 5px;
  color: #30383d;
  font-weight: 750;
}

.match-family-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.match-family-person {
  border: 0;
  border-radius: 5px;
  background: #f4f1ec;
  padding: 7px 8px;
  color: #253036;
  font-weight: 800;
  text-align: left;
}

.match-family-person:hover {
  background: #e8f5f2;
  color: var(--teal);
}

.match-family-empty {
  color: #6f7a82;
  font-weight: 750;
}

.match-title {
  margin: 0;
  text-align: center;
  font-size: clamp(24px, 3vw, 34px);
}

.person-match-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr);
  gap: 22px;
}

.match-criteria-card,
.match-results-card {
  border-radius: 8px;
  background: rgba(255, 250, 239, 0.94);
  padding: 16px;
}

.match-criteria-list {
  display: grid;
  gap: 14px;
}

.match-criterion {
  display: grid;
  gap: 5px;
}

.match-criterion p {
  display: grid;
  gap: 2px;
  margin: 0;
  color: #243038;
  font-weight: 750;
}

.match-criterion strong {
  color: #6a1c2b;
  font-size: 12px;
  text-transform: uppercase;
}

.match-criterion span {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #7d858b var(--match-width), transparent var(--match-width)),
    #e4e1db;
}

.person-match-results {
  display: grid;
  gap: 12px;
}

.person-match-card {
  display: grid;
  grid-template-columns: 64px minmax(160px, 0.8fr) minmax(240px, 1fr);
  gap: 14px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  color: #1f272d;
  text-align: left;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.person-match-card:hover {
  outline: 2px solid rgba(14, 109, 111, 0.45);
}

.match-avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dfe9ef, #6b8c82);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  color: #fff;
  font-weight: 900;
}

.match-avatar.male {
  background-color: #dff2fb;
  background-image: url("../img/person-male.png");
  background-size: auto 88%;
}

.match-avatar.female {
  background-color: #ffe3df;
  background-image: url("../img/person-female.png");
  background-size: auto 88%;
}

.person-match-card strong,
.person-match-card small {
  display: block;
}

.person-match-card strong {
  color: var(--teal);
  font-size: 18px;
}

.person-match-card small {
  margin-top: 4px;
  color: #4e6874;
  font-weight: 800;
}

.person-match-card dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 12px;
  margin: 0;
}

.person-match-card dt {
  color: #5c4a36;
  font-weight: 900;
}

.person-match-card dd {
  margin: 0;
  color: #1f272d;
  font-weight: 750;
}

.output-view {
  display: none;
}

.output-view.active {
  display: block;
}

.profile-hero {
  position: relative;
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 230px;
  padding: 64px 24px 24px;
  background: #4a4a4a;
  color: #fff;
  border-radius: 8px 8px 0 0;
}

.profile-toolbar {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.profile-toolbar .secondary-action {
  min-height: 34px;
  background: rgba(255, 255, 255, 0.92);
}

#profile-tools-button::after {
  content: "\25be";
  margin-left: 6px;
  font-size: 12px;
}

.profile-tools-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 60;
  display: grid;
  width: min(430px, calc(100vw - 42px));
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background: #fff;
  color: #20262a;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  overflow: visible;
}

.profile-tools-menu[hidden] {
  display: none !important;
}

.profile-tools-menu::before {
  content: "";
  position: absolute;
  top: -12px;
  right: 118px;
  width: 0;
  height: 0;
  border-right: 12px solid transparent;
  border-bottom: 12px solid #fff;
  border-left: 12px solid transparent;
}

.profile-tools-menu button {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  border: 0;
  border-bottom: 1px solid #e7e3dd;
  background: #fff;
  padding: 0 18px;
  color: #2b3034;
  font: inherit;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.profile-tools-menu button:last-child {
  border-bottom: 0;
}

.profile-tools-menu button:hover,
.profile-tools-menu button:focus-visible {
  background: #f2f7f6;
  outline: none;
}

.profile-tools-menu span {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  min-height: 21px;
  border-radius: 5px;
  background: #35a21c;
  color: #fff;
  font-size: 13px;
  font-weight: 950;
}

.person-search-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.person-search-form,
.person-search-results-panel {
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 8px;
  background: rgba(255, 250, 239, 0.9);
  padding: 16px;
}

.person-search-mode {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.person-search-mode > span {
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.person-search-mode label {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid #d9bb76;
  border-radius: 999px;
  background: #fffaf0;
  padding: 0 14px;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.person-search-mode label:has(input:checked) {
  border-color: rgba(14, 109, 111, 0.65);
  background: var(--teal);
  color: #fff;
}

.person-search-mode input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.person-search-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.person-search-fields label {
  display: grid;
  gap: 5px;
  color: #3d2500;
  font-size: 13px;
  font-weight: 900;
}

.person-search-fields input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d9bb76;
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
  color: #101820;
  font: inherit;
  font-weight: 750;
}

.field-hint {
  color: #7a6444;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.person-search-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.person-search-results-panel {
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr);
  min-height: 320px;
}

.person-search-results {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  max-height: 455px;
  padding-right: 4px;
}

.person-indata-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.9fr) minmax(440px, 1.1fr);
  gap: 14px;
  align-items: start;
}

.person-indata-search-card,
.person-indata-editor-card {
  min-width: 0;
}

.indata-person-search-form {
  border: 0;
  background: transparent;
  padding: 0;
}

.indata-person-search-form .person-search-fields {
  grid-template-columns: repeat(2, minmax(140px, 1fr));
}

.indata-person-results {
  max-height: 430px;
  margin-top: 12px;
  border-top: 1px solid rgba(217, 187, 118, 0.7);
  padding-top: 12px;
}

.person-edit-form select,
.person-edit-form input,
.person-edit-form textarea {
  width: 100%;
}

.person-edit-form .checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: end;
  min-height: 42px;
}

.person-edit-form .checkbox-field input {
  width: 18px;
  min-height: 18px;
}

.person-edit-form input:disabled,
.person-edit-form select:disabled,
.person-edit-form textarea:disabled {
  background: rgba(255, 255, 255, 0.72);
  color: #6a645d;
  cursor: not-allowed;
}

.registry-search-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(310px, 0.55fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.registry-search-form {
  min-width: 0;
}

.registry-search-source {
  margin-bottom: 16px;
}

.registry-field-inline,
.registry-checkbox-row,
.registry-place-row {
  grid-column: 1 / -1;
}

.registry-field-inline,
.registry-checkbox-row,
.registry-place-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.registry-field-inline > span,
.registry-place-options strong {
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
}

.registry-field-inline label,
.registry-checkbox-row label,
.registry-place-options label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: #3d2500;
  font-weight: 850;
}

.registry-field-inline input,
.registry-checkbox-row input,
.registry-place-options input {
  width: auto;
  min-height: 0;
  accent-color: var(--teal);
}

.registry-age-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(90px, 1fr));
  gap: 8px;
}

.registry-place-row {
  display: grid;
  gap: 7px;
}

.registry-search-results-panel {
  min-width: 0;
}

.registry-search-results {
  max-height: 615px;
}

.registry-search-loading {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 18px;
  color: var(--ink);
  background: #fffdf7;
  border: 1px solid rgba(14, 109, 111, 0.22);
  border-radius: 8px;
}

.registry-search-loading > div {
  display: grid;
  gap: 4px;
}

.registry-search-loading strong {
  color: var(--teal);
  font-size: 18px;
}

.registry-search-loading span:not(.registry-search-spinner) {
  color: var(--muted);
  font-weight: 800;
}

.registry-search-spinner {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 4px solid rgba(14, 109, 111, 0.16);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: rut-thinking-spin 0.85s linear infinite;
}

.registry-search-error {
  color: var(--red-dark);
  border-color: rgba(145, 0, 36, 0.35);
  background: #fff7f5;
}

.registry-search-results .rut-structured-answer {
  display: grid;
  gap: 12px;
}

.registry-search-results .rut-answer-intro {
  margin: 0 0 2px;
  font-weight: 900;
}

.registry-external-source-result {
  display: grid;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(217, 187, 118, 0.7);
}

.registry-external-source-result:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.registry-external-source-note {
  color: #31404a;
  background: rgba(255, 250, 240, 0.72);
  border: 1px dashed rgba(217, 187, 118, 0.9);
  border-radius: 7px;
  padding: 10px 12px;
}

.registry-external-source-note ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.registry-muted-note {
  margin: 0;
  color: #33424d;
}

.registry-saveable-result {
  cursor: context-menu;
}

.registry-saveable-result.is-saved-local {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(14, 109, 111, 0.14), 0 8px 18px rgba(7, 19, 30, 0.06);
}

.registry-result-saved-note {
  margin-top: 4px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
}

.registry-result-menu {
  position: fixed;
  z-index: 5000;
  min-width: 220px;
  padding: 6px;
  border: 1px solid rgba(14, 109, 111, 0.28);
  border-radius: 8px;
  background: #fffdf7;
  box-shadow: 0 18px 42px rgba(7, 19, 30, 0.22);
}

.registry-result-menu[hidden] {
  display: none;
}

.registry-result-menu button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 10px 12px;
  text-align: left;
}

.registry-result-menu button:hover {
  background: #e8f5f2;
  color: var(--teal);
}

.person-result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  border: 1px solid #e4c783;
  border-radius: 7px;
  background: #fffaf0;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.person-result-row.active,
.person-result-row:hover {
  border-color: var(--teal);
  background: #e8f5f2;
}

.person-result-row strong,
.person-result-row small {
  display: block;
}

.person-result-row strong {
  color: var(--wine);
  font-size: 16px;
  text-transform: uppercase;
}

.person-result-row small {
  margin-top: 4px;
  color: #4d5962;
  font-weight: 800;
}

.person-result-row span:last-child {
  align-self: center;
  border-radius: 999px;
  background: #efe7d2;
  padding: 5px 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.person-result-card {
  display: block;
  cursor: default;
}

.person-result-card strong {
  color: var(--teal);
  line-height: 1.15;
}

.person-result-line {
  margin-top: 4px;
  color: #102538;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.25;
}

.person-result-parents {
  margin-top: 7px;
  line-height: 1.3;
}

.person-result-source {
  margin-top: 7px;
  color: #6b2b36;
  font-size: 12px;
  font-weight: 900;
}

.person-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.person-result-actions button {
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 950;
  padding: 8px 12px;
}

.person-result-actions button:nth-child(2) {
  background: #fff;
  color: #071927;
  box-shadow: inset 0 0 0 1px #e4c783;
}

.person-result-actions button:hover,
.person-result-actions button:focus-visible {
  filter: brightness(.96);
  outline: 2px solid rgba(0, 122, 122, .25);
  outline-offset: 2px;
}

.profile-photo {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 6px;
  background: linear-gradient(135deg, #dfe9ef, #506f66);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  color: #fff;
  font-size: 42px;
  font-weight: 900;
}

.profile-photo.photo {
  background-color: #dfe9ef;
}

.profile-photo.male {
  background-color: #dff2fb;
  background-image: url("../img/person-male.png");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: auto 92%;
}

.profile-photo.female {
  background-color: #ffe3df;
  background-image: url("../img/person-female.png");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: auto 92%;
}

.profile-summary h3 {
  margin: 0 0 10px;
  color: #fff;
  font-size: 34px;
}

.profile-summary p {
  margin: 4px 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 17px;
  font-weight: 700;
}

.profile-actions {
  margin-top: 18px;
}

.profile-tabs {
  display: flex;
  justify-content: center;
  gap: 22px;
  min-height: 58px;
  padding: 0 18px;
  background: #fff;
  border-bottom: 1px solid #dfd9d0;
}

.profile-tabs button {
  border: 0;
  border-bottom: 4px solid transparent;
  background: transparent;
  color: #4e4e4e;
  font-size: 16px;
  font-weight: 800;
}

.profile-tabs button.active {
  border-bottom-color: #5d9d2c;
  color: #111;
}

.person-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.75fr) minmax(260px, 0.8fr);
  gap: 18px;
  padding: 20px;
  background: #f4f1ec;
}

.timeline-panel,
.sources-panel,
.kinship-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.timeline-panel h3,
.sources-panel h3,
.kinship-panel h3 {
  margin: 0;
}

.timeline-item,
.source-card,
.relation-card,
.family-person {
  position: relative;
  border: 1px solid #e1d7c8;
  border-radius: 6px;
  background: #fff;
  padding: 12px 14px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.family-person {
  padding: 12px 74px 12px 14px;
}

button.family-person {
  display: block;
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

button.family-person[draggable="true"] {
  cursor: grab;
}

button.family-person[draggable="true"]:active,
button.family-person.is-dragging {
  cursor: grabbing;
}

button.family-person.is-dragging {
  opacity: 0.55;
  transform: scale(0.98);
}

button.family-person:hover,
button.family-person:focus-visible {
  border-color: var(--teal);
  background: #e8f5f2;
  outline: 2px solid rgba(0, 121, 128, 0.16);
}

.family-person.is-numbered {
  padding-right: 86px;
}

.family-person .family-person-number {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  z-index: 3;
}

.family-person-avatar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 999px;
  background-color: #eef3f5;
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: auto 48px;
  color: transparent;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.22);
}

.family-person-avatar.male {
  background-color: #dff2fb;
  background-image: url("../img/person-male.png");
}

.family-person-avatar.female {
  background-color: #ffe3df;
  background-image: url("../img/person-female.png");
}

.family-person-avatar.photo {
  background-color: #dfe9ef;
  background-position: center;
  background-size: cover;
}

.family-person.is-numbered .family-person-avatar {
  top: 42px;
  width: 40px;
  height: 40px;
  background-size: auto 40px;
}

.family-person.muted {
  border-style: dashed;
  background: #fffaf0;
  color: #6d6256;
  box-shadow: none;
}

.relation-card {
  display: grid;
  gap: 6px;
  position: relative;
  padding-right: 52px;
}

.relation-card.missing {
  border-style: dashed;
  background: #fffaf0;
  box-shadow: none;
}

.relation-card.missing strong {
  color: #7a1b2a;
}

.relation-card.missing .relation-role {
  background: #f4e1d8;
  color: #7a1b2a;
}

.relation-card-header {
  display: flex;
  justify-content: flex-start;
}

.relation-role {
  display: inline-flex;
  width: auto;
  border-radius: 999px;
  background: #e8f5f2;
  padding: 4px 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.relation-card strong,
.family-person strong {
  display: block;
  color: #08727f;
  font-size: 20px;
  line-height: 1.12;
}

.timeline-item span {
  display: block;
  color: var(--teal);
  font-weight: 900;
}

.timeline-item p,
.timeline-item small,
.relation-card span,
.relation-card small,
.source-card span,
.family-person span {
  display: block;
  margin: 4px 0 0;
  color: #4d5962;
  font-weight: 700;
}

.family-person .family-life-line {
  color: #2f3437;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.28;
}

.family-person .family-role-line {
  display: block;
  margin-top: 6px;
  color: #69747a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.timeline-item small,
.relation-card small,
.source-card span {
  color: #6f7a82;
  font-size: 12px;
}

.relation-card .relation-role {
  display: inline-flex;
  margin: 0;
  color: var(--teal);
}

.relation-search-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #c9d8d5;
  border-radius: 999px;
  background: #f6fffd;
  color: var(--teal);
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

.relation-search-button:hover,
.relation-search-button:focus-visible {
  border-color: var(--teal);
  background: #e8f5f2;
  outline: 2px solid rgba(0, 121, 128, 0.18);
}

.binocular-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 14px;
}

.binocular-icon::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 2px;
  width: 4px;
  height: 7px;
  border-radius: 4px 4px 2px 2px;
  background: currentColor;
}

.binocular-icon span {
  position: absolute;
  bottom: 0;
  width: 8px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: #fff;
}

.binocular-icon span:first-child {
  left: 0;
}

.binocular-icon span:last-child {
  right: 0;
}

.tag-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.tag-row span {
  border-radius: 999px;
  padding: 6px 9px;
  background: #e8f5f2;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.note-card {
  border: 1px dashed #b8a47f;
  border-radius: 7px;
  padding: 12px;
  background: #fffdf7;
  color: #4d5962;
  font-weight: 800;
}

.family-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 34px;
  align-items: start;
  min-height: 430px;
  padding: 22px;
  border-radius: 8px;
  background: #f4f1ec;
  overflow: hidden;
}

.family-connectors {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.family-connectors path {
  fill: none;
  stroke: #111;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 4px;
}

.family-column {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: start;
  gap: 12px;
}

.family-list {
  position: relative;
  display: grid;
  gap: 10px;
}

.family-focus::before,
.family-focus::after {
  content: none;
}

.family-focus::before {
  left: -28px;
}

.family-focus::after {
  right: -28px;
}

.family-column:first-child .family-person::after,
.family-column:nth-child(3) .family-person::before,
.family-column.children .family-person::before {
  content: none;
}

.family-column:first-child .family-person::after {
  right: -27px;
}

.family-column:nth-child(3) .family-person::before,
.family-column.children .family-person::before {
  left: -27px;
}

.family-column:nth-child(3) .family-list::before {
  content: none;
}

.family-column h3 {
  margin: 0;
}

.family-empty {
  border: 1px dashed #cdb983;
  border-radius: 6px;
  background: #fffaf0;
  padding: 12px;
  color: #6a5737;
  font-weight: 800;
}

.family-focus .family-person.main {
  border-color: #c0a000;
  background: #fff7a8;
  font-size: 17px;
}

.family-board.is-family-dragging .family-focus .family-person.main {
  border-style: dashed;
}

.family-focus .family-person.main.is-drop-target {
  border-color: var(--teal);
  outline: 3px solid rgba(0, 121, 128, 0.28);
  outline-offset: 4px;
  box-shadow: 0 0 0 6px rgba(0, 121, 128, 0.12), 0 10px 22px rgba(0, 0, 0, 0.16);
}

.family-person.male {
  border-left: 6px solid #8bb8d8;
}

.family-person.female {
  border-left: 6px solid #eab4a0;
}

.children {
  border-left: 3px solid rgba(14, 109, 111, 0.35);
  padding-left: 16px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: start center;
  overflow: auto;
  padding: 28px;
  background: rgba(0, 0, 0, 0.48);
}

.analysis-confirm-backdrop {
  z-index: 10000;
  place-items: center;
  padding: 24px;
  background: rgba(7, 19, 30, 0.58);
}

.analysis-confirm-modal {
  width: min(560px, calc(100vw - 32px));
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  padding: 24px 26px;
  background: #fff8ea;
  color: var(--ink);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
  text-align: center;
}

.analysis-confirm-modal h2 {
  margin: 0 0 12px;
  color: var(--red-dark);
  font-size: 24px;
  line-height: 1.2;
}

.analysis-confirm-modal p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
}

.analysis-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

.analysis-reject-modal {
  text-align: left;
}

.analysis-reject-modal h2,
.analysis-reject-modal p {
  text-align: left;
}

.analysis-reject-label {
  display: block;
  margin: 18px 0 8px;
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

#analysis-reject-note {
  width: 100%;
  min-height: 112px;
  padding: 12px;
  border: 1px solid rgba(130, 89, 30, 0.35);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  line-height: 1.45;
  resize: vertical;
}

.relation-modal {
  position: relative;
  width: min(900px, 100%);
  padding: 22px;
  border-radius: 8px;
  background: #f4f1ec;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}

.tree-create-modal {
  position: relative;
  width: min(820px, 100%);
  padding: 24px;
  border-radius: 8px;
  background: #f8f0df;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}

.tree-create-modal h2 {
  margin: 0 44px 18px 0;
  color: #111;
  font-size: 24px;
}

.tree-create-form {
  display: grid;
  gap: 16px;
}

.tree-create-note {
  margin: 0;
  border: 1px dashed #d9bd82;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff8ea;
  color: #263238;
  font-weight: 750;
}

.tree-person-edit-backdrop {
  z-index: 520;
}

.tree-person-edit-modal {
  position: relative;
  width: min(880px, 100%);
  padding: 22px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.3);
}

.tree-person-edit-form {
  display: grid;
  gap: 18px;
}

.tree-person-edit-header {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 18px;
  align-items: center;
  margin-right: 42px;
  padding-bottom: 16px;
  border-bottom: 1px solid #dedede;
}

.tree-person-edit-header h2 {
  margin: 2px 0 4px;
  color: var(--teal);
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.04;
}

.tree-person-edit-header span {
  color: #333;
  font-size: 18px;
  font-weight: 800;
}

.person-edit-avatar {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 7px;
  background: linear-gradient(135deg, #dfe9ef, #506f66);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  color: #fff;
  font-size: 32px;
  font-weight: 900;
}

.person-edit-avatar.male {
  background-color: #dff2fb;
  background-image: url("../img/person-male.png");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: auto 92%;
}

.person-edit-avatar.female {
  background-color: #ffe3df;
  background-image: url("../img/person-female.png");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: auto 92%;
}

.person-edit-avatar.photo {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.tree-person-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.tree-person-edit-grid label,
.inline-choice-field {
  display: grid;
  gap: 7px;
  margin: 0;
}

.tree-person-edit-grid span,
.inline-choice-field legend {
  color: #1b2e36;
  font-weight: 850;
}

.tree-person-edit-grid input,
.tree-person-edit-grid select,
.tree-person-edit-grid textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c6c6c6;
  border-radius: 0;
  padding: 8px 10px;
  background: #fff;
  color: #111;
  font: inherit;
  font-weight: 650;
}

.tree-person-edit-grid input:focus,
.tree-person-edit-grid select:focus,
.tree-person-edit-grid textarea:focus {
  border-color: #5ca100;
  outline: 2px solid rgba(92, 161, 0, 0.18);
  outline-offset: 0;
}

.inline-choice-field {
  border: 0;
  padding: 0;
}

.inline-choice-field label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 18px;
  font-weight: 700;
}

.inline-choice-field input[type="radio"] {
  width: 18px;
  min-height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  accent-color: var(--teal);
}

.tree-person-edit-notes {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .tree-person-edit-header,
  .tree-person-edit-grid {
    grid-template-columns: 1fr;
  }

  .tree-person-edit-header {
    margin-right: 34px;
  }
}

.tree-relative-backdrop {
  z-index: 540;
  place-items: stretch end;
  padding: 0;
  background: rgba(0, 0, 0, 0.42);
}

.tree-relative-panel {
  position: relative;
  display: grid;
  align-content: start;
  width: min(430px, 100%);
  min-height: 100vh;
  padding: 34px 28px;
  background: #fff;
  color: #111;
  box-shadow: -18px 0 42px rgba(0, 0, 0, 0.32);
}

.tree-relative-panel h2 {
  margin: 0 42px 10px 0;
  color: #111;
  font-size: 24px;
  line-height: 1.16;
}

.tree-relative-panel h3 {
  margin: 26px 0 16px;
  font-size: 17px;
}

.tree-relative-person {
  margin: 0;
  color: #111;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.16;
}

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

.tree-relative-options button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: #e9e9e9;
  color: #111;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.tree-relative-options button:hover,
.tree-relative-options button:focus-visible {
  background: var(--teal);
  color: #fff;
  outline: none;
}

.tree-relative-form {
  display: grid;
  gap: 18px;
}

.tree-relative-back {
  width: 36px;
  height: 42px;
  border: 0;
  background: transparent;
  color: #111;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
}

.tree-relative-source {
  display: block;
}

.tree-relative-source legend {
  margin-bottom: 10px;
}

.tree-relative-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 14px 18px;
}

.tree-relative-form-grid label {
  display: grid;
  gap: 7px;
  margin: 0;
}

.tree-relative-form-grid .wide,
.tree-relative-form-grid fieldset {
  grid-column: 1 / -1;
}

.tree-relative-form-grid span,
.tree-relative-form-grid legend {
  color: #1b2e36;
  font-weight: 850;
}

.tree-relative-form-grid input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c6c6c6;
  border-radius: 0;
  padding: 8px 10px;
  background: #fff;
  color: #111;
  font: inherit;
  font-weight: 650;
}

.tree-relative-form-grid input:focus {
  border-color: #5ca100;
  outline: 2px solid rgba(92, 161, 0, 0.18);
  outline-offset: 0;
}

.tree-relative-panel .is-muted {
  opacity: 0.55;
}

@media (max-width: 560px) {
  .tree-relative-panel {
    width: 100%;
    padding: 28px 20px;
  }

  .tree-relative-options,
  .tree-relative-form-grid {
    grid-template-columns: 1fr;
  }
}

.person-media-modal,
.profile-image-modal {
  position: relative;
  width: min(960px, 100%);
  padding: 20px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}

.person-media-modal {
  width: min(1120px, 100%);
  padding: 0;
  overflow: hidden;
}

.person-media-hero {
  min-height: 88px;
  padding: 18px 64px 14px;
  background: #4b4b4b;
  color: #fff;
  text-align: center;
}

.person-media-hero h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.05;
}

.person-media-hero p {
  margin: 6px 0 0;
  font-size: 17px;
}

.person-media-form {
  display: grid;
  gap: 18px;
  padding: 24px 36px 26px;
}

.person-media-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
}

.person-media-toolbar p {
  margin: 0;
  text-align: center;
}

.link-action {
  border: 0;
  background: transparent;
  color: var(--teal);
  font-weight: 800;
  cursor: pointer;
}

.person-media-file-button {
  min-width: 112px;
  justify-content: center;
  border-radius: 999px;
  cursor: pointer;
}

.person-media-file-button input {
  display: none;
}

.person-media-drop {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 280px;
  padding: 34px 20px;
  border: 1.5px dashed var(--teal);
  border-radius: 8px;
  color: #0b5f72;
  text-align: center;
  background: #fff;
  cursor: pointer;
}

.person-media-drop.is-dragover {
  background: #eefaf8;
  box-shadow: inset 0 0 0 2px rgba(0, 121, 128, 0.2);
}

.person-media-drop p {
  margin: 0;
  max-width: 780px;
}

.person-media-icon {
  width: 56px;
  height: 56px;
}

.person-media-icon svg {
  width: 100%;
  height: 100%;
}

.person-media-icon path,
.person-media-icon circle {
  fill: none;
  stroke: #145a70;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.person-media-file-list {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #d9c68f;
  border-radius: 8px;
  background: #fff8e6;
}

.person-media-file-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff;
  color: #1f2933;
  font-weight: 800;
}

.person-media-file-item span:last-child {
  color: #54616d;
  font-weight: 700;
}

@media (max-width: 720px) {
  .person-media-hero {
    padding-inline: 42px;
  }

  .person-media-form {
    padding-inline: 18px;
  }

  .person-media-toolbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .person-media-toolbar p {
    text-align: left;
  }
}

.profile-image-modal h2 {
  margin: 0 44px 16px 0;
  color: #111;
  font-size: 22px;
}

.profile-image-form {
  display: grid;
  gap: 16px;
}

.profile-upload-panel {
  border: 1px solid #d2d2d2;
  border-radius: 8px;
  background: #fff;
}

.profile-upload-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid #e5e5e5;
  padding: 0 16px;
}

.profile-upload-drop {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 340px;
  padding: 34px 18px;
  text-align: center;
}

.profile-upload-drop.is-dragover {
  border-radius: 10px;
  background: #eefaf8;
  outline: 2px dashed var(--teal);
  outline-offset: -10px;
}

.profile-upload-drop p {
  max-width: 480px;
  margin: 0;
  color: #4c5560;
  font-weight: 650;
}

.profile-upload-preview {
  display: grid;
  place-items: center;
  width: min(220px, 58vw);
  aspect-ratio: 1;
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 78%, rgba(211, 185, 126, 0.35) 0 34%, transparent 35%),
    #fbf8ee;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.profile-upload-preview.has-image {
  border: 1px solid #d0c4a8;
  background-color: #f4f1e8;
}

.profile-upload-preview.has-image .profile-upload-illustration {
  display: none;
}

.profile-upload-illustration {
  width: 180px;
  height: 120px;
}

.profile-upload-illustration rect {
  fill: #c8b079;
}

.profile-upload-illustration circle {
  fill: #f4f1e8;
  stroke: #d8c18d;
  stroke-width: 4;
}

.profile-upload-illustration path {
  fill: none;
  stroke: #8dbb33;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-upload-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
}

.profile-upload-button input {
  display: none;
}

.relation-modal h2 {
  margin: 0 42px 20px 0;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #111;
  font-size: 34px;
  line-height: 1;
}

.relation-edit-section {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.relation-section-title,
.relation-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.relation-section-title h3 {
  margin: 0;
  font-size: 22px;
}

.relation-section-title button {
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  background: #dedbd6;
  font-weight: 800;
}

.relation-edit-row {
  grid-template-columns: 44px minmax(0, 1fr) 170px 42px;
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid #ddd5ca;
  border-radius: 6px;
  background: #fff;
}

.relation-edit-row > button {
  border: 0;
  background: transparent;
  font-size: 30px;
}

.relation-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: #dff2fb;
  background-image: url("../img/person-male.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: auto 88%;
}

.relation-avatar.female {
  background-color: #ffe3df;
  background-image: url("../img/person-female.png");
  background-size: auto 88%;
}

.relation-edit-row strong span {
  display: block;
  color: #4d5962;
  font-size: 13px;
}

.add-child-dropzone {
  display: flex;
  align-items: center;
  min-height: 62px;
  border: 2px dashed #bbb4aa;
  border-radius: 6px;
  background: transparent;
  color: #555;
  padding: 0 18px;
  font-size: 18px;
  font-weight: 800;
}

.geo-viewer {
  display: grid;
  gap: 14px;
}

.geo-view-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: thin;
}

.geo-view-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.geo-view-tabs button.active {
  background: var(--teal);
  color: #fff;
}

.geo-view-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.18fr);
  gap: 14px;
  min-width: 0;
}

.geo-list-card,
.geo-detail-card {
  min-height: 420px;
}

.geo-filter {
  margin-bottom: 12px;
}

.geo-list {
  display: grid;
  gap: 8px;
  max-height: 350px;
  overflow: auto;
  padding-right: 4px;
}

.geo-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  border: 1px solid #ead8ad;
  border-radius: 7px;
  background: #fff7e8;
  color: var(--ink);
  padding: 9px 12px;
  text-align: left;
}

.geo-list-row.active {
  border-color: var(--teal);
  background: #e8f5f2;
  box-shadow: inset 4px 0 0 var(--teal);
}

.geo-list-row strong,
.geo-list-row span {
  min-width: 0;
}

.geo-list-row strong {
  display: block;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.geo-list-row small {
  color: #5a4b35;
  font-weight: 700;
}

.geo-list-row span {
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.geo-detail-hero {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.image-slot {
  display: grid;
  place-items: center;
  min-height: 112px;
  border: 2px dashed #d4bb7c;
  border-radius: 8px;
  background: #fff7e8;
  color: #6a542b;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  overflow: hidden;
}

.image-slot.has-image {
  border-style: solid;
  background-color: #fff7e8;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.image-slot img,
.geo-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.geo-image-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.geo-gallery-item {
  display: grid;
  grid-template-rows: 92px auto;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #ead8ad;
  border-radius: 8px;
  background: #fff7e8;
}

.geo-gallery-item .image-slot {
  min-height: 92px;
  border: 0;
  border-bottom: 1px solid #ead8ad;
  border-radius: 0;
}

.geo-gallery-item span {
  display: block;
  overflow: hidden;
  padding: 8px 9px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.geo-detail-summary {
  display: grid;
  gap: 6px;
}

.geo-detail-summary strong {
  font-size: 22px;
  line-height: 1.2;
}

.geo-detail-summary span {
  color: #5a4b35;
  font-weight: 800;
}

.geo-detail-list {
  display: grid;
  grid-template-columns: minmax(120px, 0.45fr) minmax(0, 1fr);
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid #ead8ad;
  border-radius: 8px;
}

.geo-detail-list dt,
.geo-detail-list dd {
  margin: 0;
  min-height: 42px;
  padding: 11px 12px;
  background: #fff7e8;
}

.geo-detail-list dt {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.geo-detail-list dd {
  background: #fffdf7;
  font-weight: 700;
}

@media (max-width: 960px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 14px 14px 10px;
  }

  .history-controls,
  .account-controls {
    justify-content: center;
  }

  .brand-block {
    order: -1;
  }

  .brand-block.brand-anorix {
    flex-wrap: wrap;
    gap: 12px 20px;
  }

  .brand-block h1 {
    font-size: 25px;
  }

  .anorix-logo {
    width: 106px;
    height: 106px;
    margin: -6px 0;
  }

  .brand-byline {
    font-size: 24px;
  }

  .brand-logo.sfba-logo {
    width: 124px;
    height: 50px;
  }

  .workspace {
    padding: 14px;
  }

  .stat-grid,
  .two-columns,
  .three-columns,
  .record-grid,
  .search-panel,
  .statistics-filter-form,
  .statistics-grid,
  .geo-form,
  .city-map-form {
    grid-template-columns: 1fr 1fr;
  }

  .tree-import-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .statistics-actions {
    grid-column: 1 / -1;
  }

  .indata-layout {
    grid-template-columns: 1fr;
  }

  .indata-editor-layout {
    grid-template-columns: 1fr;
  }

  .indata-menu {
    display: flex;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: thin;
  }

  .indata-menu button {
    flex: 0 0 auto;
  }

  .geo-view-grid {
    grid-template-columns: 1fr;
  }

  .tree-stage {
    grid-template-columns: 1fr;
  }

  .tree-toolrail {
    grid-template-columns: repeat(7, 40px);
    width: auto;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  }

  .tree-map-header,
  .pedigree-map {
    min-width: 760px;
  }

  .pedigree-map.ancestry-tree {
    min-width: 1220px;
  }

  .person-detail-grid,
  .person-search-workbench,
  .registry-search-workbench,
  .family-board,
  .rut-layout,
  .rut-knowledge-layout,
  .ai-settings-overview,
  .ai-work-areas,
  .project-layout,
  .city-map-input-grid,
  .city-map-layout,
  .dna-import-grid,
  .dna-form,
  .dna-layout,
  .dna-gedcom-import-layout,
  .dna-step-tabs,
  .dna-step-panel,
  .person-indata-layout,
  .dna-project-workspace,
  .dna-match-workspace,
  .about-card,
  .dna-intro-card {
    grid-template-columns: 1fr 1fr;
  }

  .person-search-fields {
    grid-template-columns: 1fr 1fr;
  }

  .city-map-layout {
    grid-template-columns: 1fr;
  }

  .dna-tree-import-item {
    grid-template-columns: 1fr;
  }

  .dna-tree-candidate-detail {
    grid-template-columns: 1fr;
  }

  .dna-tree-import-item b {
    justify-self: start;
  }

  .city-map-input-grid {
    grid-template-columns: 1fr;
  }

  .city-map-info {
    position: static;
  }

  .project-sidebar,
  .project-report-column {
    position: static;
  }

  .search-panel .primary-action {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .brand-block.brand-anorix {
    gap: 8px 12px;
  }

  .brand-block h1 {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 8px;
    max-width: 340px;
    font-size: 21px;
  }

  .brand-block h1 strong:first-child {
    flex-basis: 100%;
  }

  .brand-block h1 span {
    margin-left: 0;
    margin-right: 0;
  }

  .brand-logo {
    width: 118px;
    height: 48px;
    padding: 2px 13px;
  }

  .anorix-logo {
    width: 86px;
    height: 86px;
    margin: -2px 0;
    border-radius: 13px;
  }

  .brand-byline {
    order: 3;
    flex: 0 1 100%;
    font-size: 18px;
    text-align: center;
    white-space: normal;
  }

  .brand-logo.sfba-logo {
    order: 2;
    width: 108px;
    height: 44px;
  }

  .workbench {
    min-height: 0;
  }

  .module-tabs {
    padding-left: 12px;
    padding-right: 12px;
  }

  .tab-button {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
    padding: 0 8px;
    font-size: 13px;
  }

  .tab-button.icon-only {
    flex: 0 0 44px;
  }

  .tree-import-metrics {
    grid-template-columns: 1fr;
  }

  .view-stack {
    padding: 12px;
  }

  .section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .stat-grid,
  .two-columns,
  .three-columns,
  .record-grid,
  .compact-form,
  .search-panel,
  .statistics-filter-form,
  .statistics-grid,
  .geo-form,
  .dna-form,
  .dna-import-grid,
  .dna-step-tabs,
  .dna-step-panel,
  .person-indata-layout,
  .city-map-form {
    grid-template-columns: 1fr;
  }

  .about-card {
    grid-template-columns: 1fr;
  }

  .statistics-actions,
  .statistics-bar-row,
  .statistics-list-row {
    grid-template-columns: 1fr;
  }

  .statistics-bar-row strong,
  .statistics-list-row span {
    text-align: left;
    white-space: normal;
  }

  .form-actions {
    flex-direction: column;
  }

  .save-status {
    margin-right: 0;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .tree-actions,
  .tree-map-header,
  .gedcom-step-list,
  .profile-hero,
  .person-detail-grid,
  .person-search-workbench,
  .registry-search-workbench,
  .family-board,
  .rut-layout,
  .rut-knowledge-layout,
  .ai-settings-overview,
  .ai-work-areas,
  .rut-form-row,
  .project-layout,
  .project-form,
  .project-step-form,
  .project-document-form,
  .city-map-input-grid,
  .city-map-layout,
  .dna-import-grid,
  .dna-form,
  .dna-layout,
  .dna-step-tabs,
  .dna-step-panel,
  .dna-project-workspace,
  .dna-match-workspace,
  .dna-intro-card,
  .dna-cm-tool,
  .dna-metric-row {
    grid-template-columns: 1fr;
  }

  .person-search-fields {
    grid-template-columns: 1fr;
  }

  .tree-map-header {
    align-items: stretch;
  }

  .profile-hero,
  .person-detail-grid,
  .family-board,
  .rut-layout,
  .project-layout,
  .dna-project-workspace,
  .dna-match-workspace,
  .city-map-input-grid,
  .city-map-layout,
  .dna-import-grid,
  .dna-form,
  .dna-layout,
  .dna-intro-card {
    display: grid;
  }

  .city-map-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .city-map-canvas {
    min-height: 430px;
    padding: 10px;
  }

  .city-map-settings .city-map-form,
  .city-map-step-grid,
  .city-map-picker {
    grid-template-columns: 1fr;
  }

  .dna-project-match-item,
  .dna-image-import-item {
    grid-template-columns: 1fr;
  }

  .project-step-head {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .project-step-delete {
    grid-column: 1 / -1;
    width: 100%;
  }

  .project-document-item {
    display: grid;
  }

  .rut-profile {
    grid-template-columns: 118px minmax(0, 1fr);
  }

  .rut-portrait {
    min-height: 150px;
  }

  .rut-portrait img {
    max-height: 172px;
  }

  .profile-summary h3 {
    font-size: 26px;
  }

  .relation-section-title,
  .relation-edit-row {
    grid-template-columns: 1fr;
  }

  .geo-detail-hero,
  .geo-detail-list,
  .geo-image-strip {
    grid-template-columns: 1fr;
  }

  .geo-list-row {
    grid-template-columns: 1fr;
  }

  .geo-list-row span:last-child {
    justify-self: start;
  }

  .workbench::before,
  .workbench::after {
    height: 96px;
  }
}

.analysis-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
}

.analysis-toolbar .primary-action,
.analysis-toolbar .secondary-action {
  min-height: 42px;
}

.analysis-toolbar-check {
  align-items: center;
  background: #fffdf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 900;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
}

.analysis-toolbar-check input {
  accent-color: var(--teal);
  height: 18px;
  width: 18px;
}

.analysis-settings-card,
.analysis-proband-card,
.analysis-selected-proband,
.analysis-builder-layout {
  margin-top: 14px;
}

.analysis-settings-grid,
.analysis-search-grid {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.analysis-search-grid label,
.analysis-settings-grid label {
  color: var(--ink);
  display: grid;
  font-weight: 800;
  gap: 6px;
}

.analysis-search-grid input,
.analysis-search-grid select,
.analysis-settings-grid input,
.analysis-settings-grid select {
  background: #fffdf7;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font: inherit;
  padding: 10px 12px;
  width: 100%;
}

.analysis-settings-grid .checkbox-row {
  align-items: center;
  display: flex;
  gap: 8px;
  min-height: 44px;
}

.analysis-settings-grid .checkbox-row input {
  width: auto;
}

.analysis-proband-panels {
  display: grid;
  gap: 14px;
}

.analysis-proband-results {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 280px;
  overflow: auto;
}

.analysis-proband-loading,
.analysis-proband-error {
  align-items: center;
  background: #fffdf7;
  border: 1px solid rgba(14, 109, 111, 0.22);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  gap: 14px;
  min-height: 96px;
  padding: 18px;
}

.analysis-proband-loading > div,
.analysis-proband-error > div {
  display: grid;
  gap: 4px;
}

.analysis-proband-loading strong,
.analysis-proband-error strong {
  color: var(--teal);
  font-size: 18px;
}

.analysis-proband-loading span,
.analysis-proband-error span {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.analysis-proband-result {
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 12px;
}

.analysis-proband-result strong {
  color: var(--burgundy);
  display: block;
  font-size: 17px;
}

.analysis-selected-proband {
  align-items: center;
  background: #fff8e6;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  padding: 12px 16px;
}

.analysis-selected-copy {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.analysis-selected-copy strong {
  color: var(--teal);
  font-size: 18px;
}

.analysis-selected-copy span {
  font-weight: 800;
}

.analysis-selected-avatar,
.analysis-node-avatar,
.analysis-candidate-avatar {
  background-color: #eef5f5;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  color: var(--teal);
  display: inline-grid;
  flex: 0 0 auto;
  font-weight: 900;
  place-items: center;
}

.analysis-selected-avatar {
  border: 2px solid #fff;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0,0,0,.18);
  height: 74px;
  width: 64px;
}

.analysis-node-avatar {
  border-radius: 6px;
  height: 50px;
  justify-self: center;
  width: 58px;
}

.analysis-candidate-avatar {
  border-radius: 6px;
  height: 52px;
  width: 46px;
}

.analysis-selected-avatar.male,
.analysis-node-avatar.male,
.analysis-candidate-avatar.male {
  background-color: #dff2fb;
  background-image: url("../img/person-male.png");
  background-position: center bottom;
  background-size: auto 78px;
}

.analysis-selected-avatar.female,
.analysis-node-avatar.female,
.analysis-candidate-avatar.female {
  background-color: #ffe3df;
  background-image: url("../img/person-female.png");
  background-position: center bottom;
  background-size: auto 78px;
}

.analysis-node-avatar.male,
.analysis-node-avatar.female {
  background-size: auto 60px;
}

.analysis-selected-avatar.photo,
.analysis-node-avatar.photo,
.analysis-candidate-avatar.photo {
  background-size: cover;
}

.analysis-builder-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.analysis-workspace {
  background: #454545;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  min-height: 560px;
  overflow: hidden;
  position: relative;
}

.analysis-workspace-head {
  align-items: center;
  background: rgba(0,0,0,.18);
  color: #fff;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 16px;
}

.analysis-workspace-head h3,
.analysis-workspace-head p {
  margin: 0;
}

.analysis-workspace-head p {
  color: rgba(255,255,255,.78);
  font-weight: 700;
}

.analysis-workspace-busy {
  align-items: center;
  background: rgba(28, 28, 28, 0.68);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 28px;
  position: absolute;
  z-index: 30;
}

.analysis-workspace-busy[hidden] {
  display: none;
}

.analysis-workspace-busy-card {
  align-items: center;
  background: rgba(255, 248, 230, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  color: var(--ink);
  display: grid;
  gap: 16px;
  grid-template-columns: 38px minmax(0, 1fr);
  max-width: 560px;
  padding: 20px 22px;
  width: min(100%, 560px);
}

.analysis-workspace-busy-copy {
  display: grid;
  gap: 6px;
}

.analysis-workspace-busy-copy strong {
  color: var(--burgundy);
  font-size: 26px;
  line-height: 1.05;
}

.analysis-workspace-busy-copy span {
  color: var(--ink);
  font-weight: 800;
  line-height: 1.35;
}

.analysis-workspace-spinner,
.analysis-proband-spinner {
  border-radius: 50%;
  border: 4px solid rgba(14, 109, 111, 0.18);
  border-top-color: var(--teal);
  display: inline-block;
  flex: 0 0 auto;
  height: 32px;
  width: 32px;
  animation: rut-thinking-spin 0.85s linear infinite;
}

.analysis-canvas {
  background-color: #454545;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 82px 82px;
  cursor: grab;
  min-height: 620px;
  overflow: hidden;
  position: relative;
  touch-action: none;
  user-select: none;
}

.analysis-canvas.is-panning {
  cursor: grabbing;
}

.analysis-canvas.is-panning * {
  cursor: grabbing !important;
}

.analysis-person-popover {
  align-items: start;
  background: #fff;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0,0,0,.28);
  display: grid;
  gap: 12px;
  grid-template-columns: 86px minmax(0, 1fr);
  max-width: calc(100% - 24px);
  padding: 14px 18px 14px 14px;
  position: absolute;
  width: min(430px, calc(100% - 24px));
  z-index: 20;
}

.analysis-person-popover[hidden] {
  display: none;
}

.analysis-popover-avatar {
  align-items: center;
  aspect-ratio: 1;
  background-color: #eef5f5;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  border-radius: 5px;
  color: var(--teal);
  display: grid;
  font-size: 24px;
  font-weight: 900;
  justify-items: center;
  overflow: hidden;
}

.analysis-popover-avatar.male {
  background-color: #dff2fb;
  background-image: url("../img/person-male.png");
  background-size: auto 92%;
}

.analysis-popover-avatar.female {
  background-color: #ffe3df;
  background-image: url("../img/person-female.png");
  background-size: auto 92%;
}

.analysis-popover-avatar.photo {
  background-color: #dfe9ef;
  background-size: cover;
}

.analysis-popover-body h3 {
  color: var(--teal);
  font-size: 24px;
  line-height: 1.05;
  margin: 0 26px 8px 0;
}

.analysis-popover-body p {
  color: #111;
  font-weight: 800;
  line-height: 1.2;
  margin: 3px 0;
}

.analysis-canvas-inner {
  min-height: 620px;
  min-width: 1100px;
  position: relative;
  transform-origin: 0 0;
  will-change: transform;
}

.analysis-connectors {
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 1;
}

.analysis-node {
  background: #fffdf8;
  border: 3px solid #f0f0f0;
  border-radius: 8px;
  box-sizing: border-box;
  box-shadow: 0 10px 20px rgba(0,0,0,.25);
  color: #0d1f2c;
  display: grid;
  gap: 2px;
  grid-template-rows: 24px 50px 34px 15px 15px 14px;
  height: 176px;
  overflow: hidden;
  padding: 6px 9px 8px;
  position: absolute;
  text-align: center;
  width: 142px;
  z-index: 2;
  cursor: pointer;
  user-select: none;
}

.analysis-node * {
  cursor: pointer;
}

.analysis-node[data-status="proband"] {
  border-color: #7ac943;
}

.analysis-node[data-status="confirmed"] {
  border-color: #0f7c80;
}

.analysis-node[data-status="awaiting_confirmation"] {
  border-color: #e0a41f;
}

.analysis-node[data-status="not_found"],
.analysis-node[data-status="rejected"] {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.55);
  color: #fff;
}

.analysis-node.is-active-candidate {
  background: #fff78f;
  border-color: #e0a41f;
  box-shadow: 0 0 0 3px rgba(224,164,31,.24), 0 12px 24px rgba(0,0,0,.3);
  color: #0d1f2c;
  z-index: 4;
}

.analysis-node-number {
  background: var(--teal);
  border-radius: 999px;
  color: #fff;
  font-weight: 900;
  justify-self: center;
  line-height: 24px;
  min-width: 24px;
  padding: 0 7px;
}

.analysis-node-name {
  color: var(--burgundy);
  display: -webkit-box;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.1;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.analysis-node-date,
.analysis-node-place,
.analysis-node-source {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-node-source {
  color: var(--teal);
}

.analysis-side {
  align-content: start;
  display: grid;
  gap: 14px;
}

.analysis-candidate-list,
.analysis-log-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.analysis-candidate-card,
.analysis-log-item {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.analysis-candidate-card.is-active-candidate {
  background: #fff78f;
  border-color: #e0a41f;
  box-shadow: inset 0 0 0 2px rgba(224,164,31,.18);
}

.analysis-candidate-head {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.analysis-candidate-card strong {
  color: var(--teal);
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}

.analysis-candidate-meta,
.analysis-log-meta {
  color: #42566a;
  font-size: 13px;
  font-weight: 800;
}

.analysis-candidate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.analysis-confirm-question {
  color: var(--burgundy);
  font-weight: 900;
  margin: 10px 0 0;
}

.analysis-log-item[data-level="success"] {
  border-left: 5px solid #0f7c80;
}

.analysis-log-item[data-level="warning"] {
  border-left: 5px solid #d28b00;
}

.analysis-log-item[data-level="error"] {
  border-left: 5px solid #b00020;
}

@media (max-width: 1100px) {
  .analysis-builder-layout {
    grid-template-columns: 1fr;
  }

  .analysis-settings-grid,
  .analysis-search-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 720px) {
  .analysis-settings-grid,
  .analysis-search-grid,
  .analysis-proband-result {
    grid-template-columns: 1fr;
  }
}

.print-workbench {
  display: grid;
  gap: 14px;
}

.print-report-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.print-report-tabs button {
  min-height: 42px;
  border: 1px solid #d9bb76;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 16px;
  font-weight: 900;
}

.print-report-tabs button.active {
  border-color: rgba(14, 109, 111, 0.65);
  background: var(--teal);
  color: #fff;
}

.print-report-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.36fr) minmax(520px, 1fr);
  gap: 16px;
  align-items: start;
}

.print-workbench[data-report="antavla"] .print-report-layout,
.print-workbench[data-report="grafisk-antavla"] .print-report-layout {
  grid-template-columns: 1fr;
}

.print-workbench[data-report="antavla"] .print-search-panel,
.print-workbench[data-report="grafisk-antavla"] .print-search-panel {
  display: none;
}

.print-search-panel,
.print-preview-panel {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 250, 239, 0.92);
  padding: 16px;
  box-shadow: 0 10px 22px rgba(67, 38, 0, 0.12);
}

.print-person-search-form {
  display: grid;
  gap: 10px;
}

.print-person-search-form label {
  display: grid;
  gap: 5px;
  color: #3d2500;
  font-size: 13px;
  font-weight: 900;
}

.print-person-search-form input {
  min-height: 38px;
  border: 1px solid #d9bb76;
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
  color: var(--ink);
  font-weight: 750;
}

.print-search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.print-antavla-controls {
  border: 1px solid #e1c98e;
  border-radius: 8px;
  background: #fff7e8;
  margin-bottom: 14px;
  padding: 14px;
}

.print-antavla-form {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(160px, 0.24fr) minmax(160px, 0.24fr) auto;
  gap: 10px;
  align-items: end;
}

.print-antavla-form label {
  display: grid;
  gap: 5px;
  color: #3d2500;
  font-size: 13px;
  font-weight: 900;
}

.print-antavla-form select {
  min-height: 40px;
  border: 1px solid #d9bb76;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  font-weight: 850;
}

/* Textstorleksvalet ska vinna över specialformulär som SÖK, ANALYSERA och UTSKRIFT. */
body[data-input-text-size] :is(
  .person-search-mode > span,
  .registry-field-inline > span,
  .registry-place-options strong,
  .person-search-fields label,
  .registry-field-inline label,
  .registry-checkbox-row label,
  .registry-place-options label,
  .analysis-settings-grid label,
  .analysis-toolbar-check,
  .checkbox-field,
  .print-person-search-form label,
  .print-antavla-form label,
  .tree-person-edit-grid label,
  .person-edit-form label
) {
  font-size: var(--input-label-font-size) !important;
  line-height: var(--input-text-line-height);
}

body[data-input-text-size] :is(
  .person-search-mode label,
  .registry-field-inline label,
  .registry-checkbox-row label,
  .registry-place-options label,
  .analysis-toolbar-check,
  .checkbox-field
) {
  min-height: max(32px, calc(var(--input-control-min-height) * 0.72));
}

body[data-input-text-size] :is(
  .person-search-fields input,
  .registry-age-range input,
  .registry-place-row > input,
  .analysis-settings-grid input,
  .analysis-settings-grid select,
  .analysis-search-grid input,
  .analysis-search-grid select,
  .print-person-search-form input,
  .print-antavla-form select,
  .tree-person-edit-grid input,
  .tree-person-edit-grid select,
  .tree-person-edit-grid textarea,
  .person-edit-form input,
  .person-edit-form select,
  .person-edit-form textarea
) {
  min-height: var(--input-control-min-height) !important;
  padding-right: var(--input-control-padding-x) !important;
  padding-left: var(--input-control-padding-x) !important;
  font-size: var(--input-text-font-size) !important;
  line-height: var(--input-text-line-height) !important;
}

body[data-input-text-size] :is(
  .tree-person-edit-grid textarea,
  .person-edit-form textarea
) {
  min-height: var(--input-textarea-min-height) !important;
  padding: var(--input-control-padding-y) var(--input-control-padding-x) !important;
}

body[data-input-text-size] :is(
  .registry-field-inline input,
  .registry-checkbox-row input,
  .registry-place-options input,
  .checkbox-field input,
  .analysis-toolbar-check input
) {
  width: clamp(16px, calc(var(--input-text-font-size) * 1.08), 26px);
  min-width: clamp(16px, calc(var(--input-text-font-size) * 1.08), 26px);
  min-height: clamp(16px, calc(var(--input-text-font-size) * 1.08), 26px);
}

body[data-input-text-size] .person-search-mode label {
  min-height: max(36px, var(--input-button-min-height));
  padding-right: var(--input-control-padding-x);
  padding-left: var(--input-control-padding-x);
  font-size: var(--input-text-font-size) !important;
  line-height: var(--input-text-line-height);
}

body[data-input-text-size] .person-search-actions button,
body[data-input-text-size] .registry-search-form button,
body[data-input-text-size] .print-person-search-form button {
  min-height: var(--input-button-min-height);
  font-size: var(--input-text-font-size);
  line-height: var(--input-text-line-height);
}

:where(label) > input[type="radio"],
.rut-source-mode input[type="radio"],
.person-search-mode input[type="radio"],
.registry-field-inline input[type="radio"],
.registry-place-options input[type="radio"],
.inline-choice-field input[type="radio"],
.segmented-control input[type="radio"] {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 clamp(28px, 1.8em, 34px);
  inline-size: clamp(28px, 1.8em, 34px);
  block-size: clamp(28px, 1.8em, 34px);
  min-inline-size: clamp(28px, 1.8em, 34px);
  min-block-size: clamp(28px, 1.8em, 34px);
  max-inline-size: clamp(28px, 1.8em, 34px);
  max-block-size: clamp(28px, 1.8em, 34px);
  margin: 0;
  padding: 0;
  border: 2px solid #1b1b1b;
  border-radius: 999px;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(242, 219, 156, 0.42) 100%);
  opacity: 1;
  overflow: hidden;
  pointer-events: auto;
  line-height: 1;
  vertical-align: middle;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transform: none;
}

:where(label) > input[type="radio"]::before,
.rut-source-mode input[type="radio"]::before,
.person-search-mode input[type="radio"]::before,
.registry-field-inline input[type="radio"]::before,
.registry-place-options input[type="radio"]::before,
.inline-choice-field input[type="radio"]::before,
.segmented-control input[type="radio"]::before {
  content: "\265B";
  color: #8b4c00;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(18px, 1.12em, 24px);
  font-weight: 900;
  line-height: 1;
  opacity: 0.5;
  transform: translateY(-1px) scale(0.82);
  transition: transform 0.15s ease, opacity 0.15s ease, color 0.15s ease;
}

:where(label) > input[type="radio"]:checked,
.rut-source-mode input[type="radio"]:checked,
.person-search-mode input[type="radio"]:checked,
.registry-field-inline input[type="radio"]:checked,
.registry-place-options input[type="radio"]:checked,
.inline-choice-field input[type="radio"]:checked,
.segmented-control input[type="radio"]:checked {
  border-color: #070707;
  background: radial-gradient(circle at 50% 58%, #fff4b5 0 34%, #d7a51d 35% 64%, #8b4c00 65% 100%);
  box-shadow:
    0 0 0 4px rgba(255, 236, 142, 0.28),
    0 5px 10px rgba(0, 0, 0, 0.18);
}

:where(label) > input[type="radio"]:checked::before,
.rut-source-mode input[type="radio"]:checked::before,
.person-search-mode input[type="radio"]:checked::before,
.registry-field-inline input[type="radio"]:checked::before,
.registry-place-options input[type="radio"]:checked::before,
.inline-choice-field input[type="radio"]:checked::before,
.segmented-control input[type="radio"]:checked::before {
  color: #7a4200;
  opacity: 1;
  transform: translateY(-1px) scale(0.98);
}

:where(label) > input[type="radio"]:focus-visible,
.rut-source-mode input[type="radio"]:focus-visible,
.person-search-mode input[type="radio"]:focus-visible,
.registry-field-inline input[type="radio"]:focus-visible,
.registry-place-options input[type="radio"]:focus-visible,
.inline-choice-field input[type="radio"]:focus-visible,
.segmented-control input[type="radio"]:focus-visible {
  outline: 3px solid rgba(7, 19, 30, 0.72) !important;
  outline-offset: 3px;
}

:where(label) > input[type="radio"]:disabled,
.rut-source-mode input[type="radio"]:disabled,
.person-search-mode input[type="radio"]:disabled,
.registry-field-inline input[type="radio"]:disabled,
.registry-place-options input[type="radio"]:disabled,
.inline-choice-field input[type="radio"]:disabled,
.segmented-control input[type="radio"]:disabled {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.44;
}

.rut-source-mode span::before {
  display: none;
  content: none;
}

:where(button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(7, 19, 30, 0.72) !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(255, 250, 240, 0.72);
}

:where(.primary-action, .tab-button.active, .settings-area-button.active):focus-visible {
  outline-color: rgba(255, 255, 255, 0.92) !important;
  box-shadow:
    0 0 0 4px rgba(7, 19, 30, 0.42),
    0 2px 0 rgba(0, 0, 0, 0.12);
}

.print-search-results {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  margin-top: 14px;
  padding-right: 4px;
}

.print-preview-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.print-preview-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.print-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid #e1c98e;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.print-zoom-controls[hidden] {
  display: none !important;
}

.print-zoom-controls button {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: #fff;
  color: #111;
  font-weight: 950;
  cursor: pointer;
}

.print-zoom-controls button:hover,
.print-zoom-controls button:focus-visible {
  background: var(--teal);
  color: #fff;
  outline: none;
}

.print-zoom-controls span {
  min-width: 56px;
  color: var(--teal);
  font-weight: 950;
  text-align: center;
}

.print-preview-toolbar h3 {
  margin: 0 0 4px;
}

.print-preview-toolbar p {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 800;
}

.print-preview {
  max-width: 100%;
  min-height: 560px;
  border: 1px solid #e1c98e;
  border-radius: 8px;
  background: #fff;
  color: #111;
  padding: 22px;
}

.print-preview.print-antavla {
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  background: #f6eddc;
  padding: 16px;
}

.print-preview.print-graphic-antavla {
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  background: #f6eddc;
  padding: 16px;
}

.print-graphic-antavla-stage {
  position: relative;
  width: 1062px;
  height: 751px;
  margin: 0 auto;
}

.print-empty-state {
  display: grid;
  place-items: center;
  min-height: 430px;
  gap: 8px;
  color: #46596b;
  text-align: center;
}

.print-empty-state strong {
  color: var(--teal);
  font-size: 24px;
}

.print-ansedel {
  display: grid;
  gap: 16px;
  font-family: Arial, Helvetica, sans-serif;
}

.print-ansedel-header {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  border-bottom: 3px solid #0e6d6f;
  padding-bottom: 14px;
}

.print-person-photo,
.print-relation-photo {
  display: grid;
  place-items: center;
  overflow: hidden;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  color: #fff;
  font-weight: 950;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.print-person-photo {
  width: 112px;
  height: 112px;
  border-radius: 8px;
  background: linear-gradient(135deg, #dbeef8, #0e6d6f);
  font-size: 36px;
}

.print-person-photo.female,
.print-relation-photo.female {
  background: linear-gradient(135deg, #fde4df, #b6402b);
}

.print-person-photo.unknown,
.print-relation-photo.unknown {
  background: linear-gradient(135deg, #ece4d6, #5e6670);
}

.print-person-photo.has-photo,
.print-relation-photo.has-photo {
  background-color: #fff;
  border: 1px solid #d8c19a;
}

.print-person-photo img,
.print-relation-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.print-kicker {
  margin: 0 0 4px;
  color: #8f1020;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.print-ansedel h1 {
  margin: 0 0 6px;
  color: #0e6d6f;
  font-size: 32px;
  line-height: 1.12;
}

.print-ansedel p {
  margin: 0;
}

.print-report-section {
  display: grid;
  gap: 8px;
}

.print-report-section h3 {
  margin: 0;
  border-bottom: 1px solid #d8c19a;
  color: #07131e;
  font-size: 18px;
  padding-bottom: 4px;
}

.print-info-table,
.print-event-table {
  width: 100%;
  border-collapse: collapse;
}

.print-info-table th,
.print-info-table td,
.print-event-table th,
.print-event-table td {
  border-bottom: 1px solid #eadcc2;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.print-info-table th {
  width: 185px;
  color: #36495c;
  font-weight: 900;
}

.print-event-table th {
  background: #f5ead5;
  color: #36495c;
}

.print-family-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.print-relation-list,
.print-source-list {
  display: grid;
  gap: 8px;
}

.print-relation-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid #e4c783;
  border-radius: 7px;
  background: #fffaf0;
  padding: 8px;
}

.print-relation-photo {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: linear-gradient(135deg, #dbeef8, #0e6d6f);
  font-size: 16px;
}

.print-relation-card strong,
.print-relation-card span,
.print-relation-card small,
.print-source-card strong,
.print-source-card span {
  display: block;
}

.print-relation-card strong {
  color: #0e6d6f;
}

.print-relation-card span,
.print-relation-card small,
.print-source-card span,
.print-muted {
  color: #42566a;
  font-weight: 800;
}

.print-source-card {
  border: 1px solid #e4c783;
  border-radius: 7px;
  background: #fffaf0;
  padding: 10px 12px;
}

.print-report-footer {
  border-top: 1px solid #d8c19a;
  color: #4d5962;
  font-size: 12px;
  font-weight: 800;
  padding-top: 8px;
  text-align: right;
}

.print-antavla-page {
  min-width: 1080px;
  max-width: none;
  border: 1px solid #c9a64e;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,248,231,0.92)),
    radial-gradient(circle at 50% 44%, rgba(14,109,111,0.08), transparent 34%),
    #fff8e7;
  box-shadow: 0 10px 22px rgba(58, 36, 0, 0.16);
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
  padding: 20px;
}

.print-antavla-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  border-bottom: 3px solid #0e6d6f;
  margin-bottom: 18px;
  padding-bottom: 12px;
}

.print-antavla-header h1 {
  margin: 0 0 5px;
  color: #0e6d6f;
  font-size: 30px;
  line-height: 1.12;
}

.print-antavla-header p {
  margin: 0;
  color: #40556a;
  font-weight: 800;
}

.print-antavla-header > strong {
  color: #8f1020;
  font-size: 20px;
  letter-spacing: .04em;
}

.print-antavla-chart {
  display: grid;
  gap: 14px;
  min-width: max-content;
}

.print-ancestor-generation {
  display: grid;
  gap: 8px;
  align-items: stretch;
}

.print-ancestor-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 96px;
  border: 1px solid #c9a64e;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 10px rgba(65, 38, 0, 0.11);
  overflow: hidden;
  padding: 21px 8px 8px;
}

.print-ancestor-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: #0e6d6f;
}

.print-ancestor-card.is-missing {
  border-style: dashed;
  background: rgba(255, 250, 239, 0.7);
  color: #5d6872;
}

.print-ancestor-code {
  position: absolute;
  top: 7px;
  right: 7px;
  border-radius: 999px;
  background: #e7f2e6;
  color: #0e6d6f;
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
  padding: 4px 7px;
}

.print-ancestor-card strong {
  color: #0e6d6f;
  font-size: 13px;
  line-height: 1.08;
}

.print-ancestor-card span:not(.print-ancestor-code) {
  color: #182536;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.18;
}

.generation-4 .print-ancestor-card strong,
.generation-5 .print-ancestor-card strong {
  font-size: 11px;
}

.generation-4 .print-ancestor-card span:not(.print-ancestor-code),
.generation-5 .print-ancestor-card span:not(.print-ancestor-code) {
  font-size: 9px;
}

.print-graphic-antavla-page {
  position: relative;
  width: 1062px;
  min-width: 1062px;
  aspect-ratio: 1062 / 751;
  margin: 0;
  border: 1px solid #c9a64e;
  border-radius: 8px;
  background: #f2ead7;
  box-shadow: 0 10px 22px rgba(58, 36, 0, 0.16);
  overflow: hidden;
  color: #111;
  font-family: Georgia, "Times New Roman", serif;
}

.print-graphic-antavla-bg {
  display: block;
  width: 100%;
  height: auto;
}

.print-graphic-antavla-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.graphic-ancestor-slot {
  position: absolute;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1px;
  box-sizing: border-box;
  padding: 6px 8px;
  color: #111;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.78);
  overflow: hidden;
}

.graphic-ancestor-slot strong,
.graphic-ancestor-slot span {
  display: block;
  max-width: 100%;
}

.graphic-ancestor-slot strong {
  color: #111;
  font-size: 13px;
  font-weight: 950;
  line-height: 1.06;
}

.graphic-ancestor-slot span {
  font-size: 9px;
  font-weight: 800;
  line-height: 1.12;
}

.graphic-ancestor-slot.compact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 2px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.graphic-ancestor-slot.compact strong {
  font-size: 10px;
  line-height: 1;
}

.graphic-ancestor-slot.compact span {
  font-size: 7px;
  line-height: 1;
}

.graphic-ancestor-slot.tiny strong {
  font-size: 8px;
}

.graphic-ancestor-slot.tiny span {
  font-size: 6px;
}

.graphic-ancestor-slot.is-missing {
  opacity: 0.55;
}

.graphic-ancestor-code {
  position: absolute;
  top: 2px;
  left: 3px;
  color: #2367b1;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 7px !important;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
}

.graphic-ancestor-slot.compact .graphic-ancestor-code {
  transform: rotate(180deg);
}

.print-graphic-antavla-meta {
  position: absolute;
  left: 42%;
  right: 32.5%;
  bottom: 0.35%;
  display: grid;
  justify-items: center;
  gap: 1px;
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 6px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}

@media (max-width: 1080px) {
  .print-report-layout,
  .print-family-grid {
    grid-template-columns: 1fr;
  }

  .print-preview-toolbar {
    display: grid;
  }

  .print-antavla-form {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff !important;
  }

  body.printing-report .topbar,
  body.printing-report .module-tabs,
  body.printing-report .main-nav,
  body.printing-report .section-header,
  body.printing-report .print-report-tabs,
  body.printing-report .print-search-panel,
  body.printing-report .print-preview-toolbar,
  body.printing-report .print-antavla-controls,
  body.printing-report .modal-backdrop,
  body.printing-report .registry-result-menu,
  .topbar,
  .module-tabs,
  .main-nav,
  .section-header,
  .print-report-tabs,
  .print-search-panel,
  .print-preview-toolbar,
  .print-antavla-controls,
  .modal-backdrop,
  .registry-result-menu {
    display: none !important;
  }

  body.printing-report .app-shell,
  body.printing-report .workspace,
  body.printing-report .workbench,
  body.printing-report .app-frame,
  body.printing-report .view-stack,
  body.printing-report #utskrift,
  body.printing-report .print-workbench,
  body.printing-report .print-report-layout,
  body.printing-report .print-preview-panel,
  .app-shell,
  .workspace,
  .workbench,
  .app-frame,
  .view-stack,
  #utskrift,
  .print-workbench,
  .print-report-layout,
  .print-preview-panel {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .view:not(#utskrift) {
    display: none !important;
  }

  .print-preview {
    min-height: 0;
    border: 0;
    border-radius: 0;
    padding: 0;
  }

  .print-ansedel {
    color: #000;
    font-size: 11pt;
  }

  .print-ansedel h1 {
    font-size: 24pt;
  }

  body.printing-antavla .print-antavla-page {
    min-width: 0 !important;
    width: 287mm !important;
    max-width: 287mm !important;
    min-height: 0 !important;
    max-height: 200mm !important;
    box-sizing: border-box !important;
    padding: 4mm !important;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.printing-antavla.printing-portrait .print-antavla-page {
    width: 200mm !important;
    max-width: 200mm !important;
    max-height: none !important;
    padding: 5mm !important;
  }

  body.printing-antavla.printing-landscape .print-antavla-page {
    width: 287mm !important;
    max-width: 287mm !important;
    max-height: 200mm !important;
  }

  body.printing-antavla .print-preview {
    overflow: visible;
  }

  body.printing-antavla #utskrift {
    width: auto !important;
  }

  body.printing-antavla .print-antavla-header {
    gap: 6mm;
    margin-bottom: 2mm;
    padding-bottom: 2mm;
    border-bottom-width: 0.7mm;
  }

  body.printing-antavla .print-antavla-header h1 {
    margin-bottom: 1mm;
    font-size: 15pt;
    line-height: 1.05;
  }

  body.printing-antavla .print-antavla-header p {
    font-size: 6.5pt;
    line-height: 1.15;
  }

  body.printing-antavla .print-antavla-header > strong {
    font-size: 9pt;
  }

  body.printing-antavla .print-antavla-chart {
    min-width: 0;
    width: 100%;
    gap: 1.4mm;
  }

  body.printing-antavla .print-ancestor-generation {
    gap: 1mm;
    min-height: 0;
  }

  body.printing-antavla .generation-4 {
    grid-template-columns: repeat(16, minmax(0, 1fr)) !important;
  }

  body.printing-antavla .generation-3 {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  }

  body.printing-antavla .generation-2 {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  body.printing-antavla .generation-1 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.printing-antavla .generation-0 {
    grid-template-columns: 1fr !important;
  }

  body.printing-antavla .print-ancestor-card {
    min-height: 0 !important;
    height: 100%;
    gap: 0.5mm;
    padding: 4mm 1mm 1mm;
    border-radius: 1.4mm;
    box-shadow: none;
  }

  body.printing-antavla .print-ancestor-card::before {
    height: 0.8mm;
  }

  body.printing-antavla .print-ancestor-code {
    top: 1mm;
    right: 1mm;
    font-size: 5.5pt;
    padding: 0.7mm 1mm;
  }

  body.printing-antavla .print-ancestor-card strong {
    font-size: 7pt;
    line-height: 1.02;
  }

  body.printing-antavla .print-ancestor-card span:not(.print-ancestor-code) {
    font-size: 5.8pt;
    line-height: 1.07;
  }

  body.printing-antavla .generation-4 .print-ancestor-card {
    height: 30mm;
  }

  body.printing-antavla .generation-3 .print-ancestor-card {
    height: 30mm;
  }

  body.printing-antavla .generation-2 .print-ancestor-card {
    height: 31mm;
  }

  body.printing-antavla .generation-1 .print-ancestor-card {
    height: 23mm;
  }

  body.printing-antavla .generation-0 .print-ancestor-card {
    height: 19mm;
  }

  body.printing-antavla .generation-4 .print-ancestor-card strong,
  body.printing-antavla .generation-5 .print-ancestor-card strong {
    font-size: 5.9pt;
  }

  body.printing-antavla .generation-4 .print-ancestor-card span:not(.print-ancestor-code),
  body.printing-antavla .generation-5 .print-ancestor-card span:not(.print-ancestor-code) {
    font-size: 4.9pt;
  }

  body.printing-antavla .print-report-footer {
    margin-top: 1.5mm;
    padding-top: 1mm;
    font-size: 6pt;
  }

  body.printing-graphic-antavla .print-preview {
    overflow: visible;
  }

  body.printing-graphic-antavla .print-graphic-antavla-stage {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
  }

  body.printing-graphic-antavla .print-graphic-antavla-page {
    transform: none !important;
    transform-origin: top left !important;
    width: 100% !important;
    min-width: 0 !important;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-family-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .print-report-section,
  .print-relation-card,
  .print-source-card {
    break-inside: avoid;
  }
}

.tab-button.active,
.settings-area-button.active,
.ai-settings-tab.active,
.indata-menu button.active,
.output-tabs button.active,
.geo-view-tabs button.active,
.profile-tabs button.active,
.dna-step-button.active,
.print-report-tabs button.active {
  background: var(--orange);
  color: var(--selected-button-text);
}
