main > section.tickets
{
	position: relative;
	display: flex;
	flex-flow: row nowrap;
	align-items: stretch;
	/*border: 2px solid lightgray;
	border-radius: 1em;*/
	padding: 1em;
	margin: 0px 1em 0.5em;
	flex: 1 1 auto;
	max-height: var(--max-height-tickets, 50%)!important;
    overflow: hidden;
   transition: max-height 0.3s ease-in-out;
 	
}
main > section.tickets > * {
  overflow: hidden;
}

/* petit écart entre les colonnes (sans toucher à ta flexbox existante) */
main > section.tickets {
  gap: 16px; /* fonctionne avec display:flex; row nowrap */
}

/* Colonne gauche : tickets assignés */
main > section.tickets > section.destination-level {
  position: relative;             /* pour les éléments internes positionnés */
  border-radius: 16px;
  box-shadow: 0 0 0 1px #e2e8f0, 0 2px 10px rgba(0,0,0,.04); /* liseré + ombre douce */
  background-color: #EBEBEB;      
  padding: 12px;                  /* souffle interne, n’impacte pas la grille externe */
}

/* Colonne droite : ticket création */
main > section.tickets > section.source-level {
  position: relative;
  border-radius: 16px;
  box-shadow: 0 0 0 1px #e2e8f0, 0 2px 10px rgba(0,0,0,.04);
  background-color: #EBEBEB;      /* un ton au-dessus pour la différencier */
  padding: 12px;
}

/* Important : on NE touche PAS à l’apparence des post-its */
main > section.tickets li.ticket { /* existe déjà chez toi */
  /* rien ici : ton style post-it (#FF9, ombre, etc.) reste prioritaire */
}

main > section.tickets > section.destination-level
{
	flex: 1 1 auto; 
	display: flex;
	flex-flow: row nowrap;
	align-items: center;
}


main > section.tickets > section.destination-level > menu
{
	flex-flow: row wrap;
	gap: 0.2em;
	overflow-y: auto;
	max-height: 100%;
}


main > section.tickets > section.other-level,
main > section.tickets > section.destination-level li.ticket button.update,
main > section.tickets > section.source-level li.ticket button.reply
{
	display: none !important;
}

main > section.tickets > section.source-level
{
	flex: 0 0 auto; 
	display: flex;
	flex-flow: column nowrap;
	align-items: center;
}


main > section.tickets > section.source-level > div.buttons
{
	display: flex;
	flex-flow: row wrap;
	align-items: center;
	justify-content: space-around;
}

main > section.tickets > section > *
{
	flex: 0 0 auto;
}
main > section.tickets > section > menu
{
	flex: 1 1 auto;
}

main > section.tickets li.ticket::before
{
	content: "";
	position: absolute;
	left: 0px;
	top: 0px;
	width: 100%;
	height: 100%;
	min-height: 10em;
	min-width: 10em;
	background-color: var(--bgcolor);
	border-radius: 0.3em;
	z-index: -1;
	box-sizing: border-box;
	border: 1px solid gray;
	box-shadow: 0 0 0.3em #222;
}
main > section.tickets li.ticket
{
	--bgcolor : #FF9;
	position: relative;
	display: flex;
	flex-flow: column nowrap;
	padding: 1em;
	min-width: 10em;
	min-height: 10em;
	z-index: 2;
}
main > section.tickets li.ticket > *
{
	flex: 0 0 auto;
	background-color: transparent;
}

main > section.tickets li.ticket > span,
main > section.tickets li.ticket > textarea
{
	min-height: 2.1em;
	flex: 1 1 auto;
	border: 1px dotted lightgray;
	resize: none;
}
main > section.tickets li.ticket > label
{
	font-weight: bold;
	margin: 0.5em 0px;
	display: flex;
	flex-flow: row nowrap;
	justify-content: space-between;
}

main > section.tickets > section.source-level menu
{
	flex-flow: column nowrap;
	overflow-y: auto;
}
main > section.tickets > section.source-level li.ticket.selected
{
	z-index: 3;
}
main > section.tickets > section.source-level li.ticket
{
	padding-top: 0.1em;
	flex-shrink: 1;
	flex-basis: 1em;
	min-height: 0.5em;
	margin-left: calc( var(--index) * 0.2em );
}
main > section.tickets > section.source-level li.ticket:last-of-type
{
	padding-top: 1em;
	flex-shrink: 0;
	min-height: 10em;
}

main > section.tickets li.ticket button.update,
main > section.tickets li.ticket button.reply
{
	display: flex;
	color:black;
	background-color: lightgray;
	position: absolute;
	top: 0.2em;
	right: 0.2em;
}

main > section.tickets li.ticket input.provisional-date.empty
{
	visibility: hidden;
	pointer-events: none;
}


main > section.tickets > section.source-level li.ticket:not(.selected):not(:last-of-type) button.update
{
	display: none;
}


main > section.tickets > section.source-level li.ticket button.update::after
{
	content:"✎";
}

main > section.tickets > section.destination-level li.ticket button.reply::after
{
	content:"↵";
}

main > section.tickets button.create.ticket
{
	border-radius: 50%;
	 position: relative;
}

main > section.tickets button.create.ticket::after
{
	content : "+";
	color : black;
	font-size: 3rem; 
	line-height: 1;
	inset: 0; 
	border-radius: 50%;
	display: grid; place-items: center;
	position: absolute;
}
main > section.tickets button.create.ticket:hover::after,
main > section.tickets button.create.ticket:focus-visible::after{
  color: #fff;
  background: #000 !important;
}


main > section.tickets button.activate.tickets
{
	position: relative;
	font-size: 1rem; 
	color : black;
	line-height: 1;
	background-image: conic-gradient(gray, lightgray calc(1turn * var(--activation-timeout) / var(--activation-delay)), transparent calc(1turn * var(--activation-timeout) / var(--activation-delay)), transparent);
}

main > section.tickets button.activate.tickets::after
{
	content : "✔";
	position: absolute;
	left: 0.2em;
	right: 0.2em;
	top: 0.2em;
	bottom: 0.2em;
	border-radius: 0.4em;
	border: 1px solid lightgray;
    
    
}



main > section.tickets > section.source-level li.ticket .activation-timer
{
	position: absolute;
	right: 2em;
	top: 0.2em;
	padding: 0.1em;
	border-radius: 0.3em;
	border: 1px solid gray;
	background-image: conic-gradient(gray, lightgray calc(1turn * var(--activation-timeout) / var(--activation-delay)), transparent calc(1turn * var(--activation-timeout) / var(--activation-delay)), transparent);
}

main > section.tickets > section.source-level li.ticket .activation-timer::after
{
	content: attr(data-activation-minutes) ":" attr(data-activation-seconds);
}

main > section.tickets button.activate.tickets:hover,
main > section.tickets button.activate.tickets:focus-visible{
  background-color: #000;      /* passe en noir */
  color: #fff;                 /* texte/pictos -> blanc */
}

/* 1) Le parent sert de référence pour le positionnement absolu */
main > section.tickets > section.destination-level {
  position: relative;        /* nécessaire pour placer le bouton au bon endroit */
  overflow: visible;         /* ne pas masquer le bouton si déborde légèrement */
  padding-bottom: 44px;      /* réserve un peu d'espace pour le bouton en bas */
}

/* 2) Bouton Historique : petit, cliquable, en bas à droite */
main > section.tickets > section.destination-level > .history.in-tickets {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;                /* au-dessus de tout décor (::before, etc.) */
  pointer-events: auto;      /* s'assure qu'il est cliquable */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color : black;
  padding: 4px 8px;          /* plus petit que la version par défaut */
  border-radius: 12px;
  font-size: 1rem;         /* réduit légèrement la taille */
  line-height: 1;
}

main > section.tickets > section.destination-level > .history.in-tickets:hover,
main > section.tickets > section.destination-level > .history.in-tickets:focus-visible{
  background: #000;
  color: #fff;               /* l’icône/flèche suit via currentColor */
  border-color: #000;
  outline: none;
}
/* 3) Au cas où un décor recouvre (rare) : passe derrière et ne bloque pas les clics */
main > section.tickets > section.destination-level::before {
  z-index: 0 !important;
  pointer-events: none !important;
}

/* Cache totalement les tickets pendant l'expand (pas de "reste visible") */
html.graphs-expanded main > section.tickets {
  display: none !important;
}

/* (optionnel) bloque le scroll de fond pendant l'expand */
html.graphs-expanded, html.graphs-expanded body {
  overflow: hidden;
}


/* ===== Mode "graph à gauche / tickets empilés" : 2 zones sur toute la hauteur ===== */

/* Colonne droite = pile verticale qui prend toute la hauteur du viewport */
html.layout-graph-left-stack-tickets main > section.tickets {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: calc(100svh - 64px)    /* même logique que le main ; ajuste si header fixed */
  /* neutralise les éventuelles limites héritées */
  --max-height-tickets: 100%;
  max-height: none !important;
}

/* Partie haute : tickets assignés */
html.layout-graph-left-stack-tickets main > section.tickets > section.destination-level{
  flex: 3 1 0%;   /* ← 3 parts */
  min-height: 0;  /* autorise le contenu interne à scroller */
  display: flex;
  flex-direction: column;
}

/* Partie en dessous dans cette vue empilée : ticket création */
html.layout-graph-left-stack-tickets main > section.tickets > section.source-level{
  flex: 1 1 0%;   /* ← 1 part */
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Assure le scroll interne si tes menus/listes débordent */
html.layout-graph-left-stack-tickets main > section.tickets > section.destination-level > menu,
html.layout-graph-left-stack-tickets main > section.tickets > section.source-level > menu{
  min-height: 0;
  overflow: auto;
}
/* Mode: graph à gauche + tickets empilés
   —> zone "ticket création" : alignée à gauche + petit padding
*/
html.layout-graph-left-stack-tickets
main > section.tickets > section.source-level{
  /* s’assure qu’on n’est pas centré */
  display: flex;
  flex-direction: column;
  align-items: stretch;           /* pas de centrage horizontal */
  justify-content: flex-start;
  padding: 8px 10px;              /* léger padding interne */
  gap: .4rem;                     /* petit espace entre toolbar et liste si présent */
  min-height: 0;                  /* utile pour le scroll interne */
  position: relative;             /* base pour empilement correct */
  z-index: 0;
}

/* La liste des tickets créés doit débuter en haut à gauche et pouvoir défiler */
html.layout-graph-left-stack-tickets
main > section.tickets > section.source-level > menu{
  display: flex;
  flex-wrap: wrap;                /* si cartes, elles passent à la ligne */
  justify-content: flex-start;    /* alignées à gauche */
  align-items: flex-start;        /* collées en haut */
  align-content: flex-start;      /* idem si plusieurs lignes */
  gap: .4rem .5rem;               /* petit espacement entre cartes */
  overflow: auto;
  margin: 0;
  padding: 2px;                   /* micro marge pour que rien ne touche le bord */
  min-height: 0;
  z-index: 0;                     /* passe sous d’éventuels boutons flottants */
}

/* 1) Dans ce layout, on annule le space-around de la toolbar
   et on autorise un centrage précis du bouton + */
html.layout-graph-left-stack-tickets
main > section.tickets > section.source-level > .buttons{
  display: flex;
  justify-content: flex-start !important;   /* ← annule space-around */
  align-items: center;
  gap: .5rem;
}

/* 2) Centrer le bouton "Créer" dans la toolbar */
html.layout-graph-left-stack-tickets
main > section.tickets > section.source-level > .buttons > button.create.ticket{
  margin-left: auto !important;
  margin-right: auto !important;  /* ← centre dans la ligne */
  align-self: center;
  display: inline-flex;
  width: 3.25rem; height: 3.25rem;/* optionnel : vrai rond autour du "+" */
}

/* 3) Si jamais le bouton + n’est PAS dans .buttons (enfant direct), on couvre aussi ce cas */
html.layout-graph-left-stack-tickets
main > section.tickets > section.source-level > button.create.ticket{
  margin-left: auto !important;
  margin-right: auto !important;
  align-self: center;
}


/* Zones concernées : mode "graph à gauche / tickets empilés" */
html.layout-graph-left-stack-tickets
main > section.tickets > section.source-level > menu{
  /* grille fluide à cartes fixes */
  --card-w: 220px;          /* largeur d’un post-it (à ajuster) */
  --gap-x: .6rem;           /* espace horizontal entre cartes */
  --gap-y: .6rem;           /* espace vertical entre cartes */

  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;   /* aligne toujours à gauche */
  align-content: flex-start;
  gap: var(--gap-y) var(--gap-x);
  padding: 4px;                  /* petit padding interne */
  margin: 0;
  min-height: 0;
  overflow: auto;
}

/* Chaque post-it a une largeur fixe : évite les centrages inattendus */
html.layout-graph-left-stack-tickets
main > section.tickets > section.source-level > menu > .ticket{
  flex: 0 0 var(--card-w);       /* largeur fixe */
  max-width: var(--card-w);
  margin: 0;                     /* surtout pas auto, sinon centrage ! */
  align-self: flex-start;
}

/* Si tu veux un ratio différent (ex: assignés 60% / création 40%), remplace par :
html.layout-graph-left-stack-tickets main > section.tickets > section.destination-level { flex: 0 0 60%; }
html.layout-graph-left-stack-tickets main > section.tickets > section.source-level      { flex: 1 1 0;    }
*/

/*main > section.tickets > section.destination-level > menu.tickets > .ticket.ticket-overdue {
  outline: 2px solid #e11d48; /* rouge */
/*}
*/

/* Le container doit être en flex-wrap pour permettre le "retour à la ligne" */
main > section.tickets > section.destination-level > menu.tickets{
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

/* Chaque ticket conserve sa taille ; l'ordre est piloté par le JS (style="order: …") */
main > section.tickets > section.destination-level > menu.tickets > .ticket{
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

/* Séparateur (élément flex à 100% de largeur) inséré par le JS */
main > section.tickets > section.destination-level > menu.tickets > li.bucket-sep{
  flex-basis: 100%; !important;
  height: 0;                 /* change en 1px si tu veux une ligne visible */
  margin: 6px 0;
  border: 0;
}

/* (Optionnel) si tu veux une ligne fine visible : */
/*
main > section.tickets > section.destination-level > menu.tickets > li.bucket-sep{
  height: 1px;
  background: rgba(0,0,0,.1);
}
*/



/* Tickets à venir : un peu "blanchis" (transparents), redeviennent nets au survol */
main > section.tickets > section.destination-level > menu.tickets > .ticket.ticket-upcoming{
  opacity: .50;
  transition: opacity .15s ease;
}
main > section.tickets > section.destination-level > menu.tickets > .ticket.ticket-upcoming:hover{
  opacity: 1;
}
