:root{--pb-section:#FAF8F3;--pb-card:#FFFFFF;--pb-edge:#D6D0C4;--pb-sire:#4E756A;--pb-dam:#947B59}
:root[data-pitvu-theme="dark"]{--pb-section:#263A3D;--pb-card:#172629;--pb-edge:#526B6B;--pb-sire:#9AC6B7;--pb-dam:#CFB593}
:root section.historical-profile-header,:root .panel,:root .historical-dossier{background:var(--pb-section);border-color:var(--pb-edge)}
:root .historical-profile-header .historical-parent-card,:root .historical-profile-header .historical-profile-visible-facts dl>div,:root .historical-profile-header .historical-profile-portrait .historical-photograph>a>img{background:var(--pb-card);border-color:var(--pb-edge);box-shadow:0 5px 16px rgb(38 32 21 / .04)}
:root .historical-profile-header .historical-profile-context-layout,:root .historical-profile-header .historical-profile-supporting-context{border-color:var(--pb-edge)}
.pb-active .profile-pedigree-controls,.pb-active .explorer-actions,.pb-active .explorer-help,.pb-active [data-enhanced]:has(input[type="search"]){display:none!important}
.pb-source{display:none!important}
.pb-explorer{color:var(--theme-text);background:var(--pb-card);border:1px solid var(--pb-edge);border-radius:14px;overflow:hidden;margin-top:20px;min-width:0}
.pb-toolbar{display:flex;gap:8px;flex-wrap:wrap;align-items:center;padding:16px;border-bottom:1px solid var(--theme-border);background:var(--theme-surface)}
.pb-button{font:inherit;font-size:13px;font-weight:600;line-height:1.35;border:1px solid var(--theme-control);background:var(--pb-card);color:var(--theme-text);padding:10px 13px;border-radius:8px;cursor:pointer;min-height:42px;white-space:normal}
.pb-button:hover{background:var(--theme-soft);border-color:var(--theme-link)}
.pb-toolbar .pb-search{width:250px;flex:1 1 220px;max-width:350px;margin:0 0 0 auto;background:var(--pb-card);font-size:14px}
.pb-trail{display:flex;align-items:center;gap:8px;padding:12px 16px;flex-wrap:wrap;border-bottom:1px solid var(--theme-border)}
.pb-trail .pb-button{font-size:12px;padding:5px 8px;border-color:transparent;background:none;min-height:32px;max-width:280px;text-align:left}
.pb-trail [aria-current]{font-weight:750;color:var(--theme-link)}
.pb-chevron{color:var(--theme-muted)}
.pb-results{display:flex;flex-wrap:wrap;gap:8px;padding:12px 16px;border-bottom:1px solid var(--theme-border)}
.pb-results[hidden]{display:none}
.pb-viewport{overflow:auto;max-height:740px;min-height:360px;padding:28px;overscroll-behavior:contain;scrollbar-gutter:stable;background:var(--theme-bg)}
.pb-row{display:flex;align-items:center;gap:26px;width:max-content;min-height:0;position:relative}
.pb-parents{display:flex;flex-direction:column;gap:20px;border-left:1px solid var(--pb-edge);padding-left:26px;position:relative}
.pb-parents>.pb-row:before{content:"";position:absolute;left:-27px;top:50%;width:27px;height:1px;background:var(--pb-edge)}
.pb-card{width:260px;flex:0 0 260px;padding:18px;background:var(--pb-card);border:1px solid var(--pb-edge);border-left:4px solid var(--theme-primary);border-radius:11px;box-shadow:0 4px 12px rgb(0 0 0 / .035);position:relative}
.pb-card.pb-sire{border-left-color:var(--pb-sire)}.pb-card.pb-dam{border-left-color:var(--pb-dam)}
.pb-role{display:block;color:var(--theme-muted);font-size:11px;font-weight:600;letter-spacing:.04em;margin-bottom:9px}
.pb-card .pb-name{display:block;font-family:inherit;font-size:17px!important;font-weight:650;line-height:1.4;overflow-wrap:anywhere;white-space:normal;color:var(--theme-text);text-decoration:none;max-width:100%}
.pb-card a.pb-name:hover{color:var(--theme-link);text-decoration:underline}
.pb-card-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}
.pb-card-actions .pb-button{font-size:12px;padding:7px 10px;min-height:36px}
.pb-card-actions .pb-button:last-child{border-color:var(--theme-primary);color:var(--theme-link)}
.pb-portrait{width:100%;height:100px;object-fit:contain;display:block;border-radius:7px;margin-bottom:14px;background:var(--theme-surface)}
.pb-continue{font-size:13px;color:var(--theme-link)}
.pb-explorer:fullscreen{overflow:auto;background:var(--theme-bg);padding:16px}.pb-explorer:fullscreen .pb-viewport{max-height:calc(100vh - 160px)}
@media(max-width:700px){.pb-toolbar{padding:12px}.pb-toolbar .pb-search{max-width:none;flex-basis:100%;width:100%;margin:0}.pb-viewport{padding:16px;max-height:700px}.pb-card{width:240px;flex-basis:240px;padding:16px}.pb-viewport>.pb-row{align-items:stretch;flex-direction:column;gap:24px;width:100%}.pb-viewport>.pb-row>.pb-card{width:100%;flex-basis:auto}.pb-viewport>.pb-row>.pb-parents{border-left:0;padding-left:0;gap:16px}.pb-viewport>.pb-row>.pb-parents>.pb-row{align-items:flex-start}.pb-viewport>.pb-row>.pb-parents>.pb-row:before{display:none}.pb-trail{gap:3px;padding:10px}.pb-trail .pb-button{max-width:210px}}
@media print{.pb-explorer{display:none!important}.pb-source{display:block!important}}

:root #source-pedigree.panel,:root .historical-dossier.panel,:root .historical-profile-details{background:var(--pb-section);border-color:var(--pb-edge)}

.pb-viewport{cursor:grab;touch-action:none;user-select:none;background:var(--theme-surface)}
.pb-viewport.pb-dragging,.pb-viewport.pb-dragging *{cursor:grabbing!important}
.pb-viewport button,.pb-viewport a{cursor:pointer}
.pb-pan-hint{font-size:12px!important;margin:0;padding:8px 16px;background:var(--theme-surface);color:var(--theme-muted);border-bottom:1px solid var(--theme-border)}
.pb-zoom-value{min-width:44px;text-align:center;font-size:12px;font-variant-numeric:tabular-nums}
.pb-generation-label{display:flex;align-items:center;gap:8px;margin:0;font-size:12px;font-weight:600}
.pb-generation-select{width:64px;margin:0;padding:9px;background:var(--pb-card)}
:root .historical-profile-header .historical-parent-card,:root .historical-profile-header .historical-profile-visible-facts dl>div{background:var(--pb-card)}

.pb-viewport{overflow:hidden;position:relative}.pb-viewport>.pb-row{transform-origin:0 0}

:root:not([data-pitvu-theme="dark"]) section.historical-profile-header{background:#FFFEFC}
