/* Formations : arbre et jalons formateur */

/* Formation */
.trainings { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); margin-bottom: 1rem; }
.training { color: inherit; margin: 0; display: flex; flex-direction: column; gap: .2rem; }
.training:hover { border-color: var(--accent); text-decoration: none; }
.training h2 { font-size: 1.05rem; margin: 0; }
.training.locked { opacity: .55; border-style: dashed; }
.training.locked:hover { border-color: var(--line); }
.lock-note { color: var(--warn); }
.training p { margin: 0; }
.mrow { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem; }
.mrow h2 { margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; }
.inline-form select, .inline-form input[type=text] { flex: 1 1 140px; min-width: 0; }

/* Formations : arbre (gauche -> droite ; empilé sur mobile) */
.tree-card h2 { margin-top: 0; }
.tree-scroll { overflow-x: auto; padding-bottom: .3rem; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree li { display: flex; align-items: center; position: relative; }
.tree > li + li { margin-top: .8rem; }
.tree ul { display: flex; flex-direction: column; position: relative; padding-left: 1.1rem; }
.tree ul::before { content: ""; position: absolute; left: 0; top: 50%; width: 1.1rem; border-top: 2px solid var(--line); }
.tree ul > li { padding: .3rem 0 .3rem 1.1rem; }
.tree ul > li::before { content: ""; position: absolute; left: 0; top: 50%; width: 1.1rem; border-top: 2px solid var(--line); }
.tree ul > li::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 2px solid var(--line); }
.tree ul > li:first-child::after { top: 50%; }
.tree ul > li:last-child::after { bottom: 50%; }
.tree ul > li:only-child::after { display: none; }
.tnode { flex: 0 0 auto; width: 12.5rem; display: flex; flex-direction: column; gap: .2rem; padding: .6rem .75rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: inherit; }
.tnode:hover { border-color: var(--accent); text-decoration: none; }
.tnode-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .4rem; }
.tnode-head strong { font-size: .95rem; line-height: 1.2; }
.tnode .bar { display: block; margin: .15rem 0; }
.tnode.done { border-color: var(--ok, #4cc38a); box-shadow: inset 3px 0 0 var(--ok, #4cc38a); }
.tnode.active { box-shadow: inset 3px 0 0 var(--warn); }
.tnode.locked { opacity: .55; border-style: dashed; }
.tnode.alert { border-color: var(--bad); }
.tnode.jalon { border-color: #ffd166; border-style: dashed; background: rgba(255, 209, 102, .06); }
.tnode.jalon.done { border-style: solid; box-shadow: inset 3px 0 0 #ffd166; }
.jalon-tag, .jalon-word { color: #ffd166; }
@media (max-width: 700px) {
  .tree li { display: block; }
  .tree ul { padding-left: 1rem; margin-left: .6rem; border-left: 2px solid var(--line); }
  .tree ul::before, .tree ul > li::after { display: none; }
  .tree ul > li { padding: .5rem 0 0 .8rem; }
  .tree ul > li::before { top: 1.6rem; width: .8rem; left: 0; }
  .tnode { width: auto; }
}

/* Cadre « une au choix » dans l'arbre des formations */
.tgroup { flex: 0 0 auto; border: 1px dashed var(--accent); border-radius: 12px; padding: 1.4rem .6rem .6rem;
  position: relative; background: rgba(56, 189, 248, .04); }
.tgroup-label { position: absolute; top: .35rem; left: .7rem; font-size: .72rem; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: .04em; }
.tgroup-list > li + li { margin-top: .6rem; }
@media (max-width: 700px) { .tgroup { padding-top: 1.6rem; } }
/* Jalon formateur : bande dorée sous sa formation */
.tnode-wrap { flex: 0 0 auto; width: 13.5rem; display: flex; flex-direction: column; }
.tnode-wrap .tnode { width: auto; }
.tnode-wrap .tnode:has(+ .tjalon) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.tjalon { display: flex; justify-content: space-between; gap: .4rem; align-items: center; padding: .3rem .6rem;
  font-size: .8rem; font-weight: 600; color: #ffd166; border: 1px dashed #ffd166; border-top: 0;
  border-radius: 0 0 10px 10px; background: rgba(255, 209, 102, .07); }
.tjalon:hover { text-decoration: none; background: rgba(255, 209, 102, .14); }
.tjalon.done { border-style: solid; background: rgba(255, 209, 102, .18); }
.tjalon.locked { opacity: .6; }
.tjalon.alert { border-color: var(--bad); }
.tjalon .small { font-weight: 400; white-space: nowrap; }
.tnode-head .badge { white-space: nowrap; }
@media (max-width: 700px) { .tnode-wrap { width: auto; } }

/* ---------------------------------------------------------------- Éditeur visuel des formations */
.te-help { margin-top: -.4rem; }
.te-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.te-board { position: relative; overflow-x: auto; padding-bottom: .5rem; }
.te-links { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; color: var(--muted); z-index: 2; }
.te-link { fill: none; stroke: currentColor; stroke-width: 2; opacity: .55; }
.te-link.any { stroke-dasharray: 6 5; }
.te-link.hot { color: var(--accent); stroke: var(--accent); opacity: 1; stroke-width: 2.5; }
.te-links marker path { fill: var(--muted); }
.te-lanes { display: grid; grid-template-columns: repeat(4, minmax(190px, 1fr)); gap: 1.6rem; min-width: 820px; }
.te-lane { --c: var(--accent); background: color-mix(in srgb, var(--c) 7%, var(--panel)); border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line)); border-radius: 14px; padding: .6rem; min-height: 200px; }
.te-lane-head { display: flex; align-items: center; gap: .45rem; padding: .2rem .2rem .6rem; }
.te-lane-head strong { flex: 1; min-width: 0; font-size: .92rem; }
.te-lane-icon { font-size: 1.3rem; }
.te-count { font-size: .75rem; color: var(--muted); background: var(--panel-2); border-radius: 999px; padding: 0 .45rem; }
.te-add { flex: 0 0 auto; width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 1px dashed var(--c); background: transparent; color: var(--c); font-size: 1.1rem; cursor: pointer; transition: transform .15s, background .15s; }
.te-add:hover { background: color-mix(in srgb, var(--c) 20%, transparent); transform: rotate(90deg); }
.te-cards { display: flex; flex-direction: column; gap: .7rem; min-height: 120px; }
.te-drop-hint { margin: 1.5rem 0; text-align: center; color: var(--muted); font-size: .85rem; border: 1px dashed var(--line); border-radius: 10px; padding: 1rem .5rem; }
.te-card { position: relative; z-index: 1; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 11px; padding: .55rem .65rem; cursor: grab; user-select: none; touch-action: pan-y;
  transition: transform .12s, box-shadow .15s, border-color .15s; animation: te-pop .25s ease-out; }
.te-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, .3); }
.te-card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 8px 22px rgba(0, 0, 0, .35); }
.te-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes te-pop { from { transform: scale(.96); opacity: .4; } to { transform: none; opacity: 1; } }
.te-card-top { display: flex; justify-content: space-between; align-items: center; }
.te-card-icon { font-size: 1.05rem; }
.te-star { color: #ffd166; font-size: .95rem; text-shadow: 0 0 8px rgba(255, 209, 102, .5); }
.te-card-name { font-weight: 800; margin: .15rem 0 .25rem; line-height: 1.2; overflow-wrap: anywhere; }
.te-card-meta { font-size: .75rem; color: var(--muted); }
.te-dots { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: .2rem; }
.te-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); opacity: .85; }
.te-card-foot { display: flex; justify-content: space-between; color: var(--muted); margin-top: .3rem; min-height: 1em; }
.te-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; opacity: .92; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); cursor: grabbing; }
.te-hidden { display: none; }
.te-placeholder { border: 2px dashed var(--accent); border-radius: 11px; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.te-dragging, .te-dragging * { cursor: grabbing !important; }
.te-linking .te-card.te-target { cursor: crosshair; animation: te-glow 1.2s ease-in-out infinite; }
@keyframes te-glow { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 60%, transparent); } }

.te-panel { position: sticky; top: 1rem; margin: 0; max-height: calc(100vh - 2rem); overflow-y: auto; }
.te-empty { text-align: center; padding: 2rem .5rem; }
.te-empty-icon { font-size: 2.6rem; }
.te-panel-head { display: flex; gap: .6rem; align-items: center; margin-bottom: .8rem; padding-bottom: .6rem; border-bottom: 2px solid var(--c); }
.te-panel-head > div { flex: 1; min-width: 0; }
.te-panel-icon { font-size: 2rem; }
.te-name { width: 100%; font-size: 1.15rem; font-weight: 800; background: transparent; border: 1px solid transparent; padding: .2rem .3rem; border-radius: 6px; color: var(--text); }
.te-name:hover, .te-name:focus { border-color: var(--line); background: var(--panel-2); }
.te-field { display: block; margin-bottom: .9rem; font-weight: 600; font-size: .9rem; }
.te-field > select, .te-field > textarea { display: block; width: 100%; margin-top: .3rem; font-weight: 400; }
.te-field > span { display: block; margin-bottom: .3rem; }
.te-count-row { display: flex; align-items: center; gap: .4rem; font-weight: 400; }
.te-count-row input { flex: 1; min-width: 0; }
.te-step { width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 1.1rem; cursor: pointer; }
.te-step:hover { border-color: var(--accent); color: var(--accent); }
.te-req { min-width: 1.6rem; text-align: center; font-size: 1.2rem; }
.te-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; font-weight: 400; }
.te-chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: .15rem .3rem .15rem .6rem; font-size: .82rem; }
.te-chip button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; }
.te-chip button:hover { color: var(--bad); }
.te-row { margin-bottom: .4rem; }
.te-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-weight: 400; }
.te-seg button { background: var(--panel-2); border: 0; color: var(--text); padding: .3rem .7rem; cursor: pointer; font-size: .82rem; }
.te-seg button.on { background: var(--accent); color: #08131c; font-weight: 700; }
.te-switch { display: flex; align-items: center; gap: .5rem; font-weight: 700; cursor: pointer; color: #ffd166; }
.te-danger { border-top: 1px solid var(--line); padding-top: .8rem; }
@media (max-width: 1000px) {
  .te-wrap { grid-template-columns: 1fr; }
  .te-panel { position: static; max-height: none; }
}
