* { box-sizing: border-box; }

html,
body.stammbaum-page {
    height: 100%;
    margin: 0;
}

body.stammbaum-page {
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: #f3f0ea;
    background: #444;
}

.stb-content-container {
    max-width: min(1500px, calc(100vw - 48px));
    padding: 36px 38px 42px;
}

.stb-content-container .content-title {
    margin-bottom: 1.25rem;
}

.stb-topbar {
    background: #241b16;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.stb-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    padding: .55rem .75rem;
}

.stb-nav a {
    color: #eadfd1;
    text-decoration: none;
    padding: .4rem .55rem;
    border-radius: 4px;
    font-size: .88rem;
}

.stb-nav a:hover,
.stb-nav a[aria-current="page"] {
    background: rgba(255,255,255,.12);
}

.stb-shell {
    height: min(76vh, 780px);
    display: flex;
    flex-direction: column;
    min-height: 620px;
    border: 1px solid #d3c4a9;
    background: #3f3f3f;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}

.stb-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: .65rem;
    padding: .8rem .9rem;
    background: #f4ece1;
    color: #3e2b1d;
    border-bottom: 1px solid #d3c4a9;
    font-family: Georgia, 'Times New Roman', serif;
}

.stb-toolbar label {
    display: grid;
    gap: .22rem;
    font-size: .78rem;
    font-weight: 700;
}

.stb-toolbar select,
.stb-toolbar input[type="search"] {
    min-width: 13rem;
    height: 2.15rem;
    padding: .32rem .45rem;
    border: 1px solid #c4b49a;
    border-radius: 4px;
    background: #fffdf9;
    color: #2c1e12;
    font: inherit;
}

.stb-focus-field {
    flex: 1 1 22rem;
    transition: flex-basis .18s ease;
}

.stb-focus-field:focus-within {
    flex-basis: 32rem;
}

.stb-focus-field select,
.stb-focus-field input[type="search"] {
    width: 100%;
}

.stb-toolbar button,
.stb-link-button {
    height: 2.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: 0 .7rem;
    border: 1px solid #2c1e12;
    border-radius: 4px;
    background: #2c1e12;
    color: #f4ece1;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
}

.stb-toolbar button:hover,
.stb-link-button:hover {
    filter: brightness(1.08);
}

.stb-zoom {
    display: inline-flex;
    gap: .25rem;
    margin-left: auto;
}

.stb-zoom button {
    min-width: 2.15rem;
    padding: 0 .55rem;
}

.stb-canvas-wrap {
    position: relative;
    flex: 1;
    overflow: hidden;
    background: #e7ded0;
    cursor: grab;
}

.stb-canvas-wrap.is-dragging {
    cursor: grabbing;
}

.stb-status {
    position: absolute;
    left: 1rem;
    top: 1rem;
    padding: .55rem .7rem;
    background: rgba(20,20,20,.72);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 6px;
    color: #fff;
    z-index: 3;
}

.stb-stage {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
}

.stb-lines {
    position: absolute;
    left: 0;
    top: 0;
    overflow: visible;
}

.stb-line {
    fill: none;
    stroke: rgba(94, 82, 68, .58);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.stb-line[data-type="partner"],
.stb-line[data-type="partnerA"],
.stb-line[data-type="partnerB"] {
    stroke-width: 2.2;
    stroke-dasharray: none;
    stroke-linecap: round;
}

.stb-line[data-type="partnerA"] {
    stroke: rgba(135, 188, 209, .98) !important;
}

.stb-line[data-type="partnerB"] {
    stroke: rgba(214, 139, 112, .98) !important;
}

.stb-line[data-relation-state="single"],
.stb-line[data-relation-state="unknown"],
.stb-line[data-relation-state="other"] {
    stroke: rgba(170, 170, 170, .76) !important;
    stroke-dasharray: 7 5;
}

.stb-line[data-relation-state="divorced"],
.stb-line[data-relation-state="separated"],
.stb-line[data-relation-state="ended"] {
    stroke-dasharray: 1 4;
    stroke-linecap: round;
}

.stb-partner-node {
    fill: #a9a9a9;
    stroke: #4b4b4b;
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.stb-partner-node[data-relation-state="single"],
.stb-partner-node[data-relation-state="unknown"],
.stb-partner-node[data-relation-state="other"] {
    fill: #8f8f8f;
}

.stb-partner-node[data-relation-state="divorced"],
.stb-partner-node[data-relation-state="separated"],
.stb-partner-node[data-relation-state="ended"] {
    fill: #777;
}

.stb-line[data-type="rail"],
.stb-line[data-type="railStem"] {
    stroke: rgba(94, 82, 68, .56);
    stroke-width: 2;
}

.stb-line[data-type="parentChild"] {
    stroke: rgba(94, 82, 68, .62);
    stroke-width: 2;
}

.stb-line[data-group="onlyA"],
.stb-line[data-group="shared"],
.stb-line[data-group="onlyB"] {
    stroke: rgba(94, 82, 68, .58);
}

.stb-card {
    position: absolute;
    width: 132px;
    min-width: 132px;
    max-width: 132px;
    height: 146px;
    min-height: 146px;
    padding: 9px 9px 10px;
    box-sizing: border-box;
    background: #fff;
    color: #243044;
    border: 1px solid #d8e2ee;
    border-radius: 6px;
    box-shadow: 0 2px 7px rgba(20,28,38,.17);
    overflow: visible;
    text-align: center;
}

.stb-card.is-focus {
    z-index: 5;
    border-color: #8b5a2b;
    background: #fffdf9;
    box-shadow: 0 0 0 3px rgba(255,255,255,.8), 0 0 0 7px rgba(139,90,43,.42), 0 8px 18px rgba(70,45,24,.26);
}

.stb-card.is-focus::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -13px;
    width: 30px;
    height: 4px;
    border-radius: 999px;
    background: #8b5a2b;
    transform: translateX(-50%);
}

.stb-card.is-masked {
    background: #f7f4f0;
}

.stb-portrait {
    height: 68px;
    margin: 8px 0 5px;
    border-radius: 50%;
    overflow: hidden;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stb-portrait img {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    background: #dbeaf3;
}

.stb-avatar {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    position: relative;
    background: linear-gradient(#dbe8f2, #cfdee8);
    box-shadow: inset 0 0 0 2px rgba(84,112,138,.08);
}

.stb-avatar::before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    left: 27px;
    top: 19px;
    background: #2f7097;
}

.stb-avatar::after {
    content: "";
    position: absolute;
    width: 30px;
    height: 18px;
    border-radius: 10px 10px 5px 5px;
    left: 18px;
    bottom: 15px;
    background: #2f7097;
}

.stb-avatar.female {
    background: linear-gradient(#eed7e3, #e4c7d7);
}

.stb-avatar.female::before,
.stb-avatar.female::after {
    background: #9d496f;
}

.stb-avatar.other,
.stb-avatar.unknown {
    background: linear-gradient(#e5e9ee, #d8dee6);
}

.stb-avatar.other::before,
.stb-avatar.other::after,
.stb-avatar.unknown::before,
.stb-avatar.unknown::after {
    background: #697381;
}

.stb-name {
    padding: 0 2px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.12;
    min-height: 35px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.stb-name-given,
.stb-name-surname {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stb-life {
    padding: 1px 2px 0;
    font-size: 11px;
    line-height: 1.05;
    color: #6d7788;
}

.stb-card > .stb-card-menu {
    position: absolute;
    top: 5px;
    width: 19px;
    height: 19px;
    border: 1px solid #d2b98e;
    border-radius: 50%;
    padding: 0;
    margin: 0;
    background: #fff2dc;
    color: #8b5a2b;
    font-size: 0;
    line-height: 0;
    cursor: pointer;
    z-index: 3;
}

.stb-card > .stb-card-menu::before {
    content: "";
    position: absolute;
    width: 3px;
    height: 3px;
    left: 4px;
    top: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 4px 0 0 currentColor, 8px 0 0 currentColor;
}

.stb-card > .stb-card-menu:hover {
    color: #5d4037;
    border-color: #b88952;
    background: #ffe8bf;
}

.stb-card-menu-left {
    left: 5px;
}

.stb-card-menu-right {
    right: 5px;
}

.stb-expand {
    position: absolute;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    padding: 0;
    margin: 0;
    background: rgba(155,155,155,.85);
    color: #f7f7f7;
    font-size: 14px;
    line-height: 22px;
}

.stb-expand.up { top: -29px; left: calc(50% - 11px); }
.stb-expand.down { bottom: -29px; left: calc(50% - 11px); }
.stb-expand.left { left: -29px; top: calc(50% - 11px); }
.stb-expand.right { right: -29px; top: calc(50% - 11px); }

.stb-menu {
    position: absolute;
    min-width: 150px;
    padding: .25rem;
    background: #fff;
    color: #243044;
    border: 1px solid #d7e0ec;
    border-radius: 4px;
    box-shadow: 0 8px 20px rgba(20,28,38,.18);
    z-index: 20;
}

.stb-menu button {
    width: 100%;
    display: block;
    padding: .38rem .5rem;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.stb-menu button:hover {
    background: #edf3fa;
}

.stb-menu button:disabled {
    color: #9aa6b5;
    cursor: default;
}

.stb-menu button:disabled:hover {
    background: transparent;
}

.stb-menu-note {
    padding: .25rem .5rem .35rem;
    color: #7a8797;
    font-size: 11px;
}

.stb-partner-popover {
    position: absolute;
    width: 285px;
    padding: 0 0 12px;
    background: #f7f7f7;
    color: #202020;
    border-radius: 7px;
    box-shadow: 0 12px 28px rgba(0,0,0,.28);
    z-index: 22;
}

.stb-partner-popover::after {
    content: "";
    position: absolute;
    right: -10px;
    top: 66px;
    width: 0;
    height: 0;
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
    border-left: 11px solid #f7f7f7;
}

.stb-partner-title {
    padding: 11px 12px 9px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.15;
    border-bottom: 1px solid #ececec;
}

.stb-partner-row {
    display: grid;
    grid-template-columns: 38px 1fr 54px;
    align-items: center;
    column-gap: 12px;
    padding: 11px 17px 0;
    min-height: 58px;
}

.stb-partner-thumb {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    overflow: hidden;
    background: #dbeaf3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stb-partner-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.stb-partner-thumb .stb-avatar {
    width: 30px;
    height: 30px;
}

.stb-partner-thumb .stb-avatar::before {
    width: 9px;
    height: 9px;
    left: 11px;
    top: 8px;
}

.stb-partner-thumb .stb-avatar::after {
    width: 18px;
    height: 12px;
    left: 6px;
    bottom: 5px;
}

.stb-partner-name {
    color: #0d789b;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.12;
}

.stb-partner-label {
    margin-top: 2px;
    color: #242424;
    font-size: 14px;
    line-height: 1.15;
}

.stb-switch {
    justify-self: end;
    width: 50px;
    height: 32px;
    border: 0;
    border-radius: 18px;
    padding: 0;
    background: #6b6b6b;
    position: relative;
    cursor: pointer;
}

.stb-switch::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    transition: transform .16s ease;
}

.stb-switch.is-on {
    background: #0b82a8;
}

.stb-switch.is-on::before {
    transform: translateX(18px);
}

.stb-switch:disabled {
    cursor: default;
    opacity: 1;
}

.stb-modal {
    position: fixed;
    inset: 0;
    z-index: 6000;
    background: rgba(0,0,0,.55);
    display: grid;
    place-items: start center;
    box-sizing: border-box;
    padding: 1.25rem;
}

.stb-modal[hidden] {
    display: none;
}

.stb-modal-panel {
    width: min(860px, calc(100vw - 28px));
    height: min(780px, calc(100vh - 2.5rem));
    position: relative;
    background: #fff;
    border-radius: 6px;
    border: 1px solid rgba(141, 103, 63, 0.28);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.stb-modal iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.stb-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(248, 243, 235, 0.65);
    border-radius: 50%;
    background: #4a2f22;
    color: #f8f3eb;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.stb-modal-close:hover,
.stb-modal-close:focus-visible {
    background: #6b4228;
    outline: 2px solid rgba(176, 138, 98, 0.35);
    outline-offset: 2px;
}

@media (max-width: 720px) {
    .stb-shell {
        min-height: 540px;
    }

    .stb-toolbar {
        align-items: stretch;
    }

    .stb-toolbar label,
    .stb-toolbar select,
    .stb-toolbar button,
    .stb-link-button {
        width: 100%;
    }

    .stb-zoom {
        width: 100%;
        margin-left: 0;
    }

    .stb-zoom button {
        flex: 1;
    }
}
