@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600;700&display=swap');

:root {
  --bg: #f4f4fb;
  --surface: #ffffff;
  --surface-2: #edecfa;
  --ink: #221f3d;
  --muted: #8b87a6;
  --line: rgba(34, 31, 61, 0.08);

  --primary: #4f46e5;
  --primary-dark: #372fb0;
  --primary-soft: #ecebff;

  --credit: #0fa66e;
  --credit-soft: #e2f7ee;
  --debit: #f0426a;
  --debit-soft: #fde9ee;

  --rudy: #2f7ded;
  --rudy-soft: #e6f0fe;
  --vanessa: #e0479a;
  --vanessa-soft: #fdeaf4;
  --commun: #d98e12;
  --commun-soft: #fbf1de;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(79, 70, 229, 0.09), 0 2px 6px rgba(34,31,61,0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.entete-app {
  background: linear-gradient(120deg, var(--primary) 0%, #7c6cf0 100%);
  padding: 26px clamp(16px, 5vw, 48px) 64px;
  color: white;
  position: relative;
}

.marque {
  display: flex;
  align-items: center;
  gap: 10px;
}

.marque .pastille-logo {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 1rem;
}

.marque .fanion {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.marque .sous-titre {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.75);
  margin-top: 1px;
}

nav.onglets {
  display: flex;
  gap: 6px;
  margin: -40px clamp(16px, 5vw, 48px) 0;
  background: var(--surface);
  padding: 8px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2;
  overflow-x: auto;
}

nav.onglets a {
  font-family: 'Manrope', sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

nav.onglets a:hover { background: var(--surface-2); }

nav.onglets a.actif {
  background: var(--primary);
  color: white;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px clamp(16px, 5vw, 48px) 60px;
}

.flash {
  max-width: 720px;
  margin: 0 0 20px;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
}
.flash.succes { background: var(--credit-soft); color: var(--credit); }
.flash.erreur { background: var(--debit-soft); color: var(--debit); }

h1 {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

h2 {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 16px;
}

.entete-page {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 26px;
}

.bouton {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--primary);
  color: white !important;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(79,70,229,0.25);
}
.bouton:hover { background: var(--primary-dark); }
.bouton.discret {
  background: var(--surface);
  color: var(--ink) !important;
  border: 1px solid var(--line);
  box-shadow: none;
}
.bouton.danger { background: var(--debit); box-shadow: 0 6px 16px rgba(240,66,106,0.25); }

.grille-solde {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
@media (max-width: 720px) { .grille-solde { grid-template-columns: 1fr; } }

.grille-deux {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
@media (max-width: 720px) { .grille-deux { grid-template-columns: 1fr; } }

.carte {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.carte-solde {
  background: linear-gradient(135deg, var(--primary) 0%, #7c6cf0 100%);
  color: white;
}
.carte-solde .valeur {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
}
.carte-solde .etiquette { color: rgba(255,255,255,0.8); font-size: 0.82rem; font-weight: 600; }

.carte-mini .valeur { font-family: 'JetBrains Mono', monospace; font-size: 1.4rem; font-weight: 700; }
.carte-mini .valeur.credit { color: var(--credit); }
.carte-mini .valeur.debit { color: var(--debit); }
.carte-mini .etiquette { color: var(--muted); font-size: 0.78rem; font-weight: 600; }

.grille-graphiques {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
@media (max-width: 900px) { .grille-graphiques { grid-template-columns: 1fr; } }

/* Barre du mois — signature : répartition des dépenses par personne */
.barre-personnes {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
  margin: 6px 0 16px;
}
.barre-personnes .segment { height: 100%; }
.barre-personnes .segment.rudy { background: var(--rudy); }
.barre-personnes .segment.vanessa { background: var(--vanessa); }
.barre-personnes .segment.commun { background: var(--commun); }

.legende-personnes {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.legende-personnes .item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
}
.legende-personnes .pastille { width: 10px; height: 10px; border-radius: 50%; }
.legende-personnes .pastille.rudy { background: var(--rudy); }
.legende-personnes .pastille.vanessa { background: var(--vanessa); }
.legende-personnes .pastille.commun { background: var(--commun); }
.legende-personnes .montant { font-family: 'JetBrains Mono', monospace; font-weight: 600; margin-left: 2px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
thead th {
  text-align: left;
  font-family: 'Manrope', sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
tbody td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tbody tr:hover { background: var(--surface-2); }
td.montant { font-family: 'JetBrains Mono', monospace; text-align: right; white-space: nowrap; font-weight: 600; }
td.montant.credit { color: var(--credit); }
td.montant.debit { color: var(--debit); }

.etiquette-categorie {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
}

.badge-auteur {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  margin-left: 6px;
}
.badge-auteur.rudy { background: var(--rudy-soft); color: var(--rudy); }
.badge-auteur.vanessa { background: var(--vanessa-soft); color: var(--vanessa); }
.badge-auteur.commun { background: var(--commun-soft); color: var(--commun); }

.puce-fixe {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 2px 9px;
  margin-left: 6px;
}

form.filtre {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 20px;
  padding: 18px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.champ { display: flex; flex-direction: column; gap: 6px; }
.champ label { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.03em; color: var(--muted); text-transform: uppercase; }
.champ input, .champ select {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  padding: 9px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
}
.champ input:focus, .champ select:focus { outline: none; border-color: var(--primary); }

form.formulaire-carte {
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.segment-choix {
  display: flex;
  border-radius: 999px;
  overflow: hidden;
  width: fit-content;
  background: var(--surface-2);
  padding: 4px;
  gap: 4px;
}
.segment-choix label {
  padding: 9px 18px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
  border-radius: 999px;
}
.segment-choix input { display: none; }
.segment-choix label:has(input:checked) { background: var(--primary); color: white; }

.bouton-supprimer {
  background: none;
  border: none;
  color: var(--debit);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.75;
}
.bouton-supprimer:hover { opacity: 1; }

.total-periode {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  margin: 4px 4px 18px;
  color: var(--muted);
}
.total-periode strong { color: var(--ink); }

.vide {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

.pastille {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.pastille.credit { background: var(--credit); }
.pastille.debit { background: var(--debit); }

footer {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 0.75rem;
}
