/* Rubrique « Messages » (src/web/modules/messages.js) : vues, générateur et aperçu façon Discord. */
.msg-rubrique { display: grid; gap: 20px; }

/* Les quatre vues */
.msg-vues { display: flex; max-width: 100%; }   /* barre des parties : pleine largeur (.sous-rubriques, app.css) */
.msg-vues button { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.msg-nb { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: rgb(255 255 255 / .1); font-size: 12px; font-weight: 700; }
.msg-vues button[aria-pressed="true"] .msg-nb { background: rgb(0 0 0 / .12); }
@media (max-width: 480px) {
  .msg-vues { width: 100%; }
  .msg-vues button { flex: 1 1 0; justify-content: center; padding: 0 6px; font-size: 14px; min-width: 0; }
  .msg-vues .msg-nb { display: none; }
}

/* Mise en page : aperçu au-dessus quand la rubrique est étroite, colonne collée à droite quand elle est large.
   Suit la largeur de la rubrique (conteneur « panneau », #panneau-reglages), pas celle de la fenêtre : avec la
   colonne de navigation à gauche, la rubrique fait ~990 px à 1440 et ~870 px à 1280. */
.msg-mise { display: grid; gap: 20px; }
.msg-col { display: grid; gap: 20px; min-width: 0; }
.msg-apercu { min-width: 0; }
@container panneau (min-width: 940px) {
  .msg-mise { grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); align-items: start; }
  /* colonne de gauche ~480-560 px : un contrôle moins large laisse au libellé la place d'une vraie ligne */
  .msg-col .ligne-r { grid-template-columns: minmax(0, 1fr) minmax(180px, 240px); }
  .msg-col .ligne-r:has(> div > .msg-droite) { grid-template-columns: minmax(0, 1fr) auto; }   /* un interrupteur seul : tout le reste au libellé */
  .msg-col { grid-column: 1; grid-row: 1; }
  .msg-apercu { grid-column: 2; grid-row: 1; align-self: stretch; }
  .msg-apercu > .apercu-panneau { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 84px); max-height: calc(100vh - 120px); overflow: auto; scrollbar-width: none; }
  .msg-apercu > .apercu-panneau::-webkit-scrollbar { display: none; }
}
.msg-apercu-ou { margin-left: auto; color: var(--attenue); font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Bandeau « tu modifies… » */
.msg-edition { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; padding: 12px 14px 12px 18px; border-radius: 16px; background: rgb(58 174 239 / .1); color: var(--texte); font-size: 15px; line-height: 21px; }
.msg-edition > span:nth-child(2) { flex: 1 1 220px; min-width: 0; }

/* Morceaux de formulaire */
.msg-droite { display: flex; justify-content: flex-end; }
@media (max-width: 734px) { .msg-droite { justify-content: flex-start; } }
.msg-grand { min-height: 120px; resize: vertical; }
.formulaire textarea.saisie { resize: vertical; min-height: 96px; }
.msg-note { margin: 0; color: var(--attenue); font-size: 13.5px; line-height: 19px; }
.msg-note code, .msg-var code { font: 500 13px ui-monospace, "SF Mono", Menlo, monospace; color: var(--bleu-clair); }
.msg-compte { float: right; font-variant-numeric: tabular-nums; }
.msg-droite-t { text-align: right; margin-top: -6px; }
.msg-droite-t .msg-compte { float: none; }
.msg-sous-titre { font-size: 14px; font-weight: 600; margin-top: 4px; }
.msg-sous-titre small { color: var(--attenue); font-weight: 400; margin-left: 4px; }
.msg-case { display: flex !important; grid-auto-flow: column; align-items: center; gap: 10px !important; font-weight: 500 !important; cursor: pointer; }
.msg-case input { width: 18px; height: 18px; margin: 0; accent-color: var(--bleu-clair); flex: none; }
.msg-rang { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.msg-etiq { font-size: 14px; font-weight: 600; }
.msg-seg { flex-wrap: wrap; }
.msg-seg button { min-height: 32px; font-size: 14px; }
.msg-liste { display: grid; gap: 8px; padding: 4px 12px 8px; }
.msg-item { display: grid; gap: 12px; padding: 14px 16px 16px; border-radius: 16px; background: var(--tuile-survol); min-width: 0; }
.formulaire.plat .msg-item { margin: 0; }
.msg-item label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; min-width: 0; }
.msg-item label small { color: var(--attenue); font-weight: 400; margin-left: 4px; }
.msg-item .champs-2 { display: grid; gap: 12px; }
@media (min-width: 735px) { .msg-item .champs-2 { grid-template-columns: 1fr 1fr; } }
.msg-item-tete { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.msg-item-tete > span:first-child { color: var(--attenue); margin-right: auto; }
.msg-item .avert, .msg-avert-r { margin: 0; color: var(--ambre); font-size: 13.5px; line-height: 18px; }
.msg-avert-r { padding: 0 4px; }
.msg-reactions { display: grid; gap: 8px; padding: 4px 22px 8px; }
.msg-reaction { display: grid; grid-template-columns: 110px minmax(0, 1fr) 38px; gap: 8px; align-items: center; }
.msg-reactions + .msg-note { padding: 0 22px 6px; }
.groupe > .msg-note { padding: 4px 22px 8px; }
.groupe-pied .aide { align-self: center; color: var(--attenue); font-size: 14px; }
.msg-rubrique .bouton svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; margin-right: 6px; }
.msg-prog { margin: 4px 22px 8px; }
.msg-prog label { min-width: 0; }
.msg-prog input[type="date"], .msg-prog input[type="time"] { color-scheme: dark; min-width: 0; }
.msg-erreur { padding: 0 22px; margin: 4px 0 0; }
.msg-vars { display: flex; flex-wrap: wrap; gap: 6px; }
.msg-var { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border: 0; border-radius: 999px; background: var(--tuile-haute); color: var(--attenue); font: inherit; font-size: 13.5px; cursor: pointer; }
.msg-var:hover { background: #3f4148; color: var(--texte); }
.msg-hors { padding: 0 4px; }
.msg-dom { display: flex; gap: 8px; margin-top: 8px; }
.msg-dom .saisie { flex: 1; min-width: 0; }
.puce.seule-salon { padding-left: 12px; }
.msg-sans-contenu { margin: 0; }

/* Listes « Envoyés » */
.msg-rangee { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 22px; position: relative; }
.msg-rangee + .msg-rangee::before { content: ''; position: absolute; top: 0; left: 22px; right: 22px; height: 1px; background: var(--trait); }
.msg-rangee h3 { margin: 0; font-size: 16px; line-height: 21px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; overflow-wrap: anywhere; }
.msg-rangee p { margin: 2px 0 0; color: var(--attenue); font-size: 14px; line-height: 19px; }
.msg-rangee .avert { color: var(--ambre); font-size: 13.5px; }
.msg-rangee a.outil { color: var(--attenue); }
.msg-rangee a.outil:hover { color: var(--texte); }
.msg-vide { margin: 0; padding: 6px 22px 16px; color: var(--attenue); font-size: 15px; }
.etiquette.msg-rouge { background: rgb(240 113 120 / .16); color: #ffb3b7; }
.etiquette.msg-ambre { background: rgb(242 198 109 / .14); color: var(--ambre); }

/* ── Aperçu façon Discord ── */
.mdc { overflow-wrap: anywhere; }
.mdc p { margin: 0; }
.mdc .mdc-vide { height: 1.375em; }
.mdc-texte { color: #dbdee1; }
.mdc b { color: #f2f3f5; font-weight: 700; }
.mdc code { padding: 1px 3px; border-radius: 4px; background: #2b2d31; font: 13px/1.3 ui-monospace, "SF Mono", Menlo, monospace; color: #dbdee1; }
.mdc pre { margin: 4px 0; padding: 8px 10px; border-radius: 6px; background: #2b2d31; border: 1px solid #1e1f22; font: 13px/1.4 ui-monospace, "SF Mono", Menlo, monospace; white-space: pre-wrap; color: #dbdee1; }
.mdc blockquote { margin: 2px 0; padding-left: 12px; border-left: 4px solid #4e5058; }
.mdc ul { margin: 2px 0; padding-left: 22px; }
.mdc-h1 { font-size: 24px; line-height: 1.375; font-weight: 700; color: #f2f3f5; margin: 6px 0 2px !important; }
.mdc-h2 { font-size: 20px; line-height: 1.375; font-weight: 700; color: #f2f3f5; margin: 6px 0 2px !important; }
.mdc-h3 { font-size: 16px; line-height: 1.375; font-weight: 700; color: #f2f3f5; margin: 6px 0 2px !important; }
.mdc-sous { font-size: 12px; line-height: 1.33; color: #949ba4; }
.mdc-mention { padding: 0 2px; border-radius: 3px; background: rgb(88 101 242 / .3); color: #c9cdfb; font-weight: 500; }
.mdc-lien { color: #00a8fc; }
.mdc-cache { border-radius: 3px; background: #1e1f22; color: transparent; }
.mdc-emoji { width: 1.375em; height: 1.375em; vertical-align: -.3em; object-fit: contain; }
.mdc-gris { color: #949ba4; font-size: 14px; }

.mdc-embed { position: relative; margin-top: 6px; max-width: 432px; border-radius: 4px; background: #2b2d31; border-left: 4px solid var(--c, #1e1f22); }
.mdc-embed-in { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 8px 16px 16px 12px; }
.mdc-embed-in.avec-vignette { grid-template-columns: minmax(0, 1fr) 80px; }
.mdc-embed-corps { display: grid; gap: 8px; min-width: 0; padding-top: 8px; font-size: 14px; line-height: 1.375; color: #dbdee1; }
.mdc-bas { grid-column: 1 / -1; display: grid; gap: 8px; margin-top: -6px; font-size: 14px; }
.mdc-embed-corps:empty { display: none; }
.mdc-auteur { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #f2f3f5; min-width: 0; }
.mdc-titre { font-size: 16px; font-weight: 600; color: #f2f3f5; }
.mdc-titre.lien { color: #00a8fc; }
.mdc-champs { display: grid; gap: 8px; }
.mdc-ligne { display: grid; gap: 8px; }
.mdc-ligne.n2 { grid-template-columns: 1fr 1fr; }
.mdc-ligne.n3 { grid-template-columns: 1fr 1fr 1fr; }
.mdc-champ { min-width: 0; }
.mdc-champ-nom { font-weight: 600; color: #f2f3f5; margin-bottom: 2px; }
.mdc-pied { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #b5bac1; }
.mdc-icone { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex: none; }
.mdc-image { display: block; width: 100%; max-height: 300px; object-fit: cover; border-radius: 4px; }
.mdc-vignette { display: block; width: 80px; height: 80px; border-radius: 4px; object-fit: cover; margin-top: 8px; }
/* Image hors de Discord : la page ne peut pas l'afficher, un cadre dit d'où elle vient */
.mdc-img-cadre { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: #1e1f22; color: #949ba4; font-size: 12px; text-align: center; overflow: hidden; }
.mdc-img-cadre svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mdc-img-cadre span { max-width: 100%; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdc-image.mdc-img-cadre { height: 150px; }
.mdc-icone.mdc-img-cadre { padding: 0; }
.mdc-icone.mdc-img-cadre svg { width: 12px; height: 12px; }
.mdc-icone.mdc-img-cadre span { display: none; }
.mdc-vignette.mdc-img-cadre span { font-size: 10px; }

.mdc-rangee { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.mdc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; min-width: 60px; padding: 2px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; color: #fff; background: #4e5058; max-width: 100%; }
.mdc-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdc-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mdc-btn.bleu { background: #5865f2; }
.mdc-btn.vert { background: #248046; }
.mdc-btn.rouge { background: #da373c; }
.mdc-btn .mdc-emoji { width: 18px; height: 18px; vertical-align: 0; }
.mdc-menu { max-width: 432px; }
.mdc-menu span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdc-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.mdc-reaction { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 8px; background: rgb(88 101 242 / .15); border: 1px solid #5865f2; font-size: 14px; }
.mdc-reaction b { font-size: 13px; font-weight: 600; color: #c9cdfb; }
.mdc-reaction .mdc-emoji { width: 16px; height: 16px; vertical-align: 0; }

.formulaire label > .segments, .msg-item label > .segments { width: fit-content; max-width: 100%; }
@media (max-width: 480px) {
  .apercu-discord.mdc { padding: 12px 10px 14px 8px; }
  .mdc .apd-msg { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
  .mdc .apd-av { width: 32px; height: 32px; }
  .mdc-embed-in { padding: 6px 10px 12px 10px; gap: 10px; }
  .mdc-embed-in.avec-vignette { grid-template-columns: minmax(0, 1fr) 56px; }
  .mdc-vignette { width: 56px; height: 56px; }
  .mdc-bas { margin-top: 0; }
  .mdc-ligne.n3 { grid-template-columns: 1fr 1fr; }
  .msg-reaction { grid-template-columns: 84px minmax(0, 1fr) 38px; }
}

/* Bienvenue : deux aperçus l'un sous l'autre (salon puis MP), la carte en image comme Discord l'affiche */
.msg-apercus { display: grid; gap: 16px; align-content: start; }
@container panneau (min-width: 940px) {
  .msg-apercus > .apercu-panneau { position: static; max-height: none; overflow: visible; }
}
.msg-moyen { min-height: 84px; resize: vertical; }
.msg-carte { margin-top: 8px; max-width: 400px; aspect-ratio: 1000 / 340; border-radius: 8px; overflow: hidden; background: #1e1f22; }
.msg-carte img { display: block; width: 100%; height: 100%; }
.msg-carte-attente { display: grid; place-items: center; height: 100%; color: var(--attenue); font-size: 13px; }
