/* =========================================================
   calendar.css — vue Calendrier (#/calendrier, views/calendar.js).
   Peau v3 : contours 1 px (--tp-line), ombres douces courtes, rayons 8–10 px, couleur du tableau en bande à gauche des cartes.

   .tp-cal (page) > .tp-cal__head (.tp-cal__summary, .tp-cal__overdue) + .tp-cal__bar (.tp-cal__nav, .tp-cal__navbtn
     [.is-drop-hover], .tp-cal__period, .tp-cal__views, .tp-cal__undatedbtn) + .tp-cal__layout(.is-undated-closed)
     > .tp-cal__main(.is-slide-next|.is-slide-prev|.is-fade) + aside.tp-cal__undated(.is-drop-target)
   Mois     .tp-cal__month (--weeks) > .tp-cal__weekdays + ol.tp-cal__grid > li.tp-cal__day(.is-today .is-out .is-past
            .is-weekend .is-drop-target) > .tp-cal__dayhead .tp-cal__num + ul.tp-cal__list + .tp-cal__more + .tp-cal__dayopen
   Semaine  ol.tp-cal__week > li.tp-cal__wday(.is-today …) > h3.tp-cal__wdayhead + ul.tp-cal__list | .tp-cal__none
   Carte    .tp-cal__card(--month|--week|--undated, .is-overdue .is-soon .is-complete .is-readonly .is-drag-source
            .is-landing .is-landed .is-just-done ; --b = couleur du tableau) > .tp-cal__check + a.tp-cal__link
            (.tp-cal__chiphead > .tp-cal__time + .tp-cal__dots | .tp-cal__labels, .tp-cal__title, .tp-cal__meta)
   Glisser  .tp-cal-ghost (fantôme incliné, dans <body>) · html.tp-cal-dragging · .tp-cal.is-dragging
   Popover  .tp-pop--cal-day > .tp-cal__poplist
   ========================================================= */

.tp-cal { max-width: 1480px; }
.tp-cal__head { align-items: flex-start; margin-bottom: 14px; }
.tp-cal__heading { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tp-cal__summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--tp-text-subtle); font-weight: 600; min-height: 24px; }
.tp-cal__overdue {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border: 1px solid var(--tp-coral-edge); border-radius: 12px;
  background: var(--tp-coral-bg); color: var(--tp-coral-text); font-size: 12px; line-height: 20px; font-weight: 800; cursor: pointer;
  transition: transform 200ms var(--tp-spring), filter var(--tp-dur) var(--tp-ease);
}
.tp-cal__overdue:hover { transform: translateY(-1px); filter: brightness(1.12); }
.tp-cal__overdue .tp-icon { width: 13px; height: 13px; }

/* ---------- Toolbar ---------- */
.tp-cal__bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 14px; padding: 8px 10px;
  border: 1px solid var(--tp-line); border-radius: var(--tp-radius-lg); background: var(--tp-surface); box-shadow: var(--tp-shadow-pop);
}
.tp-cal__nav { display: flex; align-items: center; gap: 6px; }
.tp-cal__navbtn {
  border: 1px solid var(--tp-line); background: var(--tp-surface-3); color: var(--tp-text-strong); box-shadow: var(--tp-shadow-raised);
  transition: background-color var(--tp-dur) var(--tp-ease), color var(--tp-dur) var(--tp-ease), transform 200ms var(--tp-spring), box-shadow 120ms var(--tp-ease);
}
.tp-cal__navbtn:hover { background: var(--tp-surface-3-hover); color: #fff; }
.tp-cal__navbtn:active { transform: translateY(2px); box-shadow: none; }
.tp-cal__navbtn.is-drop-hover { border-color: var(--tp-accent-edge); background: var(--tp-accent); color: var(--tp-accent-text); transform: scale(1.06); animation: tp-cal-nudge 650ms ease-in-out infinite; }
.tp-cal__period { flex: 0 1 auto; min-width: 0; font-size: 20px; line-height: 26px; }
.tp-cal__spacer { flex: 1; }
.tp-cal__undatedbtn .tp-count { min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; }

/* ---------- Layout ---------- */
.tp-cal__layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.tp-cal__layout.is-undated-closed { grid-template-columns: minmax(0, 1fr); }
.tp-cal__layout.is-undated-closed .tp-cal__undated { display: none; }
.tp-cal__main { min-width: 0; }
.tp-cal__main.is-slide-next [data-grid] > * { animation: tp-cal-next 240ms var(--tp-ease-out); }
.tp-cal__main.is-slide-prev [data-grid] > * { animation: tp-cal-prev 240ms var(--tp-ease-out); }
.tp-cal__main.is-fade [data-grid] > * { animation: tp-fade 200ms var(--tp-ease); }
.tp-cal__notice { margin-bottom: 14px; }
.tp-cal__notice .tp-link { font-weight: 800; }

/* ---------- Month ---------- */
.tp-cal__month {
  overflow: hidden; border: 1px solid var(--tp-line); border-radius: var(--tp-radius-lg); background: var(--tp-line); box-shadow: var(--tp-shadow-pop);
}
.tp-cal__weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--tp-bg-sunken); border-bottom: 1px solid var(--tp-line); }
.tp-cal__weekdays span { padding: 8px 10px; color: var(--tp-text-subtle); font-size: 12px; line-height: 16px; font-weight: 800; text-transform: capitalize; }
.tp-cal__weekdays span.is-weekend { color: var(--tp-text-subtlest); }
.tp-cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(124px, auto); gap: 2px; list-style: none; }
.tp-cal__day {
  position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 6px;
  background: var(--tp-surface); transition: background-color var(--tp-dur) var(--tp-ease), box-shadow var(--tp-dur) var(--tp-ease);
}
.tp-cal__day.is-weekend { background: #121927; }
.tp-cal__day.is-out { background: #0e131d; }
.tp-cal__day.is-out .tp-cal__num { color: var(--tp-text-subtlest); }
.tp-cal__day.is-past .tp-cal__num { opacity: 0.75; }
.tp-cal__day.is-today { background: #142450; box-shadow: inset 0 0 0 2px var(--tp-accent); }
.tp-cal__dayhead { display: flex; align-items: center; justify-content: space-between; min-height: 26px; }
.tp-cal__num {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border: 1px solid transparent; border-radius: 13px;
  color: var(--tp-text-strong); font-family: var(--tp-font); font-size: 13px; line-height: 1; font-weight: 800; white-space: nowrap;
}
.tp-cal__day.is-today .tp-cal__num, .tp-cal__wday.is-today .tp-cal__num {
  border-color: var(--tp-accent-edge); background: var(--tp-accent); color: var(--tp-accent-text); box-shadow: var(--tp-shadow-raised); opacity: 1;
}
.tp-cal__list { display: flex; flex-direction: column; gap: 4px; min-width: 0; list-style: none; }
.tp-cal__item { min-width: 0; }
.tp-cal__more {
  align-self: flex-start; padding: 1px 7px; border: 0; border-radius: var(--tp-radius-xs); background: none;
  color: var(--tp-text-subtle); font-size: 12px; line-height: 18px; font-weight: 800;
  transition: background-color var(--tp-dur) var(--tp-ease), color var(--tp-dur) var(--tp-ease);
}
.tp-cal__more:hover { background: var(--tp-hover-strong); color: var(--tp-text-strong); }
.tp-cal__dayopen { display: none; }
.tp-cal__day.is-drop-target, .tp-cal__wday.is-drop-target { background: var(--tp-selected); box-shadow: inset 0 0 0 2px var(--tp-accent-hover); }
.tp-cal__month--loading .tp-cal__day { min-height: 110px; }

/* ---------- Week ---------- */
.tp-cal__week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; list-style: none; }
.tp-cal__wday {
  display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 380px; padding: 8px;
  border: 1px solid var(--tp-line); border-radius: var(--tp-radius-lg); background: var(--tp-surface); box-shadow: var(--tp-shadow-raised);
  transition: background-color var(--tp-dur) var(--tp-ease), box-shadow var(--tp-dur) var(--tp-ease);
}
.tp-cal__wday.is-weekend { background: #121927; }
.tp-cal__wday.is-today { border-color: var(--tp-accent-edge); background: #142450; box-shadow: var(--tp-shadow-pop); }
.tp-cal__wdayhead { display: flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 2px; font-size: 14px; }
.tp-cal__wdname { color: var(--tp-text-subtle); font-size: 12px; font-weight: 800; text-transform: capitalize; }
.tp-cal__wdmonth { display: none; overflow: hidden; color: var(--tp-text-subtlest); font-family: var(--tp-font); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.tp-cal__wday.is-past .tp-cal__wdayhead { opacity: 0.8; }
.tp-cal__none { padding: 6px 4px; color: var(--tp-text-subtlest); font-size: 12px; }
.tp-cal__wday .tp-cal__list { gap: 6px; }

/* ---------- Card chip ---------- */
.tp-cal__card {
  --b: var(--tp-accent);
  position: relative; display: flex; align-items: flex-start; gap: 6px; min-width: 0; padding: 4px 6px 4px 11px;
  border: 1px solid var(--tp-line); border-radius: var(--tp-radius-sm); background: var(--tp-surface-2); box-shadow: var(--tp-shadow-raised);
  cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  transition: transform 180ms var(--tp-spring), background-color var(--tp-dur) var(--tp-ease), box-shadow 160ms var(--tp-ease), opacity var(--tp-dur) var(--tp-ease);
}
.tp-cal__card::before { content: ""; position: absolute; left: 3px; top: 4px; bottom: 4px; width: 4px; border-radius: 2px; background: var(--b); }
.tp-cal__card:hover { background: var(--tp-surface-3); transform: translateY(-1px); box-shadow: var(--tp-shadow-pop); }
.tp-cal__card:focus-within { box-shadow: 0 0 0 2px var(--tp-accent-hover), var(--tp-shadow-raised); }
.tp-cal__card.is-readonly { cursor: pointer; }
.tp-cal__link {
  position: static; display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; color: var(--tp-text-strong); text-decoration: none;
  -webkit-user-drag: none;
}
.tp-cal__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* whole chip clickable */
.tp-cal__link:hover { color: #fff; text-decoration: none; }
.tp-cal__link:focus-visible { outline: none; }
.tp-cal__chiphead { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; min-width: 0; min-height: 16px; }
.tp-cal__card.has-check .tp-cal__chiphead { padding-left: 21px; }
.tp-cal__time { flex: none; color: var(--tp-text-subtle); font-size: 11px; line-height: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tp-cal__title {
  display: -webkit-box; min-width: 0; overflow: hidden; font-size: 12px; line-height: 16px; font-weight: 700;
  -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: break-word;
}
.tp-cal__card--week, .tp-cal__card--undated { padding: 7px 8px 7px 12px; }
.tp-cal__card--week .tp-cal__title, .tp-cal__card--undated .tp-cal__title { font-size: 13px; line-height: 18px; -webkit-line-clamp: 3; }
.tp-cal__card--week.has-check .tp-cal__chiphead { padding-left: 23px; min-height: 18px; }
.tp-cal__dots { display: flex; gap: 3px; }
.tp-cal__dot { width: 12px; height: 5px; border-radius: 3px; background: var(--c); }
.tp-cal__labels { display: flex; flex-wrap: wrap; gap: 4px; }
.tp-cal__label { min-width: 28px; height: 6px; }
.tp-cal__meta { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--tp-text-subtlest); font-size: 11px; line-height: 14px; font-weight: 700; }
.tp-cal__board { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-cal__swatch { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 3px; background: var(--b); vertical-align: 0; }
.tp-cal__lock { display: inline-grid; flex: none; color: var(--tp-text-subtle); }
.tp-cal__lock .tp-icon { width: 12px; height: 12px; }
.tp-cal__members { margin-left: auto; flex: none; }
.tp-cal__members .tp-members > * { box-shadow: 0 0 0 2px var(--tp-surface-2); }

/* States */
.tp-cal__card.is-soon .tp-cal__time { color: var(--tp-yellow-text); }
.tp-cal__card.is-overdue { border-color: #6e2a24; background: #2a1a1e; }
.tp-cal__card.is-overdue:hover { background: #33201f; }
.tp-cal__card.is-overdue .tp-cal__time { color: var(--tp-red-text); }
.tp-cal__card.is-complete { background: #10261f; }
.tp-cal__card.is-complete:hover { background: #142e26; }
.tp-cal__card.is-complete .tp-cal__title { color: var(--tp-text-subtle); text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: #4bce9799; }
.tp-cal__card.is-complete .tp-cal__time { color: var(--tp-green-text); }

/* « Done » round checkbox */
.tp-cal__check {
  position: absolute; z-index: 1; top: 4px; left: 10px; display: grid; place-items: center; width: 16px; height: 16px; margin: 0; padding: 0;
  border: 1px solid #4f5d78; border-radius: 50%; background: var(--tp-field-bg); color: #0b2a1d; cursor: pointer;
  transition: border-color var(--tp-dur) var(--tp-ease), background-color var(--tp-dur) var(--tp-ease), transform 200ms var(--tp-spring);
}
.tp-cal__card--week .tp-cal__check, .tp-cal__card--undated .tp-cal__check { top: 7px; left: 11px; width: 18px; height: 18px; }
.tp-cal__check .tp-icon { width: 10px; height: 10px; stroke-width: 3.5; transform: scale(0); transition: transform 220ms var(--tp-spring); }
.tp-cal__check:hover { border-color: var(--tp-success); transform: scale(1.06); }
.tp-cal__check:hover .tp-icon { transform: scale(0.7); color: var(--tp-success); }
.tp-cal__check[aria-pressed="true"], .tp-cal__check.is-static { border-color: #1f7f5b; background: var(--tp-success); }
.tp-cal__check[aria-pressed="true"] .tp-icon, .tp-cal__check.is-static .tp-icon { transform: scale(1); color: #0b2a1d; }
.tp-cal__check.is-static { cursor: default; }
.tp-cal__card.is-overdue .tp-cal__check:not([aria-pressed="true"]) { border-color: var(--tp-red); }
.tp-cal__card.is-just-done .tp-cal__check { animation: tp-cal-pop 380ms var(--tp-spring); }

/* ---------- Drag & drop ---------- */
.tp-cal__card.is-drag-source { opacity: 0.35; transform: none; box-shadow: none; border-style: dashed; }
.tp-cal__card.is-landing { visibility: hidden; }
.tp-cal__card.is-landed { animation: tp-cal-land 380ms var(--tp-spring); }
.tp-cal-ghost {
  position: fixed; top: 0; left: 0; z-index: 600; margin: 0; pointer-events: none; will-change: transform;
  background: var(--tp-surface-3); box-shadow: var(--tp-shadow-pop), 0 14px 28px #03060866;
}
.tp-cal-ghost.is-landing { transition: transform 180ms var(--tp-ease), width 180ms var(--tp-ease); }
html.tp-cal-dragging, html.tp-cal-dragging * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }
.tp-cal.is-dragging .tp-cal__card:hover { transform: none; }
.tp-cal.is-dragging .tp-cal__day, .tp-cal.is-dragging .tp-cal__wday { cursor: copy; }
.tp-cal.is-dragging-undated .tp-cal__undated { opacity: 0.7; }

/* ---------- « Sans date » column ---------- */
.tp-cal__undated {
  position: sticky; top: 16px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 32px); min-width: 0; padding: 12px;
  border: 1px solid var(--tp-line); border-radius: var(--tp-radius-lg); background: var(--tp-surface); box-shadow: var(--tp-shadow-pop);
  transition: background-color var(--tp-dur) var(--tp-ease), box-shadow var(--tp-dur) var(--tp-ease), opacity var(--tp-dur) var(--tp-ease);
  animation: tp-pop-in 220ms var(--tp-spring);
}
.tp-cal__undated.is-drop-target { background: var(--tp-selected); box-shadow: inset 0 0 0 2px var(--tp-accent-hover), var(--tp-shadow-pop); }
.tp-cal__undated-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tp-cal__undated-head h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; line-height: 22px; }
.tp-cal__undated-head h2 .tp-icon { color: var(--tp-coral); }
.tp-cal__hint { color: var(--tp-text-subtlest); font-size: 12px; line-height: 16px; }
.tp-cal__ulist {
  display: flex; flex-direction: column; gap: 6px; min-height: 48px; margin: 0 -4px; padding: 2px 4px 6px; overflow-y: auto; list-style: none;
  overscroll-behavior: contain;
}
.tp-cal__uempty { padding: 8px 2px; color: var(--tp-text-subtlest); font-size: 12px; text-align: center; }

/* ---------- Misc ---------- */
.tp-cal__help { display: flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--tp-text-subtlest); font-size: 12px; line-height: 18px; }
.tp-cal__help .tp-icon { width: 14px; height: 14px; }
.tp-cal__poplist { display: flex; flex-direction: column; gap: 6px; list-style: none; }

/* ---------- Animations ---------- */
@keyframes tp-cal-next { from { opacity: 0; transform: translateX(18px); } }
@keyframes tp-cal-prev { from { opacity: 0; transform: translateX(-18px); } }
@keyframes tp-cal-land { 0% { transform: scale(0.96); } 55% { transform: scale(1.02); } 100% { transform: none; } }
@keyframes tp-cal-pop { 0% { transform: scale(0.7); } 60% { transform: scale(1.1); } 100% { transform: none; } }
@keyframes tp-cal-nudge { 50% { transform: scale(1.1); } }

/* ---------- Responsive ---------- */
/* Week view: 7 columns need room, so « Sans date » goes below them (as a grid of cards) until the screen is wide. */
@media (max-width: 1599px) {
  .tp-cal__layout.is-week { grid-template-columns: minmax(0, 1fr); }
  .tp-cal__layout.is-week .tp-cal__undated { position: static; max-height: none; animation: none; }
  .tp-cal__layout.is-week .tp-cal__ulist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); max-height: 360px; align-content: start; }
}
@media (max-width: 1199px) {
  .tp-cal__layout { grid-template-columns: minmax(0, 1fr) 260px; }
  .tp-cal__week { gap: 6px; }
  .tp-cal__wday { padding: 6px; }
}
@media (max-width: 1023px) {
  .tp-cal__layout { grid-template-columns: minmax(0, 1fr); }
  .tp-cal__undated { position: static; max-height: none; animation: none; }
  .tp-cal__ulist { max-height: 420px; }
  .tp-cal__week { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .tp-cal__wday { min-height: 0; }
  .tp-cal__wdayhead { min-height: 26px; }
  .tp-cal__wdmonth { display: inline; }
  .tp-cal__wday .tp-cal__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
@media (max-width: 699px) {
  .tp-cal__bar { gap: 8px; padding: 8px; }
  .tp-cal__period { order: -1; flex-basis: 100%; font-size: 18px; line-height: 24px; }
  .tp-cal__spacer { display: none; }
  .tp-cal__help { display: none; }
  .tp-cal__weekdays span { padding: 6px 0; text-align: center; font-size: 11px; }
  .tp-cal__grid { grid-auto-rows: minmax(64px, auto); }
  .tp-cal__day { gap: 3px; padding: 4px 3px; }
  .tp-cal__dayhead { justify-content: center; min-height: 22px; }
  .tp-cal__num { min-width: 22px; height: 22px; padding: 0 4px; font-size: 12px; border-radius: 11px; }
  .tp-cal__day .tp-cal__list { gap: 3px; padding: 0 2px; }
  /* A day becomes one big button (popover with its cards); its cards turn into coloured bars. */
  .tp-cal__card.tp-cal__card--month { min-height: 0; height: 6px; padding: 0; border: 0; border-radius: 3px; background: var(--b); box-shadow: none; }
  .tp-cal__card.tp-cal__card--month::before, .tp-cal__card.tp-cal__card--month > * { display: none; }
  .tp-cal__card.tp-cal__card--month.is-complete { opacity: 0.45; }
  .tp-cal__card.tp-cal__card--month.is-overdue { background: var(--tp-red); }
  .tp-cal__more { display: none; }
  .tp-cal__dayopen { position: absolute; inset: 0; z-index: 2; display: block; width: 100%; padding: 0; border: 0; background: transparent; border-radius: 0; }
  .tp-cal__dayopen:focus-visible { outline-offset: -3px; }
  .tp-cal__daycount {
    position: absolute; right: 2px; bottom: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
    background: var(--tp-surface-3); color: var(--tp-text-strong); font-size: 10px; line-height: 16px; font-weight: 800;
  }
  .tp-cal__wday .tp-cal__list { grid-template-columns: minmax(0, 1fr); }
}
@media (hover: none) {
  .tp-cal__card:hover { transform: none; }
}
