:root {
    /* Palette institutionnelle neutre (modifiable ici uniquement) */
    --app-blue: #1F4E79;
    --app-blue-dark: #163A5C;
    --app-blue-clair: #2F6EA8;
    --app-orange: #C8963E;
    --app-orange-dark: #A87A2C;
}

body {
    background-color: #f4f7fb;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: #1f2937;
}

.app-navbar {
    background: linear-gradient(90deg, var(--app-blue-dark), var(--app-blue));
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}
.app-navbar .navbar-brand { display: flex; align-items: center; gap: .5rem; }
.app-navbar .navbar-brand img { height: 34px; width: 34px; border-radius: 6px; object-fit: contain; }
.app-navbar .nav-link { font-weight: 500; white-space: nowrap; }
.app-navbar .nav-link:hover { color: #f2d9a8 !important; }

a { color: var(--app-blue); }

.btn-primary {
    background-color: var(--app-blue);
    border-color: var(--app-blue);
}
.btn-primary:hover {
    background-color: var(--app-blue-dark);
    border-color: var(--app-blue-dark);
}
.btn-outline-primary { color: var(--app-blue); border-color: var(--app-blue); }
.btn-outline-primary:hover { background-color: var(--app-blue); border-color: var(--app-blue); }

.btn-accent {
    background-color: var(--app-orange);
    border-color: var(--app-orange);
    color: #fff;
}
.btn-accent:hover { background-color: var(--app-orange-dark); border-color: var(--app-orange-dark); color:#fff; }

.card {
    border: none;
    border-radius: .6rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}

.stat-card { border-left: 4px solid var(--app-blue); }
.stat-card .stat-nombre { font-size: 2rem; font-weight: 700; }
.stat-card .stat-libelle { color: #6b7280; font-size: .85rem; text-transform: uppercase; }

/* Bandeau couleur des tâches */
.tache-bandeau { border-left: 5px solid transparent; }
.bandeau-vert   { border-left-color: #198754; }
.bandeau-orange { border-left-color: #E8983C; }
.bandeau-rouge  { border-left-color: #dc3545; }
.bandeau-gris   { border-left-color: #6c757d; }
.bandeau-bleu   { border-left-color: #4A90D9; }

.pastille {
    display: inline-block; width: 12px; height: 12px; border-radius: 50%;
    margin-right: 4px; vertical-align: middle;
}
.pastille-vert { background: #198754; }
.pastille-orange { background: #E8983C; }
.pastille-rouge { background: #dc3545; }
.pastille-gris { background: #6c757d; }
.pastille-bleu { background: #4A90D9; }

.progress { height: 18px; background-color: #e5e7eb; }

.journal-entree {
    border-left: 3px solid var(--app-orange);
    background: #f8fafc;
    padding: .75rem 1rem;
    margin-bottom: .5rem;
    border-radius: 0 .4rem .4rem 0;
}

.connexion-wrapper {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--app-blue-dark), var(--app-blue-clair));
}
.connexion-card { width: 100%; max-width: 400px; }
.connexion-logo { height: 84px; width: 84px; object-fit: contain; }
.app-titre { color: var(--app-blue); }

.table thead { background: linear-gradient(90deg, var(--app-blue-dark), var(--app-blue)); color: #fff; }

.badge.bg-warning { color: #4a3000 !important; }

/* Messages affichés dans la fenêtre popup (fermée par OK) */
.app-msg-list { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.3rem; }
.app-msg {
    display: flex; align-items: flex-start; gap: .6rem;
    padding: .75rem .9rem; border-radius: .45rem;
    border-left: 5px solid; background: #f8fafc; color: #1f2937;
    font-weight: 500; line-height: 1.35;
}
.app-msg i { font-size: 1.2rem; line-height: 1.2; }
.app-msg a { font-weight: 700; }
.app-msg-success { border-left-color: #198754; } .app-msg-success i { color: #198754; }
.app-msg-danger  { border-left-color: #dc3545; } .app-msg-danger i { color: #dc3545; }
.app-msg-warning { border-left-color: #E8983C; } .app-msg-warning i { color: #E8983C; }
.app-msg-info    { border-left-color: #2E6DB4; } .app-msg-info i { color: #2E6DB4; }

/* Popup de confirmation interne (remplace window.confirm du navigateur) */
.app-modal-overlay {
    position: fixed; inset: 0; z-index: 1300;
    background: rgba(0, 0, 0, .45);
    display: flex; align-items: center; justify-content: center;
    animation: appFade .2s ease;
}
.app-modal-overlay[hidden] { display: none; }
@keyframes appFade { from { opacity: 0; } to { opacity: 1; } }
.app-modal {
    background: #fff; border-radius: .7rem; padding: 1.4rem;
    max-width: 420px; width: 90%;
    box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, .35);
}
.app-modal-title { font-weight: 700; margin-bottom: .6rem; color: var(--app-blue-dark); }
.app-modal-body { margin-bottom: 1.2rem; color: #374151; }
.app-modal-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* ===================== Catégories de tâche ===================== */
.cat-badge {
    display: inline-flex; align-items: center; gap: .25rem;
    font-size: .75rem; font-weight: 600; line-height: 1;
    padding: .3rem .55rem; border-radius: 999px;
    border: 1px solid currentColor; background: #fff; white-space: nowrap;
}
.cat-urgente      { --cat: #c0262d; --cat-bg: #fde8e9; }
.cat-prioritaire  { --cat: #c2650a; --cat-bg: #fff1e0; }
.cat-reglementaire{ --cat: #6d28d9; --cat-bg: #efe9fc; }
.cat-sav          { --cat: #0e7490; --cat-bg: #e0f4f8; }
.cat-habituelle   { --cat: #1F4E79; --cat-bg: #e6eef6; }
.cat-facultative  { --cat: #6b7280; --cat-bg: #f1f2f4; }
.cat-badge { color: var(--cat); background: var(--cat-bg); }
.cat-badge.cat-urgente { background: #c0262d; color: #fff; border-color: #c0262d; }

/* Sélecteur de catégorie dans le formulaire */
.cat-choix { display: flex; flex-wrap: wrap; gap: .5rem; }
.cat-option {
    display: inline-flex; align-items: center; gap: .35rem; cursor: pointer;
    padding: .45rem .8rem; border-radius: .5rem; font-weight: 500; font-size: .9rem;
    border: 2px solid var(--cat-bg); color: var(--cat); background: #fff;
    transition: all .15s ease; user-select: none;
}
.cat-option:hover { background: var(--cat-bg); }
.btn-check:checked + .cat-option { background: var(--cat); border-color: var(--cat); color: #fff; }
.btn-check:focus-visible + .cat-option { outline: 3px solid rgba(46,109,180,.35); outline-offset: 1px; }

/* ===================== Dictée vocale ===================== */
.dictee-btn.en-ecoute { background: #dc3545; border-color: #dc3545; color: #fff; }
.dictee-btn.en-ecoute i { animation: dicteePulse 1.1s infinite; }
.dictee-panel {
    margin-top: .5rem; padding: .8rem; border-radius: .5rem;
    background: #fffaf3; border: 1px solid #f3d9b5; border-left: 4px solid var(--app-orange);
}
.dictee-panel.en-ecoute { border-left-color: #dc3545; }
.dictee-entete { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.dictee-etat { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; font-size: .9rem; color: #374151; }
.dictee-point { width: 10px; height: 10px; border-radius: 50%; background: #9ca3af; }
.dictee-panel.en-ecoute .dictee-point { background: #dc3545; animation: dicteePulse 1.1s infinite; }
.dictee-aide { margin-bottom: .5rem; }
.dictee-texte[readonly] { background: #fff; }
.dictee-interim { min-height: 1.2rem; color: #6b7280; font-style: italic; margin-top: .3rem; }
.dictee-message { min-height: 1rem; margin: .2rem 0; }
.dictee-actions { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-top: .3rem; }
.dictee-note { margin-top: .5rem; }
.dictee-insere { box-shadow: 0 0 0 .25rem rgba(25,135,84,.35) !important; transition: box-shadow .3s; }
@keyframes dicteePulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ===================== Droits d'accès ===================== */
.droits-groupe { border: 1px solid #e5e7eb; border-radius: .5rem; margin-bottom: 1rem; }
.droits-groupe-titre {
    display: flex; justify-content: space-between; align-items: center;
    padding: .6rem .9rem; background: #f4f7fb; border-bottom: 1px solid #e5e7eb;
    border-radius: .5rem .5rem 0 0; font-weight: 600; color: var(--app-blue-dark);
}
.droit-ligne { display: flex; gap: .8rem; align-items: flex-start; padding: .65rem .9rem; border-bottom: 1px solid #f1f2f4; }
.droit-ligne:last-child { border-bottom: none; }
.droit-ligne .form-check-input { width: 2.4em; height: 1.25em; margin-top: .15rem; flex-shrink: 0; cursor: pointer; }
.droit-ligne label { cursor: pointer; flex: 1; }
.droit-defaut { font-size: .7rem; }
.droits-barre {
    position: sticky; bottom: 0; z-index: 5; background: #fff;
    border-top: 1px solid #e5e7eb; padding: .75rem 0; margin-top: .5rem;
}

/* ===================== Popup flottante des messages ===================== */
.app-modal-messages { max-width: 480px; }
.app-modal-messages .app-msg-list { max-height: 60vh; overflow-y: auto; }
.app-modal-title { display: flex; align-items: center; gap: .45rem; font-size: 1.05rem; }
.app-modal { animation: appPop .18s ease-out; }
@keyframes appPop { from { transform: translateY(12px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===================== Mise en page générale ===================== */
.section-titre { text-transform: uppercase; font-size: .78rem; letter-spacing: .04em;
    color: #6b7280; font-weight: 700; margin-bottom: .8rem; }
.texte-multiligne { white-space: pre-line; }
.ligne-cliquable { cursor: pointer; }
.info-liste dt { font-weight: 500; color: #6b7280; }
.info-liste dd { margin-bottom: .35rem; }
.journal-auto { border-left-color: #9ca3af; background: #f9fafb; font-size: .92rem; }

/* ===================== Lieu d'exécution ===================== */
.lieu-badge { display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem;
    font-weight: 600; padding: .28rem .55rem; border-radius: 999px; white-space: nowrap;
    color: var(--lieu); background: var(--lieu-bg); border: 1px solid var(--lieu-bg); }
.lieu-bureau   { --lieu: #1F4E79; --lieu-bg: #e6eef6; }
.lieu-chantier { --lieu: #8a5a12; --lieu-bg: #fbefd9; }
.lieu-mixte    { --lieu: #0f766e; --lieu-bg: #dcf3ef; }
.lieu-choix { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; }
.lieu-option { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; padding: .7rem .8rem;
    border: 2px solid var(--lieu-bg); border-radius: .6rem; background: #fff; color: var(--lieu);
    transition: all .15s ease; height: 100%; }
.lieu-option i { font-size: 1.4rem; }
.lieu-option small { display: block; color: #6b7280; font-size: .75rem; line-height: 1.25; }
.lieu-option:hover { background: var(--lieu-bg); }
.btn-check:checked + .lieu-option { border-color: var(--lieu); background: var(--lieu-bg); box-shadow: 0 0 0 2px var(--lieu-bg); }

/* ===================== Équipe ===================== */
.equipe { display: inline-flex; align-items: center; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
    border-radius: 50%; background: #e5e7eb; color: #374151; font-size: .72rem; font-weight: 700;
    border: 2px solid #fff; flex-shrink: 0; }
.equipe .avatar + .avatar { margin-left: -8px; }
.avatar-pilote { background: var(--app-blue); color: #fff; }
.avatar-plus { background: #f3f4f6; color: #6b7280; }
.equipe-liste li { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid #f1f2f4; }
.equipe-liste li:last-child { border-bottom: none; }
.membres-liste { max-height: 260px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: .5rem; }
.membre-ligne { display: flex; align-items: center; gap: .6rem; padding: .45rem .7rem; margin: 0;
    border-bottom: 1px solid #f1f2f4; cursor: pointer; }
.membre-ligne:last-child { border-bottom: none; }
.membre-ligne:hover { background: #f8fafc; }
.membre-ligne.est-pilote { background: #eef4fa; cursor: not-allowed; }
.membre-ligne .form-check-input { margin-top: 0; }

/* ===================== Blocages ===================== */
.carte-bloquee { box-shadow: 0 0 0 2px rgba(220, 53, 69, .35); }
.bloque-badge { font-weight: 600; }
.blocage-carte { border: 1px solid #e5e7eb; border-left: 5px solid #dc3545; border-radius: .5rem;
    padding: .9rem 1rem; margin-bottom: .9rem; background: #fff; scroll-margin-top: 80px; }
.blocage-carte:last-child { margin-bottom: 0; }
.blocage-en_traitement { border-left-color: #E8983C; }
.blocage-leve { border-left-color: #198754; background: #fbfdfb; }
.blocage-annule { border-left-color: #9ca3af; background: #fafafa; opacity: .85; }
.blocage-surligne { animation: blocSurligne 2.2s ease; }
@keyframes blocSurligne { 0%, 40% { box-shadow: 0 0 0 4px rgba(200,150,62,.55); } 100% { box-shadow: none; } }
.chrono { list-style: none; padding-left: 0; margin: 0; border-left: 2px solid #e5e7eb; margin-left: .6rem; }
.chrono li { display: flex; gap: .6rem; position: relative; padding: 0 0 .7rem .9rem; }
.chrono li > i { position: absolute; left: -.72rem; top: 0; width: 1.3rem; height: 1.3rem; border-radius: 50%;
    background: #fff; display: flex; align-items: center; justify-content: center; font-size: .8rem; }
.chrono-danger > i { color: #dc3545; } .chrono-warning > i { color: #d97706; }
.chrono-info > i { color: var(--app-blue); } .chrono-success > i { color: #198754; }
.chrono-secondary > i { color: #6b7280; }

/* ===================== Projets ===================== */
.projet-code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; font-size: .8rem;
    color: var(--app-blue); background: #e6eef6; padding: .15rem .45rem; border-radius: .3rem; }
.projet-carte { transition: transform .12s ease, box-shadow .12s ease; }
.projet-carte:hover { transform: translateY(-2px); box-shadow: 0 .4rem 1rem rgba(0,0,0,.08); }

.modal-content { border: none; border-radius: .7rem; }

/* ===================== Gestion de projet : onglets, phases ===================== */
.onglets-projet { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.onglets-projet .nav-link { white-space: nowrap; font-size: .88rem; color: #4b5563; padding: .5rem .75rem; }
.onglets-projet .nav-link.active { color: var(--app-blue); font-weight: 600; border-top: 3px solid var(--app-orange); }
.phases { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.phase { display: flex; gap: .6rem; align-items: center; background: #fff; border-radius: .6rem;
    padding: .7rem .8rem; box-shadow: 0 1px 4px rgba(0,0,0,.06); border-bottom: 4px solid #e5e7eb; }
.phase-num { width: 30px; height: 30px; border-radius: 50%; background: #e5e7eb; color: #6b7280;
    display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.phase-faite { border-bottom-color: #198754; } .phase-faite .phase-num { background: #198754; color: #fff; }
.phase-courante { border-bottom-color: var(--app-orange); } .phase-courante .phase-num { background: var(--app-orange); color: #fff; }
@media (max-width: 992px) { .phases { grid-template-columns: 1fr 1fr; } }
.tableau-cles th { font-weight: 500; color: #6b7280; width: 50%; }
.points-attention li { padding: .3rem 0; border-bottom: 1px solid #f1f2f4; }
.points-attention:has(li) + .vide-si-seul { display: none; }

/* ===================== Diagramme de Gantt ===================== */
.gantt { font-size: .85rem; }
.gantt-echelle { display: flex; justify-content: space-between; margin-left: 32%; color: #6b7280; font-size: .75rem; }
.gantt-ligne { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; border-bottom: 1px dashed #eef0f3; }
.gantt-libelle { width: 32%; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: #1f2937; text-decoration: none; }
.gantt-piste { position: relative; flex: 1; height: 26px; background: #f8fafc; border-radius: 4px; overflow: hidden; }
.gantt-base { position: absolute; top: 18px; height: 5px; background: #9ca3af; border-radius: 3px; opacity: .8; }
.gantt-barre { position: absolute; top: 3px; height: 13px; border-radius: 4px; opacity: .45; overflow: hidden; }
.gantt-barre span { display: block; height: 100%; background: rgba(0,0,0,.45); }
.gantt-aujourdhui { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #dc3545; z-index: 2; }
.legende-base, .legende-barre, .legende-jour { display: inline-block; width: 18px; height: 6px; vertical-align: middle; border-radius: 2px; }
.legende-base { background: #9ca3af; } .legende-barre { background: #198754; opacity: .5; height: 10px; } .legende-jour { width: 2px; height: 12px; background: #dc3545; }
@media (max-width: 768px) { .gantt-libelle { width: 40%; } .gantt-echelle { margin-left: 40%; } }

/* ===================== Documents imprimables ===================== */
.logo-doc { height: 60px; }
@media print {
    .app-navbar, .no-print, footer, .breadcrumb, .btn, .app-modal-overlay, .dictee-panel, .dictee-btn { display: none !important; }
    body { background: #fff; } main { padding: 0 !important; }
    .card { box-shadow: none !important; border: none !important; }
    .document-imprimable { font-size: 11pt; }
}

/* =========================================================================
   V3 — Version entreprise : suivi partagé avec le maître d'ouvrage
   ========================================================================= */
.onglets-groupes { display: flex; flex-direction: column; gap: .35rem; }
.onglets-groupe-titre { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
    color: #6b7280; font-weight: 600; margin-bottom: .1rem; }
.onglets-groupe:nth-child(2) .onglets-projet .nav-link.active { border-top-color: #0d9488; }
.onglets-groupe:nth-child(2) .onglets-groupe-titre { color: #0d9488; }

.obs-mo { background: #f0f7ff; border-left: 3px solid var(--app-blue-clair); padding: .3rem .5rem;
    border-radius: .25rem; color: #1e3a5f; }
.texte-multiligne { white-space: pre-line; }

.journal-jour { border: 1px solid #e5e7eb; border-left: 4px solid var(--app-blue); border-radius: .45rem;
    padding: .6rem .8rem; margin-bottom: .6rem; background: #fff; }
.journal-intemperie { border-left-color: var(--app-orange); background: #fffaf0; }

.courbe { display: flex; align-items: flex-end; gap: .6rem; height: 160px; padding: .5rem 0; overflow-x: auto; }
.courbe-col { display: flex; flex-direction: column; align-items: center; min-width: 38px; height: 100%; }
.courbe-barres { flex: 1; width: 100%; display: flex; align-items: flex-end; gap: 3px;
    border-bottom: 1px solid #d1d5db; }
.courbe-barres > div { flex: 1; border-radius: 3px 3px 0 0; min-height: 2px; }
.barre-declare, .legende-declare { background: var(--app-orange); }
.barre-mo, .legende-mo { background: #0d9488; }
.legende-declare, .legende-mo { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }

.photo-carte img { width: 100%; height: 170px; object-fit: cover; border-radius: .375rem .375rem 0 0; }
.photo-vide { height: 170px; display: flex; align-items: center; justify-content: center; font-size: 2.5rem;
    color: #cbd5e1; background: #f8fafc; }
.photo-carte .d-flex.justify-content-end { justify-content: flex-start !important; }

.pilotage-chiffres { display: flex; gap: 1rem; flex-wrap: wrap; text-align: center; }
.pilotage-chiffres > div { min-width: 72px; }
.pilotage-chiffres span { display: block; font-size: 1.15rem; font-weight: 700; color: var(--app-blue); }
.pilotage-chiffres .text-danger span { color: #dc3545; }
.pilotage-chiffres small { color: #6b7280; font-size: .72rem; }
.liste-actions li { padding: .15rem 0; }
.cases-mo ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 1rem; }
