/* Autopartage — feuille de style
   Repères visuels : tableau de bord (plaque sombre, chiffres ambrés),
   fond gris tôle, typographie système (aucune dépendance externe). */

:root {
  --nuit: #131a20;
  --nuit-clair: #26313b;
  --tole: #e6e9e7;
  --blanc: #ffffff;
  --ambre: #f2a71b;
  --vert: #1c7a5e;
  --rouge: #b8402c;
  --gris: #6b7780;
  --trait: #d3d8d6;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "DejaVu Sans Mono", "Liberation Mono", monospace;

  --rayon: 14px;
  --ombre: 0 1px 2px rgba(19, 26, 32, .06), 0 6px 18px rgba(19, 26, 32, .07);
}

* { box-sizing: border-box; }

/* L'attribut `hidden` du navigateur pose display:none, qu'une règle d'auteur
   sur .ecran, .vue ou .champ écraserait. On lui rend la priorité. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--tole);
  color: var(--nuit);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2 { margin: 0; letter-spacing: -.02em; }

a { color: var(--nuit); }

.eyebrow {
  margin: 0;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gris);
}

/* ---------------------------------------------------------- En-tête */

.entete {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--nuit);
  color: var(--blanc);
  padding: 1rem 1rem .5rem;
  padding-top: calc(1rem + env(safe-area-inset-top));
}

.entete__texte { max-width: 46rem; margin: 0 auto; }

.entete .eyebrow { color: var(--ambre); }

.entete h1 { font-size: 1.35rem; font-weight: 650; }

.onglets {
  display: flex;
  gap: .25rem;
  max-width: 46rem;
  margin: .75rem auto 0;
}

.onglet {
  flex: 1;
  padding: .55rem .25rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: rgba(255, 255, 255, .6);
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
}

.onglet.est-actif { color: var(--blanc); border-bottom-color: var(--ambre); }

.onglet:focus-visible { outline: 2px solid var(--ambre); outline-offset: 2px; }

/* ---------------------------------------------------------- Structure */

main { max-width: 46rem; margin: 0 auto; padding: 1rem; }

.vue { display: flex; flex-direction: column; gap: .85rem; }

.vue form { display: flex; flex-direction: column; gap: .85rem; }

.carte {
  background: var(--blanc);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 1rem;
}

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

@media (max-width: 420px) {
  .duo { grid-template-columns: 1fr; }
}

/* ------------------------------------------------ Signature : compteur */

.compteur {
  background: var(--nuit);
  border-radius: var(--rayon);
  padding: 1.1rem 1rem 1rem;
  box-shadow: var(--ombre);
}

.compteur__label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ambre);
  margin-bottom: .6rem;
}

.compteur__plaque {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  background: #0a0e12;
  border: 1px solid var(--nuit-clair);
  border-radius: 8px;
  padding: .5rem .75rem;
}

.compteur__plaque .compteur__saisie {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--ambre);
  font-family: var(--mono);
  font-size: 2.35rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .12em;
  padding: 0;
}

.compteur__plaque .compteur__saisie::placeholder { color: rgba(242, 167, 27, .22); }

.compteur__plaque .compteur__saisie:focus { outline: none; }

.compteur__plaque:focus-within { border-color: var(--ambre); }

.compteur__unite {
  font-family: var(--mono);
  font-size: 1rem;
  color: rgba(242, 167, 27, .65);
}

.compteur__aide {
  margin: .55rem 0 0;
  font-size: .82rem;
  color: rgba(255, 255, 255, .55);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------- Champs */

.champ { display: flex; flex-direction: column; gap: .3rem; }

.champ + .champ, .champ + .duo { margin-top: .75rem; }

.duo > .champ + .champ { margin-top: 0; }

.champ > span {
  font-size: .78rem;
  font-weight: 600;
  color: var(--gris);
}

input[type="text"], input[type="password"], input[type="number"],
input[type="date"], select, textarea {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--trait);
  border-radius: 9px;
  background: var(--blanc);
  color: var(--nuit);
  font: inherit;
  font-size: 1rem;
}

textarea { resize: vertical; }

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gris) 50%),
                    linear-gradient(135deg, var(--gris) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--nuit);
  outline-offset: 1px;
  border-color: var(--nuit);
}

.montant { position: relative; }

.montant input {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  padding-right: 2rem;
}

.montant__devise {
  position: absolute;
  right: .7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gris);
  font-size: .9rem;
  pointer-events: none;
}

.depense__entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .7rem;
}

.depense__entete h2 { font-size: 1rem; font-weight: 650; }

/* ---------------------------------------------------------- Boutons */

.bouton {
  display: block;
  width: 100%;
  padding: .75rem 1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.bouton--plein { background: var(--nuit); color: var(--blanc); }

.bouton--plein:hover { background: var(--nuit-clair); }

.bouton--large { padding: .95rem 1rem; font-size: 1.05rem; }

.bouton--discret {
  background: none;
  border-color: var(--trait);
  color: var(--gris);
  font-weight: 600;
  font-size: .9rem;
}

.bouton--discret:hover { border-color: var(--gris); color: var(--nuit); }

.bouton:focus-visible { outline: 2px solid var(--ambre); outline-offset: 2px; }

/* ---------------------------------------------------------- Listes */

.liste { display: flex; flex-direction: column; gap: .6rem; }

.entree {
  background: var(--blanc);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: .85rem 1rem;
}

.entree__haut {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
}

.entree__qui { font-weight: 650; }

.entree__quand { font-size: .8rem; color: var(--gris); font-variant-numeric: tabular-nums; }

.entree__km {
  margin: .2rem 0 .5rem;
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--gris);
  font-variant-numeric: tabular-nums;
}

.entree__note { margin: .5rem 0 0; font-size: .85rem; color: var(--gris); font-style: italic; }

.postes { display: flex; flex-wrap: wrap; gap: .35rem; }

.badge {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: var(--tole);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}

.badge b { font-weight: 650; }

.badge--perso { background: #fdf0d8; }

.entree__supprimer {
  margin-top: .6rem;
  border: 0;
  background: none;
  padding: 0;
  color: var(--gris);
  font: inherit;
  font-size: .8rem;
  text-decoration: underline;
  cursor: pointer;
}

.entree__supprimer:hover { color: var(--rouge); }

.vide {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--gris);
}

/* ---------------------------------------------------------- Bilan */

.resume {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--trait);
  border-radius: var(--rayon);
  overflow: hidden;
  box-shadow: var(--ombre);
}

.resume__bloc { background: var(--blanc); padding: .85rem .75rem; }

.resume__valeur {
  display: block;
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.resume__legende {
  display: block;
  margin-top: .15rem;
  font-size: .72rem;
  color: var(--gris);
}

.solde {
  background: var(--blanc);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: .9rem 1rem;
  border-left: 4px solid var(--trait);
}

.solde--crediteur { border-left-color: var(--vert); }

.solde--debiteur { border-left-color: var(--rouge); }

.solde__haut {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
}

.solde__nom { font-weight: 650; }

.solde__montant {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.solde--crediteur .solde__montant { color: var(--vert); }

.solde--debiteur .solde__montant { color: var(--rouge); }

.solde__detail { margin: .35rem 0 0; font-size: .82rem; color: var(--gris); }

.solde__phrase { margin: .3rem 0 0; font-size: .85rem; }

.note-methode {
  margin: .25rem 0 0;
  font-size: .8rem;
  line-height: 1.5;
  color: var(--gris);
}

/* ---------------------------------------------------------- Divers */

/* ------------------------------------------- Écrans d'accès */

.ecran {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--nuit);
}

.carte--ecran {
  width: 100%;
  max-width: 23rem;
  display: flex;
  flex-direction: column;
  gap: .8rem;
}

.carte--ecran .champ + .champ { margin-top: 0; }

.titre-ecran { font-size: 1.4rem; margin: .1rem 0 0; }

.intro { margin: 0; font-size: .88rem; color: var(--gris); }

.aide { font-size: .76rem; color: var(--gris); }

.case {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .88rem;
}

.case input { width: 1.05rem; height: 1.05rem; accent-color: var(--nuit); }

/* ------------------------------------------- Identité et profil */

.entete__haut {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  max-width: 46rem;
  margin: 0 auto;
}

.identite {
  margin: 0;
  padding-top: .15rem;
  font-size: .82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .7);
  text-align: right;
}

.comptes { display: flex; flex-direction: column; gap: .1rem; }

.compte { padding: .75rem 0; border-top: 1px solid var(--trait); }

.compte:first-child { border-top: 0; padding-top: 0; }

.compte--inactif { opacity: .55; }

.compte__haut {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}

.compte__nom { font-weight: 650; }

.compte__etiquettes { display: flex; gap: .3rem; flex-wrap: wrap; }

.puce {
  padding: .1rem .45rem;
  border-radius: 999px;
  background: var(--tole);
  font-size: .72rem;
  color: var(--gris);
}

.puce--admin { background: var(--nuit); color: var(--blanc); }

.compte__detail {
  margin: .2rem 0 .4rem;
  font-size: .8rem;
  color: var(--gris);
  font-variant-numeric: tabular-nums;
}

.compte__actions { display: flex; flex-wrap: wrap; gap: .25rem .9rem; }

.lien-inline {
  border: 0;
  padding: 0;
  background: none;
  color: var(--gris);
  font: inherit;
  font-size: .8rem;
  text-decoration: underline;
  cursor: pointer;
}

.lien-inline:hover { color: var(--nuit); }

.montant .lien-inline {
  position: absolute;
  right: .7rem;
  top: 50%;
  transform: translateY(-50%);
}

.montant:has(.lien-inline) input { padding-right: 5rem; }

.nouveau-compte { margin-top: 1.2rem; border-top: 1px solid var(--trait); padding-top: 1rem; }

.nouveau-compte h3 {
  margin: 0 0 .7rem;
  font-size: .95rem;
  font-weight: 650;
}

.nouveau-compte .case { margin-top: .75rem; }

.nouveau-compte .bouton { margin-top: .75rem; }

#vue-profil .bouton--discret { margin-top: .3rem; }

.erreur { margin: 0; color: var(--rouge); font-size: .88rem; min-height: 1.2em; }

.pied {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  font-size: .78rem;
  color: var(--gris);
  text-align: center;
}

.pied a { color: var(--gris); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translate(-50%, 150%);
  z-index: 50;
  max-width: 90vw;
  padding: .7rem 1.1rem;
  border-radius: 999px;
  background: var(--nuit);
  color: var(--blanc);
  font-size: .9rem;
  box-shadow: var(--ombre);
  transition: transform .28s ease;
}

.toast.est-visible { transform: translate(-50%, 0); }

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

/* ------------------------------------------- Filtres par période */

.filtre {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  padding: .1rem 0;
}

.puce-filtre {
  padding: .35rem .8rem;
  border: 1px solid var(--trait);
  border-radius: 999px;
  background: var(--blanc);
  color: var(--gris);
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.puce-filtre:hover { border-color: var(--gris); color: var(--nuit); }

.puce-filtre.est-actif {
  background: var(--nuit);
  border-color: var(--nuit);
  color: var(--blanc);
}

.puce-filtre:focus-visible { outline: 2px solid var(--ambre); outline-offset: 2px; }

/* ------------------------------------------- Règlements */

.reglements { border-top: 3px solid var(--ambre); }

.reglements__liste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.reglement {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  padding: .6rem 0;
  border-top: 1px solid var(--trait);
}

.reglement:first-child { border-top: 0; padding-top: 0; }

.reglement__phrase { font-size: .95rem; }

.reglement__phrase b { font-weight: 650; }

.reglement__montant {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reglement--nul { display: block; color: var(--gris); font-size: .9rem; }

/* ------------------------------------------- Compléments */

.case--sombre {
  margin-top: .7rem;
  color: rgba(255, 255, 255, .8);
  font-size: .85rem;
}

.case--sombre input { accent-color: var(--ambre); }

.compteur__plaque .compteur__saisie:disabled { color: rgba(242, 167, 27, .3); }

.puce--commun { background: var(--ambre); color: var(--nuit); font-weight: 600; }

optgroup { font-style: normal; font-weight: 650; }

/* ------------------------------------------- Relevé d'ouverture */

.compteur__depart {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--nuit-clair);
}

.compteur__plaque--petite { padding: .35rem .75rem; }

.compteur__plaque .compteur__saisie--petite { font-size: 1.5rem; }

/* ------------------------------------------- Sélecteur de véhicule */

.entete__vehicule {
  max-width: 46rem;
  margin: .6rem auto 0;
}

.choix-vehicule { display: block; }

.entete__vehicule select {
  width: 100%;
  padding: .45rem .7rem;
  border: 1px solid var(--nuit-clair);
  border-radius: 9px;
  background-color: #0a0e12;
  color: var(--blanc);
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
}

.entete__vehicule select:focus-visible { outline: 2px solid var(--ambre); outline-offset: 1px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sous-titre {
  margin: 1.2rem 0 .7rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--trait);
  font-size: .95rem;
  font-weight: 650;
}

/* ------------------------------------------- Type de saisie */

.types {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .25rem;
  padding: .25rem;
  background: #0a0e12;
  border: 1px solid var(--nuit-clair);
  border-radius: 10px;
  margin-bottom: 1rem;
}

.type {
  padding: .55rem .3rem;
  border: 0;
  border-radius: 7px;
  background: none;
  color: rgba(255, 255, 255, .6);
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.type.est-actif { background: var(--ambre); color: var(--nuit); }

.type:focus-visible { outline: 2px solid var(--ambre); outline-offset: 2px; }

.type__aide {
  margin: 0 0 .9rem;
  font-size: .8rem;
  color: rgba(255, 255, 255, .55);
}

.entree__motif {
  margin: .35rem 0 0;
  font-size: .85rem;
  font-weight: 600;
}

.releve-seul {
  display: inline-block;
  margin-top: .4rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: var(--tole);
  font-size: .75rem;
  color: var(--gris);
}
