:root {
    --primaire: #d97706;
    --primaire-fonce: #b45309;
    --sidebar-bg: #1c2333;
    --sidebar-texte: #b6bfd4;
    --sidebar-actif: #2a3348;
    --fond: #f4f5f7;
    --carte: #ffffff;
    --surface-alt: #f4f5f7;
    --bordure: #e5e7eb;
    --texte: #1f2430;
    --texte-doux: #6b7280;
    --vert: #16a34a;
    --rouge: #dc2626;
    --ambre: #d97706;
    --bleu: #2563eb;
    --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--fond); color: var(--texte); font-size: 14px; }
a { color: inherit; text-decoration: none; }
i[data-lucide] { width: 18px; height: 18px; display: inline-block; vertical-align: middle; }

/* ── LAYOUT ── */
.layout { display: flex; min-height: 100vh; }
.content { flex: 1; padding: 28px 32px; max-width: 100%; }

/* ── SIDEBAR ── */
.sidebar { width: 250px; background: var(--sidebar-bg); color: var(--sidebar-texte); display: flex; flex-direction: column; flex-shrink: 0; min-height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; font-weight: 800; font-size: 15px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-nav { flex: 1; padding: 12px 10px; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar-nav a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 500; margin-bottom: 1px; line-height: 1.3; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.actif { background: var(--primaire); color: #fff; }
.sidebar-nav a i[data-lucide] { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Repères de section (non cliquables, toujours visibles) ── */
.sidebar-section-label { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--primaire); padding: 12px 12px 4px; }
.sidebar-section-label:first-child { padding-top: 4px; }

/* ── BLOC UTILISATEUR (bas de sidebar) ── */
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user .avatar-init { width: 34px; height: 34px; border-radius: 50%; background: var(--primaire); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; overflow: hidden; }
.sidebar-user .avatar-init img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user .infos { flex: 1; min-width: 0; }
.sidebar-user .infos a { display: block; }
.sidebar-user .nom { font-size: 12.5px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .role { font-size: 11px; opacity: .7; }
.sidebar-user > a { color: var(--sidebar-texte); flex-shrink: 0; }
.sidebar-user > a:hover { color: #fff; }

/* ── PAGE HEADER ── */
.page-header {
    margin-bottom: 22px; display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 14px;
    background: linear-gradient(135deg, #1c2333 0%, #3b2a5e 60%, #6b3fa0 100%);
    border-radius: 16px; padding: 24px 26px; color: #fff;
}
.page-header h1 { font-size: 1.5em; margin: 0 0 6px; color: #fff; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.page-header .sous-titre { color: rgba(255,255,255,.8); font-size: 13px; margin: 0; }
.page-header .sous-titre a { color: #fff; text-decoration: underline; }
.page-header .btn-secondaire { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.3); }
.page-header .btn-secondaire:hover { background: rgba(255,255,255,.25); }
.page-header .badge { font-size: 12px; }

.panneau { background: var(--carte); border-radius: 14px; border: 1px solid var(--bordure); margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.02); }
.panneau-entete { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--bordure); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: #444; }
.barre-outils-liste {
    display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center;
    background: #fff; border: 1px solid var(--bordure); border-radius: 14px; padding: 12px 16px;
}
.barre-outils-liste input[type="search"] { flex: 1; min-width: 200px; padding: 9px 14px; border-radius: 9px; border: 1px solid var(--bordure); font-size: 13px; background: #fafafa; }
.barre-outils-liste select { padding: 9px 12px; border-radius: 9px; border: 1px solid var(--bordure); font-size: 13px; background: #fafafa; }

.grille-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.carte-kpi {
    background: var(--carte); border-radius: 14px; border: 1px solid var(--bordure); padding: 18px;
    display: flex; align-items: center; gap: 14px; transition: transform .15s ease, box-shadow .15s ease;
}
a.carte-kpi:hover, .carte-kpi.carte-kpi-lien:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.1); text-decoration: none; color: inherit; }
.carte-kpi .icone { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.carte-kpi strong { display: block; font-size: 23px; font-weight: 800; line-height: 1.1; color: var(--texte); }
.carte-kpi span { font-size: 12px; color: var(--texte-doux); }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 9px; border: none; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-primaire { background: var(--primaire); color: #fff; }
.btn-primaire:hover { background: var(--primaire-fonce); }
.btn-secondaire { background: #fff; color: var(--texte); border: 1px solid var(--bordure); }
.btn-secondaire:hover { background: #f9fafb; }
.btn-danger { background: #fef2f2; color: var(--rouge); }
.btn-large { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }

/* ── TABLEAU ── */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-doux); padding: 10px 16px; border-bottom: 1px solid var(--bordure); }
.table td { padding: 12px 16px; border-bottom: 1px solid #f1f2f4; font-size: 13.5px; color: var(--texte); }
.table tr:last-child td { border-bottom: none; }
.table tr.ligne-cliquable:hover { background: #fafafb; cursor: pointer; }

/* ── BADGES ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-planifie { background: #eef2ff; color: #4338ca; }
.badge-en_cours { background: #fff7ed; color: var(--primaire-fonce); }
.badge-en_attente { background: #fef9c3; color: #854d0e; }
.badge-suspendu { background: #fef2f2; color: var(--rouge); }
.badge-termine { background: #f0fdf4; color: var(--vert); }
.badge-annule { background: #f3f4f6; color: #6b7280; }

/* ── BARRE DE PROGRESSION ── */
.progression { background: #eee; border-radius: 20px; height: 8px; overflow: hidden; width: 100%; }
.progression-remplie { background: var(--primaire); height: 100%; border-radius: 20px; }

/* ── FORMULAIRES ── */
.formulaire label { display: block; font-size: 12.5px; font-weight: 600; margin: 12px 0 5px; color: var(--texte); }
.formulaire label:first-child { margin-top: 0; }
.formulaire input, .formulaire select, .formulaire textarea {
    width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--bordure); font-size: 13.5px; font-family: inherit;
}
.formulaire input::placeholder, .formulaire textarea::placeholder { color: #9ca3af; }
.formulaire input:focus, .formulaire select:focus, .formulaire textarea:focus { outline: none; border-color: var(--primaire); }
.formulaire-ligne { display: flex; gap: 12px; }
.formulaire-ligne > div { flex: 1; }

/* ── LOGIN ── */
.page-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1c2333, #3a2f1a); }
.carte-login { background: #fff; border-radius: 16px; padding: 36px 34px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.carte-login-entete { text-align: center; margin-bottom: 24px; }
.logo-login { width: 52px; height: 52px; background: var(--primaire); border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; margin: 0 auto 14px; }
.carte-login-entete h1 { font-size: 18px; margin: 0 0 4px; }
.carte-login-entete p { color: var(--texte-doux); font-size: 13px; margin: 0; }
.carte-login-pied { text-align: center; font-size: 11.5px; color: var(--texte-doux); margin-top: 18px; }
.carte-login input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--bordure); background: #fff; color: var(--texte); font-size: 13.5px; }
.carte-login label { display: block; font-size: 12.5px; font-weight: 600; margin: 12px 0 5px; color: var(--texte); }

/* ── ALERTES / FLASH ── */
.alerte { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alerte-erreur { background: #fef2f2; color: var(--rouge); }
.conteneur-flash { position: fixed; top: 18px; right: 18px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 12px 18px; border-radius: 9px; font-size: 13px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.flash-succes { background: #16a34a; color: #fff; }
.flash-erreur { background: #dc2626; color: #fff; }

/* ── PASTILLES DE CRITICITÉ ── */
.pastille { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.pastille-normal { background: var(--vert); }
.pastille-risque { background: var(--ambre); }
.pastille-critique { background: var(--rouge); }

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; min-height: auto; flex-direction: row; align-items: center; }
    .sidebar-nav { padding: 8px; overflow-x: auto; }
    .sidebar-nav ul { display: flex; gap: 4px; }
    .sidebar-section-label { display: none; }
    .sidebar-user .infos { display: none; }
    .content { padding: 18px; }
    .grille-kpi { grid-template-columns: repeat(2, 1fr); }
}
