/* Cockpit Web — thème repris du portail intranet LBM-OUTILS-WEB (mêmes jetons de couleur, clair / sombre). */
:root {
  --bg: #f4f6f8; --panel: #ffffff; --panel-2: #f8fafb; --line: #e2e7ec; --text: #17212b; --muted: #5d6b78;
  --accent: #0b6bcb; --accent-ink: #ffffff; --accent-soft: #e6f0fb;
  --ok: #1d7a46; --ok-soft: #e3f4ea; --warn: #9a5b00; --warn-soft: #fdf1dc; --bad: #b42318; --bad-soft: #fdecea;
  --violet: #6b46c1; --violet-soft: #efe9fb; --orange: #c2410c; --orange-soft: #fdeee4;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141a; --panel: #151d25; --panel-2: #1a242e; --line: #26323e; --text: #e6edf3; --muted: #93a1ae;
    --accent: #4ea1ff; --accent-ink: #06111d; --accent-soft: #15283c;
    --ok: #4cc38a; --ok-soft: #12291e; --warn: #f0b44c; --warn-soft: #2d230f; --bad: #ff7b72; --bad-soft: #2f1615;
    --violet: #b197fc; --violet-soft: #241b3a; --orange: #fb923c; --orange-soft: #2f1c10;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0; }
h3 { font-size: 13px; margin: 0; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); }
.petit { font-size: 12.5px; }
.erreur { color: var(--bad); min-height: 1.2em; }
.vide { color: var(--muted); padding: 14px 16px; font-style: italic; }

/* ---------- barre du haut */
header.top { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.marque { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; color: var(--text); white-space: nowrap; }
.marque:hover { text-decoration: none; }
.logo { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
header.top nav { display: flex; gap: 2px; margin-left: 8px; overflow-x: auto; scrollbar-width: none; }
header.top nav a { padding: 6px 11px; border-radius: 7px; color: var(--muted); font-weight: 500; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
header.top nav a:hover { text-decoration: none; background: var(--panel-2); color: var(--text); }
header.top nav a.actif { background: var(--accent-soft); color: var(--accent); }
.pastille { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.droite { margin-left: auto; display: flex; gap: 8px; align-items: center; }
main.page { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
.entete { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.entete .titre { margin-right: auto; display: flex; flex-direction: column; gap: 2px; }

/* ---------- boutons et champs */
button, .btn { font: inherit; font-weight: 600; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 6px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--accent); text-decoration: none; }
button.primaire { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primaire:hover { filter: brightness(1.08); }
button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); }
button.lien { border: 0; background: none; padding: 2px 4px; color: var(--accent); font-weight: 500; }
button.petit { padding: 3px 8px; font-size: 12.5px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { width: 100%; min-height: 90px; resize: vertical; line-height: 1.5; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
input[type=range] { padding: 0; accent-color: var(--accent); }
.recherche { width: 240px; }

/* ---------- puces */
.puce { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.puce.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.puce.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.puce.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.puce.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.puce.violet { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.puce.orange { background: var(--orange-soft); color: var(--orange); border-color: transparent; }
.filtres { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filtres button { border-radius: 999px; padding: 4px 12px; font-weight: 500; }
.filtres button.actif { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- panneaux */
.panneau { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panneau > .tete { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panneau > .tete h2 { margin-right: auto; display: flex; align-items: center; gap: 8px; }
.panneau > .corps { padding: 14px 16px; }
.grille-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.colonne { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tuile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; color: var(--text); box-shadow: var(--shadow); }
.tuile:hover { text-decoration: none; border-color: var(--accent); }
.tuile .n { font-size: 26px; font-weight: 700; line-height: 1.1; }
.tuile .l { color: var(--muted); font-size: 12.5px; }
.tuile.bad .n { color: var(--bad); } .tuile.warn .n { color: var(--warn); } .tuile.ok .n { color: var(--ok); }

/* ---------- listes */
.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { display: flex; align-items: flex-start; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.liste > li:last-child { border-bottom: 0; }
.liste > li.cliquable { cursor: pointer; }
.liste > li.cliquable:hover { background: var(--panel-2); }
.liste .principal { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.liste .ligne1 { font-weight: 550; overflow-wrap: anywhere; }
.liste .ligne2 { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); }
.liste .fin { display: flex; gap: 6px; align-items: center; flex: none; }
.liste li.faite .ligne1 { text-decoration: line-through; color: var(--muted); }
.groupe-titre { padding: 7px 16px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--panel-2); border-bottom: 1px solid var(--line); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.groupe-titre .compte { margin-left: auto; font-weight: 500; }
.etoile { border: 0; background: none; padding: 0 2px; font-size: 16px; color: var(--line); cursor: pointer; }
.etoile.on { color: #f5a524; }
.ajout-rapide { display: flex; gap: 6px; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.ajout-rapide input[type=text] { flex: 1; }

/* ---------- barre d'avancement */
.barre { height: 8px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; flex: 1; min-width: 60px; }
.barre > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.barre.grande { height: 14px; border-radius: 7px; }
.barre.ok > span { background: var(--ok); }
.avancement { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; }

/* ---------- projets */
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.onglets button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 12px; color: var(--muted); font-weight: 600; }
.onglets button.actif { color: var(--accent); border-bottom-color: var(--accent); }
.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.carte { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; cursor: pointer; box-shadow: var(--shadow); color: var(--text); }
.carte:hover { border-color: var(--accent); text-decoration: none; }
.carte.fournisseur { border-left-color: var(--orange); }
.carte.mixte { border-left-color: var(--violet); }
.carte .haut { display: flex; gap: 8px; align-items: flex-start; }
.carte .nom { font-weight: 650; font-size: 15px; flex: 1; overflow-wrap: anywhere; }
.carte .meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); align-items: center; }
.carte .alerte { color: var(--bad); font-size: 12.5px; font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.kpi { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; }
.kpi .n { font-size: 19px; font-weight: 700; }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi.bad .n { color: var(--bad); }

/* ---------- Gantt */
.gantt { overflow-x: auto; }
.gantt-grille { position: relative; min-width: 720px; }
.gantt-echelle { display: flex; margin-left: 240px; border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--muted); position: relative; height: 26px; }
.gantt-echelle span { position: absolute; top: 5px; transform: translateX(2px); white-space: nowrap; }
.gantt-ligne { display: flex; align-items: center; height: 32px; border-bottom: 1px solid var(--line); }
.gantt-ligne.phase { background: var(--panel-2); height: 26px; font-size: 11.5px; text-transform: uppercase; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.gantt-libelle { width: 240px; flex: none; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.gantt-piste { position: relative; flex: 1; height: 100%; }
.gantt-barre { position: absolute; top: 8px; height: 16px; border-radius: 4px; background: var(--accent); opacity: .85; cursor: pointer; overflow: hidden; }
.gantt-barre > i { position: absolute; inset: 0 auto 0 0; background: rgba(255,255,255,.35); }
.gantt-barre.Faite { background: var(--ok); }
.gantt-barre.Bloquée { background: var(--bad); }
.gantt-barre.retard { background: var(--warn); }
.gantt-barre.jalon { width: 12px !important; height: 12px; top: 10px; transform: rotate(45deg); border-radius: 2px; background: var(--violet); }
.gantt-auj { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); opacity: .6; pointer-events: none; }
.gantt-repere { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); pointer-events: none; }

/* ---------- messages (historique d'une demande) */
.fil { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.msg { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel-2); max-width: 88%; }
.msg.Envoyé { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.msg.Note { align-self: center; background: var(--warn-soft); border-color: transparent; max-width: 100%; }
.msg .qui { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.msg .texte { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .texte.replie { max-height: 7.5em; overflow: hidden; }

/* ---------- formulaires et fenêtre */
.champs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.champ { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.champ.large { grid-column: 1 / -1; }
.champ > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.champ .case { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--text); font-size: 14px; }
.multi { display: flex; flex-wrap: wrap; gap: 6px; }
.multi label { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.voile { position: fixed; inset: 0; background: rgba(10, 16, 24, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.fenetre { background: var(--panel); border-radius: 12px; border: 1px solid var(--line); width: 100%; max-width: 720px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.fenetre > .tete { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.fenetre > .tete h2 { margin-right: auto; font-size: 16px; }
.fenetre > .corps { padding: 16px 18px; }
.fenetre > .pied { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.fenetre > .pied .espace { flex: 1; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: 6px; display: flex; flex-direction: column; min-width: 190px; z-index: 30; }
.menu button { border: 0; justify-content: flex-start; font-weight: 500; }
.menu button:hover { background: var(--panel-2); }
.relatif { position: relative; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 8px; z-index: 60; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.erreur { background: var(--bad); color: #fff; }
.infos { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13.5px; }
.infos dt { color: var(--muted); }
.infos dd { margin: 0; overflow-wrap: anywhere; }
.jour { padding: 7px 16px; font-weight: 650; background: var(--panel-2); border-bottom: 1px solid var(--line); font-size: 13px; }
.jour.auj { color: var(--accent); }
.heure { font-variant-numeric: tabular-nums; color: var(--muted); width: 58px; flex: none; font-size: 12.5px; padding-top: 1px; }
.chargement { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- connexion */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.carte-connexion { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 30px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.carte-connexion .logo { width: 44px; height: 44px; font-size: 16px; border-radius: 11px; }
.carte-connexion label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 8px; }
.carte-connexion button { justify-content: center; padding: 9px; margin-top: 6px; }

@media (max-width: 900px) {
  .grille-2 { grid-template-columns: 1fr; }
  header.top { padding: 8px 12px; flex-wrap: wrap; }
  header.top nav { order: 3; width: 100%; margin-left: 0; }
  main.page { padding: 16px 12px 50px; }
  .champs { grid-template-columns: 1fr; }
  .recherche { width: 100%; }
  .infos { grid-template-columns: 1fr; }
  .msg { max-width: 100%; }
}
