@font-face {
    font-family: "ExamKityariJameel";
    src: url("../Fonts/Jameel%20Noori%20Nastaleeq.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --navy: #17365d;
    --navy-2: #234f7d;
    --navy-3: #0f2947;
    --gold: #b18a45;
    --gold-soft: #eadfc9;
    --paper: #fffefa;
    --ink: #172033;
    --muted: #64748b;
    --line: #d8e1eb;
    --surface: #ffffff;
    --soft: #f5f8fc;
    --success: #15803d;
    --danger: #9f2d2d;
    --warning: #8a5a00;
    --male: #e8f1fb;
    --female: #f9e5ea;
    --shadow: 0 14px 36px rgba(15,41,71,.10);
    --shadow-lg: 0 24px 65px rgba(15,41,71,.16);
    --radius: 18px;
    --font: "ExamKityariJameel", serif;
}

html, body, body *, input, select, textarea, button, option, .form-control, .form-select, .btn, .modal, .table, #treeHost, #treeHost svg text {
    font-family: var(--font) !important;
}

.relation-icon {
    font-family: "Segoe UI Symbol","Noto Sans Symbols 2",sans-serif !important
}

* {
    box-sizing: border-box
}

html {
    min-width: 320px;
    scroll-behavior: smooth
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: radial-gradient(circle at 100% 0%,rgba(35,79,125,.10),transparent 28rem), linear-gradient(180deg,#f8fafc 0%,#f2f5f9 100%);
}

button, input, select, textarea {
    font: inherit
}

button {
    cursor: pointer
}

.page-shell {
    min-height: 100vh
}

.brand-header {
    color: #fff;
    background: radial-gradient(circle at 20% -40%,rgba(255,255,255,.18),transparent 22rem), linear-gradient(125deg,#102b49 0%,var(--navy) 50%,#315f8f 100%);
    border-bottom: 3px solid rgba(177,138,69,.9);
    box-shadow: 0 10px 28px rgba(15,41,71,.2);
}

.header-grid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap
}

.brand-area {
    display: flex;
    align-items: center;
    gap: 14px
}

.brand-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    background: #fff;
    padding: 5px;
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(0,0,0,.18)
}

.brand-kicker {
    font-family: "Segoe UI",Arial,sans-serif !important;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .72
}

.brand-header h1 {
    margin: 0;
    font-size: clamp(25px,2.5vw,34px);
    line-height: 1.5;
    font-weight: 400
}

.brand-header p {
    margin: 0;
    font-family: "Segoe UI",Arial,sans-serif !important;
    font-size: 13px;
    opacity: .78
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.btn-header {
    min-height: 40px;
    padding: 7px 14px;
    color: #fff;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.5);
    border-radius: 11px
}

    .btn-header:hover {
        background: #fff;
        color: var(--navy)
    }

.case-progress-wrap {
    padding: 10px 13px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px
}

.case-progress-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 5px
}

.progress-slim {
    height: 5px;
    background: rgba(255,255,255,.15)
}

    .progress-slim .progress-bar {
        background: linear-gradient(90deg,#e8d49c,#fff4c6)
    }

.quick-toolbar {
    position: sticky;
    top: 8px;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px;
    background: rgba(255,255,255,.93);
    backdrop-filter: blur(12px);
    border: 1px solid var(--line);
    border-radius: 15px;
    box-shadow: 0 8px 24px rgba(15,41,71,.08)
}

.workflow-chip, .tool-action {
    border: 1px solid #ccd8e5;
    background: #fff;
    color: var(--navy);
    border-radius: 10px;
    padding: 8px 11px;
    font-size: 14px
}

    .workflow-chip.active, .workflow-chip:hover {
        color: #fff;
        background: var(--navy);
        border-color: var(--navy)
    }

.tool-action {
    background: #f8fafc
}

    .tool-action:hover {
        background: #eef4fa
    }

.toolbar-spacer {
    flex: 1
}

.workspace-row {
    align-items: flex-start
}

.input-card, .preview-card, .report-card {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid #d9e1eb;
    border-radius: var(--radius);
    box-shadow: var(--shadow)
}

.workspace-section + .workspace-section {
    border-color: #e5ebf2 !important
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(180deg,#fff,#fafcff)
}

    .section-heading > div {
        display: flex;
        align-items: center;
        gap: 10px
    }

    .section-heading h2 {
        margin: 0;
        color: var(--navy);
        font-size: 20px;
        font-weight: 400
    }

.section-no {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg,var(--navy),var(--navy-2));
    font-family: "Segoe UI",Arial,sans-serif !important;
    font-size: 11px
}

.section-badge {
    padding: 5px 9px;
    border-radius: 999px;
    color: #75591f;
    background: #fbf4e5;
    border: 1px solid #ead6aa;
    font-family: "Segoe UI",Arial,sans-serif !important;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .04em
}

.section-body {
    padding: 0 18px 18px
}

.member-block, .subsection-card, .relation-launcher {
    padding: 15px;
    background: linear-gradient(180deg,#fff,#fbfdff);
    border: 1px solid #d9e3ee;
    border-radius: 14px
}

.subsection-card {
    margin-top: 12px
}

.propositus-card {
    background: linear-gradient(180deg,#fff,#f6faff)
}

.subsection-title, .relation-launcher-title {
    color: var(--navy);
    font-size: 18px;
    margin-bottom: 10px
}

.relation-launcher-subtitle {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7
}

.form-label {
    margin-bottom: 5px;
    color: var(--navy);
    font-size: 16px
}

.form-control, .form-select {
    min-height: 47px;
    border: 1px solid #cbd7e4;
    border-radius: 10px;
    background: #fff;
    font-size: 16px
}

    .form-control:focus, .form-select:focus {
        border-color: var(--navy-2);
        box-shadow: 0 0 0 4px rgba(35,79,125,.10)
    }

    .form-control::placeholder {
        color: #98a2b3;
        opacity: 1
    }

.ltr-control {
    direction: ltr;
    text-align: left
}

.propositus-fixed-group, .modal-readonly-field {
    min-height: 47px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #8f1f1f;
    background: #fff4f4;
    border: 1px solid #e5c1c1
}

.relation-button-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px
}

.relation-btn {
    min-height: 66px;
    display: grid;
    grid-template-columns: 38px minmax(0,1fr) 30px;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    text-align: right;
    color: var(--navy);
    background: #fff;
    border: 1px solid #cbd7e5;
    border-radius: 12px;
    transition: .15s ease
}

    .relation-btn:hover {
        transform: translateY(-1px);
        border-color: #8ea8c5;
        box-shadow: 0 7px 18px rgba(23,54,93,.09)
    }

.relation-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #edf4fb;
    border-radius: 9px
}

.relation-text {
    font-size: 17px
}

.relation-count {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: #fff;
    background: var(--navy);
    font-family: "Segoe UI",Arial,sans-serif !important;
    font-size: 12px
}

.family-summary {
    padding: 10px 12px;
    color: #40536a;
    background: #f7fafc;
    border: 1px dashed #b7c8da;
    border-radius: 10px;
    font-size: 14px
}

.info-note {
    padding: 11px 12px;
    color: #674d14;
    background: #fff9eb;
    border: 1px solid #efd9a8;
    border-radius: 11px;
    line-height: 1.7;
    font-size: 13px
}

.land-grid {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 10px
}

.estate-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px
}

    .estate-summary > div {
        padding: 11px 12px;
        background: #f5f8fc;
        border: 1px solid #d9e3ee;
        border-radius: 11px
    }

    .estate-summary span {
        display: block;
        color: var(--muted);
        font-size: 12px
    }

    .estate-summary strong {
        display: block;
        color: var(--navy);
        font-size: 17px;
        margin-top: 3px
    }

.share-table-wrap {
    border: 1px solid #dce5ee;
    border-radius: 12px;
    overflow: auto
}

.share-table {
    margin: 0;
    min-width: 520px
}

    .share-table thead th {
        color: var(--navy);
        background: #f3f7fb;
        white-space: nowrap
    }

.main-actions {
    display: flex;
    gap: 9px
}

.btn {
    border-radius: 10px
}

.btn-primary {
    background: linear-gradient(135deg,var(--navy),var(--navy-2));
    border: 0
}

    .btn-primary:hover {
        background: linear-gradient(135deg,#102b49,var(--navy))
    }

.btn-outline-primary {
    color: var(--navy);
    border-color: #a7bad0
}

.preview-column {
    min-width: 0
}

@media(min-width:1200px) and (min-height:720px) {
    .preview-card {
        position: sticky;
        top: 82px
    }
}

.preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 15px 16px;
    border-bottom: 1px solid #e0e7ef;
    background: linear-gradient(180deg,#fff,#fafcff)
}

.preview-eyebrow {
    font-family: "Segoe UI",Arial,sans-serif !important;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #7a8797
}

.preview-toolbar h2 {
    margin: 0;
    color: var(--navy);
    font-size: 21px
}

.preview-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap
}

.preview-action {
    min-height: 38px;
    padding: 6px 10px;
    border: 1px solid #cbd7e4;
    border-radius: 9px;
    color: var(--navy);
    background: #fff
}

    .preview-action:hover {
        background: #eef4fa
    }

.png-action {
    color: #fff;
    background: var(--success);
    border-color: var(--success)
}

.pdf-action {
    color: #fff;
    background: #a33a32;
    border-color: #a33a32
}

.preview-action:disabled {
    opacity: .45;
    cursor: not-allowed
}

.zoom-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--muted);
    border-bottom: 1px solid #e5ebf2;
    font-size: 12px
}

    .zoom-row input {
        flex: 1
    }

.tree-viewport {
    position: relative;
    min-height: 560px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    padding: 18px;
    background: linear-gradient(135deg,rgba(234,239,246,.95),rgba(247,249,252,.95)), repeating-linear-gradient(0deg,rgba(23,54,93,.025) 0,rgba(23,54,93,.025) 1px,transparent 1px,transparent 8px);
    scrollbar-width: thin
}

#treeHost {
    position: relative;
    width: 1123px;
    min-width: 1123px;
    aspect-ratio: 297/210;
    flex: 0 0 auto;
    background: var(--paper);
    border: 1px solid #adb9c7;
    box-shadow: var(--shadow-lg);
    transform-origin: top center;
    transition: transform .16s ease
}

    #treeHost:before {
        content: "";
        position: absolute;
        inset: 12px;
        border: 1px solid rgba(23,54,93,.28);
        pointer-events: none;
        z-index: 2
    }

    #treeHost svg {
        display: block;
        width: 100%;
        height: 100%
    }

.empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    text-align: center;
    color: #647286
}

.empty-icon {
    font-size: 50px
}

.empty-state h3 {
    margin: 0;
    color: var(--navy);
    font-size: 22px
}

.empty-state p {
    margin: 0;
    max-width: 480px
}

.preview-foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    color: #667085;
    background: #fbfcfe;
    border-top: 1px solid #e5ebf2;
    font-size: 12px
}

.status-dot {
    display: flex;
    align-items: center;
    gap: 7px
}

    .status-dot span {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #22a559
    }

.report-card {
    padding: 18px
}

.report-title {
    color: var(--navy);
    font-size: 22px;
    border-bottom: 2px solid var(--gold);
    padding-bottom: 7px
}

.report-meta {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 8px;
    margin-top: 12px
}

.report-meta-item {
    padding: 8px 10px;
    border: 1px solid #dce5ee;
    border-radius: 9px;
    background: #fafcff
}

    .report-meta-item span {
        display: block;
        color: #7b8796;
        font-size: 11px
    }

    .report-meta-item strong {
        display: block;
        color: var(--navy);
        font-size: 15px
    }

.report-table {
    min-width: 650px
}

.signature-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 20px;
    text-align: center;
    color: var(--navy)
}

    .signature-grid span {
        display: inline-block;
        margin-top: 26px;
        color: #526273
    }

.family-modal-content {
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(15,23,42,.22)
}

    .family-modal-content .modal-header {
        color: #fff;
        background: linear-gradient(135deg,var(--navy),#28527f);
        border: 0
    }

    .family-modal-content .btn-close {
        filter: invert(1)
    }

.modal-subtitle {
    opacity: .8;
    font-size: 13px
}

.modal-form-card, .member-grid-wrap {
    padding: 15px;
    background: #fff;
    border: 1px solid #d7e0ea;
    border-radius: 12px
}

.member-grid {
    min-width: 720px;
    direction: rtl
}

    .member-grid thead th {
        color: var(--navy);
        background: #f2f6fa;
        white-space: nowrap
    }

.grid-heading {
    color: var(--navy);
    font-size: 18px;
    margin-bottom: 9px
}

.modal-action-footer {
    background: #fff
}

.share-entry-card {
    padding: 12px;
    background: #f7fafc;
    border: 1px dashed #b7c8da;
    border-radius: 11px
}

.share-entry-title {
    color: var(--navy);
    font-size: 16px;
    margin-bottom: 8px
}

.share-entry-grid {
    display: grid;
    grid-template-columns: 120px 24px 120px 1fr;
    align-items: end;
    gap: 8px
}

.fraction-slash {
    padding-bottom: 10px;
    text-align: center;
    font-family: "Segoe UI",Arial,sans-serif !important
}

.share-presets {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
    padding-bottom: 4px
}

.fraction-preset {
    border: 1px solid #cbd7e4;
    background: #fff;
    color: var(--navy);
    border-radius: 8px;
    padding: 5px 8px;
    font-family: "Segoe UI",Arial,sans-serif !important
}

.share-entry-card small {
    display: block;
    color: #7a8797;
    margin-top: 7px
}

@media(max-width:991.98px) {
    .quick-toolbar {
        position: static
    }

    .preview-card {
        position: static !important
    }

    .tree-viewport {
        justify-content: flex-start
    }

    .land-grid {
        grid-template-columns: repeat(2,1fr)
    }

    .report-meta {
        grid-template-columns: repeat(2,1fr)
    }
}

@media(max-width:767.98px) {
    .brand-header .container {
        padding-inline: 14px
    }

    .header-grid {
        align-items: flex-start
    }

    .brand-area {
        align-items: flex-start
    }

    .brand-logo {
        width: 54px;
        height: 54px
    }

    .header-actions {
        width: 100%
    }

        .header-actions .btn {
            flex: 1
        }

    .quick-toolbar {
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start
    }

    .workflow-chip, .tool-action {
        white-space: nowrap
    }

    .toolbar-spacer {
        display: none
    }

    .section-body {
        padding: 0 13px 14px
    }

    .section-heading {
        padding: 14px 13px
    }

    .relation-button-grid {
        grid-template-columns: 1fr
    }

    .land-grid {
        grid-template-columns: repeat(2,1fr)
    }

    .estate-summary {
        grid-template-columns: 1fr
    }

    .main-actions {
        flex-direction: column
    }

    .preview-actions {
        width: 100%
    }

    .preview-action {
        flex: 1
    }

    .tree-viewport {
        min-height: 420px;
        padding: 10px
    }

    #treeHost {
        min-width: 900px;
        width: 900px
    }

    .report-meta {
        grid-template-columns: 1fr
    }

    .signature-grid {
        grid-template-columns: 1fr
    }

    .share-entry-grid {
        grid-template-columns: 1fr 18px 1fr
    }

    .share-presets {
        grid-column: 1/-1
    }
}

@media(max-width:480px) {
    .brand-header h1 {
        font-size: 23px
    }

    .section-badge {
        display: none
    }

    .land-grid {
        grid-template-columns: 1fr 1fr
    }
}

@media print {
    @page {
        size: A4 landscape;
        margin: 8mm
    }

    body {
        background: #fff !important
    }

    .brand-header, .quick-toolbar, .input-card, .preview-toolbar, .zoom-row, .preview-foot {
        display: none !important
    }

    main.container, .workspace-row, .preview-column, .preview-card, .report-card {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important
    }

    .workspace-row {
        display: block !important
    }

    .preview-card {
        position: static !important
    }

    .tree-viewport {
        width: 100% !important;
        min-height: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        background: #fff !important;
        border: 0 !important
    }

    #treeHost {
        width: 100% !important;
        min-width: 0 !important;
        transform: none !important;
        box-shadow: none !important;
        border: 1px solid #777 !important;
        page-break-after: always
    }

    .report-card {
        display: block !important;
        padding-top: 8mm !important
    }

    .report-table {
        min-width: 0 !important
    }
}


/* ===== v30: inheritance engine + safer tree layout ===== */
.legal-basis-box {
    padding: 13px 14px;
    color: #17365d;
    background: linear-gradient(180deg,#f4f8fc,#eef4fa);
    border: 1px solid #bfd0e1;
    border-right: 4px solid #17365d;
    border-radius: 12px;
    line-height: 1.9;
    font-size: 14px;
}

.auto-share-note {
    color: #526273;
    line-height: 1.8;
    background: #f8fbff;
    border: 1px solid #d8e4ef;
    padding: 10px 12px;
    border-radius: 10px;
}

.share-table {
    min-width: 980px
}

    .share-table td:last-child, .report-table td:last-child {
        min-width: 280px;
        white-space: normal;
        line-height: 1.7;
    }

.heir-eligible {
    color: #176b3a;
    font-weight: 600
}

.heir-blocked {
    color: #9f2d2d;
    font-weight: 600
}

.heir-review {
    color: #8a5a00;
    font-weight: 600
}

.reason-law {
    font-size: 13px;
    color: #526273
}

#treeHost svg .share-label {
    font-family: "ExamKityariJameel",serif !important;
    fill: #17365d;
    font-weight: 400;
}

#sectionPreview:fullscreen {
    background: #eef3f8;
    padding: 18px;
    overflow: auto;
}

@media print {
    html, body, body * {
        font-family: "ExamKityariJameel",serif !important;
    }
}


/* ===== Extended heir groups (v31) ===== */
.relation-button-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
}

.relation-btn {
    min-height: 70px;
}

.relation-text {
    line-height: 1.5;
}

@media (max-width: 575.98px) {
    .relation-button-grid {
        grid-template-columns: 1fr;
    }
}

.extended-heirs-note {
    font-size: 12px;
    color: var(--muted);
    margin-top: 8px;
}


/* ===== Compact Family Members Scroll Area (v32) ===== */
#sectionFamily .section-body {
    max-height: 520px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--navy-2) #eef3f8;
    overscroll-behavior: contain;
    padding-left: 12px;
}

    #sectionFamily .section-body::-webkit-scrollbar {
        width: 9px;
    }

    #sectionFamily .section-body::-webkit-scrollbar-track {
        background: #eef3f8;
        border-radius: 999px;
    }

    #sectionFamily .section-body::-webkit-scrollbar-thumb {
        background: var(--navy-2);
        border-radius: 999px;
        border: 2px solid #eef3f8;
    }

        #sectionFamily .section-body::-webkit-scrollbar-thumb:hover {
            background: var(--navy);
        }

@media (max-width: 767.98px) {
    #sectionFamily .section-body {
        max-height: 430px;
        padding-left: 8px;
    }
}


/* ===== Phase 1 Market UI: Responsive wizard + true fit preview + mobile share cards (v40) ===== */
.share-cards-mobile,
.mobile-wizard {
    display: none;
}

.autosave-ok {
    color: var(--success) !important;
}

.autosave-saving {
    color: var(--warning) !important;
}

@media (max-width: 767.98px) {
    body {
        padding-bottom: 96px;
    }

    main.container {
        padding-inline: 10px;
    }

    .quick-toolbar {
        display: none;
    }

    .workspace-row {
        --bs-gutter-y: 0;
    }

    #inputColumn,
    #previewColumn {
        width: 100%;
        padding-inline: 0;
    }

    .input-card,
    .preview-card,
    .report-card {
        border-radius: 14px;
        box-shadow: 0 8px 24px rgba(15,41,71,.08);
    }

    /* Mobile is a real four-step workflow. JS marks the active section. */
    #inputColumn .workspace-section {
        display: none;
    }

        #inputColumn .workspace-section.mobile-step-active {
            display: block;
        }

    #previewColumn {
        display: none;
    }

        #previewColumn.mobile-step-active {
            display: block;
        }

    .main-actions {
        display: none;
    }

    body[data-mobile-step="3"] .main-actions {
        display: flex;
        position: sticky;
        bottom: 92px;
        z-index: 12;
        background: rgba(255,255,255,.96);
        backdrop-filter: blur(10px);
    }

    #sectionFamily .section-body {
        max-height: none;
        overflow: visible;
        padding-left: 13px;
    }

    .share-table-wrap {
        display: none;
    }

    .share-cards-mobile {
        display: grid;
        gap: 10px;
    }

    .share-mobile-card {
        padding: 13px;
        background: #fff;
        border: 1px solid #d9e3ee;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(23,54,93,.05);
    }

    .share-mobile-head {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 8px;
    }

    .share-mobile-name {
        color: var(--navy);
        font-size: 18px;
        line-height: 1.5;
    }

    .share-mobile-relation {
        color: var(--muted);
        font-size: 13px;
    }

    .share-mobile-status {
        flex: 0 0 auto;
        padding: 4px 8px;
        border-radius: 999px;
        background: #f5f8fc;
        border: 1px solid #d9e3ee;
        font-size: 12px;
    }

    .share-mobile-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .share-mobile-metric {
        padding: 8px 10px;
        background: #f7fafc;
        border-radius: 9px;
    }

        .share-mobile-metric span {
            display: block;
            color: var(--muted);
            font-size: 11px;
        }

        .share-mobile-metric strong {
            display: block;
            color: var(--navy);
            font-size: 15px;
            margin-top: 2px;
        }

    .share-mobile-reason {
        margin-top: 9px;
        padding-top: 8px;
        border-top: 1px dashed #d6e0ea;
        color: #526273;
        line-height: 1.7;
        font-size: 12px;
    }

    .preview-toolbar {
        padding: 12px;
    }

        .preview-toolbar h2 {
            font-size: 18px;
        }

    .preview-actions {
        display: grid;
        grid-template-columns: repeat(3,1fr);
        gap: 6px;
    }

    .preview-action {
        min-width: 0;
        padding-inline: 7px;
    }

    .zoom-row {
        padding-inline: 12px;
    }

    .tree-viewport {
        min-height: 300px;
        padding: 8px;
        justify-content: center;
        overflow: hidden;
    }

    #treeHost {
        width: 1123px;
        min-width: 1123px;
        max-width: none;
        flex: 0 0 auto;
    }

    .report-card {
        margin-top: 12px !important;
    }

        .report-card .table-responsive {
            overflow-x: auto;
        }

    .mobile-wizard {
        position: fixed;
        z-index: 1040;
        right: 8px;
        left: 8px;
        bottom: max(8px, env(safe-area-inset-bottom));
        display: block;
        padding: 7px;
        background: rgba(255,255,255,.97);
        border: 1px solid #cfdae6;
        border-radius: 16px;
        box-shadow: 0 12px 34px rgba(15,41,71,.20);
        backdrop-filter: blur(14px);
    }

    .mobile-wizard-status {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        padding: 0 7px 5px;
        color: var(--muted);
        font-size: 11px;
    }

    .mobile-wizard-actions {
        display: grid;
        grid-template-columns: 36px repeat(4,1fr) 36px;
        align-items: stretch;
        gap: 4px;
    }

    .mobile-step-btn,
    .mobile-wizard-arrow {
        min-height: 47px;
        border: 0;
        border-radius: 10px;
        color: #58697d;
        background: #f5f8fc;
        font-size: 11px;
    }

        .mobile-step-btn span {
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 1px;
            border-radius: 50%;
            background: #e2eaf3;
            font-family: "Segoe UI",Arial,sans-serif !important;
            font-size: 10px;
        }

        .mobile-step-btn.active {
            color: #fff;
            background: var(--navy);
        }

            .mobile-step-btn.active span {
                color: var(--navy);
                background: #fff;
            }

    .mobile-wizard-arrow {
        color: var(--navy);
        background: #eef4fa;
        font-family: "Segoe UI",Arial,sans-serif !important;
        font-size: 21px;
    }

        .mobile-wizard-arrow:disabled {
            opacity: .35;
        }
}

@media (max-width: 420px) {
    .mobile-wizard {
        right: 4px;
        left: 4px;
        padding-inline: 5px;
    }

    .mobile-wizard-actions {
        grid-template-columns: 32px repeat(4,1fr) 32px;
        gap: 3px;
    }

    .mobile-step-btn {
        font-size: 10px;
        padding-inline: 2px;
    }

    .share-mobile-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    .mobile-wizard,
    .share-cards-mobile {
        display: none !important;
    }
}


/* ===== v41: persistent heir management ===== */
.heir-manager {
    padding: 14px;
    background: #f8fbff;
    border: 1px solid #d6e2ee;
    border-radius: 14px;
}

.heir-manager-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    color: var(--navy);
}

    .heir-manager-head strong {
        display: block;
        font-size: 17px;
        font-weight: 400;
    }

    .heir-manager-head small {
        display: block;
        margin-top: 2px;
        color: var(--muted);
        font-size: 12px;
    }

.heir-manager-count {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: #fff;
    background: var(--navy);
    font-family: "Segoe UI",Arial,sans-serif !important;
    font-size: 12px;
}

.heir-manager-list {
    display: grid;
    gap: 8px;
}

.heir-manage-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    background: #fff;
    border: 1px solid #d9e3ee;
    border-radius: 11px;
}

.heir-manage-main {
    min-width: 0;
    flex: 1;
}

.heir-manage-name {
    color: var(--navy);
    font-size: 17px;
    line-height: 1.45;
}

.heir-manage-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

    .heir-manage-meta > span:not(.status-pill) + span:not(.status-pill)::before {
        content: "•";
        margin-left: 6px;
        color: #a0aec0;
    }

.heir-manage-actions {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
}

@media (max-width: 575.98px) {
    .heir-manager {
        padding: 11px;
    }

    .heir-manage-card {
        align-items: stretch;
        flex-direction: column;
    }

    .heir-manage-actions {
        width: 100%;
    }

        .heir-manage-actions .btn {
            flex: 1;
            min-height: 40px;
        }
}
