/* ============================================================================
   ÉCRAN — CPT-01, TABLEAU DE BORD COMPTABLE (onglet Synthèse)

   Portée de la passation « Pilotage comptable, onglet Synthèse » (2026-09-05),
   fichier ecran-pilotage.css, puis REPRISE sur la maquette modernisée du 2026-09-27
   (docs/modeles/design_handoff_pilotage_compta) et vérifiée au banc d'écran
   (node tools/banc-ecran/mesurer.mjs cpt-01). À charger après modele-erp.css.

   PRÉFIXE `.sy-` ET NON `.tb-`. La passation écrit `.tb-` soixante-deux fois.
   `.tb-` est DÉJÀ le préfixe du tableau de bord de TRÉSORERIE
   (ecran-tableau-bord-tresorerie.css : .tb-kpi, .tb-file, .tb-col, .tb-alerte,
   .tb-jauge…), et `.tb-kpi` est en plus la vignette du module. Importer la
   feuille telle quelle aurait repeint l'écran du trésorier sans une erreur ni un
   avertissement — c'est exactement la collision que le portage précédent avait
   relevée et contournée par `.sy-`. Même choix, même raison.

   CE QUI N'EST PAS ICI, ET OÙ C'EST
     LE BANDEAU D'EN-TÊTE (.et-bandeau*) est monté dans easytech-theme.css : il
     est porté par les 45 écrans du module, donc c'est un gabarit, pas un écran.
     LA VIGNETTE (.sy-fait) vient de easycompta-vignette.css, la feuille qui
     l'unifie sur les vingt écrans à vignettes du module. Ne la redéfinissez pas
     ici : la seule chose que l'écran choisit est son rôle, par --vig.
     LE RAIL D'ONGLETS (.tbd-*) vient de easycompta-onglets.css, partagé avec le
     rail du trésorier.

   LA COULEUR D'ÉTAT NE S'ÉCRIT JAMAIS EN `color:`. La passation posait
   `color: var(--et-danger)` et `var(--et-succes)` sur des fonds pâles ; la charte
   du dépôt réserve ce rang aux encres `-ink`, et l'ambre en marque graphique à
   `-mark`. Corrigé partout ci-dessous — mesuré, pas supposé : --et-succes sur
   --et-succes-bg rend 3,16:1, sous AA pour du 12 px.
   ========================================================================== */

/* L'EN-TÊTE : l'heure du chargement, à gauche des deux actions (fente ActionsEnTete). */
.appgrid .sy-a-jour { font-size: 12px; color: var(--et-muted); white-space: nowrap; }

/* ---- Rangée de vignettes ----------------------------------------------
   Six colonnes, puis trois sous 1100 px et deux sous 720 px (échelle retenue de
   docs/conventions-responsive.md). Chaque vignette range sa clé, sa valeur juste dessous, puis
   sa note dans ce qui reste : la ligne des valeurs reste droite qu'il y ait une note ou non
   (la valeur tombait en bas des vignettes sans note — vu sur la capture du banc). */
.appgrid .sy-mesures {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: var(--et-tdb-gouttiere);
    margin-bottom: var(--et-tdb-ecart);
}
.appgrid .sy-fait { display: grid; grid-template-rows: auto auto minmax(0, 1fr); align-content: start; }
.appgrid .sy-fait .s { font-size: 12px; color: var(--et-muted); }

@media (max-width: 1100px) { .appgrid .sy-mesures { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px)  { .appgrid .sy-mesures { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- Blocs --------------------------------------------------------------
   Le titre de bloc est un titre de phrase, en encre, comme sur la maquette ; ce qui le
   complète (un total, un compte, la période) se range à droite, en second rang. */
.appgrid .sy-deux {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--et-tdb-gouttiere);
    align-items: stretch;
    margin-bottom: var(--et-tdb-ecart);
}
@media (max-width: 1024px) { .appgrid .sy-deux { grid-template-columns: minmax(0, 1fr); } }

.appgrid .sy-bloc {
    display: flex;
    flex-direction: column;
    background: var(--et-surface);
    border: 1px solid var(--et-hairline);
    padding: var(--et-tdb-bloc-py) var(--et-tdb-bloc-px);
    margin-bottom: var(--et-tdb-ecart);
    min-width: 0;
}
.appgrid .sy-deux > .sy-bloc { margin-bottom: 0; }

.appgrid .sy-bloc-t { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: var(--et-tdb-ecart); }
.appgrid .sy-bloc-t > h2 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 16px; font-weight: 700; color: var(--et-ink); }
.appgrid .sy-bloc-fin { font-size: 12px; color: var(--et-muted); }
.appgrid .sy-bloc-fin b { color: var(--et-ink); }

.appgrid .sy-vide { padding: 14px 2px; font-size: var(--et-fs-cell); color: var(--et-muted); text-align: center; }

.appgrid .sy-pied { margin-top: auto; padding-top: 10px; font-size: 13px; }
.appgrid .sy-pied > a:not(.mx-btn) { font-weight: 600; color: var(--et-lien); text-decoration: none; }

.appgrid .sy-mono { font-family: var(--et-font-mono); }
.appgrid .sy-fort { font-weight: 600; }

/* Une puce dit une gravité ou une série : c'est une MARQUE, jamais une encre. */
.appgrid .sy-puce { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.appgrid .sy-puce.est-carree { width: 10px; height: 10px; border-radius: 0; }

/* ---- Ce qui attend -------------------------------------------------------
   Une carte par file, côte à côte ; la carte entière est le lien. La bloquante vient en tête
   et se distingue par son FOND — composé de la teinte d'alerte et de la surface, pour suivre
   le thème sans écrire de couleur —, pas par son encre. */
.appgrid .sy-files {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin: 0 calc(-1 * var(--et-tdb-bloc-px)) calc(-1 * var(--et-tdb-bloc-py));   /* l'inverse du rembourrage de .sy-bloc */
    border-top: 1px solid var(--et-hairline);
}
.appgrid .sy-file {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: var(--et-tdb-bloc-py) var(--et-tdb-bloc-px);
    border-left: 1px solid var(--et-hairline);
    color: var(--et-ink);
    text-decoration: none;
}
.appgrid .sy-file:first-child { border-left: 0; }
.appgrid .sy-file:hover { background: var(--et-survol); }
.appgrid .sy-file.est-bloquante { background: color-mix(in srgb, var(--et-danger) 8%, var(--et-surface)); }
.appgrid .sy-file-t { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; }
.appgrid .sy-file-n { font-family: var(--et-font-mono); font-size: 20px; font-weight: 600; line-height: 1.2; }
.appgrid .sy-file-e { font-size: 12px; color: var(--et-muted); }
.appgrid .sy-file-a { margin-top: auto; padding-top: 4px; font-size: 13px; font-weight: 600; color: var(--et-lien); }

/* Deux colonnes sous 1024 px : en trois, quatre files laissaient une carte orpheline sur une
   seconde rangée (capture tablette du banc). Une seule sous 720 px. */
@media (max-width: 1024px) {
    .appgrid .sy-files { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .appgrid .sy-file:nth-child(odd) { border-left: 0; }
    .appgrid .sy-file:nth-child(n+3) { border-top: 1px solid var(--et-hairline); }
}
/* Sous 720 px, la carte devient une RANGÉE, comme sur la maquette mobile : intitulé et enjeu à
   gauche, nombre à droite, chevron ; la rangée entière reste le lien. Le libellé du geste se
   retire — le chevron le porte, et quatre fois « Ouvrir le… » doublaient la hauteur du bloc. */
@media (max-width: 720px) {
    .appgrid .sy-files { grid-template-columns: minmax(0, 1fr); }
    .appgrid .sy-file,
    .appgrid .sy-file:nth-child(n+3) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        grid-template-areas: "t n c" "e n c";
        align-items: center;
        column-gap: 10px;
        min-height: 56px;
        border-left: 0;
        border-top: 1px solid var(--et-hairline);
    }
    .appgrid .sy-file:first-child { border-top: 0; }
    .appgrid .sy-file-t { grid-area: t; }
    .appgrid .sy-file-e { grid-area: e; }
    .appgrid .sy-file-n { grid-area: n; font-size: 18px; }
    .appgrid .sy-file-a { grid-area: c; margin: 0; padding: 0; font-size: 0; }
    .appgrid .sy-file-a::after { content: "›"; font-size: 20px; color: var(--et-muted); }
}

/* ---- Histogramme d'activité ------------------------------------------- */
.appgrid .sy-histo { display: flex; align-items: flex-end; gap: 6px; height: 150px; }
.appgrid .sy-barre-col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; }
.appgrid .sy-barre-v { min-height: 16px; font-family: var(--et-font-mono); font-size: 12px; color: var(--et-muted); text-align: center; }
.appgrid .sy-barre { display: block; width: 100%; min-height: 4px; }
.appgrid .sy-barre-lab { margin-top: 5px; font-size: 12px; color: var(--et-muted); text-align: center; }
.appgrid .sy-barre-lab.est-courant { font-weight: 700; color: var(--et-lien); }
.appgrid .sy-legende { display: flex; flex-wrap: wrap; gap: var(--et-legende-gap); margin-top: var(--et-legende-ecart); font-size: 12px; color: var(--et-muted); }
.appgrid .sy-legende > span { display: inline-flex; align-items: center; gap: 6px; }
.appgrid .sy-legende i { display: inline-block; width: 10px; height: 10px; border: 1px solid var(--et-hairline); }

/* Sous 560 px, douze barres et leur valeur ne tiennent plus : la valeur reste au survol. */
@media (max-width: 559px) { .appgrid .sy-barre-v { visibility: hidden; } }

/* ---- Balance âgée : barre empilée, puis une rangée par tranche ---------- */
.appgrid .sy-agees { display: flex; flex-direction: column; }
.appgrid .sy-empile { display: flex; gap: 2px; height: 14px; margin-bottom: 8px; }
.appgrid .sy-empile > span { flex-basis: 0; min-width: 2px; }
.appgrid .sy-agee { display: flex; align-items: center; gap: 10px; min-height: 30px; border-top: 1px solid var(--et-hairline); font-size: var(--et-fs-cell); }
.appgrid .sy-empile + .sy-agee { border-top: 0; }
.appgrid .sy-agee-lab { flex: 1; min-width: 0; }
.appgrid .sy-agee-m { flex: none; text-align: right; font-family: var(--et-font-mono); font-weight: 600; }
.appgrid .sy-agee-m.est-alerte { color: var(--et-danger-ink); }
.appgrid .sy-agee-p { flex: 0 0 52px; text-align: right; font-size: 12px; color: var(--et-muted); font-family: var(--et-font-mono); }

/* La piste de barre, partagée par la concentration. */
.appgrid .sy-agee-piste { flex: 1; min-width: 40px; display: inline-block; height: 8px; background: var(--et-piste); vertical-align: middle; }
.appgrid .sy-agee-piste > span { display: block; height: 100%; }

/* ---- Trésorerie prévisionnelle : une barre par point ------------------- */
.appgrid .sy-prev { display: flex; align-items: flex-end; gap: 8px; height: 170px; }
.appgrid .sy-prev-col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.appgrid .sy-prev-v { font-family: var(--et-font-mono); font-size: 12px; color: var(--et-muted); text-align: center; white-space: nowrap; }
.appgrid .sy-prev-b { display: block; width: 100%; margin-top: 3px; }
.appgrid .sy-prev-lab { margin-top: 5px; font-family: var(--et-font-mono); font-size: 12px; color: var(--et-muted); text-align: center; }
.appgrid .sy-prev-col.est-creux .sy-prev-v { font-weight: 700; color: var(--et-avertissement-ink); }
/* Sous 560 px, six valeurs de 45 px se touchent : seule reste celle du point bas, que l'en-tête
   du bloc écrit aussi en toutes lettres ; les autres restent au survol. */
@media (max-width: 559px) { .appgrid .sy-prev-col:not(.est-creux) .sy-prev-v { visibility: hidden; } }

/* ---- Listes (échéances, qualité, concentration, période, activité) ---- */
.appgrid .sy-liste { display: flex; flex-direction: column; }

.appgrid .sy-echeance,
.appgrid .sy-point,
.appgrid .sy-fait-l,
.appgrid .sy-q,
.appgrid .sy-conc {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    padding: 4px 0;
    border-top: 1px solid var(--et-hairline);
    font-size: var(--et-fs-cell);
    color: var(--et-ink);
}
.appgrid .sy-liste > *:first-child { border-top: 0; }
.appgrid .sy-lib { flex: 1; min-width: 0; }
.appgrid .sy-jour { flex: 0 0 44px; color: var(--et-muted); font-size: 12px; }
.appgrid .sy-echeance.est-total { border-top: 2px solid var(--et-filet-fort); font-weight: 700; }
.appgrid .sy-echeance .est-entree { color: var(--et-succes-ink); }
.appgrid .sy-echeance .est-negatif { color: var(--et-danger-ink); }

/* Qualité : la rangée entière mène à l'écran qui corrige. */
.appgrid .sy-q { font-weight: 400; text-decoration: none; }
.appgrid .sy-q:hover { background: var(--et-survol); }
.appgrid .sy-q-n { flex: none; min-width: 28px; text-align: right; font-weight: 700; }
.appgrid .sy-q-n.est-tenu { color: var(--et-succes-ink); }
.appgrid .sy-q-n.est-averti { color: var(--et-avertissement-ink); }
.appgrid .sy-q-n.est-refuse { color: var(--et-danger-ink); }
.appgrid .sy-q-sur { flex: none; font-size: 12px; color: var(--et-muted); }

/* Concentration : nom, piste, encours, part. Sous 720 px le nom prend sa ligne. */
.appgrid .sy-conc-nom { flex: 0 0 200px; min-width: 0; font-weight: 700; color: var(--et-ink); text-decoration: none; }
.appgrid .sy-conc-nom:hover { color: var(--et-lien); text-decoration: underline; }
.appgrid .sy-conc-m { flex: none; min-width: 96px; text-align: right; }
.appgrid .sy-conc-p { flex: 0 0 44px; text-align: right; font-weight: 700; }
@media (max-width: 720px) {
    .appgrid .sy-conc { flex-wrap: wrap; row-gap: 2px; }
    .appgrid .sy-conc-nom { flex: 1 0 100%; }
}

/* État de la période : la pastille est la seule forme ronde de l'écran (charte : les
   pastilles d'état gardent leur arrondi). */
.appgrid .sy-pastille {
    padding: var(--et-badge-py) var(--et-badge-px);
    border-radius: 999px;
    background: var(--et-avertissement-bg);
    color: var(--et-avertissement-ink);
    font-size: 12px;
    font-weight: 700;
}
.appgrid .sy-point > i { flex: none; width: 16px; text-align: center; }
.appgrid .sy-point.est-tenu > i { color: var(--et-succes-ink); }
.appgrid .sy-point.est-manquant > i { color: var(--et-danger-ink); }
.appgrid .sy-etat, .appgrid .sy-quand { flex: none; font-size: 12px; color: var(--et-muted); }
.appgrid .sy-point.est-manquant .sy-etat { font-weight: 600; color: var(--et-avertissement-ink); }

/* ---- Paliers ----------------------------------------------------------
   Échelle retenue de docs/conventions-responsive.md. La cible tactile de 44 px sous
   1024 px (lot 02) s'étend ici à tout ce qui mène ailleurs : les cartes de file, les
   rangées de qualité, les noms de la concentration et le pied des blocs. */
@media (max-width: 1024px) {
    .appgrid .sy-q,
    .appgrid .sy-conc-nom,
    .appgrid .sy-pied > a { min-height: 44px; display: flex; align-items: center; }
    .appgrid .sy-conc-nom { display: flex; }
    .appgrid .sy-file { min-height: 44px; }
}
