/* ==========================================================================
   Individual / Person Page — Modern Overhaul
   Scoped to .wt-route-IndividualPage so nothing leaks to other pages.

   Dark mode strategy:
     - :root[data-theme=dark]  → user explicitly chose dark
     - @media (prefers-color-scheme: dark) + :root:not([data-theme=light])
       → auto mode with browser dark preference
   ========================================================================== */

/* ---------- Profile photo: large circle, no border ---------- */

#individual-images .carousel-inner {
    overflow: visible;
}

.wt-route-IndividualPage .col-sm-3 a.gallery {
    display: block;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.wt-route-IndividualPage .col-sm-3 a.gallery .img-thumbnail {
    border-radius: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    box-shadow: none;
    padding: 0;
}


/* Center the photo column */
.wt-route-IndividualPage .col-sm-3 {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Silhouette placeholder: circular with gender-based background */
.wt-route-IndividualPage .col-sm-3 > .img-thumbnail {
    border-radius: 50%;
    width: 200px;
    height: 200px;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: none;
}

.wt-route-IndividualPage .col-sm-3 .wt-individual-silhouette {
    display: block;
    width: 100% !important;
    height: 100%;
    opacity: 0.15;
    filter: brightness(0);
}

/* Gender-based silhouette container — light mode */
.wt-route-IndividualPage .col-sm-3 > .img-thumbnail:has(.wt-individual-silhouette-m) {
    background-color: #d1dce7;
}

.wt-route-IndividualPage .col-sm-3 > .img-thumbnail:has(.wt-individual-silhouette-f) {
    background-color: #ded7e2;
}

.wt-route-IndividualPage .col-sm-3 > .img-thumbnail:has(.wt-individual-silhouette-u) {
    background-color: #ddd;
}


/* ---------- Individual header: photo + title + edit ---------- */

.wt-route-IndividualPage .bocken-individual-header {
    align-items: center;
    gap: 1.25rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem !important;
}

.wt-route-IndividualPage .bocken-individual-header > .col-sm-3 {
    flex: 0 0 auto;
    width: auto;
    max-width: 260px;
    padding: 0;
    overflow: visible;
}

.wt-route-IndividualPage .wt-page-title {
    font-size: 1.65rem;
    font-weight: 300;
    letter-spacing: -0.01em;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
}

/* Reformatted title parts */
.wt-route-IndividualPage .bocken-title-name {
    font-size: 2.4rem;
    font-weight: 300;
    letter-spacing: -0.02em;
}

.wt-route-IndividualPage .bocken-title-meta {
    font-size: 1.3rem;
    font-weight: 300;
    opacity: 0.65;
}

.wt-route-IndividualPage .bocken-title-user {
    font-size: 1.1rem;
    font-weight: 300;
    opacity: 0.45;
}

.wt-route-IndividualPage .bocken-title-user a {
    color: #2E3440;
}

/* Edit button: fixed FAB in bottom-right corner */
.wt-route-IndividualPage .wt-page-menu-button {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 1rem;
    height: 1rem;
    padding: 2rem;
    margin: 2rem;
    display: grid;
    align-content: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #BF616A;
    border: none;
    z-index: 100;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    --shake-angle: 15deg;
}

.wt-route-IndividualPage .wt-page-menu-button:hover,
.wt-route-IndividualPage .wt-page-menu-button:focus {
    background-color: #2E3440;
    box-shadow: 0 0 0.4em 0.15em rgba(0, 0, 0, 0.15);
    animation: bocken-shake 0.5s forwards;
}

.wt-route-IndividualPage .wt-page-menu-button .wt-icon-menu svg {
    width: 2rem;
    height: 2rem;
    fill: white;
    stroke: none;
}

@keyframes bocken-shake {
    0%   { transform: rotate(0) scale(1); }
    25%  { box-shadow: 0 0 0.5em 0.15em rgba(0, 0, 0, 0.25); transform: rotate(var(--shake-angle)) scale(1.2); }
    50%  { box-shadow: 0 0 0.5em 0.15em rgba(0, 0, 0, 0.25); transform: rotate(calc(-1 * var(--shake-angle))) scale(1.2); }
    74%  { box-shadow: 0 0 0.5em 0.15em rgba(0, 0, 0, 0.25); transform: rotate(var(--shake-angle)) scale(1.2); }
    100% { transform: rotate(0) scale(1.2); }
}

@media screen and (max-width: 500px) {
    .wt-route-IndividualPage .wt-page-menu-button {
        margin: 1rem;
    }
}

/* Hide dropdown caret on the round button */
.wt-route-IndividualPage .wt-page-menu-button::after {
    display: none;
}

/* ---------- Name / Sex accordion ---------- */

#individual-names {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-top: 0.75rem;
}

#individual-names .accordion-item {
    border: none;
    background: var(--color-surface, #efecea);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#individual-names .accordion-button {
    background: transparent;
    border: none;
    padding: 0.65rem 1rem;
    font-size: 0.92rem;
    box-shadow: none !important;
    gap: 0.5rem;
}

#individual-names .accordion-button .label {
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    opacity: 0.55;
    min-width: 2.8rem;
}

#individual-names .accordion-button::after {
    display: none;
}

#individual-names .accordion-body {
    padding: 0.25rem 1rem 0.65rem;
}

/* ---------- Tabs: underline style ---------- */

.wt-tabs-individual .nav-tabs {
    border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.08));
    gap: 0;
    padding-bottom: 0;
}

.wt-tabs-individual .nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--color-text-secondary, #999);
    transition: color 0.2s, border-color 0.2s;
    background: transparent;
}

.wt-tabs-individual .nav-tabs .nav-link:hover {
    color: var(--color-text-primary, #eceff4);
    border-bottom-color: var(--color-primary, #5E81AC);
    background: transparent;
}

.wt-tabs-individual .nav-tabs .nav-link.active {
    color: var(--color-text-primary, #eceff4);
    border-bottom-color: var(--color-primary, #5E81AC);
    background: transparent;
    font-weight: 600;
}

.wt-tabs-individual .nav-tabs .nav-link.text-muted {
    opacity: 0.4;
}

/* ---------- iOS-style toggle for "Associated events" & "Events of close relatives" ---------- */

.wt-route-IndividualPage #show-associate-facts,
.wt-route-IndividualPage #show-relatives-facts {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    width: 44px;
    height: 24px;
    background: #D8DEE9;
    border-radius: 24px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
    outline: none;
    border: none;
    flex-shrink: 0;
    vertical-align: middle;
}

.wt-route-IndividualPage #show-associate-facts::before,
.wt-route-IndividualPage #show-relatives-facts::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    background: white;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.wt-route-IndividualPage #show-associate-facts:checked,
.wt-route-IndividualPage #show-relatives-facts:checked {
    background: var(--color-primary, #5E81AC);
}

.wt-route-IndividualPage #show-associate-facts:checked::before,
.wt-route-IndividualPage #show-relatives-facts:checked::before {
    transform: translateX(20px);
}

/* ---------- Facts table: vertical card layout ---------- */

.wt-route-IndividualPage .wt-facts-table {
    border-collapse: separate;
    border-spacing: 0 0.5rem;
    border: none;
}

.wt-route-IndividualPage .wt-facts-table > colgroup {
    display: none;
}

/* Stack label (th) and content (td) vertically */
.wt-route-IndividualPage .wt-facts-table > tbody > tr {
    display: flex;
    flex-direction: column;
    background: var(--color-surface, #efecea);
    border-radius: 0.5rem;
    position: relative;
    margin-bottom: 0.35rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wt-route-IndividualPage .wt-facts-table > tbody > tr > th,
.wt-route-IndividualPage .wt-facts-table > tbody > tr > td {
    border: none;
    background: transparent;
    vertical-align: top;
    width: 100%;
    display: block;
}

.wt-route-IndividualPage .wt-facts-table > tbody > tr > th {
    padding: 0.65rem 1rem 0;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.wt-route-IndividualPage .wt-facts-table > tbody > tr > td {
    padding: 0.25rem 1rem 0.7rem;
}

/* Fact label — normal case, smaller, muted */
.wt-route-IndividualPage .wt-fact-label {
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    color: var(--color-text-secondary, #aaa);
}

/* Edit links: top-right of card, appear on hover */
.wt-route-IndividualPage .wt-fact-edit-links {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    padding: 0;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    gap: 0;
    z-index: 2;
}

.wt-route-IndividualPage .wt-facts-table > tbody > tr:hover .wt-fact-edit-links {
    opacity: 0.7;
}

.wt-route-IndividualPage .wt-facts-table > tbody > tr:hover .wt-fact-edit-links:hover {
    opacity: 1;
}

.wt-route-IndividualPage .wt-fact-edit-links .btn {
    padding: 0.15rem 0.35rem;
    font-size: 0.75rem;
}

/* Fact value styling */
.wt-route-IndividualPage .wt-fact-main-attributes .date a {
    font-weight: 500;
}

.wt-route-IndividualPage .wt-fact-place a {
    opacity: 0.75;
    transition: opacity 0.2s;
}
.wt-route-IndividualPage .wt-fact-place a:hover {
    opacity: 1;
}

/* First row (the "Events of close relatives" toggle row) — no card style */
.wt-route-IndividualPage .wt-facts-table > tbody > tr:first-child {
    background: transparent !important;
    box-shadow: none !important;
    margin-bottom: 0;
}

.wt-route-IndividualPage .wt-facts-table > tbody > tr:first-child > td {
    padding: 0.15rem 0.35rem;
}

.wt-route-IndividualPage .wt-facts-table > tbody > tr:first-child > td label {
    font-size: 0.85rem;
    opacity: 0.7;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
}

/* Relation/associate fact rows: fix collapse visibility.
   Our display:flex on tr overrides Bootstrap's collapse display:none.
   Must restore collapse behavior explicitly. */
.wt-route-IndividualPage .wt-facts-table > tbody > tr.wt-relation-fact.collapse:not(.show),
.wt-route-IndividualPage .wt-facts-table > tbody > tr.wt-associate-fact.collapse:not(.show) {
    display: none !important;
}

.wt-route-IndividualPage .wt-facts-table > tbody > tr.wt-relation-fact.collapse.show,
.wt-route-IndividualPage .wt-facts-table > tbody > tr.wt-associate-fact.collapse.show {
    display: flex !important;
}

/* Hide family link facts (FAMC/FAMS/HUSB/WIFE/CHIL) — redundant with Relatives tab */
.wt-route-IndividualPage .wt-facts-table > tbody > tr.bocken-family-fact {
    display: none !important;
}

/* "Add a fact" row — flatten */
.wt-route-IndividualPage .wt-facts-table > tbody > tr:last-child {
    background: transparent;
    box-shadow: none;
}

/* ---------- Sidebar: cleaner accordion ---------- */

.wt-route-IndividualPage .wt-sidebar .accordion-item {
    border: none;
    background: var(--color-surface, #efecea);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wt-route-IndividualPage .wt-sidebar .accordion-button {
    background: transparent;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.7rem 1rem;
    box-shadow: none !important;
}

.wt-route-IndividualPage .wt-sidebar .accordion-button::after {
    display: none;
}

.wt-route-IndividualPage .wt-sidebar .accordion-body {
    padding: 0.25rem 0.75rem 0.75rem;
}

/* ---------- Override [dir] border rules ---------- */

.wt-route-IndividualPage .wt-facts-table > tbody > tr,
.wt-route-IndividualPage .wt-facts-table > tbody > tr > th,
.wt-route-IndividualPage .wt-facts-table > tbody > tr > td,
.wt-route-IndividualPage .wt-facts-table > tbody,
.wt-route-IndividualPage .wt-facts-table > thead,
.wt-route-IndividualPage .wt-facts-table,
.wt-route-IndividualPage .wt-family-navigator-family,
.wt-route-IndividualPage .wt-family-navigator-family > tbody,
.wt-route-IndividualPage .wt-family-navigator-family > tbody > tr,
.wt-route-IndividualPage .wt-family-navigator-family > tbody > tr > th,
.wt-route-IndividualPage .wt-family-navigator-family > tbody > tr > td {
    border: none !important;
    border-width: 0 !important;
    box-shadow: none;
}

/* Re-apply card shadow only on fact rows (not cells) */
.wt-route-IndividualPage .wt-facts-table > tbody > tr {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.wt-route-IndividualPage .wt-facts-table > tbody > tr:first-child,
.wt-route-IndividualPage .wt-facts-table > tbody > tr:last-child {
    box-shadow: none !important;
}

/* ---------- Family navigator ---------- */

.wt-route-IndividualPage .wt-family-navigator-family > tbody > tr > th,
.wt-route-IndividualPage .wt-family-navigator-family > tbody > tr > td {
    padding: 0.45rem 0.6rem;
}

/* Thumbnails in family navigator */
.wt-family-navigator-thumb-wrap {
    flex-shrink: 0;
}

.wt-family-navigator-thumb-wrap img,
.wt-family-navigator-thumb-wrap .wt-family-navigator-thumb {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.wt-family-navigator-thumb-wrap i[class*="icon-silhouette"] {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    opacity: 0.5;
}

/* Gender colors — light mode (matching full diagram light mode) */
.wt-route-IndividualPage .wt-family-navigator-family > tbody > tr.wt-sex-m > th {
    background: #d1dce7 !important;
    color: #2E3440;
}

.wt-route-IndividualPage .wt-family-navigator-family > tbody > tr.wt-sex-m > td {
    background: #dce5ee !important;
}

.wt-route-IndividualPage .wt-family-navigator-family > tbody > tr.wt-sex-f > th {
    background: #ded7e2 !important;
    color: #2E3440;
}

.wt-route-IndividualPage .wt-family-navigator-family > tbody > tr.wt-sex-f > td {
    background: #e5dfe8 !important;
}

/* ---------- Links: high contrast, no visited color ---------- */

.wt-route-IndividualPage .wt-facts-table a,
.wt-route-IndividualPage .wt-family-navigator-family a,
.wt-route-IndividualPage .wt-sidebar a {
    color: #2E3440;
    text-decoration: none;
}

.wt-route-IndividualPage .wt-facts-table a:visited,
.wt-route-IndividualPage .wt-family-navigator-family a:visited,
.wt-route-IndividualPage .wt-sidebar a:visited {
    color: #2E3440;
}

.wt-route-IndividualPage .wt-facts-table a:hover,
.wt-route-IndividualPage .wt-family-navigator-family a:hover,
.wt-route-IndividualPage .wt-sidebar a:hover {
    text-decoration: underline;
}

/* ---------- Full-width layout below ~850px ---------- */

@media (max-width: 850px) {
    .wt-route-IndividualPage .wt-main-container {
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
}

/* ---------- Mobile: photo left, title right ---------- */

@media (max-width: 575.98px) {
    .wt-route-IndividualPage .bocken-title-name {
        font-size: 1.5rem;
    }

    .wt-route-IndividualPage .bocken-title-meta {
        font-size: 1rem;
    }

    .wt-route-IndividualPage .bocken-title-user {
        font-size: 0.9rem;
    }

    .wt-route-IndividualPage .col-sm-3 a.gallery {
        width: 80px;
        height: 80px;
    }

    /* Names accordion: full width */
    .wt-route-IndividualPage .row.mb-4 > #individual-names {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ---------- Overall spacing ---------- */

.wt-route-IndividualPage .row.mb-4 {
    margin-bottom: 1.75rem !important;
    gap: 1rem;
}

.wt-route-IndividualPage .tab-content {
    padding-top: 0.25rem;
}

/* ---------- Tab content inner tables ---------- */

.wt-route-IndividualPage .wt-tab-relatives .wt-facts-table,
.wt-route-IndividualPage .wt-tab-sources .wt-facts-table,
.wt-route-IndividualPage .wt-tab-notes .wt-facts-table {
    border-spacing: 0 0.35rem;
}

/* ==========================================================================
   DARK MODE
   All dark-specific overrides live here, duplicated for both triggers:
     1. :root[data-theme=dark]           — explicit dark selection
     2. @media (prefers-color-scheme: dark) :root:not([data-theme=light])
        — auto mode with browser dark preference
   ========================================================================== */

/* --- Mixin: dark mode rules (applied by both selectors below) --- */

:root[data-theme=dark] .wt-route-IndividualPage .wt-facts-table > tbody > tr,
:root[data-theme=dark] #individual-names .accordion-item,
:root[data-theme=dark] .wt-route-IndividualPage .wt-sidebar .accordion-item {
    background: var(--color-surface, #1a1a1a);
}

:root[data-theme=dark] .wt-route-IndividualPage #show-associate-facts,
:root[data-theme=dark] .wt-route-IndividualPage #show-relatives-facts {
    background: #4C566A;
}

:root[data-theme=dark] .wt-route-IndividualPage #show-associate-facts:checked,
:root[data-theme=dark] .wt-route-IndividualPage #show-relatives-facts:checked {
    background: var(--color-primary, #5E81AC);
}

/* Active tab: black background, light blue accent */
:root[data-theme=dark] .wt-tabs-individual .nav-tabs .nav-link.active {
    background: #000;
    border-bottom-color: #88C0D0;
}

/* Silhouette icon tint */
:root[data-theme=dark] .wt-route-IndividualPage .col-sm-3 .wt-individual-silhouette {
    filter: brightness(0) invert(1);
}

/* Silhouette gender colors */
:root[data-theme=dark] .wt-route-IndividualPage .col-sm-3 > .img-thumbnail:has(.wt-individual-silhouette-m) {
    background-color: #505f73;
}
:root[data-theme=dark] .wt-route-IndividualPage .col-sm-3 > .img-thumbnail:has(.wt-individual-silhouette-f) {
    background-color: #5f596d;
}
:root[data-theme=dark] .wt-route-IndividualPage .col-sm-3 > .img-thumbnail:has(.wt-individual-silhouette-u) {
    background-color: #4C566A;
}

/* Profile picture shadow */
:root[data-theme=dark] .wt-route-IndividualPage .col-sm-3 a.gallery {
    box-shadow: 0 4px 8px rgba(255, 255, 255, 0.3);
}

/* Username link */
:root[data-theme=dark] .wt-route-IndividualPage .bocken-title-user a {
    color: #ECEFF4;
}

/* Links */
:root[data-theme=dark] .wt-route-IndividualPage .wt-facts-table a,
:root[data-theme=dark] .wt-route-IndividualPage .wt-family-navigator-family a,
:root[data-theme=dark] .wt-route-IndividualPage .wt-sidebar a {
    color: #ECEFF4;
}

:root[data-theme=dark] .wt-route-IndividualPage .wt-facts-table a:visited,
:root[data-theme=dark] .wt-route-IndividualPage .wt-family-navigator-family a:visited,
:root[data-theme=dark] .wt-route-IndividualPage .wt-sidebar a:visited {
    color: #ECEFF4;
}

/* Gender colors */
:root[data-theme=dark] .wt-route-IndividualPage .wt-family-navigator-family > tbody > tr.wt-sex-m > th {
    background: #505f73 !important;
    color: #eceff4;
}
:root[data-theme=dark] .wt-route-IndividualPage .wt-family-navigator-family > tbody > tr.wt-sex-m > td {
    background: #48566a !important;
}
:root[data-theme=dark] .wt-route-IndividualPage .wt-family-navigator-family > tbody > tr.wt-sex-f > th {
    background: #5f596d !important;
    color: #eceff4;
}
:root[data-theme=dark] .wt-route-IndividualPage .wt-family-navigator-family > tbody > tr.wt-sex-f > td {
    background: #564f61 !important;
}

/* --- Same rules for auto mode (browser prefers dark, no explicit light) --- */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme=light]) .wt-route-IndividualPage .wt-facts-table > tbody > tr,
    :root:not([data-theme=light]) #individual-names .accordion-item,
    :root:not([data-theme=light]) .wt-route-IndividualPage .wt-sidebar .accordion-item {
        background: var(--color-surface, #1a1a1a);
    }

    :root:not([data-theme=light]) .wt-route-IndividualPage #show-associate-facts,
    :root:not([data-theme=light]) .wt-route-IndividualPage #show-relatives-facts {
        background: #4C566A;
    }

    :root:not([data-theme=light]) .wt-route-IndividualPage #show-associate-facts:checked,
    :root:not([data-theme=light]) .wt-route-IndividualPage #show-relatives-facts:checked {
        background: var(--color-primary, #5E81AC);
    }

    /* Active tab: black background, light blue accent */
    :root:not([data-theme=light]) .wt-tabs-individual .nav-tabs .nav-link.active {
        background: #000;
        border-bottom-color: #88C0D0;
    }

    /* Silhouette icon tint */
    :root:not([data-theme=light]) .wt-route-IndividualPage .col-sm-3 .wt-individual-silhouette {
        filter: brightness(0) invert(1);
    }

    /* Silhouette gender colors */
    :root:not([data-theme=light]) .wt-route-IndividualPage .col-sm-3 > .img-thumbnail:has(.wt-individual-silhouette-m) {
        background-color: #505f73;
    }
    :root:not([data-theme=light]) .wt-route-IndividualPage .col-sm-3 > .img-thumbnail:has(.wt-individual-silhouette-f) {
        background-color: #5f596d;
    }
    :root:not([data-theme=light]) .wt-route-IndividualPage .col-sm-3 > .img-thumbnail:has(.wt-individual-silhouette-u) {
        background-color: #4C566A;
    }

    /* Profile picture shadow */
    :root:not([data-theme=light]) .wt-route-IndividualPage .col-sm-3 a.gallery {
        box-shadow: 0 4px 8px rgba(255, 255, 255, 0.3);
    }

    /* Username link */
    :root:not([data-theme=light]) .wt-route-IndividualPage .bocken-title-user a {
        color: #ECEFF4;
    }

    /* Links */
    :root:not([data-theme=light]) .wt-route-IndividualPage .wt-facts-table a,
    :root:not([data-theme=light]) .wt-route-IndividualPage .wt-family-navigator-family a,
    :root:not([data-theme=light]) .wt-route-IndividualPage .wt-sidebar a {
        color: #ECEFF4;
    }

    :root:not([data-theme=light]) .wt-route-IndividualPage .wt-facts-table a:visited,
    :root:not([data-theme=light]) .wt-route-IndividualPage .wt-family-navigator-family a:visited,
    :root:not([data-theme=light]) .wt-route-IndividualPage .wt-sidebar a:visited {
        color: #ECEFF4;
    }

    /* Gender colors */
    :root:not([data-theme=light]) .wt-route-IndividualPage .wt-family-navigator-family > tbody > tr.wt-sex-m > th {
        background: #505f73 !important;
        color: #eceff4;
    }
    :root:not([data-theme=light]) .wt-route-IndividualPage .wt-family-navigator-family > tbody > tr.wt-sex-m > td {
        background: #48566a !important;
    }
    :root:not([data-theme=light]) .wt-route-IndividualPage .wt-family-navigator-family > tbody > tr.wt-sex-f > th {
        background: #5f596d !important;
        color: #eceff4;
    }
    :root:not([data-theme=light]) .wt-route-IndividualPage .wt-family-navigator-family > tbody > tr.wt-sex-f > td {
        background: #564f61 !important;
    }
}

/* --- Light mode explicit overrides (toggle track) --- */

:root[data-theme=light] .wt-route-IndividualPage #show-associate-facts,
:root[data-theme=light] .wt-route-IndividualPage #show-relatives-facts {
    background: #D8DEE9;
}

:root[data-theme=light] .wt-route-IndividualPage #show-associate-facts:checked,
:root[data-theme=light] .wt-route-IndividualPage #show-relatives-facts:checked {
    background: var(--color-primary, #5E81AC);
}
