/* Google Fonts - MUSI być na początku pliku! */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&family=IM+Fell+English:ital@0;1&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

.gramps-view {
    min-height: 720px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
}

.gramps-view,
.gramps-view * {
    box-sizing: border-box;
}

.gramps-view .dropdown-menu {
    background: #fff !important;
    border-color: #dee2e6 !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.gramps-view .list-group-item {
    background: #fff !important;
    color: #212529 !important;
    border-color: #e9ecef !important;
    border-radius: 0 !important;
}

.gramps-view .list-group-item-action {
    color: inherit !important;
}

.gramps-view .btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border-radius: 0.375rem;
    line-height: 1.5;
}

.gramps-view .btn-primary {
    background-color: var(--mdb-primary, #0d6efd) !important;
    border-color: var(--mdb-primary, #0d6efd) !important;
    color: #fff !important;
}

.gramps-view .btn-outline-secondary {
    background: transparent !important;
    border: 1px solid #adb5bd !important;
    color: #495057 !important;
}

.gramps-view .form-control {
    border-radius: 0.375rem;
    line-height: 1.5;
}

.gramps-view .bg-primary {
    background-color: var(--mdb-primary, #0d6efd) !important;
}

.gramps-view .text-white {
    color: #fff !important;
}


.gramps-view__canvas {
    width: 100%;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    position: relative;
}

.gramps-view__link {
    fill: none;
    stroke: #94a3b8;
    stroke-width: 2px;
}

.gramps-view__link-dot {
    fill: #94a3b8;
}

.gramps-view__spouse-link {
    stroke: #94a3b8;
    stroke-width: 1.5px;
}

/* Nodes */
.gramps-view__node {
    transition: all 0.2s ease;
}

.gramps-view__node:hover {
    filter: brightness(0.98);
}

.gramps-view__card-bg {
    fill: #ffffff;
    stroke: #dee2e6;
    stroke-width: 1px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.12));
}

.gramps-view__node.is-male .gramps-view__card-bg {
    fill: #eaf3ff;
}

.gramps-view__node.is-female .gramps-view__card-bg {
    fill: #ffdfef;
}

.gramps-view__node:hover .gramps-view__card-bg {
    stroke: #adb5bd;
    stroke-width: 2px;
}

.gramps-view__node.is-root .gramps-view__card-bg {
    stroke: #0d6efd;
    stroke-width: 2px;
    fill: #e7f1ff;
}

.gramps-view__name {
    font-size: 14px;
    font-weight: 600;
    fill: #1e293b;
    pointer-events: none;
    /* Let clicks pass to group */
}

.gramps-view__surname {
    font-size: 13px;
    font-weight: 600;
    fill: #1e293b;
    pointer-events: none;
}

.gramps-view__dates {
    font-size: 10px;
    fill: #64748b;
    pointer-events: none;
}

.gramps-view__initials {
    font-size: 16px;
    font-weight: 600;
    fill: #64748b;
    pointer-events: none;
}

/* Parents toggle */
.gramps-view__parents-toggle-hitbox {
    fill: transparent;
    pointer-events: all;
}

.gramps-view__parents-toggle-icon {
    stroke: #94a3b8;
    stroke-width: 2.5px;
}

.gramps-view__parents-toggle.is-loading .gramps-view__parents-toggle-icon {
    stroke: #64748b;
    stroke-dasharray: 3 2;
}

/* Marriage Info Box */
.gramps-view__marriage-bg {
    fill: #9fa6b2;
    stroke: #9fa6b2;
    stroke-width: 0;
}

.gramps-view__marriage-toggle:hover .gramps-view__marriage-bg,
.gramps-view__marriage-toggle.is-collapsed .gramps-view__marriage-bg {
    fill: #8b93a1;
}

.gramps-view__marriage-text {
    font-size: 10px;
    font-weight: 600;
    fill: #ffffff;
    alignment-baseline: middle;
}

.gramps-view__marriage-date {
    font-size: 8px;
    fill: #ffffff;
    opacity: 0.85;
}

.gramps-view__marriage-arrow {
    font-size: 14px;
    font-weight: 700;
    fill: #ffffff;
    pointer-events: none;
}

.gramps-view__marriage-arrow-out {
    opacity: 1;
}

.gramps-view__marriage-arrow-in {
    opacity: 0.7;
}

/* Toolbar */
.gramps-view__toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 0;
    z-index: 10;
    display: flex !important;
    align-items: center !important;
    gap: 12px;
    flex-wrap: wrap;
}

.gramps-view__selector {
    flex: 0 1 360px;
    min-width: 260px;
}

.gramps-view__person-picker {
    position: relative;
    width: 100%;
}

.gramps-view__person-input {
    width: 100%;
    display: flex;
    align-items: stretch;
}

.gramps-view__person-input-field {
    height: auto;
    text-transform: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.gramps-view__person-clear {
    width: 32px;
    padding: 0;
    text-transform: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.gramps-view__icon {
    display: inline-block;
    vertical-align: middle;
}

.gramps-view__person-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: none;
    z-index: 20;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
}

.gramps-view__person-picker.is-open .gramps-view__person-dropdown {
    display: block;
}

.gramps-view__person-search {
    padding: 8px 12px 6px;
}

.gramps-view__person-header {
    display: grid !important;
    grid-template-columns: 2fr 2fr 1fr;
    padding: 0;
    padding-right: var(--gramps-view-scrollbar-width, 0px);
    gap: 8px;
    align-items: stretch;
}

.gramps-view__person-header--list {
    background: var(--mdb-primary, #0d6efd) !important;
    color: #fff !important;
}

.gramps-view__person-header--list .gramps-view__sort-btn {
    color: #fff;
    justify-self: stretch;
    width: 100%;
    text-align: left;
    padding: 6px 8px;
    border-radius: 0;
    display: flex;
    align-items: center;
    height: 100%;
    margin: 0;
    background: transparent;
    border: 0;
}

.gramps-view__person-header--list .gramps-view__sort-btn:hover,
.gramps-view__person-header--list .gramps-view__sort-btn:focus {
    color: #fff;
    background: rgba(0, 0, 0, 0.08);
    text-decoration: none;
}

.gramps-view__person-header--list .gramps-view__sort-btn[data-sort="birth_date"] {
    text-align: center;
}

.gramps-view__person-header--list .gramps-view__sort-btn:focus {
    box-shadow: none;
}

.gramps-view__sort-icon {
    font-size: 12px;
    color: currentColor;
    min-width: 10px;
    margin-left: 6px;
}

.gramps-view__person-list {
    max-height: 320px;
    overflow-y: auto;
}

.gramps-view__relations-list .list-group-item {
    display: block !important;
    width: 100% !important;
}

.gramps-view__person-row,
.gramps-view__person-list .gramps-view__person-row.list-group-item {
    display: grid !important;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 8px;
    align-items: center;
    font-size: 13px;
    width: 100%;
    text-align: left;
}

.gramps-view__person-row.list-group-item {
    border: none;
    border-bottom: 1px solid #f1f5f9;
    padding: 6px 8px;
}

.gramps-view__person-col--birth {
    text-align: center;
    color: #64748b;
}

.gramps-view__controls,
.gramps-view__mode-switch {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
}

.gramps-view__btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.gramps-view__icon-svg {
    width: 18px;
    height: 18px;
    display: block;
}

.gramps-view__dropdown-btn {
    height: 36px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.gramps-view__dropdown-value {
    color: #ffd54f;
    font-weight: 600;
}

.gramps-view__btn.is-active {
    background: #0a58ca;
    border-color: #0a58ca;
}

/* Detail Panel */
.gramps-view__detail-panel {
    position: absolute;
    top: 0;
    right: -620px;
    width: 600px;
    height: 100%;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
    padding: 20px;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
    overflow-y: auto;
}

.gramps-view__detail-panel.is-open {
    right: 0;
}

.gramps-view__detail-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
}

.gramps-view__detail-content h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #1e293b;
}

.gramps-view__detail-content img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 15px;
}

.gramps-view__detail-card .card-header {
    border-bottom: none;
    position: relative;
}

.gramps-view .gramps-view__note-toggle {
    display: flex !important;
    justify-content: flex-end;
    width: 100%;
    text-align: right;
}

.gramps-view__siblings-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    font-size: 14px;
}

.gramps-view__sibling-item {
    white-space: nowrap;
}

.gramps-view__sibling-item:not(:last-child)::after {
    content: ", ";
}

.gramps-view__sibling-item a {
    text-decoration: none;
}

.gramps-view__empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    text-align: center;
    color: #64748b;
    padding: 24px;
    pointer-events: none;
}

.gramps-view__empty-illustration {
    height: 33%;
    max-height: 220px;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gramps-view__empty-illustration svg {
    height: 100%;
    width: auto;
}

.gramps-view__empty-text {
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 500;
}

.gramps-view__detail-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.gramps-view__detail-avatar {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: 0 0 auto;
}

.gramps-view__detail-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gramps-view__detail-avatar--sm {
    width: 42px;
    height: 42px;
    border-radius: 8px;
}

.gramps-view__relations-list .list-group-item {
    padding: 6px 8px;
    border: none;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
}

.gramps-view__relations-list .list-group-item:last-child {
    border-bottom: none;
}

.gramps-view__person-link {
    color: #0d6efd;
    text-decoration: none;
    display: inline;
}

.gramps-view__person-link:hover {
    text-decoration: underline;
}

.gramps-view__relation-item {
    color: #212529;
    padding: 2px 0;
}

.gramps-view__media-thumb {
    position: relative;
    width: 100%;
    max-width: 220px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.gramps-view__media-thumb img {
    width: 100%;
    height: auto;
    display: block;
}

.gramps-view__media-count {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 20px;
    background: rgba(0, 0, 0, 0.35);
}

.gramps-view__timeline .list-group-item {
    border: none;
    border-left: 3px solid #0d6efd;
    border-radius: 0;
    padding: 6px 10px;
    margin-bottom: 6px;
    background: #f8f9fa;
    font-size: 13px;
}

.gramps-view__enrichment {
    display: grid;
    gap: 12px;
}

.gramps-view__enrichment-card,
.gramps-view__enrichment-form-card {
    border: 1px solid #e8dcc9;
    border-radius: 14px;
    background: linear-gradient(180deg, #fffaf2 0%, #f4ead8 100%);
    padding: 14px 16px;
    box-shadow: 0 8px 18px rgba(93, 67, 41, 0.08);
}

.gramps-view__enrichment-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 8px;
}

.gramps-view__enrichment-card-head > div {
    display: grid;
    gap: 2px;
}

.gramps-view__enrichment-card-head strong {
    color: #5c3a21;
    font-size: 15px;
}

.gramps-view__enrichment-card-head span {
    color: #8b6f54;
    font-size: 12px;
}

.gramps-view__enrichment-card-excerpt {
    font-style: italic;
    color: #6b5844;
}

.gramps-view__enrichment-card-content {
    color: #3f3125;
    line-height: 1.6;
    font-size: 14px;
}

.gramps-view__enrichment-form-intro {
    color: #6a5441;
    font-size: 13px;
    margin-bottom: 10px;
}

.gramps-view__enrichment-form textarea,
.gramps-view__enrichment-form input,
.gramps-view__enrichment-revision-form textarea,
.gramps-view__enrichment-revision-form input {
    border-radius: 10px;
    border-color: #d9c4a7;
    background: rgba(255, 255, 255, 0.88);
}

.gramps-view__enrichment-edit-toggle {
    color: #7a4e25;
    text-decoration: none;
    padding: 0;
    font-weight: 600;
}

.gramps-view__enrichment-edit-toggle:hover,
.gramps-view__enrichment-edit-toggle:focus {
    color: #5c3a21;
    text-decoration: none;
}

.gramps-view__enrichment-revision-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed rgba(124, 93, 62, 0.28);
}

.gramps-view__enrichment-actions {
    margin-top: 10px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.gramps-view__enrichment-status {
    font-size: 13px;
    color: #6c757d;
}

.gramps-view__enrichment-status.is-success {
    color: #2f6b2f;
}

.gramps-view__enrichment-status.is-error {
    color: #9d3a2f;
}

.gramps-view__enrichment-pending {
    border-radius: 10px;
    background: #fff2d7;
    color: #785a1f;
    font-size: 13px;
    padding: 10px 12px;
}

.gramps-view__hovercard {
    position: fixed;
    z-index: 1050;
    width: 300px;
    max-width: calc(100vw - 24px);
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.mdb-content--full:has(> .gramps-story) {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.mdb-hero.mdb-hero--tree {
    position: relative;
    z-index: 3;
    box-shadow: 0 18px 34px rgba(47, 31, 18, 0.28);
}

.gramps-story {
    position: relative;
    isolation: isolate;
    display: grid;
    gap: 1.5rem;
    color: #23313d;
    margin-top: -2px;
}

.gramps-story::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -1.5rem;
    bottom: -2rem;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    background:
        radial-gradient(circle at 12% 10%, rgba(94, 124, 64, 0.1), transparent 30%),
        radial-gradient(circle at 82% 16%, rgba(60, 112, 139, 0.08), transparent 34%),
        linear-gradient(180deg, #f7efe1 0%, #efe2ca 100%);
}

.gramps-story__hero,
.gramps-story__picker-card,
.gramps-story__record-card,
.gramps-story__lineage-copy,
.gramps-story__lineage-tree,
.gramps-story__contribution-form-card,
.gramps-story__correction-form-card {
    border: 1px solid rgba(97, 73, 47, 0.12);
    border-radius: 1.25rem;
    background: linear-gradient(180deg, rgba(255, 251, 245, 0.98), rgba(247, 239, 225, 0.98));
    box-shadow: 0 12px 30px rgba(93, 67, 41, 0.08);
}

.gramps-story__hero {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.95fr);
    padding: 1.6rem;
}

.gramps-story__eyebrow,
.gramps-story__record-kicker {
    margin: 0 0 0.35rem;
    color: #8a6744;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gramps-story__lead,
.gramps-story__muted {
    color: #705741;
}

.gramps-story__hero h2,
.gramps-story__record-card h3 {
    margin: 0 0 0.5rem;
    color: #3f2d1f;
}

.gramps-story__hero-meta,
.gramps-story__metric-grid {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gramps-story__metric {
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(97, 73, 47, 0.1);
}

.gramps-story__metric span {
    display: block;
    color: #8a6744;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.gramps-story__segments {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
    overflow: visible;
    scrollbar-width: thin;
    position: relative;
    z-index: 600;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.gramps-story__segment {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    border: 1px solid #8b633a;
    border-radius: 0;
    background: #9c7347;
    color: #fffaf3;
    padding: 0 14px;
    margin-left: -1px;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    box-shadow: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.gramps-story__segment:first-child {
    margin-left: 0;
    border-radius: 10px 0 0 10px;
}

.gramps-story__segment:last-of-type {
    border-radius: 0 10px 10px 0;
}

.gramps-story__segment:hover,
.gramps-story__segment:focus-visible {
    transform: translateY(-1px);
    border-color: #764f29;
    background: #8a633a;
    color: #fffaf3;
    box-shadow: 0 10px 18px rgba(122, 85, 46, 0.16);
    outline: none;
}

.gramps-story__segment.is-active {
    border-color: #65401f;
    background: #6f4524;
    color: #fffaf3;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.gramps-story__selector-pocket {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    width: min(430px, 42vw);
    height: 36px;
    min-height: 36px;
    padding: 0 8px;
    border-top: 1px solid #8b633a;
    border-bottom: 1px solid #8b633a;
    background: #ffffff;
    position: relative;
    z-index: 610;
}

.gramps-story__selector-pocket[hidden] {
    display: none !important;
}

.gramps-story__segment.is-active:has(+ .gramps-story__selector-pocket) {
    border-radius: 0;
}

.gramps-story__segment:first-child.is-active:has(+ .gramps-story__selector-pocket) {
    border-radius: 10px 0 0 10px;
}

.gramps-story__selector-pocket + .gramps-story__segment {
    margin-left: -1px;
    border-radius: 0;
}

.gramps-story__selector-pocket + .gramps-story__segment:last-of-type {
    border-radius: 0 10px 10px 0;
}

.gramps-story__selector-pocket:last-child {
    border-right: 1px solid #8b633a;
    border-radius: 0 10px 10px 0;
}

.gramps-story__menu-picker {
    position: relative;
    width: 100%;
    min-width: 0;
    z-index: 620;
}

.gramps-story__menu-picker.is-open {
    z-index: 700;
}

.gramps-story__menu-select {
    width: 100%;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid rgba(122, 85, 46, 0.25);
    border-radius: 8px;
    background: #fffaf3;
    color: #5c3518;
    padding: 0 30px 0 10px;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    text-align: left;
}

.gramps-story__menu-select::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    position: absolute;
    right: 13px;
    top: 9px;
    transform: rotate(45deg);
}

.gramps-story__menu-select span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gramps-story__menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 710;
    width: min(560px, calc(100vw - 84px));
    max-height: min(460px, calc(100vh - 290px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px;
    border: 1px solid rgba(97, 73, 47, 0.18);
    border-radius: 12px;
    background: #fffdf8;
    box-shadow: 0 18px 38px rgba(74, 52, 29, 0.18);
    scrollbar-width: thin;
}

.gramps-story__menu-picker.is-open .gramps-story__menu-dropdown {
    display: grid;
    gap: 8px;
}

.gramps-story__menu-search {
    margin: 0;
    border-radius: 8px;
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fffdf8;
}

.gramps-story__menu-list {
    padding-right: 3px;
}

.gramps-story__pane {
    display: none;
}

.gramps-story__pane.is-active {
    display: block;
}

.gramps-story__workspace,
.gramps-story__lineage-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
}

.gramps-story__content {
    min-width: 0;
    min-height: min(760px, calc(100vh - 190px));
    overflow-anchor: none;
    transition: min-height 0.18s ease;
}

.gramps-story__pane[data-story-pane="slider"] .gramps-story__content {
    min-height: min(820px, calc(100vh - 150px));
}

.gramps-story__content.is-loading {
    display: grid;
    align-items: stretch;
}

.gramps-story__sidebar {
    min-width: 0;
}

.gramps-story__picker-card,
.gramps-story__record-card,
.gramps-story__lineage-copy,
.gramps-story__lineage-tree {
    padding: 1.25rem;
}

.gramps-story__search {
    margin: 0.8rem 0 1rem;
    border-radius: 0.9rem;
    border-color: #d9c4a7;
    background: rgba(255, 255, 255, 0.88);
}

.gramps-story__menu-search.gramps-story__search {
    margin: 0;
    border-radius: 8px;
    background: #fffdf8;
}

.gramps-story__list {
    display: grid;
    gap: 0.6rem;
    max-height: 70vh;
    overflow: auto;
}

.gramps-story__menu-list.gramps-story__list {
    max-height: none;
    overflow: visible;
}

.gramps-story__list-item {
    text-align: left;
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(97, 73, 47, 0.1);
    background: rgba(255, 255, 255, 0.8);
}

.gramps-story__list-item strong,
.gramps-story__list-item span {
    display: block;
}

.gramps-story__list-item span,
.gramps-story__record-subtitle {
    color: #7f654d;
    font-size: 0.86rem;
}

.gramps-story__list-item.is-active {
    border-color: rgba(122, 85, 46, 0.35);
    background: linear-gradient(180deg, #fffdf8, #f1e5d3);
    box-shadow: 0 8px 18px rgba(93, 67, 41, 0.1);
}

.gramps-story__record-card {
    display: grid;
    gap: 1.25rem;
}

.gramps-story__record-card.gramps-story-person {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.gramps-story__record-hero {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
}

.gramps-story__grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gramps-story__section {
    display: grid;
    gap: 0.85rem;
}

.gramps-story__section h4 {
    margin: 0;
    color: #50361d;
}

.gramps-story__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.gramps-story__chip-group {
    min-width: 160px;
    padding: 0.8rem 0.95rem;
    border-radius: 1rem;
    border: 1px solid rgba(97, 73, 47, 0.1);
    background: rgba(255, 255, 255, 0.72);
}

.gramps-story__chip-group span {
    display: block;
    color: #8a6744;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
}

.gramps-story__timeline {
    display: grid;
    gap: 0.7rem;
}

.gramps-story__timeline-item {
    padding: 0.8rem 0.95rem;
    border-left: 3px solid #8c6239;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.72);
}

.gramps-story__timeline-item strong,
.gramps-story__timeline-item span {
    display: block;
}

.gramps-story__timeline-item span {
    color: #7f654d;
    font-size: 0.9rem;
}

.gramps-story__media-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.gramps-story__media-item {
    margin: 0;
    border-radius: 1rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(97, 73, 47, 0.1);
}

.gramps-story__media-item img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    display: block;
}

.gramps-story__media-item figcaption {
    padding: 0.65rem 0.75rem 0.8rem;
    color: #705741;
    font-size: 0.88rem;
}

.gramps-story-person {
    display: grid;
    gap: 1rem;
}

.gramps-story-lineage {
    display: grid;
    gap: 1rem;
}

.gramps-story-layers {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    padding: 0.35rem;
    border: 1px solid rgba(97, 73, 47, 0.16);
    border-radius: 1rem;
    background:
        radial-gradient(circle at 12% 22%, rgba(94, 124, 64, 0.12), transparent 28%),
        radial-gradient(circle at 82% 10%, rgba(60, 112, 139, 0.1), transparent 30%),
        repeating-linear-gradient(12deg, rgba(112, 82, 48, 0.05) 0 1px, transparent 1px 13px),
        linear-gradient(180deg, #f7efe1, #ede0ca);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 12px 24px rgba(93, 67, 41, 0.08);
}

.gramps-story-layers__tab {
    position: relative;
    min-width: 0;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    grid-template-areas:
        "icon label"
        "icon hint";
    column-gap: 0.65rem;
    align-items: center;
    padding: 0.78rem 0.9rem;
    border: 0;
    border-radius: 0.78rem;
    background: transparent;
    color: #5d4329;
    text-align: left;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.gramps-story-layers__tab::after {
    content: "";
    position: absolute;
    left: 0.9rem;
    right: 0.9rem;
    bottom: 0.3rem;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(112, 30, 24, 0.56), transparent);
    opacity: 0;
}

.gramps-story-layers__tab i {
    grid-area: icon;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(93, 67, 41, 0.08);
    color: #7c5b35;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.gramps-story-layers__tab span {
    grid-area: label;
    min-width: 0;
    color: inherit;
    font-weight: 850;
    font-size: 0.96rem;
    line-height: 1.1;
    overflow-wrap: anywhere;
    transition: color 0.18s ease, font-size 0.18s ease;
}

.gramps-story-layers__tab small {
    grid-area: hint;
    min-width: 0;
    color: #846b52;
    font-size: 0.76rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
    transition: color 0.18s ease;
}

.gramps-story-layers__tab:hover,
.gramps-story-layers__tab:focus-visible {
    background: transparent;
    color: #701e18;
    transform: translateY(-1px) scale(1.01);
    outline: none;
}

.gramps-story-layers__tab:hover::after,
.gramps-story-layers__tab:focus-visible::after {
    opacity: 0.75;
}

.gramps-story-layers__tab:hover i,
.gramps-story-layers__tab:focus-visible i {
    background: rgba(112, 30, 24, 0.12);
    color: #701e18;
    transform: scale(1.05);
}

.gramps-story-layers__tab:hover span,
.gramps-story-layers__tab:focus-visible span {
    color: #701e18;
    font-size: 1.08rem;
}

.gramps-story-layers__tab:hover small,
.gramps-story-layers__tab:focus-visible small {
    color: #7d3f36;
}

.gramps-story-layers__tab.is-active {
    background: transparent;
    color: #701e18;
    transform: translateY(-1px) scale(1.01);
}

.gramps-story-layers__tab.is-active::after {
    opacity: 1;
}

.gramps-story-layers__tab.is-active i {
    background: rgba(112, 30, 24, 0.12);
    color: #701e18;
    transform: scale(1.05);
}

.gramps-story-layers__tab.is-active span {
    color: #701e18;
    font-size: 1.08rem;
}

.gramps-story-layers__tab.is-active small {
    color: #7d3f36;
}

.gramps-story-layers__tab.is-active:hover,
.gramps-story-layers__tab.is-active:focus-visible {
    background: transparent;
}

.gramps-story-layers__tab.is-active:hover i,
.gramps-story-layers__tab.is-active:focus-visible i {
    background: rgba(112, 30, 24, 0.12);
    color: #701e18;
}

[data-lineage-layer-panel][hidden] {
    display: none !important;
}

.gramps-story-lineage > [data-lineage-layer-panel] {
    display: grid;
    gap: 1rem;
}

.gramps-story-lineage__hero,
.gramps-story-lineage__family-card,
.gramps-story-lineage__person-row {
    border: 1px solid rgba(23, 50, 77, 0.08);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 12px 28px rgba(23, 50, 77, 0.07);
}

.gramps-story-lineage__hero {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(340px, 1.05fr);
    gap: 1rem;
    align-items: start;
    padding: 1.2rem;
    border-radius: 1rem;
    background:
        radial-gradient(circle at top left, rgba(210, 231, 250, 0.52), transparent 42%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98));
}

.gramps-story-lineage__hero h3 {
    margin: 0 0 0.35rem;
    color: #17324d;
    font-size: clamp(1.35rem, 2vw, 1.95rem);
}

.gramps-story-lineage__lead {
    max-width: 62ch;
    margin: 0.85rem 0 0;
    color: #475569;
    line-height: 1.55;
}

.gramps-story-lineage__metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.gramps-story-lineage__metric {
    min-width: 0;
    padding: 0.85rem;
    border-radius: 0.9rem;
    background: rgba(245, 248, 251, 0.92);
    border: 1px solid rgba(23, 50, 77, 0.08);
}

.gramps-story-lineage__metric span,
.gramps-story-lineage__metric small {
    display: block;
    color: #64748b;
    line-height: 1.3;
}

.gramps-story-lineage__metric span {
    margin-bottom: 0.25rem;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.gramps-story-lineage__metric strong {
    display: block;
    color: #17324d;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.gramps-story-lineage__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.gramps-story-lineage__family-list,
.gramps-story-lineage__person-list {
    display: grid;
    gap: 0.7rem;
}

.gramps-story-lineage__family-card {
    display: flex;
    justify-content: space-between;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 0.85rem;
    border-radius: 0.95rem;
}

.gramps-story-lineage__family-card div,
.gramps-story-lineage__person-row div:last-child {
    display: grid;
    gap: 0.22rem;
    min-width: 0;
}

.gramps-story-lineage__family-card small,
.gramps-story-lineage__person-row small {
    color: #64748b;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.gramps-story-lineage__person-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem;
    border-radius: 0.95rem;
}

.gramps-story-lineage-data {
    display: grid;
    gap: 1rem;
}

.gramps-story-lineage-data__summary {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    border: 1px solid rgba(97, 73, 47, 0.12);
    background:
        linear-gradient(135deg, rgba(255, 253, 247, 0.96), rgba(246, 239, 226, 0.96));
    box-shadow: 0 12px 28px rgba(93, 67, 41, 0.06);
}

.gramps-story-lineage-data__summary h4 {
    margin: 0 0 0.35rem;
    color: #4b3520;
}

.gramps-story-lineage-data__summary p:last-child {
    max-width: 70ch;
    margin: 0;
    color: #63503c;
    line-height: 1.5;
}

.gramps-story-lineage-data__facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.gramps-story-lineage-data__fact {
    min-width: 0;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 0.7rem;
    align-items: start;
    padding: 0.85rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(97, 73, 47, 0.1);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 10px 22px rgba(93, 67, 41, 0.05);
}

.gramps-story-lineage-data__fact i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(112, 30, 24, 0.1);
    color: #701e18;
}

.gramps-story-lineage-data__fact div {
    min-width: 0;
}

.gramps-story-lineage-data__fact span,
.gramps-story-lineage-data__fact small {
    display: block;
    line-height: 1.3;
}

.gramps-story-lineage-data__fact span {
    margin-bottom: 0.2rem;
    color: #8a6744;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.gramps-story-lineage-data__fact strong {
    display: block;
    color: #4b3520;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.gramps-story-lineage-data__fact small {
    margin-top: 0.2rem;
    color: #6d5945;
    overflow-wrap: anywhere;
}

.gramps-story-lineage-data__parents {
    display: grid;
    gap: 0.7rem;
    margin-bottom: 0.85rem;
}

.gramps-story-lineage-data__parents--empty {
    padding: 0.85rem;
    border-radius: 0.9rem;
    background: rgba(248, 250, 252, 0.9);
    color: #64748b;
}

.gramps-story-lineage-data__parent {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem;
    border-radius: 0.95rem;
    border: 1px solid rgba(23, 50, 77, 0.08);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 12px 28px rgba(23, 50, 77, 0.06);
}

.gramps-story-lineage-data__parent span {
    display: block;
    color: #8a6744;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.gramps-story-lineage-data__parent strong,
.gramps-story-lineage-data__parent small {
    display: block;
    overflow-wrap: anywhere;
}

.gramps-story-lineage-data__parent small {
    color: #64748b;
    line-height: 1.35;
}

.gramps-story-research {
    display: grid;
    gap: 1rem;
    padding: 1.1rem;
    border-radius: 1rem;
    border: 1px solid rgba(126, 92, 42, 0.14);
    background:
        radial-gradient(circle at top left, rgba(255, 232, 174, 0.28), transparent 44%),
        linear-gradient(135deg, rgba(255, 253, 247, 0.98), rgba(249, 244, 234, 0.98));
    box-shadow: 0 12px 28px rgba(93, 67, 41, 0.07);
}

.gramps-story-research__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.gramps-story-research__header h4 {
    margin: 0;
    color: #4b3520;
}

.gramps-story-research__stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
}

.gramps-story-research__stats span,
.gramps-story-research__priority {
    display: inline-flex;
    align-items: center;
    min-height: 1.55rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(126, 92, 42, 0.1);
    color: #6b4b27;
    font-size: 0.78rem;
    font-weight: 800;
}

.gramps-story-research__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    align-items: start;
}

.gramps-story-research__column {
    min-width: 0;
    display: grid;
    gap: 0.65rem;
}

.gramps-story-research__column-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #4b3520;
}

.gramps-story-research__column-title i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: rgba(126, 92, 42, 0.1);
    color: #8a633a;
}

.gramps-story-research__list {
    display: grid;
    gap: 0.55rem;
}

.gramps-story-research__item,
.gramps-story-research__empty {
    min-width: 0;
    padding: 0.75rem;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(126, 92, 42, 0.1);
}

.gramps-story-research__item {
    display: grid;
    gap: 0.25rem;
}

.gramps-story-research__item strong,
.gramps-story-research__item small {
    min-width: 0;
    overflow-wrap: anywhere;
}

.gramps-story-research__item small,
.gramps-story-research__empty {
    color: #6f5b45;
    font-size: 0.84rem;
    line-height: 1.35;
}

.gramps-story-research__item--warning {
    border-color: rgba(190, 105, 42, 0.22);
    background: rgba(255, 248, 238, 0.92);
}

.gramps-story-person__hero,
.gramps-story-person__panel,
.gramps-story-person__relation-panel {
    padding: 1.1rem;
    border-radius: 1rem;
    border: 1px solid rgba(23, 50, 77, 0.08);
    background:
        radial-gradient(circle at top left, rgba(210, 231, 250, 0.48), transparent 46%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98));
    box-shadow: 0 12px 28px rgba(23, 50, 77, 0.07);
}

.gramps-story-person__hero {
    display: grid;
    gap: 1rem;
}

.gramps-story-person__identity {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
}

.gramps-story-person__avatar,
.gramps-story-person__relation-avatar {
    position: relative;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid rgba(23, 50, 77, 0.1);
}

.gramps-story-person__avatar {
    width: 92px;
    height: 92px;
    border-radius: 18px;
}

.gramps-story-person__avatar img,
.gramps-story-person__relation-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gramps-story-person__identity-copy {
    min-width: 0;
}

.gramps-story-person__identity-copy h3 {
    margin: 0 0 0.35rem;
    color: #17324d;
    font-size: clamp(1.35rem, 2vw, 1.9rem);
}

.gramps-story-person__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.7rem;
}

.gramps-story-person__badges span {
    padding: 0.32rem 0.6rem;
    border-radius: 999px;
    background: rgba(15, 88, 140, 0.08);
    color: #34516d;
    font-size: 0.8rem;
    font-weight: 650;
}

.gramps-story__hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.85rem;
}

.gramps-story__hero-actions .btn {
    border-radius: 0.45rem;
    font-weight: 700;
    box-shadow: 0 7px 16px rgba(13, 110, 253, 0.16);
}

.gramps-story__entity-link {
    color: #0f588c;
    text-decoration: none;
    font-weight: 750;
}

.gramps-story__entity-link:hover,
.gramps-story__entity-link:focus {
    color: var(--mdb-primary, #0d6efd);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.gramps-story-person__summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.gramps-story-person__main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    gap: 1rem;
    align-items: start;
}

.gramps-story-person__panel h4,
.gramps-story-person__relation-panel h4,
.gramps-story-maplet h4 {
    margin: 0;
    color: #17324d;
}

.gramps-story__record-card,
.gramps-story-person__panel,
.gramps-story-person__relation-panel,
.gramps-story-maplet,
.gramps-view-family__layout,
.gramps-view-family__layout .card,
.gramps-view-family__hero-card,
.gramps-view-family__child-card {
    min-width: 0;
}

.gramps-story-person__timeline {
    position: relative;
    display: grid;
    gap: 0.85rem;
}

.gramps-story-person__timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 0.75rem;
}

.gramps-story-person__timeline-item:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 20px;
    top: 42px;
    bottom: -0.85rem;
    width: 2px;
    background: rgba(15, 88, 140, 0.16);
}

.gramps-story-person__timeline-icon {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #eef6fb;
    color: #0f588c;
    box-shadow: 0 0 0 5px rgba(15, 88, 140, 0.07);
}

.gramps-story-person__timeline-card {
    min-width: 0;
    padding: 0.85rem 0.95rem;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(23, 50, 77, 0.08);
}

.gramps-story-person__timeline-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    color: #17324d;
    margin-bottom: 0.25rem;
}

.gramps-story-person__timeline-date,
.gramps-view-family__timeline-date {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
    text-align: right;
}

.gramps-story-person__timeline-date em,
.gramps-view-family__timeline-date em {
    display: inline-flex;
    align-items: center;
    min-height: 1.45rem;
    padding: 0.12rem 0.48rem;
    border-radius: 999px;
    background: rgba(15, 88, 140, 0.08);
    color: #0f588c;
    font-style: normal;
    font-size: 0.76rem;
    font-weight: 800;
    white-space: nowrap;
}

.gramps-story-person__timeline-head span,
.gramps-story-person__timeline-place,
.gramps-story-person__timeline-description,
.gramps-story-person__timeline-source {
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.35;
}

.gramps-story-person__timeline-source {
    margin-top: 0.35rem;
    color: #0f588c;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.gramps-story-person__family-list,
.gramps-story-person__notes,
.gramps-story-person__media-grid {
    display: grid;
    gap: 0.75rem;
}

.gramps-story-person__family-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 0.95rem;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(23, 50, 77, 0.08);
}

.gramps-story-person__family-item div {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.gramps-story-person__family-item span:first-child {
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.gramps-story-person__family-item strong {
    color: #17324d;
    overflow-wrap: anywhere;
}

.gramps-story-person__family-item small {
    color: #64748b;
    line-height: 1.35;
}

.gramps-story-person__family-count {
    flex: 0 0 auto;
    align-self: flex-start;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    background: rgba(15, 88, 140, 0.08);
    color: #0f588c;
    font-size: 0.8rem;
    font-weight: 700;
}

.gramps-story-person__relations {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.gramps-story-person__relation-list {
    display: grid;
    gap: 0.7rem;
}

.gramps-story-person__relation-card {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.8rem;
    border-radius: 0.95rem;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(23, 50, 77, 0.08);
}

.gramps-story-person__relation-avatar {
    width: 52px;
    height: 52px;
    border-radius: 12px;
}

.gramps-story-person__relation-copy {
    min-width: 0;
}

.gramps-story-person__relation-copy strong {
    display: block;
    color: #17324d;
    line-height: 1.25;
}

.gramps-story-person__relation-copy div {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.4rem;
}

.gramps-story-person__relation-copy span,
.gramps-story-person__relation-copy small {
    padding: 0.23rem 0.5rem;
    border-radius: 999px;
    background: rgba(15, 88, 140, 0.07);
    color: #475569;
    font-size: 0.78rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.gramps-story-person__notes article {
    padding: 0.9rem 1rem;
    border-radius: 0.95rem;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(23, 50, 77, 0.08);
    color: #334155;
    line-height: 1.55;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.gramps-story-maplet {
    padding: 1.1rem;
    border-radius: 1rem;
    border: 1px solid rgba(23, 50, 77, 0.08);
    background:
        radial-gradient(circle at 12% 12%, rgba(137, 188, 128, 0.22), transparent 34%),
        radial-gradient(circle at 90% 18%, rgba(119, 180, 216, 0.18), transparent 36%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(246, 251, 248, 0.98));
    box-shadow: 0 12px 28px rgba(23, 50, 77, 0.07);
}

.gramps-story-maplet__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 0.95rem;
}

.gramps-story-maplet__header p {
    margin: 0.25rem 0 0;
    color: #64748b;
    font-size: 0.92rem;
}

.gramps-story-maplet__body {
    display: grid;
    grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
    gap: 1rem;
    align-items: stretch;
}

.gramps-story-maplet__canvas,
.gramps-story-maplet__empty-map {
    min-height: 230px;
    border-radius: 1rem;
    border: 1px solid rgba(39, 82, 58, 0.12);
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.28) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255, 255, 255, 0.28) 1px, transparent 1px),
        radial-gradient(circle at 30% 26%, rgba(101, 163, 92, 0.25), transparent 24%),
        radial-gradient(circle at 72% 68%, rgba(63, 131, 166, 0.18), transparent 28%),
        linear-gradient(135deg, #dcefd8, #dcecf4 58%, #f4ead8);
    background-size: 34px 34px, 34px 34px, auto, auto, auto;
    position: relative;
    overflow: hidden;
}

.gramps-story-maplet__canvas {
    background: #e5edf2;
}

.gramps-story-maplet__canvas .leaflet-control-container {
    font-size: 0.82rem;
}

.gramps-story-maplet__empty-map {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.65rem;
    color: #456059;
    text-align: center;
    padding: 1.25rem;
}

.gramps-story-maplet__empty-map i {
    font-size: 2rem;
    color: #0f588c;
}

.gramps-story-maplet__list {
    display: grid;
    gap: 0.65rem;
}

.gramps-story-maplet__place {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 0.7rem;
    align-items: flex-start;
    padding: 0.75rem 0.85rem;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(23, 50, 77, 0.08);
}

.gramps-story-maplet__place.is-clickable {
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.gramps-story-maplet__place.is-clickable:hover,
.gramps-story-maplet__place.is-clickable:focus-within {
    border-color: rgba(15, 88, 140, 0.24);
    box-shadow: 0 10px 20px rgba(23, 50, 77, 0.08);
    transform: translateY(-1px);
}

.gramps-story-maplet__place-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 11px;
    background: rgba(15, 88, 140, 0.1);
    color: #0f588c;
    font-weight: 800;
    font-size: 0.82rem;
}

.gramps-story-maplet__place div {
    display: grid;
    gap: 0.16rem;
    min-width: 0;
}

.gramps-story-maplet__place strong {
    color: #17324d;
    line-height: 1.25;
}

.gramps-story-maplet__place small,
.gramps-story-maplet__place em {
    color: #64748b;
    font-size: 0.82rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.gramps-story-maplet__place em {
    color: #0f588c;
    font-style: normal;
    font-weight: 700;
}

.gramps-story-maplet__popup {
    display: grid;
    gap: 0.4rem;
    min-width: 220px;
}

.gramps-story-maplet__popup > strong {
    color: #17324d;
    font-size: 0.98rem;
}

.gramps-story-maplet__popup ol {
    margin: 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.35rem;
}

.gramps-story-maplet__popup li strong,
.gramps-story-maplet__popup li span {
    display: block;
}

.gramps-story-maplet__popup li span {
    color: #64748b;
    font-size: 0.82rem;
}

.gramps-view-family__note,
.gramps-view-family__timeline-description,
.gramps-story-person__timeline-description,
.gramps-view-family__child-details span,
.gramps-story-person__relation-copy span {
    overflow-wrap: anywhere;
}

.gramps-story__contribution-card {
    display: grid;
    gap: 0.45rem;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(97, 73, 47, 0.1);
    background: rgba(255, 255, 255, 0.72);
}

.gramps-story__correction-card {
    display: grid;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(97, 73, 47, 0.1);
    background: rgba(255, 255, 255, 0.72);
}

.gramps-story__correction-card--pending {
    border-color: rgba(122, 85, 46, 0.16);
    background: rgba(255, 253, 249, 0.82);
}

.gramps-story__correction-card-head {
    display: grid;
    gap: 0.2rem;
}

.gramps-story__contribution-card span,
.gramps-story__correction-card span,
.gramps-story__pending-note,
.gramps-story__status {
    color: #7f654d;
    font-size: 0.86rem;
}

.gramps-story__contribution-form-card,
.gramps-story__correction-form-card {
    padding: 1rem 1.1rem;
}

.gramps-story__subheading {
    margin: 0 0 0.15rem;
    color: #6f4d2d;
    font-size: 0.92rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.gramps-story__enrichment-forms {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gramps-story__contribution-form,
.gramps-story__correction-form {
    display: grid;
    gap: 0.75rem;
}

.gramps-story__contribution-form-card textarea,
.gramps-story__contribution-form-card input,
.gramps-story__correction-form-card textarea,
.gramps-story__correction-form-card input,
.gramps-story__correction-form-card select {
    border-radius: 0.9rem;
    border-color: #d9c4a7;
    background: rgba(255, 255, 255, 0.88);
}

.gramps-story__correction-form-card input[readonly] {
    background: rgba(247, 239, 225, 0.7);
    color: #6f4d2d;
}

.gramps-story__field-hint {
    color: #7f654d;
    font-size: 0.82rem;
    line-height: 1.45;
}

.gramps-story__correction-values {
    display: grid;
    gap: 0.35rem;
    color: #4b3624;
    font-size: 0.92rem;
}

.gramps-story__correction-values strong {
    color: #6f4d2d;
}

.gramps-story__correction-list {
    display: grid;
    gap: 0.75rem;
}

.gramps-story__pending-corrections,
.gramps-story__pending-correction-list {
    display: grid;
    gap: 0.75rem;
}

.gramps-story__vote-summary,
.gramps-story__vote-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.gramps-story__vote-summary span {
    color: #6f4d2d;
    font-size: 0.9rem;
}

.gramps-story__vote-button.is-selected {
    border-color: #8a6238 !important;
    background: rgba(140, 98, 57, 0.12) !important;
    color: #5d3f21 !important;
}

.gramps-story__vote-note,
.gramps-story__voters {
    color: #705741;
    font-size: 0.88rem;
    line-height: 1.5;
}

.gramps-story__voters {
    padding-top: 0.2rem;
    border-top: 1px solid rgba(97, 73, 47, 0.08);
}

.gramps-story__voter-list {
    margin: 0.45rem 0 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.3rem;
}

.gramps-story__voter-list li {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    color: #5c4430;
}

.gramps-story__form-actions {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.8rem;
}

.gramps-story__status.is-success {
    color: #2f6b2f;
}

.gramps-story__status.is-error {
    color: #9d3a2f;
}

.gramps-story__pending-note {
    padding: 0.85rem 0.95rem;
    border-radius: 1rem;
    background: #fff2d7;
    color: #785a1f;
}

.gramps-story__loading,
.gramps-story__empty,
.gramps-story__empty-inline {
    padding: 1.15rem 1.2rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.72);
    border: 1px dashed rgba(97, 73, 47, 0.22);
    color: #705741;
}

.gramps-story__loading {
    min-height: min(720px, calc(100vh - 210px));
    display: grid;
    align-content: start;
    gap: 1rem;
}

.gramps-story__loading > span {
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    font-weight: 750;
}

.gramps-story__skeleton {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.gramps-story__skeleton i {
    display: block;
    min-height: 96px;
    border-radius: 0.95rem;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.22)),
        rgba(255, 255, 255, 0.55);
    background-size: 220% 100%, auto;
    border: 1px solid rgba(97, 73, 47, 0.08);
    animation: gramps-story-skeleton 1.2s ease-in-out infinite;
}

.gramps-story__skeleton i:first-child {
    grid-column: 1 / -1;
    min-height: 190px;
}

.gramps-story__skeleton i:nth-child(4),
.gramps-story__skeleton i:nth-child(5) {
    min-height: 140px;
}

@keyframes gramps-story-skeleton {
    0% { background-position: 120% 0, 0 0; }
    100% { background-position: -120% 0, 0 0; }
}

@media (max-width: 767px) {
    .gramps-story__content,
    .gramps-story__pane[data-story-pane="slider"] .gramps-story__content {
        min-height: min(620px, calc(100vh - 150px));
    }

    .gramps-story__loading {
        min-height: min(560px, calc(100vh - 170px));
    }

    .gramps-story__skeleton {
        grid-template-columns: 1fr;
    }

    .gramps-story__skeleton i,
    .gramps-story__skeleton i:first-child,
    .gramps-story__skeleton i:nth-child(4),
    .gramps-story__skeleton i:nth-child(5) {
        min-height: 92px;
    }
}

.gramps-story__lineage-notes {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gramps-story__lineage-notes div {
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.72);
}

.gramps-story__lineage-notes span {
    display: block;
    color: #8a6744;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (max-width: 991px) {
    .gramps-story__hero,
    .gramps-story__workspace,
    .gramps-story__lineage-grid,
    .gramps-story__record-hero,
    .gramps-story__grid,
    .gramps-story__enrichment-forms,
    .gramps-story-lineage__hero,
    .gramps-story-lineage__grid,
    .gramps-story-research__grid {
        grid-template-columns: 1fr;
    }

    .gramps-story-person__summary-grid,
    .gramps-story-person__relations {
        grid-template-columns: 1fr;
    }

    .gramps-story-person__main-grid {
        grid-template-columns: 1fr;
    }

    .gramps-story-lineage-data__facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gramps-story__list {
        max-height: none;
    }
}

@media (max-width: 575px) {
    .gramps-story__segments {
        padding: 0;
        flex-wrap: wrap;
        gap: 0;
    }

    .gramps-story__selector-pocket {
        order: 10;
        flex: 1 0 100%;
        width: 100%;
        margin-top: -1px;
        border: 1px solid #8b633a;
        border-radius: 0 0 10px 10px;
    }

    .gramps-story__menu-dropdown {
        width: calc(100vw - 48px);
        left: 50%;
        transform: translateX(-50%);
    }

    .gramps-story__selector-pocket + .gramps-story__segment,
    .gramps-story__selector-pocket + .gramps-story__segment:last-of-type,
    .gramps-story__segment:last-of-type {
        border-radius: 0 10px 10px 0;
    }

    .gramps-story-person__identity {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .gramps-story-person__avatar {
        width: 72px;
        height: 72px;
        border-radius: 14px;
    }

    .gramps-story-person__timeline-head,
    .gramps-view-family__timeline-head {
        display: grid;
        gap: 0.25rem;
    }

    .gramps-story-person__timeline-date,
    .gramps-view-family__timeline-date {
        justify-content: flex-start;
        text-align: left;
    }

    .gramps-story__lineage-notes {
        grid-template-columns: 1fr;
    }

    .gramps-story-layers {
        grid-template-columns: 1fr 1fr;
    }

    .gramps-story-layers__tab {
        padding: 0.72rem;
        grid-template-columns: 30px minmax(0, 1fr);
        column-gap: 0.5rem;
    }

    .gramps-story-layers__tab i {
        width: 30px;
        height: 30px;
    }

    .gramps-story-lineage__metrics {
        grid-template-columns: 1fr;
    }

    .gramps-story-lineage-data__facts {
        grid-template-columns: 1fr;
    }

    .gramps-story-lineage__family-card {
        flex-direction: column;
    }

    .gramps-story-research__header {
        flex-direction: column;
    }

    .gramps-story-research__stats {
        justify-content: flex-start;
    }
}

.gramps-view__hovercard.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.gramps-view__detail-content p {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #475569;
}

/* Loading */
.gramps-view__loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 30;
    color: #64748b;
    font-weight: 500;
}

.gramps-view__spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 640px) {
    .gramps-view__toolbar {
        flex-wrap: wrap;
    }

    .gramps-view__selector {
        width: 100%;
        order: 1;
    }

    .gramps-view__sort {
        order: 2;
        width: 100%;
    }

    .gramps-view__controls,
    .gramps-view__mode-switch {
        order: 3;
    }

    .gramps-view__detail-panel {
        width: 100%;
        right: -100%;
    }
}

/* ============================================
   Pills Container & Family Chart View
   ============================================ */

.gramps-view-container {
    min-height: 720px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.gramps-view-shell {
    display: flex;
    flex-direction: column;
}

.gramps-view-nav-shell {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin-bottom: 1.5rem !important;
}

.gramps-view-nav-header {
    padding: 0;
}

.gramps-view-nav-bar {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    padding: 0;
}

.gramps-view-nav-submenu {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    width: max-content;
    min-width: 0;
    align-self: center;
    min-height: 36px;
    height: 36px;
    margin: 0;
    padding: 0 8px;
    position: relative;
    border-top: 1px solid #8b633a;
    border-bottom: 1px solid #8b633a;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    background: #ffffff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), inset 0 -1px 0 rgba(255, 255, 255, 0.82);
    transform-origin: left center;
}

.gramps-view-nav-submenu.is-entering {
    animation: grampsSubmenuPocket 220ms ease-out;
}

.gramps-view-nav-category {
    border: 1px solid #8b633a;
    background: #9c7347;
    color: #fffaf3;
    border-radius: 0;
    min-height: 36px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: none;
    margin-left: -1px;
    white-space: nowrap;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.gramps-view-nav-category:first-child {
    margin-left: 0;
    border-radius: 10px 0 0 10px;
}

.gramps-view-nav-category:last-of-type {
    border-radius: 0 10px 10px 0;
}

.gramps-view-nav-submenu + .gramps-view-nav-category {
    margin-left: -1px;
    border-radius: 0;
}

.gramps-view-nav-category:hover,
.gramps-view-nav-category:focus-visible {
    transform: translateY(-1px);
    border-color: #764f29;
    background: #8a633a;
    color: #fffaf3;
    box-shadow: 0 10px 18px rgba(122, 85, 46, 0.16);
    outline: none;
}

.gramps-view-nav-category.is-active {
    background: #6f4524;
    border-color: #65401f;
    border-radius: 0;
    color: #fffaf3;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    margin-left: -1px;
    margin-right: 0;
    order: 0;
}

.gramps-view-nav-category:first-child.is-active {
    margin-left: 0;
    border-radius: 10px 0 0 10px;
}

.gramps-view-nav-category.is-active:has(+ .gramps-view-nav-submenu) {
    border-radius: 0;
}

.gramps-view-nav-category:first-child.is-active:has(+ .gramps-view-nav-submenu) {
    border-radius: 10px 0 0 10px;
}

.gramps-view-nav-level {
    margin-bottom: 0 !important;
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 4px;
    min-width: max-content;
}

.gramps-view-nav-level .nav-item {
    margin: 0;
}

.gramps-view-nav-level .nav-link {
    padding: 0.26rem 0.62rem;
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: #5c3518;
    white-space: nowrap;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.gramps-view-nav-level .nav-link:hover,
.gramps-view-nav-level .nav-link:focus-visible {
    border-color: rgba(122, 85, 46, 0.25);
    background: #fffaf3;
    color: #5c3518;
    outline: none;
}

.gramps-view-nav-level .nav-link.active,
.gramps-view-nav-level .show > .nav-link {
    background: #f3e6d5;
    border-color: rgba(122, 85, 46, 0.35);
    color: #5c3518;
    box-shadow: none;
}

.gramps-view-nav-level .nav-link i {
    font-size: 12px;
}

.gramps-view-nav-level .nav-item[hidden] {
    display: none !important;
}

@keyframes grampsSubmenuPocket {
    from {
        opacity: 0;
        transform: translateX(-10px) scaleX(0.88);
        clip-path: inset(0 100% 0 0 round 10px);
    }
    to {
        opacity: 1;
        transform: translateX(0) scaleX(1);
        clip-path: inset(0 0 0 0 round 10px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .gramps-view-nav-submenu.is-entering {
        animation: none;
    }
}

.gramps-view-container .tab-content {
    min-height: 680px;
}

.gramps-view-container .tab-pane {
    height: 100%;
}

.gramps-view-fulltree {
    min-height: 760px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.gramps-view-fulltree__frame {
    display: block;
    width: 100%;
    height: calc(100vh - 250px);
    min-height: 760px;
    border: 0;
    background: #f8fafc;
}

.gramps-view-fulltree__empty {
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

@media (max-width: 768px) {
    .gramps-view-nav-shell {
        padding: 0;
        border-radius: 0;
    }

    .gramps-view-nav-bar {
        gap: 8px;
        padding-bottom: 2px;
    }

    .gramps-view-nav-submenu {
        margin: 0;
        padding: 0 6px;
    }

    .gramps-view-nav-category {
        min-height: 36px;
        padding: 0 12px;
    }

    .gramps-view-nav-level .nav-link {
        padding: 0.34rem 0.58rem;
    }

    .gramps-view-fulltree,
    .gramps-view-fulltree__frame {
        min-height: 680px;
    }

    .gramps-view-fulltree__frame {
        height: 82vh;
    }
}

/* Family Chart View */
.gramps-view-fchart {
    min-height: 680px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gramps-view-fchart__toolbar {
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    z-index: 100;
    position: relative;
}

.gramps-view-fchart__selector {
    position: relative;
    flex: 0 1 400px;
    min-width: 300px;
    z-index: 101;
}

.gramps-view-fchart__person-picker {
    position: relative;
}

.gramps-view-fchart__person-picker.is-open .gramps-view-fchart__person-dropdown {
    display: block;
}

.gramps-view-fchart__person-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    display: none;
}

.gramps-view-fchart__person-dropdown.show {
    display: block;
}

.gramps-view-fchart__person-header {
    display: grid;
    grid-template-columns: 1fr 1fr 105px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.gramps-view-fchart__sort-btn {
    text-decoration: none !important;
    font-size: 12px;
    padding: 8px;
    text-align: left;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    width: 100%;
    height: 100%;
}

.gramps-view-fchart__sort-btn[data-sort="birth_date"] {
    text-align: center;
}

.gramps-view-fchart__sort-btn:hover,
.gramps-view-fchart__sort-btn:focus,
.gramps-view-fchart__sort-btn:active,
.gramps-view-fchart__sort-btn.active {
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

.gramps-view-fchart__sort-icon {
    margin-left: 4px;
    font-size: 10px;
}

.gramps-view-fchart__person-list {
    max-height: 280px;
    overflow-y: auto;
}

.gramps-view-fchart__person-row {
    display: grid;
    grid-template-columns: 1fr 1fr 105px;
    padding: 0;
    font-size: 13px;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    width: 100%;
    text-align: left;
    background: #fff;
    cursor: pointer;
}

.gramps-view-fchart__person-col {
    padding: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gramps-view-fchart__person-row:hover {
    background: #f1f5f9;
}

.gramps-view-fchart__person-row.active {
    background: #e3f2fd;
}

.gramps-view-fchart__person-col--surname {
    font-weight: 600;
}

.gramps-view-fchart__person-col--birth {
    text-align: center;
    color: #666;
}

.gramps-view-fchart__controls .btn {
    width: 36px;
    height: 36px;
    padding: 0;
}

.gramps-view-fchart__btn--undo {
    width: auto !important;
    min-width: 104px;
    padding: 0 12px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    border-width: 1px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.16);
}

.gramps-view-fchart__btn--undo.is-disabled,
.gramps-view-fchart__btn--undo:disabled {
    opacity: 0.65;
    cursor: default;
    pointer-events: none;
}

.gramps-view-fchart__btn--undo span {
    display: inline-block;
    line-height: 1;
}

.gramps-view-fchart__canvas {
    flex: 1 1 auto;
    min-height: 600px;
    position: relative;
    overflow: hidden;
    background: #212121;
}

/* Family Chart library requires .f3 class on container */
.gramps-view-fchart__canvas.f3 {
    color: #fff;
    height: 600px;
}

.gramps-view-fchart__canvas.f3 > svg {
    width: 100%;
    height: 100%;
}

.gramps-view-fchart__canvas .f3-card {
    cursor: pointer;
}

.gramps-view-fchart__canvas .f3-card:hover {
    filter: brightness(1.1);
}

/* Gender colors for family-chart cards */
.gramps-view-fchart__canvas .f3-card[data-gender="M"] {
    background: #2196f3;
}

.gramps-view-fchart__canvas .f3-card[data-gender="F"] {
    background: #e91e63;
}

/* Error state */
.gramps-view__error {
    margin: 20px;
}

/* Loading state in fchart */
.gramps-view-fchart .gramps-view__loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 40;
    color: #64748b;
    font-weight: 500;
}

/* ========================================
   3D Force Graph View Styles
   ======================================== */

.gramps-view-3d-container {
    width: 100%;
    min-height: 700px;
    position: relative;
}

.gramps-3d-wrapper {
    width: 100%;
    height: 100%;
    min-height: 700px;
    display: flex;
    flex-direction: column;
    background: #1a1a2e;
    border-radius: 8px;
    overflow: hidden;
}

.gramps-3d-toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
    flex-wrap: wrap;
}

.gramps-3d-search {
    position: relative;
    min-width: 250px;
    flex: 1;
    max-width: 400px;
}

.gramps-3d-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #1a1a2e;
    color: #e8e8e8;
    font-size: 14px;
}

.gramps-3d-search-input:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

.gramps-3d-search-input::placeholder {
    color: #6c757d;
}

.gramps-3d-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #16213e;
    border: 1px solid #0f3460;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.gramps-3d-search-results .search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    color: #e8e8e8;
    border-bottom: 1px solid #0f3460;
    transition: background 0.2s;
}

.gramps-3d-search-results .search-result-item:hover {
    background: #0f3460;
}

.gramps-3d-search-results .search-result-item:last-child {
    border-bottom: none;
}

.gramps-3d-search-results .result-name {
    font-weight: 500;
}

.gramps-3d-search-results .result-date {
    color: #6c757d;
    font-size: 12px;
    margin-left: 8px;
}

.gramps-3d-search-results .no-results {
    padding: 12px;
    color: #6c757d;
    text-align: center;
}

.gramps-3d-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gramps-3d-controls label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #e8e8e8;
    font-size: 13px;
    cursor: pointer;
}

.gramps-3d-controls select {
    padding: 6px 10px;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #1a1a2e;
    color: #e8e8e8;
    font-size: 13px;
    cursor: pointer;
}

.gramps-3d-controls select:focus {
    outline: none;
    border-color: #4a90d9;
}

.gramps-3d-reset-btn {
    padding: 6px 12px;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #4a90d9;
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.gramps-3d-reset-btn:hover {
    background: #3a7bc8;
}

.gramps-3d-stats {
    color: #6c757d;
    font-size: 12px;
    margin-left: auto;
}

.gramps-3d-canvas {
    flex: 1;
    min-height: 600px;
    position: relative;
    pointer-events: auto !important;
}

.gramps-3d-canvas canvas {
    pointer-events: auto !important;
}

.gramps-3d-canvas > div {
    pointer-events: auto !important;
}

.gramps-3d-canvas.loading::after {
    content: 'Ładowanie...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #e8e8e8;
    font-size: 18px;
    z-index: 10;
}

.gramps-3d-canvas .error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff6b6b;
    font-size: 16px;
    text-align: center;
    padding: 20px;
}

.gramps-3d-info-panel {
    position: absolute;
    top: 70px;
    right: 15px;
    width: 280px;
    background: rgba(22, 33, 62, 0.95);
    border: 1px solid #0f3460;
    border-radius: 8px;
    display: none;
    z-index: 50;
    overflow: hidden;
}

.gramps-3d-info-panel .info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #0f3460;
    border-bottom: 1px solid #0f3460;
}

.gramps-3d-info-panel .info-header h3 {
    margin: 0;
    font-size: 16px;
    color: #e8e8e8;
    font-weight: 600;
}

.gramps-3d-info-panel .info-close {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.gramps-3d-info-panel .info-close:hover {
    color: #e8e8e8;
}

.gramps-3d-info-panel .info-body {
    padding: 15px;
    color: #e8e8e8;
}

.gramps-3d-info-panel .info-body p {
    margin: 0 0 8px;
    font-size: 14px;
}

.gramps-3d-info-panel .info-body strong {
    color: #adb5bd;
}

.gramps-3d-info-panel .info-load-tree {
    width: 100%;
    margin-top: 10px;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background: #4a90d9;
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.gramps-3d-info-panel .info-load-tree:hover {
    background: #3a7bc8;
}

/* 3D Graph tooltip styling */
.gramps-3d-canvas .scene-tooltip {
    background: rgba(22, 33, 62, 0.9) !important;
    border: 1px solid #0f3460 !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    color: #e8e8e8 !important;
    font-family: inherit !important;
    font-size: 13px !important;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .gramps-3d-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .gramps-3d-search {
        max-width: none;
    }

    .gramps-3d-controls {
        flex-wrap: wrap;
    }

    .gramps-3d-stats {
        margin-left: 0;
        text-align: center;
    }

    .gramps-3d-info-panel {
        width: calc(100% - 30px);
        right: 15px;
        left: 15px;
    }
}

/* ==========================================================================
   Timeline View Styles - MyHeritage inspired
   ========================================================================== */

/* Kolory gałęzi rodziny */
:root {
    --branch-paternal-paternal: #1e4d8c;   /* niebieski - linia ojca po ojcu */
    --branch-paternal-maternal: #2d5a27;   /* zielony - linia matki po ojcu */
    --branch-maternal-paternal: #c41e3a;   /* czerwony - linia ojca po matce */
    --branch-maternal-maternal: #d4a017;   /* żółty - linia matki po matce */
    --branch-descendants: #7b2d8e;         /* fioletowy - potomkowie */
    --branch-root: #0d6efd;                /* primary - główna osoba */
    --timeline-bg: #f8fafc;
    --timeline-decade-line: #e2e8f0;
    --timeline-historical-hatch: rgba(0, 0, 0, 0.05);
}

/* Timeline Container */
.gramps-view-timeline {
    min-height: 680px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 120px, #ffffff 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

/* Timeline Toolbar */
.gramps-view-timeline__toolbar {
    padding: 18px 18px 0;
    background: transparent;
    z-index: 100;
    position: relative;
}

.gramps-view-timeline__intro {
    padding: 0 2px;
}

.gramps-view-timeline__panel,
.gramps-view-timeline__controls-card,
.gramps-view-timeline__metric {
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.04);
}

.gramps-view-timeline__selector {
    position: relative;
    z-index: 101;
}

.gramps-view-timeline__person-picker {
    position: relative;
}

.gramps-view-timeline__person-picker.is-open .gramps-view-timeline__person-dropdown {
    display: block;
}

.gramps-view-timeline__person-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
    display: none;
    overflow: hidden;
}

.gramps-view-timeline__person-header {
    display: grid;
    grid-template-columns: 1fr 1fr 105px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.gramps-view-timeline__sort-btn {
    text-decoration: none !important;
    font-size: 12px;
    padding: 10px 12px;
    text-align: left;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100%;
}

.gramps-view-timeline__sort-icon {
    margin-left: 4px;
    font-size: 10px;
}

.gramps-view-timeline__person-list {
    max-height: 280px;
    overflow-y: auto;
}

.gramps-view-timeline__search-empty {
    padding: 18px 16px;
}

.gramps-view-timeline__person-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
}

.gramps-view-timeline__person-option-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.gramps-view-timeline__person-option-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(13, 110, 253, 0.12);
    color: #0d6efd;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex: 0 0 auto;
}

.gramps-view-timeline__person-option-name {
    display: block;
    color: #1e293b;
    font-weight: 600;
}

.gramps-view-timeline__person-option-id {
    display: block;
    color: #64748b;
    font-size: 11px;
}

.gramps-view-timeline__person-option-meta {
    color: #64748b;
    font-size: 12px;
    flex: 0 0 auto;
    text-align: right;
}

.gramps-view-timeline__gen-value {
    color: #ffd54f;
    font-weight: 600;
}

.gramps-view-timeline__selection-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.08), rgba(255, 255, 255, 0.92));
    border: 1px solid rgba(13, 110, 253, 0.12);
}

.gramps-view-timeline__selection-card.is-empty {
    background: #f8fafc;
    border-style: dashed;
}

.gramps-view-timeline__selection-avatar {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #0d6efd;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: 0.04em;
    overflow: hidden;
    flex: 0 0 auto;
}

.gramps-view-timeline__selection-avatar.has-photo {
    background: #e2e8f0;
}

.gramps-view-timeline__selection-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gramps-view-timeline__selection-body {
    min-width: 0;
}

.gramps-view-timeline__selection-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
}

.gramps-view-timeline__selection-meta {
    font-size: 0.9rem;
    color: #475569;
    margin-top: 2px;
}

.gramps-view-timeline__selection-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.gramps-view-timeline__metric-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.35;
}

.gramps-view-timeline__metric-note {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 6px;
}

.gramps-view-timeline__legend-shell .card {
    border-radius: 16px;
    background: #fbfdff;
}

.gramps-view-timeline__legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gramps-view-timeline__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 0.82rem;
}

.gramps-view-timeline__legend-item.is-muted {
    opacity: 0.65;
}

.gramps-view-timeline__legend-swatch {
    width: 16px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.gramps-view-timeline__legend-swatch.is-root {
    background: var(--branch-root);
}

.gramps-view-timeline__legend-swatch.is-line {
    background: linear-gradient(90deg, var(--branch-paternal-paternal), var(--branch-maternal-paternal));
}

.gramps-view-timeline__legend-swatch.is-connection {
    background: #94a3b8;
}

.gramps-view-timeline__legend-swatch.is-period {
    background: rgba(30, 77, 140, 0.25);
}

.gramps-view-timeline__legend-note {
    min-width: 240px;
}

.gramps-view-timeline__legend-status {
    border: 1px solid transparent;
}

.gramps-view-timeline__legend-status.is-success {
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
    border-color: rgba(22, 163, 74, 0.2);
}

.gramps-view-timeline__legend-status.is-warning {
    background: rgba(245, 158, 11, 0.14);
    color: #92400e;
    border-color: rgba(245, 158, 11, 0.22);
}

.gramps-view-timeline__zoom-controls .btn {
    flex: 1 1 auto;
}

/* Timeline Canvas */
.gramps-view-timeline__canvas {
    flex: 1 1 auto;
    min-height: 600px;
    position: relative;
    overflow: visible;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    margin-top: 18px;
}

.gramps-view-timeline__canvas svg {
    width: 100%;
    display: block;
    /* height is set dynamically by JS based on number of persons */
}

.timeline-loading {
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98));
    min-height: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Life Bars */
.timeline-life-bar {
    cursor: pointer;
    transition: filter 0.2s ease;
}

.timeline-life-bar:hover {
    filter: brightness(1.1);
}

.timeline-life-bar__bg {
    rx: 4px;
    ry: 4px;
}

.timeline-life-bar--deceased .timeline-life-bar__bg {
    /* Zaokrąglony prawy koniec dla zmarłych */
}

.timeline-life-bar__photo {
    clip-path: circle(14px at 16px 18px);
}

.timeline-life-bar__name {
    font-size: 12px;
    font-weight: 600;
    fill: #fff;
    pointer-events: none;
}

.timeline-life-bar__age {
    font-size: 10px;
    fill: rgba(255, 255, 255, 0.8);
    pointer-events: none;
}

.timeline-life-bar__death-icon {
    font-size: 12px;
    fill: rgba(255, 255, 255, 0.9);
}

/* Branch Colors */
.timeline-life-bar--paternal-paternal .timeline-life-bar__bg {
    fill: var(--branch-paternal-paternal);
}

.timeline-life-bar--paternal-maternal .timeline-life-bar__bg {
    fill: var(--branch-paternal-maternal);
}

.timeline-life-bar--maternal-paternal .timeline-life-bar__bg {
    fill: var(--branch-maternal-paternal);
}

.timeline-life-bar--maternal-maternal .timeline-life-bar__bg {
    fill: var(--branch-maternal-maternal);
}

.timeline-life-bar--descendants .timeline-life-bar__bg {
    fill: var(--branch-descendants);
}

.timeline-life-bar--root .timeline-life-bar__bg {
    fill: var(--branch-root);
    stroke: #fff;
    stroke-width: 2px;
}

/* Connections */
.timeline-connection {
    fill: none;
    stroke: #94a3b8;
    stroke-width: 1.5px;
}

.timeline-connection__arrow {
    fill: #94a3b8;
}

.timeline-connection__age {
    font-size: 10px;
    fill: #64748b;
    font-weight: 500;
}

/* Error Indicators */
.timeline-error-indicator {
    fill: #dc2626;
    cursor: pointer;
}

.timeline-error-indicator:hover {
    fill: #b91c1c;
}

/* Background - Decades */
.timeline-decade-line {
    stroke: var(--timeline-decade-line);
    stroke-width: 1px;
}

.timeline-decade-label {
    font-size: 11px;
    fill: #94a3b8;
    text-anchor: middle;
}

/* Historical Periods */
.timeline-historical-period {
    fill: var(--timeline-historical-hatch);
    stroke: none;
}

.timeline-historical-period--war {
    fill: rgba(100, 100, 100, 0.08);
}

.timeline-historical-period--era {
    fill: rgba(30, 77, 140, 0.05);
}

.timeline-historical-label {
    font-size: 10px;
    fill: #64748b;
    font-style: italic;
    pointer-events: none;
}

/* Context Menu */
.timeline-context-menu {
    position: absolute;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
    display: none;
}

.timeline-context-menu.is-visible {
    display: block;
}

.timeline-context-menu__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.timeline-context-menu__photo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.timeline-context-menu__name {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
}

.timeline-context-menu__dates {
    font-size: 12px;
    color: #64748b;
}

.timeline-context-menu__item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    transition: background 0.15s;
}

.timeline-context-menu__item:hover {
    background: #f1f5f9;
}

.timeline-context-menu__item i {
    width: 16px;
    color: #94a3b8;
}

/* Tooltip */
.timeline-tooltip {
    position: absolute;
    background: rgba(30, 41, 59, 0.95);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1001;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: none;
}

.timeline-tooltip .tooltip-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.timeline-tooltip .tooltip-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.timeline-tooltip .tooltip-name {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
}

.timeline-tooltip .tooltip-dates {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 4px;
}

.timeline-tooltip .tooltip-age {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
}

.timeline-tooltip .tooltip-branch {
    font-size: 11px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.timeline-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 20px;
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: rgba(30, 41, 59, 0.95) transparent transparent;
}

/* Legend */
.timeline-legend {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 11px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.timeline-legend__title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.timeline-legend__item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.timeline-legend__color {
    width: 16px;
    height: 10px;
    border-radius: 2px;
}

.timeline-legend__label {
    color: #64748b;
}

/* Loading State */
.gramps-view-timeline .gramps-view__loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 30;
}

/* Responsive */
@media (max-width: 1200px) {
    .gramps-view-timeline__toolbar {
        padding: 16px 16px 0;
    }

    .gramps-view-timeline__legend-note {
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .gramps-view-timeline__toolbar {
        padding: 14px 14px 0;
    }

    .gramps-view-timeline__selector {
        min-width: 100%;
        max-width: 100%;
    }

    .gramps-view-timeline__selection-card {
        align-items: flex-start;
    }

    .gramps-view-timeline__person-option {
        align-items: flex-start;
        flex-direction: column;
    }

    .gramps-view-timeline__legend-items {
        flex-direction: column;
        align-items: stretch;
    }

    .gramps-view-timeline__legend-item {
        justify-content: flex-start;
    }

    .gramps-view-timeline__canvas {
        margin-top: 14px;
    }

    .timeline-life-bar__name {
        font-size: 10px;
    }
}

/* ================================================================
   Fan Chart (Wachlarz)
   ================================================================ */

.gramps-view-fanchart {
    min-height: 600px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    position: relative;
}

.gramps-view-fanchart__toolbar {
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    position: relative;
    z-index: 10;
}

.gramps-view-fanchart__canvas {
    position: relative;
    overflow: hidden;
    min-height: 500px;
}

.gramps-view-fanchart__svg {
    display: block;
}

/* Tooltip */
.gramps-view-fanchart__tooltip {
    position: absolute;
    z-index: 100;
    background: rgba(33, 37, 41, 0.92);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    pointer-events: none;
    max-width: 250px;
    line-height: 1.4;
    white-space: nowrap;
}

/* Root text */
.gramps-view-fanchart__root-text {
    font-size: 12px;
    font-weight: 600;
    fill: #212529;
}

.gramps-view-fanchart__root-dates {
    font-size: 10px;
    fill: #6c757d;
}

/* Arc text */
.gramps-view-fanchart__arc-text {
    font-size: 10px;
    fill: #fff;
    pointer-events: none;
}

.gramps-view-fanchart__arc-text textPath {
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

/* Person picker (reuses fchart pattern) */
.gramps-view-fanchart__person-picker {
    position: relative;
}

.gramps-view-fanchart__person-picker.is-open .gramps-view-fanchart__person-dropdown {
    display: block;
}

.gramps-view-fanchart__person-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1050;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    display: none !important;
}

.gramps-view-fanchart__person-picker.is-open .gramps-view-fanchart__person-dropdown,
.gramps-view-fanchart__person-dropdown.show {
    display: block !important;
}

.gramps-view-fanchart__person-header {
    display: grid;
    grid-template-columns: 1fr 1fr 105px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.gramps-view-fanchart__sort-btn {
    text-decoration: none !important;
    font-size: 12px;
    padding: 8px;
    text-align: left;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    width: 100%;
    height: 100%;
}

.gramps-view-fanchart__sort-btn[data-sort="birth_date"] {
    text-align: center;
}

.gramps-view-fanchart__sort-btn:hover,
.gramps-view-fanchart__sort-btn:focus,
.gramps-view-fanchart__sort-btn:active {
    background: transparent !important;
    box-shadow: none !important;
}

.gramps-view-fanchart__sort-icon {
    margin-left: 4px;
    font-size: 10px;
}

.gramps-view-fanchart__person-list {
    max-height: 280px;
    overflow-y: auto;
}

.gramps-view-fanchart__person-row {
    display: grid;
    grid-template-columns: 1fr 1fr 105px;
    padding: 0;
    font-size: 13px;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    width: 100%;
    text-align: left;
    background: #fff;
    cursor: pointer;
}

.gramps-view-fanchart__person-col {
    padding: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gramps-view-fanchart__person-row:hover {
    background: #f1f5f9;
}

.gramps-view-fanchart__person-row.active {
    background: #e3f2fd;
}

.gramps-view-fanchart__person-col--surname {
    font-weight: 600;
}

.gramps-view-fanchart__person-col--birth {
    text-align: center;
    color: #6c757d;
}

/* ================================================================
   Map (Mapa Rodzinna)
   ================================================================ */

.gramps-view-map {
    min-height: 620px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    position: relative;
}

.gramps-view-map__toolbar {
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    position: relative;
    z-index: 1200;
}

.gramps-view-map__canvas {
    height: 620px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.gramps-view-map__empty {
    padding: 24px;
}

/* Map marker */
.gramps-view-map__marker-wrapper {
    background: none !important;
    border: none !important;
}

.gramps-view-map__marker {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid #fff;
}

.gramps-view-map__popup {
    min-width: 260px;
    max-width: 380px;
}

.gramps-view-map__popup-title {
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 4px;
}

.gramps-view-map__popup-count {
    color: #475569;
    font-size: 13px;
    margin-bottom: 8px;
}

.gramps-view-map__popup-events {
    margin: 0;
    padding-left: 18px;
    max-height: 260px;
    overflow-y: auto;
}

.gramps-view-map__popup-event {
    margin: 0 0 6px;
    padding-left: 2px;
}

.gramps-view-map__popup-event-type {
    display: block;
    font-weight: 600;
    line-height: 1.25;
}

.gramps-view-map__popup-event-meta {
    display: block;
    color: #334155;
    font-size: 12px;
    line-height: 1.35;
}

.gramps-view-map__popup-date {
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.gramps-view-map__popup-subject-info {
    color: #64748b;
    font-size: 11px;
}

/* Loading overlay */
.gramps-view-map__loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 800;
}

/* Person picker */
.gramps-view-map__person-picker {
    position: relative;
}

.gramps-view-map__person-picker.is-open .gramps-view-map__person-dropdown {
    display: block;
}

.gramps-view-map__person-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1300;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    display: none !important;
    max-height: min(440px, 70vh);
    overflow: auto;
}

.gramps-view-map__person-picker.is-open .gramps-view-map__person-dropdown,
.gramps-view-map__person-dropdown.show {
    display: block !important;
}

.gramps-view-map__person-header {
    display: grid;
    grid-template-columns: 1fr 1fr 105px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.gramps-view-map__sort-btn {
    text-decoration: none !important;
    font-size: 12px;
    padding: 8px;
    text-align: left;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    width: 100%;
    height: 100%;
}

.gramps-view-map__sort-btn[data-sort="birth_date"] {
    text-align: center;
}

.gramps-view-map__sort-btn:hover,
.gramps-view-map__sort-btn:focus,
.gramps-view-map__sort-btn:active {
    background: transparent !important;
    box-shadow: none !important;
}

.gramps-view-map__sort-icon {
    margin-left: 4px;
    font-size: 10px;
}

.gramps-view-map__person-list {
    max-height: 280px;
    overflow-y: auto;
}

.gramps-view-map__person-row {
    display: grid;
    grid-template-columns: 1fr 1fr 105px;
    padding: 0;
    font-size: 13px;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    width: 100%;
    text-align: left;
    background: #fff;
    cursor: pointer;
}

.gramps-view-map__person-col {
    padding: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gramps-view-map__person-row:hover {
    background: #f1f5f9;
}

.gramps-view-map__person-row.active {
    background: #e3f2fd;
}

.gramps-view-map__person-col--surname {
    font-weight: 600;
}

.gramps-view-map__person-col--birth {
    text-align: center;
    color: #6c757d;
}

/* ================================================================
   Relationship Finder (Pokrewieństwo)
   ================================================================ */

.gramps-view-relationship {
    min-height: 300px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    position: relative;
    padding: 20px;
}

.gramps-view-relationship__toolbar {
    background: transparent;
    border-radius: 0;
}

.gramps-view-relationship__result {
    margin-top: 8px;
}

.gramps-view-relationship__intro h6 {
    font-size: 1.05rem;
}

.gramps-view-relationship__panel,
.gramps-view-relationship__actions,
.gramps-view-relationship__hero,
.gramps-view-relationship__ancestor,
.gramps-view-relationship__route,
.gramps-view-relationship__status {
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
}

.gramps-view-relationship__selection-empty {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    color: #64748b;
    background: #f8fafc;
}

.gramps-view-relationship__selection-empty i {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #e2e8f0;
}

.gramps-view-relationship__selection-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.gramps-view-relationship__selection-avatar {
    flex-shrink: 0;
}

.gramps-view-relationship__avatar {
    width: 44px;
    height: 44px;
    object-fit: cover;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.gramps-view-relationship__avatar-placeholder {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 999px;
    color: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.gramps-view-relationship__avatar-placeholder.is-male {
    background: linear-gradient(135deg, #1d4ed8, #38bdf8);
}

.gramps-view-relationship__avatar-placeholder.is-female {
    background: linear-gradient(135deg, #db2777, #fb7185);
}

.gramps-view-relationship__selection-name {
    font-weight: 700;
    color: #0f172a;
}

.gramps-view-relationship__selection-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.gramps-view-relationship__hero {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.08), rgba(255, 255, 255, 0.95));
}

.gramps-view-relationship__hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gramps-view-relationship__hero-person {
    background: rgba(255, 255, 255, 0.82);
}

.gramps-view-relationship__hero-avatar,
.gramps-view-relationship__ancestor-avatar {
    flex-shrink: 0;
}

.gramps-view-relationship__hero-bridge {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mdb-primary, #0d6efd);
    font-size: 1.2rem;
}

.gramps-view-relationship__ancestor {
    border-color: rgba(22, 163, 74, 0.24) !important;
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.08), rgba(255, 255, 255, 0.96));
}

.gramps-view-relationship__ancestor-metrics {
    display: grid;
    gap: 8px;
    align-content: center;
}

.gramps-view-relationship__metric {
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #334155;
}

.gramps-view-relationship__route-scroller {
    overflow-x: auto;
    padding-bottom: 4px;
}

.gramps-view-relationship__route-track {
    display: flex;
    align-items: stretch;
    gap: 12px;
    min-width: min-content;
}

.gramps-view-relationship__route-person {
    width: 260px;
    flex: 0 0 260px;
    border-radius: 16px;
}

.gramps-view-relationship__route-person.is-common-ancestor {
    box-shadow: 0 18px 32px rgba(22, 163, 74, 0.18);
    outline: 2px solid rgba(22, 163, 74, 0.18);
}

.gramps-view-relationship__route-person.is-start {
    background: linear-gradient(180deg, rgba(13, 110, 253, 0.08), #fff);
}

.gramps-view-relationship__route-person.is-end {
    background: linear-gradient(180deg, rgba(100, 116, 139, 0.08), #fff);
}

.gramps-view-relationship__route-person-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
}

.gramps-view-relationship__route-person-body {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gramps-view-relationship__route-avatar {
    flex-shrink: 0;
}

.gramps-view-relationship__connector {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gramps-view-relationship__connector-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: #fff;
    color: #475569;
    white-space: nowrap;
    font-size: 0.88rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.gramps-view-relationship__status {
    background: rgba(255, 255, 255, 0.86);
}

.gramps-view-relationship__status-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #eff6ff;
    font-size: 1.4rem;
}

/* Person picker */
.gramps-view-relationship__person-picker {
    position: relative;
}

.gramps-view-relationship__person-picker.is-open .gramps-view-relationship__person-dropdown {
    display: block;
}

.gramps-view-relationship__person-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1050;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    box-shadow: 0 1rem 2rem rgba(15, 23, 42, 0.14);
    display: none !important;
    overflow: hidden;
}

.gramps-view-relationship__person-picker.is-open .gramps-view-relationship__person-dropdown,
.gramps-view-relationship__person-dropdown.show {
    display: block !important;
}

.gramps-view-relationship__person-header {
    display: grid;
    grid-template-columns: 1fr 1fr 105px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.gramps-view-relationship__sort-btn {
    text-decoration: none !important;
    font-size: 12px;
    padding: 8px;
    text-align: left;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    width: 100%;
    height: 100%;
}

.gramps-view-relationship__sort-btn[data-sort="birth_date"] {
    text-align: center;
}

.gramps-view-relationship__sort-btn:hover,
.gramps-view-relationship__sort-btn:focus,
.gramps-view-relationship__sort-btn:active {
    background: transparent !important;
    box-shadow: none !important;
}

.gramps-view-relationship__sort-icon {
    margin-left: 4px;
    font-size: 10px;
}

.gramps-view-relationship__person-list {
    max-height: 280px;
    overflow-y: auto;
}

.gramps-view-relationship__person-row {
    display: grid;
    grid-template-columns: 1fr 1fr 105px;
    padding: 0;
    font-size: 13px;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    width: 100%;
    text-align: left;
    background: #fff;
    cursor: pointer;
}

.gramps-view-relationship__person-col {
    padding: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gramps-view-relationship__person-row:hover {
    background: #f1f5f9;
}

.gramps-view-relationship__person-row.active {
    background: #e3f2fd;
}

.gramps-view-relationship__person-col--surname {
    font-weight: 600;
}

.gramps-view-relationship__person-col--birth {
    text-align: center;
    color: #6c757d;
}

/* ================================================================
   Responsive: Fan Chart, Map, Relationship
   ================================================================ */

@media (max-width: 768px) {
    .gramps-view-fanchart__toolbar,
    .gramps-view-map__toolbar,
    .gramps-view-relationship__toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .gramps-view-fanchart__selector,
    .gramps-view-map__selector,
    .gramps-view-relationship__selector {
        min-width: 100% !important;
        max-width: 100% !important;
    }

    .gramps-view-map__canvas {
        height: 400px;
    }

    .gramps-view-relationship {
        padding: 16px;
    }

    .gramps-view-relationship__hero-bridge {
        min-height: auto;
        padding: 6px 0;
    }

    .gramps-view-relationship__route-track {
        flex-direction: column;
        min-width: 100%;
    }

    .gramps-view-relationship__route-person {
        width: 100%;
        flex-basis: auto;
    }

    .gramps-view-relationship__connector {
        transform: rotate(90deg);
        align-self: center;
        padding: 8px 0;
    }

    .gramps-view-relationship__actions .card-body {
        flex-direction: row !important;
    }

    .gramps-view-relationship__selection-card,
    .gramps-view-relationship__selection-empty,
    .gramps-view-relationship__route-person-body {
        align-items: flex-start;
    }
}

/* ================================================================
   Family Card
   ================================================================ */

.gramps-view-family__intro h6,
.gramps-view-family__section-header h6 {
    color: #17324d;
}

.gramps-view-family__result,
.gramps-view-family__layout {
    display: grid;
    gap: 1.25rem;
}

.gramps-view-family__person-picker {
    position: relative;
}

.gramps-view-family__person-dropdown {
    width: 100%;
    max-height: 320px;
    overflow: hidden auto;
    padding: 0;
}

.gramps-view-family__person-header,
.gramps-view-family__person-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(64px, 0.7fr);
    gap: 0.5rem;
    align-items: center;
}

.gramps-view-family__person-header {
    padding: 0.5rem 0.75rem;
}

.gramps-view-family__sort-btn {
    justify-content: flex-start;
    text-decoration: none;
}

.gramps-view-family__person-col {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gramps-view-family__selection-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(244, 249, 255, 0.96), rgba(255, 255, 255, 0.98));
    border: 1px solid rgba(23, 50, 77, 0.08);
}

.gramps-view-family__selection-card--empty {
    justify-content: center;
    text-align: center;
    background: rgba(248, 250, 252, 0.92);
}

.gramps-view-family__selection-avatar,
.gramps-view-family__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid rgba(23, 50, 77, 0.1);
    position: relative;
}

.gramps-view-family__selection-avatar {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
}

.gramps-view-family__avatar {
    width: 66px;
    height: 66px;
    flex: 0 0 66px;
}

.gramps-view-family__avatar img,
.gramps-view-family__selection-avatar img,
.gramps-view-family__child-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gramps-view-family__avatar:has(.gramps-view-family__portrait-frame),
.gramps-view-family__child-avatar:has(.gramps-view-family__portrait-frame) {
    width: 66px;
    height: 95px;
    flex-basis: 66px;
    border: 0;
    background: transparent;
    overflow: visible;
}

.gramps-view-family__selection-avatar:has(.gramps-view-family__portrait-frame) {
    width: 54px;
    height: 78px;
    flex-basis: 54px;
    border: 0;
    background: transparent;
    overflow: visible;
}

.gramps-view-family__portrait-frame {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
}

.gramps-view-family__portrait-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: url('img/avatar-empty-frame.png') center / contain no-repeat;
}

.gramps-view-family__portrait-crop {
    position: absolute;
    z-index: 1;
    left: 9.2%;
    top: 7.7%;
    width: 81.9%;
    height: 84.5%;
    background-repeat: no-repeat;
    border-radius: 48% / 42%;
}

.gramps-view-family__avatar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    align-self: stretch;
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    border-radius: 12px;
    overflow: hidden;
    line-height: 0;
}

.gramps-view-family__avatar-icon--male {
    background: #cfe1f4;
}

.gramps-view-family__avatar-icon--female {
    background: #ffc1e6;
}

.gramps-view-family__avatar-icon--unknown {
    background: #e2e8f0;
}

.gramps-view-family__avatar-silhouette {
    position: absolute;
    inset: 8% 8% 4% 8%;
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: contain;
}

.gramps-view-family__avatar-icon--male .gramps-view-family__avatar-silhouette {
    background-image: url('avatar-profile-male.svg');
}

.gramps-view-family__avatar-icon--female .gramps-view-family__avatar-silhouette {
    background-image: url('avatar-profile-female.svg');
}

.gramps-view-family__avatar-icon--unknown .gramps-view-family__avatar-silhouette {
    background: #64748b;
    border-radius: 48% 48% 44% 44%;
    inset: 14% 18% 8% 18%;
}

.gramps-view-family__hero {
    background:
        radial-gradient(circle at top left, rgba(210, 231, 250, 0.65), transparent 52%),
        linear-gradient(135deg, rgba(255, 252, 246, 0.98), rgba(246, 250, 255, 0.98));
}

.gramps-view-family__hero-copy {
    margin-bottom: 1rem;
}

.gramps-view-family__hero-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.gramps-view-family__hero-card {
    padding: 1rem;
    border-radius: 1.1rem;
    border: 1px solid rgba(23, 50, 77, 0.08);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.gramps-view-family__hero-card--ghost {
    background: rgba(248, 250, 252, 0.94);
}

.gramps-view-family__hero-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.gramps-view-family__hero-label {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
}

.gramps-view-family__years {
    color: #0f588c;
    font-size: 0.92rem;
    font-weight: 600;
}

.gramps-view-family__life-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    color: #0f588c;
    font-size: 0.94rem;
    font-weight: 600;
    line-height: 1.35;
}

.gramps-view-family__life-dates span {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
}

.gramps-view-family__life-dates strong {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.gramps-view-family__hero-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.gramps-view-family__hero-meta div {
    padding: 0.75rem 0.85rem;
    border-radius: 0.9rem;
    background: rgba(245, 248, 251, 0.9);
}

.gramps-view-family__hero-meta span {
    display: block;
    color: #64748b;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.25rem;
}

.gramps-view-family__hero-meta strong {
    color: #17324d;
    font-size: 0.95rem;
}

.gramps-view-family__hero-meta--with-parents .gramps-view-family__hero-meta-parent {
    grid-column: 1 / -1;
}

.gramps-view-family__hero-meta-parent strong {
    display: block;
    line-height: 1.35;
}

.gramps-view-family__hero-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.gramps-view-family__fact {
    min-width: 0;
    padding: 0.7rem 0.8rem;
    border-radius: 0.8rem;
    background: rgba(245, 248, 251, 0.92);
}

.gramps-view-family__fact span {
    display: block;
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.gramps-view-family__fact strong {
    display: block;
    color: #17324d;
    font-size: 0.92rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.gramps-view-family__family-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.gramps-view-family__summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.gramps-view-family__summary-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 0.7rem;
    align-items: flex-start;
    min-width: 0;
    padding: 0.8rem;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(23, 50, 77, 0.08);
}

.gramps-view-family__summary-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(15, 88, 140, 0.08);
    color: #0f588c;
}

.gramps-view-family__summary-copy {
    display: grid;
    gap: 0.12rem;
    min-width: 0;
}

.gramps-view-family__summary-copy > span {
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.gramps-view-family__summary-copy strong {
    color: #17324d;
    font-size: 0.95rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.gramps-view-family__summary-copy small {
    color: #64748b;
    font-size: 0.82rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.gramps-view-family__family-pill,
.gramps-view-family__token {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.68rem 0.95rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(23, 50, 77, 0.08);
    color: #17324d;
    font-weight: 600;
}

.gramps-view-family__token small {
    color: #64748b;
    font-weight: 500;
}

.gramps-view-family__section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.gramps-view-family__children-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.gramps-view-family__child-card {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98));
    border: 1px solid rgba(23, 50, 77, 0.08);
}

.gramps-view-family__child-body {
    min-width: 0;
}

.gramps-view-family__child-avatar {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid rgba(23, 50, 77, 0.1);
    position: relative;
}

.gramps-view-family__child-years {
    color: #0f588c;
    font-size: 0.88rem;
    font-weight: 600;
}

.gramps-view-family__child-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.45rem;
}

.gramps-view-family__child-details span {
    max-width: 100%;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    background: rgba(15, 88, 140, 0.07);
    color: #475569;
    font-size: 0.78rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.gramps-view-family__context-block + .gramps-view-family__context-block {
    margin-top: 1rem;
}

.gramps-view-family__context-label {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.55rem;
}

.gramps-view-family__token-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.gramps-view-family__timeline-list {
    display: grid;
    gap: 0.95rem;
}

.gramps-view-family__timeline-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 0.85rem;
}

.gramps-view-family__timeline-marker {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2e7a54, #4f9770);
    box-shadow: 0 0 0 5px rgba(79, 151, 112, 0.12);
    margin-top: 0.35rem;
}

.gramps-view-family__timeline-copy {
    padding-bottom: 0.95rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.gramps-view-family__timeline-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    color: #17324d;
    margin-bottom: 0.3rem;
}

.gramps-view-family__timeline-head span,
.gramps-view-family__timeline-place,
.gramps-view-family__timeline-description {
    color: #64748b;
    font-size: 0.92rem;
}

.gramps-view-family__notes {
    display: grid;
    gap: 0.75rem;
}

.gramps-view-family__note {
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    background: rgba(248, 250, 252, 0.96);
    border: 1px solid rgba(23, 50, 77, 0.08);
    color: #334155;
    line-height: 1.6;
}

.gramps-view-family__media-grid {
    display: grid;
    gap: 0.75rem;
}

.gramps-view-family__media-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(255, 252, 246, 0.96), rgba(246, 250, 255, 0.98));
    border: 1px solid rgba(23, 50, 77, 0.08);
    color: #17324d;
    text-decoration: none;
}

.gramps-view-family__media-item:hover {
    color: #0f588c;
    border-color: rgba(15, 88, 140, 0.22);
}

.gramps-view-family__media-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(15, 88, 140, 0.08);
}

.gramps-view-family__empty,
.gramps-view-family__status {
    border-radius: 1.25rem;
}

.gramps-view-family__empty-illustration {
    width: 78px;
    height: 78px;
    margin: 0 auto 1rem;
    border-radius: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.94), rgba(255, 247, 237, 0.94));
    color: #0f588c;
    font-size: 1.85rem;
}

.gramps-view-family__empty-inline {
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    background: rgba(248, 250, 252, 0.94);
    color: #64748b;
}

.gramps-view-family__metric-value {
    color: #17324d;
    font-size: 1.08rem;
    font-weight: 700;
}

.gramps-view-family__metric-note {
    color: #64748b;
    font-size: 0.82rem;
    margin-top: 0.2rem;
}

@media (max-width: 991.98px) {
    .gramps-view-family__hero-grid,
    .gramps-view-family__children-grid,
    .gramps-view-family__summary-grid,
    .gramps-story-person__summary-grid,
    .gramps-story-person__main-grid,
    .gramps-story-person__relations,
    .gramps-story-maplet__body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .gramps-view-family__hero-meta,
    .gramps-view-family__hero-facts {
        grid-template-columns: 1fr;
    }

    .gramps-view-family__timeline-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .gramps-story-person__identity {
        grid-template-columns: 68px minmax(0, 1fr);
        align-items: flex-start;
    }

    .gramps-story-person__avatar {
        width: 68px;
        height: 68px;
        border-radius: 14px;
    }

    .gramps-story-person__timeline-head,
    .gramps-story-person__family-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .gramps-story-maplet__header {
        flex-direction: column;
    }

    .gramps-story-maplet__canvas,
    .gramps-story-maplet__empty-map {
        min-height: 190px;
    }

    .gramps-view-family__person-row,
    .gramps-view-family__person-header {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 56px;
    }
}

/* ==============================================================
 * Pocztówkowy hero osoby (A+D)
 * Modyfikator .gramps-story-person--postcard wpinany w renderPersonStory.
 * Wymaga fontów Cormorant Garamond + Lora (importowane przez family-slider.css).
 * ============================================================== */
.gramps-story-person--postcard {
    background:
        linear-gradient(#faf6ee, #faf6ee) padding-box,
        linear-gradient(135deg, #d9c4a0, #b08840 50%, #d9c4a0) border-box;
    border: 1.5px double rgba(176, 136, 64, 0.55);
    border-radius: 14px;
    box-shadow: 0 18px 42px rgba(60, 40, 20, 0.18);
    padding: 18px;
    color: #3b2f23;
    font-family: 'Lora', Georgia, serif;
}
.gramps-story-person--postcard > .gramps-story-person__hero {
    background: #fffdf6;
    border-radius: 10px;
    border: 1px solid rgba(176, 136, 64, 0.22);
    padding: 26px 28px 22px;
    margin: 0 0 16px;
    display: grid;
    gap: 22px;
}
.gramps-story-person--postcard .gramps-story-person__identity {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 28px;
    align-items: center;
}
.gramps-story-person--postcard .gramps-story-person__portrait {
    width: 220px;
    height: 280px;
    background: transparent center / contain no-repeat;
    flex-shrink: 0;
    transition: transform 0.4s ease;
}
.gramps-story-person--postcard .gramps-story-person__portrait:hover {
    transform: scale(1.02);
}
.gramps-story-person--postcard .gramps-story-person__portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    display: block;
    box-shadow: 0 10px 22px rgba(60, 40, 20, 0.22);
}
.gramps-story-person--postcard .gramps-story-person__portrait--m {
    background-image: url('img/avatar-male.png');
}
.gramps-story-person--postcard .gramps-story-person__portrait--f {
    background-image: url('img/avatar-female.png');
}
.gramps-story-person--postcard .gramps-story-person__portrait--unknown {
    background:
        linear-gradient(135deg, #b09e7e, #8a7860);
    border-radius: 12px;
}
.gramps-story-person--postcard .gramps-story-person__identity-copy {
    min-width: 0;
}
.gramps-story-person--postcard .gramps-story-person__kicker {
    font-family: 'Cormorant Garamond', serif;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: #8a4b2a;
    margin: 0 0 6px;
    font-weight: 600;
}
.gramps-story-person--postcard .gramps-story-person__name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 40px;
    font-weight: 600;
    line-height: 1.12;
    color: #3b2f23;
    margin: 0 0 10px;
}
.gramps-story-person--postcard .gramps-story-person__life {
    margin: 0 0 12px;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 22px;
    color: #6b5a45;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: baseline;
}
.gramps-story-person--postcard .gramps-story-person__life-years {
    color: #3b2f23;
    font-style: normal;
    font-weight: 600;
}
.gramps-story-person--postcard .gramps-story-person__life-years::before { content: '' }
.gramps-story-person--postcard .gramps-story-person__life-span {
    color: #8a4b2a;
    font-size: 18px;
}
.gramps-story-person--postcard .gramps-story-person__life-span::before {
    content: '·';
    margin-right: 8px;
    color: #b08840;
}
.gramps-story-person--postcard .gramps-story-person__life-dates,
.gramps-story-person--postcard [class*="LifeDates"] {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: #6b5a45;
    margin-bottom: 10px;
}
.gramps-story-person--postcard .gramps-story-person__life-dates strong {
    color: #8a4b2a;
    font-weight: 600;
    margin-right: 4px;
}
.gramps-story-person--postcard .gramps-story-person__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.gramps-story-person--postcard .gramps-story-person__badges span {
    background: rgba(176, 136, 64, 0.12);
    border: 1px solid rgba(176, 136, 64, 0.32);
    color: #6b5a45;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 11px;
    font-family: 'Lora', serif;
    letter-spacing: 0.04em;
}

/* Wiek przy wydarzeniu w timeline — wzmocniony styl */
.gramps-story-person--postcard .gramps-story-person__timeline-date em {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 10px;
    background: rgba(138, 75, 42, 0.12);
    color: #8a4b2a;
    font-size: 11px;
    font-weight: 600;
    font-style: normal;
    letter-spacing: 0.02em;
}

@media (max-width: 720px) {
    .gramps-story-person--postcard > .gramps-story-person__hero {
        padding: 18px 16px 16px;
    }
    .gramps-story-person--postcard .gramps-story-person__identity {
        grid-template-columns: 1fr;
        gap: 14px;
        text-align: center;
    }
    .gramps-story-person--postcard .gramps-story-person__portrait {
        width: 170px;
        height: 220px;
        margin: 0 auto;
    }
    .gramps-story-person--postcard .gramps-story-person__name { font-size: 28px; }
    .gramps-story-person--postcard .gramps-story-person__life { font-size: 18px; justify-content: center; }
    .gramps-story-person--postcard .gramps-story-person__life-span { font-size: 15px; }
    .gramps-story-person--postcard .gramps-story-person__badges { justify-content: center; }
}
