* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f4f8;
  color: #1a1a2e;
  min-height: 100vh;
  font-size: 16px;
}

/* ÉCRANS */
.ecran { display: none; min-height: 100vh; flex-direction: column; }
.ecran.actif { display: flex; }

/* LOGIN */
#ecran-login {
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 16px;
  background: linear-gradient(160deg, #1a6b3c 0%, #0d4a2a 100%);
}
#ecran-login .logo { font-size: 64px; }
.logo-img { max-width: 180px; max-height: 110px; object-fit: contain; background: white; padding: 10px 16px; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
#ecran-login h1 { color: white; font-size: 28px; font-weight: 700; }
#ecran-login .card { width: 100%; max-width: 380px; }

/* CARTES */
.card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* INPUTS */
input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e8ecf0;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}
input:focus { border-color: #1a6b3c; }
label { font-size: 14px; color: #666; font-weight: 500; margin-bottom: -6px; }

/* BOUTONS */
.btn-vert {
  background: #1a6b3c;
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-vert:active { transform: scale(0.97); background: #145530; }

.btn-bleu {
  background: #1565c0;
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-bleu:active { background: #0d47a1; }

.btn-wave {
  background: #0076FF;
  color: white;
  border: none;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-wave img { height: 28px; }

.grand { width: 100%; padding: 16px; font-size: 18px; }

/* ENTÊTE */
.entete {
  background: #1a6b3c;
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 600;
  min-height: 60px;
}
.entete.admin { background: #1565c0; }

.btn-retour {
  background: none;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
}
.btn-deconnexion {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}

/* GROS BOUTONS REPRÉSENTANT */
.actions-principales {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 24px 16px 16px;
}
.gros-btn {
  aspect-ratio: 1;
  border-radius: 20px;
  font-weight: 700;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  min-height: 110px;
  max-height: 150px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* Bouton large pleine largeur (compact) */
.btn-large {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 16px 20px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.12);
  transition: transform 0.1s;
}
.btn-large:active { transform: scale(0.98); }

/* STATS */
.stats-rapides {
  display: flex;
  gap: 12px;
  padding: 0 16px 24px;
}
.stat {
  flex: 1;
  background: white;
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.stat span { font-size: 28px; font-weight: 700; color: #1a6b3c; }
.stat.rouge span { color: #c62828; }
.stat small { font-size: 12px; color: #888; }

/* FILTRES */
.filtres {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
}
.filtre {
  background: white;
  border: 2px solid #e8ecf0;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
}
.filtre.actif { background: #1a6b3c; color: white; border-color: #1a6b3c; }
.filtre.rouge.actif { background: #c62828; border-color: #c62828; }

/* LISTE ABONNÉS */
#liste-abonnes, #liste-abonnes-admin {
  padding: 0 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.carte-abonne {
  background: white;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}
.carte-abonne .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.avatar.vert { background: #1a6b3c; }
.avatar.rouge { background: #c62828; }
.avatar.gris { background: #9e9e9e; }

.carte-abonne .infos { flex: 1; min-width: 0; }
.carte-abonne .nom { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carte-abonne .detail { font-size: 13px; color: #888; margin-top: 2px; }
.carte-abonne .badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.badge.actif { background: #e8f5e9; color: #1a6b3c; }
.badge.suspendu { background: #ffebee; color: #c62828; }

/* ADMIN */
.admin-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}
.admin-btn {
  background: white;
  border: 2px solid #e8ecf0;
  border-radius: 14px;
  padding: 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.admin-btn:hover, .admin-btn.actif { background: #1565c0; color: white; border-color: #1565c0; }

.admin-section { padding: 0 16px 24px; }
.admin-section h2 { font-size: 18px; margin-bottom: 12px; color: #333; }
.admin-section.cache { display: none; }

/* CARTE VILLAGE ADMIN */
.carte-village {
  background: white;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.carte-village .village-titre { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.carte-village .village-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.village-stat { font-size: 13px; color: #555; }
.village-stat strong { color: #1a6b3c; }

/* REVENUS */
.carte-revenu {
  background: white;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.revenu-village { font-weight: 600; font-size: 15px; }
.revenu-montant { font-size: 18px; font-weight: 700; color: #1a6b3c; }

/* ACTIONS ADMIN SUR ABONNÉ */
.actions-abonne {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.btn-action {
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-reconnecter { background: #e8f5e9; color: #1a6b3c; }
.btn-deconnecter { background: #ffebee; color: #c62828; }

/* INFO BOX */
.info-box {
  background: #e8f5e9;
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.6;
  color: #2e7d32;
}

/* MESSAGES */
.erreur { color: #ffcccc; font-size: 14px; text-align: center; margin-top: 8px; }
.succes { color: #e8f5e9; font-size: 14px; text-align: center; margin-top: 8px; }
#ajout-message { padding: 0 16px; margin-top: 8px; font-size: 15px; }
.msg-ok { background: #e8f5e9; color: #1a6b3c; padding: 14px; border-radius: 12px; }
.msg-err { background: #ffebee; color: #c62828; padding: 14px; border-radius: 12px; }

/* PAIEMENT PAGE */
#ecran-paiement {
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 20px;
  background: linear-gradient(160deg, #0076FF 0%, #004db3 100%);
}
#ecran-paiement .logo { font-size: 64px; }
#ecran-paiement h2 { color: white; font-size: 22px; font-weight: 700; }
#ecran-paiement .card { width: 100%; max-width: 380px; gap: 16px; }
#paiement-info { font-size: 15px; line-height: 1.8; color: #333; }
#paiement-info strong { color: #0076FF; font-size: 20px; }

/* OVERLAY */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  font-size: 48px;
}
#overlay.cache { display: none; }

/* Masquage générique */
.cache { display: none !important; }

/* CHOIX DE SECTEUR */
#ecran-secteur { background: #f0f4f8; }
.secteur-btn {
  border: none;
  border-radius: 18px;
  padding: 24px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 18px;
  text-align: left;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transition: transform 0.1s;
}
.secteur-btn:active { transform: scale(0.98); }

/* Sections boutique */
.boutique-section { padding-bottom: 24px; }
.boutique-section.cache { display: none; }

/* BADGE NOTIFICATION */
.badge-notif {
  display: none;
  background: #c62828;
  color: white;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}
.badge-notif.actif { display: inline-block; }

/* ALERTES */
.carte-alerte {
  background: white;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-left: 4px solid #ccc;
}
.carte-alerte.haute { border-left-color: #c62828; }
.carte-alerte.moyenne { border-left-color: #f59e0b; }
.carte-alerte.info { border-left-color: #1565c0; }
.carte-alerte .alerte-icone { font-size: 24px; }
.carte-alerte .alerte-titre { font-weight: 600; font-size: 14px; }
.carte-alerte .alerte-detail { font-size: 13px; color: #888; margin-top: 2px; }

/* MATÉRIEL */
.carte-materiel {
  background: white;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.carte-materiel .mat-haut { display: flex; justify-content: space-between; align-items: flex-start; }
.carte-materiel .mat-nom { font-weight: 700; font-size: 15px; }
.carte-materiel .mat-cat { font-size: 12px; color: #888; }
.carte-materiel .mat-stock { font-size: 13px; padding: 3px 10px; border-radius: 10px; font-weight: 600; }
.mat-stock.ok { background: #e8f5e9; color: #1a6b3c; }
.mat-stock.bas { background: #ffebee; color: #c62828; }
.carte-materiel .mat-prix { color: #1565c0; font-weight: 700; }
.carte-materiel .mat-doc { background: #f8f9fa; border-radius: 8px; padding: 10px; font-size: 13px; margin-top: 8px; color: #555; white-space: pre-wrap; line-height: 1.5; }
.mat-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.mat-actions button { font-size: 12px; padding: 6px 10px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; }

/* BILAN FINANCIER */
.bilan-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bilan-card { background: white; border-radius: 12px; padding: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.bilan-card .bc-label { font-size: 12px; color: #888; }
.bilan-card .bc-valeur { font-size: 18px; font-weight: 700; margin-top: 4px; }
.bc-valeur.positif { color: #1a6b3c; }
.bc-valeur.negatif { color: #c62828; }

/* GRAPHIQUES (barres) */
.graph {
  background: white;
  border-radius: 12px;
  padding: 16px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 180px;
  overflow-x: auto;
}
.graph-barre {
  flex: 1;
  min-width: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
}
.graph-barre .gb-val { font-size: 10px; font-weight: 700; color: #1a6b3c; }
.graph-barre .gb-bar { width: 70%; background: linear-gradient(180deg, #1a6b3c, #2e9e5b); border-radius: 4px 4px 0 0; min-height: 2px; transition: height 0.3s; }
.graph-barre.bleu .gb-bar { background: linear-gradient(180deg, #1565c0, #42a5f5); }
.graph-barre.bleu .gb-val { color: #1565c0; }
.graph-barre .gb-label { font-size: 9px; color: #888; text-align: center; white-space: nowrap; }

/* TICKETS SAV */
.carte-ticket {
  background: white;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-left: 4px solid #ccc;
}
.carte-ticket.ouvert { border-left-color: #c62828; }
.carte-ticket.en_cours { border-left-color: #f59e0b; }
.carte-ticket.resolu { border-left-color: #1a6b3c; opacity: 0.7; }
.ticket-titre { font-weight: 700; font-size: 15px; }
.ticket-meta { font-size: 12px; color: #888; margin-top: 3px; }
.ticket-desc { font-size: 13px; color: #555; margin-top: 6px; }
.ticket-statut { font-size: 12px; padding: 3px 10px; border-radius: 10px; font-weight: 600; }
.ts-ouvert { background: #ffebee; color: #c62828; }
.ts-en_cours { background: #fff3e0; color: #e65100; }
.ts-resolu { background: #e8f5e9; color: #1a6b3c; }
.ticket-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ticket-actions button { font-size: 12px; padding: 6px 10px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; }

/* VIDE */
.vide {
  text-align: center;
  padding: 40px 20px;
  color: #aaa;
  font-size: 15px;
}
.vide span { font-size: 48px; display: block; margin-bottom: 12px; }

@media (max-width: 380px) {
  .gros-btn { font-size: 14px; min-height: 110px; }
  .stat span { font-size: 22px; }
}
