/* =========================================================================
   Module Tâches — Lot G : commentaires, pièces jointes, activité
   -------------------------------------------------------------------------
   Tout est préfixé `.tka-` pour ne jamais entrer en collision avec
   tablette.css / taches-core.css. On n'utilise QUE les variables de
   tablette.css (--card, --txt, --txt2, --sep, --blue, --red, --green…) :
   le mode sombre suit donc tout seul.
   ========================================================================= */

.tka { display: block; }

/* ------------------------------- communs -------------------------------- */
.tka-load {
  padding: 14px 2px; font-size: 14px; color: var(--txt2); text-align: center;
}
.tka-err {
  padding: 12px 14px; border-radius: 12px; font-size: 14px;
  background: rgba(255, 59, 48, .12); color: var(--red);
}
.tka-vide {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 18px 10px 22px; text-align: center;
}
.tka-vide-ic { font-size: 34px; line-height: 1; opacity: .5; }
.tka-vide-t { font-size: 16px; font-weight: 600; color: var(--txt); }
.tka-vide-s { font-size: 13.5px; color: var(--txt2); max-width: 340px; line-height: 1.4; }

/* compteur ajouté dans le <h3> de la section */
.tka-cpt {
  min-width: 18px; padding: 0 6px; margin-left: 2px;
  background: var(--fill-2); color: var(--txt2);
  border-radius: 9px; font-size: 11px; font-weight: 700;
  line-height: 18px; text-align: center; letter-spacing: 0;
}

.tka-ic {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px;
  font-size: 14px; color: var(--txt2); background: transparent;
  opacity: .75; transition: background .18s ease, opacity .18s ease;
}
.tka-ic:hover { background: rgba(120, 120, 128, .18); opacity: 1; }
.tka-ic.danger { color: var(--red); }
.tka-ic:disabled { opacity: .3; }

.tka-ta {
  min-height: 44px; font-size: 15px; line-height: 1.45; resize: none;
  overflow: hidden;
}

/* =========================== 1. COMMENTAIRES ============================ */
.tka-fil { display: flex; flex-direction: column; gap: 2px; }

.tka-msg {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 4px; border-radius: 12px;
  transition: background .18s ease;
}
.tka-msg:hover { background: var(--fill-3); }
.tka-avat { flex: 0 0 auto; padding-top: 2px; }
.tka-bloc { flex: 1; min-width: 0; }

.tka-tete {
  display: flex; align-items: center; gap: 8px; margin-bottom: 3px;
  font-size: 13px; color: var(--txt2);
}
.tka-tete b { font-size: 14px; font-weight: 700; color: var(--txt); }
.tka-tete time { font-size: 12px; color: var(--txt2); white-space: nowrap; }
.tka-mod {
  font-size: 11px; font-style: italic; color: var(--txt2); opacity: .8;
}
.tka-outils {
  margin-left: auto; display: flex; gap: 2px;
  opacity: 0; transition: opacity .18s ease;
}
.tka-msg:hover .tka-outils,
.tka-msg:focus-within .tka-outils { opacity: 1; }

.tka-corps {
  font-size: 15px; line-height: 1.5; color: var(--txt);
  word-break: break-word; overflow-wrap: anywhere;
}
.tka-corps b { font-weight: 700; }
.tka-men {
  padding: 1px 5px; border-radius: 7px; font-weight: 600;
  background: rgba(0, 122, 255, .14); color: var(--blue);
}
.tka-url { color: var(--blue); text-decoration: underline; }

.tka-edit { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.tka-edit-b { display: flex; gap: 8px; justify-content: flex-end; }
.tka-edit-b .btn { padding: 8px 14px; font-size: 14px; }

/* ------------------------------ composer -------------------------------- */
.tka-comp {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--sep);
}
.tka-comp-in { flex: 1; min-width: 0; position: relative; }
.tka-comp-bas {
  display: flex; align-items: center; gap: 10px; margin-top: 8px;
}
.tka-astuce {
  flex: 1; min-width: 0; font-size: 11.5px; color: var(--txt2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tka-comp-bas .btn { padding: 9px 18px; font-size: 15px; }
.tka-lecture {
  margin-top: 12px; padding: 10px 12px; border-radius: 12px;
  background: var(--fill); color: var(--txt2); font-size: 13.5px;
}

/* autocomplétion des mentions */
.tka-sugg {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 30;
  display: flex; flex-direction: column; padding: 5px;
  background: var(--card); border-radius: 13px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .22);
  max-height: 232px; overflow-y: auto;
}
.tka-sugg[hidden] { display: none; }
.tka-sug {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 10px; text-align: left;
  font-size: 15px; color: var(--txt); background: transparent;
  transition: background .18s ease;
}
.tka-sug.on, .tka-sug:hover { background: rgba(0, 122, 255, .14); }

/* =========================== 2. PIÈCES JOINTES ========================== */
.tka-pjs { display: flex; flex-direction: column; gap: 6px; }

.tka-pj-row {
  display: flex; align-items: center; gap: 6px;
  border-radius: 13px; background: var(--fill-3);
  transition: background .18s ease;
}
.tka-pj-row:hover { background: var(--fill); }
.tka-pj-l {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; color: var(--txt); text-decoration: none;
}
.tka-vig {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 10px;
  object-fit: cover; background: var(--fill);
}
.tka-vig-ic {
  display: flex; align-items: center; justify-content: center; font-size: 21px;
}
.tka-pj-txt { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.tka-pj-nom {
  font-size: 15px; font-weight: 600; color: var(--txt);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tka-pj-meta {
  font-size: 12px; color: var(--txt2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tka-pj-row > .tka-ic { margin-right: 6px; }

/* zone de dépôt */
.tka-drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin-top: 12px; padding: 18px 14px; text-align: center;
  border: 2px dashed var(--sep); border-radius: 15px;
  transition: border-color .18s ease, background .18s ease;
}
.tka-drop.survol {
  border-color: var(--blue); background: rgba(0, 122, 255, .09);
}
.tka-drop-ic { font-size: 26px; line-height: 1; opacity: .65; }
.tka-drop-t { font-size: 14.5px; font-weight: 600; color: var(--txt); }
.tka-drop-b { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tka-drop-b .btn { padding: 9px 15px; font-size: 14px; }
.tka-drop-h { font-size: 11.5px; color: var(--txt2); line-height: 1.4; }

/* barre de progression d'envoi */
.tka-prog { margin-top: 10px; }
.tka-prog[hidden] { display: none; }
.tka-piste {
  height: 6px; border-radius: 3px; overflow: hidden;
  background: rgba(120, 120, 128, .18);
}
.tka-prog i {
  display: block; height: 100%; width: 0;
  background: var(--blue); transition: width .18s ease;
}
.tka-prog span {
  display: block; margin-top: 5px; font-size: 12px; color: var(--txt2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* ============================= 3. ACTIVITÉ ============================== */
.tka-jour {
  margin: 14px 0 6px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--txt2);
}
.tka-jour:first-child { margin-top: 2px; }

.tka-tl { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; }
.tka-tl::before {
  content: ""; position: absolute; left: 17px; top: 10px; bottom: 10px;
  width: 2px; background: var(--sep); border-radius: 1px;
}
.tka-ev {
  position: relative; display: flex; align-items: flex-start; gap: 10px;
  padding: 6px 2px 6px 0; font-size: 14px; color: var(--txt);
}
.tka-ev-ic {
  flex: 0 0 auto; width: 27px; height: 27px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; background: var(--card); z-index: 1;
  box-shadow: 0 0 0 2px var(--sep) inset;
}
.tka-ev-txt { flex: 1; min-width: 0; line-height: 1.45; padding-top: 4px;
  word-break: break-word; overflow-wrap: anywhere; }
.tka-ev time {
  flex: 0 0 auto; padding-top: 5px; font-size: 11.5px; color: var(--txt2);
  white-space: nowrap;
}
.tka-ev[data-kind="comment"] .tka-ev-ic { box-shadow: 0 0 0 2px rgba(0, 122, 255, .35) inset; }
.tka-ev[data-kind="attach"] .tka-ev-ic { box-shadow: 0 0 0 2px rgba(175, 82, 222, .35) inset; }
.tka-ev[data-kind="status"] .tka-ev-ic { box-shadow: 0 0 0 2px rgba(52, 199, 89, .4) inset; }
.tka-ev[data-kind="create"] .tka-ev-ic { box-shadow: 0 0 0 2px rgba(255, 149, 0, .4) inset; }

.tka-ev-t {
  display: inline; padding: 0 2px; font-size: 14px; font-weight: 600;
  color: var(--blue); background: none; text-align: left;
}
.tka-ev-t:hover { text-decoration: underline; }

.tka-plus { display: flex; justify-content: center; margin-top: 10px; }
.tka-plus .btn { padding: 8px 16px; font-size: 14px; }
.tka-fin {
  width: 100%; text-align: center; font-size: 11.5px; color: var(--txt2);
  opacity: .7; padding: 6px 0;
}

/* flux global */
.tka-flux { padding-bottom: 10px; }
.tka-flux-f {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding-bottom: 6px; margin-bottom: 4px;
}

/* ============================= responsive =============================== */
@media (max-width: 699px) {
  .tka-msg { padding: 8px 2px; gap: 8px; }
  .tka-outils { opacity: 1; }              /* pas de survol au doigt */
  .tka-corps { font-size: 14.5px; }
  .tka-comp { gap: 8px; }
  .tka-astuce { display: none; }
  .tka-comp-bas .btn { width: 100%; }
  .tka-drop { padding: 14px 10px; }
  .tka-vig { width: 38px; height: 38px; }
  .tka-ev time { display: none; }
  .tka-sugg { bottom: auto; top: calc(100% + 6px); }
}

/* Confort au clavier */
.tka button:focus-visible, .tka a:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .tka-msg, .tka-ic, .tka-outils, .tka-pj-row, .tka-drop, .tka-prog i,
  .tka-sug { transition: none; }
}
