/* Thème « néon carbone », inspiré de Healthy et Sheldon. Aucun vert. */
:root {
  /* Clair : « verre blanc » */
  --fond: #edf1f6;
  --fond-2: #e2e8ef;
  --carte: rgba(255, 255, 255, 0.82);
  --carte-pleine: #ffffff;
  --creux: #eef3f8;
  --texte: #0c1620;
  --texte-doux: #33424f;
  --discret: #586773;
  --bordure: rgba(15, 23, 42, 0.12);
  --piste: #e1e8ee;
  --accent: #1d4fcc;
  --accent-texte: #ffffff;
  --negatif: #be185d;
  --positif: #1d4fcc;
  --info-fond: rgba(47, 107, 240, 0.1);
  --erreur-fond: rgba(239, 68, 68, 0.12);
  --alerte-fond: rgba(242, 177, 0, 0.14);
  --rayon: 22px;
  /* Néons (liserés et halos) */
  --n-cyan: #06b6d4;
  --n-violet: #a855f7;
  --n-rose: #ec4899;
  --n-jaune: #f2b100;
  --n-bleu: #2f6bf0;
  --halo: 0.18;
  --ombre: rgba(30, 50, 80, 0.13);
  /* Séries des graphiques (palette vérifiée pour les daltonismes). */
  --serie-revenus: #2f6bf0;
  --serie-depenses: #d6337f;
  --critique: #dc2626;
  --grille: rgba(12, 22, 32, 0.07);
  color-scheme: light;
}

/* Sombre par défaut ; le clair se choisit avec le bouton de l'en-tête. */
:root:not([data-theme="light"]) {
  --fond: #080b0f;
  --fond-2: #0a0e13;
  --carte: rgba(13, 18, 23, 0.88);
  --carte-pleine: #0d1217;
  --creux: #070a0e;
  --texte: #eef4f8;
  --texte-doux: #c3cdd6;
  --discret: #8c99a6;
  --bordure: rgba(148, 163, 184, 0.14);
  --piste: #17212a;
  --accent: #4addf3;
  --accent-texte: #061016;
  --negatif: #ff8fc0;
  --positif: #86b4ff;
  --info-fond: rgba(34, 211, 238, 0.1);
  --erreur-fond: rgba(255, 90, 90, 0.14);
  --alerte-fond: rgba(255, 197, 61, 0.12);
  --n-cyan: #22d3ee;
  --n-violet: #c46bff;
  --n-rose: #ff5fa8;
  --n-jaune: #ffc53d;
  --n-bleu: #4c8dff;
  --halo: 0.32;
  --ombre: rgba(0, 0, 0, 0.55);
  --serie-revenus: #3d8bff;
  --serie-depenses: #e0559a;
  --critique: #ff5a5a;
  --grille: rgba(255, 255, 255, 0.06);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--texte);
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Deux halos colorés et une trame discrète, comme dans Healthy */
  background:
    radial-gradient(600px 400px at 8% -5%, color-mix(in srgb, var(--n-cyan) 16%, transparent), transparent 70%),
    radial-gradient(700px 500px at 100% 0%, color-mix(in srgb, var(--n-violet) 14%, transparent), transparent 70%),
    linear-gradient(var(--grille) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grille) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--fond);
}

h1, h2, h3 { margin: 0 0 .6em; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

main { max-width: 1000px; margin: 0 auto; padding: 16px; }

.chargement { text-align: center; margin-top: 30vh; color: var(--discret); }

/* En-tête et menu */
.entete {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 10px 16px; background: var(--carte); border-bottom: 1px solid var(--bordure);
  position: sticky; top: 0; z-index: 1;
}
.marque { font-weight: 700; color: var(--accent); }
.theme { font-size: 1.05rem; line-height: 1; padding: 6px 9px; min-height: 0; border-radius: 999px; }
.entete nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.moi { display: flex; gap: 8px; align-items: center; color: var(--discret); }
.onglet { background: none; border: none; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.onglet.actif { background: var(--info-fond); color: var(--accent); font-weight: 600; }

/* Cartes et formulaires */
.carte {
  background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon);
  padding: 16px; margin-bottom: 16px; overflow-x: auto;
}
.accueil { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.formulaire { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; align-items: end; margin-top: 12px; }
.filtres { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 12px; }
.fin { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; grid-column: 1 / -1; }
.colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--discret); }
label.case { flex-direction: row; align-items: center; gap: 6px; color: var(--texte); }
small { color: var(--discret); }

input, select, button {
  font: inherit; color: var(--texte); background: var(--carte);
  border: 1px solid var(--bordure); border-radius: 6px; padding: 7px 10px; min-height: 36px;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button.principal { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); font-weight: 600; }
button.lien { background: none; border: none; color: var(--accent); padding: 4px; min-height: 0; }
button.petit { padding: 3px 8px; min-height: 28px; font-size: .85rem; }
button.danger { color: var(--negatif); }
button.compact { border-color: transparent; background: none; font-size: 1.1rem; line-height: 1; padding: 2px 8px; color: var(--discret); }
button.compact:hover { color: var(--negatif); }

.sens { display: flex; }
.sens button { flex: 1; border-radius: 0; }
.sens button:first-child { border-radius: 6px 0 0 6px; }
.sens button:last-child { border-radius: 0 6px 6px 0; border-left: none; }
.sens button.actif { background: var(--info-fond); color: var(--accent); font-weight: 600; }

/* Messages */
.bandeau {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 6px; margin: 0 auto 12px; max-width: 1000px;
}
main > .bandeau, body > .bandeau { margin: 12px auto 0; }
.bandeau.info { background: var(--info-fond); }
.bandeau.erreur { background: var(--erreur-fond); color: var(--negatif); }
.proposition {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--info-fond); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px;
}
.proposition input { min-width: 160px; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; }
td { padding: 8px 6px; border-top: 1px solid var(--bordure); vertical-align: middle; }
tbody tr:first-child td { border-top: none; }
tfoot td { font-weight: 700; border-top: 2px solid var(--bordure); }
td.nombre { text-align: right; white-space: nowrap; }
td.date { white-space: nowrap; color: var(--discret); width: 1%; }
td.actions { text-align: right; white-space: nowrap; width: 1%; }
td.actions button + button { margin-left: 4px; }
td select { max-width: 220px; }
tr.alerte { background: var(--alerte-fond); }
tr.a-classer td:first-child { box-shadow: inset 3px 0 var(--accent); }
tr.doublon { opacity: .5; }

.montant { font-variant-numeric: tabular-nums; }
.negatif { color: var(--negatif); }
.positif { color: var(--positif); }
.discret { color: var(--discret); font-size: .85rem; }
.vide { color: var(--discret); text-align: center; padding: 16px 0; }

/* Catégories */
.arbre, .enfants { list-style: none; margin: 0; padding: 0; }
.arbre > li { padding: 6px 0; border-top: 1px solid var(--bordure); }
.titre-categorie, .enfants li { display: flex; align-items: center; gap: 8px; }
.titre-categorie strong { flex: 1; }
.enfants li { padding: 2px 0 2px 22px; }
.enfants li span { flex: 1; }
.pastille { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; vertical-align: -1px; }
.releve + .releve { margin-top: 16px; }
.pilule-epargne {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; padding: 2px 10px; min-height: 0;
  border-radius: 999px; color: var(--discret); background: none; border: 1px dashed var(--bordure);
}
/* L'interrupteur n'apparaît qu'au survol tant qu'il est éteint, pour ne pas charger la liste. */
@media (hover: hover) {
  .titre-categorie .pilule-epargne:not(.actif) { opacity: 0; transition: opacity .15s; }
  .titre-categorie:hover .pilule-epargne, .titre-categorie:focus-within .pilule-epargne { opacity: 1; }
}
@media (hover: none) { .pilule-epargne:not(.actif) { opacity: .55; } }
.pilule-epargne.actif {
  color: var(--serie-revenus); border: 1px solid color-mix(in srgb, var(--serie-revenus) 60%, transparent);
  background: color-mix(in srgb, var(--serie-revenus) 12%, transparent);
  box-shadow: 0 0 12px -4px var(--serie-revenus);
}

/* Tableau de bord */
.titre-mois { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.titre-mois h2 { margin: 0; min-width: 11ch; text-align: center; }
.titre-section { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 12px; }
.tuile { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--bordure); border-radius: 8px; }
.tuile strong { font-size: 1.4rem; }
.legende { display: flex; gap: 16px; font-size: .9rem; color: var(--discret); margin-bottom: 4px; }
.legende span { display: flex; align-items: center; gap: 6px; }
.cle { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.cle.serie-revenus { background: var(--serie-revenus); }
.cle.serie-depenses { background: var(--serie-depenses); }
.graphique { width: 100%; height: auto; display: block; overflow: visible; }
.graphique .grille { stroke: var(--bordure); stroke-width: 1; }
.graphique .base { stroke: var(--discret); stroke-width: 1; }
.graphique .axe { fill: var(--discret); font-size: 11px; }
.groupe-mois { cursor: pointer; }
.groupe-mois .zone { fill: transparent; }
.groupe-mois:hover .zone { fill: var(--info-fond); opacity: .5; }
.groupe-mois.choisi .zone { fill: var(--info-fond); }
.groupe-mois.choisi .axe { fill: var(--texte); font-weight: 700; }
.donnees { margin-top: 8px; font-size: .9rem; }
.donnees summary { cursor: pointer; color: var(--accent); }
th { text-align: left; font-weight: 600; color: var(--discret); font-size: .85rem; padding: 6px; }
th.nombre { text-align: right; }
.ligne-categorie { padding: 8px 0; border-top: 1px solid var(--bordure); }
.ligne-categorie:first-of-type { border-top: none; }
.entete-ligne { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.entete-ligne .nom { display: flex; align-items: center; gap: 8px; }
.valeurs { white-space: nowrap; font-variant-numeric: tabular-nums; }
.piste { position: relative; height: 10px; background: var(--fond); border-radius: 5px; }
.remplissage { height: 100%; background: var(--serie-depenses); border-radius: 5px; min-width: 2px; }
.ligne-categorie.depasse .remplissage { background: var(--critique); }
.repere-budget { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--texte); border-radius: 1px; }
.detail { font-size: .85rem; color: var(--discret); margin-top: 4px; }
.ligne-categorie.depasse .detail { color: var(--critique); font-weight: 600; }
.budgets td { vertical-align: middle; }
.montant-budget { width: 110px; text-align: right; }

/* Filtres repliables sur téléphone */
.filtres-repli > summary { display: none; }

/* ===== Néon : cartes, tuiles, menu ===== */
@property --angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
.entete {
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--fond) 78%, transparent);
}
.marque {
  font-weight: 800; letter-spacing: .02em;
  background: linear-gradient(90deg, var(--n-cyan), var(--n-violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.onglet { border-radius: 999px; padding: 6px 14px; color: var(--texte-doux); }
.onglet.actif {
  color: var(--texte); background: color-mix(in srgb, var(--n-cyan) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--n-cyan) 55%, transparent),
              0 0 16px -4px color-mix(in srgb, var(--n-cyan) 60%, transparent);
}
/* Chaque carte a sa couleur de néon, à tour de rôle. */
main > .carte:nth-of-type(5n+1) { --neon: var(--n-cyan); }
main > .carte:nth-of-type(5n+2) { --neon: var(--n-violet); }
main > .carte:nth-of-type(5n+3) { --neon: var(--n-rose); }
main > .carte:nth-of-type(5n+4) { --neon: var(--n-bleu); }
main > .carte:nth-of-type(5n+5) { --neon: var(--n-jaune); }
.carte {
  --neon: var(--n-cyan);
  position: relative;
  padding: 20px 22px;
  border: 1px solid transparent;
  background:
    radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--neon) 9%, transparent), transparent 70%) padding-box,
    linear-gradient(var(--carte-pleine), var(--carte-pleine)) padding-box,
    conic-gradient(from var(--angle), color-mix(in srgb, var(--neon) 20%, transparent) 0deg,
      var(--neon) 40deg, color-mix(in srgb, var(--neon) 20%, transparent) 90deg,
      color-mix(in srgb, var(--neon) 20%, transparent) 180deg,
      var(--neon) 220deg, color-mix(in srgb, var(--neon) 20%, transparent) 270deg) border-box;
  box-shadow: 0 0 44px -14px color-mix(in srgb, var(--neon) calc(var(--halo) * 100%), transparent),
              0 24px 40px -24px var(--ombre);
  animation: tour 9s linear infinite;
}
@keyframes tour { to { --angle: 360deg; } }
@media (prefers-reduced-motion: reduce) { .carte { animation: none; } }
.carte h2 { font-weight: 800; letter-spacing: -.01em; }
.carte h3 { color: var(--texte-doux); }
.tuile {
  --neon: var(--n-cyan);
  border-radius: 16px; padding: 14px 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--neon) 10%, var(--creux)), var(--creux));
  border: 1px solid color-mix(in srgb, var(--neon) 45%, transparent);
  box-shadow: inset 0 0 18px -6px color-mix(in srgb, var(--neon) 40%, transparent);
}
.tuile:nth-child(2) { --neon: var(--n-rose); }
.tuile:nth-child(3) { --neon: var(--n-violet); }
.tuile span.discret { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 600; }
.tuile strong { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
input, select { background: var(--creux); border-radius: 10px; }
button { border-radius: 10px; }
button.principal {
  background: linear-gradient(135deg, var(--n-cyan), var(--n-bleu));
  border: none; color: var(--accent-texte);
  box-shadow: 0 0 18px -4px color-mix(in srgb, var(--n-cyan) 70%, transparent);
}
.piste { background: var(--piste); height: 8px; border-radius: 4px; }
.remplissage {
  background: var(--serie-depenses); border-radius: 4px;
  box-shadow: 0 0 10px -1px color-mix(in srgb, var(--serie-depenses) 70%, transparent);
}
/* Dépassement : rouge et hachures, pour ne pas dépendre de la couleur seule. */
.ligne-categorie.depasse .remplissage {
  background: repeating-linear-gradient(135deg, var(--critique) 0 6px, color-mix(in srgb, var(--critique) 70%, var(--fond)) 6px 10px);
  box-shadow: 0 0 12px -1px color-mix(in srgb, var(--critique) 80%, transparent);
}
.bandeau.info, .proposition { background: var(--info-fond); border: 1px solid color-mix(in srgb, var(--n-cyan) 30%, transparent); border-radius: 12px; }
.bandeau.erreur { border: 1px solid color-mix(in srgb, var(--critique) 40%, transparent); border-radius: 12px; }
.groupe-mois.choisi .zone { fill: color-mix(in srgb, var(--n-cyan) 10%, transparent); }
.accueil .carte { --neon: var(--n-violet); }

/* ===== Graphiques animés, à la manière de Healthy ===== */
.heros { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; margin-bottom: 12px; }
.heros .tuiles { grid-template-columns: 1fr; margin: 0; }
.anneaux { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }

.anneau { --taille: 168px; position: relative; width: var(--taille); height: var(--taille); flex: none; }
.anneau.petit { --taille: 116px; }
.anneau svg { width: 100%; height: 100%; display: block; overflow: visible; }
.anneau .orbite { transform-box: view-box; transform-origin: 75px 75px; animation: orbite 24s linear infinite; }
.anneau .pointilles { fill: none; stroke: color-mix(in srgb, var(--c) 55%, transparent); stroke-width: 1.5; stroke-dasharray: 2 6; }
.anneau .comete { fill: var(--texte); filter: drop-shadow(0 0 4px var(--c)); }
.anneau .piste-anneau { fill: none; stroke: var(--piste); stroke-width: 11; }
.anneau .arc {
  fill: none; stroke: var(--c); stroke-width: 11; stroke-linecap: round;
  transform-box: view-box; transform-origin: 75px 75px; transform: rotate(-90deg);
  animation: remplir 1.8s cubic-bezier(.22, 1, .36, 1) both;
}
.anneau .arc.halo { filter: blur(5px); opacity: .75; }
.anneau .centre {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; line-height: 1.1; pointer-events: none;
}
.anneau .centre strong { font-size: 2.3rem; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.anneau .centre small { font-size: 1rem; font-weight: 700; color: var(--c); margin-left: 2px; letter-spacing: 0; }
.anneau .sous { margin-top: 4px; font-size: .9rem; font-weight: 700; color: color-mix(in srgb, var(--c) 75%, var(--texte)); }
.anneau .micro { margin-top: 2px; font-size: .62rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--discret); }
.anneau.petit .centre strong { font-size: 1.6rem; }
.anneau.petit .centre small { font-size: .8rem; }
.anneau.petit .sous { font-size: .8rem; margin-top: 2px; }
.anneau.petit .micro { font-size: .56rem; }
.anneau.depasse .centre strong { color: var(--critique); }
@keyframes orbite { to { transform: rotate(360deg); } }
@keyframes remplir { from { stroke-dasharray: 0 100; } }

.jauges { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 14px 10px; margin: 6px 0 18px; }
.jauge-categorie {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px 10px;
  border-radius: 16px; background: var(--creux); border: 1px solid var(--bordure);
}
.jauge-titre { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.nom-jauge { font-weight: 700; font-size: .88rem; text-align: center; }

/* Courbes de l'historique */
.courbes .grille { stroke: var(--grille); stroke-dasharray: 3 5; }
.courbes .serie .trait { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 100 100; animation: tracer 1.6s cubic-bezier(.22, 1, .36, 1) both; }
.courbes .serie .trait.halo { stroke-width: 7; filter: blur(5px); opacity: .55; }
.courbes .serie.revenus .trait { stroke: var(--serie-revenus); }
.courbes .serie.depenses .trait { stroke: var(--serie-depenses); }
.courbes .serie .aire { animation: apparaitre 1.2s .5s ease-out both; }
.courbes .serie .comete {
  fill: none; stroke: var(--texte); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 5 95;
  animation: parcourir 5s 1.6s linear infinite both;
}
.courbes .serie.depenses .comete { animation-delay: 4.1s; }
.arret-revenus { stop-color: var(--serie-revenus); }
.arret-depenses { stop-color: var(--serie-depenses); }
.courbes .point { fill: var(--carte-pleine); stroke-width: 2.5; animation: apparaitre .5s ease-out both; }
.courbes .point.serie-revenus { stroke: var(--serie-revenus); }
.courbes .point.serie-depenses { stroke: var(--serie-depenses); }
.courbes .repere { stroke: transparent; stroke-width: 1; stroke-dasharray: 3 4; }
.courbes .groupe-mois .zone { fill: transparent; }
.courbes .groupe-mois:hover .zone { fill: color-mix(in srgb, var(--n-cyan) 6%, transparent); }
.courbes .groupe-mois.choisi .zone { fill: color-mix(in srgb, var(--n-cyan) 9%, transparent); }
.courbes .groupe-mois.choisi .repere { stroke: color-mix(in srgb, var(--n-cyan) 60%, transparent); }
.courbes .groupe-mois.choisi .point { r: 6.5; }
.courbes .groupe-mois.choisi .point.serie-revenus { fill: var(--serie-revenus); filter: drop-shadow(0 0 6px var(--serie-revenus)); }
.courbes .groupe-mois.choisi .point.serie-depenses { fill: var(--serie-depenses); filter: drop-shadow(0 0 6px var(--serie-depenses)); }
.cle { border-radius: 999px; box-shadow: 0 0 8px currentColor; }
.cle.serie-revenus { color: var(--serie-revenus); }
.cle.serie-depenses { color: var(--serie-depenses); }
@keyframes tracer { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes parcourir { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes apparaitre { from { opacity: 0; } }

/* Barres des catégories : dégradé, reflet qui passe, poussée à l'arrivée */
.barres .piste { height: 12px; border-radius: 6px; overflow: visible; }
.barres .remplissage {
  position: relative; overflow: hidden; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--serie-depenses) 50%, transparent), var(--serie-depenses));
  animation: pousser 1.4s cubic-bezier(.22, 1, .36, 1) both;
}
.barres .reflet {
  position: absolute; inset: 0 auto 0 0; width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: reflet 3.2s 1.4s linear infinite both;
}
.barres .repere-budget { top: -4px; bottom: -4px; width: 3px; box-shadow: 0 0 6px var(--texte); }
@keyframes pousser { from { width: 0; } }
@keyframes reflet { 0% { transform: translateX(-140%); } 60%, 100% { transform: translateX(400%); } }

/* ===== Graphiques propres aux finances ===== */
:root { --bz1: #b9c4cf; --bz2: #ffffff; --liq-haut: #4fb8f5; --liq-bas: #2f6bf0; }
:root:not([data-theme="light"]) { --bz1: #2a3139; --bz2: #b4bec9; --liq-haut: #2bbfe6; --liq-bas: #2c56c9; }
.duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.duo > .carte { margin-bottom: 16px; }
.verdict { font-size: .8rem; font-weight: 600; color: var(--discret); text-align: center; max-width: 190px; }
.anneaux { align-items: flex-start; gap: 28px; }

/* Rythme du mois */
.anneau.rythme { --taille: 184px; }
.rythme .jour { stroke: var(--piste); stroke-width: 3; stroke-linecap: round; animation: allumer .5s ease-out both; }
.rythme .jour.allume { stroke: var(--n-violet); filter: drop-shadow(0 0 3px var(--n-violet)); }
.rythme .jour.aujourdhui { stroke: var(--texte); stroke-width: 3.5; filter: drop-shadow(0 0 5px var(--n-cyan)); animation: allumer .5s ease-out both, clignoter 1.8s 1.5s ease-in-out infinite; }
.rythme .piste-anneau, .rythme .arc { stroke-width: 12; }
.rythme .arc { transform-origin: 90px 90px; }
.repere-rythme { fill: var(--carte-pleine); stroke: var(--texte); stroke-width: 2.5; filter: drop-shadow(0 0 4px var(--texte)); animation: apparaitre .6s 1.4s both; }
@keyframes allumer { from { opacity: 0; } }
@keyframes clignoter { 50% { opacity: .35; } }

/* Bocal d'épargne */
.bocal {
  width: 168px; height: 168px; border-radius: 50%; padding: 7px; position: relative;
  background: conic-gradient(from 110deg, var(--bz1), var(--bz2) 15%, var(--bz1) 35%, var(--bz2) 60%, var(--bz1) 80%, var(--bz1));
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--n-cyan) 65%, transparent),
              0 0 28px -4px color-mix(in srgb, var(--n-cyan) calc(var(--halo) * 150%), transparent);
}
.bocal.negatif { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--critique) 65%, transparent), 0 0 28px -4px color-mix(in srgb, var(--critique) 50%, transparent); }
.bocal .interieur { position: relative; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: var(--creux); }
.bocal .liquide { position: absolute; left: 0; right: 0; bottom: 0; height: var(--niveau); animation: monter 1.8s cubic-bezier(.22, 1, .36, 1) both; }
.bocal .corps { position: absolute; inset: 0; background: linear-gradient(var(--liq-haut), var(--liq-bas)); opacity: .85; }
.bocal .vague { position: absolute; left: 0; bottom: calc(100% - 1px); width: 200%; height: 12px; animation: onduler 4s linear infinite; }
.bocal .vague path { fill: var(--liq-haut); opacity: .85; }
.bocal .vague.arriere { animation-duration: 6.5s; animation-direction: reverse; opacity: .5; height: 15px; }
.bocal .bulle {
  position: absolute; bottom: 4px; border-radius: 50%;
  background: rgba(255, 255, 255, .28); border: 1px solid rgba(255, 255, 255, .65);
  animation: bulle 3.4s ease-in infinite both;
}
.bocal .centre { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.bocal .centre strong { font-size: 2.2rem; font-weight: 800; letter-spacing: -.04em; text-shadow: 0 1px 8px var(--fond); }
.bocal .centre small { font-size: 1rem; margin-left: 2px; }
.bocal .sous { margin-top: 4px; font-weight: 700; font-size: .9rem; text-shadow: 0 1px 6px var(--fond); }
.bocal .micro { margin-top: 2px; font-size: .62rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--texte-doux); text-shadow: 0 1px 6px var(--fond); }
.bocal.negatif .centre strong, .bocal.negatif .sous { color: var(--critique); }
@keyframes monter { from { height: 0; } }
@keyframes onduler { to { transform: translateX(-50%); } }
@keyframes bulle {
  0% { bottom: 4px; transform: scale(.5); opacity: 0; }
  15% { opacity: .9; }
  80% { opacity: .7; }
  100% { bottom: 88%; transform: scale(1.1) translateX(3px); opacity: 0; }
}

/* Course du mois */
.course .grille { stroke: var(--grille); stroke-dasharray: 3 5; }
.course .mois-precedent { fill: none; stroke: var(--discret); stroke-width: 2; stroke-dasharray: 2 2.5; opacity: .7; animation: apparaitre 1s .3s both; }
.course .plafond { stroke: var(--serie-revenus); stroke-width: 1.5; stroke-dasharray: 6 5; opacity: .8; }
.course .etiquette-plafond { fill: var(--serie-revenus); font-weight: 600; }
.course .trait { fill: none; stroke: var(--serie-depenses); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 100 100; animation: tracer 1.8s cubic-bezier(.22, 1, .36, 1) both; }
.course .trait.halo { stroke-width: 8; filter: blur(5px); opacity: .55; }
.course .aire { animation: apparaitre 1.2s .6s both; }
.course .comete { fill: none; stroke: var(--texte); stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 6 94; animation: parcourir 4.5s 1.8s linear infinite both; }
.course .bout { fill: var(--serie-depenses); stroke: var(--carte-pleine); stroke-width: 2; filter: drop-shadow(0 0 6px var(--serie-depenses)); animation: apparaitre .4s 1.6s both; }
.course .pouls { fill: none; stroke: var(--serie-depenses); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: pouls 2s 1.8s ease-out infinite both; }
.course .valeur-bout { fill: var(--texte); font-weight: 800; font-size: 15px; animation: apparaitre .4s 1.7s both; }
@keyframes pouls { from { transform: scale(1); opacity: .9; } to { transform: scale(3.2); opacity: 0; } }
.cle.tiret { background: repeating-linear-gradient(90deg, var(--discret) 0 3px, transparent 3px 5px); box-shadow: none; width: 18px; height: 3px; border-radius: 0; }
.cle.plafond { background: repeating-linear-gradient(90deg, var(--serie-revenus) 0 5px, transparent 5px 8px); box-shadow: none; width: 18px; height: 2px; border-radius: 0; }
.comparaison { margin: 6px 0 0; font-size: .92rem; color: var(--texte-doux); }
.comparaison.bien strong { color: var(--positif); }
.comparaison.plus strong { color: var(--negatif); }

/* Calendrier des dépenses */
.calendrier { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.entete-jour { text-align: center; font-size: .7rem; font-weight: 700; letter-spacing: .1em; color: var(--discret); }
.case {
  position: relative; aspect-ratio: 1; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--n-violet) var(--t), var(--creux));
  border: 1px solid color-mix(in srgb, var(--n-violet) calc(var(--t) * .8), transparent);
  animation: surgir .45s cubic-bezier(.34, 1.56, .64, 1) both;
}
.case.hors { background: none; border: none; animation: none; }
.case.a-venir { background: none; border: 1px dashed var(--bordure); }
.case.zero { background: var(--creux); border-color: color-mix(in srgb, var(--n-cyan) 45%, transparent); }
.case.fort { box-shadow: 0 0 16px -3px var(--n-violet); }
.case.aujourdhui { outline: 2px solid var(--n-cyan); outline-offset: 2px; animation: surgir .45s both, respirer 2.4s 1s ease-in-out infinite; }
.case .numero { position: absolute; top: 3px; left: 6px; font-size: .62rem; font-weight: 600; color: var(--texte-doux); }
.case .somme-jour { font-size: .78rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 8px; }
.case.fort .somme-jour, .case.fort .numero { color: #fff; }
.etoile { color: var(--n-cyan); text-shadow: 0 0 8px var(--n-cyan); }
.case .etoile { margin-top: 8px; font-size: .9rem; }
.resume-calendrier { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin-top: 12px; font-size: .88rem; color: var(--texte-doux); }
@keyframes surgir { from { transform: scale(.6); opacity: 0; } }
@keyframes respirer { 50% { outline-color: color-mix(in srgb, var(--n-cyan) 30%, transparent); } }

/* Où va l'argent */
.flux { overflow: visible; margin-top: 4px; max-height: 560px; }
.course .axe { font-size: 17px; }
.course .etiquette-plafond { font-size: 13px; }
.flux .source { fill: var(--serie-revenus); filter: drop-shadow(0 0 8px var(--serie-revenus)); }
.flux .etiquette-source { fill: var(--texte); font-weight: 800; font-size: 12px; }
.flux .ruban { animation: deplier 1.3s cubic-bezier(.22, 1, .36, 1) both; }
.flux .ruban:hover .bande { filter: brightness(1.35); }
.flux .noeud { fill: var(--c); filter: drop-shadow(0 0 6px var(--c)); }
.flux .particules { fill: none; stroke: var(--texte); stroke-linecap: round; stroke-dasharray: 0 7; opacity: .6; animation: couler 2.4s linear infinite; }
.flux .etiquette-flux { fill: var(--texte); font-weight: 700; font-size: 11px; }
.flux .etiquette-flux.reste { fill: var(--serie-revenus); }
.flux .montant-flux { fill: var(--discret); font-size: 9.5px; font-variant-numeric: tabular-nums; }
@keyframes deplier { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes couler { to { stroke-dashoffset: -14; } }

/* Budgets */
.jauge-categorie.depasse { border-color: color-mix(in srgb, var(--critique) 50%, transparent); box-shadow: 0 0 18px -6px var(--critique); }
.detail-jauge { font-size: .78rem; color: var(--discret); margin-top: -4px; }
.jauge-categorie.depasse .detail-jauge { color: var(--critique); font-weight: 700; }

/* ===== Première carte : jauges puis tuiles ===== */
.heros { display: block; }
.heros .anneaux { justify-content: space-around; align-items: center; gap: 24px 28px; margin-bottom: 18px; }
.heros .tuiles { grid-template-columns: repeat(4, 1fr); }
.tuile-epargne { --neon: var(--liq-haut) !important; }
.tuile:nth-child(4) { --neon: var(--n-bleu); }
.bocal .verse { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(var(--liq-bas), color-mix(in srgb, var(--liq-bas) 70%, #000)); opacity: .9; animation: monter 1.8s .3s cubic-bezier(.22, 1, .36, 1) both; }
.bocal .bulle { z-index: 1; }

/* Reste à vivre */
.reste-a-vivre {
  flex: 1 1 300px; max-width: 380px; display: flex; flex-direction: column; gap: 10px;
  padding: 14px 16px 12px; border-radius: 20px; background: var(--creux);
  border: 1px solid color-mix(in srgb, var(--n-cyan) 40%, transparent);
  box-shadow: inset 0 0 24px -10px color-mix(in srgb, var(--n-cyan) 60%, transparent);
}
.reste-a-vivre.negatif { border-color: color-mix(in srgb, var(--critique) 55%, transparent); box-shadow: inset 0 0 24px -10px var(--critique); }
.compteur { position: relative; width: 100%; max-width: 270px; margin: 0 auto; }
.compteur svg { width: 100%; display: block; overflow: visible; }
.piste-compteur { fill: none; stroke: var(--piste); stroke-width: 14; stroke-linecap: round; }
.segment { fill: none; stroke-width: 14; animation: remplir 1.6s cubic-bezier(.22, 1, .36, 1) both; }
.segment.reste { stroke: var(--n-cyan); stroke-linecap: round; filter: drop-shadow(0 0 6px var(--n-cyan)); }
.segment.charges { stroke: var(--serie-depenses); opacity: .85; }
.segment.epargne { stroke: var(--liq-bas); opacity: .9; }
.reste-a-vivre.negatif .segment.charges { stroke: var(--critique); }
.centre-compteur { position: absolute; left: 0; right: 0; bottom: 2px; display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.centre-compteur .micro { font-size: .62rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--discret); }
.centre-compteur strong { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; color: var(--n-cyan); text-shadow: 0 0 18px color-mix(in srgb, var(--n-cyan) 45%, transparent); }
.reste-a-vivre.negatif .centre-compteur strong { color: var(--critique); text-shadow: 0 0 18px color-mix(in srgb, var(--critique) 45%, transparent); }
.centre-compteur .sous { font-size: .82rem; font-weight: 600; color: var(--texte-doux); }
.frise { display: flex; align-items: center; gap: 8px; font-size: .68rem; color: var(--discret); font-weight: 600; }
.rail { position: relative; flex: 1; height: 4px; border-radius: 2px; background: var(--piste); margin: 12px 4px 14px; }
.rail .lueur { position: absolute; left: 0; top: -1px; width: 22%; height: 6px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--n-cyan), transparent); animation: balayer 3.6s ease-in-out infinite; }
.prelevement { position: absolute; top: 50%; transform: translate(-50%, -50%); animation: surgir .5s both; }
.prelevement i { display: block; width: 12px; height: 12px; border-radius: 50%; background: var(--serie-depenses); border: 2px solid var(--creux); box-shadow: 0 0 10px var(--serie-depenses); }
.prelevement.epargne i { background: var(--liq-bas); box-shadow: 0 0 10px var(--liq-bas); }
.date-prelevement { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); font-size: .62rem; color: var(--texte-doux); }
.a-venir { list-style: none; margin: 0; padding: 0; font-size: .82rem; }
.a-venir li { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; border-top: 1px dashed var(--bordure); }
.a-venir li:first-child { border-top: none; }
.a-venir .jour-liste { min-width: 2ch; font-weight: 800; color: var(--serie-depenses); }
.a-venir li.epargne .jour-liste { color: var(--liq-haut); }
.a-venir .nom-liste { flex: 1; color: var(--texte-doux); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-venir .total-dispo .nom-liste { color: var(--texte); font-weight: 600; }
.a-venir .montant { font-weight: 700; }
@keyframes balayer { 0% { left: -22%; opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { left: 100%; opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .anneau .orbite, .anneau .arc, .courbes .trait, .courbes .aire, .courbes .point, .courbes .comete,
  .segment, .rail .lueur, .prelevement, .bocal .verse,
  .barres .remplissage, .barres .reflet, .rythme .jour, .repere-rythme, .bocal *, .course *, .case, .flux * { animation: none !important; }
  .bocal .bulle, .flux .particules { display: none; }
  .courbes .comete, .barres .reflet { display: none; }
}

@media (max-width: 600px) {
  .entete { padding: 8px 12px 0; }
  .marque { flex: 1; }
  .entete nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; }
  main { padding: 12px; }
  .carte { padding: 12px; }
  td.actions button { display: block; width: 100%; }
  td.actions button + button { margin: 4px 0 0; }
  td select { max-width: 140px; }
  .grille { grid-template-columns: 1fr; }
  .filtres-repli > summary { display: block; cursor: pointer; color: var(--accent); margin-bottom: 8px; }
  .filtres label { flex: 1 1 140px; }
  table.operations tr { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; padding: 8px 0; border-top: 1px solid var(--bordure); }
  table.operations td { border: none; padding: 0; }
  table.operations td.date { grid-column: 1; grid-row: 1; }
  table.operations td.nombre { grid-column: 3; grid-row: 1; }
  table.operations td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  table.operations td:nth-child(3) { grid-column: 1 / 3; grid-row: 3; }
  table.operations td:nth-child(3) select { max-width: none; width: 100%; }
  table.operations td.actions { grid-column: 3; grid-row: 3; }
  table.operations td.actions button { width: auto; }
  tr.a-classer td:first-child { box-shadow: none; }
  tr.a-classer { box-shadow: inset 3px 0 var(--accent); padding-left: 8px !important; }
  .montant-budget { width: 80px; }
  .graphique .axe { font-size: 20px; }
  .tuiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tuile { padding: 10px 12px; }
  .tuile strong { font-size: 1.15rem; }
  .tuile:nth-child(3) { grid-column: 1 / -1; }
  .heros { grid-template-columns: 1fr; gap: 12px; }
  .heros .tuiles { grid-template-columns: 1fr 1fr; }
  .tuile:nth-child(3) { grid-column: auto; }
  .reste-a-vivre { max-width: none; }
  .anneaux { gap: 10px; }
  .anneau { --taille: 150px; }
  .anneau.petit { --taille: 108px; }
  .jauges { grid-template-columns: repeat(2, 1fr); }
  .duo { grid-template-columns: 1fr; gap: 0; }
  .anneaux { gap: 12px; }
  .anneau.rythme { --taille: 158px; }
  .rythme .centre strong { font-size: 1.9rem; }
  .rythme .sous { font-size: .75rem; }
  .bocal { width: 148px; height: 148px; }
  .calendrier { gap: 4px; }
  .case .somme-jour { display: none; }
  .case .etoile { margin-top: 6px; }
  .flux .etiquette-flux { font-size: 12px; }
  .flux .montant-flux { font-size: 10.5px; }
  .flux .etiquette-source { font-size: 13px; }
  .flux { max-height: none; }
  .course .axe { font-size: 22px; }
  .course .etiquette-plafond { font-size: 19px; }
  .course .valeur-bout { font-size: 22px; }
  .budgets td.actions button { font-size: .75rem; }
}

/* ===== Étape 6 : prévision, bouclier, horloge, sablier, alertes ===== */
:root { --sable-1: #ffd36b; --sable-2: #f2a100; --serie-solde: #2f6bf0; }
:root:not([data-theme="light"]) { --sable-1: #ffe08a; --sable-2: #ffb300; --serie-solde: #4addf3; }

/* Horizon 30 jours */
.cle.serie-solde { color: var(--serie-solde); background: var(--serie-solde); }
.cle.eventail { background: color-mix(in srgb, var(--n-violet) 35%, transparent); box-shadow: none; border-radius: 3px; }
.cle.zone-seuil { background: repeating-linear-gradient(135deg, var(--critique) 0 2px, transparent 2px 5px); box-shadow: none; border-radius: 3px; }
.horizon .grille { stroke: var(--grille); stroke-dasharray: 3 5; }
.horizon .grille.zero { stroke: var(--discret); stroke-dasharray: none; opacity: .5; }
.horizon .fond-hachures { fill: color-mix(in srgb, var(--critique) 6%, transparent); }
.horizon .hachure { stroke: color-mix(in srgb, var(--critique) 38%, transparent); stroke-width: 2; }
.horizon .zone-interdite { animation: apparaitre 1s .2s both; }
.horizon .ligne-seuil { stroke: var(--critique); stroke-width: 1.6; stroke-dasharray: 7 5; filter: drop-shadow(0 0 4px var(--critique)); animation: gresiller 2.6s ease-in-out infinite; }
.horizon .etiquette-seuil { fill: var(--critique); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.horizon .eventail { fill: color-mix(in srgb, var(--n-violet) 16%, transparent); stroke: color-mix(in srgb, var(--n-violet) 40%, transparent); stroke-width: 1; stroke-dasharray: 2 4; animation: deplier 1.6s .3s cubic-bezier(.22, 1, .36, 1) both; }
.arret-solde { stop-color: var(--serie-solde); }
.horizon .aire { animation: apparaitre 1.2s .6s both; }
.horizon .trait { fill: none; stroke: var(--serie-solde); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 100 100; animation: tracer 1.8s cubic-bezier(.22, 1, .36, 1) both; }
.horizon .trait.halo { stroke-width: 9; filter: blur(6px); opacity: .55; }
.horizon .comete { fill: none; stroke: var(--texte); stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 5 95; animation: parcourir 5s 1.8s linear infinite both; }
.horizon .aujourdhui { stroke: var(--n-cyan); stroke-width: 1.5; stroke-dasharray: 2 3; }
.horizon .evenement { animation: tomber .7s cubic-bezier(.34, 1.56, .64, 1) both; }
.horizon .evenement .sillage { stroke: color-mix(in srgb, var(--serie-depenses) 45%, transparent); stroke-width: 1; stroke-dasharray: 1 3; }
.horizon .evenement .goutte { fill: var(--serie-depenses); stroke: var(--carte-pleine); stroke-width: 2; filter: drop-shadow(0 0 6px var(--serie-depenses)); }
.horizon .evenement.rentree .sillage { stroke: color-mix(in srgb, var(--n-cyan) 50%, transparent); }
.horizon .evenement.rentree .goutte { fill: var(--n-cyan); filter: drop-shadow(0 0 8px var(--n-cyan)); }
.horizon .evenement .signe { fill: #fff; font-size: 11px; font-weight: 800; pointer-events: none; }
.horizon .evenement.rentree .signe { fill: #061016; }
.horizon .evenement:hover .goutte { stroke-width: 3; }
.horizon .point-bas { fill: var(--carte-pleine); stroke: var(--n-jaune); stroke-width: 3; filter: drop-shadow(0 0 6px var(--n-jaune)); animation: apparaitre .4s 1.6s both; }
.horizon.alerte .point-bas { stroke: var(--critique); filter: drop-shadow(0 0 8px var(--critique)); }
.horizon .pouls-bas { fill: none; stroke: var(--n-jaune); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: pouls 2.2s 1.8s ease-out infinite both; }
.horizon.alerte .pouls-bas { stroke: var(--critique); }
.horizon .valeur-bas { fill: var(--n-jaune); font-weight: 800; font-size: 13px; animation: apparaitre .4s 1.7s both; }
.horizon.alerte .valeur-bas { fill: var(--critique); }
.horizon .valeur-fin { fill: var(--texte); font-weight: 800; font-size: 14px; animation: apparaitre .4s 1.7s both; }
@keyframes tomber { from { transform: translateY(-40px); opacity: 0; } }
@keyframes gresiller { 50% { opacity: .55; } }

/* Bouclier */
.bouclier { --b: var(--n-cyan); display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.bouclier.vigilance { --b: var(--n-jaune); }
.bouclier.alerte { --b: var(--critique); }
.ecu { position: relative; width: 150px; flex: none; margin: 0 auto; }
.ecu svg { width: 100%; display: block; overflow: visible; }
.ecu .fond-ecu { fill: var(--creux); }
.ecu .charge { fill: color-mix(in srgb, var(--b) 55%, transparent); animation: charger 1.8s cubic-bezier(.22, 1, .36, 1) both; }
.ecu .alveoles polygon { fill: none; stroke: color-mix(in srgb, var(--b) 45%, transparent); stroke-width: .8; animation: alveole 3.2s ease-in-out infinite both; }
.ecu .balayage { fill: color-mix(in srgb, #fff 22%, transparent); filter: blur(6px); animation: scanner 3.6s 1.2s ease-in-out infinite; }
.ecu .contour-ecu { fill: none; stroke: var(--b); stroke-width: 3; stroke-linejoin: round; filter: drop-shadow(0 0 8px var(--b)); }
.bouclier.alerte .contour-ecu { animation: gresiller 1.2s ease-in-out infinite; }
.ecu .fissure { fill: none; stroke: var(--texte); stroke-width: 2.2; stroke-linejoin: round; stroke-dasharray: 100 100; filter: drop-shadow(0 0 4px var(--critique)); animation: tracer 1.2s 1.2s ease-out both; }
.ecu .pourcent { position: absolute; left: 0; right: 0; top: 44%; text-align: center; font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; text-shadow: 0 1px 10px var(--fond); }
.infos-bouclier { flex: 1 1 220px; display: flex; flex-direction: column; gap: 8px; }
.etat-bouclier { font-size: 1.25rem; font-weight: 800; color: var(--b); text-shadow: 0 0 18px color-mix(in srgb, var(--b) 45%, transparent); }
.conseil { margin: 0; color: var(--texte-doux); }
.chiffres { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .88rem; }
.chiffres li { display: contents; }
.chiffres span { color: var(--discret); }
.chiffres strong { text-align: right; font-variant-numeric: tabular-nums; }
@keyframes charger { from { transform: translateY(100%); } }
@keyframes alveole { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes scanner { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translateY(170px); opacity: 0; } }

/* Horloge des prélèvements */
.horloge { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.horloge svg { width: 270px; max-width: 100%; flex: none; margin: 0 auto; overflow: visible; }
.horloge .orbite-ext { fill: none; stroke: color-mix(in srgb, var(--n-cyan) 35%, transparent); stroke-dasharray: 2 5; }
.horloge .orbite-int { fill: none; stroke: color-mix(in srgb, var(--serie-depenses) 30%, transparent); stroke-dasharray: 2 5; animation: orbite 60s linear infinite; transform-origin: 110px 110px; }
.horloge .graduation { stroke: var(--piste); stroke-width: 2.5; stroke-linecap: round; }
.horloge .graduation.passe { stroke: color-mix(in srgb, var(--n-violet) 70%, transparent); }
.horloge .repere-jour { fill: var(--discret); font-size: 8px; font-weight: 700; }
.horloge .aiguille { transform-origin: 110px 110px; transform: rotate(var(--angle-aiguille)); animation: aiguille 1.8s cubic-bezier(.22, 1, .36, 1) both; }
.horloge .aiguille line { stroke: var(--n-cyan); stroke-width: 2; stroke-linecap: round; filter: drop-shadow(0 0 4px var(--n-cyan)); }
.horloge .bout-aiguille { fill: var(--n-cyan); filter: drop-shadow(0 0 6px var(--n-cyan)); animation: apparaitre .4s 1.6s both; }
.horloge .planete { animation: surgir .6s cubic-bezier(.34, 1.56, .64, 1) both; transform-box: fill-box; transform-origin: center; }
.horloge .astre { fill: var(--serie-depenses); stroke: var(--carte-pleine); stroke-width: 1.5; }
.horloge .halo-planete { fill: color-mix(in srgb, var(--serie-depenses) 25%, transparent); animation: respirer-planete 3s ease-in-out infinite; }
.horloge .planete.rentree .astre { fill: var(--n-cyan); }
.horloge .planete.rentree .halo-planete { fill: color-mix(in srgb, var(--n-cyan) 30%, transparent); }
.horloge .planete.devinee .astre { fill-opacity: .55; stroke-dasharray: 2 2; }
.horloge .moyeu { fill: var(--creux); stroke: color-mix(in srgb, var(--n-violet) 50%, transparent); filter: drop-shadow(0 0 10px color-mix(in srgb, var(--n-violet) 40%, transparent)); }
.horloge .net { fill: var(--texte); font-size: 12px; font-weight: 800; }
.horloge .net-legende { fill: var(--discret); font-size: 6.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.resume-horloge { flex: 1 1 200px; display: flex; flex-direction: column; gap: 8px; }
.tuile-mini { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--creux);
  border: 1px solid color-mix(in srgb, var(--serie-depenses) 40%, transparent); font-size: .82rem; color: var(--discret); }
.tuile-mini strong { color: var(--texte); font-size: 1.05rem; }
.tuile-mini.rentree { border-color: color-mix(in srgb, var(--n-cyan) 45%, transparent); }
.a-venir li.rentree .jour-liste { color: var(--n-cyan); }
@keyframes aiguille { from { transform: rotate(0deg); } }
@keyframes respirer-planete { 50% { opacity: .35; } }

/* Récurrences */
.suggestions { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.suggestion { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 14px; background: var(--creux);
  border: 1px dashed color-mix(in srgb, var(--n-jaune) 55%, transparent); animation: surgir .45s both; }
.suggestion .etincelle { color: var(--n-jaune); text-shadow: 0 0 10px var(--n-jaune); animation: clignoter 2.4s ease-in-out infinite; }
.nom-suggestion { flex: 1 1 160px; display: flex; flex-direction: column; }
.repere h3 { margin: 0; }
.repere .titre-section { margin-bottom: 8px; }
table.recurrences tr.en-pause { opacity: .5; }
.ajout-recurrence { margin-top: 12px; }
.ajout-recurrence summary { cursor: pointer; color: var(--accent); font-weight: 600; }

/* Sablier du reste à vivre */
.sablier-bloc { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.sablier { width: 120px; flex: none; margin: 0 auto; }
.sablier svg { width: 100%; display: block; overflow: visible; }
.arret-sable-clair { stop-color: var(--sable-1); }
.arret-sable { stop-color: var(--sable-2); }
.sablier .sable { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--sable-2) 60%, transparent)); }
.sablier .sable.haut { animation: vider 2s cubic-bezier(.22, 1, .36, 1) both; }
.sablier .sable.bas { animation: emplir 2s cubic-bezier(.22, 1, .36, 1) both; }
.sablier .filet { stroke: var(--sable-1); stroke-width: 2; stroke-dasharray: 2 4; animation: couler 0.6s linear infinite; filter: drop-shadow(0 0 3px var(--sable-2)); }
.sablier .verre { fill: color-mix(in srgb, var(--n-jaune) 5%, transparent); stroke: color-mix(in srgb, var(--n-jaune) 70%, var(--texte)); stroke-width: 2; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--n-jaune) 50%, transparent)); }
.sablier .socle { fill: var(--creux); stroke: color-mix(in srgb, var(--n-jaune) 60%, transparent); stroke-width: 1.5; }
.sablier-bloc.negatif .verre { stroke: var(--critique); filter: drop-shadow(0 0 6px var(--critique)); }
.journee { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; }
.journee .micro { font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--discret); }
.journee .par-jour { font-size: 2.6rem; font-weight: 800; letter-spacing: -.04em; line-height: 1.05; color: var(--sable-2); text-shadow: 0 0 22px color-mix(in srgb, var(--sable-2) 45%, transparent); }
.sablier-bloc.negatif .par-jour { color: var(--critique); text-shadow: 0 0 22px color-mix(in srgb, var(--critique) 45%, transparent); }
.journee .sous { color: var(--texte-doux); font-weight: 600; }
.pieces { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.piece {
  width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800; color: #3a2600;
  background: radial-gradient(circle at 35% 30%, var(--sable-1), var(--sable-2) 70%);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, #fff 35%, transparent), 0 0 10px -2px var(--sable-2);
  animation: surgir .45s cubic-bezier(.34, 1.56, .64, 1) both;
}
.piece.jour-preleve { box-shadow: 0 0 0 2.5px var(--serie-depenses), 0 0 12px -1px var(--serie-depenses); }
.piece.aujourdhui { transform: scale(1.12); outline: 2px solid var(--n-cyan); outline-offset: 2px; animation: surgir .45s both, respirer 2.4s 1s ease-in-out infinite; }
.piece.mini { width: 12px; height: 12px; vertical-align: -2px; animation: none; }
.legende-pieces { margin: 4px 0 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.legende-pieces .piece.mini + .piece.mini, .legende-pieces .jour-preleve { margin-left: 10px; }
.jour-en-cours { flex: 1 1 220px; max-width: 300px; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 18px; background: var(--creux);
  border: 1px solid color-mix(in srgb, var(--sable-2) 40%, transparent); box-shadow: inset 0 0 22px -10px var(--sable-2); }
.jour-en-cours .micro { font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--discret); }
.jour-en-cours p { margin: 0; color: var(--texte-doux); }
.jour-en-cours strong { color: var(--texte); }
.jour-en-cours .demain strong { color: var(--sable-2); }
.barre-jour { position: relative; height: 12px; border-radius: 6px; background: var(--piste); margin: 4px 0; }
.remplissage-jour { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--sable-1), var(--sable-2)); box-shadow: 0 0 10px -1px var(--sable-2); animation: pousser 1.4s .4s cubic-bezier(.22, 1, .36, 1) both; }
.jour-en-cours.depasse { border-color: color-mix(in srgb, var(--critique) 55%, transparent); box-shadow: inset 0 0 22px -10px var(--critique); }
.jour-en-cours.depasse .remplissage-jour { background: repeating-linear-gradient(135deg, var(--critique) 0 6px, color-mix(in srgb, var(--critique) 70%, var(--fond)) 6px 10px); }
.barre-jour .repere-jour { position: absolute; top: -4px; bottom: -4px; width: 3px; border-radius: 2px; background: var(--texte); box-shadow: 0 0 6px var(--texte); }
.pilule-bouclier { --b: var(--n-cyan); align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 6px 14px 6px 8px;
  background: color-mix(in srgb, var(--b) 10%, transparent); border: 1px solid color-mix(in srgb, var(--b) 55%, transparent);
  box-shadow: 0 0 16px -6px var(--b); font-size: .85rem; color: var(--texte-doux); text-align: left; }
.pilule-bouclier.vigilance { --b: var(--n-jaune); }
.pilule-bouclier.alerte { --b: var(--critique); }
.pilule-bouclier strong { color: var(--b); }
.pilule-bouclier svg { width: 20px; height: 20px; flex: none; fill: color-mix(in srgb, var(--b) 35%, transparent); stroke: var(--b); stroke-width: 1.6; filter: drop-shadow(0 0 4px var(--b)); }
@keyframes vider { from { transform: translateY(-70px); } }
@keyframes emplir { from { transform: translateY(70px); } }

/* Cloche des alertes */
.cloche-bloc { position: relative; }
.cloche { position: relative; padding: 5px 8px; min-height: 0; border-radius: 999px; line-height: 0; }
.cloche svg { width: 20px; height: 20px; fill: none; stroke: var(--texte-doux); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.cloche.sonne svg { stroke: var(--n-jaune); filter: drop-shadow(0 0 5px var(--n-jaune)); transform-origin: 50% 10%; animation: sonner 3s ease-in-out infinite; }
.cloche .badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: .68rem; font-weight: 800; line-height: 18px;
  color: #fff; background: var(--critique); box-shadow: 0 0 10px var(--critique); }
.panneau-alertes {
  position: absolute; right: 0; top: calc(100% + 10px); width: min(380px, calc(100vw - 24px)); max-height: 75vh; overflow-y: auto; z-index: 5;
  padding: 14px; border-radius: 18px; background: var(--carte-pleine); color: var(--texte);
  border: 1px solid color-mix(in srgb, var(--n-violet) 45%, transparent);
  box-shadow: 0 0 40px -12px color-mix(in srgb, var(--n-violet) 70%, transparent), 0 24px 40px -20px var(--ombre);
  animation: surgir .25s ease-out both;
}
.panneau-alertes h3 { margin: 0; }
.liste-alertes { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
li.alerte { --v: var(--n-cyan); display: flex; gap: 10px; padding: 10px; border-radius: 12px; background: var(--creux); border: 1px solid var(--bordure); }
li.alerte.attention { --v: var(--n-jaune); }
li.alerte.critique { --v: var(--critique); }
li.alerte.non-lue { border-color: color-mix(in srgb, var(--v) 55%, transparent); box-shadow: inset 3px 0 var(--v); }
li.alerte .voyant { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; flex: none; background: var(--v); box-shadow: 0 0 8px var(--v); }
li.alerte:not(.non-lue) .voyant { opacity: .4; box-shadow: none; }
li.alerte p { margin: 2px 0; font-size: .86rem; color: var(--texte-doux); }
li.alerte strong { font-size: .92rem; }
.notif-telephone { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--bordure); }
@keyframes sonner { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(14deg); } 80% { transform: rotate(-12deg); } 85% { transform: rotate(8deg); } 90% { transform: rotate(-5deg); } }

@media (prefers-reduced-motion: reduce) {
  .horizon *, .ecu *, .horloge *, .sablier *, .piece, .suggestion, .suggestion *, .cloche svg, .panneau-alertes { animation: none !important; }
  .horizon .comete, .ecu .balayage { display: none; }
}

@media (max-width: 600px) {
  .moi { gap: 4px; }
  .horizon .axe { font-size: 11px; }
  .horizon .valeur-bas, .horizon .valeur-fin { font-size: 12px; }
  .ecu { width: 128px; }
  .journee .par-jour { font-size: 2.2rem; }
  .sablier { width: 96px; }
  .sablier-bloc { gap: 12px; }
  .piece { width: 26px; height: 26px; font-size: .66rem; }
  .panneau-alertes { position: fixed; left: 12px; right: 12px; top: 56px; width: auto; }
  table.recurrences tr { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; padding: 8px 0; border-top: 1px solid var(--bordure); }
  table.recurrences td { border: none; padding: 0; }
  table.recurrences td.date { grid-row: 1; padding-top: 2px; }
  table.recurrences td.actions { grid-column: 1 / -1; text-align: right; }
  table.recurrences td.actions button { width: auto; display: inline-block; }
  .jour-en-cours { max-width: none; }
}

/* Comptes : solde calé sur la banque, modification */
.sceau { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.sceau i { position: relative; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.sceau.cale { color: var(--n-cyan); }
.sceau.cale i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px solid currentColor; animation: pouls 2.4s ease-out infinite; }
.sceau.a-confirmer { color: var(--n-jaune); }
.sceau.a-confirmer i { animation: clignoter 1.6s ease-in-out infinite; }
tr.edition td { padding: 4px 0 12px; }
tr.edition .grille { margin-top: 0; padding: 12px; border-radius: 12px; background: var(--creux); border: 1px solid color-mix(in srgb, var(--n-violet) 45%, transparent); box-shadow: inset 0 0 22px -8px color-mix(in srgb, var(--n-violet) 50%, transparent); }
tr.edition select { max-width: none; width: 100%; }
tr.edition .aide { grid-column: 1 / -1; margin: 0; }
tr.edition label.coche { grid-column: span 2; align-self: center; }
label.coche { flex-direction: row; align-items: center; gap: 6px; color: var(--texte); }

/* Import : calage du solde sur la banque */
.calage { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin: 10px 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--creux); border: 1px solid color-mix(in srgb, var(--n-cyan) 35%, transparent); }
.calage > div:not(.fil) { display: flex; flex-direction: column; gap: 2px; }
.calage strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.calage .banque { text-align: right; }
.calage .banque strong { color: var(--n-cyan); text-shadow: 0 0 12px color-mix(in srgb, var(--n-cyan) 60%, transparent); }
.calage .fil { position: relative; height: 2px; border-radius: 2px; overflow: hidden; background: linear-gradient(90deg, color-mix(in srgb, var(--n-violet) 50%, transparent), var(--n-cyan)); }
.calage .fil i { position: absolute; top: -3px; width: 22%; height: 8px; border-radius: 4px; background: var(--n-cyan); filter: blur(3px); animation: balayer 1.8s ease-in-out infinite; }
.calage p { grid-column: 1 / -1; margin: 0; }
@media (prefers-reduced-motion: reduce) { .calage .fil i, .sceau i, .sceau i::after { animation: none; } }
.demande-solde { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.demande-solde input { width: 9em; }
.inconnus { flex-wrap: wrap; justify-content: flex-start; }
.demande-solde { justify-content: flex-start; }
.inconnus p { flex-basis: 100%; margin: 0; }
