/* ===================================================
   CONFORMIA — ADMIN STYLESHEET
   Design language adapted from shootngo
=================================================== */
:root {
    --primary: #7001fe;
    --primary-dark: #5a01cb;
    --primary-light: #9e52ff;
    --navy: #1d0648;
    --navy-light: #2d1065;
    --bg: #f7f8fa;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --gold: #daae51;
    --gold-light: #f5e6c8;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ======================= */
/* SCROLLBAR               */
/* ======================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ======================= */
/* NAVIGATION              */
/* ======================= */
.nav {
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    background: rgba(13, 4, 38, 0.92);
}

.nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 84px;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: #fff;
    cursor: pointer;
}

.logo-img {
    height: 34px;
    width: auto;
    display: block;
}

.logo-divider {
    width: 1px;
    height: 30px;
    background: rgba(255,255,255,0.18);
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.logo-text-accent { color: var(--primary-light); }

.logo-tagline {
    white-space: nowrap;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.4px;
    color: rgba(255,255,255,0.6);
    margin-top: 2px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255,255,255,0.72);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
}

.nav-link i { width: 16px; height: 16px; }

.nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.nav-link.active {
    color: #fff;
    background: rgba(112,1,254,0.45);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--gold), #c09a38);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.admin-badge i { width: 12px; height: 12px; }

.nav-user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
}

.btn-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    white-space: nowrap;
}

.btn-nav i { width: 16px; height: 16px; }

.btn-nav-ghost {
    background: transparent;
    color: rgba(255,255,255,0.72);
}

.btn-nav-ghost:hover {
    color: #fff;
    background: rgba(239,68,68,0.45);
}

/* ======================= */
/* PAGE LAYOUT             */
/* ======================= */
.app-shell {
    flex: 1;
    display: flex;
    align-items: stretch;
    min-height: 0;
}

#app {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.page {
    flex: 1;
    animation: fadeIn 0.3s ease;
    padding: 2rem;
    background: linear-gradient(180deg, #eef1f7 0%, var(--bg) 300px);
    min-height: calc(100vh - 84px);
}

/* ======================= */
/* SIDEBAR ADMIN           */
/* ======================= */
.dash-sidebar {
    width: 240px;
    background: linear-gradient(180deg, #1d0648 0%, #0d0426 100%);
    padding: 2rem 0;
    flex-shrink: 0;
    position: sticky;
    top: 84px;
    height: calc(100vh - 84px);
    overflow-y: auto;
}

.dash-sidebar-section {
    padding: 0 1rem;
    margin-bottom: 1.5rem;
}

.dash-sidebar-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.45);
    padding: 0 1rem;
    margin-bottom: 0.75rem;
}

.dash-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    margin: 0 0.5rem 0.15rem;
    transition: all 0.2s;
    border: none;
    background: none;
    width: calc(100% - 1rem);
    text-align: left;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.dash-sidebar-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.dash-sidebar-link.active {
    background: rgba(255,255,255,0.15);
    color: white;
    font-weight: 600;
    border-left: 3px solid var(--primary-light);
}

.dash-sidebar-link i {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}

.dash-sidebar-link.active i {
    opacity: 1;
}

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

.page-inner {
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--navy);
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i { width: 20px; height: 20px; color: var(--primary); }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 1.25rem;
    background: none;
    border: none;
    font-family: inherit;
    transition: var(--transition);
    text-decoration: none;
}

.detail-back i { width: 16px; height: 16px; }

.detail-back:hover { color: var(--primary); }

/* ======================= */
/* CARDS                   */
/* ======================= */
.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem;
    border: 1px solid var(--border-light);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.card-title i { width: 18px; height: 18px; color: var(--primary); }

/* ======================= */
/* BUTTONS                 */
/* ======================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.6rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.925rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn i { width: 17px; height: 17px; }

.btn-full { width: 100%; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 2px 8px rgba(112,1,254,0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(112,1,254,0.35);
}

.btn-secondary {
    background: var(--navy);
    color: white;
}

.btn-secondary:hover {
    background: var(--navy-light);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-danger-soft {
    background: #fef2f2;
    color: #dc2626;
}

.btn-danger-soft:hover {
    background: #fecaca;
}

.btn-outline {
    background: white;
    color: var(--text);
    border: 1.5px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-sm {
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-sm i { width: 14px; height: 14px; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-icon i { width: 15px; height: 15px; }

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-icon.btn-icon-danger:hover {
    border-color: var(--error);
    color: var(--error);
    background: #fef2f2;
}

/* ======================= */
/* FORMS                   */
/* ======================= */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.form-label .required { color: var(--error); }

.form-hint {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 0.35rem;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    background: white;
    color: var(--text);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(112,1,254,0.1);
}

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

.form-checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.form-checkbox-row input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
    cursor: pointer;
}

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

.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.checkbox-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    background: white;
}

.checkbox-chip input { display: none; }

.checkbox-chip:hover { border-color: var(--primary-light); }

.checkbox-chip.checked {
    border-color: var(--primary);
    background: rgba(112,1,254,0.08);
    color: var(--primary-dark);
    font-weight: 600;
}

/* ======================= */
/* ALERTS                  */
/* ======================= */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
}

.alert i { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #b45309;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

/* ======================= */
/* AUTH / LOGIN            */
/* ======================= */
.auth-layout {
    display: flex;
    flex: 1;
    min-height: 100vh;
}

.auth-side-panel {
    flex: 1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, var(--navy) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.auth-side-panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='rgba(255,255,255,0.05)' d='M0,224L48,213.3C96,203,192,181,288,181.3C384,181,480,203,576,224C672,245,768,267,864,261.3C960,256,1056,224,1152,208C1248,192,1344,192,1392,192L1440,192L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'/%3E%3C/svg%3E") no-repeat bottom;
    background-size: cover;
}

.auth-side-icon {
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.auth-side-icon i {
    width: 80px;
    height: 80px;
    color: rgba(255,255,255,0.3);
}

.auth-side-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.auth-side-text {
    font-size: 1.05rem;
    opacity: 0.85;
    line-height: 1.7;
    max-width: 380px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.auth-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg);
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background: var(--card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    border: 1px solid var(--border-light);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 14px rgba(112,1,254,0.3);
    color: white;
}

.auth-logo i { width: 30px; height: 30px; }

.auth-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--navy);
    letter-spacing: -0.02em;
}

.auth-title span { color: var(--primary); }

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.auth-demo-hint {
    margin-top: 1.5rem;
    padding: 0.85rem 1rem;
    background: rgba(112,1,254,0.06);
    border: 1px dashed rgba(112,1,254,0.35);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
}

.auth-demo-hint code {
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.8rem;
    color: var(--primary-dark);
    font-weight: 600;
    background: rgba(112,1,254,0.08);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

/* ======================= */
/* STAT CARDS              */
/* ======================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
}

.stat-card.gold::before { background: linear-gradient(90deg, var(--gold), #c09a38); }
.stat-card.navy::before { background: linear-gradient(90deg, var(--navy), var(--navy-light)); }
.stat-card.green::before { background: linear-gradient(90deg, var(--success), #059669); }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card-icon {
    float: right;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(112,1,254,0.1);
    color: var(--primary);
}

.stat-card.gold .stat-card-icon { background: rgba(218,174,81,0.15); color: #b8860b; }
.stat-card.navy .stat-card-icon { background: rgba(29,6,72,0.08); color: var(--navy); }
.stat-card.green .stat-card-icon { background: rgba(16,185,129,0.12); color: var(--success); }

.stat-card-icon i { width: 22px; height: 22px; }

.stat-card-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--navy);
    line-height: 1;
    margin-top: 0.5rem;
}

.stat-card-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    font-weight: 500;
}

.status-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
}

.status-summary-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.status-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.status-summary-count {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--navy);
}

/* ======================= */
/* STATUS BADGES           */
/* ======================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge-lg {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    border-radius: 24px;
}

.badge .badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    flex-shrink: 0;
}

.badge .badge-dot.pulse {
    animation: pulseDot 1.2s ease-in-out infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(1.35); }
}

.badge-en_attente { background: #f1f5f9; color: #64748b; }
.badge-en_analyse { background: #dbeafe; color: #2563eb; }
.badge-conforme { background: #d1fae5; color: #059669; }
.badge-non_conforme { background: #fee2e2; color: #dc2626; }
.badge-incomplet { background: #ffedd5; color: #c2410c; }
.badge-erreur { background: #7f1d1d; color: #fecaca; }

.badge-obligatoire { background: var(--gold-light); color: #92620a; }
.badge-facultatif { background: #f1f5f9; color: #64748b; }

.badge-active { background: #d1fae5; color: #059669; }
.badge-inactive { background: #f1f5f9; color: #64748b; }

.badge-source-chat {
    background: linear-gradient(135deg, rgba(112,1,254,0.12), rgba(158,82,255,0.18));
    color: var(--primary-dark);
}

.badge-source-chat i { width: 12px; height: 12px; }

.badge-extraction-ok { background: #d1fae5; color: #059669; }
.badge-extraction-en_attente { background: #f1f5f9; color: #64748b; }
.badge-extraction-erreur { background: #fee2e2; color: #dc2626; }

.badge-indeterminable { background: #ffedd5; color: #c2410c; }

/* Code chip (document codes) */
.code-chip {
    display: inline-flex;
    align-items: center;
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-dark);
    background: rgba(112,1,254,0.08);
    border: 1px solid rgba(112,1,254,0.18);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    white-space: nowrap;
}

/* ======================= */
/* PARCOURS CARDS          */
/* ======================= */
.parcours-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.parcours-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

.parcours-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-left-color: var(--primary-dark);
}

.parcours-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.parcours-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--navy);
}

.parcours-card-desc {
    color: var(--text-muted);
    font-size: 0.87rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.parcours-card-stats {
    display: flex;
    gap: 1.25rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.parcours-card-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.parcours-card-stat i { width: 15px; height: 15px; color: var(--primary); }

.parcours-card-stat strong { color: var(--navy); font-weight: 700; }

/* ======================= */
/* TABS                    */
/* ======================= */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.15rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn i { width: 16px; height: 16px; }

.tab-btn:hover { color: var(--primary); }

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-count {
    background: var(--border-light);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
}

.tab-btn.active .tab-count {
    background: rgba(112,1,254,0.12);
    color: var(--primary);
}

/* ======================= */
/* SWITCH TOGGLE           */
/* ======================= */
.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    transition: 0.25s;
    cursor: pointer;
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.25s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.switch input:checked + .switch-slider {
    background: var(--success);
}

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

.switch input:disabled + .switch-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.switch-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* ======================= */
/* ITEM LISTS (docs/rules) */
/* ======================= */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.item-row {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem 1.35rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
}

.item-row:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}

.item-row.inactive {
    opacity: 0.6;
}

.item-row-main { flex: 1; min-width: 0; }

.item-row-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.3rem;
}

.item-row-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--navy);
}

.item-row-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.item-row-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.6rem;
}

.item-row-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ======================= */
/* CHAT IA                 */
/* ======================= */
.chat-panel {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 560px;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, rgba(112,1,254,0.05), rgba(158,82,255,0.08));
}

.chat-header-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.chat-header-icon i { width: 19px; height: 19px; }

.chat-header-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--navy);
}

.chat-header-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg);
}

.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 78%;
    animation: fadeIn 0.25s ease;
}

.chat-msg.user {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-msg.assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-bubble {
    padding: 0.8rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.chat-msg.user .chat-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-msg.assistant .chat-bubble {
    background: white;
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.chat-msg-time {
    font-size: 0.68rem;
    color: var(--text-light);
    margin-top: 0.3rem;
    padding: 0 0.25rem;
}

.chat-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.6rem;
    width: 100%;
}

.chat-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.4;
}

.chat-action i { width: 15px; height: 15px; flex-shrink: 0; }

.chat-action-add {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.chat-action-doc {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

.chat-action-remove {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

/* Proposition de l'assistant : avant/après + confirmation */
.chat-proposal {
    margin-top: 0.65rem;
    width: 100%;
    background: #faf8ff;
    border: 1px solid #e6dcfb;
    border-radius: var(--radius-md);
    padding: 0.7rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.chat-prop-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-dark);
}

.chat-prop-title i { width: 14px; height: 14px; }

.chat-prop-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    line-height: 1.45;
    background: white;
    border: 1px solid var(--border-light);
}

.chat-prop-item > i { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; }
.chat-prop-item.add > i { color: var(--success); }
.chat-prop-item.edit > i { color: var(--primary); }
.chat-prop-item.remove > i { color: var(--error); }
.chat-prop-item.remove strong { color: #b91c1c; }

.chat-prop-desc {
    color: var(--text-muted);
    font-size: 0.76rem;
    margin-top: 0.2rem;
}

.chat-prop-chip {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    background: var(--border-light);
    color: var(--text-muted);
    vertical-align: 1px;
}

.chat-prop-chip.gold {
    background: var(--gold-light);
    color: #8a6a1f;
}

.chat-diff-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.3rem;
    font-size: 0.76rem;
}

.chat-diff-line i { width: 13px; height: 13px; color: var(--text-light); flex-shrink: 0; }

.chat-diff-field {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 68px;
}

.chat-diff-before {
    background: #fef2f2;
    color: #b91c1c;
    text-decoration: line-through;
    padding: 0.1rem 0.45rem;
    border-radius: 5px;
}

.chat-diff-after {
    background: #f0fdf4;
    color: #15803d;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 5px;
}

.chat-prop-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.15rem;
}

.chat-prop-actions .btn { flex: 1; justify-content: center; }

.chat-prop-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.2rem 0;
}

.chat-prop-status i { width: 15px; height: 15px; }
.chat-prop-status.ok { color: var(--success); }
.chat-prop-status.ko { color: var(--text-light); }

.chat-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.9rem 1.1rem;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-light);
    animation: typingBounce 1.2s infinite ease-in-out;
}

.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem 0;
}

.chat-suggestion {
    padding: 0.45rem 0.9rem;
    border: 1px dashed var(--primary-light);
    background: rgba(112,1,254,0.04);
    color: var(--primary-dark);
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.chat-suggestion:hover {
    background: rgba(112,1,254,0.1);
    border-style: solid;
}

.chat-input-row {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    background: white;
}

.chat-input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-family: inherit;
    transition: var(--transition);
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(112,1,254,0.1);
}

.chat-send-btn {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.chat-send-btn i { width: 19px; height: 19px; }

.chat-send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(112,1,254,0.35);
}

.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.chat-empty i {
    width: 44px;
    height: 44px;
    color: var(--primary-light);
    margin-bottom: 1rem;
}

.chat-empty-title {
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.35rem;
}

.chat-empty-text {
    font-size: 0.85rem;
    max-width: 380px;
    line-height: 1.6;
}

/* ---- Widget flottant (bulle + panneau) ---- */
.chat-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(112,1,254,0.4);
    z-index: 180;
    transition: var(--transition);
}

.chat-fab:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 32px rgba(112,1,254,0.5);
}

.chat-fab i { width: 26px; height: 26px; }

.chat-fab-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--gold);
    border: 2px solid white;
    animation: pulseDot 1.2s ease-in-out infinite;
}

.chat-widget {
    position: fixed;
    bottom: 6.75rem;
    right: 1.5rem;
    width: 380px;
    max-width: calc(100vw - 2rem);
    height: 65vh;
    max-height: 620px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 190;
    animation: chatWidgetIn 0.25s ease;
}

@keyframes chatWidgetIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-widget-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    flex-shrink: 0;
}

.chat-widget-header .chat-header-icon {
    background: rgba(255,255,255,0.18);
}

.chat-widget-header-text { min-width: 0; }

.chat-widget-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.chat-widget-sub {
    font-size: 0.75rem;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-widget-close {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.chat-widget-close i { width: 17px; height: 17px; }

.chat-widget-close:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

.chat-widget .chat-messages { padding: 1.25rem; }

.chat-widget .chat-suggestions { padding: 0.75rem 1.25rem 0; }

.chat-widget .chat-input-row { padding: 0.85rem 1.25rem; }

/* ======================= */
/* API TAB / CODE BLOCKS   */
/* ======================= */
.api-key-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.api-key-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.85rem;
    color: var(--primary-dark);
    background: var(--bg);
    min-width: 0;
}

.api-key-input:focus { outline: none; border-color: var(--primary); }

.code-block {
    position: relative;
    background: #0f172a;
    border-radius: var(--radius-md);
    padding: 1.15rem 1.25rem;
    margin: 0.75rem 0 1.25rem;
    overflow-x: auto;
}

.code-block pre {
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    color: #e2e8f0;
    white-space: pre;
}

.code-block .code-comment { color: #64748b; }
.code-block .code-accent { color: #c9a9ff; }

.code-copy-btn {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.code-copy-btn i { width: 13px; height: 13px; }

.code-copy-btn:hover {
    background: rgba(255,255,255,0.16);
    color: white;
}

.api-step-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--navy);
    margin-top: 1.5rem;
}

.api-step-num {
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* ======================= */
/* TABLES                  */
/* ======================= */
.table-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-scroll { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 0.85rem 1.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 0.85rem 1.5rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(112,1,254,0.02);
}

.data-table tbody tr.clickable {
    cursor: pointer;
}

.data-table tbody tr.clickable:hover {
    background: rgba(112,1,254,0.05);
}

.td-ref {
    font-weight: 600;
    color: var(--primary-dark);
}

.td-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ======================= */
/* FILTER BAR              */
/* ======================= */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.filter-select {
    padding: 0.6rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    font-family: inherit;
    color: var(--text);
    background: white;
    cursor: pointer;
}

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

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

.filter-search i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-light);
    pointer-events: none;
}

.filter-search input {
    width: 100%;
    padding: 0.6rem 0.85rem 0.6rem 2.5rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    font-family: inherit;
}

.filter-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(112,1,254,0.1);
}

.auto-refresh-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--info);
    font-weight: 500;
}

.auto-refresh-hint i { width: 13px; height: 13px; animation: spin 2s linear infinite; }

/* ======================= */
/* DOSSIER DETAIL          */
/* ======================= */
.dossier-head-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.dossier-head-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.dossier-head-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-light);
}

.dossier-meta-item { min-width: 140px; }

.dossier-meta-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.dossier-meta-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
}

.dossier-meta-value a {
    color: var(--primary);
    text-decoration: none;
}

.dossier-meta-value a:hover { text-decoration: underline; }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 1.35rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.summary-card-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.summary-card-icon i { width: 21px; height: 21px; }

.summary-card-icon.ok { background: rgba(16,185,129,0.12); color: var(--success); }
.summary-card-icon.ko { background: rgba(239,68,68,0.12); color: var(--error); }
.summary-card-icon.neutral { background: rgba(112,1,254,0.1); color: var(--primary); }

.summary-card-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--navy);
    line-height: 1.1;
}

.summary-card-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Documents transmis */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.doc-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.doc-card:hover {
    box-shadow: var(--shadow-md);
}

.doc-card-preview {
    height: 170px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-light);
    overflow: hidden;
}

.doc-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: var(--transition);
}

.doc-card-preview img:hover { transform: scale(1.03); }

.doc-card-file-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-light);
}

.doc-card-file-icon i { width: 38px; height: 38px; }

.doc-card-file-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.doc-card-file-link i { width: 14px !important; height: 14px !important; }

.doc-card-file-link:hover { text-decoration: underline; }

.doc-card-body {
    padding: 1.1rem 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.doc-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.doc-card-name {
    font-size: 0.85rem;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.doc-card-size {
    font-size: 0.75rem;
    color: var(--text-light);
}

.extraction-details {
    margin-top: 0.4rem;
    border-top: 1px solid var(--border-light);
    padding-top: 0.6rem;
}

.extraction-details summary {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    user-select: none;
}

.extraction-details summary:hover { color: var(--primary-dark); }

/* Historique des versions d'un document */
.doc-history summary i { width: 13px; height: 13px; vertical-align: -2px; margin-right: 0.25rem; }

.doc-history-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.45rem 0.2rem;
    border-top: 1px solid var(--border-light);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.doc-history-meta { flex: 1; min-width: 180px; }
.doc-history-row .doc-card-file-link { font-size: 0.78rem; }
.doc-history-row .doc-card-file-link i { width: 12px; height: 12px; }

.extraction-json {
    margin-top: 0.6rem;
    background: #0f172a;
    color: #c9a9ff;
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.72rem;
    line-height: 1.55;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    max-height: 260px;
    overflow-y: auto;
    white-space: pre;
}

/* Rule results */
.rule-result-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.35rem;
}

.rule-result-row + .rule-result-row { margin-top: 0.75rem; }

.rule-result-status { flex-shrink: 0; padding-top: 2px; }

.rule-result-main { flex: 1; min-width: 0; }

.rule-result-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.rule-result-reason {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-top: 0.3rem;
}

/* ======================= */
/* MODALS                  */
/* ======================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}

.modal {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.25s ease;
}

.modal-wide { max-width: 760px; }

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

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

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--navy);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close i { width: 18px; height: 18px; }

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

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

.modal-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.modal-text strong { color: var(--navy); }

/* ======================= */
/* TOASTS                  */
/* ======================= */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--border-light);
    border-left-width: 4px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    animation: toastIn 0.3s ease;
    line-height: 1.45;
}

.toast i { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-success i { color: var(--success); }
.toast.toast-error { border-left-color: var(--error); }
.toast.toast-error i { color: var(--error); }
.toast.toast-info { border-left-color: var(--info); }
.toast.toast-info i { color: var(--info); }

.toast.leaving { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

/* ======================= */
/* EMPTY STATE             */
/* ======================= */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: var(--radius-xl);
    border: 2px dashed var(--border);
}

.empty-state.compact { padding: 2.5rem 1.5rem; }

.empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(112,1,254,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    color: var(--primary);
}

.empty-icon i { width: 28px; height: 28px; }

.empty-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.5rem;
}

.empty-text {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.empty-text:last-child { margin-bottom: 0; }

/* ======================= */
/* SPINNER / LOADER        */
/* ======================= */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}

.spinner-dark {
    border-color: var(--border);
    border-top-color: var(--primary);
}

.spinner-lg {
    width: 42px;
    height: 42px;
    border-width: 3px;
}

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

.page-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 6rem 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ======================= */
/* UTILITIES               */
/* ======================= */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ======================= */
/* RESPONSIVE              */
/* ======================= */
@media (max-width: 1024px) {
    .logo-tagline { display: none; }
    .dash-sidebar { width: 200px; }
}

@media (max-width: 768px) {
    .nav { padding: 0 1rem; }
    .nav-inner { height: 68px; }
    .nav-user-name { display: none; }
    .admin-badge { display: none; }
    /* Les liens sont repris par la barre latérale (horizontale sur mobile) */
    .nav-links { display: none; }
    .logo { gap: 10px; }
    .logo-img { height: 28px; }
    .btn-nav { padding: 0.45rem 0.6rem; font-size: 0.8rem; }

    .app-shell { flex-direction: column; }
    .dash-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        padding: 0.75rem 0;
        display: flex;
        overflow-x: auto;
    }
    .dash-sidebar-label { display: none; }
    .dash-sidebar-section { display: flex; gap: 0.25rem; margin-bottom: 0; padding: 0 0.5rem; }
    .dash-sidebar-link { white-space: nowrap; margin: 0; padding: 0.5rem 0.75rem; font-size: 0.8rem; width: auto; }
    .dash-sidebar-link.active { border-left: none; }

    .auth-side-panel { display: none; }
    .auth-layout { flex-direction: column; }

    .chat-widget {
        width: calc(100vw - 2rem);
        height: 70vh;
        bottom: 6rem;
        right: 1rem;
    }
    .chat-fab { bottom: 1.25rem; right: 1rem; }

    .page { padding: 1rem; }
    .page-title { font-size: 1.4rem; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .parcours-grid { grid-template-columns: 1fr; }
    .doc-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }

    .card { padding: 1.25rem; }
    .modal { padding: 1.5rem; }
    .auth-card { padding: 1.75rem; }

    .data-table th, .data-table td { padding: 0.6rem 0.75rem; font-size: 0.8rem; }

    .chat-msg { max-width: 92%; }
    .chat-panel { height: 480px; }

    .dossier-head-meta { gap: 1rem; }
}

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