/* ========================================
   AGENTIC-FLOW v2.0 — Design System
   Cabinet Vailles | Agence de Communication IA
   ======================================== */

:root {
    /* Cabinet Vailles Branding */
    --brand-red: #B30B0B;
    --brand-red-light: #e81c1c;
    --brand-red-glow: rgba(179, 11, 11, 0.35);
    --brand-black: #050508;
    --brand-dark: #0a0a0f;
    --brand-gray: #DED7D7;
    --brand-white: #FFFFFF;
    
    /* UI Neutrals */
    --text-main: #EAEAEA;
    --text-muted: #777;
    --text-dim: #444;
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-hover: rgba(179, 11, 11, 0.3);
    --bg-glass: rgba(255, 255, 255, 0.025);
    --bg-glass-solid: rgba(12, 12, 18, 0.85);
    --glass-blur: blur(20px);
    
    /* Status Colors */
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;
    
    /* Spacing & Sizing */
    --container-max: 1440px;
    --radius-s: 6px;
    --radius-m: 10px;
    --radius-l: 14px;
    --radius-xl: 22px;
    
    /* Shadows */
    --shadow-card: 0 4px 30px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px var(--brand-red-glow);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::selection {
    background: var(--brand-red);
    color: white;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--brand-black);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ========== Background Effects ========== */
.glow-bg {
    position: fixed;
    top: -15%;
    right: -10%;
    width: 55%;
    height: 65%;
    background: radial-gradient(ellipse, rgba(179, 11, 11, 0.12) 0%, transparent 65%);
    z-index: -1;
    pointer-events: none;
    animation: glowFloat 8s ease-in-out infinite;
}

.glow-bg-bottom {
    position: fixed;
    bottom: -15%;
    left: -10%;
    width: 45%;
    height: 55%;
    background: radial-gradient(ellipse, rgba(179, 11, 11, 0.08) 0%, transparent 65%);
    z-index: -1;
    pointer-events: none;
    animation: glowFloat 10s ease-in-out infinite reverse;
}

.grid-bg {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(179, 11, 11, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(179, 11, 11, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: -1;
    pointer-events: none;
}

@keyframes glowFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -15px) scale(1.05); }
}

/* ========== Layout ========== */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

h1, h2, h3 {
    font-weight: 700;
    letter-spacing: 1.5px;
}

/* ========== Glass Effect ========== */
.glass {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-l);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass:hover {
    border-color: var(--border-glass-hover);
    box-shadow: var(--shadow-card);
}

/* ========== Header ========== */
.main-header {
    background: rgba(5, 5, 8, 0.9);
    backdrop-filter: var(--glass-blur);
    border-bottom: 2px solid var(--brand-red);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 30px rgba(179, 11, 11, 0.15);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.main-logo {
    height: 45px;
    transition: transform 0.3s ease, filter 0.3s;
}

.main-logo:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

.header-info h1 {
    font-size: 1.1rem;
    color: var(--brand-gray);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 10px;
}

.version-tag {
    font-size: 0.6rem;
    background: var(--brand-red);
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: 0;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.25);
    padding: 3px 12px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    width: fit-content;
    margin-top: 4px;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: var(--color-success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--color-success);
    animation: dotPulse 2s infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 10px var(--color-success); }
    50% { opacity: 0.6; box-shadow: 0 0 20px var(--color-success); }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-stats {
    display: flex;
    gap: 1.2rem;
}

.mini-stat {
    text-align: center;
}

.mini-stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--brand-red);
    font-family: 'JetBrains Mono', monospace;
}

.mini-stat-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.clock {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 14px;
    border-radius: var(--radius-s);
    border: 1px solid var(--border-glass);
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--brand-red), #8B0000);
    border-radius: var(--radius-s);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.user-avatar:hover {
    transform: scale(1.1);
}

/* ========== Page Layout ========== */
.page-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
    padding-top: 2rem;
    padding-bottom: 3rem;
    min-height: calc(100vh - 200px);
    width: 100%;
}

/* ========== Side Panel ========== */
.panel-card {
    padding: 1.5rem;
}

.panel-title {
    font-size: 0.75rem;
    color: var(--brand-red);
    margin-bottom: 1.2rem;
    border-left: 3px solid var(--brand-red);
    padding-left: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.side-nav ul {
    list-style: none;
}

.side-nav li {
    padding: 10px 12px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-s);
    position: relative;
}

.side-nav li:hover {
    color: var(--brand-white);
    background: rgba(179, 11, 11, 0.08);
    transform: translateX(4px);
}

.side-nav li.active {
    font-weight: 700;
    color: var(--brand-red);
    background: rgba(179, 11, 11, 0.1);
    border-left: 3px solid var(--brand-red);
}

.badge {
    font-size: 0.6rem;
    background: var(--brand-red);
    color: white;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
    margin-left: auto;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
}

.stat-item .label { color: var(--text-muted); }
.stat-item .value { font-weight: 700; color: var(--brand-red); font-family: 'JetBrains Mono', monospace; }
.stat-item .value.danger { color: var(--color-danger); }

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-action {
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    background: rgba(179, 11, 11, 0.06);
    border: 1px solid rgba(179, 11, 11, 0.15);
    color: var(--text-main);
    border-radius: var(--radius-s);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.25s;
    font-weight: 600;
}

.btn-action:hover {
    background: rgba(179, 11, 11, 0.15);
    border-color: var(--brand-red);
    transform: translateX(3px);
}

.btn-danger-action:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: var(--color-danger) !important;
    color: var(--color-danger) !important;
}

/* ========== Search / Command Bar ========== */
.search-section {
    padding: 1.2rem;
}

.search-container {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    font-size: 1.1rem;
}

.search-input-wrapper input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    padding: 14px 20px 14px 45px;
    color: white;
    border-radius: var(--radius-s);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s;
    font-family: 'Inter', sans-serif;
}

.search-input-wrapper input:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 20px rgba(179, 11, 11, 0.15);
}

.mission-select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 14px 12px;
    border-radius: var(--radius-s);
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    outline: none;
}

.mission-select option {
    background: var(--brand-dark);
    color: var(--text-main);
}

.btn {
    padding: 12px 24px;
    border-radius: var(--radius-s);
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-size: 0.8rem;
    letter-spacing: 1px;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-red), #8B0000);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-red-light), var(--brand-red));
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
}

.btn-secondary:hover {
    border-color: var(--brand-red);
    color: var(--brand-red);
}

/* ========== Tab System ========== */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

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

/* ========== KPI Cards ========== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.2rem;
}

.kpi-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--brand-red), transparent);
}

.kpi-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.kpi-info {
    flex: 1;
}

.kpi-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: var(--brand-white);
    line-height: 1;
}

.kpi-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.kpi-trend {
    font-size: 1.2rem;
    font-weight: 800;
}

.kpi-trend.up { color: var(--color-success); }
.kpi-trend.down { color: var(--color-danger); }
.kpi-trend.neutral { color: var(--text-muted); }

/* ========== Workflow Canvas ========== */
.workflow-canvas {
    padding: 1.5rem;
    overflow: hidden;
    min-height: 680px;
    display: flex;
    flex-direction: column;
}

#workflow-graph {
    width: 100%;
    height: 680px;
    border-radius: var(--radius-m);
    flex-shrink: 0;
}

/* ========== Section Headers ========== */
.section-header {
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.1rem;
    color: var(--brand-white);
    text-transform: uppercase;
}

.section-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
    display: block;
}

/* ========== Agent Grid ========== */
.agent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
}

.agent-card {
    padding: 1.8rem;
    position: relative;
    overflow: hidden;
    border-left: 4px solid transparent;
    cursor: pointer;
}

.agent-card:hover {
    border-left-color: var(--brand-red);
    background: rgba(179, 11, 11, 0.04);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
}

.agent-card.sandboxed {
    border-left-color: var(--color-warning);
}

.agent-card.sandboxed::after {
    content: '🐳';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.8rem;
}

.agent-label {
    font-size: 0.6rem;
    color: var(--brand-red);
    font-weight: 800;
    margin-bottom: 8px;
    display: block;
    letter-spacing: 2px;
    font-family: 'JetBrains Mono', monospace;
}

.agent-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-right: 80px; /* Espace pour l'avatar en haut à droite */
}

.agent-name {
    font-size: 1.25rem;
    margin: 0;
    color: var(--brand-white);
}

.agent-role {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Modale Fiche Agent */
.fiche-modal-card {
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 0;
    border: 1px solid rgba(179, 11, 11, 0.2);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.fiche-modal-card .modal-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-bottom: 1px solid rgba(179, 11, 11, 0.1);
}

.fiche-modal-card .modal-body {
    padding: 1.5rem;
}

.fiche-modal-card .fiche-card {
    margin: 0;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0;
}

.agent-icon {
    font-size: 1.6rem;
    opacity: 0.7;
}

/* --- Avatars --- */
.agent-avatar-wrapper {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    z-index: 2;
}

.agent-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid rgba(179, 11, 11, 0.4);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(179, 11, 11, 0.2);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.agent-card:hover .agent-avatar-img {
    border-color: var(--brand-red-light);
    box-shadow: 0 0 30px rgba(179, 11, 11, 0.6);
    transform: scale(1.1) rotate(3deg);
}

.agent-avatar-icon {
    display: none;
}

.agent-info {
    flex: 1;
}

.agent-desc {
    color: var(--brand-gray);
    font-size: 0.8rem;
    margin-bottom: 16px;
    min-height: 42px;
    line-height: 1.5;
}

/* ========== Agent Model Selector ========== */
.agent-model-section {
    margin-bottom: 14px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-s);
    transition: border-color 0.3s;
}

.agent-model-section:hover {
    border-color: rgba(179, 11, 11, 0.25);
}

.model-current {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.model-provider-icon {
    font-size: 0.9rem;
    line-height: 1;
}

.model-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--brand-red-light);
    font-weight: 700;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.model-selector-wrapper {
    position: relative;
}

.model-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(179, 11, 11, 0.2);
    color: var(--text-muted);
    padding: 6px 28px 6px 10px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    outline: none;
    transition: all 0.25s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23B30B0B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.model-select:hover {
    border-color: var(--brand-red);
    color: var(--text-main);
}

.model-select:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 12px rgba(179, 11, 11, 0.15);
    color: var(--text-main);
}

.model-select option {
    background: #0a0a0f;
    color: var(--text-main);
    padding: 8px;
}

.model-select optgroup {
    background: #151520;
    color: var(--brand-red);
    font-weight: 700;
    font-style: normal;
    padding: 5px;
    text-transform: uppercase;
    padding-top: 6px;
}

/* Fournisseur Selector Premium */
.provider-select {
    background: rgba(179, 11, 11, 0.1);
    border: 1px solid rgba(179, 11, 11, 0.3);
    color: var(--brand-red-light);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    outline: none;
    transition: all 0.3s;
    font-family: 'JetBrains Mono', monospace;
}

.provider-select:hover {
    background: rgba(179, 11, 11, 0.2);
    border-color: var(--brand-red);
    box-shadow: 0 0 15px var(--brand-red-glow);
}

/* Animations pour changement de provider */
@keyframes providerSwitch {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.05); filter: brightness(1.5); }
    100% { transform: scale(1); filter: brightness(1); }
}

.provider-changed {
    animation: providerSwitch 0.5s ease-out;
}

/* Style spécifique pour la fiche agent */
.fiche-model-config {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-m);
    border: 1px solid var(--border-glass);
}

.fiche-config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.fiche-config-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.fiche-config-selects {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    max-width: 300px;
}

.agent-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-glass);
    padding-top: 12px;
}

.agent-status-mini {
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'JetBrains Mono', monospace;
}

.agent-badges {
    display: flex;
    gap: 6px;
}

.agent-badge {
    font-size: 0.55rem;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agent-badge.tasks { background: rgba(59, 130, 246, 0.15); color: var(--color-info); }
.agent-badge.msgs { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }

.btn-small {
    padding: 5px 10px;
    font-size: 0.65rem;
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    border-radius: var(--radius-s);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.btn-fiche { border-color: rgba(34,197,94,.35) !important; color: var(--color-success) !important; }
.btn-fiche:hover { background: rgba(34,197,94,.15) !important; border-color: var(--color-success) !important; }

.btn-small:hover {
    background: var(--brand-red);
    border-color: var(--brand-red);
    color: white;
}

/* ========== Workflow Table ========== */
.workflow-table {
    padding: 1.5rem;
    overflow-x: auto;
}

.workflow-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.workflow-table th {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 2px solid var(--brand-red);
    color: var(--brand-red);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.workflow-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-main);
}

.workflow-table tr:hover td {
    background: rgba(179, 11, 11, 0.04);
}

.action-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    background: rgba(179, 11, 11, 0.08);
    padding: 3px 8px;
    border-radius: 3px;
    color: var(--brand-red-light);
}

.status-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
}

.status-pill.active { background: rgba(34, 197, 94, 0.15); color: var(--color-success); }
.status-pill.pending { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }

/* ========== Tasks ========== */
.tasks-filters {
    padding: 1rem;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.filter-btn:hover, .filter-btn.active {
    background: rgba(179, 11, 11, 0.12);
    border-color: var(--brand-red);
    color: var(--brand-red);
}

/* ── Tasks layout (task list + activity panel) ── */
.tasks-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .tasks-layout {
        grid-template-columns: 1fr;
    }
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* ── Activity Panel ── */
.activity-panel {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow: hidden;
    border-radius: var(--radius-l);
    max-height: 80vh;
}

.activity-panel-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.2rem 0.8rem;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(255,255,255,0.02);
}

.activity-panel-title {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-main);
    margin: 0;
    flex: 1;
}

.activity-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 6px var(--color-success);
    animation: blink-dot 1.5s ease-in-out infinite;
}

@keyframes blink-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

.activity-feed {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: calc(80vh - 48px);
}

.activity-feed::-webkit-scrollbar { width: 4px; }
.activity-feed::-webkit-scrollbar-thumb { background: var(--border-glass-hover); border-radius: 2px; }

.activity-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.activity-item:hover { background: rgba(255,255,255,0.03); }
.activity-item.running { border-left-color: var(--color-warning); }
.activity-item.done    { border-left-color: rgba(34,197,94,0.4); }
.activity-item.error   { border-left-color: var(--color-danger); }

.activity-item-left {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.activity-agent-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.activity-item-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.activity-item-top {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.activity-agent-name {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--brand-red);
    white-space: nowrap;
}

.activity-tool-name {
    font-size: 0.72rem;
    color: var(--text-main);
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.activity-detail {
    font-size: 0.68rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
    display: block;
}

.activity-item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    flex-shrink: 0;
}

.activity-status {
    font-size: 0.75rem;
}

.activity-status.running { animation: spin 1s linear infinite; display: inline-block; }

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.activity-time {
    font-size: 0.62rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

.activity-duration {
    font-size: 0.6rem;
    color: var(--text-dim);
    font-family: monospace;
}

.activity-source-badge {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.activity-source-badge.mcp {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.activity-item.mcp {
    background: rgba(168, 85, 247, 0.03);
}

.activity-item.mcp.running { border-left-color: #a855f7; }
.activity-item.mcp.done    { border-left-color: rgba(168, 85, 247, 0.4); }
.activity-item.mcp.error   { border-left-color: var(--color-danger); }

.task-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-left: 4px solid transparent;
}

.task-item.pending { border-left-color: var(--color-warning); }
.task-item.in_progress { border-left-color: var(--color-info); }
.task-item.completed { border-left-color: var(--color-success); }
.task-item.blocked { border-left-color: var(--color-danger); }
.task-item.failed { border-left-color: var(--color-danger); }

.msg.agent  { border-left-color: var(--brand-red); background: rgba(179, 11, 11, 0.05); }
.msg.system { border-left-color: var(--text-dim); font-style: italic; }
.msg.error  { border-left-color: var(--color-danger); background: rgba(239, 68, 68, 0.05); color: #fecaca; }
.msg.success { border-left-color: var(--color-success); background: rgba(34, 197, 94, 0.05); color: #bbf7d0; }

/* Style Premium - Promptor v7.1 */
.msg.premium {
    border-left: 4px solid #D4AF37;
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.1), transparent);
    color: #fef08a;
    font-weight: 600;
    box-shadow: inset 5px 0 15px rgba(212, 175, 55, 0.1);
    animation: premiumGlow 3s infinite alternate;
}

@keyframes premiumGlow {
    from { border-left-color: #D4AF37; box-shadow: inset 5px 0 10px rgba(212, 175, 55, 0.05); }
    to { border-left-color: #FBBF24; box-shadow: inset 8px 0 20px rgba(212, 175, 55, 0.2); }
}

.task-info {
    flex: 1;
}

.task-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
}

.task-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    gap: 10px;
}

.task-agent {
    font-weight: 700;
    color: var(--brand-red);
}

.task-status-badge {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ========== Mailbox ========== */
.mailbox-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 1rem;
}

.mailbox-agents {
    padding: 1rem;
}

.mailbox-agent-item {
    padding: 10px 12px;
    cursor: pointer;
    border-radius: var(--radius-s);
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.mailbox-agent-item:hover, .mailbox-agent-item.active {
    background: rgba(179, 11, 11, 0.1);
    color: var(--brand-red);
}

.mailbox-messages {
    padding: 1.5rem;
    min-height: 400px;
}

.message-item {
    padding: 1rem 1.5rem;
    border-left: 3px solid var(--border-glass);
    margin-bottom: 1rem;
    border-radius: 0 var(--radius-s) var(--radius-s) 0;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s;
}

.message-item:hover {
    border-left-color: var(--brand-red);
    background: rgba(179, 11, 11, 0.04);
}

.message-item.urgent {
    border-left-color: var(--color-danger);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.message-from {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--brand-red);
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
}

.message-subject {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.message-body {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ========== Salles - Grille & Cartes ========== */
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.room-card {
    padding: 1.8rem;
    display: flex;
    gap: 1.2rem;
    align-items: flex-start;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-glass);
}

.room-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(179, 11, 11, 0.08), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s;
}

.room-card:hover {
    transform: translateY(-4px);
    border-color: var(--brand-red);
    box-shadow: 0 8px 40px rgba(179, 11, 11, 0.2), inset 0 1px 0 rgba(255,255,255,0.05);
}

.room-card:hover::before {
    opacity: 1;
}

.room-icon {
    font-size: 2.4rem;
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px rgba(179, 11, 11, 0.3));
    transition: transform 0.3s;
}

.room-card:hover .room-icon {
    transform: scale(1.15) rotate(-5deg);
}

.room-info {
    flex: 1;
    min-width: 0;
}

.room-info h3 {
    font-size: 1rem;
    color: var(--brand-white);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.room-info p {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 10px;
}

.room-agents {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.mini-agent-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: 50%;
    transition: all 0.25s;
}

.room-card:hover .mini-agent-icon {
    border-color: rgba(179, 11, 11, 0.3);
    background: rgba(179, 11, 11, 0.08);
}

/* Room Chat Container */
.room-chat-wrapper {
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    min-height: 500px;
}

.room-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.3);
}

.room-chat-header h3 {
    font-size: 1rem;
    color: var(--brand-white);
    display: flex;
    align-items: center;
    gap: 8px;
}

.room-messages-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.15);
    min-height: 400px;
}

.room-messages-body::-webkit-scrollbar {
    width: 5px;
}

.room-messages-body::-webkit-scrollbar-thumb {
    background: rgba(179, 11, 11, 0.3);
    border-radius: 3px;
}

@media (max-width: 1024px) {
    .rooms-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .rooms-grid { grid-template-columns: 1fr; }
    .room-card { padding: 1.2rem; }
}

/* ========== Salles - Bulles de Chat Premium ========== */
#room-messages {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-m);
    scroll-behavior: smooth;
    max-height: 600px;
    overflow-y: auto;
}

.room-message-bubble {
    display: flex;
    gap: 1rem;
    max-width: 85%;
    animation: bubbleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
}

/* Alignement alterné ou spécifique */
.room-message-bubble.ceo-msg { align-self: flex-start; }
.room-message-bubble.coach-msg { align-self: flex-end; flex-direction: row-reverse; }
.room-message-bubble.agent-msg { align-self: flex-start; }

.bubble-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 2px solid var(--brand-red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(179, 11, 11, 0.2);
}

.ceo-msg .bubble-avatar { border-color: var(--brand-red); }
.coach-msg .bubble-avatar { border-color: #D4AF37; }

.bubble-content {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 1.2rem;
    border-radius: 18px;
    position: relative;
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-card);
}

.ceo-msg .bubble-content {
    border-top-left-radius: 2px;
    background: linear-gradient(135deg, rgba(179, 11, 11, 0.1), rgba(255, 255, 255, 0.05));
    border-left: 2px solid var(--brand-red);
}

.coach-msg .bubble-content {
    border-top-right-radius: 2px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(255, 255, 255, 0.05));
    border-right: 2px solid #D4AF37;
    text-align: right;
}

.bubble-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.7rem;
    gap: 15px;
}

.bubble-sender {
    font-weight: 800;
    color: var(--brand-red-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.coach-msg .bubble-sender { color: #fef08a; }

.bubble-time {
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
}

.bubble-subject {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.bubble-text {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-main);
}

@keyframes bubbleIn {
    from { opacity: 0; transform: translateY(15px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ========== Security ========== */
.security-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
}

.security-card {
    padding: 1.5rem;
}

.security-card h3 {
    font-size: 0.85rem;
    margin-bottom: 1rem;
    color: var(--brand-white);
}

.txt-muted {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.sandbox-item, .protocol-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.8rem;
}

.sandbox-status {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
}

.sandbox-status.sandboxed {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
}

.sandbox-status.approval {
    background: rgba(59, 130, 246, 0.15);
    color: var(--color-info);
}

.protocol-active {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-success);
    padding: 2px 8px;
    border-radius: 3px;
    background: rgba(34, 197, 94, 0.12);
}

.circuit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.8rem;
}

.circuit-status {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
}

.circuit-status.closed {
    background: rgba(34, 197, 94, 0.12);
    color: var(--color-success);
}

.circuit-status.open {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========== Terminal ========== */
.terminal-card {
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.terminal-header {
    background: rgba(15, 15, 20, 0.95);
    padding: 10px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 16px;
    border-radius: var(--radius-l) var(--radius-l) 0 0;
}

.terminal-dots {
    display: flex;
    gap: 7px;
}

.terminal-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.terminal-dots span:nth-child(1) { background: #ff5f56; }
.terminal-dots span:nth-child(2) { background: #ffbd2e; }
.terminal-dots span:nth-child(3) { background: #27c93f; }

.terminal-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-dim);
    flex: 1;
}

.terminal-clear {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.terminal-clear:hover { opacity: 1; }

.terminal-body {
    height: 380px;
    overflow-y: auto;
    padding: 16px 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    background: rgba(2, 2, 5, 0.95);
    line-height: 1.7;
}

.terminal-body::-webkit-scrollbar {
    width: 4px;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: rgba(179, 11, 11, 0.3);
    border-radius: 2px;
}

.msg {
    margin-bottom: 6px;
    animation: slideIn 0.3s ease-out;
}

.msg.system { color: var(--text-dim); }
.msg.input { color: var(--text-muted); }
.msg.agent { color: var(--brand-red-light); }
.msg.success { color: var(--color-success); }
.msg.error { color: var(--color-danger); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.terminal-footer {
    padding: 12px 18px;
    background: rgba(8, 8, 12, 0.95);
    display: flex;
    gap: 10px;
    align-items: center;
    border-radius: 0 0 var(--radius-l) var(--radius-l);
}

.terminal-prompt {
    color: var(--brand-red);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

.terminal-footer input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    outline: none;
}

.terminal-footer button {
    background: rgba(179, 11, 11, 0.2);
    color: var(--brand-red);
    border: 1px solid rgba(179, 11, 11, 0.3);
    padding: 5px 14px;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: var(--radius-s);
    transition: all 0.2s;
    letter-spacing: 1px;
}

.terminal-footer button:hover {
    background: var(--brand-red);
    color: white;
}

/* ========== Modal ========== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 9000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.3s;
}

.modal-card {
    width: 90%;
    max-width: 600px;
    padding: 0;
    overflow: hidden;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1rem;
    color: var(--brand-white);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover { color: var(--brand-red); }

/* Qualification modal chips */
.qual-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}
.qual-chip:hover {
    border-color: var(--brand-red);
    color: var(--text-main);
}
.qual-chip:has(input:checked) {
    border-color: var(--brand-red);
    background: rgba(255, 59, 48, 0.15);
    color: var(--brand-white);
}
.qual-chip input[type="checkbox"] {
    display: none;
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    font-weight: 600;
}

.form-group textarea,
.form-group select {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 12px;
    border-radius: var(--radius-s);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.3s;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--brand-red);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
}

/* ========== Footer ========== */
.main-footer {
    border-top: 1px solid var(--border-glass);
    padding: 30px 0;
    margin-top: 40px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 6px var(--color-success);
}

.separator {
    color: var(--text-dim);
    opacity: 0.3;
}

/* ========== Loading ========== */
.mt-large { margin-top: 2rem; }

#loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--brand-black);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s ease;
}

.loader-content {
    text-align: center;
}

.spinner-ring {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(179, 11, 11, 0.1);
    border-top-color: var(--brand-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

.loader-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    33% { content: '.'; }
    66% { content: '..'; }
    100% { content: '...'; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.online-pulse {
    animation: statusPulse 3s infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* ========== Toast Notifications ========== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    border-radius: var(--radius-s);
    font-weight: 600;
    font-size: 0.8rem;
    z-index: 10000;
    animation: toastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-card);
    max-width: 400px;
}

.toast.success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(22, 163, 74, 0.9));
    color: white;
}

.toast.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9), rgba(185, 28, 28, 0.9));
    color: white;
}

.toast.info {
    background: linear-gradient(135deg, rgba(179, 11, 11, 0.9), rgba(139, 0, 0, 0.9));
    color: white;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ========== Responsive ========== */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .security-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .page-layout {
        grid-template-columns: 1fr;
    }
    .side-panel {
        display: none;
    }
    .header-stats {
        display: none;
    }
    .mailbox-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
    }
    .search-container {
        flex-wrap: wrap;
    }
    .mission-select {
        width: 100%;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ========== FICHES TAB ========== */
.fiches-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:1.4rem; }
.fiche-card { padding:1.6rem; position:relative; border-left:4px solid transparent; overflow:hidden;
  transition:border-left-color .3s ease,transform .3s ease,box-shadow .3s ease; }
.fiche-card:hover { border-left-color:var(--brand-red); transform:translateY(-3px); box-shadow:var(--shadow-card); }
.fiche-header { display:flex; align-items:flex-start; gap:1rem; margin-bottom:1rem; }
.fiche-avatar-wrap { position:relative; flex-shrink:0; }
.fiche-avatar { 
    display:flex; align-items:center; justify-content:center; width:80px; height:80px;
    font-size:2rem; background:rgba(0,0,0,.3); border:2px solid rgba(179,11,11,.6); border-radius:50%; 
    overflow:hidden; position:relative; 
    box-shadow: 0 0 20px rgba(179, 11, 11, 0.3), inset 0 0 10px rgba(0,0,0,0.5);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Lueur pulsée pour les agents */
.fiche-avatar {
    border-color: var(--brand-red-light);
    box-shadow: 0 0 25px rgba(179, 11, 11, 0.5);
    animation: avatarGlow 4s infinite alternate;
}

@keyframes avatarGlow {
    from { box-shadow: 0 0 15px rgba(179, 11, 11, 0.4); }
    to { box-shadow: 0 0 35px rgba(179, 11, 11, 0.7); }
}

.fiche-avatar-img { 
    position:absolute; inset:0; width:100%; height:100%; object-fit:cover; z-index:2; 
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    filter: brightness(1.05) contrast(1.1);
}
.fiche-avatar:hover .fiche-avatar-img { transform: scale(1.15); }

.fiche-avatar-fallback {
    display: none;
}

.fiche-status-dot { position:absolute; bottom:6px; right:6px; width:16px; height:16px; z-index:4;
  border-radius:50%; border:3px solid var(--brand-dark); }
.fiche-status-dot.online  { background:var(--color-success); box-shadow:0 0 8px var(--color-success); }
.fiche-status-dot.busy    { background:var(--color-warning); box-shadow:0 0 8px var(--color-warning); }
.fiche-status-dot.offline { background:var(--text-dim); }
.fiche-identity { flex:1; min-width:0; }
.fiche-name-row { display:flex; align-items:center; gap:8px; margin-bottom:2px; }
.fiche-name { font-size:1.1rem; font-weight:800; color:var(--brand-white); margin:0; letter-spacing:.5px; }
.fiche-role { display:block; font-size:.62rem; color:var(--text-muted); text-transform:uppercase;
  letter-spacing:1.5px; margin-bottom:4px; font-family:'JetBrains Mono',monospace; }
.fiche-xp-label { font-family:'JetBrains Mono',monospace; font-size:.7rem;
  color:var(--color-success); font-weight:700; }
.fiche-rank-badge { font-size:.55rem; font-weight:800; padding:2px 8px; border-radius:4px;
  text-transform:uppercase; letter-spacing:1px; white-space:nowrap; }
.rank-recrue { background:rgba(100,100,100,.2); color:#888; }
.rank-junior { background:rgba(59,130,246,.15); color:var(--color-info); }
.rank-senior { background:rgba(245,158,11,.15); color:var(--color-warning); }
.rank-expert { background:rgba(179,11,11,.15); color:var(--brand-red-light); }
.rank-master { background:rgba(212,175,55,.15); color:#D4AF37; border:1px solid rgba(212,175,55,.3); }
.fiche-xp-track { width:100%; height:5px; background:rgba(255,255,255,.06);
  border-radius:3px; overflow:hidden; margin-bottom:4px; }
.fiche-xp-bar { height:100%; border-radius:3px;
  background:linear-gradient(90deg,#16a34a,#22c55e,#4ade80);
  transition:width 1s cubic-bezier(.4,0,.2,1); box-shadow:0 0 10px rgba(34,197,94,.4); }
.fiche-xp-meta { display:flex; justify-content:space-between; font-size:.58rem;
  color:var(--text-dim); font-family:'JetBrains Mono',monospace; margin-bottom:1rem; }
.fiche-stats { display:grid; grid-template-columns:repeat(3,1fr); border:1px solid var(--border-glass);
  border-radius:var(--radius-s); margin-bottom:1.1rem; overflow:hidden; }
.fiche-stat-item { text-align:center; padding:8px 4px; border-right:1px solid var(--border-glass); }
.fiche-stat-item:last-child { border-right:none; }
.fiche-stat-value { display:block; font-size:1.1rem; font-weight:800;
  font-family:'JetBrains Mono',monospace; color:var(--brand-white); line-height:1.1; }
.fiche-stat-label { font-size:.55rem; color:var(--text-muted); text-transform:uppercase; letter-spacing:1px; }
.fiche-section-label { font-size:.6rem; color:var(--brand-red); text-transform:uppercase;
  letter-spacing:2px; font-weight:700; border-left:2px solid var(--brand-red);
  padding-left:7px; margin-bottom:8px; margin-top:.8rem; }
.fiche-competencies { display:flex; flex-direction:column; gap:6px; margin-bottom:.4rem; }
.fiche-comp-row { display:flex; align-items:center; gap:8px; }
.fiche-comp-name { font-size:.62rem; color:var(--text-muted); width:130px; flex-shrink:0;
  text-transform:uppercase; letter-spacing:.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.fiche-comp-track { flex:1; height:4px; background:rgba(255,255,255,.05); border-radius:2px; overflow:hidden; }
.fiche-comp-bar { height:100%; border-radius:2px; background:linear-gradient(90deg,#15803d,#22c55e);
  transition:width 1.2s cubic-bezier(.4,0,.2,1); }
.fiche-comp-score { font-size:.6rem; font-family:'JetBrains Mono',monospace;
  color:var(--color-success); font-weight:700; width:24px; text-align:right; flex-shrink:0; }
.fiche-achievements { display:flex; flex-wrap:wrap; gap:6px; margin-top:4px; }
.fiche-achievement { display:flex; align-items:center; gap:4px; padding:3px 8px;
  border-radius:12px; font-size:.6rem; font-weight:600; border:1px solid; transition:all .2s; }
.fiche-achievement.unlocked { background:rgba(34,197,94,.1); border-color:rgba(34,197,94,.3);
  color:var(--color-success); }
.fiche-achievement.locked { background:rgba(255,255,255,.02); border-color:var(--border-glass);
  color:var(--text-dim); opacity:.45; filter:grayscale(1); }
.fiche-ach-label { max-width:80px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.fiche-entry-animation {
    animation: ficheSlideUp 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes ficheSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
/* ========== Task Validation Styles ========== */
.task-item.awaiting_validation {
    border-left: 4px solid #a855f7;
    background: rgba(168, 85, 247, 0.05);
}

.task-item.awaiting_validation .task-status-badge {
    animation: pulseValidation 2s infinite;
}

@keyframes pulseValidation {
    0% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(168, 85, 247, 0); }
    100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
}

.task-item.rejected {
    border-left: 4px solid #ec4899;
    background: rgba(236, 72, 153, 0.05);
}

.task-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.task-buttons {
    display: flex;
    gap: 8px;
}

.btn-success {
    background: #15803d;
    color: white;
}

.btn-success:hover {
    background: #16a34a;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.3);
}

.btn-danger {
    background: #9f1239;
    color: white;
}

.btn-danger:hover {
    background: #be123c;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

/* ========== Costs Analytics ========== */
.costs-section {
    padding: 1.5rem;
}

.costs-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.costs-card {
    padding: 1.5rem;
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.costs-card h3 {
    font-size: 0.9rem;
    color: var(--brand-red);
    text-transform: uppercase;
    margin-bottom: 1.2rem;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 0.5rem;
}

.costs-list-container {
    flex: 1;
    overflow-y: auto;
}

.cost-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 0.85rem;
}

.cost-row:last-child {
    border-bottom: none;
}

.cost-date {
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.cost-provider {
    font-weight: 600;
}

.cost-amount {
    color: var(--brand-red-light);
    font-weight: 700;
}

.provider-badge {
    background: rgba(179, 11, 11, 0.1);
    color: var(--brand-red-light);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid rgba(179, 11, 11, 0.2);
}

.costs-provider-breakdown {
    padding: 1.5rem;
}

.provider-analysis-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    align-items: center;
    margin-top: 1.5rem;
}

.chart-wrapper {
    position: relative;
    height: 300px;
    width: 300px;
}

.provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2rem;
    margin-top: 1.2rem;
}

.provider-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-glass);
    padding: 1rem;
    border-radius: var(--radius-m);
    text-align: center;
}

.provider-name {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.provider-cost {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--brand-white);
    font-family: 'JetBrains Mono', monospace;
}

/* ======================================
   Approval System Styles
   ====================================== */

/* Nav badge for approvals */
#nav-approvals-count {
    background: #f59e0b;
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    margin-left: 0.4rem;
}

/* Task item amber border for human approval */
.task-item.awaiting_human_approval {
    border-left: 3px solid #f59e0b;
}

/* Approval cards */
.approval-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s, transform 0.2s;
}
.approval-item:hover {
    border-color: rgba(245,158,11,0.4);
    transform: translateY(-2px);
}
.approval-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.approval-agent-icon, .fiche-avatar-wrap {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    position: relative;
}
.fiche-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--brand-red);
    box-shadow: 0 0 15px var(--brand-red-glow);
}
.approval-agent-icon {
    font-size: 1.8rem;
}
.approval-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand-white);
    margin: 0;
}
.approval-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}
.approval-brief-preview {
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid #f59e0b;
    background: rgba(245,158,11,0.05);
    border-radius: 4px;
}
.approval-content-preview {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: #ccc;
    white-space: pre-wrap;
    margin-bottom: 1rem;
}
.approval-content-preview::-webkit-scrollbar { width: 5px; }
.approval-content-preview::-webkit-scrollbar-track { background: transparent; }
.approval-content-preview::-webkit-scrollbar-thumb { background: #B30B0B; border-radius: 4px; }
.approval-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.btn-approve {
    background: rgba(34,197,94,0.15);
    border: 1px solid rgba(34,197,94,0.4);
    color: #22c55e;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.2s, box-shadow 0.2s;
}
.btn-approve:hover {
    background: rgba(34,197,94,0.3);
    box-shadow: 0 0 12px rgba(34,197,94,0.4);
}
.btn-reject-approval {
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.4);
    color: #ef4444;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.2s, box-shadow 0.2s;
}
.btn-reject-approval:hover {
    background: rgba(239,68,68,0.3);
    box-shadow: 0 0 12px rgba(239,68,68,0.4);
}

/* Approval config panel */
.approval-config-panel {
    margin-top: 2rem;
    padding: 1.25rem;
    border-radius: 12px;
}
.approval-config-panel h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--brand-white);
}
.global-toggle-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.global-toggle-row span {
    font-size: 0.9rem;
    color: var(--brand-white);
    font-weight: 600;
}
.agents-toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}
.agent-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.06);
}
.agent-toggle-name {
    font-size: 0.85rem;
    color: #ccc;
}

/* Toggle switch */
.toggle-label {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    cursor: pointer;
}
.toggle-label input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.15);
    border-radius: 22px;
    transition: 0.3s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
.toggle-label input:checked + .toggle-slider {
    background: #22c55e;
}
.toggle-label input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* Reject modal */
.reject-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.reject-modal-overlay.active {
    display: flex;
}
.reject-modal-box {
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 1.75rem;
    width: 480px;
    max-width: 95vw;
}
.reject-modal-box h3 {
    margin-bottom: 1rem;
    color: var(--brand-white);
}
.reject-modal-box textarea {
    width: 100%;
    min-height: 100px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--brand-white);
    padding: 0.75rem;
    font-family: inherit;
    font-size: 0.85rem;
    resize: vertical;
    box-sizing: border-box;
}
.reject-modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1rem;
}
.approvals-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.approvals-empty .empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.75rem;
}

/* ========================================
   Livrables Tab
   ======================================== */
.livrables-layout { display: flex; gap: 1.5rem; height: 70vh; }
.livrables-sidebar { width: 320px; flex-shrink: 0; overflow-y: auto; }
.livrables-viewer { flex: 1; overflow-y: auto; background: var(--glass-bg); border-radius: 12px; padding: 1.5rem; }
.mission-block { margin-bottom: 0.75rem; border-radius: 10px; overflow: hidden; }
.mission-block-header { padding: 0.75rem 1rem; cursor: pointer; background: var(--glass-bg); display: flex; justify-content: space-between; align-items: center; border-radius: 10px; }
.mission-block-header:hover { background: rgba(255,255,255,0.08); }
.mission-block-files { display: none; padding: 0.5rem; }
.mission-block.open .mission-block-files { display: block; }
.mission-block.open .mission-block-header { border-radius: 10px 10px 0 0; }
.file-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.75rem; border-radius: 8px; cursor: pointer; font-size: 0.85rem; transition: background 0.15s; }
.file-item:hover { background: rgba(255,255,255,0.08); }
.file-item.active { background: rgba(99,102,241,0.25); border-left: 3px solid rgb(99,102,241); }
.file-item-icon { flex-shrink: 0; }
.file-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item-meta { flex-shrink: 0; font-size: 0.7rem; color: var(--text-muted, #9ca3af); white-space: nowrap; }
.livrables-viewer-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 1rem; }
.livrables-viewer-meta { font-size: 0.8rem; color: var(--text-muted, #9ca3af); margin-top: 0.25rem; }
.livrables-content { white-space: pre-wrap; font-family: monospace; font-size: 0.85rem; line-height: 1.6; }
.livrables-content h1, .livrables-content h2, .livrables-content h3 { font-family: sans-serif; margin: 1rem 0 0.5rem; }
.livrables-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; opacity: 0.4; font-size: 1rem; gap: 0.75rem; }
.livrables-placeholder span { font-size: 3rem; }
.livrables-empty { padding: 1rem; opacity: 0.5; }
.mission-badge { font-size: 0.7rem; padding: 0.15rem 0.4rem; border-radius: 4px; background: rgba(99,102,241,0.3); }
.mission-file-count { font-size: 0.75rem; color: var(--text-muted, #9ca3af); display: flex; align-items: center; gap: 0.4rem; }
.mission-chevron { display: inline-block; transition: transform 0.2s; font-size: 0.8rem; }
.mission-block:not(.open) .mission-chevron { transform: rotate(-90deg); }
.mission-block-files { background: rgba(0,0,0,0.15); border-radius: 0 0 10px 10px; }

/* ========== NLM WIZARD ========== */
.wizard-step kbd {
    background: #333;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 2px 0 #000;
}

#nlm-bookmarklet-code {
    display: block;
    word-break: break-all;
    white-space: pre-wrap;
    line-height: 1.4;
    user-select: all;
    background: rgba(0, 255, 0, 0.05);
    padding: 10px;
    border-radius: 4px;
    border: 1px dashed rgba(0, 255, 0, 0.3);
}

#nlm-wizard-modal .modal-card {
    border: 1px solid var(--brand-red-glow);
    box-shadow: 0 0 40px var(--brand-red-glow);
}

/* ========== Log Formatting Boxes ========== */
.log-system-box {
    background: rgba(43, 88, 118, 0.15);
    border-left: 3px solid #3b82f6;
    padding: 10px 14px;
    margin: 8px 0;
    border-radius: 0 4px 4px 0;
    color: #e2e8f0;
    font-size: 0.82rem;
}

.log-alert-box {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
    padding: 10px 14px;
    margin: 8px 0;
    border-radius: 0 4px 4px 0;
    color: #fca5a5;
    font-size: 0.82rem;
    font-weight: 500;
}

.log-agent-box {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.15);
    padding: 12px 16px;
    margin: 10px 0;
    border-radius: 6px;
    color: #d1d5db;
    font-size: 0.85rem;
    border-left: 3px solid #10b981;
}

.log-regular-text {
    margin: 6px 0;
}
