/* ══════════════════════════════════════════════════════════════
   ebios.css — Module EBIOS RM (Analyse de Risques)
   Couleur : Violet (#8b5cf6)
   Tous les selecteurs prefixes .ebios-
   ══════════════════════════════════════════════════════════════ */

:root {
    --ebios: #8b5cf6;
    --ebios-dark: #7c3aed;
    --ebios-light: #f5f3ff;
    --ebios-lighter: #ede9fe;
    --ebios-border: #ddd6fe;
    --ebios-text: #5b21b6;

    /* Risk levels */
    --ebios-very-low: #22c55e;
    --ebios-low: #84cc16;
    --ebios-moderate: #eab308;
    --ebios-high: #f97316;
    --ebios-very-high: #ef4444;
}

/* ── Module button active state ── */
.module-btn.active-ebios {
    background: var(--ebios-light);
    color: var(--ebios-dark);
    border-color: var(--ebios);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

/* ── Module panel ── */
#mod-ebios {
    display: none;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px 40px;
}

/* ── Analysis selector ── */
.ebios-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid var(--ebios-border);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.ebios-selector select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
}

.ebios-selector select:focus {
    border-color: var(--ebios);
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

/* ── Stepper ── */
.ebios-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 24px;
    padding: 0;
    position: relative;
}

.ebios-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
    padding: 12px 8px 10px;
    border-radius: 10px;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    font-family: inherit;
}

.ebios-step:hover {
    background: var(--ebios-light);
}

.ebios-step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #94a3b8;
    border: 2px solid #e2e8f0;
    transition: all 0.2s ease;
    position: relative;
    z-index: 2;
}

.ebios-step.active .ebios-step-num {
    background: var(--ebios);
    color: #fff;
    border-color: var(--ebios);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.ebios-step.completed .ebios-step-num {
    background: var(--ebios-very-low);
    color: #fff;
    border-color: var(--ebios-very-low);
}

.ebios-step-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
    margin-top: 6px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.3;
    max-width: 120px;
}

.ebios-step.active .ebios-step-label {
    color: var(--ebios-dark);
}

.ebios-step.completed .ebios-step-label {
    color: #16a34a;
}

/* Connector line between steps */
.ebios-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 30px;
    left: calc(50% + 22px);
    width: calc(100% - 44px);
    height: 2px;
    background: #e2e8f0;
    z-index: 1;
}

.ebios-step.completed:not(:last-child)::after {
    background: var(--ebios-very-low);
}

/* ── Atelier content panels ── */
.ebios-atelier {
    display: none;
    animation: ebiosFadeIn 0.25s ease;
}

.ebios-atelier.active {
    display: block;
}

@keyframes ebiosFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Cards ── */
.ebios-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.ebios-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.ebios-card-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ebios-card-header h3 .ebios-icon {
    width: 28px;
    height: 28px;
    background: var(--ebios-lighter);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ebios);
}

/* ── Tables ── */
.ebios-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.ebios-table thead th {
    text-align: left;
    padding: 8px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    background: #f8fafc;
}

.ebios-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.ebios-table tbody tr:hover {
    background: var(--ebios-light);
}

/* ── Buttons ── */
.ebios-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.ebios-btn-primary {
    background: var(--ebios);
    color: #fff;
    border-color: var(--ebios);
}

.ebios-btn-primary:hover {
    background: var(--ebios-dark);
}

.ebios-btn-ghost {
    background: transparent;
    color: var(--ebios);
    border-color: var(--ebios-border);
}

.ebios-btn-ghost:hover {
    background: var(--ebios-light);
}

.ebios-btn-sm {
    padding: 4px 10px;
    font-size: 0.75rem;
}

.ebios-btn-danger {
    background: transparent;
    color: #ef4444;
    border-color: #fecaca;
}

.ebios-btn-danger:hover {
    background: #fef2f2;
}

/* ── Forms (inline) ── */
.ebios-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.ebios-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ebios-form-group label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.ebios-form-group input,
.ebios-form-group select,
.ebios-form-group textarea {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.ebios-form-group input:focus,
.ebios-form-group select:focus,
.ebios-form-group textarea:focus {
    border-color: var(--ebios);
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.ebios-form-group.full-width {
    grid-column: 1 / -1;
}

/* ── Checkbox Grid (multi-select) ── */
.ebios-checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    padding: 8px 0;
}
.ebios-checkbox-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #475569;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}
.ebios-checkbox-item:hover {
    border-color: #8b5cf6;
    background: rgba(139,92,246,0.04);
}
.ebios-checkbox-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #8b5cf6;
    margin: 0;
}
.ebios-checkbox-item input[type="checkbox"]:checked + span {
    color: #7c3aed;
    font-weight: 600;
}

/* ── Badges ── */
.ebios-risk-id {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace;
    background: #1e3a5f;
    color: #fff;
    letter-spacing: 0.02em;
}

.ebios-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
}

.ebios-badge-very-low { background: rgba(34,197,94,0.12); color: #16a34a; }
.ebios-badge-low { background: rgba(132,204,22,0.12); color: #65a30d; }
.ebios-badge-moderate { background: rgba(234,179,8,0.12); color: #ca8a04; }
.ebios-badge-high { background: rgba(249,115,22,0.12); color: #ea580c; }
.ebios-badge-very-high { background: rgba(239,68,68,0.12); color: #dc2626; }

.ebios-badge-draft { background: #f1f5f9; color: #64748b; }
.ebios-badge-in-progress { background: rgba(59,130,246,0.1); color: #2563eb; }
.ebios-badge-completed { background: rgba(34,197,94,0.1); color: #16a34a; }

/* ── Risk matrix (ARA-style) ── */
.ebios-matrix-card {
    position: relative;
    padding-bottom: 16px;
}

.ebios-matrix-wrapper {
    overflow-x: auto;
    margin: 16px 16px 0 16px;
    position: relative;
}

.ebios-matrix-grid {
    display: grid;
    grid-template-columns: 120px repeat(5, 1fr);
    grid-template-rows: auto repeat(4, 80px);
    gap: 4px;
    min-width: 560px;
}

/* Header cells (proba labels) */
.ebios-mx-header {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 6px 4px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    text-align: center;
    line-height: 1.2;
}

.ebios-mx-header.corner {
    align-items: flex-end;
    justify-content: flex-end;
    padding-right: 8px;
    font-style: italic;
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.68rem;
}

/* Row label (impact level) */
.ebios-mx-rowlabel {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 12px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
}

/* Data cell */
.ebios-mx-cell {
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 70px;
    transition: transform 0.12s, box-shadow 0.12s;
    cursor: default;
}

.ebios-mx-cell:hover {
    transform: scale(1.03);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    z-index: 2;
}

.ebios-mx-cell.above-appetite {
    outline: 2.5px solid rgba(139,26,26,0.5);
    outline-offset: -2px;
}

/* Empty dot placeholder */
.ebios-mx-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(0,0,0,0.08);
}

/* Risk IDs in cell (R1, R2...) */
.ebios-mx-risks {
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    font-family: 'SF Mono', 'Fira Code', monospace;
    letter-spacing: 0.03em;
    word-spacing: 4px;
}

/* Axis labels */
.ebios-matrix-xlabel {
    text-align: center;
    font-size: 0.75rem;
    font-style: italic;
    color: #94a3b8;
    margin-top: 10px;
    padding-right: 0;
}

.ebios-matrix-ylabel {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.72rem;
    font-style: italic;
    color: #94a3b8;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    letter-spacing: 1px;
}

/* Legend */
.ebios-matrix-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 14px 16px 4px;
    flex-wrap: wrap;
}

.ebios-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.74rem;
    color: #64748b;
    font-weight: 500;
}

.ebios-legend-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* ── Empty state ── */
.ebios-empty {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.ebios-empty-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

.ebios-empty p {
    font-size: 0.85rem;
    margin-bottom: 12px;
}

/* ── Two-column layout (Atelier 1, 2) ── */
.ebios-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ── KPI row ── */
.ebios-kpis {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.ebios-kpi {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    border-left: 4px solid #e2e8f0;
}

.ebios-kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
}

.ebios-kpi-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-top: 4px;
}

.ebios-kpi.danger { border-left-color: #ef4444; }
.ebios-kpi.danger .ebios-kpi-value { color: #ef4444; }
.ebios-kpi.success { border-left-color: #22c55e; }
.ebios-kpi.success .ebios-kpi-value { color: #22c55e; }
.ebios-kpi.warning { border-left-color: #eab308; }
.ebios-kpi.warning .ebios-kpi-value { color: #eab308; }

/* ── Appetite slider ── */
.ebios-appetite {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 16px;
}

.ebios-appetite label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.ebios-appetite input[type="range"] {
    flex: 1;
    accent-color: var(--ebios);
}

.ebios-appetite-value {
    background: var(--ebios);
    color: #fff;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 32px;
    text-align: center;
}

/* ── Atelier description (collapsible) ── */
.ebios-atelier-desc {
    background: var(--ebios-light);
    border: 1px solid var(--ebios-border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.82rem;
    color: var(--ebios-text);
    line-height: 1.5;
}

.ebios-atelier-desc strong {
    display: block;
    margin-bottom: 4px;
}

/* ── Context panel (Informations generales) ── */
.ebios-context-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}

.ebios-context-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.ebios-context-summary::-webkit-details-marker { display: none; }
.ebios-context-summary::before {
    content: '\25B6';
    font-size: 0.6rem;
    color: #94a3b8;
    transition: transform 0.2s;
}
details[open] > .ebios-context-summary::before {
    transform: rotate(90deg);
}

.ebios-context-body {
    padding: 0 16px 16px;
}

.ebios-context-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
}

.ebios-context-row:last-child { margin-bottom: 0; }

.ebios-context-row .ebios-form-group.full-width {
    grid-column: 1 / -1;
}

.ebios-context-body input,
.ebios-context-body textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.82rem;
    background: #ffffff;
    transition: border-color 0.2s;
}

.ebios-context-body input:focus,
.ebios-context-body textarea:focus {
    border-color: var(--ebios);
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.ebios-context-body label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 4px;
}

/* ── ISO Conformity Section ── */
.ebios-iso-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.ebios-iso-kpi {
    text-align: center;
    padding: 6px 0;
}

.ebios-iso-kpi-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1e293b;
}

.ebios-iso-kpi-label {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 500;
    margin-top: 2px;
}

.ebios-iso-view-btn.active {
    background: var(--ebios-light) !important;
    color: var(--ebios-dark) !important;
    border-color: var(--ebios) !important;
}

.ebios-iso-filter {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.ebios-iso-filter select {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.78rem;
    background: #fff;
    color: #1e293b;
}

.ebios-iso-filter select:focus {
    border-color: var(--ebios);
    outline: none;
}

.ebios-iso-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.ebios-iso-badge.mapped {
    background: #dcfce7;
    color: #166534;
}

.ebios-iso-badge.unmapped {
    background: #fef2f2;
    color: #991b1b;
}

.ebios-iso-badge.partial {
    background: #fef9c3;
    color: #854d0e;
}

.ebios-iso-action-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    background: #eff6ff;
    color: #1e40af;
    margin: 1px 2px;
    cursor: pointer;
}

.ebios-iso-action-tag:hover {
    background: #dbeafe;
}

/* ── Teaser (upsell) ── */
#mod-ebios-teaser {
    display: none;
    max-width: 700px;
    margin: 60px auto;
    text-align: center;
    padding: 48px 32px;
    background: linear-gradient(135deg, var(--ebios-light) 0%, #fff 100%);
    border: 1px solid var(--ebios-border);
    border-radius: 16px;
}

#mod-ebios-teaser h2 {
    font-size: 1.4rem;
    color: var(--ebios-dark);
    margin-bottom: 12px;
}

#mod-ebios-teaser p {
    color: #64748b;
    font-size: 0.95rem;
    margin-bottom: 24px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Actions row ── */
.ebios-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ── Criticite bar ── */
.ebios-crit-bar {
    display: inline-block;
    height: 6px;
    border-radius: 3px;
    min-width: 30px;
}

.ebios-crit-1 { background: var(--ebios-very-low); width: 25%; }
.ebios-crit-2 { background: var(--ebios-low); width: 50%; }
.ebios-crit-3 { background: var(--ebios-high); width: 75%; }
.ebios-crit-4 { background: var(--ebios-very-high); width: 100%; }

/* ── Progress bar (actions) ── */
.ebios-progress {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.ebios-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--ebios);
    transition: width 0.3s ease;
}

/* ── Responsive ── */
@media (max-width: 968px) {
    .ebios-columns {
        grid-template-columns: 1fr;
    }
    .ebios-kpis {
        grid-template-columns: repeat(3, 1fr);
    }
    .ebios-stepper {
        gap: 0;
    }
    .ebios-step-label {
        font-size: 0.65rem;
        max-width: 80px;
    }
}

@media (max-width: 600px) {
    .ebios-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
    .ebios-step-num {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }
    .ebios-step-label {
        display: none;
    }
    #mod-ebios {
        padding: 0 8px 20px;
    }
}

/* ══════════════════════════════════════════════════════════════
   Entity Edit Modal
   ══════════════════════════════════════════════════════════════ */

.ebios-entity-modal-content {
    max-width: 640px;
    border-radius: 16px;
    overflow: hidden;
    padding: 0;
}

.ebios-entity-modal-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ebios-entity-modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ebios-entity-modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.ebios-entity-modal-footer {
    padding: 12px 20px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #f1f5f9;
}

/* ── Form sections inside entity modal ── */
.ebios-modal-section {
    margin-bottom: 16px;
}

.ebios-modal-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ebios);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--ebios-border);
}

/* ── Residual risk block (Atelier 5 modal) ── */
.ebios-residual-grid {
    display: flex;
    align-items: stretch;
    gap: 16px;
    margin-top: 8px;
}
.ebios-residual-col {
    flex: 1;
    background: var(--ebios-bg, #f8f6ff);
    border: 1px solid var(--ebios-border, #e5e0f8);
    border-radius: 10px;
    padding: 14px;
}
.ebios-residual-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ebios, #8b5cf6);
    margin-bottom: 10px;
}
.ebios-residual-info {
    font-size: 0.82rem;
    color: #374151;
    margin-bottom: 4px;
}
.ebios-residual-arrow {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ebios, #8b5cf6);
    padding: 0 4px;
}
.ebios-residual-score {
    margin-top: 10px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
    color: #6b7280;
    background: #f3f4f6;
}
.ebios-residual-score.score-critique {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}
.ebios-residual-score.score-eleve {
    background: #fff7ed;
    color: #ea580c;
    border: 1px solid #fdba74;
}
.ebios-residual-score.score-moyen {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fcd34d;
}
.ebios-residual-score.score-faible {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #86efac;
}
.ebios-muted {
    font-size: 0.82rem;
    color: #9ca3af;
    font-style: italic;
    padding: 8px 0;
}

/* ── Close analysis modal ── */
.ebios-close-kpis {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}
.ebios-close-kpi {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    background: var(--ebios-bg, #f8f6ff);
    border: 1px solid var(--ebios-border, #e5e0f8);
    border-radius: 10px;
}
.ebios-close-kpi.above {
    background: #fef2f2;
    border-color: #fca5a5;
}
.ebios-close-kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1f2937;
}
.ebios-close-kpi.above .ebios-close-kpi-value {
    color: #dc2626;
}
.ebios-close-kpi-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    margin-top: 2px;
}
.ebios-prefix-preview {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ebios-prefix-example {
    font-size: 0.78rem;
    color: #9ca3af;
    white-space: nowrap;
}
.ebios-close-table-wrapper {
    margin-top: 16px;
}
.ebios-close-table-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}
.ebios-close-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.ebios-close-table th {
    text-align: left;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    padding: 6px 8px;
}
.ebios-close-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}
.ebios-close-table .score-col {
    text-align: center;
    font-weight: 700;
}
.ebios-sev-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.ebios-sev-badge.sev-critical { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.ebios-sev-badge.sev-high { background: #fff7ed; color: #ea580c; border: 1px solid #fdba74; }
.ebios-sev-badge.sev-medium { background: #fffbeb; color: #d97706; border: 1px solid #fcd34d; }
.ebios-sev-badge.sev-low { background: #f0fdf4; color: #16a34a; border: 1px solid #86efac; }
.ebios-close-ok-msg {
    margin-top: 12px;
    padding: 8px 14px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    color: #16a34a;
    font-size: 0.8rem;
    font-weight: 500;
}
.ebios-close-error p { margin: 0 0 8px 0; color: #374151; }
.ebios-close-missing-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    background: #fef2f2;
    padding: 8px;
}
.ebios-close-missing-item {
    padding: 4px 8px;
    font-size: 0.82rem;
    color: #dc2626;
}
.ebios-close-missing-item::before {
    content: '• ';
    font-weight: 700;
}

/* ── Live risk badge ── */
.ebios-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.ebios-live-badge .ebios-live-score {
    font-size: 1.2rem;
}

/* ── Toggle switch ── */
.ebios-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ebios-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.ebios-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.ebios-toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 11px;
    transition: 0.2s;
}

.ebios-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    left: 3px;
    top: 3px;
    transition: 0.2s;
}

.ebios-toggle input:checked + .ebios-toggle-slider {
    background: var(--ebios);
}

.ebios-toggle input:checked + .ebios-toggle-slider::before {
    transform: translateX(18px);
}

/* ── Multi-select VM checkboxes ── */
.ebios-vm-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.ebios-vm-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.ebios-vm-checkbox:hover {
    border-color: var(--ebios-border);
    background: var(--ebios-light);
}

.ebios-vm-checkbox.checked {
    border-color: var(--ebios);
    background: var(--ebios-light);
    color: var(--ebios-dark);
}

.ebios-vm-checkbox input {
    width: 14px;
    height: 14px;
    accent-color: var(--ebios);
}

/* ── ISO Multi-select widget ── */
.ebios-iso-widget {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.ebios-iso-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    background: #fff;
    min-height: 38px;
    flex-wrap: wrap;
}

.ebios-iso-trigger:hover {
    border-color: var(--ebios);
}

.ebios-iso-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--ebios-lighter);
    color: var(--ebios-dark);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.ebios-iso-tag .ebios-iso-tag-remove {
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    opacity: 0.6;
}

.ebios-iso-tag .ebios-iso-tag-remove:hover {
    opacity: 1;
}

.ebios-iso-placeholder {
    color: #94a3b8;
    font-size: 0.82rem;
}

.ebios-iso-dropdown {
    display: none;
    border-top: 1px solid #e2e8f0;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
}

.ebios-iso-dropdown.open {
    display: block;
}

.ebios-iso-cat-header {
    padding: 8px 12px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ebios-text);
    background: var(--ebios-light);
    position: sticky;
    top: 0;
    z-index: 1;
}

.ebios-iso-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.1s;
}

.ebios-iso-item:hover {
    background: #f8fafc;
}

.ebios-iso-item input {
    width: 14px;
    height: 14px;
    accent-color: var(--ebios);
    flex-shrink: 0;
}

.ebios-iso-item-code {
    font-weight: 700;
    color: var(--ebios);
    min-width: 32px;
}

.ebios-iso-suggest-btn {
    display: block;
    width: 100%;
    padding: 6px 12px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ebios);
    background: var(--ebios-light);
    border: none;
    border-top: 1px solid var(--ebios-border);
    cursor: pointer;
}

.ebios-iso-suggest-btn:hover {
    background: var(--ebios-lighter);
}

/* ══════════════════════════════════════════════════════════════
   Catalogue Picker Modal
   ══════════════════════════════════════════════════════════════ */

.ebios-catalog-modal-content {
    max-width: 900px;
    width: 95vw;
    border-radius: 16px;
    overflow: hidden;
    padding: 0;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.ebios-catalog-modal-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.ebios-catalog-modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
}

.ebios-catalog-search-wrap {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.ebios-catalog-search-wrap input {
    width: 100%;
    padding: 7px 12px 7px 32px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.82rem;
    font-family: inherit;
}

.ebios-catalog-search-wrap input:focus {
    outline: none;
    border-color: var(--ebios);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.ebios-catalog-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.ebios-catalog-modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

/* ── Catalogue category groups ── */
.ebios-cat-group {
    margin-bottom: 20px;
}

.ebios-cat-group-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ebios-text);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--ebios-border);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ebios-cat-group-count {
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.72rem;
}

/* ── Catalogue cards ── */
.ebios-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.ebios-cat-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    position: relative;
}

.ebios-cat-card:hover {
    border-color: var(--ebios-border);
    background: #fafafe;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.08);
}

.ebios-cat-card.selected {
    border-color: var(--ebios);
    background: var(--ebios-light);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

.ebios-cat-card.disabled {
    opacity: 0.45;
    pointer-events: none;
    background: #f8fafc;
}

.ebios-cat-card input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--ebios);
    flex-shrink: 0;
    margin-top: 2px;
}

.ebios-cat-card-body {
    flex: 1;
    min-width: 0;
}

.ebios-cat-card-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 3px;
    line-height: 1.3;
}

.ebios-cat-card-desc {
    font-size: 0.72rem;
    color: #64748b;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ebios-cat-card-meta {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.ebios-cat-card-tag {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
}

.ebios-cat-card-tag.tag-risk {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

.ebios-cat-card-tag.tag-proba {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
}

.ebios-cat-card-tag.tag-impact {
    background: rgba(234, 179, 8, 0.08);
    color: #ca8a04;
}

.ebios-cat-card-tag.tag-type {
    background: rgba(139, 92, 246, 0.08);
    color: var(--ebios);
}

/* ── Avancement quick buttons ── */
.ebios-progress-btns {
    display: flex;
    gap: 4px;
}

.ebios-progress-btns button {
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.ebios-progress-btns button:hover {
    border-color: var(--ebios);
    background: var(--ebios-light);
}

.ebios-progress-btns button.active {
    background: var(--ebios);
    color: #fff;
    border-color: var(--ebios);
}

/* ══════════════════════════════════════════════════════
   DASHBOARD
   ══════════════════════════════════════════════════════ */

.ebios-export-menu {
    display: flex;
    gap: 4px;
    align-items: center;
    padding-left: 8px;
    border-left: 1px solid #e2e8f0;
    margin-left: 4px;
}

#ebiosDashboardBtn.active {
    background: var(--ebios);
    color: #fff;
    border-color: var(--ebios);
}

.ebios-dashboard {
    margin-top: 8px;
}

.ebios-dash-kpis {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.ebios-dash-kpi {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: box-shadow 0.2s;
}

.ebios-dash-kpi:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.ebios-dash-kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.ebios-dash-kpi-icon.purple { background: rgba(139,92,246,0.1); color: var(--ebios); }
.ebios-dash-kpi-icon.red { background: rgba(239,68,68,0.1); color: #ef4444; }
.ebios-dash-kpi-icon.green { background: rgba(34,197,94,0.1); color: #22c55e; }
.ebios-dash-kpi-icon.amber { background: rgba(234,179,8,0.1); color: #ca8a04; }
.ebios-dash-kpi-icon.blue { background: rgba(59,130,246,0.1); color: #3b82f6; }

.ebios-dash-kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.1;
    color: #1e293b;
}

.ebios-dash-kpi-label {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ebios-dash-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ebios-chart-container {
    padding: 12px 16px 16px;
    min-height: 240px;
    position: relative;
}

.ebios-chart-container canvas {
    max-height: 280px;
}

.ebios-chart-empty {
    padding: 40px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.82rem;
}

/* ══════════════════════════════════════════════════════
   FILTER BAR — Atelier 4
   ══════════════════════════════════════════════════════ */

.ebios-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.ebios-filter-search {
    position: relative;
    flex: 1;
    min-width: 160px;
}

.ebios-filter-search input {
    width: 100%;
    padding: 6px 10px 6px 32px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.ebios-filter-search input:focus {
    border-color: var(--ebios);
}

.ebios-filter-pills {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.ebios-pill {
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}

.ebios-pill:hover { border-color: #94a3b8; }
.ebios-pill.active { background: var(--ebios); color: #fff; border-color: var(--ebios); }
.ebios-pill.pill-very-high.active { background: #ef4444; border-color: #ef4444; }
.ebios-pill.pill-high.active { background: #f97316; border-color: #f97316; }
.ebios-pill.pill-moderate.active { background: #eab308; border-color: #eab308; color: #1e293b; }
.ebios-pill.pill-low.active { background: #84cc16; border-color: #84cc16; color: #1e293b; }

.ebios-filter-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.ebios-filter-toggle input {
    accent-color: var(--ebios);
}

.ebios-filter-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: #94a3b8;
    margin-left: 6px;
}

/* ── Sortable table headers ── */
.ebios-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.ebios-sortable:hover {
    color: var(--ebios);
}

.ebios-sort-icon {
    font-size: 0.65rem;
    vertical-align: middle;
    opacity: 0.5;
}

.ebios-sort-icon.asc::after { content: ' \u25B2'; }
.ebios-sort-icon.desc::after { content: ' \u25BC'; }

/* ══════════════════════════════════════════════════════
   ISO CONFORMITE TABLE — Dashboard
   ══════════════════════════════════════════════════════ */

.ebios-coverage-bar {
    width: 100%;
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 3px;
}

.ebios-coverage-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.ebios-coverage-fill.cov-green { background: #22c55e; }
.ebios-coverage-fill.cov-yellow { background: #eab308; }
.ebios-coverage-fill.cov-red { background: #ef4444; }

.ebios-coverage-text {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
}

/* ── Responsive for modals ── */
@media (max-width: 700px) {
    .ebios-catalog-modal-content { max-width: 100%; width: 100%; max-height: 100vh; border-radius: 0; }
    .ebios-cat-grid { grid-template-columns: 1fr; }
    .ebios-entity-modal-content { max-width: 100%; border-radius: 0; }
    .ebios-dash-kpis { grid-template-columns: repeat(2, 1fr); }
    .ebios-dash-charts { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════
   Assistance IA — Suggestions panneau de revision
   ══════════════════════════════════════════════════════════════ */

.ebios-btn-ai {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 1px 3px rgba(124, 58, 237, 0.3);
}
.ebios-btn-ai:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #9333ea 100%) !important;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.4);
}
.ebios-btn-ai[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cache les boutons IA si le toggle n'est pas actif */
body:not(.ai-ebios-on):not(.ai-ebios-teaser) .ebios-ai-only { display: none !important; }

/* Teaser IA pour demo : affiche les boutons IA en mode grisé */
body.ai-ebios-teaser .ebios-ai-only {
    display: inline-flex !important;
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Bouton teaser IA générique (remediation, plan d'action) */
.ai-teaser-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 1px 3px rgba(124, 58, 237, 0.2);
}

/* Modal IA — overlay fixed standalone */
#ebiosAiReviewModal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
#ebiosAiReviewModal[style*="flex"] { display: flex !important; }
#ebiosAiReviewModal .modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
#ebiosAiReviewModal .modal-content.ebios-ai-modal {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}
#ebiosAiReviewModal .ebios-catalog-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 24px 14px;
    border-bottom: 1px solid #e2e8f0;
}
#ebiosAiReviewModal .ebios-catalog-modal-header > div:first-child { min-width: 0; flex: 1; }
#ebiosAiReviewModal .ebios-catalog-modal-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.4;
    word-break: break-word;
}
#ebiosAiReviewModal .modal-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    padding: 0 4px;
}
#ebiosAiReviewModal .modal-close:hover { color: #1e293b; }
#ebiosAiReviewModal .ebios-catalog-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}
.ebios-ai-modal-body {
    padding: 16px 24px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.ebios-ai-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 50px 20px;
    color: #64748b;
    font-size: 0.86rem;
}
.ebios-ai-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e9d5ff;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: ebios-ai-spin 0.9s linear infinite;
}
@keyframes ebios-ai-spin { to { transform: rotate(360deg); } }

.ebios-ai-item {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e9d5ff;
    background: #faf5ff;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.ebios-ai-item:hover {
    border-color: #c4b5fd;
    background: #f3e8ff;
}
.ebios-ai-item.checked {
    border-color: #7c3aed;
    background: #ede9fe;
}
.ebios-ai-item input[type="checkbox"] {
    margin-top: 3px;
    accent-color: #7c3aed;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.ebios-ai-item-body { flex: 1; min-width: 0; }
.ebios-ai-item-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: #1e293b;
    margin-bottom: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.ebios-ai-item-desc {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.4;
}
.ebios-ai-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #ede9fe;
    color: #6d28d9;
    border: 1px solid #d8b4fe;
}
.ebios-ai-tag.tag-interne { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.ebios-ai-tag.tag-externe { background: #fef3c7; color: #92400e; border-color: #fcd34d; }

.ebios-ai-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 16px;
    border-radius: 8px;
    font-size: 0.84rem;
}

/* Badge IA sur les éléments générés */
.ebios-ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    margin-left: 4px;
    letter-spacing: 0.02em;
}

/* ══════════════════════════════════════════════════════════════
   AI Review — Pre-close review
   ══════════════════════════════════════════════════════════════ */

.ebios-ai-review-content {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #1e293b;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px 0;
}
.ebios-ai-review-content h2 { font-size: 1rem; font-weight: 700; margin: 16px 0 8px; color: #1e293b; }
.ebios-ai-review-content h3 { font-size: 0.9rem; font-weight: 700; margin: 14px 0 6px; color: #334155; }
.ebios-ai-review-content h4 { font-size: 0.85rem; font-weight: 600; margin: 12px 0 4px; color: #475569; }
.ebios-ai-review-content ul { margin: 4px 0 8px 16px; padding: 0; }
.ebios-ai-review-content li { margin-bottom: 4px; }
.ebios-ai-review-content p { margin: 6px 0; }
.ebios-ai-review-content strong { color: #0f172a; }

.ebios-ai-review-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    text-align: right;
}

/* ══════════════════════════════════════════════════════════════
   Archive toggle badge
   ══════════════════════════════════════════════════════════════ */

.ebios-badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--ebios);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    border-radius: 8px;
    text-align: center;
    padding: 0 4px;
}

#ebiosArchiveToggle {
    position: relative;
}

#ebiosArchiveToggle.active {
    background: rgba(139, 92, 246, 0.1);
    color: var(--ebios);
    border-color: var(--ebios);
}

/* ══════════════════════════════════════════════════════════════
   Status Banner (clôturée / archivée)
   ══════════════════════════════════════════════════════════════ */

.ebios-status-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin: 0 0 12px 0;
}

.ebios-banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ebios-banner-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ebios-banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ebios-banner-text strong {
    font-size: 13px;
    font-weight: 600;
}

.ebios-banner-text span {
    font-size: 12px;
    opacity: 0.8;
}

.ebios-banner-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.ebios-status-completed {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.ebios-status-completed .ebios-banner-icon {
    background: #dcfce7;
    color: #16a34a;
}

.ebios-status-completed .ebios-btn {
    color: #166534;
    border-color: #bbf7d0;
}

.ebios-status-completed .ebios-btn:hover {
    background: #dcfce7;
}

.ebios-status-archived {
    background: #fefce8;
    border: 1px solid #fde68a;
    color: #854d0e;
}

.ebios-status-archived .ebios-banner-icon {
    background: #fef9c3;
    color: #ca8a04;
}

.ebios-status-archived .ebios-btn {
    color: #854d0e;
    border-color: #fde68a;
}

.ebios-status-archived .ebios-btn:hover {
    background: #fef9c3;
}

/* ══════════════════════════════════════════════════════════════
   Atelier 5 — Risk Accordion Cards
   ══════════════════════════════════════════════════════════════ */

.ebios-risk-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 12px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}
.ebios-risk-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ── Risk Header (clickable accordion) ── */
.ebios-risk-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    background: #f8fafc;
    border-bottom: 1px solid transparent;
    transition: background 0.15s;
}
.ebios-risk-card.open .ebios-risk-header {
    border-bottom-color: #e2e8f0;
    background: #fff;
}
.ebios-risk-header:hover {
    background: var(--ebios-light);
}

.ebios-risk-header .ebios-risk-id {
    flex-shrink: 0;
}

.ebios-risk-title {
    flex: 1;
    min-width: 0;
}
.ebios-risk-title .risk-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ebios-risk-title .risk-meta {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ebios-risk-scores {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.ebios-risk-score {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace;
}
.ebios-risk-score.intrinsic {
    background: #fef2f2;
    color: #dc2626;
}
.ebios-risk-score.residual {
    background: #f0fdf4;
    color: #16a34a;
}
.ebios-risk-score.residual.high {
    background: #fef2f2;
    color: #dc2626;
}
.ebios-risk-score.residual.moderate {
    background: #fffbeb;
    color: #d97706;
}
.ebios-risk-score-arrow {
    color: #94a3b8;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.ebios-risk-actions-count {
    font-size: 0.72rem;
    color: #64748b;
    padding: 2px 8px;
    background: #f1f5f9;
    border-radius: 10px;
    flex-shrink: 0;
    white-space: nowrap;
}

.ebios-risk-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.ebios-risk-chevron {
    color: #94a3b8;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.ebios-risk-card.open .ebios-risk-chevron {
    transform: rotate(180deg);
}

/* ── Risk Body (collapsible) ── */
.ebios-risk-body {
    display: none;
    padding: 0;
}
.ebios-risk-card.open .ebios-risk-body {
    display: block;
}

/* ── Action Row (checkbox list) ── */
.ebios-action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 10px 20px;
    border-bottom: 1px solid #f1f5f9;
    transition: opacity 0.2s, background 0.15s;
}
.ebios-action-row:last-child {
    border-bottom: none;
}
.ebios-action-row:hover {
    background: #fafbfc;
}

.ebios-action-row.checked {
    background: #f0fdf4;
}
.ebios-action-row.checked .action-text {
    color: #16a34a;
}
.ebios-action-row.checked .ebios-action-check {
    accent-color: #16a34a;
}

.ebios-action-check {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: var(--ebios);
    cursor: pointer;
}

.ebios-action-content {
    flex: 1;
    min-width: 0;
}
.ebios-action-content .action-text {
    font-size: 0.85rem;
    color: #1e293b;
    cursor: pointer;
}
.ebios-action-content .action-text:hover {
    color: var(--ebios);
}
.ebios-action-tags {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.ebios-action-tag {
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #64748b;
    font-weight: 600;
}
.ebios-action-tag.type { background: rgba(139,92,246,0.08); color: #7c3aed; }
.ebios-action-tag.prio-critique { background: rgba(239,68,68,0.1); color: #dc2626; }
.ebios-action-tag.prio-haute { background: rgba(249,115,22,0.1); color: #ea580c; }
.ebios-action-tag.prio-moyenne { background: rgba(234,179,8,0.1); color: #ca8a04; }
.ebios-action-tag.prio-basse { background: rgba(34,197,94,0.1); color: #16a34a; }
.ebios-action-tag.iso { background: rgba(59,130,246,0.08); color: #2563eb; }

.ebios-action-progress {
    width: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ebios-action-progress .ebios-progress {
    flex: 1;
    height: 4px;
}
.ebios-action-progress small {
    font-size: 0.68rem;
    color: #94a3b8;
    min-width: 28px;
    text-align: right;
}

.ebios-action-btns {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

/* ── Risk Card Footer (add action) ── */
.ebios-risk-footer {
    padding: 8px 16px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
}
.ebios-risk-footer .ebios-btn {
    font-size: 0.75rem;
}

