/*  ecran-compte-resultat.css — SYS-02.

    Préfixe `.cr-`, celui de la maquette, vérifié libre : `cr-arrete` existait
    dans CreancesClient.razor mais comme IDENTIFIANT HTML, pas comme classe — donc
    aucune règle CSS ne le porte, et rien n'entre en concurrence.

    ALIGNÉ SUR LA GRAMMAIRE DU CANEVAS SYS-03 (2026-09-23) : barre de vues, tableau,
    bande de la ligne retenue, pied. Les mêmes rôles que ecran-tableau-flux.css, sous
    ce préfixe : une classe servie à deux écrans monte au gabarit, elle ne se lit pas
    dans la feuille d'un autre écran — et deux écrans ne font pas encore une règle.

    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. */
.cr-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);
}

.cr-seg { display: flex; }

.cr-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;
}

.cr-seg button + button { border-left: 0; }

.cr-seg button.est-actif {
    background: var(--et-table-head);
    border-color: var(--et-table-head);
    color: var(--et-sur-aplat);
}

.cr-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;
}

.cr-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). */
.cr-bascules .form-check {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 0;
    margin: 0;
    padding-left: 0;
    white-space: nowrap;
}

.cr-bascules .form-check-input { float: none; flex-shrink: 0; margin: 0; }
.cr-bascules .form-check-label { margin: 0; }

/* 2 · La ligne de contexte, et le sens du résultat en pastille. */
.cr-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);
}

.cr-contexte strong { color: var(--et-ink); }
.cr-contexte-alerte { font-weight: 600; color: var(--et-avertissement-ink); }
.cr-contexte-unite { margin-left: auto; }

.cr-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;
}

.cr-pastille.est-hausse { background: var(--et-succes-bg); color: var(--et-succes-ink); }
.cr-pastille.est-baisse { background: var(--et-danger-badge-bg); color: var(--et-danger-ink); }

/* 3 · Le tableau : postes de détail, soldes intermédiaires, résultat net. */
.cr-cadre {
    border: 1px solid var(--et-hairline);
    background: var(--et-surface);
}

.cr-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: var(--et-fs-cell);
}

.cr-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;
}

.cr-table td {
    padding: 0 8px;
    height: 30px;
    border-bottom: 1px solid var(--et-rang);
    color: var(--et-ink);
}

.cr-table tbody tr { cursor: pointer; }
.cr-table tbody tr:hover td { background: var(--et-survol); }

.cr-c-ref { width: 64px; }
.cr-c-num { width: 150px; text-align: right; white-space: nowrap; }
.cr-c-var { width: 100px; text-align: right; white-space: nowrap; }
.cr-c-ca { width: 90px; text-align: right; white-space: nowrap; }

.cr-table thead th.cr-c-num,
.cr-table thead th.cr-c-var,
.cr-table thead th.cr-c-ca { text-align: right; }

.cr-table td.cr-c-num,
.cr-table td.cr-c-ca {
    font-family: var(--et-font-mono);
    font-variant-numeric: tabular-nums;
}

.cr-pale { color: var(--et-muted) !important; }

/* Une charge en encre de danger : c'est le signe du poste, une donnée. */
.cr-n.est-charge,
.cr-bande-mt.est-charge,
.cr-compo .mnt.est-charge,
.cr-compte .mnt.est-charge { color: var(--et-danger-ink); }

.cr-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);
}

/* 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. */
.cr-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;
}

.cr-lib:focus-visible { outline: 2px solid var(--et-form-blue); outline-offset: -2px; }

/* Un poste sans compte rattaché reste toujours à zéro : un signe, pas une alerte. */
.cr-sans-compte { color: var(--et-avertissement-ink); }

.cr-table tr.est-detail .cr-lib { padding-left: 16px; }

.cr-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;
}

.cr-table tr.est-solde .cr-lib { color: var(--et-table-head-encre); font-weight: 600; }

.cr-table tr.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);
}

.cr-table tr.est-final .cr-lib { font-weight: 700; }

.cr-table tr.est-choisie td { background: var(--et-tint); }
.cr-table tr.est-choisie td:first-child { box-shadow: inset 3px 0 0 var(--et-form-blue); }

.cr-aucun { padding: 16px 12px !important; text-align: center; color: var(--et-muted) !important; }

/* La marche de la cascade : ce que l'étage a coûté par rapport au précédent.
   En chasse fixe, sans couleur — le signe d'une marche ne dit pas si elle est
   bonne : descendre après la valeur ajoutée est normal, c'est l'ampleur qui
   compte, et l'ampleur se lit dans le nombre. */
.cr-marche {
    font-family: var(--et-font-mono);
    font-weight: 600;
}

/* 4 · La ligne retenue : ce qu'elle vaut, d'où elle vient, comment elle se calcule. */
.cr-bande {
    display: grid;
    grid-template-columns: 300px minmax(0, 420px) minmax(0, 1fr);
    margin-top: 12px;
    border: 1px solid var(--et-hairline);
    border-top: 2px solid var(--et-table-head);
    background: var(--et-surface);
}

.cr-bande-col { min-width: 0; padding: 12px 16px; }
.cr-bande-col + .cr-bande-col { border-left: 1px solid var(--et-hairline); }

.cr-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);
}

.cr-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);
}

.cr-bande-prec,
.cr-bande-sens { margin-top: 4px; font-size: 12px; color: var(--et-muted); }

.cr-bande-prec { font-family: var(--et-font-mono); }

.cr-bande-cap {
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--et-table-head-encre);
}

.cr-bande-texte { font-size: var(--et-fs-cell); line-height: 1.5; color: var(--et-ink); }
.cr-bande-vide { font-size: 12px; color: var(--et-muted); }

.cr-compo,
.cr-compte {
    display: flex;
    align-items: baseline;
    gap: 10px;
    width: 100%;
    min-height: 28px;
    padding: 2px 0;
    font-size: 12px;
    color: var(--et-ink);
    text-decoration: none;
}

.cr-compo {
    background: none;
    border: 0;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}

.cr-compo:hover:not(:disabled) .lib,
.cr-compte:hover .lib { color: var(--et-lien); text-decoration: underline; }

.cr-compo:disabled { cursor: default; }

.cr-compo .lib,
.cr-compte .lib {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--et-muted);
}

.cr-compte .rep {
    width: 72px;
    flex-shrink: 0;
    font-family: var(--et-font-mono);
    font-weight: 600;
    color: var(--et-ink);
}

.cr-compo .mnt,
.cr-compte .mnt {
    flex-shrink: 0;
    font-family: var(--et-font-mono);
    font-variant-numeric: tabular-nums;
}

/* 5 · Le pied : la cascade contre la balance, et le chemin vers les contrôles. */
.cr-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);
}

.cr-pied-total { display: inline-flex; align-items: baseline; gap: 8px; }

.cr-pied-total > span {
    font-size: 12px;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--et-muted);
}

.cr-pied-total strong {
    font-family: var(--et-font-mono);
    font-size: var(--et-fs-tete);
    font-variant-numeric: tabular-nums;
    color: var(--et-ink);
}

/* 6 · Paliers — échelle retenue (docs/conventions-responsive.md). */
@media (max-width: 1100px) {
    .cr-bande { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .cr-bande-col:last-child { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--et-hairline); }
}

/* Cibles tactiles : 44 px sous 1024 px, jamais moins (docs/cibles-tactiles.md). */
@media (max-width: 1024px) {
    .cr-seg button { height: 44px; }
    .cr-table td { height: 44px; }
    .cr-lib, .cr-compo, .cr-compte { min-height: 44px; }
    .cr-compo, .cr-compte { align-items: center; }
    .cr-pied .btn { min-height: 44px; }
}

@media (max-width: 720px) {
    .cr-seg { width: 100%; }
    .cr-seg button { flex: 1 1 0; justify-content: center; padding: 0 8px; white-space: normal; text-align: center; }
    .cr-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. */
    .cr-cadre { overflow-x: auto; }
    /* 720 px et des montants à 118 : à 620 px, la vue Soldes ne laissait que 66 px au
       libellé une fois posées ses cinq colonnes chiffrées (mesuré à 390 px). */
    .cr-table { min-width: 720px; }
    .cr-c-num { width: 118px; }
    .cr-bande { grid-template-columns: minmax(0, 1fr); }
    .cr-bande-col + .cr-bande-col { border-left: 0; border-top: 1px solid var(--et-hairline); }
}
