/* ================================================================
   styles.css — Composants custom MOPPI v2
   Design Light Corporate — Tailwind CSS complement
   ================================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Code couleur de l'atelier, relevé sur leur légende : c'est celui que les
     équipes lisent depuis des années. Le mode daltonien le remplace plus bas
     par la palette Okabe-Ito, et l'abréviation du métier est toujours écrite
     à côté de la couleur. */
  --color-ai:     #00B050;   /* « P » chez eux          */
  --color-elec:   #00B0F0;   /* « E »                   */
  --color-meor:   #FFC000;   /* « OR »                  */
  --color-mefr:   #FFFF00;   /* « FB »                  */
  --color-meth:   #0070C0;   /* « TH »                  */
  --color-sc:     #966FF7;   /* « SC »                  */
  /* Absents de leur légende : on prend deux teintes qui ne s'y confondent pas. */
  --color-nett:   #974706;
  --color-meca:   #595959;

  /* Lisibilité du texte posé sur ces fonds : clair sur les teintes
     sombres, sombre sur les vives. */
  --texte-sur-ai:   #FFFFFF;
  --texte-sur-elec: #11243A;
  --texte-sur-meor: #1F2937;
  --texte-sur-mefr: #1F2937;
  --texte-sur-meth: #FFFFFF;
  --texte-sur-sc:   #FFFFFF;
  --texte-sur-nett: #FFFFFF;
  --texte-sur-meca: #FFFFFF;

  --color-primary: #1e40af;
  --color-success: rgb(var(--tw-green-600));
  --color-warning: #d97706;
  --color-danger:  rgb(var(--tw-red-600));

  /* Séries des graphiques (causes d'annulation…) */
  --serie-1: #1e40af;
  --serie-2: #7c3aed;
  --serie-3: rgb(var(--tw-emerald-600));
  --serie-4: #d97706;
  --serie-5: rgb(var(--tw-red-600));
  --serie-6: #0891b2;
}

/* ── Reset léger ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Badges métier ─────────────────────────────────────────── */
.badge--elec { background: #eff6ff; color: #1d4ed8; }
.badge--ai   { background: #f5f3ff; color: #6d28d9; }
.badge--meor { background: #fffbeb; color: #92400e; }
.badge--mefr { background: #fff7ed; color: #9a3412; }
.badge--meth { background: #f0fdfa; color: #0f766e; }
.badge--sc   { background: rgb(var(--tw-rose-50)); color: rgb(var(--tw-rose-700)); }
.badge--nett { background: #ecfeff; color: #0e7490; }

.badge-metier {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ── Pastilles de statut (opérations) ─────────────────────── */
.badge-planifie  { background: #eff6ff; color: #1d4ed8; }
.badge-cloture   { background: rgb(var(--tw-green-50)); color: rgb(var(--tw-green-700)); }
.badge-annule    { background: rgb(var(--tw-red-50)); color: rgb(var(--tw-red-700)); }
.badge-reporte   { background: #fefce8; color: #92400e; }
.badge-preventif { background: #f0f9ff; color: #0369a1; }
.badge-correctif { background: #fef3c7; color: #92400e; }

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* ── Dots de statut ────────────────────────────────────────── */
.dot--elec { background: var(--color-elec); }
.dot--ai   { background: var(--color-ai); }
.dot--meor { background: var(--color-meor); }
.dot--mefr { background: var(--color-mefr); }
.dot--meth { background: var(--color-meth); }
.dot--sc   { background: var(--color-sc); }
.dot--nett { background: var(--color-nett); }

.metier-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
}

/* ── Cartes KPI ────────────────────────────────────────────── */
.kpi-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: box-shadow .15s;
}
.kpi-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1;
}

.kpi-label {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 6px;
}

.kpi-trend-up   { color: rgb(var(--tw-green-600)); }
.kpi-trend-down { color: rgb(var(--tw-red-600)); }

/* ── Tables premium ────────────────────────────────────────── */
.table-premium {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table-premium th {
  background: #f8fafc;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.table-premium td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}

.table-premium tr:last-child td { border-bottom: none; }
.table-premium tbody tr:hover { background: #f8fafc; }

/* ── Boutons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, opacity .15s;
  white-space: nowrap;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--primary {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.btn--primary:hover:not(:disabled) { background: #1e3a8a; }

.btn--secondary {
  background: white;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.btn--secondary:hover:not(:disabled) { background: #f8fafc; }

.btn--danger {
  background: rgb(var(--tw-red-50));
  color: rgb(var(--tw-red-700));
  border: 1px solid rgb(var(--tw-red-200));
}
.btn--danger:hover:not(:disabled) { background: rgb(var(--tw-red-100)); }

.btn--success {
  background: rgb(var(--tw-green-50));
  color: rgb(var(--tw-green-700));
  border: 1px solid rgb(var(--tw-green-200));
}
.btn--success:hover:not(:disabled) { background: rgb(var(--tw-green-100)); }

.btn--warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}
.btn--warning:hover:not(:disabled) { background: #fef3c7; }

/* Bouton violet — Simulateur RA */
.btn--violet {
  background: #7c3aed;
  color: white;
  border: 1px solid #6d28d9;
}
.btn--violet:hover:not(:disabled) { background: #6d28d9; }

.btn--sm { padding: 5px 12px; font-size: 0.8rem; }
.btn--xs { padding: 3px 8px; font-size: 0.75rem; border-radius: 6px; }

/* ── Formulaires ───────────────────────────────────────────── */
.form-input {
  width: 100%;
  padding: 9px 14px;
  font-size: 0.875rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--color-primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(30,64,175,.12);
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

.form-label--required::after {
  content: ' *';
  color: var(--color-danger);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 36px;
}

.form-group { margin-bottom: 16px; }

/* ── Section headings ──────────────────────────────────────── */
.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  overflow: hidden;
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
}

.card-body { padding: 16px 20px; }

/* ── Toast notifications ───────────────────────────────────── */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e293b;
  background: white;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  pointer-events: auto;
  max-width: 360px;
  animation: slideInRight .2s ease-out;
}

.toast--success { border-left: 4px solid var(--color-success); }
.toast--danger  { border-left: 4px solid var(--color-danger); }
.toast--warning { border-left: 4px solid var(--color-warning); }
.toast--info    { border-left: 4px solid var(--color-primary); }

/* ── Alertes inline ────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  border-width: 1px;
  border-style: solid;
}

.alert--success { background: rgb(var(--tw-green-50)); color: rgb(var(--tw-green-700)); border-color: rgb(var(--tw-green-200)); }
.alert--warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert--danger  { background: rgb(var(--tw-red-50)); color: rgb(var(--tw-red-700)); border-color: rgb(var(--tw-red-200)); }
.alert--info    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* ── Auth error ────────────────────────────────────────────── */
.auth-error {
  padding: 8px 12px;
  background: rgb(var(--tw-red-50));
  color: rgb(var(--tw-red-700));
  border: 1px solid rgb(var(--tw-red-200));
  border-radius: 8px;
  font-size: 0.8rem;
}

/* ── Modal footer ──────────────────────────────────────────── */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  padding-bottom: 4px;
  border-top: 1px solid #f1f5f9;
  margin-top: 20px;
  position: sticky;
  bottom: 0;
  background: #fff;
  z-index: 1;
}

/* ── Progress bar ──────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  border-radius: 9999px;
  background: #e2e8f0;
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  border-radius: 9999px;
  background: var(--color-primary);
  transition: width .3s ease;
}
.progress-bar__fill--success { background: var(--color-success); }
.progress-bar__fill--warning { background: var(--color-warning); }
.progress-bar__fill--danger  { background: var(--color-danger); }

/* ── Split Jour/Nuit (vue PROD) ────────────────────────────── */
.shift-panel {
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.shift-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
  font-weight: 600;
}

.shift-header--jour  { background: linear-gradient(135deg, #fffbeb 0%, #fef9c3 100%); color: #92400e; }
.shift-header--nuit  { background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); color: #1e40af; }

/* ── Semaine tabs ──────────────────────────────────────────── */
.week-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f1f5f9;
  border-radius: 10px;
  flex-wrap: wrap;
}

.week-tab {
  flex: 1;
  min-width: 80px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: #64748b;
  transition: all .15s;
  white-space: nowrap;
  text-align: center;
}

.week-tab:hover { background: white; color: #1e293b; }
.week-tab.active {
  background: white;
  color: var(--color-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* ── Voie card (vue PROD) ──────────────────────────────────── */
.voie-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  transition: box-shadow .15s;
}
.voie-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }

.voie-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--color-primary);
  font-weight: 700;
  font-size: 0.8rem;
}

/* ── Effectifs grid ────────────────────────────────────────── */
.effectif-grid {
  display: grid;
  grid-template-columns: auto repeat(5, 1fr);
  gap: 1px;
  background: #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.8rem;
}

.effectif-grid > * {
  background: white;
  padding: 6px 10px;
  text-align: center;
}

.effectif-grid .header-cell {
  background: #f8fafc;
  font-weight: 600;
  color: #64748b;
  font-size: 0.7rem;
  text-transform: uppercase;
}

/* ── Indicateur de charge (%) ──────────────────────────────── */
.charge-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.charge-pill--ok      { background: rgb(var(--tw-green-50)); color: rgb(var(--tw-green-700)); }
.charge-pill--warning { background: #fffbeb; color: #92400e; }
.charge-pill--danger  { background: rgb(var(--tw-red-50)); color: rgb(var(--tw-red-700)); }

/* ── Empty states ──────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #94a3b8;
  text-align: center;
  gap: 12px;
}

.empty-state svg { width: 40px; height: 40px; opacity: .5; }
.empty-state p   { font-size: 0.875rem; max-width: 280px; }

/* ── Spinner inline ────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

/* ── Validation badges ─────────────────────────────────────── */
.valid-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 9999px;
  font-size: 0.75rem; font-weight: 600;
}
.valid-chip--ok  { background: rgb(var(--tw-green-50)); color: rgb(var(--tw-green-600)); }
.valid-chip--nok { background: rgb(var(--tw-red-50)); color: rgb(var(--tw-red-600)); }

/* ── Animations ────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

/* ── Responsive helpers ────────────────────────────────────── */
@media (max-width: 640px) {
  .hide-mobile { display: none !important; }
}

@media (max-width: 1024px) {
  .hide-tablet { display: none !important; }
}

/* ── Tooltips (data-tip) ───────────────────────────────────── */
/* Usage : <span data-tip="Mon texte&#10;Ligne 2">              */
/* Rendu géré en JS (position:fixed sur #tooltip-global)        */
/* ⚠ NE PAS revenir à ::after — les parents overflow:hidden    */
/*   coupent les pseudo-éléments position:absolute.             */
[data-tip] {
  cursor: help;
}

/* Tooltip global — injecté dans <body> par utils.js */
#tooltip-global {
  position: fixed;
  z-index: 9999;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 0.7rem;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 8px;
  pointer-events: none;
  max-width: 260px;
  white-space: pre-line;
  box-shadow: 0 6px 20px rgba(0,0,0,.28);
  text-align: left;
  font-weight: 400;
  opacity: 0;
  transition: opacity .15s;
  display: none;
}
/* Flèche pointant vers le bas (tooltip au-dessus de l'élément) */
#tooltip-global.tt-top::after {
  content: '';
  position: absolute;
  top: 100%;
  left: var(--arrow-left, 50%);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e293b;
}
/* Flèche pointant vers le haut (tooltip en dessous de l'élément) */
#tooltip-global.tt-bottom::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: var(--arrow-left, 50%);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: #1e293b;
}

/* ── Print (export PDF Gantt) ──────────────────────────────── */
@media print {
  #sidebar, header, #toast-container { display: none !important; }
  #view-container { padding: 0 !important; overflow: visible !important; }
  body { background: white; }
}

/* ── Cadrans Journée / Nuit (Production, Planning S+1) ─────── */
/* Côte à côte sur grand écran, l'un sous l'autre sinon, comme l'écran PHP.
   Un cadran agrandi prend toute la largeur ; l'autre se replie en bandeau. */
.cadrans {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}
@media (min-width: 1280px) {
  .cadrans--deux { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.cadran {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  min-width: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.cadran__entete {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem 1rem;
  border-bottom: 1px solid #f1f5f9;
}
.cadran__entete--jour { background: #fffbeb; }   /* jour : ambre très pâle */
.cadran__entete--nuit { background: #eef2ff; }   /* nuit : indigo très pâle */
.cadran--replie .cadran__entete { border-bottom: none; }
.cadran__titre  { font-weight: 600; font-size: .875rem; color: #1e293b; }
.cadran__nombre { font-size: .75rem; color: #64748b; }
.cadran__bouton {
  margin-left: auto;
  font-size: .75rem;
  font-weight: 500;
  color: #475569;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: .2rem .6rem;
  cursor: pointer;
}
.cadran__bouton:hover        { border-color: var(--color-primary); color: var(--color-primary); }
.cadran__bouton:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.cadran__corps { overflow-x: auto; }

.cadrans-bloc { display: flex; flex-direction: column; gap: .5rem; }
.cadrans-bloc__entete {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 .25rem;
}
.cadrans-bloc__sous-titre { font-size: .75rem; color: #94a3b8; }

/* Jours du Planning S+1 : en-têtes qui servent aussi de cibles de dépôt */
.jour-entete {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #475569;
}
.jour-entete--vide       { color: #94a3b8; font-weight: 500; }
.jour-entete__nombre     { margin-left: auto; font-weight: 500; text-transform: none; letter-spacing: 0; color: #94a3b8; }
.jour-vide-indice        { display: none; margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; }
.glissement-en-cours .jour-vide-indice { display: inline; color: var(--color-primary); }

/* ── Glisser-déposer ───────────────────────────────────────── */
tr[draggable="true"]            { cursor: grab; }
tr[draggable="true"]:active     { cursor: grabbing; }
.en-glissement                  { opacity: .4; }
.zone-survolee {
  outline: 2px dashed var(--color-primary);
  outline-offset: -2px;
  background-color: rgba(30, 64, 175, .05);
}

/* ── Dates à revoir ────────────────────────────────────────── */
/* Ligne dont la date ou l'heure d'entrée ne concorde plus avec son jour ou
   son équipe - typiquement après un glisser-déposer. Redevient normale d'elle-
   même une fois les dates corrigées. */
.ligne-a-revoir > td            { background-color: #fff7ed; }
.ligne-a-revoir > td:first-child { box-shadow: inset 3px 0 0 var(--color-warning); }
.date-a-revoir {
  flex-shrink: 0;
  color: var(--color-warning);
  font-size: .85rem;
  line-height: 1;
  cursor: help;
}

/* ================================================================
   DALTONISME - voir js/couleurs.js
   1. Pour tout le monde : chaque couleur d'état est doublée d'un symbole.
   2. html.daltonien (réglage de chacun) : vert -> bleu, rouge -> vermillon
      (variables de src/tailwind-input.css), métiers en palette Okabe-Ito,
      hachures sur les zones en alerte.
   ================================================================ */

/* ── 1. Symboles de statut, visibles de tous ──────────────── */
.badge-planifie::before { content: "○" / ""; }
.badge-cloture::before  { content: "✓" / ""; }
.badge-reporte::before  { content: "↷" / ""; }
.badge-annule::before   { content: "✕" / ""; }

/* Étiquette de métier : l'abréviation se lit, la couleur ne fait qu'aider. */
.metier-tag {
  --c: var(--color-meca);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  margin-right: 2px;
  padding: 0 4px;
  border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, white);
  background: color-mix(in srgb, var(--c) 14%, white);
  color: color-mix(in srgb, var(--c) 70%, black);
  font-size: .625rem;
  font-weight: 700;
  line-height: 1rem;
  letter-spacing: .02em;
}
.metier-tag--elec { --c: var(--color-elec); }
.metier-tag--ai   { --c: var(--color-ai); }
.metier-tag--meca { --c: var(--color-meca); }
.metier-tag--meor { --c: var(--color-meor); }
.metier-tag--mefr { --c: var(--color-mefr); }
.metier-tag--meth { --c: var(--color-meth); }
.metier-tag--sc   { --c: var(--color-sc); }
.metier-tag--nett { --c: var(--color-nett); }

/* Niveau d'une carte d'indicateur : symbole + mot */
.niveau-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 9999px;
  font-size: .625rem;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(255, 255, 255, .7);
}
.niveau-tag--success { color: rgb(var(--tw-green-700)); }
.niveau-tag--warning { color: #92400e; }
.niveau-tag--danger  { color: rgb(var(--tw-red-700)); }

/* Bouton du menu */
.btn-daltonien {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  margin-bottom: .25rem;
  padding: .4rem .5rem;
  border-radius: .5rem;
  font-size: .75rem;
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
}
.btn-daltonien:hover         { background: #f8fafc; color: #334155; }
.btn-daltonien:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.btn-daltonien__etat {
  font-size: .625rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 9999px;
  background: #f1f5f9;
  color: #64748b;
}
.btn-daltonien[aria-pressed="true"] .btn-daltonien__etat {
  background: var(--color-primary);
  color: #fff;
}

/* ── 2. Mode daltonien ────────────────────────────────────── */
/* Palette Okabe-Ito : reste distincte pour tous les types de daltonisme. */
html.daltonien {
  --color-elec: #0072b2;
  --color-ai:   #cc79a7;
  --color-meca: #6b7280;
  --color-meor: #e69f00;
  --color-mefr: #56b4e9;
  --color-meth: #009e73;
  --color-sc:   #d55e00;
  --color-nett: #000000;   /* noir : toujours distinct, quel que soit le daltonisme */

  --color-warning: #e69f00;

  --serie-1: #0072b2;
  --serie-2: #e69f00;
  --serie-3: #009e73;
  --serie-4: #cc79a7;
  --serie-5: #d55e00;
  --serie-6: #56b4e9;
}

/* « Clôturé » passe au bleu : « planifié », bleu lui aussi, devient neutre. */
.daltonien .badge-planifie { background: #f1f5f9; color: #334155; }

/* Barres de Gantt : les teintes claires de la palette (orange, ciel) rendaient
   le texte blanc peu lisible. */
.daltonien .gantt-bar { text-shadow: 0 0 2px rgba(0, 0, 0, .85), 0 0 1px rgba(0, 0, 0, .85); }

/* Hachures sur ce qui est en alerte : se voit même sans percevoir la teinte. */
.daltonien .progress-bar__fill--danger,
.daltonien .bg-red-500,
.daltonien .bg-rose-500 {
  background-image: repeating-linear-gradient(45deg,
    rgba(255, 255, 255, .45) 0 3px, transparent 3px 7px);
}
.daltonien td.bg-red-100,
.daltonien .gantt-row--error .gantt-agent-info {
  background-image: repeating-linear-gradient(45deg,
    rgb(var(--tw-red-300) / .45) 0 2px, transparent 2px 7px);
}
.daltonien .kk-bar--red {
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .45) 0 3px, transparent 3px 7px),
                    linear-gradient(90deg, rgb(var(--tw-red-400)), rgb(var(--tw-red-500)));
}

/* ── Voies multiples d'une opération ───────────────────────── */
/* Une opération peut passer par plusieurs voies, dans l'ordre de saisie :
   la rame commence sur la première et finit sur la dernière. */
.voie-fleche {
  display: inline-block;
  margin: 0 2px;
  color: #94a3b8;
  font-size: .7rem;
}
.voies-editeur {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
}
.voie-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 4px 1px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  font-size: .7rem;
  font-weight: 700;
  color: #334155;
}
.voie-chip__fleche  { margin-right: 3px; color: #94a3b8; font-weight: 400; }
.voie-chip__nom     { letter-spacing: .02em; }
.voie-chip__retirer {
  border: none;
  background: none;
  color: #cbd5e1;
  font-size: .65rem;
  line-height: 1;
  padding: 1px 2px;
  cursor: pointer;
}
.voie-chip__retirer:hover { color: var(--color-danger); }

/* ── Champ de recherche des tableaux ───────────────────────── */
.champ-recherche { position: relative; display: inline-flex; align-items: center; }
.champ-recherche svg {
  position: absolute;
  left: 9px;
  width: 14px;
  height: 14px;
  color: #94a3b8;
  pointer-events: none;
}
.champ-recherche .form-input {
  padding-left: 29px;
  min-width: 15rem;
  font-size: .8125rem;
}

/* ── Onglets de familles (BDD modules) ─────────────────────── */
.familles-onglets {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  padding-bottom: .125rem;
}
.famille-onglet {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .75rem;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  background: #fff;
  font-size: .8125rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.famille-onglet:hover         { border-color: var(--color-primary); color: var(--color-primary); }
.famille-onglet:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.famille-onglet--actif {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 600;
}
.famille-onglet__nombre {
  font-size: .6875rem;
  font-weight: 700;
  padding: 0 .375rem;
  border-radius: 9999px;
  background: #f1f5f9;
  color: #64748b;
}
.famille-onglet--actif .famille-onglet__nombre { background: rgba(255, 255, 255, .25); color: #fff; }

/* ── Variante de série d'un module ─────────────────────────── */
/* Une gamme n'a pas le même contenu d'une série à l'autre. Quand la rame ne
   suffit pas à trancher, on demande plutôt que de deviner. */
.variante-indice {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
  font-size: .65rem;
  font-weight: 600;
  font-family: ui-monospace, monospace;
}
.variante-select { border-color: var(--color-warning); }
.variante-select--a-choisir {
  background: #fffbeb;
  color: #92400e;
  font-weight: 600;
}

/* ── Lots d'une opération massifiée ────────────────────────── */
/* Chaque lot peut se faire sur sa propre voie : MIDK6 sur M7, MITES sur T10. */
.lots-resume {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem;
  font-size: .6875rem;
  font-family: ui-monospace, monospace;
  color: #64748b;
}
.lots-resume__voie {
  margin-left: 3px;
  padding: 0 5px;
  border-radius: 4px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 700;
}

/* ── Tâches d'un module (unité de placement) ───────────────── */
.taches-bloc table input,
.taches-bloc table select { min-width: 0; }
.taches-bloc tbody tr:hover { background: #f8fafc; }

/* ── Ligne annoncée par le rendez-vous, à renseigner ───────── */
/* « 3GENE- » ouvre trois lignes vides : le détail vient d'un autre outil. */
.a-renseigner {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: 1px 7px;
  border-radius: 6px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: .6875rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Consistance saisie d'une ligne hors BDD ───────────────── */
.consistance {
  border-left: 2px solid #fde68a;
  padding-left: .6rem;
}

/* ── Calendrier des semaines types (écran PHP) ─────────────── */
.semaines-types {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: .4rem;
}
.semaine-type {
  /* la marque de mouvement se pose dans le coin */
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .4rem .5rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}
.semaine-type--vide     { background: #f8fafc; border-style: dashed; }
.semaine-type--courante { border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(30, 64, 175, .12); }
.semaine-type__num {
  font-size: .6875rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: .03em;
}
.semaine-type--courante .semaine-type__num { color: var(--color-primary); }
.semaine-type__nom    { font-size: .8125rem; font-weight: 600; color: #1e293b; }
.semaine-type__choix {
  width: 100%;
  padding: .15rem .25rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: .75rem;
  background: #fff;
  color: #1e293b;
}
.semaine-type__choix:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }

/* ── Charge d'une semaine type ─────────────────────────────── */
.semaine-type__charge {
  align-self: flex-end;
  font-size: .625rem;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 4px;
}
.semaine-type--ok      .semaine-type__charge { background: rgb(var(--tw-green-100)); color: rgb(var(--tw-green-700)); }
.semaine-type--tendu   { border-color: #fcd34d; }
.semaine-type--tendu   .semaine-type__charge { background: #fef3c7; color: #92400e; }
.semaine-type--depasse { border-color: rgb(var(--tw-red-300)); background: rgb(var(--tw-red-50) / .5); }
.semaine-type--depasse .semaine-type__charge { background: rgb(var(--tw-red-100)); color: rgb(var(--tw-red-700)); }
.semaine-type__pose {
  margin-left: 3px;
  padding: 0 4px;
  border-radius: 4px;
  background: #eef2ff;
  color: #3730a3;
  font-size: .5625rem;
  font-weight: 700;
}

.charge-resume {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  margin-bottom: .6rem;
  font-size: .75rem;
  color: #475569;
}
.charge-resume__item--tendu   strong, .charge-resume__item--tendu   { color: #92400e; }
.charge-resume__item--depasse strong, .charge-resume__item--depasse { color: rgb(var(--tw-red-700)); }

.voie-choix {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .55rem;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  font-size: .75rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
}
.voie-choix:has(input:checked) { border-color: var(--color-primary); color: var(--color-primary); background: #eff6ff; }
.semaine-type__ajout {
  float: right;
  border: none;
  background: none;
  color: #94a3b8;
  font-size: .8rem;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}
.semaine-type__ajout:hover { color: var(--color-primary); }

/* ── Besoin en agents, par semaine type ────────────────────── */
.semaine-type__besoin {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  cursor: pointer;
}
.besoin-metier {
  padding: 0 4px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  font-size: .625rem;
  font-weight: 700;
}
.besoin-metier--depasse { background: rgb(var(--tw-red-100)); color: rgb(var(--tw-red-700)); }
.semaine-type__ouvrir {
  float: right;
  border: none;
  background: none;
  color: #94a3b8;
  font-size: .8rem;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}
.semaine-type__ouvrir:hover { color: var(--color-primary); }

.besoin-carte {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .6rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: .75rem;
  color: #334155;
}
.besoin-carte--tendu   { border-color: #fcd34d; background: #fffbeb; }
.besoin-carte--depasse { border-color: rgb(var(--tw-red-300)); background: rgb(var(--tw-red-50)); }
.origine-modele {
  padding: 0 5px;
  border-radius: 4px;
  background: #eef2ff;
  color: #3730a3;
  font-size: .625rem;
  font-weight: 700;
}

/* Pose sur une voie deja prise : une rame devra etre deplacee.
   Ce cas ne doit pas echapper au planificateur, il porte sa marque partout
   ou la pose s'affiche : fenetre de semaine, case du calendrier, planning. */
.marque-mouvement {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    margin-left: 0.25rem;
    padding: 0 0.2rem;
    border: 1px solid #f59e0b;
    border-radius: 0.375rem;
    background: #fffbeb;
    color: #b45309;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    cursor: help;
}
.marque-mouvement--case {
    position: absolute;
    top: 0.15rem;
    right: 0.15rem;
    margin-left: 0;
}

/* Detail d'une operation massifiee : un module par ligne, avec sa voie.
   MIDK6+MITES n'est pas une rame sur une voie, mais MIDK6 sur M7 et MITES
   sur T10 — le planificateur doit lire les deux. */
.ligne-lot {
    background: #f8fafc;
    font-size: 0.6875rem;
}
.ligne-lot td { border-bottom: 1px solid #f1f5f9; }
/* Travail a cheval sur deux equipes : l'equipe de jour ne finit pas, la nuit
   reprend, et la rame reste sur la voie entre les deux. */
.a-cheval {
    display: inline-block;
    margin-left: 0.25rem;
    padding: 0 0.25rem;
    border: 1px solid #c7d2fe;
    border-radius: 0.25rem;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.625rem;
    font-weight: 700;
    cursor: help;
}

.lot-sans-voie {
    display: inline-block;
    padding: 0 0.3rem;
    border: 1px dashed #f59e0b;
    border-radius: 0.25rem;
    color: #b45309;
    font-weight: 600;
    cursor: help;
}


/* Un code de pointage, tel qu'il s'ecrit dans la case : J, N, RP… */
.code-pointage {
  display: inline-block;
  min-width: 2rem;
  padding: 0 .375rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #0f172a;
  font-weight: 700;
  font-size: .75rem;
  line-height: 1.5rem;
  text-align: center;
}

/* ── Pointages : agents en lignes, jours en colonnes, comme le classeur ── */
.pt-periode { min-width: 12rem; text-align: center; font-weight: 600; color: #0f172a; font-size: .875rem; }
.pt-palette { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; padding: .5rem .75rem;
  background: #fff; border: 1px solid #e2e8f0; border-radius: .75rem; }
.pt-outil { display: inline-flex; align-items: center; gap: .25rem; padding: .125rem; border: 2px solid transparent;
  border-radius: 6px; font-size: .75rem; color: #475569; cursor: pointer; }
.pt-outil:hover { border-color: #cbd5e1; }
.pt-outil--actif { border-color: var(--color-primary); background: #eff6ff; }
.pt-table { border-collapse: collapse; font-size: .75rem; width: max-content; min-width: 100%; }
.pt-table th, .pt-table td { border: 1px solid #e2e8f0; padding: 0; text-align: center; }
.pt-table thead th { background: #f8fafc; color: #475569; font-weight: 600; }
.pt-agent { position: sticky; left: 0; z-index: 1; background: #fff; text-align: left !important;
  padding: .25rem .5rem !important; white-space: nowrap; min-width: 11rem; }
.pt-table thead .pt-agent { background: #f8fafc; }
.pt-corps td { background: #f1f5f9; text-align: left; font-weight: 700; color: #334155; padding: .25rem .5rem; }
.pt-case { width: 2.25rem; height: 1.75rem; }
.pt-case[data-act] { cursor: pointer; }
.pt-case[data-act]:hover { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.pt-case--we { background: #f8fafc; }
.pt-case--auj { box-shadow: inset 0 0 0 2px #f59e0b; }
.pt-case--large { width: auto; min-width: 16rem; text-align: left !important; padding: .25rem .5rem !important; }
.pt-case .code-pointage { min-width: 1.75rem; padding: 0 .125rem; font-size: .6875rem; line-height: 1.25rem; }
/* 1/2 Présence : la case coupée en deux moitiés de shift. */
.pt-case--demi { padding: 0 !important; }
.pt-demi { display: flex; width: 100%; height: 100%; min-height: 1.5rem; }
.pt-demi__part { flex: 1 1 50%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pt-demi__part + .pt-demi__part { border-left: 1px dashed #94a3b8; }
.pt-demi__part .code-pointage { min-width: 0; width: 100%; padding: 0; font-size: .5625rem; border-radius: 0; }
.pt-demi__part--present { font-size: .5625rem; font-weight: 600; color: #166534; background: #f0fdf4; }
.pt-demi__part--nuit { color: #1e3a8a; background: #dbeafe; }
.pt-demi-vac { display: inline-flex; align-items: center; gap: .25rem; margin-left: .5rem; padding-left: .5rem;
               border-left: 1px solid #cbd5e1; font-size: .75rem; color: #475569; }
.pt-jour { min-width: 2.25rem; }
.pt-jour__btn { display: flex; flex-direction: column; align-items: center; width: 100%; padding: .125rem 0;
  line-height: 1.1; cursor: pointer; color: inherit; }
.pt-jour__btn:hover { color: var(--color-primary); }
.pt-compteur { min-width: 2.5rem; padding: 0 .25rem !important; font-weight: 600; color: #334155; background: #fafafa; }
.pt-compteur--presence { background: #f0fdf4; color: #166534; }
.pt-total td { background: #f8fafc; font-weight: 600; color: #166534; }
.pt-mois { min-width: 4.5rem; padding: .25rem !important; }
.pt-mois__abs { display: block; font-size: .625rem; color: #64748b; font-weight: 400; }
.pt-bilan { display: flex; gap: .5rem; padding: .25rem .625rem; border: 1px solid #e2e8f0; border-radius: .5rem;
  background: #fff; font-size: .75rem; }
.pt-table--jour { width: auto; min-width: 0; margin: 0 .75rem .75rem; }

/* ── PHP : présents pointés contre besoin ───────────────────────────── */
.couverture { display: inline-flex; align-items: center; gap: 2px; margin-top: 2px; padding: 0 5px;
  border-radius: 4px; font-size: .625rem; font-weight: 700; cursor: pointer; border: 1px solid; }
.couverture--ok     { color: #166534; background: #f0fdf4; border-color: #86efac; }
.couverture--manque { color: #991b1b; background: #fef2f2; border-color: #fca5a5; }
.couverture-cellule { min-width: 3rem; padding: .25rem !important; font-weight: 600; color: #166534; background: #f0fdf4; }
.couverture-cellule span { display: block; font-size: .625rem; font-weight: 400; }
.couverture-cellule--manque { color: #991b1b; background: #fee2e2; }

/* ── Pointages : se repérer et ne rien casser ───────────────────────────
   La grille défile dans son propre cadre, sur les deux axes : les noms
   restent à gauche, les jours en haut, les présents en bas. */
.pt-cadre { max-height: calc(100vh - 290px); min-height: 260px; overflow: auto; position: relative; }
.pt-cadre .pt-table { border-collapse: separate; border-spacing: 0; }
.pt-cadre .pt-table th, .pt-cadre .pt-table td { border: 0; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.pt-cadre thead th { position: sticky; top: 0; z-index: 2; }
.pt-cadre .pt-agent { position: sticky; left: 0; z-index: 1; box-shadow: 2px 0 4px rgba(15, 23, 42, .06); }
.pt-cadre thead .pt-agent { z-index: 3; }     /* le coin reste au-dessus de tout */
.pt-cadre .pt-corps .pt-agent { background: #f1f5f9; }

/* Une ligne sur deux, nettement, et la ligne survolée qui s'éclaire d'un bout à l'autre. */
.pt-ligne td { background-color: #fff; }
/* La ligne de notes du DPx sous un agent (2026-11-05) : le texte reste dans
   sa case, entier en infobulle. */
.pt-note { max-width: 2.25rem; height: 1.25rem; padding: 0 1px; text-align: center; vertical-align: middle; }
.pt-note__txt { display: block; font-size: .5625rem; line-height: 1.05; color: #92400e; font-weight: 600;
  max-height: 1.2rem; overflow: hidden; overflow-wrap: anywhere; cursor: help; }
.pt-mois__notes { display: block; font-size: .625rem; color: #92400e; }
.pt-note__jour { padding: 0 .5rem; font-size: .75rem; color: #92400e; text-align: left; }
.pt-note__btn { display: block; width: 100%; min-height: 1.2rem; cursor: text; border-radius: 2px; }
.pt-note__btn:hover { background: #fef3c7; }
.pt-note__btn:focus-visible, .pt-note__ajout:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 1px; }
.pt-note__btn .pt-note__txt { cursor: text; }
.pt-note__ajout { color: inherit; border-radius: 3px; padding: 0 .25rem; }
.pt-note__ajout:hover { background: #fef3c7; }
.pt-ligne td.pt-case--we { background-color: #f1f5f9; }
.pt-ligne--paire td { background-color: #f1f5f9; }
.pt-ligne--paire td.pt-case--we { background-color: #e2e8f0; }
.pt-ligne:hover td, .pt-ligne:hover .pt-agent { background-color: #eff6ff; }
.pt-ligne:hover .pt-agent { font-weight: 700; color: #1e3a8a; }
/* Un agent et sa ligne de notes, son nom fusionné : ils s'éclairent ensemble. */
.pt-ligne:hover + .pt-ligne--notes td, .pt-ligne:has(+ .pt-ligne--notes:hover) td { background-color: #eff6ff; }
.pt-ligne:has(+ .pt-ligne--notes:hover) .pt-agent { font-weight: 700; color: #1e3a8a; }
.pt-ligne:has(+ .pt-ligne--notes:hover) .pt-agent__ext { opacity: 1; }
.pt-jour--vise { background: #dbeafe !important; color: #1e3a8a !important; }

/* Le lundi ouvre la semaine : un trait plus franc. */
.pt-case--lundi { border-left: 3px solid #64748b !important; }

/* Le brouillon : ce qui changera à l'enregistrement, et seulement cela. */
.pt-case--brouillon { box-shadow: inset 0 0 0 2px #f59e0b; background-color: #fffbeb !important; }
.pt-cadre--saisie .pt-case[data-date] { cursor: crosshair; }
.pt-cadre--saisie { user-select: none; }

/* La barre d'état : qui, quel jour, quoi — sans plisser les yeux. */
.pt-etat { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; min-height: 2.25rem;
  padding: .375rem .75rem; border-bottom: 1px solid #e2e8f0; background: #f8fafc; font-size: .8125rem; color: #475569; }
.pt-etat strong { color: #0f172a; }
.pt-etat__code { font-weight: 600; color: #0f172a; }
.pt-etat__avant { color: #b45309; font-weight: 600; }

/* Ce qui attend d'être enregistré. */
.pt-brouillon { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem;
  padding: .375rem .75rem; border: 1px solid #e2e8f0; border-radius: .75rem; background: #fff; font-size: .8125rem; color: #64748b; }
.pt-brouillon--actif { border-color: #f59e0b; background: #fffbeb; color: #92400e; }
.pt-brouillon > span { margin-right: auto; }
.pt-brouillon .btn[disabled] { opacity: .45; cursor: not-allowed; }

/* En fin d'équipe, ses présents du jour. */
.pt-cadre .pt-total td { background: #f0fdf4; color: #166534; font-weight: 700; }
.pt-cadre .pt-total .pt-agent { background: #f0fdf4; }
.pt-total--fin td { border-bottom: 2px solid #86efac !important; }
.pt-total__corps { font-weight: 400; color: #15803d; font-size: .6875rem; }
.pt-cadre .pt-corps td { background: #e2e8f0; color: #0f172a; font-weight: 700; }

/* Pointages : les numéros de semaine au-dessus des jours, figés eux aussi. */
.pt-cadre thead tr.pt-semaines th { top: 0; height: 1.5rem; font-size: .6875rem; font-weight: 700;
  color: #334155; background: #e2e8f0; letter-spacing: .02em; }
.pt-cadre thead tr.pt-semaines + tr th { top: 1.5rem; }

/* Présents contre besoin PHP, en fin de famille. */
.pt-couv { font-size: .6875rem; font-weight: 700; }
.pt-cadre .pt-total--couv td { background: #f8fafc; color: #475569; }
.pt-cadre .pt-total--couv .pt-agent { background: #f8fafc; }
.pt-cadre .pt-total--couv td.pt-couv--manque { background: #fee2e2; color: #991b1b; }
.pt-cadre .pt-total--couv td.pt-couv--ok { background: #dcfce7; color: #166534; }

/* Extraction des pointages : choisir les agents, les codes, la forme. */
.pt-ext__liste { max-height: 14rem; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: .5rem; padding: .25rem .5rem; background: #fff; }
.pt-ext__item { display: flex; align-items: center; gap: .5rem; padding: .2rem 0; cursor: pointer; }
.pt-ext__corps { margin-top: .375rem; font-size: .6875rem; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .04em; }
/* Le calendrier d'un agent, à portée de main sur sa ligne. */
.pt-agent__ext { margin-left: .25rem; opacity: 0; font-size: .75rem; cursor: pointer; }
.pt-ligne:hover .pt-agent__ext, .pt-agent__ext:focus-visible { opacity: 1; }

/* Interrupteur « Nuits notées le lendemain » : un vrai interrupteur, état lisible. */
.pt-interrupteur { display: inline-flex; align-items: center; gap: .5rem; padding: .3rem .6rem; border: 1px solid #cbd5e1;
  border-radius: .5rem; background: #fff; font-size: .8125rem; font-weight: 600; color: #475569; cursor: pointer; }
.pt-interrupteur__piste { position: relative; width: 2rem; height: 1.1rem; border-radius: 999px; background: #cbd5e1; transition: background .15s; }
.pt-interrupteur__bouton { position: absolute; top: .15rem; left: .15rem; width: .8rem; height: .8rem; border-radius: 999px;
  background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .3); transition: left .15s; }
.pt-interrupteur--on { border-color: #1d4ed8; background: #eff6ff; color: #1e3a8a; }
.pt-interrupteur--on .pt-interrupteur__piste { background: #1d4ed8; }
.pt-interrupteur--on .pt-interrupteur__bouton { left: 1.05rem; }
.pt-interrupteur:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 2px; }

/* Un N lu la veille : la petite flèche le dit, sans déplacer la case. */
.pt-case--veille { position: relative; }
.pt-case--veille::after { content: '↶'; position: absolute; top: 0; left: 1px; font-size: .5625rem; line-height: 1; color: #1d4ed8; font-weight: 700; }
.pt-etat__veille { color: #1d4ed8; font-weight: 600; }

/* Un agent retiré de l'année : ses cases hachurées, on n'y pointe rien. */
.pt-ligne td.pt-case--retire { background: repeating-linear-gradient(135deg, #e2e8f0 0 3px, #f8fafc 3px 7px); cursor: not-allowed; }
.pt-etat__retire { color: #b45309; font-weight: 600; }
.pt-retires { font-size: .75rem; color: #92400e; padding: .25rem .75rem; }

/* Construire : les groupes de rotation, retouchables avant de lancer. */
.pt-gr { border: 1px solid #e2e8f0; border-radius: .5rem; padding: .375rem .5rem; }
.pt-gr__tete { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .75rem; }
.pt-gr__apercu { display: inline-flex; gap: 1px; }
.pt-gr__apercu span { width: 1.1rem; text-align: center; font-size: .625rem; font-weight: 700; border-radius: 2px; background: #fef3c7; color: #92400e; }
.pt-gr__apercu span.pt-gr__n { background: #1e3a8a; color: #fff; }
.pt-gr__membres { display: flex; flex-wrap: wrap; gap: .25rem .75rem; margin-top: .25rem; font-size: .75rem; }
.pt-gr__membres select { font-size: .6875rem; padding: 0 .25rem; border: 1px solid #cbd5e1; border-radius: .25rem; }
.pt-gr__choix { font-size: .75rem; padding: .125rem .375rem; border: 1px solid #cbd5e1; border-radius: .375rem; background: #fff; }

/* Arrivées TCAD en face des rendez-vous (Planning S+1). */
.tcad-table { border-collapse: collapse; font-size: .8125rem; width: 100%; }
.tcad-table th, .tcad-table td { border-bottom: 1px solid #e2e8f0; padding: .375rem .5rem; text-align: left; vertical-align: top; }
.tcad-table thead th { position: sticky; top: 0; background: #f8fafc; color: #475569; font-weight: 600; z-index: 1; }
.tcad-creneau td { background: #eef2ff; color: #3730a3; font-weight: 600; font-size: .75rem; }
.tcad-impossible td { background: #fef2f2; }

/* ── Planning S+1 : menus Importer / Afficher ──────────────── */
.menu-deroulant { position: relative; display: inline-block; }
.menu-deroulant > summary { list-style: none; cursor: pointer; }
.menu-deroulant > summary::-webkit-details-marker { display: none; }
.menu-deroulant__liste {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0;
  min-width: 250px; padding: 4px;
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgb(15 23 42 / .15);
}
.menu-deroulant__item {
  text-align: left; padding: 7px 10px; border-radius: 6px;
  font-size: .8125rem; font-weight: 600; color: #1e293b;
}
.menu-deroulant__item:hover, .menu-deroulant__item:focus-visible { background: #f1f5f9; }
.menu-deroulant__aide { display: block; font-size: .6875rem; font-weight: 400; color: #64748b; }

/* Une validation : son état et, pour le planificateur, le bouton. */
.valid-chip--bouton { cursor: pointer; border: 1px solid transparent; }
.valid-chip--bouton:hover { border-color: currentColor; }

/* Saturation de la semaine, en tête de la grille */
.jauge-bandeau { margin-left: auto; font-size: .75rem; font-weight: 600; color: #15803d; cursor: help; }
.jauge-bandeau--sature { color: #dc2626; }

/* ── Saisie d'un code module : propositions (ChoixModule) ──── */
.choix-module__liste {
  position: fixed; z-index: 9999;
  max-height: 320px; max-width: 520px; overflow-y: auto; padding: 4px;
  background: #fff; border: 1px solid #cbd5e1; border-radius: 8px;
  box-shadow: 0 12px 28px -6px rgb(15 23 42 / .25);
}
.choix-module__item {
  display: flex; align-items: baseline; gap: 10px; width: 100%;
  padding: 6px 8px; border-radius: 6px; text-align: left; font-size: .8125rem; color: #1e293b;
}
.choix-module__item strong { font-family: ui-monospace, monospace; font-weight: 700; white-space: nowrap; }
.choix-module__item span { color: #64748b; font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choix-module__item:hover, .choix-module__item--actif { background: #e0ecff; }

/* ── Planning S+1 en plein écran : toute la place pour la grille ── */
body.plein-ecran #sidebar,
body.plein-ecran #main-area > header { display: none !important; }
body.plein-ecran #main-area { padding-left: 0 !important; }
body.plein-ecran #view-container { padding: .5rem 1rem !important; }
