/* Système de design — dérivé de la maquette Claude Design
   (projet "GestionMaison mobile app", écran GestionMaison.dc.html).
   Palette volontairement claire uniquement (pas de variante sombre) :
   la maquette n'en propose pas. */

:root {
  color-scheme: light;

  --fond-app: #f6f3ec;
  --surface: #ffffff;
  --surface-alerte: #fbebe2;
  --surface-accent: #cde4da;

  --primaire: #1f4b3f;
  --primaire-survol: #2a5f50;
  --accent: #83c0ac;
  --accent-texte: #8fb9aa;
  --accent-clair: #b7d8cc;

  --terracotta: #b4531f;
  --terracotta-vif: #c9612f;
  --terracotta-bordure: #efc9b2;
  --ambre: #f0c08a;

  --texte: #14201c;
  --texte-att: #6b7a73;
  --texte-faint: #8a9990;
  --texte-disabled: #a8b2ac;

  --bordure: #d9d3c6;
  --bordure-douce: #e3dcce;
  --bordure-nav: #e8e2d6;
  --separateur: #f0ece3;
  --bordure-secondaire: #c6cfc9;

  --rayon-carte: 22px;
  --rayon-champ: 14px;
  --rayon-bouton: 16px;
  --ombre-carte: 0 1px 2px rgba(20, 32, 28, 0.06);

  --police: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --police-titre: "Instrument Serif", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--fond-app);
  color: var(--texte);
  font-family: var(--police);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primaire);
}

input,
button,
textarea {
  font-family: inherit;
}

@keyframes gmspin {
  to {
    transform: rotate(360deg);
  }
}

[hidden] {
  display: none !important;
}

/* ── Coquille de l'app (après connexion) ──────────────────────────────── */

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--fond-app);
}

#vue-active {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 96px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: max(8px, env(safe-area-inset-top));
}

.barre-onglets {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--bordure-nav);
  padding: 8px 6px max(10px, env(safe-area-inset-bottom));
  z-index: 10;
}

.onglet {
  flex: 1;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.onglet-pastille {
  width: 56px;
  height: 30px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.onglet-label {
  font: 500 11px/1 var(--police);
}

/* ── En-têtes d'écran ──────────────────────────────────────────────────── */

h2.titre-ecran {
  margin: 0;
  font: 400 30px/1.1 var(--police-titre);
  color: var(--texte);
}

.sous-titre-ecran {
  font: 400 13px/1.3 var(--police);
  color: var(--texte-faint);
}

/* ── Boutons ───────────────────────────────────────────────────────────── */

.bouton {
  height: 52px;
  border: none;
  border-radius: var(--rayon-bouton);
  background: var(--primaire);
  color: var(--fond-app);
  font: 600 14px/1 var(--police);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
}

.bouton:hover {
  background: var(--primaire-survol);
}

.bouton:disabled {
  opacity: 0.6;
  cursor: default;
}

.bouton-outline {
  background: transparent;
  border: 1.5px solid var(--primaire);
  color: var(--primaire);
}

.bouton-outline:hover {
  background: rgba(31, 75, 63, 0.07);
}

.bouton-neutre {
  background: transparent;
  border: 1.5px solid var(--bordure-secondaire);
  color: var(--primaire);
}

.bouton-neutre:hover {
  background: rgba(31, 75, 63, 0.07);
}

.bouton-icone {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--ombre-carte);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.bouton-icone:hover {
  background: var(--fond-app);
}

/* ── Puces / sélecteurs (chips) ────────────────────────────────────────── */

.puce {
  border: 1.5px solid var(--bordure);
  background: var(--surface);
  color: var(--texte-att);
  border-radius: 99px;
  padding: 8px 14px;
  font: 500 12.5px/1 var(--police);
  cursor: pointer;
}

.puce.actif {
  border-color: var(--primaire);
  background: var(--surface-accent);
  color: var(--primaire);
}

/* ── Cartes ────────────────────────────────────────────────────────────── */

.carte {
  background: var(--surface);
  border-radius: var(--rayon-carte);
  padding: 16px;
  box-shadow: var(--ombre-carte);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.carte-sombre {
  background: var(--primaire);
  border-radius: var(--rayon-carte);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--fond-app);
}

.carte-alerte {
  background: var(--surface-alerte);
  border: 1px solid var(--terracotta-bordure);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--terracotta);
  font: 500 12.5px/1.45 var(--police);
}

.carte-pointillee {
  border: 1.5px dashed var(--bordure);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Formulaires ───────────────────────────────────────────────────────── */

.champ-groupe {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.champ-label {
  font: 500 12px/1 var(--police);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--texte-att);
}

.champ,
.champ-groupe input,
.champ-groupe textarea {
  height: 52px;
  border-radius: var(--rayon-champ);
  border: 1.5px solid var(--bordure);
  background: var(--surface);
  padding: 0 16px;
  font-size: 16px;
  color: var(--texte);
  outline: none;
  width: 100%;
}

.champ-groupe textarea {
  height: auto;
  min-height: 76px;
  padding: 13px 16px;
  font: 400 14px/1.5 var(--police);
  resize: none;
}

.champ:focus,
.champ-groupe input:focus,
.champ-groupe textarea:focus {
  border-color: var(--primaire);
  box-shadow: 0 0 0 3px rgba(31, 75, 63, 0.12);
}

.message-erreur {
  color: var(--terracotta);
  font-size: 0.9rem;
  min-height: 1.2em;
  text-align: center;
}

/* ── Interrupteur (switch) ─────────────────────────────────────────────── */

.interrupteur {
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: 99px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 3px;
  background: var(--bordure-secondaire);
  justify-content: flex-start;
  transition: background 0.15s;
}

.interrupteur.actif {
  background: var(--primaire);
  justify-content: flex-end;
}

.interrupteur .bille {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ── Progression ───────────────────────────────────────────────────────── */

.barre-progression {
  height: 8px;
  border-radius: 99px;
  background: var(--fond-app);
  overflow: hidden;
  display: flex;
}

.barre-progression > span {
  height: 100%;
}

/* ── Liste de tâches / éléments ────────────────────────────────────────── */

.case-cochee {
  flex: none;
  width: 24px;
  height: 24px;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.case-cochee .rond-vide {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.8px solid var(--bordure-secondaire);
}

.case-cochee .rond-plein {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primaire);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--primaire);
  color: var(--fond-app);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 11px/1 var(--police);
}

/* ── Écrans de connexion (avant l'app) ─────────────────────────────────── */

.ecran-connexion {
  min-height: 100vh;
  max-width: 460px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 34px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.ecran-connexion .entete {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ecran-connexion .logo {
  width: 84px;
  height: 84px;
  display: block;
}

.ecran-connexion h1 {
  margin: 0;
  font: 400 36px/1.05 var(--police-titre);
  color: var(--texte);
}

.ecran-connexion h1 em {
  font-style: italic;
}

.ecran-connexion p.accroche {
  margin: 0;
  font: 400 14px/1.5 var(--police);
  color: var(--texte-att);
}

.champ-mdp-conteneur {
  position: relative;
  display: flex;
}

.champ-mdp-conteneur input {
  flex: 1;
  padding-right: 52px;
}

.bouton-oeil {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bouton-oeil:hover {
  background: rgba(31, 75, 63, 0.08);
}

.ligne-souvenir {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.case-souvenir {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font: 500 13.5px/1 var(--police);
  color: var(--texte);
}

.case-souvenir .boite {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.8px solid var(--bordure);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

.case-souvenir.coche .boite {
  background: var(--primaire);
  border-color: var(--primaire);
}

.lien-discret {
  font: 500 13px/1 var(--police);
  color: var(--texte-att);
  text-decoration: none;
}

.pied-invitation {
  padding: 18px 0 0;
  border-top: 1px solid var(--bordure-douce);
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--texte-faint);
  font: 400 12px/1.45 var(--police);
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(246, 243, 236, 0.35);
  border-top-color: var(--fond-app);
  animation: gmspin 0.7s linear infinite;
}

/* ── Desktop (≥ 900px) ─────────────────────────────────────────────────────
   En dessous du seuil, rien ne change : coquille mobile (onglets bas,
   colonne à 480px). Au-delà, disposition classique de site web — barre
   latérale fixe, connexion en deux colonnes, contenu qui utilise la largeur
   disponible. Les éléments ci-dessous n'existent pas en dessous du seuil. */

.panneau-marque {
  display: none;
}

.barre-laterale {
  display: none;
}

.rangee-cartes {
  display: flex;
  gap: 10px;
}

/* Bandeau sombre de l'espace choisi (Entretien).
   Sous 900 px la colonne est en `display: contents` : le bandeau tombe dans le
   flux de la page, juste sous l'en-tête, et déborde volontairement jusqu'aux
   bords — d'où la marge négative et les seuls coins bas arrondis. Au-delà, il
   redevient une carte de la colonne et doit être arrondi de partout. */
.bandeau-espace {
  margin: -8px -20px 0;
  padding: 16px 20px 20px;
  background: var(--primaire);
  color: var(--fond-app);
  border-radius: 0 0 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.grille-cartes {
  display: flex;
  flex-direction: column;
}

.disposition-principale,
.colonne-principale,
.colonne-secondaire {
  display: contents;
}

@media (min-width: 900px) {
  /* Connexion : bandeau de marque à gauche, formulaire à droite. */
  .ecran-auth {
    display: flex;
    min-height: 100vh;
  }

  .panneau-marque {
    display: flex;
    flex: 1 1 420px;
    flex-direction: column;
    justify-content: space-between;
    gap: 48px;
    background: var(--primaire);
    padding: 48px 56px;
    min-height: 100vh;
    box-sizing: border-box;
  }

  .panneau-marque .marque-entete {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .panneau-marque .marque-entete img {
    width: 40px;
    height: 40px;
    display: block;
  }

  .panneau-marque .marque-entete span {
    font: 600 14px/1 var(--police);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fond-app);
  }

  .panneau-marque h1 {
    margin: 0;
    font: 400 52px/1.05 var(--police-titre);
    color: var(--fond-app);
  }

  .panneau-marque h1 em {
    font-style: italic;
    color: var(--accent-clair);
  }

  .panneau-marque p {
    margin: 0;
    font: 400 16px/1.55 var(--police);
    color: var(--accent-clair);
    max-width: 480px;
  }

  .panneau-marque .marque-pied {
    font: 400 13px/1.4 var(--police);
    color: var(--accent-clair);
  }

  .ecran-connexion {
    flex: 1 1 440px;
    min-height: 100vh;
    justify-content: center;
  }

  /* Coquille de l'app : barre latérale + contenu, plein écran. */
  #app {
    max-width: none;
    flex-direction: row;
    align-items: stretch;
  }

  .barre-onglets {
    display: none;
  }

  .barre-laterale {
    display: flex;
    flex: 0 0 248px;
    flex-direction: column;
    gap: 22px;
    background: var(--surface);
    border-right: 1px solid var(--bordure-nav);
    padding: 22px 14px;
    min-height: 100vh;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    align-self: flex-start;
  }

  .barre-laterale .laterale-entete {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px;
  }

  .barre-laterale .laterale-entete img {
    width: 32px;
    height: 32px;
    display: block;
    flex: none;
  }

  .barre-laterale .laterale-entete .textes {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
  }

  .barre-laterale .nom-app {
    font: 600 13px/1 var(--police);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--primaire);
  }

  .barre-laterale .nom-foyer {
    font: 400 12px/1 var(--police);
    color: var(--texte-att);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .barre-laterale nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .barre-laterale .onglet-lateral {
    border: none;
    background: transparent;
    border-radius: 12px;
    padding: 11px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    width: 100%;
  }

  .barre-laterale .onglet-lateral:hover {
    background: var(--separateur);
  }

  .barre-laterale .onglet-lateral .libelle {
    flex: 1;
    font: 500 14px/1 var(--police);
  }

  .barre-laterale .laterale-pied {
    margin-top: auto;
    border-top: 1px solid var(--bordure-nav);
    padding: 16px 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .barre-laterale .laterale-pied .avatar {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 12.5px;
  }

  .barre-laterale .laterale-pied .textes {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
  }

  .barre-laterale .laterale-pied .nom {
    font: 600 13.5px/1 var(--police);
    color: var(--texte);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .barre-laterale .laterale-pied .role {
    font: 400 12px/1 var(--police);
    color: var(--texte-att);
  }

  .barre-laterale .laterale-pied button {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
  }

  .barre-laterale .laterale-pied button:hover {
    background: var(--separateur);
  }

  /* Contenu : largeur confortable plutôt que colonne mobile centrée. */
  #vue-active {
    max-width: none;
    width: 100%;
    padding: 32px 40px 56px;
  }

  #vue-active > * {
    width: 100%;
    max-width: 1080px;
  }

  #vue-active {
    align-items: center;
  }

  /* Le bouton "+" flottant de l'écran Tâches (mobile) redevient un bouton
     normal dans l'en-tête, une fois déplacé dans la ligne de titre par
     taches.js — voir le commentaire à côté de son marquage. */
  #bouton-nouvelle-tache {
    position: static !important;
    box-shadow: none !important;
  }

  .rangee-cartes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .disposition-principale {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: flex-start;
  }

  .colonne-principale {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1.4 1 420px;
    min-width: 0;
  }

  .bandeau-espace {
    margin: 0;
    border-radius: 22px;
  }

  .colonne-secondaire {
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1 1 320px;
    min-width: 0;
  }

  .grille-cartes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    align-items: start;
  }
}
