/* Simulateur budgétaire chiffrons.fr — feuille autonome.
   Mêmes jetons que blog/assets/blog.css : fond clair, accent bleu,
   Geist / Geist Mono. Volontairement indépendante des chunks Next.js
   hashés du site principal, qui changent à chaque build. */

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --fg: #0c0a09;
  --muted: #52525b;
  --border: #e4e4e7;
  --accent: #1e40af;
  --positif: #15803d;
  --negatif: #b91c1c;
  --attention: #a16207;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Geist', system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: 'Geist Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

.site-header { border-bottom: 1px solid var(--border); padding: 1rem 1.5rem; background: var(--surface); }
.site-header nav {
  max-width: 1100px; margin: 0 auto; display: flex; gap: 1.25rem; align-items: center;
  font-family: 'Geist Mono', monospace; font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.03em; flex-wrap: wrap;
}
.site-header nav a { color: var(--muted); }
.site-header nav a.brand { color: var(--fg); font-weight: 600; margin-right: auto; }

main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.kicker {
  font-family: 'Geist Mono', monospace; font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); margin: 0 0 .5rem;
}
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.15; margin: 0 0 1rem; letter-spacing: -0.02em; }
.chapo { font-size: 1.05rem; color: var(--muted); max-width: 62ch; margin: 0 0 2rem; }
.chapo strong { color: var(--fg); }

/* ---- Disposition : liste à gauche, résultat collant à droite ---- */
.grille { display: grid; gap: 2rem; align-items: start; }
@media (min-width: 62rem) { .grille { grid-template-columns: minmax(0,1fr) 21rem; } }

/* ---- Panneau de résultat ---- */
.resultat {
  background: var(--surface); border: 1px solid var(--border); border-radius: .75rem;
  padding: 1.25rem; position: sticky; top: 0; z-index: 20;
}
@media (min-width: 62rem) { .resultat { top: 1rem; order: 2; } }
@media (max-width: 61.99rem) {
  .resultat { margin: 0 -1.5rem 2rem; border-radius: 0; border-left: 0; border-right: 0; padding: 1rem 1.5rem; }
}

.resultat h2 { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .5rem; font-weight: 600; }
.solde { font-size: clamp(2rem, 7vw, 2.75rem); font-weight: 700; line-height: 1; letter-spacing: -0.03em; display: block; }
.solde[data-signe="positif"] { color: var(--positif); }
.solde[data-signe="negatif"] { color: var(--negatif); }
.solde[data-signe="neutre"] { color: var(--muted); }
.solde-unite { font-size: .9rem; color: var(--muted); display: block; margin-top: .15rem; }
.solde-cumul { font-size: .85rem; color: var(--muted); margin: .5rem 0 0; }

.jauge { margin: 1rem 0 .5rem; }
.jauge-piste { height: .5rem; background: #e7e5e4; border-radius: 999px; overflow: hidden; position: relative; }
.jauge-barre { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .35s ease; }
.jauge-barre[data-atteint="oui"] { background: var(--positif); }
.jauge-reperes { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); margin-top: .35rem; }
.palier { font-size: .85rem; margin: .75rem 0 0; padding: .6rem .75rem; background: var(--bg); border-radius: .5rem; border: 1px solid var(--border); }
.compteur { font-size: .8rem; color: var(--muted); margin: .75rem 0 0; }

.partage { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.partage-liens { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.partage-liens a, .partage-liens button {
  font-family: 'Geist Mono', monospace; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  border: 1px solid var(--border); background: var(--bg); color: var(--fg);
  padding: .35rem .6rem; border-radius: .375rem; cursor: pointer; text-decoration: none;
}
.partage-liens a:hover, .partage-liens button:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---- Contrôles ---- */
.controles { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; align-items: center; }
.controles input[type="search"] {
  flex: 1 1 12rem; min-width: 0; padding: .5rem .7rem; border: 1px solid var(--border);
  border-radius: .5rem; font: inherit; font-size: .9rem; background: var(--surface); color: var(--fg);
}
.prereglages { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.25rem; }
.prereglages button, .filtres button {
  font-family: 'Geist Mono', monospace; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  padding: .4rem .65rem; border-radius: .375rem; cursor: pointer;
}
.prereglages button:hover, .filtres button:hover { border-color: var(--accent); color: var(--accent); }
.filtres { display: flex; gap: .4rem; }
.filtres button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- Liste des mesures ---- */
.theme { border: 1px solid var(--border); border-radius: .625rem; background: var(--surface); margin-bottom: .625rem; }
.theme > summary {
  cursor: pointer; padding: .75rem 1rem; font-weight: 600; display: flex;
  align-items: baseline; gap: .6rem; list-style: none;
}
.theme > summary::-webkit-details-marker { display: none; }
.theme > summary::before { content: '▸'; color: var(--muted); font-size: .8rem; transition: transform .15s; }
.theme[open] > summary::before { transform: rotate(90deg); }
.theme-compte { font-size: .75rem; color: var(--muted); font-weight: 400; margin-left: auto; }
.theme-liste { list-style: none; margin: 0; padding: 0 1rem 1rem; }

.mesure { display: flex; gap: .65rem; align-items: flex-start; padding: .55rem 0; border-top: 1px solid var(--border); }
.mesure input[type="checkbox"] { margin-top: .35rem; width: 1.05rem; height: 1.05rem; accent-color: var(--accent); flex: none; }
.mesure-corps { flex: 1; min-width: 0; }
.mesure label { cursor: pointer; font-size: .95rem; display: block; }
.mesure-meta { font-size: .78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; margin-top: .15rem; }
.montant { font-weight: 600; }
.montant[data-sens="economie"] { color: var(--positif); }
.montant[data-sens="depense"] { color: var(--negatif); }
.montant[data-sens="neutre"] { color: var(--muted); }
.mesure[hidden] { display: none; }

/* ---- Méthode ---- */
.methode { margin-top: 3rem; border-top: 1px solid var(--border); padding-top: 1.5rem; font-size: .9rem; color: var(--muted); }
.methode h2 { font-size: 1.1rem; color: var(--fg); margin: 0 0 .75rem; }
.methode h3 { font-size: .95rem; color: var(--fg); margin: 1.25rem 0 .4rem; }
.methode ul { padding-left: 1.1rem; }
.methode li { margin: .3rem 0; }
.sources { list-style: none; padding: 0; }
.sources li { padding: .5rem 0; border-top: 1px solid var(--border); }
.sources .valeur { font-family: 'Geist Mono', monospace; color: var(--fg); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
