/*  ecran-tableau-flux.css — SYS-03.

    LE PRÉFIXE DE LA MAQUETTE EST `.fx-`, ET IL EST PRIS
    C'est celui du modèle de fiche historique (wwwroot/css/fiche.css, 99 règles,
    ~40 écrans), que la charte cite nommément dans CLAUDE.md. D'où `.tf-`.

    PORTÉ DU CANEVAS DE DESIGN « Tableau des flux SYS-03 » (2026-09-23) : barre de vues,
    tableau borné par ses deux trésoreries, chemin de la trésorerie en marches, bande de
    la ligne retenue, pied des bornes. La grammaire suit celle du bilan (ecran-bilan.css
    §4) sans en emprunter une classe : une classe servie à deux écrans monte au gabarit,
    elle ne se lit pas dans la feuille d'un autre écran.

    Aucune couleur écrite : tout est --et-*. Une couleur d'état n'est jamais une encre —
    le texte prend le rang -ink. Le commun du lot (contrôles, variation) vit dans
    etats-financiers.css. */

/* 1 · La barre d'outils : vues et bascules de lecture. */
.tf-barre {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--et-surface-2);
    border: 1px solid var(--et-hairline);
}

.tf-seg { display: flex; }

.tf-seg button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 14px;
    background: var(--et-surface);
    border: 1px solid var(--et-form-border);
    font-size: 12px;
    font-weight: 600;
    color: var(--et-ink);
    white-space: nowrap;
    cursor: pointer;
}

.tf-seg button + button { border-left: 0; }

.tf-seg button.est-actif {
    background: var(--et-table-head);
    border-color: var(--et-table-head);
    color: var(--et-sur-aplat);
}

.tf-seg-compte {
    min-width: 18px;
    padding: 0 5px;
    background: var(--et-avertissement-bg);
    color: var(--et-avertissement-ink);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    border-radius: 999px;
}

.tf-bascules {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    font-size: var(--et-fs-cell);
}

/* La case de Bootstrap flotte à -1.5em ; en flex, case et libellé restent sur une
   ligne quelle que soit la taille que la charte donne à la case (voir ecran-bilan.css). */
.tf-bascules .form-check {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 0;
    margin: 0;
    padding-left: 0;
    white-space: nowrap;
}

.tf-bascules .form-check-input { float: none; flex-shrink: 0; margin: 0; }
.tf-bascules .form-check-label { margin: 0; }

/* 2 · La ligne de contexte, et le sens de la variation en pastille. */
.tf-contexte {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    margin-bottom: 12px;
    font-size: var(--et-fs-cell);
    color: var(--et-muted);
}

.tf-contexte strong { color: var(--et-ink); }
.tf-contexte-alerte { font-weight: 600; color: var(--et-avertissement-ink); }
.tf-contexte-unite { margin-left: auto; }

.tf-pastille {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: var(--et-badge-py) var(--et-badge-px);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.tf-pastille.est-hausse { background: var(--et-succes-bg); color: var(--et-succes-ink); }
.tf-pastille.est-baisse { background: var(--et-danger-badge-bg); color: var(--et-danger-ink); }

/* L'exploitation qui ne couvre pas l'investissement : un avertissement, pas une erreur.
   L'ambre en marque est --et-avertissement-mark : l'ambre pur ne passe pas 3:1. */
.tf-bandeau {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 8px 14px;
    background: var(--et-avertissement-bg);
    border: 1px solid var(--et-hairline);
    box-shadow: inset 3px 0 0 var(--et-avertissement-mark);
    font-size: var(--et-fs-cell);
    font-weight: 600;
    color: var(--et-avertissement-ink);
}

/* 3 · Le tableau, borné par ses deux trésoreries. */
.tf-cadre {
    border: 1px solid var(--et-hairline);
    background: var(--et-surface);
}

.tf-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: var(--et-fs-cell);
}

.tf-table thead th {
    padding: var(--et-cellule-tete-y) 8px;
    background: var(--et-table-head);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--et-sur-aplat);
    white-space: nowrap;
}

.tf-table td {
    padding: 0 8px;
    height: 30px;
    border-bottom: 1px solid var(--et-rang);
    color: var(--et-ink);
}

.tf-table tbody tr:not(.tf-titre) { cursor: pointer; }
.tf-table tbody tr:not(.tf-titre):hover td { background: var(--et-survol); }

.tf-c-ref { width: 64px; }
.tf-c-num { width: 150px; text-align: right; white-space: nowrap; }
.tf-c-var { width: 100px; text-align: right; white-space: nowrap; }

.tf-table thead th.tf-c-num,
.tf-table thead th.tf-c-var { text-align: right; }

.tf-table td.tf-c-num {
    font-family: var(--et-font-mono);
    font-variant-numeric: tabular-nums;
}

.tf-pale { color: var(--et-muted) !important; }

/* Un décaissement en encre de danger : c'est le sens du flux, une donnée. */
.tf-n.est-sortie,
.tf-bande-mt.est-sortie,
.tf-compo .mnt.est-sortie,
.tf-source .mnt.est-sortie { color: var(--et-danger-ink); }

.tf-rep {
    display: inline-block;
    min-width: 30px;
    padding: 0 4px;
    background: var(--et-surface-3);
    border: 1px solid var(--et-form-border);
    font-family: var(--et-font-mono);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: var(--et-muted);
}

.tf-rep.est-borne { font-weight: 500; }

/* Le libellé est le bouton qui retient la ligne : la rangée entière est cliquable,
   le bouton porte le focus et l'état pour le clavier. */
.tf-lib {
    display: block;
    width: 100%;
    min-height: 30px;
    padding: 4px 0;
    background: none;
    border: 0;
    text-align: left;
    font: inherit;
    color: inherit;
    line-height: 1.35;
    cursor: pointer;
}

.tf-lib:focus-visible { outline: 2px solid var(--et-form-blue); outline-offset: -2px; }

.tf-titre td {
    height: auto;
    padding: 10px 8px 6px 72px;
    background: var(--et-surface);
    border-bottom: 1px solid var(--et-hairline);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--et-table-head-encre);
}

.tf-table tr.est-solde td {
    height: 34px;
    background: var(--et-surface-2);
    border-top: 1px solid var(--et-filet-fort);
    border-bottom: 1px solid var(--et-filet-fort);
    font-weight: 600;
}

.tf-table tr.est-solde .tf-lib { color: var(--et-table-head-encre); font-weight: 600; }

.tf-table tr.est-variation td {
    height: 36px;
    background: var(--et-surface-2);
    border-top: 2px solid var(--et-table-head);
    font-weight: 700;
}

.tf-table tr.est-variation .tf-lib { color: var(--et-table-head-encre); font-weight: 700; }

.tf-table tr.tf-borne td { font-weight: 600; }

.tf-table tr.tf-borne.est-final td {
    height: 40px;
    background: var(--et-info-bg);
    border-top: 2px solid var(--et-form-blue);
    border-bottom: 2px solid var(--et-form-blue);
    font-weight: 700;
    font-size: var(--et-fs-tete);
}

.tf-table tr.est-choisie td { background: var(--et-tint); }
.tf-table tr.est-choisie td:first-child { box-shadow: inset 3px 0 0 var(--et-form-blue); }

/* 4 · Le chemin de la trésorerie : les marches, puis les quatre lectures. */
.tf-chemin {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 20px;
    border: 1px solid var(--et-hairline);
    background: var(--et-surface);
}

.tf-chemin-tete { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.tf-chemin-tete h2 { margin: 0; font-size: var(--et-fs-tete); font-weight: 700; color: var(--et-ink); }
.tf-chemin-tete span { font-size: 12px; color: var(--et-muted); }

.tf-chemin-corps { display: flex; gap: 24px; }
.tf-marches-cadre { flex: 1 1 auto; min-width: 0; }

.tf-marches {
    display: flex;
    gap: 24px;
    height: 280px;
    padding: 0 12px;
    border-bottom: 2px solid var(--et-table-head);
}

.tf-marche { position: relative; flex: 1 1 0; min-width: 0; }

/* La hauteur et la position viennent du Razor : ce sont des données. */
.tf-barre-marche { position: absolute; left: 0; right: 0; }
.tf-barre-marche.est-borne { background: var(--et-table-head); }
.tf-barre-marche.est-entree { background: var(--et-succes); }
.tf-barre-marche.est-sortie { background: var(--et-danger); }

.tf-marche-mt {
    position: absolute;
    left: 0;
    right: 0;
    font-family: var(--et-font-mono);
    font-size: var(--et-fs-cell);
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.tf-marche-mt.est-borne { color: var(--et-table-head-encre); }
.tf-marche-mt.est-entree { color: var(--et-succes-ink); }
.tf-marche-mt.est-sortie { color: var(--et-danger-ink); }

.tf-marches-lib {
    display: flex;
    gap: 24px;
    padding: 8px 12px 0;
    font-size: var(--et-fs-cell);
    font-weight: 600;
    color: var(--et-ink);
}

.tf-marches-lib > div { flex: 1 1 0; min-width: 0; text-align: center; }

.tf-marches-liste { display: none; }

.tf-legende {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 8px 0 0;
    list-style: none;
    font-size: 12px;
    color: var(--et-ink);
}

.tf-legende li { display: flex; align-items: center; gap: 8px; }
.tf-puce { width: 14px; height: 14px; flex-shrink: 0; }
.tf-puce.est-borne { background: var(--et-table-head); }
.tf-puce.est-entree { background: var(--et-succes); }
.tf-puce.est-sortie { background: var(--et-danger); }

/* 5 · La ligne retenue : ce qu'elle vaut, d'où elle vient, comment elle se calcule. */
.tf-bande {
    display: grid;
    grid-template-columns: 300px minmax(0, 400px) minmax(0, 1fr);
    margin-top: 12px;
    border: 1px solid var(--et-hairline);
    border-top: 2px solid var(--et-table-head);
    background: var(--et-surface);
}

.tf-bande-col { min-width: 0; padding: 12px 16px; }
.tf-bande-col + .tf-bande-col { border-left: 1px solid var(--et-hairline); }

.tf-bande-ref {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: var(--et-fs-cell);
    font-weight: 600;
    line-height: 1.35;
    color: var(--et-ink);
}

.tf-bande-mt {
    margin-top: 8px;
    font-family: var(--et-font-mono);
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--et-ink);
}

.tf-bande-prec,
.tf-bande-sens { margin-top: 4px; font-size: 12px; color: var(--et-muted); }

.tf-bande-prec { font-family: var(--et-font-mono); }

.tf-bande-cap {
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--et-table-head-encre);
}

.tf-bande-formule { font-family: var(--et-font-mono); font-size: var(--et-fs-cell); color: var(--et-ink); }
.tf-bande-texte { font-size: var(--et-fs-cell); line-height: 1.5; color: var(--et-ink); }
.tf-bande-vide { font-size: 12px; color: var(--et-muted); }

.tf-compo,
.tf-source {
    display: flex;
    align-items: baseline;
    gap: 10px;
    width: 100%;
    padding: 2px 0;
    font-size: 12px;
    color: var(--et-ink);
}

.tf-compo {
    min-height: 28px;
    background: none;
    border: 0;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}

.tf-compo:hover:not(:disabled) .lib { color: var(--et-lien); text-decoration: underline; }
.tf-compo:disabled { cursor: default; }

.tf-compo .lib,
.tf-source .lib {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--et-muted);
}

.tf-source .rep {
    width: 56px;
    flex-shrink: 0;
    font-family: var(--et-font-mono);
    font-weight: 600;
    color: var(--et-ink);
}

.tf-compo .mnt,
.tf-source .mnt {
    flex-shrink: 0;
    font-family: var(--et-font-mono);
    font-variant-numeric: tabular-nums;
}

.tf-source.est-orpheline .mnt { color: var(--et-avertissement-ink); font-family: inherit; font-weight: 600; }

/* 6 · Le pied : les bornes qui ferment l'état, et le chemin vers les contrôles. */
.tf-pied {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 24px;
    margin-top: 12px;
    padding: 8px 14px;
    background: var(--et-surface-2);
    border: 1px solid var(--et-hairline);
}

.tf-pied-total { display: inline-flex; align-items: baseline; gap: 8px; }

.tf-pied-total > span {
    font-size: 12px;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--et-muted);
}

.tf-pied-total strong {
    font-family: var(--et-font-mono);
    font-size: var(--et-fs-tete);
    font-variant-numeric: tabular-nums;
    color: var(--et-ink);
}

.tf-pied-total.est-hausse strong { color: var(--et-succes-ink); }
.tf-pied-total.est-baisse strong { color: var(--et-danger-ink); }
.tf-pied-total.est-cloture strong { color: var(--et-lien); font-weight: 700; }

/* 7 · Paliers — échelle retenue (docs/conventions-responsive.md). */
@media (max-width: 1100px) {
    .tf-bande { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .tf-bande-col.est-methode { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--et-hairline); }
    .tf-legende { flex-basis: 160px; }
}

/* Cibles tactiles : 44 px sous 1024 px, jamais moins (docs/cibles-tactiles.md). */
@media (max-width: 1024px) {
    .tf-seg button { height: 44px; }
    .tf-table td { height: 44px; }
    .tf-lib, .tf-compo { min-height: 44px; }
    .tf-pied .btn { min-height: 44px; }
}

@media (max-width: 720px) {
    .tf-seg { width: 100%; }
    .tf-seg button { flex: 1 1 0; justify-content: center; padding: 0 8px; }
    .tf-contexte-unite { margin-left: 0; }
    /* Le tableau garde sa largeur utile et défile dans son cadre ; la page, elle, ne
       déborde pas. Quelle colonne est secondaire est une décision comptable, pas CSS. */
    .tf-cadre { overflow-x: auto; }
    .tf-table { min-width: 620px; }
    .tf-titre td { padding-left: 8px; }
    .tf-chemin { padding: 12px; }
    .tf-chemin-corps { flex-direction: column; gap: 12px; }
    .tf-marches { gap: 8px; height: 180px; padding: 0; }
    .tf-marche-mt, .tf-marches-lib { display: none; }
    .tf-legende { display: none; }
    .tf-marches-liste { display: flex; flex-direction: column; margin: 8px 0 0; font-size: var(--et-fs-cell); }
    .tf-marches-liste > div { display: flex; align-items: center; gap: 8px; min-height: 30px; border-bottom: 1px solid var(--et-rang); }
    .tf-marches-liste dt { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; font-weight: 600; color: var(--et-ink); }
    .tf-marches-liste dd { margin: 0; font-family: var(--et-font-mono); font-variant-numeric: tabular-nums; color: var(--et-ink); }
    .tf-marches-liste dd.est-sortie { color: var(--et-danger-ink); }
    .tf-marches-liste dd.est-entree { color: var(--et-succes-ink); }
    .tf-bande { grid-template-columns: minmax(0, 1fr); }
    .tf-bande-col + .tf-bande-col { border-left: 0; border-top: 1px solid var(--et-hairline); }
}
