/*
 * Dowin — tâches partagées (1.169.0).
 *
 * Trois surfaces : la carte dans le fil, le formulaire de création et le
 * tableau de groupe en trois colonnes. L'état et la priorité ne circulent que
 * par `data-etat` et `data-priorite` : le liseré, la pastille et la teinte
 * prennent leur valeur dans une variable locale, jamais dans un style en
 * ligne. Sur 369 px, le tableau s'empile et chaque bouton garde une cible
 * d'au moins 40 px ; les teintes ont une variante lisible en thème sombre.
 */

/* ------------------------------- Carte ---------------------------------- */

.tache {
  --tache-accent: var(--green);

  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  padding: 10px 12px 10px 13px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--tache-accent);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
}

/* Une tâche à faire est ambre, une tâche en cours bleue, une tâche terminée
 * verte. Le retard prime sur l'état : une tâche encore ouverte et dépassée est
 * rouge, c'est l'information la plus utile. */
.tache[data-etat='a-faire'] {
  --tache-accent: #c47f00;
}

.tache[data-etat='en-cours'] {
  --tache-accent: #2b7de9;
}

.tache[data-etat='termine'] {
  --tache-accent: var(--green);
}

.tache.is-en-retard {
  --tache-accent: #d94f4f;
}

[data-theme='dark'] .tache[data-etat='a-faire'] {
  --tache-accent: #f0b429;
}

[data-theme='dark'] .tache[data-etat='en-cours'] {
  --tache-accent: #6fb0ff;
}

[data-theme='dark'] .tache.is-en-retard {
  --tache-accent: #ff8a80;
}

.tache.is-invalide {
  border-left-color: var(--border);
  background: var(--panel-2);
  color: var(--text-soft);
}

.tache.is-invalide .tache__titre {
  font-size: 13px;
  font-weight: 500;
}

.tache__entete {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.tache__titre {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.tache__details {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* Des détails vides ne doivent pas laisser un trou dans la carte. */
.tache__details:empty {
  display: none;
}

.tache__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
  color: var(--muted, var(--text-soft));
  font-size: 11.5px;
  line-height: 1.4;
}

.tache__assigne,
.tache__echeance,
.tache__priorite {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tache__echeance.is-retard {
  color: var(--tache-accent);
  font-weight: 600;
}

.tache__priorite {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.tache__priorite[data-priorite='haute'] {
  border-color: color-mix(in srgb, #d94f4f 45%, var(--border));
  background: color-mix(in srgb, #d94f4f 10%, transparent);
  color: #c0392b;
}

.tache__priorite[data-priorite='basse'] {
  color: var(--text-soft);
}

[data-theme='dark'] .tache__priorite[data-priorite='haute'] {
  color: #ff8a80;
}

.tache__reunion {
  align-self: flex-start;
  padding: 2px 8px;
  border-left: 2px solid var(--green);
  border-radius: 0 6px 6px 0;
  background: color-mix(in srgb, var(--green) 8%, transparent);
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.4;
}

.tache__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  margin-top: 2px;
}

.tache__etat,
.tache__voir {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 12.5px;
}

.tache__etat {
  font-variant-numeric: tabular-nums;
}

.tache__etat:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ----------------------------- Formulaire -------------------------------- */

.tache-form__corps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.tache-form__champ {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.tache-form__label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.tache-form__titre,
.tache-form__details,
.tache-form__assigne,
.tache-form__date,
.tache-form__priorite {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.tache-form__details {
  min-height: 88px;
  line-height: 1.4;
  resize: vertical;
}

.tache-form__titre:focus-visible,
.tache-form__details:focus-visible,
.tache-form__assigne:focus-visible,
.tache-form__date:focus-visible,
.tache-form__priorite:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

.tache-form__limite {
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid var(--green);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--green) 8%, transparent);
  color: var(--text-soft);
  font-size: 11.5px;
  line-height: 1.45;
}

.tache-form__publier {
  min-height: 44px;
}

.tache-form__publier:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ------------------------------- Tableau --------------------------------- */

.taches__corps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.taches__entete {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.taches__nouvelle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 12.5px;
}

.taches__nouvelle svg {
  flex: none;
  width: 16px;
  height: 16px;
}

.taches__filtres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  margin-left: auto;
}

.taches__filtre {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 12.5px;
}

.taches__filtre.is-actif {
  border-color: color-mix(in srgb, var(--green) 55%, var(--border));
  background: color-mix(in srgb, var(--green) 10%, transparent);
  color: var(--green-dark, var(--green));
  font-weight: 600;
}

.taches__colonnes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.taches__colonne {
  --colonne-accent: var(--green);

  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--colonne-accent);
  border-radius: 10px;
  background: var(--panel-2);
}

.taches__colonne[data-etat='a-faire'] {
  --colonne-accent: #c47f00;
}

.taches__colonne[data-etat='en-cours'] {
  --colonne-accent: #2b7de9;
}

.taches__colonne[data-etat='termine'] {
  --colonne-accent: var(--green);
}

[data-theme='dark'] .taches__colonne[data-etat='a-faire'] {
  --colonne-accent: #f0b429;
}

[data-theme='dark'] .taches__colonne[data-etat='en-cours'] {
  --colonne-accent: #6fb0ff;
}

.taches__colonne-entete {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.taches__colonne-titre {
  margin: 0;
  min-width: 0;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  overflow-wrap: anywhere;
}

.taches__compte {
  flex: none;
  color: var(--muted, var(--text-soft));
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.taches__item {
  --item-accent: var(--green);

  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--item-accent);
  border-radius: 8px;
  background: var(--panel);
}

.taches__item[data-etat='a-faire'] {
  --item-accent: #c47f00;
}

.taches__item[data-etat='en-cours'] {
  --item-accent: #2b7de9;
}

.taches__item[data-etat='termine'] {
  --item-accent: var(--green);
}

[data-theme='dark'] .taches__item[data-etat='a-faire'] {
  --item-accent: #f0b429;
}

[data-theme='dark'] .taches__item[data-etat='en-cours'] {
  --item-accent: #6fb0ff;
}

.taches__item-titre {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.taches__item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px 8px;
  min-width: 0;
  color: var(--muted, var(--text-soft));
  font-size: 11px;
  line-height: 1.4;
}

.taches__item-assigne,
.taches__item-echeance,
.taches__item-priorite {
  min-width: 0;
  overflow-wrap: anywhere;
}

.taches__item-echeance.is-retard {
  color: #c0392b;
  font-weight: 600;
}

[data-theme='dark'] .taches__item-echeance.is-retard {
  color: #ff8a80;
}

.taches__item-priorite {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.taches__item-priorite[data-priorite='haute'] {
  border-color: color-mix(in srgb, #d94f4f 45%, var(--border));
  background: color-mix(in srgb, #d94f4f 10%, transparent);
  color: #c0392b;
}

[data-theme='dark'] .taches__item-priorite[data-priorite='haute'] {
  color: #ff8a80;
}

.taches__etats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  margin-top: 2px;
}

.taches__etat {
  flex: 1 1 auto;
  min-height: 40px;
  padding: 6px 8px;
  font-size: 11.5px;
}

.taches__etat[aria-pressed='true'] {
  border-color: color-mix(in srgb, var(--item-accent) 55%, var(--border));
  background: color-mix(in srgb, var(--item-accent) 12%, transparent);
  color: var(--item-accent);
  font-weight: 600;
}

.taches__etat:disabled {
  opacity: 0.7;
  cursor: default;
}

.taches__vide {
  padding: 16px 8px;
  color: var(--muted, var(--text-soft));
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  overflow-wrap: anywhere;
}

/* ------------------------------- Mobile ---------------------------------- */

@media (max-width: 760px) {
  .taches__colonnes {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .tache {
    padding: 9px 10px 9px 11px;
  }

  .tache__titre {
    font-size: 14px;
  }

  .tache__details {
    font-size: 12.5px;
    -webkit-line-clamp: 4;
  }

  .tache__etat,
  .tache__voir {
    flex: 1 1 145px;
  }

  .taches__filtres {
    width: 100%;
    margin-left: 0;
  }

  .taches__filtre {
    flex: 1 1 auto;
  }

  .taches__colonne {
    padding: 7px;
  }
}

/* Sur 369 px, les trois boutons d'état tiennent sur une ligne tant que les
 * libellés sont courts ; en dessous, ils s'empilent sans déborder. */
@media (max-width: 380px) {
  .taches__etat {
    flex: 1 1 100%;
  }
}
