/*
 * Le rangement d'une discussion (R19) : il prend la place du fil dans la même
 * carte, avec le même vocabulaire de dessin. Deux vues, liste et grille, qui
 * partagent la même rangée : seule la mise en page change.
 */
.onglets { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--tb-surface-2); }
.onglet { padding: 5px 12px; border-radius: 999px; font-size: var(--tb-t-s); font-weight: 500; color: var(--tb-texte-2); transition: background var(--tb-duree), color var(--tb-duree); }
.onglet:hover { color: var(--tb-texte); }
.onglet.est-actif { background: var(--tb-surface); color: var(--tb-texte); box-shadow: var(--tb-ombre-carte); }

.rangement { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.rangement-barre { display: flex; align-items: center; gap: var(--tb-sp-2); padding: var(--tb-sp-3) 18px; border-bottom: 1px solid var(--tb-bordure); }
.rangement-poids { font-size: var(--tb-t-xs); color: var(--tb-texte-3); white-space: nowrap; }
.rangement-corps { flex: 1; min-height: 0; overflow-y: auto; padding: var(--tb-sp-2) var(--tb-sp-3); }
.rangement-pied { display: flex; align-items: center; gap: var(--tb-sp-2); padding: var(--tb-sp-3) 18px; border-top: 1px solid var(--tb-bordure); background: var(--tb-surface); }

/* Fil d'Ariane */
.ariane { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
.ariane-lien { font-size: var(--tb-t-m); color: var(--tb-texte-2); border-radius: var(--tb-rayon-s); padding: 2px 4px; }
.ariane-lien:hover { color: var(--tb-texte); background: var(--tb-surface-2); }
.ariane-sep { color: var(--tb-texte-3); }
.ariane-ici { font-size: var(--tb-t-m); font-weight: 600; color: var(--tb-texte); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Une rangée : la même en liste et en grille */
.rg-item { display: flex; align-items: center; gap: var(--tb-sp-3); padding: 8px 10px; border-radius: var(--tb-rayon); transition: background var(--tb-duree); }
.rg-item:hover { background: var(--tb-surface-2); }
.rg-item.est-choisi { background: color-mix(in srgb, var(--tb-accent) 9%, transparent); }
.rg-coche input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; border: 1.6px solid var(--tb-bordure-2); border-radius: 50%; background: var(--tb-surface); cursor: pointer; position: relative; flex: none; }
.rg-coche input:checked { border-color: var(--tb-accent); }
.rg-coche input:checked::after { content: ''; position: absolute; inset: 3.2px; border-radius: 50%; background: var(--tb-accent); }
.rg-icone { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--tb-rayon-s); background: var(--tb-surface-3); color: var(--tb-texte-2); font-size: 9.5px; font-weight: 700; text-transform: uppercase; flex: none; overflow: hidden; }
.rg-icone-dossier { background: color-mix(in srgb, var(--tb-accent) 12%, transparent); color: var(--tb-accent); }
.rg-vignette img { width: 100%; height: 100%; object-fit: cover; }
.rg-nom { flex: 1; min-width: 0; text-align: left; font-size: var(--tb-t-m); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-nom:hover { text-decoration: underline; }
.rg-info, .rg-quand { font-size: var(--tb-t-xs); color: var(--tb-texte-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rg-info { min-width: 84px; text-align: right; }
.rg-quand { min-width: 56px; text-align: right; }
.rg-outils { display: flex; gap: 2px; opacity: 0; transition: opacity var(--tb-duree); }
.rg-item:hover .rg-outils, .rg-item:focus-within .rg-outils { opacity: 1; }
@media (hover: none) { .rg-outils { opacity: 1; } }

/* Vue grille : la rangée devient une carte */
.rangement-corps.est-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--tb-sp-2); align-content: start; }
.est-grille .rg-item { position: relative; flex-direction: column; align-items: stretch; gap: 6px; padding: 10px; border: 1px solid var(--tb-bordure); }
.est-grille .rg-coche { position: absolute; top: 8px; left: 8px; }
.est-grille .rg-icone { width: 100%; height: 92px; border-radius: var(--tb-rayon); font-size: 13px; }
.est-grille .rg-nom { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.est-grille .rg-info, .est-grille .rg-quand { text-align: left; min-width: 0; }
.est-grille .rg-outils { position: absolute; top: 6px; right: 6px; background: var(--tb-surface); border-radius: 999px; padding: 2px; }

.rg-vide { padding: 48px var(--tb-sp-4); text-align: center; color: var(--tb-texte-3); font-size: var(--tb-t-m); }
.rg-attente { display: flex; flex-direction: column; gap: var(--tb-sp-2); padding: var(--tb-sp-2); }
.rg-attente .squelette { height: 46px; border-radius: var(--tb-rayon); }

/* L'aperçu d'un document (R21) : la coque de la visionneuse, une page blanche dedans. */
.visionneuse-doc .visionneuse-barre { flex-wrap: wrap; }
.visionneuse-page { flex: 1; min-height: 0; margin: 0 18px 18px; border-radius: 10px; overflow: auto; background: var(--tb-surface); box-shadow: 0 24px 80px rgba(0, 0, 0, .6); }
.ap-pdf { display: block; width: 100%; height: 100%; border: 0; background: var(--tb-surface); }
.ap-contenu { padding: var(--tb-sp-4); color: var(--tb-texte); }
.ap-attente, .ap-message { padding: 40px; text-align: center; color: var(--tb-texte-2); }
.ap-note { margin: -6px 18px 8px; font-size: var(--tb-t-s); color: rgba(255, 255, 255, .6); }
.ap-feuilles { background: rgba(255, 255, 255, .12); }
.ap-feuilles .onglet { color: rgba(255, 255, 255, .75); }
.ap-feuilles .onglet.est-actif { background: rgba(255, 255, 255, .92); color: var(--tb-texte); }

/* Un tableau d'aperçu : lettres de colonnes et numéros de lignes, comme dans un tableur. */
.ap-table { border-collapse: collapse; font-size: var(--tb-t-s); font-variant-numeric: tabular-nums; }
.ap-table th, .ap-table td { border: 1px solid var(--tb-bordure); padding: 5px 9px; text-align: left; vertical-align: top; white-space: pre-wrap; max-width: 360px; }
.ap-table thead th, .ap-table .ap-num { position: sticky; background: var(--tb-surface-2); color: var(--tb-texte-3); font-weight: 600; text-align: center; font-size: var(--tb-t-xs); }
.ap-table thead th { top: 0; z-index: 2; }
.ap-table .ap-num { left: 0; z-index: 1; min-width: 38px; }
.ap-table .ap-coin { top: 0; left: 0; z-index: 3; }
.ap-table td.n { text-align: right; }
.ap-table-doc { margin: var(--tb-sp-3) 0; }

/* Un document : du texte, lisible, à largeur de lecture. */
.ap-doc { max-width: 78ch; margin: 0 auto; line-height: 1.6; }
.ap-doc h2 { font-size: 20px; margin: 22px 0 8px; }
.ap-doc h3 { font-size: 17px; margin: 18px 0 6px; }
.ap-doc h4, .ap-doc h5, .ap-doc h6 { font-size: 15px; margin: 14px 0 6px; }
.ap-doc p { margin: 0 0 10px; }
.ap-doc li { margin: 0 0 6px 20px; list-style: disc; }
.ap-texte { margin: 0; padding: var(--tb-sp-3); font: 12.5px/1.55 var(--tb-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.ap-vide { padding: 24px; color: var(--tb-texte-3); }
