/**
 * Sensei Conversation — chat mockup styles.
 *
 * Every skin is expressed as custom properties on the conversation wrapper and consumed by
 * single-class rules. Divi writes the user's own design settings against the module order class,
 * which always wins on specificity, so any skin default can be overridden from the module settings.
 *
 * Layout uses logical properties throughout so RTL mirrors without a single `[dir]` override.
 *
 * One thing is deliberately not here: the conversation paints no background of its own. It sits
 * inside the module's padding, so a colour on it stops at the padding edge and leaves a band of the
 * module's own background around it — which is exactly what a chat surface must not do. The skins
 * that want a coloured surface seed `module.decoration.background` instead (see
 * `visual-builder/callbacks/on-skin-change.ts`), which paints the whole module box, padding
 * included, and is the same field Content > Background offers the user.
 */

.ds-conversation {
    --ds-conv-max-width: 80%;

    /**
     * How narrow a text bubble is allowed to get. A bubble hugs its text, which for "Ok" or a single
     * emoji is a sliver barely wider than its own corner radius — real chat apps keep a floor under
     * it so a short reply still reads as a bubble. A skin that wants more room under a rounder corner
     * can restate it the way it restates every other value here.
     */
    --ds-conv-min-width: 56px;
    --ds-conv-gap: 8px;

    /* A run from the same sender stays tight whatever the message spacing — that closeness is what
       makes a run read as one burst — but never looser than the spacing itself, so Design > Message
       List > Message Spacing below 5px tightens runs too, down to nothing at 0. */
    --ds-conv-group-gap: min(5px, var(--ds-conv-gap));
    --ds-conv-avatar-size: 34px;
    --ds-conv-avatar-radius: 50%;

    /**
     * How far the typing indicator is set in from the edge: the skin's avatar column. Resolved here,
     * on the wrapper, so it is fixed at the skin's size — a message that resizes its own avatar
     * redeclares `--ds-conv-avatar-size` on itself, and would otherwise drag the indicator of that
     * one message sideways with it.
     */
    --ds-conv-typing-indent: calc(var(--ds-conv-avatar-size) + 8px);

    /* The letter that stands in when a message has no avatar picture. Each skin restates these,
       which is what makes the fallback follow the chat style out of the box. */
    --ds-conv-initial-bg: #8c8c93;
    --ds-conv-initial-color: #ffffff;
    --ds-conv-initial-size: 14px;
    --ds-conv-initial-weight: 600;
    --ds-conv-media-size: 89px;
    --ds-conv-radius: 18px;
    --ds-conv-radius-tight: 6px;
    --ds-conv-pad-block: 8px;
    --ds-conv-pad-inline: 13px;
    --ds-conv-font-size: 15px;
    --ds-conv-line-height: 1.45;
    --ds-conv-in-bg: #ececee;
    --ds-conv-in-color: #1b1b1f;
    --ds-conv-out-bg: #d8dce1;
    --ds-conv-out-color: #1b1b1f;
    --ds-conv-bubble-shadow: none;
    --ds-conv-bubble-border: 0 solid transparent;
    --ds-conv-sender-color: rgba(0, 0, 0, 0.62);
    --ds-conv-sender-size: 12px;
    --ds-conv-meta-color: rgba(0, 0, 0, 0.45);
    --ds-conv-meta-size: 11px;
    --ds-conv-status-color: rgba(0, 0, 0, 0.4);
    --ds-conv-status-read-color: #3b9cf0;
    --ds-conv-reaction-bg: #ffffff;
    --ds-conv-reaction-border: rgba(0, 0, 0, 0.08);
    --ds-conv-reaction-size: 13px;

    /**
     * How tall the reaction chip comes out: its line box, plus a pixel of padding and a pixel of
     * border on each side. Derived rather than measured, because it has to be known before the chip
     * is laid out — the chip is taken out of flow, so the space it hangs in has to be reserved for
     * it by the row above. Kept in step with the `line-height` and the padding in
     * `.ds-conversation-message__reactions`.
     */
    --ds-conv-reaction-height: calc(var(--ds-conv-reaction-size) * 1.5 + 4px);
    --ds-conv-tail-size: 7px;

    /* How far a message rises into place. Read by the keyframes and by the room the list keeps. */
    --ds-conv-rise: 14px;

    /* How far it carries past its resting place before settling — the "pop". */
    --ds-conv-pop: 5px;

    /**
     * A Height set in the Design tab gives the module box a definite size, which is what this
     * percentage resolves against — the conversation then hands that height down to the list, which
     * scrolls. With no height set it resolves to `auto` and the whole arrangement collapses back to
     * a plain column that grows with its messages, so nothing scrolls that does not have to.
     */
    display: flex;
    flex-direction: column;
    block-size: 100%;
}

.ds-conversation__list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--ds-conv-gap);

    /**
     * `flex-grow: 0` with `margin-block-start: auto` is what pins the messages to the bottom, and it
     * has to be the list itself rather than anything inside it. An `auto` margin on the first child
     * lives *inside* the scroll container, where it counts towards scroll height: a conversation of
     * two messages reported 14px more scrollHeight than clientHeight and showed a scrollbar with
     * nothing to scroll. Out here the margin is laid out by the conversation, not the scroller, so a
     * list that fits reports no overflow at all.
     *
     * `min-block-size: 0` is what allows a flex item to shrink below its content; without it the
     * list keeps its full height and spills past the module instead of scrolling.
     */
    flex: 0 1 auto;
    min-block-size: 0;
    margin-block-start: auto;
    overflow-y: auto;

    /**
     * Scrolls, but shows no scrollbar. A chat surface is a piece of artwork on the page rather than
     * a pane of the interface, and a system scrollbar down the side of a phone mockup gives that
     * away immediately. The list still scrolls by wheel, drag, touch, keyboard and by the player
     * following the message it is revealing — only the indicator is gone.
     *
     * Two declarations because the standard property and the WebKit pseudo-element are answers to
     * the same question from different eras; a browser that understands neither simply keeps its
     * scrollbar, which is a visible default rather than a broken one.
     */
    scrollbar-width: none;

    /**
     * Bubble tails are drawn a few pixels outside the list box. Scrolling one axis promotes the
     * other from `visible` to `auto`, so an outgoing tail would raise a horizontal scrollbar and an
     * incoming one would be sliced off. Reserving the tail width as padding brings both back inside
     * the scroll container, and the matching negative margin cancels that padding again so every
     * bubble sits exactly where it did before.
     */
    padding-inline: var(--ds-conv-tail-size);
    margin-inline: calc(var(--ds-conv-tail-size) * -1);
}

.ds-conversation__list::-webkit-scrollbar {
    display: none;
}

/**
 * Divi puts a bottom margin on every module in a column — 2.75% of the row's width, so the wider the
 * row the bigger it gets — and the messages are modules. Here the spacing between messages is the
 * list's own gap (Design > Message List > Message Spacing), so that margin comes off.
 *
 * `!important` because one version of Divi's rule (inside a Theme Builder layout) carries an ID the
 * selector cannot outweigh; `:where()` keeps the selector itself as light as possible, so a margin
 * set in a message's own Design > Spacing — also written with `!important`, against its order
 * class — still wins.
 */
:where(.ds-conversation__list) > .ds-conversation-message {
    margin-block-end: 0 !important;
}

/**
 * Nothing in the list shrinks to fit it — the list scrolls instead.
 *
 * A flex column with a constrained height squashes its items to make room, and a squashed message
 * keeps drawing its bubble at full height because its own overflow is visible. The result is
 * messages painted on top of each other rather than a scrollbar. Applied to every child so anything
 * the user drops between the messages is safe too.
 */
.ds-conversation__list > * {
    flex: 0 0 auto;
}

/**
 * The module takes the full width of its column, for every style that is not a phone.
 *
 * A Divi 5 column lays its modules out with flex, where a module with no width of its own is only
 * as wide as its content — and while the conversation plays in, the messages that have not landed
 * yet take up no room. The module started narrow and widened as each message arrived. The phone
 * frame asks for the full width itself (see `:has(> .ds-conversation-device)`); this does the same
 * for the chat panel and the plain conversation.
 *
 * `:where()` keeps it a default at no specificity at all, so a Width or Max Width from
 * Design > Sizing replaces it.
 */
:where(:has(> .ds-conversation-panel), :has(> .ds-conversation)) {
    inline-size: 100%;
}

/* -------------------------------------------------------------------------- */
/* Phone mockup — what the iOS, Material and Green Messenger styles look like  */
/* -------------------------------------------------------------------------- */

/**
 * The mockup is chrome only: a status bar, a title bar and a dead input row around the real
 * conversation. Everything is expressed as custom properties so the two platforms share one set of
 * rules and differ only in the values further down.
 *
 * The frame wraps `.ds-conversation` rather than living inside it, so none of the skin variables
 * or design settings on the conversation itself are disturbed by it.
 *
 * The values below are the iOS ones; the Material block at the end of this section overrides the
 * handful that differ. Only these two chat styles draw a frame at all.
 *
 * Border, corner radius and box shadow are deliberately absent here: `on-skin-change.ts` seeds them
 * onto the module's own Design > Border / Box Shadow fields instead (`border-radius` below just
 * `inherit`s the result), the same fields every other chat style already uses for its card. That
 * keeps them editable in the Design panel instead of fixed in this file — the one thing still fixed
 * here is which two chat styles get a frame at all.
 */

/**
 * That border/shadow paints on the module box the frame sits inside, not the frame itself — and a
 * column can be wider than a phone, which would draw the outline around the full column width while
 * a narrower, centred phone sat inside it. The frame fills this box and this box is what is capped
 * and centred, so the outline is always flush against the frame.
 *
 * The 420px here is a fallback only: picking a phone style seeds the same number as the module's own
 * Max Width, which is written against the module order class and outranks this rule, so the user can
 * raise it and the frame grows with it. This keeps a module that somehow has no Max Width — one saved
 * before that seed existed, or one the user cleared — from stretching to a full-column phone.
 *
 * The module box is also the frame's layout context, and it is a flex column for one reason: it is
 * the only way to hand the frame a module Height without a percentage. A `block-size: 100%` on the
 * frame is a percentage against this box, and a percentage that resolves against a box sized by its
 * own contents comes back as the contents' height — a definite height, which beats `aspect-ratio`
 * outright. That is what kept the phone growing with each message that played in and shrinking back
 * while the conversation was empty. As a flex item the frame needs no percentage at all: with no
 * Height set there is no free space to take, so the ratio sizes it; with a Height set this box is
 * definite and `flex-grow` fills it.
 *
 * `<style>` and `<noscript>` are the only other children here and both are `display: none`, so they
 * generate no flex items and the frame is laid out alone.
 *
 * `inline-size: 100%` is the width half of the same care. A ratio can only work out a height from a
 * width it can actually measure, and a box left to shrink to fit takes its width from its contents —
 * which would put the widest message bubble back in charge of how big the phone is, empty chat
 * narrow and short, first message wider and taller. Asking for the full width of whatever this sits
 * in gives the ratio a number that has nothing to do with the messages, in every layout Divi might
 * drop the module into.
 */
:has(> .ds-conversation-device) {
    display: flex;
    flex-direction: column;
    inline-size: 100%;
    max-inline-size: 420px;
    margin-inline: auto;

    /**
     * The module clips the frame, rather than the frame rounding itself. A box's own clip follows
     * the inner edge of its border — the outer radius less the border width — so the bars meet the
     * module's rounded edge exactly, whatever Border width and radius are set. A frame that took the
     * module's radius for its own was rounder than that inner edge by the border width, and left a
     * sliver of the module's background showing in each corner.
     */
    overflow: hidden;
}

.ds-conversation-device {
    --ds-device-line: rgba(0, 0, 0, 0.09);
    --ds-device-ink: #111114;
    --ds-device-muted: #8a8f98;
    --ds-device-accent: #007aff;
    --ds-device-control-bg: #eceff3;
    --ds-device-pad: 16px;

    display: flex;
    flex-direction: column;
    /**
     * The frame takes the module box's width rather than capping itself: how wide the phone is, and
     * therefore how tall, is the module's own Max Width, seeded at 420px when a phone style is picked
     * (see `PHONE_WIDTH` in `visual-builder/callbacks/on-skin-change.ts`) and editable from
     * Design > Sizing like any other. The 420px on the module box above is only a fallback for a
     * module that has no Max Width of its own — a Divi module's own rules outrank it, so raising Max
     * Width still grows the phone.
     */
    inline-size: 100%;
    /**
     * A real phone screen is portrait, so the frame defaults to one instead of whatever height it
     * happens to inherit. Nothing inside it is allowed a say in that: `flex-basis: auto` with no
     * `block-size` leaves the ratio to size the frame off its own (capped) width, and
     * `min-block-size: 0` keeps the automatic minimum of a flex item — which is the height of its
     * contents — from pushing past the ratio once the messages are in. The frame is therefore the
     * same box whether the conversation is empty, playing in or complete; the screen below shrinks to
     * fit it and the message list scrolls, exactly as it does when a Height is set on a frameless
     * chat style.
     *
     * `flex-grow` is what still lets a module Height (the user's own, from Design > Sizing) win: it
     * makes this box definite, and the frame takes the room it opens up. See the module box above.
     */
    aspect-ratio: 9 / 16;
    flex: 1 1 auto;
    min-block-size: 0;
    /* No screen colour of its own: the module's Content > Background is the phone's screen, seeded
       per platform in on-skin-change.ts, so it can be recoloured like any other chat style. */
    /* The corners are the module's: its Design > Border > Radius, seeded per platform in
       on-skin-change.ts, clips the frame (see the module box above). */
}

.ds-conversation-device__status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px var(--ds-device-pad) 6px;
    color: var(--ds-device-ink);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
}

.ds-conversation-device__status-icons {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--ds-device-ink);
}

.ds-conversation-device__status-icons svg {
    display: block;
    block-size: 11px;
    inline-size: auto;
    fill: currentColor;
}

/**
 * Title bar. The three-column grid is what centres the title against the whole bar rather than
 * against the space left over by the back control, which is how a real title bar reads.
 */
.ds-conversation-device__bar {
    display: grid;
    grid-template-columns: 28px 1fr 28px;
    align-items: center;
    padding: 8px var(--ds-device-pad) 12px;
    border-block-end: 1px solid var(--ds-device-line);
}

.ds-conversation-device__back {
    display: inline-flex;
    align-items: center;
    color: var(--ds-device-accent);
}

.ds-conversation-device__back svg {
    display: block;
    block-size: 16px;
    inline-size: auto;
}

.ds-conversation-device__title {
    grid-column: 2;
    text-align: center;
    color: var(--ds-device-ink);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

/**
 * The screen. It is the part of the frame that absorbs the difference between an empty conversation
 * and a full one: `flex: 1 1 auto` lets it take the room the chrome leaves and give it back again,
 * and `min-block-size: 0` is what allows the giving back — a floor here would be handed straight on
 * to the frame as a taller box the moment the messages outgrew it, which is the resizing the ratio
 * above exists to prevent. An empty screen still reads as a real one because the frame is sized by
 * its ratio rather than by what is in it, so there is nothing left to collapse.
 */
.ds-conversation-device__screen {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-block-size: 0;
    padding: 0 12px;
}

/**
 * Inside the frame the conversation is sized by flex layout, so the `block-size: 100%` it carries
 * for a frameless chat style is taken back off: it is another percentage against a box sized by its
 * contents, and it would put the messages' own height back into the chain the frame's ratio exists
 * to keep them out of.
 */
.ds-conversation-device__screen > .ds-conversation {
    flex: 1 1 auto;
    block-size: auto;
    min-block-size: 0;
}

/**
 * The screen's breathing room above and below the messages lives inside the scrolling list, not on
 * the screen around it. On the screen it was a band the list could not scroll into, so a long
 * conversation was cut off 14px short of the title bar and the compose bar instead of scrolling
 * under them.
 *
 * The bottom padding also takes over from the room the sequenced list reserves for the rise (see
 * `.ds-conversation--sequenced .ds-conversation__list`): it is at least as tall, so the rising
 * message still stays inside the scroll area, and dropping the negative margin keeps the list from
 * reaching down over the compose bar.
 */
.ds-conversation-device__screen .ds-conversation .ds-conversation__list {
    padding-block: 14px max(14px, var(--ds-conv-rise));
    margin-block-end: 0;
}

.ds-conversation-device__compose {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px var(--ds-device-pad) 16px;
    border-block-start: 1px solid var(--ds-device-line);
}

.ds-conversation-device__plus,
.ds-conversation-device__send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    inline-size: 30px;
    block-size: 30px;
    border-radius: 50%;
    background-color: var(--ds-device-control-bg);
    color: var(--ds-device-muted);
    font-size: 19px;
    line-height: 1;
}

.ds-conversation-device__send svg {
    display: block;
    block-size: 15px;
    inline-size: auto;
    fill: currentColor;
}

/* The dead input. A span rather than an input so nothing in the mockup is focusable or submittable. */
.ds-conversation-device__field {
    flex: 1 1 auto;
    min-inline-size: 0;
    padding: 8px 14px;
    border: 1px solid var(--ds-device-line);
    border-radius: 999px;
    color: var(--ds-device-muted);
    font-size: 14px;
    line-height: 1.4;
    /* A long placeholder truncates instead of wrapping the row onto two lines. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* -------------------------------------------------------------------------- */
/* Phone mockup — Material                                                     */
/* -------------------------------------------------------------------------- */

/**
 * Material differs in shape and weight rather than in structure: a tighter corner radius (seeded
 * onto the module's own Border > Radius by on-skin-change.ts, same as the iOS one), a left-aligned
 * title, a filled send button and no attachment control.
 */
.ds-conversation-device--android {
    --ds-device-accent: #1b1b1f;
    --ds-device-control-bg: #e8def8;
    --ds-device-pad: 14px;
}

.ds-conversation-device--android .ds-conversation-device__status {
    font-size: 13px;
    font-weight: 500;
}

.ds-conversation-device--android .ds-conversation-device__bar {
    grid-template-columns: 28px 1fr;
    gap: 10px;
    border-block-end: 0;
}

.ds-conversation-device--android .ds-conversation-device__title {
    grid-column: 2;
    text-align: start;
    font-size: 16px;
    font-weight: 500;
}

.ds-conversation-device--android .ds-conversation-device__compose {
    border-block-start: 0;
}

.ds-conversation-device--android .ds-conversation-device__field {
    background-color: #f3edf7;
    border-color: transparent;
}

.ds-conversation-device--android .ds-conversation-device__send {
    inline-size: 34px;
    block-size: 34px;
    color: #21005d;
}

/* -------------------------------------------------------------------------- */
/* Phone mockup — iOS and Material, Dark                                       */
/* -------------------------------------------------------------------------- */

/**
 * The same frame with its status bar, title bar and input row drawn for a dark screen. Only the
 * chrome changes: the screen is the module's Content > Background (seeded dark when the style is
 * picked), and the messages keep their own settings.
 *
 * Every fill and line here is white at some opacity rather than a solid dark grey, so the controls
 * are tinted by whatever screen colour is behind them — navy, brown or black alike — instead of
 * sitting on it as grey patches.
 */
.ds-conversation-device--dark {
    --ds-device-ink: #ffffff;
    --ds-device-muted: rgba(255, 255, 255, 0.6);
    --ds-device-line: rgba(255, 255, 255, 0.18);
    --ds-device-accent: #0a84ff;
    --ds-device-control-bg: rgba(255, 255, 255, 0.16);
}

/* iOS dark mode's own input row: an outlined, lightly filled field, so it still reads as a field. */
.ds-conversation-device--ios.ds-conversation-device--dark .ds-conversation-device__field {
    border-color: var(--ds-device-line);
    background-color: rgba(255, 255, 255, 0.08);
}

.ds-conversation-device--ios.ds-conversation-device--dark :is(.ds-conversation-device__plus, .ds-conversation-device__send) {
    color: rgba(255, 255, 255, 0.85);
}

.ds-conversation-device--android.ds-conversation-device--dark {
    --ds-device-accent: rgba(255, 255, 255, 0.9);
    --ds-device-muted: rgba(255, 255, 255, 0.7);
}

.ds-conversation-device--android.ds-conversation-device--dark .ds-conversation-device__field {
    background-color: rgba(255, 255, 255, 0.1);
}

.ds-conversation-device--android.ds-conversation-device--dark .ds-conversation-device__send {
    color: rgba(255, 255, 255, 0.9);
}

/* -------------------------------------------------------------------------- */
/* Phone mockup — Green Messenger                                              */
/* -------------------------------------------------------------------------- */

/**
 * The iOS frame, re-dressed: the chat wallpaper runs behind the bars as well as the messages, the
 * title bar names the contact (see `DeviceSkinTrait::device_contact()`) and its controls float as
 * white pills, and the input row carries the camera and a green microphone.
 */
.ds-conversation-device--whatsapp {
    --ds-device-ink: #0b141a;
    --ds-device-accent: #0b141a;
    --ds-device-muted: #54656f;
    --ds-device-control-bg: #ffffff;
    --ds-device-line: rgba(11, 20, 26, 0.08);
    --ds-device-bar-bg: #f6f5f3;
    --ds-device-green: #25d366;
}

.ds-conversation-device--whatsapp .ds-conversation-device__status,
.ds-conversation-device--whatsapp .ds-conversation-device__bar,
.ds-conversation-device--whatsapp .ds-conversation-device__compose {
    background-color: var(--ds-device-bar-bg);
}

.ds-conversation-device--whatsapp .ds-conversation-device__bar {
    grid-template-columns: 34px 34px minmax(0, 1fr) auto;
    gap: 10px;
    padding-block: 6px 10px;
    border-block-end: 1px solid var(--ds-device-line);
}

/* The back chevron and the call buttons sit on white pills, the way the app floats them. */
.ds-conversation-device--whatsapp .ds-conversation-device__back,
.ds-conversation-device--whatsapp .ds-conversation-device__actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    block-size: 34px;
    border-radius: 999px;
    background-color: var(--ds-device-control-bg);
    box-shadow: 0 1px 3px rgba(11, 20, 26, 0.12);
}

.ds-conversation-device--whatsapp .ds-conversation-device__back svg {
    block-size: 14px;
}

.ds-conversation-device--whatsapp .ds-conversation-device__actions {
    gap: 16px;
    padding-inline: 12px;
    color: var(--ds-device-ink);
}

.ds-conversation-device--whatsapp .ds-conversation-device__actions svg {
    display: block;
    inline-size: 19px;
    block-size: 19px;
}

.ds-conversation-device__avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    inline-size: 34px;
    block-size: 34px;
    border-radius: 50%;
    background-color: #c9d4cc;
    color: #3b4a54;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
}

.ds-conversation-device__avatar img {
    display: block;
    inline-size: 100%;
    block-size: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.ds-conversation-device--whatsapp .ds-conversation-device__title {
    grid-column: auto;
    overflow: hidden;
    font-size: 15px;
    text-align: start;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ds-conversation-device--whatsapp .ds-conversation-device__compose {
    gap: 10px;
    border-block-start: 0;
}

/* A bare plus, not the grey disc iOS draws. */
.ds-conversation-device--whatsapp .ds-conversation-device__plus {
    inline-size: auto;
    background-color: transparent;
    color: var(--ds-device-ink);
    font-size: 26px;
    font-weight: 300;
}

/* An empty white pill with the sticker icon at its far end, instead of placeholder text. */
.ds-conversation-device--whatsapp .ds-conversation-device__field {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-block-size: 34px;
    padding-block: 0;
    padding-inline-end: 10px;
    background-color: var(--ds-device-control-bg);
    color: var(--ds-device-muted);
}

.ds-conversation-device__sticker,
.ds-conversation-device__camera svg {
    display: block;
    inline-size: 20px;
    block-size: 20px;
}

.ds-conversation-device__camera {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--ds-device-ink);
}

.ds-conversation-device--whatsapp .ds-conversation-device__send {
    inline-size: 34px;
    block-size: 34px;
    background-color: var(--ds-device-green);
    color: #ffffff;
}

/* -------------------------------------------------------------------------- */
/* Phone mockup — Blue Messenger                                               */
/* -------------------------------------------------------------------------- */

/**
 * The iOS frame, re-dressed: a white-to-blue wash behind the status and title bars, the contact
 * with a presence dot and "Active now" in the title bar, blue call icons, and the input row's own
 * tools, "Aa" field and thumbs-up.
 */
.ds-conversation-device--messenger {
    --ds-device-ink: #050505;
    --ds-device-accent: #0866ff;
    --ds-device-muted: #65676b;
    --ds-device-control-bg: #f0f0f0;
    --ds-device-line: transparent;
}

/* One horizontal gradient on both bars, so the two read as one header. */
.ds-conversation-device--messenger .ds-conversation-device__status,
.ds-conversation-device--messenger .ds-conversation-device__bar {
    background-image: linear-gradient(90deg, #ffffff 40%, #d4e4ff 100%);
}

.ds-conversation-device--messenger .ds-conversation-device__bar {
    grid-template-columns: 16px 40px minmax(0, 1fr) auto;
    gap: 10px;
    padding-block: 6px 10px;
}

.ds-conversation-device--messenger .ds-conversation-device__avatar {
    inline-size: 40px;
    block-size: 40px;
}

/* Presence dot, ringed in white so it reads against the picture. */
.ds-conversation-device--messenger .ds-conversation-device__avatar::after {
    content: "";
    position: absolute;
    inset-block-end: -1px;
    inset-inline-end: -1px;
    inline-size: 11px;
    block-size: 11px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background-color: #31a24c;
}

.ds-conversation-device--messenger .ds-conversation-device__title {
    grid-column: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-inline-size: 0;
    text-align: start;
}

.ds-conversation-device__name {
    overflow: hidden;
    font-size: 16px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ds-conversation-device__subtitle {
    color: var(--ds-device-muted);
    font-size: 12px;
    font-weight: 400;
}

.ds-conversation-device--messenger .ds-conversation-device__actions {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    color: var(--ds-device-accent);
}

.ds-conversation-device--messenger .ds-conversation-device__actions svg {
    display: block;
    inline-size: 22px;
    block-size: 22px;
    fill: currentColor;
}

.ds-conversation-device--messenger .ds-conversation-device__compose {
    gap: 12px;
    padding-inline: 12px;
}

.ds-conversation-device__tools {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 12px;
    color: var(--ds-device-accent);
}

.ds-conversation-device__tools svg {
    display: block;
    inline-size: 22px;
    block-size: 22px;
    fill: currentColor;
}

/* A grey pill with "Aa" at the start and the emoji button at the end. */
.ds-conversation-device--messenger .ds-conversation-device__field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-block: 6px;
    padding-inline: 14px 8px;
    border-color: transparent;
    background-color: var(--ds-device-control-bg);
}

.ds-conversation-device__placeholder {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ds-conversation-device__emoji {
    display: block;
    flex: 0 0 auto;
    inline-size: 22px;
    block-size: 22px;
    fill: var(--ds-device-accent);
}

/* The thumbs-up stands on its own, with no disc behind it. */
.ds-conversation-device--messenger .ds-conversation-device__send {
    inline-size: auto;
    block-size: auto;
    background-color: transparent;
    color: var(--ds-device-accent);
}

.ds-conversation-device--messenger .ds-conversation-device__send svg {
    block-size: 24px;
}

/* -------------------------------------------------------------------------- */
/* Message row                                                                 */
/* -------------------------------------------------------------------------- */

/**
 * A message is a column: the avatar/bubble row, then the meta row. The sender name sits in the
 * bubble's column inside that row, directly above the bubble.
 *
 * The avatar shares the row with the bubble column and nothing else. That is what makes it align
 * to the bottom of the bubble rather than the bottom of the whole message, and what lets a larger
 * avatar grow upwards beside the name instead of pushing the name away from the bubble.
 */
.ds-conversation-message {
    display: flex;
    flex-direction: column;
    position: relative;
    max-width: 100%;

    /**
     * Every part of a message is as wide as it needs to be and no wider. The two rules below pick
     * the side it hugs; this is what a message falls back to when neither applies — without it the
     * default `stretch` hands the row the full width of the list, the row hands it to the bubble, and
     * a two-word message is drawn as a full-width slab.
     */
    align-items: flex-start;
}

.ds-conversation-message--left {
    align-items: flex-start;
    text-align: start;
}

.ds-conversation-message--right {
    align-items: flex-end;
    text-align: end;
}

.ds-conversation-message__row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-inline-size: var(--ds-conv-max-width);
}

.ds-conversation-message--left .ds-conversation-message__row {
    flex-direction: row;
}

.ds-conversation-message--right .ds-conversation-message__row {
    flex-direction: row-reverse;
}

/* One line of text: centre the avatar on the bubble. Measured in JS, because whether the text
   wraps depends on the available width. With no JavaScript the class is absent and the avatar
   bottom-aligns, which is the correct fallback. */
.ds-conversation-message--single-line .ds-conversation-message__row {
    align-items: center;
}

/**
 * Reactions overhang the bubble; padding on the row reserves the room they hang in, so the message
 * below is not sat on. The avatar aligns to the end of the row's content box, so the reservation
 * leaves it level with the bottom of the bubble rather than pushing it down with the chip.
 *
 * Exactly the overhang, no more: the chip's top edge is pinned to the bottom of the text (see the
 * rule further down), so what hangs below the bubble is the rest of the chip once the bubble's own
 * bottom padding is taken off it.
 */
.ds-conversation-message--has-reactions .ds-conversation-message__row {
    padding-block-end: calc(var(--ds-conv-reaction-height) - var(--ds-conv-pad-block));
}

/**
 * A centred avatar is centred on the bubble column, and the sender name above the bubble is part of
 * that column — so the avatar would sit half a name too high. A top margin as tall as the name takes
 * it back down onto the bubble's own centre. Only where the name is actually drawn: a message that
 * continues a run from the same side hides it (see the grouping rules further down).
 */
.ds-conversation-message--single-line:not(.ds-conversation-message--left + .ds-conversation-message--left):not(.ds-conversation-message--right + .ds-conversation-message--right) .ds-conversation-message__row:has(> .ds-conversation-message__body > .ds-conversation-message__sender) > .ds-conversation-message__avatar-wrap {
    margin-block-start: calc(var(--ds-conv-sender-size) * 1.3 + 3px);
}

/**
 * The slot the avatar occupies, and the empty slot a grouped message keeps so its bubbles stay
 * aligned. `--ds-conv-avatar-size` is the single source of truth for the avatar column: the skin
 * sets it, and a message that overrides the Avatar size redeclares it on itself (see the child's
 * ModuleStylesTrait). `min-block-size` rather than `block-size` so an avatar given a taller custom
 * height grows the slot with it instead of overflowing, while an empty slot keeps the full square.
 */
.ds-conversation-message__avatar-wrap {
    flex: 0 0 auto;
    inline-size: var(--ds-conv-avatar-size);
    min-block-size: var(--ds-conv-avatar-size);
}

.ds-conversation-message__avatar {
    display: block;
    inline-size: var(--ds-conv-avatar-size);
    block-size: var(--ds-conv-avatar-size);
    border-radius: var(--ds-conv-avatar-radius);
    object-fit: cover;
}

/**
 * The initial fills the same square the picture would, so a thread of messages lines up whether or
 * not each one has an avatar. Everything here is a skin default: the Avatar Initial design group
 * writes against the module order class, which outranks these single-class rules.
 */
.ds-conversation-message__initial {
    display: flex;
    align-items: center;
    justify-content: center;
    inline-size: var(--ds-conv-avatar-size);
    block-size: var(--ds-conv-avatar-size);
    border-radius: var(--ds-conv-avatar-radius);
    background-color: var(--ds-conv-initial-bg);
    color: var(--ds-conv-initial-color);
    font-size: var(--ds-conv-initial-size);
    font-weight: var(--ds-conv-initial-weight);
    line-height: 1;
    /* One letter in a small circle: no room for a descender to push it off centre. */
    text-align: center;
    text-transform: uppercase;
    user-select: none;
}

/**
 * Wraps the bubble only — the row above owns the max width.
 *
 * `align-items` is the same story as on the message itself: a flex column stretches its items by
 * default, and the bubble is one, so anything that made this box wider than the text — a reaction
 * hanging off the corner, a media group, a row the avatar had already sized — was passed straight on
 * to the bubble. Hugging the message's own side instead leaves the bubble sized by its content.
 */
.ds-conversation-message__body {
    position: relative;
    display: flex;
    flex-direction: column;
    min-inline-size: 0;
    max-inline-size: 100%;
}

.ds-conversation-message--left .ds-conversation-message__body {
    align-items: flex-start;
}

.ds-conversation-message--right .ds-conversation-message__body {
    align-items: flex-end;
}

.ds-conversation-message__sender {
    display: block;
    margin-block-end: 3px;
    margin-inline: 4px;
    color: var(--ds-conv-sender-color);
    font-size: var(--ds-conv-sender-size);
    line-height: 1.3;
}

/* -------------------------------------------------------------------------- */
/* Bubble                                                                      */
/* -------------------------------------------------------------------------- */

.ds-conversation-message__bubble {
    position: relative;
    display: inline-block;
    /**
     * `min()` rather than the variable alone: the floor must never outgrow the ceiling, or a bubble
     * in a column narrower than the floor would push its way out of the conversation instead of
     * wrapping inside it.
     */
    min-inline-size: min(var(--ds-conv-min-width), 100%);
    max-inline-size: 100%;
    padding: var(--ds-conv-pad-block) var(--ds-conv-pad-inline);
    border: var(--ds-conv-bubble-border);
    border-radius: var(--ds-conv-radius);
    box-shadow: var(--ds-conv-bubble-shadow);
    font-size: var(--ds-conv-font-size);
    line-height: var(--ds-conv-line-height);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

/**
 * Everything a chat style gives the bubble — colours here, padding, border, radius and shadow on
 * the rule above — is a default the message's own Design > Bubble settings replace. Those are
 * written against the message's order class, so the side is wrapped in `:where()` to keep these
 * rules at a single class: any value set in the settings wins, whatever the style.
 */
:where(.ds-conversation-message--left) .ds-conversation-message__bubble {
    background-color: var(--ds-conv-in-bg);
    color: var(--ds-conv-in-color);
}

:where(.ds-conversation-message--right) .ds-conversation-message__bubble {
    background-color: var(--ds-conv-out-bg);
    color: var(--ds-conv-out-color);
}

/**
 * The one corner that is not the settings' to round: the one a tail is drawn from. The tail's sharp
 * vertex is drawn to meet a square corner exactly, so any rounding there — the style's or the
 * settings' — would peel it away and leave a sliver of background between the two. Deliberately
 * more specific than the settings, and only where a tail is actually drawn: not with the tail
 * switched off, not on stickers and images, and not on a bubble that continues a run (only the last
 * one of a run has a tail). Neutral, Light, Dark and Minimal Messenger draw one only where the
 * message asks for it (Show Bubble Tail: Show). Every other corner takes the radius from the
 * settings.
 */
:where(.ds-conversation:not(.ds-conversation--neutral, .ds-conversation--wechat, .ds-conversation--dark, .ds-conversation--minimal)) .ds-conversation-message--left:not(.ds-conversation-message--no-tail, .ds-conversation-message--sticker, .ds-conversation-message--image, :has(+ .ds-conversation-message--left)) .ds-conversation-message__bubble,
:where(.ds-conversation--neutral, .ds-conversation--wechat, .ds-conversation--dark, .ds-conversation--minimal) .ds-conversation-message--left.ds-conversation-message--tail:not(.ds-conversation-message--sticker, .ds-conversation-message--image, :has(+ .ds-conversation-message--left)) .ds-conversation-message__bubble {
    border-end-start-radius: 0;
}

:where(.ds-conversation:not(.ds-conversation--neutral, .ds-conversation--wechat, .ds-conversation--dark, .ds-conversation--minimal)) .ds-conversation-message--right:not(.ds-conversation-message--no-tail, .ds-conversation-message--sticker, .ds-conversation-message--image, :has(+ .ds-conversation-message--right)) .ds-conversation-message__bubble,
:where(.ds-conversation--neutral, .ds-conversation--wechat, .ds-conversation--dark, .ds-conversation--minimal) .ds-conversation-message--right.ds-conversation-message--tail:not(.ds-conversation-message--sticker, .ds-conversation-message--image, :has(+ .ds-conversation-message--right)) .ds-conversation-message__bubble {
    border-end-end-radius: 0;
}

.ds-conversation-message__text > *:first-child {
    margin-block-start: 0;
    padding-block-start: 0;
}

.ds-conversation-message__text > *:last-child {
    margin-block-end: 0;
    padding-block-end: 0;
}

/**
 * Tail — drawn in the bubble's own background colour, so recolouring a bubble carries over.
 *
 * `--ds-conv-tail-color` is written onto the message by the Bubble group's background colour (see
 * `ModuleStylesTrait.php` and its Visual Builder twin). A border colour cannot be inherited from the
 * box the triangle hangs off, so it has to be handed over like this; the skin's own colour is the
 * fallback, which is what a bubble filled with a gradient or an image falls back to as well.
 *
 * The box sits flush against the bubble's tail-side corner (that corner is squared off above): one
 * border is the outward-facing inline side (transparent),
 * the other is the block-end (coloured), and together they form a right triangle whose vertical
 * edge runs flush along the bubble and whose point hangs below, outside it — verified by rendering
 * this exact rule in a browser rather than by eye, since this shape is easy to get mirror-swapped.
 */
.ds-conversation-message__bubble::after {
    content: "";
    position: absolute;
    inset-block-end: 0;
    inline-size: 0;
    block-size: 0;
    pointer-events: none;
}

.ds-conversation-message--left .ds-conversation-message__bubble::after {
    inset-inline-start: calc(var(--ds-conv-tail-size) * -1);
    border-inline-start: var(--ds-conv-tail-size) solid transparent;
    border-block-end: var(--ds-conv-tail-size) solid var(--ds-conv-tail-color, var(--ds-conv-in-bg));
}

.ds-conversation-message--right .ds-conversation-message__bubble::after {
    inset-inline-end: calc(var(--ds-conv-tail-size) * -1);
    border-inline-end: var(--ds-conv-tail-size) solid transparent;
    border-block-end: var(--ds-conv-tail-size) solid var(--ds-conv-tail-color, var(--ds-conv-out-bg));
}

.ds-conversation-message--no-tail .ds-conversation-message__bubble::after,
.ds-conversation-message--sticker .ds-conversation-message__bubble::after {
    display: none;
}

/* -------------------------------------------------------------------------- */
/* Consecutive messages from the same side read as one group                   */
/* -------------------------------------------------------------------------- */

.ds-conversation-message--left + .ds-conversation-message--left,
.ds-conversation-message--right + .ds-conversation-message--right {
    margin-block-start: calc(var(--ds-conv-group-gap) - var(--ds-conv-gap));
}

.ds-conversation-message--left + .ds-conversation-message--left .ds-conversation-message__sender,
.ds-conversation-message--right + .ds-conversation-message--right .ds-conversation-message__sender {
    display: none;
}

/**
 * Keep the slot so the bubbles stay aligned, but only the last message of a run shows the face —
 * the end of the run is where a real chat puts it, alongside the tail, which the rule below keeps
 * on that same message. The sender name stays at the top of the run, where the name of whoever is
 * about to speak belongs.
 *
 * "Last" means last *on screen*, not last in the markup. While a conversation plays in, the
 * messages that have not landed yet take up no space at all, so the face has to sit on the newest
 * message of the run and move down as the next one lands — which is what a live chat does. The test
 * is therefore on `.is-shown`, the class the player adds as each message arrives, rather than on
 * markup order: a run of three reads as one message with a face, then two, then three, with the
 * face travelling down.
 *
 * A message being typed does not take the face yet. Its row is hidden while the indicator is in the
 * box (see the `is-typing` rule further down), so there would be nothing to move the face onto; it
 * stays on the message before until the typed one actually lands.
 *
 * Without JavaScript nothing carries `.is-shown` and every face would show, so the `<noscript>`
 * block in `RenderCallbackTrait` restates this against markup order instead.
 */
.ds-conversation-message--left:has(+ .ds-conversation-message--left.is-shown) :is(.ds-conversation-message__avatar, .ds-conversation-message__initial),
.ds-conversation-message--right:has(+ .ds-conversation-message--right.is-shown) :is(.ds-conversation-message__avatar, .ds-conversation-message__initial) {
    visibility: hidden;
}

/* Only the last bubble of a run keeps its tail. Browsers without :has() keep every tail, which
   is a harmless fallback rather than a broken layout. */
.ds-conversation-message--left:has(+ .ds-conversation-message--left) .ds-conversation-message__bubble::after,
.ds-conversation-message--right:has(+ .ds-conversation-message--right) .ds-conversation-message__bubble::after {
    display: none;
}

/* -------------------------------------------------------------------------- */
/* Media, stickers and reactions                                               */
/* -------------------------------------------------------------------------- */

/**
 * Sticker and image messages render at a fixed square by default. This is only the default: the
 * Image / Sticker design group writes width, height and object-fit against the module order class,
 * which outranks these single-class rules, so the size stays fully adjustable per message.
 */
.ds-conversation-message__media {
    display: block;
    inline-size: var(--ds-conv-media-size);
    block-size: var(--ds-conv-media-size);
    max-inline-size: 100%;
    /* A photo in a bubble reads as a thumbnail, so it fills the square. */
    object-fit: cover;
    /* No frame of our own, and none inherited from a theme that borders every img. */
    border: 0;
    /* The picture now carries the bubble shape itself, so it takes the full radius. */
    border-radius: var(--ds-conv-radius);
}

/**
 * Several pictures in one bubble, arranged the way a chat app groups a photo burst.
 *
 * The images are laid out but never resized here: each one keeps the size from the rule above, and
 * therefore keeps whatever the Image / Sticker design group writes over it. Restating a size on the
 * group would tie with that rule on specificity and turn the outcome into a question of stylesheet
 * order, so the tracks are `auto` and the pictures size the grid rather than the other way round.
 */
.ds-conversation-message__media-group {
    /* Three across is the widest arrangement; the counts that read better narrower say so below. */
    --ds-conv-media-columns: 3;

    display: grid;
    grid-template-columns: repeat(var(--ds-conv-media-columns), auto);
    gap: var(--ds-conv-media-gap, 4px);
    /* Shrink to the pictures so the bubble does not stretch to the full message width. */
    inline-size: fit-content;
    max-inline-size: 100%;
}

.ds-conversation-message__media-group[data-count="1"] {
    --ds-conv-media-columns: 1;
}

/* Two side by side, and four as a square — both read better than a single row of four. */
.ds-conversation-message__media-group[data-count="2"],
.ds-conversation-message__media-group[data-count="4"] {
    --ds-conv-media-columns: 2;
}

/**
 * A group can outgrow a narrow bubble, so the pictures give up their fixed square there. `min-width`
 * on a grid item defaults to its content size, which would keep the images at full width and push
 * the group past the bubble instead of letting the columns shrink.
 */
.ds-conversation-message__media-group > .ds-conversation-message__media {
    min-inline-size: 0;
    max-inline-size: 100%;
}

/**
 * Image and sticker messages carry no bubble chrome — no padding ring, no background, no border,
 * no shadow and no tail. The picture is the message, so anything drawn around it reads as a frame.
 */
:where(.ds-conversation-message--image, .ds-conversation-message--sticker) .ds-conversation-message__bubble {
    padding: 0;
    background-color: transparent;
    border: 0;
    box-shadow: none;

    /* The picture is the message, so there is no bubble to keep a minimum width under. */
    min-inline-size: 0;
}

.ds-conversation-message--image .ds-conversation-message__bubble::after {
    display: none;
}

.ds-conversation-message--sticker .ds-conversation-message__media {
    /* A sticker is artwork on a transparent ground — fit it whole rather than cropping it. */
    object-fit: contain;
    border-radius: 0;
}

/**
 * The chip is anchored by its top edge to where the text ends, not by its bottom edge to the
 * bubble's. Hung from the bottom it rode up over the last line of the message; from here it sits in
 * the bubble's own bottom padding and hangs the rest of the way out, clear of every line of text.
 *
 * `100%` of an absolutely positioned child's containing block is the bubble's padding box, so
 * taking the bubble's bottom padding off it lands exactly on the last line's baseline box — which
 * means a restyled bubble padding or a resized reaction moves the chip with it rather than eating
 * into the message.
 */
.ds-conversation-message__reactions {
    position: absolute;
    inset-block-start: calc(100% - var(--ds-conv-pad-block));
    inset-inline-end: 8px;
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border: 1px solid var(--ds-conv-reaction-border);
    border-radius: 999px;
    background-color: var(--ds-conv-reaction-bg);
    font-size: var(--ds-conv-reaction-size);
    line-height: 1.5;
    white-space: nowrap;
}

.ds-conversation-message--left .ds-conversation-message__reactions {
    inset-inline-end: auto;
    inset-inline-start: 8px;
}

/* -------------------------------------------------------------------------- */
/* Meta row: timestamp + read status                                           */
/* -------------------------------------------------------------------------- */

/**
 * The meta row hangs from the bottom of the bubble column rather than sitting in it. In flow it
 * would be part of what the avatar is aligned against, and the avatar would line up with the
 * timestamp instead of the bubble. Out of flow it stays directly under the bubble — under the
 * reaction chip, when there is one — however large the avatar grows beside it.
 *
 * Being out of flow, it needs its room reserved: the message keeps a strip below the row as tall as
 * the meta line (its line box plus its top margin). Derived from the skin variable, like the
 * reaction height, because it has to be known before the meta row is laid out.
 */
.ds-conversation-message__meta {
    position: absolute;
    inset-block-start: 100%;
    inset-inline-start: 0;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-block-start: 3px;
    margin-inline: 4px;
    color: var(--ds-conv-meta-color);
    font-size: var(--ds-conv-meta-size);
    line-height: 1.3;
}

.ds-conversation-message--right .ds-conversation-message__meta {
    inset-inline-start: auto;
    inset-inline-end: 0;
}

/* The chip overhangs the bubble into the row's bottom padding, so the meta row goes below that. */
.ds-conversation-message--has-reactions .ds-conversation-message__meta {
    inset-block-start: calc(100% + var(--ds-conv-reaction-height) - var(--ds-conv-pad-block));
}

.ds-conversation-message:has(.ds-conversation-message__meta):not(.is-typing) {
    padding-block-end: calc(var(--ds-conv-meta-size) * 1.3 + 3px);
}

.ds-conversation-message__time {
    color: inherit;
    font-size: inherit;
}

.ds-conversation-message__status {
    display: inline-flex;
    color: var(--ds-conv-status-color);
    font-size: inherit;
    letter-spacing: -0.25em;
    padding-inline-end: 0.25em;
}

.ds-conversation-message__status[data-status="sent"]::before {
    content: "\2713";
}

.ds-conversation-message__status[data-status="delivered"]::before {
    content: "\2713\2713";
}

.ds-conversation-message__status[data-status="read"]::before {
    content: "\2713\2713";
    color: var(--ds-conv-status-read-color);
}

/* -------------------------------------------------------------------------- */
/* Typing simulation                                                           */
/* -------------------------------------------------------------------------- */

/**
 * While the module is armed, a message that has not been reached yet takes up no space at all.
 * That is what makes the conversation build the way a live chat does: each message lands at the
 * bottom and pushes the ones before it up, instead of fading in on ground already reserved for it.
 *
 * The rendered HTML always contains every message, which keeps the content available for search
 * engines and for visitors without JavaScript (see the `<noscript>` override the render callback
 * prints, which only has to put this one `display` back).
 */
.ds-conversation--sequenced .ds-conversation-message:not(.is-shown):not(.is-typing) {
    display: none;
}

/**
 * A message enters when its typing indicator lands in it, or -- for a message that does not type --
 * when it is shown. Both selectors carry the same animation, so a message that types first and then
 * reveals its content keeps the one entrance rather than starting over halfway through.
 */
/* Scaling from the bubble's own bottom corner makes it look like it grows out of the thread,
   rather than shrinking away from the edge it is aligned to. */
.ds-conversation--sequenced .ds-conversation-message--left.is-typing,
.ds-conversation--sequenced .ds-conversation-message--left.is-shown {
    transform-origin: 0 100%;
}

.ds-conversation--sequenced .ds-conversation-message--right.is-typing,
.ds-conversation--sequenced .ds-conversation-message--right.is-shown {
    transform-origin: 100% 100%;
}

.ds-conversation--sequenced .ds-conversation-message.is-typing,
.ds-conversation--sequenced .ds-conversation-message.is-shown {
    animation: ds-conversation-rise 0.42s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

/**
 * Room for the rise, so it does not make the list scroll.
 *
 * A message starts `--ds-conv-rise` below where it comes to rest, and a transform counts towards
 * scrollable overflow — so a conversation far too short to scroll still put a scrollbar on the list
 * for as long as anything was animating, which across a sequence is most of the time. Reserving the
 * distance as padding keeps the displaced message inside the scroll area, and the matching negative
 * margin takes the reservation back out of the layout so nothing moves. Same trick the list already
 * uses across its inline axis to make room for the bubble tails.
 */
:where(.ds-conversation--sequenced) .ds-conversation__list {
    padding-block-end: var(--ds-conv-rise);
    margin-block-end: calc(var(--ds-conv-rise) * -1);
}

/**
 * The plain conversation (Neutral, Auto): the room above the first message and below the last
 * lives inside the scrolling list, not in the module's padding — which picking the style seeds with
 * the sides only. In the padding it was a band at the top and bottom that the list could not scroll
 * into, and messages were cut off short of the card's edges.
 *
 * The bottom is at least as tall as the room the sequenced list keeps for the rise, which it
 * replaces. One class, and later in the file than the sequenced rule, so it replaces that — and
 * Design > Message List > Spacing, written against the order class, replaces this in turn.
 */
:where(:has(> .ds-conversation) > .ds-conversation) .ds-conversation__list {
    padding-block: 24px max(24px, var(--ds-conv-rise));
    margin-block-end: 0;
}

/**
 * While a message is being typed only the indicator is in the box, so the bubble is indicator-sized
 * and grows into the real message when the content lands.
 *
 * `is-typing` is added by the script and never rendered by the server, which is what keeps this
 * rule from ever applying without JavaScript -- so nothing here has to be undone for `<noscript>`,
 * and the grouped-message rule that hides a repeated sender name is left alone.
 */
.ds-conversation--sequenced .ds-conversation-message.is-typing > .ds-conversation-message__row {
    display: none;
}

/**
 * The message pops into place rather than merely sliding: it starts small and low, carries a little
 * past where it belongs, then settles.
 *
 * The overshoot is on the block axis only, and `scale` never passes 1. That is not a stylistic
 * choice — a transform counts towards scrollable overflow, and the list scrolls on one axis, which
 * makes the other scroll too. A bubble scaled to even 1.05 sticks out further than the 7px the list
 * reserves for tails and raises a horizontal scrollbar on a conversation with nothing to scroll.
 * Growing up to 1 and overshooting upwards both stay inside room that is already reserved.
 */
@keyframes ds-conversation-rise {
    0% {
        opacity: 0;
        transform: translateY(var(--ds-conv-rise)) scale(0.88);
    }

    55% {
        opacity: 1;
        transform: translateY(calc(var(--ds-conv-pop) * -1)) scale(1);
    }

    100% {
        opacity: 1;
        transform: none;
    }
}

/**
 * The read status and a reaction are things that happen after the message is sent, so the player
 * treats each as a beat of its own: one Delay Between Messages after the message lands it adds
 * `is-read`, one more and it adds `is-reacted`, and each pops in with a small overshoot.
 *
 * Hidden by scale rather than `display`, so each keeps its room and nothing shifts when it appears.
 * Keyed on `is-shown`, which only the script adds, so without JavaScript both are simply there. The
 * 1.1 overshoot stays well inside that room, so it raises no scrollbar.
 */
.ds-conversation--sequenced .ds-conversation-message.is-shown:not(.is-read) .ds-conversation-message__status,
.ds-conversation--sequenced .ds-conversation-message.is-shown:not(.is-reacted) .ds-conversation-message__reactions {
    transform: scale(0);
}

.ds-conversation--sequenced .ds-conversation-message.is-read .ds-conversation-message__status,
.ds-conversation--sequenced .ds-conversation-message.is-reacted .ds-conversation-message__reactions {
    animation: ds-conversation-react 0.45s ease-out both;
}

@keyframes ds-conversation-react {
    0% {
        transform: scale(0);
    }

    60% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}


/**
 * In flow, not absolute: the message it sits in has collapsed to nothing, so the indicator is what
 * gives the bubble its size while the message is being typed.
 */
.ds-conversation__typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px var(--ds-conv-pad-inline);
    border-radius: var(--ds-conv-radius);
    background-color: var(--ds-conv-tail-color, var(--ds-conv-in-bg));
    box-shadow: var(--ds-conv-bubble-shadow);

    /* The dots are drawn in the text colour of the message being typed (see the dot rule). */
    color: var(--ds-conv-text-color, var(--ds-conv-in-color));
}

/* The message is a flex column that already aligns its children to the correct edge, so the
   indicator needs no side of its own -- only the outgoing colour. Both follow a colour set in
   Design > Bubble through `--ds-conv-tail-color`, the same way the tail does, so the indicator is
   drawn in the colour of the bubble it turns into. */
.ds-conversation-message--right .ds-conversation__typing {
    background-color: var(--ds-conv-tail-color, var(--ds-conv-out-bg));
    color: var(--ds-conv-text-color, var(--ds-conv-out-color));
}

/* Clear the avatar column per message, so a message that hides its own avatar still lines up.
   Always the skin's column, whatever size this message gives its avatar (see the variable). */
.ds-conversation-message--with-avatar.ds-conversation-message--left .ds-conversation__typing {
    margin-inline-start: var(--ds-conv-typing-indent);
}

.ds-conversation-message--with-avatar.ds-conversation-message--right .ds-conversation__typing {
    margin-inline-end: var(--ds-conv-typing-indent);
}

.ds-conversation__typing-dot {
    inline-size: 6px;
    block-size: 6px;
    border-radius: 50%;

    /**
     * The message's own text colour at half strength, so the dots read on whatever bubble they sit
     * in — light on the dark outgoing bubbles, dark on the light ones, and in step with a colour set
     * in Design > Message Text. The bounce animates opacity on top of this, so a dot peaks at half
     * the text colour and rests at a sixth of it. Browsers without `color-mix()` keep the plain text
     * colour, which the animation still dims.
     */
    background-color: currentColor;
    background-color: color-mix(in srgb, currentColor 50%, transparent);
    animation: ds-conversation-typing 1.2s infinite ease-in-out;
}

.ds-conversation__typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.ds-conversation__typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes ds-conversation-typing {
    0%,
    60%,
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

/**
 * Reduced motion: no reveal choreography and no bouncing dots — everything is simply there.
 * Declared after the arming rules so it wins at equal specificity.
 */
@media (prefers-reduced-motion: reduce) {
    .ds-conversation--sequenced .ds-conversation-message:not(.is-shown):not(.is-typing) {
        display: flex;
    }

    .ds-conversation--sequenced .ds-conversation-message.is-typing,
    .ds-conversation--sequenced .ds-conversation-message.is-shown,
    .ds-conversation--sequenced .ds-conversation-message.is-read .ds-conversation-message__status,
    .ds-conversation--sequenced .ds-conversation-message.is-reacted .ds-conversation-message__reactions {
        animation: none;
    }

    .ds-conversation__typing {
        display: none;
    }

    .ds-conversation__typing-dot {
        animation: none;
    }
}

/* -------------------------------------------------------------------------- */
/* Skins                                                                       */
/* -------------------------------------------------------------------------- */

/* Auto renders as Material until the client resolves the real device, so the swap to iOS on an
   Apple device is the only visible change and page caching stays intact. */
.ds-conversation--android,
.ds-conversation--auto {
    --ds-conv-radius: 18px;
    --ds-conv-radius-tight: 4px;
    --ds-conv-in-bg: #e8def8;
    --ds-conv-in-color: #1d192b;
    --ds-conv-out-bg: #d3e3fd;
    --ds-conv-out-color: #041e49;
    --ds-conv-pad-block: 10px;
    --ds-conv-pad-inline: 16px;
    --ds-conv-meta-color: rgba(29, 25, 43, 0.55);
    --ds-conv-status-read-color: #0b57d0;
}

.ds-conversation--ios {
    --ds-conv-initial-bg: #c7c7cc;
    --ds-conv-initial-color: #ffffff;
    --ds-conv-radius: 20px;
    --ds-conv-radius-tight: 6px;
    --ds-conv-in-bg: #e9e9eb;
    --ds-conv-in-color: #000000;
    --ds-conv-out-bg: #0b93f6;
    --ds-conv-out-color: #ffffff;
    --ds-conv-pad-block: 8px;
    --ds-conv-pad-inline: 14px;
    --ds-conv-font-size: 16px;
    --ds-conv-tail-size: 8px;
    --ds-conv-meta-color: rgba(60, 60, 67, 0.6);
    --ds-conv-status-read-color: #0b93f6;
}

.ds-conversation--whatsapp {
    --ds-conv-initial-bg: #c9d4cc;
    --ds-conv-initial-color: #3b4a54;
    --ds-conv-radius: 8px;
    --ds-conv-radius-tight: 2px;
    --ds-conv-in-bg: #ffffff;
    --ds-conv-in-color: #111b21;
    --ds-conv-out-bg: #d9fdd3;
    --ds-conv-out-color: #111b21;
    --ds-conv-bubble-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
    --ds-conv-tail-size: 6px;
    --ds-conv-pad-block: 6px;
    --ds-conv-pad-inline: 9px;
    --ds-conv-meta-color: rgba(17, 27, 33, 0.45);
    --ds-conv-status-read-color: #53bdeb;
    --ds-conv-gap: 6px;
}

/* Text reads from the start of the bubble on both sides, as it does in the app. */
.ds-conversation--whatsapp .ds-conversation-message__text,
.ds-conversation--messenger .ds-conversation-message__text {
    text-align: start;
}

.ds-conversation--messenger {
    --ds-conv-initial-bg: #c4d3ec;
    --ds-conv-initial-color: #050505;
    --ds-conv-radius: 20px;
    --ds-conv-radius-tight: 4px;
    --ds-conv-in-bg: #f0f0f0;
    --ds-conv-in-color: #050505;
    --ds-conv-out-bg: #0866ff;
    --ds-conv-out-color: #ffffff;
    --ds-conv-pad-block: 8px;
    --ds-conv-pad-inline: 13px;
    --ds-conv-font-size: 16px;
    --ds-conv-avatar-size: 28px;
    --ds-conv-meta-color: rgba(5, 5, 5, 0.45);
    --ds-conv-status-read-color: #0866ff;
    --ds-conv-reaction-bg: #f0f0f0;
    --ds-conv-reaction-border: #ffffff;
    --ds-conv-gap: 6px;
}

/**
 * A Messenger run reads as one block: the corners where two bubbles from the same side meet
 * tighten, and the outer corners of the run stay round. The last bubble of the run carries the tail,
 * unless the message switches it off.
 */
.ds-conversation--messenger .ds-conversation-message--left:has(+ .ds-conversation-message--left) .ds-conversation-message__bubble {
    border-end-start-radius: var(--ds-conv-radius-tight);
}

.ds-conversation--messenger .ds-conversation-message--right:has(+ .ds-conversation-message--right) .ds-conversation-message__bubble {
    border-end-end-radius: var(--ds-conv-radius-tight);
}

.ds-conversation--messenger .ds-conversation-message--left + .ds-conversation-message--left .ds-conversation-message__bubble {
    border-start-start-radius: var(--ds-conv-radius-tight);
}

.ds-conversation--messenger .ds-conversation-message--right + .ds-conversation-message--right .ds-conversation-message__bubble {
    border-start-end-radius: var(--ds-conv-radius-tight);
}

/* Only the other person has a face in Messenger; your own messages run to the edge. */
.ds-conversation--messenger .ds-conversation-message--right .ds-conversation-message__avatar-wrap {
    display: none;
}

.ds-conversation--messenger .ds-conversation-message--right .ds-conversation__typing {
    margin-inline-end: 0;
}

/* A reaction hangs off the bubble's far corner on both sides. */
.ds-conversation--messenger .ds-conversation-message--left .ds-conversation-message__reactions {
    inset-inline-start: auto;
    inset-inline-end: 8px;
}

.ds-conversation--wechat {
    --ds-conv-tail-outline: #e2e4e8;
    --ds-conv-radius: 12px;
    --ds-conv-radius-tight: 12px;
    --ds-conv-bubble-border: 1px solid #e2e4e8;
    --ds-conv-avatar-radius: 10px;
    --ds-conv-initial-bg: #e6ecfb;
    --ds-conv-initial-color: #394a5f;
    --ds-conv-in-bg: #f9f9f9;
    --ds-conv-in-color: #394a5f;
    --ds-conv-out-bg: #6b93ff;
    --ds-conv-out-color: #ffffff;
    --ds-conv-avatar-size: 34px;
    --ds-conv-pad-block: 10px;
    --ds-conv-pad-inline: 14px;
    --ds-conv-sender-color: #394a5f;
    --ds-conv-meta-color: rgba(57, 74, 95, 0.6);
    --ds-conv-status-color: rgba(57, 74, 95, 0.5);
    --ds-conv-status-read-color: #6b93ff;
    --ds-conv-reaction-bg: #ffffff;
    --ds-conv-reaction-border: #e2e4e8;
    --ds-conv-gap: 8px;
}

.ds-conversation--dark {
    --ds-conv-tail-outline: #172b54;
    --ds-conv-radius: 12px;
    --ds-conv-radius-tight: 12px;
    --ds-conv-bubble-border: 1px solid #172b54;
    --ds-conv-avatar-radius: 10px;
    --ds-conv-initial-bg: #22365f;
    --ds-conv-initial-color: #e4eaf6;
    --ds-conv-in-bg: #13254a;
    --ds-conv-in-color: #c9d2e3;
    --ds-conv-out-bg: #6b93ff;
    --ds-conv-out-color: #ffffff;
    --ds-conv-avatar-size: 34px;
    --ds-conv-pad-block: 10px;
    --ds-conv-pad-inline: 14px;
    --ds-conv-sender-color: #c9d2e3;
    --ds-conv-meta-color: rgba(201, 210, 227, 0.5);
    --ds-conv-status-color: rgba(201, 210, 227, 0.5);
    --ds-conv-status-read-color: #8fadff;
    --ds-conv-reaction-bg: #1b3160;
    --ds-conv-reaction-border: #0f1b35;
    --ds-conv-gap: 8px;
}

.ds-conversation--minimal {
    --ds-conv-tail-outline: #e3e3ea;
    --ds-conv-initial-bg: #ebebf3;
    --ds-conv-initial-color: #3d3d5c;
    --ds-conv-radius: 0px;
    --ds-conv-radius-tight: 0px;
    --ds-conv-in-bg: #ffffff;
    --ds-conv-in-color: #3d3d5c;
    --ds-conv-out-bg: #ebebf3;
    --ds-conv-out-color: #3d3d5c;
    --ds-conv-bubble-border: 1px solid #e3e3ea;
    --ds-conv-pad-block: 12px;
    --ds-conv-pad-inline: 20px;
    --ds-conv-font-size: 16px;
    --ds-conv-line-height: 1.6;
    --ds-conv-sender-color: #3d3d5c;
    --ds-conv-meta-color: rgba(61, 61, 92, 0.5);
    --ds-conv-status-color: rgba(61, 61, 92, 0.45);
    --ds-conv-status-read-color: #4fc3a1;
    --ds-conv-reaction-bg: #ffffff;
    --ds-conv-reaction-border: #e3e3ea;
    --ds-conv-gap: 8px;
}

/* Minimal Messenger's outgoing block is a flat fill: its edge takes the fill's own colour. Like
   every style default, it gives way to the message's own Design > Bubble border. */
:where(.ds-conversation--minimal) :where(.ds-conversation-message--right) .ds-conversation-message__bubble {
    border-color: var(--ds-conv-out-bg);
}

/**
 * Light and Dark Messenger are desktop chat panels: one radius all round, and the outgoing bubble
 * edged in a deeper shade of its own blue rather than the grey hairline. Like every style default,
 * the edge gives way to the message's own Design > Bubble border.
 */

:where(.ds-conversation--wechat, .ds-conversation--dark) :where(.ds-conversation-message--right) .ds-conversation-message__bubble {
    --ds-conv-tail-outline: #5a84f5;

    border-color: #5a84f5;
}

/**
 * A bordered bubble's tail is outlined too. A border triangle cannot carry a border of its own, so
 * the outline is a pair of 1px shadows of the triangle itself, one out to the side and one down,
 * which trace its two outer edges; its inner edge overlaps the bubble's border, so bubble and tail
 * read as one outlined shape. Minimal's outgoing block has no visible edge, so its tail outline is
 * its own fill.
 */
:where(.ds-conversation--wechat, .ds-conversation--dark, .ds-conversation--minimal) :where(.ds-conversation-message--left) .ds-conversation-message__bubble::after {
    filter: drop-shadow(-1px 0 0 var(--ds-conv-tail-outline)) drop-shadow(0 1px 0 var(--ds-conv-tail-outline));
}

:where(.ds-conversation--minimal) :where(.ds-conversation-message--right) .ds-conversation-message__bubble {
    --ds-conv-tail-outline: var(--ds-conv-out-bg);
}

:where(.ds-conversation--wechat, .ds-conversation--dark, .ds-conversation--minimal) :where(.ds-conversation-message--right) .ds-conversation-message__bubble::after {
    filter: drop-shadow(1px 0 0 var(--ds-conv-tail-outline)) drop-shadow(0 1px 0 var(--ds-conv-tail-outline));
}

/* Neutral, Light, Dark and Minimal Messenger draw no tail by default; a message set to Show still
   gets one. */
:is(.ds-conversation--neutral, .ds-conversation--wechat, .ds-conversation--dark, .ds-conversation--minimal) .ds-conversation-message:not(.ds-conversation-message--tail) .ds-conversation-message__bubble::after {
    display: none;
}

/* -------------------------------------------------------------------------- */
/* Chat panel header — Light and Dark Messenger                                */
/* -------------------------------------------------------------------------- */

/**
 * A desktop messenger's title bar above the messages: who the chat is with (see
 * `DeviceSkinTrait::device_contact()`), a presence dot, and the call buttons. It sits in the flow
 * above the conversation, which takes the rest of the module's height and scrolls as before.
 */
.ds-conversation-panel {
    --ds-panel-ink: #394a5f;
    --ds-panel-muted: rgba(57, 74, 95, 0.75);
    --ds-panel-line: rgba(0, 0, 0, 0.08);
    --ds-panel-accent: #6b93ff;
    --ds-panel-ring: #ffffff;

    display: flex;
    flex-direction: column;
    block-size: 100%;
}

.ds-conversation-panel--dark {
    --ds-panel-ink: #e4eaf6;
    --ds-panel-muted: rgba(201, 210, 227, 0.8);
    --ds-panel-line: rgba(255, 255, 255, 0.1);
    --ds-panel-ring: #0f1b35;
}

.ds-conversation-panel > .ds-conversation {
    flex: 1 1 auto;
    block-size: auto;
    min-block-size: 0;
}

/**
 * The room below the last message lives inside the scrolling list, not in the module's padding
 * (which picking the style seeds without a bottom). In the padding it was a band the list could not
 * scroll into, and messages were cut off short of the card's edge. At least as tall as the room the
 * sequenced list keeps for the rise, which it replaces — as in the phone screen. Kept to one
 * class, so Design > Message List > Spacing still replaces it.
 */
:where(.ds-conversation-panel .ds-conversation) .ds-conversation__list {
    padding-block-end: max(24px, var(--ds-conv-rise));
    margin-block-end: 0;
}

.ds-conversation-panel__header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 12px;
    margin-block-end: 16px;
    padding-block-end: 16px;
    border-block-end: 1px solid var(--ds-panel-line);
    color: var(--ds-panel-ink);
}

.ds-conversation-panel__avatar {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    inline-size: 44px;
    block-size: 44px;
    border-radius: 50%;
    background-color: #e6ecfb;
    color: #394a5f;
    font-size: 17px;
    font-weight: 600;
    line-height: 1;
}

.ds-conversation-panel__avatar img {
    display: block;
    inline-size: 100%;
    block-size: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.ds-conversation-panel__avatar::after {
    content: "";
    position: absolute;
    inset-block-end: 0;
    inset-inline-end: 0;
    inline-size: 10px;
    block-size: 10px;
    border: 2px solid var(--ds-panel-ring);
    border-radius: 50%;
    background-color: var(--ds-panel-accent);
}

.ds-conversation-panel__title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-inline-size: 0;
}

.ds-conversation-panel__name {
    overflow: hidden;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ds-conversation-panel__subtitle {
    color: var(--ds-panel-muted);
    font-size: 13px;
    line-height: 1.3;
}

.ds-conversation-panel__actions {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 20px;
    margin-inline-start: auto;
}

.ds-conversation-panel__actions svg {
    display: block;
    inline-size: 20px;
    block-size: 20px;
    fill: currentColor;
}

/* -------------------------------------------------------------------------- */
/* Chat panel — Minimal Messenger                                              */
/* -------------------------------------------------------------------------- */

/**
 * A back chevron on the left; the contact's name, a presence ring and a small uppercase status on
 * the right, beside a large avatar; and a grey input row along the bottom. The card is seeded
 * without padding so the header and the input row run edge to edge, and the messages keep their
 * own room at the sides instead.
 */
.ds-conversation-panel--minimal {
    --ds-panel-ink: #3d3d5c;
    --ds-panel-muted: rgba(61, 61, 92, 0.55);
    --ds-panel-line: transparent;
    --ds-panel-accent: #4fc3a1;
}

.ds-conversation-panel--minimal > .ds-conversation {
    margin-inline: 24px;
}

/**
 * The module clips the panel, so the input row's square corners follow the card's rounded ones —
 * the same way the phone frame is clipped (see `:has(> .ds-conversation-device)`). The row runs
 * edge to edge here, which is what puts its corners in the card's corners.
 */
:has(> .ds-conversation-panel--minimal) {
    overflow: hidden;
}

.ds-conversation-panel--minimal .ds-conversation-panel__header {
    margin-block-end: 8px;
    padding: 20px 24px;
    border-block-end: 0;
}

.ds-conversation-panel__back {
    display: inline-flex;
    color: var(--ds-panel-muted);
}

.ds-conversation-panel__back svg {
    display: block;
    block-size: 18px;
    inline-size: auto;
}

/* Name and status to the right, stacked status-first and aligned to the avatar that follows. */
.ds-conversation-panel--minimal .ds-conversation-panel__title {
    align-items: flex-end;
    margin-inline-start: auto;
    text-align: end;
}

.ds-conversation-panel--minimal .ds-conversation-panel__subtitle {
    order: -1;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ds-conversation-panel--minimal .ds-conversation-panel__name {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 400;
}

/* Presence is a ring beside the name, not a dot on the avatar. */
.ds-conversation-panel--minimal .ds-conversation-panel__name::before {
    content: "";
    flex: 0 0 auto;
    inline-size: 8px;
    block-size: 8px;
    border: 2px solid var(--ds-panel-accent);
    border-radius: 50%;
}

.ds-conversation-panel--minimal .ds-conversation-panel__avatar {
    order: 1;
    inline-size: 56px;
    block-size: 56px;
    background-color: #ebebf3;
    color: #3d3d5c;
}

.ds-conversation-panel--minimal .ds-conversation-panel__avatar::after {
    display: none;
}

/**
 * The input row. Translucent rather than a solid grey, so it is tinted by the card colour it sits
 * on, like the dark phone chrome.
 */
.ds-conversation-panel__footer {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
    background-color: rgba(61, 61, 92, 0.08);
    color: var(--ds-panel-muted);
    font-size: 16px;
    line-height: 1.4;
}

.ds-conversation-panel__camera {
    display: block;
    flex: 0 0 auto;
    inline-size: 24px;
    block-size: 24px;
}

/* -------------------------------------------------------------------------- */
/* Misc                                                                        */
/* -------------------------------------------------------------------------- */

.ds-conversation-message__meta:empty {
    display: none;
}

/**
 * Builder-only affordance. A message with no text (or no image, for the sticker and image types)
 * is dropped from the frontend HTML entirely, so this hint never reaches a visitor — it only tells
 * the editor why the module they are looking at will not appear on the live page.
 */
.ds-conversation-message--empty .ds-conversation-message__bubble {
    border: 1px dashed currentColor;
    opacity: 0.6;
}

.ds-conversation-message__empty-hint {
    display: inline-block;
    font-size: 12px;
    font-style: italic;
    line-height: 1.4;
}

