:root {
  --bleu: #3d6ef0;
  --violet: #a350dc;
  --corail: #ff9068;
  --fond: #f5f6fa;
  --surface: #ffffff;
  --texte: #14161c;
  --sub: #6b7280;
  --bordure: #e0e2e8;
  --ombre: rgba(0,0,0,0.05);
}
[data-theme="sombre"] {
  --fond: #14161c;
  --surface: #1f222b;
  --texte: #f2f3f6;
  --sub: #9aa0ac;
  --bordure: #2c303c;
  --ombre: rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }
svg { width: 1em; height: 1em; display: inline-block; vertical-align: middle; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--fond);
  color: var(--texte);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, color 0.2s;
  /* Empêche la sélection de texte et le menu contextuel (copier/rechercher) au tap long — sans
     ça, un appui maintenu déclenche presque toujours ce menu natif avant notre propre code. */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
input, textarea { -webkit-user-select: text; user-select: text; } /* la saisie doit rester sélectionnable */
#app { min-height: 100vh; padding: 16px; padding-bottom: 40px; }
/* Mode "app" épinglée (standalone) : la zone en haut (heure, réseau, encoche caméra) chevauche
   sinon le contenu — env(safe-area-inset-top) vaut 0 dans un onglet de navigateur classique,
   donc sans effet là où ce n'est pas nécessaire. */
body.mode-app #app { padding-top: calc(16px + env(safe-area-inset-top, 24px)); }

h1 { font-family: 'Space Grotesk', sans-serif; font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 10px; }
.sub { color: var(--sub); font-size: 13px; margin: 4px 0 18px; }

.conteneur-centre {
  min-height: calc(100vh - 32px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 6px;
}
.logo-app { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 12px; box-shadow: 0 6px 20px rgba(61,110,240,0.25); }

input {
  width: 100%; max-width: 320px; padding: 13px 14px; border: 1px solid var(--bordure); border-radius: 10px;
  font-size: 15px; margin-top: 10px; background: var(--surface); color: var(--texte);
}
button { border: none; cursor: pointer; font-size: 14px; font-weight: 600; text-align: center; }
button.primary {
  background: linear-gradient(135deg, var(--bleu), var(--violet));
  color: white; border-radius: 10px;
}
button.secondary { background: var(--surface); color: var(--texte); border: 1px solid var(--bordure); border-radius: 10px; }
button.large { width: 100%; padding: 14px; margin-top: 12px; }
button.link { background: none; color: var(--bleu); margin-top: 16px; font-weight: 500; }
button.icone-bouton { background: var(--surface); border-radius: 50%; width: 40px; height: 40px; font-size: 17px; box-shadow: 0 2px 8px var(--ombre); color: var(--texte); display: flex; align-items: center; justify-content: center; }
.icone-bouton svg { width: 20px; height: 20px; }
.icone-bouton-grande svg { width: 24px; height: 24px; }
.bouton-contact-rond svg { width: 24px; height: 24px; }
.bouton-contact-rond.verrouille-syncplus { opacity: 0.45; position: relative; }
.cadenas-mini { position: absolute; bottom: -2px; right: -2px; background: var(--surface); border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 11px; box-shadow: 0 1px 4px rgba(0,0,0,0.2); }

.msg-erreur { color: #dc2626; font-size: 13px; min-height: 18px; margin-top: 8px; max-width: 320px; }

.entete-accueil { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.entete-accueil h1 { margin: 0; }
.icone-bouton-grande { font-size: 22px; }

.carte { background: var(--surface); border-radius: 16px; padding: 18px; margin-bottom: 14px; box-shadow: 0 2px 10px var(--ombre); }

.carte-montants { background: linear-gradient(135deg, var(--bleu), var(--violet), var(--corail)); color: white; }
.carte-montants h2 { color: white; opacity: 0.9; }
.grille-montants { display: flex; justify-content: space-between; text-align: center; }
.grille-montants > div { display: flex; flex-direction: column; }
.grille-montants .chiffre { font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 700; }
.grille-montants .libelle { font-size: 11px; opacity: 0.85; margin-top: 4px; }

.ligne-prestation { display: flex; justify-content: space-between; align-items: center; padding: 10px 0 10px 12px; border-bottom: 1px solid var(--bordure); border-left: 5px solid var(--sub); position: relative; }
.ligne-prestation:last-child { border-bottom: none; }
.ligne-gauche { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.nom-client { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; min-width: 0; display: block; }
.date-presta { font-size: 12px; color: var(--sub); }
.montant-presta { font-weight: 700; font-size: 14px; white-space: nowrap; flex-shrink: 0; }

/* Prestations passées : visuellement atténuées et barrées — distinction demandée pour l'accueil. */
.ligne-prestation.passee { opacity: 0.55; }
.ligne-prestation.passee .nom-client,
.ligne-prestation.passee .montant-presta { text-decoration: line-through; }

.liste-apropos { list-style: none; padding: 0; width: 100%; max-width: 320px; text-align: left; }
.liste-apropos li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--bordure); font-size: 13px; }

.entete-carte-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.entete-carte-flex h2 { margin: 0; }
.link-petit { background: none; color: var(--bleu); font-size: 12px; font-weight: 600; padding: 0; }

/* Écran de conflit de synchronisation */
.choix-conflit { background: var(--surface); border: 2px solid var(--bordure); border-radius: 14px; padding: 16px; width: 100%; max-width: 320px; margin-top: 12px; cursor: pointer; text-align: left; }
.choix-conflit h3 { margin: 4px 0 6px; font-size: 15px; }
.choix-conflit p { margin: 2px 0; font-size: 13px; }
.choix-conflit.recommande { border-color: var(--bleu); box-shadow: 0 4px 16px rgba(61,110,240,0.15); }
.badge-recommande { display: inline-block; background: var(--bleu); color: white; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; margin-bottom: 4px; }

/* Filtres écran Prestations */
/* Panneau de filtres repliable — une seule ligne quand fermé */
.carte.filtres-compact { padding: 0; overflow: hidden; }
.ligne-filtre-toggle { width: 100%; background: none; display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; font-size: 14.5px; font-weight: 700; color: var(--texte); }
.carte.filtres-compact .champ-filtre, .carte.filtres-compact .grille-filtres-double { margin-left: 18px; margin-right: 18px; width: calc(100% - 36px); }
.carte.filtres-compact .link { margin: 0 18px 16px; display: block; }

/* Barre de réglages accueil : vue Prestations/Clients (ou Prestataires) + style liste/cartes */
.barre-reglages-accueil { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.segmented { display: flex; background: var(--surface); border-radius: 10px; padding: 3px; box-shadow: 0 2px 8px var(--ombre); }
.segmented button { background: none; padding: 7px 14px; border-radius: 8px; font-size: 12.5px; color: var(--sub); }
.segmented button.actif { background: linear-gradient(135deg, var(--bleu), var(--violet)); color: white; }

/* Vignettes carrées en grille (mode "cartes") — clients, prestataires ou prestations */
.grille-vignettes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vignette-carte {
  background: var(--surface); border-radius: 16px; padding: 14px; box-shadow: 0 2px 10px var(--ombre);
  display: flex; flex-direction: column; cursor: pointer; aspect-ratio: 1; position: relative; overflow: hidden;
}
.vignette-carte .nom-client { font-size: 15px; font-weight: 700; margin-top: 20px; }
.vignette-carte .date-presta { font-size: 12.5px; }
.vignette-carte .montant-presta { font-size: 17px; margin-top: auto; }
.vignette-carte.passee .nom-client { text-decoration: line-through; }
.vignette-client { cursor: pointer; }

/* Statut réalisation : triangle de couleur coin haut-gauche (au lieu d'une pastille, plus visible) */
.triangle-statut { position: absolute; top: 0; left: 0; width: 0; height: 0;
  border-style: solid; border-width: 34px 34px 0 0; border-color: var(--sub) transparent transparent transparent; }
.triangle-statut.faite { border-color: #16a34a transparent transparent transparent; }
.triangle-statut-icone { position: absolute; top: 3px; left: 3px; font-size: 11px; color: white; }

/* Statut paiement : pastille agrandie coin haut-droit, bien visible */
.badge-paiement { position: absolute; top: 9px; right: 9px; width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: white; font-weight: 700; }
.badge-paiement.paye { background: #16a34a; }
.badge-paiement.partiel { background: #f59e0b; }
.badge-paiement.non-paye { background: #dc2626; }
.badge-paiement svg { width: 13px; height: 13px; }

.icone-commentaire-vignette { position: absolute; bottom: 10px; right: 10px; font-size: 20px; }
.info-secondaire-vignette { font-size: 11.5px; color: var(--sub); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; min-width: 0; display: block; }

/* Équivalent en mode liste : bande colorée à gauche (réalisation) + pastille paiement agrandie */
.ligne-prestation.faite-statut { border-left-color: #16a34a; }
.badge-paiement-ligne { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: white; font-weight: 700; margin-left: 6px; cursor: pointer; }
.badge-paiement-ligne.paye { background: #16a34a; }
.badge-paiement-ligne.partiel { background: #f59e0b; }
.badge-paiement-ligne.non-paye { background: #dc2626; }
.badge-paiement-ligne svg { width: 12px; height: 12px; }

/* Pastille simple (écran de détail, pas les vignettes) */
.pastille { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.pastille.faite { background: #16a34a; }
.pastille.a-faire { background: #9aa0ac; }
.pastille.paye { background: #16a34a; }
.pastille.partiel { background: #f59e0b; }
.pastille.non-paye { background: #dc2626; }

/* Boutons ronds "+" (ajouter client / ajouter prestation) */
.bouton-rond-ajouter {
  width: 100%; aspect-ratio: 1; border-radius: 16px; background: var(--surface); border: 2px dashed var(--bordure);
  display: flex; align-items: center; justify-content: center; font-size: 36px; color: var(--bleu); cursor: pointer;
}
.bouton-rond-ajouter-liste {
  width: 100%; padding: 14px; border-radius: 12px; background: var(--surface); border: 2px dashed var(--bordure);
  display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--bleu); cursor: pointer; margin-top: 8px;
}

/* Boutons ronds de contact (écran détail prestation / fiche client) — taille fixe, icône seule */
.bouton-contact-rond {
  width: 60px; height: 60px; border-radius: 50%; background: var(--surface); box-shadow: 0 2px 8px var(--ombre);
  display: flex; align-items: center; justify-content: center; font-size: 24px; text-decoration: none; flex-shrink: 0;
  position: relative;
}
.rangee-contacts-rapides { display: flex; gap: 14px; justify-content: center; margin: 4px 0 14px; }

/* Gros bouton rond "Marquer comme faite" — largeur fixe, centré, texte wrap centré */
.bouton-rond-large {
  width: 190px; height: 190px; border-radius: 50%; margin: 10px auto; display: flex; align-items: center; justify-content: center;
  text-align: center; font-size: 15px; font-weight: 700; padding: 20px; box-sizing: border-box; line-height: 1.25;
  background: linear-gradient(135deg, var(--bleu), var(--violet)); color: white; box-shadow: 0 6px 20px rgba(61,110,240,0.3);
}
.bouton-rond-large.statut-faite { background: linear-gradient(135deg, #16a34a, #0d9155); box-shadow: 0 6px 20px rgba(22,163,74,0.3); }
#btn-toggle-faite svg { font-size: 40px; }
#btn-toggle-faite > span > span { height: auto !important; }

/* Bouton retour : chevron épais bien visible, plus grand que les autres icônes */
.bouton-retour-chevron {
  background: var(--surface); border-radius: 50%; width: 42px; height: 42px; box-shadow: 0 2px 8px var(--ombre);
  display: flex; align-items: center; justify-content: center;
}
.bouton-retour-chevron svg { width: 20px; height: 20px; }

/* Filtres — champs plus grands et lisibles (annule l'excès de compacité d'une itération précédente) */
.champ-filtre {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--bordure); border-radius: 10px;
  font-size: 14.5px; background: var(--surface); color: var(--texte); margin-bottom: 10px; font-family: inherit;
  box-sizing: border-box; min-width: 0;
}
input[type="date"].champ-filtre, input[type="time"].champ-filtre { appearance: none; -webkit-appearance: none; }
.grille-filtres-double { display: flex; gap: 10px; }
.grille-filtres-double .champ-filtre { flex: 1; min-width: 0; }

/* Carte forfait (menu Compte) — dégradé, comme sur l'app desktop */
.carte-forfait { text-align: left; background: linear-gradient(135deg, var(--bleu), var(--violet)); color: white; }
.carte-forfait .nom-forfait { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; }
.carte-forfait button.secondary { background: rgba(255,255,255,0.18); color: white; border: 1px solid rgba(255,255,255,0.3); }
/* Un dégradé par palier — Basique neutre, Sync bleu/violet, Sync+ dégradé complet de la marque. */
.carte-forfait.forfait-basique { background: linear-gradient(135deg, #6b7280, #4b5563); }
.carte-forfait.forfait-sync { background: linear-gradient(135deg, var(--bleu), var(--violet)); }
.carte-forfait.forfait-syncplus { background: linear-gradient(135deg, var(--bleu), var(--violet), var(--corail)); }

/* Petite puce carrée cliquable (ex. code client verrouillé) */
.chip-code {
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  width: 52px; height: 52px; border-radius: 12px; background: var(--fond); font-size: 20px;
  border: 1px solid var(--bordure);
}

/* Sélecteur de thème (menu Compte) */
.selecteur-theme { display: flex; background: var(--surface); border-radius: 10px; padding: 3px; width: 100%; max-width: 320px; margin-top: 6px; }
.selecteur-theme button { flex: 1; background: none; padding: 8px; border-radius: 8px; font-size: 13px; color: var(--sub); }
.selecteur-theme button.actif { background: linear-gradient(135deg, var(--bleu), var(--violet)); color: white; }

/* Contacts rapides (écran détail prestation) */
.contacts-rapides { display: flex; gap: 8px; }
.bouton-contact { flex: 1; text-align: center; padding: 10px 6px; font-size: 12.5px; text-decoration: none; display: block; }
