/* Paramètres — C16–C23 (reportés en A) : lignes, invariants, pipeline,
   codes de récupération, Web Push. */
.settings-page { display: grid; gap: var(--space-6); max-width: 1216px; }
.list { display: grid; margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--surface); }
.list-row { display: grid; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--border); scroll-margin-top: calc(var(--header-height) + var(--space-4)); }
.list-row:last-child { border-bottom: 0; }
.list-row-current { background: var(--selection); }
.list-row:not(.list-row-expanded, .list-row-current):hover { background: var(--surface-subtle); }
.list-row-expanded { background: var(--surface-subtle); box-shadow: inset 3px 0 0 var(--accent); }
.list-row-muted .list-row-title { color: var(--text-muted); }
.list-row-invalid { border-left: 3px solid var(--danger); }
.list-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); min-height: 44px; }
.list-row-title { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-section); font-weight: 600; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
a.list-row-title:hover { text-decoration: underline; }
.list-row-badges { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.list-row-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-left: auto; }
.list-row-actions .button { min-height: 36px; padding: 6px var(--space-3); }
@media (pointer: coarse) { .list-row-actions .button { min-height: var(--control-height); } }
.list-row-meta { font-size: var(--text-sm); color: var(--text-muted); overflow-wrap: anywhere; }
.list-row-meta:empty { display: none; }
/* Pastille de tête (icône, poignée, couleur) sur une largeur fixe : les lignes
   secondaires s'alignent sous le titre, d'une ligne à l'autre. */
.list-row { --list-row-leading: 40px; }
.list-row-leading { display: inline-flex; flex: none; align-items: center; gap: var(--space-2); min-width: var(--list-row-leading); }
.list-row:has(> .list-row-head > .list-row-leading) > :not(.list-row-head, .list-row-editor) {
  margin-left: calc(var(--list-row-leading) + var(--space-3));
}
.list-row-meta code { font-size: 13px; }
/* Éditeur déplié : panneau en retrait sur la ligne teintée. */
.list-row-editor { margin: var(--space-2) 0 0; padding: var(--space-6); border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--surface); }
.list-row.dragging { opacity: .6; background: var(--surface-2); }

.violations { display: grid; gap: var(--space-1); margin: 0; padding: var(--space-3) var(--space-4); list-style: none; border: 1px solid var(--danger); border-radius: var(--radius-small); background: var(--danger-soft); color: var(--danger); font-size: var(--text-sm); }
.violations li { display: flex; gap: var(--space-2); align-items: start; }
.violations .ui-icon { margin-top: 2px; }

.pipeline { display: grid; gap: var(--space-2); margin: 0; overflow-x: auto; }
.pipeline-graph { min-width: 640px; max-height: 240px; }
.graph-node-box { fill: var(--surface); stroke: var(--border); stroke-width: 1; }
.graph-node-name { fill: var(--text); font-size: 14px; font-weight: 600; font-family: var(--font); }
.graph-node-kind { fill: var(--text-muted); font-size: 12px; font-family: var(--font); }
.graph-node.graph-invalid .graph-node-box { stroke: var(--danger); stroke-width: 2; }
.graph-edge { stroke-width: 1.75; }
.graph-next { stroke: var(--accent); }
.graph-reject { stroke: var(--warning); stroke-dasharray: 5 4; }
.graph-edge.graph-invalid { stroke: var(--danger); }
.graph-arrow { fill: context-stroke; }
.pipeline-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: var(--text-sm); color: var(--text-muted); }
.pipeline-legend span::before { content: ""; display: inline-block; width: 20px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 2px solid var(--accent); }
.pipeline-legend .legend-reject::before { border-top: 2px dashed var(--warning); }
.pipeline-legend .legend-invalid::before { border-color: var(--danger); }

.recovery-codes { display: grid; gap: var(--space-3); }
.recovery-codes ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.recovery-codes code { display: block; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--surface-2); text-align: center; letter-spacing: 1px; }
.push-device { display: grid; gap: var(--space-2); justify-items: start; }

/* Téléphone : titre et actions sur la première ligne, badges dessous, sous le titre. */
@media (max-width: 640px) {
  .list-row-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
  .list-row-head > .list-row-leading { grid-column: 1; grid-row: 1; }
  .list-row-head > .list-row-title { grid-column: 2; grid-row: 1; }
  .list-row-head > .list-row-badges { grid-column: 2 / -1; grid-row: 2; }
  /* Plusieurs actions : une rangée à elles, le titre garde toute la largeur. */
  .list-row-head > .list-row-actions { grid-column: 2 / -1; grid-row: 3; margin-left: 0; }
  .list-row-head > .list-row-actions:has(> :only-child) { grid-column: 3; grid-row: 1; justify-content: flex-end; }
  .list-row-head:not(:has(> .list-row-leading)) > .list-row-title { grid-column: 1 / 3; }
  .list-row-head:not(:has(> .list-row-leading)) > :is(.list-row-badges, .list-row-actions:not(:has(> :only-child))) { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .list-row { --list-row-leading: 32px; padding: var(--space-3) var(--space-4); }
  .list-row-editor { margin-inline: calc(-1 * var(--space-4)); padding: var(--space-4); border-inline-width: 0; border-radius: 0; }
}

/* Liste de cartes de réglage (Paramètres → Colonnes) ; la carte elle-même est `Card`. */
.settings-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); align-items: start; }

/* Pastille de couleur d'une colonne (couleur posée par CSSOM). */
.column-swatch { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgb(16 24 40 / 12%); }

/* Délégation aux agents : une ligne par colonne délégable. */
.delegation-list { display: grid; margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-small); overflow: clip; }
.delegation-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border);
  box-shadow: inset 3px 0 0 transparent; transition: background var(--fast), box-shadow var(--fast);
}
.delegation-row:last-child { border-bottom: 0; }
.delegation-row-on { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--success); }
.delegation-row > .column-swatch { align-self: start; margin-top: 6px; }
.delegation-row-switch { min-width: 0; }
.delegation-row-switch .field-hint { overflow-wrap: anywhere; }
.delegation-row-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: var(--space-2); }
@media (max-width: 720px) {
  .delegation-row { grid-template-columns: auto minmax(0, 1fr); }
  .delegation-row-meta { grid-column: 2; justify-content: start; }
}

/* Aperçu des passages ouverts, sous l'interrupteur du formulaire. */
.delegation-preview {
  display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-small);
}
.delegation-preview-title { font-size: var(--text-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.delegation-edges { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.delegation-edge {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 6px 4px 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: var(--text-sm);
}
.delegation-edge .ui-icon { color: var(--text-muted); }
.delegation-edge-to { font-weight: 600; }
.delegation-preview-off .delegation-edge { border-style: dashed; color: var(--text-muted); }
.delegation-preview-off .delegation-edge-to { font-weight: 400; }
.delegation-preview .warning { align-items: start; }
