/* ═══════════════════════════════════════════════════════════════
   TIMESHEET — Feuille de temps personnelle + vue équipe
   ═══════════════════════════════════════════════════════════════ */

.ts-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
  font-family: -apple-system, 'Inter', sans-serif;
  color: #0f172a;
}

/* ── Header ── */
.ts-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.ts-header__title h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.ts-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  color: #64748b;
}
.ts-header__tabs {
  display: flex;
  gap: 0.35rem;
  background: #f1f5f9;
  padding: 0.25rem;
  border-radius: 10px;
}
.ts-tab {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}
.ts-tab:hover { background: rgba(255,255,255,0.6); color: #0f172a; }
.ts-tab.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(15,23,42,0.1);
}

/* ── Clock bar ── */
.ts-clock-bar { margin-bottom: 1rem; }
.ts-clock {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: #fff;
  border: 2px solid #e2e8f0;
  position: relative;
}
.ts-clock--active {
  background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%);
  border-color: #10b981;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.15);
}
.ts-clock--idle {
  background: #f8fafc;
}
.ts-clock__pulse {
  position: absolute;
  top: 12px; right: 12px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #10b981;
  animation: ts-pulse 1.8s ease-in-out infinite;
}
@keyframes ts-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
}
.ts-clock__info { flex: 1; min-width: 0; }
.ts-clock__status { font-weight: 700; font-size: 0.95rem; }
.ts-clock__project { font-size: 0.82rem; color: #475569; margin-top: 0.15rem; }
.ts-clock__toggle {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dashed #93c5fd;
  cursor: pointer;
  transition: color 0.12s;
}
.ts-clock__toggle:hover { color: #1d4ed8; border-bottom-style: solid; }
.ts-clock__timer { text-align: right; font-variant-numeric: tabular-nums; }
.ts-clock__elapsed {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #047857;
  line-height: 1;
}
.ts-clock__remaining {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 0.2rem;
}
.ts-clock__select {
  padding: 0.55rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font-size: 0.88rem;
  font-family: inherit;
  min-width: 280px;
  max-width: 400px;
}

/* Bannière de suggestion RDV (en bas de la zone "infos" du clock idle).
   Cliquable → démarre directement le pointage sur ce projet. */
.ts-clock__suggestion {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.55rem;
  padding: 0.45rem 0.55rem 0.45rem 0.85rem;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #93c5fd;
  border-radius: 999px;
  font-size: 0.82rem;
  color: #1e3a8a;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}
.ts-clock__suggestion:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25);
}
.ts-clock__suggestion.is-active {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #34d399;
  color: #065f46;
  animation: ts-sug-pulse 2.5s ease-in-out infinite;
}
.ts-clock__suggestion.is-active:hover {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
}
@keyframes ts-sug-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}
.ts-clock__sug-ic { font-size: 0.95rem; line-height: 1; }
.ts-clock__sug-text { flex: 1; }
.ts-clock__sug-text strong { font-weight: 800; }
.ts-clock__sug-time {
  font-family: 'SF Mono', monospace;
  font-size: 0.75rem;
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 4px;
}
.ts-clock__sug-cta {
  background: rgba(255, 255, 255, 0.85);
  color: #065f46;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.ts-clock__suggestion:not(.is-active) .ts-clock__sug-cta {
  color: #1e40af;
}
.ts-clock__btn {
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s;
  white-space: nowrap;
}
.ts-clock__btn--start {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16,185,129,0.35);
}
.ts-clock__btn--start:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(16,185,129,0.45); }
.ts-clock__btn--stop {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239,68,68,0.35);
}
.ts-clock__btn--stop:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(239,68,68,0.45); }

/* ── Week nav ── */
.ts-week-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  background: #fff;
  padding: 0.4rem 0.5rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.ts-nav-btn {
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 1.3rem;
  color: #475569;
  cursor: pointer;
  transition: all 0.12s;
}
.ts-nav-btn:hover { background: #f1f5f9; color: #0f172a; }
.ts-nav-btn--today {
  width: auto;
  padding: 0 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  background: #eff6ff;
  color: #2563eb;
}
.ts-nav-btn--today:hover { background: #dbeafe; }
.ts-week-label {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  color: #0f172a;
  letter-spacing: -0.01em;
}

/* ── Summary ── */
.ts-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: #fff;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 1rem;
}
.ts-summary__total { display: flex; align-items: baseline; gap: 0.55rem; }
.ts-summary__label { font-size: 0.82rem; color: #64748b; font-weight: 600; }
.ts-summary__value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}
.ts-summary__decimal { font-size: 0.85rem; color: #64748b; font-family: 'SF Mono', monospace; }

/* ── Week grid (Ma semaine) ── */
.ts-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}
.ts-day {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ts-day:hover { border-color: #cbd5e1; box-shadow: 0 4px 10px rgba(15,23,42,0.05); }
.ts-day--today {
  border-color: #3b82f6;
  background: #f8faff;
  box-shadow: 0 0 0 1px #3b82f6;
}
.ts-day__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.55rem 0.7rem;
  background: linear-gradient(180deg, #fafbfc, #ffffff);
  border-bottom: 1px solid #f1f5f9;
}
.ts-day--today .ts-day__head { background: linear-gradient(180deg, #dbeafe, #eff6ff); }
.ts-day__name { font-weight: 700; font-size: 0.82rem; color: #0f172a; }
.ts-day__date { font-size: 0.7rem; color: #64748b; margin-top: 0.1rem; }
.ts-day__total {
  font-weight: 800;
  font-size: 0.9rem;
  color: #047857;
  font-variant-numeric: tabular-nums;
  padding: 0.15rem 0.5rem;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 6px;
}
.ts-day__entries {
  flex: 1;
  padding: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  overflow-y: auto;
}
.ts-day__add {
  padding: 0.45rem;
  background: transparent;
  border: 1px dashed #cbd5e1;
  margin: 0 0.45rem 0.45rem;
  border-radius: 6px;
  font-size: 0.72rem;
  color: #64748b;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}
.ts-day__add:hover { background: #f8fafc; border-color: #94a3b8; color: #0f172a; }
.ts-empty {
  font-size: 0.74rem;
  color: #cbd5e1;
  text-align: center;
  padding: 0.5rem;
  font-style: italic;
}

/* ── Entry row ── */
.ts-entry {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  grid-template-areas:
    "src time dur"
    ".   proj proj"
    ".   meta meta";
  gap: 0.1rem 0.45rem;
  padding: 0.45rem 0.55rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.75rem;
  position: relative;
}
.ts-entry:hover { background: #f1f5f9; border-color: #cbd5e1; }
.ts-entry--auto { border-left: 3px solid #f59e0b; }
.ts-entry--active {
  background: linear-gradient(135deg, #dcfce7, #d1fae5);
  border-color: #10b981;
}
.ts-entry__source { grid-area: src; align-self: center; font-size: 0.9rem; }
.ts-entry__time { grid-area: time; font-weight: 600; color: #0f172a; font-variant-numeric: tabular-nums; }
.ts-entry__duration { grid-area: dur; font-weight: 700; color: #047857; font-variant-numeric: tabular-nums; }
.ts-entry__project { grid-area: proj; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-entry__notes { grid-area: meta; }
.ts-entry__action {
  position: absolute;
  top: 2px;
  background: transparent;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
  padding: 2px 4px;
  border-radius: 4px;
}
.ts-entry__action:nth-of-type(1) { right: 22px; }
.ts-entry__action:nth-of-type(2) { right: 2px; }
.ts-entry:hover .ts-entry__action { opacity: 0.7; }
.ts-entry__action:hover { opacity: 1; background: rgba(0,0,0,0.05); }
.ts-entry__action--del:hover { background: #fef2f2; }
.ts-billed-pill {
  position: absolute;
  top: 2px;
  right: 50px;
  font-size: 0.7rem;
}

/* ── Team grid (admin) ── */
.ts-team-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 1rem;
}
.ts-team-meta {
  font-size: 0.9rem;
  color: #475569;
}
.ts-team-meta strong { color: #0f172a; }

.ts-grid-wrap {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: auto;
  box-shadow: 0 2px 8px rgba(15,23,42,0.04);
}
.ts-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
  min-width: 720px;
}
.ts-grid th {
  position: sticky;
  top: 0;
  background: #fafbfc;
  padding: 0.55rem 0.6rem;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #475569;
  font-weight: 700;
  text-transform: uppercase;
  border-bottom: 2px solid #e2e8f0;
  z-index: 1;
}
.ts-grid__user-th { text-align: left; min-width: 200px; }
.ts-grid__day-th { min-width: 70px; }
.ts-grid__day-num { font-size: 0.85rem; color: #0f172a; font-weight: 700; margin-top: 0.1rem; }
.ts-grid__total-th { background: #f0f9ff !important; color: #1e40af; }

.ts-grid td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid #f1f5f9;
  text-align: center;
  vertical-align: middle;
}
.ts-grid tbody tr:hover { background: #f8fafc; }
.ts-grid__user {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-align: left;
  font-weight: 600;
}
.ts-grid__user-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.ts-grid__user-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ts-grid__user-status { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ts-approval {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.ts-approval--ok { background: #dcfce7; color: #166534; }
.ts-approval--pending { background: #fef3c7; color: #92400e; }
.ts-approval-btn {
  font-size: 0.68rem;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  border-radius: 6px;
  padding: 1px 7px;
  cursor: pointer;
}
.ts-approval-btn:hover { background: #f1f5f9; }
.ts-approval-btn--ok { border-color: #86efac; color: #166534; background: #f0fdf4; }
.ts-approval-btn--ok:hover { background: #dcfce7; }
.ts-row--validated { background: rgba(16, 185, 129, 0.04); }

/* ===== Tag « Férié » sur les punchs ===== */
.ts-holiday-tag,
.ts-cell-holiday,
.ts-th-holiday {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 800;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 5px;
  padding: 0 5px;
  line-height: 1.4;
  white-space: nowrap;
}
.ts-th--holiday { background: #fffbeb; }
.ts-th-holiday { margin-top: 2px; }
.ts-grid__cell--holiday { position: relative; }
.ts-cell-holiday { position: absolute; top: 2px; left: 2px; z-index: 2; }
.ts-day--holiday { box-shadow: inset 0 0 0 2px #fde68a; }
.ts-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ts-grid__cell {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #0f172a;
  transition: background 0.15s;
  vertical-align: top;
  padding: 0.4rem 0.4rem !important;
  min-width: 110px;
}
.ts-grid__cell--empty {
  color: #cbd5e1;
  vertical-align: middle;
  text-align: center;
}
.ts-grid__dot { font-size: 1.2rem; }
.ts-grid__total {
  font-weight: 800;
  color: #1e40af;
  background: #f0f9ff;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
  text-align: center;
}

/* ── Cellule détaillée : total + pills d'heures clock in/out ── */
.ts-grid__cell-total {
  font-size: 0.82rem;
  font-weight: 800;
  color: #065f46;
  text-align: center;
  padding-bottom: 0.2rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px dashed rgba(16, 185, 129, 0.3);
}
.ts-grid__cell-pills {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  align-items: stretch;
}

/* Pills horaires : HH:MM→HH:MM avec couleur selon source */
.ts-pill {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: #e0f2fe;
  color: #075985;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: center;
  border: 1px solid transparent;
  line-height: 1.3;
  transition: transform 0.1s, box-shadow 0.1s, background 0.12s;
}
.ts-pill:hover { box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15); }

/* Source : pointage normal (clock in/out réel) */
.ts-pill--punch {
  background: #d1fae5;
  color: #065f46;
  border-color: rgba(16, 185, 129, 0.25);
}
.ts-pill--punch:hover { background: #a7f3d0; transform: translateY(-1px); }

/* Source : saisie manuelle */
.ts-pill--manual {
  background: #fef3c7;
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.25);
}
.ts-pill--manual:hover { background: #fde68a; transform: translateY(-1px); }

/* Source : auto-fermé après 8h */
.ts-pill--auto {
  background: #fee2e2;
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.3);
}
.ts-pill--auto:hover { background: #fecaca; transform: translateY(-1px); }

/* Pill "+N" pour les entrées masquées */
.ts-pill--more {
  background: #e2e8f0;
  color: #475569;
  font-size: 0.62rem;
  cursor: help;
}

/* ── Editor overlay ── */
.ts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
}
.ts-overlay__panel {
  background: #fff;
  border-radius: 14px;
  padding: 1.4rem;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  animation: ts-popin 0.18s ease-out;
}
@keyframes ts-popin {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.ts-overlay__panel h3 { margin: 0 0 1rem; font-size: 1.1rem; font-weight: 700; }
.ts-overlay__row {
  margin-bottom: 0.85rem;
}
.ts-overlay__row label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.3rem;
}
.ts-overlay__row input,
.ts-overlay__row select,
.ts-overlay__row textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
}
.ts-overlay__row input:focus,
.ts-overlay__row select:focus,
.ts-overlay__row textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.ts-overlay__row--2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.ts-overlay__hint {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.85rem;
}
.ts-overlay__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Panel plus large pour accueillir la grille horaire */
.ts-overlay__panel--grid {
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
}

/* ── Time Grid ──────────────────────────────────────────────────
   Grille verticale de 33 cells (06:00 → 22:00, par tranches de 30 min).
   L'utilisateur clique-glisse pour définir la plage horaire.
   ─────────────────────────────────────────────────────────────── */
.ts-tg-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
  border-radius: 8px;
  margin-bottom: 0.55rem;
}
.ts-tg-summary-times {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  color: #0f172a;
  flex-wrap: wrap;
}
.ts-tg-summary-times strong {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #065f46;
  font-variant-numeric: tabular-nums;
}
.ts-tg-summary-label {
  font-size: 0.72rem;
  color: #475569;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ts-tg-summary-arrow {
  color: #94a3b8;
  font-weight: 700;
  margin: 0 0.2rem;
}
.ts-tg-summary-duration {
  font-size: 1rem;
  font-weight: 800;
  color: #047857;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.7);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}

.ts-tg-hint {
  font-size: 0.82rem;
  color: #64748b;
  margin-bottom: 0.5rem;
  padding: 0.4rem 0.65rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  transition: all 0.15s ease;
}
.ts-tg-hint strong { color: #0f172a; }
.ts-tg-hint--active {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #f59e0b;
  color: #92400e;
  animation: ts-hint-pulse 1.5s ease-in-out infinite;
}
.ts-tg-hint--active strong { color: #78350f; }
@keyframes ts-hint-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0); }
}

.ts-tg-wrap {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fafbfc;
  max-height: 320px;
  overflow-y: auto;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  position: relative;
  padding: 0.25rem 0;
  scrollbar-width: thin;
}

.ts-tg-cell {
  display: flex;
  align-items: center;
  height: 18px;
  padding: 0 0.75rem;
  font-size: 0.72rem;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  border-top: 1px dashed transparent;
  transition: background 0.08s ease, color 0.08s ease;
  cursor: pointer;
  position: relative;
}
.ts-tg-cell:hover {
  background: rgba(59, 130, 246, 0.08);
}
.ts-tg-cell--hour {
  border-top: 1px solid #e2e8f0;
  color: #475569;
  font-weight: 600;
  height: 20px;
}
.ts-tg-cell--hour .ts-tg-cell__label {
  font-size: 0.78rem;
}
.ts-tg-cell:first-child {
  border-top: none;
}
.ts-tg-cell__label {
  pointer-events: none;
  position: relative;
  z-index: 1;
}

/* État "dans la plage sélectionnée" */
.ts-tg-cell--in {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.18), rgba(16, 185, 129, 0.28));
  color: #065f46;
  font-weight: 700;
}
.ts-tg-cell--in.ts-tg-cell--hour {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.25), rgba(16, 185, 129, 0.35));
  color: #064e3b;
}

/* Bords : début / fin de la plage */
.ts-tg-cell--start {
  background: #10b981 !important;
  color: #fff !important;
  font-weight: 800;
  box-shadow: inset 0 2px 0 #047857;
  border-top: 1px solid #047857 !important;
}
.ts-tg-cell--start::after {
  content: 'DÉBUT';
  position: absolute;
  right: 0.65rem;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.25);
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  color: #fff;
}
.ts-tg-cell--end {
  background: #059669 !important;
  color: #fff !important;
  font-weight: 800;
  box-shadow: inset 0 -2px 0 #047857;
}
.ts-tg-cell--end::after {
  content: 'FIN';
  position: absolute;
  right: 0.65rem;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.25);
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  color: #fff;
}
.ts-tg-cell--single::after {
  content: 'DÉBUT / FIN';
}

/* Indicateur visuel : ces bords sont des "handles" qu'on peut glisser
   pour ajuster l'extrémité sans toucher à l'autre. Le curseur ew-resize
   signale que l'élément se redimensionne horizontalement (ou verticalement
   par extension visuelle, même si la grille est verticale).
   Petite "poignée" sur la bordure droite pour le côté physique du drag. */
.ts-tg-cell--start,
.ts-tg-cell--end {
  cursor: ns-resize;
  position: relative;
  transition: filter 120ms ease;
}
.ts-tg-cell--start::before,
.ts-tg-cell--end::before {
  content: '';
  position: absolute;
  left: 0.4rem;
  top: 50%;
  width: 16px;
  height: 4px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 2px;
  transform: translateY(-50%);
  box-shadow: 0 -3px 0 rgba(255, 255, 255, 0.6), 0 3px 0 rgba(255, 255, 255, 0.6);
  pointer-events: none;
  opacity: 0.85;
}
.ts-tg-cell--start:hover,
.ts-tg-cell--end:hover {
  filter: brightness(1.08);
}
/* Cellule unique (start == end) : pas de drag possible (lo == hi) */
.ts-tg-cell--single { cursor: pointer; }
.ts-tg-cell--single::before { display: none; }

/* Pendant un drag : feedback visuel renforcé sur la grille + curseur global */
.ts-tg-wrap.ts-tg--dragging {
  cursor: ns-resize;
  user-select: none;
  -webkit-user-select: none;
}
.ts-tg-wrap.ts-tg--dragging .ts-tg-cell--start,
.ts-tg-wrap.ts-tg--dragging .ts-tg-cell--end {
  filter: brightness(1.18) saturate(1.2);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.5), 0 4px 14px rgba(16, 185, 129, 0.35);
}

/* Preview "ghost" pendant la sélection 2-clics (entre start cliqué et hover) */
.ts-tg-cell--preview {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.25)) !important;
  color: #92400e !important;
}

/* ── Édition d'un punch en cours ─────────────────────────────── */

/* Bandeau d'avertissement en haut du modal */
.ts-overlay__open-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0 1rem;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.05));
  border-left: 4px solid #10b981;
  border-radius: 6px;
}
.ts-overlay__open-pulse {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: ts-pulse 1.6s ease-out infinite;
}
@keyframes ts-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70%  { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.ts-overlay__open-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  line-height: 1.3;
}
.ts-overlay__open-text strong { font-size: 0.95rem; color: #065f46; }
.ts-overlay__open-text span   { font-size: 0.82rem; color: #047857; }

/* Toggle "Terminer ce punch" */
.ts-overlay__row--toggle {
  display: block;
}
.ts-overlay__row--toggle > label {
  display: none; /* le label flottant n'est pas pertinent pour un toggle */
}
.ts-toggle {
  display: flex !important;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  background: #fef9c3;
  border: 1px dashed #eab308;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  color: #713f12;
  width: 100%;
}
.ts-toggle input[type="checkbox"] {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #b91c1c;
  flex-shrink: 0;
}
.ts-toggle:hover {
  background: #fef3c7;
  border-color: #ca8a04;
}

/* Grille en mode "punch ouvert non terminé" : on grise la zone potentielle de fin
   pour signaler que la grille n'agit que sur le début */
.ts-tg-wrap--open-punch:not(.ts-tg-wrap--finishing) .ts-tg-cell:not(.ts-tg-cell--start):not(.ts-tg-cell--in) {
  opacity: 0.55;
}
.ts-tg-wrap--open-punch:not(.ts-tg-wrap--finishing) .ts-tg-cell--start::after {
  content: 'DÉBUT (punch en cours)';
}

/* Quand on coche "Terminer", on remet la grille active */
.ts-tg-wrap--finishing .ts-tg-cell {
  opacity: 1;
}
.ts-tg-wrap--finishing .ts-tg-cell--end::after {
  content: 'FIN (à enregistrer)';
}

/* ── Loading / empty ── */
.ts-loading,
.ts-empty-big {
  text-align: center;
  padding: 3rem 1rem;
  color: #94a3b8;
  font-style: italic;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .ts-week-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 768px) {
  .ts-week-grid { grid-template-columns: 1fr; }
  .ts-day { min-height: auto; }
  .ts-clock { flex-wrap: wrap; }
  .ts-clock__select { width: 100%; min-width: 0; max-width: none; }
  .ts-header { flex-direction: column; align-items: stretch; }
  .ts-grid { font-size: 0.78rem; }
  .ts-grid__user-name { max-width: 100px; }
}
