.customer-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    font-size: 14px;
}

.customer-left {
    display: flex;
    flex-direction: column;
}

.customer-main {
    font-weight: 600;
}

.customer-sub {
    font-size: 13px;
    color: #666;
}

.customer-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.badge-pv {
    background: #198754;
    padding: 3px 8px;
    border-radius: 6px;
    color: white;
}

.badge-wp {
    background: #0d6efd;
    padding: 3px 8px;
    border-radius: 6px;
    color: white;
}

.badge-none {
    background: #6c757d;
    padding: 3px 8px;
    border-radius: 6px;
    color: white;
}

.badge-both {
    background: #6f42c1;
    padding: 3px 8px;
    border-radius: 6px;
    color: white;
}

/* ===== CRM Such-Badges ===== */
.crm-badge-pv {
    background: #198754;
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
}

.crm-badge-wp {
    background: #0d6efd;
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
}

.crm-badge-none {
    background: #6c757d;
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
}

.crm-badge-both {
    background: #6f42c1;
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
}

/* ===== CRM Such-Item ===== */
.crm-result-item {
    padding: 12px 14px !important;
}

.crm-result-row {
    display: flex;
    gap: 14px;
    align-items: center;
    font-size: 15px;
    font-weight: 500;
}

.crm-meta {
    font-size: 13px;
    color: #555;
    margin-top: 4px;
    margin-left: 2px;
}

.crm-name {
    min-width: 160px;
}

.crm-kundennummer {
    color: #777;
}

.crm-id {
    color: #999 !important;
}

.crm-quelle {
    margin-left: auto;
    font-weight: 600;
}

/* ================================
   MOBILE OPTIMIERUNG FÜR SUCHERGEBNISSE
==================================*/
@media (max-width: 768px) {

    #search-results {
        border-radius: 10px !important;
        overflow: hidden !important;
        margin-top: 4px;
    }

    .crm-result-item {
        padding: 10px 12px !important;
        font-size: 13px !important;
        line-height: 1.25 !important;
    }

    .crm-result-row {
        gap: 10px !important;
        flex-wrap: nowrap;
    }

    .crm-badge,
    .crm-badge-pv,
    .crm-badge-wp,
    .crm-badge-none,
    .crm-badge-both {
        font-size: 11px !important;
        padding: 2px 6px !important;
        border-radius: 5px !important;
        white-space: nowrap;
    }

    .crm-name {
        font-size: 13px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }

    .crm-kundennummer {
        font-size: 12px !important;
        color: #888;
    }

    .crm-id {
        font-size: 11px !important;
        color: #aaa !important;
    }

    .crm-quelle {
        font-size: 11px !important;
        margin-left: auto;
        white-space: nowrap;
        color: #0d6efd !important;
    }

    .crm-meta {
        font-size: 11px !important;
        margin-top: 3px !important;
        color: #666;
    }

    /* Klickfläche verbessern */
    .list-group-item {
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }
}

/* =====================================================
   CRM Suche – Mobile Vollbreite + Scrollbare Ergebnisse
   ===================================================== */

/* --- Ergebnisliste Desktop --- */
#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 3000;
    background: #fff;
    max-height: 50vh;
    overflow-y: auto;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

#search-results:empty,
#search-results:not(:has(.list-group-item)) {
    display: none !important;
}

/* --- MOBILE Layout --- */
@media (max-width: 768px) {

    /* Suchliste wird zu einem Fullwidth-Panel */
    #search-results {
        position: fixed !important;
        top: 55px !important;
        /* direkt unter Header */
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-height: calc(100vh) !important;
        overflow-y: auto;
        border-radius: 0 !important;
        background: #fff;
        padding-bottom: 5px;
        z-index: 9999 !important;
    }

    #search-results.search-results-mobile {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;

        width: 100vw !important;
        height: calc(100vh - 90px) !important;

        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;

        background: #fff;
        z-index: 99999 !important;
        padding-bottom: 40px;
    }
    input,
    textarea,
    select {
        font-size: 16px !important;
        line-height: 22px !important;
        height: 44px !important;
    }
}

/* Jede Ergebnis-Zeile */
.crm-result-item {
    padding: 14px 16px !important;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px !important;
    line-height: 1.3;
}

.crm-result-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.crm-name {
    font-weight: 600;
    font-size: 14px !important;
}

.crm-kundennummer,
.crm-id,
.crm-quelle {
    font-size: 12px !important;
    color: #666;
}

.crm-meta {
    font-size: 12px !important;
    color: #777;
    padding-left: 40px;
}

/* Badges kleiner */
.crm-badge,
.crm-badge-pv,
.crm-badge-wp,
.crm-badge-none,
.crm-badge-both {
    font-size: 11px !important;
    padding: 2px 6px !important;
    border-radius: 5px;
    white-space: nowrap;
}

@supports (-webkit-overflow-scrolling: touch) {
    #search-results.search-results-mobile {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        max-height: calc(100vh) !important;
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
        background: #fff;
        z-index: 9999 !important;
    }
}
