/* gantt.css — Styles spécifiques pour le diagramme de Gantt (S+1) */

.gantt-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-6);
  box-sizing: border-box; /* Garanti pas de débordement par padding */
}

.gantt-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.gantt-agent-info {
  width: 140px;
  min-width: 140px;
  background: var(--color-surface-alt);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
}

.gantt-timeline-wrapper {
  flex: 1;
  position: relative;
  height: 48px;
  background: #F3F4F6; /* gris clair neutre */
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.gantt-timeline {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.gantt-axis {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 0.65rem;
  color: var(--color-muted);
  pointer-events: none;
  font-family: monospace;
}

.gantt-bar {
  position: absolute;
  top: 6px;
  height: 36px;
  background: var(--color-primary);
  color: white;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: transform 0.2s;
  border: 1px solid rgba(0,0,0,0.1);
}

.gantt-bar:hover {
  transform: translateY(-2px);
  background: #2563EB; /* primary light */
}

/* Pastille « commentaire » dans le coin d'une barre. Placee dans le coin
   plutot qu'en texte : lisible meme sur une barre trop etroite pour afficher
   son libelle. Le commentaire complet s'affiche au survol. */
.gantt-bar__commentaire {
  position: absolute;
  top: 1px;
  right: 3px;
  font-size: 11px;
  line-height: 1;
  filter: drop-shadow(0 0 1px rgba(0,0,0,.35));
  pointer-events: none;
}

/* Tooltip natif css */
.tooltip-parent {
  position: relative;
}

/* Une barre de Gantt porte aussi la classe tooltip-parent. Les deux regles
   ayant le meme poids, la precedente l'emportait : les barres passaient en
   position relative, sortaient de l'axe des heures et s'empilaient. La seconde
   barre d'une meme ligne etait poussee hors du cadre et n'apparaissait plus que
   comme un trait. Invisible tant qu'un agent n'avait qu'une barre par ligne ;
   revele par la coupure des taches a la pause. Une barre absolue sert tout
   aussi bien de reference a son infobulle. */
.gantt-bar.tooltip-parent {
  position: absolute;
}

.tooltip-box {
  display: none;
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: #333333;
  color: #FFFFFF;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
  font-weight: normal;
  text-align: left;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.tooltip-box::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px;
  border-style: solid;
  border-color: var(--color-text) transparent transparent transparent;
}

.tooltip-parent:hover .tooltip-box {
  display: block;
}

/* Surcharge agent */
.gantt-row--error .gantt-agent-info {
  border-color: var(--color-danger);
  background: rgb(var(--tw-red-50)); /* red 50 */
}

/* Impression Gantt A3 */
@media print {
  @page {
    size: A3 landscape;
    margin: 10mm;
  }

  body {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  /* Zone de sécurité pour éviter les troncatures sur les bords */
  #gantt-render-area {
    width: 100% !important;
    padding: 2mm !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  .print-hide {
    display: none !important;
  }

  /* Force chaque journée à démarrer sur une nouvelle feuille physique */
  .gantt-day-section {
    page-break-before: always !important;
    break-before: page !important;
    margin-top: 0 !important;
    padding: 5mm 0 !important; /* Réduit pour plus d'espace vertical */
    border-top: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .gantt-grid {
    border: 1px solid #eee !important;
    box-shadow: none !important;
    width: 100% !important;
    padding: 5mm !important;
    gap: 8px !important; /* Resserre les agents */
  }

  .gantt-agent-info {
    width: 120px !important; /* Réduit de 140px à 120px pour gagner du Gantt */
    min-width: 120px !important;
    font-size: 9pt !important;
  }

  .gantt-timeline-wrapper {
    border: 1px solid #ccc !important;
    height: 42px !important; /* Plus compact */
  }

  .gantt-bar {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    border: 1px solid rgba(0,0,0,0.2) !important;
    font-size: 7pt !important; /* Texte plus fin pour éviter que ça dépasse */
  }

  /* Titre SNCF en haut de chaque page A3 */
  .print-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #333;
    margin-bottom: 10px;
    padding-bottom: 5px;
    width: 100% !important;
  }

  .print-header h1 {
    font-size: 24pt !important;
    color: #333;
    margin: 0;
  }

  .print-footer {
    display: block !important;
    text-align: right;
    font-size: 8pt;
    color: #999;
    margin-top: 10px;
  }
}

/* En-tête masqué à l'écran, visible en PDF */
.print-header, .print-footer {
  display: none;
}

/* ──────────────────────────────────────────────────────────────
   Occupation des voies (GanttVoies)
   Une ligne par voie, la semaine entière en abscisse. Une barre qui
   franchit un trait de jour est un reliquat : la rame est encore là
   le lendemain. C'est tout l'objet de cette vue.
   ────────────────────────────────────────────────────────────── */
.gv { display: flex; flex-direction: column; gap: 4px; min-width: 760px; }

.gv-ligne { display: flex; align-items: stretch; gap: 8px; }
.gv-ligne--entete { margin-bottom: 2px; }

.gv-voie {
  flex: 0 0 72px;
  display: flex;
  align-items: center;
  font-size: .75rem;
  font-weight: 700;
  color: #334155;
}

.gv-piste {
  position: relative;
  flex: 1 1 auto;
  height: 30px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}
.gv-piste--entete { background: #fff; border-color: transparent; height: 26px; }

/* Les traits de séparation des jours : ils donnent le repère du débordement. */
.gv-sep {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: #e2e8f0;
}

.gv-jour {
  position: absolute;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: .625rem;
  line-height: 1.1;
  color: #64748b;
  border-left: 1px solid #e2e8f0;
}
.gv-jour__nom  { font-weight: 700; }
.gv-jour__date { color: #94a3b8; }

.gv-barre {
  position: absolute;
  top: 3px;
  height: 24px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 3px;
  border: 1px solid #1d4ed8;
  border-radius: 4px;
  background: #dbeafe;
  color: #1e3a8a;
  font-size: .625rem;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  cursor: help;
}
/* Rame qui attend sa sortie, travail fini : la voie reste prise. */
.gv-barre--attente {
  background: repeating-linear-gradient(135deg, #cbd5e1 0 6px, #e2e8f0 6px 12px);
  color: #334155;
}
/* Deux rames au même moment sur la même voie : impossible, et ça se voit. */
.gv-barre--conflit {
  border-color: #b91c1c;
  background: repeating-linear-gradient(45deg, #fee2e2, #fee2e2 5px, #fecaca 5px, #fecaca 10px);
  color: #7f1d1d;
}
/* Occupation qui commence avant ou finit après la semaine affichée. */
.gv-barre--deborde { border-style: dashed; }


.gv-mouvement { color: #b45309; font-weight: 700; }

/* Nombre de vacations : 20 h de travail, c'est quatre vacations, et la rame
   reste sur la voie entre les deux. */
.gv-vacations {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .7);
  color: #1e3a8a;
  font-size: .5625rem;
  font-weight: 700;
}
.gv-depasse { color: #b91c1c; font-weight: 700; }

.gv-libre {
  position: absolute;
  left: 6px; top: 50%;
  transform: translateY(-50%);
  font-size: .625rem;
  color: #cbd5e1;
}

.gv-legende {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: .625rem;
  color: #475569;
}
.gv-pastille {
  display: inline-block;
  width: 10px; height: 10px;
  margin-right: 3px;
  border: 1px solid #1d4ed8;
  border-radius: 2px;
  background: #dbeafe;
  vertical-align: -1px;
}
.gv-pastille--conflit { border-color: #b91c1c; background: #fecaca; }

/* ──────────────────────────────────────────────────────────────
   PDDV — la semaine telle que l'atelier la lit deja

   On reprend leur disposition ET leur intensite de couleur : leur
   tableau tranche au bleu franc, a l'orange vif, au rouge. Les teintes,
   elles, sont celles de MOPPI — celles qui basculent en mode daltonien.
   Chaque case ecrit l'abreviation du metier a cote de sa couleur : la
   couleur ne porte jamais l'information a elle seule.
   ────────────────────────────────────────────────────────────── */
.pddv { display: flex; flex-direction: column; gap: 20px; }

.pddv-legende {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  font-size: .6875rem;
  color: #334155;
}

/* Bandeau du jour : le gris franc de leur tableau. */
.pddv-bloc__titre {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 5px 10px;
  background: #D1D1D1;
  border: 1px solid #9ca3af;
  border-bottom: none;
}
.pddv-bloc__jour {
  font-size: .9375rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #111827;
}
.pddv-bloc__date { font-size: .8125rem; font-weight: 600; color: #374151; }
.pddv-note { font-size: .6875rem; font-style: italic; color: #4b5563; }

.pddv-table {
  width: 100%;
  /* Des cases assez larges pour qu'un code tienne sur une ligne :
     la grille défile en largeur sur un petit écran. */
  min-width: 1180px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: .75rem;
}
.pddv-table th, .pddv-table td {
  border: 1px solid #9ca3af;
  padding: 2px 4px;
  vertical-align: middle;
  text-align: center;
}
.pddv-table thead th {
  background: #e5e7eb;
  font-size: .6875rem;
  font-weight: 700;
  color: #111827;
}
/* Jour et nuit : deux couleurs franches, prises dans leur fichier. */
.pddv-entete--jour {
  background: #FFC000 !important;
  color: #1f2937 !important;
}
.pddv-entete--nuit {
  background: #002060 !important;
  color: #fff !important;
}

.pddv-voie {
  width: 56px;
  background: #f3f4f6;
  font-weight: 800;
  font-size: .8125rem;
  color: #111827;
}
.pddv-pos {
  width: 92px;
  background: #fafafa;
  font-size: .6875rem;
  color: #374151;
}
.pddv-cell { height: 36px; padding: 3px !important; }
/* Le bandeau du jour suit la largeur de sa table. */
.pddv-bloc { min-width: 1180px; }
/* La moitié Nuit répète la voie et la place : un trait franc les sépare. */
.pddv-voie--nuit { border-left: 3px solid #374151 !important; }
.pddv-cell--hors {
  background: repeating-linear-gradient(45deg, #e5e7eb, #e5e7eb 5px, #d1d5db 5px, #d1d5db 10px);
}

/* Une rame dans sa case : centree, sur la couleur de son metier. */
.pddv-op {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--c, #475569);
  color: var(--t, #fff);
  line-height: 1.35;
}
.pddv-op + .pddv-op { margin-top: 2px; }
/* Une case occupée : ses rames remplissent toute la case, sans marge ; à
   plusieurs, elles se partagent sa hauteur. */
.pddv-cell--pleine { padding: 0 !important; height: 36px; }
.pddv-pile { display: flex; flex-direction: column; height: 100%; min-height: 36px; }
.pddv-pile > .pddv-op { flex: 1 1 auto; border-radius: 0; margin: 0; }
.pddv-pile > .pddv-op + .pddv-op { margin-top: 0; border-top: 1px solid rgba(255, 255, 255, .6); }
/* Demi-vacations : la case se coupe en deux, première moitié à gauche. Une
   rame de moins de 75 % de la vacation n'en prend qu'une ; deux rendez-vous
   alternent ainsi sur une même voie. */
.pddv-pile--moities {
  display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: row dense; align-items: stretch;
  background: linear-gradient(to right, transparent calc(50% - .5px), #cbd5e1 calc(50% - .5px), #cbd5e1 calc(50% + .5px), transparent calc(50% + .5px));
}
.pddv-pile--moities > .pddv-op--m1 { grid-column: 1; }
.pddv-pile--moities > .pddv-op--m2 { grid-column: 2; }
.pddv-pile--moities > .pddv-op--entiere { grid-column: 1 / -1; }
.pddv-pile--moities > .pddv-op + .pddv-op { border-top: 0; }
.pddv-pile--moities > .pddv-op { border-left: 1px solid rgba(255, 255, 255, .6); }
.pddv-cell { position: relative; }
.pddv-moitie { position: absolute; top: 0; bottom: 0; width: 50%; pointer-events: none; z-index: 2; }
.pddv-moitie--1 { left: 0; }
.pddv-moitie--2 { right: 0; }
.glissement-en-cours .pddv-moitie { pointer-events: auto; }
.glissement-en-cours .pddv-moitie--2 { border-left: 1px dashed #94a3b8; }
.pddv-moitie.zone-survolee { outline: 2px dashed var(--color-primary); outline-offset: -2px; background: rgba(30, 64, 175, .1); }


.pddv-op__code { font-weight: 700; letter-spacing: .01em; }
/* Un rendez-vous « A+B+C » tient sur une ligne ; trop long pour la case, il
   revient à la ligne après un « + » (pddv.js insère les points de coupure). */
.pddv-op { flex-wrap: wrap; min-width: 0; }
.pddv-op__code { min-width: 0; overflow-wrap: anywhere; text-align: center; }
.pddv-op__rame { font-family: ui-monospace, monospace; font-size: .6875rem; opacity: .9; }
.pddv-op__metier {
  padding: 0 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(0, 0, 0, .2);
  color: #111827;
  font-size: .625rem;
  font-weight: 800;
}

/* La couleur du metier qui pese le plus. Les variables basculent toutes
   seules en mode daltonien : rien a refaire ici. */
.pddv-op--elec { --c: var(--color-elec); --t: var(--texte-sur-elec, #fff); }
.pddv-op--ai   { --c: var(--color-ai);   --t: var(--texte-sur-ai,   #fff); }
.pddv-op--meca { --c: var(--color-meca); --t: var(--texte-sur-meca, #fff); }
.pddv-op--meor { --c: var(--color-meor); --t: var(--texte-sur-meor, #fff); }
.pddv-op--mefr { --c: var(--color-mefr); --t: var(--texte-sur-mefr, #fff); }
.pddv-op--meth { --c: var(--color-meth); --t: var(--texte-sur-meth, #fff); }
.pddv-op--sc   { --c: var(--color-sc);   --t: var(--texte-sur-sc,   #fff); }
.pddv-op--nett { --c: var(--color-nett); --t: var(--texte-sur-nett, #fff); }
.pddv-op--autre { --c: #475569; --t: #fff; }
/* Couleur choisie dans la fiche du rendez-vous (2026-11-03) : elle passe
   devant celle du corps de métier, dont l'abréviation reste écrite.
   Liste : js/utils.js, COULEURS_RDV. */
.pddv-op.pddv-op--rdv-rouge,     .couleur-rdv.pddv-op--rdv-rouge     { --c: #dc2626; --t: #fff; }
.pddv-op.pddv-op--rdv-orange,    .couleur-rdv.pddv-op--rdv-orange    { --c: #ea580c; --t: #fff; }
.pddv-op.pddv-op--rdv-jaune,     .couleur-rdv.pddv-op--rdv-jaune     { --c: #facc15; --t: #422006; }
.pddv-op.pddv-op--rdv-vert,      .couleur-rdv.pddv-op--rdv-vert      { --c: #15803d; --t: #fff; }
.pddv-op.pddv-op--rdv-turquoise, .couleur-rdv.pddv-op--rdv-turquoise { --c: #0f766e; --t: #fff; }
.pddv-op.pddv-op--rdv-bleu,      .couleur-rdv.pddv-op--rdv-bleu      { --c: #1d4ed8; --t: #fff; }
.pddv-op.pddv-op--rdv-violet,    .couleur-rdv.pddv-op--rdv-violet    { --c: #7c3aed; --t: #fff; }
.pddv-op.pddv-op--rdv-rose,      .couleur-rdv.pddv-op--rdv-rose      { --c: #db2777; --t: #fff; }
.pddv-op.pddv-op--rdv-marron,    .couleur-rdv.pddv-op--rdv-marron    { --c: #92400e; --t: #fff; }
.pddv-op.pddv-op--rdv-gris,      .couleur-rdv.pddv-op--rdv-gris      { --c: #4b5563; --t: #fff; }

/* Rame en place, personne n'y touche : barree et effacee, comme chez eux. */
.pddv-op--sans-travail {
  background: #f3f4f6;
  color: #6b7280;
  text-decoration: line-through;
  border: 1px dashed #9ca3af;
}
.pddv-op--sans-travail .pddv-op__code { font-weight: 600; }

/* Travail fini, la rame attend sa sortie : la voie reste prise. Hachuree,
   pour ne pas la confondre avec du travail. */
.pddv-op--attente {
  background: repeating-linear-gradient(135deg, #e2e8f0 0 6px, #f8fafc 6px 12px);
  color: #334155;
  border: 1px dashed #64748b;
}


/* Confie au Service Continu : le rouge de leur tableau. */
.pddv-sc {
  color: #FF0000;
  font-weight: 800;
  font-size: .6875rem;
  background: #fff;
  padding: 0 2px;
  border-radius: 2px;
}

.pddv-total { background: #f3f4f6; font-size: .6875rem; }
.pddv-total__libelle {
  background: #e5e7eb;
  font-size: .6875rem;
  font-weight: 700;
  color: #111827;
  text-align: right !important;
}
.pddv-total__h { font-weight: 800; color: #111827; margin-right: 6px; }
.pddv-total__m { margin-right: 6px; color: #374151; }

/* La grille se manipule : on y glisse, on y cree, on en retire. */
.pddv-op[draggable="true"] { cursor: grab; }
.pddv-op[draggable="true"]:active { cursor: grabbing; }
.pddv-cell.zone-survolee {
  outline: 2px dashed var(--color-primary);
  outline-offset: -2px;
  background-color: rgba(30, 64, 175, .08);
}

/* Le « + » d'une case libre : discret, visible au survol. */
.pddv-creer {
  width: 100%;
  border: none;
  background: none;
  color: transparent;
  font-size: .8125rem;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
}
.pddv-cell:hover .pddv-creer { color: #94a3b8; }
.pddv-creer:hover { color: var(--color-primary) !important; }
.pddv-creer:focus-visible { color: var(--color-primary) !important; outline: 2px solid var(--color-primary); }

.pddv-retirer {
  margin-left: 2px;
  border: none;
  background: rgba(255, 255, 255, .25);
  border-radius: 2px;
  color: inherit;
  font-size: .625rem;
  line-height: 1;
  padding: 1px 3px;
  opacity: 0;
  cursor: pointer;
}
.pddv-op:hover .pddv-retirer, .pddv-retirer:focus-visible { opacity: 1; }
.pddv-retirer:hover { background: #dc2626; color: #fff; }

/* « Pas d'intervention sur cette vacation » (⊘), ou la rétablir (↺). */
.pddv-sans-intervention {
  margin-left: 2px;
  border: none;
  background: rgba(255, 255, 255, .25);
  border-radius: 2px;
  color: inherit;
  font-size: .625rem;
  line-height: 1;
  padding: 1px 3px;
  opacity: 0;
  cursor: pointer;
}
.pddv-op:hover .pddv-sans-intervention, .pddv-sans-intervention:focus-visible { opacity: 1; }
.pddv-sans-intervention:hover { background: #b45309; color: #fff; }
.pddv-op--sans-travail .pddv-sans-intervention { opacity: .8; }

/* Le code du module ouvre la fiche de l'operation. */
.pddv-op__code--lien {
  border: none;
  background: none;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, .45);
  text-underline-offset: 2px;
}
.pddv-op__code--lien:hover { text-decoration-color: currentColor; }
.pddv-op__code--lien:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

/* Ce que les anciens tableaux signalaient, en marge du code. */
.pddv-marque {
  font-size: .6875rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}
.pddv-marque--alerte     { color: #7F1D1D; background: #FFF; border-radius: 2px; padding: 0 2px; }
.pddv-marque--attention  { color: #92400E; background: #FFF; border-radius: 2px; padding: 0 2px; }

/* Le caddie : les gammes generiques annoncees par le rendez-vous, dont le
   contenu vient d'un autre outil. Tant qu'elles ne sont pas renseignees,
   leur charge ne compte pas — d'ou l'orange. */
.pddv-caddie {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 3px;
  padding: 0 4px;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  background: #fff;
  color: #334155;
  font-size: .625rem;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
}
.pddv-caddie:hover { border-color: var(--color-primary); color: var(--color-primary); }
.pddv-caddie--afaire {
  border-color: #d97706;
  background: #fffbeb;
  color: #92400e;
}

/* Le rang d'une gamme dans le tableau d'edition. */
.gene-rang {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: .625rem;
  font-weight: 700;
}

/* La case se double-clique : on le fait sentir. */
.pddv-cell[data-on="dblclick"] { cursor: pointer; }

/* Les operations comptees sans case dans la grille : le compteur annonce un
   nombre, la grille doit le montrer. On les liste au-dessus, en clair. */
.pddv-horsgrille {
  margin-bottom: .75rem;
  padding: .5rem .75rem;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  background: #fffbeb;
  color: #78350f;
  font-size: .75rem;
}
.pddv-horsgrille__titre { font-weight: 700; margin-bottom: .375rem; }
.pddv-horsgrille__liste { display: flex; flex-wrap: wrap; gap: .375rem; }
.pddv-horsgrille__op {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .125rem .5rem;
  border: 1px solid #fcd34d;
  border-radius: 4px;
  background: #fff;
}
.pddv-horsgrille__op[data-on="dblclick"] { cursor: pointer; }
.pddv-horsgrille__op .pddv-op__code--lien { color: #78350f; font-weight: 700; }
.pddv-horsgrille__raison { color: #92400e; font-style: italic; }

/* Jour sans aucune rame : replié sur son bandeau, un clic le déplie. */
.pddv-bloc--replie > summary { cursor: pointer; list-style: none; border-bottom: 1px solid #9ca3af; }
.pddv-bloc--replie > summary::-webkit-details-marker { display: none; }
.pddv-bloc--replie > summary::before { content: '▸'; color: #4b5563; margin-right: 2px; }
.pddv-bloc--replie[open] > summary { border-bottom: none; }
.pddv-bloc--replie[open] > summary::before { content: '▾'; }
.pddv-bloc--replie[open] .pddv-bloc__vide { display: none; }

/* Jauge capacitaire d'une vacation, au pied de sa colonne (Planning S+1). */
.jauge-puce {
  display: inline-block; margin: 1px 3px; padding: 1px 6px; border-radius: 9999px;
  font-size: .6875rem; font-weight: 700; white-space: nowrap; cursor: help;
  border: 1px solid transparent;
}
.jauge-puce--vide   { background: #f8fafc; color: #94a3b8; border-color: #e2e8f0; }
.jauge-puce--ok     { background: #dcfce7; color: #166534; }
.jauge-puce--tendu  { background: #fef3c7; color: #92400e; }
.jauge-puce--sature { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

/* ── Grille des agents d'une vacation (js/repartition.js) ───────── */
.jauge-puce--lien { cursor: pointer; }
.jauge-puce--lien:hover { outline: 2px solid #1e40af; outline-offset: 1px; }
.rep-reports { display: flex; gap: 8px; margin-bottom: 10px; }
.rep-report {
  flex: 1; padding: 6px 10px; border: 2px dashed #cbd5e1; border-radius: 8px;
  font-size: .75rem; color: #475569; text-align: center; background: #f8fafc;
}
.rep-section { border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.rep-section__titre {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding: 6px 10px; background: #f1f5f9; font-size: .8125rem; font-weight: 700; color: #0f172a;
}
.rep-section__titre .text-slate-500 { font-weight: 500; font-size: .75rem; }
.rep-ligne { display: grid; grid-template-columns: 180px 1fr 110px; align-items: center; border-top: 1px solid #f1f5f9; }
.rep-ligne--entete { border-top: 0; }
.rep-ligne--deborde { background: #fef2f2; }
.rep-agent { padding: 4px 8px; font-size: .75rem; font-weight: 600; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-agent__sp { margin-left: 4px; padding: 0 4px; border-radius: 3px; background: #e2e8f0; font-size: .625rem; color: #334155; }
.rep-frise { position: relative; height: 30px; background: #fff; border-left: 1px solid #e2e8f0; border-right: 1px solid #e2e8f0; }
.rep-frise--entete { height: 18px; background: transparent; border: 0; }
.rep-frise--autre { background: repeating-linear-gradient(135deg, #fef3c7 0 6px, #fff 6px 12px); }
.rep-bloc__confie { margin-right: 3px; padding: 0 3px; border-radius: 3px; background: #fef3c7; color: #92400e; font-size: .625rem; }

.rep-heure { position: absolute; top: 0; bottom: 0; width: 1px; background: #f1f5f9; }
.rep-heure--txt { width: auto; background: none; font-size: .625rem; color: #94a3b8; transform: translateX(-50%); }
/* 1/2 Présence : la moitié de vacation où l'agent est absent, hachurée. */
.rep-demi { position: absolute; top: 0; bottom: 0; pointer-events: none;
            background: repeating-linear-gradient(45deg, #f1f5f9 0 6px, #e2e8f0 6px 12px); }
.rep-presence { position: absolute; top: 0; bottom: 0; background: rgba(34, 197, 94, .14); border: 1px dashed #22c55e; pointer-events: none; }
.rep-bloc {
  position: absolute; top: 3px; height: 24px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  padding: 2px 5px; border-radius: 4px; font-size: .6875rem; font-weight: 600; cursor: grab;
  background: var(--c, #475569); color: var(--t, #fff); border: 1px solid rgba(0, 0, 0, .15);
}
.rep-bloc--libre { position: static; display: inline-block; margin: 2px 4px 2px 0; max-width: 260px; }
.rep-bloc--main { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .85); }
.rep-bloc--deborde { border: 2px solid #b91c1c; }
.rep-bloc.en-glissement { opacity: .45; }
.rep-bloc__rame { font-family: ui-monospace, monospace; opacity: .9; }
.rep-bloc__h { opacity: .85; font-weight: 500; }
.rep-total { padding: 0 8px; font-size: .75rem; font-weight: 700; text-align: right; }
.rep-depasse { display: block; color: #b91c1c; font-size: .6875rem; }
.rep-libre { padding: 6px 10px; border-top: 1px dashed #cbd5e1; background: #fafafa; min-height: 34px; }
.rep-libre__titre { font-size: .6875rem; font-weight: 700; color: #64748b; margin-right: 8px; text-transform: uppercase; }
/* Sous la jauge : du travail que la répartition automatique n'a donné à personne. */
.jauge-alerte {
  display: inline-block; margin: 1px 3px; padding: 1px 7px; border-radius: 9999px; cursor: pointer;
  font-size: .6875rem; font-weight: 700; background: #b91c1c; color: #fff; border: 0;
}
.jauge-alerte:hover { background: #7f1d1d; }
/* Un « + » par demi-vacation, et dans la moitié libre d'une case prise. */
.pddv-creer-moities { display: flex; height: 100%; min-height: 30px; }
.pddv-creer-moities > .pddv-creer { flex: 1 1 50%; }
.pddv-creer-moities > .pddv-creer + .pddv-creer { border-left: 1px dashed #e2e8f0; }
.pddv-creer--moitie { align-self: stretch; }
.pddv-pile--moities > .pddv-creer--moitie { color: #94a3b8; background: #f8fafc; border: 1px dashed #cbd5e1; }
.pddv-pile--moities > .pddv-creer--moitie:hover { color: var(--color-primary); background: #eff6ff; }

/* ── Lisibilité (2026-10-27) : les grilles étaient écrites trop petit. ──
   Tout est agrandi d'environ deux points ; les cases suivent en hauteur. */
.pddv-table { font-size: .875rem; }
.pddv-table thead th { font-size: .8125rem; }
.pddv-voie { font-size: .9375rem; width: 60px; }
.pddv-pos { font-size: .8125rem; }
.pddv-bloc__jour { font-size: 1.0625rem; }
.pddv-bloc__date { font-size: .9375rem; }
.pddv-note { font-size: .8125rem; }
.pddv-cell, .pddv-cell--pleine { height: 42px; }
.pddv-pile { min-height: 42px; }
.pddv-creer-moities { min-height: 36px; }
.pddv-creer { font-size: 1rem; }
.pddv-op { line-height: 1.3; }
.pddv-op__code { font-size: .875rem; }
.pddv-op__rame { font-size: .8125rem; }
.pddv-op__metier { font-size: .75rem; }
.pddv-total { font-size: .8125rem; }
.jauge-puce, .jauge-alerte { font-size: .8125rem; }
.gv-barre { font-size: .75rem; }
.rep-section__titre { font-size: .9375rem; }
.rep-section__titre .text-slate-500 { font-size: .8125rem; }
.rep-agent { font-size: .875rem; }
.rep-agent__sp, .rep-bloc__confie { font-size: .75rem; }
.rep-frise { height: 36px; }
.rep-bloc { height: 30px; font-size: .8125rem; }
.rep-heure--txt { font-size: .75rem; }
.rep-total { font-size: .875rem; }
.rep-libre__titre, .rep-depasse { font-size: .8125rem; }

/* ── Étiquettes des opérations très lisibles (2026-10-27, 2e passe) ── */
.pddv-cell, .pddv-cell--pleine { height: 50px; }
.pddv-pile { min-height: 50px; }
.pddv-creer-moities { min-height: 44px; }
.pddv-op { gap: 6px; padding: 2px 6px; line-height: 1.25; }
.pddv-op__code { font-size: 1.0625rem; font-weight: 800; }
.pddv-op__rame { font-size: .9375rem; font-weight: 700; opacity: 1; }
.pddv-op__metier { font-size: .8125rem; padding: 0 4px; }
.pddv-marque { font-size: .9375rem; }
/* Une opération commentée : la bulle se voit de loin, le texte au survol. */
.pddv-comment {
  display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 6px; border-radius: 6px;
  background: #d97706; color: #fff; border: 2px solid #fff; box-shadow: 0 0 0 1px #92400e;
  font-size: .8125rem; font-weight: 800; line-height: 1; cursor: help; white-space: nowrap;
}


/* ── Jour seul / Nuit seule : l'autre côté se replie (retenu sur le poste) ── */
.pddv-cotes { display: inline-flex; gap: 0; margin: 0 0 8px; border: 1px solid #94a3b8; border-radius: 8px; overflow: hidden; }
.pddv-cote-btn { padding: 5px 12px; font-size: .875rem; font-weight: 700; background: #fff; color: #334155; border: 0; cursor: pointer; }
.pddv-cote-btn + .pddv-cote-btn { border-left: 1px solid #94a3b8; }
.pddv-cote-btn:hover { background: #f1f5f9; }
.pddv-cote-btn--actif { background: #1e3a8a; color: #fff; }
.pddv-cote-btn--actif:hover { background: #1e3a8a; }
.pddv--sans-nuit .pddv-cote-nuit, .pddv--sans-jour .pddv-cote-jour { display: none; }
.pddv--sans-nuit .pddv-table, .pddv--sans-nuit .pddv-bloc,
.pddv--sans-jour .pddv-table, .pddv--sans-jour .pddv-bloc { min-width: 640px; }
/* La nuit seule n'a plus besoin du trait qui la séparait du jour. */
.pddv--sans-jour .pddv-voie--nuit { border-left: 1px solid #9ca3af !important; }

/* ── Planning S+1 : la bande du haut reste figée, seule la grille défile ── */
.s1-bande {
  /* Collée au bord haut de la zone qui défile, marge intérieure comprise. */
  position: sticky; top: -1rem; z-index: 30;
  display: flex; flex-direction: column; gap: .5rem;
  margin: -1rem -1rem 0; padding: .75rem 1rem .5rem;
  background: #f8fafc; border-bottom: 1px solid #cbd5e1;
  box-shadow: 0 4px 8px -6px rgba(15, 23, 42, .35);
}
@media (min-width: 1024px) {
  .s1-bande { top: -1.5rem; margin: -1.5rem -1.5rem 0; padding: 1rem 1.5rem .5rem; }

}
.s1-bande .week-tabs { margin: 0; }
.s1-bande__ligne { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.s1-bande__recherche { flex: 1 1 260px; min-width: 220px; }
.s1-bande .pddv-cotes { margin: 0; }
/* Plein écran : la zone qui défile a des marges plus fines. */
body.plein-ecran .s1-bande { top: -.5rem; margin: -.5rem -1rem 0; padding: .5rem 1rem .5rem; }
/* Gantt des agents de la semaine : les vacations l'une sous l'autre. */
.rep-gantt__vac { margin-bottom: 14px; break-inside: avoid; }
.rep-gantt__titre { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 1rem; font-weight: 800; color: #0f172a; }
.rep-gantt .rep-bloc { cursor: default; }

/* ── Planning S+1 : la corbeille en sacs, collée en bas (2026-11-03) ──
   Les rendez-vous mis de côté à l'import (voie déjà prise) attendent ici,
   à portée de main du dimanche au dimanche : on prend un sac, on le dépose
   sur la case de la voie voulue. */
.sacs-bande {
  position: sticky; bottom: -1rem; z-index: 30;
  margin: 0 -1rem -1rem; padding: .5rem 1rem .75rem;
  background: #fffbeb; border-top: 2px solid #f59e0b;
  box-shadow: 0 -4px 10px -6px rgba(15, 23, 42, .35);
}
@media (min-width: 1024px) {
  .sacs-bande { bottom: -1.5rem; margin: 0 -1.5rem -1.5rem; padding: .5rem 1.5rem 1rem; }
}
/* Vide : seulement pendant un glisser, pour y lâcher une étiquette. */
.sacs-bande--vide { display: none; }
.glissement-en-cours .sacs-bande--vide { display: block; }
.sacs-bande.zone-survolee { background: #fde68a; }
.sacs-bande__titre { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem;
  font-size: .8rem; font-weight: 700; color: #92400e; margin-bottom: .4rem; }
.sacs-bande__aide { font-weight: 400; color: #b45309; font-size: .75rem; }
.sacs-bande__liste { display: flex; gap: .75rem; overflow-x: auto; padding: .35rem .1rem .2rem; }
.sac { position: relative; flex: 0 0 auto; padding-top: .55rem; cursor: grab; }
.sac:active { cursor: grabbing; }
.sac.en-glissement { opacity: .45; }
/* L'anse du sac. */
.sac__anse { position: absolute; top: 0; left: 50%; width: 1.6rem; height: .9rem; transform: translateX(-50%);
  border: 3px solid #92400e; border-bottom: 0; border-radius: .9rem .9rem 0 0; }
.sac__corps { display: flex; flex-direction: column; align-items: center; gap: .05rem;
  min-width: 5.5rem; padding: .4rem .6rem .45rem; border-radius: .45rem .45rem .9rem .9rem;
  background: linear-gradient(180deg, #d97706, #b45309); color: #fff; text-align: center;
  box-shadow: 0 3px 0 #78350f, 0 4px 8px rgba(120, 53, 15, .3); cursor: inherit; }
.sac__corps:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; }
.sac:hover .sac__corps { transform: translateY(-2px); }
.sac__rame { font-family: ui-monospace, monospace; font-weight: 700; font-size: .8rem; }
.sac__code { font-size: .7rem; font-weight: 600; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sac__quand { font-size: .65rem; opacity: .9; }

/* ── Fiche du Planning S+1 : les pastilles de couleur (2026-11-03) ── */
.couleurs-rdv { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.couleur-rdv { position: relative; width: 1.75rem; height: 1.75rem; border-radius: 9999px; cursor: pointer;
  background: var(--c, #fff); border: 2px solid rgba(15, 23, 42, .15); }
.couleur-rdv--auto { background: conic-gradient(var(--color-elec, #2563eb) 0 25%, var(--color-meca, #16a34a) 0 50%,
  var(--color-ai, #9333ea) 0 75%, var(--color-sc, #f59e0b) 0); }
.couleur-rdv input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.couleur-rdv:has(input:checked) { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0f172a; }
.couleur-rdv:has(input:focus-visible) { outline: 3px solid #1d4ed8; outline-offset: 3px; }
.couleur-rdv__nom { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
