/* =====================================================================
   Membres de l'équipe (public/team.js, 08/11/2026) : tableau, fiche membre, invitation, discussion en panneau
   Jetons communs (--bg, --surface, --surface-2/3, --line, --fg, --fg-2, --muted, --accent) ; composants de v2.css.
   ===================================================================== */
#view-agence.tm2-owner #fm-team-card, #view-agence.tm2-owner #ag-create:not([hidden]) ~ #tm2 { display: none !important; }
#view-agence:not(.tm2-owner) .tm2-tools, #view-agence:not(.tm2-owner) #tm2, #view-agence:not(.tm2-owner) .tm2-chathead { display: none !important; }
#view-agence.tm2-owner #ag-space { display: none; }
.tm2 { display: flex; flex-direction: column; gap: 12px; }
.tm2-tools .btn-ghost, .tm2-tools .btn-main { display: inline-flex; align-items: center; gap: 7px; }
.tm2-tools .i { width: 15px; height: 15px; }
.tm2-chatbtn { position: relative; }
.tm2-dot { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
.tm2-dot[hidden] { display: none; }
.tm2-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tm2-kpis .v-kpi span { font-size: 12px; }
/* barre de recherche et filtres */
.tm2-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tm2-bar .grow { flex: 1; }
.tm2-search { display: flex; align-items: center; gap: 8px; height: 36px; width: min(320px, 100%); padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); transition: border-color .15s; }
.tm2-search:focus-within { border-color: var(--accent); }
.tm2-search .i { width: 15px; height: 15px; color: var(--muted); flex: none; }
html body .app .tm2-search input.ui-bare { flex: 1; min-width: 0; height: 34px; padding: 0 !important; border: 0 !important; box-shadow: none !important; background: transparent !important; color: var(--fg); font: inherit; font-size: 13.5px; outline: none; }
html body .app .tm2-bar select { width: auto; min-width: 150px; height: 36px !important; min-height: 36px !important; font-size: 13px !important; }
/* actions groupées */
.tm2-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 10px; background: color-mix(in srgb, var(--accent) 6%, var(--surface)); animation: uiPanelIn .16s var(--ease, ease-out) both; }
.tm2-bulk b { font-size: 13px; margin-right: 4px; }
.tm2-bulk .grow { flex: 1; }
html body .app .tm2-bulk select { width: auto; height: 32px !important; min-height: 32px !important; font-size: 12.5px !important; }
/* tableau */
.tm2-table .tm2-ck { width: 38px; padding-right: 0; }
.tm2-table .tm2-ck input { width: 16px; height: 16px; cursor: pointer; }
.tm2-table tbody tr[data-tm2-row] { cursor: pointer; transition: background .12s; }
.tm2-table tbody tr[data-tm2-row]:hover { background: var(--surface-2); }
.tm2-table tbody tr.on { background: var(--surface-3); box-shadow: inset 2px 0 0 var(--accent); }
.tm2-table tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tm2-table tr.inv .aic-who b { color: var(--fg-2); }
.tm2-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.tm2-sort:hover, .tm2-sort.on { color: var(--fg); }
.tm2-sort .i { width: 11px; height: 11px; transform: rotate(90deg); }
.tm2-accs { max-width: 240px; }
.tm2-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; margin: 1px 4px 1px 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); font-size: 12px; color: var(--fg-2); white-space: nowrap; }
.tm2-chip.more { color: var(--muted); }
.tm2-exp { display: block; margin-top: 3px; font-size: 11px; }
.tm2-act { width: 44px; text-align: right; }
.tm2-act .co-more { display: inline-block; }
.tm2-menu { right: 0; left: auto; }
.tm2-none { text-align: center; color: var(--muted); padding: 22px !important; }
.tm2-pages { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.tm2-av { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; font-size: 12.5px; font-weight: 700; background: hsl(var(--h) 38% 30%); color: hsl(var(--h) 80% 92%); }
.tm2-av.lg { width: 40px; height: 40px; font-size: 15px; }
.tm2-av.inv { background: var(--surface-3); color: var(--muted); border: 1px dashed var(--line-2, var(--line)); }
:root[data-theme="light"] .tm2-av:not(.inv) { background: hsl(var(--h) 60% 88%); color: hsl(var(--h) 55% 28%); }
/* fiche membre */
.tm2-drawer .aic-dh small { display: block; }
.tm2-dl { display: grid; grid-template-columns: 1fr; margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tm2-dl > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.tm2-dl > div:last-child { border-bottom: 0; }
.tm2-dl dt { font-size: 12.5px; color: var(--muted); }
.tm2-dl dd { margin: 0; font-size: 13px; color: var(--fg); min-width: 0; overflow-wrap: anywhere; }
html body .app .tm2-dl select { height: 32px !important; min-height: 32px !important; font-size: 13px !important; width: 100%; }
.tm2-sub { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }
.tm2-sub b { font-size: 13px; } .tm2-sub small { font-size: 12px; }
.tm2-accrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tm2-accrow .pf-badge { margin-right: 4px; }
.tm2-cchip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 12.5px; color: var(--fg-2); cursor: pointer; transition: border-color .15s, background .15s; }
.tm2-cchip:hover { border-color: var(--line-2, var(--muted-2)); }
.tm2-cchip:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); color: var(--fg); }
.tm2-cchip input { width: 14px; height: 14px; margin: 0; }
.tm2-cchip em { font-style: normal; font-size: 11px; color: var(--muted); }
.tm2-doms { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tm2-dom { border-bottom: 1px solid var(--line); }
.tm2-dom:last-child { border-bottom: 0; }
.tm2-dom > summary { display: grid; grid-template-columns: minmax(0, 1fr) 90px 40px; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
.tm2-dom > summary::-webkit-details-marker { display: none; }
.tm2-dom > summary:hover { background: var(--surface-2); }
.tm2-dom > summary b { font-size: 13px; font-weight: 600; }
.tm2-dom > summary small { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.tm2-meter { position: relative; height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.tm2-meter i { position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 99px; background: var(--accent); transition: width .25s var(--ease, ease-out); }
.tm2-perms { display: flex; flex-direction: column; padding: 2px 12px 10px; gap: 2px; animation: uiPanelIn .14s var(--ease, ease-out) both; }
.tm2-perm { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 12.5px; color: var(--fg-2); }
.tm2-perm > span { flex: 1; min-width: 0; }
.tm2-perm.off { opacity: .5; }
.tm2-feats { display: flex; flex-wrap: wrap; margin: 0; }
.tm2-akpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tm2-akpis .v-kpi { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tm2-akpis .v-kpi b { font-size: 16px; }
.tm2-shifts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tm2-shifts li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--fg-2); }
.tm2-shifts li:last-child { border-bottom: 0; }
.tm2-shifts li > span:first-child { width: 110px; color: var(--muted); }
.tm2-shifts li b { font-variant-numeric: tabular-nums; color: var(--fg); margin-right: auto; }
.tm2-ch { font-size: 12px; color: var(--accent); font-weight: 600; margin-right: 4px; }
.tm2-code { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 10px; background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.tm2-code small { font-size: 12px; color: var(--muted); }
.tm2-code b { flex: 1; font-size: 20px; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; color: var(--fg); }
.tm2-code.big b { font-size: 26px; }
.tm2-invcard { padding-top: 14px; }
/* invitation */
.tm2-modal[hidden] { display: none !important; }
.tm2-icard { width: min(560px, calc(100vw - 32px)) !important; max-height: calc(100vh - 40px); overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 22px !important; }
.tm2-icard h2 { margin: 0; font-size: 17px; font-weight: 650; }
.tm2-icard > p { margin: -8px 0 0; }
.tm2-igrid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.tm2-isec { display: flex; flex-direction: column; gap: 8px; }
.tm2-isec > b { font-size: 13px; font-weight: 600; }
.tm2-roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tm2-roles button { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--fg-2); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.tm2-roles button b { font-size: 13.5px; color: var(--fg); }
.tm2-roles button small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.tm2-roles button:hover { border-color: var(--line-2, var(--muted-2)); }
.tm2-roles button[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); box-shadow: 0 0 0 1px var(--accent) inset; }
.tm2-prev { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tm2-prev li { display: grid; grid-template-columns: 120px minmax(0, 1fr) 38px; gap: 10px; align-items: center; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.tm2-prev li:last-child { border-bottom: 0; }
.tm2-prev li b { font-weight: 600; color: var(--fg); }
.tm2-prev li span { color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm2-prev li em { font-style: normal; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.tm2-prev li.none span { color: var(--muted); }
.tm2-accrow.wrap { gap: 6px; }
.tm2-ierr { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 12.5px; }
.tm2-ierr[hidden] { display: none; }
.tm2-iacts { display: flex; justify-content: flex-end; gap: 8px; }
.tm2-ok { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.tm2-ok .i { width: 22px; height: 22px; }
/* discussion d'équipe : un panneau à droite */
#ag-space.tm2-float[hidden] { display: none !important; }
#ag-space.tm2-float { display: grid !important; position: fixed; z-index: 58; top: 0; right: 0; bottom: 0; width: min(920px, 100vw); grid-template-columns: minmax(0, 1fr) 290px; grid-template-rows: auto minmax(0, 1fr); gap: 0; margin: 0; padding: 0; background: var(--bg); border-left: 1px solid var(--line); box-shadow: -18px 0 48px rgba(0, 0, 0, .35); animation: tm2Slide .2s var(--ease, ease-out) both; }
:root[data-theme="light"] #ag-space.tm2-float { box-shadow: -18px 0 48px rgba(0, 0, 0, .1); }
.tm2-chathead { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tm2-chathead .grow { flex: 1; }
#ag-space.tm2-float > .ag-chat { border: 0 !important; border-radius: 0 !important; border-right: 1px solid var(--line) !important; display: flex; flex-direction: column; min-height: 0; margin: 0; }
#ag-space.tm2-float > .ag-chat .ag-thread { flex: 1; min-height: 0; max-height: none; }
#ag-space.tm2-float > .stack { overflow-y: auto; padding: 12px; gap: 12px; }
@keyframes tm2Slide { from { transform: translateX(18px); opacity: 0; } }
/* téléphone : le tableau devient une liste de cartes, panneaux en plein écran */
@media (max-width: 760px) {
  .tm2-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tm2-search { width: 100%; }
  html body .app .tm2-bar select { flex: 1 1 40%; min-width: 0; }
  .tm2-table thead { display: none; }
  .tm2-table, .tm2-table tbody { display: block; }
  .tm2-table tr[data-tm2-row] { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 12px 12px; border-bottom: 1px solid var(--line); }
  .tm2-table tr[data-tm2-row] td { display: none; height: auto; padding: 0; border: 0; }
  .tm2-table tr[data-tm2-row] td:nth-child(1) { display: block; grid-row: 1 / span 2; }
  .tm2-table tr[data-tm2-row] td:nth-child(2) { display: block; grid-column: 2; }
  .tm2-table tr[data-tm2-row] td:nth-child(5) { display: block; grid-column: 3; grid-row: 1; }
  .tm2-table tr[data-tm2-row] td:nth-child(3) { display: block; grid-column: 2; font-size: 12.5px; }
  .tm2-table tr[data-tm2-row] td:nth-child(8) { display: block; grid-column: 3; grid-row: 2; }
  .tm2-table .tm2-ck input { width: 20px; height: 20px; }
  .tm2-table .aic-who { min-width: 0; }
  .tm2-table .aic-who > span { min-width: 0; }
  .tm2-table .aic-who b, .tm2-table .aic-who small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tm2-tools .tm2-dot { top: 3px; right: 3px; }
  .tm2-table td.tm2-act { width: auto; min-width: 44px; }
  .tm2-dl > div { grid-template-columns: 1fr; gap: 3px; }
  .tm2-igrid, .tm2-roles { grid-template-columns: 1fr; }
  .tm2-akpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tm2-prev li { grid-template-columns: 100px minmax(0, 1fr) 34px; }
  #ag-space.tm2-float { width: 100vw; grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; }
  #ag-space.tm2-float > .stack { max-height: 34vh; }
}
@media (prefers-reduced-motion: reduce) { #ag-space.tm2-float, .tm2-bulk, .tm2-perms { animation: none; } .tm2-meter i { transition: none; } }
#ag-space.tm2-float #fm-team-card { display: none !important; }
#ag-space.tm2-float { align-items: stretch !important; }
#ag-space.tm2-float > .ag-chat { align-self: stretch; height: auto; }
#ag-space.tm2-float > .ag-chat .composer { margin-top: auto; }
