/* Coteparti — back-office (loaded after site.css) */

.cp-topbar {
    background: var(--ind-brand-dark);
    color: #fff;
    height: 56px;
}
.cp-topbar .site-brand { color: #fff; font-size: 1.15rem; }
.cp-topbar .site-brand:hover { color: #fff; opacity: .9; }
.cp-topbar .btn-link { color: #d9e3df; text-decoration: none; }
.cp-topbar .btn-link:hover { color: #fff; }

.cp-layout {
    display: flex;
    min-height: calc(100vh - 56px);
}
.cp-sidebar {
    width: 240px;
    flex: 0 0 240px;
    background: var(--ind-surface);
    border-right: 1px solid var(--ind-line);
    padding: 1rem .75rem;
}
.cp-sidebar .nav-link {
    color: var(--ind-ink);
    border-radius: 8px;
    padding: .5rem .75rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.cp-sidebar .nav-link:hover { background: var(--ind-paper); }
.cp-sidebar .nav-link.active {
    background: var(--ind-brand-soft);
    color: var(--ind-brand-dark);
    font-weight: 600;
}
.cp-sidebar .nav-link.disabled { color: #9aa4a7; }
.cp-sidebar .nav-section {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ind-muted);
    margin: 1.25rem .75rem .35rem;
}
.cp-sidebar .soon {
    margin-left: auto;
    font-size: .65rem;
    background: var(--ind-paper);
    border: 1px solid var(--ind-line);
    border-radius: 20px;
    padding: 0 .45rem;
    color: var(--ind-muted);
}
.cp-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.75rem;
}

.stat-card {
    background: var(--ind-surface);
    border: 1px solid var(--ind-line);
    border-radius: var(--ind-radius);
    padding: 1.1rem 1.25rem;
    height: 100%;
}
.stat-card .stat-value {
    font-size: 1.9rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.stat-card .stat-label { color: var(--ind-muted); font-size: .9rem; }

.panel {
    background: var(--ind-surface);
    border: 1px solid var(--ind-line);
    border-radius: var(--ind-radius);
    padding: 1.25rem 1.5rem;
}

/* ---- auth pages ---- */
.auth-wrap {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 16px;
    background:
        radial-gradient(900px 380px at 90% 0%, var(--ind-accent-soft), transparent 60%),
        radial-gradient(800px 380px at 0% 100%, var(--ind-brand-soft), transparent 60%);
}
.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--ind-surface);
    border: 1px solid var(--ind-line);
    border-radius: 14px;
    padding: 2rem;
    box-shadow: 0 20px 40px -28px rgba(31, 42, 46, .4);
}
.auth-card h1 { font-size: 1.6rem; }

@media (max-width: 767.98px) {
    .cp-layout { display: block; }
    .cp-sidebar {
        width: auto;
        border-right: 0;
        border-bottom: 1px solid var(--ind-line);
        padding: .5rem 16px;
    }
    .cp-sidebar .nav { flex-direction: row !important; flex-wrap: nowrap; overflow-x: auto; }
    .cp-sidebar .nav-section, .cp-sidebar .soon { display: none; }
    .cp-sidebar .nav-link { white-space: nowrap; }
    .cp-main { padding: 1.25rem 16px; }
    .auth-card { padding: 1.5rem; }
}

/* ---- genealogical tree (d3) ---- */
.tree-canvas {
    position: relative;
    height: calc(100vh - 56px - 1.75rem * 2 - 60px);
    min-height: 460px;
    background: #f1f1ef;
    border: 1px solid var(--ind-line);
    border-radius: var(--ind-radius);
    overflow: hidden;
}
.tree-canvas svg { width: 100%; height: 100%; display: block; cursor: grab; }
.tree-canvas svg:active { cursor: grabbing; }
.tree-list { height: 100%; overflow: auto; padding: 1rem; }

.tree-links path { fill: none; stroke: #9aa3a6; stroke-width: 1.4; }
.tree-links path.link-partnership { stroke-dasharray: 5 4; }
.tree-links path.link-ended { stroke-dasharray: 2 4; }

.tree-card { cursor: pointer; outline: none; }
.tree-card .card-bg { fill: #fff; stroke: var(--ind-unknown); stroke-width: 2; }
.tree-card.gender-M .card-bg { stroke: var(--ind-male); }
.tree-card.gender-F .card-bg { stroke: var(--ind-female); }
.tree-card.pedigree.gender-M .card-bg { fill: #d7eff7; }
.tree-card.pedigree.gender-F .card-bg { fill: #fbe1e3; }
.tree-card.is-root .card-bg { stroke-width: 3.5; }
.tree-card.is-root.pedigree .card-bg { fill: #fff; }
.tree-card.is-placeholder .card-bg,
.tree-card.is-masked .card-bg { stroke-dasharray: 5 4; fill: #fafafa; }
.tree-card:hover .card-bg, .tree-card:focus .card-bg { filter: drop-shadow(0 4px 8px rgba(31, 42, 46, .18)); }
.tree-card .card-name { font-size: 13px; font-weight: 600; fill: var(--ind-ink); }
.tree-card .card-meta { font-size: 12px; fill: var(--ind-muted); }
.tree-card .card-badge { font-size: 11px; font-weight: 700; fill: var(--ind-brand); }
.tree-card .card-plus circle { fill: #fff; stroke: #c9cfd1; }
.tree-card .card-plus text { font-size: 16px; fill: var(--ind-ink); }
.tree-card .card-plus:hover circle { fill: var(--ind-brand-soft); stroke: var(--ind-brand); }
.tree-card.is-missing .card-bg { fill: transparent; stroke: #9aa3a6; stroke-width: 1.4; stroke-dasharray: 5 4; }
.tree-card.is-missing .missing-label { font-size: 15px; fill: var(--ind-ink); }
.tree-card.is-missing:hover .card-bg, .tree-card.is-missing:focus .card-bg { fill: #fff; stroke: var(--ind-brand); }

/* ---- add relative picker ---- */
.relative-picker { padding: 2rem 1rem; }
.relative-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 1.5rem 2.5rem; margin-bottom: 2rem; }
.relative-row:last-child { margin-bottom: 0; }
.relative-option { display: flex; flex-direction: column; align-items: center; width: 110px; text-align: center; text-decoration: none; color: var(--ind-ink); }
.relative-option:hover { color: var(--ind-brand); }
.relative-option.disabled { opacity: .4; cursor: not-allowed; }
.relative-avatar { position: relative; width: 84px; height: 84px; border-radius: 50%; border: 1px solid var(--ind-line); display: block; margin-bottom: .5rem; }
.relative-avatar img { width: 100%; height: 100%; border-radius: 50%; }
.relative-plus { position: absolute; right: -2px; bottom: 2px; width: 28px; height: 28px; border-radius: 50%; background: var(--ind-accent); color: #fff; font-weight: 700; line-height: 28px; text-align: center; }
.relative-option:hover .relative-plus { background: var(--ind-brand); }
.relative-label { font-size: .95rem; line-height: 1.2; }

/* ---- person ---- */
.person-avatar { border-radius: 50%; border: 1px solid var(--ind-line); }
.family-list li:last-child { border-bottom: 0 !important; }
.person-form { max-width: 760px; }

@media (max-width: 767.98px) {
    .tree-canvas { height: 70vh; }
    .relative-row { gap: 1rem 1.25rem; }
}
.tree-links path.link-half { stroke-dasharray: 6 3; stroke: #b7852f; }

/* ---- shares ---- */
.share-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--ind-line); }
.share-seg { display: block; height: 100%; border-right: 2px solid #fff; }
.share-seg:last-child { border-right: 0; }
.share-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.share-seg-0 { background: #2f5d50; }
.share-seg-1 { background: #b7852f; }
.share-seg-2 { background: #5b8fa8; }
.share-seg-3 { background: #c86b62; }
.share-seg-4 { background: #7a9a55; }
.share-seg-5 { background: #8a6fa8; }
.share-seg-6 { background: #d4a64a; }
.share-seg-7 { background: #4f7d8f; }
.owners-table td { border-color: var(--ind-line); }
.share-row { padding: .75rem 0; border-bottom: 1px dashed var(--ind-line); }
.share-row .form-label { margin-bottom: .15rem; color: var(--ind-muted); }
.share-sum { font-weight: 600; padding: .25rem .75rem; border-radius: 20px; background: var(--ind-paper); }
.share-sum.is-ok { background: var(--ind-brand-soft); color: var(--ind-brand-dark); }
.share-sum.is-bad { background: #fbe4e1; color: #9a2f22; }

.timeline { position: relative; }
.timeline-item { position: relative; padding: 0 0 1.1rem 1.4rem; border-left: 2px solid var(--ind-line); margin-left: .4rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; left: -7px; top: .35rem; width: 12px; height: 12px; border-radius: 50%; background: var(--ind-accent); border: 2px solid #fff; }
.property-card { transition: box-shadow .15s; }
.property-card:hover { box-shadow: 0 10px 24px -18px rgba(31, 42, 46, .5); }

/* ---- succession ---- */
.calculation-steps li { margin-bottom: .45rem; line-height: 1.55; }
.panel.border-success { border-left: 4px solid #2f5d50 !important; }
.panel.border-danger { border-left: 4px solid #b3402f !important; }
.panel.border-warning { border-left: 4px solid #b7852f !important; }

/* ---- lease ---- */
.lease-payment { border: 1px solid var(--ind-line); border-radius: var(--ind-radius); padding: .75rem 1rem; background: #fff; }
.lease-payment summary { cursor: pointer; list-style: none; }
.lease-payment summary::-webkit-details-marker { display: none; }

/* ---- fan view ---- */
.fan-slot { cursor: pointer; outline: none; }
.fan-slot path { fill: #fff; stroke: #d9dcda; stroke-width: 1; }
.fan-slot.gender-M path { fill: #d7eff7; }
.fan-slot.gender-F path { fill: #fbe1e3; }
.fan-slot.gender-U path { fill: #eef0ef; }
.fan-slot.is-masked path, .fan-slot.is-placeholder path { fill: #f6f6f5; stroke-dasharray: 4 3; }
.fan-slot.is-missing path { fill: transparent; stroke: #b9c0c2; stroke-dasharray: 4 3; }
.fan-slot:hover path, .fan-slot:focus path { stroke: var(--ind-brand); stroke-width: 2; }
.fan-root path { fill: #fff !important; stroke: var(--ind-brand); stroke-width: 2; }
.fan-name { font-size: 12px; font-weight: 600; fill: var(--ind-ink); pointer-events: none; }
.fan-meta { font-size: 10.5px; font-weight: 400; fill: var(--ind-muted); pointer-events: none; }
.fan-plus { font-size: 16px; fill: var(--ind-muted); pointer-events: none; }

/* ---------------------------------------------------------------- files & photos */
.files-list li + li { border-top: 1px solid var(--bs-border-color, #e5e7eb); }
.file-icon { flex: 0 0 42px; height: 42px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; color: #fff; }
.file-icon-pdf { background: #c0392b; }
.file-icon-img { background: #2d6a8f; }
.min-w-0 { min-width: 0; }
.files-panel .dropzone { border: 2px dashed #b8c4ce; border-radius: 8px; background: #f8fafb; min-height: 0; padding: 14px; }
.files-panel .dropzone .dz-message { margin: 10px 0; }
.person-photo { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 110px; }
.photo-dropzone.dropzone { border: 1px dashed #b8c4ce; border-radius: 6px; min-height: 0; padding: 2px 6px; background: transparent; }
.photo-dropzone.dropzone .dz-message { margin: 0; }
.photo-dropzone.dropzone .dz-preview { margin: 4px; }

/* ---------------------------------------------------------------- professional: cases, plans */
.case-banner { background: #fff7e0; border: 1px solid #f0d68a; border-radius: 8px; padding: 8px 12px; }
.case-steps li { padding: 2px 0; }
.case-steps li.done { color: #1f7a44; }
.case-steps li.done::marker { content: "✓  "; }
.plan-card { border: 1px solid var(--bs-border-color, #dee2e6); border-radius: 10px; padding: 18px; height: 100%; background: #fff; display: flex; flex-direction: column; }
.plan-card .plan-price { font-size: 1.6rem; font-weight: 700; }
.plan-card.plan-current { border-color: #2d6a8f; box-shadow: 0 0 0 2px rgba(45, 106, 143, .15); }

/* tree: relatives not drawn ("+N"), gaps of the whole family view */
.tree-card .card-hidden { cursor: pointer; }
.tree-card .card-hidden rect { fill: var(--ind-brand); }
.tree-card .card-hidden text { font-size: 11px; font-weight: 700; fill: #fff; }
.tree-card .card-hidden:hover rect, .tree-card .card-hidden:focus rect { fill: var(--ind-brand-dark, #1d4f46); }
.tree-card .card-gap circle { fill: #b3261e; }
.tree-card .card-gap text { font-size: 12px; font-weight: 700; fill: #fff; }
.tree-gaps { background: #fff; border: 1px solid var(--bs-border-color, #dee2e6); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
.tree-gaps .gap-dot { display: inline-block; width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 50%; background: #b3261e; color: #fff; font-weight: 700; font-size: 12px; }

/* property page: guide of the deeds */
.deeds-guide summary { cursor: pointer; list-style: revert; }
.deeds-guide ol li { margin-bottom: .25rem; }
