/* ============================
   VARIABLES & RESET
   ============================ */
:root {
  --bleu:        #2563EB;
  --bleu-clair:  #EFF6FF;
  --bleu-moyen:  #BFDBFE;
  --bleu-fonce:  #1D4ED8;
  --blanc:       #FFFFFF;
  --gris-bg:     #F8FAFC;
  --gris-border: #E2E8F0;
  --gris-text:   #64748B;
  --texte:       #1E293B;
  --rouge:       #EF4444;
  --vert:        #22C55E;
  --orange:      #F97316;

  /* Couleurs par catégorie */
  --col-architecture:  #3B82F6;
  --col-infrastructure:#8B5CF6;
  --col-service:       #06B6D4;
  --col-conges:        #F59E0B;
  --col-maladie:       #EF4444;
  --col-ferie:         #EC4899;
  --col-admin:         #64748B;
  --col-formation:     #10B981;
  --col-reunion:       #6366F1;
  --col-avant-vente:   #F97316;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--gris-bg);
  color: var(--texte);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================
   HEADER
   ============================ */
header {
  background: var(--bleu);
  color: white;
  padding: 0 1.5rem;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-left { display: flex; align-items: center; gap: 1rem; }
.logo {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 2px;
  background: white;
  color: var(--bleu);
  padding: 2px 10px;
  border-radius: 4px;
}
.header-title { font-size: 0.95rem; opacity: 0.9; }

.header-right { display: flex; align-items: center; gap: 1rem; }
.header-user {
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0.85;
  padding: 3px 10px;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
}
.btn-logout {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-logout:hover { background: rgba(255,255,255,0.35); }

.btn-contrat {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s;
}
.btn-contrat.active {
  background: white;
  color: var(--bleu);
}
.btn-contrat:hover:not(.active) { background: rgba(255,255,255,0.35); }

.nav-mois {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-mois button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.nav-mois button:hover { background: rgba(255,255,255,0.35); }
#label-mois { font-weight: 600; font-size: 0.95rem; min-width: 100px; text-align: center; }

/* ============================
   LAYOUT PRINCIPAL
   ============================ */
main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ============================
   PANNEAU GAUCHE
   ============================ */
.panneau-gauche {
  width: 25%;
  min-width: 280px;
  background: var(--blanc);
  border-right: 1px solid var(--gris-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-title {
  padding: 0.75rem 1rem;
  background: var(--bleu-clair);
  border-bottom: 1px solid var(--bleu-moyen);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--bleu-fonce);
}

.heures-total {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
}
.heures-total .sep { color: var(--gris-text); }
#total-saisi { font-weight: 700; color: var(--bleu); }
#total-contrat { color: var(--gris-text); }

/* Tableau */
.table-wrapper {
  flex: 1;
  overflow-y: auto;
}

#table-pointages {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

#table-pointages thead th {
  background: var(--gris-bg);
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--gris-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--gris-border);
  position: sticky;
  top: 0;
}

#table-pointages tbody tr {
  border-bottom: 1px solid var(--gris-border);
  transition: background 0.1s;
}
#table-pointages tbody tr:hover { background: var(--bleu-clair); }
#table-pointages tbody tr.ligne-active {
  background: var(--bleu-moyen);
  outline: 2px solid var(--bleu);
  outline-offset: -1px;
}

#table-pointages tbody td {
  padding: 6px 8px;
  vertical-align: middle;
}

.td-nom { max-width: 120px; }
.td-nom .nom-affaire {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
  display: block;
}
.td-num {
  font-size: 0.75rem;
  color: var(--gris-text);
  white-space: nowrap;
  font-family: monospace;
}

.couleur-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
}

.td-heures {
  white-space: nowrap;
  text-align: center;
}
.td-heures .heures-ctrl {
  display: flex;
  align-items: center;
  gap: 3px;
}
.td-heures button {
  width: 20px;
  height: 20px;
  border: 1px solid var(--gris-border);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}
.td-heures button:hover { background: var(--bleu-clair); border-color: var(--bleu); }
.val-heures-input {
  width: 48px;
  text-align: center;
  font-weight: 600;
  font-size: 0.82rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  padding: 1px 2px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.val-heures-input:hover { border-color: var(--gris-border); background: var(--gris-bg); }
.val-heures-input:focus { border-color: var(--bleu); background: white; }

.td-suppr button {
  background: none;
  border: none;
  color: var(--gris-text);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 4px;
  border-radius: 3px;
  transition: all 0.1s;
}
.td-suppr button:hover { color: var(--rouge); background: #FEF2F2; }
.btn-favori { color: #CBD5E1 !important; }
.btn-favori:hover { color: #F59E0B !important; background: #FFFBEB !important; }
.btn-favori.favori-actif { color: #F59E0B !important; }

/* Favoris */
.favoris-section {
  border-bottom: 1px solid var(--gris-border);
}
.favoris-header {
  padding: 5px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gris-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--gris-bg);
}
.favoris-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gris-text);
  font-size: 0.82rem;
  padding: 2px 4px;
  border-radius: 3px;
  transition: all 0.1s;
}
.favoris-toggle:hover { color: var(--bleu); background: var(--bleu-clair); }

.favoris-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
}
.favori-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--bleu-moyen);
  background: var(--bleu-clair);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--bleu-fonce);
  cursor: pointer;
  transition: all 0.1s;
  white-space: nowrap;
}
.favori-chip:hover {
  background: var(--bleu-moyen);
  border-color: var(--bleu);
}
.favori-chip .favori-star {
  color: #F59E0B;
  font-size: 0.75rem;
}
.favori-chip .favori-suppr {
  color: var(--gris-text);
  font-size: 0.7rem;
  margin-left: 2px;
  display: none;
}
.favoris-list.edit-mode .favori-chip .favori-suppr { display: inline; }
.favoris-list.edit-mode .favori-chip .favori-star { display: none; }
.favoris-list.edit-mode .favori-chip {
  border-color: var(--rouge);
  background: #FEF2F2;
  color: var(--rouge);
}
.favoris-list.edit-mode .favori-chip:hover {
  background: #FECACA;
}

/* Ajout ligne */
.ajout-ligne {
  padding: 0.6rem;
  border-top: 1px solid var(--gris-border);
  background: var(--gris-bg);
}

.autocomplete-wrapper {
  width: 100%;
  position: relative;
}
.autocomplete-wrapper input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--gris-border);
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}
.autocomplete-wrapper input:focus { border-color: var(--bleu); }

.dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--bleu-moyen);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
}

.dropdown-item {
  padding: 7px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-bottom: 1px solid var(--gris-bg);
  transition: background 0.1s;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover, .dropdown-item.selected { background: var(--bleu-clair); }
.dropdown-item .d-nom { font-size: 0.85rem; font-weight: 500; }
.dropdown-item .d-num { font-size: 0.72rem; color: var(--gris-text); }
.dropdown-item .d-score {
  font-size: 0.68rem;
  color: var(--bleu);
  font-weight: 600;
  float: right;
}

.heures-input-wrapper {
  display: flex;
  align-items: center;
  border: 1px solid var(--gris-border);
  border-radius: 6px;
  overflow: hidden;
  background: white;
}
.heures-input-wrapper button {
  width: 24px;
  height: 32px;
  border: none;
  background: var(--gris-bg);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}
.heures-input-wrapper button:hover { background: var(--bleu-moyen); }
.heures-input-wrapper input {
  width: 44px;
  border: none;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  padding: 0 2px;
}
/* Cacher les flèches du number input */
.heures-input-wrapper input::-webkit-outer-spin-button,
.heures-input-wrapper input::-webkit-inner-spin-button { -webkit-appearance: none; }

.btn-ajouter {
  background: var(--bleu);
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-ajouter:hover { background: var(--bleu-fonce); }

/* Boutons rapides */
.boutons-rapides {
  padding: 0.4rem 0.6rem;
  display: flex;
  gap: 0.3rem;
  border-top: 1px solid var(--gris-border);
}
.boutons-rapides button {
  flex: 1;
  padding: 4px;
  border: 1px solid var(--gris-border);
  background: white;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gris-text);
  transition: all 0.1s;
}
.boutons-rapides button:hover {
  border-color: var(--bleu);
  color: var(--bleu);
  background: var(--bleu-clair);
}

/* Types spéciaux */
.types-speciaux {
  border-top: 1px solid var(--gris-border);
  padding: 0.5rem 0.6rem;
}
.types-titre {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gris-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
}
.types-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.type-btn {
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--gris-border);
  background: white;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.1s;
}
.type-btn:hover { border-color: var(--bleu); color: var(--bleu); background: var(--bleu-clair); }

/* Import / Export */
.import-export {
  padding: 0.6rem;
  border-top: 1px solid var(--gris-border);
  display: flex;
  gap: 0.4rem;
}
.btn-secondary {
  flex: 1;
  padding: 6px;
  border: 1px solid var(--gris-border);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  text-align: center;
  color: var(--gris-text);
  transition: all 0.15s;
  display: block;
}
.btn-secondary:hover {
  border-color: var(--bleu);
  color: var(--bleu);
  background: var(--bleu-clair);
}

/* ============================
   PANNEAU DROIT — CALENDRIER
   ============================ */
.panneau-droit {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--blanc);
}

.calendrier-header {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--gris-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--gris-bg);
}

.vue-switcher {
  display: flex;
  border: 1px solid var(--gris-border);
  border-radius: 6px;
  overflow: hidden;
}
.vue-btn {
  padding: 5px 16px;
  border: none;
  background: white;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gris-text);
  transition: all 0.15s;
}
.vue-btn.active { background: var(--bleu); color: white; }
.vue-btn:hover:not(.active) { background: var(--bleu-clair); }

.nav-semaine {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-semaine button {
  background: none;
  border: 1px solid var(--gris-border);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.1s;
}
.nav-semaine button:hover { border-color: var(--bleu); color: var(--bleu); }
#label-semaine { font-size: 0.85rem; font-weight: 600; min-width: 80px; text-align: center; }

.vue-calendrier {
  flex: 1;
  overflow: hidden;
  padding: 0.75rem;
}

/* ---- VUE MOIS ---- */
.mois-grid {
  display: flex;
  gap: 0.5rem;
  height: 100%;
}

.semaine-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--gris-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--gris-bg);
}

.semaine-col-header {
  padding: 6px 8px;
  background: var(--bleu-clair);
  border-bottom: 1px solid var(--bleu-moyen);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--bleu-fonce);
  text-align: center;
  cursor: pointer;
  transition: background 0.15s;
}
.semaine-col-header:hover { background: var(--bleu-moyen); }

.semaine-col-dates {
  font-size: 0.65rem;
  color: var(--gris-text);
  text-align: center;
  padding: 2px;
  border-bottom: 1px solid var(--gris-border);
}

.semaine-col-body {
  flex: 1;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.semaine-col-body:hover { filter: brightness(0.97); }

.barre-heures-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column-reverse;
  height: 100%;
}

.barre-affaire {
  width: 100%;
  min-height: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: height 0.3s ease;
}

.barre-affaire span {
  font-size: 0.68rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.semaine-label-heures {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gris-text);
}

/* ---- VUE SEMAINE ---- */
.semaine-grid {
  display: flex;
  gap: 0.5rem;
  height: 100%;
}

.jour-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--gris-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--gris-bg);
}

.jour-col-header {
  padding: 6px 4px;
  background: var(--bleu-clair);
  border-bottom: 1px solid var(--bleu-moyen);
  text-align: center;
}
.jour-col-header .jour-nom {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--bleu-fonce);
}
.jour-col-header .jour-date {
  font-size: 0.68rem;
  color: var(--gris-text);
}

.jour-col-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.bloc-affaire {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 4px;
  padding: 3px 5px;
  cursor: pointer;
  user-select: none;
  overflow: visible;
  transition: box-shadow 0.15s, outline 0.1s;
}
.bloc-affaire:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 10;
}
.bloc-affaire.actif {
  outline: 2px solid white;
  outline-offset: 1px;
  z-index: 20;
}
.bloc-affaire { cursor: grab; }
.bloc-affaire:active { cursor: grabbing; }
.bloc-affaire.dragging { opacity: 0.4; }
.bloc-affaire.drop-above { border-top: 3px solid var(--bleu) !important; }
.bloc-affaire.drop-below { border-bottom: 3px solid var(--bleu) !important; }

.jour-col-body.jour-drag-over {
  background: var(--bleu-clair) !important;
  outline: 2px dashed var(--bleu);
  outline-offset: -2px;
}
.bloc-affaire .bloc-nom {
  font-size: 0.72rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.bloc-affaire .bloc-heures {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.85);
}

.bloc-affaire .bloc-controls {
  display: flex;
  position: absolute;
  top: 2px;
  right: 2px;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}
.bloc-affaire:hover .bloc-controls { opacity: 1; }
.bloc-affaire .bloc-controls button {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 3px;
  background: rgba(0,0,0,0.3);
  color: white;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.bloc-affaire .bloc-controls .bloc-suppr:hover {
  background: var(--rouge);
}

.btn-ndf {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--gris-border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--gris-text);
  font-weight: 600;
  transition: all 0.1s;
  z-index: 5;
  white-space: nowrap;
}
.btn-ndf:hover { background: white; color: var(--orange); border-color: var(--orange); }

/* Barre de progression jour */
.jour-progress {
  height: 3px;
  background: var(--gris-border);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}
.jour-progress-fill {
  height: 100%;
  background: var(--vert);
  transition: width 0.3s;
}
.jour-progress-fill.over { background: var(--rouge); }

/* ---- JOURS FÉRIÉS ---- */
.jour-ferie .jour-col-body { background: repeating-linear-gradient(
  45deg, var(--gris-bg), var(--gris-bg) 4px, #F1F5F9 4px, #F1F5F9 8px
); }
.ferie-header { background: var(--col-ferie) !important; }
.ferie-header .jour-nom,
.ferie-header .jour-date { color: white !important; }
.ferie-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ferie-overlay {
  position: absolute;
  inset: 0;
  background: rgba(236, 72, 153, 0.04);
  pointer-events: none;
}

/* ============================
   MODAL NDF
   ============================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: white;
  border-radius: 10px;
  width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-header {
  padding: 1rem;
  border-bottom: 1px solid var(--gris-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
}
.modal-header button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gris-text);
  font-size: 1rem;
  transition: color 0.1s;
}
.modal-header button:hover { color: var(--rouge); }
#modal-ndf-body { padding: 0.75rem 1rem; }

.repas-ligne {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.repas-ligne input[type="text"] {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--gris-border);
  border-radius: 6px;
  font-size: 0.85rem;
}
.repas-ligne input[type="number"] {
  width: 70px;
  padding: 5px 8px;
  border: 1px solid var(--gris-border);
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: right;
}
.repas-ligne button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gris-text);
  font-size: 0.9rem;
}
.repas-ligne button:hover { color: var(--rouge); }

.modal .btn-ajouter {
  display: block;
  width: calc(100% - 2rem);
  margin: 0.5rem 1rem 1rem;
}

/* ============================
   ALIAS DROPDOWN
   ============================ */
.dropdown-alias-prompt {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.d-aucun { font-size: 0.82rem; color: var(--gris-text); }
.btn-creer-alias {
  background: var(--bleu-clair);
  border: 1px solid var(--bleu-moyen);
  color: var(--bleu-fonce);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.btn-creer-alias:hover { background: var(--bleu-moyen); }

.btn-add-alias {
  background: none;
  border: 1px solid var(--gris-border);
  border-radius: 4px;
  color: var(--gris-text);
  font-size: 0.75rem;
  width: 18px;
  height: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  padding: 0;
}
.btn-add-alias:hover { border-color: var(--bleu); color: var(--bleu); }

.d-aliases {
  font-size: 0.68rem;
  color: var(--bleu);
  font-style: italic;
}

.alias-mode-header {
  padding: 7px 10px;
  background: var(--bleu-clair);
  border-bottom: 1px solid var(--bleu-moyen);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--bleu-fonce);
}
.alias-mode-header button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gris-text);
  font-size: 0.9rem;
}

.alias-inline-form { padding: 6px 8px; }
.btn-alias-ok, .btn-alias-cancel {
  padding: 4px 8px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}
.btn-alias-ok { background: var(--bleu); color: white; }
.btn-alias-cancel { background: var(--gris-bg); color: var(--gris-text); }

/* Toast notification */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--texte);
  color: white;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 9999;
}
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================
   TICKETS NDF DANS VUE SEMAINE
   ============================ */
.ticket-jour-chip {
  position: absolute;
  left: 2px;
  right: 2px;
  height: 26px;
  background: #FFF7ED;
  border: 1px solid #FDBA74;
  border-radius: 4px;
  padding: 2px 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  overflow: hidden;
  transition: all 0.1s;
  z-index: 3;
}
.ticket-jour-chip:hover {
  background: #FED7AA;
  border-color: var(--orange);
  z-index: 10;
}
.ticket-jour-chip.ticket-jour-ok {
  background: #F0FDF4;
  border-color: #86EFAC;
}
.ticket-jour-chip.ticket-jour-ok:hover {
  background: #DCFCE7;
  border-color: var(--vert);
}
.ticket-jour-icon { font-size: 0.75rem; flex-shrink: 0; }
.ticket-jour-etab {
  font-weight: 600;
  color: var(--texte);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.ticket-jour-montant {
  font-weight: 700;
  color: var(--orange);
  flex-shrink: 0;
}
.ticket-jour-affaire {
  font-size: 0.62rem;
  color: var(--bleu);
  font-weight: 500;
  flex-shrink: 0;
}
.ticket-jour-no-affaire {
  font-size: 0.62rem;
  color: var(--rouge);
  font-style: italic;
  flex-shrink: 0;
}

/* Popup assigner affaire */
.ticket-assign-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  z-index: 15000;
  width: 340px;
  overflow: hidden;
}
.ticket-assign-header {
  padding: 10px 14px;
  background: var(--gris-bg);
  border-bottom: 1px solid var(--gris-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
}
.ticket-assign-header button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gris-text);
  font-size: 1rem;
}
.ticket-assign-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ticket-assign-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gris-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ticket-assign-suggestions {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ticket-assign-suggestion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--gris-border);
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.1s;
}
.ticket-assign-suggestion:hover {
  background: var(--bleu-clair);
  border-color: var(--bleu);
}
.tas-nom { font-weight: 500; }
.tas-num { font-size: 0.72rem; color: var(--gris-text); }
.tas-aliases { font-size: 0.68rem; color: var(--bleu); font-style: italic; }

.ticket-assign-search-wrap {
  position: relative;
}
.ticket-assign-search-wrap input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--gris-border);
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}
.ticket-assign-search-wrap input:focus { border-color: var(--bleu); }

.ticket-assign-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--bleu-moyen);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
}
.ticket-assign-result {
  padding: 7px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--gris-bg);
  transition: background 0.1s;
}
.ticket-assign-result:last-child { border-bottom: none; }
.ticket-assign-result:hover,
.ticket-assign-result.selected { background: var(--bleu-clair); }
.tas-empty {
  padding: 10px;
  text-align: center;
  color: var(--gris-text);
  font-size: 0.82rem;
}

/* ============================
   BOUTON NDF HEADER
   ============================ */
.btn-header-ndf {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.15s;
}
.btn-header-ndf:hover { background: rgba(255,255,255,0.35); }

/* ============================
   MODAL NDF GLOBAL
   ============================ */
.modal-ndf-global-content {
  width: 480px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-ndf-body {
  display: flex;
  flex-direction: column;
}

/* Sections */
.ndf-g-section {
  border-bottom: 1px solid var(--gris-border);
}
.ndf-g-section:last-child { border-bottom: none; }

/* Zone upload */
.ndf-g-zone-upload {
  padding: 20px;
  text-align: center;
  cursor: pointer;
  border: 2px dashed var(--gris-border);
  margin: 12px;
  border-radius: 8px;
  transition: all 0.15s;
}
.ndf-g-zone-upload:hover {
  border-color: var(--bleu);
  background: var(--bleu-clair);
}
.ndf-g-upload-icon { font-size: 1.8rem; margin-bottom: 4px; }
.ndf-g-upload-label { font-weight: 600; font-size: 0.85rem; }

/* Spinner */
.ndf-g-spinner {
  padding: 24px;
  text-align: center;
}
.ndf-g-spinner-label { font-size: 0.82rem; color: var(--gris-text); margin-top: 8px; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner-ring {
  width: 32px;
  height: 32px;
  border: 3px solid var(--gris-border);
  border-top-color: var(--bleu);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

/* Résultat OCR */
.ndf-g-resultat-layout {
  display: flex;
  gap: 12px;
  padding: 12px;
}
.ndf-g-resultat-img {
  width: 120px;
  flex-shrink: 0;
  cursor: pointer;
}
.ndf-g-resultat-img img {
  width: 100%;
  border: 1px solid var(--gris-border);
  border-radius: 4px;
  transition: transform 0.2s;
}

/* Zoom ticket — overlay plein écran */
.ndf-zoom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.ndf-zoom-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.ndf-g-resultat-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ndf-g-field label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gris-text);
  display: block;
  margin-bottom: 2px;
}
.ndf-g-field input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--gris-border);
  border-radius: 5px;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s;
}
.ndf-g-field input:focus { border-color: var(--bleu); }
.ndf-g-field select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--gris-border);
  border-radius: 5px;
  font-size: 0.82rem;
  outline: none;
  background: white;
  transition: border-color 0.15s;
}
.ndf-g-field select:focus { border-color: var(--bleu); }

.ndf-g-field-row {
  display: flex;
  gap: 8px;
}
.ndf-g-field-row .ndf-g-field { flex: 1; }

.ndf-g-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.ndf-g-actions .btn-primary,
.ndf-g-actions .btn-secondary {
  padding: 6px 12px;
  font-size: 0.82rem;
}

/* Field highlighting */
.ndf-field-ok label { color: #16A34A; }
.ndf-field-ok input { background: #F0FDF4; border-color: #86EFAC !important; }
.ndf-field-missing label { color: #D97706; }
.ndf-field-missing input { background: #FFFBEB; border-color: #FCD34D !important; }

/* Liste tickets header */
.ndf-g-liste-header {
  padding: 8px 12px;
  font-weight: 600;
  font-size: 0.82rem;
  background: var(--gris-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ndf-g-filtre-mois {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  font-size: 0.8rem;
}
.ndf-g-filtre-mois button {
  background: none;
  border: 1px solid var(--gris-border);
  border-radius: 4px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--gris-text);
}

/* Liste tickets */
.ndf-g-empty {
  padding: 20px;
  text-align: center;
  color: var(--gris-text);
  font-size: 0.82rem;
}
.ndf-g-total {
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--gris-text);
  border-bottom: 1px solid var(--gris-border);
}
.ndf-g-ticket-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--gris-border);
  font-size: 0.82rem;
}
.ndf-g-ticket-row:last-child { border-bottom: none; }
.ndf-g-ticket-row:hover { background: var(--bleu-clair); }

.ndf-g-ticket-info { display: flex; gap: 8px; align-items: center; }
.ndf-g-ticket-date { color: var(--gris-text); font-size: 0.75rem; min-width: 70px; }
.ndf-g-ticket-cat {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--bleu);
  background: var(--bleu-clair);
  padding: 1px 5px;
  border-radius: 3px;
}
.ndf-g-ticket-etab { font-weight: 500; }

.ndf-g-ticket-right { display: flex; align-items: center; gap: 6px; }
.ndf-g-ticket-montant { font-weight: 600; min-width: 60px; text-align: right; }

.ndf-g-btn-voir,
.ndf-g-btn-suppr {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.82rem;
  transition: all 0.1s;
}
.ndf-g-btn-voir:hover { background: var(--bleu-clair); }
.ndf-g-btn-suppr:hover { background: #FEF2F2; color: var(--rouge); }

.ndf-g-export {
  padding: 10px 12px;
  border-top: 1px solid var(--gris-border);
}

/* Modal voir ticket */
.modal-ndf-voir-content {
  width: 420px;
  max-height: 80vh;
  overflow-y: auto;
}
.ndf-voir-img {
  padding: 12px;
  background: var(--gris-bg);
  border-bottom: 1px solid var(--gris-border);
}
.ndf-voir-img img {
  width: 100%;
  border-radius: 4px;
  border: 1px solid var(--gris-border);
}
.ndf-voir-infos {
  padding: 12px;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ndf-voir-total { font-size: 1rem; margin-top: 4px; }
.ndf-voir-meta {
  font-size: 0.75rem;
  color: var(--gris-text);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--gris-border);
}

/* ============================
   LOGIN
   ============================ */
.login-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--bleu) 0%, var(--bleu-fonce) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.login-card {
  background: white;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 340px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  text-align: center;
}

.login-logo {
  font-weight: 800;
  font-size: 1.8rem;
  letter-spacing: 3px;
  color: var(--bleu);
  margin-bottom: 0.25rem;
}

.login-titre {
  font-size: 1rem;
  font-weight: 500;
  color: var(--gris-text);
  margin-bottom: 1.5rem;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#login-form input {
  padding: 10px 12px;
  border: 1px solid var(--gris-border);
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
#login-form input:focus { border-color: var(--bleu); }

.login-btn {
  background: var(--bleu);
  color: white;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 0.25rem;
}
.login-btn:hover { background: var(--bleu-fonce); }

.login-erreur {
  color: var(--rouge);
  font-size: 0.82rem;
  font-weight: 500;
}

/* ============================
   UTILITAIRES
   ============================ */
.hidden { display: none !important; }

/* Scrollbar fine */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gris-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--bleu-moyen); }
