/* Courses : mise en page de l'application (barre, deux volets, fil de discussion).
   Couleurs, polices, cartes, boutons, champs, pastilles et onglets viennent de /commun/style.css. */

/* Les blocs mis en flex ou en grille doivent rester masqués quand l'attribut hidden est posé */
[hidden] {
  display: none !important;
}

/* --- Page de connexion --------------------------------------------------------------------- */

.formulaire {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: end;
}

.formulaire label,
.formulaire input {
  flex: 1 1 100%;
}

/* --- Application --------------------------------------------------------------------------- */

body.appli {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.barre {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--papier);
  border-bottom: 1px solid var(--trait);
}

.marque {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
}

.marque .toque {
  width: 2rem;
  height: 2rem;
}

.barre h1 {
  font-size: 1.4rem;
  margin: 0;
}

.barre .listes {
  flex: 1 1 12rem;
  min-width: 0;
}

.barre .moi {
  margin: 0;
}

.nouvelle-liste {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--trait);
}

.nouvelle-liste input {
  flex: 1 1 14rem;
}

.espace {
  flex: 1;
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 26rem);
  align-items: start;
  gap: 1rem;
}

.espace section {
  margin: 0;
}

.aucune {
  grid-column: 1 / -1;
}

.vues-mobiles {
  display: none;
}

/* --- Volet liste --------------------------------------------------------------------------- */

.articles {
  list-style: none;
  margin: 0;
  padding: 0;
}

.articles li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 5.5rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--trait);
}

.articles .nom small {
  display: block;
}

.articles .prix,
.total strong {
  text-align: right;
  white-space: nowrap;
}

.total {
  display: flex;
  justify-content: space-between;
  margin: 0.75rem 0 0;
  font-size: 1.15rem;
}

/* --- Volet Rémy ---------------------------------------------------------------------------- */

.volet-chat {
  position: sticky;
  top: 1rem;
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 8rem);
  min-height: 24rem;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.message {
  max-width: 88%;
  padding: 0.5rem 0.8rem;
  border-radius: 1rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.remy {
  align-self: flex-start;
  background: var(--fond);
  border-bottom-left-radius: 0.25rem;
}

.message.humain {
  align-self: flex-start;
  border: 1px solid var(--trait);
}

.message.moi {
  align-self: flex-end;
  background: var(--accent);
  color: var(--papier);
  border: 0;
  border-bottom-right-radius: 0.25rem;
}

.message.systeme {
  align-self: center;
  color: var(--encre-douce);
  font-size: 0.9rem;
}

.message .etat {
  display: block;
  font-size: 0.8rem;
  opacity: 0.8;
}

.onglets .voyant {
  margin-right: 0.4rem;
}

.message .auteur {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--encre-douce);
}

.attente {
  margin: 0 0 0.5rem;
}

.envoi {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.5rem;
  align-items: end;
}

.envoi label {
  grid-column: 1 / -1;
}

.envoi textarea {
  resize: none;
  field-sizing: content;
  min-height: 2.6rem;
  max-height: 9rem;
}

/* --- Téléphone : un volet à la fois -------------------------------------------------------- */

@media (max-width: 48rem) {
  .espace {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.75rem;
  }

  .vues-mobiles {
    display: flex;
    padding: 0.5rem 0.75rem 0;
  }

  .espace[data-vue="liste"] .volet-chat,
  .espace[data-vue="chat"] .volet-liste {
    display: none;
  }

  .volet-chat {
    position: static;
    height: calc(100dvh - 11rem);
  }

  .barre .moi {
    flex-basis: 100%;
  }
}
