/* Identité Frere — tous les tokens vivent dans src/styles/tokens.css.
   Aucune valeur brute (hex, police, ombre) ici : uniquement des références. */
@import url('./src/styles/tokens.css');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

::selection { background: var(--color-primary); color: var(--color-ink); }

:focus-visible {
  outline: 3px solid var(--color-accent-dark);
  outline-offset: 3px;
}

html {
  height: 100%;
  background: var(--color-bg);
}

body {
  height: 100%;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: contain;
}

:root { --nav-h: 60px; } /* dimension de layout, pas un token d'identité */

/* ── Layout ── */
.page {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  padding-top: 16px;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Bottom nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--color-surface);
  border-top: var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--color-muted);
  text-decoration: none;
  font-family: var(--font-mono);
  /* 9px sans letter-spacing : depuis que le tampon central réserve ~68px,
     « Transactions » doit tenir dans un quart de l'espace restant à 360px. */
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  padding: 6px 2px;
  flex: 1 1 0;
  min-width: 0;
  border-radius: var(--radius);
  transition: color 0.15s;
  cursor: pointer;
  touch-action: manipulation;
}

.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--color-ink); background: var(--color-primary); }
.nav-item:not(.active):hover { color: var(--color-ink); }

/* ── Profil (tête de Paramètres) — léger, HORS carte ── */
.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 22px;
}
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-primary);
  border: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 30px;
  flex-shrink: 0;
}
.profile-who { flex: 1; min-width: 0; }
.profile-nom-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.profile-nom {
  font-family: var(--font-display);
  font-size: 26px; /* taille de départ — le JS réduit jusqu'à tenir, JAMAIS de « … » */
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden; /* le temps que l'auto-fit converge : pas de débordement visible */
}
/* Édition inline du prénom : le champ prend l'habit du titre. */
.profile-nom-input {
  font-family: var(--font-display);
  font-size: 22px;
  text-transform: uppercase;
  border: 2px solid var(--color-ink);
  border-radius: 8px;
  background: var(--color-surface);
  padding: 2px 8px;
  width: 100%;
  min-width: 0;
}
.profile-aka {
  font-family: var(--font-mono);
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
/* Le petit crayon : volontairement effacé — un indice, pas un bouton.
   Exception assumée à la règle « tout interactif est bordé » : à côté d'un
   titre, un cadre ferait deux fois le poids du geste qu'il déclenche. La
   cible tactile reste de 22px, le focus clavier reste marqué. */
.profile-edit {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--color-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.profile-edit:hover, .profile-edit:active { color: var(--color-ink); }
.profile-edit svg { width: 13px; height: 13px; }
.profile-edit:focus-visible { outline: 3px solid var(--color-accent-dark); outline-offset: 2px; border-radius: 6px; }
/* Édition inline du surnom : un petit select à la place du texte. */
.profile-aka-select {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--color-ink);
  border-radius: 7px;
  background: var(--color-surface);
  padding: 2px 6px;
}

/* ── La liste dense de Paramètres (maquette 3) ── */
.eyebrow-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: var(--color-ink);
  color: var(--color-bg);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  margin: 4px 0 6px 2px;
}
.list-card {
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 16px;
}
.set-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  background: none;
  border: none;
  border-bottom: 2px dashed var(--color-ink); /* le pointillé ticket */
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.set-row:last-child { border-bottom: none; }
.set-row:active { background: var(--color-primary); }
.set-row .val {
  margin-left: auto;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 12px;
  color: var(--color-muted);
  white-space: nowrap;
}
.set-row .chev { color: var(--color-muted); font-family: var(--font-mono); flex-shrink: 0; }
.set-row:focus-visible { outline: 3px solid var(--color-accent-dark); outline-offset: -3px; }

/* Le petit interrupteur des lignes de réglage (ex : Coach Splinter). */
.toggle {
  width: 40px;
  height: 22px;
  border: 2px solid var(--color-ink);
  border-radius: 99px;
  background: var(--color-surface);
  position: relative;
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-ink);
  transition: left 0.15s;
}
.toggle.on { background: var(--color-accent); }
.toggle.on::after { left: 20px; }
@media (prefers-reduced-motion: reduce) { .toggle::after { transition: none; } }

/* Groupe à destination unique : les lignes gardent leurs séparateurs,
   UNE seule flèche, centrée verticalement, pour tout le bloc. */
.list-card--grouped { display: flex; align-items: stretch; }
.list-card--grouped .group-rows { flex: 1; min-width: 0; }
.group-chev {
  border: none;
  border-left: 2px dashed var(--color-ink);
  background: none;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 20px;
  padding: 0 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.group-chev:active { background: var(--color-primary); color: var(--color-ink); }
.group-chev:focus-visible { outline: 3px solid var(--color-accent-dark); outline-offset: -3px; }

/* ── Carte repliable (details natif — le « + » pivote, motif accordéon) ── */
.card-fold summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-fold summary::-webkit-details-marker { display: none; }
.fold-plus {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  transition: transform 0.15s;
}
.card-fold[open] .fold-plus { transform: rotate(45deg); }
.card-fold .fold-body { margin-top: 14px; }
@media (prefers-reduced-motion: reduce) { .fold-plus { transition: none; } }
.profile-statut {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--color-accent-dark);
  margin-top: 4px;
}
/* La flèche d'évolution : verte = rang gagné, ambre = rang perdu (90 j glissants).
   Le statut voyage toujours avec son MOT — la flèche n'est qu'un renfort. */
.rank-arrow { margin-left: 4px; font-size: 11px; }
.rank-arrow.up { color: var(--color-accent-dark); }
.rank-arrow.down { color: var(--color-warning); }
.profile-stats {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-left: 12px;
  border-left: 2px dashed var(--color-ink); /* le pointillé ticket */
  flex-shrink: 0;
}
.pstat b {
  display: block;
  font-family: var(--font-mono);
  font-size: 17px;
  line-height: 1;
}
.pstat span {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ── Choix du mois (bas du parcours 5 étapes) — discret ── */
.month-pick {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 2px dashed var(--color-ink); /* le pointillé ticket sépare du parcours */
}
.month-pick-label { font-size: 11px; }
.month-pick-select { font-size: 13px; padding: 8px 10px; }

/* Exception d'un mois futur : valeur qui ne suit plus le mois courant.
   Jaune = mise en valeur (rôle charte de --color-primary), toujours accompagné
   du MOT « modifié pour ce mois » — la couleur ne voyage jamais seule. */
.overridden {
  border-color: var(--color-ink);
  background: color-mix(in srgb, var(--color-primary) 22%, var(--color-surface));
}
.ovr-flag {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--color-primary);
  border: 2px solid var(--color-ink);
  border-radius: 6px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* ── Le bouton-date « Auj. 📅 » sur la ligne du commentaire (date-chips.js,
   maquette 2 du 2026-07-19). Le champ date natif est un fantôme derrière. ── */
.combo-line { position: relative; display: flex; gap: 6px; align-items: stretch; }
.combo-line .form-control[type="text"] { flex: 1; min-width: 0; }
.date-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  border: 2px solid var(--color-ink);
  border-radius: 99px;
  padding: 0 11px;
  background: var(--color-surface);
  color: var(--color-ink);
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}
/* Autre date qu'aujourd'hui : repère JAUNE — ça se voit avant d'enregistrer. */
.date-btn.is-other { background: var(--color-primary); }
.date-btn:focus-visible { outline: 3px solid var(--color-accent-dark); outline-offset: 2px; }
.date-ghost {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ── Champs mot de passe : œil + règles (src/lib/password.js) ── */
.pw-wrap { position: relative; display: block; }
.pw-wrap .form-control { padding-right: 46px; width: 100%; }
.pw-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  background: none;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.pw-eye:hover { color: var(--color-ink); }
.pw-eye svg { width: 18px; height: 18px; }
.pw-eye:focus-visible { outline: 3px solid var(--color-accent-dark); outline-offset: 2px; border-radius: 6px; }

.pw-rules {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.7;
}
.pw-rules li::before { content: '✕ '; font-weight: 700; }
.pw-rules li.ok::before { content: '✓ '; }
.pw-rules li.ko { color: var(--color-danger); }
.pw-rules li.ok { color: var(--color-accent-dark); }
.form-control.pw-invalid { border-color: var(--color-danger); }

/* ── Cards / surface ── */
.card {
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

/* ── Section title ── */
.section-title {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: var(--color-ink);
  color: var(--color-bg);
  padding: 3px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
}

/* ── Hero row ── */
.hero-label {
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 4px;
}

.hero-amount {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* ── Stat rows ── */
.stat-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-row:last-child { margin-bottom: 0; }

.card .stat-row { margin-bottom: 0; }

.stat-cell {
  flex: 1;
  min-width: 0;
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 10px 8px;
  text-align: center;
}

.card .stat-cell { box-shadow: none; }

.stat-cell.full { flex: none; width: 100%; }

.stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--color-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
}

.stat-value.sm { font-size: 14px; }

/* ── Color helpers (rôles fixes : vert = positif, rouge = négatif) ── */
.c-ok    { color: var(--color-accent-dark); }
.c-red   { color: var(--color-danger); }
.c-blue  { color: var(--color-ink); }
.c-amber { color: var(--color-ink); }
.c-dim   { color: var(--color-muted); }
.c-violet{ color: var(--color-ink); }

/* ── Alert banner ── */
.alert-banner {
  background: var(--color-primary);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--color-ink);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-banner svg { flex-shrink: 0; width: 16px; height: 16px; }

/* ── Type chip ── */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 2px solid var(--color-ink);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-ink);
}

.chip-loisirs  { background: var(--color-primary); }
.chip-courses  { background: var(--color-accent); }
/* Anciennes catégories (ndf / avances) : conservées, visibles, hors budget.
   Volontairement ternes — elles ne participent plus à rien. */
.chip-legacy   { background: var(--color-bg); color: var(--color-muted); border-style: dashed; }

/* ── Type picker ── Deux catégories, et deux seulement. Gros boutons : la saisie
   doit tenir en 2 taps (§7.2), donc la cible tactile prime sur la densité. */
/* Les 3 catégories sur UNE ligne (maquette « pastille + texte », 2026-07-19) :
   boutons fins, pastille de couleur de la catégorie (les mêmes teintes que la
   liste Transactions : jaune loisirs, vert courses, encre galères) — la
   couleur aide à viser, le texte peut rester petit sans rien perdre. */
.type-picker { display: flex; gap: 6px; }
.type-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 2px;
  border: 2.5px solid var(--color-ink);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: 12px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.12s, box-shadow 0.12s;
  text-align: center;
  touch-action: manipulation;
}
.type-btn.active {
  background: var(--color-primary);
  box-shadow: 2px 2px 0 var(--color-ink);
}
.type-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--color-ink);
  flex-shrink: 0;
}
.type-dot--loisirs { background: var(--color-primary); }
.type-dot--courses { background: var(--color-accent); }
.type-dot--galeres { background: var(--color-ink); }
/* Actif = fond jaune : la pastille loisirs (jaune) passerait inaperçue —
   elle s'inverse en surface pour rester lisible. */
.type-btn.active .type-dot--loisirs { background: var(--color-surface); }

/* ── Sorties temporaires (2026-07-19) — pastille CREUSE = « pas vraiment
   parti » : le langage visuel des créances, partout dans l'app. */
.type-dot--hollow { background: var(--color-surface); border-style: dashed; }
.type-btn--more { flex: 0 0 34px; font-family: var(--font-mono); font-weight: 700; font-size: 15px; }
.type-picker--extra { margin-top: 6px; }
/* ⚠ display:flex du picker ÉCRASE l'attribut hidden (même leçon que la
   recherche de Transactions) : on le rétablit explicitement. */
.type-picker--extra[hidden] { display: none; }
/* La description obligatoire vide : bord ET fond rouges — ça doit se VOIR. */
.form-control.field-error {
  border-color: var(--color-danger);
  background: color-mix(in srgb, var(--color-danger) 8%, var(--color-surface));
}
.form-control.field-error::placeholder { color: var(--color-danger); }

/* Les chips de créance (réconciliation dans « J'ai reçu du fric »). */
.adv-chips { display: flex; flex-direction: column; gap: 6px; }
.adv-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  border: 2px dashed var(--color-ink);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--color-surface);
  color: var(--color-ink);
  text-align: left;
  cursor: pointer;
}
.adv-chip.on { border-style: solid; background: var(--color-accent); }

/* La carte « Dehors » (bas du dashboard) — un bouton discret, ambre. */
.adv-card {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--color-ink);
}
.adv-card-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  text-transform: uppercase;
}
.adv-total { margin-left: auto; font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--color-warning); }
.adv-card-line {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--color-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* La gestion (D2, compacte) : une ligne par créance, ✓ / ✕ au bout. */
.adv-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 2px;
  border-bottom: 1px dashed rgba(20, 20, 20, 0.3);
}
.adv-row.is-settled { opacity: 0.55; }
.adv-lbl { flex: 1; min-width: 0; font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adv-sub { display: block; font-family: var(--font-mono); font-size: 10px; color: var(--color-muted); font-weight: 400; }
.adv-act {
  flex-shrink: 0;
  width: 34px;
  height: 30px;
  border: 2px solid currentColor;
  border-radius: 8px;
  background: var(--color-surface);
  font-family: var(--font-mono);
  font-weight: 700;
  cursor: pointer;
}
.adv-act.ok { color: var(--color-accent-dark); }
.adv-act.ko { color: var(--color-danger); }

/* Le badge d'état dans la liste Transactions (E2). */
.adv-badge {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  border: 2px solid currentColor;
  border-radius: 5px;
  padding: 1px 5px;
  flex-shrink: 0;
}
.adv-badge.open { color: var(--color-warning); }
.adv-badge.settled { color: var(--color-accent-dark); }

/* ── FAB ── */
/* Le « + » tampon — centré, à cheval sur la barre de nav, présent sur les
   4 écrans (maquette « tampon incliné » validée le 2026-07-19).
   L'inclinaison est l'« imperfection contrôlée » de la marque (CLAUDE.md §2.5) :
   réservée aux éléments d'accent — c'en est un. */
.fab {
  position: fixed;
  left: 50%;
  /* 36px ancrés DANS la barre, le reste dépasse au-dessus — la protrusion
     reste constante quelle que soit la hauteur de barre/safe-area. */
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) - 36px);
  width: 62px;
  height: 62px;
  border-radius: 16px;
  background: var(--color-primary);
  color: var(--color-ink);
  border: var(--border);
  box-shadow: var(--shadow);
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, box-shadow 0.1s;
  z-index: 110; /* au-dessus de la barre (100), sous les sheets (200) */
  touch-action: manipulation;
  transform: translateX(-50%) rotate(-7deg);
}

.fab:hover { transform: translate(calc(-50% + 2px), 2px) rotate(-7deg); box-shadow: 2px 2px 0 var(--color-ink); }
.fab:active { transform: translate(calc(-50% + 4px), 4px) rotate(-7deg); box-shadow: none; }

/* L'espace que la barre réserve au tampon : les 4 onglets s'écartent. */
.nav-gap { width: 68px; flex-shrink: 0; }

/* ── Bottom sheet ── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--color-ink) 55%, transparent);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.sheet-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-top: var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom));
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 92dvh;
  overflow-y: auto;
}

.sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--color-ink);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.sheet-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  text-transform: uppercase;
  margin-bottom: 20px;
  text-align: center;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  padding: 11px 14px;
  -webkit-appearance: none;
  appearance: none;
}

.form-control::placeholder { color: var(--color-muted); }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23141414' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  padding-right: 36px;
  cursor: pointer;
}

input[type="date"].form-control::-webkit-calendar-picker-indicator {
  cursor: pointer;
}

/* ── Buttons ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--color-primary);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  touch-action: manipulation;
}

.btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--color-ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: none; }

.btn-primary { background: var(--color-primary); color: var(--color-ink); }
.btn-danger  { background: var(--color-danger); color: var(--color-bg); }
.btn-ghost   { background: var(--color-surface); color: var(--color-ink); }
/* Bouton inversé (charte §4) : fond encre, texte jaune — à poser SUR du jaune
   (carte-offre annuelle du paywall). */
.btn-dark    { background: var(--color-ink); color: var(--color-primary); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

/* ── Toast ── */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok   { background: var(--color-accent); color: var(--color-ink); }
.toast.err  { background: var(--color-danger); color: var(--color-bg); }

/* ── Month selector ── */
.month-selector {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.month-selector select.form-control {
  flex: 1;
}

/* ── Ticket de caisse (motif signature Frere) ── */
.ticket-wrap {
  filter: drop-shadow(4px 4px 0 var(--color-ink));
  margin-bottom: 24px;
}

.ticket {
  background: var(--color-surface);
  border: var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 18px 14px 4px;
  font-family: var(--font-mono);
  position: relative;
}

/* Dents de scie : triangles en aplats (hard stops), pas un dégradé visuel */
.ticket-teeth {
  height: 8px;
  background:
    linear-gradient(45deg, var(--color-surface) 4px, transparent 0) 0 0 / 8px 8px repeat-x,
    linear-gradient(-45deg, var(--color-surface) 4px, transparent 0) 4px 0 / 8px 8px repeat-x;
}

.ticket-head {
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.ticket-sub {
  text-align: center;
  font-size: 11px;
  color: var(--color-muted);
  padding-bottom: 12px;
  border-bottom: 2px dashed var(--color-ink);
}

.ticket-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 2px;
  border-top: 2px dashed var(--color-ink);
  font-weight: 700;
  font-size: 14px;
}

/* Tampon vert « VU. » incliné */
.stamp {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--color-accent-dark);
  border: 3px solid var(--color-accent-dark);
  border-radius: 6px;
  padding: 1px 8px;
  transform: rotate(-8deg);
}

/* ── Transaction list ── */
.tx-list { display: flex; flex-direction: column; gap: 10px; }

/* Lignes de transaction à l'intérieur d'un ticket */
.ticket .tx-item,
.ticket .tx-item:hover,
.ticket .tx-item:active {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  transform: none;
}
.ticket .tx-item { border-bottom: 2px dashed var(--color-ink); padding: 10px 2px; }
.ticket .tx-item:last-of-type { border-bottom: none; }
.ticket .tx-item:hover { background: color-mix(in srgb, var(--color-primary) 30%, transparent); }

.tx-item {
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
}

.tx-item:hover  { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--color-ink); }
.tx-item:active { transform: translate(4px, 4px); box-shadow: none; }

.tx-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-muted);
  min-width: 36px;
  text-align: center;
  line-height: 1.2;
}

.tx-date-day  { font-size: 17px; font-weight: 700; color: var(--color-ink); }
.tx-date-mon  { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }

.tx-body { flex: 1; min-width: 0; }
.tx-comment {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.tx-comment.empty { color: var(--color-muted); font-style: italic; }

.tx-amount {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

/* ── Filter pills ── */
.filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 4px 8px 4px;
  margin-bottom: 10px;
  scrollbar-width: none;
}
.filter-pills::-webkit-scrollbar { display: none; }

.pill {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 2px solid var(--color-ink);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
  touch-action: manipulation;
}

.pill.active {
  background: var(--color-primary);
  box-shadow: 3px 3px 0 var(--color-ink);
}

/* ── Search ── */
.search-wrap {
  position: relative;
  margin-bottom: 14px;
}

.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-muted);
  pointer-events: none;
}

.search-input {
  padding-left: 36px;
}

/* ── Action sheet ── */
.action-sheet {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  color: var(--color-muted);
  padding: 48px 16px;
  font-size: 14px;
}

.empty-state svg {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  opacity: 0.4;
  display: block;
}

/* ── Confirm dialog ── */
.confirm-msg {
  text-align: center;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* ── Settings form ── */
.settings-card { margin-bottom: 20px; }

.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  text-transform: uppercase;
  margin-bottom: 20px;
}

/* ── Divider ── */
.divider {
  height: 0;
  border-top: 2px dashed var(--color-ink);
  margin: 12px 0;
}

/* ── Responsive ── */
@media (min-width: 520px) {
  .container { padding: 0 24px; }
  .page { padding-top: 24px; }
  .hero-amount { font-size: 40px; }
}

/* ── Sheet close button — « la touche du pavé » (maquette A, 2026-07-19) ──
   Carré bordure 3px + ombre dure + trait épais : la croix est une TOUCHE,
   cohérente avec le clavier TPE juste en dessous — fini le rond à trait fin
   qui flottait sur le champ montant. */
.sheet-close-btn {
  /* STICKY, pas absolute : le sheet scrolle (overflow-y), un absolute
     partirait avec le contenu. Sticky reste collée en haut du sheet.
     Les marges négatives la remontent au coin sans occuper de place
     (le titre garde sa hauteur). */
  position: sticky;
  top: 8px;
  margin-left: auto;
  margin-top: -24px;
  margin-bottom: -40px;
  z-index: 5;
  width: 40px;
  height: 40px;
  border: var(--border);
  background: var(--color-surface);
  color: var(--color-ink);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--color-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: transform 0.1s, box-shadow 0.1s;
}
/* Interaction charte : hover = 2px bas-droite + ombre réduite ; clic = à fond. */
.sheet-close-btn:hover  { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--color-ink); }
.sheet-close-btn:active { transform: translate(3px, 3px); box-shadow: none; }
.sheet-close-btn svg    { width: 18px; height: 18px; stroke-width: 4; }

/* ── Transaction avatar (multi-user) ── */
.tx-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius);
  border: 2px solid var(--color-ink);
  background: var(--color-primary);
  color: var(--color-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════════
   TABLEAU DE BORD — blueprint §6
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Le chiffre héros ─────────────────────────────────────────────────────────
   UN par écran. Mono, parce que chez Frere un prix est toujours en mono
   (CLAUDE.md §4) — c'est un écart assumé à la règle dataviz « jamais de police
   d'affichage sur le chiffre héros », et c'est l'identité qui tranche. */
.hero-block { text-align: center; padding: 0; }

/* Héros en deux volets (ADR-016) : l'absolu à gauche, le rythme à droite.
   Séparateur pointillé — le motif ticket, vertical. */
.hero-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
}
.hero-split .hero-block + .hero-block {
  border-left: 2px dashed var(--color-grid);
}
/* Deux chiffres côte à côte : on descend d'un cran pour tenir à 360px. */
.hero-split .hero-figure { font-size: 30px; }

.hero-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 4px;
}

.hero-kicker {
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 4px;
}

.hero-figure {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  transition: color 0.15s ease;
}
/* Le statut colore le chiffre. Les trois teintes passent 3:1 sur le papier
   (validé) — le jaune, lui, ne peut pas porter de statut : 1,33:1. */
.hero-figure.is-ok      { color: var(--status-ok-text); }
.hero-figure.is-warning { color: var(--status-warning-text); }
.hero-figure.is-over    { color: var(--status-over-text); }


/* ── La barre à repère de rythme ──────────────────────────────────────────────
   §6.2. La lecture, sans aucun calcul :
     remplissage à GAUCHE du trait  → tu consommes moins vite que le calendrier
     remplissage AU-DELÀ du trait   → tu brûles trop vite
     remplissage à 100 %            → dépassé, l'excédent part de l'épargne
   Un chiffre dit « combien » ; cette barre dit « est-ce que ça va ». */
.pace {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 14px 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.pace + .pace { border-top: 2px dashed var(--color-ink); }

/* UNE seule ligne, toujours : nom + « XX € ce mois » + verdict. Les tailles
   sont FLUIDES (elles se resserrent avec l'écran) pour que le pire cas
   (« COURSES 1 000 € ce mois ✕ dépassé de 1 000 € ») tienne sans déborder.
   Le verdict est l'élément flexible, aligné à droite, clip en ultime recours. */
/* En-tête à DEUX ÉTAGES (maquette 1, 2026-07-19) : ligne 1 = titre + objectif
   (le titre s'ellipse si l'écran est minuscule), ligne 2 = le verdict, seul,
   avec toute la largeur — le débordement de « Loisirs & Galères ✓ en bonne
   voie » est structurellement impossible. */
.pace-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
  margin-bottom: 1px;
}

.pace-name {
  font-family: var(--font-display);
  font-size: clamp(14px, 4.6vw, 17px);
  text-transform: uppercase;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;        /* dernier recours sur écran minuscule : ellipse */
  text-overflow: ellipsis;
}

/* Le VERDICT, en toutes lettres. Un daltonien lit le mot, pas la teinte :
   le statut ne voyage jamais en couleur seule (CLAUDE.md §2.3 bis). */
.pace-verdict {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(9.5px, 3.1vw, 11px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
  margin-bottom: 8px;
  overflow: hidden; /* ultime garde-fou : jamais hors de la carte */
  text-overflow: ellipsis;
}
.pace-verdict.is-ok      { color: var(--status-ok-text); }
.pace-verdict.is-warning { color: var(--status-warning-text); }
.pace-verdict.is-over    { color: var(--status-over-text); }

/* La piste = le budget de l'enveloppe. Sa largeur ne bouge JAMAIS : c'est la
   référence visuelle. Une windfall n'élargit pas la piste, elle fait reculer
   le remplissage — et ça, ça se voit. */
.pace-track {
  position: relative;
  height: 26px;
  background: var(--color-bg);
  border: var(--border);
  border-radius: 8px;
  /* Le remplissage est un enfant en position absolue : overflow visible ferait
     dépasser ses coins du cadre d'encre. */
  overflow: hidden;
}

.pace-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 0;
  /* 150 ms : la barre bouge sous les yeux quand une dépense est saisie.
     C'est ce feedback qui crée l'habitude (§6.3). */
  transition: width 0.15s ease, background-color 0.15s ease;
}
.pace-fill.is-ok      { background: var(--status-ok-fill); }
.pace-fill.is-warning { background: var(--status-warning-fill); }
.pace-fill.is-over    { background: var(--status-over-fill); }

/* Le repère « auj. ». Il DÉPASSE la piste en haut et en bas pour rester lisible
   quand le remplissage passe dessous (§6.3) — d'où le wrapper non-clippé. */
.pace-marker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.pace-marker {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 3px;
  margin-left: -1.5px;
  background: var(--color-ink);
  border-radius: 2px;
  transition: left 0.15s ease;
}

.pace-today {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-muted);
  margin-top: 8px;
  height: 12px;
  position: relative;
}
.pace-today span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
  transition: left 0.15s ease;
}

.pace-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.pace-remaining { font-weight: 700; color: var(--color-ink); }
.pace-budget    { color: var(--color-muted); }

/* Le repère vit hors du cadre clippé : on le sort de .pace-track. */
.pace-bar { position: relative; }

/* ── Bandeau épargne — une barre, pas un chiffre ──────────────────────────────
   C'est un « bullet chart » : un remplissage (où tu es), un trait plein (ce que
   tu vises), un trait pointillé (où tu finiras à ce rythme).

   MÊME GRAMMAIRE que les barres d'enveloppe, volontairement : l'utilisateur a
   déjà appris à lire « remplissage vs trait vertical » deux cartes plus haut.
   On ne lui enseigne pas un second langage pour le même geste.

   Différence de sens du trait pointillé : un trait PLEIN est un fait (ton
   objectif), un trait POINTILLÉ est une prévision. Le pointillé ne ment pas
   sur son statut. */
/* Titre puis verdict, EMPILÉS : le verdict peut être une vraie phrase — il
   vit sous « Épargne », passe à la ligne si besoin, ne déborde jamais. */
.savings-head {
  display: block;
  margin-bottom: 6px;
}

.savings-title {
  font-family: var(--font-display);
  font-size: 16px;
  text-transform: uppercase;
}

/* L'objectif d'enveloppe, en léger après le nom : LOISIRS  objectif 700 € */
.pace-obj {
  font-family: var(--font-mono);
  font-size: clamp(9.5px, 3.1vw, 11px);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-muted);
  margin-left: 6px;
  white-space: nowrap; /* « 700 € ce mois » lui-même est insécable */
}

/* L'objectif, en léger juste après le titre : ÉPARGNE  objectif 400 € */
.savings-obj {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-muted);
  margin-left: 8px;
}

/* Le verdict, en toutes lettres, comme sur les enveloppes : un daltonien lit
   le mot, jamais la teinte seule. */
.savings-verdict {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: normal;   /* la phrase va à la ligne, jamais hors de la carte */
  overflow-wrap: break-word;
}
.savings-verdict.is-ok      { color: var(--status-ok-text); }
.savings-verdict.is-warning { color: var(--status-warning-text); }
.savings-verdict.is-over    { color: var(--status-over-text); }

.savings-bar { position: relative; }

/* Les légendes vivent au-DESSUS (l'objectif) et en-DESSOUS (la prévision) de la
   barre : sur deux lignes distinctes, elles ne peuvent jamais se percuter, même
   quand la prévision tombe pile sur l'objectif. */
.savings-caption {
  position: relative;
  height: 13px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-muted);
}
.savings-caption--top    { margin-bottom: 7px; }
.savings-caption--bottom { margin-top: 9px; }
.savings-caption span {
  position: absolute;
  white-space: nowrap;
  transition: left 0.15s ease;
}

.savings-track {
  position: relative;
  height: 26px;
  background: var(--color-bg);
  border: var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.savings-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  transition: left 0.15s ease, width 0.15s ease, background-color 0.15s ease;
}
.savings-fill.is-ok      { background: var(--status-ok-fill); }
.savings-fill.is-warning { background: var(--status-warning-fill); }
.savings-fill.is-over    { background: var(--status-over-fill); }

/* La ligne du zéro. Elle n'apparaît QUE si l'épargne peut passer en négatif —
   sinon c'est du bord gauche, et une ligne de plus à lire pour rien. */
.savings-zero {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--color-ink);
  opacity: 0.3;
}

/* Les traits dépassent la piste en haut et en bas pour rester lisibles quand le
   remplissage passe dessous — d'où ce calque non clippé. */
.savings-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

/* « Tu vises » — un fait : trait plein, encre. */
.savings-target {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 3px;
  margin-left: -1.5px;
  background: var(--color-ink);
  border-radius: 2px;
  transition: left 0.15s ease;
}

/* « À ce rythme » — une prévision. Elle reste POINTILLÉE (un pointillé n'est pas
   un fait), mais prend la couleur de l'atterrissage : c'est là que la sobriété
   se voit. Un trait vert à DROITE du trait plein = « à ce rythme, tu bats ton
   objectif ». Une flèche entre deux chiffres ne savait pas raconter ça. */
.savings-forecast {
  position: absolute;
  top: -5px;
  bottom: -5px;
  border-left: 3px dashed var(--color-muted);
  margin-left: -1.5px;
  transition: left 0.15s ease, border-color 0.15s ease;
}
.savings-forecast.is-ok      { border-left-color: var(--status-ok-text); }
.savings-forecast.is-warning { border-left-color: var(--status-warning-fill); }
.savings-forecast.is-over    { border-left-color: var(--status-over-fill); }

/* Les trois chiffres, écrits. La barre donne le diagnostic ; ces valeurs sont
   le canal de secours — aucune information ne repose sur la seule couleur. */
.savings-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin-top: 16px;
}
.savings-stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin-bottom: 3px;
}
.savings-stat-value {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--color-ink);
}
.savings-stat-value.is-ok      { color: var(--status-ok-text); }
.savings-stat-value.is-warning { color: var(--status-warning-text); }
.savings-stat-value.is-over    { color: var(--status-over-text); }
.savings-stat-value.is-dim     { color: var(--color-muted); }

/* Avant le jour 4, pas de projection : elle s'extrapolerait sur un échantillon
   minuscule et ferait le yo-yo à chaque saisie (§2.1). */
.savings-note {
  font-size: 12px;
  color: var(--color-muted);
  line-height: 1.45;
  margin-top: 14px;
}
.savings-note a { color: var(--color-ink); font-weight: 700; }

/* ── Saisie : le pavé numérique ───────────────────────────────────────────────
   Grand, ouvert d'emblée, focus sur le montant. Loguer en < 5 s, c'est LA
   boucle qui fait vivre l'app (§0). */
/* Le montant « souligné de caisse » (maquette A1, 2026-07-19) : plus de
   cadre — de gros chiffres libres sur un souligné épais, qui passe VERT
   quand on saisit. Façon écran de calculatrice.
   ⚠ EXCEPTION à la règle « contour 3px sur :focus-visible » (CLAUDE.md §3,
   documentée là-bas) : le pavé TPE donne le focus PAR SCRIPT à chaque
   ouverture du sheet — le navigateur classe ce focus « visible », et le
   contour encadrait donc le champ en permanence (pas ce qui était convenu,
   2026-07-19). Le signal clavier reste NON-couleur-seule : le soulignement
   double d'épaisseur (4 → 8px) en plus de passer vert. */
.amount-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  padding: 4px 8px 8px;
  border: none;
  border-bottom: 4px solid var(--color-ink);
  border-radius: 0;
  background: none;
  color: var(--color-ink);
  caret-color: var(--color-accent-dark);
}
.amount-input:focus {
  outline: none;
  border-bottom-color: var(--color-accent-dark);
}
.amount-input:focus-visible {
  outline: none;
  border-bottom-color: var(--color-accent-dark);
  border-bottom-width: 8px;
  padding-bottom: 4px; /* compense les +4px du souligné : zéro saut de mise en page */
}
.amount-input::placeholder { color: var(--color-muted); opacity: 0.5; }

/* ── Windfall : 3 destinations, toujours 2 taps ───────────────────────────── */
.windfall-targets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.windfall-btn {
  padding: 16px 4px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: 15px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s, transform 0.12s, box-shadow 0.12s;
  touch-action: manipulation;
  min-height: 56px;
}
/* Épargne est le défaut : c'est le seul qui ne peut pas nuire (§3). */
.windfall-btn.active {
  background: var(--color-accent);
  box-shadow: var(--shadow-sm);
  transform: translate(-2px, -2px);
}

.windfall-note {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-danger);
  margin-top: 10px;
}

/* Une windfall dans la liste : distinguée visuellement d'une dépense (§7.3). */
.tx-windfall .tx-amount { color: var(--color-accent-dark); }

/* ── Garde-fou de configuration (§1) ───────────────────────────────────────── */
.guard {
  border: var(--border);
  border-radius: var(--radius);
  background: var(--color-primary);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 16px;
}

/* Les leviers du garde-fou : boutons compacts DANS la carte jaune —
   fond surface, l'action se détache de l'alerte sans crier. */
.guard-fix-hint { font-weight: 700; margin-top: 10px; }
.guard-fixes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.guard-fixes .btn { padding: 8px 14px; font-size: 12px; }

/* ── Étapes du parcours (§1) ───────────────────────────────────────────────── */
.step { margin-bottom: 22px; }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.step-num {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--color-primary);
  border: var(--border);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 16px;
  transform: rotate(-6deg);
}
.step-title { font-family: var(--font-display); font-size: 19px; text-transform: uppercase; }
.step-hint  { font-size: 13px; color: var(--color-muted); margin-top: 6px; line-height: 1.45; }

/* Étape 5 : Loisirs est CALCULÉ, jamais saisi. En lecture seule, et ça se voit. */
.step-readonly {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  padding: 14px;
  border: 3px dashed var(--color-ink);
  border-radius: var(--radius);
  background: var(--color-bg);
  text-align: center;
}
.step-readonly.is-negative { color: var(--color-danger); }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}


/* ── Onboarding (src/lib/onboarding.js) — direction « affiche collée » ─────────
   Overlay 65 % dont le trou est découpé au box-shadow géant : le spotlight
   GLISSE d'une ancre à l'autre par simple transition de position. */
.ob-spot {
  position: fixed;
  z-index: 100;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(20, 20, 20, .65);
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
  pointer-events: none; /* on voit le champ éclairé, on ne clique pas dessous */
  transition: top .25s ease, left .25s ease, width .25s ease, height .25s ease;
}
.ob-spot--closed { outline: none; } /* étape finale : plus de trou, ombre pleine */

/* « Passer le tuto » — TOUJOURS visible. */
.ob-skip {
  position: fixed;
  top: 12px; right: 12px;
  z-index: 120;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-bg);
  background: none;
  border: 2px solid rgba(246, 245, 240, .55);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.ob-skip:hover { border-color: var(--color-bg); }

/* La bulle-poster : rotation légère (élément d'accent), ombre dure. */
.ob-bubble {
  position: fixed;
  left: 16px; right: 16px;
  max-width: 388px;
  margin: 0 auto;
  z-index: 110;
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: 7px 7px 0 rgba(0, 0, 0, .55);
  transform: rotate(-1.6deg);
  padding: 18px 16px 16px;
  transition: opacity .22s ease, translate .22s ease;
}
.ob-bubble.ob-out { opacity: 0; translate: 0 8px; }

.ob-sticker {
  position: absolute;
  top: -16px; right: -8px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--color-primary);
  border: var(--border);
  font-family: var(--font-marker);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(9deg);
}
.ob-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 21px;
  line-height: 1.12;
  margin-bottom: 8px;
  padding-right: 40px; /* le sticker ne mord pas le titre */
}
.ob-text {
  font-size: 14px;
  line-height: 1.45;
  color: var(--color-muted);
  margin-bottom: 12px;
}
.ob-field {
  width: 100%;
  border: var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  background: var(--color-bg);
  margin-bottom: 10px;
}
.ob-field--label { font-family: var(--font-body); font-size: 16px; }

.ob-row { display: flex; gap: 10px; align-items: center; margin-top: 2px; }
.ob-progress { display: flex; gap: 6px; }
.ob-progress span {
  width: 10px; height: 10px;
  border: 2px solid var(--color-ink);
  border-radius: 2px; /* des coupons, pas des points SaaS */
  background: transparent;
}
.ob-progress span.done { background: var(--color-accent); }
.ob-progress span.now  { background: var(--color-primary); }

.ob-btn {
  flex: 1;
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 16px;
  letter-spacing: 1px;
  background: var(--color-ink);
  color: var(--color-primary);
  border: var(--border);
  border-radius: 10px;
  padding: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.ob-btn:hover  { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--color-ink); }
.ob-btn:active { transform: translate(4px, 4px); box-shadow: none; }

/* Étape 5 — la révélation, centrée, chiffres en grand. */
.ob-bubble--final { transform: rotate(-1.2deg); text-align: center; padding: 26px 20px 20px; }
.ob-final-kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--color-muted);
  margin-bottom: 10px;
}
.ob-final-figure {
  font-family: var(--font-mono);
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--status-ok-text);
  margin-bottom: 4px;
}
.ob-final-perday {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 19px;
  margin: 8px 0 10px;
}
.ob-hl { background: var(--color-primary); padding: 0 6px; }


/* ── Pavé numérique « TPE » (src/lib/keypad.js) ────────────────────────────────
   Le clavier maison des montants : le clavier système ne s'ouvre plus
   (inputmode="none"), donc plus AUCUN décalage de viewport sur mobile. */
.kp {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* calculatrice : 1-9, puis , 0 ⌫ */
  gap: 5px;
  margin: 2px 0 8px;
  /* L'overflow:hidden (animation de repli) rognait les ombres dures des
     touches (4px vers la droite et le bas) : on leur réserve la place. */
  padding: 0 4px 4px 0;
  max-height: 340px; /* marge après l'agrandissement des touches (2026-07-19) */
  overflow: hidden;
  transition: max-height .25s ease, opacity .2s ease, margin .25s ease;
}
.kp--collapsed { max-height: 0; opacity: 0; margin: 0; }

.kp-key {
  font-family: var(--font-mono);
  font-size: 20px; /* +15 % (2026-07-19) : les touches respirent */
  font-weight: 700;
  padding: 8px 0; /* compactage −40 % puis +15 % (2026-07-19) */
  background: var(--color-surface);
  color: var(--color-ink);
  border: var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
  touch-action: manipulation; /* pas de zoom double-tap sur les touches */
}
.kp-key:active { transform: translate(4px, 4px); box-shadow: none; }
/* Virgule et correction : un jaune ADOUCI — visibles sans crier (le jaune
   plein reste réservé aux actions ; ici c'est un repère, pas un CTA). */
.kp-key--back,
.kp-key--comma {
  background: color-mix(in srgb, var(--color-primary) 45%, var(--color-surface));
}
/* La validation : pleine largeur SOUS le pavé — la zone du pouce. */
.kp-key--validate {
  grid-column: 1 / -1;
  background: var(--color-accent);
  font-family: var(--font-display);
  font-size: 20px; /* +25 % (2026-07-19) : LE bouton du geste, il s'assume */
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 10px 0;
}

/* Dans les sheets de saisie : étiquettes plus discrètes, et le pavé respire
   un peu plus sous le champ montant. (Scopé : Paramètres garde ses tailles.) */
.sheet .form-label { font-size: 10px; margin-bottom: 4px; }
.sheet .kp { margin-top: 6px; }
/* Sheet de saisie compacté (−40 %, 2026-07-19) : marges et champs resserrés. */
.sheet .form-group { margin-bottom: 8px; }
.sheet .amount-input { padding: 2px 8px 6px; font-size: 26px; }
/* Même compensation qu'au niveau global : le souligné focus-clavier gagne
   4px d'épaisseur, le padding les rend — zéro saut de mise en page. */
.sheet .amount-input:focus-visible { padding-bottom: 2px; }

/* « J'ai reçu du fric » en LIEN vert (maquette B1, 2026-07-19) : une ligne de
   texte soulignée entre le commentaire et le pavé — quasi zéro hauteur, et le
   vert-argent de la charte le fait ressortir du blanc. */
.link-fric {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 6px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-accent-dark);
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  touch-action: manipulation;
}
.link-fric:focus-visible { outline: 3px solid var(--color-accent-dark); outline-offset: 2px; border-radius: 8px; }
/* `display:block` écraserait l'attribut hidden (même piège que .type-picker,
   journal 2026-07-19) : on le neutralise explicitement. */
.link-fric[hidden] { display: none; }
/* Variante destructive du lien discret (« Erreur de saisie ? Supprime-la »). */
.link-fric--danger { color: var(--color-danger); }
.link-fric--danger:focus-visible { outline-color: var(--color-danger); }
.sheet .form-control { padding: 8px 10px; }
.sheet .type-btn, .sheet .windfall-btn { padding: 7px 4px; }
.sheet .sheet-title { margin-bottom: 8px; }
.sheet .btn { padding: 8px 14px; }

/* Le trait « budget » (dépassement uniquement) : la limite franchie, en
   pointillés d'encre — distincte du repère « auj. » (plein). */
.pace-budget-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px dashed var(--color-ink);
}

/* En dépassement, l'« actuel » est un TRAIT, pas un bout de barre arrondi :
   la piste se coupe net à droite, et le trait rouge marque la position —
   même langage que « auj. » et « budget ». */
.pace-track--cut {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.pace-actual-line {
  position: absolute;
  left: 100%;
  top: -5px;
  bottom: -5px;
  width: 3px;
  margin-left: -3px; /* collé au bord, entièrement visible */
  background: var(--status-over-text);
  border-radius: 2px;
}

/* ── La punchline du dashboard ─────────────────────────────────────────────────
   Pas de cadre : une annotation à la marker (la SEULE de l'écran — quota
   charte respecté), légèrement penchée, une ligne garantie. Le statut est
   déjà porté en texte par les verdicts des barres : ici la couleur ne fait
   que doubler l'ambiance. */
.mood-line {
  font-family: var(--font-display);   /* même voix que LOISIRS / COURSES */
  /* La taille des montants du héros (26px), réduite au besoin pour tenir
     sur une ligne des petits écrans. */
  font-size: clamp(16px, 7vw, 26px);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  transform: rotate(-1.2deg);
  margin: -4px 0 16px;
  white-space: nowrap;
  overflow: hidden;
}
.mood-line.is-ok      { color: var(--status-ok-text); }
.mood-line.is-warning { color: var(--status-warning-text); }
/* Le surnom (frère, bg…) SURLIGNÉ jaune, texte encre (maquette « mur
   d'affiches », validée 2026-07-19) : c'est TON nom, on le met en scène —
   le rôle charte du jaune taxi, toujours accompagné d'encre. */
.mood-line .mood-name {
  color: var(--color-ink);
  background: var(--color-primary);
  padding: 0 6px 1px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ── Le conseil — la ligne d'ami entre enveloppes et épargne ──────────────────
   Pas de cadre : une annotation manuscrite (LE marker de l'écran — quota
   charte respecté, la punchline est en display). Encre neutre : c'est un
   conseil, pas un statut. Plusieurs lignes autorisées. */
.advice-line {
  font-family: var(--font-marker);
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
  color: var(--color-ink);
  margin: -2px 4px 14px;
}
/* Le rythme salvateur (« 12 €/j ») en vert : la sortie de secours se voit. */
.advice-amount { color: var(--status-ok-text); }

/* ── Jauge-réservoir d'épargne ─────────────────────────────────────────────────
   Des ZONES sémantiques en fond (rouge sous zéro, orange sous l'objectif,
   vert au-dessus — teintes adoucies : le statut est aussi porté par les
   traits et les verdicts, la couleur ne voyage jamais seule) ; l'ENGAGÉ
   (déjà dépensé) est hachuré par-dessus, le niveau actuel est un trait. */
.savings-zone { position: absolute; top: 0; bottom: 0; }
.sz-red  { background: color-mix(in srgb, var(--status-over-fill) 26%, transparent); }
.sz-warn { background: color-mix(in srgb, var(--status-warning-fill) 24%, transparent); }
.sz-ok   { background: color-mix(in srgb, var(--status-ok-fill) 22%, transparent); }

/* Les hachures = « barré, déjà parti » (motif, pas dégradé : charte ok). */
.savings-engaged {
  position: absolute;
  top: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, var(--color-muted) 45%, transparent) 0 3px,
    transparent 3px 7px
  );
}

/* Le trait « actuel » : la frontière vif/engagé, colorée par le statut. */
.savings-current {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
}
.savings-current.is-ok      { background: var(--status-ok-text); }
.savings-current.is-warning { background: var(--status-warning-text); }
.savings-current.is-over    { background: var(--status-over-text); }

/* La ligne de chiffres sous la jauge : « économisés : X actuel · Y à ce rythme ». */
.savings-footline {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-muted);
}

/* ── Visites guidées (src/lib/tour.js) ─────────────────────────────────────────
   Mêmes composants ob-* que l'onboarding, mais élevés AU-DESSUS des sheets
   (z 201) : la visite de la saisie se joue sheet ouvert. */
.ob-z2.ob-spot   { z-index: 300; }
.ob-z2.ob-bubble { z-index: 310; }
.ob-z2.ob-skip   { z-index: 320; }
