/* Base */
.crm-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.crm-col-2{grid-column:span 2}
.crm-actions{margin-top:12px}
.crm-alert{padding:10px 12px;border-radius:6px;margin:8px 0}
.crm-alert-warning{background:#fffbeb;border:1px solid #f59e0b}
.crm-alert-error{background:#fef2f2;border:1px solid #ef4444}
.crm-alert-success{background:#ecfdf5;border:1px solid #10b981}

/* Table */
.crm-table{width:100%;border-collapse:collapse}
.crm-table th,.crm-table td{border:1px solid #e5e7eb;padding:8px}
.crm-table thead th{background:#f5f5f5}
.crm-table .crm-late{color:#b91c1c;font-weight:600}
.crm-table-responsive{overflow:auto}

/* Badges */
.crm-badge{display:inline-block;padding:2px 8px;border-radius:999px;font-size:12px;line-height:18px;border:1px solid #d1d5db;background:#f9fafb}
.crm-badge.valide{border-color:#10b981;background:#ecfdf5}
.crm-badge.vu{border-color:#3b82f6;background:#eff6ff}
.crm-badge.a_completer{border-color:#f59e0b;background:#fffbeb}
.crm-badge.enregistre{border-color:#9ca3af;background:#f3f4f6}

/* Filters - AMÉLIORÉ */
.crm-filters{
    background:#f9fafb;
    border:1px solid #e5e7eb;
    padding:20px;
    margin-bottom:20px;
    border-radius:10px;
}

.crm-filter-row{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
    gap:16px;
    margin-bottom:16px;
    align-items:end;
}

.crm-filter-item{
    display:flex;
    flex-direction:column;
}

.crm-filter-item label{
    display:block;
    font-weight:600;
    font-size:13px;
    margin-bottom:8px;
    color:#374151;
    white-space:nowrap;
}

.crm-filter-item select,
.crm-filter-item input{
    height:40px;
    padding:8px 12px;
    border:1px solid #d1d5db;
    border-radius:6px;
    font-size:14px;
    background:#fff;
    box-sizing:border-box;
}

.crm-filter-item select:focus,
.crm-filter-item input:focus{
    outline:none;
    border-color:#3b82f6;
    box-shadow:0 0 0 3px rgba(59,130,246,0.1);
}

.crm-filter-actions{
    display:flex;
    justify-content:flex-end;
    gap:10px;
    margin-top:8px;
    align-items:center;
}

.crm-filter-actions .button{
    height:40px;
    padding:0 20px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:6px;
    font-size:14px;
    font-weight:500;
    text-decoration:none;
    border:1px solid #d1d5db;
    background:#fff;
    color:#374151;
    cursor:pointer;
    margin:0;
}

.crm-filter-actions .button-primary{
    background:#3b82f6;
    border-color:#3b82f6;
    color:#fff;
}

.crm-filter-actions .button:hover{
    background:#f3f4f6;
}

.crm-filter-actions .button-primary:hover{
    background:#2563eb;
}

/* Upload dropzone */
.crm-dropzone{border:2px dashed #cbd5e1;padding:16px;text-align:center;border-radius:8px;background:#f8fafc}
.crm-dropzone.dragover{background:#eef2ff;border-color:#6366f1}
.crm-progress{height:6px;background:#e5e7eb;border-radius:999px;overflow:hidden;margin-top:8px}
.crm-progress .crm-bar{height:6px;width:0%;background:#6366f1;transition:width .2s}
.crm-files-list{list-style:none;margin:8px 0 0;padding:0}
.crm-files-list li{margin:2px 0;font-size:13px}

/* Actions alignment - SOLUTION DÉFINITIVE */
:root{--crm-control-h:32px}

.crm-actions-cell{
    vertical-align:middle;
    padding:12px 8px !important;
}

.crm-actions-group{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    align-items:center;
    justify-content:center;
}

/* FORCE L'ALIGNEMENT de tous les enfants directs */
.crm-actions-group > *{
    display:inline-flex !important;
    align-items:center !important;
    height:var(--crm-control-h) !important;
    vertical-align:middle !important;
    margin:0 !important;
    padding-top:0 !important;
    padding-bottom:0 !important;
}

/* Formulaires dans les actions */
.crm-actions-group form{
    display:inline-flex !important;
    align-items:center !important;
    gap:6px;
    margin:0 !important;
    height:var(--crm-control-h) !important;
}

/* Boutons standards */
.crm-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    height:var(--crm-control-h);
    padding:0 10px;
    line-height:1;
    box-sizing:border-box;
    font-size:12px;
    white-space:nowrap;
    border-radius:6px;
    border:1px solid #d1d5db;
    background:#fff;
    text-decoration:none;
    cursor:pointer;
}

.crm-btn:hover{
    background:#f3f4f6;
    text-decoration:none;
}

.crm-btn-edit{
    border-color:#93c5fd;
    background:#dbeafe;
    color:#1e40af;
}

.crm-btn-edit:hover{
    background:#bfdbfe;
}

/* Boutons dans les formulaires */
.crm-actions-group button{
    -webkit-appearance:none;
    appearance:none;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    height:var(--crm-control-h);
    padding:0 10px;
    line-height:1;
    box-sizing:border-box;
    font-size:12px;
    white-space:nowrap;
    border-radius:6px;
    border:1px solid #d1d5db;
    background:#fff;
    color:inherit;
    font:inherit;
    cursor:pointer;
    text-decoration:none;
    gap:4px;
}

.crm-btn-danger,
.crm-actions-group button.crm-btn-danger{
    background:#ef4444;
    border-color:#ef4444;
    color:#fff;
}

.crm-actions-group button.crm-btn-danger:hover{
    background:#dc2626;
    border-color:#dc2626;
}

.crm-btn-ghost,
.crm-actions-group button.crm-btn-ghost{
    background:#6b7280;
    border-color:#6b7280;
    color:#fff;
}

.crm-actions-group button.crm-btn-ghost:hover{
    background:#4b5563;
    border-color:#4b5563;
}

/* Formulaire de statut - SOLUTION RADICALE */
.crm-status-inline{
    display:inline-flex !important;
    align-items:center !important;
    gap:6px !important;
    padding:0 !important;
    margin:0 !important;
    border:none !important;
    background:transparent !important;
    height:var(--crm-control-h) !important;
    box-sizing:border-box !important;
}

.crm-status-label{
    font-size:12px;
    color:#6b7280;
    margin:0 !important;
    padding:0 !important;
    white-space:nowrap;
    display:inline-flex;
    align-items:center;
    height:var(--crm-control-h);
    line-height:1;
}

.crm-status-select{
    display:inline-flex;
    align-items:center;
    height:var(--crm-control-h) !important;
    min-width:90px;
    padding:0 8px !important;
    margin:0 !important;
    line-height:1;
    box-sizing:border-box;
    font-size:12px;
    border:1px solid #d1d5db;
    border-radius:6px;
    background:#fff;
}

/* Formulaire de suppression */
.crm-delete-inline{
    display:inline-flex !important;
    align-items:center !important;
    margin:0 !important;
    height:var(--crm-control-h) !important;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
    .crm-actions-group {
        flex-direction:column;
        align-items:stretch;
        gap:4px;
    }
    
    .crm-actions-group > * {
        height:auto !important;
    }
    
    .crm-status-inline {
        justify-content:space-between;
        width:100%;
        height:auto !important;
    }
    
    .crm-status-select {
        min-width:120px;
        height:auto !important;
    }
}

/* --- v1.9.3.1: Accessibilité & contraste des alertes --- */
.crm-alert{display:flex;align-items:flex-start;gap:8px;border-width:1px;font-weight:500}
.crm-alert .crm-ico{font-size:16px;line-height:1.2;flex:0 0 auto;margin-top:1px}

/* Contraste renforcé */
.crm-alert-success{background:#e6f7ef;border-color:#059669;color:#065f46}
.crm-alert-warning{background:#fff7e6;border-color:#d97706;color:#92400e}
.crm-alert-error{background:#fee2e2;border-color:#dc2626;color:#7f1d1d}

/* Boutons : focus visible */
.crm-btn:focus, .crm-actions-group button:focus, .crm-filter-actions .button:focus{
  outline:none; box-shadow:0 0 0 3px rgba(59,130,246,.25);
}
