/* Explorateur transversal : espaces | arborescence | contenu | informations. Préfixe .ex- */

.ex-page .page-head .search { min-width: 260px; }
.ex-page .page-head .field label { display: none; }

.ex {
  display: grid;
  grid-template-columns: 200px 220px minmax(0, 1fr) 280px;
  gap: 0;
  min-height: calc(100vh - 160px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l);
  overflow: hidden;
}
.ex > * { min-width: 0; min-height: 0; }
.ex-spaces, .ex-tree { border-right: 1px solid var(--border); background: var(--surface-2); overflow: auto; }
.ex-info { border-left: 1px solid var(--border); background: var(--surface-2); overflow: auto; padding: var(--space-4); font-size: 14px; }
.ex-main { display: flex; flex-direction: column; min-height: 0; position: relative; }

/* Espaces */
.ex-spaces { padding: var(--space-3) var(--space-2); font-size: 14px; }
.ex-space-group + .ex-space-group { margin-top: var(--space-4); }
.ex-space-group h2 { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); padding: 0 var(--space-2); margin-bottom: var(--space-1); font-family: var(--font); }
.ex-space-group ul { list-style: none; margin: 0; padding: 0; }
.ex-space { display: flex; align-items: center; gap: var(--space-2); min-height: 34px; padding: 0 var(--space-2); border-radius: var(--radius); color: var(--text-2); white-space: nowrap; overflow: hidden; }
.ex-space span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.ex-space svg { flex-shrink: 0; }
.ex-space[data-kind="personal"] svg { color: var(--cat-rh); }
.ex-space[data-kind="shared"] svg { color: var(--cat-fonds); }
.ex-space[data-kind="team"] svg { color: var(--cat-production); }
.ex-space:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.ex-space[aria-current="page"] { background: var(--blue-light); color: var(--accent); font-weight: 600; }
.ex-space-note { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.ex-space-empty { padding: 4px var(--space-2); font-size: 13px; color: var(--text-muted); }

/* Arborescence */
.ex-tree { padding: var(--space-3) var(--space-2); font-size: 14px; }
.ex-tree ul { list-style: none; margin: 0; padding: 0; }
.ex-tree li[aria-expanded="false"] > ul { display: none; }
.ex-tree-row { display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 var(--space-2); border-radius: var(--radius-s); color: var(--text-2); cursor: pointer; white-space: nowrap; }
.ex-tree-row:hover { background: var(--hover); color: var(--text); }
.ex-tree-row[aria-current="true"] { background: var(--blue-light); color: var(--accent); font-weight: 600; }
.ex-tree-root { margin-bottom: var(--space-1); font-weight: 500; }
.ex-tree-name { overflow: hidden; text-overflow: ellipsis; }
.ex-tree-toggle { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex-shrink: 0; border: 0; background: none; color: var(--text-muted); padding: 0; cursor: pointer; border-radius: 3px; }
.ex-tree-toggle:hover { background: var(--active); color: var(--text); }
.ex-tree li[aria-expanded="true"] > .ex-tree-row .ex-tree-toggle svg { transform: rotate(90deg); }
.ex-tree-empty { padding: var(--space-2); font-size: 13px; color: var(--text-muted); }

/* Barre d'outils et fil d'Ariane */
.ex-toolbar { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); background: var(--surface); }
.ex-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 14px; min-height: 28px; }
.ex-crumb { border: 0; background: none; padding: 3px 6px; border-radius: var(--radius-s); color: var(--text-2); font: inherit; font-size: 14px; cursor: pointer; }
.ex-crumb:hover { background: var(--hover); color: var(--text); }
.ex-crumb.is-current { color: var(--text); font-weight: 600; cursor: default; }
.ex-crumb-sep { color: var(--text-3); padding: 0 2px; }
.ex-tools { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.ex-tools .spacer { flex: 1; }
.ex-tools .field { margin: 0; }
.ex-filter { width: 150px; min-height: 30px; font-size: 13px; padding: 0 var(--space-2); }
.ex-sort .input { min-height: 30px; font-size: 13px; padding: 0 28px 0 var(--space-2); }
.ex-view { display: inline-flex; gap: 2px; }
.ex-view .btn.is-on { background: var(--blue-light); border-color: var(--blue-subtle); color: var(--accent); }
.ex-search-title { font-size: 16px; }

/* Contenu */
.ex-content { flex: 1; min-height: 240px; overflow: auto; outline: none; position: relative; }
.ex-content:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.ex-main.ex-dropping .ex-content { background: var(--blue-light); box-shadow: inset 0 0 0 2px var(--accent); }
.ex-main.ex-dropping .ex-content::after { content: "Déposer ici"; position: absolute; inset: auto 0 var(--space-4); text-align: center; color: var(--accent); font-weight: 600; pointer-events: none; }
.ex-drop-target { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--blue-light) !important; }

.ex-list { width: 100%; min-width: 540px; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.ex-list th, .ex-list td { padding: 7px var(--space-3); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ex-list th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.ex-list th.sortable { cursor: pointer; user-select: none; }
.ex-list th .sort-ind { display: inline-block; width: 12px; margin-left: 4px; color: var(--text-muted); }
.ex-list th[aria-sort="ascending"] .sort-ind::after { content: "▲"; font-size: 9px; }
.ex-list th[aria-sort="descending"] .sort-ind::after { content: "▼"; font-size: 9px; }
.ex-list td.num, .ex-list th.num { text-align: right; font-variant-numeric: tabular-nums; }
.ex-list td { overflow: hidden; text-overflow: ellipsis; }
.ex-list th:nth-child(2) { width: 84px; }
/* Fonds : la colonne Étiquettes est large et sur une ligne (quatre étiquettes au plus, puis « +n ») ; pas de texte comprimé */
.ex-list.is-fonds { min-width: 900px; }
.ex-list.is-fonds th:nth-child(1) { width: auto; }
.ex-list.is-fonds th:nth-child(2) { width: 40%; }
.ex-list.is-fonds th:nth-child(3) { width: 84px; }
.ex-list.is-fonds th:nth-child(4) { width: 142px; }
.ex-list.is-fonds th:nth-child(5) { width: 110px; }
.ex-list.is-fonds th, .ex-list.is-fonds td { padding-top: 8px; padding-bottom: 8px; }
.ex-list.is-fonds td.ex-cell-tags { overflow: hidden; }
.ex-list.is-fonds .ex-name { font-weight: 500; }
.ex-list.is-fonds td.muted, .ex-list.is-fonds td.num { font-variant-numeric: tabular-nums; }
/* Mode fonds : pas d'arbre de dossiers (il serait vide) → la liste prend la place */
.ex:has(.ex-fonds-nav) { grid-template-columns: 200px minmax(0, 1fr) 280px; }
.ex:has(.ex-fonds-nav) .ex-tree { display: none; }
.ex-list th:nth-child(3) { width: 84px; }
.ex-list th:nth-child(4) { width: 136px; }
.ex-list th:nth-child(5) { width: 110px; }
.ex-row { transition: background-color .12s var(--ease), transform .12s var(--ease-out), box-shadow .12s var(--ease); animation: rise-in .2s var(--ease-out) both; } .ex-row { cursor: default; user-select: none; }
/* Lignes alternées (lecture plus facile sur les longues listes) */
.ex-list tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.ex-row:hover { background: var(--hover); }
/* sélection : plus forte que les lignes alternées et le survol (la 2e ligne sélectionnée restait sans couleur, 22 octobre 2026) */
.ex-list tbody tr.ex-row.is-selected, .ex-list tbody tr.ex-row.is-selected:hover { background: var(--blue-light); box-shadow: inset 3px 0 0 var(--accent); }
.ex-row.is-selected td { color: var(--text); }
.ex-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.ex-cell-name { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.ex-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }

/* Type : icône dans une case teintée par catégorie (.ftype, app.css), dimension fixe dans la liste */
.ex-list .ftype { width: 30px; min-width: 30px; height: 22px; padding: 0; }
.ex-type-cell { display: inline-flex; align-items: center; gap: 6px; }

.ex-lock { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--warn-text); white-space: nowrap; }
.ex-lock svg { width: 14px; height: 14px; }
.ex-lock.is-mine { color: var(--cat-rh); }
.ex-shared { display: inline-flex; color: var(--cat-fonds); }

/* Grille */
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); padding: var(--space-4); }
.ex-card { transition: background-color .12s var(--ease), transform .12s var(--ease-out), box-shadow .12s var(--ease); animation: rise-in .2s var(--ease-out) both; } .ex-card { display: flex; flex-direction: column; gap: 6px; padding: var(--space-2); border-radius: var(--radius); border: 1px solid transparent; cursor: default; user-select: none; }
.ex-card:hover { background: var(--hover); }
.ex-card.is-selected { background: var(--blue-light); border-color: var(--blue-subtle); }
.ex-card:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.ex-thumb { position: relative; aspect-ratio: 16 / 10; border-radius: var(--radius-s); background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--border); }
.ex-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ex-thumb .ftype { width: 44px; min-width: 44px; height: 32px; padding: 0; }
.ex-thumb .ftype svg { width: 26px; height: 26px; }
.ex-thumb .ex-lock { position: absolute; right: 6px; bottom: 6px; background: var(--surface); padding: 1px 6px; border-radius: 999px; font-size: 11px; }
.ex-thumb-folder { background: var(--blue-light); border-color: transparent; }
.ex-card-name { font-size: 13px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-card-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Téléversements */
.ex-uploads { border-top: 1px solid var(--border); background: var(--surface-2); padding: var(--space-2) var(--space-4); font-size: 13px; max-height: 180px; overflow: auto; }
.ex-uploads[hidden] { display: none; }
.ex-uploads ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ex-upload { display: grid; grid-template-columns: minmax(0, 1fr) 70px minmax(120px, 220px) minmax(0, auto) 30px; align-items: center; gap: var(--space-3); }
.ex-upload.is-done, .ex-upload.is-failed { grid-template-columns: minmax(0, 1fr) 70px minmax(120px, auto) 30px; }
/* vitesse d'envoi (22 octobre 2026) : pourcentage, octets, débit, temps restant */
.ex-upload-stats { white-space: nowrap; font-size: 12px; }
@media (max-width: 720px) { .ex-upload { grid-template-columns: minmax(0, 1fr) auto 30px; } .ex-upload .ex-upload-size { display: none; } .ex-upload .progress { grid-column: 1 / -1; } .ex-upload-stats { grid-column: 1 / -1; } }
.ex-upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-upload-size { text-align: right; font-variant-numeric: tabular-nums; }
.ex-upload-error { color: var(--danger); font-size: 12px; }

/* Menu d'actions */
.ex-menu { position: fixed; z-index: 60; min-width: 200px; padding: 4px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.ex-menu button { text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: var(--radius-s); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.ex-menu button:hover, .ex-menu button:focus-visible { background: var(--hover); outline: none; }
.ex-menu button.is-danger { color: var(--danger); }

/* Panneau d'information */
.ex-info h2 { font-size: 15px; font-weight: 600; margin-bottom: var(--space-3); overflow-wrap: anywhere; font-family: var(--font); }
.ex-info .dl { grid-template-columns: 90px 1fr; gap: 6px var(--space-2); font-size: 13px; }
.ex-info-thumb { aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--surface-3); margin-bottom: var(--space-3); border: 1px solid var(--border); }
.ex-info-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.ex-info-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
.ex-info-shares { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.ex-info-shares h3 { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); margin-bottom: var(--space-2); font-family: var(--font); }
.ex-info-shares ul { list-style: none; margin: 0 0 var(--space-2); padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.ex-ref { font-size: 12px; overflow-wrap: anywhere; }

/* Dialogues */
.ex-viewer .dialog-body { padding: 0; background: #000; display: flex; align-items: center; justify-content: center; min-height: 240px; }
.ex-viewer-media { display: block; max-width: 100%; max-height: calc(100vh - 220px); margin: 0 auto; }
.ex-viewer-audio { width: 90%; margin: var(--space-6) auto; }
.ex-viewer-frame { width: 100%; height: calc(100vh - 220px); border: 0; background: var(--surface); }
.ex-viewer .dialog-body > p { color: var(--text-3); padding: var(--space-8); }
.ex-pick { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-1); }
.ex-pick ul { list-style: none; margin: 0; padding: 0; }
.ex-pick-row { display: flex; align-items: center; gap: var(--space-2); width: 100%; text-align: left; min-height: 32px; padding: 0 var(--space-3); border: 0; background: none; border-radius: var(--radius-s); color: var(--text-2); font: inherit; font-size: 14px; cursor: pointer; }
.ex-pick-row:hover { background: var(--hover); color: var(--text); }
.ex-pick-row[aria-pressed="true"] { background: var(--blue-light); color: var(--accent); font-weight: 600; }
.ex-pick-row:disabled { opacity: .45; cursor: default; }
.ex-share-row { display: flex; align-items: flex-end; gap: var(--space-2); flex-wrap: wrap; }
.ex-share-row .field { flex: 1; min-width: 160px; margin: 0; }
.ex-shares-title { font-size: 14px; margin: var(--space-6) 0 var(--space-2); font-family: var(--font); }
.ex-share-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ex-share-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--border); font-size: 14px; }
.ex-share-main { min-width: 0; overflow-wrap: anywhere; }
.ex-fonds-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2) var(--space-3); font-size: 14px; }
.ex-fonds-list .check { min-height: 30px; }
.ex-fonds-emission summary { cursor: pointer; padding: 4px 0; font-weight: 500; }
.ex-fonds-emission .check { margin-left: var(--space-4); }

/* Responsive : colonnes empilées */
@media (max-width: 1200px) {
  .ex { grid-template-columns: 170px 190px minmax(0, 1fr); }
  /* signalement 135 (28 octobre 2026) : en vue Fonds, la règle :has() l'emportait et gardait « 200px 1fr 280px » : la liste
     finissait dans 134 px avec un panneau d'information vide à droite */
  .ex:has(.ex-fonds-nav) { grid-template-columns: 170px minmax(0, 1fr); }
  .ex-info { display: none; }
  .ex-list td:nth-child(5), .ex-list th:nth-child(5) { display: none; }
  .ex-list { min-width: 440px; }
}
@media (max-width: 899px) {
  .ex, .ex:has(.ex-fonds-nav) { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .ex-spaces, .ex-tree { border-right: 0; border-bottom: 1px solid var(--border); max-height: 200px; }
  .ex-info { display: block; border-left: 0; border-top: 1px solid var(--border); }
  .ex-list td:nth-child(5), .ex-list th:nth-child(5) { display: none; }
}

/* Fonds dans l'explorateur : étiquettes colorées et barre de filtres */
.ex-space[data-kind="fonds"] svg { color: var(--cat-fonds); }
.ex-tagbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 var(--space-3); }
.ex-tagbar .meta { margin-right: 4px; }
.ex-tag { transition: background-color .12s var(--ease), transform .12s var(--ease-out), box-shadow .12s var(--ease); animation: rise-in .2s var(--ease-out) both; } .ex-tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 7px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--tag) 35%, transparent); background: color-mix(in srgb, var(--tag) 12%, var(--surface)); color: color-mix(in srgb, var(--tag) 70%, var(--text)); font: inherit; font-size: 12.5px; cursor: pointer; transition: background-color var(--duration) var(--ease), color var(--duration) var(--ease), border-color var(--duration) var(--ease), transform var(--duration) var(--ease); }
.ex-tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tag); flex-shrink: 0; }
.ex-tag:hover { border-color: var(--tag); transform: translateY(-1px); }
.ex-tag.is-on { background: var(--tag); color: #fff; border-color: var(--tag); }
.ex-tag.is-on::before { background: rgba(255,255,255,.85); }
.ex-tag .ex-tag-count { font-variant-numeric: tabular-nums; opacity: .75; font-size: 11px; }
.ex-tag-sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; }
.ex-tag-clear { font-size: 12px; }
.ex-tags-cell { display: inline-flex; flex-wrap: nowrap; gap: 4px; max-width: 100%; overflow: hidden; }
.ex-tags-cell .ex-tag { white-space: nowrap; flex: 0 0 auto; }
.ex-tag-more { display: inline-flex; align-items: center; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 11px; cursor: default; }
.ex-tags-cell .ex-tag { padding: 0 7px 0 5px; font-size: 11px; cursor: default; }
.ex-tags-cell .ex-tag::before { width: 6px; height: 6px; }
.ex-tags-cell .ex-tag:hover { transform: none; }
.ex-fonds-nav { display: flex; align-items: center; gap: var(--space-2); }
.ex-fonds-nav .input { width: auto; min-height: 30px; font-size: 13px; }
.ex-info-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: var(--space-2) 0; }

/* Fonds › Internet : barre de téléchargement direct (yt-dlp) et cartes des tâches */
.ex-netbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2, var(--surface)); }
.ex-netbar .ex-net-url { flex: 1 1 320px; min-width: 200px; }
.ex-netbar .meta { flex-basis: 100%; }
.ex-net-pending { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.ex-net-pending[hidden] { display: none; }
.ex-net-card { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.ex-net-card.is-failed { border-color: var(--danger); }
.ex-net-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ex-net-card-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ex-menu button[disabled] { color: var(--muted); cursor: default; }

/* ---- Classer par IA : aperçu du plan ---- */
.ex-organize-table td { vertical-align: top; }
.ex-organize-from { word-break: break-word; }
.ex-organize-name { width: 100%; min-width: 16ch; }
.ex-organize-new::after { content: ' · nouveau'; color: var(--text-3); font-size: .85em; }

/* ---- Liste : vignette réelle et bande de couleur par type ---- */
.ex-row-thumb-wrap { display: inline-flex; width: 44px; height: 26px; border-radius: 4px; overflow: hidden; background: #000; flex: none; vertical-align: middle; margin-right: var(--space-2); }
.ex-row-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.ex-row { --cat: transparent; box-shadow: inset 3px 0 0 var(--cat); }
.ex-row[data-cat="video"] { --cat: #4d8df0; }
.ex-row[data-cat="audio"] { --cat: #2fb37a; }
.ex-row[data-cat="image"] { --cat: #d458c8; }
.ex-row[data-cat="pdf"] { --cat: #e5484d; }
.ex-row[data-cat="text"], .ex-row[data-cat="subtitle"] { --cat: #e3a21a; }
.ex-row[data-cat="nle"], .ex-row[data-cat="montage"] { --cat: #ff7a3d; }
.ex-row[data-cat="link"] { --cat: #6f7889; }
.ex-row[data-cat="folder"] { --cat: #c9a227; }
.ex-row.is-selected { box-shadow: inset 3px 0 0 var(--cat); }
