/* ============================================================
   Relevés de temps hebdomadaires
   L'écran le plus rechigné du SIRH : il doit se remplir en
   quelques secondes, au clavier comme à la souris, et se lire
   d'un coup d'œil. Tout est bâti sur les jetons du DS.
   ============================================================ */

.ts-page {
  max-width: 760px;
  margin: 0 auto;
}

/* ===== En-tête ===== */
.ts-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.ts-head__title {
  font-size: 26px;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin: 0;
}
.ts-head__sub {
  color: var(--gray-600);
  margin-top: 2px;
}

/* ===== File d'attente du rattrapage =====
   Savoir combien il en reste change tout : l'ancien SI faisait
   découvrir la semaine suivante après chaque envoi. */
.ts-queue {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 16px;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-xl);
  background: var(--brand-indigo-tint-2);
  color: var(--brand-ink);
  font-size: 13px;
}
.ts-queue__label { font-weight: var(--weight-medium); }
.ts-queue__dots { display: flex; gap: 5px; flex: 1; }
.ts-queue__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gray-300);
}
.ts-queue__dot.is-current { background: var(--accent); }
.ts-queue__count {
  color: var(--gray-600);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ===== Carte de saisie ===== */
.ts-card { padding: 0; overflow: hidden; }
.ts-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-6);
  border-bottom: 1px solid var(--gray-100);
}
.ts-card__week {
  font-size: 19px;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
}
.ts-card__dates {
  color: var(--gray-600);
  font-size: 14px;
  margin-top: 2px;
}
.ts-card__quota {
  text-align: right;
  white-space: nowrap;
}
.ts-card__quota b {
  display: block;
  font-size: 26px;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
}
.ts-card__quota span {
  font-size: 12px;
  color: var(--gray-500);
}

/* ===== Étapes =====
   L'écran se lit de haut en bas : on ajoute, puis on répartit. Sans ce
   découpage, on ne sait pas par où commencer. */
.ts-step {
  padding: var(--space-6);
  border-bottom: 1px solid var(--gray-100);
}
.ts-step--split { padding-bottom: var(--space-3); }
.ts-step__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: var(--space-4);
}
.ts-step__num {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-ink);
  color: #fff;
  font-size: 12px;
  font-weight: var(--weight-semibold);
  line-height: 1;
}
.ts-step__title {
  font-weight: var(--weight-semibold);
  line-height: 1.35;
}
.ts-step__hint {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 1px;
}

/* ===== Recherche =====
   Un vrai champ encadré, pas un filet de séparation : c'est le premier geste
   de l'écran, il doit se voir. */
.ts-search__field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 46px;
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-xl);
  cursor: text;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.ts-search__field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--brand-indigo-tint);
}
.ts-search__field > .lucide {
  width: 17px;
  height: 17px;
  flex: none;
  color: var(--gray-400);
}
.ts-search__field:focus-within > .lucide { color: var(--accent); }
.ts-search__field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 15px;
  color: var(--brand-ink);
  outline: none;
}
.ts-search__field input::placeholder { color: var(--gray-400); }
.ts-search__clear {
  border: 0;
  background: transparent;
  color: var(--gray-400);
  padding: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
}
.ts-search__clear:hover { color: var(--brand-ink); background: var(--gray-100); }
.ts-search__clear .lucide { width: 15px; height: 15px; }

/* Les résultats poussent le contenu vers le bas : rien à refermer. */
/* Issue de secours sous la barre : discrète tant qu'on n'en a pas besoin,
   mais assez lisible pour qu'on la trouve après une recherche infructueuse. */
.ts-search__browse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--accent);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.ts-search__browse:hover { text-decoration: underline; }
.ts-search__browse .lucide { width: 14px; height: 14px; }

/* Catalogue complet, dans la fenêtre. Le corps de la fenêtre défile déjà :
   on lui retire ses marges pour que les blocs de BU aillent d'un bord à
   l'autre, comme des rubriques. */
.ts-catalogue.modal-body { padding: 0; }
.ts-catalogue .ts-result { padding-left: 18px; padding-right: 18px; }
.ts-catalogue__hint {
  flex: 1;
  font-size: 12px;
  color: var(--gray-500);
}

/* L'intitulé de BU reste visible pendant qu'on parcourt son bloc : sans lui,
   on ne sait plus dans quelle BU on est arrivé. */
.ts-catalogue__bu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface-sunken, #FAFAFC);
  border-bottom: 1px solid var(--gray-100);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--gray-500);
  position: sticky;
  top: 0;
  z-index: 1;
}
.ts-catalogue__count {
  font-weight: var(--weight-medium);
  letter-spacing: 0;
  color: var(--gray-400);
}
.ts-catalogue__group:last-child .ts-result:last-child { border-bottom: 0; }

.ts-results:empty { display: none; }
.ts-results {
  margin-top: 8px;
  border: 1px solid var(--gray-150);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: #fff;
}
.ts-results__list { display: grid; }
.ts-result {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--gray-100);
  background: transparent;
  padding: 10px 14px;
  text-align: left;
  font-size: 14px;
  color: var(--brand-ink);
  cursor: pointer;
  transition: background 0.12s ease;
}
.ts-result:last-child { border-bottom: 0; }
.ts-result:hover,
.ts-result:focus-visible { background: var(--brand-indigo-tint-2); }
.ts-result__icon {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--brand-indigo-tint);
  color: var(--accent);
}
.ts-result__icon img { width: 100%; height: 100%; object-fit: contain; }
.ts-result__icon .lucide { width: 14px; height: 14px; }
.ts-result__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--weight-medium);
}
.ts-result__bu {
  font-size: 12px;
  color: var(--gray-500);
  white-space: nowrap;
}
.ts-result__add {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-indigo-tint);
  color: var(--accent);
}
.ts-result__add .lucide { width: 14px; height: 14px; }
.ts-results__empty {
  padding: 18px 14px;
  font-size: 13px;
  color: var(--gray-500);
  text-align: center;
}
.ts-results__empty .lucide {
  width: 20px;
  height: 20px;
  color: var(--gray-300);
  margin-bottom: 6px;
}

/* ===== Lignes de saisie ===== */
.ts-lines { display: grid; }
.ts-line {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.ts-line:last-child { border-bottom: 0; }
.ts-line__icon {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--brand-indigo-tint);
  color: var(--accent);
}
/* `contain` : voir la note sur .project-icon — c'est le même logo. */
.ts-line__icon img { width: 100%; height: 100%; object-fit: contain; }
.ts-line__icon .lucide { width: 15px; height: 15px; }
.ts-line__body { flex: 1; min-width: 0; }
.ts-line__name {
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ts-line__bu { font-size: 12px; color: var(--gray-500); }
.ts-line__days {
  width: 52px;
  text-align: right;
  font-size: 13px;
  color: var(--gray-500);
  font-variant-numeric: tabular-nums;
}
.ts-line__remove {
  border: 0;
  background: transparent;
  color: var(--gray-300);
  padding: 4px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
}
.ts-line__remove:hover { color: var(--status-danger-fg); background: var(--status-danger-bg); }
.ts-line__remove .lucide { width: 15px; height: 15px; }

.ts-empty {
  padding: var(--space-6) 0 var(--space-7);
  text-align: center;
  color: var(--gray-500);
  font-size: 14px;
}
.ts-empty .lucide {
  width: 20px;
  height: 20px;
  color: var(--gray-300);
  margin-bottom: 6px;
}

/* ===== Pas − / + =====
   Une semaine fait 10 demi-journées : cliquer vaut mieux que saisir, et le
   clavier reste possible. */
.ts-stepper {
  display: flex;
  align-items: center;
  flex: none;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}
.ts-stepper__btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--gray-600);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.ts-stepper__btn:hover { background: var(--brand-indigo-tint); color: var(--accent); }
.ts-stepper__btn:active { background: var(--brand-indigo-tint-2); }
.ts-stepper__input {
  width: 42px;
  height: 32px;
  border: 0;
  border-left: 1px solid var(--gray-100);
  border-right: 1px solid var(--gray-100);
  text-align: center;
  font-size: 14px;
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--brand-ink);
  background: transparent;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
.ts-stepper__input::-webkit-outer-spin-button,
.ts-stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ts-stepper__input:focus { background: var(--brand-indigo-tint-2); }

/* ===== Ligne d'absence, posée par le système ===== */
.ts-absence {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 12px;
  margin-top: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--status-success-bg);
}
.ts-absence__icon {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--status-success-fg);
}
.ts-absence__icon .lucide { width: 15px; height: 15px; }
.ts-absence__body { flex: 1; min-width: 0; }
.ts-absence__title { font-weight: var(--weight-medium); }
.ts-absence__detail { font-size: 12px; color: var(--gray-600); }
.ts-auto {
  border-radius: 999px;
  background: #fff;
  color: var(--status-success-fg);
  padding: 3px 9px;
  font-size: 11px;
  font-weight: var(--weight-semibold);
}

/* ===== Pied : compteur et envoi ===== */
.ts-foot { padding: var(--space-5) var(--space-6) var(--space-6); }

/* ===== Compteur vivant ===== */
.ts-meter { margin-bottom: var(--space-4); }
.ts-meter__bar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  background: var(--gray-100);
  overflow: hidden;
}
.ts-meter__absence { background: var(--status-success-fg); opacity: 0.35; }
.ts-meter__fill {
  background: var(--accent);
  transition: width 0.18s ease, background 0.18s ease;
}
.ts-meter__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: 8px;
  font-size: 13px;
}
.ts-meter__hint { color: var(--gray-600); }
.ts-meter__count {
  color: var(--gray-500);
  font-variant-numeric: tabular-nums;
}
.ts-meter__count b { color: var(--brand-ink); font-weight: var(--weight-semibold); }

/* Le compte est juste : tout passe au vert, le bouton s'ouvre. */
.is-complete .ts-meter__fill { background: var(--status-success-fg); }
.is-complete .ts-meter__hint { color: var(--status-success-fg); font-weight: var(--weight-medium); }
.is-over .ts-meter__fill { background: var(--status-danger-fg); }
.is-over .ts-meter__hint { color: var(--status-danger-fg); font-weight: var(--weight-medium); }

.ts-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ===== Rien à déclarer ===== */
.ts-clear {
  text-align: center;
  padding: var(--space-9) var(--space-8);
}
.ts-clear__icon {
  width: 52px;
  height: 52px;
  margin: 0 auto var(--space-5);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--status-success-bg);
  color: var(--status-success-fg);
}
.ts-clear__icon .lucide { width: 26px; height: 26px; }
.ts-clear__title {
  font-size: 22px;
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-2);
}
.ts-clear__text { color: var(--gray-600); }

@media (max-width: 640px) {
  .ts-card__head { flex-direction: column; }
  .ts-card__quota { text-align: left; }
  .ts-line { flex-wrap: wrap; }
  .ts-line__body { flex-basis: 100%; order: -1; }
  .ts-line__days { flex: 1; text-align: left; }
}

/* ===== Pastille de retard dans la navigation ===== */
.app-sidebar__badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  background: var(--gray-150);
  color: var(--gray-600);
}
.app-sidebar__badge.is-late {
  background: var(--status-danger-fg);
  color: #fff;
}

/* ===== Appel sur le tableau de bord =====
   L'échéance est lointaine du lundi au jeudi : sans cet appel, rien
   ne rappelle qu'une semaine attend. Il durcit une fois passée. */
.ts-callout {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-4);
  color: inherit;
  text-decoration: none;
  border-left: 3px solid var(--accent);
  transition: border-color 0.16s ease, background 0.16s ease;
}
.ts-callout:hover { background: var(--brand-indigo-tint-2); color: inherit; }
.ts-callout__icon {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-indigo-tint);
  color: var(--accent);
}
.ts-callout__icon .lucide { width: 17px; height: 17px; }
.ts-callout__body { flex: 1; min-width: 0; }
.ts-callout__title {
  font-weight: var(--weight-semibold);
  margin-bottom: 2px;
}
.ts-callout__hint {
  font-size: var(--text-sm);
  color: var(--gray-600);
}
.ts-callout__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--accent);
}
.ts-callout__cta .lucide { width: 15px; height: 15px; }

.ts-callout--late {
  border-left-color: var(--status-danger-fg);
}
.ts-callout--late .ts-callout__icon {
  background: var(--status-danger-bg);
  color: var(--status-danger-fg);
}
.ts-callout--late .ts-callout__cta { color: var(--status-danger-fg); }
.ts-callout--late:hover { background: var(--status-danger-bg); }

.ts-meter__unit {
  font-size: 12px;
  color: var(--gray-400);
  margin-left: 2px;
}
