/* LA PAGE DES FINANCES D'ALINÉA. Le langage de la maquette approuvée (commit 113b6ad), repris tel quel.
   Seuls ajouts, l'écran de connexion, l'état d'erreur d'une vue et la puce ambre de QuickBooks (section 11). */

/* ===== 1. Le système, en jetons. Un bloc neuf prend un jeton, jamais un nombre. ===== */
:root {
  color-scheme: light;
  /* Typographie, six tailles, trois graisses, deux familles */
  --police-ui: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --police-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --police-titre: var(--police-ui);
  --t-1: 12px; --t-2: 14px; --t-3: 16px; --t-4: 20px; --t-5: 28px; --t-6: 48px;
  --g-1: 400; --g-2: 500; --g-3: 600;
  /* Espacement, base 4 */
  --e-1: 4px; --e-2: 8px; --e-3: 12px; --e-4: 16px; --e-5: 24px; --e-6: 32px; --e-7: 48px;
  /* Trois rayons, deux ombres. La première est nulle, les filets font le travail. */
  --r-1: 6px; --r-2: 12px; --r-3: 999px;
  --o-1: none;
  --o-2: 0 16px 40px -12px rgba(18, 36, 22, .22), 0 2px 8px rgba(18, 36, 22, .06);
  --duree: 200ms; --courbe: cubic-bezier(.2, .7, .2, 1);

  /* Couleurs, dérivées du vert #104b0b et du bleu #afd8e2 d'Alinéa */
  --coquille: #f4f4f1;
  --fond: #ffffff; --surface: #ffffff; --surface-2: #f7f8f5; --surface-3: #eef0eb;
  --trait: #e7e9e4; --trait-fort: #d4d8d0;
  --encre: #16201a; --encre-2: #48534b; --encre-3: #5d6860;
  --marque: #104b0b; --marque-doux: #e7f0e4; --sur-marque: #ffffff;
  --banniere: #104b0b; --banniere-2: #c9dec3;
  --bleu-marque: #afd8e2;
  --focus: #1d6b16;
  --positif: #1d6b16; --positif-doux: #e7f2e5;
  --negatif: #b42318; --negatif-doux: #fdecea; --negatif-trait: #f3c3bd;
  --alerte: #855800; --alerte-doux: #fff2d2; --alerte-trait: #f0d999;
  --estime: #175a6b; --estime-doux: #e3f1f5; --estime-trait: #8fc3d1;
  --s-encaisse: #1d6b16; --s-nette: #1f86ad; --s-couts: #b4580c; --s-total: #3b4a40;
  --saison: rgba(240, 196, 80, .16); --saison-encre: #6b4d00;
  --coussin-zone: rgba(180, 35, 24, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --coquille: #0b0f0c;
    --fond: #111612; --surface: #111612; --surface-2: #161c18; --surface-3: #1e2620;
    --trait: #232b25; --trait-fort: #343f37;
    --encre: #edf2ec; --encre-2: #b8c3ba; --encre-3: #97a39a;
    --marque: #9ad18c; --marque-doux: #1d3020; --sur-marque: #0e1310;
    --banniere: #174a12; --banniere-2: #c9dec3;
    --focus: #9ad18c;
    --positif: #7cd36f; --positif-doux: #173019;
    --negatif: #ff8f80; --negatif-doux: #3a1a17; --negatif-trait: #6b2c25;
    --alerte: #f0c060; --alerte-doux: #33290f; --alerte-trait: #5e4a17;
    --estime: #8ccbdc; --estime-doux: #14303a; --estime-trait: #2f6474;
    --s-encaisse: #4fa845; --s-nette: #3a9cc4; --s-couts: #d07a33; --s-total: #c3cdc5;
    --saison: rgba(240, 192, 96, .09); --saison-encre: #e7c46c;
    --coussin-zone: rgba(255, 143, 128, .07);
    --o-2: 0 16px 40px -12px rgba(0, 0, 0, .7), 0 2px 8px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --coquille: #0b0f0c;
  --fond: #111612; --surface: #111612; --surface-2: #161c18; --surface-3: #1e2620;
  --trait: #232b25; --trait-fort: #343f37;
  --encre: #edf2ec; --encre-2: #b8c3ba; --encre-3: #97a39a;
  --marque: #9ad18c; --marque-doux: #1d3020; --sur-marque: #0e1310;
  --banniere: #174a12; --banniere-2: #c9dec3;
  --focus: #9ad18c;
  --positif: #7cd36f; --positif-doux: #173019;
  --negatif: #ff8f80; --negatif-doux: #3a1a17; --negatif-trait: #6b2c25;
  --alerte: #f0c060; --alerte-doux: #33290f; --alerte-trait: #5e4a17;
  --estime: #8ccbdc; --estime-doux: #14303a; --estime-trait: #2f6474;
  --s-encaisse: #4fa845; --s-nette: #3a9cc4; --s-couts: #d07a33; --s-total: #c3cdc5;
  --saison: rgba(240, 192, 96, .09); --saison-encre: #e7c46c;
  --coussin-zone: rgba(255, 143, 128, .07);
  --o-2: 0 16px 40px -12px rgba(0, 0, 0, .7), 0 2px 8px rgba(0, 0, 0, .4);
}

/* ===== 2. Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--coquille); color: var(--encre);
  font: var(--g-1) var(--t-2)/1.5 var(--police-ui);
  font-feature-settings: "tnum" 1, "ss01" 1; font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
b, strong, th { font-weight: var(--g-3); }
h1 { font: var(--g-3) var(--t-5)/1.05 var(--police-ui); letter-spacing: -.03em; }
@media (min-width: 720px) { h1 { font-size: var(--t-6); letter-spacing: -.04em; } }
h2 { font-size: var(--t-3); font-weight: var(--g-3); line-height: 1.3; letter-spacing: -.01em; }
h3 { font-size: var(--t-2); font-weight: var(--g-3); }
button, input, select { font: inherit; color: inherit; font-feature-settings: inherit; }
button { cursor: pointer; }
svg { display: block; }
.icone { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icone.p { width: 14px; height: 14px; }
.icone.g { width: 20px; height: 20px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-1); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { white-space: nowrap; }
.mono { font-family: var(--police-mono); font-size: var(--t-1); font-weight: var(--g-1); letter-spacing: .08em; text-transform: uppercase; color: var(--encre-3); }
.discret { color: var(--encre-3); font-size: var(--t-1); }
.second { color: var(--encre-2); font-size: var(--t-2); }

/* ===== 3. Coquille, barre du haut, barre latérale, panneau central ===== */
.barre { display: flex; align-items: center; gap: var(--e-3); padding: var(--e-2) var(--e-4); background: var(--coquille); flex-wrap: wrap; }
.fil { display: flex; align-items: center; gap: var(--e-2); margin-right: auto; min-width: 0; font-size: var(--t-2); }
.fil .logo {
  width: 24px; height: 24px; border-radius: var(--r-1); background: var(--marque); color: var(--sur-marque); flex: none;
  display: grid; place-items: center; font-weight: var(--g-3); font-size: var(--t-2); letter-spacing: -.02em;
}
.fil .sep { color: var(--trait-fort); }
.fil .actuel { color: var(--encre-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fil .nom { font-weight: var(--g-2); display: inline-flex; align-items: center; gap: 2px; }
.btn-icone {
  width: 32px; height: 32px; border-radius: var(--r-1); border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; color: var(--encre-2); flex: none;
}
.btn-icone:hover { background: var(--surface-3); color: var(--encre); }
.recherche {
  display: none; align-items: center; gap: var(--e-2); min-width: 240px; height: 32px; padding: 0 var(--e-2) 0 var(--e-3);
  border: 1px solid var(--trait); border-radius: var(--r-1); background: var(--surface); color: var(--encre-3); font-size: var(--t-2);
}
.recherche kbd { margin-left: auto; font-family: var(--police-mono); font-size: var(--t-1); border: 1px solid var(--trait); border-radius: var(--r-1); padding: 0 var(--e-1); color: var(--encre-3); }
.avatar { width: 28px; height: 28px; border-radius: var(--r-3); display: grid; place-items: center; background: var(--marque-doux); color: var(--marque); font-size: var(--t-1); font-weight: var(--g-3); flex: none; }
.fraicheur { display: flex; gap: var(--e-2); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.fraicheur::-webkit-scrollbar { display: none; }
.app { display: grid; grid-template-columns: 1fr; min-height: calc(100vh - 80px); }
.cote {
  position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(288px, 86vw); background: var(--coquille);
  border-right: 1px solid var(--trait); padding: var(--e-4) var(--e-3); display: flex; flex-direction: column; gap: var(--e-4);
  transform: translateX(-102%); transition: transform var(--duree) var(--courbe); overflow-y: auto;
}
.cote.ouvert { transform: none; box-shadow: var(--o-2); }
.voile { position: fixed; inset: 0; z-index: 40; background: rgba(10, 16, 12, .4); }
.voile[hidden] { display: none; }
.nav-groupe { display: grid; gap: 2px; }
.nav-titre { font-size: var(--t-1); color: var(--encre-3); padding: var(--e-3) var(--e-3) var(--e-1); }
.onglet {
  display: flex; align-items: center; gap: var(--e-3); width: 100%; text-align: left;
  border: 1px solid transparent; background: none; color: var(--encre-2); border-radius: var(--r-1);
  padding: 6px var(--e-3); font-size: var(--t-2); font-weight: var(--g-1); min-height: 34px;
  transition: background var(--duree) var(--courbe), color var(--duree);
}
.onglet:hover { background: var(--surface-3); color: var(--encre); }
.onglet[aria-selected="true"] { background: var(--surface); color: var(--encre); border-color: var(--trait); font-weight: var(--g-2); }
.onglet .compte { margin-left: auto; }
.compte {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-3); display: inline-grid; place-items: center;
  font-size: var(--t-1); font-weight: var(--g-3); background: var(--marque); color: var(--sur-marque);
}
.compte.neg { background: var(--negatif); color: var(--surface); }
.cote-pied { margin-top: auto; display: grid; gap: 2px; }
.cote-pied .note { font-size: var(--t-1); color: var(--encre-3); padding: var(--e-2) var(--e-3) 0; }
.panneau { background: var(--fond); min-width: 0; border-top: 1px solid var(--trait); }
main { max-width: 1120px; margin: 0 auto; padding: var(--e-5) var(--e-4) var(--e-7); }
section[hidden] { display: none; }
@media (min-width: 720px) {
  .recherche { display: inline-flex; }
  main { padding: var(--e-7) var(--e-6) var(--e-7); }
}
@media (max-width: 719px) {
  .barre .fraicheur { order: 5; width: 100%; }
  .fil .sep.deux, .fil .actuel { display: none; }
}
@media (min-width: 1024px) {
  .app { grid-template-columns: 232px 1fr; }
  .cote { position: sticky; top: 0; height: calc(100vh - 48px); transform: none; width: auto; border-right: 0; padding: var(--e-2) var(--e-3) var(--e-4); box-shadow: none; z-index: 1; }
  .btn-menu { display: none; }
  .voile { display: none; }
  .panneau { border: 1px solid var(--trait); border-right: 0; border-bottom: 0; border-top-left-radius: var(--r-2); }
}
/* ===== 4. Composants ===== */
.entete-page { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--e-3) var(--e-5); margin-bottom: var(--e-2); }
.entete-page .sur-titre { font-size: var(--t-1); font-weight: var(--g-2); color: var(--encre-3); letter-spacing: .06em; text-transform: uppercase; margin-bottom: var(--e-1); }
.entete-page p.sous { color: var(--encre-2); font-size: var(--t-2); margin-top: var(--e-1); max-width: 64ch; }
.grille { display: grid; gap: var(--e-4); }
@media (min-width: 720px) {
  .grille.c2 { grid-template-columns: 1fr 1fr; }
  .grille.c3 { grid-template-columns: repeat(3, 1fr); }
  .grille.c4 { grid-template-columns: repeat(2, 1fr); }
  .grille.c2-1 { grid-template-columns: 2fr 1fr; }
  .grille.c1-2 { grid-template-columns: 1fr 2fr; }
}
@media (min-width: 1100px) { .grille.c4 { grid-template-columns: repeat(4, 1fr); } }
.pile { display: grid; gap: var(--e-4); align-content: start; }
section > * + * { margin-top: var(--e-4); }
.carte {
  background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r-2); box-shadow: var(--o-1);
  padding: var(--e-4); min-width: 0; position: relative;
}
@media (min-width: 720px) { .carte { padding: var(--e-5); } }
.carte-tete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--e-2) var(--e-4); margin-bottom: var(--e-4); }
.carte-tete .second { margin-top: 2px; }
.etiquette { font-size: var(--t-1); font-weight: var(--g-2); color: var(--encre-3); letter-spacing: .02em; }
.valeur { font-size: var(--t-5); font-weight: var(--g-3); line-height: 1.15; letter-spacing: -.02em; margin-top: var(--e-1); display: flex; align-items: center; gap: var(--e-2); flex-wrap: wrap; }
.valeur.moyenne { font-size: var(--t-4); }
.valeur.heros { font-size: var(--t-6); line-height: 1; letter-spacing: -.03em; }
.valeur.neg { color: var(--negatif); }
.valeur.pos { color: var(--positif); }

.pastille {
  display: inline-flex; align-items: center; gap: var(--e-1); padding: 2px var(--e-2); border-radius: var(--r-3);
  font-size: var(--t-1); font-weight: var(--g-3); line-height: 18px; white-space: nowrap;
  background: var(--surface-3); color: var(--encre-2); border: 1px solid transparent;
}
.pastille.pos { background: var(--positif-doux); color: var(--positif); }
.pastille.neg { background: var(--negatif-doux); color: var(--negatif); }
.pastille.alerte { background: var(--alerte-doux); color: var(--alerte); }
.pastille.estime { background: var(--estime-doux); color: var(--estime); }
.pastille.marque { background: var(--marque-doux); color: var(--marque); }
.pastille.grande { font-size: var(--t-2); padding: var(--e-1) var(--e-3) var(--e-1) var(--e-2); line-height: 20px; }
.puce-source {
  display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-1); font-weight: var(--g-2);
  padding: var(--e-1) var(--e-3) var(--e-1) var(--e-2); border-radius: var(--r-3); border: 1px solid var(--trait); background: var(--surface); color: var(--encre-2);
}
.puce-source .point { width: 8px; height: 8px; border-radius: var(--r-3); background: var(--positif); box-shadow: 0 0 0 3px var(--positif-doux); }
.puce-source.vieux { color: var(--negatif); border-color: var(--negatif-trait); background: var(--negatif-doux); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e-2); min-height: 40px; padding: 0 var(--e-4);
  border-radius: var(--r-1); border: 1px solid var(--marque); background: var(--marque); color: var(--sur-marque);
  font-size: var(--t-2); font-weight: var(--g-3); transition: transform var(--duree) var(--courbe), filter var(--duree);
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.contour { background: var(--surface); color: var(--encre); border-color: var(--trait-fort); }
.btn.contour:hover { background: var(--surface-2); filter: none; }
.btn.fantome { background: transparent; border-color: transparent; color: var(--encre-2); padding: 0 var(--e-2); }
.btn.fantome:hover { color: var(--encre); background: var(--surface-2); filter: none; }
.btn.petit { min-height: 32px; padding: 0 var(--e-3); font-size: var(--t-1); }
.lien { background: none; border: 0; padding: 0; color: var(--marque); font-weight: var(--g-3); font-size: inherit; display: inline-flex; gap: var(--e-1); align-items: center; }
.lien:hover { text-decoration: underline; text-underline-offset: 3px; }

.seg { display: inline-flex; padding: 3px; border-radius: var(--r-1); background: var(--surface-3); gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; border-radius: var(--r-1); padding: 6px var(--e-3); font-size: var(--t-1); font-weight: var(--g-2);
  color: var(--encre-2); display: inline-flex; align-items: center; gap: 6px; min-height: 32px;
}
.seg button[aria-pressed="true"], .seg button[aria-checked="true"] { background: var(--surface); color: var(--encre); box-shadow: var(--o-1); }
.seg.choix button[aria-checked="true"][data-v="compter"] { background: var(--marque); color: var(--sur-marque); }
.seg.choix button[aria-checked="true"][data-v="ne_pas_compter"] { background: var(--encre); color: var(--fond); }

.tableau { width: 100%; border-collapse: collapse; font-size: var(--t-2); }
.tableau th, .tableau td { padding: var(--e-2) var(--e-2); border-bottom: 1px solid var(--trait); text-align: right; white-space: nowrap; }
.tableau th { font-size: var(--t-1); font-weight: var(--g-2); color: var(--encre-3); text-transform: uppercase; letter-spacing: .04em; white-space: normal; vertical-align: bottom; line-height: 1.3; }
.tableau th:first-child, .tableau td:first-child { text-align: left; }
.tableau td.texte { white-space: normal; text-align: left; min-width: 140px; }
.tableau tbody tr { transition: background var(--duree); }
.tableau tbody tr:hover { background: var(--surface-2); }
.tableau tr.choisi { background: var(--marque-doux); }
.tableau tr.total td { font-weight: var(--g-3); border-top: 1px solid var(--trait-fort); border-bottom: 0; }
.tableau .colle { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.tableau tr:hover .colle { background: var(--surface-2); }
.tableau tr.choisi .colle { background: var(--marque-doux); }
.defile { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sous-ligne { display: block; font-size: var(--t-1); color: var(--encre-3); font-weight: var(--g-1); }
.est { color: var(--estime); font-style: italic; }

.legende { display: flex; flex-wrap: wrap; gap: var(--e-2) var(--e-4); font-size: var(--t-1); color: var(--encre-2); align-items: center; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.cle-ligne { width: 16px; height: 2px; border-radius: var(--r-1); background: currentColor; }
.cle-carre { width: 10px; height: 10px; border-radius: var(--r-1); }
.cle-tiret { width: 16px; border-top: 2px dashed var(--encre-3); }

/* Alertes */
.puces-alertes { display: flex; flex-wrap: wrap; gap: var(--e-2); align-items: center; }
.puce-alerte {
  display: inline-flex; align-items: center; gap: var(--e-2); padding: 6px var(--e-3) 6px var(--e-2); border-radius: var(--r-3);
  border: 1px solid var(--negatif-trait); background: var(--negatif-doux); color: var(--negatif); font-size: var(--t-1); font-weight: var(--g-3); min-height: 32px;
  transition: transform var(--duree) var(--courbe);
}
.puce-alerte.alerte { border-color: var(--alerte-trait); background: var(--alerte-doux); color: var(--alerte); }
button.puce-alerte:hover { transform: translateY(-1px); }
.puce-alerte.fixe { cursor: default; }

/* Barres de progression */
.progres { position: relative; height: 8px; border-radius: var(--r-3); background: var(--surface-3); margin-top: var(--e-3); }
.progres .plein { position: absolute; inset: 0 auto 0 0; border-radius: var(--r-3); background: var(--s-encaisse); transform-origin: left; }
.progres.neg .plein { background: var(--negatif); }
.progres .repere { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: var(--r-1); background: var(--encre); }

/* Infobulle et message */
.bulle {
  position: fixed; z-index: 60; pointer-events: none; display: none; min-width: 180px; max-width: 260px;
  background: var(--surface); color: var(--encre); border: 1px solid var(--trait); border-radius: var(--r-1); box-shadow: var(--o-2);
  padding: var(--e-2) var(--e-3); font-size: var(--t-1);
}
.bulle .t { color: var(--encre-3); margin-bottom: var(--e-1); font-weight: var(--g-2); }
.bulle .r { display: flex; justify-content: space-between; gap: var(--e-3); align-items: center; padding: 1px 0; }
.bulle .r span { display: inline-flex; align-items: center; gap: 6px; color: var(--encre-2); }
.bulle .r b { font-weight: var(--g-3); }
.message {
  position: fixed; left: 50%; bottom: var(--e-5); z-index: 70; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: var(--encre); color: var(--fond); padding: var(--e-3) var(--e-4); border-radius: var(--r-2); font-size: var(--t-2); box-shadow: var(--o-2);
  display: flex; gap: var(--e-2); align-items: center; max-width: calc(100vw - 32px); transition: opacity var(--duree), transform var(--duree) var(--courbe);
}
.message.vu { opacity: 1; transform: translate(-50%, 0); }

/* Squelette */
.squelette { display: grid; gap: var(--e-4); }
.os { border-radius: var(--r-2); background: var(--surface-2); position: relative; overflow: hidden; }
.os::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
  animation: lueur 1.2s infinite;
}
@keyframes lueur { to { transform: translateX(100%); } }

/* État vide */
.vide { display: grid; justify-items: center; text-align: center; gap: var(--e-2); padding: var(--e-6) var(--e-4); color: var(--encre-2); }
.vide .rond { width: 48px; height: 48px; border-radius: var(--r-3); display: grid; place-items: center; background: var(--marque-doux); color: var(--marque); }
.vide b { color: var(--encre); font-weight: var(--g-3); }

/* Graphiques */
.graphique { position: relative; width: 100%; }
.graphique svg { width: 100%; height: auto; overflow: visible; }
.graphique svg:focus-visible { outline-offset: 4px; }
.axe { font-size: var(--t-1); fill: var(--encre-3); }
.etiq { font-size: var(--t-1); fill: var(--encre-2); }
.etiq-fort { font-size: var(--t-1); font-weight: var(--g-3); fill: var(--encre); }
.etiq-neg { font-size: var(--t-1); font-weight: var(--g-3); fill: var(--negatif); }
.anime .trace { stroke-dasharray: 1; stroke-dashoffset: 1; animation: trace 900ms var(--courbe) forwards; }
.anime .monte { transform-box: fill-box; transform-origin: bottom; transform: scaleY(0); animation: monte 600ms var(--courbe) forwards; animation-delay: var(--retard, 0ms); }
.anime .monte.bas { transform-origin: top; }
.anime .glisse { transform-box: fill-box; transform-origin: left; transform: scaleX(0); animation: glisse 600ms var(--courbe) forwards; animation-delay: var(--retard, 0ms); }
.anime .apparait { opacity: 0; animation: apparait 500ms var(--courbe) forwards; animation-delay: var(--retard, 300ms); }
@keyframes trace { to { stroke-dashoffset: 0; } }
@keyframes monte { to { transform: scaleY(1); } }
@keyframes glisse { to { transform: scaleX(1); } }
@keyframes apparait { to { opacity: 1; } }
.entre { animation: entre 380ms var(--courbe) both; }
@keyframes entre { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
  .os::after { animation: none; }
}
/* ===== 5. Écrans ===== */

/* Aujourd'hui */
.etat-global { display: grid; gap: var(--e-4); padding: var(--e-5); border-radius: var(--r-2); border: 1px solid var(--trait); background: var(--surface); box-shadow: var(--o-1); position: relative; overflow: hidden; }
.etat-global::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--negatif); }
.etat-global.vert::before { background: var(--positif); }
.etat-global.ambre::before { background: var(--alerte); }
.etat-global .ligne { display: flex; flex-wrap: wrap; gap: var(--e-3) var(--e-4); align-items: center; justify-content: space-between; }
.etat-global .pastille { justify-self: start; }
.etat-global .phrase { font: var(--g-2) var(--t-4)/1.35 var(--police-titre); max-width: 46ch; }
.etat-global .bas { display: flex; flex-wrap: wrap; gap: var(--e-3); align-items: center; justify-content: space-between; border-top: 1px solid var(--trait); padding-top: var(--e-3); }
.jauge svg { width: 100%; height: auto; }
.tuile .progres { margin-top: var(--e-4); }
.tuile .pied { font-size: var(--t-1); color: var(--encre-3); margin-top: var(--e-3); display: flex; gap: 6px; align-items: center; }
.tuile .etincelle { height: 44px; margin-top: var(--e-3); position: relative; }
.tuile .etincelle svg { width: 100%; height: 100%; }
details.calcul { margin-top: var(--e-3); border-top: 1px solid var(--trait); padding-top: var(--e-3); }
details.calcul summary { list-style: none; cursor: pointer; display: inline-flex; gap: var(--e-1); align-items: center; color: var(--marque); font-size: var(--t-2); font-weight: var(--g-3); min-height: 32px; }
details.calcul summary::-webkit-details-marker { display: none; }
details.calcul summary .icone { transition: transform var(--duree) var(--courbe); }
details.calcul[open] summary .icone { transform: rotate(90deg); }
.decompte { list-style: none; margin: var(--e-2) 0 0; padding: 0; font-size: var(--t-2); }
.decompte li { display: flex; justify-content: space-between; gap: var(--e-3); padding: 6px 0; border-bottom: 1px dashed var(--trait); color: var(--encre-2); }
.decompte li b { color: var(--encre); font-weight: var(--g-2); }
.decompte li.total { border-bottom: 0; color: var(--encre); font-weight: var(--g-3); }
.frise { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; align-items: end; margin-bottom: var(--e-4); }
.frise .j { display: grid; gap: var(--e-1); justify-items: center; font-size: var(--t-1); color: var(--encre-3); }
.frise .col { width: 100%; height: 56px; border-radius: var(--r-1); background: var(--surface-2); display: flex; align-items: flex-end; overflow: hidden; }
.frise .col i { display: block; width: 100%; background: var(--s-couts); border-radius: var(--r-1) var(--r-1) 0 0; }
.frise .j.plein { color: var(--encre); font-weight: var(--g-3); }
.frise .j.auj .col { box-shadow: inset 0 0 0 1.5px var(--marque); }
.jours { display: grid; gap: var(--e-3); }
.jour-bloc { display: grid; grid-template-columns: 52px 1fr; gap: var(--e-3); }
.jour-date { text-align: center; border-radius: var(--r-1); background: var(--surface-2); padding: var(--e-1) 0; align-self: start; }
.jour-date b { display: block; font-size: var(--t-4); font-weight: var(--g-3); line-height: 1.1; }
.jour-date span { font-size: var(--t-1); color: var(--encre-3); text-transform: uppercase; }
.jour-lignes .l { display: flex; justify-content: space-between; gap: var(--e-3); font-size: var(--t-2); padding: 2px 0; color: var(--encre-2); }
.jour-lignes .l.tot { color: var(--encre); font-weight: var(--g-3); border-bottom: 1px solid var(--trait); padding-bottom: var(--e-1); margin-bottom: 2px; }
.tuile-lien { text-align: left; width: 100%; font: inherit; color: inherit; display: grid; gap: 2px; transition: border-color var(--duree), transform var(--duree) var(--courbe); }
button.tuile-lien:hover { border-color: var(--trait-fort); transform: translateY(-1px); }
.tuile-lien .fleche { position: absolute; top: var(--e-4); right: var(--e-4); color: var(--encre-3); }

/* Profit par mois */
.selecteur { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(56px, 1fr); gap: var(--e-1); overflow-x: auto; scrollbar-width: thin; padding-bottom: var(--e-1); scroll-snap-type: x proximity; }
.mois-btn {
  scroll-snap-align: start; border: 1px solid transparent; background: transparent; border-radius: var(--r-1); padding: var(--e-2) var(--e-1) var(--e-1);
  display: grid; gap: var(--e-1); justify-items: center; color: var(--encre-2); font-size: var(--t-1); transition: background var(--duree);
}
.mois-btn:hover { background: var(--surface-2); }
.mois-btn[aria-pressed="true"] { background: var(--marque-doux); border-color: color-mix(in srgb, var(--marque) 40%, transparent); color: var(--encre); font-weight: var(--g-3); }
.mois-btn .barre-zone { position: relative; width: 22px; height: 64px; }
.mois-btn .zero { position: absolute; left: -6px; right: -6px; height: 1px; background: var(--trait-fort); }
.mois-btn .b { position: absolute; left: 0; right: 0; border-radius: var(--r-1); background: var(--positif); }
.mois-btn .b.neg { background: var(--negatif); }
.mois-btn .b.prevu { background: repeating-linear-gradient(135deg, var(--positif) 0 3px, color-mix(in srgb, var(--positif) 35%, transparent) 3px 6px); }
.mois-btn .b.prevu.neg { background: repeating-linear-gradient(135deg, var(--negatif) 0 3px, color-mix(in srgb, var(--negatif) 35%, transparent) 3px 6px); }
.mois-btn .saison { height: 4px; width: 22px; border-radius: var(--r-1); background: transparent; }
.mois-btn .saison.oui { background: var(--saison-encre); opacity: .55; }
.mois-btn .auj { font-size: var(--t-1); }
.mois-btn.courant .barre-zone::after { content: ""; position: absolute; inset: -4px -6px; border: 1.5px solid var(--marque); border-radius: var(--r-1); }
.resume-mois { display: grid; gap: var(--e-4); grid-template-columns: 1fr; margin-bottom: var(--e-4); }
@media (min-width: 720px) { .resume-mois { grid-template-columns: repeat(3, 1fr); } }
.resume-mois > div { padding: var(--e-3) var(--e-4); background: var(--surface-2); border-radius: var(--r-1); }
.note-mois { display: flex; gap: var(--e-2); align-items: flex-start; font-size: var(--t-2); color: var(--encre-2); margin-top: var(--e-3); }

/* Tableau de caisse, les semaines en colonnes */
.cadre-caisse { overflow: auto; max-height: min(82vh, 1100px); border: 1px solid var(--trait); border-radius: var(--r-1); -webkit-overflow-scrolling: touch; }
table.caisse { border-collapse: separate; border-spacing: 0; font-size: var(--t-1); width: max-content; min-width: 100%; }
table.caisse th, table.caisse td { padding: var(--e-2) var(--e-1); border-bottom: 1px solid var(--trait); background: var(--surface); text-align: right; vertical-align: top; }
table.caisse thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-weight: var(--g-2); color: var(--encre-2); border-bottom: 1px solid var(--trait-fort); vertical-align: bottom; }
table.caisse th.sem { min-width: 56px; max-width: 76px; white-space: normal; line-height: 1.25; }
table.caisse th.sem .d { display: block; font-size: var(--t-2); font-weight: var(--g-3); color: var(--encre); white-space: nowrap; }
table.caisse .colle { position: sticky; left: 0; z-index: 1; text-align: left; border-right: 1px solid var(--trait-fort); min-width: 108px; max-width: 128px; white-space: normal; padding-left: var(--e-3); font-size: var(--t-1); font-weight: var(--g-2); color: var(--encre); }
table.caisse thead .colle { z-index: 3; }
table.caisse td .v { display: block; white-space: nowrap; }
table.caisse .zero { color: var(--encre-3); }
table.caisse tr.groupe th, table.caisse tr.groupe td { background: var(--surface-2); font-size: var(--t-1); font-weight: var(--g-3); letter-spacing: .08em; padding-top: var(--e-3); color: var(--encre-3); }
table.caisse tr.groupe.e th { color: var(--positif); }
table.caisse tr.groupe.s th { color: var(--s-couts); }
table.caisse tr.tot > * { font-weight: var(--g-3); background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
table.caisse td.taxes { color: var(--encre-3); background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--surface-2) 6px 12px); }
table.caisse .rouge { background-color: color-mix(in srgb, var(--negatif-doux) 85%, var(--surface)) !important; }
table.caisse thead th.rouge { box-shadow: inset 0 3px 0 var(--negatif); }
table.caisse .total-col { border-left: 1px solid var(--trait-fort); background-color: var(--surface-2); font-weight: var(--g-3); }
table.caisse .manque { color: var(--negatif); font-weight: var(--g-3); }
table.caisse .sous { display: block; font-size: var(--t-1); color: var(--encre-3); font-weight: var(--g-1); white-space: nowrap; }
table.caisse .colle .sous { white-space: normal; }
table.caisse tr.detail th { font-weight: var(--g-1); padding-left: var(--e-5); color: var(--encre-2); }
table.caisse tr.detail td { color: var(--encre-2); }
.deplie { all: unset; cursor: pointer; display: inline-flex; gap: var(--e-1); align-items: center; font-weight: var(--g-2); }
.deplie .icone { transition: transform var(--duree) var(--courbe); color: var(--marque); }
.deplie[aria-expanded="true"] .icone { transform: rotate(90deg); }
.deplie:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-1); }
.mini { display: inline-block; margin: 2px 2px 0 0; padding: 0 5px; border-radius: var(--r-3); font-size: var(--t-1); font-weight: var(--g-3); background: var(--surface-3); color: var(--encre-2); }
.mini.pos { background: var(--positif-doux); color: var(--positif); }
.mini.alerte { background: var(--alerte-doux); color: var(--alerte); }
.mini.neg { background: var(--negatif); color: var(--surface); }

/* Audit, haltères */
.halteres { display: grid; }
.haltere { display: grid; grid-template-columns: 1fr auto; gap: var(--e-1) var(--e-3); padding: var(--e-3) 0; border-bottom: 1px solid var(--trait); align-items: center; }
.haltere .nom { font-size: var(--t-2); font-weight: var(--g-2); }
.haltere .piste { grid-column: 1 / -1; position: relative; height: 24px; }
.haltere .piste .rail { position: absolute; left: 0; right: 0; top: 11px; height: 2px; border-radius: var(--r-1); background: var(--surface-3); }
.haltere .piste .lien-h { position: absolute; top: 10px; height: 4px; border-radius: var(--r-1); }
.haltere .piste .pt { position: absolute; top: 5px; width: 14px; height: 14px; margin-left: -7px; border-radius: var(--r-3); }
.haltere .piste .pt.prevu { background: var(--surface); border: 2px solid var(--encre-3); }
.haltere .piste .pt.reel { box-shadow: 0 0 0 2px var(--surface); }
.haltere .chiffres { grid-column: 1 / -1; display: flex; gap: var(--e-4); font-size: var(--t-1); color: var(--encre-3); white-space: nowrap; }
.haltere .chiffres b { color: var(--encre); font-weight: var(--g-3); }
.haltere .cause { display: block; font-size: var(--t-1); color: var(--encre-3); font-weight: var(--g-1); }
@media (min-width: 900px) {
  .haltere { grid-template-columns: minmax(180px, 1fr) 2fr 200px 110px; }
  .haltere .piste, .haltere .chiffres { grid-column: auto; }
  .haltere .chiffres { justify-content: flex-end; }
  .haltere .ecart { text-align: right; }
}
.titre-groupe { font-size: var(--t-1); font-weight: var(--g-3); letter-spacing: .08em; text-transform: uppercase; color: var(--encre-3); padding: var(--e-4) 0 var(--e-1); }
.barre-marge { display: inline-block; width: 64px; height: 6px; border-radius: var(--r-3); background: var(--surface-3); vertical-align: middle; margin-right: var(--e-2); position: relative; overflow: hidden; }
.barre-marge i { position: absolute; inset: 0 auto 0 0; border-radius: var(--r-3); background: var(--s-encaisse); }

/* À valider */
.seance { display: grid; gap: var(--e-3) var(--e-4); grid-template-columns: 56px 1fr; padding: var(--e-4) 0; border-bottom: 1px solid var(--trait); align-items: start; }
.seance:last-child { border-bottom: 0; }
.seance .date { text-align: center; border-radius: var(--r-1); background: var(--surface-2); padding: var(--e-2) 0; }
.seance .date b { display: block; font-size: var(--t-4); font-weight: var(--g-3); line-height: 1.1; }
.seance .date span { font-size: var(--t-1); color: var(--encre-3); text-transform: uppercase; }
.seance .infos { display: grid; gap: var(--e-1); min-width: 0; }
.seance .infos .haut { display: flex; flex-wrap: wrap; gap: var(--e-2); align-items: center; }
.seance .montants { display: flex; flex-wrap: wrap; gap: var(--e-1) var(--e-4); font-size: var(--t-2); color: var(--encre-2); }
.seance .montants b { color: var(--encre); font-weight: var(--g-3); }
.seance .effet { font-size: var(--t-1); color: var(--encre-3); display: flex; gap: 6px; align-items: center; }
.seance .actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: var(--e-2); align-items: center; }
@media (min-width: 900px) {
  .seance { grid-template-columns: 56px 1fr auto; align-items: center; }
  .seance .actions { grid-column: 3; justify-content: flex-end; }
}
.seance.sort { animation: sort 320ms var(--courbe) forwards; }
@keyframes sort { to { opacity: 0; transform: translateX(16px); } }
.bilan-valider { display: grid; gap: var(--e-3); grid-template-columns: 1fr; }
@media (min-width: 720px) { .bilan-valider { grid-template-columns: repeat(3, 1fr); } }

/* Réglages */
.section-reglage { display: grid; gap: var(--e-4); padding: var(--e-5) 0; border-bottom: 1px solid var(--trait); }
.section-reglage:first-child { padding-top: 0; }
.section-reglage:last-child { border-bottom: 0; }
@media (min-width: 900px) { .section-reglage { grid-template-columns: 280px 1fr; gap: var(--e-6); } }
.section-reglage .explique h2 { margin-bottom: var(--e-1); }
.section-reglage .explique p { color: var(--encre-2); font-size: var(--t-2); }
form.formulaire { display: grid; gap: var(--e-4); }
.champs { display: grid; gap: var(--e-4); grid-template-columns: 1fr; }
@media (min-width: 560px) { .champs.c2 { grid-template-columns: 1fr 1fr; } }
label.champ { display: grid; gap: 6px; font-size: var(--t-1); font-weight: var(--g-2); color: var(--encre-2); }
label.champ .aide { font-weight: var(--g-1); color: var(--encre-3); }
input[type="text"], input[type="date"], select {
  width: 100%; min-height: 40px; padding: 0 var(--e-3); border-radius: var(--r-1); border: 1px solid var(--trait-fort);
  background: var(--surface); color: var(--encre); font-size: var(--t-2); transition: border-color var(--duree), box-shadow var(--duree);
}
input:hover, select:hover { border-color: var(--encre-3); }
input:focus-visible, select:focus-visible { outline: none; border-color: var(--marque); box-shadow: 0 0 0 3px color-mix(in srgb, var(--marque) 22%, transparent); }
.avec-unite { position: relative; }
.avec-unite input { padding-right: 32px; }
.avec-unite::after { content: "$"; position: absolute; right: var(--e-3); top: 50%; transform: translateY(-50%); color: var(--encre-3); font-size: var(--t-2); }
.interrupteur { display: inline-flex; gap: var(--e-3); align-items: center; font-size: var(--t-2); cursor: pointer; }
.interrupteur input { appearance: none; width: 36px; height: 20px; border-radius: var(--r-3); background: var(--trait-fort); position: relative; margin: 0; transition: background var(--duree); cursor: pointer; flex: none; }
.interrupteur input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: var(--r-3); background: var(--surface); box-shadow: var(--o-1); transition: transform var(--duree) var(--courbe); }
.interrupteur input:checked { background: var(--marque); }
.interrupteur input:checked::after { transform: translateX(16px); }
.liste-simple { list-style: none; margin: 0; padding: 0; border: 1px solid var(--trait); border-radius: var(--r-1); }
.liste-simple li { display: flex; justify-content: space-between; align-items: center; gap: var(--e-3); padding: var(--e-3) var(--e-4); border-bottom: 1px solid var(--trait); font-size: var(--t-2); }
.liste-simple li:last-child { border-bottom: 0; }
.liste-simple li.total { background: var(--surface-2); font-weight: var(--g-3); }
.qbo { display: grid; gap: var(--e-3); padding: var(--e-4); border-radius: var(--r-1); border: 1px solid var(--trait); background: var(--surface-2); }
.qbo .haut { display: flex; justify-content: space-between; gap: var(--e-3); align-items: center; flex-wrap: wrap; }
.qbo .logo-qbo { width: 36px; height: 36px; border-radius: var(--r-1); background: var(--surface); border: 1px solid var(--trait); display: grid; place-items: center; color: var(--positif); }
.boutons { display: flex; flex-wrap: wrap; gap: var(--e-2); align-items: center; }
/* ===== 6. Couche du langage de la référence. Toute règle de mise en page est gardée par une requête média. ===== */
.entete-page { margin-bottom: var(--e-3); align-items: flex-end; }
.entete-page .mono { margin-bottom: var(--e-2); }
.entete-page p.sous { margin-top: var(--e-2); }
section > * + * { margin-top: var(--e-5); }
.carte { box-shadow: none; }
.carte-tete h2 { font-size: var(--t-3); }
.titre-ic { display: flex; align-items: center; gap: var(--e-2); }
.titre-ic .icone { color: var(--encre-3); }
.carte-tete .titre-mois, .titre-mois { font-size: var(--t-5); font-weight: var(--g-3); letter-spacing: -.03em; line-height: 1.1; margin-top: var(--e-1); }
.valeur { font-weight: var(--g-2); letter-spacing: -.03em; }
.tuile-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--e-3); color: var(--encre-3); margin-bottom: var(--e-4); }
.tuile-tete .mono { text-align: right; line-height: 1.4; }
.tuile .valeur { margin-top: 0; }
.tuile .second { margin-top: var(--e-2); display: flex; flex-wrap: wrap; gap: var(--e-1) var(--e-2); align-items: center; }
.tuile-lien { text-align: left; }
.legende.centre { justify-content: center; margin-top: var(--e-3); }
.petit-seg button { min-height: 28px; padding: var(--e-1) var(--e-3); }
.seg { background: var(--surface-2); border: 1px solid var(--trait); }
.seg button[aria-pressed="true"], .seg button[aria-checked="true"] { box-shadow: none; border: 1px solid var(--trait); }
.puce-source { background: var(--surface); }

/* La bannière « À faire en premier », à la couleur de la marque */
.banniere {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--e-4) var(--e-5);
  background: var(--banniere); color: #ffffff; border-radius: var(--r-2); padding: var(--e-5);
}
.banniere-texte { display: grid; gap: var(--e-1); min-width: 0; flex: 1 1 320px; }
.banniere-haut { display: flex; flex-wrap: wrap; gap: var(--e-2) var(--e-3); align-items: center; margin-bottom: var(--e-1); }
.banniere .mono { color: var(--banniere-2); }
.banniere-titre { font-size: var(--t-4); font-weight: var(--g-3); letter-spacing: -.02em; line-height: 1.25; }
.banniere-sous { color: var(--banniere-2); font-size: var(--t-2); max-width: 72ch; }
.btn-blanc {
  min-height: 40px; padding: 0 var(--e-4); border-radius: var(--r-1); border: 0; background: #ffffff; color: #104b0b;
  font-size: var(--t-2); font-weight: var(--g-3); transition: transform var(--duree) var(--courbe);
}
.btn-blanc:hover { transform: translateY(-1px); }
.btn-blanc:focus-visible { outline-color: #ffffff; }

/* Pastille à point de couleur */
.pastille-point {
  display: inline-flex; align-items: center; gap: 6px; padding: 1px var(--e-2); border-radius: var(--r-3);
  border: 1px solid var(--trait); background: var(--surface); color: var(--encre); font-size: var(--t-1); font-weight: var(--g-2); white-space: nowrap; line-height: 20px;
}
.pastille-point i { width: 6px; height: 6px; border-radius: var(--r-3); background: var(--encre-3); flex: none; }
.pastille-point.neg i { background: var(--negatif); }
.pastille-point.alerte i { background: #d99a00; }
.pastille-point.pos i { background: var(--positif); }
.pastille-point.estime i { background: var(--estime); }
.pastille-point.sur-banniere { background: #ffffff; border-color: #ffffff; color: #16201a; }
.pastille-point.sur-banniere.neg i { background: #b42318; }
.pastille-point.sur-banniere.pos i { background: #1d6b16; }
.pastille-point.sur-banniere.alerte i { background: #b07b00; }

/* Cellules de liste, bordées et arrondies */
.cellules { display: grid; gap: var(--e-2); }
.cellule {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "ic texte quand" "ic etat montant";
  gap: var(--e-1) var(--e-3); align-items: center; padding: var(--e-3) var(--e-4); border: 1px solid var(--trait);
  border-radius: var(--r-2); background: var(--surface-2); color: inherit; text-align: left; width: 100%; font: inherit;
  transition: border-color var(--duree), background var(--duree);
}
button.cellule:hover { border-color: var(--trait-fort); background: var(--surface); }
.cellule-ic { grid-area: ic; color: var(--encre-3); align-self: start; padding-top: 2px; }
.cellule-texte { grid-area: texte; display: grid; min-width: 0; }
.cellule-texte b { font-weight: var(--g-2); font-size: var(--t-2); }
.cellule-texte span { color: var(--encre-3); font-size: var(--t-1); }
.cellule .pastille-point { grid-area: etat; justify-self: start; }
.cellule-quand { grid-area: quand; justify-self: end; text-align: right; letter-spacing: 0; text-transform: none; white-space: nowrap; }
.cellule-montant { grid-area: montant; text-align: right; font-weight: var(--g-3); }
.cellules { container-type: inline-size; }
@container (min-width: 600px) {
  .cellule { grid-template-columns: auto 1fr auto auto auto; grid-template-areas: "ic texte etat quand montant"; }
  .cellule-ic { align-self: center; padding-top: 0; }
}

/* Navigation latérale */
[data-nav] { display: flex; flex-direction: column; gap: var(--e-2); flex: 1; }
.nav-groupe.bas { margin-top: auto; }
.cote-pied { margin-top: 0; }

/* À valider, chaque séance devient une cellule */
.seance { border: 1px solid var(--trait); border-radius: var(--r-2); padding: var(--e-4); background: var(--surface-2); margin-bottom: var(--e-2); }
.seance:last-child { border-bottom: 1px solid var(--trait); }
.seance .date { background: var(--surface); border: 1px solid var(--trait); }
.seance .date span, .jour-date span { font-family: var(--police-mono); font-size: var(--t-1); letter-spacing: .06em; }

/* Tables, en-têtes en chasse fixe */
.tableau th { font-family: var(--police-mono); font-weight: var(--g-1); letter-spacing: .06em; }
table.caisse thead th.sem .d { font-family: var(--police-ui); }
.titre-groupe { font-family: var(--police-mono); font-weight: var(--g-1); }
.frise .mono { letter-spacing: 0; }
.mois-btn > span:nth-child(2) { font-family: var(--police-mono); text-transform: uppercase; letter-spacing: .04em; }

/* Le tableau de caisse tient en entier à 1280 px */
@media (min-width: 1024px) {
  body[data-vue="treize"] main { padding-left: var(--e-5); padding-right: var(--e-5); }
  #s-treize > .carte:last-of-type { padding: var(--e-4); }
  .app { grid-template-columns: 216px 1fr; }
  table.caisse .colle { min-width: 88px; max-width: 94px; }
  table.caisse th.sem { min-width: 50px; }
}
.puce-source { flex: none; white-space: nowrap; }

/* Réglages */
.section-reglage .explique h2 { font-size: var(--t-3); }
.liste-simple { background: var(--surface); }

/* ===== 7. Les listes se replient ===== */
.tete-pliable { display: flex; align-items: center; gap: var(--e-2); }
.carte-tete.tete-pliable > :first-child { margin-right: auto; }
.btn-plier {
  width: 28px; height: 28px; border-radius: var(--r-1); border: 1px solid var(--trait); background: var(--surface);
  display: grid; place-items: center; color: var(--encre-2); flex: none; order: 99;
}
.btn-plier:hover { background: var(--surface-3); color: var(--encre); }
.btn-plier .icone { transition: transform var(--duree) var(--courbe); }
.btn-plier[aria-expanded="false"] .icone { transform: rotate(-90deg); }
.btn-plier.ligne { width: 22px; height: 22px; display: inline-grid; vertical-align: middle; margin-right: var(--e-2); order: 0; }
.resume-plie { font-size: var(--t-1); color: var(--encre-3); white-space: nowrap; }
.resume-plie[hidden] { display: none; }
.pliable-corps { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 280ms var(--courbe), opacity 220ms var(--courbe); }
.pliable-corps.plie { grid-template-rows: 0fr; opacity: 0; }
.pliable-corps.sans-anim { transition: none; }
.pliable-int { min-height: 0; overflow: hidden; padding: 4px; margin: -4px; }
.carte.est-plie > .carte-tete { margin-bottom: 0; }
.groupe-jour + .groupe-jour { margin-top: var(--e-3); }
.groupe-jour-tete { display: flex; align-items: center; gap: var(--e-3); padding: var(--e-1) 0 var(--e-2); font-size: var(--t-2); }
.groupe-jour-tete b { font-weight: var(--g-3); }
.groupe-jour-tete .total-jour { margin-left: auto; font-weight: var(--g-3); }
.groupe-jour-tete .mono { letter-spacing: 0; text-transform: none; }
.groupe-jour.est-plie .groupe-jour-tete { padding-bottom: 0; }
.reglage-tete { margin-bottom: var(--e-1); }
.reglage-tete h2 { margin-right: auto; }
.outils-plis { display: flex; gap: var(--e-1); flex-wrap: wrap; }
table.caisse tr.groupe th { white-space: nowrap; }

/* ===== 8. Graphiques illustrés, teintes de la marque ===== */
.puce-icone { width: 36px; height: 36px; border-radius: var(--r-3); display: grid; place-items: center; background: var(--surface-3); color: var(--encre-2); flex: none; }
.puce-icone.vert { background: var(--marque-doux); color: var(--positif); }
.puce-icone.bleu { background: var(--estime-doux); color: var(--estime); }
.puce-icone.alerte { background: var(--alerte-doux); color: var(--alerte); }
.puce-icone.neg { background: var(--negatif-doux); color: var(--negatif); }
.tuile-tete { align-items: center; }
.variation b { white-space: nowrap; }
.variation { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--t-1); color: var(--encre-3); letter-spacing: 0; font-weight: var(--g-1); }
.variation b { display: inline-flex; padding: 1px var(--e-2); border-radius: var(--r-3); font-weight: var(--g-3); line-height: 18px; }
.variation.pos b { background: var(--positif-doux); color: var(--positif); }
.variation.neg b { background: var(--negatif-doux); color: var(--negatif); }
.valeur .variation { font-size: var(--t-1); }
.tuile-anneau { display: flex; align-items: center; justify-content: space-between; gap: var(--e-3); }
.tuile-anneau > div { display: grid; gap: var(--e-2); min-width: 0; }
.anneau { flex: none; overflow: visible; }
.anneau-centre { font-size: var(--t-2); font-weight: var(--g-3); fill: var(--encre); }
.anneau.anime .anneau-trace { animation: anneau 900ms var(--courbe) both; }
@keyframes anneau { from { stroke-dasharray: 0 100; } }
.progres-fin { height: 6px; border-radius: var(--r-3); background: var(--surface-3); margin-top: var(--e-4); overflow: hidden; }
.progres-fin span { display: block; height: 100%; border-radius: var(--r-3); background: linear-gradient(90deg, color-mix(in srgb, var(--s-encaisse) 55%, transparent), var(--s-encaisse)); }
.tuile .pied { display: flex; gap: var(--e-2); align-items: center; }
.etincelle.grande { height: 56px; margin-top: var(--e-3); position: relative; }
.etincelle.grande svg { width: 100%; height: 100%; }
.pt-et { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: var(--r-3); background: var(--c); box-shadow: 0 0 0 2px var(--surface); }
.pt-et.neg { background: var(--negatif); }
.cle-barre { display: inline-block; width: 20px; height: 8px; border-radius: var(--r-3); }
.mono-svg { font-family: var(--police-mono); letter-spacing: .04em; }
.carte.heros { background: linear-gradient(180deg, color-mix(in srgb, var(--marque-doux) 55%, var(--surface)) 0, var(--surface) 140px); }
.carte.heros .carte-tete .titre-ic { align-items: flex-start; }
.anneaux { display: grid; gap: var(--e-4); margin-top: var(--e-5); padding-top: var(--e-5); border-top: 1px solid var(--trait); }
@media (min-width: 720px) { .anneaux { grid-template-columns: 1fr 1fr; } }
.anneau-bloc { display: flex; align-items: center; gap: var(--e-4); padding: var(--e-4); border: 1px solid var(--trait); border-radius: var(--r-2); background: var(--surface-2); }
.anneau-bloc .second { display: flex; flex-wrap: wrap; gap: var(--e-1) var(--e-2); align-items: center; margin-top: var(--e-1); }
.mois-btn .b { border-radius: var(--r-1); background: linear-gradient(180deg, var(--positif), color-mix(in srgb, var(--positif) 50%, transparent)); }
.mois-btn .b.neg { background: linear-gradient(0deg, var(--negatif), color-mix(in srgb, var(--negatif) 50%, transparent)); }
.mois-btn .barre-zone { width: 24px; }
.paire { grid-column: 1 / -1; display: grid; gap: 4px; padding: var(--e-1) 0; }
.paire span { display: block; height: 10px; border-radius: var(--r-3); min-width: 4px; }
.paire .b-prevu { background: color-mix(in srgb, var(--estime) 22%, var(--surface-3)); }
.paire .b-reel { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 45%, transparent), var(--c)); }
@media (min-width: 900px) { .haltere .paire { grid-column: auto; } }
.anime .monte { animation-duration: 700ms; }

/* ===== 9. Argent libre en deux, actions directes, justesse, téléphone ===== */
.deux-chiffres { display: grid; gap: var(--e-4); }
.deux-chiffres .filet { height: 1px; background: var(--trait); }
.deux-chiffres .mono { margin-bottom: var(--e-1); }
.deux-chiffres .second { margin-top: var(--e-1); }
.cellule .cellule-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: var(--e-2); align-items: center; padding-top: var(--e-1); }
.cellule.avec-actions { grid-template-areas: "ic texte quand" "ic etat montant" "ic actions actions"; }
@container (min-width: 600px) {
  .cellule.avec-actions { grid-template-areas: "ic texte etat quand montant" "ic actions actions actions actions"; }
}
.choix-inline { width: auto; min-width: 200px; min-height: 32px; font-size: var(--t-1); }
.justesse { cursor: help; }
.message.actif { pointer-events: auto; }
.message .annuler { background: none; border: 0; color: inherit; font-weight: var(--g-3); text-decoration: underline; text-underline-offset: 3px; padding: 0 var(--e-1); }
.btn.exporter[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.relancer { width: 28px; height: 28px; border-radius: var(--r-3); border: 1px solid var(--trait); background: var(--surface); color: var(--encre-2); display: grid; place-items: center; flex: none; }
.relancer:hover { color: var(--encre); background: var(--surface-3); }
.relancer.tourne .icone { animation: tourne 800ms linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
.barre-onglets, .feuille { display: none; }
@media (min-width: 720px) {
  .carte-tete.tete-pliable { flex-wrap: nowrap; align-items: flex-start; }
  .carte-tete.tete-pliable > * { min-width: 0; }
  .carte-tete.tete-pliable .legende { justify-content: flex-end; }
}

/* ===== 10. Téléphone, la barre reste à gauche en rail d'icônes ===== */
.btn-rail { display: none; }
@media (max-width: 1023px) {
  .app { grid-template-columns: 52px minmax(0, 1fr); }
  .btn-menu, .barre-onglets, .feuille { display: none; }
  main { padding-left: var(--e-3); padding-right: var(--e-3); }
  .cote {
    position: sticky; top: 0; height: 100vh; width: 52px; transform: none; box-shadow: none; z-index: 50;
    padding: var(--e-2) 6px; gap: var(--e-2); align-items: center; overflow: visible; border-right: 1px solid var(--trait);
  }
  .btn-rail { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-1); border: 1px solid var(--trait); background: var(--surface); color: var(--encre-2); flex: none; }
  .cote .nav-titre, .cote .cote-pied { display: none; }
  .cote .nav-groupe { justify-items: center; }
  .cote .onglet { width: 40px; height: 40px; min-height: 40px; padding: 0; justify-content: center; position: relative; }
  .cote .onglet > span:not(.compte) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .cote .onglet .compte { position: absolute; top: 6px; right: 6px; min-width: 8px; width: 8px; height: 8px; padding: 0; font-size: 0; box-shadow: 0 0 0 2px var(--coquille); }
  .cote.deploye {
    position: fixed; left: 0; top: 0; bottom: 0; height: auto; width: min(264px, 82vw); align-items: stretch;
    padding: var(--e-3); box-shadow: var(--o-2); overflow-y: auto;
  }
  .cote.deploye .btn-rail { align-self: flex-start; }
  .cote.deploye .nav-titre { display: block; }
  .cote.deploye .cote-pied { display: grid; }
  .cote.deploye .nav-groupe { justify-items: stretch; }
  .cote.deploye .onglet { width: 100%; height: auto; min-height: 36px; padding: 6px var(--e-3); justify-content: flex-start; }
  .cote.deploye .onglet > span:not(.compte) { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .cote.deploye .onglet .compte { position: static; width: auto; min-width: 20px; height: 20px; padding: 0 6px; font-size: var(--t-1); box-shadow: none; margin-left: auto; }
}
.section-reglage > *, .pliable-corps, .pliable-int { min-width: 0; }
.defile, .cadre-caisse { position: relative; } /* les libellés cachés restent dans leur cadre défilant */

/* ===== 11. Ajouts de la page réelle ===== */
/* La puce de QuickBooks en ambre, une transaction acceptée de plus de 3 jours ouvrables */
.puce-source.alerte { color: var(--alerte); border-color: var(--alerte-trait); background: var(--alerte-doux); }
.puce-source.neutre { color: var(--encre-3); }
.relancer[disabled] { opacity: .5; cursor: progress; }

/* La connexion, avant tout chiffre */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: var(--e-5) var(--e-4); background: var(--coquille); }
.connexion[hidden], .app-entiere[hidden] { display: none; }
.boite-connexion {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r-2);
  padding: var(--e-6) var(--e-5); display: grid; gap: var(--e-4);
}
.boite-connexion .marque-tete { display: flex; align-items: center; gap: var(--e-2); }
.boite-connexion .marque-tete .logo {
  width: 32px; height: 32px; border-radius: var(--r-1); background: var(--marque); color: var(--sur-marque);
  display: grid; place-items: center; font-weight: var(--g-3); font-size: var(--t-3);
}
.boite-connexion h1 { font-size: var(--t-5); }
.boite-connexion .sous { color: var(--encre-2); }
.boite-connexion input[type="email"], .boite-connexion input[type="password"], .boite-connexion input[inputmode="numeric"] {
  width: 100%; min-height: 44px; padding: 0 var(--e-3); border-radius: var(--r-1); border: 1px solid var(--trait-fort);
  background: var(--surface); color: var(--encre); font-size: var(--t-3);
}
.boite-connexion input:focus-visible { outline: none; border-color: var(--marque); box-shadow: 0 0 0 3px color-mix(in srgb, var(--marque) 22%, transparent); }
.boite-connexion input.code { font-family: var(--police-mono); letter-spacing: .3em; text-align: center; font-size: var(--t-4); }
.boite-connexion .btn { width: 100%; min-height: 44px; }
.boite-connexion .btn[disabled] { opacity: .6; cursor: progress; }
.erreur-connexion { color: var(--negatif); background: var(--negatif-doux); border: 1px solid var(--negatif-trait); border-radius: var(--r-1); padding: var(--e-2) var(--e-3); font-size: var(--t-2); }
.erreur-connexion[hidden] { display: none; }
.qr { display: grid; justify-items: center; gap: var(--e-2); padding: var(--e-4); background: #ffffff; border: 1px solid var(--trait); border-radius: var(--r-1); }
.qr img { width: 184px; height: 184px; }
.secret-totp { font-family: var(--police-mono); font-size: var(--t-1); word-break: break-all; color: #16201a; text-align: center; }

/* La barre du haut, la personne connectée et la sortie */
.btn-sortir { width: auto; padding: 0 var(--e-2); gap: 6px; display: inline-flex; font-size: var(--t-1); font-weight: var(--g-2); }

/* Une vue qui ne se calcule pas, dite calmement dans le style de « Ce qui attend » */
.erreur-vue { display: grid; gap: var(--e-3); }
.erreur-vue .cellule { background: var(--surface); }
.erreur-vue .boutons { margin-top: var(--e-1); }
form.formulaire[aria-busy="true"] { opacity: .6; pointer-events: none; }
.formulaire-ligne { display: grid; gap: var(--e-3); padding: var(--e-3) var(--e-4); background: var(--surface-2); border-bottom: 1px solid var(--trait); }
.liste-simple li.edition { display: block; padding: 0; }
input[type="number"] {
  width: 100%; min-height: 40px; padding: 0 var(--e-3); border-radius: var(--r-1); border: 1px solid var(--trait-fort);
  background: var(--surface); color: var(--encre); font-size: var(--t-2);
}
/* Les textes réels sont plus longs que ceux de la maquette. Au téléphone, le « quand » passe sous le titre
   pour laisser la largeur au texte, au large la cellule reprend la rangée unique de la maquette. */
.cellule { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "ic texte texte" "ic quand quand" "ic etat montant"; }
.cellule.avec-actions { grid-template-areas: "ic texte texte" "ic quand quand" "ic etat montant" "ic actions actions"; }
.cellule-quand { justify-self: start; text-align: left; }
.cellule-quand:empty { display: none; }
.cellule-actions { min-width: 0; }
@container (min-width: 600px) {
  .cellule { grid-template-columns: auto minmax(0, 1fr) auto auto auto; grid-template-areas: "ic texte etat quand montant"; }
  .cellule.avec-actions { grid-template-areas: "ic texte etat quand montant" "ic actions actions actions actions"; }
  .cellule-quand { justify-self: end; text-align: right; }
}
a.btn { text-decoration: none; }
/* La dépense d'un compte fixe sous sa catégorie, jamais à côté */
select[data-categorie], select[data-fixe-de] { display: block; }
