/* Tokens repris du code Flutter : lib/core/theme/app_colors.dart,
   app_text.dart, app_shadows.dart et lib/core/constants/app_dimensions.dart */
:root {
  --coral: #E85338;
  --coral-dark: #C8402A;
  --teal: #1B4944;
  --teal-light: #2F6B63;
  --cream: #FBF9F6;
  --blush: #FBEDE8;
  --white: #FFFFFF;
  --gold: #F0A431;
  --green-dark: #2F8F5A;
  --slate: #94A3B8;

  /* teal / coral avec opacité, équivalents de tealA() et coralA() */
  --line: rgba(27, 73, 68, 0.08);
  --line-fort: rgba(27, 73, 68, 0.14);
  --muted: rgba(27, 73, 68, 0.55);
  --muted-fort: rgba(27, 73, 68, 0.75);
  --coral-faible: rgba(232, 83, 56, 0.10);

  /* Arrondis : cartes 18–26, boutons 12–16 */
  --r-carte: 22px;
  --r-bouton: 14px;
  --r-champ: 16px;
  --r-image: 18px;
  --r-pastille: 999px;

  /* Ombres teintées, jamais noires */
  --ombre-carte: 0 16px 40px -20px rgba(27, 73, 68, 0.4);
  --ombre-corail: 0 12px 24px -10px rgba(232, 83, 56, 0.6);
  --ombre-logo: 0 18px 40px -14px rgba(232, 83, 56, 0.6);

  --sidebar-l: 250px;
}

* { box-sizing: border-box; }

/* L'attribut [hidden] (display:none de l'UA) est écrasé par toute règle
   qui fixe display (grid/flex). On le rend prioritaire pour que masquer un
   écran le masque vraiment — sinon connexion, démarrage et application se
   superposent. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--teal);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- Logo de l'app reconstruit (carré corail + cœur) --- */
.logo {
  width: 40px; height: 40px; flex: none;
  background: var(--coral);
  border-radius: 13px;
  box-shadow: var(--ombre-logo);
  display: grid; place-items: center;
}
.logo svg { width: 20px; height: 20px; fill: var(--cream); }
.logo.grand { width: 62px; height: 62px; border-radius: 20px; }
.logo.grand svg { width: 32px; height: 32px; }
.logo.blanc { background: var(--white); box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.35); }
.logo.blanc svg { fill: var(--coral); }
.marque { font-size: 22px; font-weight: 800; color: var(--coral); letter-spacing: 0.06em; line-height: 1; }
.titre { display: flex; flex-direction: column; gap: 2px; }
.sous-titre { font-size: 12px; color: var(--muted); letter-spacing: -0.01em; }
.grow { flex: 1; }

/* =====================================================================
   Écran de démarrage
   ================================================================== */
.ecran-plein {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.demarrage-carte { text-align: center; display: grid; justify-items: center; gap: 18px; }
.demarrage-carte p { color: var(--muted-fort); margin: 0; font-weight: 600; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line-fort); border-top-color: var(--coral);
  animation: tourne 0.8s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

/* =====================================================================
   Écran de connexion (deux colonnes : hero + panneau)
   ================================================================== */
.ecran-connexion { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }

.connexion-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, var(--coral) 0%, var(--coral-dark) 55%, #a5331f 100%);
  color: var(--white);
  display: flex; align-items: center;
  padding: 56px;
}
/* Motif de cœurs discret en filigrane */
.hero-motif {
  position: absolute; inset: 0; opacity: 0.14; pointer-events: none;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,0.9) 0 2px, transparent 3px),
    radial-gradient(circle at 72% 12%, rgba(255,255,255,0.7) 0 3px, transparent 4px),
    radial-gradient(circle at 88% 64%, rgba(255,255,255,0.8) 0 2px, transparent 3px),
    radial-gradient(circle at 34% 82%, rgba(255,255,255,0.6) 0 3px, transparent 4px);
  background-size: 260px 260px;
}
.hero-motif::after {
  content: ""; position: absolute; right: -90px; bottom: -90px;
  width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%);
}
.hero-contenu { position: relative; max-width: 420px; }
.hero-marque { font-size: 46px; font-weight: 800; letter-spacing: 0.05em; margin: 22px 0 0; }
.hero-baseline { font-size: 18px; line-height: 1.55; margin: 14px 0 34px; color: rgba(255,255,255,0.92); }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.hero-points li { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 15px; }
.hero-puce {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,0.22); display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
}

.connexion-panneau { display: grid; place-items: center; padding: 40px 24px; background: var(--cream); }
.panneau-boite {
  width: 100%; max-width: 380px; text-align: center;
  display: grid; justify-items: center;
}
.panneau-boite .logo { margin-bottom: 20px; }
.panneau-boite h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 10px; }
.panneau-sous { color: var(--muted-fort); margin: 0 0 26px; max-width: 320px; }
.panneau-note { color: var(--muted); font-size: 13px; margin: 22px 0 0; }
.panneau-boite .message { width: 100%; text-align: left; margin: 0 0 18px; }

/* Bouton Google officiel */
.google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--white); color: #1f1f1f;
  border: 1.5px solid var(--line-fort);
  padding: 15px 22px; border-radius: var(--r-bouton);
  font: inherit; font-weight: 700; cursor: pointer;
  box-shadow: 0 10px 26px -16px rgba(27, 73, 68, 0.5);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.google:hover { border-color: var(--slate); box-shadow: 0 14px 30px -14px rgba(27, 73, 68, 0.55); }
.google:active { transform: scale(0.99); }
.g-ico { width: 20px; height: 20px; flex: none; }

@media (max-width: 860px) {
  .ecran-connexion { grid-template-columns: 1fr; }
  .connexion-hero { display: none; }
}

/* =====================================================================
   Application : sidebar + corps
   ================================================================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-l); flex: none;
  background: var(--white); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 40;
}
.sidebar-marque {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 18px; border-bottom: 1px solid var(--line);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; overflow-y: auto; }
.sidebar-pied {
  margin-top: auto; display: flex; flex-direction: column; gap: 4px;
  padding: 12px; border-top: 1px solid var(--line);
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 11px 14px; border-radius: var(--r-bouton);
  background: none; border: none; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--muted-fort);
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item .ico { width: 20px; height: 20px; flex: none; fill: currentColor; opacity: 0.85; }
.nav-item span:not(.pastille) { flex: 1; }
.nav-item:hover { background: rgba(27, 73, 68, 0.05); color: var(--teal); }
.nav-item.actif { background: var(--coral-faible); color: var(--coral); }
.nav-item.actif .ico { opacity: 1; }
.nav-item.deconnexion { color: var(--coral-dark); }
.nav-item.deconnexion:hover { background: var(--coral-faible); }
.nav-item .pastille {
  background: var(--coral); color: var(--cream);
  border-radius: var(--r-pastille); padding: 1px 8px; min-width: 22px; text-align: center;
  font-size: 11px; font-weight: 700;
}
.nav-item.actif .pastille { background: var(--coral); }

.app-corps { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px; background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-titre { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.burger {
  display: none; background: none; border: none; cursor: pointer;
  padding: 6px; border-radius: 10px; color: var(--teal);
}
.burger svg { width: 24px; height: 24px; fill: currentColor; }
.burger:hover { background: rgba(27, 73, 68, 0.06); }

.compte {
  display: flex; align-items: center; gap: 10px;
  background: none; border: 1px solid var(--line); cursor: pointer;
  padding: 6px 12px 6px 6px; border-radius: var(--r-pastille);
  font: inherit; color: var(--teal);
}
.compte:hover { border-color: var(--line-fort); background: rgba(27, 73, 68, 0.03); }
.compte-pastille {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  background: var(--teal); color: var(--cream);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; text-transform: uppercase;
}
.compte-mail { font-size: 13px; font-weight: 600; color: var(--muted-fort); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Voile mobile */
.voile { position: fixed; inset: 0; background: rgba(27, 73, 68, 0.35); z-index: 39; }

main { max-width: 1100px; margin: 0 auto; padding: 24px 24px 64px; width: 100%; }

/* Sidebar hors-écran sur mobile */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh;
    transform: translateX(-100%); transition: transform 0.22s ease;
    box-shadow: 0 24px 60px -20px rgba(27, 73, 68, 0.5);
  }
  .app.sidebar-ouverte .sidebar { transform: translateX(0); }
  .burger { display: inline-flex; }
  .compte-mail { display: none; }
  main { padding: 18px 16px 56px; }
}

/* =====================================================================
   Composants (repris tels quels)
   ================================================================== */
.carte {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-carte);
  box-shadow: var(--ombre-carte);
  padding: 22px;
  margin-bottom: 18px;
}

h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 12px; }

/* --- Tableau de bord --- */
.chiffres { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.chiffre {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-champ); padding: 16px 18px;
}
.chiffre .valeur { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.chiffre .libelle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.chiffre.alerte { border-color: var(--coral); background: var(--coral-faible); }
.chiffre.alerte .valeur { color: var(--coral); }

/* --- Images --- */
.images { display: grid; grid-template-columns: 1fr 2fr; gap: 18px; align-items: start; }
@media (max-width: 760px) { .images { grid-template-columns: 1fr; } }
.bloc h3 {
  margin: 0 0 10px; font-size: 12px; font-weight: 700;
  color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase;
}
.selfie img { width: 100%; border-radius: var(--r-image); display: block; background: var(--blush); }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.galerie img {
  width: 100%; aspect-ratio: 3/4; object-fit: cover;
  border-radius: var(--r-image); background: var(--blush);
}
.photo-bloc { position: relative; }
.photo-bloc.masquee img { filter: grayscale(1) brightness(0.6); }
.photo-bloc .etat {
  position: absolute; top: 8px; left: 8px;
  background: var(--teal); color: var(--cream);
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: var(--r-pastille);
}
.photo-bloc button { width: 100%; margin-top: 6px; }

/* --- Pastilles d'identité --- */
.identite { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.puce {
  background: rgba(27, 73, 68, 0.05); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: var(--r-pastille); font-size: 13px; font-weight: 500;
}
.puce b { font-weight: 700; }
.puce.rouge { background: var(--coral-faible); border-color: var(--coral); color: var(--coral-dark); }

/* --- Contexte d'un message signalé --- */
.fil { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.bulle {
  border: 1px solid var(--line); border-radius: var(--r-image);
  padding: 10px 14px; background: rgba(27, 73, 68, 0.03); max-width: 80%;
}
.bulle.vise { border-color: var(--coral); background: var(--coral-faible); }
.bulle .qui { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }

/* --- Formulaires --- */
textarea, input[type="search"] {
  width: 100%; padding: 14px 16px;
  border: 1.5px solid var(--line-fort); border-radius: var(--r-champ);
  font: inherit; color: var(--teal); background: var(--white);
}
textarea { min-height: 76px; margin-top: 18px; resize: vertical; }
textarea::placeholder, input::placeholder { color: rgba(27, 73, 68, 0.4); }
textarea:focus, input:focus { outline: none; border-color: var(--coral); }

.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
button {
  font: inherit; font-weight: 700; letter-spacing: -0.01em;
  padding: 14px 24px; border-radius: var(--r-bouton);
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: default; transform: none; }

.principal { background: var(--coral); color: var(--cream); box-shadow: var(--ombre-corail); }
.ok { background: var(--green-dark); color: var(--cream); }
.non { background: var(--white); color: var(--coral-dark); border-color: var(--coral-dark); }
.neutre { background: var(--white); color: var(--teal); border-color: var(--line-fort); }
.discret { padding: 10px 16px; font-size: 13px; font-weight: 600; }

.message { padding: 14px 18px; border-radius: var(--r-champ); margin-bottom: 18px; font-size: 14px; }
.erreur { background: var(--coral-faible); color: var(--coral-dark); }
.info { background: rgba(27, 73, 68, 0.06); color: var(--muted-fort); }
.succes { background: rgba(47, 143, 90, 0.12); color: var(--green-dark); }

.vide { text-align: center; padding: 70px 20px; color: var(--muted); }
.vide h2 { color: var(--teal); }

.raccourcis { font-size: 12px; color: var(--muted); margin-top: 14px; }
.raccourcis kbd {
  background: rgba(27, 73, 68, 0.06); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 7px; font-family: inherit; font-size: 11px; font-weight: 700;
}
.scores {
  font-size: 12px; color: var(--muted); margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--line);
}

/* --- Liste et fiche d'utilisateur --- */
.ligne-user {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border: 1px solid var(--line);
  border-radius: var(--r-champ); background: var(--white); margin-bottom: 8px;
  cursor: pointer; width: 100%; text-align: left; font: inherit; font-weight: 400;
}
.ligne-user:hover { border-color: var(--coral); }
.ligne-user .avatar {
  width: 46px; height: 46px; flex: none; border-radius: var(--r-pastille);
  object-fit: cover; background: var(--blush);
}
.ligne-user .nom { font-weight: 700; }
.ligne-user .detail { font-size: 12px; color: var(--muted); }
.ligne-user .marques { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.marque-etat {
  font-size: 11px; font-weight: 700; padding: 3px 9px;
  border-radius: var(--r-pastille); background: rgba(27, 73, 68, 0.06); color: var(--muted-fort);
}
.marque-etat.corail { background: var(--coral-faible); color: var(--coral-dark); }
.marque-etat.or { background: rgba(240, 164, 49, 0.18); color: #9A6410; }
.marque-etat.vert { background: rgba(47, 143, 90, 0.14); color: var(--green-dark); }
.champ-nombre {
  width: 90px; padding: 10px 12px; border: 1.5px solid var(--line-fort);
  border-radius: var(--r-bouton); font: inherit; color: var(--teal);
}
.bio { color: var(--muted-fort); margin: 0 0 14px; }

/* --- Paramètres --- */
.param-ligne {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.param-ligne:last-child { border-bottom: none; }
.param-cle { font-weight: 700; min-width: 160px; }
.param-val { color: var(--muted-fort); word-break: break-word; }

/* Onglet Revenus ---------------------------------------------------------- */
.revenus-outils { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.revenus-outils label { font-size: 13px; font-weight: 600; color: var(--muted-fort); }
.revenus-outils select {
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-fort);
  background: var(--white); font: inherit; color: inherit;
}
.revenus-table { width: 100%; border-collapse: collapse; margin-top: 18px; }
.revenus-table th, .revenus-table td {
  padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px;
}
.revenus-table th { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.revenus-table td.nombre { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.revenus-table tr:last-child td { border-bottom: none; }
.revenus-simule { font-size: 12px; color: var(--coral); margin-top: 12px; }
