/* Le garde-manger du foyer : lin, kraft, bois et confitures. */
@font-face { font-family: Fraunces; font-weight: 600; font-display: swap; src: url(polices/fraunces-latin-600.woff2) format("woff2"); }
@font-face { font-family: Fraunces; font-weight: 700; font-display: swap; src: url(polices/fraunces-latin-700.woff2) format("woff2"); }
@font-face { font-family: Caveat; font-weight: 500; font-display: swap; src: url(polices/caveat-latin-500.woff2) format("woff2"); }
@font-face { font-family: Caveat; font-weight: 700; font-display: swap; src: url(polices/caveat-latin-700.woff2) format("woff2"); }
@font-face { font-family: Nunito; font-weight: 400; font-display: swap; src: url(polices/nunito-latin-400.woff2) format("woff2"); }
@font-face { font-family: Nunito; font-weight: 600; font-display: swap; src: url(polices/nunito-latin-600.woff2) format("woff2"); }
@font-face { font-family: Nunito; font-weight: 700; font-display: swap; src: url(polices/nunito-latin-700.woff2) format("woff2"); }
@font-face { font-family: Nunito; font-weight: 800; font-display: swap; src: url(polices/nunito-latin-800.woff2) format("woff2"); }

:root {
  color-scheme: light;
  --lin: #f3eadb; --lin-2: #ebdfca; --carte: #fbf6ec; --bord: #eadbc2; --kraft: #d9bf94; --kraft-f: #b49a72;
  --bois: #9a6a45; --bois-f: #6e4529; --etagere: #f7efe2;
  --encre: #3b2a1e; --doux: #7a6553; --pale: #a8937e;
  --cornichon: #6f8f3d; --miel: #e3a33b; --confiture: #c2413a; --prune: #7a4a78; --ciel: #5f8fb0;
  --serie-1: #6f8f3d; --serie-2: #e3a33b; --grille: #eadfcb; --zero: #b49a72;
  --s1: #f7ead2; --s2: #f1d9ad; --s3: #e9c27f; --s4: #dba553; --s5: #c4862f; --s6: #9a6420;
  --ok: #557a2b; --ok-fond: #eef3e0; --critique: #b0362f; --critique-fond: #f9e3df;
  --attention: #9a5f0c; --attention-fond: #fbeccc;
  --ombre: 0 10px 30px -18px rgba(80, 50, 20, .45);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --lin: #211912; --lin-2: #2c2219; --carte: #2a2018; --bord: #3d2f22; --kraft: #6b5538; --kraft-f: #8c7350;
    --bois: #7a5232; --bois-f: #4e321c; --etagere: #2f251b;
    --encre: #f3e7d3; --doux: #c7b39a; --pale: #9a8670;
    --cornichon: #9cbb68; --miel: #efb85a; --confiture: #e06a5f; --prune: #b588b2; --ciel: #8fb6d4;
    --serie-1: #9cbb68; --serie-2: #efb85a; --grille: #3a2d21; --zero: #8c7350;
    --s1: #33281c; --s2: #4a3720; --s3: #6a4b22; --s4: #8d6226; --s5: #b07d2d; --s6: #d49b3c;
    --ok: #a9c97a; --ok-fond: #26301a; --critique: #f08a80; --critique-fond: #3a1f1b;
    --attention: #f2c063; --attention-fond: #3a2c12;
    --ombre: 0 10px 30px -18px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --lin: #211912; --lin-2: #2c2219; --carte: #2a2018; --bord: #3d2f22; --kraft: #6b5538; --kraft-f: #8c7350;
  --bois: #7a5232; --bois-f: #4e321c; --etagere: #2f251b;
  --encre: #f3e7d3; --doux: #c7b39a; --pale: #9a8670;
  --cornichon: #9cbb68; --miel: #efb85a; --confiture: #e06a5f; --prune: #b588b2; --ciel: #8fb6d4;
  --serie-1: #9cbb68; --serie-2: #efb85a; --grille: #3a2d21; --zero: #8c7350;
  --s1: #33281c; --s2: #4a3720; --s3: #6a4b22; --s4: #8d6226; --s5: #b07d2d; --s6: #d49b3c;
  --ok: #a9c97a; --ok-fond: #26301a; --critique: #f08a80; --critique-fond: #3a1f1b;
  --attention: #f2c063; --attention-fond: #3a2c12;
  --ombre: 0 10px 30px -18px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background-color: var(--lin); color: var(--encre); font: 16px/1.5 Nunito, system-ui, sans-serif;
  background-image: repeating-linear-gradient(0deg, rgba(120, 90, 60, .035) 0 1px, transparent 1px 4px),
                    repeating-linear-gradient(90deg, rgba(120, 90, 60, .03) 0 1px, transparent 1px 5px); }
a { color: var(--bois); }
main { max-width: 1080px; margin: 0 auto; padding: 0 16px 64px; }

/* En-tête */
.barre { max-width: 1080px; margin: 0 auto; padding: 20px 16px 0; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.marque { font: 700 24px Fraunces, serif; color: var(--encre); text-decoration: none; display: flex; align-items: baseline; gap: 8px; margin-right: auto; }
.marque small { font: 500 21px Caveat, cursive; color: var(--doux); }
.liens { display: flex; gap: 4px; flex-wrap: wrap; }
.liens a { padding: 7px 14px; border-radius: 999px; color: var(--encre); text-decoration: none; font-weight: 700; }
.liens a:hover { background: var(--lin-2); }
.liens a.actif { background: var(--encre); color: var(--lin); }
.qui { display: flex; align-items: center; gap: 8px; color: var(--doux); font-size: 14px; }
.qui button { font: inherit; background: none; border: 1px dashed var(--kraft-f); color: var(--doux); border-radius: 999px; padding: 3px 12px; cursor: pointer; }

/* Onglets années et mois : étiquettes kraft */
.onglets-annees { display: flex; gap: 6px; margin: 20px 0 8px; flex-wrap: wrap; }
.onglets-annees a { text-decoration: none; color: var(--doux); padding: 3px 14px; border-radius: 999px; font-weight: 700; }
.onglets-annees a.actif { background: var(--bois); color: #fff8ec; }
.onglets-mois { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: thin; }
.onglets-mois a, .onglets-mois span { flex: none; padding: 5px 13px; border: 2px dashed var(--kraft); border-radius: 10px; color: var(--doux); text-decoration: none; font-weight: 600; font-size: 15px; }
.onglets-mois a:hover { border-style: solid; }
.onglets-mois a.actif { background: var(--kraft); border-style: solid; border-color: var(--kraft); color: var(--encre); }
.onglets-mois span { opacity: .45; }
.onglets-mois .annee-tab { font-weight: 800; }

/* Titres et textes */
h1 { font: 600 clamp(30px, 5vw, 44px)/1.1 Fraunces, serif; margin: 22px 0 4px; }
h2 { font: 600 26px/1.2 Fraunces, serif; margin: 44px 0 4px; }
h3 { font: 700 24px Caveat, cursive; margin: 0; }
.sous-titre { color: var(--doux); margin: 0 0 8px; font-size: 17px; }
.aide { color: var(--doux); margin: 0 0 16px; max-width: 780px; }
.manuscrit { font: 600 20px/1.2 Caveat, cursive; color: var(--doux); }
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 18px; padding: 20px; box-shadow: var(--ombre); }
.grille2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* Accueil du mois : score + chiffres */
.accueil { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; margin-top: 20px; }
.score { display: flex; gap: 20px; align-items: center; }
.score .rond { width: 130px; height: 130px; flex: none; position: relative; }
.score .rond svg { width: 100%; height: 100%; }
.score .rond b { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font: 700 40px/1 Fraunces, serif; }
.score .rond b span { font: 600 13px Nunito; color: var(--doux); margin-top: 4px; }
.score h3 { color: var(--cornichon); font-size: 28px; }
.score.bas h3 { color: var(--confiture); }
.score p { margin: 4px 0 0; color: var(--doux); }
.score .niveau { display: inline-block; margin-top: 8px; background: var(--lin-2); border-radius: 999px; padding: 2px 12px; font-weight: 700; font-size: 14px; }
.detail-score { display: grid; gap: 4px; margin-top: 10px; font-size: 13px; color: var(--doux); }
.detail-score div { display: flex; justify-content: space-between; gap: 10px; border-top: 1px dashed var(--bord); padding-top: 3px; }
.chiffres { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chiffre { background: var(--lin-2); border-radius: 14px; padding: 14px 16px; }
.chiffre small { color: var(--doux); font-weight: 700; }
.chiffre b { display: block; font: 700 26px Fraunces, serif; font-variant-numeric: tabular-nums; }
.chiffre em { font: 600 18px/1.1 Caveat, cursive; color: var(--cornichon); font-style: normal; }
.chiffre em.mal { color: var(--confiture); }

/* Étagère de bocaux */
.etagere { position: relative; padding: 22px 20px 0; background: linear-gradient(var(--etagere), var(--lin-2)); border-radius: 18px; border: 1px solid var(--bord); }
.pots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; align-items: end; }
.pot { text-align: center; text-decoration: none; color: var(--encre); display: block; transition: transform .2s; }
a.pot:hover { transform: translateY(-6px) rotate(-1.5deg); }
.pot svg { width: 100%; max-width: 140px; height: auto; filter: drop-shadow(0 8px 6px rgba(70, 40, 15, .18)); }
.pot .nom { font: 700 22px/1.1 Caveat, cursive; margin-top: -2px; }
.pot .som { font-size: 13px; color: var(--doux); padding-bottom: 12px; }
.planche { height: 22px; margin: 0 -20px; background: linear-gradient(var(--bois), var(--bois-f)); border-radius: 0 0 18px 18px; box-shadow: 0 6px 12px -6px rgba(60, 30, 10, .5); }

/* Provisions (blocs de dépenses) */
.provisions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 26px; }
.provision { border-bottom: 1px dashed var(--bord); }
.provision summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 48px 1fr; gap: 14px; align-items: center; padding: 10px 4px; border-radius: 12px; }
.provision summary::-webkit-details-marker { display: none; }
.provision summary:hover { background: var(--lin-2); }
.provision .ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--lin-2); }
.provision .msg { display: block; }
.provision .l { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; }
.provision .l span { font-weight: 600; color: var(--doux); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.jauge { display: block; height: 14px; border-radius: 99px; background: var(--grille); margin-top: 6px; position: relative; overflow: hidden; }
.jauge i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--c, var(--cornichon)); }
.jauge s { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--encre); opacity: .35; }
.provision .msg { font: 600 18px/1.3 Caveat, cursive; color: var(--doux); }
.provision .msg.mal { color: var(--confiture); }
.provision .msg.bien { color: var(--cornichon); }
.cats { padding: 0 6px 12px 66px; }
.cat { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 5px 0; font-size: 14px; border-top: 1px dotted var(--bord); }
.cat details summary { cursor: pointer; color: var(--encre); }
.cat .montant { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.cat .ecart { grid-column: 2; text-align: right; font-size: 12px; color: var(--doux); }
.cat ul { margin: 4px 0 6px; padding-left: 16px; font-size: 13px; color: var(--doux); }
.cat li { display: flex; justify-content: space-between; gap: 12px; }
.legende-blocs { display: flex; gap: 18px; font-size: 13px; color: var(--doux); margin-bottom: 8px; flex-wrap: wrap; }
.legende-blocs i { display: inline-block; width: 18px; height: 10px; border-radius: 5px; background: var(--cornichon); margin-right: 6px; vertical-align: 0; }
.legende-blocs b { display: inline-block; width: 2px; height: 12px; background: var(--encre); opacity: .4; margin-right: 6px; vertical-align: -2px; }

/* Défi */
.defi { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center;
  background: repeating-linear-gradient(45deg, var(--carte) 0 14px, var(--lin-2) 14px 28px); }
.defi .badge { width: 70px; height: 70px; border-radius: 50%; background: var(--miel); display: grid; place-items: center; font-size: 34px; box-shadow: 0 0 0 6px color-mix(in srgb, var(--miel) 35%, transparent); }
.semaines { display: flex; gap: 6px; }
.semaines i { width: 26px; height: 26px; border-radius: 50%; background: var(--cornichon); display: grid; place-items: center; color: #fff; font-style: normal; font-size: 14px; }
.semaines i.vide { background: var(--carte); border: 2px dashed var(--kraft-f); }

/* Messages */
.message { margin-top: 16px; padding: 12px 16px; border-radius: 14px; font-weight: 600; }
.message.ok { background: var(--ok-fond); color: var(--ok); }
.message.erreur { background: var(--critique-fond); color: var(--critique); }
.message.attention { background: var(--attention-fond); color: var(--attention); }
.alerte { display: flex; gap: 12px; padding: 12px 16px; border-radius: 14px; margin-top: 12px; align-items: flex-start; font-weight: 600; }
.alerte .icone { flex: none; font-size: 20px; line-height: 1.2; }
.alerte.critique { background: var(--critique-fond); color: var(--critique); }
.alerte.attention { background: var(--attention-fond); color: var(--attention); }

/* Graphiques */
svg { width: 100%; height: auto; display: block; }
svg text.axe { font: 12px Nunito, sans-serif; fill: var(--doux); }
svg .grille { stroke: var(--grille); stroke-width: 1; }
svg .zero { stroke: var(--zero); stroke-width: 1.5; stroke-dasharray: 4 4; }
svg .cible { fill: transparent; }
svg .cible:hover { fill: var(--encre); fill-opacity: .05; }
svg .point { stroke: var(--carte); stroke-width: 2; pointer-events: none; }
svg .curseur { stroke: var(--doux); stroke-dasharray: 3 3; visibility: hidden; pointer-events: none; }
.legende { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--doux); margin-bottom: 8px; }
.legende i { display: inline-block; width: 18px; height: 10px; border-radius: 5px; margin-right: 6px; vertical-align: 0; }

/* Tableaux */
.defile { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { padding: 8px 8px; border-bottom: 1px dashed var(--bord); text-align: left; vertical-align: middle; }
thead th { color: var(--doux); font-weight: 700; font-size: 13px; border-bottom: 2px solid var(--bord); }
tbody th { font-weight: 700; }
td small { display: block; color: var(--pale); font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.positif { color: var(--ok); font-weight: 700; }
table.chaleur td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 62px; border-radius: 6px; }
table.chaleur th:first-child { min-width: 170px; }
table.chaleur thead a { color: var(--doux); }
.n0 { color: var(--pale); }
.n1 { background: var(--s1); } .n2 { background: var(--s2); } .n3 { background: var(--s3); }
.n4 { background: var(--s4); } .n5 { background: var(--s5); color: #fff; } .n6 { background: var(--s6); color: #fff; }
select.categorie { font: inherit; font-size: 13.5px; padding: 4px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--doux); max-width: 230px; }
select.categorie:hover, select.categorie:focus { border-color: var(--kraft); background: var(--carte); }
tr.a-classer select.categorie { border: 2px dashed var(--miel); color: var(--attention); font-weight: 700; }

/* Formulaires et boutons */
.filtres { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
input[type=search], input[type=text], input[type=password], input[type=file], input[type=date], input[type=number], select.champ {
  font: inherit; padding: 10px 12px; border: 1px solid var(--kraft); border-radius: 12px; background: var(--carte); color: var(--encre); }
.filtres input { flex: 1; min-width: 200px; }
button.principal, a.principal { font: inherit; font-weight: 800; background: var(--bois); color: #fff8ec; border: 0; border-radius: 999px; padding: 10px 20px; cursor: pointer; text-decoration: none; display: inline-block; box-shadow: 0 4px 0 var(--bois-f); }
button.principal:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--bois-f); }
button.secondaire, a.secondaire { font: inherit; font-weight: 700; background: var(--carte); color: var(--encre); border: 2px solid var(--kraft); border-radius: 999px; padding: 7px 16px; cursor: pointer; text-decoration: none; display: inline-block; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pagination { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; flex-wrap: wrap; align-items: center; }
.champ-solde { display: grid; gap: 6px; margin: 12px 0; font-size: 14px; color: var(--doux); }
.champ-solde input { max-width: 240px; }
.formulaire { display: grid; gap: 12px; }
.formulaire label { display: grid; gap: 4px; font-weight: 700; font-size: 14px; color: var(--doux); }
.couleurs { display: flex; gap: 8px; flex-wrap: wrap; }
.couleurs label { cursor: pointer; }
.couleurs input { position: absolute; opacity: 0; }
.couleurs span { display: block; width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--carte); box-shadow: 0 0 0 2px var(--kraft); }
.couleurs input:checked + span { box-shadow: 0 0 0 3px var(--encre); }
.couleurs input:focus-visible + span { outline: 2px solid var(--encre); outline-offset: 3px; }
.remplir { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.remplir input[type=text] { width: 110px; padding: 7px 10px; }

/* Connexion */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.connexion form { width: 100%; max-width: 380px; display: grid; gap: 14px; text-align: left; }
.connexion .bocal { width: 92px; margin: 0 auto -6px; }
.connexion h1 { margin: 0; text-align: center; font-size: 32px; }
.connexion .sous-titre { text-align: center; font: 600 22px Caveat, cursive; }
.connexion label { display: grid; gap: 4px; font-weight: 700; font-size: 14px; color: var(--doux); }
.connexion input { width: 100%; }
.connexion .erreur { color: var(--critique); margin: 0; font-weight: 700; }

#tip { position: fixed; pointer-events: none; background: var(--encre); color: var(--lin); font-size: 13px; padding: 6px 10px; border-radius: 10px; max-width: 320px; opacity: 0; transition: opacity .1s; z-index: 10; }
footer { margin-top: 48px; color: var(--pale); font: 500 19px Caveat, cursive; text-align: center; }

@media (max-width: 760px) {
  .accueil, .grille2, .provisions { grid-template-columns: 1fr; }
  .score { flex-direction: column; text-align: center; }
  .pots { grid-template-columns: repeat(2, 1fr); }
  .defi { grid-template-columns: auto 1fr; } .defi .semaines { grid-column: 1 / -1; }
  .cats { padding-left: 10px; }
  .barre { padding-top: 14px; } .marque { font-size: 21px; }
}
