/* ============================================================================
   JOURNAL DES TRANSACTIONS — /app/transactions
   Passation « design_handoff_transactions » (Design 21).

   SA FEUILLE, ET RIEN QUE LA SIENNE. Deux repères visuels qui n'existent que sur cet
   écran. Ce qui habille le sélecteur de bornes (.per-*) n'est PAS ici : ce composant est
   partagé, il vit dans le gabarit — sinon le deuxième écran qui le poserait dépendrait de
   la feuille de celui-ci pour s'afficher.

   Aucune couleur en dur : tout passe par les jetons --et-*, c'est par eux que le mode
   sombre existe.
   ========================================================================= */

/* ---------------------------------------------------------------------------
   LE REPÈRE DE DIVERGENCE, entre l'état DÉCLARÉ par le terminal et le sens RETENU
   au calcul.

   AMBRE, JAMAIS ROUGE, et c'est tout le propos : la résolution a fait son travail, elle
   n'a pas échoué. Sur un parc non configuré en Entrée/Sortie l'état brut vaut 0 partout —
   la divergence y est la règle, pas l'anomalie, et un journal rouge sur toutes ses lignes
   n'apprendrait plus rien à personne.

   Le signe est un ≠ et non une icône : il tient dans la pastille de sens, contre le mot
   qu'il nuance, là où une icône en fin de cellule se rattacherait à la ligne entière. */
.tbl-divergent {
    margin-left: 4px;
    font-family: var(--et-font-mono);
    font-size: 12px;
    color: var(--et-avertissement-ink);
}

/* ---------------------------------------------------------------------------
   LE MATRICULE SANS RATTACHEMENT DE CALCUL.

   Un badge que le moteur ignore n'est pas une case vide : c'est le numéro brut lu par le
   terminal, et la seule prise pour aller le rattacher. Il garde donc sa pastille de code,
   en rouge — le seul cas de l'écran où quelqu'un est venu travailler et où le système
   l'ignore, la journée sortant absente sans que rien d'autre ne le dise. */
.code-chip.est-alerte {
    background: var(--et-danger-badge-bg);
    color: var(--et-danger-ink);
}

/* ---------------------------------------------------------------------------
   LA BASCULE « ÉCARTÉES » de la barre d'outils, à l'état actif.

   .mx-btn n'a pas d'état retenu dans le gabarit : ses boutons agissent et retombent. Ici
   le bouton FILTRE, donc il reste enfoncé tant que la vue est réduite — sans quoi un
   journal de trois lignes passerait pour un journal vide. Le repère reprend celui de
   .tbl-btn-filtre juste à côté, qui dit déjà « une réduction est en cours ». */
.mx-btn.est-actif {
    border-color: var(--et-form-blue);
    background: var(--et-tint);
    color: var(--et-form-blue-d);
}
.appgrid[data-theme="dark"] .mx-btn.est-actif { background: rgba(123, 162, 228, .14); color: var(--et-form-blue-encre); }

/* ===========================================================================
   PORT DE LA MAQUETTE DU 2026-10-04 (« design_handoff_transactions »).

   Tuiles, bandeau et onglets viennent du gabarit (modele-erp.css §11.x). Cette feuille
   porte ce qui ne sert que cet écran : la barre onglets + recherche, la table REGROUPÉE
   PAR JOUR (un <tbody> par jour, sa ligne de tête), ses cartes sous 1024 px, et l'aperçu
   en panneau latéral — passé au-dessus de la liste sous 1024 px.
   ========================================================================= */

.trx-outils { align-items: center; flex-wrap: wrap; max-width: 100%; }
.trx-outils .mx-btn { min-height: 44px; }

/* --- Le bandeau ------------------------------------------------------------ */
.trx-signal-titre { font-size: 14px; color: var(--et-ink); }
.trx-signal-ligne { flex-wrap: wrap; align-items: center; }
.trx-signal-txt { flex: 1 1 280px; min-width: 0; font-size: 13px; color: var(--et-ink); }
.trx-signal-detail { color: var(--et-ink); }
.trx-signal-ligne .mx-signal-marque { margin-top: 0; }
.trx-signal-ligne .mx-signal-acte { min-height: 44px; display: inline-flex; align-items: center; }

/* --- Corps : la liste et l'aperçu côte à côte ------------------------------ */
.trx-corps { display: flex; gap: 16px; align-items: flex-start; }
.trx-carte { flex: 1 1 640px; min-width: 0; padding: 0; display: flex; flex-direction: column; }

.trx-barre {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px;
    padding: 0 16px 0 0; border-bottom: 1px solid var(--et-hairline);
}
.trx-vues { flex: 0 1 auto; border-bottom: 0; max-width: 100%; }
.trx-recherche-bloc { display: flex; gap: 8px; flex: 1 1 320px; min-width: 0; justify-content: flex-end; padding: var(--et-criteres-py) 0; }
.trx-recherche {
    flex: 1 1 200px; max-width: 360px; display: flex; align-items: center; gap: 8px;
    height: 44px; margin: 0; padding: 0 12px; border: 1px solid var(--et-bord-champ); background: var(--et-surface);
}
.trx-recherche .bi { color: var(--et-muted); }
.trx-recherche input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--et-ink); }
.trx-recherche input:focus { outline: none; }
.trx-recherche:focus-within { border-color: var(--et-form-blue); }
.trx-terminal { height: 44px; width: auto; max-width: 220px; }

/* --- La table regroupée par jour ------------------------------------------- */
.trx-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.trx-table thead th {
    padding: var(--et-cellule-tete-y) 12px; background: var(--et-table-head); text-align: left; white-space: nowrap;
    font-size: 12px; font-weight: 600; color: var(--et-sur-ardoise-plein);
}
.trx-jour th {
    padding: 8px 16px; background: var(--et-surface-2); border-bottom: 1px solid var(--et-hairline);
    text-align: left; font-size: 13px; font-weight: 400; color: var(--et-muted);
}
.trx-jour strong { color: var(--et-ink); }
.trx-ligne { cursor: pointer; }
.trx-ligne > td { padding: var(--et-cellule-y) 12px; border-bottom: 1px solid var(--et-rang); color: var(--et-ink); vertical-align: middle; }
@media (max-width: 1024px) { .trx-ligne > td { height: 44px; } }   /* règle tactile, sous 1024 px seulement : posée dès le bureau, la hauteur figeait la ligne (lot AK2) */
.trx-ligne:hover > td { background: var(--et-survol); }
.trx-ligne:focus-visible { outline: 2px solid var(--et-form-blue); outline-offset: -2px; }
.trx-c-heure { width: 64px; font-family: var(--et-font-mono); }
.trx-c-code { width: 80px; font-family: var(--et-font-mono); font-size: 13px; font-weight: 600; white-space: nowrap; }
.trx-c-sens { width: 100px; }
.trx-c-nom { font-weight: 600; }
.trx-c-nom.est-inconnu { color: var(--et-danger-ink); }
.trx-c-terminal { font-size: 13px; color: var(--et-muted); }
.trx-c-sort .mx-pastille { white-space: nowrap; }

/* Ce qui sortira faux : fond rouge pâle et filet à gauche. Le passage ouvert dans
   l'aperçu prend le bleu, qui l'emporte. */
.trx-ligne.est-grave > td { background: var(--et-danger-badge-bg); }
.trx-ligne.est-grave > td:first-child { box-shadow: inset 3px 0 0 var(--et-danger); }
.trx-ligne.est-choisi > td { background: var(--et-tint); }
.trx-ligne.est-choisi > td:first-child { box-shadow: inset 3px 0 0 var(--et-form-blue); }

.trx-sens {
    display: inline-flex; align-items: center; padding: 1px 10px; border-radius: var(--et-r-pill);
    font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--et-tint); color: var(--et-form-blue-d);
}
.trx-sens.est-sortie { background: var(--et-neutre-bg); color: var(--et-neutre); }

.trx-pied {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px;
    padding: 10px 16px; border-top: 1px solid var(--et-hairline); font-size: 13px; color: var(--et-muted);
}
.trx-pied .tbl-methode { padding: 0; border: 0; flex: 1 1 360px; text-align: right; }

/* --- L'aperçu ---------------------------------------------------------------- */
.trx-apercu {
    flex: 0 1 420px; min-width: 0; background: var(--et-surface); border: 1px solid var(--et-hairline);
    position: sticky; top: 16px;
}
.trx-apercu-tete {
    display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px;
    background: var(--et-form-blue); color: var(--et-sur-aplat);
}
.trx-apercu-titre { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.trx-apercu-titre strong { font-size: 16px; }
.trx-apercu-titre span { font-size: 13px; color: var(--et-sur-aplat-doux); }
.trx-apercu-fermer {
    flex: none; width: 44px; height: 44px; display: inline-grid; place-items: center;
    border: 1px solid var(--et-fond-marine-survol); background: transparent; color: var(--et-sur-aplat); cursor: pointer;
}
.trx-apercu-fermer:hover { background: var(--et-fond-marine-doux); }
.trx-apercu-corps { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; }

.trx-sort-boite {
    display: flex; flex-direction: column; gap: 4px; padding: 10px 12px;
    border-left: 4px solid var(--et-neutre); background: var(--et-neutre-bg); color: var(--et-ink); font-size: 13px;
}
.trx-sort-boite .lbl { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.trx-sort-boite strong { font-size: 14px; }
.trx-sort-boite.est-negatif  { background: var(--et-danger-badge-bg); border-left-color: var(--et-danger); color: var(--et-danger-ink); }
.trx-sort-boite.est-positif  { background: var(--et-succes-bg); border-left-color: var(--et-succes); color: var(--et-succes-ink); }
.trx-sort-boite.est-attente  { background: var(--et-avertissement-bg); border-left-color: var(--et-avertissement-mark); color: var(--et-avertissement-ink); }

.trx-apercu-champs {
    display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 14px;
}
.trx-apercu-champs dt { font-weight: 400; color: var(--et-muted); }
.trx-apercu-champs dd { margin: 0; color: var(--et-ink); overflow-wrap: anywhere; }
.trx-mono { font-family: var(--et-font-mono); }
.trx-apercu-lien { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; text-align: center; white-space: normal; }

/* --- Sous 1024 px : une carte par passage, l'aperçu au-dessus ---------------- */
@media (max-width: 1024px) {
    .trx-corps { flex-direction: column; align-items: stretch; }
    .trx-apercu { order: -1; flex: none; position: static; }
    .trx-barre { padding: 0; }
    .trx-vues { overflow-x: auto; }
    .trx-recherche-bloc { padding: var(--et-criteres-py) 16px; flex-basis: 100%; }
    .trx-recherche { max-width: none; }

    .trx-table, .trx-table tbody { display: block; width: 100%; }
    .trx-table thead { display: none; }
    .trx-jour, .trx-jour th { display: block; }
    .trx-ligne {
        display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center;
        gap: 6px 8px; padding: 10px 16px; border-bottom: 1px solid var(--et-rang);
    }
    .trx-ligne > td { display: block; height: auto; padding: 0; border: 0; width: auto; }
    .trx-ligne.est-grave { background: var(--et-danger-badge-bg); box-shadow: inset 3px 0 0 var(--et-danger); }
    .trx-ligne.est-choisi { background: var(--et-tint); box-shadow: inset 3px 0 0 var(--et-form-blue); }
    .trx-ligne.est-grave > td, .trx-ligne.est-choisi > td, .trx-ligne:hover > td,
    .trx-ligne.est-grave > td:first-child, .trx-ligne.est-choisi > td:first-child { background: none; box-shadow: none; }
    .trx-c-heure { font-weight: 600; }
    .trx-c-nom { min-width: 0; overflow-wrap: anywhere; }
    .trx-c-terminal { grid-column: 1 / 4; }
    .trx-c-sort { grid-column: 4; justify-self: end; }
    .trx-pied .tbl-methode { text-align: left; }
}
@media (max-width: 559px) {
    .trx-recherche-bloc { flex-wrap: wrap; }
    .trx-terminal { max-width: none; flex: 1 1 100%; }
    .trx-ligne { grid-template-columns: auto minmax(0, 1fr) auto; }
    .trx-c-nom { grid-column: 1 / 3; grid-row: 2; }
    .trx-c-sens { grid-column: 3; grid-row: 1; justify-self: end; }
    .trx-c-terminal { grid-column: 1 / 3; }
    .trx-c-sort { grid-column: 3; }
    .trx-apercu-champs { grid-template-columns: 1fr; gap: 2px; }
    .trx-apercu-champs dd { margin-bottom: 8px; }
}
@media print {
    .trx-barre, .trx-outils, .trx-apercu { display: none !important; }
}
