/* Onglet Dépenses : liste, saisie, statistiques (graphiques SVG) et catégories. Couleurs prises aux variables de
   styles.css, redéfinies pour le thème Nuit (css/themes.css) ; les séries des graphiques ont leurs propres teintes claires et sombres. */

:root {
  --serie-0: #2563EB; --serie-1: #D97706; --serie-2: #059669; --serie-3: #9B51E0;
  --serie-4: #DC2626; --serie-5: #0284C7; --serie-6: #8D6E4F; --serie-7: #DB2777;
}
html[data-theme=nuit] {
  --serie-0: #6E9BFF; --serie-1: #FBBF24; --serie-2: #34D399; --serie-3: #C084FC;
  --serie-4: #F87171; --serie-5: #38BDF8; --serie-6: #C9A27E; --serie-7: #F472B6;
}

/* La navigation du téléphone passe à six liens : en grille, sur deux lignes de trois quand l'écran est étroit, pour
   que chaque lien reste visible et touchable, sans mot coupé. */
.t-nav { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.t-nav a { padding: 10px 2px 14px; white-space: nowrap; }
@media (max-width: 560px) {
  .t-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .t-nav a { padding: 9px 2px; }
}

/* ---------- page ---------- */
.coquille.collab .page-gestion { padding: 18px 16px 24px; }
.page-gestion .entete h1 { overflow-wrap: anywhere; }
.aide { color: var(--gris); font-size: 13px; }
.case { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; min-height: 40px; cursor: pointer; }
.case input { width: 20px; height: 20px; flex: none; accent-color: var(--bleu); }
.case.danger { color: var(--retard); }

/* ---------- filtres ---------- */
.filtres {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; align-items: end;
  margin: 0 0 16px;
}
.filtres .champ select, .filtres .champ input { min-width: 0; }

/* ---------- liste ---------- */
.depenses { list-style: none; margin: 0; padding: 0; border: 1px solid var(--filet); border-radius: 12px; background: var(--blanc); }
.depense { padding: 10px 14px; border-top: 1px solid var(--filet); display: grid; gap: 2px; }
.depense:first-child { border-top: 0; }
.dep-haut { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.dep-libelle { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.dep-montant { white-space: nowrap; font-size: 15.5px; }
.dep-bas { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; color: var(--gris); font-size: 13px; }
.dep-bas span { overflow-wrap: anywhere; min-width: 0; }
.dep-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-left: -8px; }
.dep-actions:empty { display: none; }
.dep-total {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 12px 0 0;
  padding: 12px 14px; border-radius: 12px; background: var(--bleu-pale); font-weight: 600;
}
.dep-total b { font-size: 19px; white-space: nowrap; }

/* ---------- saisie ---------- */
.saisie-depense #dep-montant { font-size: 22px; font-weight: 700; }
.saisie-depense .aide { display: block; margin-top: 4px; }

/* ---------- statistiques ---------- */
.tuiles-depenses { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tuiles-depenses .tuile b { font-size: clamp(20px, 5.5vw, 30px); overflow-wrap: anywhere; }
.tuiles-depenses .tuile small { color: var(--gris); font-size: 13px; }
.graphiques { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.graphique { min-width: 0; background: var(--blanc); }
.graphique.large { grid-column: 1 / -1; }
.g-graphe { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.g-echelle { display: flex; flex-direction: column; justify-content: space-between; height: 160px; font-size: 12px; color: var(--gris); text-align: right; }
.g-zone { display: block; width: 100%; height: 160px; overflow: visible; }
.g-etiquettes { display: grid; margin-top: 4px; font-size: 11.5px; color: var(--gris); text-align: center; line-height: 1.2; }
.g-etiquettes span { overflow: hidden; white-space: nowrap; }
.g-etiquettes small { display: block; font-size: 10.5px; }
.g-grille { stroke: var(--filet); stroke-width: 1; }
.g-barre { fill: var(--bleu); }
.g-surface { fill: var(--bleu-pale); }
.g-ligne { fill: none; stroke: var(--bleu); stroke-width: 2.5; stroke-linejoin: round; }
.g-serie-0 { fill: var(--serie-0); } .g-serie-1 { fill: var(--serie-1); } .g-serie-2 { fill: var(--serie-2); }
.g-serie-3 { fill: var(--serie-3); } .g-serie-4 { fill: var(--serie-4); } .g-serie-5 { fill: var(--serie-5); }
.g-serie-6 { fill: var(--serie-6); } .g-serie-7 { fill: var(--serie-7); }
.g-legende { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; }
.g-legende li { display: flex; align-items: center; gap: 6px; }
.g-postes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.g-postes li { display: grid; grid-template-columns: minmax(0, 10em) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.g-lib { overflow-wrap: anywhere; }
.g-lib small { color: var(--gris); }
.g-postes b { white-space: nowrap; font-size: 13.5px; }
.g-piste { display: block; width: 100%; height: 12px; border-radius: 4px; background: var(--survol); }
.g-chiffres { margin-top: 10px; font-size: 13.5px; }
.g-chiffres summary { cursor: pointer; color: var(--bleu-texte); font-weight: 600; min-height: 32px; }
.g-chiffres .grille { min-width: 0; }

/* ---------- catégories ---------- */
.ajouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 0 0 18px; }
.ajout-categorie { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; border: 1px solid var(--filet); border-radius: 12px; padding: 12px; }
.ajout-categorie .champ { flex: 1 1 160px; }
.categories, .sous-categories { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.categories > li { border: 1px solid var(--filet); border-radius: 12px; padding: 10px 12px; background: var(--blanc); }
.categories h3 { font-size: 14px; margin: 0 0 8px; }
.sous-categories { margin: 8px 0 0 18px; }
.categorie { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.categorie input { flex: 1 1 140px; min-width: 0; border: 1px solid var(--filet); border-radius: 8px; padding: 6px 10px; background: var(--blanc); min-height: 40px; }
.categorie.archivee input { opacity: .6; font-style: italic; }
.categorie small { color: var(--gris); }

@media (max-width: 820px) {
  .graphiques { grid-template-columns: minmax(0, 1fr); }
  .tuiles-depenses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-postes li { grid-template-columns: minmax(0, 1fr) auto; }
  .g-postes .g-piste { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- dépenses récurrentes (v1.2) : à saisir ce mois-ci, habituelles ---------- */
.bloc-recurrentes { margin: 0 0 18px; }
.bloc-recurrentes h2 { font-size: 16px; margin: 0 0 8px; }
.compte-retard { color: var(--retard); font-size: 14px; }
.a-saisir .recurrente.s-en_retard { border-left: 4px solid var(--retard); }
.a-saisir .recurrente.s-en_retard .dep-libelle { color: var(--retard); }
.habituelles { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.habituelle {
  display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border: 1px solid var(--filet);
  border-radius: 999px; background: var(--blanc); min-width: 0;
}
.habituelle .dep-libelle { overflow-wrap: anywhere; }
.categorie-archivee { color: var(--retard); font-weight: 600; }
.sauts { list-style: none; margin: 4px 0 0; padding: 0; font-size: 14px; color: var(--gris); }
.sauts li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
