/* ============================================================================
   ÉCRANS — RÈGLEMENTS CLIENTS (TRE-11) ET FOURNISSEURS (TRE-12)

   UNE SEULE FEUILLE POUR DEUX ÉCRANS, et c'est la règle du dépôt : encaisser et
   payer sont le même geste vu des deux côtés, avec la même fiche, la même table
   d'imputation et le même récapitulatif. Deux feuilles auraient été deux copies.
   Le préfixe est celui des maquettes de la passation, .r1- pour les clients et
   .r2- pour les fournisseurs (docs/modeles/design_handoff_easycompta) ; les deux
   familles partagent les mêmes règles, écrites une fois.
   ========================================================================== */

.appgrid .r1-onglets, .appgrid .r2-onglets { display: flex; padding: 0 4px; margin-bottom: 12px; background: var(--et-surface); border-bottom: 1px solid var(--et-hairline); flex-shrink: 0; flex-wrap: wrap; }
.appgrid .r1-onglets > button, .appgrid .r2-onglets > button { display: flex; align-items: center; gap: 7px; height: var(--et-onglet-h); padding: 0 var(--et-onglet-px); background: transparent; border: 0; border-bottom: 2px solid transparent; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--et-muted); cursor: pointer; }
.appgrid .r1-onglets > button:hover, .appgrid .r2-onglets > button:hover { color: var(--et-lien); }
.appgrid .r1-onglets > button.est-actif, .appgrid .r2-onglets > button.est-actif { color: var(--et-lien); border-bottom-color: var(--et-form-blue); }   /* encre --et-lien : bascule en sombre (2026-10-03) */

.appgrid .r2-ligne:hover { background: var(--et-surface-3); cursor: pointer; }
.appgrid .r1-chip, .appgrid .r2-chip, .xp-corps .r1-chip, .xp-corps .r2-chip { display: inline-block; padding: 1px 7px; background: var(--et-surface-3); border: 1px solid var(--et-form-border); font-family: var(--et-font-mono); font-size: 12px; font-weight: 600; white-space: nowrap; }

/* La paire étiquette/valeur sert aussi hors fenêtre : les aperçus de l'onglet
   « Comptabilisation » des deux écrans. Liée au seul .xp-corps, elle y tombait en
   colonne unique sans que rien ne le dise. */
.appgrid .r1-paire, .appgrid .r2-paire,
.xp-corps .r1-paire, .xp-corps .r2-paire { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }

/* Le champ d'imputation, dans la table : petit, aligné à droite, mono — on y tape
   un montant en regard d'un solde, et l'œil doit pouvoir les comparer. */
.xp-corps .r1-mini, .xp-corps .r2-mini { box-sizing: border-box; width: 100%; height: 26px; padding: 0 6px; text-align: right; font-family: var(--et-font-mono); font-size: 13px; background: var(--et-surface); border: 1px solid var(--et-form-border); border-radius: var(--et-r2); color: var(--et-ink); outline: none; }
.xp-corps .r1-mini:focus, .xp-corps .r2-mini:focus { border-color: var(--et-form-blue); box-shadow: inset 0 0 0 1px var(--et-form-blue); }
.xp-corps .r2-case { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; cursor: pointer; }

@media (max-width: 1024px) {
  .appgrid .r1-paire, .appgrid .r2-paire,
  .xp-corps .r1-paire, .xp-corps .r2-paire { grid-template-columns: minmax(0, 1fr); }
  .appgrid .r1-onglets > button, .appgrid .r2-onglets > button { height: 44px; }
  .xp-corps .r1-mini, .xp-corps .r2-mini { height: 44px; }
}

/* ============================================================================
   TRE-12 — LA MAQUETTE DENSE (canevas « Règlements fournisseurs », 2026-10-14)

   UN PANNEAU DE FILTRES QUI SE POSE OÙ IL Y A LA PLACE. Latéral (230 px) quand la
   colonne de contenu en a assez pour lui ET pour le tableau (1 290 px : la table la
   plus large tient en ~1 060) ; sinon une bande au-dessus du tableau, ses groupes
   côte à côte. Le choix se fait sur le CONTENEUR, pas sur la fenêtre : la colonne de
   contenu tombe d'une falaise à 1 025 px (docs/conventions-responsive.md § 2), et un
   palier de viewport mettrait le panneau à côté d'un tableau qui défile.

   UN TABLEAU QUI NE TIENT PLUS PASSE EN CARTES, au lieu de défiler : une colonne qui
   sort de l'écran est, pour qui lit, une colonne omise. Même règle, même conteneur :
   sous 1 060 px de zone, chaque rangée devient une carte et chaque cellule porte son
   libellé (data-lib). Au-dessus, aucune cellule ne revient à la ligne — un numéro
   coupé en deux se relit mal — et la colonne Fournisseur garde 240 px.
   ========================================================================== */
.appgrid .r2-titre-barre { font-size: 12px; font-weight: 700; color: var(--et-table-head-encre); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.appgrid .r2-lien { padding: 0; background: none; border: 0; font: inherit; font-size: 12px; color: var(--et-lien); cursor: pointer; white-space: nowrap; }
.appgrid .r2-lien:hover { text-decoration: underline; }

.appgrid .r2-cadre-corps { container: r2-corps / inline-size; }
.appgrid .r2-corps { display: flex; flex-direction: column; gap: 10px; }
.appgrid .r2-zone { flex: 1 1 auto; min-width: 0; container: r2-zone / inline-size; }

.appgrid .r2-filtres { background: var(--et-surface); border: 1px solid var(--et-hairline); font-size: 13px; }
.appgrid .r2-filtres-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--et-hairline); }
.appgrid .r2-filtres.est-replie .r2-filtres-tete { border-bottom: 0; }
.appgrid .r2-filtres-bascule { display: inline-flex; align-items: center; gap: 6px; padding: 0; background: none; border: 0; font: inherit; font-size: 12px; font-weight: 700; color: var(--et-table-head-encre); text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }
.appgrid .r2-filtres-corps { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.appgrid .r2-filtres.est-replie .r2-filtres-corps { display: none; }
.appgrid .r2-f-groupe { min-width: 0; margin: 0; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--et-rang); }
.appgrid .r2-f-groupe legend { float: left; width: 100%; margin: 0 0 4px; padding: 0; font-size: 12px; font-weight: 700; color: var(--et-ink); }
.appgrid .r2-f-opt { clear: both; display: flex; align-items: center; gap: 6px; min-height: 24px; margin: 0; cursor: pointer; }
.appgrid .r2-f-opt input { margin: 0; }
.appgrid .r2-f-opt span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; }
.appgrid .r2-f-opt em { font-style: normal; font-family: var(--et-font-mono); font-size: 12px; color: var(--et-faint); }
.appgrid .r2-f-pilules { clear: both; display: flex; flex-wrap: wrap; gap: 4px; }
.appgrid .r2-f-pilule { min-height: 24px; padding: 0 8px; background: var(--et-surface); border: 1px solid var(--et-form-border); font: inherit; font-size: 12px; color: var(--et-ink); cursor: pointer; }
.appgrid .r2-f-pilule.est-actif { background: var(--et-tint); border-color: var(--et-form-blue); color: var(--et-lien); font-weight: 600; }
.appgrid .r2-f-champ { clear: both; box-sizing: border-box; width: 100%; height: 26px; padding: 0 6px; background: var(--et-surface); border: 1px solid var(--et-bord-champ); font: inherit; font-size: 12px; color: var(--et-ink); }

@container r2-corps (min-width: 1290px) {
  .appgrid .r2-corps { flex-direction: row; align-items: flex-start; }
  .appgrid .r2-filtres { flex: 0 0 230px; }
  .appgrid .r2-filtres-corps { display: block; }
}

/* ---- Le tableau dense ---- */
.appgrid .r2-cartes th, .appgrid .r2-cartes td { white-space: nowrap; }
.appgrid .r2-cartes .r2-col-tiers { min-width: 240px; }
.appgrid .r2-cartes .r2-num { text-align: right; font-variant-numeric: tabular-nums; }
.appgrid .r2-cartes tr.r2-groupe > td { background: var(--et-surface-2); font-size: 12px; font-weight: 700; color: var(--et-table-head-encre); border-bottom: 1px solid var(--et-filet-fort); }
.appgrid .r2-cartes tr.r2-groupe > td:first-child { text-transform: uppercase; letter-spacing: .04em; }
/* Rangée de total (2026-10-19, à la place des vignettes) : son libellé porte les sous-totaux
   d'action et s'enroule plutôt que d'élargir la table — « .tbl tfoot td:first-child » le figeait. */
.appgrid .r2-cartes tfoot td:first-child { white-space: normal; }
/* La case de sélection d'une facture, devant son numéro (colonne « Facture » du <Tableau>). */
.appgrid .r2-facture { display: inline-flex; align-items: center; gap: 6px; }
.appgrid .r2-facture input { margin: 0; }
.appgrid .r2-selection-t { font-size: 12px; color: var(--et-muted); white-space: nowrap; }

@container r2-zone (max-width: 1059px) {
  .appgrid table.r2-cartes,
  .appgrid table.r2-cartes > tbody { display: block; width: 100%; }
  .appgrid table.r2-cartes > thead { display: none; }
  .appgrid table.r2-cartes > tbody > tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px;
    padding: 10px 12px; border-top: 1px solid var(--et-hairline);
    height: auto;   /* « .tbl tbody tr » pose 1 px : une carte en grille déborderait de sa rangée */
  }
  .appgrid table.r2-cartes > tbody > tr > td {
    display: block; position: static; padding: 0 !important; border: 0; background: transparent;
    text-align: left !important; min-width: 0; white-space: normal;
  }
  .appgrid table.r2-cartes > tbody > tr > td:first-child,
  .appgrid table.r2-cartes td:only-child { grid-column: 1 / -1; }
  .appgrid table.r2-cartes .r2-col-tiers { min-width: 0; }
  .appgrid table.r2-cartes td[data-lib]::before {
    content: attr(data-lib); display: block;
    font-family: var(--et-font); font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em; color: var(--et-muted);
  }
  .appgrid table.r2-cartes tr.r2-groupe { background: var(--et-surface-2); }
  /* Le pied suit les cartes : un bloc, libellé au-dessus, montant à droite. */
  .appgrid table.r2-cartes > tfoot { display: block; width: 100%; }
  .appgrid table.r2-cartes > tfoot > tr { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 10px 12px; }
  .appgrid table.r2-cartes > tfoot > tr > td { display: block; padding: 0 !important; border: 0; }
  .appgrid table.r2-cartes > tfoot > tr > td:empty { display: none; }
}

/* ---- Comptabilisation : deux pièces côte à côte, chacune avec ses lignes ---- */
.appgrid .r2-compta { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr)); gap: 10px; align-items: start; }
.appgrid .r2-piece { display: flex; flex-direction: column; min-width: 0; }
.appgrid .r2-schema { font-family: var(--et-font-mono); font-size: 12px; color: var(--et-muted); white-space: nowrap; }
.appgrid .r2-kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--et-surface); border-bottom: 1px solid var(--et-hairline); }
.appgrid .r2-kv > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 6px 10px; border-right: 1px solid var(--et-rang); }
.appgrid .r2-kv > div:last-child { border-right: 0; }
.appgrid .r2-kv span { font-size: 12px; color: var(--et-muted); }
.appgrid .r2-kv b { font-family: var(--et-font-mono); font-size: 14px; font-weight: 600; color: var(--et-ink); }
.appgrid .r2-anomalies { padding: 6px 10px; background: var(--et-avertissement-bg); border-bottom: 1px solid var(--et-avertissement-bord); font-size: 12px; color: var(--et-avertissement-ink); }
.appgrid .r2-lignes { background: var(--et-surface); }
.appgrid .r2-lignes .r2-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.appgrid .r2-lignes .r2-lignes-lib { white-space: normal; }
.appgrid .r2-lignes tfoot td { padding: var(--et-cellule-total-y) 10px; background: var(--et-surface-2); border-top: 1px solid var(--et-filet-fort); font-size: 12px; font-weight: 700; color: var(--et-table-head-encre); }
.appgrid .r2-piece-pied { display: flex; justify-content: flex-end; padding: 8px 10px; background: var(--et-surface); border-top: 1px solid var(--et-hairline); }
.appgrid .r2-piece-vide { padding: 12px 14px; background: var(--et-surface); font-size: 13px; color: var(--et-muted); }

@media (max-width: 1024px) {
  .appgrid .r2-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .appgrid .r2-f-opt, .appgrid .r2-f-pilule, .appgrid .r2-filtres-bascule, .appgrid .r2-lien { min-height: 44px; }
  .appgrid .r2-f-champ { height: 44px; }
}

/* ============================================================================
   TRE-12 — LA CAMPAGNE DE PAIEMENT ET LE RELEVÉ D'ÉCHÉANCES (passation Achat, lot 4, 2026-10-15)

   Le bandeau de campagne est posé au-dessus du tableau des factures : son état se lit
   d'abord par son icône et son mot, la couleur ne fait que le redire — un liseré, pas
   un aplat (à préparer : avertissement ; visée : succès). Ses gestes se replient sous
   le texte plutôt que de pousser la zone hors de l'écran.

   Les puces d'état d'une facture (litige, campagne, brouillon) reprennent .r2-chip ;
   le litige prend le liseré de la marque d'avertissement, sa raison est dans le title.
   ========================================================================== */
.appgrid .r2-cpg {
    display: flex; align-items: flex-start; flex-wrap: wrap; gap: 10px 12px; margin-bottom: 12px;
    padding: 10px 14px; background: var(--et-surface); border: 1px solid var(--et-hairline);
    border-left: 3px solid var(--et-form-border);
}
.appgrid .r2-cpg > i { flex: none; font-size: 16px; color: var(--et-muted); padding-top: 1px; }
.appgrid .r2-cpg.est-brouillon { border-left-color: var(--et-avertissement-mark); }
.appgrid .r2-cpg.est-brouillon > i { color: var(--et-avertissement-ink); }
.appgrid .r2-cpg.est-visee { border-left-color: var(--et-succes); }
.appgrid .r2-cpg.est-visee > i { color: var(--et-succes-ink); }
.appgrid .r2-cpg-txt { flex: 1 1 320px; min-width: 0; }
.appgrid .r2-cpg-titre { font-size: 13px; font-weight: 700; color: var(--et-ink); }
.appgrid .r2-cpg-sous { margin-top: 2px; font-size: 13px; line-height: 1.45; color: var(--et-muted); }
.appgrid .r2-cpg-frn { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.appgrid .r2-cpg-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.appgrid .r2-chip.r2-chip-etat { margin-right: 4px; font-family: inherit; font-weight: 600; }
.appgrid .r2-chip.r2-chip-etat.est-litige,
.xp-corps .r2-chip.r2-chip-etat.est-litige { border-left: 3px solid var(--et-avertissement-mark); color: var(--et-avertissement-ink); background: var(--et-avertissement-bg); }

/* Le relevé : une table par fournisseur et tranche d'ancienneté, qui défile dans sa fenêtre
   plutôt que de la déborder sur téléphone ; une tranche échue non nulle prend l'encre d'alerte. */
.xp-corps .r2-releve-cadre { overflow-x: auto; }
.xp-corps .r2-releve { min-width: 640px; }
.xp-corps .r2-releve td.est-echu { color: var(--et-danger-ink); font-weight: 600; }

@media (max-width: 1024px) {
    .appgrid .r2-cpg-actions .btn { min-height: 44px; }
}
@media (max-width: 559px) {
    .appgrid .r2-cpg-actions { flex: 1 1 100%; }
    .appgrid .r2-cpg-actions .btn { flex: 1 1 auto; }
}
