/* ==========================================================================
   SALGSBILAG — Product search autocomplete
   ========================================================================== */
.salgsbilag-search-wrap {
    position: relative;
    margin-bottom: 16px;
}
.salgsbilag-search-input {
    width: 100%;
}
.salgsbilag-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0dcd6;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 50;
    margin-top: 4px;
    max-height: 320px;
    overflow-y: auto;
}
.salgsbilag-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid #f5f5f5;
}
.salgsbilag-search-result:last-child {
    border-bottom: none;
}
.salgsbilag-search-result:hover {
    background: #f8f6f3;
}
.salgsbilag-search-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.salgsbilag-search-result.is-sold .salgsbilag-product-thumb,
.salgsbilag-search-result.is-sold .salgsbilag-product-sku {
    opacity: 0.55;
}
.salgsbilag-sold-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 7px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    vertical-align: middle;
    background: var(--sbv2-rust-soft, #fde8e3);
    color: var(--sbv2-rust, #b3401f);
}
.salgsbilag-search-empty {
    padding: 16px;
    text-align: center;
    color: #999;
    font-size: 0.86rem;
}

/* Selected products */
.salgsbilag-selected-product {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: box-shadow 0.15s;
}
.salgsbilag-selected-product:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.salgsbilag-product-thumb {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
}
.salgsbilag-product-thumb img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    display: block;
    border-radius: 6px;
    border: 1px solid #f0f0f0;
}
.salgsbilag-product-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.salgsbilag-product-name {
    font-size: 0.86rem;
    font-weight: 500;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.salgsbilag-product-sku {
    font-size: 0.74rem;
    color: #aaa;
}
.salgsbilag-product-price {
    font-size: 0.86rem;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .salgsbilag-search-dropdown {
        max-height: 260px;
    }
    .salgsbilag-search-result {
        padding: 12px 14px;
    }
    .salgsbilag-selected-product {
        padding: 12px;
        gap: 10px;
    }
    .salgsbilag-product-thumb,
    .salgsbilag-product-thumb img {
        width: 36px;
        height: 36px;
    }
    .sb-remove-product {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ==========================================================================
   KONTAKTER — list, view, contact picker
   ========================================================================== */

/* Actions bar */
.kontakt-actions-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.kontakt-import-btn {
    background: #374151;
}
.kontakt-import-btn:hover {
    background: #4b5563;
}
.kontakt-import-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.kontakt-import-status {
    font-size: 0.84rem;
    color: #15803d;
    font-weight: 500;
}

/* Search bar */
.kontakt-search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.kontakt-search-input {
    flex: 1;
    max-width: 360px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #e8e4de;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #1a1a1a;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}
.kontakt-search-input:focus {
    border-color: #1a1a1a;
}
.kontakt-counter {
    font-size: 0.82rem;
    color: #888;
    white-space: nowrap;
}

/* List cards */
.kontakt-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.kontakt-list-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.kontakt-list-card:hover {
    border-color: #ddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.kontakt-list-card-main {
    min-width: 0;
    flex: 1;
}
.kontakt-list-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #222;
    display: flex;
    align-items: center;
    gap: 8px;
}
.kontakt-list-card-meta {
    font-size: 0.78rem;
    color: #999;
    margin-top: 2px;
}
.kontakt-badge-dinero {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    background: #eff6ff;
    color: #1d4ed8;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* View fields */
.kontakt-view-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.kontakt-view-field {
    display: flex;
    gap: 12px;
    font-size: 0.88rem;
}
.kontakt-view-label {
    min-width: 80px;
    color: #888;
    font-weight: 500;
    flex-shrink: 0;
}
.kontakt-view-value {
    color: #333;
}

/* Contact search picker (salgsbilag form) */
.kontakt-search-wrap {
    position: relative;
}
.kontakt-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0dcd6;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 50;
    margin-top: 4px;
    max-height: 320px;
    overflow-y: auto;
}
.kontakt-search-result {
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid #f5f5f5;
}
.kontakt-search-result:last-child {
    border-bottom: none;
}
.kontakt-search-result:hover {
    background: #f8f6f3;
}
.kontakt-search-result-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: #222;
}
.kontakt-search-result-meta {
    font-size: 0.78rem;
    color: #999;
    margin-top: 1px;
}
.kontakt-search-empty {
    padding: 16px;
    text-align: center;
    color: #999;
    font-size: 0.86rem;
}

@media (max-width: 600px) {
    .kontakt-actions-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .kontakt-list-card {
        padding: 12px 14px;
    }
    .kontakt-view-field {
        flex-direction: column;
        gap: 2px;
    }
    .kontakt-search-dropdown {
        max-height: 260px;
    }
}

/* ── Sync preview modal ──────────────────────────────────────────────── */
.bilag-sync-modal-backdrop[hidden] { display: none; }
.bilag-sync-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9999;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
}
.bilag-sync-modal {
    background: #fff;
    border-radius: 6px;
    width: 100%;
    max-width: 980px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    display: flex; flex-direction: column;
    max-height: calc(100vh - 80px);
}
.bilag-sync-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
}
.bilag-sync-modal-header h3 { margin: 0; font-size: 1.05rem; }
.bilag-sync-modal-close {
    background: none; border: none; font-size: 24px; line-height: 1;
    cursor: pointer; color: #666; padding: 0 6px;
}
.bilag-sync-modal-close:hover { color: #000; }
.bilag-sync-modal-body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1;
}
.bilag-sync-modal-footer {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid #eee;
    background: #fafafa;
}
.bilag-sync-summary { margin: 0 0 12px; color: #555; font-size: 0.88rem; }
.bilag-sync-product {
    border: 1px solid #eee; border-radius: 4px;
    margin-bottom: 14px; overflow: hidden;
}
.bilag-sync-product-head {
    padding: 8px 12px; background: #f7f7f7;
    border-bottom: 1px solid #eee;
    font-size: 0.92rem;
}
.bilag-sync-changed-count { color: #b87b00; font-weight: 600; }
.bilag-sync-clean { color: #4a8f4a; }
.bilag-sync-table {
    width: 100%; border-collapse: collapse; font-size: 0.86rem;
}
.bilag-sync-table th, .bilag-sync-table td {
    padding: 6px 12px; border-bottom: 1px solid #f0f0f0;
    text-align: left; vertical-align: top;
    word-break: break-word;
}
.bilag-sync-table th { background: #fafafa; font-weight: 600; color: #555; }
.bilag-sync-table td:nth-child(2),
.bilag-sync-table td:nth-child(3) { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.82rem; }
.bilag-sync-row-changed td:nth-child(3) { background: #fff8d6; }
.bilag-sync-row-changed td:nth-child(2) { background: #fde7e7; color: #8a3030; }
.bilag-sync-hide-unchanged .bilag-sync-row-same { display: none; }
.bilag-sync-hide-unchanged .bilag-sync-product[data-changed="0"] { display: none; }

