.map-collab-anchor {
    position: relative;
}

.handrive-item-map-collab-anchor {
    position: absolute;
    top: 50%;
    right: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 10px;
    width: 10px;
    height: 10px;
    transform: translateY(-50%);
}

/* The presence dot owns its trailing slot independently of URL sharing. */
.handrive-item-name-wrap.has-map-collab-indicator > .handrive-item-map-collab-anchor {
    right: 10px;
}

.handrive-item-map-collab-anchor[hidden] {
    display: none;
}

.map-collab-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    box-shadow: none;
    cursor: pointer;
    transform: translate(-50%, -50%);
    -webkit-tap-highlight-color: transparent;
}

.map-collab-indicator[hidden] {
    display: none;
}

.map-collab-indicator:hover,
.map-collab-indicator:active {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.map-collab-indicator:focus-visible {
    outline: 2px solid var(--handrive-focus-ring, #3cb44b);
    outline-offset: 1px;
}

.map-collab-indicator-dot {
    display: block;
    flex: 0 0 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3cb44b;
}

.map-popup-option-group {
    display: inline-flex;
    align-items: flex-start;
    gap: 8px;
}

.map-popup-actions-options {
    align-self: center;
    margin-right: 0;
}

.map-popup-option-toggle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    min-width: 25px;
    line-height: 1;
}

.map-popup-option-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    line-height: 1;
}

.map-popup-option-icon svg {
    display: block;
    flex: 0 0 auto;
}

.map-viewer-wrap #handrive-url-share-modal .handrive-popup-modal-backdrop.site-modal-backdrop {
    background: var(--site-modal-backdrop-bg, rgb(0 0 0 / 0.24));
    -webkit-backdrop-filter: var(--site-modal-backdrop-filter, none);
    backdrop-filter: var(--site-modal-backdrop-filter, none);
}

.map-viewer-wrap #handrive-url-share-modal .handrive-popup-modal-dialog.site-modal-dialog {
    border-radius: var(--site-popup-radius-common, 12px);
    background: var(--site-dropdown-surface-bg, var(--site-modal-surface-bg, rgb(var(--site-modal-surface-rgb, 248 248 248) / var(--site-modal-surface-opacity, 0.72))));
    background-color: var(--site-dropdown-surface-bg, var(--site-modal-surface-bg, rgb(var(--site-modal-surface-rgb, 248 248 248) / var(--site-modal-surface-opacity, 0.72))));
    background-image: none;
    -webkit-backdrop-filter: var(--site-dropdown-surface-filter, var(--site-modal-surface-filter, saturate(120%) blur(4px)));
    backdrop-filter: var(--site-dropdown-surface-filter, var(--site-modal-surface-filter, saturate(120%) blur(4px)));
    box-shadow: var(--site-dropdown-menu-shadow, var(--site-popup-shadow-common, 0 8px 18px rgba(0, 0, 0, 0.2)));
}

.map-collab-popup {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: var(--site-z-popup);
    min-width: 180px;
    max-width: min(260px, calc(100vw - 20px));
    padding: 6px;
    color: var(--handrive-text, var(--site-text, #222));
}

.map-viewer-wrap .map-collab-widget.leaflet-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: min(260px, calc(100vw - 20px));
    margin: 0 0 10px 10px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    pointer-events: auto;
}

.map-viewer-wrap .map-collab-widget[hidden] {
    display: none;
}

.map-viewer-wrap .map-collab-widget:not(.is-map-control-mounted) {
    display: none;
}

.map-viewer-wrap .map-collab-popup-loading {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    max-width: 100%;
    padding: 6px 8px;
    color: var(--site-text, var(--handrive-text, #222));
    font-size: 12px;
    line-height: 1.2;
}

.map-viewer-wrap .map-collab-popup-loading .handrive-list-loading-spinner {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    border-width: 2px;
}

.map-viewer-wrap .map-collab-widget > .map-collab-popup {
    position: static;
    inset: auto;
    min-width: min(180px, calc(100vw - 20px));
    max-width: 100%;
    max-height: min(280px, calc(100dvh - 40px));
    overflow: auto;
    overscroll-behavior: contain;
}

.map-collab-popup.is-list-popup-portal {
    position: fixed;
    top: 0;
    right: auto;
    left: 0;
    z-index: var(--site-z-popup-raised, 1125);
}

.map-collab-popup.site-dropdown-menu {
    border: 1px solid var(--site-dropdown-menu-border, var(--site-border-context, rgba(0, 0, 0, 0.14)));
    border-radius: var(--site-dropdown-menu-radius, var(--site-popup-radius-common, 12px));
    background: var(--site-dropdown-surface-bg, var(--site-modal-surface-bg, rgb(var(--site-modal-surface-rgb, 248 248 248) / var(--site-modal-surface-opacity, 0.72))));
    background-color: var(--site-dropdown-surface-bg, var(--site-modal-surface-bg, rgb(var(--site-modal-surface-rgb, 248 248 248) / var(--site-modal-surface-opacity, 0.72))));
    background-image: none;
    -webkit-backdrop-filter: var(--site-dropdown-surface-filter, var(--site-modal-surface-filter, saturate(120%) blur(4px)));
    backdrop-filter: var(--site-dropdown-surface-filter, var(--site-modal-surface-filter, saturate(120%) blur(4px)));
    box-shadow: var(--site-dropdown-menu-shadow, var(--site-popup-shadow-common, 0 8px 18px rgba(0, 0, 0, 0.2)));
    opacity: 1;
}

.map-collab-popup[hidden] {
    display: none;
}

.map-collab-popup-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 4px 8px 4px;
    color: var(--handrive-text-muted, var(--site-text-muted, #666));
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.map-collab-popup-title-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
}

.map-collab-popup-title-name > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-collab-popup-count {
    flex: 0 0 auto;
    color: var(--handrive-text-muted, var(--site-text-muted, #666));
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.map-collab-popup-lock {
    display: inline-block;
    width: 11px;
    height: 14px;
    flex: 0 0 11px;
    background-color: currentColor;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    mask-repeat: no-repeat;
}

.map-collab-popup-empty {
    padding: 5px 8px;
    color: var(--handrive-text-muted, var(--site-text-muted, #666));
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
}

.map-collab-popup-row {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    padding: 5px 8px;
    border-radius: var(--btn-template-radius, 8px);
    color: var(--handrive-text-stronger, var(--site-text-stronger, #111));
    font-size: 12px;
    line-height: 1.25;
    white-space: nowrap;
}

.map-collab-popup-dot {
    display: block;
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.map-collab-popup-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-collab-guest-name-button {
    width: 100%;
    margin-top: 6px;
    justify-content: center;
    font-size: 12px;
}
