/* ============================================================================
   Relationship Map — تصميم موحّد احترافي (npmap-*)
   مستقلّ بذاته، يستعمل متغيّرات الثيم مع قيم بديلة. ضمّنه مرّة بالـ Layout.
   ============================================================================ */
.relmap-host {
    width: 100%;
}

.npmap-wrap {
    font-family: 'Poppins', 'Tajawal', system-ui, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 340px;
    box-sizing: border-box;
    padding: 34px 26px;
    background-color: #fbfdfc;
    background-image: radial-gradient(rgba(22,40,74,.06) 1px, transparent 1px);
    background-size: 20px 20px;
    border-radius: 14px;
}

.npmap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 100%;
}

.npmap-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 210px;
    max-width: 300px;
}

.npmap-col-left {
    align-items: flex-end;
}

.npmap-col-right {
    align-items: flex-start;
}

.npmap-group {
    width: 100%;
}

.npmap-col-left .npmap-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.npmap-label {
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--slate, #64748b);
    margin-bottom: 9px;
}

/* ── عقدة المركز ── */
.npmap-focus {
    position: relative;
    flex: 0 0 auto;
    width: 214px;
    text-align: center;
    background: linear-gradient(180deg, #ffffff, #f5faf6);
    border: 1px solid rgba(0,108,53,.28);
    border-radius: 18px;
    padding: 20px 18px 18px;
    box-shadow: 0 16px 40px -14px rgba(22,40,74,.30), 0 2px 6px rgba(22,40,74,.06);
}

    .npmap-focus::before {
        content: "";
        position: absolute;
        inset-inline: 18px;
        top: 0;
        height: 3px;
        border-radius: 3px;
        background: linear-gradient(90deg, var(--g, #006c35), var(--gold, #d4af37));
    }

.npmap-focus-chip {
    width: 46px;
    height: 46px;
    margin: 2px auto 10px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(150deg, var(--g, #006c35), var(--gd, #004d26));
    color: #fff;
    font-size: 1.25rem;
    box-shadow: 0 6px 16px -4px rgba(0,108,53,.5);
}

.npmap-focus-code {
    font-family: ui-monospace, monospace;
    font-size: .66rem;
    letter-spacing: .04em;
    color: var(--slate, #64748b);
}

.npmap-focus-title {
    font-weight: 800;
    font-size: 1rem;
    line-height: 1.3;
    color: var(--navy, #16284a);
    margin: 3px 0 0;
    word-break: break-word;
}

.npmap-focus.is-odoo {
    border-color: rgba(184,134,11,.45);
    background: linear-gradient(180deg, #fff, #faf6ef);
}

    .npmap-focus.is-odoo .npmap-focus-chip {
        background: linear-gradient(150deg, #5d3a52, #3a2033);
    }

    .npmap-focus.is-odoo::before {
        background: linear-gradient(90deg, var(--gold, #d4af37), #5d3a52);
    }

/* ── الوصلات ── */
.npmap-wire {
    flex: 0 0 auto;
    align-self: center;
    width: 36px;
    height: 2px;
    position: relative;
}

    .npmap-wire::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        height: 2px;
        transform: translateY(-50%);
        background: linear-gradient(90deg, rgba(0,108,53,.45), rgba(0,108,53,.12));
        border-radius: 2px;
    }

.npmap-wire-left::before {
    background: linear-gradient(90deg, rgba(0,108,53,.12), rgba(0,108,53,.45));
}

.npmap-wire::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--g, #006c35);
    transform: translateY(-50%);
}

.npmap-wire-right::after {
    left: -2px;
}

.npmap-wire-left::after {
    right: -2px;
}

/* ── الكروت ── */
.npmap-card {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    background: #fff;
    border: 1px solid var(--line, #e6ebe8);
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: 0 1px 3px rgba(22,40,74,.05);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

    .npmap-card.is-nav {
        cursor: pointer;
    }

        .npmap-card.is-nav:hover {
            transform: translateY(-2px);
            border-color: rgba(0,108,53,.5);
            box-shadow: 0 8px 20px -8px rgba(0,108,53,.28);
        }

.npmap-av {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(150deg, var(--g, #006c35), var(--gl, #2e9e5b));
    color: #fff;
    font-weight: 800;
    font-size: .85rem;
}

    .npmap-av.is-company {
        border-radius: 11px;
        background: linear-gradient(150deg, var(--navy, #16284a), var(--slate, #64748b));
    }

    .npmap-av img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .npmap-av i {
        font-size: 1.05rem;
    }

.npmap-meta {
    flex: 1 1 auto;
    min-width: 0;
}

.npmap-name {
    font-weight: 700;
    font-size: .9rem;
    line-height: 1.25;
    color: var(--navy, #16284a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.npmap-sub {
    font-size: .74rem;
    color: var(--slate, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.npmap-code {
    font-family: ui-monospace, monospace;
    font-size: .66rem;
    color: #94a3b8;
    margin-top: 1px;
}

.npmap-pill {
    display: inline-block;
    font-size: .64rem;
    font-weight: 700;
    color: #fff;
    border-radius: 999px;
    padding: 3px 9px;
    letter-spacing: .02em;
    white-space: nowrap;
}

    .npmap-pill.sm {
        flex: 0 0 auto;
        font-size: .6rem;
        padding: 2px 8px;
    }

.npmap-focus .npmap-pill {
    margin-top: 10px;
}

.npmap-x {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 7px;
    width: 24px;
    height: 24px;
    transition: .15s;
}

    .npmap-x:hover {
        color: #b91c1c;
        background: #fdecec;
    }

.npmap-empty {
    font-size: .78rem;
    color: #94a3b8;
    font-style: italic;
    background: #fff;
    border: 1px dashed var(--line, #e6ebe8);
    border-radius: 12px;
    padding: 10px 14px;
    text-align: center;
}

/* ── أداة الإسناد ── */
.npmap-assign {
    display: flex;
    gap: 7px;
    align-items: center;
    width: 100%;
    margin-top: 4px;
}

.npmap-assign-select {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid var(--line, #e6ebe8);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: .82rem;
    color: var(--navy, #16284a);
    background: #fff;
}

.npmap-assign-role {
    width: 84px;
    border: 1px solid var(--line, #e6ebe8);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: .82rem;
}

    .npmap-assign-select:focus, .npmap-assign-role:focus {
        outline: none;
        border-color: var(--g, #006c35);
        box-shadow: 0 0 0 3px rgba(0,108,53,.12);
    }

.npmap-assign-btn {
    flex: 0 0 auto;
    border: 0;
    background: var(--g, #006c35);
    color: #fff;
    border-radius: 10px;
    width: 38px;
    height: 36px;
    cursor: pointer;
    transition: .15s;
}

    .npmap-assign-btn:hover {
        background: var(--gd, #004d26);
    }

.npmap-loading {
    padding: 30px;
    text-align: center;
    color: var(--slate, #64748b);
    font-size: .9rem;
}

@media (max-width: 720px) {
    .npmap-wrap {
        padding: 22px 12px;
    }

    .npmap {
        gap: 14px;
    }

    .npmap-wire {
        display: none;
    }

    .npmap-col, .npmap-col-left {
        align-items: stretch;
        max-width: 100%;
        width: 100%;
    }

        .npmap-col-left .npmap-group {
            align-items: stretch;
        }
}
