/* CRM — 1:1 aus ERP assets/css/kontakte.css + kontakt-edit.css portiert. Marken-Orange = var(--o). */

/* ===== Layout: linke Typen-Leiste + Hauptbereich ===== */
.crm-wrap{display:flex;gap:0;height:100%;margin:-18px}
.crm-rail{width:230px;flex-shrink:0;border-right:1px solid #e5e7eb;padding:16px 0;overflow-y:auto;background:#fff}
.crm-rail-top{padding:0 14px 10px}
.crm-rail-btn{display:flex;align-items:center;gap:10px;width:100%;padding:9px 12px;border:0;border-radius:2px;background:none;cursor:pointer;font-size:14px;font-weight:600;color:#374151;text-align:left}
.crm-rail-btn:hover{background:#f3f4f6}
.crm-rail-btn.active,.crm-rail-btn.active:hover{background:var(--o);color:#fff}
.crm-rail-btn.plain{font-weight:500;color:#6b7280}
.crm-rail-grp{font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:#9ca3af;padding:16px 20px 8px;border-top:1px solid #f1f3f5;margin-top:8px;display:flex;align-items:center;gap:8px}
.crm-rail-grp::before{content:'';width:7px;height:7px;border-radius:50%;background:#6a1b9a}
.crm-type{display:flex;align-items:center;gap:10px;padding:8px 20px;cursor:pointer;font-size:14px;color:#374151}
.crm-type:hover{background:#f8fafc}
.crm-type.active{background:#fff4ee;color:var(--o);font-weight:600}
.crm-type .crm-type-ico{color:#9ca3af;font-size:15px}
.crm-type .crm-type-count{margin-left:auto;font-size:12px;color:#9ca3af;font-weight:600}
.crm-main{flex:1;min-width:0;padding:16px 18px;overflow-y:auto}

/* ===== Toolbar ===== */
.crm-toolbar{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-bottom:12px}
.crm-search{flex:1;position:relative}
.crm-search input{width:100%;padding:9px 12px 9px 34px;border:1px solid var(--border);border-radius:2px;font-size:14px;outline:none}
.crm-search input:focus{border-color:#999}
.crm-search .bi{position:absolute;left:11px;top:50%;transform:translateY(-50%);color:#9ca3af}
.crm-tbtn{display:inline-flex;align-items:center;gap:6px;padding:9px 14px;border:1px solid var(--border);border-radius:2px;background:#fff;color:#374151;font-size:13px;font-weight:500;cursor:pointer;white-space:nowrap}
.crm-tbtn:hover{background:#f8fafc}
.crm-tbtn.primary{background:var(--o);border-color:var(--o);color:#fff;font-weight:600}
.crm-tbtn.primary:hover{background:var(--o-h)}
.crm-bar2{display:flex;align-items:center;gap:12px;margin-bottom:10px;font-size:13px;color:#6b7280}

/* ===== Zellen (aus kontakte.css, 1:1) ===== */
.kon-name-cell{display:flex;align-items:center;gap:12px;min-height:40px;min-width:280px}
.kon-avatar-initials{width:38px;height:38px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;color:#fff;letter-spacing:.3px}
.kon-avatar-img,.kon-logo-img{width:38px;height:38px;border-radius:50%;object-fit:cover;flex-shrink:0}
.kon-name-info{display:flex;flex-direction:column;gap:3px;min-width:0}
.kon-name-primary{font-size:13px;font-weight:600;color:#111827;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.kon-name-meta{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.kon-type-badge{display:inline-block;font-size:10px;font-weight:600;padding:1px 7px;border-radius:2px;color:#fff;letter-spacing:.02em;line-height:1.6}
.kon-type-badge-sm{display:inline-block;font-size:10px;font-weight:600;padding:1px 7px;border-radius:2px;color:#fff;line-height:1.6}
.kon-cc-badge{background:#1a1a1a!important}
.kon-portal-badge{background:#059669!important}
.kon-meta-text{font-size:11px;color:#9ca3af;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.kon-meta-sep{color:#d1d5db;font-size:10px}
.kon-name-orgs{display:flex;flex-direction:column;align-items:flex-start;gap:3px;margin-top:3px}
.kon-org-label{display:inline-block;font-size:10px;font-weight:600;padding:1px 7px;border-radius:2px;background:#e5e7eb;color:#4b5563;line-height:1.6;white-space:nowrap;max-width:180px;overflow:hidden;text-overflow:ellipsis}
.kon-team-stack{display:flex;align-items:center;padding-left:4px}
.kon-team-initials{width:30px;height:30px;border-radius:50%;border:2px solid #fff;margin-left:-8px;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:700;color:#fff}
.kon-team-initials:first-child{margin-left:0}
.kon-team-empty{font-size:11px;color:#d1d5db}
.kon-share-circle{width:30px;height:30px;border-radius:50%;border:2px solid #fff;display:inline-flex;align-items:center;justify-content:center;font-size:12px;color:#fff}
.kon-share-public{background:#059669}.kon-share-private{background:#9ca3af}
.kon-assigned-icon{background:#059669}
.kon-act-badge{display:inline-block;font-size:10px;font-weight:600;padding:1px 7px;border-radius:2px;color:#fff;line-height:1.6;white-space:nowrap}
.kon-act-projects{background:#2563eb}.kon-act-empty{background:transparent;color:#d1d5db;font-weight:400}
.kon-contact-actions{display:flex;align-items:center;gap:2px}
.kon-action-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:2px;border:0;background:transparent;color:#9ca3af;cursor:pointer;transition:all .2s;font-size:15px;padding:0}
.kon-action-btn.kon-phone:hover{background:#ecfdf5;color:#059669}
.kon-action-btn.kon-email:hover{background:#eff6ff;color:#2563eb}
.kon-action-btn.kon-web:hover{background:#fdf4ff;color:#9333ea}
.kon-action-btn.is-disabled{opacity:.15;cursor:default;pointer-events:none}
.kon-status-dot{width:9px;height:9px;border-radius:50%;display:inline-block}
.kon-status-dot.on{background:#22c55e}.kon-status-dot.off{background:#d1d5db}
tr.kon-row-inactive td{opacity:.45}

/* ===== Edit-Formular (1:1 aus kontakt-edit.css + address-autocomplete.css) ===== */
.crm-edit .field{margin-bottom:20px;display:flex;align-items:flex-start;gap:20px}
.crm-edit .field:last-child{margin-bottom:0}
.crm-edit .field.hidden{display:none}
.crm-edit .field-label{font-size:14px;font-weight:600;color:#303030;min-width:180px;padding-top:9px;flex-shrink:0;text-align:right;padding-right:15px}
.crm-edit .field-input{flex:1;max-width:500px}
.crm-edit .field-input .form-control,.crm-edit .field-input .form-select{width:100%}
.crm-edit .field-name-pair{display:flex;gap:10px}
.crm-edit .field-name-pair .form-control{flex:1}
.crm-edit .field.field-toggle{align-items:center}
.crm-edit .field.field-toggle .field-label{padding-top:0}
.crm-edit .field-top-aligned{align-items:flex-start}
/* Kontakttyp gesperrt */
.crm-edit .field-type-locked{display:flex;align-items:center;gap:12px}
.crm-edit .field:has(.field-type-locked){align-items:center}
.crm-edit .field:has(.field-type-locked) .field-label{padding-top:0}
.crm-edit .kon-type-lock-hint{font-size:12px;color:#94a3b8;line-height:1.6}
.crm-edit .kon-type-badge{font-size:12px;padding:3px 10px}
.crm-edit .text-danger{color:#dc2626}
/* Bild-Upload */
.crm-edit .image-upload-row{display:flex;align-items:center;gap:16px}
.crm-edit .image-preview{width:80px;height:80px;border-radius:50%;overflow:hidden;border:2px solid #d6d6d6;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.crm-edit .image-preview-img{width:100%;height:100%;object-fit:cover}
.crm-edit .image-upload-actions{display:flex;flex-direction:column;gap:8px}
.crm-edit .image-initials{color:#fff;font-size:24px;font-weight:700;line-height:1}
.crm-edit .btn-upload{display:inline-flex;align-items:center;gap:6px;padding:6px 14px;background:var(--o);color:#fff;font-size:13px;font-weight:600;border-radius:2px;cursor:pointer;border:none;transition:background .1s}
.crm-edit .btn-upload:hover{background:var(--o-h)}
.crm-edit .btn-upload input[type=file]{display:none}
.crm-edit .image-remove-link{font-size:12px;color:#b91c1c;text-decoration:none;cursor:pointer}
.crm-edit .image-remove-link:hover{text-decoration:underline}
.crm-edit .image-format-hint{font-size:11px;color:#888}
.crm-edit .image-format-hint.image-hint-error{color:var(--danger,#dc2626)}
/* Adresse (manuelles Detail-Grid mit Sub-Labels) */
.crm-edit .addr-detail-row{display:flex;gap:8px;flex-wrap:wrap}
.crm-edit .addr-detail-row .addr-detail-field{flex:1;min-width:120px}
.crm-edit .addr-detail-row .addr-detail-field input{font-size:13px;color:#303030}
.crm-edit .addr-detail-row .addr-detail-field label{font-size:11px;color:#999;margin-bottom:2px;display:block}
.crm-edit .addr-detail-row .addr-detail-field.addr-zip{max-width:80px;flex:0 0 80px}
/* Organisation „+" / Verrechnungssatz */
.crm-edit .org-add-btn{width:36px;height:36px;border:1px solid var(--border);background:#fff;border-radius:2px;color:#6b7280;cursor:pointer;font-size:16px}
.crm-edit .org-add-btn:hover{background:#f8fafc}
.crm-edit .billing-rate-row{display:flex;gap:12px;align-items:center}
/* Beziehungs-Block (migrierte CRM-Verknüpfungen) */
.crm-edit .crm-rel{display:flex;flex-direction:column;gap:8px;width:100%}
.crm-edit .crm-rel-row{display:flex;gap:10px;align-items:baseline}
.crm-edit .crm-rel-k{font-size:12px;color:#9ca3af;min-width:110px;flex-shrink:0}
.crm-edit .crm-rel-v{display:flex;flex-wrap:wrap;gap:6px}
.crm-edit .crm-rel-v .kon-org-label{font-size:11px;background:#eef2f7;color:#374151;padding:2px 8px;border-radius:2px}
