/* ============================================
   Variables et Base - Design Moderne Épuré
   OPTIMISÉ POUR LA PERFORMANCE
   ============================================ */
:root {
    /* Couleurs principales - Palette moderne */
    --primary: #0f172a;
    --primary-light: #1e293b;
    --primary-gradient: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);

    /* Accent - Bleu moderne */
    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);

    /* États */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #06b6d4;
    --info-light: #cffafe;

    /* Neutres */
    --bg: #f8fafc;
    --bg-secondary: #f1f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    /* Effets - OPTIMISÉ: Ombres simplifiées */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 12px rgba(59, 130, 246, 0.12);

    /* Dimensions */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* OPTIMISÉ: Transitions plus rapides */
    --transition-fast: 100ms ease-out;
    --transition: 150ms ease-out;
    --transition-slow: 200ms ease-out;
}

/* OPTIMISATION: Réduire les repaints */
* {
    -webkit-tap-highlight-color: transparent;
}

/* OPTIMISATION: GPU acceleration pour les éléments animés */
.card, .btn, .check-box, .action-btn, .stat-card, .nav-item, .gantt-bar {
    will-change: transform;
    transform: translateZ(0);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Layout Principal
   ============================================ */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

.app {
    display: flex;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    max-width: calc(100vw - 280px);
    overflow-x: hidden;
}

/* ============================================
   Sidebar - Design Moderne Épuré
   ============================================ */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #0a0f1a 0%, #111827 50%, #0f172a 100%);
    color: #fff;
    position: fixed;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-logo {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.01em;
    color: #fff;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sidebar-subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 8px;
    font-weight: 400;
    padding-left: 48px;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
    position: relative;
}

.sidebar-nav::-webkit-scrollbar {
    width: 3px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* Section avec titre (legacy) */
.nav-section {
    padding: 1.25rem 1.25rem 0.625rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #3b82f6;
    font-weight: 700;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-section::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.3) 0%, transparent 100%);
}

.nav-section:first-child {
    margin-top: 0;
}

/* Menu déroulant par catégorie */
.nav-group {
    margin-top: 2px;
}

.nav-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.7rem 1.25rem;
    margin: 2px 0.625rem;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
}

.nav-group-header:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.nav-group.open > .nav-group-header {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.08);
}

.nav-group-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    flex-shrink: 0;
}

.nav-group-icon svg {
    width: 18px;
    height: 18px;
}

.nav-group-arrow {
    margin-left: auto;
    display: flex;
    align-items: center;
    transition: transform 0.25s ease;
    opacity: 0.5;
}

.nav-group.open > .nav-group-header .nav-group-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

.nav-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-group.open > .nav-group-items {
    max-height: 500px;
}

.nav-group-items .nav-item {
    padding-left: 2.8rem;
    font-size: 0.825rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1.25rem;
    margin: 2px 0.625rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    position: relative;
}

.nav-item[data-page="dashboard"],
.nav-item[data-page="dashboard"].active,
.nav-item[data-page="dashboard"]:hover {
    color: #3b82f6;
}

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

.nav-item.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.08) 100%);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.nav-item.active .nav-item-icon {
    color: #60a5fa;
}

.nav-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s ease;
}

.nav-item:hover .nav-item-icon {
    color: #60a5fa;
}

/* Icônes SVG inline pour la navigation */
.nav-item-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.75;
    fill: none;
}

.nav-item-badge {
    margin-left: auto;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    position: relative;
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-footer-sync {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.4);
}

.sidebar-footer-sync::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.btn-logout {
    width: 100%;
    padding: 0.625rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* ============================================
   Header - Design Épuré OPTIMISÉ
   ============================================ */
.header {
    background: #fff;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.header-title {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

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

.header-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.header-date svg {
    color: var(--accent);
}

/* ============================================
   Pages
   ============================================ */
.page-content {
    padding: 2rem;
    flex: 1;
    max-width: min(1600px, 100%);
    width: 100%;
    box-sizing: border-box;
}

.page {
    display: none;
    /* OPTIMISATION: Animation plus rapide */
    animation: fadeIn 0.2s ease-out;
    /* OPTIMISATION: Containment */
    contain: layout style paint;
}

.page.active {
    display: block;
}

/* OPTIMISATION: Contenu des pages inactives ignoré */
.page:not(.active) * {
    visibility: hidden;
    pointer-events: none;
}

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

/* ============================================
   Cards - Design Moderne OPTIMISÉ
   ============================================ */
.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border-light);
    /* OPTIMISATION: Containment + pas de transition sur hover */
    contain: layout style;
}

/* OPTIMISATION: Suppression hover shadow qui cause des repaints */
.card:hover {
    /* box-shadow supprimé pour performance */
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.card-body {
    padding: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   Stats Grid - Design Moderne
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

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

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 3px 0 0 3px;
}

/* OPTIMISÉ: Utiliser uniquement transform, pas de changement de shadow */
.stat-card:hover {
    transform: translateY(-2px) translateZ(0);
}

.stat-card.success::before {
    background: linear-gradient(180deg, var(--success) 0%, #059669 100%);
}

.stat-card.warning::before {
    background: linear-gradient(180deg, var(--warning) 0%, #d97706 100%);
}

.stat-card.danger::before {
    background: linear-gradient(180deg, var(--danger) 0%, #dc2626 100%);
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   Boutons - Design Moderne
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

/* OPTIMISÉ: Pas de changement de shadow au hover */
.btn-primary:hover {
    transform: translateY(-1px) translateZ(0);
    opacity: 0.9;
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

/* OPTIMISÉ: Hovers simplifiés */
.btn-success:hover {
    transform: translateY(-1px) translateZ(0);
    opacity: 0.9;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: #fff;
    box-shadow: var(--shadow);
}

.btn-warning:hover {
    transform: translateY(-1px) translateZ(0);
    opacity: 0.9;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: #fff;
    box-shadow: var(--shadow);
}

.btn-danger:hover {
    transform: translateY(-1px) translateZ(0);
    opacity: 0.9;
}

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

.btn-outline:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

/* ============================================
   Tables - Design Épuré OPTIMISÉ
   ============================================ */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    /* OPTIMISATION: Containment pour isoler les repaints */
    contain: layout style;
    /* Responsive: autoriser le scroll horizontal */
    min-width: 100%;
}

/* Conteneur responsive pour les tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* OPTIMISATION: Containment pour les lignes de table */
tbody tr {
    contain: layout style paint;
}

th {
    background: var(--bg-secondary);
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

td {
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--bg-secondary);
}

/* ============================================
   Badges - Design Moderne
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success {
    background: var(--success-light);
    color: #047857;
}

.badge-warning {
    background: var(--warning-light);
    color: #b45309;
}

.badge-danger {
    background: var(--danger-light);
    color: #b91c1c;
}

.badge-info {
    background: var(--info-light);
    color: #0e7490;
}

/* ============================================
   Check Box - Design Moderne
   ============================================ */
.check-box {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 0.75rem;
    background: var(--card);
}

.check-box.checked {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

/* OPTIMISÉ: Feedback rapide sur les checkboxes */
.check-box:hover {
    border-color: var(--accent);
    transform: scale(1.05) translateZ(0);
}

.check-box:active {
    transform: scale(0.9) translateZ(0);
}

/* ============================================
   Vérifications avec labels
   ============================================ */
.verif-header {
    display: flex;
    gap: 8px;
    font-size: 0.6rem;
    justify-content: center;
}

.verif-header span {
    width: 24px;
    text-align: center;
}

.verif-boxes {
    display: flex;
    gap: 8px;
}

.verif-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.verif-label {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

/* ============================================
   Semaines Badge
   ============================================ */
.semaines-badge {
    display: inline-flex;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

.semaines-badge.urgent {
    background: var(--danger-light);
    color: #b91c1c;
}

.semaines-badge.soon {
    background: var(--warning-light);
    color: #b45309;
}

.semaines-badge.ok {
    background: var(--success-light);
    color: #047857;
}

/* ============================================
   Modals - Design OPTIMISÉ
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* OPTIMISÉ: Suppression backdrop-filter, fond opaque */
    background: rgba(15, 23, 42, 0.75);
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    z-index: 1000;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
    animation: overlayIn 0.2s ease;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: min(600px, 95vw);
    margin: 2rem auto;
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

/* Modales avec largeur réduite */
.modal.modal-sm {
    max-width: min(400px, 95vw);
}

.modal.modal-md {
    max-width: min(500px, 95vw);
}

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

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-secondary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger);
    color: #fff;
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 6px;
}

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

/* ============================================
   Formulaires - Design Moderne
   ============================================ */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.form-row.three {
    grid-template-columns: repeat(3, 1fr);
}

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

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

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

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

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

.form-check {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-check input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* ============================================
   Actions
   ============================================ */
.action-btns {
    display: flex;
    gap: 6px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-muted);
}

/* OPTIMISÉ: Feedback visuel rapide */
.action-btn:hover {
    background: var(--accent);
    color: #fff;
    transform: scale(1.05) translateZ(0);
}

.action-btn:active {
    transform: scale(0.95) translateZ(0);
}

.action-btn.edit:hover {
    background: var(--warning);
}

.action-btn.delete:hover {
    background: var(--danger);
}

.action-btn.archive:hover {
    background: var(--success);
}

/* ============================================
   Toast - Design Moderne
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--text);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

.toast.error {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
}

.toast.warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
}

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

/* ============================================
   Filtres - Design Moderne
   ============================================ */
.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--card);
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.search-box::before {
    content: "\1F50D";
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    opacity: 0.5;
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    min-width: 160px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* ============================================
   Divers
   ============================================ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem;
    opacity: 0.5;
    transition: var(--transition);
}

.password-toggle:hover {
    opacity: 1;
}

/* ============================================
   Page de Connexion - Design Futuriste
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0e1a;
    background-image: url('futur.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center top, rgba(0, 170, 255, 0.08) 0%, transparent 60%);
}

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 170, 255, 0.15), 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(0, 170, 255, 0.03); }
    50% { box-shadow: 0 0 30px rgba(0, 170, 255, 0.25), 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 0 30px rgba(0, 170, 255, 0.05); }
}

.login-card {
    background: rgba(12, 17, 30, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: 0 0 20px rgba(0, 170, 255, 0.15), 0 8px 32px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: min(420px, 95vw);
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0, 170, 255, 0.2);
    animation: glow-pulse 4s ease-in-out infinite;
}

.login-header {
    background: linear-gradient(135deg, rgba(0, 100, 200, 0.3), rgba(0, 170, 255, 0.1));
    color: #fff;
    padding: 2.5rem 2rem;
    text-align: center;
    position: relative;
    border-bottom: 1px solid rgba(0, 170, 255, 0.15);
}

.login-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 170, 255, 0.5), transparent);
}

.login-logo {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #e0eaff;
}

.login-logo-icon {
    width: 42px;
    height: 42px;
    background: rgba(0, 170, 255, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #00aaff;
    border: 1px solid rgba(0, 170, 255, 0.3);
}

.login-subtitle {
    font-size: 0.85rem;
    opacity: 0.5;
    position: relative;
    z-index: 1;
    color: #8899bb;
}

.login-form {
    padding: 2rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form .form-group label {
    color: #8899bb;
}

.login-form .form-control {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 170, 255, 0.15);
    color: #e0eaff;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.login-form .form-control::placeholder {
    color: rgba(136, 153, 187, 0.5);
}

.login-form .form-control:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 170, 255, 0.5);
    box-shadow: 0 0 12px rgba(0, 170, 255, 0.15);
    color: #fff;
    outline: none;
}

.remember-me-group {
    margin-bottom: 1rem !important;
}

.remember-me-group .form-check {
    justify-content: flex-start;
    font-size: 0.875rem;
    color: #8899bb;
}

.login-error {
    color: #ff6b6b;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    text-align: center;
    min-height: 1.25rem;
    padding: 0.5rem;
    background: rgba(255, 80, 80, 0.1);
    border: 1px solid rgba(255, 80, 80, 0.2);
    border-radius: var(--radius-sm);
    display: none;
}

.login-error:not(:empty) {
    display: block;
}

.btn-login {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #0066cc, #00aaff);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-login:hover {
    background: linear-gradient(135deg, #0077dd, #00bbff);
    box-shadow: 0 0 20px rgba(0, 170, 255, 0.3);
    transform: translateY(-1px);
}

.login-footer {
    padding: 1rem 2rem 2rem;
    text-align: center;
    color: #556688;
    font-size: 0.8rem;
}

.password-toggle {
    color: #8899bb;
}

.password-toggle:hover {
    color: #00aaff;
}

/* ============================================
   Loading Overlay - OPTIMISÉ
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* OPTIMISÉ: Suppression backdrop-filter */
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 3000;
    color: var(--primary);
    font-weight: 500;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   User Email
   ============================================ */
.user-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 500;
    border: 1px solid var(--border-light);
}

/* ============================================
   Diagramme de Gantt - Design Moderne
   ============================================ */
.gantt-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#ganttZoomLevel {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 90px;
    text-align: center;
    font-weight: 500;
}

.gantt-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 500px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    -webkit-overflow-scrolling: touch;
}

.gantt-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.gantt-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.gantt-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.gantt-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.gantt-chart {
    display: table;
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
}

.gantt-header {
    display: table-row;
    background: var(--bg-secondary);
}

.gantt-header-label {
    display: table-cell;
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    border-bottom: 2px solid var(--border);
    position: sticky;
    left: 0;
    z-index: 12;
    vertical-align: middle;
}

.gantt-header-timeline {
    display: table-cell;
    vertical-align: middle;
    border-bottom: 2px solid var(--border);
}

.gantt-header-timeline-inner {
    display: flex;
}

.gantt-header-day {
    flex: 0 0 45px;
    width: 45px;
    min-width: 45px;
    padding: 0.625rem 0.25rem;
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    border-right: 1px solid var(--border-light);
}

.gantt-header-day.weekend {
    background: rgba(0, 0, 0, 0.02);
}

.gantt-header-day.today {
    background: rgba(59, 130, 246, 0.1);
    font-weight: 700;
    color: var(--accent);
}

.gantt-header-day .day-name {
    font-weight: 600;
    text-transform: uppercase;
}

.gantt-header-day .day-date {
    font-size: 0.7rem;
    margin-top: 3px;
    opacity: 0.8;
}

.gantt-body {
    display: table-row-group;
}

.gantt-row {
    display: table-row;
    transition: var(--transition-fast);
}

.gantt-row:hover .gantt-row-label,
.gantt-row:hover .gantt-row-timeline {
    background: rgba(59, 130, 246, 0.03);
}

.gantt-row-label {
    display: table-cell;
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    padding: 0.875rem 1.25rem;
    background: var(--card);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    left: 0;
    z-index: 5;
    vertical-align: middle;
}

.gantt-row-label .client-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.gantt-row-label .client-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.gantt-row-timeline {
    display: table-cell;
    position: relative;
    vertical-align: middle;
    height: 56px;
    border-bottom: 1px solid var(--border-light);
}

.gantt-row-timeline-inner {
    display: flex;
    align-items: center;
    height: 100%;
    position: relative;
}

.gantt-cell {
    flex: 0 0 45px;
    width: 45px;
    min-width: 45px;
    height: 100%;
    border-right: 1px solid var(--border-light);
}

.gantt-cell.weekend {
    background: rgba(0, 0, 0, 0.015);
}

.gantt-cell.today {
    background: rgba(59, 130, 246, 0.05);
}

.gantt-bar {
    position: absolute;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
    z-index: 2;
    padding: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gantt-bar:hover {
    transform: scaleY(1.15);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.gantt-bar.urgent {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.gantt-bar.soon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.gantt-bar.ok {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.gantt-bar.past {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

.gantt-legend {
    display: flex;
    gap: 2rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.legend-color {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend-color.urgent {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.legend-color.soon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.legend-color.ok {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.legend-color.past {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

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

.gantt-empty-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
}

/* ============================================
   Calendrier Planning - Design Moderne
   ============================================ */
.calendar-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.calendar-month-label {
    font-size: 1.1rem;
    font-weight: 600;
    min-width: 160px;
    text-align: center;
    color: var(--text);
}

.calendar-container {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
}

.calendar-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
}

.calendar-day-name {
    padding: 0.875rem 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-day-name.weekend {
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.02);
}

.calendar-day-name .day-short {
    display: none;
}

.calendar-day-name .day-full {
    display: inline;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
    min-height: 120px;
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    padding: 0.5rem;
    background: var(--card);
    transition: var(--transition-fast);
    position: relative;
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

.calendar-day:hover {
    background: rgba(59, 130, 246, 0.02);
}

.calendar-day.other-month {
    background: var(--bg-secondary);
    opacity: 0.5;
}

.calendar-day.weekend {
    background: rgba(0, 0, 0, 0.015);
}

.calendar-day.today {
    background: rgba(59, 130, 246, 0.08);
    box-shadow: inset 0 0 0 2px var(--accent);
}

.calendar-day-number {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.calendar-day.today .calendar-day-number {
    color: var(--accent);
    font-weight: 700;
}

.calendar-day.other-month .calendar-day-number {
    color: var(--text-muted);
}

.calendar-events {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 85px;
    overflow-y: auto;
}

.calendar-events::-webkit-scrollbar {
    width: 3px;
}

.calendar-events::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.calendar-event {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}

.calendar-event:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.calendar-event.urgent {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.calendar-event.soon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.calendar-event.ok {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.calendar-event .event-modules {
    background: rgba(255, 255, 255, 0.25);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
}

.calendar-event-more {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    padding: 2px;
    cursor: pointer;
}

.calendar-event-more:hover {
    color: var(--accent);
}

.calendar-legend {
    display: flex;
    gap: 2rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-light);
    justify-content: center;
}

/* ============================================
   Responsive Mobile
   ============================================ */

/* Bouton menu mobile */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 200;
    width: 44px;
    height: 44px;
    border: none;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
    align-items: center;
    justify-content: center;
}

.mobile-menu-btn svg {
    width: 22px;
    height: 22px;
}

.mobile-menu-btn:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
}

/* Overlay pour fermer le menu OPTIMISÉ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* OPTIMISÉ: Suppression backdrop-filter */
    background: rgba(15, 23, 42, 0.6);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
    animation: overlayIn 0.2s ease;
}

@media (max-width: 768px) {
    /* Afficher le bouton menu */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Sidebar cachée par défaut sur mobile */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 280px;
        z-index: 100;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Contenu principal prend toute la largeur */
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
        min-width: 0;
    }

    /* Header adapté */
    .header {
        padding: 1rem;
        padding-left: 4.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .header-title {
        font-size: 1.15rem;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .header-date {
        font-size: 0.8rem;
    }

    /* Page content */
    .page-content {
        padding: 1.25rem;
    }

    /* Stats grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    /* Cards */
    .card-header {
        padding: 1rem 1.25rem;
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .card-header .btn {
        width: 100%;
        justify-content: center;
    }

    .card-body {
        padding: 1rem;
    }

    /* Tables responsive */
    table {
        font-size: 0.8rem;
    }

    th, td {
        padding: 0.75rem 0.5rem;
        vertical-align: middle;
    }

    /* Cacher certaines colonnes sur mobile */
    .hide-mobile {
        display: none !important;
    }

    /* Scroll horizontal pour les tables */
    .card-body {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Filtres */
    .filters-bar {
        flex-direction: column;
        gap: 1rem;
    }

    .search-box {
        min-width: 100%;
        width: 100%;
    }

    .filter-select {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }

    /* Groupe de filtres sur mobile */
    .filters-row {
        display: flex;
        gap: 0.75rem;
        width: 100%;
    }

    .filters-row .filter-select {
        flex: 1;
    }

    /* Modals */
    .modal-overlay {
        padding: 0.75rem;
        align-items: flex-start;
    }

    .modal {
        margin: 0.75rem auto;
        max-width: 100%;
        border-radius: var(--radius-lg);
    }

    .modal-body {
        max-height: 70vh;
    }

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

    .form-row.three {
        grid-template-columns: 1fr;
    }

    /* Gantt */
    /* Calendrier responsive mobile */
    .calendar-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.5rem 0;
    }

    .calendar-controls .btn {
        padding: 0.5rem 0.75rem;
        min-height: 38px;
    }

    .calendar-month-label {
        font-size: 0.95rem;
        min-width: 120px;
        order: -1;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .calendar-container {
        margin: 0 -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .calendar-header-row {
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .calendar-day-name {
        padding: 0.5rem 0.125rem;
        font-size: 0.65rem;
        letter-spacing: 0;
    }

    .calendar-day-name .day-full {
        display: none;
    }

    .calendar-day-name .day-short {
        display: inline;
    }

    .calendar-day {
        min-height: 60px;
        padding: 0.2rem;
    }

    .calendar-day-number {
        font-size: 0.7rem;
        margin-bottom: 0.2rem;
    }

    .calendar-events {
        max-height: 40px;
        gap: 2px;
    }

    .calendar-event {
        padding: 2px 3px;
        font-size: 0.55rem;
        border-radius: 3px;
    }

    .calendar-event .event-client {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .calendar-event .event-modules {
        display: none;
    }

    .calendar-event-more {
        font-size: 0.55rem;
        padding: 1px;
    }

    .calendar-legend {
        flex-wrap: wrap;
        gap: 0.5rem;
        font-size: 0.7rem;
        padding: 0.75rem 0.5rem;
        margin-top: 0.75rem;
    }

    .calendar-legend .legend-item {
        font-size: 0.65rem;
    }

    .calendar-day-name .day-short {
        display: inline;
    }

    .calendar-day-name .day-full {
        display: none;
    }

    /* Gantt */
    .gantt-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
    }

    .gantt-controls .btn {
        padding: 0.625rem 1rem;
    }

    .gantt-container {
        max-height: 320px;
        margin: 0 -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .gantt-header-label,
    .gantt-row-label {
        width: 110px;
        min-width: 110px;
        max-width: 110px;
        padding: 0.625rem;
        position: sticky;
        left: 0;
        background: var(--card);
        z-index: 5;
    }

    .gantt-header-label {
        background: var(--bg-secondary);
        z-index: 12;
    }

    .gantt-row-label .client-name {
        font-size: 0.75rem;
    }

    .gantt-row-label .client-info {
        font-size: 0.6rem;
    }

    .gantt-header-day {
        flex: 0 0 38px;
        width: 38px;
        min-width: 38px;
        padding: 0.5rem 0.25rem;
    }

    .gantt-header-day .day-name {
        font-size: 0.55rem;
    }

    .gantt-header-day .day-date {
        font-size: 0.55rem;
    }

    .gantt-cell {
        flex: 0 0 38px;
        width: 38px;
        min-width: 38px;
    }

    .gantt-bar {
        height: 26px;
        font-size: 0.65rem;
        padding: 0 6px;
        border-radius: 6px;
    }

    .gantt-row-timeline {
        height: 48px;
    }

    .gantt-legend {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
        justify-content: center;
    }

    .legend-item {
        font-size: 0.75rem;
    }

    .legend-color {
        width: 14px;
        height: 14px;
    }

    /* Actions boutons */
    .action-btns {
        flex-wrap: wrap;
    }

    .action-btn {
        width: 36px;
        height: 36px;
    }

    /* Semaines badge */
    .semaines-badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Check boxes plus grands pour mobile */
    .check-box {
        width: 30px;
        height: 30px;
    }

    /* Vérifications sur mobile */
    .verif-boxes {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }

    .verif-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
    }

    .verif-item .check-box {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }

    .verif-label {
        font-size: 0.55rem;
        font-weight: 600;
    }

    .verif-header {
        display: none;
    }

    /* Login page */
    .login-page {
        width: 100%;
        padding: 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .login-card {
        margin: 0 auto;
        width: 100%;
        max-width: 400px;
        border-radius: var(--radius-lg);
    }

    .login-header {
        padding: 2rem 1.5rem;
    }

    .login-form {
        padding: 1.5rem;
    }

    /* Toast */
    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1.5rem;
    }

    .toast {
        width: 100%;
    }

    /* User email caché sur mobile */
    .user-email {
        display: none;
    }
}

/* Écrans moyens (tablettes, petits laptops) */
@media (max-width: 1200px) {
    .main-content {
        margin-left: 260px;
        max-width: calc(100vw - 260px);
    }

    .sidebar {
        width: 260px;
    }

    .page-content {
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

/* Écrans entre tablette et mobile */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 240px;
        max-width: calc(100vw - 240px);
    }

    .sidebar {
        width: 240px;
    }

    .sidebar-header {
        padding: 1.25rem 1rem;
    }

    .sidebar-logo {
        font-size: 1rem;
    }

    .sidebar-logo-icon {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    .sidebar-subtitle {
        padding-left: 44px;
        font-size: 0.7rem;
    }

    .nav-item {
        padding: 0.625rem 1rem;
        font-size: 0.8rem;
        margin: 2px 0.5rem;
    }

    .nav-section {
        padding: 1rem 1rem 0.5rem;
        font-size: 0.6rem;
    }

    .nav-group-header {
        padding: 0.6rem 1rem;
        font-size: 0.75rem;
        margin: 2px 0.5rem;
    }

    .nav-group-items .nav-item {
        padding-left: 2.2rem;
    }

    .page-content {
        padding: 1.25rem;
    }

    .header {
        padding: 1rem 1.5rem;
    }

    .header-title {
        font-size: 1.25rem;
    }

    /* Tables plus compactes */
    th, td {
        padding: 0.75rem 0.875rem;
        font-size: 0.8rem;
    }

    /* Cards plus compactes */
    .card-header {
        padding: 0.875rem 1.25rem;
    }

    .card-body {
        padding: 1.25rem;
    }
}

/* Très petits écrans */
@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header-title {
        font-size: 1rem;
    }

    .gantt-header-label,
    .gantt-row-label {
        width: 90px;
        min-width: 90px;
        max-width: 90px;
        padding: 0.5rem;
        position: sticky;
        left: 0;
        background: var(--card);
        z-index: 5;
    }

    .gantt-header-label {
        background: var(--bg-secondary);
        z-index: 12;
    }

    .gantt-header-day,
    .gantt-cell {
        flex: 0 0 32px;
        width: 32px;
        min-width: 32px;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* ============================================
   Animations Utilitaires
   ============================================ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Focus visible pour accessibilité */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Sélection de texte */
::selection {
    background: var(--accent);
    color: #fff;
}

::-moz-selection {
    background: var(--accent);
    color: #fff;
}

/* ============================================
   DMIST Badge avec couleurs personnalisées
   ============================================ */
.dmist-badge {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ============================================
   Notes Cell
   ============================================ */
.notes-cell {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    max-width: 150px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}

/* ============================================
   NC Detail Modal
   ============================================ */
.nc-detail-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.nc-detail-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.nc-detail-row:last-of-type {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.nc-detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.nc-detail-value {
    font-size: 1rem;
    color: var(--text);
    font-weight: 500;
}

.nc-detail-description {
    background: var(--card);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-weight: 400;
    line-height: 1.6;
}

.nc-detail-status {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

/* ============================================
   Quantity Control pour Stock
   ============================================ */
.qty-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.qty-btn.minus {
    background: var(--danger-light);
    color: var(--danger);
}

.qty-btn.minus:hover {
    background: var(--danger);
    color: #fff;
}

.qty-btn.plus {
    background: var(--success-light);
    color: var(--success);
}

.qty-btn.plus:hover {
    background: var(--success);
    color: #fff;
}

.qty-value {
    min-width: 40px;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}

/* Mobile responsive pour qty-control */
@media (max-width: 768px) {
    .qty-btn {
        width: 32px;
        height: 32px;
    }

    .qty-value {
        min-width: 32px;
        font-size: 0.9rem;
    }
}

/* ============================================
   Dashboard - KPIs et Graphiques
   ============================================ */

/* KPIs principaux */
.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
}

.kpi-icon.blue {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
    color: #3b82f6;
}

.kpi-icon.orange {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
    color: #f59e0b;
}

.kpi-icon.green {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
    color: #10b981;
}

.kpi-icon.purple {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.05) 100%);
    color: #8b5cf6;
}

.kpi-content {
    flex: 1;
    min-width: 0;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.kpi-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

.kpi-trend {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.kpi-trend.up {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.kpi-trend.down {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Stats détaillées */
.dashboard-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-detail-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.stat-detail-card.urgent {
    border-left: 3px solid #ef4444;
}

.stat-detail-card.success {
    border-left: 3px solid #10b981;
}

.stat-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.stat-detail-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-detail-icon {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
    opacity: 0.5;
}

.stat-detail-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
}

.stat-detail-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-detail-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Graphiques */
.dashboard-charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.chart-card.wide {
    grid-column: 1 / -1;
}

.chart-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.chart-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.chart-body {
    padding: 1.25rem;
    height: 280px;
    position: relative;
}

.chart-body-tall {
    height: 350px;
}

.chart-body canvas {
    max-width: 100%;
    max-height: 100%;
}

/* Tableau récapitulatif */
.dashboard-table-section {
    margin-top: 1rem;
}

/* Responsive Dashboard */
@media (max-width: 1200px) {
    .dashboard-kpis {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 768px) {
    .dashboard-kpis {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .dashboard-stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .dashboard-charts-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .kpi-card {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .kpi-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .kpi-icon svg {
        width: 20px;
        height: 20px;
    }

    .kpi-value {
        font-size: 1.5rem;
    }

    .kpi-label {
        font-size: 0.7rem;
    }

    .kpi-trend {
        top: 0.75rem;
        right: 0.75rem;
        font-size: 0.6rem;
        padding: 3px 6px;
    }

    .stat-detail-card {
        padding: 1rem;
    }

    .stat-detail-value {
        font-size: 1.25rem;
    }

    .stat-detail-sub {
        font-size: 0.65rem;
    }

    .chart-card {
        border-radius: var(--radius);
    }

    .chart-header {
        padding: 0.875rem 1rem;
    }

    .chart-title {
        font-size: 0.8rem;
    }

    .chart-body {
        height: 220px;
        padding: 1rem;
    }

    .chart-body-tall {
        height: 260px;
    }

    .dashboard-table-section table th,
    .dashboard-table-section table td {
        padding: 0.625rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Très petits écrans - Dashboard */
@media (max-width: 380px) {
    .dashboard-kpis {
        grid-template-columns: 1fr;
    }

    .dashboard-stats-row {
        grid-template-columns: 1fr;
    }

    .kpi-card {
        flex-direction: row;
        align-items: center;
    }

    .kpi-value {
        font-size: 1.75rem;
    }

    .chart-body {
        height: 200px;
        padding: 0.75rem;
    }

    .chart-body-tall {
        height: 240px;
    }
}

/* ============================================
   Export Section
   ============================================ */
.export-section {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.export-section .btn {
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.export-section .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
    .export-section {
        justify-content: center;
    }

    .export-section .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   OPTIMISATIONS iOS & Android
   ============================================ */

/* Safe Area Insets pour iPhone avec notch */
@supports (padding: max(0px)) {
    .sidebar {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .main-content {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .modal-overlay {
        padding-top: max(2rem, env(safe-area-inset-top));
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }

    .toast-container {
        bottom: max(1.5rem, calc(env(safe-area-inset-bottom) + 1rem));
    }

    @media (max-width: 768px) {
        .header {
            padding-top: max(1rem, env(safe-area-inset-top));
        }

        .mobile-menu-btn {
            top: max(1rem, calc(env(safe-area-inset-top) + 0.5rem));
        }

        .sidebar {
            padding-top: max(0px, env(safe-area-inset-top));
        }
    }
}

/* Touch targets minimum 44px pour iOS/Android */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.25rem;
    }

    .btn-sm {
        min-height: 40px;
        padding: 0.625rem 1rem;
    }

    .action-btn {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
    }

    .check-box {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
    }

    .nav-item {
        min-height: 48px;
        padding: 0.875rem 1.25rem;
    }

    .nav-group-header {
        min-height: 48px;
        padding: 0.875rem 1.25rem;
    }

    .form-input,
    .form-select,
    .form-textarea {
        min-height: 48px;
        font-size: 16px; /* Empêche le zoom auto sur iOS */
        padding: 0.875rem 1rem;
    }

    .filter-select {
        min-height: 48px;
        font-size: 16px;
    }

    .search-box input {
        min-height: 48px;
        font-size: 16px;
        padding: 0.875rem 1rem 0.875rem 2.75rem;
    }

    .qty-btn {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
    }

    .password-toggle {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem;
    }

    .modal-close {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
    }

    /* Gantt touch improvements */
    .gantt-bar {
        min-height: 36px;
    }

    .gantt-row {
        min-height: 60px;
    }
}

/* Smooth scrolling mobile */
@media (max-width: 768px) {
    .sidebar-nav,
    .modal-body,
    .card-body,
    .gantt-container,
    .page-content {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    /* Prevent pull-to-refresh on specific elements */
    .gantt-container,
    .modal-body {
        overscroll-behavior: contain;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Fix input zoom iOS */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    textarea,
    select {
        font-size: 16px;
    }

    /* Fix iOS date input */
    input[type="date"] {
        -webkit-appearance: none;
        appearance: none;
    }

    /* Prevent overscroll bounce */
    html {
        overflow: hidden;
        height: 100%;
    }

    body {
        overflow: auto;
        height: 100%;
        -webkit-overflow-scrolling: touch;
    }
}

/* Mobile iOS/Android layout fix */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    .app {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .main-content {
        width: 100%;
        max-width: 100vw;
        margin-left: 0 !important;
        overflow-x: hidden;
    }

    .page-content {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .login-page {
        width: 100%;
        max-width: 100vw;
    }
}

/* Android specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: .001dpcm) {
    /* High DPI displays */
    .sidebar-logo-icon,
    .login-logo-icon {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Landscape mobile orientation */
@media (max-width: 896px) and (orientation: landscape) {
    .sidebar {
        width: 220px;
    }

    .modal-body {
        max-height: 50vh;
    }

    .login-card {
        max-width: 500px;
    }

    .login-header {
        padding: 1.5rem;
    }

    .login-form {
        padding: 1.25rem;
    }

    .dashboard-kpis {
        grid-template-columns: repeat(4, 1fr);
    }

    .dashboard-stats-row {
        grid-template-columns: repeat(4, 1fr);
    }

    .chart-body {
        height: 180px;
    }
}

/* PWA Standalone mode */
@media (display-mode: standalone) {
    .sidebar-footer {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .main-content {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
}

/* High contrast mode / Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .gantt-bar:hover {
        transform: none;
    }

    .btn:hover,
    .stat-card:hover,
    .action-btn:hover {
        transform: none;
    }
}

/* Dark mode support (respect system preference) */
@media (prefers-color-scheme: dark) {
    /* Optionnel: ajouter support dark mode si souhaité */
}

/* Print styles for mobile */
@media print {
    .sidebar,
    .mobile-menu-btn,
    .sidebar-overlay,
    .header-actions,
    .action-btns,
    .btn,
    .filters-bar,
    .export-section {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        max-width: 100%;
    }

    .page {
        display: block !important;
        page-break-inside: avoid;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Amélioration performance mobile */
@media (max-width: 768px) {
    /* Désactiver les effets lourds sur mobile */
    .card,
    .stat-card,
    .kpi-card,
    .btn {
        will-change: auto;
    }

    /* Containment agressif pour mobile */
    .page {
        contain: layout style paint;
    }

    .chart-card {
        contain: layout style;
    }

    /* Réduire les animations */
    .toast {
        animation-duration: 0.2s;
    }

    .modal {
        animation-duration: 0.2s;
    }

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

/* Fix scrollbar mobile */
@media (max-width: 768px) {
    /* Hide scrollbars but keep scroll functionality */
    .sidebar-nav::-webkit-scrollbar,
    .gantt-container::-webkit-scrollbar {
        width: 0;
        height: 0;
    }

    /* Show thin scrollbar for card-body */
    .card-body::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }

    .card-body::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 4px;
    }
}

/* Verif boxes mobile - plus grande zone tactile */
@media (max-width: 768px) {
    .verif-boxes {
        gap: 6px;
    }

    .verif-item .check-box {
        width: 40px;
        height: 40px;
        border-radius: 8px;
        font-size: 1.1rem;
    }

    .verif-label {
        font-size: 0.6rem;
        margin-top: 2px;
    }
}

/* Badge mobile */
@media (max-width: 768px) {
    .badge {
        padding: 0.25rem 0.625rem;
        font-size: 0.65rem;
    }

    .nav-item-badge {
        padding: 2px 6px;
        font-size: 0.6rem;
        min-width: 18px;
    }
}

/* Cards mobile amélioration */
@media (max-width: 768px) {
    .card {
        border-radius: var(--radius);
        margin-bottom: 1rem;
    }

    .card-title {
        font-size: 0.85rem;
    }

    /* Scroll horizontal tables */
    .card-body table {
        min-width: 600px;
    }

    /* NC/Stock tables - plus compact */
    #ncTable,
    #stockTable,
    #historiqueTable {
        min-width: 500px;
    }
}

/* Modal mobile full-screen optionnel */
@media (max-width: 480px) {
    .modal-overlay {
        padding: 0;
        align-items: stretch;
    }

    .modal {
        margin: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-width: 100%;
        min-height: 50vh;
        max-height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        flex: 1;
        max-height: none;
        overflow-y: auto;
    }

    .modal-footer {
        position: sticky;
        bottom: 0;
        background: var(--bg-secondary);
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    /* Plus d'espace pour les formulaires */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-row {
        gap: 1rem;
    }

    /* Calendrier très petit écran */
    .calendar-day {
        min-height: 50px;
        padding: 0.15rem;
    }

    .calendar-day-number {
        font-size: 0.6rem;
        margin-bottom: 0.1rem;
    }

    .calendar-events {
        max-height: 32px;
        gap: 1px;
    }

    .calendar-event {
        padding: 1px 2px;
        font-size: 0.5rem;
        border-radius: 2px;
    }

    .calendar-event-more {
        font-size: 0.5rem;
    }

    .calendar-controls .btn-primary {
        display: none;
    }

    .calendar-legend {
        display: none;
    }
}

/* ============================================
   Toggle Admin View - Switch pour voir toutes les donnees
   ============================================ */
.admin-view-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-right: 1rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: var(--transition);
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent);
}

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

.toggle-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.toggle-label.active {
    color: var(--accent);
    font-weight: 600;
}

@media (max-width: 768px) {
    .admin-view-toggle {
        padding: 0.25rem 0.5rem;
        margin-right: 0.5rem;
    }

    .toggle-label {
        display: none;
    }
}

/* ============================================
   Badge de version
   ============================================ */
.version-badge {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .version-badge {
        display: none;
    }
}

/* ============================================
   Alertes Livraisons
   ============================================ */
.alertes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.alerte-card {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    border-left: 4px solid;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.alerte-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.alerte-aujourdhui {
    border-left-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #fff 100%);
}

.alerte-urgent {
    border-left-color: #f97316;
    background: linear-gradient(135deg, #fff7ed 0%, #fff 100%);
}

.alerte-proche {
    border-left-color: #eab308;
    background: linear-gradient(135deg, #fefce8 0%, #fff 100%);
}

.alerte-normal {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #fff 100%);
}

.alerte-urgency {
    min-width: 90px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-top: 2px;
    flex-shrink: 0;
}

.alerte-aujourdhui .alerte-urgency { color: #ef4444; }
.alerte-urgent .alerte-urgency { color: #f97316; }
.alerte-proche .alerte-urgency { color: #eab308; }
.alerte-normal .alerte-urgency { color: #3b82f6; }

.alerte-content {
    flex: 1;
    min-width: 0;
}

.alerte-client {
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
    color: #1e293b;
}

.alerte-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.alerte-date {
    font-weight: 600;
    color: #475569;
}

.alerte-modules {
    color: #64748b;
}

.alerte-frigo {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.2rem;
}

.alerte-notes {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 0.3rem;
    font-style: italic;
}

.alertes-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@media (max-width: 768px) {
    .alerte-card {
        flex-direction: column;
        gap: 0.25rem;
    }

    .alerte-urgency {
        min-width: unset;
    }
}

/* ============================================
   Mode lecture seule (Viewer)
   ============================================ */
.readonly-mode .action-btn,
.readonly-mode .btn-add,
.readonly-mode .fab,
.readonly-mode .qty-control,
.readonly-mode .card-header .btn-primary,
.readonly-mode .card-header .btn-outline {
    display: none !important;
}

.readonly-mode .action-btns {
    visibility: hidden;
}

/* Badge indicateur mode lecture seule */
.readonly-mode .main-content::before {
    content: 'Mode lecture seule';
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--warning);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ============================================
   Bandeau de mise à jour
   ============================================ */
#updateBanner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.update-banner {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.update-banner span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.update-banner button {
    background: white;
    color: #3b82f6;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.update-banner button:hover {
    background: #f0f9ff;
    transform: scale(1.05);
}

.update-banner button.dismiss {
    background: transparent;
    color: white;
    padding: 0.25rem 0.5rem;
    font-size: 1.1rem;
    opacity: 0.8;
}

.update-banner button.dismiss:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .update-banner {
        flex-wrap: wrap;
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .update-banner button {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* ============================================
   Bloc-notes Styles
   ============================================ */

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.note-card {
    background: var(--card);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    min-height: 150px;
    position: relative;
}

.note-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.note-card-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    margin: 0;
    flex: 1;
    word-break: break-word;
}

.note-card-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.note-card:hover .note-card-actions {
    opacity: 1;
}

.note-card-btn {
    background: transparent;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.note-card-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
}

.note-card-btn.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.note-card-content {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    white-space: pre-wrap;
    word-break: break-word;
}

.note-card-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.note-card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Modal Note */
.note-textarea {
    min-height: 250px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;
}

.note-colors {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.note-color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.note-color-btn:hover {
    transform: scale(1.1);
}

.note-color-btn.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* Message aucune note */
.no-data-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    text-align: center;
}

.no-data-message svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-data-message p {
    margin: 0.25rem 0;
}

.no-data-message .text-muted {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Modal large */
.modal.modal-lg {
    max-width: 600px;
    width: 95%;
}

/* Visualisation note */
.note-view-content {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    min-height: 200px;
    max-height: 60vh;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
    font-size: 0.95rem;
}

.note-view-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

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

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

    .note-card-actions {
        opacity: 1;
    }

    .note-textarea {
        min-height: 200px;
    }
}

/* ============================================
   Planning Phasage EXKAL - Refonte complète
   ============================================ */

/* Header style sidebar (bleu foncé/anthracite) */
.phasage-header {
    background: linear-gradient(180deg, #0a0f1a 0%, #111827 50%, #0f172a 100%);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    color: #fff;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.phasage-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.phasage-header-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.phasage-logo {
    height: 38px;
    width: auto;
    filter: brightness(0) invert(1);
}

.phasage-header-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
}

.phasage-header-date {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.08);
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

.phasage-header-info {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 2fr;
    gap: 1rem;
}

.phasage-info-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.phasage-info-group label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

.phasage-info-wide {
    grid-column: span 1;
}

.phasage-header-input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 0.625rem 0.875rem;
    color: #fff;
    font-size: 0.95rem;
    width: 100%;
    transition: all 0.2s ease;
}

.phasage-header-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.phasage-header-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Actions Phasage */
.phasage-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.phasage-actions .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
}

/* Card et container table */
.phasage-card {
    margin-top: 0;
}

.phasage-card-body {
    padding: 0 !important;
}

/* Table wrapper avec scroll horizontal et vertical */
.phasage-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 65vh;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius) var(--radius) 0 0;
    border: 1px solid #E5E7EB;
}

/* Table de phasage - LISIBLE */
.phasage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 1200px;
    table-layout: fixed;
}

/* En-têtes du tableau - FOND NOIR, texte blanc, STICKY */
.phasage-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.phasage-thead-row {
    background: #000000 !important;
}

.phasage-thead-row th {
    padding: 0.875rem 0.75rem;
    text-align: left;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #FFFFFF !important;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    vertical-align: middle;
    height: 48px;
    background: #000000 !important;
}

.phasage-thead-row th:last-child {
    border-right: none;
}

.phasage-th-drag {
    width: 32px !important;
    min-width: 32px;
    max-width: 32px;
    padding: 0 !important;
    text-align: center;
}

/* Corps du tableau */
.phasage-table tbody tr {
    transition: background 0.15s ease;
    height: 44px;
    min-height: 44px;
}

.phasage-table tbody tr:nth-child(even):not([class*="phasage-phase-"]) {
    background-color: #f8fafc;
}

.phasage-table tbody tr:hover:not(.dragging) {
    background-color: #F0F4F8 !important;
}

.phasage-table tbody tr:active {
    /* Style actif géré par le drag handle */
}

.phasage-table tbody tr.dragging {
    opacity: 0.5;
    background: var(--accent-light) !important;
}

.phasage-table tbody tr.drag-over {
    border-top: 3px solid var(--accent);
}

/* Surbrillance ligne nouvelle/en cours d'édition */
.phasage-table tbody tr.phasage-row-highlight {
    outline: 3px solid #3B82F6 !important;
    outline-offset: -1px;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
    animation: phasage-highlight-pulse 1.5s ease-in-out;
}

@keyframes phasage-highlight-pulse {
    0% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.6); }
    50% { box-shadow: 0 0 8px rgba(59, 130, 246, 0.3); }
    100% { box-shadow: 0 0 12px rgba(59, 130, 246, 0.4); }
}

/* Garder la surbrillance quand un input de la ligne a le focus */
.phasage-table tbody tr:focus-within {
    outline: 2px solid #3B82F6 !important;
    outline-offset: -1px;
}

.phasage-table td {
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid #E5E7EB;
    vertical-align: middle;
    font-size: 13px;
}

/* Inputs du tableau - fond blanc, bordure visible */
.phasage-input {
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: 1px solid #D0D0D0;
    border-radius: 4px;
    background: #FFFFFF;
    font-size: 13px;
    font-family: inherit;
    color: #1A1A1A;
    transition: all 0.15s ease;
}

.phasage-input::placeholder {
    color: #999999;
    opacity: 1;
}

.phasage-input:hover {
    border-color: #B0B0B0;
    background: #FFFFFF;
}

.phasage-input:focus {
    outline: none;
    background: #FFFFFF;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.phasage-input-reperes {
    font-weight: 700;
    text-align: center;
}

/* Input date - style cohérent */
.phasage-input[type="date"] {
    color: #1A1A1A;
}

.phasage-input[type="date"]::-webkit-datetime-edit-text,
.phasage-input[type="date"]::-webkit-datetime-edit-month-field,
.phasage-input[type="date"]::-webkit-datetime-edit-day-field,
.phasage-input[type="date"]::-webkit-datetime-edit-year-field {
    color: #1A1A1A;
}

.phasage-input[type="date"]:invalid::-webkit-datetime-edit {
    color: #999999;
}

/* Cellule du drag handle */
.phasage-drag-cell {
    width: 32px !important;
    min-width: 32px;
    max-width: 32px;
    padding: 0 !important;
    text-align: center;
}

/* Handle de drag - visible et cliquable */
.phasage-drag-handle {
    cursor: grab;
    padding: 8px 4px;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    border-radius: 4px;
    margin: 2px;
}

.phasage-drag-handle:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.08);
}

.phasage-drag-handle:active {
    cursor: grabbing;
    background: rgba(59, 130, 246, 0.15);
    color: #3B82F6;
}

/* Première cellule (drag) */
.phasage-table tbody td:first-child {
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    padding: 0 !important;
    text-align: center;
}

/* Actions sur lignes */
.phasage-row-actions {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.phasage-row-actions .action-btn {
    width: 32px;
    height: 32px;
}

/* ============================================
   Couleurs de phase (fond + texte Repères)
   ============================================ */
.phasage-phase-1 { background-color: #FFFFFF !important; }
.phasage-phase-1 .phasage-input-reperes { color: #CC0000 !important; }

.phasage-phase-2 { background-color: #C6EFCE !important; }
.phasage-phase-2 .phasage-input-reperes { color: #003399 !important; }

.phasage-phase-3 { background-color: #BDD7EE !important; }
.phasage-phase-3 .phasage-input-reperes { color: #006600 !important; }

.phasage-phase-4 { background-color: #FCE4D6 !important; }
.phasage-phase-4 .phasage-input-reperes { color: #7030A0 !important; }

.phasage-phase-5 { background-color: #FFF2CC !important; }
.phasage-phase-5 .phasage-input-reperes { color: #833C0B !important; }

.phasage-phase-6 { background-color: #E2D9F3 !important; }
.phasage-phase-6 .phasage-input-reperes { color: #C00000 !important; }

.phasage-phase-7 { background-color: #FCE4EC !important; }
.phasage-phase-7 .phasage-input-reperes { color: #00626E !important; }

.phasage-phase-8 { background-color: #D5F5E3 !important; }
.phasage-phase-8 .phasage-input-reperes { color: #BF6900 !important; }

.phasage-phase-9 { background-color: #E8E8E8 !important; }
.phasage-phase-9 .phasage-input-reperes { color: #1A1A1A !important; }

/* ============================================
   Liste des Plannings et Archives
   ============================================ */
.phasage-liste-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.phasage-item {
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s ease;
}

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

.phasage-item-header {
    background: linear-gradient(180deg, #0a0f1a 0%, #111827 100%);
    padding: 1rem 1.25rem;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.phasage-item-header.archived {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
}

.phasage-item-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.phasage-item-meta {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.phasage-item-body {
    padding: 1.25rem;
}

.phasage-item-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.phasage-item-info-block {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.phasage-item-info-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    font-weight: 600;
}

.phasage-item-info-value {
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 500;
}

.phasage-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.phasage-item-actions .btn {
    flex: 1;
    min-width: 110px;
    justify-content: center;
}

/* ============================================
   Modal Visualisation Planning
   ============================================ */
.phasage-view-header {
    background: linear-gradient(180deg, #0a0f1a 0%, #111827 100%);
    padding: 1.25rem 1.5rem;
    color: #fff;
}

.phasage-view-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.phasage-view-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.phasage-view-info {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.phasage-view-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.phasage-view-info-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
}

.phasage-view-info-value {
    font-size: 0.9rem;
    color: #fff;
    font-weight: 500;
}

/* Table en lecture seule */
.phasage-view-table-wrapper {
    overflow-x: auto;
    padding: 0;
}

.phasage-view-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 900px;
}

.phasage-view-table th {
    background: #2D5F2D;
    color: #fff;
    padding: 0.75rem 0.625rem;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.phasage-view-table td {
    padding: 0.625rem;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.phasage-view-table .reperes-cell {
    font-weight: 700;
    text-align: center;
}

/* ============================================
   Export PDF
   ============================================ */
#phasagePdfContent {
    position: absolute;
    left: -9999px;
    top: 0;
    width: 297mm;
    background: #fff;
}

/* ============================================
   Responsive Phasage
   ============================================ */
@media (max-width: 1024px) {
    .phasage-header-info {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .phasage-header-top {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .phasage-header-info {
        grid-template-columns: 1fr;
    }

    .phasage-info-wide {
        grid-column: span 1;
    }

    .phasage-actions {
        flex-direction: column;
    }

    .phasage-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .phasage-item-actions .btn {
        flex: 1 1 100%;
    }

    .phasage-view-info {
        grid-template-columns: 1fr 1fr;
    }
}
