.pedigree-page {
    overflow-x: hidden;
}

.pedigree-work-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9rem;
}

.pedigree-work-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 5.5rem;
    min-width: 0;
    padding: 1.15rem 1.25rem;
    border-radius: 1.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 24px -18px rgba(15, 23, 42, 0.35);
    color: #0f172a;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.pedigree-work-card:hover {
    transform: translateY(-2px);
    border-color: rgba(212, 175, 55, 0.55);
    box-shadow: 0 16px 32px -20px rgba(15, 23, 42, 0.4);
}

.pedigree-work-card__icon {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #fef9ec;
    color: #d4af37;
    font-size: 1.15rem;
}

.pedigree-work-card__label {
    min-width: 0;
    line-height: 1.2;
}

.pedigree-work-card--primary {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
    box-shadow: 0 12px 28px -16px rgba(15, 23, 42, 0.7);
}

.pedigree-work-card--primary:hover {
    background: #1e293b;
    border-color: #1e293b;
}

.pedigree-work-card--primary .pedigree-work-card__icon {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

@media (min-width: 768px) {
    .pedigree-work-grid {
        grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
    }

    .pedigree-work-card {
        min-height: 6.25rem;
        padding: 1.35rem 1.4rem;
        font-size: 1.12rem;
    }
}

body.pedigree-editor-page footer {
    display: none !important;
}

html:has(body.pedigree-editor-page),
body.pedigree-editor-page {
    overflow: hidden !important;
    height: 100%;
    max-height: 100dvh;
    overscroll-behavior: none;
}

body.pedigree-editor-page .main-wrapper {
    min-height: 0;
    padding-bottom: 0;
    overflow: hidden;
}

.pedigree-editor-shell {
    height: calc(100dvh - var(--site-top-offset, 70px));
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
    overflow: hidden;
}

.pedigree-brand {
    display: none;
    align-items: center;
    flex-shrink: 0;
    min-height: 44px;
    padding: 0.15rem 0.25rem;
    border-radius: 0.75rem;
}

.pedigree-brand img {
    display: block;
    height: 32px;
    width: auto;
    max-width: min(140px, 34vw);
    object-fit: contain;
}

body.pedigree-editor-page.is-pedigree-fullscreen {
    --site-top-offset: 0px;
}

body.pedigree-editor-page.is-pedigree-fullscreen #site-top,
html:fullscreen #site-top,
html:-webkit-full-screen #site-top {
    display: none !important;
}

html:fullscreen,
html:-webkit-full-screen {
    height: 100%;
    background: #f1f5f9;
}

html:fullscreen body.pedigree-editor-page,
html:-webkit-full-screen body.pedigree-editor-page {
    height: 100%;
    max-height: 100%;
    background: #f1f5f9;
}

body.pedigree-editor-page.is-pedigree-fullscreen .main-wrapper,
html:fullscreen body.pedigree-editor-page .main-wrapper,
html:-webkit-full-screen body.pedigree-editor-page .main-wrapper {
    padding-top: 0;
    min-height: 0;
}

body.pedigree-editor-page.is-pedigree-fullscreen .pedigree-editor-shell,
html:fullscreen body.pedigree-editor-page .pedigree-editor-shell,
html:-webkit-full-screen body.pedigree-editor-page .pedigree-editor-shell {
    height: 100dvh;
    max-height: 100dvh;
}

body.pedigree-editor-page.is-pedigree-fullscreen .pedigree-brand,
html:fullscreen body.pedigree-editor-page .pedigree-brand,
html:-webkit-full-screen body.pedigree-editor-page .pedigree-brand {
    display: inline-flex;
}

body.pedigree-editor-page.is-pedigree-fullscreen .pedigree-back-btn,
html:fullscreen body.pedigree-editor-page .pedigree-back-btn,
html:-webkit-full-screen body.pedigree-editor-page .pedigree-back-btn {
    display: none;
}

body.pedigree-editor-page.is-pedigree-fullscreen .pedigree-toolbar {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

#pedigree-fullscreen.is-active {
    border-color: #d4af37;
    color: #b8962e;
    background: #fffbeb;
}

.pedigree-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "left priority"
        "tools tools";
    align-items: center;
    column-gap: 0.45rem;
    row-gap: 0.35rem;
    padding: 0.45rem 0.55rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.pedigree-toolbar__left {
    grid-area: left;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.pedigree-toolbar__tools {
    grid-area: tools;
    min-width: 0;
    margin: 0 -0.55rem;
    padding: 0 0.55rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.pedigree-toolbar__tools::-webkit-scrollbar {
    height: 3px;
}

.pedigree-toolbar__tools::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.pedigree-toolbar__tools-scroll {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
    width: max-content;
    min-height: 44px;
    padding-bottom: 1px;
}

.pedigree-toolbar__group {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    padding-right: 0.4rem;
    margin-right: 0.05rem;
    border-right: 1px solid #e2e8f0;
}

.pedigree-toolbar__group:last-child {
    border-right: 0;
    padding-right: 0;
    margin-right: 0;
}

.pedigree-toolbar__priority {
    grid-area: priority;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    flex-shrink: 0;
}

.pedigree-title-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1 1 auto;
    max-width: none;
}

.pedigree-title-box span {
    display: none;
    font-size: 0.65rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.02em;
    line-height: 1.1;
    margin-bottom: 0.15rem;
}

.pedigree-title-input {
    min-width: 0;
    width: 100%;
    min-height: 40px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 0.85rem;
    padding: 0 0.7rem;
    font-weight: 700;
    font-size: 0.88rem;
    letter-spacing: -0.02em;
    color: #0f172a;
    outline: none;
}

.pedigree-title-input:focus {
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.pedigree-icon-btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.85rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0;
    transition: all .15s ease;
    flex-shrink: 0;
}

.pedigree-icon-btn,
.pedigree-save-status {
    white-space: nowrap;
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pedigree-save-status {
    display: none;
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
}

.pedigree-btn__label {
    display: none;
}

.pedigree-btn__label--always {
    display: inline;
}

.pedigree-view-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
}

.pedigree-view-controls .pedigree-icon-btn {
    min-height: 44px;
    min-width: 44px;
    font-size: 0.95rem;
    border-color: #dbe3ef;
    box-shadow: none;
}

/* Tablet (včetně iPadu na šířku): nástroje se zalamují, nejedou vodorovným posuvem jako na telefonu. */
@media (min-width: 768px) and (max-width: 1279px) {
    .pedigree-toolbar {
        padding: 0.55rem 0.85rem 0.5rem;
        row-gap: 0.45rem;
        column-gap: 0.55rem;
    }

    .pedigree-toolbar__tools {
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    .pedigree-toolbar__tools-scroll {
        width: 100%;
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        row-gap: 0.4rem;
        min-height: 0;
    }

    .pedigree-toolbar__group {
        border-right: 0;
        padding-right: 0;
        margin-right: 0;
        gap: 0.35rem;
    }

    .pedigree-title-input {
        min-height: 44px;
        font-size: 0.95rem;
    }

    .pedigree-btn__label,
    .pedigree-btn__label--lg {
        display: inline;
    }

    .pedigree-trait-select select {
        max-width: min(16rem, 42vw);
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    #pedigreeSidebar.public-section-drawer {
        width: min(22.5rem, calc(100vw - 4.5rem)) !important;
        border-radius: 0 1.5rem 1.5rem 0;
    }

    #pedigreeSidebarOverlay.public-section-drawer-overlay {
        left: min(22.5rem, calc(100vw - 4.5rem)) !important;
    }

    #pedigreeSidebar nav a {
        min-height: 48px;
        font-size: 1rem;
        padding-top: 0.7rem;
        padding-bottom: 0.7rem;
    }
}

@media (min-width: 1280px) {
    .pedigree-toolbar {
        grid-template-columns: minmax(12rem, 18rem) minmax(0, 1fr) auto;
        grid-template-areas: "left tools priority";
        column-gap: 0.65rem;
        row-gap: 0;
        padding: 0.6rem 0.85rem;
        align-items: center;
    }

    .pedigree-toolbar__tools {
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    .pedigree-toolbar__tools-scroll {
        width: auto;
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
        min-height: 0;
    }

    .pedigree-toolbar__group {
        border-right: 0;
        padding-right: 0;
        margin-right: 0;
        gap: 0.4rem;
    }

    .pedigree-title-box {
        max-width: 20rem;
    }

    .pedigree-title-box span {
        display: block;
    }

    .pedigree-title-input {
        min-height: 44px;
        font-size: 0.95rem;
        padding: 0 0.8rem;
        border-radius: 0.9rem;
    }

    .pedigree-btn__label,
    .pedigree-btn__label--lg {
        display: inline;
    }

    .pedigree-save-status {
        display: inline;
    }

    .pedigree-view-controls {
        gap: 0.45rem;
        padding: 0.15rem;
        margin: 0 0.1rem;
    }

    .pedigree-view-controls .pedigree-icon-btn {
        min-height: 44px;
        min-width: 44px;
        font-size: 1rem;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    }

    .pedigree-trait-select select {
        max-width: min(13.5rem, 42vw);
        border-radius: 0.9rem;
        padding: 0 0.75rem;
        font-size: 0.82rem;
    }

    .pedigree-assignment-bar {
        gap: 0.5rem;
        padding: 0.45rem 0.9rem;
        font-size: 0.8rem;
    }
}

.pedigree-save-status.is-saving {
    color: #b8962e;
}

.pedigree-save-status.is-ok {
    color: #059669;
}

.pedigree-save-status.is-error {
    color: #dc2626;
}

.pedigree-btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: 0.9rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0 0.7rem;
    transition: all .15s ease;
}

.pedigree-icon-btn--danger {
    color: #be123c;
}

.pedigree-icon-btn.pedigree-icon-btn--danger:hover {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #9f1239;
}

.pedigree-icon-btn:hover,
.pedigree-btn--ghost:hover {
    border-color: #d4af37;
    color: #0f172a;
}

.pedigree-btn--primary {
    background: linear-gradient(135deg, #d4af37, #b8962e);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(184, 150, 46, 0.22);
}

.pedigree-btn--dark {
    background: #0f172a;
    color: #fff;
    border-color: transparent;
}

.pedigree-btn:disabled,
.pedigree-icon-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.pedigree-trait-select {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
}

.pedigree-trait-select select {
    min-height: 44px;
    max-width: min(11.5rem, 48vw);
    border-radius: 0.85rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 0 0.65rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.pedigree-assignment-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    font-size: 0.75rem;
    font-weight: 600;
    color: #78350f;
}

.pedigree-assignment-bar--locked {
    background: #fff7ed;
    border-bottom-color: #fdba74;
    color: #9a3412;
}

.pedigree-assignment-bar--note {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 0.35rem;
}

.pedigree-assignment-bar--note > span.min-w-0 {
    white-space: normal;
    line-height: 1.35;
}

.pedigree-send-bar {
    flex-wrap: wrap;
    row-gap: 0.35rem;
}

.pedigree-send-bar .pedigree-btn {
    margin-left: auto;
    font-size: 0.85rem;
    min-height: 44px;
}

.pedigree-assignment-bar--draft {
    background: #f8fafc;
    border-bottom-color: #cbd5e1;
    color: #334155;
}

.pedigree-chip--action {
    cursor: pointer;
    border-color: #f59e0b;
    background: #fff;
    color: #b45309;
    font-weight: 700;
    min-height: 32px;
}

.pedigree-chip--action:hover {
    background: #ffedd5;
}

.pedigree-workspace {
    flex: 1;
    min-height: 0;
    display: flex;
    position: relative;
}

.pedigree-canvas-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
    overflow: hidden;
    background: #f4f5f7;
    -webkit-user-select: none;
    user-select: none;
}

#pedigree-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
}

#pedigree-canvas text,
#pedigree-canvas tspan {
    -webkit-user-select: none;
    user-select: none;
}

#pedigree-canvas.is-panning {
    cursor: grabbing;
}

.pedigree-marquee {
    position: absolute;
    z-index: 8;
    pointer-events: none;
    border: 1.5px solid #d4af37;
    background: rgba(212, 175, 55, 0.12);
    border-radius: 4px;
    box-sizing: border-box;
}

body.pedigree-painting #pedigree-canvas,
body.pedigree-painting #pedigree-canvas.is-panning {
    cursor: copy;
}

.pedigree-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.pedigree-empty.hidden {
    display: none;
}

.pedigree-empty__btn {
    pointer-events: auto;
    width: min(22rem, calc(100% - 2rem));
    min-height: 44px;
    border-radius: 1.5rem;
    border: 1px dashed #d4af37;
    background: #fff;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
    padding: 1.25rem 1.1rem;
    text-align: left;
    display: grid;
    grid-template-columns: 2.75rem 1fr;
    gap: 0.15rem 0.85rem;
}

.pedigree-empty__btn i {
    grid-row: span 2;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 1rem;
    background: #fef3c7;
    color: #b8962e;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pedigree-empty__btn strong {
    font-size: 1rem;
    color: #0f172a;
}

.pedigree-empty__btn span {
    font-size: 0.8rem;
    color: #64748b;
}

.pedigree-legend {
    position: absolute;
    left: 0.75rem;
    bottom: 0.75rem;
    max-width: calc(100% - 1.5rem);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 0.45rem 0.6rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.pedigree-legend button {
    min-height: 44px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 0 0.7rem;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: grab;
    touch-action: none;
}

.pedigree-legend button.is-on,
.pedigree-legend button.is-paint {
    border-color: #d4af37;
    background: #fffbeb;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.16);
}

.pedigree-legend button.is-clear {
    cursor: pointer;
}

.pedigree-legend i {
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 999px;
    display: inline-block;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.pedigree-legend__hint {
    width: 100%;
    font-size: 0.68rem;
    font-weight: 600;
    color: #94a3b8;
}

.pedigree-legend__item {
    display: inline-flex;
    align-items: stretch;
    min-height: 44px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    overflow: hidden;
}

.pedigree-legend__item.is-on,
.pedigree-legend__item.is-paint {
    border-color: #d4af37;
    background: #fffbeb;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.16);
}

.pedigree-legend__item .pedigree-legend__swatch {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    min-height: 44px;
}

.pedigree-legend button.pedigree-legend__edit,
.pedigree-legend button.pedigree-legend__add {
    cursor: pointer;
    touch-action: manipulation;
}

.pedigree-legend__edit {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    border: 0;
    border-left: 1px solid #e2e8f0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #94a3b8;
    padding: 0;
    justify-content: center;
}

.pedigree-legend__edit:hover,
.pedigree-legend__add:hover {
    color: #b8962e;
    background: rgba(212, 175, 55, 0.14);
}

.pedigree-legend__add {
    border-style: dashed;
}

.pedigree-legend__edit i,
.pedigree-legend__add i {
    width: auto;
    height: auto;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.pedigree-field input[type="color"] {
    height: 44px;
    padding: 0.25rem;
    cursor: pointer;
}

.pedigree-paint-ghost {
    position: fixed;
    z-index: 95;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 40px;
    padding: 0.35rem 0.7rem 0.35rem 0.4rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #d4af37;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
    pointer-events: none;
    font-size: 0.78rem;
    font-weight: 700;
    color: #0f172a;
    transform: translate(-6px, -6px);
}

.pedigree-paint-ghost[hidden] {
    display: none;
}

.pedigree-paint-ghost i,
.pedigree-paint-ghost__swatch {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    display: inline-block;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.15);
}

.pedigree-trait-pop {
    position: fixed;
    z-index: 86;
    width: min(22.5rem, calc(100vw - 1.5rem));
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 1.15rem;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
    padding: 0.7rem 0.75rem 0.75rem;
}

.pedigree-trait-pop[hidden] {
    display: none;
}

.pedigree-trait-pop__title {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #64748b;
    margin-bottom: 0.45rem;
}

.pedigree-trait-pop__swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.pedigree-trait-pop__swatches button {
    min-height: 44px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 0 0.65rem;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.pedigree-trait-pop__swatches button.is-on {
    border-color: #d4af37;
    background: #fffbeb;
}

.pedigree-trait-pop__swatches i {
    width: 0.95rem;
    height: 0.95rem;
    border-radius: 999px;
    display: inline-block;
}

.pedigree-trait-pop__clear {
    width: 100%;
    min-height: 44px;
    margin-top: 0.5rem;
    border: 0;
    border-radius: 0.85rem;
    background: #fff1f2;
    color: #be123c;
    font-size: 0.8rem;
    font-weight: 700;
}

.pedigree-node.is-drop .pedigree-shape,
.pedigree-node.is-link-from .pedigree-shape {
    stroke: #d4af37;
    stroke-width: 4;
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.45));
}

body.pedigree-linking #pedigree-canvas {
    cursor: alias;
}

.pedigree-link-banner {
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    max-width: calc(100% - 1.5rem);
    min-height: 44px;
    padding: 0.35rem 0.45rem 0.35rem 0.85rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
    font-size: 0.8rem;
    font-weight: 700;
    color: #78350f;
}

.pedigree-link-banner[hidden] {
    display: none;
}

.pedigree-link-banner i {
    color: #b8962e;
}

.pedigree-rel-actions {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.pedigree-rel-actions__title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
}

.pedigree-parents-hint {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
    line-height: 1.35;
}

.pedigree-parent-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0.35rem 0.4rem 0.35rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: #fff;
    font-size: 0.84rem;
    font-weight: 700;
    color: #0f172a;
}

.pedigree-parent-chip > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pedigree-union-chip {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    min-height: 44px;
    padding: 0.55rem 0.7rem;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: #fff;
}

.pedigree-union-chip__dot {
    width: 0.7rem;
    height: 0.7rem;
    margin-top: 0.3rem;
    border-radius: 999px;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.04);
}

.pedigree-union-chip strong {
    display: block;
    font-size: 0.82rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.pedigree-union-chip small {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.35;
}

.pedigree-rel-btn {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 44px;
    width: 100%;
    text-align: left;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 0.55rem 0.7rem;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.pedigree-rel-btn:hover {
    border-color: #d4af37;
    background: #fffef8;
}

.pedigree-rel-btn__icon {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fffbeb;
    color: #b8962e;
}

.pedigree-rel-btn__icon.is-rose { background: #ffe4e6; color: #e11d48; }
.pedigree-rel-btn__icon.is-sky { background: #e0f2fe; color: #0369a1; }
.pedigree-rel-btn__icon.is-violet { background: #ede9fe; color: #6d28d9; }
.pedigree-rel-btn__icon.is-slate { background: #f1f5f9; color: #334155; }

.pedigree-rel-btn > span:last-child,
.pedigree-rel-choice > span:last-child {
    min-width: 0;
}

.pedigree-rel-btn strong,
.pedigree-rel-choice strong {
    display: block;
    font-size: 0.84rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.pedigree-rel-btn small,
.pedigree-rel-choice small {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    color: #94a3b8;
}

.pedigree-rel-choices {
    display: grid;
    gap: 0.45rem;
}

.pedigree-rel-choice {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 44px;
    width: 100%;
    text-align: left;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 0.55rem 0.7rem;
    background: #fff;
}

.pedigree-rel-choice:hover {
    border-color: #d4af37;
    background: #fffbeb;
}

.pedigree-toast {
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 5;
}

.pedigree-sidebar {
    width: min(22.5rem, 100%);
    flex-shrink: 0;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.pedigree-sidebar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.pedigree-sidebar__body {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.pedigree-field {
    margin-bottom: 0.75rem;
}

.pedigree-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 0.35rem;
}

.pedigree-field input,
.pedigree-field select,
.pedigree-field textarea {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    padding: 0.65rem 0.75rem;
    background: #fff;
    outline: none;
}

.pedigree-field input:focus,
.pedigree-field select:focus,
.pedigree-field textarea:focus {
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.pedigree-gender-grid,
.pedigree-trait-grid {
    display: grid;
    gap: 0.45rem;
}

.pedigree-gender-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.pedigree-gender-card,
.pedigree-alive-card,
.pedigree-choice {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 44px;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 0.55rem 0.7rem;
    cursor: pointer;
    background: #fff;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease;
}

.pedigree-gender-card {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 5.6rem;
    padding: 0.7rem 0.35rem 0.6rem;
    text-align: center;
}

.pedigree-gender-card:hover,
.pedigree-alive-card:hover,
.pedigree-choice:hover {
    border-color: #d4af37;
    background: #fffef8;
}

.pedigree-gender-card:has(:checked),
.pedigree-alive-card:has(:checked),
.pedigree-choice:has(:checked) {
    border-color: #d4af37;
    background: linear-gradient(180deg, #fffbeb 0%, #fff 100%);
    box-shadow: 0 8px 18px rgba(184, 150, 46, 0.14);
}

.pedigree-gender-card:has(:checked) {
    transform: translateY(-1px);
}

.pedigree-gender-card:focus-within,
.pedigree-alive-card:focus-within {
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.pedigree-gender-card__glyph {
    width: 2.35rem;
    height: 2.35rem;
    display: grid;
    place-items: center;
}

.pedigree-gender-card__shape {
    width: 1.7rem;
    height: 1.7rem;
    box-sizing: border-box;
    border: 2.5px solid #0f172a;
    background: #fff;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.pedigree-gender-card__shape--male {
    border-radius: 0.28rem;
}

.pedigree-gender-card__shape--female {
    border-radius: 999px;
}

.pedigree-gender-card__shape--other {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.18rem;
    transform: rotate(45deg);
}

.pedigree-gender-card:has(:checked) .pedigree-gender-card__shape {
    background: #fde68a;
    border-color: #b8962e;
    box-shadow: 0 0 0 3px rgba(253, 230, 138, 0.55);
}

.pedigree-gender-card__text {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    line-height: 1.15;
}

.pedigree-gender-card__label {
    font-size: 0.78rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.pedigree-gender-card__hint {
    font-size: 0.62rem;
    font-weight: 600;
    color: #94a3b8;
}

.pedigree-alive-card__icon {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #94a3b8;
}

.pedigree-alive-card:has(:checked) .pedigree-alive-card__icon {
    background: #dcfce7;
    color: #15803d;
}

.pedigree-alive-card__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}

.pedigree-alive-card__text span {
    font-size: 0.86rem;
    font-weight: 700;
    color: #0f172a;
}

#pf-death-wrap.is-locked {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
}

#pf-death-wrap input[type="date"] {
    scroll-margin: 0;
}

.pedigree-alive-card__text small {
    font-size: 0.7rem;
    font-weight: 600;
    color: #94a3b8;
}

.pedigree-menu {
    position: fixed;
    z-index: 80;
    min-width: 13.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
    padding: 0.35rem;
}

.pedigree-menu button {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0 0.7rem;
    border: 0;
    background: transparent;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    text-align: left;
}

.pedigree-menu button:hover {
    background: #f8fafc;
}

.pedigree-menu button.is-danger {
    color: #be123c;
}

.pedigree-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 60;
}

@media (max-width: 1023px) {
    .pedigree-sidebar {
        position: fixed;
        top: calc(var(--site-top-offset, 70px) + var(--pedigree-toolbar-offset, 0px));
        right: 0;
        bottom: 0;
        z-index: 70;
        width: min(22.5rem, 100%);
        max-height: calc(100dvh - var(--site-top-offset, 70px) - var(--pedigree-toolbar-offset, 0px));
        transform: translateX(110%);
        transition: transform .2s ease;
        box-shadow: -12px 0 40px rgba(15, 23, 42, 0.16);
    }

    .pedigree-sidebar.is-open {
        transform: translateX(0);
    }

    body.pedigree-editor-page.is-pedigree-fullscreen .pedigree-sidebar {
        top: var(--pedigree-toolbar-offset, 0px);
        max-height: calc(100dvh - var(--pedigree-toolbar-offset, 0px));
    }

    .pedigree-sidebar__body {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .pedigree-sidebar-backdrop {
        top: calc(var(--site-top-offset, 70px) + var(--pedigree-toolbar-offset, 0px));
    }

    body.pedigree-editor-page.is-pedigree-fullscreen .pedigree-sidebar-backdrop {
        top: var(--pedigree-toolbar-offset, 0px);
    }
}

@media (max-width: 1279px) {
    .pedigree-menu.is-sheet {
        left: 50% !important;
        right: auto;
        top: auto !important;
        bottom: max(0.75rem, env(safe-area-inset-bottom));
        transform: translateX(-50%);
        width: min(24rem, calc(100vw - 1.5rem));
        max-height: min(70dvh, 32rem);
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding-bottom: 0.35rem;
        z-index: 85;
    }
}

.pedigree-node.is-dim {
    opacity: 0.28;
}

.pedigree-node.is-branch-dim {
    opacity: 0.42;
}

.pedigree-node.is-branch-dim .pedigree-label-bg {
    fill: #f1f5f9;
}

.pedigree-branch-restore {
    cursor: pointer;
    pointer-events: auto;
}

.pedigree-parent-chip.is-branch-hidden,
.pedigree-union-chip.is-branch-hidden {
    opacity: 0.55;
    background: #f8fafc;
}

.pedigree-parent-chip.is-assumed {
    border-color: #e8d48b;
    background: linear-gradient(180deg, #fffef8, #fff);
}

.pedigree-chip-meta {
    color: #94a3b8;
    font-weight: 500;
}

.pedigree-union-chip__body {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.pedigree-child-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    min-height: 44px;
}

.pedigree-child-line small {
    min-width: 0;
    margin-top: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pedigree-chip-x {
    flex-shrink: 0;
}

.pedigree-union-chip > .pedigree-icon-btn {
    flex-shrink: 0;
    margin-left: auto;
}

.pedigree-hub-layer {
    pointer-events: none;
}

.pedigree-sib-block {
    pointer-events: auto;
}

.pedigree-sib-hit {
    pointer-events: all;
}

body.pedigree-union-dragging #pedigree-canvas,
body.pedigree-union-dragging #pedigree-canvas.is-panning {
    cursor: grabbing !important;
}

.pedigree-sib-block.is-dragging .pedigree-sib-hit {
    fill: rgba(15, 23, 42, 0.03);
}

.pedigree-node.is-selected .pedigree-shape {
    stroke: #d4af37;
    stroke-width: 3;
}

#pedigree-open-sidebar[aria-pressed="true"] {
    border-color: #d4af37;
    background: #fffbeb;
    color: #b8962e;
}

#pedigree-toggle-lines[aria-pressed="false"],
#pedigree-toggle-lines.is-muted {
    opacity: 0.72;
    border-style: dashed;
}

@media (min-width: 1024px) {
    .pedigree-sidebar.is-collapsed {
        display: none;
    }

    #pedigree-close-sidebar {
        display: none !important;
    }
}

.pedigree-modal {
    position: fixed;
    inset: 0;
    /* Nad pevným menu webu (.site-top je 1000), ať seznam úkolů nezajíždí pod hlavičku. */
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding:
        max(0.75rem, env(safe-area-inset-top))
        max(0.75rem, env(safe-area-inset-right))
        max(0.75rem, env(safe-area-inset-bottom))
        max(0.75rem, env(safe-area-inset-left));
    overflow: hidden;
    overscroll-behavior: contain;
}

.pedigree-modal[hidden] {
    display: none;
}

.pedigree-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
}

.pedigree-modal__dialog {
    position: relative;
    z-index: 1;
    margin: 0;
    display: flex;
    flex-direction: column;
    width: min(100%, 22.5rem);
    max-height: calc(100dvh - 1.5rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: 0;
    background: #fff;
    border-radius: 1.5rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    overflow: hidden;
}

.pedigree-modal__head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-shrink: 0;
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #fffbeb 0%, #fff 100%);
}

.pedigree-modal__icon {
    width: 2.35rem;
    height: 2.35rem;
    flex-shrink: 0;
    border-radius: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fde68a;
    color: #b8962e;
}

.pedigree-modal__title {
    font-size: 0.98rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.pedigree-modal__sub {
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
}

.pedigree-modal__body {
    padding: 0.9rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.pedigree-modal__body .label-like {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 0.35rem;
}

.pedigree-modal__foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 0;
    gap: 0.45rem;
    padding: 0.75rem 0.9rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.pedigree-trait-opt {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.pedigree-trait-opt input[type="text"] {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    padding: 0.55rem 0.7rem;
    background: #fff;
}

.pedigree-trait-opt input[type="text"]:focus {
    border-color: #d4af37;
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.pedigree-trait-opt input[type="color"] {
    width: 2.75rem;
    height: 44px;
    padding: 0.2rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    background: #fff;
    cursor: pointer;
}

.pedigree-trait-opt__remove {
    min-width: 44px;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: #94a3b8;
    border-radius: 0.75rem;
}

.pedigree-trait-opt__remove:hover {
    color: #be123c;
    background: #fff1f2;
}

.pedigree-pick-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.pedigree-pick {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.15rem;
    width: 100%;
    min-height: 44px;
    text-align: left;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: #fff;
    padding: 0.65rem 0.8rem;
    cursor: pointer;
}

.pedigree-pick:hover:not(:disabled) {
    border-color: #d4af37;
    background: #fffbeb;
}

.pedigree-pick:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.pedigree-pick strong {
    font-size: 0.92rem;
    color: #0f172a;
    font-weight: 700;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.pedigree-pick span {
    font-size: 0.75rem;
    color: #64748b;
    max-width: 100%;
    overflow-wrap: anywhere;
}
