:root {
  --fond: #f5f4f0;
  --carte: #ffffff;
  --encre: #15171c;
  --encre-douce: #5d636f;
  --trait: #e4e2dc;
  --accent: #1f4fd8;
  --accent-fond: #e9eefc;
  --ok: #14744a;
  --ok-fond: #e2f4ea;
  --alerte: #9a5b00;
  --alerte-fond: #fdf0d5;
  --danger: #b3261e;
  --rayon: 18px;
  --ombre: 0 1px 2px rgba(20, 22, 28, 0.05), 0 8px 24px rgba(20, 22, 28, 0.05);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--encre); line-height: 1.45; -webkit-font-smoothing: antialiased; }
main { max-width: 1080px; margin: 0 auto; padding: 0 20px 96px; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; margin: 0; letter-spacing: -0.01em; }
a { color: var(--accent); text-underline-offset: 3px; }
.marque { margin: 0 0 2px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }

.entete { max-width: 1080px; margin: 0 auto; padding: 28px 20px 20px; display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.entete-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.bouton { font: inherit; font-weight: 600; font-size: 0.92rem; border: 1px solid var(--trait); background: var(--carte); color: var(--encre); padding: 9px 14px; border-radius: 999px; cursor: pointer; transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease; }
.bouton:hover { border-color: #c9c6bd; }
.bouton:active { transform: scale(0.97); }
.bouton:focus-visible, .onglets button:focus-visible, .depot:focus-within, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.bouton.principal { background: var(--encre); color: #fff; border-color: var(--encre); }
.bouton.principal:hover { background: #000; }
.bouton.valider { background: var(--ok); color: #fff; border-color: var(--ok); }
.bouton.discret { background: transparent; color: var(--encre-douce); }
.bouton.petit { padding: 6px 11px; font-size: 0.84rem; }
.bouton[disabled] { opacity: 0.5; cursor: progress; }

.pastille { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; background: var(--alerte-fond); color: var(--alerte); }
.pastille.auto { background: var(--ok-fond); color: var(--ok); }

.bento { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.societe { background: var(--carte); border-radius: var(--rayon); padding: 22px; box-shadow: var(--ombre); display: grid; gap: 14px; }
.societe header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; }
.societe .depuis { color: var(--encre-douce); font-size: 0.82rem; }
.chiffre { margin: 0; font-size: clamp(2.6rem, 2rem + 3vw, 3.8rem); font-weight: 750; letter-spacing: -0.04em; line-height: 1; }
.chiffre small { display: block; margin-top: 8px; font-size: 0.95rem; font-weight: 500; letter-spacing: 0; color: var(--encre-douce); }
.chiffre.zero { color: var(--ok); }
.jauge { height: 10px; background: var(--fond); border-radius: 999px; overflow: hidden; }
.jauge span { display: block; height: 100%; background: var(--ok); border-radius: 999px; width: 0; }
.repartition { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.86rem; color: var(--encre-douce); margin: 0; padding: 0; list-style: none; }
.repartition b { color: var(--encre); font-weight: 650; }

.depot { display: grid; gap: 2px; text-align: center; padding: 20px; margin-bottom: 22px; border: 1.5px dashed #c9c6bd; border-radius: var(--rayon); color: var(--encre-douce); cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease; }
.depot strong { color: var(--encre); }
.depot:hover, .depot.survol { background: var(--accent-fond); border-color: var(--accent); }
.depot span { font-size: 0.88rem; }

.onglets { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--trait); margin-bottom: 18px; }
.onglets button { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 2.5px solid transparent; padding: 10px 12px; margin-bottom: -1px; color: var(--encre-douce); cursor: pointer; border-radius: 8px 8px 0 0; }
.onglets button[aria-selected="true"] { color: var(--encre); border-bottom-color: var(--encre); }
.compte { display: inline-block; min-width: 1.6em; padding: 1px 7px; margin-left: 4px; border-radius: 999px; background: var(--trait); font-size: 0.78rem; text-align: center; }
.onglets button[aria-selected="true"] .compte { background: var(--encre); color: #fff; }

.vue { display: grid; gap: 12px; }
.barre { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.aide { color: var(--encre-douce); font-size: 0.9rem; margin: 0; }
.vide { background: var(--carte); border-radius: var(--rayon); padding: 34px 22px; text-align: center; color: var(--encre-douce); box-shadow: var(--ombre); }
.vide strong { display: block; color: var(--encre); font-size: 1.05rem; margin-bottom: 4px; }

.carte { background: var(--carte); border-radius: var(--rayon); padding: 18px 20px; box-shadow: var(--ombre); }
.proposition { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 16px; align-items: center; }
.proposition .fleche { color: #b9b5aa; font-size: 1.3rem; }
.cote { min-width: 0; }
.cote .titre { font-weight: 650; overflow-wrap: anywhere; }
.cote .sous { color: var(--encre-douce); font-size: 0.86rem; overflow-wrap: anywhere; }
.montant { font-weight: 700; white-space: nowrap; }
.etiquettes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.etiquette { font-size: 0.76rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--fond); color: var(--encre-douce); }
.etiquette.sur { background: var(--ok-fond); color: var(--ok); }
.etiquette.verifier { background: var(--alerte-fond); color: var(--alerte); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.groupe > header { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.groupe .conseil { color: var(--encre-douce); font-size: 0.88rem; margin: 2px 0 10px; }
.lignes { list-style: none; margin: 0; padding: 0; }
.lignes li { display: grid; grid-template-columns: 7.6em 1fr auto auto; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--trait); font-size: 0.93rem; }
.lignes li.survol { background: var(--accent-fond); }
.lignes .date { color: var(--encre-douce); white-space: nowrap; }
.lignes .libelle { overflow-wrap: anywhere; }

.attente { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.attente select { font: inherit; font-size: 0.88rem; padding: 7px 9px; border-radius: 10px; border: 1px solid var(--trait); background: var(--carte); max-width: 320px; }

.journal { list-style: none; margin: 0; padding: 0; }
.journal li { display: grid; grid-template-columns: 9.5em 5.5em 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid var(--trait); font-size: 0.88rem; }
.journal li:first-child { border-top: 0; }
.journal .quand, .journal .qui { color: var(--encre-douce); }

.annonce { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; background: var(--encre); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 0.92rem; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); opacity: 0; pointer-events: none; max-width: min(92vw, 640px); text-align: center; }
.annonce.erreur { background: var(--danger); }

.dialogue { border: 0; border-radius: var(--rayon); padding: 24px; width: min(92vw, 460px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.dialogue::backdrop { background: rgba(20, 22, 28, 0.45); }
.dialogue h2 { margin-bottom: 4px; }
.dialogue fieldset { border: 0; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.dialogue label.choix { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 10px 12px; border: 1px solid var(--trait); border-radius: 12px; cursor: pointer; font-size: 0.92rem; }
.dialogue label.choix small { display: block; color: var(--encre-douce); }
.dialogue textarea { font: inherit; width: 100%; min-height: 64px; padding: 10px; border-radius: 12px; border: 1px solid var(--trait); resize: vertical; }
.dialogue .actions { margin-top: 16px; }

.page-connexion { min-height: 100vh; display: grid; place-items: center; }
.connexion { background: var(--carte); padding: 32px; border-radius: var(--rayon); box-shadow: var(--ombre); width: min(92vw, 380px); }
.connexion form { display: grid; gap: 10px; margin-top: 20px; }
.connexion label { font-size: 0.88rem; font-weight: 600; }
.connexion input { font: inherit; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--trait); }
.message { color: var(--danger); font-size: 0.88rem; min-height: 1.3em; margin: 0; }

@media (max-width: 720px) {
  .proposition { grid-template-columns: 1fr; gap: 10px; }
  .proposition .fleche { display: none; }
  .actions { justify-content: flex-start; }
  .lignes li { grid-template-columns: 1fr auto; }
  .lignes .date { grid-column: 1 / -1; font-size: 0.8rem; margin-bottom: -8px; }
  .lignes li .actions { grid-column: 1 / -1; }
  .attente { grid-template-columns: 1fr; }
  .journal li { grid-template-columns: 1fr; gap: 0; }
}

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