/* ==========================================================================
   Saisie des heures — L'Atelier du Trégor
   Même écriture que le planning mural (Archivo Narrow, titres en Caveat,
   traits noirs, pastels), mais en pixels : c'est un outil d'écran, pas une
   feuille A3.

   Tout est préfixé .saisie ou sx- : la page est injectée dans le thème
   WordPress, dont les règles .entry * et Font Awesome (.fa, .fab…) gagnent
   sinon à spécificité égale. Aucune classe ne s'appelle fa, fab, fad, fal,
   far ni fas.
   ========================================================================== */

@font-face {
  font-family: 'Archivo Narrow';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/archivo-narrow-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Archivo Narrow';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/archivo-narrow-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/caveat-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/caveat-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html, body { margin: 0; padding: 0; background: #f2f1ee; }

.saisie {
  --col-nom: 168px;
  --col-min: 56px;
  --col-total: 112px;
  --haut-case: 58px;
  --trait: #111;
  --filet: #dcdcdc;
  --doux: #666;
  --ok: #2f7d32;
  --manque: #c0392b;
  --partiel: #c77800;

  font-family: 'Archivo Narrow', 'Arial Narrow', sans-serif;
  color: #111;
  background: #fff;
  max-width: 1700px;
  margin: 0 auto;
  padding: 18px 20px 28px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 14px;
  line-height: 1.25;
}
.saisie *, .saisie *::before, .saisie *::after { box-sizing: border-box; }
.saisie button { font-family: inherit; color: inherit; }
.saisie [hidden] { display: none !important; }

/* --- Bandeau --------------------------------------------------------------- */

.sx-bandeau {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  border-bottom: 1.5px solid var(--trait);
  padding-bottom: 10px;
}
.sx-titres { display: flex; align-items: baseline; gap: 16px; }
.sx-titre { font-family: Caveat, cursive; font-size: 42px; line-height: 0.95; }
.sx-lieu { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: #333; }

.sx-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sx-nav-libelle { display: flex; flex-direction: column; align-items: center; min-width: 150px; }
.sx-periode { font-size: 15px; font-weight: 700; letter-spacing: 0.05em; text-transform: capitalize; }
.sx-periode-indice { font-size: 12px; color: var(--doux); }

.sx-btn-nav {
  width: 34px; height: 28px;
  border: 1.2px solid var(--trait); border-radius: 5px;
  background: #fff; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.sx-tri { width: 0; height: 0; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.sx-tri--g { border-right: 10px solid var(--trait); }
.sx-tri--d { border-left: 10px solid var(--trait); }

.saisie .sx-btn {
  border: 1.2px solid var(--trait);
  background: #fff;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1.3;
  min-height: 28px;
}
.saisie .sx-btn:hover { background: #f4f3ef; }
.saisie .sx-btn:disabled { opacity: 0.4; cursor: default; }
.saisie .sx-btn--plein { background: #111; color: #fff; }
.saisie .sx-btn--plein:hover { background: #333; }
.saisie .sx-btn--danger { border-color: var(--manque); color: var(--manque); }
.saisie .sx-btn--lien {
  border: 0; background: none; padding: 2px 4px; min-height: 0;
  text-decoration: underline; font-size: 13px; color: #111;
}

.sx-vues { display: inline-flex; border: 1.2px solid var(--trait); border-radius: 5px; overflow: hidden; }
.saisie .sx-vue {
  border: 0; border-left: 1px solid #bbb; background: #fff; padding: 4px 10px;
  cursor: pointer; font-size: 13px; min-height: 26px;
}
.saisie .sx-vue:first-child { border-left: 0; }
.saisie .sx-vue--active { background: #111; color: #fff; }

.sx-outils { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sx-auteur { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #333; }
.sx-auteur select {
  font-family: inherit; font-size: 14px; padding: 3px 6px;
  border: 1.2px solid var(--trait); border-radius: 5px; background: #fff;
}
.sx-etat { font-size: 12px; color: var(--doux); min-width: 92px; }
.sx-etat::before { content: '●'; margin-right: 5px; }
.sx-etat--ok::before { color: var(--ok); }
.sx-etat--attente::before { color: var(--partiel); }
.sx-etat--erreur { color: var(--manque); }
.sx-etat--erreur::before { color: var(--manque); }

.sx-demo {
  border: 1px dashed #999; padding: 6px 10px; font-size: 13px;
  letter-spacing: 0.04em; color: #444; background: #fbfaf6;
}

/* --- Grille ---------------------------------------------------------------- */

.sx-defile { overflow-x: auto; }

/* Les colonnes sont posées par saisie.js (le samedi, quand il apparaît, est
   plus étroit). La largeur minimale garantit des cases cliquables : en deçà,
   la grille défile horizontalement plutôt que de s'écraser. */
.sx-grille {
  display: grid;
  grid-template-columns: var(--col-nom) repeat(var(--nb-jours, 15), minmax(var(--col-min), 1fr)) var(--col-total);
  width: 100%;
  min-width: calc(var(--col-nom) + var(--nb-jours, 15) * var(--col-min) + var(--col-total));
  user-select: none;
  -webkit-user-select: none;
}
.sx-grille > * { min-width: 0; }
.sx-grille--serree { --col-min: 40px; }

.sx-coin { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: #444;
           display: flex; align-items: flex-end; padding: 0 6px 5px 0; border-bottom: 1.5px solid var(--trait); }
.sx-coin--haut { border-bottom: 0; }
.sx-coin--total { justify-content: flex-end; padding-right: 2px; }

.sx-tete-semaine {
  display: flex; align-items: baseline; gap: 8px;
  padding: 2px 0 2px 6px;
  border-left: 1.5px solid var(--trait);
  white-space: nowrap; overflow: hidden;
}
.sx-tete-semaine-code { font-family: Caveat, cursive; font-size: 26px; line-height: 1; }
.sx-tete-semaine-plage { font-size: 12px; color: #555; }

.sx-tete-jour {
  display: flex; flex-direction: column; align-items: center;
  padding: 1px 0 4px;
  border-left: 1px solid var(--filet);
  border-bottom: 1.5px solid var(--trait);
  position: relative;
  min-width: 0;
}
.sx-tete-jour.sx-lundi { border-left: 1.5px solid var(--trait); }
.sx-tete-jour:first-of-type { border-left: 1.5px solid var(--trait); }
.sx-tete-jour-lettre { font-family: Caveat, cursive; font-size: 20px; line-height: 1; }
.sx-tete-jour-num { font-size: 11px; color: var(--doux); }
.sx-tete-jour-marque {
  font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: #333;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px;
}
.sx-tete-jour.sx-auj .sx-tete-jour-num {
  background: #111; color: #fff; border-radius: 8px; padding: 0 6px;
}

/* --- Colonne des noms ------------------------------------------------------- */

.sx-nom {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px 4px 0;
  border-bottom: 1px solid #cfcfcf;
  min-width: 0;
}
.sx-nom-pastille {
  flex: 0 0 auto;
  width: 34px; height: 22px; border-radius: 11px;
  border: 1px solid rgba(0, 0, 0, 0.32);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; letter-spacing: 0.06em;
}
.sx-nom-texte { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sx-nom-prenom { font-family: Caveat, cursive; font-size: 22px; line-height: 0.95; }
.sx-nom-famille { font-size: 11px; color: #555; letter-spacing: 0.05em; text-transform: uppercase;
                  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saisie .sx-nom-menu {
  border: 0; background: none; cursor: pointer; font-size: 18px; color: #999;
  padding: 0 4px; min-height: 0; line-height: 1;
}
.saisie .sx-nom-menu:hover { color: #111; }

/* --- Cases ---------------------------------------------------------------- */

.sx-case {
  position: relative;
  height: var(--haut-case);
  border-left: 1px solid var(--filet);
  border-bottom: 1px solid #cfcfcf;
  padding: 3px 0 13px;
  cursor: cell;
  min-width: 0;
  background: #fff;
}
.sx-case.sx-lundi { border-left: 1.5px solid var(--trait); }
.sx-nom + .sx-case { border-left: 1.5px solid var(--trait); }
.sx-case.sx-auj { background: #fffdf2; }
.sx-case:hover { background: #f7f6f1; }

/* Jours non travaillés : les hachures du planning mural */
.sx-case--off {
  background: repeating-linear-gradient(45deg, #fff 0 6px, #e4e4e4 6px 8px);
  cursor: default;
}
.sx-case--off:hover { background: repeating-linear-gradient(45deg, #fff 0 6px, #d9d9d9 6px 8px); }
.sx-case--hors { background: repeating-linear-gradient(45deg, #f1f1f1 0 6px, #d6d6d6 6px 8px); }

/* État du jour, lu au premier coup d'œil : un liseré en pied de case */
.sx-case--manque::after,
.sx-case--partiel::after,
.sx-case--trop::after,
.sx-case--ok::after,
.sx-case--horsjour::after {
  content: ''; position: absolute; left: 3px; right: 3px; bottom: 2px; height: 3px; border-radius: 2px;
}
.sx-case--manque::after { background: repeating-linear-gradient(90deg, var(--manque) 0 4px, transparent 4px 7px); }
.sx-case--partiel::after { background: var(--partiel); }
.sx-case--trop::after { background: var(--manque); }
.sx-case--ok::after { background: rgba(47, 125, 50, 0.45); }
.sx-case--horsjour::after { background: #6b7fb3; }

.sx-total-jour {
  position: absolute; right: 4px; bottom: 5px;
  font-size: 10px; color: #777; line-height: 1;
  pointer-events: none;
}
.sx-case--manque .sx-total-jour { color: var(--manque); }
.sx-case--partiel .sx-total-jour,
.sx-case--trop .sx-total-jour { color: var(--partiel); font-weight: 700; }
.sx-case--trop .sx-total-jour { color: var(--manque); }

.sx-plus {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #bbb; opacity: 0; pointer-events: none;
}
.sx-case:hover .sx-plus { opacity: 1; }
.sx-grille--serree .sx-plus { font-size: 14px; }

/* Sélection, cible d'un dépôt, aperçu d'un étirement */
.sx-case--sel { background: #e9f0fb !important; box-shadow: inset 0 0 0 1.5px #3b6fc4; }
.sx-case--cible { box-shadow: inset 0 0 0 2px #111; background: #f4f3ef !important; }
.sx-case--apercu { box-shadow: inset 0 0 0 2px var(--teinte, #999); }
.sx-case--apercu::before {
  content: ''; position: absolute; inset: 4px 2px 14px; border-radius: 6px;
  background: var(--teinte, #ccc); opacity: 0.55; border: 1.5px dashed #111;
}
.sx-case--retrait .sx-bloc { opacity: 0.25; text-decoration: line-through; }

.sx-clignote { animation: sx-clignote 1.4s ease-out 2; }
@keyframes sx-clignote {
  0% { box-shadow: inset 0 0 0 3px var(--manque); }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}

.sx-indice {
  position: absolute; left: 4px; top: 4px; right: 4px;
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: #333; border: 1px dashed #333; border-radius: 4px; padding: 1px 3px;
  text-align: center; background: rgba(255, 255, 255, 0.85);
  pointer-events: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

/* --- Filigrane : affectations du planning ---------------------------------- */

.sx-fantome {
  position: absolute; left: 2px; right: 2px; top: 3px; bottom: 13px;
  border-radius: 7px;
  border: 1.2px dashed rgba(0, 0, 0, 0.35);
  background:
    repeating-linear-gradient(-45deg, transparent 0 5px, rgba(255, 255, 255, 0.55) 5px 9px),
    var(--teinte, #ddd);
  opacity: 0.38;
  pointer-events: none;
}
.sx-fantome--suite { left: -1px; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.sx-fantome--continue { right: -1px; border-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.sx-case:hover .sx-fantome { opacity: 0.55; }
.saisie .sx-fantome-etiquette {
  position: absolute; left: 3px; bottom: 2px; max-width: calc(100% - 6px);
  pointer-events: auto; cursor: pointer;
  border: 0; background: rgba(255, 255, 255, 0.9); border-radius: 4px;
  font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0 4px; min-height: 0; line-height: 15px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left;
}
.saisie .sx-fantome-etiquette:hover { background: #111; color: #fff; }
.sx-fantome-plus { position: absolute; right: 3px; top: 1px; font-size: 10px; font-weight: 700; }
/* Dès qu'il y a des heures, le filigrane s'efface derrière elles */
.sx-case:has(.sx-pile) .sx-fantome { opacity: 0.16; }
.sx-case:has(.sx-pile) .sx-fantome-etiquette { display: none; }

/* --- Blocs de sessions ------------------------------------------------------ */

.sx-pile {
  position: relative; z-index: 1;
  height: 100%;
  display: flex; flex-direction: column; gap: 2px;
  padding: 0 3px;
}
.sx-bloc {
  position: relative;
  flex: 1 1 0;
  min-height: 12px;
  border-radius: 7px;
  border: 1px solid rgba(0, 0, 0, 0.32);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 3px;
  padding: 2px 5px;
  overflow: hidden;
  cursor: grab;
  touch-action: manipulation;
}
.sx-bloc:hover { box-shadow: 0 0 0 1.5px #111; z-index: 2; }
.sx-bloc--absence {
  background: #fff;
  border: 1.2px dashed #111;
}
.sx-bloc--attente { opacity: 0.6; }
/* Session saisie sans lot : à rattacher, elle ne compte pour aucun chantier */
.sx-bloc--sanslot {
  background: repeating-linear-gradient(-45deg, #fff 0 5px, #f6d6d1 5px 8px);
  border: 1.2px dashed var(--manque);
  color: var(--manque);
}
.sx-bloc--suite { margin-left: -4px; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.sx-bloc--continue { margin-right: -4px; border-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.sx-bloc--source { opacity: 0.35; }
.sx-bloc--vole {
  position: fixed; z-index: 1000; pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); opacity: 0.92; cursor: grabbing;
}
.sx-bloc--vole.sx-bloc--copie::after {
  content: '+'; position: absolute; right: 3px; top: 0; font-weight: 700; font-size: 14px;
}
body.sx-glisse, body.sx-glisse * { cursor: grabbing !important; }

.sx-bloc-texte { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.sx-bloc-client {
  font-weight: 700; font-size: 11.5px; letter-spacing: 0.03em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sx-bloc-lot { font-size: 11px; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sx-bloc-marques { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex: 0 0 auto; }
.sx-bloc-duree { font-size: 10.5px; font-weight: 700; }
.sx-bloc-panier {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; border-radius: 50%;
  border: 1px solid #111; background: rgba(255, 255, 255, 0.85);
  font-size: 9px; font-weight: 700; line-height: 1;
}
.sx-grille--serree .sx-bloc-lot { display: none; }
.sx-grille--serree .sx-bloc-client { font-size: 10px; }

.sx-reste {
  flex: 1 1 0; min-height: 8px;
  border: 1.2px dashed #bbb; border-radius: 6px;
  background: repeating-linear-gradient(90deg, transparent 0 6px, #f3f3f3 6px 9px);
}
.sx-reste:hover { border-color: #111; }

/* Poignées : on étire un bloc comme un événement d'agenda */
.sx-poignee {
  position: absolute; top: 0; bottom: 0; width: 9px;
  cursor: ew-resize; z-index: 3;
  touch-action: none;
}
.sx-poignee--g { left: 0; }
.sx-poignee--d { right: 0; }
.sx-poignee::after {
  content: ''; position: absolute; top: 50%; width: 3px; height: 14px; margin-top: -7px;
  border-radius: 2px; background: #111; opacity: 0;
}
.sx-poignee--g::after { left: 2px; }
.sx-poignee--d::after { right: 2px; }
.sx-bloc:hover .sx-poignee::after { opacity: 0.55; }

/* --- Colonne des totaux ----------------------------------------------------- */

.sx-total {
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 2px;
  padding: 0 0 0 8px;
  border-left: 1.5px solid var(--trait);
  border-bottom: 1px solid #cfcfcf;
  font-size: 12px;
}
.sx-total-heures { font-weight: 700; white-space: nowrap; }
.saisie .sx-total-manque {
  border: 0; background: none; color: var(--manque); cursor: pointer;
  font-size: 12px; padding: 0; min-height: 0; text-decoration: underline;
}
.sx-total-ok { color: var(--ok); font-size: 12px; }

.sx-vide { padding: 24px; font-size: 15px; }

/* --- Mode affectations -------------------------------------------------------
   Les blocs sont des plages de jours. Les heures déjà saisies passent dans
   le bandeau du pied de case, là où la saisie des heures met son total.   */

.sx-case--aff.sx-case--passe { background: #fbfbf8; }
.sx-case--aff .sx-fantome--heures {
  top: auto; bottom: 1px; height: 11px; left: 3px; right: 3px;
  border: 0; border-radius: 3px; opacity: 0.8;
  background:
    repeating-linear-gradient(-45deg, transparent 0 4px, rgba(255, 255, 255, 0.6) 4px 7px),
    var(--teinte, #ddd);
}
.sx-case--aff:hover .sx-fantome--heures { opacity: 1; }
.sx-fantome-texte {
  display: block; padding: 0 3px;
  font-size: 8.5px; line-height: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sx-case--aff .sx-indice {
  z-index: 2; left: auto; top: auto; right: 3px; bottom: 1px;
  font-size: 8.5px; line-height: 9px; padding: 0 3px; border-radius: 3px;
}
/* Prévu : un simple pointillé — c'est l'état ordinaire d'une affectation à
   venir, il ne doit pas charger la grille. Confirmé : trait plein, plus appuyé. */
.sx-bloc--prevu { border-style: dashed; border-color: rgba(0, 0, 0, 0.55); }
.sx-bloc--aff:not(.sx-bloc--prevu) { border-color: rgba(0, 0, 0, 0.7); border-width: 1.5px; }
.sx-case--conflit .sx-bloc { box-shadow: inset 0 0 0 2px var(--manque); }
.sx-bloc-lieu {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; border-radius: 3px;
  background: #111; color: #fff;
  font-size: 9px; font-weight: 700; line-height: 1;
}
.sx-bloc-note { font-size: 10px; line-height: 1; }
.sx-legende-chip--prevu { border: 1.2px dashed rgba(0, 0, 0, 0.6); background: #fff; }
.sx-legende-chip--conflit { background: #fff; box-shadow: inset 0 0 0 2px var(--manque); }
.saisie .sx-champ--date { flex: 0 0 auto; min-width: 0; width: 150px; }
.sx-option-et { font-size: 12px; color: #555; }
.sx-resume-note--erreur { color: var(--manque); font-weight: 700; }
.saisie a.sx-autre { text-decoration: none; }

/* --- Pied ------------------------------------------------------------------ */

.sx-pied {
  border-top: 1px solid #bbb; padding-top: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.sx-legende { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; }
.sx-legende-item { display: inline-flex; align-items: center; gap: 5px; }
.sx-legende-chip {
  display: inline-block; width: 22px; height: 12px; border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.32);
}
.sx-legende-chip--absence { background: #fff; border: 1.2px dashed #111; }
.sx-legende-chip--fantome {
  border: 1.2px dashed rgba(0, 0, 0, 0.4);
  background: repeating-linear-gradient(-45deg, #fff 0 3px, #ddd 3px 6px);
}
.sx-aide { font-size: 12px; color: #444; }
.sx-alertes { font-size: 12px; color: #7a7a7a; }
.sx-alertes-titre { font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

/* --- Fenêtres --------------------------------------------------------------- */

.sx-pop {
  position: fixed; z-index: 900;
  width: 460px; max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow: auto;
  background: #fff;
  border: 1.5px solid #111; border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
  font-family: 'Archivo Narrow', 'Arial Narrow', sans-serif;
  font-size: 14px; color: #111;
}
.sx-pop--feuille {
  left: 0 !important; right: 0; bottom: 0; top: auto !important;
  width: 100%; max-width: none; max-height: 85vh;
  border-radius: 14px 14px 0 0; border-bottom: 0;
}
.sx-pop-corps { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.sx-pop-tete { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 0 8px; }
.sx-pop-titre { font-family: Caveat, cursive; font-size: 28px; line-height: 1; }
.sx-pop-sous { grid-column: 1; font-size: 13px; color: #555; }
.saisie .sx-pop-fermer {
  grid-row: 1 / span 2; grid-column: 2;
  border: 0; background: none; font-size: 22px; cursor: pointer; padding: 0 4px; min-height: 0;
}
.sx-pop-pied { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 2px; }
.sx-pop-espace { flex: 1; }

.sx-lots { display: flex; flex-direction: column; gap: 6px; }
.saisie .sx-lots-recherche {
  font-family: inherit; font-size: 15px;
  border: 1.2px solid #111; border-radius: 6px; padding: 6px 8px; width: 100%;
  background: #fff; height: auto; box-shadow: none;
}
.sx-lots-liste {
  max-height: 260px; overflow: auto;
  border: 1px solid #ddd; border-radius: 6px; padding: 2px 0;
}
.sx-lots-groupe {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: #666;
  padding: 6px 8px 2px; position: sticky; top: 0; background: #fff; z-index: 1;
}
.saisie .sx-lot {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: none; text-align: left; cursor: pointer;
  padding: 4px 8px; min-height: 0; font-size: 14px; border-radius: 0;
}
.saisie .sx-lot:hover, .saisie .sx-lot:focus { background: #f2f1ec; outline: none; }
.saisie .sx-lot--choisi { background: #111 !important; color: #fff; }
.saisie .sx-lot--choisi .sx-lot-raison, .saisie .sx-lot--choisi .sx-lot-zone { color: #ddd; border-color: #ddd; }
.sx-lot-chip {
  flex: 0 0 auto; width: 18px; height: 12px; border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.35);
}
.sx-lot-texte { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sx-lot-client { font-weight: 700; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.sx-lot-nom { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sx-lot-raison { font-size: 11px; color: #666; white-space: nowrap; font-style: italic; }
.sx-lot-zone { font-size: 10px; border: 1px solid #999; border-radius: 3px; padding: 0 3px; color: #555; }
.sx-lots-rien { padding: 10px; color: #666; font-size: 13px; }

.sx-motifs { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 8px 6px; }
.saisie .sx-motif {
  border: 1.2px dashed #111; background: #fff; border-radius: 12px;
  padding: 2px 9px; font-size: 13px; cursor: pointer; min-height: 0;
}
.saisie .sx-motif:hover { background: #f2f1ec; }
.saisie .sx-motif.sx-lot--choisi { background: #111; color: #fff; border-style: solid; }

.sx-zone-lot { display: flex; flex-direction: column; gap: 6px; }
.sx-lot-actuel {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid #ddd; border-radius: 6px; padding: 6px 8px;
}
.sx-lot-actuel .sx-lot-nom { flex: 1; }

.sx-options { display: flex; flex-direction: column; gap: 7px; }
.sx-option { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sx-option-nom { width: 52px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: #555; }
.sx-option-vide { font-size: 13px; color: #777; font-style: italic; }
.sx-segments { display: inline-flex; flex-wrap: wrap; border: 1.2px solid #111; border-radius: 6px; overflow: hidden; }
.saisie .sx-segment {
  border: 0; border-left: 1px solid #ccc; background: #fff; cursor: pointer;
  font-size: 13px; padding: 3px 8px; min-height: 0;
}
.saisie .sx-segment:first-child { border-left: 0; }
.saisie .sx-segment--actif { background: #111; color: #fff; }
.sx-duree { display: inline-flex; gap: 4px; }
.sx-duree select, .saisie .sx-champ {
  font-family: inherit; font-size: 14px; padding: 3px 6px;
  border: 1.2px solid #111; border-radius: 5px; background: #fff; height: auto; box-shadow: none;
}
.saisie .sx-champ { flex: 1; min-width: 160px; }
.sx-note { font-size: 12px; color: #666; white-space: pre-line; border-top: 1px dotted #ccc; padding-top: 6px; }

.sx-resume { display: flex; flex-direction: column; gap: 4px; font-size: 13px;
             border-top: 1px solid #e3e3e3; padding-top: 8px; }
.sx-resume-texte { font-weight: 700; }
.sx-resume-note { color: #666; }
.sx-coche { display: flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; }
.sx-coche--ligne { padding: 3px 0; }

.sx-texte { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.sx-texte-note { font-size: 12px; color: #666; }
.sx-texte-fort { font-weight: 700; }
.sx-pop-corps--etroit { max-width: 420px; }

.sx-qui { display: flex; flex-wrap: wrap; gap: 6px; }
.sx-qui .sx-btn { font-family: Caveat, cursive; font-size: 22px; padding: 2px 14px; }

/* --- Messages --------------------------------------------------------------- */

.sx-toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 950; background: #111; color: #fff; border-radius: 8px;
  padding: 9px 14px; display: flex; align-items: center; gap: 14px;
  font-size: 14px; max-width: calc(100vw - 24px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.saisie .sx-toast-action { color: #fff; font-weight: 700; }

.sx-barre {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 890;
  display: flex; align-items: center; gap: 10px; justify-content: flex-end;
  background: #fff; border-top: 1.5px solid #111; padding: 10px 12px;
}
.sx-barre span { flex: 1; font-weight: 700; }

/* ==========================================================================
   Téléphone (sous 760 px) : une semaine, noms resserrés
   ========================================================================== */

@media (max-width: 760px) {
  .saisie {
    --col-nom: 74px; --col-min: 52px; --col-total: 0px; --haut-case: 64px;
    padding: 10px 8px 70px;
  }
  .sx-titre { font-size: 32px; }
  .sx-lieu, .sx-vues, .sx-aide, #sx-remplir { display: none; }
  .sx-nom-famille, .sx-nom-menu { display: none; }
  .sx-nom-pastille { display: none; }
  .sx-nom-prenom { font-size: 19px; }
  /* Jamais display:none dans la grille : une cellule retirée décalerait
     toutes les suivantes. La colonne est ramenée à zéro et masquée. */
  .sx-total, .sx-coin--total { visibility: hidden; padding: 0; border: 0; overflow: hidden; }
  .sx-bloc { padding: 2px 3px; }
  .sx-bloc-lot { display: none; }
  .sx-poignee { width: 14px; }
  .sx-tete-semaine-plage { display: none; }
}

@media print {
  html, body { background: #fff; }
  .sx-outils, .sx-nav button, .sx-aide, .sx-pop, .sx-toast, .sx-barre { display: none !important; }
  .saisie { max-width: none; padding: 0; }
}
