/* =====================================================================================================================
   (28/11/2026) Messagerie et éditeur de scripts dans la DA actuelle (stylepro / motion / sections / ecrans), chargée en
   dernier. Purement visuel : aucun id, aucune classe ni fonction retirés ; public/msgui.js ne fait que déplacer des
   éléments existants (compteur, filtres) et habiller les menus de la conversation. Sombre et clair, 3 couleurs.
   ===================================================================================================================== */

/* ---------- appli PC (studio-nav) : plus de grande bande vide au-dessus de la messagerie ----------
   Le titre de la page est dans la barre de l'appli ; le compteur « à répondre » et Actualiser passent en tête de liste. */
html.studio-nav body :is(#gs, .app) #view-inbox > .viewbar:is(#gs,*):not(#mx-z) { display: none !important; }
html body :is(#gs, .app) #view-inbox .mx-top:is(#gs,*):not(#mx-z) { display: flex; align-items: center; gap: 6px; margin: 0; padding: 10px 12px 2px; }
html body :is(#gs, .app) #view-inbox .mx-top .msg-sum:is(#gs,*):not(#mx-z) { flex: 1; min-width: 0; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html body :is(#gs, .app) #view-inbox .mx-top .v-ibtn:is(#gs,*):not(#mx-z) { width: 30px; height: 30px; }

/* ---------- filtres : les principaux visibles, les autres dans « Plus », plus rien de coupé ---------- */
html body :is(#gs, .app) #view-inbox .mx-chipbar:is(#gs,*):not(#mx-z) { position: relative; display: flex; align-items: center; gap: 6px; padding: 0 12px 8px; }
html body :is(#gs, .app) #view-inbox .mx-chipbar > .msg-chips:is(#gs,*):not(#mx-z) { flex: none; min-width: auto; display: flex; flex-wrap: nowrap; gap: 6px; padding: 0 !important; overflow: visible; -webkit-mask-image: none !important; mask-image: none !important; }
html body :is(#gs, .app) #view-inbox .mx-chipbar > .msg-chips > .mx-hide:is(#gs,*):not(#mx-z) { display: none !important; }
html body :is(#gs, .app) #view-inbox .mx-chipbar :is(.msg-chips > button, .mx-more):is(#gs,*):not(#mx-z) { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; min-height: 30px; padding: 0 12px !important; border: 1px solid var(--line) !important; border-radius: 999px !important; background: transparent !important; color: var(--muted) !important; font: 600 12.5px/1 var(--font-body, Inter, sans-serif) !important; white-space: nowrap; cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
html body :is(#gs, .app) #view-inbox .mx-chipbar :is(.msg-chips > button, .mx-more):hover:is(#gs,*):not(#mx-z) { color: var(--fg) !important; border-color: var(--line-2) !important; }
html body :is(#gs, .app) #view-inbox .mx-chipbar :is(.msg-chips > button[aria-selected="true"], .mx-more.on):is(#gs,*):not(#mx-z) { color: var(--fg) !important; background: var(--surface-2) !important; border-color: color-mix(in srgb, var(--acc, var(--accent)) 55%, var(--line)) !important; }
html body :is(#gs, .app) #view-inbox .mx-chipbar .msg-chips > button em:is(#gs,*):not(#mx-z) { margin: 0 !important; padding: 1px 6px; border-radius: 999px; background: var(--acc-fill, var(--acc, var(--accent))); color: var(--acc-ink, #0d0d0c) !important; font: 700 10.5px/1.4 var(--font-body, Inter, sans-serif); }
html body :is(#gs, .app) #view-inbox .mx-more svg:is(#gs,*):not(#mx-z) { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2.2; transition: transform .25s; }
html body :is(#gs, .app) #view-inbox .mx-more[aria-expanded="true"] svg:is(#gs,*):not(#mx-z) { transform: rotate(180deg); }
html body :is(#gs, .app) #view-inbox .mx-pop:is(#gs,*):not(#mx-z) { position: absolute; z-index: 40; top: calc(100% - 2px); right: 12px; min-width: 210px; padding: 6px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .55); overflow-y: auto; overscroll-behavior: contain; }
html body :is(#gs, .app) #view-inbox .mx-pop[hidden]:is(#gs,*):not(#mx-z) { display: none !important; }
html body :is(#gs, .app) #view-inbox .mx-pop > button:is(#gs,*):not(#mx-z) { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--fg-2, var(--fg)); font: 500 13px/1 var(--font-body, Inter, sans-serif); text-align: left; cursor: pointer; }
html body :is(#gs, .app) #view-inbox .mx-pop > button:hover:is(#gs,*):not(#mx-z) { background: var(--surface-2); color: var(--fg); }
html body :is(#gs, .app) #view-inbox .mx-pop > button[aria-checked="true"]:is(#gs,*):not(#mx-z) { color: var(--fg); font-weight: 650; }
html body :is(#gs, .app) #view-inbox .mx-pop > button[aria-checked="true"]:is(#gs,*):not(#mx-z)::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--acc, var(--accent)); }
html body :is(#gs, .app) #view-inbox .mx-pop em:is(#gs,*):not(#mx-z) { margin-left: auto; font-style: normal; color: var(--muted); font-size: 12px; }
html[data-motion="full"] body #view-inbox .mx-pop:not([hidden]) { animation: mx-pop .22s cubic-bezier(.3, 1.3, .4, 1); transform-origin: top right; }
@keyframes mx-pop { from { opacity: 0; transform: translateY(-4px) scale(.97); } }

/* ---------- bandeau de shift : le texte en entier (sur deux lignes s'il le faut) ---------- */
html body :is(#gs, .app) #view-inbox .ib-shift:not([hidden]):is(#gs,*):not(#mx-z) { display: grid !important; grid-template-columns: 8px minmax(0, 1fr) auto; grid-template-areas: "dot title btn" "dot text btn"; align-items: center; column-gap: 10px; row-gap: 1px; padding: 8px 10px 8px 12px; border-radius: 12px; background: var(--surface); }
html body :is(#gs, .app) #view-inbox .ib-shift > i:is(#gs,*):not(#mx-z) { grid-area: dot; }
html body :is(#gs, .app) #view-inbox .ib-shift > b:is(#gs,*):not(#mx-z) { grid-area: title; font-size: 12.5px; }
html body :is(#gs, .app) #view-inbox .ib-shift > span:is(#gs,*):not(#mx-z) { grid-area: text; white-space: normal !important; overflow: visible !important; text-overflow: clip !important; font-size: 12px; line-height: 1.35; }
html body :is(#gs, .app) #view-inbox .ib-shift > button:is(#gs,*):not(#mx-z) { grid-area: btn; }
html body :is(#gs, .app) #view-inbox .ib-shift button:is(#gs,*):not(#mx-z) { height: 28px; padding: 0 11px !important; border: 1px solid var(--line-2) !important; border-radius: 999px !important; background: var(--surface-2) !important; color: var(--fg) !important; font-weight: 650; }
html body :is(#gs, .app) #view-inbox .ib-shift.on:is(#gs,*):not(#mx-z) { border-color: color-mix(in srgb, var(--ok, #6fcb98) 40%, var(--line)); }

/* ---------- lignes de la liste : l'extrait manquant (« — ») discret ---------- */
html body :is(#gs, .app) #view-inbox .msg-row:is(#gs,*):not(#mx-z) { border-radius: 12px; }

/* ---------- en-tête de la conversation : statut, priorité, chatter en vraies pastilles-menus (jamais coupées) ---------- */
html body :is(#gs, .app) #view-inbox .mt-ctl:is(#gs,*):not(#mx-z) { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
html body :is(#gs, .app) #view-inbox .mx-pill:is(#gs,*):not(#mx-z) { position: relative; display: inline-flex; align-items: center; height: 30px; padding: 0 0 0 30px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface-2); color: var(--fg-2, var(--fg)); transition: border-color .2s, background .2s; }
html body :is(#gs, .app) #view-inbox .mx-pill:hover:is(#gs,*):not(#mx-z) { border-color: color-mix(in srgb, var(--fg) 30%, var(--line-2)); }
html body :is(#gs, .app) #view-inbox .mx-pill > svg:is(#gs,*):not(#mx-z) { position: absolute; width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
html body :is(#gs, .app) #view-inbox .mx-pill > svg.mx-ico:is(#gs,*):not(#mx-z) { left: 11px; }
html body :is(#gs, .app) #view-inbox .mx-pill > svg.mx-chev:is(#gs,*):not(#mx-z) { right: 10px; width: 11px; height: 11px; opacity: .7; }
html body :is(#gs, .app) #view-inbox .mx-pill > select:is(#gs,*):not(#mx-z) { appearance: none; -webkit-appearance: none; height: 28px !important; min-height: 28px !important; max-width: none !important; width: auto; field-sizing: content; padding: 0 28px 0 0 !important; border: 0 !important; border-radius: 999px !important; background: transparent !important; box-shadow: none !important; color: inherit !important; font: 600 12.5px/28px var(--font-body, Inter, sans-serif) !important; cursor: pointer; }
html body :is(#gs, .app) #view-inbox .mx-pill > select:focus-visible:is(#gs,*):not(#mx-z) { outline: none; }
html body :is(#gs, .app) #view-inbox .mx-pill:focus-within:is(#gs,*):not(#mx-z) { outline: 2px solid var(--acc, var(--accent)); outline-offset: 1px; }
html body :is(#gs, .app) #view-inbox .mx-pill > select option:is(#gs,*):not(#mx-z) { color: var(--fg); background: var(--surface); }
/* couleurs d'état : à répondre (ambre), nouveau (accent), en cours (bleu), traité (vert) ; priorité haute / urgente */
html body :is(#gs, .app) #view-inbox .mx-pill[data-k="st"][data-v="wait"]:is(#gs,*):not(#mx-z) { color: var(--warn, #e0ae62); border-color: color-mix(in srgb, var(--warn, #e0ae62) 45%, var(--line)); background: color-mix(in srgb, var(--warn, #e0ae62) 10%, var(--surface-2)); }
html body :is(#gs, .app) #view-inbox .mx-pill[data-k="st"][data-v="new"]:is(#gs,*):not(#mx-z) { color: var(--acc-text, var(--acc, var(--accent))); border-color: color-mix(in srgb, var(--acc, var(--accent)) 45%, var(--line)); }
html body :is(#gs, .app) #view-inbox .mx-pill[data-k="st"][data-v="open"]:is(#gs,*):not(#mx-z) { color: var(--c4t, var(--c4, #6ea0ff)); border-color: color-mix(in srgb, var(--c4, #6ea0ff) 40%, var(--line)); }
html body :is(#gs, .app) #view-inbox .mx-pill[data-k="st"][data-v="done"]:is(#gs,*):not(#mx-z) { color: var(--ok, #6fcb98); border-color: color-mix(in srgb, var(--ok, #6fcb98) 40%, var(--line)); }
html body :is(#gs, .app) #view-inbox .mx-pill[data-k="prio"][data-v="1"]:is(#gs,*):not(#mx-z) { color: var(--warn, #e0ae62); border-color: color-mix(in srgb, var(--warn, #e0ae62) 45%, var(--line)); }
html body :is(#gs, .app) #view-inbox .mx-pill[data-k="prio"][data-v="2"]:is(#gs,*):not(#mx-z) { color: var(--danger, #f08a78); border-color: color-mix(in srgb, var(--danger, #f08a78) 50%, var(--line)); background: color-mix(in srgb, var(--danger, #f08a78) 9%, var(--surface-2)); }
html body :is(#gs, .app) #view-inbox .mx-pill[data-k="assign"][data-v="none"]:is(#gs,*):not(#mx-z) { color: var(--muted); }
html[data-theme="light"] body :is(#gs, .app) #view-inbox .mx-pill[data-k="st"][data-v="wait"]:is(#gs,*):not(#mx-z), html[data-theme="light"] body :is(#gs, .app) #view-inbox .mx-pill[data-k="prio"][data-v="1"]:is(#gs,*):not(#mx-z) { color: #8a5a10; }
html[data-theme="light"] body :is(#gs, .app) #view-inbox .mx-pill[data-k="st"][data-v="open"]:is(#gs,*):not(#mx-z) { color: #2559c4; }
html[data-theme="light"] body :is(#gs, .app) #view-inbox .mx-pill[data-k="st"][data-v="done"]:is(#gs,*):not(#mx-z) { color: #137a52; }
html[data-theme="light"] body :is(#gs, .app) #view-inbox .mx-pill[data-k="prio"][data-v="2"]:is(#gs,*):not(#mx-z) { color: #b3261e; }

/* ---------- fil de la conversation : séparateurs de jour en pastille, mentions discrètes ---------- */
html body :is(#gs, .app) #view-inbox :is(.mt-day, .mb-day, .msg-day):is(#gs,*):not(#mx-z) { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11.5px; font-weight: 600; }
html body :is(#gs, .app) #view-inbox :is(.mt-day, .mb-day, .msg-day):is(#gs,*):not(#mx-z)::before, html body :is(#gs, .app) #view-inbox :is(.mt-day, .mb-day, .msg-day):is(#gs,*):not(#mx-z)::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- zone d'écriture : un seul bloc net, outils alignés, variables en pastilles ---------- */
html body :is(#gs, .app) #view-inbox .mc-box:is(#gs,*):not(#mx-z) { border: 1px solid var(--line-2) !important; border-radius: 16px !important; background: var(--surface) !important; transition: border-color .2s, box-shadow .2s; }
html body :is(#gs, .app) #view-inbox .mc-box:focus-within:is(#gs,*):not(#mx-z) { border-color: color-mix(in srgb, var(--acc, var(--accent)) 55%, var(--line-2)) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc, var(--accent)) 14%, transparent); }
html body :is(#gs, .app) #view-inbox .mc-box textarea:is(#gs,*):not(#mx-z) { border: 0 !important; background: transparent !important; box-shadow: none !important; }
html body :is(#gs, .app) #view-inbox .mc-box :is(.mc-var, [data-var], .lib-chip):is(#gs,*):not(#mx-z) { height: 26px; padding: 0 9px; border: 1px solid var(--line) !important; border-radius: 999px !important; background: var(--surface-2) !important; color: var(--fg-2, var(--fg)) !important; font: 600 11.5px/24px var(--font-mono, ui-monospace, monospace) !important; }

/* ---------- fiche du fan ---------- */
/* chiffres : trois tuiles aérées avec une icône ronde teintée (dépensé, PPV, pourboires) */
html body :is(#gs, .app) #view-inbox .fp-tiles:is(#gs,*):not(#mx-z), html body :is(#gs, .app) .fp-modal .fp-tiles:is(#gs,*):not(#mx-z) { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 8px !important; margin: 4px 0 0 !important; padding: 0 14px !important; border: 0 !important; background: none !important; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-tiles > div:is(#gs,*):not(#mx-z) { display: grid !important; grid-template-columns: minmax(0, 1fr) !important; grid-template-areas: "ico" "val" "lab"; justify-items: start; align-items: center; gap: 2px !important; min-width: 0; padding: 10px 10px 9px !important; border: 1px solid var(--line) !important; border-left: 1px solid var(--line) !important; border-radius: 12px !important; background: var(--surface) !important; text-align: left !important; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-tiles > div > .fp-ti:is(#gs,*):not(#mx-z) { grid-area: ico; display: grid; place-items: center; width: 24px; height: 24px; margin-bottom: 4px; border-radius: 50%; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 26%, transparent); }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-tiles > div > .fp-ti svg:is(#gs,*):not(#mx-z) { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-tiles > div > b:is(#gs,*):not(#mx-z) { grid-area: val; max-width: 100%; font: 700 15px/1.2 var(--font-display, "Hanken Grotesk", sans-serif) !important; font-variant-numeric: tabular-nums; color: var(--fg) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-tiles > div > small:is(#gs,*):not(#mx-z) { grid-area: lab; font-size: 11.5px !important; color: var(--muted) !important; text-transform: none !important; letter-spacing: 0 !important; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-lastbuy:is(#gs,*):not(#mx-z) { margin: 8px 14px 0 !important; text-align: left !important; font-size: 12px !important; color: var(--muted) !important; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-ideas:is(#gs,*):not(#mx-z) { display: flex !important; align-items: center; justify-content: center; gap: 6px; height: 36px; margin: 10px 14px 2px !important; padding: 0 12px !important; border: 1px solid color-mix(in srgb, var(--acc, var(--accent)) 40%, var(--line)) !important; border-radius: 10px !important; background: color-mix(in srgb, var(--acc, var(--accent)) 8%, var(--surface)) !important; color: var(--fg) !important; font-weight: 650 !important; }
/* onglets de la fiche : le style des onglets de page (soulignement à la couleur d'accent) */
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-tabs:is(#gs,*):not(#mx-z) { display: flex !important; gap: 2px !important; margin: 12px 14px 4px !important; padding: 0 !important; border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: 0 !important; background: none !important; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-tabs > button:is(#gs,*):not(#mx-z) { position: relative; flex: 1 1 auto; height: 34px; padding: 0 8px !important; border: 0 !important; border-radius: 8px 8px 0 0 !important; background: none !important; color: var(--muted) !important; font: 600 12.5px/1 var(--font-body, Inter, sans-serif) !important; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-tabs > button:hover:is(#gs,*):not(#mx-z) { color: var(--fg) !important; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-tabs > button[aria-selected="true"]:is(#gs,*):not(#mx-z) { color: var(--fg) !important; background: none !important; box-shadow: inset 0 -2px 0 var(--acc, var(--accent)) !important; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-tabs > button[aria-selected="true"]:is(#gs,*):not(#mx-z)::after { content: "" !important; display: block !important; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--acc, var(--accent)); }
/* sections de la fiche : la même carte partout (même largeur, même titre) */
html body :is(#gs, .app) #view-inbox .msg-fan :is(.fp-sec, .fp-note):is(#gs,*):not(#mx-z) { margin: 10px 14px !important; padding: 12px 14px !important; border: 1px solid var(--line) !important; border-radius: 12px !important; background: var(--surface) !important; box-shadow: none !important; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) :is(.fp-sec h4, .fp-note > header):is(#gs,*):not(#mx-z) { display: flex; align-items: center; gap: 8px; margin: 0 0 8px !important; font: 650 13px/1.3 var(--font-body, Inter, sans-serif) !important; letter-spacing: 0 !important; text-transform: none !important; color: var(--fg) !important; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-sec h4 .fp-link:is(#gs,*):not(#mx-z) { margin-left: auto; font-size: 12px; font-weight: 600; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-sec h4 > small:is(#gs,*):not(#mx-z) { margin-left: auto; font-weight: 500; color: var(--muted); }
/* note interne : garde son rôle de post-it (trait ambre à gauche, épingle), mais dans la DA (plus de titre orange isolé) */
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-note:is(#gs,*):not(#mx-z) { border-left: 3px solid color-mix(in srgb, var(--warn, #e0ae62) 70%, var(--line)) !important; background: color-mix(in srgb, var(--warn, #e0ae62) 5%, var(--surface)) !important; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-note > header:is(#gs,*):not(#mx-z)::before { content: ""; width: 14px; height: 14px; flex: none; background: var(--warn, #e0ae62); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17v5M9 3h6l-1 6 3 3v2H7v-2l3-3z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17v5M9 3h6l-1 6 3 3v2H7v-2l3-3z'/%3E%3C/svg%3E") center / contain no-repeat; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-note .fp-addnote:is(#gs,*):not(#mx-z) { display: flex; gap: 6px; margin-top: 8px; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-note .fp-addnote input:is(#gs,*):not(#mx-z) { flex: 1; min-width: 0; height: 34px; }
/* résumé IA : une petite étincelle devant le titre */
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-aisum h4:is(#gs,*):not(#mx-z)::before { content: ""; width: 14px; height: 14px; flex: none; background: var(--acc, var(--accent)); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3c.6 4.6 2.4 6.4 7 7-4.6.6-6.4 2.4-7 7-.6-4.6-2.4-6.4-7-7 4.6-.6 6.4-2.4 7-7z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3c.6 4.6 2.4 6.4 7 7-4.6.6-6.4 2.4-7 7-.6-4.6-2.4-6.4-7-7 4.6-.6 6.4-2.4 7-7z'/%3E%3C/svg%3E") center / contain no-repeat; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-kv:is(#gs,*):not(#mx-z) { padding: 7px 0 !important; border-bottom: 1px solid var(--line) !important; font-size: 12.5px; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-kv:last-child:is(#gs,*):not(#mx-z) { border-bottom: 0 !important; }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-kv > span:is(#gs,*):not(#mx-z) { color: var(--muted); }
html body :is(#gs, .app) :is(#view-inbox, .fp-modal) .fp-none:is(#gs,*):not(#mx-z) { color: var(--muted); font-size: 12.5px; }

/* ---------- téléphone ---------- */
@media (max-width: 760px) {
  html body :is(#gs, .app) #view-inbox .mx-chipbar:is(#gs,*):not(#mx-z) { padding: 0 12px 8px; }
  html body :is(#gs, .app) #view-inbox .mx-pop:is(#gs,*):not(#mx-z) { right: 12px; left: auto; max-width: calc(100vw - 24px); }
  html body :is(#gs, .app) #view-inbox .mx-pill:is(#gs,*):not(#mx-z) { height: 32px; }
  html body :is(#gs, .app) #view-inbox .fp-tiles:is(#gs,*):not(#mx-z) { padding: 0 12px !important; }
}

/* =====================================================================================================================
   Éditeur de scripts (« Modifier le script » / « Nouveau script ») : plus large, en-tête et pied fixes, étapes en cartes
   numérotées le long d'un fil, message confortable, médias en lignes claires. Aucune fonction retirée.
   ===================================================================================================================== */
html body .lb-modal:has(.lb-sform) > .co-card.lb-sform, html body .lb-modal .co-card.lb-sform { width: min(980px, calc(100vw - 32px)) !important; max-width: none !important; max-height: calc(100vh - 48px) !important; display: flex !important; flex-direction: column; padding: 0 !important; overflow: hidden !important; border-radius: 16px !important; }
html body .lb-modal .lb-sform > :is(h2, p.muted, .cp-row, .lb-vars, .lb-steps-ed, .lb-mfoot, button[type="submit"]) { margin-left: 0; margin-right: 0; }
html body .lb-modal .lb-sform > h2 { flex: none; margin: 0 !important; padding: 20px 56px 4px 24px !important; font: 700 21px/1.2 var(--font-display, "Hanken Grotesk", sans-serif) !important; }
html body .lb-modal .lb-sform > .co-x { position: absolute; top: 14px; right: 14px; z-index: 2; }
html body .lb-modal .lb-sform > p.muted { flex: none; margin: 0 !important; padding: 0 24px 12px !important; max-width: none; font-size: 12.5px !important; line-height: 1.5; border-bottom: 1px solid var(--line); }
/* le corps défile ; titre, variables et pied restent visibles */
html body .lb-modal .lb-sform > .cp-row { flex: none; display: grid !important; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; padding: 14px 24px 6px !important; }
html body .lb-modal .lb-sform > .lb-vars { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 24px 12px !important; border-bottom: 1px solid var(--line); }
html body .lb-modal .lb-sform > .lb-vars > .mx-vlab { margin-right: 4px; color: var(--muted); font-size: 12px; }
html body .lb-modal .lb-sform > .lb-vars .lib-chip { height: 26px; padding: 0 10px !important; border-radius: 999px !important; font: 600 12px/24px var(--font-mono, ui-monospace, monospace) !important; }
html body .lb-modal .lb-sform > .lb-steps-ed { flex: 1 1 auto; min-height: 120px; overflow-y: auto; padding: 18px 24px 8px 24px !important; counter-reset: lbstep; }
/* une étape = une carte numérotée, reliée aux autres par un fil vertical */
html body .lb-modal .lb-sform .lb-step { position: relative; margin: 0 0 16px 36px !important; padding: 14px 16px 16px !important; border: 1px solid var(--line) !important; border-radius: 14px !important; background: var(--surface) !important; min-width: 0; }
html body .lb-modal .lb-sform .lb-step::before { content: ""; position: absolute; left: -23px; top: 34px; bottom: -18px; width: 2px; border-radius: 2px; background: var(--line); }
html body .lb-modal .lb-sform .lb-step:last-child::before { display: none; }
html body .lb-modal .lb-sform .lb-step > legend { position: absolute; left: -36px; top: 12px; display: grid; place-items: center; width: 28px; height: 28px; margin: 0; padding: 0 !important; border-radius: 50%; background: var(--acc-fill, var(--acc, var(--accent))); color: var(--acc-ink, #0d0d0c); font: 0/0 a; }
html body .lb-modal .lb-sform .lb-step > legend .lb-sn-n { font: 800 12.5px/1 var(--font-display, "Hanken Grotesk", sans-serif); color: inherit; }
html body .lb-modal .lb-sform .lb-step > .lb-step-del { position: absolute; top: 10px; right: 10px; }
html body .lb-modal .lb-sform .lb-step > .cp-row { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 220px); gap: 12px; margin: 0 36px 10px 0 !important; }
html body .lb-modal .lb-sform .lb-step label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--fg-2, var(--fg)); }
html body .lb-modal .lb-sform .lb-step textarea[data-s="text"] { min-height: 112px; padding: 12px 14px !important; border-radius: 12px !important; font-size: 14px !important; line-height: 1.5 !important; resize: vertical; }
html body .lb-modal .lb-sform .lb-step input[data-s="note"] { height: 36px; }
/* les médias de l'étape : un bloc net par message, une ligne claire par média */
html body .lb-modal .lb-sform .lb-step .lb-set { margin: 12px 0 10px; padding: 12px; border: 1px dashed var(--line-2); border-radius: 12px; background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
html body .lb-modal .lb-sform .vs-sum { margin: 0 0 8px; color: var(--fg-2, var(--fg)); font-size: 12.5px; font-weight: 600; }
html body .lb-modal .lb-sform .vs-msg { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
html body .lb-modal .lb-sform .vs-mh { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
html body .lb-modal .lb-sform .vs-mh > b { font-size: 13px; }
html body .lb-modal .lb-sform .vs-mp { color: var(--muted); font-size: 12px; }
html body .lb-modal .lb-sform .vs-cards { gap: 8px !important; }
html body .lb-modal .lb-sform .vs-card { grid-template-columns: 56px minmax(0, 1fr) auto auto auto auto !important; gap: 10px !important; padding: 8px 10px !important; border-radius: 12px !important; border: 1px solid var(--line) !important; border-left-width: 3px !important; background: var(--surface) !important; }
html body .lb-modal .lb-sform .vs-th { width: 56px !important; height: 56px !important; border-radius: 10px !important; }
html body .lb-modal .lb-sform .vs-badge { height: 26px; padding: 0 10px !important; border-radius: 999px !important; font: 700 11px/24px var(--font-body, Inter, sans-serif) !important; letter-spacing: .02em; }
html body .lb-modal .lb-sform .vs-card.paid .vs-badge { color: var(--acc-text, var(--acc, var(--accent))) !important; border-color: color-mix(in srgb, var(--acc, var(--accent)) 50%, var(--line)) !important; background: color-mix(in srgb, var(--acc, var(--accent)) 12%, transparent) !important; }
html body .lb-modal .lb-sform .vs-price input { width: 84px !important; height: 34px; font: 700 15px/1 var(--font-display, "Hanken Grotesk", sans-serif) !important; text-align: right; }
html body .lb-modal .lb-sform .vs-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
/* pied fixe : ajouter une étape, flouter, enregistrer — toujours visibles */
html body .lb-modal .lb-sform > .lb-mfoot { flex: none; display: flex !important; align-items: center; gap: 12px; padding: 12px 24px !important; border-top: 1px solid var(--line); background: var(--surface); }
html body .lb-modal .lb-sform > .lb-mfoot > .mx-save { width: auto !important; margin: 0 0 0 auto !important; min-width: 210px; height: 40px; }
html body .lb-modal .lb-sform > .lb-mfoot > .lb-blur { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
@media (max-width: 760px) {
  html body .lb-modal .co-card.lb-sform { width: 100vw !important; max-height: 100dvh !important; height: 100dvh; border-radius: 0 !important; }
  html body .lb-modal .lb-sform > :is(h2) { padding: 16px 52px 4px 16px !important; font-size: 19px !important; }
  html body .lb-modal .lb-sform > :is(p.muted, .cp-row, .lb-vars, .lb-steps-ed) { padding-left: 16px !important; padding-right: 16px !important; }
  html body .lb-modal .lb-sform > .cp-row { grid-template-columns: minmax(0, 1fr) !important; }
  html body .lb-modal .lb-sform .lb-step > .cp-row { grid-template-columns: minmax(0, 1fr) !important; margin-right: 30px !important; }
  /* (28/11/2026) téléphone : toute la feuille défile d'un bloc (description, titre, variables, étapes) ; seuls le titre
     « Modifier le script » avec × et le pied (Ajouter une étape, Flouter, Enregistrer) restent collés — la place va aux étapes */
  html body .lb-modal:has(.lb-sform) > .co-card.lb-sform:not(#mx-z), html body .lb-modal .co-card.lb-sform:not(#mx-z) { display: block !important; overflow-y: auto !important; overscroll-behavior: contain; }
  html body .lb-modal .lb-sform > .co-x:not(#mx-z) { position: sticky !important; top: 10px; float: right; z-index: 4; margin: 10px 10px 0 0; }
  html body .lb-modal .lb-sform > h2:not(#mx-z) { position: sticky; top: 0; z-index: 3; background: var(--surface); }
  html body .lb-modal .lb-sform > .lb-steps-ed:not(#mx-z) { overflow: visible; min-height: 0; max-height: none; } /* (app.css la limite à 52vh) */
  html body .lb-modal .lb-sform > .lb-mfoot:not(#mx-z) { position: sticky; bottom: 0; z-index: 3; }
  html body .lb-modal .lb-sform .lb-step { margin-left: 30px !important; padding: 12px !important; }
  html body .lb-modal .lb-sform .lb-step > legend { left: -30px; width: 24px; height: 24px; }
  html body .lb-modal .lb-sform .lb-step::before { left: -19px; }
  html body .lb-modal .lb-sform .vs-card { grid-template-columns: 48px minmax(0, 1fr) auto !important; }
  html body .lb-modal .lb-sform .vs-th { width: 48px !important; height: 48px !important; }
  html body .lb-modal .lb-sform > .lb-mfoot { padding: 10px 16px !important; flex-wrap: wrap; }
  html body .lb-modal .lb-sform > .lb-mfoot { padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important; }
  html body .lb-modal .lb-sform > .lb-mfoot > .mx-save { flex: 1 1 100%; margin: 0 !important; min-width: 0; }
}
/* téléphone et écrans tactiles : « Plus » est une cible de 44 px comme les autres filtres */
@media (max-width: 760px), (pointer: coarse) {
  html body :is(#gs, .app) #view-inbox .mx-chipbar .mx-more:is(#gs,*):not(#mx-z) { height: 44px !important; min-height: 44px !important; }
  html body :is(#gs, .app) #view-inbox .mx-pop > button:is(#gs,*):not(#mx-z) { height: 44px; }
}
