/* ============ Application famille — design épuré ============ */

:root {
  --fond: #f7f7f8;
  --surface: #ffffff;
  --encre: #18181b;
  --gris: #71717a;
  --gris-clair: #a1a1aa;
  --ligne: #e4e4e7;
  --accent: #4f46e5;
  --accent-doux: #eef2ff;
  --vert: #059669;
  --vert-doux: #ecfdf5;
  --rouge: #dc2626;
  --rouge-doux: #fef2f2;
  --ambre: #d97706;
  --rayon: 14px;
}

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

body {
  font-family: -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--fond);
  color: var(--encre);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.cache { display: none !important; }

svg { display: block; }

/* ---------------- En-tête ---------------- */

.entete {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: rgba(247, 247, 248, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ligne);
}

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

.logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--encre);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo svg { width: 17px; height: 17px; }

.marque h1 { font-size: 16.5px; font-weight: 700; letter-spacing: -0.02em; }

#statut {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gris);
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: 999px;
  padding: 6px 12px;
}

#statut-point { width: 7px; height: 7px; border-radius: 50%; background: var(--ambre); }
#statut.en-ligne #statut-point { background: #10b981; }
#statut.en-ligne { color: var(--encre); }

/* ---------------- Contenu ---------------- */

main { padding: 18px 16px 92px; }

.onglet { display: none; }
.onglet.visible { display: block; animation: apparition 0.2s ease; }

@keyframes apparition {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.carte {
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  padding: 18px;
  margin-bottom: 14px;
}

.carte h2 {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.texte-doux { font-size: 13.5px; color: var(--gris); line-height: 1.5; margin-bottom: 12px; }

.note { font-size: 13px; color: var(--gris-clair); line-height: 1.5; padding: 2px 6px; }

.titre-liste {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--gris-clair);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 22px 4px 10px;
}

/* ---------------- Champs et boutons ---------------- */

input[type="text"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--ligne);
  border-radius: 10px;
  padding: 12px 13px;
  font-size: 15px;
  margin-bottom: 10px;
  font-family: inherit;
  background: var(--surface);
  color: var(--encre);
}

input::placeholder, textarea::placeholder { color: var(--gris-clair); }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-doux);
}

textarea { min-height: 80px; resize: vertical; }

.btn {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  font-family: inherit;
  transition: opacity 0.12s, transform 0.08s;
}

.btn:active { transform: scale(0.99); opacity: 0.85; }

.btn.principal { background: var(--encre); }
.btn.secondaire { background: var(--surface); color: var(--encre); border: 1px solid var(--ligne); }
.btn.appel { background: var(--vert); }
.btn.appel:disabled { background: var(--ligne); color: var(--gris-clair); cursor: default; }
.btn.raccrocher { background: var(--rouge); margin-top: 12px; }
.btn.compact { width: auto; padding: 12px 20px; flex-shrink: 0; }

.rangee-boutons { display: flex; gap: 10px; }
.rangee-champ { display: flex; gap: 10px; }
.rangee-champ input { margin-bottom: 0; }

.champ-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--encre);
}

.champ-ligne select { width: auto; margin-bottom: 0; padding: 9px 12px; font-size: 14px; }

/* ---------------- Import de photos ---------------- */

.zone-depot {
  width: 100%;
  border: 1.5px dashed var(--ligne);
  border-radius: 12px;
  background: var(--fond);
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 600;
  color: var(--encre);
  cursor: pointer;
  font-family: inherit;
}

.zone-depot:active { background: var(--accent-doux); border-color: var(--accent); }

.zone-depot small { font-size: 12px; font-weight: 400; color: var(--gris-clair); }

.zone-depot-icone {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--ligne);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--encre);
  margin-bottom: 4px;
}

.zone-depot-icone svg { width: 18px; height: 18px; }

/* ---------------- Albums ---------------- */

.album-item {
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  margin-bottom: 12px;
  overflow: hidden;
}

.album-couvertures {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 116px;
  gap: 2px;
  cursor: pointer;
  background: var(--fond);
  overflow: hidden;
}

.album-couvertures img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  min-height: 0;
}

.album-couvertures .mini {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  min-height: 0;
}

.album-couvertures .vide-couv {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gris-clair);
}

.album-couvertures .vide-couv svg { width: 28px; height: 28px; }

.album-infos {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
}

.album-infos .nom { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.album-infos .detail { font-size: 12.5px; color: var(--gris); margin-top: 2px; }

.album-item.inactif .album-couvertures { filter: grayscale(1) opacity(0.55); }

/* Interrupteur */
.interrupteur { position: relative; width: 42px; height: 25px; flex-shrink: 0; }

.interrupteur input { opacity: 0; width: 0; height: 0; }

.interrupteur .glissiere {
  position: absolute;
  inset: 0;
  background: var(--ligne);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s;
}

.interrupteur .glissiere::before {
  content: '';
  position: absolute;
  width: 19px;
  height: 19px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.18s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.interrupteur input:checked + .glissiere { background: var(--encre); }
.interrupteur input:checked + .glissiere::before { transform: translateX(17px); }

.btn-retour {
  display: flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  color: var(--gris);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 2px 12px;
  font-family: inherit;
}

.btn-retour svg { width: 16px; height: 16px; }

.btn-lien-danger {
  width: 100%;
  border: none;
  background: none;
  color: var(--rouge);
  font-size: 13px;
  cursor: pointer;
  padding: 12px 0 2px;
  font-family: inherit;
}

/* ---------------- Galerie ---------------- */

#galerie {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.photo-item {
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: 12px;
  overflow: hidden;
}

.photo-item .visuel { position: relative; }

.photo-item img { width: 100%; height: 124px; object-fit: cover; display: block; }

.photo-item.masquee img { filter: grayscale(1) brightness(0.8); }

.badge-masquee {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(24, 24, 27, 0.85);
  color: #fff;
  font-size: 10.5px;
  font-weight: 650;
  border-radius: 6px;
  padding: 3px 7px;
}

.photo-item .legende {
  padding: 8px 10px 3px;
  font-size: 12.5px;
  min-height: 27px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--encre);
}

.photo-item .actions { display: flex; border-top: 1px solid var(--ligne); }

.photo-item .actions button {
  flex: 1;
  border: none;
  background: none;
  padding: 9px 0;
  cursor: pointer;
  color: var(--gris);
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-item .actions button svg { width: 16px; height: 16px; }
.photo-item .actions button + button { border-left: 1px solid var(--ligne); }
.photo-item .actions .supprimer { color: var(--rouge); }

/* ---------------- Listes rappels / messages ---------------- */

.ligne {
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: 12px;
  padding: 13px 15px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.ligne .titre { font-size: 14px; font-weight: 600; }
.ligne .sous-titre { font-size: 12.5px; color: var(--gris); margin-top: 2px; }
.ligne.passe { opacity: 0.5; }

.ligne .supprimer {
  border: none;
  background: none;
  color: var(--gris-clair);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ligne .supprimer:active { background: var(--rouge-doux); color: var(--rouge); }
.ligne .supprimer svg { width: 16px; height: 16px; }

/* ---------------- Suggestions ---------------- */

.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.suggestion {
  border: 1px solid var(--ligne);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--encre);
  font-family: inherit;
}

.suggestion:active { background: var(--accent-doux); border-color: var(--accent); }

/* ---------------- Appel ---------------- */

.carte-appel { text-align: center; padding-top: 26px; }

.appel-rond {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--vert-doux);
  color: var(--vert);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.appel-rond svg { width: 26px; height: 26px; }

.carte-appel input { text-align: center; }

#visio-zone { position: relative; }

#visio-distant {
  width: 100%;
  border-radius: var(--rayon);
  background: #000;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

#visio-local {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 92px;
  border-radius: 10px;
  border: 2px solid #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

/* ---------------- Télécommande ---------------- */

#tele-chaines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.chaine-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--ligne);
  background: var(--surface);
  border-radius: 11px;
  padding: 12px 14px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--encre);
  text-align: left;
  font-family: inherit;
}

.chaine-chip span {
  background: var(--fond);
  border-radius: 7px;
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--gris);
}

.chaine-chip.active { border-color: var(--accent); background: var(--accent-doux); }
.chaine-chip.active span { background: var(--accent); color: #fff; }

.tele-rangee {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.btn-rond {
  border: 1px solid var(--ligne);
  background: var(--surface);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--encre);
}

.btn-rond:active { background: var(--fond); }
.btn-rond svg { width: 18px; height: 18px; }

#tele-volume-barre {
  flex: 1;
  height: 6px;
  background: var(--ligne);
  border-radius: 3px;
  overflow: hidden;
}

#tele-volume-niveau {
  height: 100%;
  background: var(--encre);
  border-radius: 3px;
  transition: width 0.15s;
}

/* ---------------- Profil / membres ---------------- */

.entete-profil {
  border: none;
  background: none;
  color: var(--gris);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0 0;
  font-family: inherit;
}

.membre-carte {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ligne);
  border-radius: 12px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.membre-carte.moi { border-color: var(--accent); background: var(--accent-doux); }

.membre-choix {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  padding: 0;
}

.pastille {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.membre-nom { font-size: 14.5px; font-weight: 600; color: var(--encre); }

.mini-option {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--gris);
  cursor: pointer;
}

.membre-suppr {
  border: none;
  background: none;
  color: var(--gris-clair);
  cursor: pointer;
  font-size: 15px;
  padding: 4px 6px;
}

/* ---------------- Veille bienveillante ---------------- */

.veille {
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
}

.veille.ok { background: var(--vert-doux); color: var(--vert); }
.veille.alerte { background: #fef2f2; color: var(--rouge); }
.veille.inconnu { background: var(--fond); color: var(--gris); }

/* ---------------- Historique appels ---------------- */

.appel-duree { font-size: 13px; color: var(--gris); font-weight: 600; }
.appel-duree.manque { color: var(--rouge); }

/* ---------------- Accusés de lecture ---------------- */

.recu { font-size: 11.5px; color: var(--gris-clair); white-space: nowrap; flex-shrink: 0; }
.recu.vu { color: var(--vert); }

/* ---------------- États vides ---------------- */

.etat-vide {
  text-align: center;
  padding: 32px 20px;
  color: var(--gris-clair);
}

.etat-vide p { font-size: 13.5px; line-height: 1.55; }

/* ---------------- Navigation basse ---------------- */

#nav-bas {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--ligne);
  padding-bottom: env(safe-area-inset-bottom);
}

#nav-bas button {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 0 11px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--gris-clair);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}

#nav-bas button svg { width: 21px; height: 21px; }

#nav-bas button.actif { color: var(--encre); }

/* ---------------- Toast ---------------- */

#toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translate(-50%, -80px);
  background: var(--encre);
  color: #fff;
  font-size: 13.5px;
  font-weight: 550;
  border-radius: 999px;
  padding: 11px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transition: transform 0.28s ease;
  z-index: 100;
  max-width: 90%;
  text-align: center;
}

#toast.visible { transform: translate(-50%, 0); }
