/* Comptes de la chambre — charte DSK
   Bleu marine, gris bleutés, rayons 2–4 px, aucune ombre, aucun dégradé. */

:root {
  --marine: #0b2447;
  --texte: #0b2447;
  --texte-doux: #4a5a73;
  --texte-leger: #6b7a90;
  --lien: #1a4f9c;
  --fond: #ffffff;
  --fond-doux: #f4f6f9;
  --ligne: #d8dee7;
  --ligne-forte: #b9c3d1;
  --erreur: #b3261e;
  --rayon: 3px;
  --titre: "Newsreader", Georgia, "Times New Roman", serif;
  --corps: "Source Sans 3", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--corps);
  font-size: 16px;
  line-height: 1.5;
}

[hidden] { display: none !important; }

h1, h2 { font-family: var(--titre); font-weight: 500; margin: 0; }

code { font-size: 14px; background: var(--fond-doux); padding: 1px 4px; border-radius: 2px; }

/* Marque */
.logo {
  display: inline-block;
  font-family: var(--titre);
  font-weight: 600;
  letter-spacing: 0.06em;
  border: 1.5px solid var(--marine);
  border-radius: 2px;
  padding: 4px 10px;
  color: var(--marine);
}
.logo.petit { font-size: 14px; padding: 1px 7px; }

/* Connexion */
.connexion {
  max-width: 420px;
  margin: 0 auto;
  padding: 72px 24px 40px;
}
.connexion h1 { font-size: 34px; line-height: 1.15; margin-top: 28px; }
.connexion .sous-titre {
  font-family: var(--titre);
  font-style: italic;
  font-size: 20px;
  color: var(--texte-doux);
  margin: 6px 0 32px;
}

/* Champs */
.champ { display: block; margin-bottom: 16px; }
.champ > span { display: block; font-size: 14px; font-weight: 500; color: var(--texte-doux); margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"] {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--texte);
  background: var(--fond);
  border: 1px solid var(--ligne-forte);
  border-radius: var(--rayon);
  padding: 10px 12px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
input:focus { border-color: var(--marine); }
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--texte);
  -webkit-box-shadow: 0 0 0 1000px var(--fond) inset;
  transition: background-color 9999s;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* Boutons */
.bouton {
  display: inline-block;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--marine);
  background: var(--fond);
  border: 1px solid var(--marine);
  border-radius: var(--rayon);
  padding: 10px 18px;
  cursor: pointer;
}
.bouton:hover { background: var(--fond-doux); }
.bouton-plein { background: var(--marine); color: #fff; width: 100%; }
.bouton-plein:hover { background: #12305c; }
.bouton:disabled { opacity: 0.55; cursor: default; }
button:focus-visible, .lien:focus-visible, .fleche:focus-visible { outline: 2px solid var(--lien); outline-offset: 2px; }

.lien {
  font: inherit;
  font-size: 14px;
  color: var(--lien);
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.erreur { color: var(--erreur); font-size: 14px; margin: 0 0 14px; }
.note { color: var(--texte-leger); font-size: 14px; margin: 8px 0 0; }

/* En-tête */
.entete {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--fond);
  border-bottom: 1px solid var(--ligne);
  padding: calc(env(safe-area-inset-top) + 12px) 20px 10px;
}
.entete-ligne { display: flex; align-items: center; gap: 10px; max-width: 640px; margin: 0 auto; }
.entete-titre { font-size: 14px; color: var(--texte-doux); flex: 1; }
.navigation-mois {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 640px;
  margin: 10px auto 0;
}
.navigation-mois h1 { font-size: 26px; text-align: center; flex: 1; }
.fleche {
  width: 40px;
  height: 40px;
  font-size: 26px;
  line-height: 1;
  color: var(--marine);
  background: var(--fond);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  cursor: pointer;
}
.fleche:disabled { color: var(--ligne-forte); cursor: default; }

/* Contenu */
.contenu { max-width: 640px; margin: 0 auto; padding: 8px 20px calc(env(safe-area-inset-bottom) + 48px); }
.etat { font-size: 14px; color: var(--texte-leger); min-height: 21px; margin: 6px 0 0; text-align: right; }

.bloc { padding: 26px 0; border-bottom: 1px solid var(--ligne); }
.bloc:last-child { border-bottom: 0; }
.bloc h2 { font-size: 22px; }
.surtitre { font-family: var(--corps) !important; font-size: 13px !important; font-weight: 600 !important; letter-spacing: 0.08em; text-transform: uppercase; color: var(--texte-doux); }

/* Résultat */
.resultat { padding-top: 14px; }
.phrase-resultat {
  font-family: var(--titre);
  font-size: 30px;
  line-height: 1.2;
  margin: 10px 0 18px;
}
.phrase-resultat strong { font-weight: 600; }
.details { margin: 0; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--ligne); border-radius: var(--rayon); }
.details > div { padding: 12px 14px; }
.details > div + div { border-left: 1px solid var(--ligne); }
.details dt { font-size: 14px; color: var(--texte-doux); }
.details dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Report */
.lignes-report { margin-top: 12px; }
.ligne-simple { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 15px; }
.ligne-simple span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
.grille-deux { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.grille-deux .champ { margin-bottom: 0; }
.pleine-largeur { grid-column: 1 / -1; margin-top: 0; }

/* Charges */
.charge { border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 14px; margin-top: 14px; }
.charge-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.charge-nom { font-family: var(--titre); font-size: 20px; font-weight: 500; }
.charge-part { font-size: 14px; color: var(--texte-doux); }
.charge .grille-deux { margin-top: 10px; }
.charge-champs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 10px; align-items: end; }
.charge-champs .champ { margin-bottom: 0; }
.charge-champs .champ > span { font-size: 13px; }
.charge-bilan { margin-top: 12px; font-size: 15px; }
.charge-bilan .dette { font-weight: 600; }
.charge-bilan .reste { color: var(--texte-doux); }
.charge-pied { display: flex; justify-content: flex-end; margin-top: 6px; }

.ajout { display: flex; gap: 10px; margin-top: 16px; }
.ajout input { flex: 1; }

/* Mouvements */
.form-mouvement { margin-top: 16px; border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 14px; background: var(--fond-doux); }
.form-mouvement .grille-deux { margin: 0 0 16px; }
.choix { border: 0; margin: 0 0 14px; padding: 0; }
.choix legend { font-size: 14px; font-weight: 500; color: var(--texte-doux); margin-bottom: 6px; padding: 0; }
.choix { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.choix legend { grid-column: 1 / -1; }
.choix label { position: relative; }
.choix input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choix span {
  display: block;
  text-align: center;
  padding: 10px;
  font-weight: 600;
  border: 1px solid var(--ligne-forte);
  background: var(--fond);
  color: var(--texte-doux);
}
.choix label:first-of-type span { border-radius: var(--rayon) 0 0 var(--rayon); }
.choix label:last-of-type span { border-radius: 0 var(--rayon) var(--rayon) 0; border-left: 0; }
.choix input:checked + span { background: var(--marine); border-color: var(--marine); color: #fff; }
.choix input:focus-visible + span { outline: 2px solid var(--lien); outline-offset: 2px; }
.apercu { font-size: 14px; color: var(--texte-doux); margin: 0 0 14px; min-height: 21px; }

.liste-mouvements { list-style: none; padding: 0; margin: 18px 0 0; }
.mouvement { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--ligne); }
.mouvement:last-child { border-bottom: 1px solid var(--ligne); }
.mouvement-texte { font-size: 15px; }
.mouvement-meta { font-size: 14px; color: var(--texte-leger); }
.mouvement-montant { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.vide { color: var(--texte-leger); font-size: 15px; padding: 12px 0; margin: 0; }

.fin { text-align: center; }
.fin .bouton { width: 100%; }

@media (max-width: 380px) {
  .charge-champs { grid-template-columns: 1fr 1fr; }
  .charge-champs .champ:first-child { grid-column: 1 / -1; }
  .phrase-resultat { font-size: 26px; }
}
