/* The category tree of the Organiser, wherever it is mounted.
 *
 * The Organiser's tree was drawn by rules spread across four workspace
 * stylesheets that only the application page loads - 40 of them for this one
 * component. Mounted on the cabinet's Catégories screen it got none of them:
 * no chevrons, no frame, a larger type, and the collapse did nothing visible.
 *
 * These are the values the Organiser actually computes to in the application,
 * measured there and written once, scoped to .cat-manager__tree so they apply
 * on any page. In the application they restate what the workspace sheets
 * already produce; everywhere else they are the whole look. (§2.14: this is
 * the shape the tree's styles should end up in.)
 */

.cat-manager__tree > ul {
  margin: 0 0 1rem;
  padding: 0.4rem;
  list-style: none;
  background: #FFFFFF;
  border: 1px solid rgba(192, 190, 181, 0.7);
  border-radius: 14px;
}

.cat-manager__tree ul.children {
  margin: 0 0 0 1rem;
  padding: 0 0 0 0.75rem;
  list-style: none;
}

.cat-manager__tree li.category-node {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 4px;
  min-height: 36px;
  margin: 0.12rem 0;
  list-style: none;
}

/* The sub-tree is a row of its own, spanning both columns. Without this it was
   auto-placed: on a node with action buttons it landed under the label, but on
   a read-only library - no buttons, so the second column free - it landed
   *beside* the label, and align-items: center then pushed every parent to the
   middle of its own branch. A connector library of a hundred folders became a
   staircase two and a half screens tall (22 September). */
.cat-manager__tree li.category-node > ul { grid-column: 1 / -1; }

.cat-manager__tree li[aria-expanded="false"] > ul { display: none; }

.cat-manager__tree li.category-node > .label-text {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 30px;
  padding: 0.34rem 0.6rem 0.34rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #0B1F4D;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}

.cat-manager__tree .label-text > i {
  flex: 0 0 auto;
  width: 16px;
  margin-right: 4px;
  color: #3B4860;
  font-size: 0.85rem;
  text-align: center;
}

.cat-manager__tree .toggle-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 0.35rem;
  border-radius: 6px;
  background: var(--t-line-soft, #EEEDE8);
  color: var(--t-muted, #596378);
  cursor: pointer;
}
.cat-manager__tree .toggle-icon::before {
  content: "›";
  display: block;
  font-size: 0.8rem;
  line-height: 1;
  transition: transform 0.2s;
}
.cat-manager__tree li[aria-expanded="true"] > .label-text > .toggle-icon::before {
  transform: rotate(90deg);
}

.cat-manager__tree .node-action {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 1px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--t-muted, #596378);
  font-size: 0.75rem;
  cursor: pointer;
}

/* A library that cannot be organised here - a connector's folders, mirrored
   from Google Drive or OneDrive - said nothing: the tree simply had no
   actions, and the screen still promised that changes were saved immediately.
   */
.cat-manager__note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(192, 190, 181, 0.7);
  border-radius: 10px;
  background: var(--t-line-soft, #F7F6F2);
  color: var(--t-muted, #596378);
  font-size: 0.82rem;
  line-height: 1.4;
}
.cat-manager__note > i {
  margin-top: 0.15rem;
  color: var(--t-muted, #596378);
}
.cat-manager__note[hidden] { display: none; }

/* The tree one ticks folders or categories in (TreeWithCheckbox), wherever
 * it is mounted (28 September 2026).
 *
 * Same story as the Organiser's: its look was the workspace stylesheets',
 * which only the application page loads. In a document's « Modifier » and
 * in the import dialog it was right; in « Choisir les dossiers à
 * synchroniser », on the firm's connectors and on « Mon compte », it came out
 * as a bulleted list with nothing to show what was ticked - selection is a
 * class on the row, drawn here, not a checkbox (Benjamin, 28 September).
 *
 * The values are those it computes to in « Modifier », measured there and
 * written once, scoped to .tree-with-checkbox. The borders of the hover and
 * the selection take the navy tint: measured, they were a brown left over
 * from an earlier palette.
 */
.tree-with-checkbox {
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  background: #FFFFFF;
  border: 1px solid rgba(192, 190, 181, 0.7);
  border-radius: 14px;
}
.tree-with-checkbox ul.children {
  flex-basis: 100%;
  margin: 0 0 0 0.9rem;
  padding: 0 0 0 0.85rem;
  list-style: none;
  border-left: 1px solid rgba(192, 190, 181, 0.6);
}
.tree-with-checkbox li[aria-expanded="false"] > ul.children { display: none; }
.tree-with-checkbox li.category-node {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  margin: 0.12rem 0;
}
.tree-with-checkbox li.category-node > .label-text {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  min-height: 30px;
  padding: 0.34rem 0.95rem 0.34rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #0B1F4D;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.tree-with-checkbox li.library-node > .label-text { padding-right: 0.6rem; }
.tree-with-checkbox li.category-node > .label-text:hover {
  background: #F7F6F2;
  border-color: rgba(11, 31, 77, 0.12);
  transform: translateX(2px);
}
.tree-with-checkbox li.category-node > .label-text.selected {
  background: #E3EDFF;
  border-color: rgba(11, 31, 77, 0.18);
  color: #0B1F4D;
  font-weight: 600;
  box-shadow: inset 2px 0 0 #0B1F4D;
}
.tree-with-checkbox .label-text > i {
  flex: 0 0 auto;
  width: 16px;
  margin-right: 4px;
  color: #3B4860;
  font-size: 0.85rem;
  text-align: center;
}
.tree-with-checkbox .library-node > .label-text > i { color: #0B1F4D; }
.tree-with-checkbox .toggle-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 0.35rem;
  border-radius: 6px;
  background: #EEEDE8;
  color: #596378;
  cursor: pointer;
}
.tree-with-checkbox .toggle-icon::before {
  content: "›";
  display: block;
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}
.tree-with-checkbox li[aria-expanded="true"] > .label-text .toggle-icon::before { transform: rotate(90deg); }
.tree-with-checkbox .toggle-spacer {
  display: inline-block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-right: 0.35rem;
}
.tree-with-checkbox .label-text .label-name {
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-with-checkbox .label-text:focus-visible {
  outline: 2px solid rgba(11, 31, 77, 0.45);
  outline-offset: 1px;
}
