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;
}



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;
  padding: 0.5em 0.2em;
}

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: 0.72em 0.78em 0.50em 0.78em;
	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;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	padding: 0;
	border: none;
	flex: 1 1 auto;
	resize: none;
}
main > section.tickets li.ticket > label
{
	margin: 0.14em 0 0.05em 0;
    line-height: 1.08;
    font-size: 0.82rem;
	font-weight: bold;
	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.reply,
main > section.tickets li.ticket button.update {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
  z-index: 3;
}

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,
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;
}



/* 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;
  overflow-x: hidden;
  overflow-y: hidden;
}

/* 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;
}

/* ---- overrides compacts ticket affiché ---- */



main > section.tickets li.ticket label.title {
  margin: 0 0 0.12em 0;
  line-height: 1.14;
  font-size: 0.96rem;
  font-weight: 600;
}

/* ---- bloc description / task ---- */

main > section.tickets > section.destination-level li.ticket > textarea.current-step.task,
main > section.tickets > section.destination-level li.ticket > textarea.description {
  flex: 1 1 auto;
  min-height: calc(4 * 1.18em);
  max-height: calc(4 * 1.18em);
  font-size: 0.82rem;
  line-height: 1.12;
  overflow: hidden;
  resize: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  position: relative;
  z-index: 1;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(180deg, #000 88%, rgba(0, 0, 0, 0) 100%);
  mask-image: linear-gradient(180deg, #000 88%, rgba(0, 0, 0, 0) 100%);
}

main > section.tickets > section.destination-level li.ticket > textarea.current-step.task::-webkit-scrollbar,
main > section.tickets > section.destination-level li.ticket > textarea.description::-webkit-scrollbar {
  display: none;
}

/* ---- champ date caché ---- */

main > section.tickets li.ticket input.provisional-date.empty,
main > section.tickets li.ticket input.current-step.provisional-date[type="datetime-local"][readonly] {
  position: absolute;
  width: 0;
  height: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  outline: none;
  box-shadow: none;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* ---- texte de date ---- */

section.destination-level .provisional-date-text::before,
section.source-level .provisional-date-text::before {
  content: "Pour le : ";
  font-weight: 500;
  margin-right: 0.16em;
}

main > section.tickets > section.destination-level li.ticket > .provisional-date-text {
  display: block;
  flex: 0 0 auto;
  min-height: 0;
  height: auto;
  margin-top: auto;
  padding-top: 0.28em;
  font-size: 0.76rem;
  line-height: 1.02;
  opacity: 0.88;
  align-self: flex-start;
}
