/**
 * Trialoop - organisation management shell (T4: club / federation / organisation pages), batch "org".
 * To be merged into components.css. Same conventions: every colour is a theme token with the Grid value as fallback,
 * the Vitesse signature (blue band + slanted speed lines) comes from .tl-band.
 * Blocks:
 *   .tl-orghead          page head on a .tl-band: eyebrow (organisation name + type), display title, lead, aside (picker, actions)
 *   .tl-orgpicker        compact organisation selector (GET form) inside the head
 *   .tl-orgnav           section menu inside .tl-side (horizontal scroller on phones, sticky vertical list from 900px)
 *   .tl-rows / .tl-row   list rows with actions (stack on phones, actions under the text)
 *   .tl-actions          group of buttons / inline forms
 *   .tl-panel__head      panel title + tools, .tl-panel--danger, .tl-panel--flush
 *   .tl-table--stack     table that turns into cards on phones (td[data-label])
 *   .tl-submitbar        primary form actions, pinned to the thumb zone on phones
 *   .tl-check            44px checkbox / radio line, .tl-pillset (radio pills)
 *   .tl-ink--*           coloured numbers (KPIs), .tl-notice--info, .tl-notice--block
 */

/* ---------- page frame: full width even inside a flex column body (the section strip must not widen the page) ---------- */
.tl-org { width: 100%; min-width: 0; }

/* ---------- page head ---------- */
.tl-orghead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 24px; }
.tl-orghead::before { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(var(--tl-accent-rgb, 255, 30, 106), .10) 45%, transparent 60%); transform: translateX(-100%); animation: tl-org-sweep 1.4s .2s ease-out forwards; pointer-events: none; }
@keyframes tl-org-sweep { to { transform: translateX(100%); } }
.tl-orghead > * { position: relative; z-index: 1; }
.tl-orghead__main { flex: 1 1 320px; min-width: 0; }
.tl-orghead .tl-display { font-size: clamp(34px, 7vw, 64px); overflow-wrap: anywhere; }
.tl-orghead .tl-eyebrow { flex-wrap: wrap; }
.tl-orghead .tl-eyebrow b { font-weight: 800; letter-spacing: .14em; }
.tl-orghead__mark { width: 18px; height: 4px; border-radius: 2px; background: var(--tl-accent, #ff1e6a); transform: skewX(var(--tl-slant, -14deg)); flex-shrink: 0; }
.tl-orghead__type { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 10px; letter-spacing: .14em; background: var(--tl-accent-soft, rgba(255, 30, 106, 0.16)); color: var(--tl-accent-ink, #ff4d8a); }
.tl-orghead .tl-lead a { color: inherit; font-weight: 600; }
.tl-orghead__roles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tl-orghead__aside { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; flex: 0 1 auto; min-width: 0; max-width: 100%; }
.tl-orghead__aside .tl-btn, .tl-orghead__aside .btn { white-space: nowrap; }
[data-theme="vitesse"] .tl-orghead::before { background: linear-gradient(105deg, transparent 30%, rgba(var(--tl-shade-rgb, 255, 255, 255), .14) 45%, transparent 60%); }
[data-theme="vitesse"] .tl-orghead__mark { background: var(--tl-on-accent, #fff); }
[data-theme="vitesse"] .tl-orghead__type, [data-theme="vitesse"] .tl-band .tl-role { background: rgba(var(--tl-shade-rgb, 255, 255, 255), .16); color: var(--tl-on-accent, #fff); }
[data-theme="vitesse"] .tl-band .tl-btn--ghost, [data-theme="vitesse"] .tl-band .btn-secondary { color: var(--tl-on-accent, #fff); border-color: rgba(var(--tl-shade-rgb, 255, 255, 255), .55); background: transparent; }
[data-theme="vitesse"] .tl-band .tl-btn:not(.tl-btn--ghost), [data-theme="vitesse"] .tl-band .btn-primary { background: var(--tl-on-accent, #fff); color: var(--tl-accent, #1D3FBF); border-color: var(--tl-on-accent, #fff); }
[data-theme="vitesse"] .tl-band a:not(.tl-btn):not(.btn) { color: var(--tl-on-accent, #fff); }
[data-theme="vitesse"] .tl-band .tl-orgpicker label, [data-theme="vitesse"] .tl-band .tl-orgpicker__label { color: var(--tl-on-accent, #fff); }

/* titles: win over the legacy global h1 / h2 colours (some carry !important) */
.tl-orghead h1.tl-display, .tl-org h2.tl-h2 { color: var(--tl-display, var(--white, #fff)) !important; }
[data-theme="vitesse"] .tl-orghead h1.tl-display { color: var(--tl-on-accent, #fff) !important; }

/* organisation selector (GET form, auto-submit) */
.tl-orgpicker { display: flex; flex-direction: column; gap: 6px; margin: 0; min-width: 0; max-width: 100%; }
.tl-orgpicker label, .tl-orgpicker__label { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--tl-muted, rgba(255, 255, 255, 0.7)); }
.tl-orgpicker select { min-height: 44px; min-width: min(260px, 100%); max-width: 100%; }
.tl-orgpicker--inline { flex-direction: row; align-items: center; flex-wrap: wrap; }

/* ---------- section menu (inside .tl-side) ---------- */
.tl-side__nav.tl-orgnav { flex: 1 1 100%; max-width: none; display: flex; gap: 6px; padding: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.tl-orgnav::-webkit-scrollbar { display: none; }
.tl-orgnav .tl-nav-group { display: none; }
.tl-orgnav .tl-nav-item { flex: 0 0 auto; min-height: 44px; padding: 6px 12px; box-sizing: border-box; white-space: nowrap; scroll-snap-align: start; }
.tl-orgnav .tl-nav-item small { display: block; font-size: 11px; font-weight: 500; color: var(--tl-faint, rgba(255, 255, 255, 0.5)) !important; line-height: 1.2; margin-top: 2px; }
.tl-orgnav .tl-nav-item.is-on small { color: inherit !important; opacity: .85; }
.tl-orgnav .tl-nav-item__txt { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.tl-orgnav__sep { flex: 0 0 1px; align-self: stretch; margin: 6px 2px; background: var(--tl-line, rgba(255, 255, 255, 0.1)); }
@media (min-width: 900px) {
    .tl-side__nav.tl-orgnav { flex: 1 1 230px; max-width: 260px; display: block; padding: 12px; overflow: visible; position: sticky; top: calc(var(--header-height, 80px) + 16px); }
    .tl-orgnav .tl-nav-group { display: block; }
    .tl-orgnav .tl-nav-item { white-space: normal; }
    .tl-orgnav__sep { display: block; height: 1px; margin: 10px 6px; }
}
[data-theme="vitesse"] .tl-orgnav .tl-nav-item.is-on { clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
[data-theme="vitesse"] .tl-orgnav .tl-nav-item.is-on .tl-count { background: rgba(var(--tl-shade-rgb, 255, 255, 255), .22); color: var(--tl-on-accent, #fff); }

/* ---------- panels ---------- */
.tl-panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.tl-panel__head .tl-h2, .tl-panel__head h2 { margin: 0; }
.tl-panel .tl-h2 { font-size: 22px; }
.tl-panel--danger { border-color: rgba(var(--tl-danger-rgb, 255, 51, 102), .45); }
.tl-panel--danger .tl-h2::after { background: linear-gradient(90deg, var(--tl-danger, #ff3366), transparent); }
.tl-panel--flush { padding: 0; overflow: hidden; }
.tl-stack > * + * { margin-top: 16px; }
.tl-sub { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--tl-accent-ink, #ff4d8a); margin: 18px 0 8px; }
.tl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tl-actions form { margin: 0; display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- list rows ---------- */
.tl-rows { display: flex; flex-direction: column; }
.tl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 0; border-bottom: 1px solid var(--tl-line, rgba(255, 255, 255, 0.08)); }
.tl-row:last-child { border-bottom: 0; }
.tl-row__main { flex: 1 1 200px; min-width: 0; }
.tl-row__title { display: block; font-weight: 700; color: var(--tl-text, #fff); overflow-wrap: anywhere; }
.tl-row__meta { display: block; font-size: 13px; color: var(--tl-muted, rgba(255, 255, 255, 0.7)); margin-top: 3px; overflow-wrap: anywhere; }
.tl-row__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tl-row__actions form { margin: 0; }
.tl-row .tl-avatar { width: 40px; height: 40px; }
.tl-row--enter { animation: tl-org-rise .45s ease both; }
.tl-row--enter:nth-child(2) { animation-delay: .05s; } .tl-row--enter:nth-child(3) { animation-delay: .1s; } .tl-row--enter:nth-child(n+4) { animation-delay: .15s; }
@keyframes tl-org-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- tables that become cards on phones ---------- */
.tl-table .tl-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-table td small { color: var(--tl-muted, rgba(255, 255, 255, 0.7)); }
@media (max-width: 720px) {
    .tl-tablewrap--stack { border: 0; background: transparent; overflow: visible; }
    .tl-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .tl-table--stack, .tl-table--stack tbody, .tl-table--stack tr, .tl-table--stack td { display: block; width: 100%; box-sizing: border-box; }
    .tl-table--stack tr { margin-bottom: 12px; padding: 12px 14px; border-radius: var(--tl-r, 1rem); background: var(--tl-surface, rgba(255, 255, 255, 0.03)); border: 1px solid var(--tl-line, rgba(255, 255, 255, 0.1)); }
    .tl-table--stack td { border: 0; padding: 6px 0; display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; text-align: right; }
    .tl-table--stack td[data-label]::before { content: attr(data-label); flex: 0 0 auto; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--tl-faint, rgba(255, 255, 255, 0.5)); text-align: left; padding-top: 2px; }
    .tl-table--stack td.tl-cell-head { display: block; text-align: left; font-size: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--tl-line, rgba(255, 255, 255, 0.08)); margin-bottom: 4px; }
    .tl-table--stack td.tl-cell-actions { display: block; text-align: left; padding-top: 10px; }
    .tl-table--stack tr:hover td { background: transparent; }
}

/* ---------- forms ---------- */
.tl-check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; margin: 0; }
.tl-check input[type="checkbox"], .tl-check input[type="radio"] { width: 20px; height: 20px; flex: 0 0 auto; margin: 0; accent-color: var(--tl-accent, #ff1e6a); }
.tl-pillset { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.tl-pillset label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: var(--tl-r-chip, 9999px); border: 1px solid var(--tl-input-border, rgba(255, 255, 255, 0.2)); background: var(--tl-field, rgba(255, 255, 255, 0.03)); color: var(--tl-text, #fff); font-size: 14px; cursor: pointer; margin: 0; }
.tl-pillset label:has(input:checked) { border-color: var(--tl-accent, #ff1e6a); background: var(--tl-accent-soft, rgba(255, 30, 106, 0.12)); font-weight: 600; }
.tl-pillset label:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.tl-pillset input { accent-color: var(--tl-accent, #ff1e6a); margin: 0; }
.tl-fieldgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px 16px; }
.tl-fieldgrid .tl-field { margin-bottom: 0; }
.tl-fieldgrid .tl-field--full { grid-column: 1 / -1; }
.tl-submitbar { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 18px; }
@media (max-width: 640px) {
    .tl-submitbar { position: sticky; bottom: 0; z-index: 5; margin: 18px -18px -18px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--tl-surface, rgba(20, 10, 20, 0.96)); border-top: 1px solid var(--tl-line, rgba(255, 255, 255, 0.1)); border-radius: 0 0 var(--tl-r, 1rem) var(--tl-r, 1rem); box-shadow: 0 -8px 20px rgba(var(--tl-shade-rgb, 0, 0, 0), .18); }
    .tl-submitbar .btn, .tl-submitbar .tl-btn { flex: 1 1 auto; justify-content: center; }
    .tl-row__actions { width: 100%; }
    .tl-orghead__aside { width: 100%; }
    .tl-orgpicker, .tl-orgpicker select { width: 100%; }
    .tl-org .tl-kpis { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
    .tl-org .tl-kpi b { font-size: 28px; }
}

/* ---------- small helpers ---------- */
.tl-ink--ok { color: var(--tl-ok, #00ff88) !important; }
.tl-ink--warn { color: var(--tl-warn, #ffaa00) !important; }
.tl-ink--danger { color: var(--tl-danger, #ff3366) !important; }
.tl-ink--accent { color: var(--tl-accent-ink, #ff4d8a) !important; }
.tl-kpis--enter .tl-kpi { animation: tl-org-rise .5s ease both; }
.tl-kpis--enter .tl-kpi:nth-child(2) { animation-delay: .06s; } .tl-kpis--enter .tl-kpi:nth-child(3) { animation-delay: .12s; } .tl-kpis--enter .tl-kpi:nth-child(n+4) { animation-delay: .18s; }
.tl-notice--info { background: var(--tl-info-bg, rgba(0, 212, 255, 0.12)); color: var(--tl-info, #00d4ff); }
.tl-notice--block { display: block; }
.tl-notice a { color: inherit; font-weight: 600; }
.tl-todos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; margin-bottom: 18px; }
.tl-todo--pulse { animation: tl-org-pulse 3s ease-in-out infinite; }
@keyframes tl-org-pulse { 0%, 100% { border-color: var(--tl-line, rgba(255, 255, 255, 0.1)); } 50% { border-color: var(--tl-accent, #ff1e6a); box-shadow: 0 0 24px rgba(var(--tl-accent-rgb, 255, 30, 106), .16); } }

@media (prefers-reduced-motion: reduce) {
    .tl-orghead::before, .tl-row--enter, .tl-kpis--enter .tl-kpi, .tl-todo--pulse { animation: none; }
    .tl-orghead::before { display: none; }
}

/* === GESTION V1 (managers): compact head and plain section titles on the organisation management pages === */
.tl-org .tl-band.tl-orghead { padding: 14px 18px; min-height: 0; }
.tl-org .tl-orghead { align-items: center; gap: 10px 18px; }
.tl-org .tl-orghead .tl-display { font: 700 1.4rem/1.2 var(--tl-font-body, inherit); font-style: normal; text-transform: none; letter-spacing: 0; }
.tl-org .tl-orghead .tl-lead { margin: .25rem 0 0; font-size: .875rem; }
.tl-org .tl-h2 { font: 700 1rem/1.3 var(--tl-font-body, inherit); font-style: normal; text-transform: none; letter-spacing: 0; padding-bottom: 0; margin-bottom: .6rem; }
.tl-org .tl-h2::after { display: none; }
.tl-org h1.tl-h2, .tl-org h2.tl-h2, .tl-org h3.tl-h2 { font-size: 1.05rem; line-height: 1.3; }
/* === /GESTION V1 === */
